summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 96c994d)
raw | patch | inline | side by side (parent: 96c994d)
| author | joncruz <joncruz@users.sourceforge.net> | |
| Fri, 24 Mar 2006 04:12:22 +0000 (04:12 +0000) | ||
| committer | joncruz <joncruz@users.sourceforge.net> | |
| Fri, 24 Mar 2006 04:12:22 +0000 (04:12 +0000) |
| ChangeLog | patch | blob | history | |
| src/dialogs/Makefile_insert | patch | blob | history | |
| src/dialogs/eek-color-def.cpp | [new file with mode: 0644] | patch | blob |
| src/dialogs/eek-color-def.h | [new file with mode: 0644] | patch | blob |
| src/dialogs/swatches.cpp | patch | blob | history | |
| src/dialogs/swatches.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index f65651c8c20a3f4da23dd07e3d5eb08dfdb3ab7a..8def88483804f1f4d99aa14ccc832df2f03c4cd0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-03-10 Jon A. Cruz <jon@joncruz.org>
+
+ * src/dialogs/eek-color-def.cpp, src/dialogs/eek-color-def.h,
+ src/dialogs/Makefile_insert, src/dialogs/swatches.h,
+ src/dialogs/swatches.cpp:
+
+ Bringing in new color class.
+
2006-03-23 Michael Wybrow <mjwybrow@users.sourceforge.net>
* packaging/macosx/Resources/bin/inkscape: Fix a packaging
index b3084c06ab4885befdd3585a72f39ddd01ed87b7..4100ec8532c0bb7282bee11f4aaec0d29174e821 100644 (file)
dialogs/debugdialog.h \
dialogs/dialog-events.cpp \
dialogs/dialog-events.h \
+ dialogs/eek-color-def.h \
+ dialogs/eek-color-def.cpp \
dialogs/eek-preview.h \
dialogs/eek-preview.cpp \
dialogs/export.cpp \
diff --git a/src/dialogs/eek-color-def.cpp b/src/dialogs/eek-color-def.cpp
--- /dev/null
@@ -0,0 +1,96 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Eek Color Definition.
+ *
+ * The Initial Developer of the Original Code is
+ * Jon A. Cruz.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <libintl.h>
+
+#if !defined(_)
+#define _(s) gettext(s)
+#endif // !defined(_)
+
+#include "eek-color-def.h"
+
+namespace eek
+{
+
+ColorDef::ColorDef() :
+ r(0),
+ g(0),
+ b(0),
+ descr(_("none")),
+ none(true)
+{
+}
+
+ColorDef::ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description ) :
+ r(r),
+ g(g),
+ b(b),
+ descr(description),
+ none(false)
+{
+}
+
+ColorDef::~ColorDef()
+{
+}
+
+ColorDef::ColorDef( ColorDef const &other )
+{
+ if ( this != &other ) {
+ *this = other;
+ }
+}
+
+ColorDef& ColorDef::operator=( ColorDef const &other )
+{
+ if ( this != & other )
+ {
+ r = other.r;
+ g = other.g;
+ b = other.b;
+ descr = other.descr;
+ none = other.none;
+ }
+ return *this;
+}
+
+
+
+
+} // namespace eek
diff --git a/src/dialogs/eek-color-def.h b/src/dialogs/eek-color-def.h
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef SEEN_EEK_COLOR_DEF_H
+#define SEEN_EEK_COLOR_DEF_H
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Eek Color Definition.
+ *
+ * The Initial Developer of the Original Code is
+ * Jon A. Cruz.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <string>
+
+namespace eek
+{
+
+class ColorDef
+{
+public:
+ ColorDef();
+ ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description );
+ virtual ~ColorDef();
+
+ ColorDef( ColorDef const &other );
+ virtual ColorDef& operator=( ColorDef const &other );
+
+
+ unsigned int r;
+ unsigned int g;
+ unsigned int b;
+ std::string descr;
+ bool none;
+
+protected:
+
+private:
+};
+
+
+} // namespace eek
+
+
+#endif // SEEN_EEK_COLOR_DEF_H
index 17418186a77f402ccf482171a03adcdda292f412..d9aad2bdce6795b6a806a86a424f8d588e09f577 100644 (file)
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
ColorItem::ColorItem( unsigned int r, unsigned int g, unsigned int b, Glib::ustring& name ) :
- _r(r),
- _g(g),
- _b(b),
- _name(name)
+ def( r, g, b, name )
{
}
ColorItem &ColorItem::operator=(ColorItem const &other)
{
if ( this != &other ) {
- _r = other._r;
- _g = other._g;
- _b = other._b;
- _name = other._name;
+ def = other.def;
}
return *this;
}
ColorItem* item = reinterpret_cast<ColorItem*>(user_data);
if ( info == 1 ) {
- gchar* tmp = g_strdup_printf("#%02x%02x%02x", item->_r, item->_g, item->_b);
+ gchar* tmp = g_strdup_printf("#%02x%02x%02x", item->def.r, item->def.g, item->def.b);
gtk_selection_data_set( data,
typeText,
tmp = 0;
} else {
guint16 tmp[4];
- tmp[0] = (item->_r << 8) | item->_r;
- tmp[1] = (item->_g << 8) | item->_g;
- tmp[2] = (item->_b << 8) | item->_b;
+ tmp[0] = (item->def.r << 8) | item->def.r;
+ tmp[1] = (item->def.g << 8) | item->def.g;
+ tmp[2] = (item->def.b << 8) | item->def.b;
tmp[3] = 0xffff;
gtk_selection_data_set( data,
typeXColor,
if ( item )
{
Glib::RefPtr<Gdk::Pixbuf> thumb = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, false, 8, 32, 24 );
- guint32 fillWith = (0xff000000 & (item->_r << 24))
- | (0x00ff0000 & (item->_g << 16))
- | (0x0000ff00 & (item->_b << 8));
+ guint32 fillWith = (0xff000000 & (item->def.r << 24))
+ | (0x00ff0000 & (item->def.g << 16))
+ | (0x0000ff00 & (item->def.b << 8));
thumb->fill( fillWith );
gtk_drag_set_icon_pixbuf( dc, thumb->gobj(), 0, 0 );
}
@@ -160,7 +154,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Gtk::Built
{
Gtk::Widget* widget = 0;
if ( style == PREVIEW_STYLE_BLURB ) {
- Gtk::Label *lbl = new Gtk::Label(_name);
+ Gtk::Label *lbl = new Gtk::Label(def.descr);
lbl->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
widget = lbl;
} else {
@@ -173,7 +167,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Gtk::Built
EekPreview * preview = EEK_PREVIEW(eekWidget);
Gtk::Widget* newBlot = Glib::wrap(eekWidget);
- eek_preview_set_color( preview, (_r << 8)|_r, (_g << 8)|_g, (_b << 8)|_b);
+ eek_preview_set_color( preview, (def.r << 8) | def.r, (def.g << 8) | def.g, (def.b << 8) | def.b);
eek_preview_set_details( preview, (::PreviewStyle)style, (::ViewType)view, (::GtkIconSize)size );
@@ -194,7 +188,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Gtk::Built
Gtk::Widget* newBlot = btn;
*/
- tips.set_tip((*newBlot), _name);
+ tips.set_tip((*newBlot), def.descr);
/*
newBlot->signal_clicked().connect( sigc::mem_fun(*this, &ColorItem::buttonClicked) );
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop) {
char const * attrName = secondary ? "stroke" : "fill";
- guint32 rgba = (_r << 24) | (_g << 16) | (_b << 8) | 0xff;
+ guint32 rgba = (def.r << 24) | (def.g << 16) | (def.b << 8) | 0xff;
gchar c[64];
sp_svg_write_color(c, 64, rgba);
diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h
index 37a04cfba3ff4d53a1bbcec3f8e4d8b9aed2a641..1fba23ebaa8556a1b9441bcf4717889e93ae0688 100644 (file)
--- a/src/dialogs/swatches.h
+++ b/src/dialogs/swatches.h
#include "ui/widget/panel.h"
#include "ui/previewholder.h"
+#include "dialogs/eek-color-def.h"
+
+using eek::ColorDef;
namespace Inkscape {
namespace UI {
ViewType view,
Gtk::BuiltinIconSize size);
void buttonClicked(bool secondary = false);
- unsigned int _r;
- unsigned int _g;
- unsigned int _b;
- Glib::ustring _name;
-
+
+ ColorDef def;
private:
Gtk::Tooltips tips;
};