1 /** @file
2 * @brief Transform dialog
3 */
4 /* Author:
5 * Bryce W. Harrington <bryce@bryceharrington.org>
6 *
7 * Copyright (C) 2004, 2005 Authors
8 * Released under GNU GPL. Read the file 'COPYING' for more information.
9 */
11 #ifndef INKSCAPE_UI_DIALOG_TRANSFORMATION_H
12 #define INKSCAPE_UI_DIALOG_TRANSFORMATION_H
16 #include <gtkmm/notebook.h>
17 #include <glibmm/i18n.h>
21 #include "ui/widget/panel.h"
22 #include "ui/widget/notebook-page.h"
23 #include "ui/widget/scalar-unit.h"
24 #include "ui/widget/imageicon.h"
25 #include "ui/widget/button.h"
30 namespace Inkscape {
31 namespace UI {
32 namespace Dialog {
37 class Transformation : public UI::Widget::Panel
38 {
40 public:
42 /**
43 * Create a new transform
44 */
45 Transformation();
47 /**
48 * Cleanup
49 */
50 virtual ~Transformation();
52 /**
53 * Factory method. Create an instance of this class/interface
54 */
55 static Transformation &getInstance()
56 { return *new Transformation(); }
59 /**
60 * Show the Move panel
61 */
62 void setPageMove()
63 { presentPage(PAGE_MOVE); }
66 /**
67 * Show the Scale panel
68 */
69 void setPageScale()
70 { presentPage(PAGE_SCALE); }
73 /**
74 * Show the Rotate panel
75 */
76 void setPageRotate()
77 { presentPage(PAGE_ROTATE); }
79 /**
80 * Show the Skew panel
81 */
82 void setPageSkew()
83 { presentPage(PAGE_SKEW); }
85 /**
86 * Show the Transform panel
87 */
88 void setPageTransform()
89 { presentPage(PAGE_TRANSFORM); }
92 int getCurrentPage()
93 { return _notebook.get_current_page(); }
95 typedef enum {
96 PAGE_MOVE, PAGE_SCALE, PAGE_ROTATE, PAGE_SKEW, PAGE_TRANSFORM, PAGE_QTY
97 } PageType;
99 void updateSelection(PageType page, Inkscape::Selection *selection);
101 protected:
103 Gtk::Notebook _notebook;
105 UI::Widget::NotebookPage _page_move;
106 UI::Widget::NotebookPage _page_scale;
107 UI::Widget::NotebookPage _page_rotate;
108 UI::Widget::NotebookPage _page_skew;
109 UI::Widget::NotebookPage _page_transform;
111 UI::Widget::UnitMenu _units_move;
112 UI::Widget::UnitMenu _units_scale;
113 UI::Widget::UnitMenu _units_rotate;
114 UI::Widget::UnitMenu _units_skew;
116 UI::Widget::ScalarUnit _scalar_move_horizontal;
117 UI::Widget::ScalarUnit _scalar_move_vertical;
118 UI::Widget::ScalarUnit _scalar_scale_horizontal;
119 UI::Widget::ScalarUnit _scalar_scale_vertical;
120 UI::Widget::ScalarUnit _scalar_rotate;
121 UI::Widget::ScalarUnit _scalar_skew_horizontal;
122 UI::Widget::ScalarUnit _scalar_skew_vertical;
124 UI::Widget::Scalar _scalar_transform_a;
125 UI::Widget::Scalar _scalar_transform_b;
126 UI::Widget::Scalar _scalar_transform_c;
127 UI::Widget::Scalar _scalar_transform_d;
128 UI::Widget::Scalar _scalar_transform_e;
129 UI::Widget::Scalar _scalar_transform_f;
131 UI::Widget::CheckButton _check_move_relative;
132 UI::Widget::CheckButton _check_scale_proportional;
133 UI::Widget::CheckButton _check_apply_separately;
134 UI::Widget::CheckButton _check_replace_matrix;
136 /**
137 * Layout the GUI components, and prepare for use
138 */
139 void layoutPageMove();
140 void layoutPageScale();
141 void layoutPageRotate();
142 void layoutPageSkew();
143 void layoutPageTransform();
145 virtual void _apply();
146 void presentPage(PageType page);
147 void onSwitchPage(GtkNotebookPage *page,
148 guint pagenum);
150 /**
151 * Callbacks for when a user changes values on the panels
152 */
153 void onMoveValueChanged();
154 void onMoveRelativeToggled();
155 void onScaleXValueChanged();
156 void onScaleYValueChanged();
157 void onRotateValueChanged();
158 void onSkewValueChanged();
159 void onTransformValueChanged();
160 void onReplaceMatrixToggled();
161 void onScaleProportionalToggled();
163 void onClear();
165 void onApplySeparatelyToggled();
167 /**
168 * Called when the selection is updated, to make
169 * the panel(s) show the new values.
170 * Editor---->dialog
171 */
172 void updatePageMove(Inkscape::Selection *);
173 void updatePageScale(Inkscape::Selection *);
174 void updatePageRotate(Inkscape::Selection *);
175 void updatePageSkew(Inkscape::Selection *);
176 void updatePageTransform(Inkscape::Selection *);
178 /**
179 * Called when the Apply button is pushed
180 * Dialog---->editor
181 */
182 void applyPageMove(Inkscape::Selection *);
183 void applyPageScale(Inkscape::Selection *);
184 void applyPageRotate(Inkscape::Selection *);
185 void applyPageSkew(Inkscape::Selection *);
186 void applyPageTransform(Inkscape::Selection *);
188 private:
190 /**
191 * Copy constructor
192 */
193 Transformation(Transformation const &d);
195 /**
196 * Assignment operator
197 */
198 Transformation operator=(Transformation const &d);
200 Gtk::Button *applyButton;
201 Gtk::Button *resetButton;
202 Gtk::Button *cancelButton;
203 };
208 } // namespace Dialog
209 } // namespace UI
210 } // namespace Inkscape
214 #endif //INKSCAPE_UI_DIALOG_TRANSFORMATION_H
219 /*
220 Local Variables:
221 mode:c++
222 c-file-style:"stroustrup"
223 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
224 indent-tabs-mode:nil
225 fill-column:99
226 End:
227 */
228 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :