Code

Refactoring SPColor to C++ and removing legacy CMYK implementation
[inkscape.git] / src / dialogs / layers-panel.h
index ba135e20202522cca24e07ea93dc85c3dfc25f28..83c5089fc8a434726caa00a02c9dae7de4718957 100644 (file)
 #include <gtkmm/treeview.h>
 #include <gtkmm/treestore.h>
 #include <gtkmm/tooltips.h>
+#include <gtkmm/scale.h>
 #include <gtkmm/scrolledwindow.h>
+#include <gtkmm/box.h>
+#include <gtkmm/buttonbox.h>
+#include <gtkmm/spinbutton.h>
 
-#include "ui/widget/panel.h"
 //#include "ui/previewholder.h"
+#include "ui/dialog/dialog.h"
 
 class SPObject;
 
@@ -33,14 +37,14 @@ namespace Dialogs {
 /**
  * A panel that displays layers.
  */
-class LayersPanel : public Inkscape::UI::Widget::Panel
+class LayersPanel : public Inkscape::UI::Dialog::Dialog
 {
 public:
-    LayersPanel();
+    LayersPanel(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory);
     virtual ~LayersPanel();
 
-    static LayersPanel& getInstance();
     //virtual void setOrientation( Gtk::AnchorType how );
+    static LayersPanel *create(Inkscape::UI::Dialog::Behavior::BehaviorFactory behavior_factory);
 
     void setDesktop( SPDesktop* desktop );
 
@@ -49,6 +53,7 @@ protected:
 
 private:
     class ModelColumns;
+    class InternalUIBounce;
 
     LayersPanel(LayersPanel const &); // no copy
     LayersPanel &operator=(LayersPanel const &); // no assign
@@ -59,33 +64,50 @@ private:
     void _fireAction( unsigned int code );
     Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
 
+    void _preToggle( GdkEvent const *event );
     void _toggled( Glib::ustring const& str, int targetCol );
 
     void _handleButtonEvent(GdkEventButton* evt);
     void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
 
+    void _pushTreeSelectionToCurrent();
     void _checkTreeSelection();
 
     void _takeAction( int val );
+    bool _executeAction();
+
+    bool _rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & model, Gtk::TreeModel::Path const & path, bool b );
+
+    void _updateLayer(SPObject *layer);
+    bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
 
     void _selectLayer(SPObject *layer);
     bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
 
     void _layersChanged();
+    void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
 
-    SPObject* _selectedLayer();
+    void _opacityChanged();
 
-    // Hooked to the desktop:
-    sigc::connection _layerChangedConnection;
+    SPObject* _selectedLayer();
 
     // Hooked to the layer manager:
+    sigc::connection _layerChangedConnection;
+    sigc::connection _layerUpdatedConnection;
     sigc::connection _changedConnection;
     sigc::connection _addedConnection;
     sigc::connection _removedConnection;
+    sigc::connection _opacityConnection;
+
+    // Internal
+    sigc::connection _selectedConnection;
 
+    int _maxNestDepth;
     Inkscape::LayerManager* _mgr;
     SPDesktop* _desktop;
     ModelColumns* _model;
+    InternalUIBounce* _pending;
+    GdkEvent* _toggleEvent;
     Glib::RefPtr<Gtk::TreeStore> _store;
     std::vector<Gtk::Widget*> _watching;
     std::vector<Gtk::Widget*> _watchingNonTop;
@@ -93,9 +115,12 @@ private:
 
     Gtk::Tooltips _tips;
     Gtk::TreeView _tree;
-    Gtk::HBox _buttonsRow;
+    Gtk::HButtonBox _buttonsRow;
     Gtk::ScrolledWindow _scroller;
+    Gtk::HBox _opacityBox;
+    Gtk::HScale _opacity;
     Gtk::Menu _popupMenu;
+    Gtk::SpinButton _spinBtn;
 };