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 "dialog.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 Dialog
42 {
44 public:
46 /**
47 * Create a new transform
48 */
49 Transformation(Behavior::BehaviorFactory behavior_factory);
51 /**
52 * Cleanup
53 */
54 virtual ~Transformation();
57 /**
58 * Factory method. Create an instance of this class/interface
59 */
60 static Transformation *create(Behavior::BehaviorFactory behavior_factory)
61 { return new Transformation(behavior_factory); }
64 /**
65 * Show the Move panel
66 */
67 void setPageMove()
68 { presentPage(PAGE_MOVE); }
71 /**
72 * Show the Scale panel
73 */
74 void setPageScale()
75 { presentPage(PAGE_SCALE); }
78 /**
79 * Show the Rotate panel
80 */
81 void setPageRotate()
82 { presentPage(PAGE_ROTATE); }
84 /**
85 * Show the Skew panel
86 */
87 void setPageSkew()
88 { presentPage(PAGE_SKEW); }
90 /**
91 * Show the Transform panel
92 */
93 void setPageTransform()
94 { presentPage(PAGE_TRANSFORM); }
97 int getCurrentPage()
98 { return _notebook.get_current_page(); }
100 typedef enum {
101 PAGE_MOVE, PAGE_SCALE, PAGE_ROTATE, PAGE_SKEW, PAGE_TRANSFORM, PAGE_QTY
102 } PageType;
104 void updateSelection(PageType page, Inkscape::Selection *selection);
106 protected:
108 Gtk::Notebook _notebook;
110 NotebookPage _page_move;
111 NotebookPage _page_scale;
112 NotebookPage _page_rotate;
113 NotebookPage _page_skew;
114 NotebookPage _page_transform;
116 UnitMenu _units_move;
117 UnitMenu _units_scale;
118 UnitMenu _units_rotate;
119 UnitMenu _units_skew;
121 ScalarUnit _scalar_move_horizontal;
122 ScalarUnit _scalar_move_vertical;
123 ScalarUnit _scalar_scale_horizontal;
124 ScalarUnit _scalar_scale_vertical;
125 ScalarUnit _scalar_rotate;
126 ScalarUnit _scalar_skew_horizontal;
127 ScalarUnit _scalar_skew_vertical;
129 Scalar _scalar_transform_a;
130 Scalar _scalar_transform_b;
131 Scalar _scalar_transform_c;
132 Scalar _scalar_transform_d;
133 Scalar _scalar_transform_e;
134 Scalar _scalar_transform_f;
136 CheckButton _check_move_relative;
137 CheckButton _check_scale_proportional;
138 CheckButton _check_apply_separately;
139 CheckButton _check_replace_matrix;
141 /**
142 * Layout the GUI components, and prepare for use
143 */
144 void layoutPageMove();
145 void layoutPageScale();
146 void layoutPageRotate();
147 void layoutPageSkew();
148 void layoutPageTransform();
150 virtual void _apply();
151 void presentPage(PageType page);
153 void onSelectionChanged(Inkscape::NSApplication::Application *inkscape,
154 Inkscape::Selection *selection);
155 void onSelectionModified(Inkscape::NSApplication::Application *inkscape,
156 Inkscape::Selection *selection,
157 int unsigned flags);
158 void onSwitchPage(GtkNotebookPage *page,
159 guint pagenum);
161 /**
162 * Callbacks for when a user changes values on the panels
163 */
164 void onMoveValueChanged();
165 void onMoveRelativeToggled();
166 void onScaleXValueChanged();
167 void onScaleYValueChanged();
168 void onRotateValueChanged();
169 void onSkewValueChanged();
170 void onTransformValueChanged();
171 void onReplaceMatrixToggled();
172 void onScaleProportionalToggled();
174 void onClear();
176 void onApplySeparatelyToggled();
178 /**
179 * Called when the selection is updated, to make
180 * the panel(s) show the new values.
181 * Editor---->dialog
182 */
183 void updatePageMove(Inkscape::Selection *);
184 void updatePageScale(Inkscape::Selection *);
185 void updatePageRotate(Inkscape::Selection *);
186 void updatePageSkew(Inkscape::Selection *);
187 void updatePageTransform(Inkscape::Selection *);
189 /**
190 * Called when the Apply button is pushed
191 * Dialog---->editor
192 */
193 void applyPageMove(Inkscape::Selection *);
194 void applyPageScale(Inkscape::Selection *);
195 void applyPageRotate(Inkscape::Selection *);
196 void applyPageSkew(Inkscape::Selection *);
197 void applyPageTransform(Inkscape::Selection *);
199 private:
201 /**
202 * Copy constructor
203 */
204 Transformation(Transformation const &d);
206 /**
207 * Assignment operator
208 */
209 Transformation operator=(Transformation const &d);
211 Gtk::Button *applyButton;
212 Gtk::Button *resetButton;
213 Gtk::Button *cancelButton;
214 };
219 } // namespace Dialog
220 } // namespace UI
221 } // namespace Inkscape
225 #endif //INKSCAPE_UI_DIALOG_TRANSFORMATION_H
230 /*
231 Local Variables:
232 mode:c++
233 c-file-style:"stroustrup"
234 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
235 indent-tabs-mode:nil
236 fill-column:99
237 End:
238 */
239 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :