From 6432ea1f9446f1156ec3eaeeb9c7c8c4aea40625 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 Oct 2010 04:12:10 +0000 Subject: [PATCH] Remove the realtime visual tool option, as the threaded video display makes it pointless Originally committed to SVN as r4825. --- aegisub/src/subs_edit_box.cpp | 21 +++----------- aegisub/src/subs_edit_box.h | 5 ++-- aegisub/src/video_box.cpp | 12 -------- aegisub/src/video_box.h | 32 --------------------- aegisub/src/visual_tool.cpp | 38 +++++++++---------------- aegisub/src/visual_tool.h | 3 +- aegisub/src/visual_tool_cross.cpp | 2 +- aegisub/src/visual_tool_drag.cpp | 4 +-- aegisub/src/visual_tool_vector_clip.cpp | 4 +-- 9 files changed, 25 insertions(+), 96 deletions(-) diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index 03b85b369..142b02c4a 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -423,11 +423,7 @@ void SubsEditBox::UpdateFrameTiming () { void SubsEditBox::OnKeyDown(wxKeyEvent &event) { int key = event.GetKeyCode(); if (line && (key == WXK_RETURN || key == WXK_NUMPAD_ENTER)) { -#ifdef __APPLE__ - Commit(event.m_metaDown); -#else - Commit(event.m_controlDown); -#endif + NextLine(); } else { event.Skip(); @@ -435,18 +431,10 @@ void SubsEditBox::OnKeyDown(wxKeyEvent &event) { } void SubsEditBox::OnCommitButton(wxCommandEvent &) { -#ifdef __APPLE__ - Commit(wxGetMouseState().CmdDown()); -#else - Commit(wxGetMouseState().ControlDown()); -#endif + if (line) NextLine(); } -void SubsEditBox::Commit(bool stay) { - if (stay) { - VideoContext::Get()->Refresh(); - return; - } +void SubsEditBox::NextLine() { int next = grid->GetLastSelRow() + 1; if (next >= grid->GetRows()) { AssDialogue *cur = grid->GetDialogue(next-1); @@ -473,13 +461,12 @@ void SubsEditBox::OnChange(wxStyledTextEvent &event) { template void SubsEditBox::SetSelectedRows(setter set, T value, wxString desc, bool amend) { using namespace std::tr1::placeholders; - static agi::OptionValue* realtime = OPT_GET("Video/Visual Realtime"); for_each(sel.begin(), sel.end(), std::tr1::bind(set, _1, value)); commitId = grid->ass->Commit(desc, (amend && desc == lastCommitType) ? commitId : -1); lastCommitType = desc; - grid->CommitChanges(false, realtime->GetBool()); + grid->CommitChanges(false); } template diff --git a/aegisub/src/subs_edit_box.h b/aegisub/src/subs_edit_box.h index 71cd9b44b..0f3735958 100644 --- a/aegisub/src/subs_edit_box.h +++ b/aegisub/src/subs_edit_box.h @@ -123,9 +123,8 @@ class SubsEditBox : public wxPanel, protected SelectionListener { /// Get block number at text position int BlockAtPos(int pos) const; - /// @brief Refresh the video display and move to the next line - /// @param stay Only refresh the video - void Commit(bool stay); + /// @brief Move to the next line, creating it if needed + void NextLine(); int timeCommitId[3]; int commitId; diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index a90e89735..ee1f2b072 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -105,8 +105,6 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox) visualToolBar->AddTool(Video_Mode_Clip,_("Clip"),GETIMAGE(visual_clip_24),_("Clip subtitles to a rectangle."),wxITEM_RADIO); visualToolBar->AddTool(Video_Mode_Vector_Clip,_("Vector Clip"),GETIMAGE(visual_vector_clip_24),_("Clip subtitles to a vectorial area."),wxITEM_RADIO); visualToolBar->AddSeparator(); - visualToolBar->AddTool(Video_Mode_Realtime,_("Realtime"),GETIMAGE(visual_realtime_24),_("Toggle realtime display of changes."),wxITEM_CHECK); - visualToolBar->ToggleTool(Video_Mode_Realtime,OPT_GET("Video/Visual Realtime")->GetBool()); visualToolBar->AddTool(Video_Mode_Help,_("Help"),GETIMAGE(visual_help_24),_("Open the manual page for Visual Typesetting.")); visualToolBar->Realize(); // Avoid ugly themed background on Vista and possibly also Win7 @@ -163,7 +161,6 @@ BEGIN_EVENT_TABLE(VideoBox, wxPanel) EVT_BUTTON(Video_Stop, VideoBox::OnVideoStop) EVT_TOGGLEBUTTON(Video_Auto_Scroll, VideoBox::OnVideoToggleScroll) - EVT_TOOL(Video_Mode_Realtime, VideoBox::OnToggleRealtime) EVT_TOOL(Video_Mode_Help, VideoBox::OnHelp) END_EVENT_TABLE() @@ -215,15 +212,6 @@ void VideoBox::OnVideoToggleScroll(wxCommandEvent &event) { OPT_SET("Video/Subtitle Sync")->SetBool(AutoScroll->GetValue()); } -/// @brief Realtime toggle -/// @param event -/// -void VideoBox::OnToggleRealtime(wxCommandEvent &event) { - OPT_SET("Video/Visual Realtime")->SetBool(event.IsChecked()); -} - - - /// @brief Help /// @param event /// diff --git a/aegisub/src/video_box.h b/aegisub/src/video_box.h index 1871863a2..f3d2917f8 100644 --- a/aegisub/src/video_box.h +++ b/aegisub/src/video_box.h @@ -70,7 +70,6 @@ private: void OnVideoStop(wxCommandEvent &event); void OnVideoToggleScroll(wxCommandEvent &event); - void OnToggleRealtime(wxCommandEvent &event); void OnHelp(wxCommandEvent &event); public: @@ -110,50 +109,19 @@ public: DECLARE_EVENT_TABLE() }; - -/////// // IDs enum { - - /// DOCME Video_Play = 500, - - /// DOCME Video_Play_Line, - - /// DOCME Video_Stop, - - /// DOCME Video_Auto_Scroll, - - /// DOCME Video_Mode_Standard, - - /// DOCME Video_Mode_Drag, - - /// DOCME Video_Mode_Rotate_Z, - - /// DOCME Video_Mode_Rotate_XY, - - /// DOCME Video_Mode_Scale, - - /// DOCME Video_Mode_Clip, - - /// DOCME Video_Mode_Vector_Clip, - - /// DOCME - Video_Mode_Realtime, - - /// DOCME Video_Mode_Help }; - - diff --git a/aegisub/src/visual_tool.cpp b/aegisub/src/visual_tool.cpp index 018b6f153..b121b7914 100644 --- a/aegisub/src/visual_tool.cpp +++ b/aegisub/src/visual_tool.cpp @@ -62,8 +62,7 @@ const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,4 template VisualTool::VisualTool(VideoDisplay *parent, VideoState const& video) -: realtime(OPT_GET("Video/Visual Realtime")) -, dragStartX(0) +: dragStartX(0) , dragStartY(0) , selChanged(false) , selectedFeatures(selFeatures) @@ -92,7 +91,6 @@ VisualTool::~VisualTool() { template void VisualTool::OnMouseEvent(wxMouseEvent &event) { - bool realTime = realtime->GetBool(); bool needRender = false; if (event.Leaving()) { @@ -136,14 +134,9 @@ void VisualTool::OnMouseEvent(wxMouseEvent &event) { } } UpdateDrag(*cur); - - if (realTime) { - CommitDrag(*cur); - } - } - if (realTime) { - Commit(); + CommitDrag(*cur); } + Commit(); needRender = true; } // end drag @@ -167,7 +160,7 @@ void VisualTool::OnMouseEvent(wxMouseEvent &event) { for (selection_iterator cur = selFeatures.begin(); cur != selFeatures.end(); ++cur) { CommitDrag(*cur); } - Commit(true); + Commit(); } curFeature = features.end(); @@ -179,22 +172,18 @@ void VisualTool::OnMouseEvent(wxMouseEvent &event) { // continue hold if (event.LeftIsDown()) { UpdateHold(); - - if (realTime) { - CommitHold(); - Commit(); - } needRender = true; } // end hold else { holding = false; - CommitHold(); - Commit(true); parent->ReleaseMouse(); parent->SetFocus(); } + CommitHold(); + Commit(); + } else if (leftClick) { // start drag @@ -246,15 +235,14 @@ void VisualTool::OnMouseEvent(wxMouseEvent &event) { } template -void VisualTool::Commit(bool full, wxString message) { +void VisualTool::Commit(wxString message) { externalChange = false; - if (full) { - if (message.empty()) { - message = _("visual typesetting"); - } - grid->ass->Commit(message); + if (message.empty()) { + message = _("visual typesetting"); } - grid->CommitChanges(full); + grid->ass->Commit(message); + + grid->CommitChanges(); externalChange = true; } diff --git a/aegisub/src/visual_tool.h b/aegisub/src/visual_tool.h index f248a67b7..3de795b72 100644 --- a/aegisub/src/visual_tool.h +++ b/aegisub/src/visual_tool.h @@ -95,7 +95,6 @@ protected: typedef typename std::list::iterator feature_iterator; typedef typename std::list::const_iterator feature_const_iterator; private: - agi::OptionValue* realtime; /// Realtime updating option int dragStartX; /// Starting x coordinate of the current drag, if any int dragStartY; /// Starting y coordinate of the current drag, if any @@ -185,7 +184,7 @@ protected: void DrawAllFeatures(); /// @brief Commit the current file state /// @param message Description of changes for undo - void Commit(bool full=false, wxString message = L""); + void Commit(wxString message = L""); /// @brief Add a feature (and its line) to the selection /// @param i Index in the feature list diff --git a/aegisub/src/visual_tool_cross.cpp b/aegisub/src/visual_tool_cross.cpp index 30992dbbf..71de35b30 100644 --- a/aegisub/src/visual_tool_cross.cpp +++ b/aegisub/src/visual_tool_cross.cpp @@ -69,7 +69,7 @@ bool VisualToolCross::Update() { SetOverride(*cur, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy)); } - Commit(true, _("positioning")); + Commit(_("positioning")); return false; } diff --git a/aegisub/src/visual_tool_drag.cpp b/aegisub/src/visual_tool_drag.cpp index 609b69495..753a051b7 100644 --- a/aegisub/src/visual_tool_drag.cpp +++ b/aegisub/src/visual_tool_drag.cpp @@ -109,7 +109,7 @@ void VisualToolDrag::OnSubTool(wxCommandEvent &) { else SetOverride(line, L"\\move",wxString::Format(L"(%i,%i,%i,%i,%i,%i)",x1,y1,x1,y1,0,line->End.GetMS() - line->Start.GetMS())); } - Commit(true); + Commit(); Refresh(); UpdateToggleButtons(); } @@ -376,7 +376,7 @@ bool VisualToolDrag::Update() { } } - Commit(true, _("positioning")); + Commit(_("positioning")); OnFileChanged(); return false; diff --git a/aegisub/src/visual_tool_vector_clip.cpp b/aegisub/src/visual_tool_vector_clip.cpp index 2831609ab..53bd86543 100644 --- a/aegisub/src/visual_tool_vector_clip.cpp +++ b/aegisub/src/visual_tool_vector_clip.cpp @@ -323,7 +323,7 @@ bool VisualToolVectorClip::InitializeDrag(feature_iterator feature) { Save(); MakeFeatures(); - Commit(true, _("delete control point")); + Commit(_("delete control point")); return false; } @@ -402,7 +402,7 @@ bool VisualToolVectorClip::InitializeHold() { // Commit Save(); MakeFeatures(); - Commit(true); + Commit(); return false; }