Implement almost all stubbed-out commands other than the MRU ones

Originally committed to SVN as r5196.
This commit is contained in:
Thomas Goyne 2011-01-16 07:15:24 +00:00
parent 7afbce439d
commit 9779eacbf1
14 changed files with 213 additions and 136 deletions

View file

@ -70,8 +70,7 @@ public:
STR_HELP("About Aegisub.")
void operator()(agi::Context *c) {
AboutScreen About(c->parent);
About.ShowModal();
AboutScreen(c->parent).ShowModal();
}
};
@ -85,7 +84,6 @@ public:
STR_HELP("Display audio and subtitles only.")
void operator()(agi::Context *c) {
if (!c->audioController->IsAudioOpen()) return;
wxGetApp().frame->SetDisplayMode(0,1);
}
};
@ -100,7 +98,6 @@ public:
STR_HELP("Display audio, video and subtitles.")
void operator()(agi::Context *c) {
if (!c->audioController->IsAudioOpen() || !VideoContext::Get()->IsLoaded()) return;
wxGetApp().frame->SetDisplayMode(1,1);
}
};
@ -143,7 +140,7 @@ public:
STR_HELP("Exit the application.")
void operator()(agi::Context *c) {
printf("XXX: not working yet\n");
wxGetApp().frame->Close();
}
};
@ -162,21 +159,16 @@ public:
int old = app->locale.curCode;
int newCode = app->locale.PickLanguage();
// Is OK?
if (newCode != -1) {
if (newCode != -1 && newCode != old) {
// Set code
OPT_SET("App/Locale")->SetInt(newCode);
// Language actually changed?
if (newCode != old) {
// Ask to restart program
int result = wxMessageBox(_T("Aegisub needs to be restarted so that the new language can be applied. Restart now?"),_T("Restart Aegisub?"),wxICON_QUESTION | wxYES_NO);
if (result == wxYES) {
// Restart Aegisub
if (wxGetApp().frame->Close()) {
RestartAegisub();
//wxStandardPaths stand;
//wxExecute(_T("\"") + stand.GetExecutablePath() + _T("\""));
}
// Ask to restart program
int result = wxMessageBox(_T("Aegisub needs to be restarted so that the new language can be applied. Restart now?"),_T("Restart Aegisub?"),wxICON_QUESTION | wxYES_NO);
if (result == wxYES) {
// Restart Aegisub
if (wxGetApp().frame->Close()) {
RestartAegisub();
}
}
}
@ -193,8 +185,7 @@ public:
STR_HELP("Event log.")
void operator()(agi::Context *c) {
LogWindow *log = new LogWindow(c->parent);
log->Show(1);
(new LogWindow(c->parent))->Show(1);
}
};
@ -223,8 +214,7 @@ public:
void operator()(agi::Context *c) {
try {
Preferences pref(c->parent);
pref.ShowModal();
Preferences(c->parent).ShowModal();
} catch (agi::Exception& e) {
LOG_E("config/init") << "Caught exception: " << e.GetName() << " -> " << e.GetMessage();
}

View file

@ -141,7 +141,7 @@ public:
STR_HELP("Display audio as a frequency-power spectrograph.")
void operator()(agi::Context *c) {
printf("XXX: fixme\n");
OPT_SET("Audio/Spectrum")->SetBool(true);
}
};
@ -155,7 +155,7 @@ public:
STR_HELP("Display audio as a linear amplitude graph.")
void operator()(agi::Context *c) {
printf("XXX: fixme\n");
OPT_SET("Audio/Spectrum")->SetBool(false);
}
};

View file

@ -68,12 +68,13 @@ public:
#ifdef __APPLE__
if (wxGetMouseState().CmdDown()) {
#else
if (wxGetMouseState().ControlDown()) {
if (wxGetMouseState().ControlDown()) {
#endif
wxGetApp().global_scripts->Reload();
if (wxGetMouseState().ShiftDown()) {
const std::vector<Automation4::Script*> scripts = c->local_scripts->GetScripts();
for (size_t i = 0; i < scripts.size(); ++i) {
wxGetApp().global_scripts->Reload();
if (wxGetMouseState().ShiftDown()) {
const std::vector<Automation4::Script*>& scripts = c->local_scripts->GetScripts();
for (size_t i = 0; i < scripts.size(); ++i) {
try {
scripts[i]->Reload();
} catch (const wchar_t *e) {
@ -84,13 +85,14 @@ public:
}
wxGetApp().frame->StatusTimeout(_("Reloaded all Automation scripts"));
} else {
}
else {
wxGetApp().frame->StatusTimeout(_("Reloaded autoload Automation scripts"));
}
} else {
VideoContext::Get()->Stop();
DialogAutomation dlg(c->parent, c->local_scripts);
dlg.ShowModal();
}
else {
c->videoContext->Stop();
DialogAutomation(c->parent, c->local_scripts).ShowModal();
}
#endif
}

View file

@ -101,7 +101,7 @@ public:
STR_HELP("Delete currently selected lines.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
c->SubsGrid->DeleteLines(c->SubsGrid->GetSelection());
}
};
@ -115,7 +115,8 @@ public:
STR_HELP("Duplicate the selected lines.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->DuplicateLines(sels.front(), sels.back(), false);
}
};
@ -129,7 +130,8 @@ public:
STR_HELP("Duplicate lines and shift by one frame.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->DuplicateLines(sels.front(), sels.back(), true);
}
};
@ -143,7 +145,8 @@ public:
STR_HELP("Joins selected lines in a single one, as karaoke.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->JoinAsKaraoke(sels.front(), sels.back());
}
};
@ -157,7 +160,8 @@ public:
STR_HELP("Joins selected lines in a single one, concatenating text together.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->JoinLines(sels.front(), sels.back(), true);
}
};
@ -171,7 +175,8 @@ public:
STR_HELP("Joins selected lines in a single one, keeping text of first and discarding remaining.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->JoinLines(sels.front(), sels.back(), false);
}
};
@ -217,7 +222,7 @@ public:
STR_HELP("Recombine subtitles when they have been split and merged.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
//XXX: subs_grid.cpp
}
};
@ -231,7 +236,16 @@ public:
STR_HELP("Uses karaoke timing to split line into multiple smaller lines.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
c->SubsGrid->BeginBatch();
wxArrayInt sels = c->SubsGrid->GetSelection();
bool didSplit = false;
for (int i = sels.size() - 1; i >= 0; --i) {
didSplit |= c->SubsGrid->SplitLineByKaraoke(sels[i]);
}
if (didSplit) {
c->ass->Commit(_("splitting"));
}
c->SubsGrid->EndBatch();
}
};
@ -245,7 +259,8 @@ public:
STR_HELP("Swaps the two selected lines.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->SwapLines(sels.front(), sels.back());
}
};
@ -259,7 +274,7 @@ public:
STR_HELP("Redoes last action.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->ass->Redo();
}
};
@ -274,7 +289,7 @@ public:
STR_HELP("Find and replace words in subtitles.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
Search.OpenDialog(true);
}
};
@ -289,7 +304,7 @@ public:
STR_HELP("Undoes last action.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->ass->Undo();
}
};

View file

@ -121,9 +121,8 @@ public:
STR_HELP("Hide override tags in the subtitle grid.")
void operator()(agi::Context *c) {
// XXX: Needs fixing.
// OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(event.GetId() - cmd::id("subtitle/tags/show"));
// SubsGrid->Refresh(false);
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(2);
c->SubsGrid->Refresh(false);
}
};
@ -137,7 +136,8 @@ public:
STR_HELP("Show full override tags in the subtitle grid.")
void operator()(agi::Context *c) {
//XXX: see grid_tags_hide
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(0);
c->SubsGrid->Refresh(false);
}
};
@ -151,7 +151,8 @@ public:
STR_HELP("Replace override tags in the subtitle grid with a simplified placeholder.")
void operator()(agi::Context *c) {
//XXX: see grid_tags_hide
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(1);
c->SubsGrid->Refresh(false);
}
};

View file

@ -63,7 +63,7 @@ public:
STR_HELP("Closes the currently open keyframes list.")
void operator()(agi::Context *c) {
VideoContext::Get()->CloseKeyframes();
c->videoContext->CloseKeyframes();
}
};
@ -88,10 +88,8 @@ public:
if (filename.empty()) return;
OPT_SET("Path/Last/Keyframes")->SetString(STD_STR(filename));
// Load
VideoContext::Get()->LoadKeyframes(filename);
}
c->videoContext->LoadKeyframes(filename);
}
};
@ -106,9 +104,9 @@ public:
void operator()(agi::Context *c) {
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
wxString filename = wxFileSelector(_T("Select the Keyframes file to open"),path,_T(""),_T("*.key.txt"),_T("Text files (*.txt)|*.txt"),wxFD_OVERWRITE_PROMPT | wxFD_SAVE);
if (filename.IsEmpty()) return;
if (filename.empty()) return;
OPT_SET("Path/Last/Keyframes")->SetString(STD_STR(filename));
VideoContext::Get()->SaveKeyframes(filename);
c->videoContext->SaveKeyframes(filename);
}
};

View file

@ -76,7 +76,7 @@ public:
STR_HELP("Recent keyframes.")
void operator()(agi::Context *c) {
// VideoContext::Get()->LoadKeyframes(lagi_wxString(config::mru->GetEntry("Keyframes", event.GetId()-cmd::id("recent/keyframe"))));
// c->videoContext->LoadKeyframes(lagi_wxString(config::mru->GetEntry("Keyframes", event.GetId()-cmd::id("recent/keyframe"))));
}
};

View file

@ -48,6 +48,7 @@
#include "command.h"
#include "../ass_dialogue.h"
#include "../ass_file.h"
#include "../compat.h"
#include "../dialog_attachments.h"
@ -75,9 +76,8 @@ public:
STR_HELP("Open the attachment list.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogAttachments attachments(c->parent, c->ass);
attachments.ShowModal();
c->videoContext->Stop();
DialogAttachments(c->parent, c->ass).ShowModal();
}
};
@ -91,7 +91,7 @@ public:
STR_HELP("Find words in subtitles.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
Search.OpenDialog(false);
}
};
@ -106,11 +106,28 @@ public:
STR_HELP("Find next match of last word.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
Search.FindNext();
}
};
static void insert_subtitle_at_video(agi::Context *c, bool after) {
int n = c->SubsGrid->GetFirstSelRow();
// Create line to add
AssDialogue *def = new AssDialogue;
int video_ms = c->videoContext->TimeAtFrame(c->videoContext->GetFrameN(), agi::vfr::START);
def->Start.SetMS(video_ms);
def->End.SetMS(video_ms + OPT_GET("Timing/Default Duration")->GetInt());
def->Style = c->SubsGrid->GetDialogue(n)->Style;
// Insert it
c->SubsGrid->BeginBatch();
c->SubsGrid->InsertLine(def, n, after);
c->SubsGrid->SelectRow(n + after);
c->SubsGrid->SetActiveLine(def);
c->SubsGrid->EndBatch();
}
/// Inserts a line after current.
class subtitle_insert_after: public Command {
@ -121,11 +138,32 @@ public:
STR_HELP("Inserts a line after current.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
int n = c->SubsGrid->GetFirstSelRow();
int nrows = c->SubsGrid->GetRows();
// Create line to add
AssDialogue *def = new AssDialogue;
if (n == nrows-1) {
def->Start = c->SubsGrid->GetDialogue(n)->End;
def->End = c->SubsGrid->GetDialogue(n)->End;
def->End.SetMS(def->End.GetMS()+OPT_GET("Timing/Default Duration")->GetInt());
}
else {
def->Start = c->SubsGrid->GetDialogue(n)->End;
def->End = c->SubsGrid->GetDialogue(n+1)->Start;
}
if (def->End.GetMS() < def->Start.GetMS()) def->End.SetMS(def->Start.GetMS()+OPT_GET("Timing/Default Duration")->GetInt());
def->Style = c->SubsGrid->GetDialogue(n)->Style;
// Insert it
c->SubsGrid->BeginBatch();
c->SubsGrid->InsertLine(def, n, true);
c->SubsGrid->SelectRow(n + 1);
c->SubsGrid->SetActiveLine(def);
c->SubsGrid->EndBatch();
}
};
/// Inserts a line after current, starting at video time.
class subtitle_insert_after_videotime: public Command {
public:
@ -135,7 +173,7 @@ public:
STR_HELP("Inserts a line after current, starting at video time.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
insert_subtitle_at_video(c, true);
}
};
@ -149,7 +187,31 @@ public:
STR_HELP("Inserts a line before current.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
int n = c->SubsGrid->GetFirstSelRow();
// Create line to add
AssDialogue *def = new AssDialogue;
if (n == 0) {
def->Start.SetMS(0);
def->End = c->SubsGrid->GetDialogue(n)->Start;
}
else if (c->SubsGrid->GetDialogue(n-1)->End.GetMS() > c->SubsGrid->GetDialogue(n)->Start.GetMS()) {
def->Start.SetMS(c->SubsGrid->GetDialogue(n)->Start.GetMS()-OPT_GET("Timing/Default Duration")->GetInt());
def->End = c->SubsGrid->GetDialogue(n)->Start;
}
else {
def->Start = c->SubsGrid->GetDialogue(n-1)->End;
def->End = c->SubsGrid->GetDialogue(n)->Start;
}
if (def->End.GetMS() < def->Start.GetMS()) def->End.SetMS(def->Start.GetMS()+OPT_GET("Timing/Default Duration")->GetInt());
def->Style = c->SubsGrid->GetDialogue(n)->Style;
// Insert it
c->SubsGrid->BeginBatch();
c->SubsGrid->InsertLine(def, n, false);
c->SubsGrid->SelectRow(n);
c->SubsGrid->SetActiveLine(def);
c->SubsGrid->EndBatch();
}
};
@ -163,7 +225,7 @@ public:
STR_HELP("Inserts a line before current, starting at video time.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
insert_subtitle_at_video(c, false);
}
};
@ -236,7 +298,7 @@ public:
STR_HELP("Opens the subtitles from the current video file.")
void operator()(agi::Context *c) {
wxGetApp().frame->LoadSubtitles(VideoContext::Get()->videoName, "binary");
wxGetApp().frame->LoadSubtitles(c->videoContext->videoName, "binary");
}
};
@ -250,9 +312,8 @@ public:
STR_HELP("Open script properties window.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogProperties Properties(c->parent, c->ass);
Properties.ShowModal();
c->videoContext->Stop();
DialogProperties(c->parent, c->ass).ShowModal();
}
};
@ -295,7 +356,7 @@ public:
STR_HELP("Selects all lines that are currently visible on video frame.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->SubsGrid->SelectVisible();
}
};
@ -311,8 +372,8 @@ public:
void operator()(agi::Context *c) {
//XXX: This is obscene, requires refactoring the spellchecker.
// VideoContext::Get()->Stop();
// new DialogSpellChecker;
c->videoContext->Stop();
new DialogSpellChecker(wxGetApp().frame);
}
};

View file

@ -65,7 +65,8 @@ public:
STR_HELP("Changes times of subs so end times begin on next's start time.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->AdjoinLines(sels.front(), sels.back(), false);
}
};
@ -79,7 +80,8 @@ public:
STR_HELP("Changes times of subs so start times begin on previous's end time.")
void operator()(agi::Context *c) {
//XXX: subs_grid.cpp
wxArrayInt sels = c->SubsGrid->GetSelection();
c->SubsGrid->AdjoinLines(sels.front(), sels.back(), true);
}
};
@ -94,7 +96,7 @@ public:
STR_HELP("Shift selection so first selected line starts at current frame.")
void operator()(agi::Context *c) {
if (!VideoContext::Get()->IsLoaded()) return;
if (!c->videoContext->IsLoaded()) return;
wxArrayInt sels = c->SubsGrid->GetSelection();
size_t n=sels.Count();
@ -103,7 +105,7 @@ public:
// Get shifting in ms
AssDialogue *cur = c->SubsGrid->GetDialogue(sels[0]);
if (!cur) return;
int shiftBy = VideoContext::Get()->TimeAtFrame(VideoContext::Get()->GetFrameN(),agi::vfr::START) - cur->Start.GetMS();
int shiftBy = c->videoContext->TimeAtFrame(c->videoContext->GetFrameN(),agi::vfr::START) - cur->Start.GetMS();
// Update
for (size_t i=0;i<n;i++) {
@ -129,9 +131,8 @@ public:
STR_HELP("Shift subtitles by time or frames.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogShiftTimes Shift(c->parent, c->SubsGrid);
Shift.ShowModal();
c->videoContext->Stop();
DialogShiftTimes(c->parent, c->SubsGrid).ShowModal();
}
};
@ -160,7 +161,23 @@ public:
STR_HELP("Shift selected subtitles so first selected starts at this frame.")
void operator()(agi::Context *c) {
//XXX: needs contents.
if (c->videoContext->IsLoaded()) return;
wxArrayInt sels = c->SubsGrid->GetSelection();
if (sels.empty()) return;
AssDialogue *cur = c->SubsGrid->GetDialogue(sels[0]);
if (!cur) return;
int shiftBy = c->videoContext->TimeAtFrame(c->videoContext->GetFrameN(),agi::vfr::START) - cur->Start.GetMS();
for (size_t i = 0; i < sels.size(); ++i) {
if (cur = c->SubsGrid->GetDialogue(sels[i])) {
cur->Start.SetMS(cur->Start.GetMS() + shiftBy);
cur->End.SetMS(cur->End.GetMS() + shiftBy);
}
}
c->ass->Commit(_("shift to frame"));
}
};
@ -174,7 +191,7 @@ public:
STR_HELP("Set start and end of subtitles to the keyframes around current video frame.")
void operator()(agi::Context *c) {
VideoContext *con = VideoContext::Get();
VideoContext *con = c->videoContext;
if (!con->IsLoaded() || !con->KeyFramesLoaded()) return;
// Get frames

View file

@ -64,7 +64,7 @@ public:
STR_HELP("Closes the currently open timecodes file.")
void operator()(agi::Context *c) {
VideoContext::Get()->CloseTimecodes();
c->videoContext->CloseTimecodes();
}
};
@ -82,7 +82,7 @@ public:
wxString str = wxString(_("All Supported Types")) + _T("(*.txt)|*.txt|") + _("All Files") + _T(" (*.*)|*.*");
wxString filename = wxFileSelector(_("Open timecodes file"),path,_T(""),_T(""),str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) {
VideoContext::Get()->LoadTimecodes(filename);
c->videoContext->LoadTimecodes(filename);
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(filename));
}
}
@ -102,7 +102,7 @@ public:
wxString str = wxString(_("All Supported Types")) + _T("(*.txt)|*.txt|") + _("All Files") + _T(" (*.*)|*.*");
wxString filename = wxFileSelector(_("Save timecodes file"),path,_T(""),_T(""),str,wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (!filename.empty()) {
VideoContext::Get()->SaveTimecodes(filename);
c->videoContext->SaveTimecodes(filename);
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(filename));
}
}

View file

@ -85,9 +85,8 @@ public:
STR_HELP("Saves a copy of subtitles with processing applied to it.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogResample diag(c->parent, c->SubsGrid);
diag.ShowModal();
c->videoContext->Stop();
DialogResample(c->parent, c->SubsGrid).ShowModal();
}
};
@ -101,9 +100,8 @@ public:
STR_HELP("Open fonts collector.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogFontsCollector Collector(c->parent, c->ass);
Collector.ShowModal();
c->videoContext->Stop();
DialogFontsCollector(c->parent, c->ass).ShowModal();
}
};
@ -117,9 +115,8 @@ public:
STR_HELP("Selects lines based on defined criterea.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogSelection select(c->parent, c->SubsGrid);
select.ShowModal();
c->videoContext->Stop();
DialogSelection(c->parent, c->SubsGrid).ShowModal();
}
};
@ -133,9 +130,8 @@ public:
STR_HELP("Changes resolution and modifies subtitles to conform to change.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogResample diag(c->parent, c->SubsGrid);
diag.ShowModal();
c->videoContext->Stop();
DialogResample(c->parent, c->SubsGrid).ShowModal();
}
};
@ -149,7 +145,7 @@ public:
STR_HELP("Open styling assistant.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
if (!c->stylingAssistant) c->stylingAssistant = new DialogStyling(c->parent, c->SubsGrid);
c->stylingAssistant->Show(true);
}
@ -165,9 +161,8 @@ public:
STR_HELP("Open styles manager.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogStyleManager StyleManager(c->parent, c->SubsGrid);
StyleManager.ShowModal();
c->videoContext->Stop();
DialogStyleManager(c->parent, c->SubsGrid).ShowModal();
}
};
@ -181,8 +176,7 @@ public:
STR_HELP("Open Kanji timer.")
void operator()(agi::Context *c) {
DialogKanjiTimer kanjitimer(c->parent, c->SubsGrid);
kanjitimer.ShowModal();
DialogKanjiTimer(c->parent, c->SubsGrid).ShowModal();
}
};
@ -196,8 +190,7 @@ public:
STR_HELP("Runs a post-processor for timing to deal with lead-ins, lead-outs, scene timing and etc.")
void operator()(agi::Context *c) {
DialogTimingProcessor timing(c->parent, c->SubsGrid);
timing.ShowModal();
DialogTimingProcessor(c->parent, c->SubsGrid).ShowModal();
}
};
@ -211,11 +204,10 @@ public:
STR_HELP("Open translation assistant.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
int start = c->SubsGrid->GetFirstSelRow();
if (start == -1) start = 0;
DialogTranslation Trans(c->parent, c->ass, c->SubsGrid, start, true);
Trans.ShowModal();
DialogTranslation(c->parent, c->ass, c->SubsGrid, start, true).ShowModal();
}
};

View file

@ -72,8 +72,8 @@ public:
STR_HELP("Forces video to 2.35 aspect ratio.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
VideoContext::Get()->SetAspectRatio(3);
c->videoContext->Stop();
c->videoContext->SetAspectRatio(3);
wxGetApp().frame->SetDisplayMode(1,-1);
}
};
@ -88,9 +88,9 @@ public:
STR_HELP("Forces video to a custom aspect ratio.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
wxString value = wxGetTextFromUser(_("Enter aspect ratio in either:\n decimal (e.g. 2.35)\n fractional (e.g. 16:9)\n specific resolution (e.g. 853x480)"),_("Enter aspect ratio"),AegiFloatToString(VideoContext::Get()->GetAspectRatioValue()));
wxString value = wxGetTextFromUser(_("Enter aspect ratio in either:\n decimal (e.g. 2.35)\n fractional (e.g. 16:9)\n specific resolution (e.g. 853x480)"),_("Enter aspect ratio"),AegiFloatToString(c->videoContext->GetAspectRatioValue()));
if (value.IsEmpty()) return;
value.MakeLower();
@ -118,7 +118,7 @@ public:
wxString denum = value.Mid(pos+1);
if (num.ToDouble(&a) && denum.ToDouble(&b) && b!=0) {
numval = a/b;
if (scale) c->videoBox->videoDisplay->SetZoom(b / VideoContext::Get()->GetHeight());
if (scale) c->videoBox->videoDisplay->SetZoom(b / c->videoContext->GetHeight());
}
}
else numval = 0.0;
@ -129,7 +129,7 @@ public:
// Set value
else {
VideoContext::Get()->SetAspectRatio(4,numval);
c->videoContext->SetAspectRatio(4,numval);
wxGetApp().frame->SetDisplayMode(1,-1);
}
}
@ -146,8 +146,8 @@ public:
STR_HELP("Leave video on original aspect ratio.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
VideoContext::Get()->SetAspectRatio(0);
c->videoContext->Stop();
c->videoContext->SetAspectRatio(0);
wxGetApp().frame->SetDisplayMode(1,-1);
}
};
@ -163,8 +163,8 @@ public:
STR_HELP("Forces video to 4:3 aspect ratio.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
VideoContext::Get()->SetAspectRatio(1);
c->videoContext->Stop();
c->videoContext->SetAspectRatio(1);
wxGetApp().frame->SetDisplayMode(1,-1);
}
};
@ -179,8 +179,8 @@ public:
STR_HELP("Forces video to 16:9 aspect ratio.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
VideoContext::Get()->SetAspectRatio(2);
c->videoContext->Stop();
c->videoContext->SetAspectRatio(2);
wxGetApp().frame->SetDisplayMode(1,-1);
}
};
@ -224,9 +224,8 @@ public:
STR_HELP("Shows video details.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
DialogVideoDetails videodetails(c->parent);
videodetails.ShowModal();
c->videoContext->Stop();
DialogVideoDetails(c->parent).ShowModal();
}
};
@ -275,7 +274,7 @@ public:
STR_HELP("Play video.")
void operator()(agi::Context *c) {
VideoContext::Get()->Play();
c->videoContext->Play();
}
};
@ -303,10 +302,9 @@ public:
STR_HELP("Jump to frame or time.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
if (VideoContext::Get()->IsLoaded()) {
DialogJumpTo JumpTo(c->parent);
JumpTo.ShowModal();
c->videoContext->Stop();
if (c->videoContext->IsLoaded()) {
DialogJumpTo(c->parent).ShowModal();
c->videoBox->videoSlider->SetFocus();
}
}
@ -390,7 +388,7 @@ public:
void operator()(agi::Context *c) {
//XXX: Fix to not require using an event. (maybe)
// OPT_SET("Video/Overscan Mask")->SetBool(event.IsChecked());
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->videoBox->videoDisplay->Render();
}
};
@ -405,7 +403,7 @@ public:
STR_HELP("Set zoom to 100%.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->videoBox->videoDisplay->SetZoom(1.);
}
};
@ -421,7 +419,7 @@ public:
STR_HELP("Set zoom to 200%.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->videoBox->videoDisplay->SetZoom(2.);
}
};
@ -436,7 +434,7 @@ public:
STR_HELP("Set zoom to 50%.")
void operator()(agi::Context *c) {
VideoContext::Get()->Stop();
c->videoContext->Stop();
c->videoBox->videoDisplay->SetZoom(.5);
}
};

View file

@ -306,7 +306,8 @@ void FrameMain::InitContents() {
StartupLog(_T("Create video box"));
videoBox = new VideoBox(Panel, false, ZoomBox, ass);
temp_context.videoBox = videoBox;
VideoContext::Get()->audio = audioController;
temp_context.videoContext = VideoContext::Get();
temp_context.videoContext->audio = audioController;
wxBoxSizer *videoSizer = new wxBoxSizer(wxVERTICAL);
videoSizer->Add(videoBox, 0, wxEXPAND);
videoSizer->AddStretchSpacer(1);
@ -316,7 +317,7 @@ void FrameMain::InitContents() {
SubsGrid = new SubtitlesGrid(this,Panel,-1,ass,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
temp_context.SubsGrid = SubsGrid;
videoBox->videoSlider->grid = SubsGrid;
VideoContext::Get()->grid = SubsGrid;
temp_context.videoContext->grid = SubsGrid;
Search.grid = SubsGrid;
// Tools area

View file

@ -10,6 +10,7 @@ namespace Automation4 { class ScriptManager; }
class SubsEditBox;
class SubtitlesGrid;
class VideoBox;
class VideoContext;
namespace agi {
@ -28,6 +29,7 @@ struct Context {
SubsEditBox *EditBox;
SubtitlesGrid *SubsGrid;
VideoBox *videoBox;
VideoContext *videoContext;
};
}