10
10
* bulia byak <buliabyak@users.sf.net>
11
11
* Ralf Stephan <ralf@ark.in-berlin.de>
12
12
* John Bintz <jcoswell@coswellproductions.org>
13
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
15
* Copyright (C) 2007 Johan Engelen
14
16
* Copyright (C) 2006 John Bintz
15
17
* Copyright (C) 1999-2005 authors
16
18
* Copyright (C) 2000-2001 Ximian, Inc.
23
25
#include "config.h"
28
#include <gdk/gdkevents.h>
26
29
#include <gtk/gtktypeutils.h>
27
30
#include <sigc++/sigc++.h>
28
32
#include "libnr/nr-matrix.h"
29
33
#include "libnr/nr-matrix-fns.h"
30
34
#include "libnr/nr-rect.h"
95
108
GList *zooms_future;
96
109
unsigned int dkey;
97
110
unsigned int number;
99
112
unsigned int interaction_disabled_counter;
101
115
/// \todo fixme: This has to be implemented in different way */
102
116
guint guides_active : 1;
104
// storage for selected dragger used by GrDrag as it's
118
// storage for selected dragger used by GrDrag as it's
105
119
// created and deleted by tools
108
bool gr_fill_or_stroke;
123
bool gr_fill_or_stroke;
110
126
Inkscape::ObjectHierarchy *_layer_hierarchy;
111
127
gchar * _reconstruction_old_layer_id;
119
135
return _document_replaced_signal.connect (slot);
122
sigc::connection connectEventContextChanged (const sigc::slot<void,SPDesktop*,SPEventContext*> & slot)
138
sigc::connection connectEventContextChanged (const sigc::slot<void,SPDesktop*,SPEventContext*> & slot)
124
140
return _event_context_changed_signal.connect (slot);
126
sigc::connection connectSetStyle (const sigc::slot<bool, const SPCSSAttr *> & slot)
142
sigc::connection connectSetStyle (const sigc::slot<bool, const SPCSSAttr *> & slot)
128
return _set_style_signal.connect (slot);
144
return _set_style_signal.connect (slot);
130
sigc::connection connectQueryStyle (const sigc::slot<int, SPStyle *, int> & slot)
146
sigc::connection connectQueryStyle (const sigc::slot<int, SPStyle *, int> & slot)
132
return _query_style_signal.connect (slot);
148
return _query_style_signal.connect (slot);
134
150
// subselection is some sort of selection which is specific to the tool, such as a handle in gradient tool, or a text selection
135
151
sigc::connection connectToolSubselectionChanged(const sigc::slot<void, gpointer> & slot) {
136
return _tool_subselection_changed.connect(slot);
152
return _tool_subselection_changed.connect(slot);
138
void emitToolSubselectionChanged(gpointer data);
154
void emitToolSubselectionChanged(gpointer data);
139
155
sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPObject *> & slot) {
140
return _layer_changed_signal.connect(slot);
156
return _layer_changed_signal.connect(slot);
143
// Whiteboard changes
159
// Whiteboard changes
145
161
#ifdef WITH_INKBOARD
146
Inkscape::Whiteboard::SessionManager* whiteboard_session_manager() {
147
return _whiteboard_session_manager;
162
Inkscape::Whiteboard::SessionManager* whiteboard_session_manager() {
163
return _whiteboard_session_manager;
150
Inkscape::Whiteboard::SessionManager* _whiteboard_session_manager;
166
Inkscape::Whiteboard::SessionManager* _whiteboard_session_manager;
154
170
void init (SPNamedView* nv, SPCanvas* canvas);
171
virtual ~SPDesktop();
158
174
Inkscape::MessageContext *guidesMessageContext() const {
159
return _guides_message_context;
175
return _guides_message_context;
162
178
void setDisplayModeNormal();
166
182
int getMode() const { return displayMode; }
184
Inkscape::UI::Widget::Dock* getDock() { return _widget->getDock(); }
168
186
void set_active (bool new_active);
169
187
SPObject *currentRoot() const;
170
188
SPObject *currentLayer() const;
173
191
bool isLayer(SPObject *object) const;
174
192
bool isWithinViewport(SPItem *item) const;
175
193
bool itemIsHidden(SPItem const *item) const;
177
195
void activate_guides (bool activate);
178
196
void change_document (SPDocument *document);
210
228
void next_zoom();
212
230
bool scroll_to_point (NR::Point const *s_dt, gdouble autoscrollspeed = 0);
213
void scroll_world (double dx, double dy);
214
void scroll_world (NR::Point const scroll)
231
void scroll_world (double dx, double dy, bool is_scrolling = false);
232
void scroll_world (NR::Point const scroll, bool is_scrolling = false)
218
scroll_world(scroll[X], scroll[Y]);
236
scroll_world(scroll[X], scroll[Y], is_scrolling);
221
239
void getWindowGeometry (gint &x, gint &y, gint &w, gint &h);
222
240
void setWindowPosition (NR::Point p);
223
241
void setWindowSize (gint w, gint h);
224
242
void setWindowTransient (void* p, int transient_policy=1);
243
Gtk::Window* getToplevel();
225
244
void presentWindow();
226
245
bool warnDialog (gchar *text);
227
246
void toggleRulers();
230
249
void destroyWidget();
231
250
void setToolboxFocusTo (gchar const* label);
232
251
void setToolboxAdjustmentValue (gchar const* id, double val);
252
void setToolboxSelectOneValue (gchar const* id, gint val);
233
253
bool isToolboxButtonActive (gchar const *id);
234
254
void updateNow();
235
255
void updateCanvasNow();
237
257
void enableInteraction();
238
258
void disableInteraction();
260
void setWaitingCursor();
261
void clearWaitingCursor();
263
void toggleColorProfAdjust();
266
void toggleSnapping();
267
bool gridsEnabled() { return grids_visible; }
268
void showGrids(bool show, bool dirty_document = true);
272
bool is_fullscreen();
240
276
void fullscreen();
242
278
void registerEditWidget (Inkscape::UI::View::EditWidgetInterface *widget)
243
279
{ _widget = widget; }
245
NR::Matrix w2d() const;
281
NR::Matrix w2d() const; //transformation from window to desktop coordinates (used for zooming)
246
282
NR::Point w2d(NR::Point const &p) const;
247
283
NR::Point d2w(NR::Point const &p) const;
248
284
NR::Matrix doc2dt() const;
254
290
virtual void mouseover() {}
255
291
virtual void mouseout() {}
293
virtual bool onDeleteUI (GdkEventAny*);
294
virtual bool onWindowStateEvent (GdkEventWindowState* event);
258
297
Inkscape::UI::View::EditWidgetInterface *_widget;
259
298
Inkscape::Application *_inkscape;
264
303
NR::Matrix _doc2dt;
305
bool grids_visible; /* don't set this variable directly, use the method below */
306
void set_grids_visible(bool visible);
266
308
void push_current_zoom (GList**);
268
310
sigc::signal<void,SPDesktop*,SPDocument*> _document_replaced_signal;
270
312
sigc::signal<void> _deactivate_signal;
271
313
sigc::signal<void,SPDesktop*,SPEventContext*> _event_context_changed_signal;
272
314
sigc::signal<void, gpointer> _tool_subselection_changed;
274
316
sigc::connection _activate_connection;
275
317
sigc::connection _deactivate_connection;
276
318
sigc::connection _sel_modified_connection;
279
321
sigc::connection _reconstruction_finish_connection;
280
322
sigc::connection _commit_connection;
281
323
sigc::connection _modified_connection;
283
325
virtual void onPositionSet (double, double);
284
326
virtual void onResized (double, double);
285
327
virtual void onRedrawRequested();