2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_resample.cpp
|
|
|
|
/// @brief Resample Resolution dialogue box and logic
|
|
|
|
/// @ingroup tools_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2011-01-16 08:17:36 +01:00
|
|
|
#ifndef AGI_PRE
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#endif
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "ass_dialogue.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_file.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "ass_override.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_style.h"
|
|
|
|
#include "dialog_resample.h"
|
2011-01-16 08:17:36 +01:00
|
|
|
#include "include/aegisub/context.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "help_button.h"
|
|
|
|
#include "libresrc/libresrc.h"
|
|
|
|
#include "utils.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "validators.h"
|
2007-01-21 18:01:22 +01:00
|
|
|
#include "video_context.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-16 08:17:36 +01:00
|
|
|
// IDs
|
|
|
|
enum {
|
|
|
|
BUTTON_DEST_FROM_VIDEO = 1520,
|
|
|
|
CHECK_ANAMORPHIC,
|
|
|
|
CHECK_SYMMETRICAL,
|
|
|
|
TEXT_MARGIN_T,
|
|
|
|
TEXT_MARGIN_L,
|
|
|
|
TEXT_MARGIN_R,
|
|
|
|
TEXT_MARGIN_B
|
|
|
|
};
|
|
|
|
|
|
|
|
DialogResample::DialogResample(agi::Context *c)
|
|
|
|
: wxDialog(c->parent,-1,_("Resample resolution"),wxDefaultPosition)
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2007-07-05 01:09:40 +02:00
|
|
|
// Set icon
|
2009-07-25 06:49:59 +02:00
|
|
|
SetIcon(BitmapToIcon(GETIMAGE(resample_toolbutton_24)));
|
2007-07-05 01:09:40 +02:00
|
|
|
|
2007-10-18 04:47:13 +02:00
|
|
|
// Margins
|
|
|
|
MarginSymmetrical = NULL; // Do not remove this
|
|
|
|
wxSizer *MarginBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Margin offset"));
|
|
|
|
wxSizer *MarginSizer = new wxGridSizer(3,3,5,5);
|
|
|
|
MarginTop = new wxTextCtrl(this,TEXT_MARGIN_T,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
|
|
|
MarginLeft = new wxTextCtrl(this,TEXT_MARGIN_L,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
|
|
|
MarginSymmetrical = new wxCheckBox(this,CHECK_SYMMETRICAL,_("Symmetrical"));
|
|
|
|
MarginRight = new wxTextCtrl(this,TEXT_MARGIN_R,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
|
|
|
MarginBottom = new wxTextCtrl(this,TEXT_MARGIN_B,_T("0"),wxDefaultPosition,wxSize(50,-1),0);
|
|
|
|
MarginSizer->AddSpacer(1);
|
|
|
|
MarginSizer->Add(MarginTop,1,wxEXPAND);
|
|
|
|
MarginSizer->AddSpacer(1);
|
|
|
|
MarginSizer->Add(MarginLeft,1,wxEXPAND);
|
|
|
|
MarginSizer->Add(MarginSymmetrical,1,wxEXPAND);
|
|
|
|
MarginSizer->Add(MarginRight,1,wxEXPAND);
|
|
|
|
MarginSizer->AddSpacer(1);
|
|
|
|
MarginSizer->Add(MarginBottom,1,wxEXPAND);
|
|
|
|
MarginSizer->AddSpacer(1);
|
|
|
|
MarginBoxSizer->Add(MarginSizer,1,wxALIGN_CENTER|wxBOTTOM,5);
|
|
|
|
MarginSymmetrical->SetValue(true);
|
|
|
|
MarginRight->Enable(false);
|
|
|
|
MarginBottom->Enable(false);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-10-18 04:47:13 +02:00
|
|
|
// Resolution
|
2006-01-16 22:02:54 +01:00
|
|
|
wxSizer *ResBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Resolution"));
|
|
|
|
wxSizer *ResSizer = new wxBoxSizer(wxHORIZONTAL);
|
2006-07-01 09:22:57 +02:00
|
|
|
int sw,sh;
|
2011-01-16 08:17:36 +01:00
|
|
|
c->ass->GetResolution(sw,sh);
|
2011-01-20 06:57:30 +01:00
|
|
|
ResX = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(50,-1),0,NumValidator(wxString::Format("%i",sw)));
|
|
|
|
ResY = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(50,-1),0,NumValidator(wxString::Format("%i",sh)));
|
2006-01-16 22:02:54 +01:00
|
|
|
wxStaticText *ResText = new wxStaticText(this,-1,_("x"));
|
|
|
|
wxButton *FromVideo = new wxButton(this,BUTTON_DEST_FROM_VIDEO,_("From video"));
|
2011-01-21 05:57:21 +01:00
|
|
|
if (!c->videoController->IsLoaded()) FromVideo->Enable(false);
|
2006-01-16 22:02:54 +01:00
|
|
|
ResSizer->Add(ResX,1,wxRIGHT,5);
|
|
|
|
ResSizer->Add(ResText,0,wxALIGN_CENTER | wxRIGHT,5);
|
|
|
|
ResSizer->Add(ResY,1,wxRIGHT,5);
|
|
|
|
ResSizer->Add(FromVideo,1,0,0);
|
|
|
|
Anamorphic = new wxCheckBox(this,CHECK_ANAMORPHIC,_("Change aspect ratio"));
|
|
|
|
ResBoxSizer->Add(ResSizer,1,wxEXPAND|wxBOTTOM,5);
|
|
|
|
ResBoxSizer->Add(Anamorphic,0,0,0);
|
|
|
|
|
|
|
|
// Button sizer
|
2007-10-18 17:42:07 +02:00
|
|
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
|
|
|
ButtonSizer->AddButton(new wxButton(this,wxID_OK));
|
|
|
|
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
2008-01-13 22:05:31 +01:00
|
|
|
ButtonSizer->AddButton(new HelpButton(this,_T("Resample")));
|
2007-10-18 17:42:07 +02:00
|
|
|
ButtonSizer->Realize();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Main sizer
|
|
|
|
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
2007-10-18 04:47:13 +02:00
|
|
|
MainSizer->Add(MarginBoxSizer,1,wxEXPAND|wxALL,5);
|
|
|
|
MainSizer->Add(ResBoxSizer,0,wxEXPAND|wxALL,5);
|
2006-01-16 22:02:54 +01:00
|
|
|
MainSizer->Add(ButtonSizer,0,wxEXPAND|wxRIGHT|wxLEFT|wxBOTTOM,5);
|
|
|
|
MainSizer->SetSizeHints(this);
|
|
|
|
SetSizer(MainSizer);
|
|
|
|
CenterOnParent();
|
2007-10-18 04:47:13 +02:00
|
|
|
instance = this;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Event table
|
|
|
|
BEGIN_EVENT_TABLE(DialogResample,wxDialog)
|
2007-10-18 17:42:07 +02:00
|
|
|
EVT_BUTTON(wxID_OK,DialogResample::OnResample)
|
2006-01-16 22:02:54 +01:00
|
|
|
EVT_BUTTON(BUTTON_DEST_FROM_VIDEO,DialogResample::OnGetDestRes)
|
2007-10-18 04:47:13 +02:00
|
|
|
EVT_CHECKBOX(CHECK_SYMMETRICAL,DialogResample::OnSymmetrical)
|
|
|
|
EVT_TEXT(TEXT_MARGIN_T,DialogResample::OnMarginChange)
|
|
|
|
EVT_TEXT(TEXT_MARGIN_L,DialogResample::OnMarginChange)
|
|
|
|
EVT_TEXT(TEXT_MARGIN_R,DialogResample::OnMarginChange)
|
|
|
|
EVT_TEXT(TEXT_MARGIN_B,DialogResample::OnMarginChange)
|
2006-01-16 22:02:54 +01:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Resample tags
|
|
|
|
/// @param name
|
|
|
|
/// @param n
|
|
|
|
/// @param curParam
|
|
|
|
/// @param _curDiag
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogResample::ResampleTags (wxString name,int n,AssOverrideParameter *curParam,void *_curDiag) {
|
2007-10-18 04:47:13 +02:00
|
|
|
instance->DoResampleTags(name,n,curParam,_curDiag);
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param name
|
|
|
|
/// @param n
|
|
|
|
/// @param curParam
|
|
|
|
/// @param _curDiag
|
|
|
|
/// @return
|
|
|
|
///
|
2007-10-18 04:47:13 +02:00
|
|
|
void DialogResample::DoResampleTags (wxString name,int n,AssOverrideParameter *curParam,void *_curDiag) {
|
2006-01-16 22:02:54 +01:00
|
|
|
double resizer = 1.0;
|
2007-10-18 04:47:13 +02:00
|
|
|
bool isX = false;
|
|
|
|
bool isY = false;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
switch (curParam->classification) {
|
|
|
|
case PARCLASS_ABSOLUTE_SIZE:
|
|
|
|
resizer = r;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARCLASS_ABSOLUTE_POS_X:
|
|
|
|
resizer = rx;
|
2007-10-18 04:47:13 +02:00
|
|
|
isX = true;
|
2006-01-16 22:02:54 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PARCLASS_ABSOLUTE_POS_Y:
|
|
|
|
resizer = ry;
|
2007-10-18 04:47:13 +02:00
|
|
|
isY = true;
|
2006-01-16 22:02:54 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PARCLASS_RELATIVE_SIZE_X:
|
|
|
|
resizer = ar;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARCLASS_RELATIVE_SIZE_Y:
|
|
|
|
//resizer = ry;
|
2008-01-14 01:30:00 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PARCLASS_DRAWING:
|
|
|
|
{
|
|
|
|
AssDialogueBlockDrawing block;
|
2010-06-16 08:20:06 +02:00
|
|
|
block.text = curParam->Get<wxString>();
|
2008-01-14 01:30:00 +01:00
|
|
|
block.TransformCoords(m[0],m[2],rx,ry);
|
2010-06-16 08:20:06 +02:00
|
|
|
curParam->Set(block.GetText());
|
2008-01-14 01:30:00 +01:00
|
|
|
}
|
|
|
|
return;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
VariableDataType curType = curParam->GetType();
|
|
|
|
if (curType == VARDATA_FLOAT) {
|
2010-06-16 08:20:06 +02:00
|
|
|
float par = curParam->Get<double>();
|
2007-10-18 04:47:13 +02:00
|
|
|
if (isX) par += m[0];
|
|
|
|
if (isY) par += m[2];
|
2010-06-16 08:20:06 +02:00
|
|
|
curParam->Set<double>(par * resizer);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
if (curType == VARDATA_INT) {
|
2010-06-16 08:20:06 +02:00
|
|
|
int par = curParam->Get<int>();
|
2007-10-18 04:47:13 +02:00
|
|
|
if (isX) par += m[0];
|
|
|
|
if (isY) par += m[2];
|
2010-06-16 08:20:06 +02:00
|
|
|
curParam->Set<int>(int(double(par) * resizer + 0.5));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Resample
|
|
|
|
/// @param event
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogResample::OnResample (wxCommandEvent &event) {
|
2006-07-01 09:22:57 +02:00
|
|
|
int x1,y1;
|
2011-01-16 08:17:36 +01:00
|
|
|
c->ass->GetResolution(x1,y1);
|
2006-01-16 22:02:54 +01:00
|
|
|
long x2 = 0;
|
|
|
|
long y2 = 0;
|
|
|
|
ResX->GetValue().ToLong(&x2);
|
|
|
|
ResY->GetValue().ToLong(&y2);
|
|
|
|
|
2008-01-11 04:33:23 +01:00
|
|
|
// Sanity check
|
|
|
|
if (x1 == 0 || y1 == 0) {
|
|
|
|
wxMessageBox(_T("Invalid source resolution. This should not happen. Please contact the developers."),_("Error"),wxCENTRE|wxICON_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (x2 == 0 || y2 == 0) {
|
|
|
|
wxMessageBox(_("Invalid resolution: destination resolution cannot be 0 on either dimension."),_("Error"),wxCENTRE|wxICON_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-10-18 04:47:13 +02:00
|
|
|
// Get margins
|
|
|
|
MarginLeft->GetValue().ToLong(&m[0]);
|
|
|
|
MarginRight->GetValue().ToLong(&m[1]);
|
|
|
|
MarginTop->GetValue().ToLong(&m[2]);
|
|
|
|
MarginBottom->GetValue().ToLong(&m[3]);
|
|
|
|
|
2007-10-18 18:33:46 +02:00
|
|
|
// Add margins to original resolution
|
|
|
|
x1 += m[0] + m[1];
|
|
|
|
x2 += m[2] + m[3];
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Calculate resamples
|
|
|
|
rx = double(x2)/double(x1);
|
|
|
|
ry = double(y2)/double(y1);
|
|
|
|
r = ry;
|
|
|
|
if (Anamorphic->IsChecked()) ar = rx/ry;
|
|
|
|
else ar = 1.0;
|
|
|
|
|
|
|
|
// Iterate through subs
|
|
|
|
AssStyle *curStyle;
|
|
|
|
AssDialogue *curDiag;
|
2011-01-16 08:17:36 +01:00
|
|
|
for (entryIter cur=c->ass->Line.begin();cur!=c->ass->Line.end();cur++) {
|
2006-01-16 22:02:54 +01:00
|
|
|
// Apply to dialogues
|
2010-05-19 02:44:52 +02:00
|
|
|
curDiag = dynamic_cast<AssDialogue*>(*cur);
|
2007-08-03 19:32:23 +02:00
|
|
|
if (curDiag && !(curDiag->Comment && (curDiag->Effect.StartsWith(_T("template")) || curDiag->Effect.StartsWith(_T("code"))))) {
|
2006-01-16 22:02:54 +01:00
|
|
|
try {
|
|
|
|
// Override tags
|
|
|
|
curDiag->ParseASSTags();
|
2007-10-18 04:47:13 +02:00
|
|
|
curDiag->ProcessParameters(&DialogResample::ResampleTags,curDiag);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Drawing tags
|
|
|
|
size_t nblocks = curDiag->Blocks.size();
|
|
|
|
AssDialogueBlockDrawing *curBlock;
|
|
|
|
for (size_t i=0;i<nblocks;i++) {
|
2010-06-04 05:07:52 +02:00
|
|
|
curBlock = dynamic_cast<AssDialogueBlockDrawing*>(curDiag->Blocks.at(i));
|
2006-01-16 22:02:54 +01:00
|
|
|
if (curBlock) {
|
2007-10-18 04:47:13 +02:00
|
|
|
curBlock->TransformCoords(m[0],m[2],rx,ry);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Margins
|
2007-01-05 19:27:15 +01:00
|
|
|
for (int i=0;i<2;i++) {
|
2007-10-18 04:47:13 +02:00
|
|
|
curDiag->Margin[i] = int((curDiag->Margin[i]+m[i]) * rx + 0.5);
|
|
|
|
curDiag->Margin[i+2] = int((curDiag->Margin[i+2]+m[i+2]) * ry + 0.5);
|
2007-01-05 19:27:15 +01:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Update
|
|
|
|
curDiag->UpdateText();
|
2006-02-21 04:13:35 +01:00
|
|
|
curDiag->ClearBlocks();
|
2006-01-16 22:02:54 +01:00
|
|
|
continue;
|
|
|
|
}
|
2006-04-14 18:46:38 +02:00
|
|
|
catch (const wchar_t *err) {
|
2006-01-16 22:02:54 +01:00
|
|
|
wxLogMessage(err);
|
|
|
|
}
|
|
|
|
catch (wxString err) {
|
|
|
|
wxLogMessage(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply to styles
|
2010-05-19 02:44:52 +02:00
|
|
|
curStyle = dynamic_cast<AssStyle*>(*cur);
|
2006-01-16 22:02:54 +01:00
|
|
|
if (curStyle) {
|
|
|
|
curStyle->fontsize = int(curStyle->fontsize * r + 0.5);
|
2007-10-18 04:47:13 +02:00
|
|
|
curStyle->outline_w *= r;
|
|
|
|
curStyle->shadow_w *= r;
|
2006-01-16 22:02:54 +01:00
|
|
|
curStyle->spacing *= rx;
|
|
|
|
curStyle->scalex *= ar;
|
2007-10-18 04:47:13 +02:00
|
|
|
for (int i=0;i<2;i++) {
|
|
|
|
curStyle->Margin[i] = int((curStyle->Margin[i]+m[i]) * rx + 0.5);
|
|
|
|
curStyle->Margin[i+2] = int((curStyle->Margin[i+2]+m[i+2]) * ry + 0.5);
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
curStyle->UpdateData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change script resolution
|
2011-01-16 08:17:36 +01:00
|
|
|
c->ass->SetScriptInfo(_T("PlayResX"),wxString::Format(_T("%i"),x2));
|
|
|
|
c->ass->SetScriptInfo(_T("PlayResY"),wxString::Format(_T("%i"),y2));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Flag as modified
|
2011-01-16 08:17:36 +01:00
|
|
|
c->ass->Commit(_("resolution resampling"), AssFile::COMMIT_TEXT);
|
2006-01-16 22:02:54 +01:00
|
|
|
EndModal(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Get destination resolution from video
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogResample::OnGetDestRes (wxCommandEvent &event) {
|
2011-01-21 05:57:21 +01:00
|
|
|
ResX->SetValue(wxString::Format(_T("%i"),c->videoController->GetWidth()));
|
|
|
|
ResY->SetValue(wxString::Format(_T("%i"),c->videoController->GetHeight()));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Symmetrical checkbox clicked
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-10-18 04:47:13 +02:00
|
|
|
void DialogResample::OnSymmetrical (wxCommandEvent &event) {
|
|
|
|
bool state = !MarginSymmetrical->IsChecked();
|
|
|
|
MarginRight->Enable(state);
|
|
|
|
MarginBottom->Enable(state);
|
|
|
|
if (!state) {
|
|
|
|
MarginRight->SetValue(MarginLeft->GetValue());
|
|
|
|
MarginBottom->SetValue(MarginTop->GetValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Margin value changed
|
|
|
|
/// @param event
|
|
|
|
/// @return
|
|
|
|
///
|
2007-10-18 04:47:13 +02:00
|
|
|
void DialogResample::OnMarginChange (wxCommandEvent &event) {
|
|
|
|
if (!MarginSymmetrical) return;
|
|
|
|
bool state = !MarginSymmetrical->IsChecked();
|
|
|
|
if (!state && (event.GetEventObject() == MarginLeft || event.GetEventObject() == MarginTop)) {
|
|
|
|
MarginRight->SetValue(MarginLeft->GetValue());
|
|
|
|
MarginBottom->SetValue(MarginTop->GetValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// DOCME
|
2007-10-18 04:47:13 +02:00
|
|
|
DialogResample *DialogResample::instance = NULL;
|