Code

Objects will now change when their linked colors change.
[inkscape.git] / src / dialogs / swatches.h
index ca17cd066cd2ad90e4034f55734fc6fd98bc3ba5..b6f28f18201be089257b122264f72d92ee867d3a 100644 (file)
 
 #include "ui/widget/panel.h"
 #include "ui/previewholder.h"
+#include "dialogs/eek-color-def.h"
+
+using eek::ColorDef;
 
 namespace Inkscape {
 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( unsigned int r, unsigned int g, unsigned int b,
                Glib::ustring& name );
@@ -39,13 +45,32 @@ public:
                                     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:
+    static void _dropDataIn( GtkWidget *widget,
+                             GdkDragContext *drag_context,
+                             gint x, gint y,
+                             GtkSelectionData *data,
+                             guint info,
+                             guint event_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 _linkIsTone;
+    int _linkPercent;
+    int _linkGray;
+    ColorItem* _linkSrc;
+    std::vector<ColorItem*> _listeners;
 };
 
        
@@ -60,6 +85,7 @@ public:
     virtual ~SwatchesPanel();
 
     static SwatchesPanel& getInstance();
+    virtual void setOrientation( Gtk::AnchorType how );
 
 protected:
     virtual void _handleAction( int setId, int itemId );