diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2009-03-21 18:20:28 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2009-03-21 18:20:28 +0000 |
| commit | d268be1114d64cc698c36b3d23afa1c6acf426fc (patch) | |
| tree | b8cba411da6ce33b1b1bd2467a6a519ca3a4dd13 /src/ui/dialog/swatches.cpp | |
| parent | Added explicit tagging of "solid color gradients" and base context menu to ad... (diff) | |
| download | inkscape-d268be1114d64cc698c36b3d23afa1c6acf426fc.tar.gz inkscape-d268be1114d64cc698c36b3d23afa1c6acf426fc.zip | |
Cleaning up interface. Moved internals out of .h file.
(bzr r7536)
Diffstat (limited to 'src/ui/dialog/swatches.cpp')
| -rw-r--r-- | src/ui/dialog/swatches.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 1bc3e6882..4e15d26ac 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -49,6 +49,64 @@ namespace UI { namespace Dialogs { +void _loadPaletteFile( gchar const *filename ); + +/** + * The color swatch you see on screen as a clickable box. + */ +class ColorItem : public Inkscape::UI::Previewable +{ + friend void _loadPaletteFile( gchar const *filename ); +public: + ColorItem( ege::PaintDef::ColorType type ); + ColorItem( unsigned int r, unsigned int g, unsigned int b, + Glib::ustring& name ); + virtual ~ColorItem(); + ColorItem(ColorItem const &other); + virtual ColorItem &operator=(ColorItem const &other); + virtual Gtk::Widget* getPreview(PreviewStyle style, + ViewType view, + ::PreviewSize size, + guint ratio); + void buttonClicked(bool secondary = false); + ege::PaintDef def; + void* ptr; + +private: + static void _dropDataIn( GtkWidget *widget, + GdkDragContext *drag_context, + gint x, gint y, + GtkSelectionData *data, + guint info, + guint event_time, + gpointer user_data); + + static void _dragGetColorData( GtkWidget *widget, + GdkDragContext *drag_context, + GtkSelectionData *data, + guint info, + guint time, + gpointer user_data); + + static void _wireMagicColors( void* p ); + static void _colorDefChanged(void* data); + + void _linkTint( ColorItem& other, int percent ); + void _linkTone( ColorItem& other, int percent, int grayLevel ); + + Gtk::Tooltips tips; + std::vector<Gtk::Widget*> _previews; + + bool _isLive; + bool _linkIsTone; + int _linkPercent; + int _linkGray; + ColorItem* _linkSrc; + std::vector<ColorItem*> _listeners; +}; + + + ColorItem::ColorItem(ege::PaintDef::ColorType type) : def(type), ptr(0), |
