Don't create the default visual tool until video is loaded so that visual tools can assume video is loaded.

Originally committed to SVN as r4630.
This commit is contained in:
Thomas Goyne 2010-06-28 07:13:08 +00:00
parent dfb844b6ab
commit d30326b20d
5 changed files with 12 additions and 14 deletions

View file

@ -265,7 +265,7 @@ void SubsEditBox::SetSplitLineMode(wxSize newSize) {
/// @param timeOnly /// @param timeOnly
/// @param weak /// @param weak
/// ///
void SubsEditBox::Update (bool timeOnly,bool weak,bool video) { void SubsEditBox::Update (bool timeOnly,bool weak) {
if (enabled) { if (enabled) {
AssDialogue *curdiag = grid->GetActiveLine(); AssDialogue *curdiag = grid->GetActiveLine();
if (curdiag) { if (curdiag) {
@ -301,7 +301,6 @@ void SubsEditBox::Update (bool timeOnly,bool weak,bool video) {
// Video // Video
VideoContext::Get()->curLine = curdiag; VideoContext::Get()->curLine = curdiag;
if (video) VideoContext::Get()->UpdateDisplays(false);
TextEdit->EmptyUndoBuffer(); TextEdit->EmptyUndoBuffer();
} }

View file

@ -255,7 +255,7 @@ public:
void SetSplitLineMode(wxSize size=wxSize(-1,-1)); void SetSplitLineMode(wxSize size=wxSize(-1,-1));
void CommitText(bool weak=false); void CommitText(bool weak=false);
void Update(bool timeOnly=false,bool weak=false,bool video=true); void Update(bool timeOnly=false,bool weak=false);
void UpdateGlobals(); void UpdateGlobals();
void UpdateFrameTiming(); void UpdateFrameTiming();
void DoKeyPress(wxKeyEvent &event); void DoKeyPress(wxKeyEvent &event);

View file

@ -320,6 +320,8 @@ void VideoContext::RemoveDisplay(VideoDisplay *display) {
/// @param full /// @param full
/// ///
void VideoContext::UpdateDisplays(bool full) { void VideoContext::UpdateDisplays(bool full) {
if (!loaded) return;
for (std::list<VideoDisplay*>::iterator cur=displayList.begin();cur!=displayList.end();cur++) { for (std::list<VideoDisplay*>::iterator cur=displayList.begin();cur!=displayList.end();cur++) {
VideoDisplay *display = *cur; VideoDisplay *display = *cur;

View file

@ -134,7 +134,6 @@ VideoDisplay::VideoDisplay(VideoBox *box, VideoSlider *ControlSlider, wxTextCtrl
, SubsPosition(SubsPosition) , SubsPosition(SubsPosition)
, PositionDisplay(PositionDisplay) , PositionDisplay(PositionDisplay)
, videoOut(new VideoOutGL()) , videoOut(new VideoOutGL())
, tool(new VisualToolCross(this, video, box->visualSubToolBar))
, activeMode(Video_Mode_Standard) , activeMode(Video_Mode_Standard)
, toolBar(box->visualSubToolBar) , toolBar(box->visualSubToolBar)
, scriptW(INT_MIN) , scriptW(INT_MIN)
@ -326,16 +325,16 @@ void VideoDisplay::DrawOverscanMask(int sizeH, int sizeV, wxColor color, double
gl.SetLineColour(wxColor(0, 0, 0), 0.0, 1); gl.SetLineColour(wxColor(0, 0, 0), 0.0, 1);
// Draw sides // Draw sides
E(gl.DrawRectangle(gapH, 0, w-gapH, sizeV)); // Top E(gl.DrawRectangle(gapH, 0, w-gapH, sizeV)); // Top
E(gl.DrawRectangle(w-sizeH, gapV, w, h-gapV)); // Right E(gl.DrawRectangle(w-sizeH, gapV, w, h-gapV)); // Right
E(gl.DrawRectangle(gapH, h-sizeV, w-gapH, h)); // Bottom E(gl.DrawRectangle(gapH, h-sizeV, w-gapH, h)); // Bottom
E(gl.DrawRectangle(0, gapV, sizeH, h-gapV)); // Left E(gl.DrawRectangle(0, gapV, sizeH, h-gapV)); // Left
// Draw rounded corners // Draw rounded corners
E(gl.DrawRing(gapH, gapV, rad1, rad2, 1.0, 180.0, 270.0)); // Top-left E(gl.DrawRing(gapH, gapV, rad1, rad2, 1.0, 180.0, 270.0)); // Top-left
E(gl.DrawRing(w-gapH, gapV, rad1, rad2, 1.0, 90.0, 180.0)); // Top-right E(gl.DrawRing(w-gapH, gapV, rad1, rad2, 1.0, 90.0, 180.0)); // Top-right
E(gl.DrawRing(w-gapH, h-gapV, rad1, rad2, 1.0, 0.0, 90.0)); // Bottom-right E(gl.DrawRing(w-gapH, h-gapV, rad1, rad2, 1.0, 0.0, 90.0)); // Bottom-right
E(gl.DrawRing(gapH, h-gapV, rad1, rad2, 1.0,270.0,360.0)); // Bottom-left E(gl.DrawRing(gapH, h-gapV, rad1, rad2, 1.0,270.0,360.0)); // Bottom-left
E(glDisable(GL_BLEND)); E(glDisable(GL_BLEND));
} }

View file

@ -90,10 +90,8 @@ VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& vide
, ctrlDown(false) , ctrlDown(false)
, altDown(false) , altDown(false)
{ {
if (VideoContext::Get()->IsLoaded()) { frame_n = VideoContext::Get()->GetFrameN();
frame_n = VideoContext::Get()->GetFrameN(); grid->AddSelectionListener(this);
VideoContext::Get()->grid->AddSelectionListener(this);
}
PopulateFeatureList(); PopulateFeatureList();
} }
@ -284,7 +282,7 @@ void VisualTool<FeatureType>::Commit(bool full, wxString message) {
} }
grid->CommitChanges(false,!full); grid->CommitChanges(false,!full);
if (full) if (full)
grid->editBox->Update(false, true, false); grid->editBox->Update(false, true);
} }
template<class FeatureType> template<class FeatureType>