Code

codedread's patch for bug 254850 (fixes handling of description field in Object Prope...
[inkscape.git] / src / dialogs / swatches.h
index fea2b83094a4043461086115b40a5f58bf10a895..310272b1c49003200eb2c5d690ad46054220b8a3 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 );
@@ -37,15 +43,43 @@ public:
     virtual ColorItem &operator=(ColorItem const &other);
     virtual Gtk::Widget* getPreview(PreviewStyle style,
                                     ViewType view,
-                                    Gtk::BuiltinIconSize size);
+                                    ::PreviewSize size,
+                                    guint ratio);
     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 _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;
 };
 
        
@@ -56,12 +90,11 @@ private:
 class SwatchesPanel : public Inkscape::UI::Widget::Panel
 {
 public:
-    SwatchesPanel();
+    SwatchesPanel(gchar const* prefsPath = "dialogs.swatches");
     virtual ~SwatchesPanel();
 
     static SwatchesPanel& getInstance();
-
-    void Temp();
+    virtual void setOrientation( Gtk::AnchorType how );
 
 protected:
     virtual void _handleAction( int setId, int itemId );