Rename FrameMain::SubsBox to SubsGrid for consistency with the rest of Aegisub.

Originally committed to SVN as r4527.
This commit is contained in:
Thomas Goyne 2010-06-16 06:20:33 +00:00
parent 43f3502043
commit faf2e562cd
7 changed files with 92 additions and 92 deletions

View file

@ -83,7 +83,7 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDi
videoBox = new VideoBox(panel, true); videoBox = new VideoBox(panel, true);
videoBox->videoDisplay->freeSize = true; videoBox->videoDisplay->freeSize = true;
videoBox->videoDisplay->SetClientSize(initialDisplaySize); videoBox->videoDisplay->SetClientSize(initialDisplaySize);
videoBox->videoSlider->grid = par->SubsBox; videoBox->videoSlider->grid = par->SubsGrid;
// Set sizer // Set sizer
wxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); wxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);

View file

@ -509,7 +509,7 @@ void FontsCollectorThread::Collect() {
if (oper == 3 && someOk) { if (oper == 3 && someOk) {
wxMutexGuiEnter(); wxMutexGuiEnter();
subs->FlagAsModified(_("font attachment")); subs->FlagAsModified(_("font attachment"));
collector->main->SubsBox->CommitChanges(); collector->main->SubsGrid->CommitChanges();
wxMutexGuiLeave(); wxMutexGuiLeave();
} }
} }

View file

@ -196,7 +196,7 @@ bool DialogSpellChecker::FindNext(int startLine,int startPos) {
if (startPos != -1) lastPos = 0; if (startPos != -1) lastPos = 0;
// Get grid // Get grid
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsBox; SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
int rows = grid->GetRows(); int rows = grid->GetRows();
// Loop through lines // Loop through lines
@ -269,7 +269,7 @@ void DialogSpellChecker::SetWord(wxString word) {
for (size_t i=0;i<sugs.Count();i++) suggestList->Append(sugs[i]); for (size_t i=0;i<sugs.Count();i++) suggestList->Append(sugs[i]);
// Show word on the main program interface // Show word on the main program interface
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsBox; SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
int line = lastLine % grid->GetRows(); int line = lastLine % grid->GetRows();
grid->SelectRow(line,false); grid->SelectRow(line,false);
grid->MakeCellVisible(line,0); grid->MakeCellVisible(line,0);
@ -382,7 +382,7 @@ bool DialogSpellChecker::FindOrDie() {
/// ///
void DialogSpellChecker::Replace() { void DialogSpellChecker::Replace() {
// Get dialog // Get dialog
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsBox; SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
AssDialogue *diag = grid->GetDialogue(lastLine % grid->GetRows()); AssDialogue *diag = grid->GetDialogue(lastLine % grid->GetRows());
// Replace // Replace
@ -436,7 +436,7 @@ void DialogSpellChecker::OnTakeSuggestion(wxCommandEvent &event) {
/// ///
bool DialogSpellChecker::GetFirstMatch() { bool DialogSpellChecker::GetFirstMatch() {
// Get selection // Get selection
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsBox; SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
wxArrayInt sel = grid->GetSelection(); wxArrayInt sel = grid->GetSelection();
firstLine = (sel.Count()>0) ? sel[0] : 0; firstLine = (sel.Count()>0) ? sel[0] : 0;
bool hasTypos = FindNext(firstLine,0); bool hasTypos = FindNext(firstLine,0);

View file

@ -581,15 +581,15 @@ void FrameMain::InitContents() {
// Subtitles area // Subtitles area
StartupLog(_T("Create subtitles grid")); StartupLog(_T("Create subtitles grid"));
SubsBox = new SubtitlesGrid(this,Panel,-1,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid")); SubsGrid = new SubtitlesGrid(this,Panel,-1,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
BottomSizer->Add(SubsBox,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,0); BottomSizer->Add(SubsGrid,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,0);
StartupLog(_T("Reset undo stack")); StartupLog(_T("Reset undo stack"));
AssFile::StackReset(); AssFile::StackReset();
videoBox->videoSlider->grid = SubsBox; videoBox->videoSlider->grid = SubsGrid;
VideoContext::Get()->grid = SubsBox; VideoContext::Get()->grid = SubsGrid;
StartupLog(_T("Reset video zoom")); StartupLog(_T("Reset video zoom"));
videoBox->videoDisplay->SetZoom(OPT_GET("Video/Default Zoom")->GetInt() * .125 + .125); videoBox->videoDisplay->SetZoom(OPT_GET("Video/Default Zoom")->GetInt() * .125 + .125);
Search.grid = SubsBox; Search.grid = SubsGrid;
// Audio area // Audio area
StartupLog(_T("Create audio box")); StartupLog(_T("Create audio box"));
@ -599,7 +599,7 @@ void FrameMain::InitContents() {
// Top sizer // Top sizer
StartupLog(_T("Create subtitle editing box")); StartupLog(_T("Create subtitle editing box"));
EditBox = new SubsEditBox(Panel,SubsBox); EditBox = new SubsEditBox(Panel,SubsGrid);
EditBox->audio = audioBox->audioDisplay; EditBox->audio = audioBox->audioDisplay;
StartupLog(_T("Arrange controls in sizers")); StartupLog(_T("Arrange controls in sizers"));
ToolSizer = new wxBoxSizer(wxVERTICAL); ToolSizer = new wxBoxSizer(wxVERTICAL);
@ -640,7 +640,7 @@ void FrameMain::UpdateToolbar() {
// Collect flags // Collect flags
bool isVideo = VideoContext::Get()->IsLoaded(); bool isVideo = VideoContext::Get()->IsLoaded();
HasSelection = true; HasSelection = true;
int selRows = SubsBox->GetNumberSelection(); int selRows = SubsGrid->GetNumberSelection();
// Update // Update
wxToolBar* toolbar = GetToolBar(); wxToolBar* toolbar = GetToolBar();
@ -698,17 +698,17 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
} }
// Proceed into loading // Proceed into loading
SubsBox->Clear(); SubsGrid->Clear();
AssFile::StackReset(); AssFile::StackReset();
if (isFile) { if (isFile) {
AssFile::top->Load(filename,charset); AssFile::top->Load(filename,charset);
SubsBox->LoadFromAss(AssFile::top,false,true); SubsGrid->LoadFromAss(AssFile::top,false,true);
wxFileName fn(filename); wxFileName fn(filename);
StandardPaths::SetPathValue(_T("?script"),fn.GetPath()); StandardPaths::SetPathValue(_T("?script"),fn.GetPath());
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(fn.GetPath())); OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(fn.GetPath()));
} }
else { else {
SubsBox->LoadDefault(AssFile::top); SubsGrid->LoadDefault(AssFile::top);
StandardPaths::SetPathValue(_T("?script"),_T("")); StandardPaths::SetPathValue(_T("?script"),_T(""));
} }
} }
@ -1128,8 +1128,8 @@ void FrameMain::LoadVideo(wxString file,bool autoload) {
videoBox->videoDisplay->SetZoom(target_zoom); videoBox->videoDisplay->SetZoom(target_zoom);
// Check that the video size matches the script video size specified // Check that the video size matches the script video size specified
int scriptx = SubsBox->ass->GetScriptInfoAsInt(_T("PlayResX")); int scriptx = SubsGrid->ass->GetScriptInfoAsInt(_T("PlayResX"));
int scripty = SubsBox->ass->GetScriptInfoAsInt(_T("PlayResY")); int scripty = SubsGrid->ass->GetScriptInfoAsInt(_T("PlayResY"));
if (scriptx != vidx || scripty != vidy) { if (scriptx != vidx || scripty != vidy) {
switch (OPT_GET("Video/Check Script Res")->GetInt()) { switch (OPT_GET("Video/Check Script Res")->GetInt()) {
case 1: case 1:
@ -1139,10 +1139,10 @@ void FrameMain::LoadVideo(wxString file,bool autoload) {
// Fallthrough to case 2 // Fallthrough to case 2
case 2: case 2:
// Always change script res // Always change script res
SubsBox->ass->SetScriptInfo(_T("PlayResX"), wxString::Format(_T("%d"), vidx)); SubsGrid->ass->SetScriptInfo(_T("PlayResX"), wxString::Format(_T("%d"), vidx));
SubsBox->ass->SetScriptInfo(_T("PlayResY"), wxString::Format(_T("%d"), vidy)); SubsGrid->ass->SetScriptInfo(_T("PlayResY"), wxString::Format(_T("%d"), vidy));
SubsBox->ass->FlagAsModified(_("Change script resolution")); SubsGrid->ass->FlagAsModified(_("Change script resolution"));
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
break; break;
case 0: case 0:
default: default:
@ -1152,7 +1152,7 @@ void FrameMain::LoadVideo(wxString file,bool autoload) {
} }
} }
SubsBox->CommitChanges(true); SubsGrid->CommitChanges(true);
SetDisplayMode(1,-1); SetDisplayMode(1,-1);
EditBox->UpdateFrameTiming(); EditBox->UpdateFrameTiming();
@ -1192,7 +1192,7 @@ void FrameMain::LoadVFR(wxString filename) {
if (filename != _T("")) { if (filename != _T("")) {
try { try {
VFR_Output.Load(filename); VFR_Output.Load(filename);
SubsBox->Refresh(false); SubsGrid->Refresh(false);
} }
// Fail // Fail
@ -1212,7 +1212,7 @@ void FrameMain::LoadVFR(wxString filename) {
} }
} }
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
EditBox->UpdateFrameTiming(); EditBox->UpdateFrameTiming();
} }

View file

@ -326,7 +326,7 @@ private:
public: public:
/// DOCME /// DOCME
SubtitlesGrid *SubsBox; SubtitlesGrid *SubsGrid;
/// DOCME /// DOCME
SubsEditBox *EditBox; SubsEditBox *EditBox;

View file

@ -250,7 +250,7 @@ END_EVENT_TABLE()
/// @brief Redirect grid events to grid /// @brief Redirect grid events to grid
/// @param event /// @param event
void FrameMain::OnGridEvent (wxCommandEvent &event) { void FrameMain::OnGridEvent (wxCommandEvent &event) {
SubsBox->GetEventHandler()->ProcessEvent(event); SubsGrid->GetEventHandler()->ProcessEvent(event);
} }
/// @brief Rebuild recent list /// @brief Rebuild recent list
@ -384,7 +384,7 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) {
else if (curMenu == subtitlesMenu) { else if (curMenu == subtitlesMenu) {
// Variables // Variables
bool continuous; bool continuous;
wxArrayInt sels = SubsBox->GetSelection(&continuous); wxArrayInt sels = SubsGrid->GetSelection(&continuous);
int count = sels.Count(); int count = sels.Count();
bool state,state2; bool state,state2;
@ -417,7 +417,7 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) {
else if (curMenu == timingMenu) { else if (curMenu == timingMenu) {
// Variables // Variables
bool continuous; bool continuous;
wxArrayInt sels = SubsBox->GetSelection(&continuous); wxArrayInt sels = SubsGrid->GetSelection(&continuous);
int count = sels.Count(); int count = sels.Count();
// Video related // Video related
@ -449,7 +449,7 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) {
item->Enable(!AssFile::IsRedoStackEmpty()); item->Enable(!AssFile::IsRedoStackEmpty());
// Copy/cut/paste // Copy/cut/paste
wxArrayInt sels = SubsBox->GetSelection(); wxArrayInt sels = SubsGrid->GetSelection();
bool can_copy = (sels.Count() > 0); bool can_copy = (sels.Count() > 0);
bool can_paste = true; bool can_paste = true;
@ -505,7 +505,7 @@ int FrameMain::AddMacroMenuItems(wxMenu *menu, const std::vector<Automation4::Fe
int id = activeMacroItems.size();; int id = activeMacroItems.size();;
for (std::vector<Automation4::FeatureMacro*>::const_iterator i = macros.begin(); i != macros.end(); ++i) { for (std::vector<Automation4::FeatureMacro*>::const_iterator i = macros.begin(); i != macros.end(); ++i) {
wxMenuItem * m = menu->Append(Menu_Automation_Macro + id, (*i)->GetName(), (*i)->GetDescription()); wxMenuItem * m = menu->Append(Menu_Automation_Macro + id, (*i)->GetName(), (*i)->GetDescription());
m->Enable((*i)->Validate(SubsBox->ass, SubsBox->GetAbsoluteSelection(), SubsBox->GetFirstSelRow())); m->Enable((*i)->Validate(SubsGrid->ass, SubsGrid->GetAbsoluteSelection(), SubsGrid->GetFirstSelRow()));
activeMacroItems.push_back(*i); activeMacroItems.push_back(*i);
id++; id++;
} }
@ -916,7 +916,7 @@ void FrameMain::OnJumpTo(wxCommandEvent&) {
/// @brief Open shift dialog /// @brief Open shift dialog
void FrameMain::OnShift(wxCommandEvent&) { void FrameMain::OnShift(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
DialogShiftTimes Shift(this,SubsBox); DialogShiftTimes Shift(this,SubsGrid);
Shift.ShowModal(); Shift.ShowModal();
} }
@ -926,17 +926,17 @@ void FrameMain::OnOpenProperties (wxCommandEvent &) {
DialogProperties Properties(this); DialogProperties Properties(this);
int res = Properties.ShowModal(); int res = Properties.ShowModal();
if (res) { if (res) {
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
} }
} }
/// @brief Open styles manager /// @brief Open styles manager
void FrameMain::OnOpenStylesManager(wxCommandEvent&) { void FrameMain::OnOpenStylesManager(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
DialogStyleManager StyleManager(this,SubsBox); DialogStyleManager StyleManager(this,SubsGrid);
StyleManager.ShowModal(); StyleManager.ShowModal();
EditBox->UpdateGlobals(); EditBox->UpdateGlobals();
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
} }
/// @brief Open attachments /// @brief Open attachments
@ -949,9 +949,9 @@ void FrameMain::OnOpenAttachments(wxCommandEvent&) {
/// @brief Open translation assistant /// @brief Open translation assistant
void FrameMain::OnOpenTranslation(wxCommandEvent&) { void FrameMain::OnOpenTranslation(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
int start = SubsBox->GetFirstSelRow(); int start = SubsGrid->GetFirstSelRow();
if (start == -1) start = 0; if (start == -1) start = 0;
DialogTranslation Trans(this,AssFile::top,SubsBox,start,true); DialogTranslation Trans(this,AssFile::top,SubsGrid,start,true);
Trans.ShowModal(); Trans.ShowModal();
} }
@ -971,19 +971,19 @@ void FrameMain::OnOpenFontsCollector (wxCommandEvent &) {
/// @brief Open Resolution Resampler /// @brief Open Resolution Resampler
void FrameMain::OnOpenResample (wxCommandEvent &) { void FrameMain::OnOpenResample (wxCommandEvent &) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
DialogResample diag(this, SubsBox); DialogResample diag(this, SubsGrid);
diag.ShowModal(); diag.ShowModal();
} }
/// @brief Open Timing post-processor dialog /// @brief Open Timing post-processor dialog
void FrameMain::OnOpenTimingProcessor (wxCommandEvent &) { void FrameMain::OnOpenTimingProcessor (wxCommandEvent &) {
DialogTimingProcessor timing(this,SubsBox); DialogTimingProcessor timing(this,SubsGrid);
timing.ShowModal(); timing.ShowModal();
} }
/// @brief Open Kanji Timer dialog /// @brief Open Kanji Timer dialog
void FrameMain::OnOpenKanjiTimer (wxCommandEvent &) { void FrameMain::OnOpenKanjiTimer (wxCommandEvent &) {
DialogKanjiTimer kanjitimer(this,SubsBox); DialogKanjiTimer kanjitimer(this,SubsGrid);
kanjitimer.ShowModal(); kanjitimer.ShowModal();
} }
@ -1044,52 +1044,52 @@ void FrameMain::OnOpenAutomation (wxCommandEvent &) {
/// @param event /// @param event
void FrameMain::OnAutomationMacro (wxCommandEvent &event) { void FrameMain::OnAutomationMacro (wxCommandEvent &event) {
#ifdef WITH_AUTOMATION #ifdef WITH_AUTOMATION
SubsBox->BeginBatch(); SubsGrid->BeginBatch();
// First get selection data // First get selection data
// This much be done before clearing the maps, since selection data are lost during that // This much be done before clearing the maps, since selection data are lost during that
std::vector<int> selected_lines = SubsBox->GetAbsoluteSelection(); std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
int first_sel = SubsBox->GetFirstSelRow(); int first_sel = SubsGrid->GetFirstSelRow();
// Clear all maps from the subs grid before running the macro // Clear all maps from the subs grid before running the macro
// The stuff done by the macro might invalidate some of the iterators held by the grid, which will cause great crashing // The stuff done by the macro might invalidate some of the iterators held by the grid, which will cause great crashing
SubsBox->Clear(); SubsGrid->Clear();
// Run the macro... // Run the macro...
activeMacroItems[event.GetId()-Menu_Automation_Macro]->Process(SubsBox->ass, selected_lines, first_sel, this); activeMacroItems[event.GetId()-Menu_Automation_Macro]->Process(SubsGrid->ass, selected_lines, first_sel, this);
// Have the grid update its maps, this properly refreshes it to reflect the changed subs // Have the grid update its maps, this properly refreshes it to reflect the changed subs
SubsBox->UpdateMaps(); SubsGrid->UpdateMaps();
SubsBox->SetSelectionFromAbsolute(selected_lines); SubsGrid->SetSelectionFromAbsolute(selected_lines);
SubsBox->CommitChanges(true, false); SubsGrid->CommitChanges(true, false);
SubsBox->AdjustScrollbar(); SubsGrid->AdjustScrollbar();
SubsBox->EndBatch(); SubsGrid->EndBatch();
#endif #endif
} }
/// @brief Snap subs to video /// @brief Snap subs to video
void FrameMain::OnSnapSubsStartToVid (wxCommandEvent &) { void FrameMain::OnSnapSubsStartToVid (wxCommandEvent &) {
if (VideoContext::Get()->IsLoaded() && SubsBox->GetSelection().Count() > 0) { if (VideoContext::Get()->IsLoaded() && SubsGrid->GetSelection().Count() > 0) {
SubsBox->SetSubsToVideo(true); SubsGrid->SetSubsToVideo(true);
} }
} }
/// @brief DOCME /// @brief DOCME
void FrameMain::OnSnapSubsEndToVid (wxCommandEvent &) { void FrameMain::OnSnapSubsEndToVid (wxCommandEvent &) {
if (VideoContext::Get()->IsLoaded() && SubsBox->GetSelection().Count() > 0) { if (VideoContext::Get()->IsLoaded() && SubsGrid->GetSelection().Count() > 0) {
SubsBox->SetSubsToVideo(false); SubsGrid->SetSubsToVideo(false);
} }
} }
/// @brief Jump video to subs /// @brief Jump video to subs
void FrameMain::OnSnapVidToSubsStart (wxCommandEvent &) { void FrameMain::OnSnapVidToSubsStart (wxCommandEvent &) {
if (VideoContext::Get()->IsLoaded() && SubsBox->GetSelection().Count() > 0) { if (VideoContext::Get()->IsLoaded() && SubsGrid->GetSelection().Count() > 0) {
SubsBox->SetVideoToSubs(true); SubsGrid->SetVideoToSubs(true);
} }
} }
/// @brief DOCME /// @brief DOCME
void FrameMain::OnSnapVidToSubsEnd (wxCommandEvent &) { void FrameMain::OnSnapVidToSubsEnd (wxCommandEvent &) {
if (VideoContext::Get()->IsLoaded() && SubsBox->GetSelection().Count() > 0) { if (VideoContext::Get()->IsLoaded() && SubsGrid->GetSelection().Count() > 0) {
SubsBox->SetVideoToSubs(false); SubsGrid->SetVideoToSubs(false);
} }
} }
@ -1097,7 +1097,7 @@ void FrameMain::OnSnapVidToSubsEnd (wxCommandEvent &) {
void FrameMain::OnSnapToScene (wxCommandEvent &) { void FrameMain::OnSnapToScene (wxCommandEvent &) {
if (VideoContext::Get()->IsLoaded()) { if (VideoContext::Get()->IsLoaded()) {
// Get frames // Get frames
wxArrayInt sel = SubsBox->GetSelection(); wxArrayInt sel = SubsGrid->GetSelection();
int curFrame = VideoContext::Get()->GetFrameN(); int curFrame = VideoContext::Get()->GetFrameN();
int prev = 0; int prev = 0;
int next = 0; int next = 0;
@ -1139,33 +1139,33 @@ void FrameMain::OnSnapToScene (wxCommandEvent &) {
// Update rows // Update rows
for (size_t i=0;i<sel.Count();i++) { for (size_t i=0;i<sel.Count();i++) {
cur = SubsBox->GetDialogue(sel[i]); cur = SubsGrid->GetDialogue(sel[i]);
cur->Start.SetMS(start_ms); cur->Start.SetMS(start_ms);
cur->End.SetMS(end_ms); cur->End.SetMS(end_ms);
} }
// Commit // Commit
SubsBox->editBox->Update(true); SubsGrid->editBox->Update(true);
SubsBox->ass->FlagAsModified(_("snap to scene")); SubsGrid->ass->FlagAsModified(_("snap to scene"));
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
} }
} }
/// @brief Shift to frame /// @brief Shift to frame
void FrameMain::OnShiftToFrame (wxCommandEvent &) { void FrameMain::OnShiftToFrame (wxCommandEvent &) {
if (VideoContext::Get()->IsLoaded()) { if (VideoContext::Get()->IsLoaded()) {
wxArrayInt sels = SubsBox->GetSelection(); wxArrayInt sels = SubsGrid->GetSelection();
size_t n=sels.Count(); size_t n=sels.Count();
if (n == 0) return; if (n == 0) return;
// Get shifting in ms // Get shifting in ms
AssDialogue *cur = SubsBox->GetDialogue(sels[0]); AssDialogue *cur = SubsGrid->GetDialogue(sels[0]);
if (!cur) return; if (!cur) return;
int shiftBy = VFR_Output.GetTimeAtFrame(VideoContext::Get()->GetFrameN(),true) - cur->Start.GetMS(); int shiftBy = VFR_Output.GetTimeAtFrame(VideoContext::Get()->GetFrameN(),true) - cur->Start.GetMS();
// Update // Update
for (size_t i=0;i<n;i++) { for (size_t i=0;i<n;i++) {
cur = SubsBox->GetDialogue(sels[i]); cur = SubsGrid->GetDialogue(sels[i]);
if (cur) { if (cur) {
cur->Start.SetMS(cur->Start.GetMS()+shiftBy); cur->Start.SetMS(cur->Start.GetMS()+shiftBy);
cur->End.SetMS(cur->End.GetMS()+shiftBy); cur->End.SetMS(cur->End.GetMS()+shiftBy);
@ -1173,9 +1173,9 @@ void FrameMain::OnShiftToFrame (wxCommandEvent &) {
} }
// Commit // Commit
SubsBox->ass->FlagAsModified(_("shift to frame")); SubsGrid->ass->FlagAsModified(_("shift to frame"));
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
SubsBox->editBox->Update(true,false); SubsGrid->editBox->Update(true,false);
} }
} }
@ -1183,7 +1183,7 @@ void FrameMain::OnShiftToFrame (wxCommandEvent &) {
void FrameMain::OnUndo(wxCommandEvent&) { void FrameMain::OnUndo(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
AssFile::StackPop(); AssFile::StackPop();
SubsBox->LoadFromAss(AssFile::top,true); SubsGrid->LoadFromAss(AssFile::top,true);
AssFile::Popping = false; AssFile::Popping = false;
} }
@ -1191,7 +1191,7 @@ void FrameMain::OnUndo(wxCommandEvent&) {
void FrameMain::OnRedo(wxCommandEvent&) { void FrameMain::OnRedo(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
AssFile::StackRedo(); AssFile::StackRedo();
SubsBox->LoadFromAss(AssFile::top,true); SubsGrid->LoadFromAss(AssFile::top,true);
AssFile::Popping = false; AssFile::Popping = false;
} }
@ -1317,7 +1317,7 @@ void FrameMain::OnCut (wxCommandEvent &) {
EditBox->TextEdit->Cut(); EditBox->TextEdit->Cut();
return; return;
} }
SubsBox->CutLines(SubsBox->GetSelection()); SubsGrid->CutLines(SubsGrid->GetSelection());
} }
@ -1327,7 +1327,7 @@ void FrameMain::OnCopy (wxCommandEvent &) {
EditBox->TextEdit->Copy(); EditBox->TextEdit->Copy();
return; return;
} }
SubsBox->CopyLines(SubsBox->GetSelection()); SubsGrid->CopyLines(SubsGrid->GetSelection());
} }
@ -1337,24 +1337,24 @@ void FrameMain::OnPaste (wxCommandEvent &) {
EditBox->TextEdit->Paste(); EditBox->TextEdit->Paste();
return; return;
} }
SubsBox->PasteLines(SubsBox->GetFirstSelRow()); SubsGrid->PasteLines(SubsGrid->GetFirstSelRow());
} }
/// @brief Paste over /// @brief Paste over
void FrameMain::OnPasteOver (wxCommandEvent &) { void FrameMain::OnPasteOver (wxCommandEvent &) {
SubsBox->PasteLines(SubsBox->GetFirstSelRow(),true); SubsGrid->PasteLines(SubsGrid->GetFirstSelRow(),true);
} }
/// @brief Select visible lines /// @brief Select visible lines
void FrameMain::OnSelectVisible (wxCommandEvent &) { void FrameMain::OnSelectVisible (wxCommandEvent &) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
SubsBox->SelectVisible(); SubsGrid->SelectVisible();
} }
/// @brief Open select dialog /// @brief Open select dialog
void FrameMain::OnSelect (wxCommandEvent &) { void FrameMain::OnSelect (wxCommandEvent &) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
DialogSelection select(this, SubsBox); DialogSelection select(this, SubsGrid);
select.ShowModal(); select.ShowModal();
} }
@ -1362,28 +1362,28 @@ void FrameMain::OnSelect (wxCommandEvent &) {
void FrameMain::OnSortStart (wxCommandEvent &) { void FrameMain::OnSortStart (wxCommandEvent &) {
AssFile::top->Sort(); AssFile::top->Sort();
AssFile::top->FlagAsModified(_("sort")); AssFile::top->FlagAsModified(_("sort"));
SubsBox->UpdateMaps(); SubsGrid->UpdateMaps();
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
} }
/// @brief Sort subtitles by end time /// @brief Sort subtitles by end time
void FrameMain::OnSortEnd (wxCommandEvent &) { void FrameMain::OnSortEnd (wxCommandEvent &) {
AssFile::top->Sort(AssFile::CompEnd); AssFile::top->Sort(AssFile::CompEnd);
AssFile::top->FlagAsModified(_("sort")); AssFile::top->FlagAsModified(_("sort"));
SubsBox->UpdateMaps(); SubsGrid->UpdateMaps();
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
} }
/// @brief Sort subtitles by style name /// @brief Sort subtitles by style name
void FrameMain::OnSortStyle (wxCommandEvent &) { void FrameMain::OnSortStyle (wxCommandEvent &) {
AssFile::top->Sort(AssFile::CompStyle); AssFile::top->Sort(AssFile::CompStyle);
AssFile::top->FlagAsModified(_("sort")); AssFile::top->FlagAsModified(_("sort"));
SubsBox->UpdateMaps(); SubsGrid->UpdateMaps();
SubsBox->CommitChanges(); SubsGrid->CommitChanges();
} }
/// @brief Open styling assistant /// @brief Open styling assistant
void FrameMain::OnOpenStylingAssistant (wxCommandEvent &) { void FrameMain::OnOpenStylingAssistant (wxCommandEvent &) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
if (!stylingAssistant) stylingAssistant = new DialogStyling(this,SubsBox); if (!stylingAssistant) stylingAssistant = new DialogStyling(this,SubsGrid);
stylingAssistant->Show(true); stylingAssistant->Show(true);
} }
@ -1461,18 +1461,18 @@ void FrameMain::OnFocusSeek(wxCommandEvent &) {
void FrameMain::OnPrevLine(wxCommandEvent &) { void FrameMain::OnPrevLine(wxCommandEvent &) {
int next = EditBox->linen-1; int next = EditBox->linen-1;
if (next < 0) return; if (next < 0) return;
SubsBox->SelectRow(next); SubsGrid->SelectRow(next);
SubsBox->MakeCellVisible(next,0); SubsGrid->MakeCellVisible(next,0);
EditBox->SetToLine(next); EditBox->SetToLine(next);
} }
/// @brief Next line hotkey /// @brief Next line hotkey
void FrameMain::OnNextLine(wxCommandEvent &) { void FrameMain::OnNextLine(wxCommandEvent &) {
int nrows = SubsBox->GetRows(); int nrows = SubsGrid->GetRows();
int next = EditBox->linen+1; int next = EditBox->linen+1;
if (next >= nrows) return; if (next >= nrows) return;
SubsBox->SelectRow(next); SubsGrid->SelectRow(next);
SubsBox->MakeCellVisible(next,0); SubsGrid->MakeCellVisible(next,0);
EditBox->SetToLine(next); EditBox->SetToLine(next);
} }
@ -1494,11 +1494,11 @@ void FrameMain::OnToggleTags(wxCommandEvent &) {
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(tagMode); OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(tagMode);
// Refresh grid // Refresh grid
SubsBox->Refresh(false); SubsGrid->Refresh(false);
} }
void FrameMain::OnSetTags(wxCommandEvent &event) { void FrameMain::OnSetTags(wxCommandEvent &event) {
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(event.GetId() - Menu_View_FullTags); OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(event.GetId() - Menu_View_FullTags);
SubsBox->Refresh(false); SubsGrid->Refresh(false);
} }
/// @brief Commit Edit Box's changes /// @brief Commit Edit Box's changes

View file

@ -506,7 +506,7 @@ END_EVENT_TABLE()
void AegisubApp::OnMouseWheel(wxMouseEvent &event) { void AegisubApp::OnMouseWheel(wxMouseEvent &event) {
wxPoint pt; wxPoint pt;
wxWindow *target = wxFindWindowAtPointer(pt); wxWindow *target = wxFindWindowAtPointer(pt);
if (frame && (target == frame->audioBox->audioDisplay || target == frame->SubsBox)) { if (frame && (target == frame->audioBox->audioDisplay || target == frame->SubsGrid)) {
if (target->IsShownOnScreen()) target->GetEventHandler()->ProcessEvent(event); if (target->IsShownOnScreen()) target->GetEventHandler()->ProcessEvent(event);
else event.Skip(); else event.Skip();
} }