#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "color-wheel-selector.h"
#include <math.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/spinbutton.h>
#include "svg/svg-icc-color.h"
#include "ui/dialog-events.h"
#include "ui/selected-color.h"
#include "ui/widget/color-scales.h"
#include "ui/widget/color-slider.h"
#include "ui/widget/gimpcolorwheel.h"
namespace Inkscape {
namespace UI {
namespace Widget {
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
, _updating(false)
#if !GTK_CHECK_VERSION(3, 0, 0)
#endif
, _wheel(0)
, _slider(0)
{
_initUI();
_color_changed_connection = color.signal_changed.connect(sigc::mem_fun(this, &ColorWheelSelector::_colorChanged));
_color_dragged_connection = color.signal_dragged.connect(sigc::mem_fun(this, &ColorWheelSelector::_colorChanged));
}
{
_wheel = 0;
#if !GTK_CHECK_VERSION(3, 0, 0)
delete _alpha_adjustment;
#endif
}
{
/* Create components */
#if GTK_CHECK_VERSION(3, 0, 0)
#else
gtk_table_attach(GTK_TABLE(gobj()), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
#endif
row++;
/* Label */
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
#else
#endif
/* Adjustment */
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
/* Slider */
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
_slider->set_hexpand(true);
#else
#endif
_slider->setColors(SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 0.0), SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 0.5),
/* Spinbutton */
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
spin_button->show();
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
#else
#endif
/* Signals */
_alpha_adjustment->signal_value_changed().connect(sigc::mem_fun(this, &ColorWheelSelector::_adjustmentChanged));
}
{
#if GTK_CHECK_VERSION(3, 0, 0)
#else
#endif
}
{
}
{
if (_updating) {
return;
}
// 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 (_updating) {
return;
}
}
{
if (wheelSelector->_updating) {
return;
}
gdouble h = 0;
gdouble s = 0;
gdouble v = 0;
gimp_color_wheel_get_color(wheel, &h, &s, &v);
sp_color_hsv_to_rgb_floatv(rgb, h, s, v);
wheelSelector->_updating = true;
wheelSelector->_updating = false;
}
{
if(_updating) { return; }
#ifdef DUMP_CHANGE_INFO
g_message("ColorWheelSelector::_colorChanged( this=%p, %f, %f, %f, %f)", this, _color.color().v.c[0],
#endif
_updating = true;
{
sp_color_rgb_to_hsv_floatv(hsv, _color.color().v.c[0], _color.color().v.c[1], _color.color().v.c[2]);
}
_updating = false;
}
{
return w;
}
Glib::ustring ColorWheelSelectorFactory::modeName() const { return gettext(ColorWheelSelector::MODE_NAME); }
}
}
}
/*
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 :