(svn r22242) -Codechange: Let OnInvalidateData() decide itself what to do immediately in command scope, and what to do asynchronously in GUI-scope.

This commit is contained in:
frosch
2011-03-13 21:32:13 +00:00
parent 4b4a40a72e
commit 335744a1af
3 changed files with 36 additions and 33 deletions

View File

@@ -434,22 +434,16 @@ public:
/**
* Mark this window's data as invalid (in need of re-computing)
* @param data The data to invalidate with
* @param gui_scope Whether the funtion is called from GUI scope.
*/
void InvalidateData(int data = 0)
void InvalidateData(int data = 0, bool gui_scope = true)
{
this->SetDirty();
this->OnInvalidateData(data);
}
/**
* Schedule a invalidation call for next redraw.
* Important for asynchronous invalidation from commands.
* @param data The data to invalidate with
*/
void ScheduleInvalidateData(int data = 0)
{
this->SetDirty();
*this->scheduled_invalidation_data.Append() = data;
if (!gui_scope) {
/* Schedule GUI-scope invalidation for next redraw. */
*this->scheduled_invalidation_data.Append() = data;
}
this->OnInvalidateData(data, gui_scope);
}
/**
@@ -458,7 +452,7 @@ public:
void ProcessScheduledInvalidations()
{
for (int *data = this->scheduled_invalidation_data.Begin(); this->window_class != WC_INVALID && data != this->scheduled_invalidation_data.End(); data++) {
this->OnInvalidateData(*data);
this->OnInvalidateData(*data, true);
}
this->scheduled_invalidation_data.Clear();
}