Code

Merging from trunk
[inkscape.git] / src / ui / dialog / transformation.h
1 /**
2  * \brief Object Transformation dialog
3  *
4  * Author:
5  *   Bryce W. Harrington <bryce@bryceharrington.org>
6  *
7  * Copyright (C) 2004, 2005 Authors
8  *
9  * Released under GNU GPL.  Read the file 'COPYING' for more information.
10  */
12 #ifndef INKSCAPE_UI_DIALOG_TRANSFORMATION_H
13 #define INKSCAPE_UI_DIALOG_TRANSFORMATION_H
17 #include <gtkmm/notebook.h>
18 #include <glibmm/i18n.h>
22 #include "ui/widget/panel.h"
23 #include "application/application.h"
24 #include "ui/widget/notebook-page.h"
25 #include "ui/widget/scalar-unit.h"
26 #include "ui/widget/imageicon.h"
27 #include "ui/widget/button.h"
30 using namespace Inkscape::UI::Widget;
34 namespace Inkscape {
35 namespace UI {
36 namespace Dialog {
41 class Transformation : public UI::Widget::Panel
42 {
44 public:
46     /**
47      * Create a new transform
48      */
49     Transformation();
51     /**
52      * Cleanup
53      */
54     virtual ~Transformation();
56     /**
57      * Factory method.  Create an instance of this class/interface
58      */
59     static Transformation &getInstance()
60         { return *new Transformation(); }
63     /**
64      * Show the Move panel
65      */
66     void setPageMove()
67         { presentPage(PAGE_MOVE);      }
70     /**
71      * Show the Scale panel
72      */
73     void setPageScale()
74         { presentPage(PAGE_SCALE);     }
77     /**
78      * Show the Rotate panel
79      */
80     void setPageRotate()
81         { presentPage(PAGE_ROTATE);    }
83     /**
84      * Show the Skew panel
85      */
86     void setPageSkew()
87         { presentPage(PAGE_SKEW);      }
89     /**
90      * Show the Transform panel
91      */
92     void setPageTransform()
93         { presentPage(PAGE_TRANSFORM); }
96     int getCurrentPage()
97         { return _notebook.get_current_page(); }
99     typedef enum {
100         PAGE_MOVE, PAGE_SCALE, PAGE_ROTATE, PAGE_SKEW, PAGE_TRANSFORM, PAGE_QTY
101     } PageType;
103     void updateSelection(PageType page, Inkscape::Selection *selection);
105 protected:
107     Gtk::Notebook     _notebook;
109     NotebookPage      _page_move;
110     NotebookPage      _page_scale;
111     NotebookPage      _page_rotate;
112     NotebookPage      _page_skew;
113     NotebookPage      _page_transform;
115     UnitMenu          _units_move;
116     UnitMenu          _units_scale;
117     UnitMenu          _units_rotate;
118     UnitMenu          _units_skew;
120     ScalarUnit        _scalar_move_horizontal;
121     ScalarUnit        _scalar_move_vertical;
122     ScalarUnit        _scalar_scale_horizontal;
123     ScalarUnit        _scalar_scale_vertical;
124     ScalarUnit        _scalar_rotate;
125     ScalarUnit        _scalar_skew_horizontal;
126     ScalarUnit        _scalar_skew_vertical;
128     Scalar            _scalar_transform_a;
129     Scalar            _scalar_transform_b;
130     Scalar            _scalar_transform_c;
131     Scalar            _scalar_transform_d;
132     Scalar            _scalar_transform_e;
133     Scalar            _scalar_transform_f;
135     CheckButton  _check_move_relative;
136     CheckButton  _check_scale_proportional;
137     CheckButton  _check_apply_separately;
138     CheckButton  _check_replace_matrix;
140     /**
141      * Layout the GUI components, and prepare for use
142      */
143     void layoutPageMove();
144     void layoutPageScale();
145     void layoutPageRotate();
146     void layoutPageSkew();
147     void layoutPageTransform();
149     virtual void _apply();
150     void presentPage(PageType page);
152     void onSelectionChanged(Inkscape::NSApplication::Application *inkscape,
153                             Inkscape::Selection *selection);
154     void onSelectionModified(Inkscape::NSApplication::Application *inkscape,
155                              Inkscape::Selection *selection,
156                              int unsigned flags);
157     void onSwitchPage(GtkNotebookPage *page,
158                     guint pagenum);
160     /**
161      * Callbacks for when a user changes values on the panels
162      */
163     void onMoveValueChanged();
164     void onMoveRelativeToggled();
165     void onScaleXValueChanged();
166     void onScaleYValueChanged();
167     void onRotateValueChanged();
168     void onSkewValueChanged();
169     void onTransformValueChanged();
170     void onReplaceMatrixToggled();
171     void onScaleProportionalToggled();
173     void onClear();
175     void onApplySeparatelyToggled();
177     /**
178      * Called when the selection is updated, to make
179      * the panel(s) show the new values.
180      * Editor---->dialog
181      */
182     void updatePageMove(Inkscape::Selection *);
183     void updatePageScale(Inkscape::Selection *);
184     void updatePageRotate(Inkscape::Selection *);
185     void updatePageSkew(Inkscape::Selection *);
186     void updatePageTransform(Inkscape::Selection *);
188     /**
189      * Called when the Apply button is pushed
190      * Dialog---->editor
191      */
192     void applyPageMove(Inkscape::Selection *);
193     void applyPageScale(Inkscape::Selection *);
194     void applyPageRotate(Inkscape::Selection *);
195     void applyPageSkew(Inkscape::Selection *);
196     void applyPageTransform(Inkscape::Selection *);
198 private:
200     /**
201      * Copy constructor
202      */
203     Transformation(Transformation const &d);
205     /**
206      * Assignment operator
207      */
208     Transformation operator=(Transformation const &d);
210     Gtk::Button *applyButton;
211     Gtk::Button *resetButton;
212     Gtk::Button *cancelButton;
213 };
218 } // namespace Dialog
219 } // namespace UI
220 } // namespace Inkscape
224 #endif //INKSCAPE_UI_DIALOG_TRANSFORMATION_H
229 /*
230   Local Variables:
231   mode:c++
232   c-file-style:"stroustrup"
233   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
234   indent-tabs-mode:nil
235   fill-column:99
236   End:
237 */
238 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :