Remove the realtime visual tool option, as the threaded video display makes it pointless

Originally committed to SVN as r4825.
This commit is contained in:
Thomas Goyne 2010-10-26 04:12:10 +00:00
parent 3174f995fa
commit 6432ea1f94
9 changed files with 25 additions and 96 deletions

View File

@ -423,11 +423,7 @@ void SubsEditBox::UpdateFrameTiming () {
void SubsEditBox::OnKeyDown(wxKeyEvent &event) { void SubsEditBox::OnKeyDown(wxKeyEvent &event) {
int key = event.GetKeyCode(); int key = event.GetKeyCode();
if (line && (key == WXK_RETURN || key == WXK_NUMPAD_ENTER)) { if (line && (key == WXK_RETURN || key == WXK_NUMPAD_ENTER)) {
#ifdef __APPLE__ NextLine();
Commit(event.m_metaDown);
#else
Commit(event.m_controlDown);
#endif
} }
else { else {
event.Skip(); event.Skip();
@ -435,18 +431,10 @@ void SubsEditBox::OnKeyDown(wxKeyEvent &event) {
} }
void SubsEditBox::OnCommitButton(wxCommandEvent &) { void SubsEditBox::OnCommitButton(wxCommandEvent &) {
#ifdef __APPLE__ if (line) NextLine();
Commit(wxGetMouseState().CmdDown());
#else
Commit(wxGetMouseState().ControlDown());
#endif
} }
void SubsEditBox::Commit(bool stay) { void SubsEditBox::NextLine() {
if (stay) {
VideoContext::Get()->Refresh();
return;
}
int next = grid->GetLastSelRow() + 1; int next = grid->GetLastSelRow() + 1;
if (next >= grid->GetRows()) { if (next >= grid->GetRows()) {
AssDialogue *cur = grid->GetDialogue(next-1); AssDialogue *cur = grid->GetDialogue(next-1);
@ -473,13 +461,12 @@ void SubsEditBox::OnChange(wxStyledTextEvent &event) {
template<class T, class setter> template<class T, class setter>
void SubsEditBox::SetSelectedRows(setter set, T value, wxString desc, bool amend) { void SubsEditBox::SetSelectedRows(setter set, T value, wxString desc, bool amend) {
using namespace std::tr1::placeholders; 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)); for_each(sel.begin(), sel.end(), std::tr1::bind(set, _1, value));
commitId = grid->ass->Commit(desc, (amend && desc == lastCommitType) ? commitId : -1); commitId = grid->ass->Commit(desc, (amend && desc == lastCommitType) ? commitId : -1);
lastCommitType = desc; lastCommitType = desc;
grid->CommitChanges(false, realtime->GetBool()); grid->CommitChanges(false);
} }
template<class T> template<class T>

View File

@ -123,9 +123,8 @@ class SubsEditBox : public wxPanel, protected SelectionListener<AssDialogue> {
/// Get block number at text position /// Get block number at text position
int BlockAtPos(int pos) const; int BlockAtPos(int pos) const;
/// @brief Refresh the video display and move to the next line /// @brief Move to the next line, creating it if needed
/// @param stay Only refresh the video void NextLine();
void Commit(bool stay);
int timeCommitId[3]; int timeCommitId[3];
int commitId; int commitId;

View File

@ -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_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->AddTool(Video_Mode_Vector_Clip,_("Vector Clip"),GETIMAGE(visual_vector_clip_24),_("Clip subtitles to a vectorial area."),wxITEM_RADIO);
visualToolBar->AddSeparator(); 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->AddTool(Video_Mode_Help,_("Help"),GETIMAGE(visual_help_24),_("Open the manual page for Visual Typesetting."));
visualToolBar->Realize(); visualToolBar->Realize();
// Avoid ugly themed background on Vista and possibly also Win7 // 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_BUTTON(Video_Stop, VideoBox::OnVideoStop)
EVT_TOGGLEBUTTON(Video_Auto_Scroll, VideoBox::OnVideoToggleScroll) EVT_TOGGLEBUTTON(Video_Auto_Scroll, VideoBox::OnVideoToggleScroll)
EVT_TOOL(Video_Mode_Realtime, VideoBox::OnToggleRealtime)
EVT_TOOL(Video_Mode_Help, VideoBox::OnHelp) EVT_TOOL(Video_Mode_Help, VideoBox::OnHelp)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -215,15 +212,6 @@ void VideoBox::OnVideoToggleScroll(wxCommandEvent &event) {
OPT_SET("Video/Subtitle Sync")->SetBool(AutoScroll->GetValue()); 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 /// @brief Help
/// @param event /// @param event
/// ///

View File

@ -70,7 +70,6 @@ private:
void OnVideoStop(wxCommandEvent &event); void OnVideoStop(wxCommandEvent &event);
void OnVideoToggleScroll(wxCommandEvent &event); void OnVideoToggleScroll(wxCommandEvent &event);
void OnToggleRealtime(wxCommandEvent &event);
void OnHelp(wxCommandEvent &event); void OnHelp(wxCommandEvent &event);
public: public:
@ -110,50 +109,19 @@ public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
///////
// IDs // IDs
enum { enum {
/// DOCME
Video_Play = 500, Video_Play = 500,
/// DOCME
Video_Play_Line, Video_Play_Line,
/// DOCME
Video_Stop, Video_Stop,
/// DOCME
Video_Auto_Scroll, Video_Auto_Scroll,
/// DOCME
Video_Mode_Standard, Video_Mode_Standard,
/// DOCME
Video_Mode_Drag, Video_Mode_Drag,
/// DOCME
Video_Mode_Rotate_Z, Video_Mode_Rotate_Z,
/// DOCME
Video_Mode_Rotate_XY, Video_Mode_Rotate_XY,
/// DOCME
Video_Mode_Scale, Video_Mode_Scale,
/// DOCME
Video_Mode_Clip, Video_Mode_Clip,
/// DOCME
Video_Mode_Vector_Clip, Video_Mode_Vector_Clip,
/// DOCME
Video_Mode_Realtime,
/// DOCME
Video_Mode_Help Video_Mode_Help
}; };

View File

@ -62,8 +62,7 @@ const wxColour IVisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,4
template<class FeatureType> template<class FeatureType>
VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& video) VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& video)
: realtime(OPT_GET("Video/Visual Realtime")) : dragStartX(0)
, dragStartX(0)
, dragStartY(0) , dragStartY(0)
, selChanged(false) , selChanged(false)
, selectedFeatures(selFeatures) , selectedFeatures(selFeatures)
@ -92,7 +91,6 @@ VisualTool<FeatureType>::~VisualTool() {
template<class FeatureType> template<class FeatureType>
void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) { void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
bool realTime = realtime->GetBool();
bool needRender = false; bool needRender = false;
if (event.Leaving()) { if (event.Leaving()) {
@ -136,14 +134,9 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
} }
} }
UpdateDrag(*cur); UpdateDrag(*cur);
CommitDrag(*cur);
if (realTime) {
CommitDrag(*cur);
}
}
if (realTime) {
Commit();
} }
Commit();
needRender = true; needRender = true;
} }
// end drag // end drag
@ -167,7 +160,7 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
for (selection_iterator cur = selFeatures.begin(); cur != selFeatures.end(); ++cur) { for (selection_iterator cur = selFeatures.begin(); cur != selFeatures.end(); ++cur) {
CommitDrag(*cur); CommitDrag(*cur);
} }
Commit(true); Commit();
} }
curFeature = features.end(); curFeature = features.end();
@ -179,22 +172,18 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
// continue hold // continue hold
if (event.LeftIsDown()) { if (event.LeftIsDown()) {
UpdateHold(); UpdateHold();
if (realTime) {
CommitHold();
Commit();
}
needRender = true; needRender = true;
} }
// end hold // end hold
else { else {
holding = false; holding = false;
CommitHold();
Commit(true);
parent->ReleaseMouse(); parent->ReleaseMouse();
parent->SetFocus(); parent->SetFocus();
} }
CommitHold();
Commit();
} }
else if (leftClick) { else if (leftClick) {
// start drag // start drag
@ -246,15 +235,14 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
} }
template<class FeatureType> template<class FeatureType>
void VisualTool<FeatureType>::Commit(bool full, wxString message) { void VisualTool<FeatureType>::Commit(wxString message) {
externalChange = false; externalChange = false;
if (full) { if (message.empty()) {
if (message.empty()) { message = _("visual typesetting");
message = _("visual typesetting");
}
grid->ass->Commit(message);
} }
grid->CommitChanges(full); grid->ass->Commit(message);
grid->CommitChanges();
externalChange = true; externalChange = true;
} }

View File

@ -95,7 +95,6 @@ protected:
typedef typename std::list<FeatureType>::iterator feature_iterator; typedef typename std::list<FeatureType>::iterator feature_iterator;
typedef typename std::list<FeatureType>::const_iterator feature_const_iterator; typedef typename std::list<FeatureType>::const_iterator feature_const_iterator;
private: private:
agi::OptionValue* realtime; /// Realtime updating option
int dragStartX; /// Starting x coordinate of the current drag, if any int dragStartX; /// Starting x coordinate of the current drag, if any
int dragStartY; /// Starting y 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(); void DrawAllFeatures();
/// @brief Commit the current file state /// @brief Commit the current file state
/// @param message Description of changes for undo /// @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 /// @brief Add a feature (and its line) to the selection
/// @param i Index in the feature list /// @param i Index in the feature list

View File

@ -69,7 +69,7 @@ bool VisualToolCross::Update() {
SetOverride(*cur, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy)); SetOverride(*cur, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy));
} }
Commit(true, _("positioning")); Commit(_("positioning"));
return false; return false;
} }

View File

@ -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())); 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(); Refresh();
UpdateToggleButtons(); UpdateToggleButtons();
} }
@ -376,7 +376,7 @@ bool VisualToolDrag::Update() {
} }
} }
Commit(true, _("positioning")); Commit(_("positioning"));
OnFileChanged(); OnFileChanged();
return false; return false;

View File

@ -323,7 +323,7 @@ bool VisualToolVectorClip::InitializeDrag(feature_iterator feature) {
Save(); Save();
MakeFeatures(); MakeFeatures();
Commit(true, _("delete control point")); Commit(_("delete control point"));
return false; return false;
} }
@ -402,7 +402,7 @@ bool VisualToolVectorClip::InitializeHold() {
// Commit // Commit
Save(); Save();
MakeFeatures(); MakeFeatures();
Commit(true); Commit();
return false; return false;
} }