summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-07-30 21:17:21 +0000
committerMarkus Engel <markus.engel@tum.de>2013-07-30 21:17:21 +0000
commitb2dd3583e7372d23d18bbc6e861f4f645ec3dc37 (patch)
tree659f5549fc533cebec5326615b6e385ffdde5453 /src/ui
parentMerge from trunk (r12439). (diff)
downloadinkscape-b2dd3583e7372d23d18bbc6e861f4f645ec3dc37.tar.gz
inkscape-b2dd3583e7372d23d18bbc6e861f4f645ec3dc37.zip
Further refactoring of EventContexts.
(bzr r11608.1.109)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/align-and-distribute.cpp25
-rw-r--r--src/ui/tool/node-tool.cpp8
-rw-r--r--src/ui/tool/node-tool.h33
3 files changed, 37 insertions, 29 deletions
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 8845b60e5..38f10c59c 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -47,6 +47,7 @@
#include "widgets/icon.h"
#include "sp-root.h"
#include "document-undo.h"
+#include "desktop.h"
#include <glibmm/i18n.h>
@@ -367,19 +368,25 @@ public :
private :
Geom::Dim2 _orientation;
bool _distribute;
- virtual void on_button_click()
- {
- if (!_dialog.getDesktop()) return;
- SPEventContext *event_context = sp_desktop_event_context(_dialog.getDesktop());
- if (!INK_IS_NODE_TOOL (event_context)) return;
+ virtual void on_button_click() {
+ if (!_dialog.getDesktop()) {
+ return;
+ }
+
+ SPEventContext *event_context = _dialog.getDesktop()->getEventContext();
+
+ if (!INK_IS_NODE_TOOL(event_context)) {
+ return;
+ }
+
InkNodeTool *nt = INK_NODE_TOOL(event_context);
- if (_distribute)
+ if (_distribute) {
nt->_multipath->distributeNodes(_orientation);
- else
+ } else {
nt->_multipath->alignNodes(_orientation);
-
+ }
}
};
@@ -825,7 +832,7 @@ private :
static void on_tool_changed(Inkscape::Application */*inkscape*/, SPEventContext */*context*/, AlignAndDistribute *daad)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop && sp_desktop_event_context(desktop))
+ if (desktop && desktop->getEventContext())
daad->setMode(tools_active(desktop) == TOOLS_NODES);
}
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp
index b65ca22b9..d424c1fdb 100644
--- a/src/ui/tool/node-tool.cpp
+++ b/src/ui/tool/node-tool.cpp
@@ -411,7 +411,7 @@ void InkNodeTool::selection_changed(Inkscape::Selection *sel) {
this->desktop->updateNow();
}
-gint InkNodeTool::root_handler(GdkEvent* event) {
+bool InkNodeTool::root_handler(GdkEvent* event) {
/* things to handle here:
* 1. selection of items
* 2. passing events to manipulators
@@ -613,7 +613,7 @@ void InkNodeTool::update_tip(GdkEvent *event) {
}
}
-gint InkNodeTool::item_handler(SPItem* item, GdkEvent* event) {
+bool InkNodeTool::item_handler(SPItem* item, GdkEvent* event) {
SPEventContext::item_handler(item, event);
return FALSE;
@@ -684,13 +684,13 @@ void InkNodeTool::mouseover_changed(Inkscape::UI::ControlPoint *p) {
this->cursor_shape = cursor_node_d_xpm;
this->hot_x = 1;
this->hot_y = 1;
- sp_event_context_update_cursor(this);
+ this->sp_event_context_update_cursor();
this->cursor_drag = true;
} else if (!cdp && this->cursor_drag) {
this->cursor_shape = cursor_node_xpm;
this->hot_x = 1;
this->hot_y = 1;
- sp_event_context_update_cursor(this);
+ this->sp_event_context_update_cursor();
this->cursor_drag = false;
}
}
diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h
index df8b5d782..313cc0561 100644
--- a/src/ui/tool/node-tool.h
+++ b/src/ui/tool/node-tool.h
@@ -15,22 +15,23 @@
#include <glib.h>
#include "event-context.h"
-#define INK_NODE_TOOL(obj) ((InkNodeTool*)obj)
-#define INK_IS_NODE_TOOL(obj) (dynamic_cast<const InkNodeTool*>((const SPEventContext*)obj))
-
namespace Inkscape {
+ namespace Display {
+ class TemporaryItem;
+ }
+
+ namespace UI {
+ class MultiPathManipulator;
+ class ControlPointSelection;
+ class Selector;
+ class ControlPoint;
-namespace Display {
-class TemporaryItem;
-} // namespace Display
-namespace UI {
-class MultiPathManipulator;
-class ControlPointSelection;
-class Selector;
-struct PathSharedData;
-class ControlPoint;
-} // namespace UI
-} // namespace Inkscape
+ struct PathSharedData;
+ }
+}
+
+#define INK_NODE_TOOL(obj) ((InkNodeTool*)obj)
+#define INK_IS_NODE_TOOL(obj) (dynamic_cast<const InkNodeTool*>((const SPEventContext*)obj))
class InkNodeTool : public SPEventContext {
public:
@@ -47,8 +48,8 @@ public:
virtual void setup();
virtual void set(const Inkscape::Preferences::Entry& val);
- virtual gint root_handler(GdkEvent* event);
- virtual gint item_handler(SPItem* item, GdkEvent* event);
+ virtual bool root_handler(GdkEvent* event);
+ virtual bool item_handler(SPItem* item, GdkEvent* event);
virtual const std::string& getPrefsPath();