sp-color-wheel-selector.cpp revision 9fb4864477462bc005fa792b095fd06549eca4ab
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <math.h>
#include <gtk/gtksignal.h>
#include <gtk/gtklabel.h>
#include <gtk/gtktable.h>
#include <gtk/gtkspinbutton.h>
#include "../dialogs/dialog-events.h"
#include "sp-color-wheel-selector.h"
#include "sp-color-scales.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),
_sbtn(0),
_label(0)
{
}
{
_adj = 0;
_wheel = 0;
_sbtn = 0;
_label = 0;
}
{
{
}
}
void ColorWheelSelector::init()
{
GtkWidget *t;
_tt = gtk_tooltips_new();
gtk_widget_show (t);
/* Create components */
row = 0;
_wheel = sp_color_wheel_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 */
}
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
}
{
// 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 );
}
{
wheelSelector->_updateInternals( color, wheelSelector->_alpha, sp_color_wheel_is_adjusting( wheel ) );
}
/*
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:encoding=utf-8:textwidth=99 :