summaryrefslogtreecommitdiff
path: root/tikzit/src/gtk/Application.m
diff options
context:
space:
mode:
Diffstat (limited to 'tikzit/src/gtk/Application.m')
-rw-r--r--tikzit/src/gtk/Application.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/tikzit/src/gtk/Application.m b/tikzit/src/gtk/Application.m
index 4096fe9..11d0cd7 100644
--- a/tikzit/src/gtk/Application.m
+++ b/tikzit/src/gtk/Application.m
@@ -198,6 +198,19 @@ Application* app = nil;
}
}
+- (void) activateToolForKey:(unsigned int)keyVal withMask:(InputMask)mask {
+ // FIXME: cache the accel info, rather than reparsing it every time?
+ for (id<Tool> tool in tools) {
+ guint toolKey = 0;
+ GdkModifierType toolMod = 0;
+ gtk_accelerator_parse ([[tool shortcut] UTF8String], &toolKey, &toolMod);
+ if (toolKey != 0 && toolKey == keyVal && (int)mask == (int)toolMod) {
+ [self setActiveTool:tool];
+ return;
+ }
+ }
+}
+
- (void) _addWindow:(Window*)window {
[window setActiveTool:activeTool];
[openWindows addObject:window];