sp-color-wheel-selector.cpp revision 21540d59a919b4404c3f298470257f8b33310351
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <math.h>
#include "../dialogs/dialog-events.h"
#include "sp-color-wheel-selector.h"
#include "sp-color-scales.h"
#include "sp-color-icc-selector.h"
#include "../svg/svg-icc-color.h"
static SPColorSelectorClass *parent_class;
#define XPAD 4
#define YPAD 1
{
if (!type) {
sizeof (SPColorWheelSelectorClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (SPColorWheelSelector),
0, /* n_preallocs */
0, /* value_table */
};
"SPColorWheelSelector",
&info,
static_cast< GTypeFlags > (0) );
}
return type;
}
static void
{
}
: ColorSelector( csel ),
_adj(0),
_wheel(0),
_slider(0),
_sbtn(0),
_label(0)
{
}
{
_adj = 0;
_wheel = 0;
_sbtn = 0;
_label = 0;
}
{
{
}
}
{
// drop a little for resizing
diam -= 4;
if ( style ) {
if (thick > 0) {
}
}
"focus-padding", &padding,
NULL );
if (padding > 0) {
}
}
{
GtkAllocation allocation = {0, 0, 0, 0};
}
{
}
void ColorWheelSelector::init()
{
GtkWidget *t;
gtk_widget_show (t);
/* Create components */
row = 0;
_wheel = gtk_hsv_new();
gtk_table_attach( GTK_TABLE(t), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), XPAD, YPAD);
row++;
/* Label */
/* Adjustment */
/* Slider */
gtk_table_attach (GTK_TABLE (t), _slider, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD);
/* Spinbutton */
gtk_table_attach (GTK_TABLE (t), _sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD);
/* Signals */
// GTK does not automatically scale the color wheel, so we have to add that in:
}
static void
{
}
static void
{
}
static void
{
}
sp_color_wheel_selector_new (void)
{
return GTK_WIDGET (csel);
}
/* Helpers for setting color value */
}
void ColorWheelSelector::_colorChanged()
{
#ifdef DUMP_CHANGE_INFO
g_message("ColorWheelSelector::_colorChanged( this=%p, %f, %f, %f, %f)", this, color.v.c[0], color.v.c[1], color.v.c[2], alpha );
#endif
{
gdouble h = 0;
gdouble s = 0;
gdouble v = 0;
}
}
{
// TODO check this. It looks questionable:
// if a value is entered between 0 and 1 exclusive, normalize it to (int) 0..255 or 0..100
}
if (wheelSelector->_updating) return;
wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
}
{
(void)slider;
if (!wheelSelector->_dragging) {
wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
}
}
{
(void)slider;
if (wheelSelector->_dragging) {
wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
}
}
{
(void)slider;
wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
}
{
gdouble h = 0;
gdouble s = 0;
gdouble v = 0;
gtk_hsv_get_color( hsv, &h, &s, &v );
gdouble r = 0;
gdouble g = 0;
gdouble b = 0;
gtk_hsv_to_rgb(h, s, v, &r, &g, &b);
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :