1 /** @file
2 * @brief Align and Distribute dialog
3 */
4 /* Authors:
5 * Bryce W. Harrington <bryce@bryceharrington.org>
6 * Aubanel MONNIER <aubi@libertysurf.fr>
7 * Frank Felfe <innerspace@iname.com>
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 *
10 * Copyright (C) 1999-2004, 2005 Authors
11 *
12 * Released under GNU GPL. Read the file 'COPYING' for more information.
13 */
15 #ifndef INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_H
16 #define INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_H
18 #include <gtkmm/notebook.h>
19 #include <glibmm/i18n.h>
21 #include <list>
22 #include <gtkmm/frame.h>
23 #include <gtkmm/tooltips.h>
24 #include <gtkmm/comboboxtext.h>
25 #include <gtkmm/table.h>
26 #include <gtkmm/buttonbox.h>
27 #include <gtkmm/label.h>
28 #include "libnr/nr-dim2.h"
29 #include "libnr/nr-rect.h"
32 #include "ui/widget/panel.h"
33 #include "ui/widget/notebook-page.h"
36 class SPItem;
38 namespace Inkscape {
39 namespace UI {
40 namespace Dialog {
42 class Action;
45 class AlignAndDistribute : public Widget::Panel {
46 public:
47 AlignAndDistribute();
48 virtual ~AlignAndDistribute();
50 static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); }
52 enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
54 AlignTarget getAlignTarget() const;
56 Gtk::Table &align_table(){return _alignTable;}
57 Gtk::Table &distribute_table(){return _distributeTable;}
58 Gtk::Table &rearrange_table(){return _rearrangeTable;}
59 Gtk::Table &removeOverlap_table(){return _removeOverlapTable;}
60 Gtk::Table &nodes_table(){return _nodesTable;}
61 Gtk::Tooltips &tooltips(){return _tooltips;}
63 std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
64 void setMode(bool nodeEdit);
66 Geom::OptRect randomize_bbox;
68 protected:
70 void on_ref_change();
71 void on_selgrp_toggled();
72 void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext,
73 guint row, guint col, bool onInterSpace,
74 Geom::Dim2 orientation, float kBegin, float kEnd);
75 void addAlignButton(const Glib::ustring &id, const Glib::ustring tiptext,
76 guint row, guint col);
77 void addNodeButton(const Glib::ustring &id, const Glib::ustring tiptext,
78 guint col, Geom::Dim2 orientation, bool distribute);
79 void addRemoveOverlapsButton(const Glib::ustring &id,
80 const Glib::ustring tiptext,
81 guint row, guint col);
82 void addGraphLayoutButton(const Glib::ustring &id,
83 const Glib::ustring tiptext,
84 guint row, guint col);
85 void addExchangePositionsButton(const Glib::ustring &id,
86 const Glib::ustring tiptext,
87 guint row, guint col);
88 void addExchangePositionsByZOrderButton(const Glib::ustring &id,
89 const Glib::ustring tiptext,
90 guint row, guint col);
91 void addExchangePositionsClockwiseButton(const Glib::ustring &id,
92 const Glib::ustring tiptext,
93 guint row, guint col);
94 void addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext,
95 guint row, guint col);
96 void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext,
97 guint row, guint col);
98 void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
99 guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
101 std::list<Action *> _actionList;
102 Gtk::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame;
103 Gtk::Table _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable;
104 Gtk::HBox _anchorBox;
105 Gtk::HBox _selgrpBox;
106 Gtk::VBox _alignBox;
107 Gtk::Label _anchorLabel;
108 Gtk::Label _selgrpLabel;
109 Gtk::CheckButton _selgrp;
110 Gtk::ComboBoxText _combo;
111 Gtk::Tooltips _tooltips;
113 private:
114 AlignAndDistribute(AlignAndDistribute const &d);
115 AlignAndDistribute& operator=(AlignAndDistribute const &d);
116 };
119 struct BBoxSort
120 {
121 SPItem *item;
122 float anchor;
123 Geom::Rect bbox;
124 BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
125 BBoxSort(const BBoxSort &rhs);
126 };
127 bool operator< (const BBoxSort &a, const BBoxSort &b);
129 } // namespace Dialog
130 } // namespace UI
131 } // namespace Inkscape
133 #endif // INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_H
135 /*
136 Local Variables:
137 mode:c++
138 c-file-style:"stroustrup"
139 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
140 indent-tabs-mode:nil
141 fill-column:99
142 End:
143 */
144 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :