summaryrefslogtreecommitdiffstats
path: root/src/extension/paramcolor.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-04-04 04:55:24 +0000
committergouldtj <gouldtj@users.sourceforge.net>2008-04-04 04:55:24 +0000
commit8a2ba4f29d0304fef7631e0efec8b10a2dc99121 (patch)
tree0eb2b0987084a55191da506c6c7e870bbe2d903d /src/extension/paramcolor.cpp
parent* packaging/macosx/ScriptExec/main.c: Add a comment to clarify what looks (diff)
downloadinkscape-8a2ba4f29d0304fef7631e0efec8b10a2dc99121.tar.gz
inkscape-8a2ba4f29d0304fef7631e0efec8b10a2dc99121.zip
r18381@shi: ted | 2008-03-07 20:11:34 -0800
New work branch r18391@shi: ted | 2008-03-08 21:36:03 -0800 Moving the parameters around to clean up the directories. r18392@shi: ted | 2008-03-08 21:57:14 -0800 Moving the 'get' function to cpp r18870@shi: ted | 2008-04-03 21:10:20 -0700 Adding in to the parameter prototype the ability to have a gui-tip and a gui-hidden parameter r18871@shi: ted | 2008-04-03 21:17:39 -0700 Using the _gui-hidden parameter to block the creation of the widget if set. r18890@shi: ted | 2008-04-03 21:53:55 -0700 Merge from r18024 which got lost in the shuffle. (bzr r5322)
Diffstat (limited to 'src/extension/paramcolor.cpp')
-rw-r--r--src/extension/paramcolor.cpp122
1 files changed, 0 insertions, 122 deletions
diff --git a/src/extension/paramcolor.cpp b/src/extension/paramcolor.cpp
deleted file mode 100644
index cb7437be0..000000000
--- a/src/extension/paramcolor.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2005-2007 Authors:
- * Ted Gould <ted@gould.cx>
- * Johan Engelen <johan@shouraizou.nl>
- * Christopher Brown <audiere@gmail.com>
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <iostream>
-#include <sstream>
-
-#include <gtkmm/adjustment.h>
-#include <gtkmm/box.h>
-#include <gtkmm/spinbutton.h>
-
-#include <xml/node.h>
-
-#include "extension.h"
-#include "paramcolor.h"
-
-#include "color.h"
-#include "widgets/sp-color-selector.h"
-#include "widgets/sp-color-notebook.h"
-
-
-namespace Inkscape {
-namespace Extension {
-
-void sp_color_param_changed(SPColorSelector *csel, GObject *cp);
-
-
-/** \brief Free the allocated data. */
-ParamColor::~ParamColor(void)
-{
-
-}
-
-guint32
-ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ )
-{
- _value = in;
-
- gchar * prefname = this->pref_name();
- std::string value;
- string(value);
- prefs_set_string_attribute(PREF_DIR, prefname, value.c_str());
- g_free(prefname);
-
- return _value;
-}
-
-/** \brief Initialize the object, to do that, copy the data. */
-ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext)
-{
- const char * defaulthex = NULL;
- if (sp_repr_children(xml) != NULL)
- defaulthex = sp_repr_children(xml)->content();
-
- gchar * pref_name = this->pref_name();
- const gchar * paramval = prefs_get_string_attribute(PREF_DIR, pref_name);
- g_free(pref_name);
-
- if (paramval != NULL)
- defaulthex = paramval;
-
- _value = atoi(defaulthex);
-
- return;
-}
-
-void
-ParamColor::string (std::string &string)
-{
- char str[16];
- 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;
- 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);
-
- gtk_widget_show(GTK_WIDGET(spColorSelector));
- hbox->show();
-
- return dynamic_cast<Gtk::Widget *>(hbox);
-}
-
-void
-sp_color_param_changed(SPColorSelector *csel, GObject *obj)
-{
- const SPColor color = csel->base->getColor();
- float alpha = csel->base->getAlpha();
-
- ParamColor* ptr = (ParamColor*)obj;
- ptr->set(color.toRGBA32( alpha ), NULL, NULL);
-
- ptr->_changeSignal->emit();
-}
-
-}; /* namespace Extension */
-}; /* namespace Inkscape */