Code

Merge from fe-moved
[inkscape.git] / src / ui / dialog / align-and-distribute.h
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"
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     Geom::OptRect randomize_bbox;
70 protected:
72     void on_ref_change();
73     void on_selgrp_toggled();
74     void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
75                                       guint row, guint col, bool onInterSpace, 
76                                       Geom::Dim2 orientation, float kBegin, float kEnd);
77     void addAlignButton(const Glib::ustring &id, const Glib::ustring tiptext, 
78                         guint row, guint col);
79     void addNodeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
80                         guint col, Geom::Dim2 orientation, bool distribute);
81     void addRemoveOverlapsButton(const Glib::ustring &id,
82                         const Glib::ustring tiptext,
83                         guint row, guint col);
84     void addGraphLayoutButton(const Glib::ustring &id,
85                         const Glib::ustring tiptext,
86                         guint row, guint col);
87     void addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext, 
88                         guint row, guint col);
89     void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
90                         guint row, guint col);
91     void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
92                            guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
94     std::list<Action *> _actionList;
95     Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
96     Gtk::Table _alignTable, _distributeTable, _removeOverlapTable, _graphLayoutTable, _nodesTable;
97     Gtk::HBox _anchorBox;
98     Gtk::HBox _selgrpBox;
99     Gtk::VBox _alignBox;
100     Gtk::Label _anchorLabel;
101     Gtk::Label _selgrpLabel;
102     Gtk::CheckButton _selgrp;
103     Gtk::ComboBoxText _combo;
104     Gtk::Tooltips _tooltips;
106 private:
107     AlignAndDistribute(AlignAndDistribute const &d);
108     AlignAndDistribute& operator=(AlignAndDistribute const &d);
109 };
112 struct BBoxSort
114     SPItem *item;
115     float anchor;
116     Geom::Rect bbox;
117     BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
118     BBoxSort(const BBoxSort &rhs);
119 };
120 bool operator< (const BBoxSort &a, const BBoxSort &b);
122 } // namespace Dialog
123 } // namespace UI
124 } // namespace Inkscape
126 #endif // INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_H
128 /*
129   Local Variables:
130   mode:c++
131   c-file-style:"stroustrup"
132   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
133   indent-tabs-mode:nil
134   fill-column:99
135   End:
136 */
137 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :