X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fwidgets%2Fsp-color-wheel-selector.cpp;h=d548b732532f96d4936fd62aedf1096cd41c1436;hb=c559a44911579b77710f6698f1a064195da7c292;hp=6012f4e2004ebdb02d320c448c3d429c245e8dc0;hpb=6c9ed961677b5d06ead88ca2d1ac9321b775e7a5;p=inkscape.git diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 6012f4e20..d548b7325 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -125,14 +125,14 @@ void ColorWheelSelector::init() /* Create components */ row = 0; - _wheel = sp_color_wheel_new (); - gtk_widget_show (_wheel); - gtk_table_attach (GTK_TABLE (t), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), XPAD, YPAD); + _wheel = gtk_hsv_new(); + gtk_widget_show( _wheel ); + 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 */ - _label = gtk_label_new_with_mnemonic (_("_A")); + _label = gtk_label_new_with_mnemonic (_("_A:")); gtk_misc_set_alignment (GTK_MISC (_label), 1.0, 0.5); gtk_widget_show (_label); gtk_table_attach (GTK_TABLE (t), _label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); @@ -171,8 +171,8 @@ void ColorWheelSelector::init() gtk_signal_connect (GTK_OBJECT (_slider), "changed", GTK_SIGNAL_FUNC (_sliderChanged), _csel); - gtk_signal_connect (GTK_OBJECT(_wheel), "changed", - GTK_SIGNAL_FUNC (_wheelChanged), _csel); + gtk_signal_connect( GTK_OBJECT(_wheel), "changed", + GTK_SIGNAL_FUNC(_wheelChanged), _csel ); } static void @@ -217,7 +217,13 @@ void ColorWheelSelector::_colorChanged() 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 _updating = TRUE; - sp_color_wheel_set_color( SP_COLOR_WHEEL( _wheel ), &_color ); + { + gdouble h = 0; + gdouble s = 0; + gdouble v = 0; + gtk_rgb_to_hsv( _color.v.c[0], _color.v.c[1], _color.v.c[2], &h, &s, &v ); + gtk_hsv_set_color( GTK_HSV(_wheel), h, s, v ); + } guint32 start = _color.toRGBA32( 0x00 ); guint32 mid = _color.toRGBA32( 0x7f ); @@ -284,12 +290,21 @@ void ColorWheelSelector::_sliderChanged( SPColorSlider *slider, SPColorWheelSele wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging ); } -void ColorWheelSelector::_wheelChanged( SPColorWheel *wheel, SPColorWheelSelector *cs ) +void ColorWheelSelector::_wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs ) { - ColorWheelSelector* wheelSelector = (ColorWheelSelector*)(SP_COLOR_SELECTOR(cs)->base); - SPColor color; + ColorWheelSelector* wheelSelector = static_cast(SP_COLOR_SELECTOR(cs)->base); + + 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); - sp_color_wheel_get_color( wheel, &color ); + SPColor color(r, g, b); guint32 start = color.toRGBA32( 0x00 ); guint32 mid = color.toRGBA32( 0x7f ); @@ -298,7 +313,7 @@ void ColorWheelSelector::_wheelChanged( SPColorWheel *wheel, SPColorWheelSelecto sp_color_slider_set_colors (SP_COLOR_SLIDER(wheelSelector->_slider), start, mid, end); preserve_icc(&color, cs); - wheelSelector->_updateInternals( color, wheelSelector->_alpha, sp_color_wheel_is_adjusting( wheel ) ); + wheelSelector->_updateInternals( color, wheelSelector->_alpha, gtk_hsv_is_adjusting( hsv ) ); } @@ -311,4 +326,4 @@ void ColorWheelSelector::_wheelChanged( SPColorWheel *wheel, SPColorWheelSelecto fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :