~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/widgets/sp-color-gtkselector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
}
110
110
 
111
111
GtkWidget *
112
 
sp_color_gtkselector_new (GType, SPColorSpaceType colorspace)
 
112
sp_color_gtkselector_new( GType )
113
113
{
114
114
        SPColorGtkselector *csel;
115
115
 
128
128
{
129
129
}
130
130
 
131
 
void ColorGtkselector::_colorChanged( const SPColor& color, gfloat alpha )
 
131
void ColorGtkselector::_colorChanged()
132
132
{
133
133
    GdkColor gcolor;
134
 
    float rgb[3];
135
 
    g_return_if_fail (_csel != NULL);
136
 
    g_return_if_fail (SP_IS_COLOR_GTKSELECTOR (_csel));
137
 
    g_return_if_fail( ( 0.0 <= alpha ) && ( alpha <= 1.0 ) );
138
 
 
139
 
    sp_color_copy (&_color, &color);
140
 
    _alpha = alpha;
141
 
 
142
 
    sp_color_get_rgb_floatv( &color, rgb );
 
134
 
143
135
    gcolor.pixel = 0;
144
 
    gcolor.red   = static_cast< guint16 > (rgb[0] * 65535);
145
 
    gcolor.green = static_cast< guint16 > (rgb[1] * 65535);
146
 
    gcolor.blue  = static_cast< guint16 > (rgb[2] * 65535);
 
136
    gcolor.red   = static_cast< guint16 >(_color.v.c[0] * 65535);
 
137
    gcolor.green = static_cast< guint16 >(_color.v.c[1] * 65535);
 
138
    gcolor.blue  = static_cast< guint16 >(_color.v.c[2] * 65535);
147
139
 
148
140
//     g_message( "*****  _colorChanged %04x %04x %04x", gcolor.red, gcolor.green, gcolor.blue );
149
141
    g_signal_handler_block( _gtkThing, _sigId );
150
 
    gtk_color_selection_set_current_alpha (_gtkThing, (guint16)(65535 * alpha));
151
 
    gtk_color_selection_set_current_color (_gtkThing, &gcolor);
 
142
    gtk_color_selection_set_current_alpha( _gtkThing, static_cast<guint16>(65535 * _alpha) );
 
143
    gtk_color_selection_set_current_color( _gtkThing, &gcolor );
152
144
    g_signal_handler_unblock(_gtkThing, _sigId );
153
145
}
154
146
 
155
147
void ColorGtkselector::_gtkChanged( GtkColorSelection *colorselection, SPColorGtkselector *gtksel )
156
148
{
157
 
    ColorGtkselector* gtkInst = (ColorGtkselector*)(SP_COLOR_SELECTOR(gtksel)->base);
158
 
    SPColor ourColor;
159
149
    GdkColor color;
160
 
    guint16 alpha;
161
 
 
162
150
    gtk_color_selection_get_current_color (colorselection, &color);
163
 
    alpha = gtk_color_selection_get_current_alpha (colorselection);
164
 
 
165
 
    sp_color_set_rgb_float (&ourColor, (color.red / 65535.0), (color.green / 65535.0), (color.blue / 65535.0));
 
151
 
 
152
    guint16 alpha = gtk_color_selection_get_current_alpha (colorselection);
 
153
 
 
154
    SPColor ourColor( (color.red / 65535.0), (color.green / 65535.0), (color.blue / 65535.0) );
166
155
 
167
156
//     g_message( "*****  _gtkChanged   %04x %04x %04x", color.red, color.green, color.blue );
168
157
 
 
158
    ColorGtkselector* gtkInst = (ColorGtkselector*)(SP_COLOR_SELECTOR(gtksel)->base);
169
159
    gtkInst->_updateInternals( ourColor, static_cast< gfloat > (alpha) / 65535.0, gtk_color_selection_is_adjusting(colorselection) );
170
160
}