A small tweak to the preferences dialog, adding RGB and HSV radio buttons

to toggle between the colour spaces. Not yet support for transparent colours
because that's proving to be rather hard!


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2920 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-10-23 09:39:01 +00:00
parent c67645effa
commit e7739010d4
5 changed files with 89 additions and 21 deletions

View File

@ -1,7 +1,11 @@
2001-10-23 Angus Leeming <a.leeming@ic.ac.uk>
* FormGraphics.[Ch]: move some parameters out of the heaader file and
into namespace anon.
into namespace anon.
* FormPreferences.C:
* forms/form_preferences.fd: replaced button_colorspace with two
radio buttons, button_hsv and button_rgb.
2001-10-19 Jürgen Spitzmüller <j.spitzmueller@gmx.de>

View File

@ -499,7 +499,8 @@ void FormPreferences::Colors::build()
setPreHandler(dialog_->slider_red);
setPreHandler(dialog_->slider_green);
setPreHandler(dialog_->slider_blue);
setPreHandler(dialog_->button_colorspace);
setPreHandler(dialog_->radio_rgb);
setPreHandler(dialog_->radio_hsv);
}
string const
@ -521,7 +522,8 @@ FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
ob == dialog_->slider_blue) {
str = N_("Find a new color.");
} else if (ob == dialog_->button_colorspace) {
} else if (ob == dialog_->radio_rgb ||
ob == dialog_->radio_hsv) {
str = N_("Toggle between RGB and HSV color spaces.");
}
@ -544,7 +546,8 @@ void FormPreferences::Colors::input(FL_OBJECT const * const ob)
ob == dialog_->slider_blue) {
InputRGB();
} else if (ob == dialog_->button_colorspace) {
} else if (ob == dialog_->radio_rgb ||
ob == dialog_->radio_hsv) {
SwitchColorSpace();
} else if (ob == dialog_->button_modify) {
@ -847,16 +850,14 @@ void FormPreferences::Colors::Modify()
void FormPreferences::Colors::SwitchColorSpace() const
{
bool const pressed = fl_get_button(dialog_->button_colorspace);
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 (pressed) {
fl_set_object_label(dialog_->button_colorspace, _("HSV"));
if (hsv) {
fl_hide_object(dialog_->slider_red);
fl_hide_object(dialog_->slider_blue);
fl_hide_object(dialog_->slider_green);
@ -887,8 +888,6 @@ void FormPreferences::Colors::SwitchColorSpace() const
fl_set_object_label(dialog_->text_color_values, label.c_str());
} else {
fl_set_object_label(dialog_->button_colorspace, _("RGB"));
fl_show_object(dialog_->slider_red);
fl_show_object(dialog_->slider_blue);
fl_show_object(dialog_->slider_green);

View File

@ -325,9 +325,17 @@ FD_form_colors * FormPreferences::build_colors()
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
fl_set_slider_size(obj, 0.15);
fdui->button_colorspace = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 310, 219, 30, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->group_radio_printto = fl_bgn_group();
fdui->radio_hsv = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 250, 220, 30, 30, _("HSV"));
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
fdui->radio_rgb = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 335, 220, 30, 30, _("RGB"));
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
fl_set_button(obj, 1);
fl_end_group();
fdui->text_color_values = obj = fl_add_text(FL_NORMAL_TEXT, 250, 250, 150, 30, "");
fl_set_object_boxtype(obj, FL_DOWN_BOX);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);

View File

@ -100,7 +100,9 @@ struct FD_form_colors {
FL_OBJECT *slider_red;
FL_OBJECT *slider_green;
FL_OBJECT *slider_blue;
FL_OBJECT *button_colorspace;
FL_OBJECT *group_radio_printto;
FL_OBJECT *radio_hsv;
FL_OBJECT *radio_rgb;
FL_OBJECT *text_color_values;
FL_OBJECT *button_color;
FL_OBJECT *button_modify;

View File

@ -819,7 +819,7 @@ argument:
Name: form_colors
Width: 450
Height: 360
Number of Objects: 12
Number of Objects: 15
--------------------
class: FL_BOX
@ -971,23 +971,78 @@ argument: 0
slsize: 0.15
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 310 219 30 30
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_colorspace
name: group_radio_printto
callback:
argument:
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 250 220 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: HSV
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_hsv
callback: C_FormBaseDeprecatedInputCB
argument: 0
--------------------
class: FL_CHECKBUTTON
type: RADIO_BUTTON
box: 335 220 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_RIGHT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: RGB
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_rgb
callback: C_FormBaseDeprecatedInputCB
argument: 0
value: 1
--------------------
class: FL_END_GROUP
type: 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
@ -1246,7 +1301,7 @@ argument: 0
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 0 0 0
box: 0 10 10 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER