Code

Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in...
[inkscape.git] / src / ui / dialog / align-and-distribute.h
index 69fc176736aae8a6785114d047436574e0ff8520..7c99d67c791285a090ad46368e7f0c5e08917898 100644 (file)
@@ -1,7 +1,7 @@
-/**
- * \brief Align and Distribute dialog
- *
- * Authors:
+/** @file
+ * @brief Align and Distribute dialog
+ */
+/* Authors:
  *   Bryce W. Harrington <bryce@bryceharrington.org>
  *   Aubanel MONNIER <aubi@libertysurf.fr>
  *   Frank Felfe <innerspace@iname.com>
 #include "libnr/nr-rect.h"
 
 
-#include "dialog.h"
+#include "ui/widget/panel.h"
 #include "ui/widget/notebook-page.h"
 
-using namespace Inkscape::UI::Widget;
-
 
 class SPItem;
 
@@ -44,12 +42,12 @@ namespace Dialog {
 class Action;
 
 
-class AlignAndDistribute : public Dialog {
+class AlignAndDistribute : public Widget::Panel {
 public:
     AlignAndDistribute();
     virtual ~AlignAndDistribute();
 
-    static AlignAndDistribute *create() { return new AlignAndDistribute(); }
+    static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); }
 
     enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
 
@@ -57,47 +55,58 @@ public:
 
     Gtk::Table &align_table(){return _alignTable;}
     Gtk::Table &distribute_table(){return _distributeTable;}
+    Gtk::Table &rearrange_table(){return _rearrangeTable;}
     Gtk::Table &removeOverlap_table(){return _removeOverlapTable;}
-    Gtk::Table &graphLayout_table(){return _graphLayoutTable;}
     Gtk::Table &nodes_table(){return _nodesTable;}
     Gtk::Tooltips &tooltips(){return _tooltips;}
 
     std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
     void setMode(bool nodeEdit);
 
-    NR::Rect randomize_bbox;
-    bool randomize_bbox_set;
-
+    Geom::OptRect randomize_bbox;
 
 protected:
 
     void on_ref_change();
+    void on_selgrp_toggled();
     void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
                                       guint row, guint col, bool onInterSpace, 
-                                      NR::Dim2 orientation, float kBegin, float kEnd);
+                                      Geom::Dim2 orientation, float kBegin, float kEnd);
     void addAlignButton(const Glib::ustring &id, const Glib::ustring tiptext, 
                         guint row, guint col);
     void addNodeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
-                        guint col, NR::Dim2 orientation, bool distribute);
+                        guint col, Geom::Dim2 orientation, bool distribute);
     void addRemoveOverlapsButton(const Glib::ustring &id,
                         const Glib::ustring tiptext,
                         guint row, guint col);
     void addGraphLayoutButton(const Glib::ustring &id,
                         const Glib::ustring tiptext,
                         guint row, guint col);
+    void addExchangePositionsButton(const Glib::ustring &id,
+                        const Glib::ustring tiptext,
+                        guint row, guint col);
+    void addExchangePositionsByZOrderButton(const Glib::ustring &id,
+                        const Glib::ustring tiptext,
+                        guint row, guint col);
+    void addExchangePositionsClockwiseButton(const Glib::ustring &id,
+                        const Glib::ustring tiptext,
+                        guint row, guint col);
     void addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext, 
                         guint row, guint col);
     void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
                         guint row, guint col);
     void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
-                           guint row, guint col, Gtk::Table &table, NR::Dim2 orientation, bool distribute);
+                           guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
 
     std::list<Action *> _actionList;
-    Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
-    Gtk::Table _alignTable, _distributeTable, _removeOverlapTable, _graphLayoutTable, _nodesTable;
+    Gtk::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame;
+    Gtk::Table _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable;
     Gtk::HBox _anchorBox;
+    Gtk::HBox _selgrpBox;
     Gtk::VBox _alignBox;
     Gtk::Label _anchorLabel;
+    Gtk::Label _selgrpLabel;
+    Gtk::CheckButton _selgrp;
     Gtk::ComboBoxText _combo;
     Gtk::Tooltips _tooltips;
 
@@ -106,6 +115,17 @@ private:
     AlignAndDistribute& operator=(AlignAndDistribute const &d);
 };
 
+
+struct BBoxSort
+{
+    SPItem *item;
+    float anchor;
+    Geom::Rect bbox;
+    BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
+    BBoxSort(const BBoxSort &rhs);
+};
+bool operator< (const BBoxSort &a, const BBoxSort &b);
+
 } // namespace Dialog
 } // namespace UI
 } // namespace Inkscape
@@ -121,4 +141,4 @@ private:
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :