From 30c2924b9f6cbe30896d2c8ff1c3505ba79f3a88 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 17 Feb 2013 01:16:11 +0000 Subject: [PATCH] Try to fix flickery updates (#59). --- src/wx/job_manager_view.cc | 6 +++--- src/wx/wx_util.cc | 8 ++++++++ src/wx/wx_util.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc index 8bede709f..7537da287 100644 --- a/src/wx/job_manager_view.cc +++ b/src/wx/job_manager_view.cc @@ -98,17 +98,17 @@ JobManagerView::update () if (!(*i)->finished ()) { float const p = (*i)->overall_progress (); if (p >= 0) { - _job_records[*i].message->SetLabel (std_to_wx (st)); + checked_set (_job_records[*i].message, st); _job_records[*i].gauge->SetValue (p * 100); } else { - _job_records[*i].message->SetLabel (_("Running")); + checked_set (_job_records[*i].message, wx_to_std (_("Running"))); _job_records[*i].gauge->Pulse (); } } if ((*i)->finished() && !_job_records[*i].finalised) { _job_records[*i].gauge->SetValue (100); - _job_records[*i].message->SetLabel (std_to_wx (st)); + checked_set (_job_records[*i].message, st); _job_records[*i].finalised = true; if (!(*i)->error_details().empty ()) { _job_records[*i].details->Enable (true); diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 632dbc32e..bf78ff4d7 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -170,6 +170,14 @@ checked_set (wxTextCtrl* widget, string value) } } +void +checked_set (wxStaticText* widget, string value) +{ + if (widget->GetLabel() != std_to_wx (value)) { + widget->SetLabel (std_to_wx (value)); + } +} + void checked_set (wxCheckBox* widget, bool value) { diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index dd069a9d7..6cde08a90 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -63,3 +63,4 @@ extern void checked_set (wxChoice* widget, std::string value); extern void checked_set (wxTextCtrl* widget, std::string value); extern void checked_set (wxCheckBox* widget, bool value); extern void checked_set (wxRadioButton* widget, bool value); +extern void checked_set (wxStaticText* widget, std::string value); -- 2.30.2