A color picker for xforms.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7352 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-07-23 15:36:40 +00:00
parent 7668244a77
commit e59f7a4ef5
10 changed files with 783 additions and 449 deletions

View File

@ -1,3 +1,11 @@
2003-07-23 Angus Leeming <leeming@lyx.org>
* FormColorpicker.[Ch]
* forms/form_colorpicker.fd: new files. A color picker for xforms.
* FormPreferences.[Ch]
* forms/form_preferences.fd: use it.
2003-07-23 Angus Leeming <leeming@lyx.org>
* FormExternal.C (apply, update):

View File

@ -32,6 +32,7 @@
#include "ControlPrefs.h"
#include "FormPreferences.h"
#include "FormColorpicker.h"
#include "forms/form_preferences.h"
#include "ControlPrint.h"

View File

@ -0,0 +1,369 @@
/**
* \file FormColorpicker.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "FormColorpicker.h"
#include "forms/form_colorpicker.h"
#include "xforms_resize.h"
#include "Tooltips.h"
#include "Color.h"
#include "gettext.h"
#include "lyxrc.h"
#include "support/LAssert.h"
#include "support/filetools.h" // LibFileSearch
#include "support/tostr.h"
#include "lyx_forms.h"
#include "Lsstream.h"
#include <iomanip>
namespace {
enum GuiColors {
GUI_COLOR_CHOICE = FL_FREE_COL13,
GUI_COLOR_HUE_DIAL = FL_FREE_COL14,
};
string const fillLabel(RGBColor const & rgb)
{
return tostr(rgb.r) + ", " + tostr(rgb.g) + ", " + tostr(rgb.b);
}
string const fillLabel(HSVColor const & hsv)
{
int const h = int(hsv.h);
int const s = int(100.0 * hsv.s);
int const v = int(100.0 * hsv.v);
return tostr(h) + ", " + tostr(s) + ", " + tostr(v);
}
} // namespace anon
extern "C" {
// Callback function invoked by xforms when the dialog is closed by the
// window manager.
static int C_WMHideCB(FL_FORM * form, void *);
} // extern "C"
FormColorpicker::FormColorpicker()
: minw_(0), minh_(0),
title_(_("Select Color")),
finished_(true),
icon_pixmap_(0), icon_mask_(0),
tooltips_(new Tooltips)
{}
FormColorpicker::~FormColorpicker()
{
if (icon_pixmap_)
XFreePixmap(fl_get_display(), icon_pixmap_);
}
RGBColor const & FormColorpicker::requestColor(RGBColor const & color)
{
input_color_ = color;
color_ = color;
show();
fl_deactivate_all_forms();
fl_activate_form(form());
finished_ = false;
while (!finished_)
fl_check_forms();
fl_activate_all_forms();
return color_;
}
void FormColorpicker::show()
{
if (!form()) {
build();
prepare_to_show();
}
// make sure the form is up to date.
fl_freeze_form(form());
update();
fl_unfreeze_form(form());
if (form()->visible) {
fl_raise_form(form());
/* This XMapWindow() will hopefully ensure that
* iconified dialogs are de-iconified. Mad props
* out to those crazy Xlib guys for forgetting a
* XDeiconifyWindow(). At least WindowMaker, when
* being notified of the redirected MapRequest will
* specifically de-iconify. From source, fvwm2 seems
* to do the same.
*/
XMapWindow(fl_get_display(), form()->window);
} else {
// calls to fl_set_form_minsize/maxsize apply only to the next
// fl_show_form(), so this comes first.
fl_set_form_minsize(form(), minw_, minh_);
string const maximize_title = "LyX: " + title_;
int const iconify_policy =
lyxrc.dialogs_iconify_with_main ? FL_TRANSIENT : 0;
fl_show_form(form(),
FL_PLACE_MOUSE | FL_FREE_SIZE,
iconify_policy,
maximize_title.c_str());
}
}
void FormColorpicker::hide() const
{
// xforms sometimes tries to process a hint-type MotionNotify, and
// use XQueryPointer, without verifying if the window still exists.
// So we try to clear out motion events in the queue before the
// DestroyNotify
XSync(fl_get_display(), false);
if (form() && form()->visible)
fl_hide_form(form());
}
void FormColorpicker::build()
{
dialog_.reset(build_colorpicker(this));
rgb_.reset(build_colorpicker_rgb(this));
hsv_.reset(build_colorpicker_hsv(this));
fl_set_object_color(dialog_->button_color,
GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
fl_set_object_color(hsv_->dial_hue, GUI_COLOR_HUE_DIAL, FL_BLACK);
fl_set_dial_bounds(hsv_->dial_hue, 0.0, 360.0);
fl_set_dial_step(hsv_->dial_hue, 1.0);
fl_set_dial_return(hsv_->dial_hue, FL_RETURN_CHANGED);
fl_set_slider_bounds(hsv_->slider_saturation, 0.0, 1.0);
fl_set_slider_step(hsv_->slider_saturation, 0.01);
fl_set_slider_return(hsv_->slider_saturation, FL_RETURN_CHANGED);
fl_set_slider_bounds(hsv_->slider_value, 0.0, 1.0);
fl_set_slider_step(hsv_->slider_value, 0.01);
fl_set_slider_return(hsv_->slider_value, FL_RETURN_CHANGED);
fl_set_slider_bounds(rgb_->slider_red, 0.0, 255.0);
fl_set_slider_step(rgb_->slider_red, 1.0);
fl_set_slider_return(rgb_->slider_red, FL_RETURN_CHANGED);
fl_set_slider_bounds(rgb_->slider_green, 0.0, 255.0);
fl_set_slider_step(rgb_->slider_green, 1.0);
fl_set_slider_return(rgb_->slider_green, FL_RETURN_CHANGED);
fl_set_slider_bounds(rgb_->slider_blue, 0.0, 255.0);
fl_set_slider_step(rgb_->slider_blue, 1.0);
fl_set_slider_return(rgb_->slider_blue, FL_RETURN_CHANGED);
// Stack tabs
fl_addto_tabfolder(dialog_->tabfolder,_("RGB").c_str(), rgb_->form);
fl_addto_tabfolder(dialog_->tabfolder,_("HSV").c_str(), hsv_->form);
}
void FormColorpicker::update() const
{
fl_mapcolor(GUI_COLOR_CHOICE, color_.r, color_.g, color_.b);
FL_FORM * folder = fl_get_active_folder(dialog_->tabfolder);
if (!folder)
folder = rgb_->form;
if (folder == rgb_->form) {
fl_set_slider_value(rgb_->slider_red, color_.r);
fl_set_slider_value(rgb_->slider_green, color_.g);
fl_set_slider_value(rgb_->slider_blue, color_.b);
fl_set_object_label(dialog_->text_color_values,
fillLabel(color_).c_str());
} else if (folder == hsv_->form) {
HSVColor hsv = HSVColor(color_);
hsv.h = std::max(hsv.h, 0.0);
fl_set_dial_value(hsv_->dial_hue, hsv.h);
fl_set_slider_value(hsv_->slider_saturation, hsv.s);
fl_set_slider_value(hsv_->slider_value, hsv.v);
fl_set_object_label(dialog_->text_color_values,
fillLabel(hsv).c_str());
RGBColor col = HSVColor(hsv.h, 1.0, 1.0);
col.r = std::max(col.r, 0u);
fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
fl_redraw_object(hsv_->dial_hue);
}
}
void FormColorpicker::input(FL_OBJECT * ob, long)
{
if (ob == dialog_->tabfolder) {
update();
} else if (ob == hsv_->dial_hue ||
ob == hsv_->slider_saturation ||
ob == hsv_->slider_value) {
InputHSV();
} else if (ob == rgb_->slider_red ||
ob == rgb_->slider_green ||
ob == rgb_->slider_blue) {
InputRGB();
} else if (ob == dialog_->button_ok) {
hide();
finished_ = true;
} else if (ob == dialog_->button_close || ob == 0) {
color_ = input_color_;
hide();
finished_ = true;
}
}
FL_FORM * FormColorpicker::form() const
{
return dialog_.get() ? dialog_->form : 0;
}
Tooltips & FormColorpicker::tooltips() const
{
return *tooltips_;
}
void FormColorpicker::prepare_to_show()
{
double const scale = get_scale_to_fit(form());
if (scale > 1.001)
scale_form_horizontally(form(), scale);
// work around dumb xforms sizing bug
minw_ = form()->w;
minh_ = form()->h;
fl_set_form_atclose(form(), C_WMHideCB, 0);
// set the title for the minimized form
if (!lyxrc.dialogs_iconify_with_main)
fl_winicontitle(form()->window, title_.c_str());
// assign an icon to the form
string const iconname =
lyx::support::LibFileSearch("images", "lyx", "xpm");
if (!iconname.empty()) {
unsigned int w, h;
icon_pixmap_ = fl_read_pixmapfile(fl_root,
iconname.c_str(),
&w,
&h,
&icon_mask_,
0, 0, 0);
fl_set_form_icon(form(), icon_pixmap_, icon_mask_);
}
}
void FormColorpicker::InputRGB()
{
int const red = int(fl_get_slider_value(rgb_->slider_red));
int const green = int(fl_get_slider_value(rgb_->slider_green));
int const blue = int(fl_get_slider_value(rgb_->slider_blue));
color_ = RGBColor(red, green, blue);
fl_freeze_form(dialog_->form);
fl_set_object_label(dialog_->text_color_values,
fillLabel(color_).c_str());
fl_mapcolor(GUI_COLOR_CHOICE, color_.r, color_.g, color_.b);
fl_redraw_object(dialog_->button_color);
fl_unfreeze_form(dialog_->form);
}
void FormColorpicker::InputHSV()
{
double const hue = fl_get_dial_value(hsv_->dial_hue);
double const sat = fl_get_slider_value(hsv_->slider_saturation);
double const val = fl_get_slider_value(hsv_->slider_value);
HSVColor hsv = HSVColor(hue, sat, val);
color_ = hsv;
fl_freeze_form(dialog_->form);
fl_set_object_label(dialog_->text_color_values, fillLabel(hsv).c_str());
fl_mapcolor(GUI_COLOR_CHOICE, color_.r, color_.g, color_.b);
fl_redraw_object(dialog_->button_color);
RGBColor col = HSVColor(hue, 1.0, 1.0);
col.r = std::max(col.r, 0u);
fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
fl_redraw_object(hsv_->dial_hue);
fl_unfreeze_form(dialog_->form);
}
extern "C" {
void C_FormColorpickerInputCB(FL_OBJECT * ob, long d)
{
lyx::support::Assert(ob && ob->form && ob->form->u_vdata);
FormColorpicker * ptr =
static_cast<FormColorpicker *>(ob->form->u_vdata);
ptr->input(ob, d);
}
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
lyx::support::Assert(form && form->u_vdata);
FormColorpicker * ptr = static_cast<FormColorpicker *>(form->u_vdata);
ptr->input(0, 0);
return FL_CANCEL;
}
} // extern "C"

View File

@ -0,0 +1,89 @@
// -*- C++ -*-
/**
* \file FormColorpicker.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#ifndef FORMCOLORPICKER_H
#define FORMCOLORPICKER_H
#include "Color.h"
#include "forms_fwd.h"
#include "LString.h"
#include <boost/scoped_ptr.hpp>
#include <X11/Xlib.h> // for Pixmap
class Tooltips;
class FD_colorpicker;
class FD_colorpicker_rgb;
class FD_colorpicker_hsv;
class FormColorpicker
{
public:
FormColorpicker();
~FormColorpicker();
/** Launch the color picker. All other dialogs are frozen till
a color is chosen (or the dialog is closed).
\param color the color used to initialise the dialog.
*/
RGBColor const & requestColor(RGBColor const & color);
/** Input callback function.
* Invoked only by the xforms callback interface
*/
void input(FL_OBJECT *, long);
private:
/// Build the dialog
void build();
/// Hide the dialog.
void hide() const;
/// Create the dialog if necessary, update it and display it.
void show();
/// Update dialog before/whilst showing it.
void update() const;
Tooltips & tooltips() const;
/// Pointer to the actual instantiation of xform's form
FL_FORM * form() const;
/** Called on the first show() request, initialising various bits and
* pieces.
*/
void prepare_to_show();
void InputRGB();
void InputHSV();
/// The dialog's minimum allowable dimensions.
int minw_;
int minh_;
/// The title displayed by the Window Manager.
string title_;
RGBColor input_color_;
RGBColor color_;
bool finished_;
/// Passed to the window manager to give a pretty little symbol ;-)
Pixmap icon_pixmap_;
Pixmap icon_mask_;
boost::scoped_ptr<Tooltips> tooltips_;
boost::scoped_ptr<FD_colorpicker> dialog_;
boost::scoped_ptr<FD_colorpicker_rgb> rgb_;
boost::scoped_ptr<FD_colorpicker_hsv> hsv_;
};
#endif // FORMCOLORPICKER_H

View File

@ -16,6 +16,7 @@
#include "xformsBC.h"
#include "ButtonController.h"
#include "FormColorpicker.h"
#include "Color.h"
#include "input_validators.h"
#include "forms_gettext.h"
@ -506,48 +507,16 @@ void FormPreferences::Colors::apply()
void FormPreferences::Colors::build()
{
picker_.reset(new FormColorpicker);
dialog_.reset(build_preferences_colors(&parent_));
fl_set_object_color(dialog_->button_color,
GUI_COLOR_CHOICE, GUI_COLOR_CHOICE);
fl_set_object_color(dialog_->dial_hue, GUI_COLOR_HUE_DIAL, FL_BLACK);
fl_set_dial_bounds(dialog_->dial_hue, 0.0, 360.0);
fl_set_dial_step(dialog_->dial_hue, 1.0);
fl_set_dial_return(dialog_->dial_hue, FL_RETURN_CHANGED);
fl_set_slider_bounds(dialog_->slider_saturation, 0.0, 1.0);
fl_set_slider_step(dialog_->slider_saturation, 0.01);
fl_set_slider_return(dialog_->slider_saturation, FL_RETURN_CHANGED);
fl_set_slider_bounds(dialog_->slider_value, 0.0, 1.0);
fl_set_slider_step(dialog_->slider_value, 0.01);
fl_set_slider_return(dialog_->slider_value, FL_RETURN_CHANGED);
fl_set_slider_bounds(dialog_->slider_red, 0.0, 255.0);
fl_set_slider_step(dialog_->slider_red, 1.0);
fl_set_slider_return(dialog_->slider_red, FL_RETURN_CHANGED);
fl_set_slider_bounds(dialog_->slider_green, 0.0, 255.0);
fl_set_slider_step(dialog_->slider_green, 1.0);
fl_set_slider_return(dialog_->slider_green, FL_RETURN_CHANGED);
fl_set_slider_bounds(dialog_->slider_blue, 0.0, 255.0);
fl_set_slider_step(dialog_->slider_blue, 1.0);
fl_set_slider_return(dialog_->slider_blue, FL_RETURN_CHANGED);
// set up the feedback mechanism
setPrehandler(dialog_->browser_lyx_objs);
setPrehandler(dialog_->button_color);
setPrehandler(dialog_->button_modify);
setPrehandler(dialog_->dial_hue);
setPrehandler(dialog_->slider_saturation);
setPrehandler(dialog_->slider_value);
setPrehandler(dialog_->slider_red);
setPrehandler(dialog_->slider_green);
setPrehandler(dialog_->slider_blue);
setPrehandler(dialog_->radio_rgb);
setPrehandler(dialog_->radio_hsv);
}
@ -560,17 +529,6 @@ FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
if (ob == dialog_->button_modify)
return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
if (ob == dialog_->dial_hue ||
ob == dialog_->slider_saturation ||
ob == dialog_->slider_value ||
ob == dialog_->slider_red ||
ob == dialog_->slider_green ||
ob == dialog_->slider_blue)
return _("Find a new color.");
if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv)
return _("Toggle between RGB and HSV color spaces.");
return string();
}
@ -580,20 +538,6 @@ void FormPreferences::Colors::input(FL_OBJECT const * const ob)
if (ob == dialog_->browser_lyx_objs) {
InputBrowserLyX();
} else if (ob == dialog_->dial_hue ||
ob == dialog_->slider_saturation ||
ob == dialog_->slider_value) {
InputHSV();
} else if (ob == dialog_->slider_red ||
ob == dialog_->slider_green ||
ob == dialog_->slider_blue) {
InputRGB();
} else if (ob == dialog_->radio_rgb ||
ob == dialog_->radio_hsv) {
SwitchColorSpace();
} else if (ob == dialog_->button_modify) {
Modify();
}
@ -640,108 +584,10 @@ void FormPreferences::Colors::InputBrowserLyX() const
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
fl_redraw_object(dialog_->button_color);
// Display either RGB or HSV but not both!
SwitchColorSpace();
// Deactivate the modify button to begin with...
setEnabled(dialog_->button_modify, false);
fl_unfreeze_form(dialog_->form);
}
void FormPreferences::Colors::InputHSV()
{
double const hue = fl_get_dial_value(dialog_->dial_hue);
double const sat = fl_get_slider_value(dialog_->slider_saturation);
double const val = fl_get_slider_value(dialog_->slider_value);
int const h = int(hue);
int const s = int(100.0 * sat);
int const v = int(100.0 * val);
string const label = tostr(h) + ", " + tostr(s) + ", " + tostr(v);
fl_set_object_label(dialog_->text_color_values, label.c_str());
RGBColor col = HSVColor(hue, sat, val);
fl_freeze_form(dialog_->form);
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
fl_redraw_object(dialog_->button_color);
col = HSVColor(hue, 1.0, 1.0);
col.r = max(col.r, 0u);
fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b);
fl_redraw_object(dialog_->dial_hue);
// Ascertain whether to activate the Modify button.
vector<NamedColor>::size_type const selLyX =
fl_get_browser(dialog_->browser_lyx_objs);
fl_unfreeze_form(dialog_->form);
if (selLyX < 1) return;
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
bool modify = false;
// Is the choice an Xforms color...
if (selLyX - 1 < xformsColorDB.size()) {
vector<XformsColor>::size_type const i = selLyX - 1;
modify = (xformsColorDB[i].color() != col);
}
// or a LyX Logical color?
else {
vector<NamedColor>::size_type const i = selLyX - 1 -
xformsColorDB.size();
modify = (lyxColorDB[i].color() != col);
}
setEnabled(dialog_->button_modify, modify);
}
void FormPreferences::Colors::InputRGB()
{
int const red = int(fl_get_slider_value(dialog_->slider_red));
int const green = int(fl_get_slider_value(dialog_->slider_green));
int const blue = int(fl_get_slider_value(dialog_->slider_blue));
string const label = tostr(red) + string(", ") + tostr(green) +
string(", ") + tostr(blue);
fl_set_object_label(dialog_->text_color_values, label.c_str());
fl_freeze_form(dialog_->form);
RGBColor col = RGBColor(red, green, blue);
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
fl_redraw_object(dialog_->button_color);
// Ascertain whether to activate the Modify button.
vector<NamedColor>::size_type const selLyX =
fl_get_browser(dialog_->browser_lyx_objs);
fl_unfreeze_form(dialog_->form);
if (selLyX < 1) return;
bool modify = false;
// Is the choice an Xforms color...
if (selLyX - 1 < xformsColorDB.size()) {
vector<XformsColor>::size_type const i = selLyX - 1;
modify = (xformsColorDB[i].color() != col);
}
// or a LyX Logical color?
else {
vector<NamedColor>::size_type const i = selLyX - 1 -
xformsColorDB.size();
modify = (lyxColorDB[i].color() != col);
}
setEnabled(dialog_->button_modify, modify);
}
void FormPreferences::Colors::LoadBrowserLyX()
{
if (!dialog_->browser_lyx_objs->visible)
@ -851,8 +697,15 @@ void FormPreferences::Colors::Modify()
if (selLyX < 1)
return;
RGBColor col;
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
RGBColor before;
fl_getmcolor(GUI_COLOR_CHOICE, &before.r, &before.g, &before.b);
RGBColor col = picker_->requestColor(before);
if (before == col)
return;
fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b);
fl_redraw_object(dialog_->button_color);
// Is the choice an Xforms color...
if (selLyX - 1 < xformsColorDB.size()) {
@ -869,74 +722,6 @@ void FormPreferences::Colors::Modify()
lyxColorDB[i].g = col.g;
lyxColorDB[i].b = col.b;
}
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, 0u);
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);
}

View File

@ -28,6 +28,8 @@ class ControlPrefs;
class Dialogs;
class LyXView;
class RGBColor;
class FormColorpicker;
struct FD_preferences;
struct FD_preferences_colors;
struct FD_preferences_converters;
@ -87,8 +89,7 @@ private:
public:
///
enum GuiColors {
GUI_COLOR_CHOICE = FL_FREE_COL14,
GUI_COLOR_HUE_DIAL = FL_FREE_COL15,
GUI_COLOR_CHOICE = FL_FREE_COL15,
GUI_COLOR_CURSOR = FL_FREE_COL16
};
///
@ -115,20 +116,16 @@ private:
///
void InputBrowserLyX() const;
///
void InputHSV();
///
void InputRGB();
///
void LoadBrowserLyX();
///
void Modify();
///
void SwitchColorSpace() const;
///
FormPreferences & parent_;
///
boost::scoped_ptr<FD_preferences_colors> dialog_;
///
boost::scoped_ptr<FormColorpicker> picker_;
/// A vector of LyX LColor GUI name and associated RGB color.
std::vector<NamedColor> lyxColorDB;

View File

@ -77,6 +77,8 @@ libxforms_la_SOURCES = \
FormCharacter.h \
FormCitation.C \
FormCitation.h \
FormColorpicker.C \
FormColorpicker.h \
FormDocument.C \
FormDocument.h \
FormErrorList.C \

View File

@ -16,6 +16,7 @@ SRCS = form_aboutlyx.fd \
form_changes.fd \
form_character.fd \
form_citation.fd \
form_colorpicker.fd \
form_document.fd \
form_errorlist.fd \
form_ert.fd \

View File

@ -0,0 +1,286 @@
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 3
Unit of measure: FL_COORD_PIXEL
SnapGrid: 5
=============== FORM ===============
Name: form_colorpicker
Width: 270
Height: 360
Number of Objects: 6
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 270 360
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
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_TABFOLDER
type: TOP_TABFOLDER
box: 10 25 255 235
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: tabbed folder
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthWest FL_SouthEast
name: tabfolder
callback: C_FormColorpickerInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 280 100 30
boxtype: FL_BORDER_BOX
colors: FL_WHITE FL_COL1
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: button_color
callback:
argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 115 280 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: text_color_values
callback:
argument:
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 80 330 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: OK
shortcut: ^M
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_ok
callback: C_FormColorpickerInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 175 330 90 25
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Cancel|^[
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_close
callback: C_FormColorpickerInputCB
argument: 0
=============== FORM ===============
Name: form_colorpicker_rgb
Width: 255
Height: 220
Number of Objects: 4
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 255 220
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
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_SLIDER
type: VERT_FILL_SLIDER
box: 55 30 40 140
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_RED
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: R|#R
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_red
callback: C_FormColorpickerInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: VERT_FILL_SLIDER
box: 110 30 40 140
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_GREEN
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: G|#G
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_green
callback: C_FormColorpickerInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: VERT_FILL_SLIDER
box: 165 30 40 140
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: B|#B
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_blue
callback: C_FormColorpickerInputCB
argument: 0
slsize: 0.15
=============== FORM ===============
Name: form_colorpicker_hsv
Width: 255
Height: 220
Number of Objects: 4
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 255 220
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
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_DIAL
type: NORMAL_DIAL
box: 91 8 100 100
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_RIGHT_BCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: H|#H
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: dial_hue
callback: C_FormColorpickerInputCB
argument: 0
--------------------
class: FL_SLIDER
type: HOR_NICE_SLIDER
box: 65 115 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: S|#S
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_saturation
callback: C_FormColorpickerInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: HOR_NICE_SLIDER
box: 65 155 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: V|#V
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_value
callback: C_FormColorpickerInputCB
argument: 0
slsize: 0.15
==============================
create_the_forms

View File

@ -782,7 +782,7 @@ argument: 0
Name: form_preferences_colors
Width: 450
Height: 360
Number of Objects: 15
Number of Objects: 4
--------------------
class: FL_BOX
@ -820,214 +820,10 @@ name: browser_lyx_objs
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_DIAL
type: NORMAL_DIAL
box: 276 23 100 100
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_RIGHT_BCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: H|#H
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: dial_hue
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_SLIDER
type: HOR_NICE_SLIDER
box: 251 135 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: S|#S
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_saturation
callback: C_FormBaseInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: HOR_NICE_SLIDER
box: 251 175 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: V|#V
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_value
callback: C_FormBaseInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: VERT_FILL_SLIDER
box: 250 25 40 180
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_RED
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: R|#R
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_red
callback: C_FormBaseInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: VERT_FILL_SLIDER
box: 305 25 40 180
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_GREEN
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: G|#G
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_green
callback: C_FormBaseInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_SLIDER
type: VERT_FILL_SLIDER
box: 360 25 40 180
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: B|#B
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slider_blue
callback: C_FormBaseInputCB
argument: 0
slsize: 0.15
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 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_ROUND3DBUTTON
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_FormBaseInputCB
argument: 0
--------------------
class: FL_ROUND3DBUTTON
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_FormBaseInputCB
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
box: 250 250 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: text_color_values
callback:
argument:
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 250 285 60 30
box: 245 155 60 30
boxtype: FL_BORDER_BOX
colors: FL_WHITE FL_COL1
alignment: FL_ALIGN_CENTER
@ -1045,7 +841,7 @@ argument:
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 310 285 90 30
box: 310 155 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -1238,13 +1034,13 @@ alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
name:
callback:
argument:
--------------------
class: FL_INPUT
@ -1257,7 +1053,7 @@ style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Real name : |#R
shortcut:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_user_name
@ -1275,13 +1071,13 @@ style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Email address : |#E
shortcut:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_user_email
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
Name: form_preferences_spelloptions
Width: 450