Eliminate an unnecessary call to VideoContext::UpdateDisplays triggered by SubsEditBox::SetToLine, moderately improving responsiveness when working with lines that take a long time to render.

Originally committed to SVN as r3925.
This commit is contained in:
Thomas Goyne 2010-01-02 06:23:02 +00:00
parent 931326e3c0
commit 8513fef7e2
2 changed files with 11 additions and 8 deletions

View File

@ -261,10 +261,11 @@ void SubsEditBox::SetSplitLineMode(wxSize newSize) {
/// @brief Update function
/// @param timeOnly
/// @param weak
/// @param timeOnly If true, only update the time fields
/// @param weak ?
/// @param video If true, update the video display
///
void SubsEditBox::Update (bool timeOnly,bool weak) {
void SubsEditBox::Update (bool timeOnly,bool weak,bool video) {
if (enabled) {
AssDialogue *curdiag = grid->GetDialogue(linen);
if (curdiag) {
@ -300,7 +301,7 @@ void SubsEditBox::Update (bool timeOnly,bool weak) {
// Video
VideoContext::Get()->curLine = curdiag;
VideoContext::Get()->UpdateDisplays(false);
if (video) VideoContext::Get()->UpdateDisplays(false);
TextEdit->EmptyUndoBuffer();
}
@ -352,10 +353,12 @@ void SubsEditBox::SetToLine(int n,bool weak) {
// Set to nothing
if (n == -1) {
enabled = false;
SetControlsState(false);
return;
}
// Set line
else if (grid->GetDialogue(n)) {
if (grid->GetDialogue(n)) {
enabled = true;
if (n != linen) {
linen = n;
@ -366,7 +369,7 @@ void SubsEditBox::SetToLine(int n,bool weak) {
}
// Update controls
Update();
Update(false, false, false);
// Set video
if (VideoContext::Get()->IsLoaded() && !weak) {
@ -374,7 +377,7 @@ void SubsEditBox::SetToLine(int n,bool weak) {
if (Search.hasFocus) sync = _T("Find update video");
else sync = _T("Sync video with subs");
if (Options.AsBool(sync) == true) {
if (Options.AsBool(sync)) {
VideoContext::Get()->Stop();
AssDialogue *cur = grid->GetDialogue(n);
if (cur) VideoContext::Get()->JumpToFrame(VFR_Output.GetFrameAtTime(cur->Start.GetMS(),true));

View File

@ -251,7 +251,7 @@ public:
void SetSplitLineMode(wxSize size=wxSize(-1,-1));
void CommitText(bool weak=false);
void Update(bool timeOnly=false,bool weak=false);
void Update(bool timeOnly=false,bool weak=false,bool video=true);
void UpdateGlobals();
void SetToLine(int n,bool weak=false);
void UpdateFrameTiming();