Code

Improve behavior when pasting, DnDing and importing bitmap images
[inkscape.git] / src / ui / dialog / swatches.h
index c498f7ffd9f9588f03f981ebdbde13b2434ede39..35bcd8c784bba864c3d46a5f71e4be7f0586117d 100644 (file)
@@ -21,67 +21,10 @@ namespace Inkscape {
 namespace UI {
 namespace Dialogs {
 
-
-void _loadPaletteFile( gchar const *filename );
+class ColorItem;
 
 /**
- * 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;
-};
-       
-class RemoveColorItem;
-
-/**
- * A panel that displays color swatches.
+ * A panel that displays paint swatches.
  */
 class SwatchesPanel : public Inkscape::UI::Widget::Panel
 {
@@ -90,6 +33,7 @@ public:
     virtual ~SwatchesPanel();
 
     static SwatchesPanel& getInstance();
+
     virtual void setOrientation( Gtk::AnchorType how );
 
     virtual void setDesktop( SPDesktop* desktop );
@@ -99,6 +43,7 @@ public:
     virtual void handleGradientsChange(); // temporary
 
 protected:
+    virtual void _updateFromSelection();
     virtual void _handleAction( int setId, int itemId );
     virtual void _setDocument( SPDocument *document );
     virtual void _rebuild();
@@ -107,8 +52,6 @@ private:
     SwatchesPanel(SwatchesPanel const &); // no copy
     SwatchesPanel &operator=(SwatchesPanel const &); // no assign
 
-    static SwatchesPanel* instance;
-
     PreviewHolder* _holder;
     ColorItem* _clear;
     ColorItem* _remove;
@@ -119,6 +62,9 @@ private:
 
     sigc::connection _documentConnection;
     sigc::connection _resourceConnection;
+    sigc::connection _selChanged;
+    sigc::connection _setModified;
+    sigc::connection _subselChanged;
 };
 
 } //namespace Dialogs