-
- fl_freeze_form(dialog_->form);
- setEnabled(dialog_->button_modify, false);
- fl_unfreeze_form(dialog_->form);
-}
-
-
-void FormPreferences::Colors::SwitchColorSpace() const
-{
- bool const hsv = fl_get_button(dialog_->radio_hsv);
-
- RGBColor col;
- fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
-
- fl_freeze_form(dialog_->form);
-
- if (hsv) {
- fl_hide_object(dialog_->slider_red);
- fl_hide_object(dialog_->slider_blue);
- fl_hide_object(dialog_->slider_green);
- fl_show_object(dialog_->dial_hue);
- fl_show_object(dialog_->slider_saturation);
- fl_show_object(dialog_->slider_value);
-
- HSVColor hsv = HSVColor(col);
- hsv.h = max(hsv.h, 0.0);
-
- fl_set_dial_value(dialog_->dial_hue, hsv.h);
- fl_set_slider_value(dialog_->slider_saturation, hsv.s);
- fl_set_slider_value(dialog_->slider_value, hsv.v);
-
- col = HSVColor(hsv.h, 1.0, 1.0);
- col.r = max(col.r, 0);
- fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
- fl_redraw_object(dialog_->dial_hue);
-
- // Adjust the label a bit, but not the actual values.
- // Means that toggling from one space to the other has no
- // effect on the final color.
- int const h = int(hsv.h);
- int const s = int(100 * hsv.s);
- int const v = int(100 * hsv.v);
- string const label = tostr(h) + ", " + tostr(s) +
- ", " + tostr(v);
- fl_set_object_label(dialog_->text_color_values, label.c_str());
-
- } else {
- fl_show_object(dialog_->slider_red);
- fl_show_object(dialog_->slider_blue);
- fl_show_object(dialog_->slider_green);
- fl_hide_object(dialog_->dial_hue);
- fl_hide_object(dialog_->slider_saturation);
- fl_hide_object(dialog_->slider_value);
-
- fl_set_slider_value(dialog_->slider_red, col.r);
- fl_set_slider_value(dialog_->slider_green, col.g);
- fl_set_slider_value(dialog_->slider_blue, col.b);
-
- // Adjust the label a bit. Same reasoning as above.
- int const r = int(col.r);
- int const g = int(col.g);
- int const b = int(col.b);
- string const label = tostr(r) + ", " + tostr(g) +
- ", " + tostr(b);
- fl_set_object_label(dialog_->text_color_values, label.c_str());
- }
-
- fl_unfreeze_form(dialog_->form);
-}
-
-string const FormPreferences::Colors::X11hexname(RGBColor const & col) const
-{
- ostringstream ostr;
-
- ostr << '#' << std::setbase(16) << setfill('0')
- << setw(2) << col.r
- << setw(2) << col.g
- << setw(2) << col.b;
-
- return STRCONV(ostr.str());