Code

updated spanish.nsh and inkscape.nsi to reflect latest file-changes
[inkscape.git] / trunk / src / ui / dialog / transformation.h
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"
29 using namespace Inkscape::UI::Widget;
33 namespace Inkscape {
34 namespace UI {
35 namespace Dialog {
40 class Transformation : public UI::Widget::Panel
41 {
43 public:
45     /**
46      * Create a new transform
47      */
48     Transformation();
50     /**
51      * Cleanup
52      */
53     virtual ~Transformation();
55     /**
56      * Factory method.  Create an instance of this class/interface
57      */
58     static Transformation &getInstance()
59         { return *new Transformation(); }
62     /**
63      * Show the Move panel
64      */
65     void setPageMove()
66         { presentPage(PAGE_MOVE);      }
69     /**
70      * Show the Scale panel
71      */
72     void setPageScale()
73         { presentPage(PAGE_SCALE);     }
76     /**
77      * Show the Rotate panel
78      */
79     void setPageRotate()
80         { presentPage(PAGE_ROTATE);    }
82     /**
83      * Show the Skew panel
84      */
85     void setPageSkew()
86         { presentPage(PAGE_SKEW);      }
88     /**
89      * Show the Transform panel
90      */
91     void setPageTransform()
92         { presentPage(PAGE_TRANSFORM); }
95     int getCurrentPage()
96         { return _notebook.get_current_page(); }
98     typedef enum {
99         PAGE_MOVE, PAGE_SCALE, PAGE_ROTATE, PAGE_SKEW, PAGE_TRANSFORM, PAGE_QTY
100     } PageType;
102     void updateSelection(PageType page, Inkscape::Selection *selection);
104 protected:
106     Gtk::Notebook     _notebook;
108     NotebookPage      _page_move;
109     NotebookPage      _page_scale;
110     NotebookPage      _page_rotate;
111     NotebookPage      _page_skew;
112     NotebookPage      _page_transform;
114     UnitMenu          _units_move;
115     UnitMenu          _units_scale;
116     UnitMenu          _units_rotate;
117     UnitMenu          _units_skew;
119     ScalarUnit        _scalar_move_horizontal;
120     ScalarUnit        _scalar_move_vertical;
121     ScalarUnit        _scalar_scale_horizontal;
122     ScalarUnit        _scalar_scale_vertical;
123     ScalarUnit        _scalar_rotate;
124     ScalarUnit        _scalar_skew_horizontal;
125     ScalarUnit        _scalar_skew_vertical;
127     Scalar            _scalar_transform_a;
128     Scalar            _scalar_transform_b;
129     Scalar            _scalar_transform_c;
130     Scalar            _scalar_transform_d;
131     Scalar            _scalar_transform_e;
132     Scalar            _scalar_transform_f;
134     CheckButton  _check_move_relative;
135     CheckButton  _check_scale_proportional;
136     CheckButton  _check_apply_separately;
137     CheckButton  _check_replace_matrix;
139     /**
140      * Layout the GUI components, and prepare for use
141      */
142     void layoutPageMove();
143     void layoutPageScale();
144     void layoutPageRotate();
145     void layoutPageSkew();
146     void layoutPageTransform();
148     virtual void _apply();
149     void presentPage(PageType page);
151     void onSelectionChanged(Inkscape::NSApplication::Application *inkscape,
152                             Inkscape::Selection *selection);
153     void onSelectionModified(Inkscape::NSApplication::Application *inkscape,
154                              Inkscape::Selection *selection,
155                              int unsigned flags);
156     void onSwitchPage(GtkNotebookPage *page,
157                     guint pagenum);
159     /**
160      * Callbacks for when a user changes values on the panels
161      */
162     void onMoveValueChanged();
163     void onMoveRelativeToggled();
164     void onScaleXValueChanged();
165     void onScaleYValueChanged();
166     void onRotateValueChanged();
167     void onSkewValueChanged();
168     void onTransformValueChanged();
169     void onReplaceMatrixToggled();
170     void onScaleProportionalToggled();
172     void onClear();
174     void onApplySeparatelyToggled();
176     /**
177      * Called when the selection is updated, to make
178      * the panel(s) show the new values.
179      * Editor---->dialog
180      */
181     void updatePageMove(Inkscape::Selection *);
182     void updatePageScale(Inkscape::Selection *);
183     void updatePageRotate(Inkscape::Selection *);
184     void updatePageSkew(Inkscape::Selection *);
185     void updatePageTransform(Inkscape::Selection *);
187     /**
188      * Called when the Apply button is pushed
189      * Dialog---->editor
190      */
191     void applyPageMove(Inkscape::Selection *);
192     void applyPageScale(Inkscape::Selection *);
193     void applyPageRotate(Inkscape::Selection *);
194     void applyPageSkew(Inkscape::Selection *);
195     void applyPageTransform(Inkscape::Selection *);
197 private:
199     /**
200      * Copy constructor
201      */
202     Transformation(Transformation const &d);
204     /**
205      * Assignment operator
206      */
207     Transformation operator=(Transformation const &d);
209     Gtk::Button *applyButton;
210     Gtk::Button *resetButton;
211     Gtk::Button *cancelButton;
212 };
217 } // namespace Dialog
218 } // namespace UI
219 } // namespace Inkscape
223 #endif //INKSCAPE_UI_DIALOG_TRANSFORMATION_H
228 /*
229   Local Variables:
230   mode:c++
231   c-file-style:"stroustrup"
232   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
233   indent-tabs-mode:nil
234   fill-column:99
235   End:
236 */
237 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :