Code

This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp...
[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"
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 &removeOverlap_table(){return _removeOverlapTable;}
59     Gtk::Table &graphLayout_table(){return _graphLayoutTable;}
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 addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext, 
86                         guint row, guint col);
87     void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
88                         guint row, guint col);
89     void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
90                            guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
92     std::list<Action *> _actionList;
93     Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
94     Gtk::Table _alignTable, _distributeTable, _removeOverlapTable, _graphLayoutTable, _nodesTable;
95     Gtk::HBox _anchorBox;
96     Gtk::HBox _selgrpBox;
97     Gtk::VBox _alignBox;
98     Gtk::Label _anchorLabel;
99     Gtk::Label _selgrpLabel;
100     Gtk::CheckButton _selgrp;
101     Gtk::ComboBoxText _combo;
102     Gtk::Tooltips _tooltips;
104 private:
105     AlignAndDistribute(AlignAndDistribute const &d);
106     AlignAndDistribute& operator=(AlignAndDistribute const &d);
107 };
110 struct BBoxSort
112     SPItem *item;
113     float anchor;
114     Geom::Rect bbox;
115     BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
116     BBoxSort(const BBoxSort &rhs);
117 };
118 bool operator< (const BBoxSort &a, const BBoxSort &b);
120 } // namespace Dialog
121 } // namespace UI
122 } // namespace Inkscape
124 #endif // INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_H
126 /*
127   Local Variables:
128   mode:c++
129   c-file-style:"stroustrup"
130   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
131   indent-tabs-mode:nil
132   fill-column:99
133   End:
134 */
135 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :