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_shift_times.cpp
|
|
|
|
/// @brief Shift Times dialogue box and logic
|
|
|
|
/// @ingroup secondary_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
///////////
|
|
|
|
// Headers
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2006-03-14 05:23:00 +01:00
|
|
|
#include <algorithm>
|
2009-09-10 15:06:40 +02:00
|
|
|
#include <fstream>
|
2006-03-14 05:23:00 +01:00
|
|
|
#include <string>
|
2009-09-10 15:06:40 +02:00
|
|
|
|
2007-06-21 02:46:50 +02:00
|
|
|
#include <wx/filefn.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#include <wx/filename.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ass_dialogue.h"
|
|
|
|
#include "ass_file.h"
|
|
|
|
#include "ass_time.h"
|
|
|
|
#include "charset_conv.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "dialog_shift_times.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "help_button.h"
|
|
|
|
#include "libresrc/libresrc.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "main.h"
|
2007-06-21 02:46:50 +02:00
|
|
|
#include "standard_paths.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subs_grid.h"
|
2007-07-05 01:09:40 +02:00
|
|
|
#include "utils.h"
|
2010-07-08 06:29:04 +02:00
|
|
|
#include "video_context.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "video_display.h"
|
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 Constructor
|
|
|
|
/// @param parent
|
|
|
|
/// @param _grid
|
|
|
|
///
|
2007-01-21 18:01:22 +01:00
|
|
|
DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid)
|
2006-01-16 22:02:54 +01:00
|
|
|
: wxDialog(parent, -1, _("Shift Times"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("JumpTo"))
|
|
|
|
{
|
2007-07-05 01:09:40 +02:00
|
|
|
// Set icon
|
2009-07-25 06:49:59 +02:00
|
|
|
SetIcon(BitmapToIcon(GETIMAGE(shift_times_toolbutton_24)));
|
2007-07-05 01:09:40 +02:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Set initial values
|
|
|
|
ready = true;
|
|
|
|
grid = _grid;
|
|
|
|
shiftframe = 0;
|
2007-09-24 19:40:03 +02:00
|
|
|
|
|
|
|
// Static-box sizers before anything else
|
|
|
|
wxSizer *TimesSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Shift by"));
|
|
|
|
wxSizer *HistorySizer = new wxStaticBoxSizer(wxVERTICAL,this,_("History"));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Times
|
2007-09-24 19:40:03 +02:00
|
|
|
RadioTime = new wxRadioButton(this,RADIO_TIME,_("Time: "),wxDefaultPosition,wxDefaultSize, wxRB_GROUP);
|
|
|
|
RadioFrames = new wxRadioButton(this,RADIO_FRAME,_("Frames: "),wxDefaultPosition,wxDefaultSize);
|
|
|
|
ShiftTime = new TimeEdit(this,TEXT_SHIFT_TIME,_T(""),wxDefaultPosition,wxDefaultSize);
|
|
|
|
ShiftFrame = new wxTextCtrl(this,TEXT_SHIFT_FRAME,wxString::Format(_T("%i"),shiftframe),wxDefaultPosition,wxDefaultSize);
|
2006-01-16 22:02:54 +01:00
|
|
|
ShiftTime->SetToolTip(_("Enter time in h:mm:ss.cs notation"));
|
|
|
|
RadioTime->SetToolTip(_("Shift by time"));
|
|
|
|
ShiftFrame->Disable();
|
2010-07-08 06:29:04 +02:00
|
|
|
if (!VideoContext::Get()->TimecodesLoaded()) RadioFrames->Disable();
|
2006-01-16 22:02:54 +01:00
|
|
|
else {
|
|
|
|
ShiftFrame->SetToolTip(_("Enter number of frames to shift by"));
|
|
|
|
RadioFrames->SetToolTip(_("Shift by frames"));
|
|
|
|
}
|
2007-09-24 19:40:03 +02:00
|
|
|
wxSizer *TimeFrameSizer = new wxFlexGridSizer(2,2,5,5);
|
|
|
|
TimeFrameSizer->Add(RadioTime,0,wxALIGN_CENTER_VERTICAL,0);
|
|
|
|
TimeFrameSizer->Add(ShiftTime,1);
|
|
|
|
TimeFrameSizer->Add(RadioFrames,0,wxALIGN_CENTER_VERTICAL,0);
|
|
|
|
TimeFrameSizer->Add(ShiftFrame,1);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Direction
|
|
|
|
DirectionForward = new wxRadioButton(this,-1,_("Forward"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
|
|
|
|
DirectionBackward = new wxRadioButton(this,-1,_("Backward"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
DirectionForward->SetToolTip(_("Shifts subs forward, making them appear later. Use if they are appearing too soon."));
|
|
|
|
DirectionBackward->SetToolTip(_("Shifts subs backward, making them appear earlier. Use if they are appearing too late."));
|
|
|
|
wxSizer *DirectionSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
DirectionSizer->Add(DirectionForward,1,wxEXPAND,0);
|
|
|
|
DirectionSizer->Add(DirectionBackward,1,wxLEFT | wxEXPAND,5);
|
2007-09-24 19:40:03 +02:00
|
|
|
TimesSizer->Add(TimeFrameSizer,0,wxEXPAND,0);
|
2006-01-16 22:02:54 +01:00
|
|
|
TimesSizer->Add(DirectionSizer,0,wxEXPAND | wxTOP,5);
|
|
|
|
|
|
|
|
// Selection
|
2006-12-30 19:53:19 +01:00
|
|
|
wxString SelChoices[3] = { _("All rows"), _("Selected rows"), _("Selection onward") };
|
|
|
|
SelChoice = new wxRadioBox(this,-1,_("Affect"), wxDefaultPosition, wxDefaultSize, 3, SelChoices, 3, wxRA_SPECIFY_ROWS);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Times
|
|
|
|
wxString TimesChoices[3] = { _("Start and End times"), _("Start times only"), _("End times only") };
|
|
|
|
TimesChoice = new wxRadioBox(this,-1,_("Times"), wxDefaultPosition, wxDefaultSize, 3, TimesChoices, 3, wxRA_SPECIFY_ROWS);
|
|
|
|
|
|
|
|
// History
|
2006-03-13 23:36:27 +01:00
|
|
|
History = new wxListBox(this,-1,wxDefaultPosition,wxSize(350,100), 0, NULL, wxLB_HSCROLL);
|
2008-01-13 23:25:26 +01:00
|
|
|
wxButton *ClearButton = new wxButton(this,SHIFT_CLEAR_HISTORY,_("Clear"));
|
2006-01-16 22:02:54 +01:00
|
|
|
HistorySizer->Add(History,1,wxEXPAND,0);
|
2008-01-13 23:25:26 +01:00
|
|
|
HistorySizer->Add(ClearButton,0,wxEXPAND,0);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Buttons
|
2008-01-13 23:25:26 +01:00
|
|
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
|
|
|
ButtonSizer->AddButton(new wxButton(this,wxID_OK));
|
|
|
|
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
|
|
|
ButtonSizer->AddButton(new HelpButton(this,_T("Shift Times")));
|
|
|
|
ButtonSizer->Realize();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// General layout
|
|
|
|
wxSizer *LeftSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
wxSizer *RightSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
LeftSizer->Add(TimesSizer,0,wxEXPAND | wxBOTTOM,5);
|
|
|
|
LeftSizer->Add(SelChoice,0,wxEXPAND | wxBOTTOM,5);
|
|
|
|
LeftSizer->Add(TimesChoice,0,wxEXPAND,5);
|
|
|
|
RightSizer->Add(HistorySizer,0,wxEXPAND,0);
|
|
|
|
TopSizer->Add(LeftSizer,0,wxEXPAND | wxRIGHT,5);
|
|
|
|
TopSizer->Add(RightSizer,0,wxEXPAND,0);
|
|
|
|
MainSizer->Add(TopSizer,0,wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT,5);
|
|
|
|
MainSizer->Add(ButtonSizer,0,wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT,5);
|
|
|
|
|
|
|
|
// Set sizer
|
|
|
|
SetSizer(MainSizer);
|
|
|
|
MainSizer->SetSizeHints(this);
|
|
|
|
CenterOnParent();
|
|
|
|
|
|
|
|
// Load values from options
|
2010-06-24 08:26:44 +02:00
|
|
|
if (!OPT_GET("Tool/Shift Times/ByTime")->GetBool()) {
|
2006-01-16 22:02:54 +01:00
|
|
|
if (RadioFrames->IsEnabled()) {
|
|
|
|
RadioFrames->SetValue(true);
|
|
|
|
ShiftFrame->Enable(true);
|
|
|
|
ShiftTime->Enable(false);
|
2010-05-21 03:13:36 +02:00
|
|
|
ShiftFrame->SetValue(AegiIntegerToString(OPT_GET("Tool/Shift Times/Length")->GetInt()));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2010-05-21 03:13:36 +02:00
|
|
|
ShiftTime->SetTime(OPT_GET("Tool/Shift Times/Length")->GetInt());
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
2010-05-21 03:13:36 +02:00
|
|
|
TimesChoice->SetSelection(OPT_GET("Tool/Shift Times/Type")->GetInt());
|
|
|
|
SelChoice->SetSelection(OPT_GET("Tool/Shift Times/Affect")->GetInt());
|
2010-06-24 08:26:44 +02:00
|
|
|
if (OPT_GET("Tool/Shift Times/Direction")->GetBool()) DirectionBackward->SetValue(true);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-12-30 19:53:19 +01:00
|
|
|
// Has selection?
|
|
|
|
wxArrayInt sel = grid->GetSelection();
|
|
|
|
if (sel.Count() == 0) {
|
|
|
|
SelChoice->Enable(1,false);
|
|
|
|
SelChoice->Enable(2,false);
|
|
|
|
SelChoice->SetSelection(0);
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Load history
|
2007-06-21 02:46:50 +02:00
|
|
|
LoadHistory(StandardPaths::DecodePath(_T("?user/shift_history.txt")));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Event table
|
|
|
|
BEGIN_EVENT_TABLE(DialogShiftTimes, wxDialog)
|
|
|
|
EVT_BUTTON(wxID_CANCEL,DialogShiftTimes::OnClose)
|
|
|
|
EVT_BUTTON(wxID_OK,DialogShiftTimes::OnOK)
|
2007-01-17 07:18:12 +01:00
|
|
|
EVT_BUTTON(SHIFT_CLEAR_HISTORY,DialogShiftTimes::OnClear)
|
2006-01-16 22:02:54 +01:00
|
|
|
EVT_RADIOBUTTON(RADIO_TIME,DialogShiftTimes::OnRadioTime)
|
|
|
|
EVT_RADIOBUTTON(RADIO_FRAME,DialogShiftTimes::OnRadioFrame)
|
|
|
|
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 Clear History
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-01-17 07:18:12 +01:00
|
|
|
void DialogShiftTimes::OnClear(wxCommandEvent &event) {
|
2007-06-21 02:46:50 +02:00
|
|
|
wxRemoveFile(StandardPaths::DecodePath(_T("?user/shift_history.txt")));
|
2007-01-17 07:18:12 +01:00
|
|
|
History->Clear();
|
|
|
|
}
|
|
|
|
|
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 Cancel
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogShiftTimes::OnClose(wxCommandEvent &event) {
|
|
|
|
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 Apply
|
|
|
|
/// @param event
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
|
|
|
// General values
|
|
|
|
int type = TimesChoice->GetSelection();
|
2006-12-30 19:53:19 +01:00
|
|
|
int affect = SelChoice->GetSelection();
|
|
|
|
bool allrows = affect == 0;
|
|
|
|
bool selOnward = affect == 2;
|
2006-01-16 22:02:54 +01:00
|
|
|
long len;
|
|
|
|
bool byTime = RadioTime->GetValue();
|
|
|
|
bool backward = DirectionBackward->GetValue();
|
|
|
|
bool didSomething = false;
|
|
|
|
|
2006-12-30 19:53:19 +01:00
|
|
|
// Selection
|
|
|
|
int nrows = grid->GetRows();
|
|
|
|
wxArrayInt sel = grid->GetSelection();
|
|
|
|
int firstSel = 0;
|
|
|
|
if (sel.Count()) firstSel = sel[0];
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-12-30 19:53:19 +01:00
|
|
|
// Get length
|
|
|
|
if (byTime) len = ShiftTime->time.GetMS();
|
|
|
|
else ShiftFrame->GetValue().ToLong(&len);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2009-06-05 02:02:26 +02:00
|
|
|
if (byTime && len == 0) {
|
|
|
|
// Shift zero milliseconds in time mode
|
|
|
|
// Equivalent to doing nothing at all, so just dismiss
|
|
|
|
EndModal(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-12-30 19:53:19 +01:00
|
|
|
// If backwards, invert
|
|
|
|
if (backward) len = -len;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-12-30 19:53:19 +01:00
|
|
|
// Shift
|
|
|
|
for (int i=0;i<nrows;i++) {
|
|
|
|
if (allrows || (i >= firstSel && selOnward) || grid->IsInSelection(i,0)) {
|
|
|
|
if (byTime) grid->ShiftLineByTime(i,len,type);
|
|
|
|
else grid->ShiftLineByFrames(i,len,type);
|
|
|
|
didSomething = true;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add entry to history
|
|
|
|
if (didSomething) {
|
|
|
|
if (backward) len = -len;
|
|
|
|
wxString message = _T("");
|
2010-07-09 09:31:48 +02:00
|
|
|
wxFileName assfile(grid->ass->filename);
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString filename = assfile.GetFullName();
|
2006-12-30 19:53:19 +01:00
|
|
|
|
|
|
|
// File
|
2006-02-20 22:32:58 +01:00
|
|
|
if (filename.IsEmpty()) message << _("unsaved, ");
|
2006-01-16 22:02:54 +01:00
|
|
|
else message << filename << _T(", ");
|
2006-12-30 19:53:19 +01:00
|
|
|
|
|
|
|
// Time/frames
|
2006-01-16 22:02:54 +01:00
|
|
|
if (byTime) message << ShiftTime->GetValue() << _T(" ");
|
|
|
|
else message << len << _(" frames ");
|
2006-12-30 19:53:19 +01:00
|
|
|
|
|
|
|
// Forward/backwards
|
2006-01-16 22:02:54 +01:00
|
|
|
if (backward) message << _("backward, ");
|
|
|
|
else message << _("forward, ");
|
2006-12-30 19:53:19 +01:00
|
|
|
|
|
|
|
// Start/end
|
2006-01-16 22:02:54 +01:00
|
|
|
if (type == 0) message << _("s+e, ");
|
|
|
|
if (type == 1) message << _("s, ");
|
|
|
|
if (type == 2) message << _("e, ");
|
2006-12-30 19:53:19 +01:00
|
|
|
|
|
|
|
// Selection range
|
|
|
|
if (affect == 0) message << _("all");
|
2010-05-01 03:07:00 +02:00
|
|
|
else if (affect == 2) message << wxString::Format(_("from %i onward"),sel[0]+1);
|
2006-01-16 22:02:54 +01:00
|
|
|
else { // This huge block of code prints the selected ranges of subs
|
|
|
|
message << _("sel ");
|
|
|
|
int last = sel[0]-1;
|
|
|
|
int first = sel[0];
|
|
|
|
for (unsigned int i=0;i<sel.Count();i++) {
|
|
|
|
if (sel[i] != last+1) {
|
|
|
|
if (first != last) message << wxString::Format(_T("%i"),first+1) << _T("-") << wxString::Format(_T("%i"),last+1) << _T(";");
|
|
|
|
else message << wxString::Format(_T("%i"),first+1) << _T(";");
|
|
|
|
first = sel[i];
|
|
|
|
}
|
|
|
|
last = sel[i];
|
|
|
|
}
|
|
|
|
if (first != last) message << wxString::Format(_T("%i"),first+1) << _T("-") << wxString::Format(_T("%i"),last+1);
|
|
|
|
else message << wxString::Format(_T("%i"),first+1);
|
|
|
|
}
|
2006-12-30 19:53:19 +01:00
|
|
|
|
|
|
|
// Done, append
|
2006-01-16 22:02:54 +01:00
|
|
|
AppendToHistory(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store modifications
|
2010-06-24 08:26:44 +02:00
|
|
|
OPT_SET("Tool/Shift Times/ByTime")->SetBool(byTime);
|
2010-05-21 03:13:36 +02:00
|
|
|
OPT_SET("Tool/Shift Times/Type")->SetInt(type);
|
|
|
|
OPT_SET("Tool/Shift Times/Length")->SetInt(len);
|
|
|
|
OPT_SET("Tool/Shift Times/Affect")->SetInt(affect);
|
2010-06-24 08:26:44 +02:00
|
|
|
OPT_SET("Tool/Shift Times/Direction")->SetBool(backward);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// End dialog
|
2010-12-07 20:09:28 +01:00
|
|
|
grid->ass->Commit(_("shifting"), AssFile::COMMIT_TIMES);
|
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 Set to time
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogShiftTimes::OnRadioTime(wxCommandEvent &event) {
|
|
|
|
ShiftTime->Enable(true);
|
|
|
|
ShiftFrame->Enable(false);
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Set to frame
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogShiftTimes::OnRadioFrame(wxCommandEvent &event) {
|
|
|
|
ShiftTime->Enable(false);
|
|
|
|
ShiftFrame->Enable(true);
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Appends a line to history
|
|
|
|
/// @param text
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogShiftTimes::AppendToHistory(wxString text) {
|
|
|
|
// Open file
|
2006-02-20 22:32:58 +01:00
|
|
|
if (HistoryFile.IsEmpty()) return;
|
2006-01-16 22:02:54 +01:00
|
|
|
using namespace std;
|
|
|
|
ofstream file;
|
2009-07-14 23:28:49 +02:00
|
|
|
file.open(HistoryFile.mb_str(csConvLocal),ios::out | ios::app);
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!file.is_open()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert line
|
|
|
|
file << text.mb_str(wxConvUTF8) << endl;
|
|
|
|
|
|
|
|
// Close
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Loads history from disk
|
|
|
|
/// @param filename
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void DialogShiftTimes::LoadHistory(wxString filename) {
|
|
|
|
// Open file
|
|
|
|
using namespace std;
|
|
|
|
HistoryFile = filename;
|
|
|
|
ifstream file;
|
2009-07-14 23:28:49 +02:00
|
|
|
file.open(filename.mb_str(csConvLocal));
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!file.is_open()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup
|
|
|
|
string buffer;
|
|
|
|
History->Clear();
|
|
|
|
History->Freeze();
|
|
|
|
|
|
|
|
// Get lines
|
|
|
|
while (!file.eof()) {
|
|
|
|
getline(file,buffer);
|
|
|
|
wxString curLine(buffer.c_str(),wxConvUTF8);
|
|
|
|
if (curLine != _T("")) History->Insert(curLine,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Finish updating
|
|
|
|
History->Thaw();
|
|
|
|
//History->SetFirstItem(History->GetCount()-1);
|
|
|
|
|
|
|
|
// Close
|
|
|
|
file.close();
|
|
|
|
}
|
2009-07-29 07:43:02 +02: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
|
|
|
|