Code

NR::Maybe => boost::optional
[inkscape.git] / src / ui / dialog / align-and-distribute.h
1 /**
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"
35 using namespace Inkscape::UI::Widget;
38 class SPItem;
40 namespace Inkscape {
41 namespace UI {
42 namespace Dialog {
44 class Action;
47 class AlignAndDistribute : public Widget::Panel {
48 public:
49     AlignAndDistribute();
50     virtual ~AlignAndDistribute();
52     static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); }
54     enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
56     AlignTarget getAlignTarget() const;
58     Gtk::Table &align_table(){return _alignTable;}
59     Gtk::Table &distribute_table(){return _distributeTable;}
60     Gtk::Table &removeOverlap_table(){return _removeOverlapTable;}
61     Gtk::Table &graphLayout_table(){return _graphLayoutTable;}
62     Gtk::Table &nodes_table(){return _nodesTable;}
63     Gtk::Tooltips &tooltips(){return _tooltips;}
65     std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
66     void setMode(bool nodeEdit);
68     boost::optional<Geom::Rect> randomize_bbox;
70 protected:
72     void on_ref_change();
73     void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
74                                       guint row, guint col, bool onInterSpace, 
75                                       Geom::Dim2 orientation, float kBegin, float kEnd);
76     void addAlignButton(const Glib::ustring &id, const Glib::ustring tiptext, 
77                         guint row, guint col);
78     void addNodeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
79                         guint col, Geom::Dim2 orientation, bool distribute);
80     void addRemoveOverlapsButton(const Glib::ustring &id,
81                         const Glib::ustring tiptext,
82                         guint row, guint col);
83     void addGraphLayoutButton(const Glib::ustring &id,
84                         const Glib::ustring tiptext,
85                         guint row, guint col);
86     void addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext, 
87                         guint row, guint col);
88     void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
89                         guint row, guint col);
90     void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
91                            guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
93     std::list<Action *> _actionList;
94     Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
95     Gtk::Table _alignTable, _distributeTable, _removeOverlapTable, _graphLayoutTable, _nodesTable;
96     Gtk::HBox _anchorBox;
97     Gtk::VBox _alignBox;
98     Gtk::Label _anchorLabel;
99     Gtk::ComboBoxText _combo;
100     Gtk::Tooltips _tooltips;
102 private:
103     AlignAndDistribute(AlignAndDistribute const &d);
104     AlignAndDistribute& operator=(AlignAndDistribute const &d);
105 };
108 struct BBoxSort
110     SPItem *item;
111     float anchor;
112     Geom::Rect bbox;
113     BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
114     BBoxSort(const BBoxSort &rhs);
115 };
116 bool operator< (const BBoxSort &a, const BBoxSort &b);
118 } // namespace Dialog
119 } // namespace UI
120 } // namespace Inkscape
122 #endif // INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_H
124 /*
125   Local Variables:
126   mode:c++
127   c-file-style:"stroustrup"
128   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
129   indent-tabs-mode:nil
130   fill-column:99
131   End:
132 */
133 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :