summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-03-08 22:10:52 +0000
committerCarl Hetherington <cth@carlh.net>2016-03-10 17:44:20 +0000
commitcaee7a9456d4abb953d1311333bcdd3454883229 (patch)
tree40184ca54dbb3e497c675e9c73180787e5f2c318
parent4b7fab6e3dbb7cae32a2e0b66f1b6ca275367126 (diff)
Optimise opening of colour conversion editor slightly.
-rw-r--r--src/wx/colour_conversion_editor.cc10
-rw-r--r--src/wx/colour_conversion_editor.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/wx/colour_conversion_editor.cc b/src/wx/colour_conversion_editor.cc
index 36ca074fa..879b16b6f 100644
--- a/src/wx/colour_conversion_editor.cc
+++ b/src/wx/colour_conversion_editor.cc
@@ -37,6 +37,7 @@ using boost::lexical_cast;
ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv)
: wxPanel (parent, wxID_ANY)
+ , _ignore_chromaticity_changed (false)
{
wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
SetSizer (overall_sizer);
@@ -245,6 +246,8 @@ ColourConversionEditor::set (ColourConversion conversion)
_yuv_to_rgb->SetSelection (conversion.yuv_to_rgb ());
+ _ignore_chromaticity_changed = true;
+
SafeStringStream s;
s.setf (std::ios::fixed, std::ios::floatfield);
s.precision (6);
@@ -280,6 +283,8 @@ ColourConversionEditor::set (ColourConversion conversion)
s << conversion.white().y;
_white_y->SetValue (std_to_wx (s.str ()));
+ _ignore_chromaticity_changed = false;
+
if (conversion.adjusted_white ()) {
_adjust_white->SetValue (true);
s.str ("");
@@ -294,6 +299,7 @@ ColourConversionEditor::set (ColourConversion conversion)
update_rgb_to_xyz ();
update_bradford ();
+ changed ();
}
ColourConversion
@@ -365,6 +371,10 @@ ColourConversionEditor::changed ()
void
ColourConversionEditor::chromaticity_changed ()
{
+ if (_ignore_chromaticity_changed) {
+ return;
+ }
+
update_rgb_to_xyz ();
changed ();
}
diff --git a/src/wx/colour_conversion_editor.h b/src/wx/colour_conversion_editor.h
index 918f2a7d0..f1186aa2a 100644
--- a/src/wx/colour_conversion_editor.h
+++ b/src/wx/colour_conversion_editor.h
@@ -49,6 +49,7 @@ private:
void set_spin_ctrl (wxSpinCtrlDouble *, double);
std::map<wxSpinCtrlDouble*, double> _last_spin_ctrl_value;
+ bool _ignore_chromaticity_changed;
wxSpinCtrlDouble* _input_gamma;
wxSpinCtrlDouble* _input_power;