sp-color-wheel-selector.cpp revision 1ec0e7318a4bf659c7f5703dccb1cef17c5adabd
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "sp-color-wheel-selector.h"
#include <math.h>
#include <gtkmm/adjustment.h>
#include "../dialogs/dialog-events.h"
#include "sp-color-scales.h"
#include "sp-color-icc-selector.h"
#include "../svg/svg-icc-color.h"
#include "ui/widget/color-slider.h"
#include "ui/widget/gimpcolorwheel.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;
}
{
}
: ColorSelector( csel ),
_adj(0),
_wheel(0),
_slider(0),
_sbtn(0),
_label(0)
{
}
{
_adj = 0;
_wheel = 0;
_sbtn = 0;
_label = 0;
}
{
{
}
}
void ColorWheelSelector::init()
{
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *t = gtk_grid_new();
#else
#endif
gtk_widget_show (t);
/* Create components */
row = 0;
#if GTK_CHECK_VERSION(3,0,0)
#else
gtk_table_attach(GTK_TABLE(t), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
#endif
row++;
/* Label */
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
/* Adjustment */
/* Slider */
#if GTK_CHECK_VERSION(3,0,0)
_slider->set_hexpand(true);
#else
gtk_table_attach(GTK_TABLE (t), _slider->gobj(), 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD);
#endif
/* Spinbutton */
#if GTK_CHECK_VERSION(3,0,0)
#else
gtk_table_attach (GTK_TABLE (t), _sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD);
#endif
/* Signals */
}
{
}
static void
{
}
{
}
{
SPColorWheelSelector *csel = SP_COLOR_WHEEL_SELECTOR(g_object_new (SP_TYPE_COLOR_WHEEL_SELECTOR, NULL));
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
{
float hsv[3] = {0,0,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 ColorWheelSelector::_sliderGrabbed()
{
if (!_dragging) {
_grabbed();
}
}
void ColorWheelSelector::_sliderReleased()
{
if (_dragging) {
_released();
}
}
void ColorWheelSelector::_sliderChanged()
{
}
{
gdouble h = 0;
gdouble s = 0;
gdouble v = 0;
gimp_color_wheel_get_color( wheel, &h, &s, &v );
float rgb[3] = {0,0,0};
sp_color_hsv_to_rgb_floatv (rgb, h, s, v);
wheelSelector->_updateInternals( color, wheelSelector->_alpha, gimp_color_wheel_is_adjusting(wheel) );
}
return wrapped;
}
}
/*
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 :