Save selection over undo/redo.

Originally committed to SVN as r4668.
This commit is contained in:
Thomas Goyne 2010-07-09 07:31:43 +00:00
parent 2e5dc176db
commit 5e22a0f151

View file

@ -1168,17 +1168,25 @@ void FrameMain::OnShiftToFrame (wxCommandEvent &) {
/// @brief Undo /// @brief Undo
void FrameMain::OnUndo(wxCommandEvent&) { void FrameMain::OnUndo(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
int active_line = SubsGrid->GetDialogueIndex(SubsGrid->GetActiveLine());
AssFile::top->Undo(); AssFile::top->Undo();
UpdateTitle(); UpdateTitle();
SubsGrid->UpdateMaps(); SubsGrid->UpdateMaps();
SubsGrid->SetSelectionFromAbsolute(selected_lines);
SubsGrid->SetActiveLine(SubsGrid->GetDialogue(active_line));
} }
/// @brief Redo /// @brief Redo
void FrameMain::OnRedo(wxCommandEvent&) { void FrameMain::OnRedo(wxCommandEvent&) {
VideoContext::Get()->Stop(); VideoContext::Get()->Stop();
std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
int active_line = SubsGrid->GetDialogueIndex(SubsGrid->GetActiveLine());
AssFile::top->Redo(); AssFile::top->Redo();
UpdateTitle(); UpdateTitle();
SubsGrid->UpdateMaps(); SubsGrid->UpdateMaps();
SubsGrid->SetSelectionFromAbsolute(selected_lines);
SubsGrid->SetActiveLine(SubsGrid->GetDialogue(active_line));
} }
/// @brief Find /// @brief Find