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 weak
///
void SubsEditBox::Update (bool timeOnly,bool weak,bool video) {
void SubsEditBox::Update (bool timeOnly,bool weak) {
if (enabled) {
AssDialogue *curdiag = grid->GetActiveLine();
if (curdiag) {
@ -301,7 +301,6 @@ void SubsEditBox::Update (bool timeOnly,bool weak,bool video) {
// Video
VideoContext::Get()->curLine = curdiag;
if (video) VideoContext::Get()->UpdateDisplays(false);
TextEdit->EmptyUndoBuffer();
}

View File

@ -255,7 +255,7 @@ public:
void SetSplitLineMode(wxSize size=wxSize(-1,-1));
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 UpdateFrameTiming();
void DoKeyPress(wxKeyEvent &event);

View File

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

View File

@ -134,7 +134,6 @@ VideoDisplay::VideoDisplay(VideoBox *box, VideoSlider *ControlSlider, wxTextCtrl
, SubsPosition(SubsPosition)
, PositionDisplay(PositionDisplay)
, videoOut(new VideoOutGL())
, tool(new VisualToolCross(this, video, box->visualSubToolBar))
, activeMode(Video_Mode_Standard)
, toolBar(box->visualSubToolBar)
, 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);
// 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(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
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(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, 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));
}

View File

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