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 "application/application.h"
23 #include "ui/widget/notebook-page.h"
24 #include "ui/widget/scalar-unit.h"
25 #include "ui/widget/imageicon.h"
26 #include "ui/widget/button.h"
31 namespace Inkscape {
32 namespace UI {
33 namespace Dialog {
38 class Transformation : public UI::Widget::Panel
39 {
41 public:
43 /**
44 * Create a new transform
45 */
46 Transformation();
48 /**
49 * Cleanup
50 */
51 virtual ~Transformation();
53 /**
54 * Factory method. Create an instance of this class/interface
55 */
56 static Transformation &getInstance()
57 { return *new Transformation(); }
60 /**
61 * Show the Move panel
62 */
63 void setPageMove()
64 { presentPage(PAGE_MOVE); }
67 /**
68 * Show the Scale panel
69 */
70 void setPageScale()
71 { presentPage(PAGE_SCALE); }
74 /**
75 * Show the Rotate panel
76 */
77 void setPageRotate()
78 { presentPage(PAGE_ROTATE); }
80 /**
81 * Show the Skew panel
82 */
83 void setPageSkew()
84 { presentPage(PAGE_SKEW); }
86 /**
87 * Show the Transform panel
88 */
89 void setPageTransform()
90 { presentPage(PAGE_TRANSFORM); }
93 int getCurrentPage()
94 { return _notebook.get_current_page(); }
96 typedef enum {
97 PAGE_MOVE, PAGE_SCALE, PAGE_ROTATE, PAGE_SKEW, PAGE_TRANSFORM, PAGE_QTY
98 } PageType;
100 void updateSelection(PageType page, Inkscape::Selection *selection);
102 protected:
104 Gtk::Notebook _notebook;
106 UI::Widget::NotebookPage _page_move;
107 UI::Widget::NotebookPage _page_scale;
108 UI::Widget::NotebookPage _page_rotate;
109 UI::Widget::NotebookPage _page_skew;
110 UI::Widget::NotebookPage _page_transform;
112 UI::Widget::UnitMenu _units_move;
113 UI::Widget::UnitMenu _units_scale;
114 UI::Widget::UnitMenu _units_rotate;
115 UI::Widget::UnitMenu _units_skew;
117 UI::Widget::ScalarUnit _scalar_move_horizontal;
118 UI::Widget::ScalarUnit _scalar_move_vertical;
119 UI::Widget::ScalarUnit _scalar_scale_horizontal;
120 UI::Widget::ScalarUnit _scalar_scale_vertical;
121 UI::Widget::ScalarUnit _scalar_rotate;
122 UI::Widget::ScalarUnit _scalar_skew_horizontal;
123 UI::Widget::ScalarUnit _scalar_skew_vertical;
125 UI::Widget::Scalar _scalar_transform_a;
126 UI::Widget::Scalar _scalar_transform_b;
127 UI::Widget::Scalar _scalar_transform_c;
128 UI::Widget::Scalar _scalar_transform_d;
129 UI::Widget::Scalar _scalar_transform_e;
130 UI::Widget::Scalar _scalar_transform_f;
132 UI::Widget::CheckButton _check_move_relative;
133 UI::Widget::CheckButton _check_scale_proportional;
134 UI::Widget::CheckButton _check_apply_separately;
135 UI::Widget::CheckButton _check_replace_matrix;
137 /**
138 * Layout the GUI components, and prepare for use
139 */
140 void layoutPageMove();
141 void layoutPageScale();
142 void layoutPageRotate();
143 void layoutPageSkew();
144 void layoutPageTransform();
146 virtual void _apply();
147 void presentPage(PageType page);
149 void onSelectionChanged(Inkscape::NSApplication::Application *inkscape,
150 Inkscape::Selection *selection);
151 void onSelectionModified(Inkscape::NSApplication::Application *inkscape,
152 Inkscape::Selection *selection,
153 int unsigned flags);
154 void onSwitchPage(GtkNotebookPage *page,
155 guint pagenum);
157 /**
158 * Callbacks for when a user changes values on the panels
159 */
160 void onMoveValueChanged();
161 void onMoveRelativeToggled();
162 void onScaleXValueChanged();
163 void onScaleYValueChanged();
164 void onRotateValueChanged();
165 void onSkewValueChanged();
166 void onTransformValueChanged();
167 void onReplaceMatrixToggled();
168 void onScaleProportionalToggled();
170 void onClear();
172 void onApplySeparatelyToggled();
174 /**
175 * Called when the selection is updated, to make
176 * the panel(s) show the new values.
177 * Editor---->dialog
178 */
179 void updatePageMove(Inkscape::Selection *);
180 void updatePageScale(Inkscape::Selection *);
181 void updatePageRotate(Inkscape::Selection *);
182 void updatePageSkew(Inkscape::Selection *);
183 void updatePageTransform(Inkscape::Selection *);
185 /**
186 * Called when the Apply button is pushed
187 * Dialog---->editor
188 */
189 void applyPageMove(Inkscape::Selection *);
190 void applyPageScale(Inkscape::Selection *);
191 void applyPageRotate(Inkscape::Selection *);
192 void applyPageSkew(Inkscape::Selection *);
193 void applyPageTransform(Inkscape::Selection *);
195 private:
197 /**
198 * Copy constructor
199 */
200 Transformation(Transformation const &d);
202 /**
203 * Assignment operator
204 */
205 Transformation operator=(Transformation const &d);
207 Gtk::Button *applyButton;
208 Gtk::Button *resetButton;
209 Gtk::Button *cancelButton;
210 };
215 } // namespace Dialog
216 } // namespace UI
217 } // namespace Inkscape
221 #endif //INKSCAPE_UI_DIALOG_TRANSFORMATION_H
226 /*
227 Local Variables:
228 mode:c++
229 c-file-style:"stroustrup"
230 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
231 indent-tabs-mode:nil
232 fill-column:99
233 End:
234 */
235 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :