1 /**
2 * \brief This class implements the functionality of the window layout, menus,
3 * and signals.
4 *
5 * Authors:
6 * Bryce W. Harrington <bryce@bryceharrington.org>
7 * Derek P. Moore <derekm@hackunix.org>
8 * Ralf Stephan <ralf@ark.in-berlin.de>
9 *
10 * Copyright (C) 2004 Bryce Harrington
11 *
12 * Released under GNU GPL. Read the file 'COPYING' for more information.
13 */
15 #ifndef INKSCAPE_UI_VIEW_EDIT_WIDGET_H
16 #define INKSCAPE_UI_VIEW_EDIT_WIDGET_H
18 #include <gtkmm/box.h>
19 #include <gtkmm/table.h>
20 #include <gtkmm/entry.h>
21 #include <gtkmm/scrollbar.h>
22 #include <gtkmm/actiongroup.h>
23 #include <gtkmm/uimanager.h>
24 #include <gtkmm/togglebutton.h>
26 #include "ui/dialog/dialog-manager.h"
27 #include "ui/view/edit-widget-interface.h"
28 #include "ui/widget/selected-style.h"
29 #include "ui/widget/ruler.h"
30 #include "ui/widget/toolbox.h"
31 #include "ui/widget/svg-canvas.h"
32 #include "ui/widget/zoom-status.h"
33 #include "widgets/layer-selector.h"
35 struct SPDesktop;
36 struct SPDocument;
37 struct SPNamedView;
39 namespace Inkscape {
40 namespace UI {
41 namespace View {
43 class EditWidget : public Gtk::Window,
44 public EditWidgetInterface {
45 public:
46 EditWidget (SPDocument*);
47 ~EditWidget();
49 // Initialization
50 void initActions();
51 void initUIManager();
52 void initLayout();
53 void initEdit (SPDocument*);
54 void destroyEdit();
56 // Actions
57 void onActionFileNew();
58 void onActionFileOpen();
59 void onActionFilePrint();
60 void onActionFileQuit();
61 void onToolbarItem();
62 void onSelectTool();
63 void onNodeTool();
65 // Menus
66 void onMenuItem();
68 void onDialogAbout();
69 void onDialogAlignAndDistribute();
70 void onDialogInkscapePreferences();
71 void onDialogDialog();
72 void onDialogDocumentProperties();
73 void onDialogExport();
74 void onDialogExtensionEditor();
75 void onDialogFillAndStroke();
76 void onDialogFind();
77 void onDialogLayerEditor();
78 void onDialogMessages();
79 void onDialogObjectProperties();
80 void onDialogTextProperties();
81 void onDialogTransform();
82 void onDialogTransformation();
83 void onDialogTrace();
84 void onDialogXmlEditor();
86 // Whiteboard (Inkboard)
87 #ifdef WITH_INKBOARD
88 void onDialogWhiteboardConnect();
89 void onDialogWhiteboardShareWithUser();
90 void onDialogWhiteboardShareWithChat();
91 void onDialogOpenSessionFile();
92 void onDumpXMLTracker();
93 #endif
95 void onUriChanged();
97 // from EditWidgetInterface
98 virtual void *getWindow();
99 virtual void setTitle (gchar const*);
100 virtual void layout();
101 virtual void present();
102 virtual void getGeometry (gint &x, gint &y, gint &w, gint &h);
103 virtual void setSize (gint w, gint h);
104 virtual void setPosition (NR::Point p);
105 virtual void setTransient (void*, int);
106 virtual NR::Point getPointer();
107 virtual void setFullscreen();
108 virtual bool shutdown();
109 virtual void destroy();
110 virtual void requestCanvasUpdate();
111 virtual void activateDesktop();
112 virtual void deactivateDesktop();
113 virtual void viewSetPosition (NR::Point p);
114 virtual void updateRulers();
115 virtual void updateScrollbars (double scale);
116 virtual void toggleRulers();
117 virtual void toggleScrollbars();
118 virtual void updateZoom();
119 virtual void letZoomGrabFocus();
120 virtual void setToolboxFocusTo (const gchar *);
121 virtual void setToolboxAdjustmentValue (const gchar *, double);
122 virtual bool isToolboxButtonActive (gchar const*);
123 virtual void setCoordinateStatus (NR::Point p);
124 virtual void setMessage (Inkscape::MessageType type, gchar const* msg);
125 virtual bool warnDialog (gchar*);
127 protected:
128 friend void _namedview_modified (SPNamedView*, guint, EditWidget*);
130 Gtk::Tooltips _tooltips;
132 // Child widgets:
133 Gtk::Table _main_window_table;
134 Gtk::VBox _toolbars_vbox;
135 Gtk::HBox _sub_window_hbox;
136 Gtk::Table _viewport_table;
138 UI::Widget::Toolbox *_tool_ctrl;
139 Gtk::Toolbar *_select_ctrl;
140 Gtk::Toolbar *_uri_ctrl;
141 Gtk::Label _uri_label;
142 Gtk::Entry _uri_entry;
143 Gtk::Toolbar *_node_ctrl;
145 UI::Widget::HRuler _top_ruler;
146 UI::Widget::VRuler _left_ruler;
147 Gtk::HScrollbar _bottom_scrollbar;
148 Gtk::VScrollbar _right_scrollbar;
149 Gtk::ToggleButton _sticky_zoom;
150 UI::Widget::SVGCanvas _svg_canvas;
151 Gtk::HBox _statusbar;
152 UI::Widget::SelectedStyle _selected_style_status;
153 UI::Widget::ZoomStatus _zoom_status;
154 Inkscape::Widgets::LayerSelector _layer_selector;
155 Gtk::EventBox _coord_eventbox;
156 Gtk::Table _coord_status;
157 Gtk::Label _coord_status_x, _coord_status_y;
158 Gtk::Label _select_status;
160 SPDesktop* _desktop;
161 SPNamedView* _namedview;
162 double _dt2r;
164 Glib::RefPtr<Gtk::ActionGroup> _act_grp;
165 Glib::RefPtr<Gtk::UIManager> _ui_mgr;
166 UI::Dialog::DialogManager _dlg_mgr;
168 void initMenuActions();
169 void initToolbarActions();
170 void initAccelMap();
171 void initMenuBar();
172 void initCommandsBar();
173 void initToolControlsBar();
174 void initUriBar();
175 void initToolsBar();
176 void initBottomScrollbar();
177 void initRightScrollbar();
178 void initLeftRuler();
179 void initTopRuler();
180 void initStickyZoom();
181 void initStatusbar();
183 virtual bool on_key_press_event (GdkEventKey*);
184 virtual bool on_delete_event (GdkEventAny*);
185 virtual bool on_focus_in_event (GdkEventFocus*);
187 private:
188 bool onEntryFocusIn (GdkEventFocus*);
189 bool onEntryFocusOut (GdkEventFocus*);
190 void onWindowSizeAllocate (Gtk::Allocation&);
191 void onWindowRealize();
192 void onAdjValueChanged();
194 bool _update_s_f, _update_a_f;
195 };
196 } // namespace View
197 } // namespace UI
198 } // namespace Inkscape
200 #endif // INKSCAPE_UI_VIEW_EDIT_WIDGET_H
202 /*
203 Local Variables:
204 mode:c++
205 c-file-style:"stroustrup"
206 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
207 indent-tabs-mode:nil
208 fill-column:99
209 End:
210 */
211 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :