From 6e06f897cf9954c2710da7a38afabcf766d9da73 Mon Sep 17 00:00:00 2001 From: joncruz Date: Fri, 20 Mar 2009 06:50:37 +0000 Subject: [PATCH] Renamed ColorDef to PaintDef to prep for expanded functionality. --- src/dialogs/CMakeLists.txt | 4 +- src/interface.cpp | 8 ++-- src/ui/dialog/CMakeLists.txt | 2 + src/ui/dialog/swatches.cpp | 16 +++---- src/ui/dialog/swatches.h | 6 +-- src/widgets/Makefile_insert | 4 +- .../{eek-color-def.cpp => ege-paint-def.cpp} | 44 +++++++++---------- .../{eek-color-def.h => ege-paint-def.h} | 26 +++++------ 8 files changed, 55 insertions(+), 55 deletions(-) rename src/widgets/{eek-color-def.cpp => ege-paint-def.cpp} (89%) rename src/widgets/{eek-color-def.h => ege-paint-def.h} (88%) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 9d2ed9eb8..4e6b1ee3d 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -1,8 +1,6 @@ SET(dialogs_SRC clonetiler.cpp dialog-events.cpp -eek-color-def.cpp -eek-preview.cpp export.cpp extensions.cpp fill-style.cpp @@ -25,4 +23,4 @@ xml-tree.cpp ) ADD_LIBRARY(dialogs STATIC ${dialogs_SRC}) TARGET_LINK_LIBRARIES(dialogs -2geom ${INKSCAPE_LIBS}) \ No newline at end of file +2geom ${INKSCAPE_LIBS}) diff --git a/src/interface.cpp b/src/interface.cpp index c162ea6d6..144611c9a 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -63,7 +63,7 @@ #include "style.h" #include "event-context.h" #include "gradient-drag.h" -#include "widgets/eek-color-def.h" +#include "widgets/ege-paint-def.h" // Include Mac OS X menu synchronization on native OSX build #ifdef GDK_WINDOWING_QUARTZ @@ -1243,15 +1243,15 @@ sp_ui_drag_data_received(GtkWidget *widget, bool worked = false; Glib::ustring colorspec; if ( data->format == 8 ) { - eek::ColorDef color; + ege::PaintDef color; worked = color.fromMIMEData("application/x-oswb-color", reinterpret_cast(data->data), data->length, data->format); if ( worked ) { - if ( color.getType() == eek::ColorDef::CLEAR ) { + if ( color.getType() == ege::PaintDef::CLEAR ) { colorspec = ""; // TODO check if this is sufficient - } else if ( color.getType() == eek::ColorDef::NONE ) { + } else if ( color.getType() == ege::PaintDef::NONE ) { colorspec = "none"; } else { unsigned int r = color.getR(); diff --git a/src/ui/dialog/CMakeLists.txt b/src/ui/dialog/CMakeLists.txt index 1d912cf9f..ea63d6023 100644 --- a/src/ui/dialog/CMakeLists.txt +++ b/src/ui/dialog/CMakeLists.txt @@ -16,6 +16,8 @@ dock-behavior.cpp document-metadata.cpp document-properties.cpp extension-editor.cpp +eek-preview.cpp +ege-paint-def.cpp filedialog.cpp filedialogimpl-gtkmm.cpp fill-and-stroke.cpp diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 8fb811e3d..6470b3a5a 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -47,7 +47,7 @@ namespace UI { namespace Dialogs { -ColorItem::ColorItem(eek::ColorDef::ColorType type) : +ColorItem::ColorItem(ege::PaintDef::ColorType type) : def(type), _isLive(false), _linkIsTone(false), @@ -145,7 +145,7 @@ static void dragBegin( GtkWidget */*widget*/, GdkDragContext* dc, gpointer data using Inkscape::IO::Resource::ICONS; using Inkscape::IO::Resource::SYSTEM; - if (item->def.getType() != eek::ColorDef::RGB){ + if (item->def.getType() != ege::PaintDef::RGB){ GError *error = NULL; gsize bytesRead = 0; gsize bytesWritten = 0; @@ -444,7 +444,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS Gtk::Widget* newBlot = Glib::wrap(eekWidget); eek_preview_set_color( preview, (def.getR() << 8) | def.getR(), (def.getG() << 8) | def.getG(), (def.getB() << 8) | def.getB()); - if ( def.getType() != eek::ColorDef::RGB ) { + if ( def.getType() != ege::PaintDef::RGB ) { using Inkscape::IO::Resource::get_path; using Inkscape::IO::Resource::ICONS; using Inkscape::IO::Resource::SYSTEM; @@ -601,18 +601,18 @@ void ColorItem::buttonClicked(bool secondary) SPCSSAttr *css = sp_repr_css_attr_new(); Glib::ustring descr; switch (def.getType()) { - case eek::ColorDef::CLEAR: { + case ege::PaintDef::CLEAR: { // TODO actually make this clear sp_repr_css_set_property( css, attrName, "none" ); descr = secondary? _("Remove stroke color") : _("Remove fill color"); break; } - case eek::ColorDef::NONE: { + case ege::PaintDef::NONE: { sp_repr_css_set_property( css, attrName, "none" ); descr = secondary? _("Set stroke color to none") : _("Set fill color to none"); break; } - case eek::ColorDef::RGB: { + case ege::PaintDef::RGB: { gchar c[64]; guint32 rgba = (def.getR() << 24) | (def.getG() << 16) | (def.getB() << 8) | 0xff; sp_svg_write_color(c, sizeof(c), rgba); @@ -997,8 +997,8 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : { Gtk::RadioMenuItem* hotItem = 0; _holder = new PreviewHolder(); - _clear = new ColorItem( eek::ColorDef::CLEAR ); - _remove = new ColorItem( eek::ColorDef::NONE ); + _clear = new ColorItem( ege::PaintDef::CLEAR ); + _remove = new ColorItem( ege::PaintDef::NONE ); { JustForNow *docPalette = new JustForNow(); diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index ed311242e..8b83e1450 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -15,7 +15,7 @@ #include "ui/widget/panel.h" #include "ui/previewholder.h" -#include "widgets/eek-color-def.h" +#include "widgets/ege-paint-def.h" namespace Inkscape { namespace UI { @@ -31,7 +31,7 @@ class ColorItem : public Inkscape::UI::Previewable { friend void _loadPaletteFile( gchar const *filename ); public: - ColorItem( eek::ColorDef::ColorType type ); + ColorItem( ege::PaintDef::ColorType type ); ColorItem( unsigned int r, unsigned int g, unsigned int b, Glib::ustring& name ); virtual ~ColorItem(); @@ -42,7 +42,7 @@ public: ::PreviewSize size, guint ratio); void buttonClicked(bool secondary = false); - eek::ColorDef def; + ege::PaintDef def; private: static void _dropDataIn( GtkWidget *widget, diff --git a/src/widgets/Makefile_insert b/src/widgets/Makefile_insert index 13f2b33eb..08b2433ea 100644 --- a/src/widgets/Makefile_insert +++ b/src/widgets/Makefile_insert @@ -7,10 +7,10 @@ ink_common_sources += \ widgets/dash-selector.h \ widgets/desktop-widget.cpp \ widgets/desktop-widget.h \ - widgets/eek-color-def.cpp \ - widgets/eek-color-def.h \ widgets/eek-preview.cpp \ widgets/eek-preview.h \ + widgets/ege-paint-def.cpp \ + widgets/ege-paint-def.h \ widgets/fill-style.cpp \ widgets/fill-style.h \ widgets/font-selector.cpp \ diff --git a/src/widgets/eek-color-def.cpp b/src/widgets/ege-paint-def.cpp similarity index 89% rename from src/widgets/eek-color-def.cpp rename to src/widgets/ege-paint-def.cpp index 8542e5593..dc1579c8e 100644 --- a/src/widgets/eek-color-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -1,5 +1,5 @@ /** @file - * @brief EEK color definition + * @brief EGE paint definition */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -54,9 +54,9 @@ #define _(s) gettext(s) #endif // !defined(_) -#include "eek-color-def.h" +#include "ege-paint-def.h" -namespace eek +namespace ege { static std::string mimeTEXT("text/plain"); @@ -65,7 +65,7 @@ static std::string mimeOSWB_COLOR("application/x-oswb-color"); static std::string doubleToStr(double d); -ColorDef::ColorDef() : +PaintDef::PaintDef() : descr(_("none")), type(NONE), r(0), @@ -75,7 +75,7 @@ ColorDef::ColorDef() : { } -ColorDef::ColorDef( ColorType type ) : +PaintDef::PaintDef( ColorType type ) : descr(), type(type), r(0), @@ -96,7 +96,7 @@ ColorDef::ColorDef( ColorType type ) : } } -ColorDef::ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description ) : +PaintDef::PaintDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description ) : descr(description), type(RGB), r(r), @@ -106,18 +106,18 @@ ColorDef::ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::s { } -ColorDef::~ColorDef() +PaintDef::~PaintDef() { } -ColorDef::ColorDef( ColorDef const &other ) +PaintDef::PaintDef( PaintDef const &other ) { if ( this != &other ) { *this = other; } } -ColorDef& ColorDef::operator=( ColorDef const &other ) +PaintDef& PaintDef::operator=( PaintDef const &other ) { if ( this != & other ) { @@ -131,7 +131,7 @@ ColorDef& ColorDef::operator=( ColorDef const &other ) return *this; } -class ColorDef::HookData { +class PaintDef::HookData { public: HookData( ColorCallback cb, void* data ) {_cb = cb; _data = data;} ColorCallback _cb; @@ -139,7 +139,7 @@ public: }; -std::vector ColorDef::getMIMETypes() +std::vector PaintDef::getMIMETypes() { std::vector listing; listing.push_back(mimeOSWB_COLOR); @@ -148,7 +148,7 @@ std::vector ColorDef::getMIMETypes() return listing; } -void ColorDef::getMIMEData(std::string const & type, char*& dest, int& len, int& format) +void PaintDef::getMIMEData(std::string const & type, char*& dest, int& len, int& format) { if ( type == mimeTEXT ) { dest = new char[8]; @@ -168,12 +168,12 @@ void ColorDef::getMIMEData(std::string const & type, char*& dest, int& len, int& } else if ( type == mimeOSWB_COLOR ) { std::string tmp(""); switch ( getType() ) { - case eek::ColorDef::NONE: + case ege::PaintDef::NONE: { tmp += ""; } break; - case eek::ColorDef::CLEAR: + case ege::PaintDef::CLEAR: { tmp += ""; } @@ -204,7 +204,7 @@ void ColorDef::getMIMEData(std::string const & type, char*& dest, int& len, int& } } -bool ColorDef::fromMIMEData(std::string const & type, char const * data, int len, int /*format*/) +bool PaintDef::fromMIMEData(std::string const & type, char const * data, int len, int /*format*/) { bool worked = false; bool changed = false; @@ -213,11 +213,11 @@ bool ColorDef::fromMIMEData(std::string const & type, char const * data, int len } else if ( type == mimeOSWB_COLOR ) { std::string xml(data, len); if ( xml.find("") != std::string::npos ) { - if ( (this->type != eek::ColorDef::NONE) + if ( (this->type != ege::PaintDef::NONE) || (this->r != 0) || (this->g != 0) || (this->b != 0) ) { - this->type = eek::ColorDef::NONE; + this->type = ege::PaintDef::NONE; this->r = 0; this->g = 0; this->b = 0; @@ -229,7 +229,7 @@ bool ColorDef::fromMIMEData(std::string const & type, char const * data, int len if ( pos != std::string::npos ) { size_t endPos = xml.find(">", pos); std::string srgb = xml.substr(pos, endPos); - this->type = eek::ColorDef::RGB; + this->type = ege::PaintDef::RGB; size_t numPos = srgb.find("r="); if (numPos != std::string::npos) { char* endPtr = 0; @@ -279,7 +279,7 @@ bool ColorDef::fromMIMEData(std::string const & type, char const * data, int len return worked; } -void ColorDef::setRGB( unsigned int r, unsigned int g, unsigned int b ) +void PaintDef::setRGB( unsigned int r, unsigned int g, unsigned int b ) { if ( r != this->r || g != this->g || b != this->b ) { this->r = r; @@ -297,12 +297,12 @@ void ColorDef::setRGB( unsigned int r, unsigned int g, unsigned int b ) } } -void ColorDef::addCallback( ColorCallback cb, void* data ) +void PaintDef::addCallback( ColorCallback cb, void* data ) { _listeners.push_back( new HookData(cb, data) ); } -void ColorDef::removeCallback( ColorCallback /*cb*/, void* /*data*/ ) +void PaintDef::removeCallback( ColorCallback /*cb*/, void* /*data*/ ) { } @@ -314,7 +314,7 @@ static std::string doubleToStr(double d) return out.str(); } -} // namespace eek +} // namespace ege /* Local Variables: diff --git a/src/widgets/eek-color-def.h b/src/widgets/ege-paint-def.h similarity index 88% rename from src/widgets/eek-color-def.h rename to src/widgets/ege-paint-def.h index 2f6117d54..b47aec8aa 100644 --- a/src/widgets/eek-color-def.h +++ b/src/widgets/ege-paint-def.h @@ -1,5 +1,5 @@ /** @file - * @brief EEK color definition + * @brief EGE paint definition */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -37,30 +37,30 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef SEEN_EEK_COLOR_DEF_H -#define SEEN_EEK_COLOR_DEF_H +#ifndef SEEN_EGE_PAINT_DEF_H +#define SEEN_EGE_PAINT_DEF_H #include #include -namespace eek +namespace ege { typedef void (*ColorCallback)( void* data ); -class ColorDef +class PaintDef { public: enum ColorType{CLEAR, NONE, RGB}; - ColorDef(); - ColorDef(ColorType type); - ColorDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description ); - virtual ~ColorDef(); + PaintDef(); + PaintDef(ColorType type); + PaintDef( unsigned int r, unsigned int g, unsigned int b, const std::string& description ); + virtual ~PaintDef(); - ColorDef( ColorDef const &other ); - virtual ColorDef& operator=( ColorDef const &other ); + PaintDef( PaintDef const &other ); + virtual PaintDef& operator=( PaintDef const &other ); ColorType getType() const { return type; } @@ -95,9 +95,9 @@ private: }; -} // namespace eek +} // namespace ege -#endif // SEEN_EEK_COLOR_DEF_H +#endif // SEEN_EGE_PAINT_DEF_H /* Local Variables: -- 2.30.2