From 16ab6082df2b5e9b9bc71cbadffdb36c35af888b Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Thu, 12 Apr 2007 18:27:14 +0000 Subject: [PATCH] Un-broke selected_lines in Automation Originally committed to SVN as r1061. --- aegisub/frame_main_events.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 4d3a1ef57..0a53d98c5 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -949,13 +949,19 @@ void FrameMain::OnOpenAutomation (wxCommandEvent &event) { /////////////////////////////////////////////////////////// // General handler for all Automation-generated menu items void FrameMain::OnAutomationMacro (wxCommandEvent &event) { + SubsBox->BeginBatch(); + // First get selection data + // This much be done before clearing the maps, since selection data are lost during that + std::vector selected_lines = SubsBox->GetAbsoluteSelection(); + int first_sel = SubsBox->GetFirstSelRow(); // 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 SubsBox->Clear(); // Run the macro... - activeMacroItems[event.GetId()-Menu_Automation_Macro]->Process(SubsBox->ass, SubsBox->GetAbsoluteSelection(), SubsBox->GetFirstSelRow(), this); + activeMacroItems[event.GetId()-Menu_Automation_Macro]->Process(SubsBox->ass, selected_lines, first_sel, this); // Have the grid update its maps, this properly refreshes it to reflect the changed subs SubsBox->UpdateMaps(); + SubsBox->EndBatch(); }