diff options
| author | Ted Gould <ted@gould.cx> | 2008-02-29 21:37:22 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2008-02-29 21:37:22 +0000 |
| commit | 23c6090f0f77b6cd8b47e80e69974519e22f4ecf (patch) | |
| tree | 91fc6ca41a0daacd1f336038b2e77eacc1315ae0 /src/extension/paramcolor.cpp | |
| parent | Copy perspectives, too, when pasting 3D boxes (solves LP #195867) (diff) | |
| download | inkscape-23c6090f0f77b6cd8b47e80e69974519e22f4ecf.tar.gz inkscape-23c6090f0f77b6cd8b47e80e69974519e22f4ecf.zip | |
r18220@shi: ted | 2008-02-29 13:18:55 -0800
Okay, sadly I'm not keeping the version history because I'm not convenced
that SVK will do it right. One mega-patch, but that's life.
Reshuffle the exection-env and prefdialog code so that the state machines
aren't intertwines, which fixes a whole host of bugs with them. I think
the behavior is correct now.
Make it so that the effects can count how many preferences they have to
determine if the dialog should be shown (fix above). Once this code was
written it was easy to make it show an ellipsis on the verb if there is
a dialog or not. This involved removing ellipsis from those effects that
had it hard coded.
Make it so that the parameters know that their command line options are
going into a list. They don't have to acknowledge it, but they can, and
specifically notebook does and handles it differently. This should fix
the notebooks on Win32, but doesn't apparently completely.
Change the script extension on windows to use pythonw instead of python
so that the command line doesn't appear all the time.
(bzr r4908)
Diffstat (limited to 'src/extension/paramcolor.cpp')
| -rw-r--r-- | src/extension/paramcolor.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/extension/paramcolor.cpp b/src/extension/paramcolor.cpp index 2a32086a8..cb7437be0 100644 --- a/src/extension/paramcolor.cpp +++ b/src/extension/paramcolor.cpp @@ -45,7 +45,9 @@ ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node* _value = in; gchar * prefname = this->pref_name(); - prefs_set_string_attribute(PREF_DIR, prefname, this->string()->c_str()); + std::string value; + string(value); + prefs_set_string_attribute(PREF_DIR, prefname, value.c_str()); g_free(prefname); return _value; @@ -66,41 +68,40 @@ ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * if (paramval != NULL) defaulthex = paramval; - _value = atoi(defaulthex); + _value = atoi(defaulthex); return; } -/** \brief Return the value as a string */ -Glib::ustring * -ParamColor::string (void) +void +ParamColor::string (std::string &string) { char str[16]; - sprintf(str, "%i", _value); - - return new Glib::ustring(str); + sprintf(str, "%i", _value); + string += str; + return; } Gtk::Widget * ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * changeSignal ) { - _changeSignal = new sigc::signal<void>(*changeSignal); - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - SPColorSelector* spColorSelector = (SPColorSelector*)sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK); - - ColorSelector* colorSelector = spColorSelector->base; - if (_value < 1) { - _value = 0xFF000000; - } - SPColor *color = new SPColor( _value ); - float alpha = (_value & 0xff) / 255.0F; + _changeSignal = new sigc::signal<void>(*changeSignal); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + SPColorSelector* spColorSelector = (SPColorSelector*)sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK); + + ColorSelector* colorSelector = spColorSelector->base; + if (_value < 1) { + _value = 0xFF000000; + } + SPColor *color = new SPColor( _value ); + float alpha = (_value & 0xff) / 255.0F; colorSelector->setColorAlpha(*color, alpha); - hbox->pack_start (*Glib::wrap(&spColorSelector->vbox), true, true, 0); - g_signal_connect(G_OBJECT(spColorSelector), "changed", G_CALLBACK(sp_color_param_changed), (void*)this); + hbox->pack_start (*Glib::wrap(&spColorSelector->vbox), true, true, 0); + g_signal_connect(G_OBJECT(spColorSelector), "changed", G_CALLBACK(sp_color_param_changed), (void*)this); - gtk_widget_show(GTK_WIDGET(spColorSelector)); - hbox->show(); + gtk_widget_show(GTK_WIDGET(spColorSelector)); + hbox->show(); return dynamic_cast<Gtk::Widget *>(hbox); } @@ -108,13 +109,13 @@ ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, si void sp_color_param_changed(SPColorSelector *csel, GObject *obj) { - const SPColor color = csel->base->getColor(); - float alpha = csel->base->getAlpha(); + const SPColor color = csel->base->getColor(); + float alpha = csel->base->getAlpha(); ParamColor* ptr = (ParamColor*)obj; - ptr->set(color.toRGBA32( alpha ), NULL, NULL); + ptr->set(color.toRGBA32( alpha ), NULL, NULL); - ptr->_changeSignal->emit(); + ptr->_changeSignal->emit(); } }; /* namespace Extension */ |
