summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2014-03-29 00:57:47 +0000
committerMarkus Engel <markus.engel@tum.de>2014-03-29 00:57:47 +0000
commit3c12cff9a89350a47eb4823194946982bd918677 (patch)
tree9f86260d8bae24062434109223d76fd93bab1a5f /src
parentGuides: Clean up memory a bit better and move color changed to OK so we don't... (diff)
downloadinkscape-3c12cff9a89350a47eb4823194946982bd918677.tar.gz
inkscape-3c12cff9a89350a47eb4823194946982bd918677.zip
Removed obsolete header file.
(bzr r13229)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/main.cpp2
-rw-r--r--src/modifier-fns.h64
-rw-r--r--src/ui/dialog/dialog.cpp4
-rw-r--r--src/ui/tools/pencil-tool.cpp21
-rw-r--r--src/ui/tools/pencil-tool.h4
-rw-r--r--src/ui/tools/tool-base.cpp2
-rw-r--r--src/ui/tools/tool-base.h2
9 files changed, 18 insertions, 83 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c34bd2e62..e1e0afa79 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -369,7 +369,6 @@ set(inkscape_SRC
message.h
mod360-test.h
mod360.h
- modifier-fns.h
number-opt-number.h
object-edit.h
object-hierarchy.h
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 5ff44b253..8872b045d 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -94,7 +94,6 @@ ink_common_sources += \
message.h \
message-stack.cpp message-stack.h \
mod360.cpp mod360.h \
- modifier-fns.h \
object-edit.cpp object-edit.h \
object-hierarchy.cpp object-hierarchy.h \
object-snapper.cpp object-snapper.h \
diff --git a/src/main.cpp b/src/main.cpp
index 25f813c2b..00d0fcbb6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -925,7 +925,7 @@ namespace Inkscape {
namespace UI {
namespace Tools {
-guint get_group0_keyval(GdkEventKey* event);
+guint get_group0_keyval(GdkEventKey const* event);
}
}
diff --git a/src/modifier-fns.h b/src/modifier-fns.h
deleted file mode 100644
index cab110467..000000000
--- a/src/modifier-fns.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef SEEN_MODIFIER_FNS_H
-#define SEEN_MODIFIER_FNS_H
-
-/** \file
- * Functions on GdkEventKey.state that test modifier keys.
- *
- * The MOD__SHIFT macro in macros.h is equivalent to mod_shift(event-\>key.state).
- */
-
-/*
- * Hereby placed in public domain.
- */
-
-#include <gdk/gdk.h>
-#include <glib.h>
-
-inline bool
-mod_shift(guint const state)
-{
- return state & GDK_SHIFT_MASK;
-}
-
-inline bool
-mod_ctrl(guint const state)
-{
- return state & GDK_CONTROL_MASK;
-}
-
-inline bool
-mod_alt(guint const state)
-{
- return state & GDK_MOD1_MASK;
-}
-
-inline bool
-mod_shift_only(guint const state)
-{
- return (state & GDK_SHIFT_MASK) && !(state & GDK_CONTROL_MASK) && !(state & GDK_MOD1_MASK);
-}
-
-inline bool
-mod_ctrl_only(guint const state)
-{
- return !(state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK) && !(state & GDK_MOD1_MASK);
-}
-
-inline bool
-mod_alt_only(guint const state)
-{
- return !(state & GDK_SHIFT_MASK) && !(state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK);
-}
-
-#endif /* !SEEN_MODIFIER_FNS_H */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 3cc3f3d88..645294bb5 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -26,11 +26,11 @@
#include "ui/tools/tool-base.h"
#include "desktop.h"
#include "desktop-handles.h"
-#include "modifier-fns.h"
#include "shortcuts.h"
#include "preferences.h"
#include "interface.h"
#include "verbs.h"
+#include "ui/tool/event-utils.h"
#include <gtk/gtk.h>
@@ -279,7 +279,7 @@ bool Dialog::_onEvent(GdkEvent *event)
case GDK_KEY_F4:
case GDK_KEY_w:
case GDK_KEY_W: {
- if (mod_ctrl_only(event->key.state)) {
+ if (Inkscape::UI::held_only_control(event->key)) {
_close();
ret = true;
}
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 374846539..fb4e82c32 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -26,7 +26,6 @@
#include "draw-anchor.h"
#include "message-stack.h"
#include "message-context.h"
-#include "modifier-fns.h"
#include "sp-path.h"
#include "preferences.h"
#include "snap.h"
@@ -45,6 +44,7 @@
#include "display/curve.h"
#include "livarot/Path.h"
#include "tool-factory.h"
+#include "ui/tool/event-utils.h"
namespace Inkscape {
namespace UI {
@@ -131,11 +131,11 @@ bool PencilTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- ret = this->_handleKeyPress(get_group0_keyval (&event->key), event->key.state);
+ ret = this->_handleKeyPress(event->key);
break;
case GDK_KEY_RELEASE:
- ret = this->_handleKeyRelease(get_group0_keyval (&event->key), event->key.state);
+ ret = this->_handleKeyRelease(event->key);
break;
default:
@@ -467,16 +467,16 @@ void PencilTool::_cancel() {
this->desktop->canvas->endForcedFullRedraws();
}
-bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
+bool PencilTool::_handleKeyPress(GdkEventKey const &event) {
bool ret = false;
- switch (keyval) {
+ switch (get_group0_keyval(&event)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
case GDK_KEY_KP_Down:
// Prevent the zoom field from activation.
- if (!mod_ctrl_only(state)) {
+ if (!Inkscape::UI::held_only_control(event)) {
ret = true;
}
break;
@@ -491,7 +491,7 @@ bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
break;
case GDK_KEY_z:
case GDK_KEY_Z:
- if (mod_ctrl_only(state) && this->npoints != 0) {
+ if (Inkscape::UI::held_only_control(event) && this->npoints != 0) {
// if drawing, cancel, otherwise pass it up for undo
if (this->state != SP_PENCIL_CONTEXT_IDLE) {
this->_cancel();
@@ -501,7 +501,7 @@ bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
break;
case GDK_KEY_g:
case GDK_KEY_G:
- if (mod_shift_only(state)) {
+ if (Inkscape::UI::held_only_shift(event)) {
sp_selection_to_guides(this->desktop);
ret = true;
}
@@ -520,9 +520,10 @@ bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
return ret;
}
-bool PencilTool::_handleKeyRelease(guint const keyval, guint const /*state*/) {
+bool PencilTool::_handleKeyRelease(GdkEventKey const &event) {
bool ret = false;
- switch (keyval) {
+
+ switch (get_group0_keyval(&event)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Meta_L:
diff --git a/src/ui/tools/pencil-tool.h b/src/ui/tools/pencil-tool.h
index e01b0afb5..e8d156dbd 100644
--- a/src/ui/tools/pencil-tool.h
+++ b/src/ui/tools/pencil-tool.h
@@ -57,8 +57,8 @@ private:
bool _handleButtonPress(GdkEventButton const &bevent);
bool _handleMotionNotify(GdkEventMotion const &mevent);
bool _handleButtonRelease(GdkEventButton const &revent);
- bool _handleKeyPress(guint const keyval, guint const state);
- bool _handleKeyRelease(guint const keyval, guint const state);
+ bool _handleKeyPress(GdkEventKey const &event);
+ bool _handleKeyRelease(GdkEventKey const &event);
void _setStartpoint(Geom::Point const &p);
void _setEndpoint(Geom::Point const &p);
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 96ac95926..4195c9eb2 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -1132,7 +1132,7 @@ void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
* Use this instead of simply event->keyval, so that your keyboard shortcuts
* work regardless of layouts (e.g., in Cyrillic).
*/
-guint get_group0_keyval(GdkEventKey *event) {
+guint get_group0_keyval(GdkEventKey const *event) {
guint keyval = 0;
gdk_keymap_translate_keyboard_state(gdk_keymap_get_for_display(
diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h
index e11a22296..b27de9030 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -244,7 +244,7 @@ gint gobble_motion_events(gint mask);
void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, GdkEvent *event,
gchar const *ctrl_tip, gchar const *shift_tip, gchar const *alt_tip);
-guint get_group0_keyval(GdkEventKey *event);
+guint get_group0_keyval(GdkEventKey const *event);
SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups);
SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, Geom::Point const &p);