diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-11-07 20:44:00 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-11-07 20:44:00 +0000 |
| commit | 55b451bf382e0c3d5ed8728e42fbb535acfa8a33 (patch) | |
| tree | 094d9faca06cfffc89a872732db4ac3ef60508d9 /src/ui | |
| parent | Fix for Bug #1247985 (Incorrect implementation of plural forms). (diff) | |
| download | inkscape-55b451bf382e0c3d5ed8728e42fbb535acfa8a33.tar.gz inkscape-55b451bf382e0c3d5ed8728e42fbb535acfa8a33.zip | |
First step of moving tools into appropriate namespaces.
(bzr r12782)
Diffstat (limited to 'src/ui')
27 files changed, 100 insertions, 75 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index da6fed86b..ffb2bdf8c 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -247,13 +247,13 @@ void ClipboardManagerImpl::copy(SPDesktop *desktop) // not the object that holds it; also copy the style at cursor into if (tools_isactive(desktop, TOOLS_TEXT)) { _discardInternalClipboard(); - Glib::ustring selected_text = sp_text_get_selected_text(desktop->event_context); + Glib::ustring selected_text = Inkscape::UI::Tools::sp_text_get_selected_text(desktop->event_context); _clipboard->set_text(selected_text); if (_text_style) { sp_repr_css_attr_unref(_text_style); _text_style = NULL; } - _text_style = sp_text_get_style_at_cursor(desktop->event_context); + _text_style = Inkscape::UI::Tools::sp_text_get_style_at_cursor(desktop->event_context); return; } @@ -908,7 +908,7 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop) // if the text editing tool is active, paste the text into the active text object if (tools_isactive(desktop, TOOLS_TEXT)) { - return sp_text_paste_inline(desktop->event_context); + return Inkscape::UI::Tools::sp_text_paste_inline(desktop->event_context); } // try to parse the text as a color and, if successful, apply it as the current style diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 38f10c59c..4a3852d5d 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -374,13 +374,13 @@ private : return; } - SPEventContext *event_context = _dialog.getDesktop()->getEventContext(); + Inkscape::UI::Tools::ToolBase *event_context = _dialog.getDesktop()->getEventContext(); if (!INK_IS_NODE_TOOL(event_context)) { return; } - InkNodeTool *nt = INK_NODE_TOOL(event_context); + Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(event_context); if (_distribute) { nt->_multipath->distributeNodes(_orientation); @@ -829,7 +829,7 @@ private : -static void on_tool_changed(Inkscape::Application */*inkscape*/, SPEventContext */*context*/, AlignAndDistribute *daad) +static void on_tool_changed(Inkscape::Application */*inkscape*/, Inkscape::UI::Tools::ToolBase */*context*/, AlignAndDistribute *daad) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop && desktop->getEventContext()) diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index f27d344fa..7fc9c3889 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -270,7 +270,7 @@ bool Dialog::_onEvent(GdkEvent *event) switch (event->type) { case GDK_KEY_PRESS: { - switch (get_group0_keyval (&event->key)) { + switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) { case GDK_KEY_Escape: { _defocus(); ret = true; @@ -300,7 +300,7 @@ bool Dialog::_onEvent(GdkEvent *event) bool Dialog::_onKeyPress(GdkEventKey *event) { unsigned int shortcut; - shortcut = get_group0_keyval(event) | + shortcut = Inkscape::UI::Tools::get_group0_keyval(event) | ( event->state & GDK_SHIFT_MASK ? SP_SHORTCUT_SHIFT_MASK : 0 ) | ( event->state & GDK_CONTROL_MASK ? diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index b9e5d4883..c726f93af 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -318,7 +318,7 @@ SPObject* LayerPropertiesDialog::_selectedLayer() bool LayerPropertiesDialog::_handleKeyEvent(GdkEventKey *event) { - switch (get_group0_keyval(event)) { + switch (Inkscape::UI::Tools::get_group0_keyval(event)) { case GDK_KEY_Return: case GDK_KEY_KP_Enter: { _strategy->perform(*this); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index c01903f94..ff9265c8d 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -544,7 +544,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) bool LayersPanel::_handleKeyEvent(GdkEventKey *event) { - switch (get_group0_keyval(event)) { + switch (Inkscape::UI::Tools::get_group0_keyval(event)) { case GDK_KEY_Return: case GDK_KEY_KP_Enter: case GDK_KEY_F2: { diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index a537b7fca..dfddfb1d3 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -328,7 +328,7 @@ void XmlTree::attr_reset_context(gint attr) bool XmlTree::sp_xml_tree_key_press(GdkEventKey *event) { - unsigned int shortcut = get_group0_keyval (event) | + unsigned int shortcut = Inkscape::UI::Tools::get_group0_keyval (event) | ( event->state & GDK_SHIFT_MASK ? SP_SHORTCUT_SHIFT_MASK : 0 ) | ( event->state & GDK_CONTROL_MASK ? @@ -842,7 +842,7 @@ void XmlTree::on_document_uri_set(gchar const * /*uri*/, SPDocument * /*document gboolean XmlTree::quit_on_esc (GtkWidget *w, GdkEventKey *event, GObject */*tbl*/) { - switch (get_group0_keyval (event)) { + switch (Inkscape::UI::Tools::get_group0_keyval (event)) { case GDK_KEY_Escape: // defocus gtk_widget_destroy(w); return TRUE; diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index 1c42c5d90..b5ee0a597 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -582,7 +582,7 @@ void ControlPointSelection::_commitHandlesTransform(CommitEvent ce) signal_commit.emit(ce); } -bool ControlPointSelection::event(SPEventContext * /*event_context*/, GdkEvent *event) +bool ControlPointSelection::event(Inkscape::UI::Tools::ToolBase * /*event_context*/, GdkEvent *event) { // implement generic event handling that should apply for all control point selections here; // for example, keyboard moves and transformations. This way this functionality doesn't need diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index f5eb47026..a087e0455 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -90,7 +90,7 @@ public: void invertSelection(); void spatialGrow(SelectableControlPoint *origin, int dir); - virtual bool event(SPEventContext *, GdkEvent *); + virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *); void transform(Geom::Affine const &m); void align(Geom::Dim2 d); diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index 069dcc67b..3f1587492 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -218,7 +218,7 @@ int ControlPoint::_event_handler(SPCanvasItem */*item*/, GdkEvent *event, Contro } // main event callback, which emits all other callbacks. -bool ControlPoint::_eventHandler(SPEventContext *event_context, GdkEvent *event) +bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { // NOTE the static variables below are shared for all points! // TODO handle clicks and drags from other buttons too @@ -310,7 +310,7 @@ bool ControlPoint::_eventHandler(SPEventContext *event_context, GdkEvent *event) _desktop->set_coordinate_status(_position); sp_event_context_snap_delay_handler(event_context, NULL, (gpointer) this, &event->motion, - DelayedSnapEvent::CONTROL_POINT_HANDLER); + Inkscape::UI::Tools::DelayedSnapEvent::CONTROL_POINT_HANDLER); } return true; } @@ -375,7 +375,7 @@ bool ControlPoint::_eventHandler(SPEventContext *event_context, GdkEvent *event) // update tips on modifier state change // TODO add ESC keybinding as drag cancel case GDK_KEY_PRESS: - switch (get_group0_keyval(&event->key)) + switch (Inkscape::UI::Tools::get_group0_keyval(&event->key)) { case GDK_KEY_Escape: { // ignore Escape if this is not a drag diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h index 30efe8a27..b3ed9545e 100644 --- a/src/ui/tool/control-point.h +++ b/src/ui/tool/control-point.h @@ -23,7 +23,16 @@ #include "enums.h" class SPDesktop; -class SPEventContext; + +namespace Inkscape { +namespace UI { +namespace Tools { + +class ToolBase; + +} +} +} namespace Inkscape { namespace UI { @@ -181,7 +190,7 @@ public: static Glib::ustring format_tip(char const *format, ...) G_GNUC_PRINTF(1,2); // temporarily public, until snap delay is refactored a little - virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event); + virtual bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event); SPDesktop *const _desktop; ///< The desktop this control point resides on. protected: diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index b83ce1b3c..4ca736f80 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -32,7 +32,7 @@ CurveDragPoint::CurveDragPoint(PathManipulator &pm) : setVisible(false); } -bool CurveDragPoint::_eventHandler(SPEventContext *event_context, GdkEvent *event) +bool CurveDragPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { // do not process any events when the manipulator is empty if (_pm.empty()) { diff --git a/src/ui/tool/curve-drag-point.h b/src/ui/tool/curve-drag-point.h index 73e4cd969..ea83978e0 100644 --- a/src/ui/tool/curve-drag-point.h +++ b/src/ui/tool/curve-drag-point.h @@ -35,7 +35,7 @@ public: void setSize(double sz) { _setSize(sz); } void setTimeValue(double t) { _t = t; } void setIterator(NodeList::iterator i) { first = i; } - virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event); + virtual bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event); protected: diff --git a/src/ui/tool/manipulator.h b/src/ui/tool/manipulator.h index ffed370d3..2e6d80517 100644 --- a/src/ui/tool/manipulator.h +++ b/src/ui/tool/manipulator.h @@ -40,7 +40,7 @@ public: virtual ~Manipulator() {} /// Handle input event. Returns true if handled. - virtual bool event(SPEventContext *, GdkEvent *)=0; + virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *)=0; SPDesktop *const _desktop; }; @@ -145,7 +145,7 @@ public: } } - virtual bool event(SPEventContext *event_context, GdkEvent *event) { + virtual bool event(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { for (typename MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { if ((*i).second->event(event_context, event)) return true; } diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 5d5ea2adc..519c4ac6a 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -557,7 +557,7 @@ void MultiPathManipulator::updateHandles() invokeForAll(&PathManipulator::updateHandles); } -bool MultiPathManipulator::event(SPEventContext *event_context, GdkEvent *event) +bool MultiPathManipulator::event(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { _tracker.event(event); guint key = 0; diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index 54a9b5753..1328372c6 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -36,7 +36,7 @@ class MultiPathManipulator : public PointManipulator { public: MultiPathManipulator(PathSharedData &data, sigc::connection &chg); virtual ~MultiPathManipulator(); - virtual bool event(SPEventContext *, GdkEvent *event); + virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *event); bool empty() { return _mmap.empty(); } unsigned size() { return _mmap.empty(); } diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index 76e33e506..2eeab7c1b 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -45,7 +45,7 @@ #include <gdk/gdkkeysyms.h> -/** @struct InkNodeTool +/** @struct NodeTool * * Node tool event context. * @@ -104,25 +104,29 @@ using Inkscape::ControlManager; -SPCanvasGroup *create_control_group(SPDesktop *d); - #include "tool-factory.h" +namespace Inkscape { +namespace UI { +namespace Tools { + namespace { - SPEventContext* createNodesContext() { - return new InkNodeTool(); + ToolBase* createNodesContext() { + return new NodeTool(); } bool nodesContextRegistered = ToolFactory::instance().registerObject("/tools/nodes", createNodesContext); } -const std::string& InkNodeTool::getPrefsPath() { - return InkNodeTool::prefsPath; +const std::string& NodeTool::getPrefsPath() { + return NodeTool::prefsPath; } -const std::string InkNodeTool::prefsPath = "/tools/nodes"; +const std::string NodeTool::prefsPath = "/tools/nodes"; + +SPCanvasGroup *create_control_group(SPDesktop *d); -InkNodeTool::InkNodeTool() : SPEventContext() { +NodeTool::NodeTool() : ToolBase() { this->show_handles = false; this->single_node_transform_handles = false; this->show_transform_handles = false; @@ -159,7 +163,7 @@ void destroy_group(SPCanvasGroup *g) sp_canvas_item_destroy(SP_CANVAS_ITEM(g)); } -InkNodeTool::~InkNodeTool() { +NodeTool::~NodeTool() { this->enableGrDrag(false); if (this->flash_tempitem) { @@ -184,8 +188,8 @@ InkNodeTool::~InkNodeTool() { destroy_group(this->_transform_handle_group); } -void InkNodeTool::setup() { - SPEventContext::setup(); +void NodeTool::setup() { + ToolBase::setup(); this->_path_data = new Inkscape::UI::PathSharedData(); @@ -208,14 +212,14 @@ void InkNodeTool::setup() { this->_selection_changed_connection.disconnect(); this->_selection_changed_connection = - selection->connectChanged(sigc::mem_fun(this, &InkNodeTool::selection_changed)); + selection->connectChanged(sigc::mem_fun(this, &NodeTool::selection_changed)); this->_mouseover_changed_connection.disconnect(); this->_mouseover_changed_connection = - Inkscape::UI::ControlPoint::signal_mouseover_change.connect(sigc::mem_fun(this, &InkNodeTool::mouseover_changed)); + Inkscape::UI::ControlPoint::signal_mouseover_change.connect(sigc::mem_fun(this, &NodeTool::mouseover_changed)); this->_sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged( - sigc::mem_fun(this, &InkNodeTool::handleControlUiStyleChange) + sigc::mem_fun(this, &NodeTool::handleControlUiStyleChange) ); this->_selected_nodes = new Inkscape::UI::ControlPointSelection(this->desktop, this->_transform_handle_group); @@ -224,8 +228,8 @@ void InkNodeTool::setup() { this->_multipath = new Inkscape::UI::MultiPathManipulator(data, this->_selection_changed_connection); - this->_selector->signal_point.connect(sigc::mem_fun(this, &InkNodeTool::select_point)); - this->_selector->signal_area.connect(sigc::mem_fun(this, &InkNodeTool::select_area)); + this->_selector->signal_point.connect(sigc::mem_fun(this, &NodeTool::select_point)); + this->_selector->signal_area.connect(sigc::mem_fun(this, &NodeTool::select_area)); this->_multipath->signal_coords_changed.connect( sigc::bind( @@ -240,7 +244,7 @@ void InkNodeTool::setup() { // <=> // void update_tip(GdkEvent *event) sigc::hide(sigc::hide(sigc::bind( - sigc::mem_fun(this, &InkNodeTool::update_tip), + sigc::mem_fun(this, &NodeTool::update_tip), (GdkEvent*)NULL ))) ); @@ -279,7 +283,7 @@ void InkNodeTool::setup() { this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive } -void InkNodeTool::set(const Inkscape::Preferences::Entry& value) { +void NodeTool::set(const Inkscape::Preferences::Entry& value) { Glib::ustring entry_name = value.getEntryName(); if (entry_name == "show_handles") { @@ -312,12 +316,12 @@ void InkNodeTool::set(const Inkscape::Preferences::Entry& value) { this->edit_masks = value.getBool(); this->selection_changed(this->desktop->selection); } else { - SPEventContext::set(value); + ToolBase::set(value); } } /** Recursively collect ShapeRecords */ -void gather_items(InkNodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::ShapeRole role, +void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::ShapeRole role, std::set<Inkscape::UI::ShapeRecord> &s) { using namespace Inkscape::UI; @@ -358,7 +362,7 @@ void gather_items(InkNodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Sh } } -void InkNodeTool::selection_changed(Inkscape::Selection *sel) { +void NodeTool::selection_changed(Inkscape::Selection *sel) { using namespace Inkscape::UI; std::set<ShapeRecord> shapes; @@ -405,7 +409,7 @@ void InkNodeTool::selection_changed(Inkscape::Selection *sel) { this->desktop->updateNow(); } -bool InkNodeTool::root_handler(GdkEvent* event) { +bool NodeTool::root_handler(GdkEvent* event) { /* things to handle here: * 1. selection of items * 2. passing events to manipulators @@ -534,10 +538,10 @@ bool InkNodeTool::root_handler(GdkEvent* event) { break; } - return SPEventContext::root_handler(event); + return ToolBase::root_handler(event); } -void InkNodeTool::update_tip(GdkEvent *event) { +void NodeTool::update_tip(GdkEvent *event) { using namespace Inkscape::UI; if (event && (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE)) { @@ -603,7 +607,7 @@ void InkNodeTool::update_tip(GdkEvent *event) { } } -void InkNodeTool::select_area(Geom::Rect const &sel, GdkEventButton *event) { +void NodeTool::select_area(Geom::Rect const &sel, GdkEventButton *event) { using namespace Inkscape::UI; if (this->_multipath->empty()) { @@ -621,7 +625,7 @@ void InkNodeTool::select_area(Geom::Rect const &sel, GdkEventButton *event) { } } -void InkNodeTool::select_point(Geom::Point const &sel, GdkEventButton *event) { +void NodeTool::select_point(Geom::Point const &sel, GdkEventButton *event) { using namespace Inkscape::UI; // pull in event helpers if (!event) { @@ -659,7 +663,7 @@ void InkNodeTool::select_point(Geom::Point const &sel, GdkEventButton *event) { } } -void InkNodeTool::mouseover_changed(Inkscape::UI::ControlPoint *p) { +void NodeTool::mouseover_changed(Inkscape::UI::ControlPoint *p) { using Inkscape::UI::CurveDragPoint; CurveDragPoint *cdp = dynamic_cast<CurveDragPoint*>(p); @@ -679,10 +683,14 @@ void InkNodeTool::mouseover_changed(Inkscape::UI::ControlPoint *p) { } } -void InkNodeTool::handleControlUiStyleChange() { +void NodeTool::handleControlUiStyleChange() { this->_multipath->updateHandles(); } +} +} +} + //} // anonymous namespace /* diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index c41f50650..a670256bb 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -30,13 +30,17 @@ namespace Inkscape { } } -#define INK_NODE_TOOL(obj) (dynamic_cast<InkNodeTool*>((SPEventContext*)obj)) -#define INK_IS_NODE_TOOL(obj) (dynamic_cast<const InkNodeTool*>((const SPEventContext*)obj)) +#define INK_NODE_TOOL(obj) (dynamic_cast<Inkscape::UI::Tools::NodeTool*>((Inkscape::UI::Tools::ToolBase*)obj)) +#define INK_IS_NODE_TOOL(obj) (dynamic_cast<const Inkscape::UI::Tools::NodeTool*>((const Inkscape::UI::Tools::ToolBase*)obj)) -class InkNodeTool : public SPEventContext { +namespace Inkscape { +namespace UI { +namespace Tools { + +class NodeTool : public ToolBase { public: - InkNodeTool(); - virtual ~InkNodeTool(); + NodeTool(); + virtual ~NodeTool(); Inkscape::UI::ControlPointSelection* _selected_nodes; Inkscape::UI::MultiPathManipulator* _multipath; @@ -83,6 +87,10 @@ private: void handleControlUiStyleChange(); }; +} +} +} + #endif /* diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 76ec68c3e..e246bf997 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -250,7 +250,7 @@ char const *Handle::handle_type_to_localized_string(NodeType type) } } -bool Handle::_eventHandler(SPEventContext *event_context, GdkEvent *event) +bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { switch (event->type) { @@ -834,7 +834,7 @@ NodeType Node::parse_nodetype(char x) } } -bool Node::_eventHandler(SPEventContext *event_context, GdkEvent *event) +bool Node::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { int dir = 0; diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index 591dd8532..e3fc6c2c8 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -106,7 +106,7 @@ protected: Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node *parent); - virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event); + virtual bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event); virtual void dragged(Geom::Point &new_pos, GdkEventMotion *event); virtual bool grabbed(GdkEventMotion *event); virtual void ungrabbed(GdkEventButton *event); @@ -217,7 +217,7 @@ public: // temporarily public /** Customized event handler to catch scroll events needed for selection grow/shrink. */ - virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event); + virtual bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event); Inkscape::SnapCandidatePoint snapCandidatePoint(); diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index d12e2958b..ec58e2141 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -157,7 +157,7 @@ PathManipulator::~PathManipulator() } /** Handle motion events to update the position of the curve drag point. */ -bool PathManipulator::event(SPEventContext * /*event_context*/, GdkEvent *event) +bool PathManipulator::event(Inkscape::UI::Tools::ToolBase * /*event_context*/, GdkEvent *event) { if (empty()) return false; diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index e01e8617f..7a13ce723 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -56,7 +56,7 @@ public: PathManipulator(MultiPathManipulator &mpm, SPPath *path, Geom::Affine const &edit_trans, guint32 outline_color, Glib::ustring lpe_key); ~PathManipulator(); - virtual bool event(SPEventContext *, GdkEvent *); + virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *); bool empty(); void writeXML(); diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index 2b3ba837c..d46a160bc 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -48,12 +48,12 @@ public: SPDesktop *desktop() { return _desktop; } - bool event(SPEventContext *ec, GdkEvent *e) { + bool event(Inkscape::UI::Tools::ToolBase *ec, GdkEvent *e) { return _eventHandler(ec, e); } protected: - virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event) { + virtual bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { if (event->type == GDK_KEY_PRESS && shortcut_key(event->key) == GDK_KEY_Escape && sp_canvas_item_is_visible(_rubber)) { @@ -110,7 +110,7 @@ Selector::~Selector() delete _dragger; } -bool Selector::event(SPEventContext *event_context, GdkEvent *event) +bool Selector::event(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent *event) { // The hidden control point will capture all events after it obtains the grab, // but it relies on this function to initiate it. If we pass only first button @@ -118,7 +118,7 @@ bool Selector::event(SPEventContext *event_context, GdkEvent *event) switch (event->type) { case GDK_BUTTON_PRESS: // Do not pass button presses other than left button to the control point. - // This way middle click and right click can be handled in SPEventContext. + // This way middle click and right click can be handled in ToolBase. if (event->button.button == 1 && !event_context->space_panning) { _dragger->setPosition(_desktop->w2d(event_point(event->motion))); return _dragger->event(event_context, event); diff --git a/src/ui/tool/selector.h b/src/ui/tool/selector.h index 7e2759b69..dbe751ede 100644 --- a/src/ui/tool/selector.h +++ b/src/ui/tool/selector.h @@ -28,7 +28,7 @@ class Selector : public Manipulator { public: Selector(SPDesktop *d); virtual ~Selector(); - virtual bool event(SPEventContext *, GdkEvent *); + virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *); sigc::signal<void, Geom::Rect const &, GdkEventButton*> signal_area; sigc::signal<void, Geom::Point const &, GdkEventButton*> signal_point; diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index daed3a523..535a138ed 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -128,7 +128,7 @@ bool TransformHandle::grabbed(GdkEventMotion *) _setState(_state); // Collect the snap-candidates, one for each selected node. These will be stored in the _snap_points vector. - InkNodeTool *nt = INK_NODE_TOOL(_th._desktop->event_context); + Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(_th._desktop->event_context); //ControlPointSelection *selection = nt->_selected_nodes.get(); ControlPointSelection* selection = nt->_selected_nodes; @@ -754,7 +754,7 @@ void TransformHandleSet::setBounds(Geom::Rect const &r, bool preserve_center) } } -bool TransformHandleSet::event(SPEventContext *, GdkEvent*) +bool TransformHandleSet::event(Inkscape::UI::Tools::ToolBase *, GdkEvent*) { return false; } diff --git a/src/ui/tool/transform-handle-set.h b/src/ui/tool/transform-handle-set.h index ce949cbb2..54f81adf5 100644 --- a/src/ui/tool/transform-handle-set.h +++ b/src/ui/tool/transform-handle-set.h @@ -40,7 +40,7 @@ public: TransformHandleSet(SPDesktop *d, SPCanvasGroup *th_group); virtual ~TransformHandleSet(); - virtual bool event(SPEventContext *, GdkEvent *); + virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *); bool visible() const { return _visible; } Mode mode() const { return _mode; } diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 18d53bf5c..24a21e075 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -111,7 +111,7 @@ bool Rotateable::on_motion(GdkEventMotion *event) { do_motion(force, modifier); } } - gobble_motion_events(GDK_BUTTON1_MASK); + Inkscape::UI::Tools::gobble_motion_events(GDK_BUTTON1_MASK); return true; } return false; diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 6cbc15c1b..aa8f68ce8 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -71,7 +71,7 @@ bool SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/) bool SpinButton::on_my_key_press_event(GdkEventKey* event) { - switch (get_group0_keyval (event)) { + switch (Inkscape::UI::Tools::get_group0_keyval (event)) { case GDK_KEY_Escape: undo(); return true; // I consumed the event |
