From 9e194683f9c4109158d46aa6f6f0e7542db8b558 Mon Sep 17 00:00:00 2001 From: Patrick Welche Date: Thu, 12 Mar 2009 14:46:50 +0000 Subject: [PATCH] (a) makes the control mode list box (in the preferences pane) under mac os x non-editable; (b) fixes keyboard input in the OpenGL impl, allowing use of e.g. two-button mode. svn path=/trunk/; revision=3664 --- ChangeLog | 6 + Src/MacOSX/Dasher.xcodeproj/project.pbxproj | 137 ++------------------- Src/MacOSX/DasherViewOpenGL.h | 5 +- Src/MacOSX/DasherViewOpenGL.mm | 27 +++- .../English.lproj/Preferences.nib/classes.nib | 49 ++++++-- Src/MacOSX/English.lproj/Preferences.nib/info.nib | 16 ++- Src/MacOSX/KeyboardHelper.cpp | 73 +++++++++++ Src/MacOSX/KeyboardHelper.h | 15 +++ 8 files changed, 173 insertions(+), 155 deletions(-) rewrite Src/MacOSX/English.lproj/Preferences.nib/classes.nib (100%) create mode 100644 Src/MacOSX/KeyboardHelper.cpp create mode 100644 Src/MacOSX/KeyboardHelper.h diff --git a/ChangeLog b/ChangeLog index 03069e50..9e0802af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-12 Alan Lawrence + + * MacOSX: + * makes the control mode list box (in the preferences pane) non-editable + * fixes keyboard input in the OpenGL implementation. + 2009-03-11 Patrick Welche * Parameters.h: Change DynamicFilter defaults to something more diff --git a/Src/MacOSX/Dasher.xcodeproj/project.pbxproj b/Src/MacOSX/Dasher.xcodeproj/project.pbxproj index c9fc3647..842ebbe3 100755 --- a/Src/MacOSX/Dasher.xcodeproj/project.pbxproj +++ b/Src/MacOSX/Dasher.xcodeproj/project.pbxproj @@ -390,6 +390,8 @@ 33E173E40F3E0B6400D19B38 /* training_swedish_SE.txt in Resources */ = {isa = PBXBuildFile; fileRef = 33E173C40F3E0B6400D19B38 /* training_swedish_SE.txt */; }; 33E173E50F3E0B6400D19B38 /* training_turkish_TR.txt in Resources */ = {isa = PBXBuildFile; fileRef = 33E173C50F3E0B6400D19B38 /* training_turkish_TR.txt */; }; 33E173E60F3E0B6400D19B38 /* training_welsh_GB.txt in Resources */ = {isa = PBXBuildFile; fileRef = 33E173C60F3E0B6400D19B38 /* training_welsh_GB.txt */; }; + 33E91A770F55E60B00B5F513 /* KeyboardHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33E91A750F55E60B00B5F513 /* KeyboardHelper.cpp */; }; + 33E91A780F55E60B00B5F513 /* KeyboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 33E91A760F55E60B00B5F513 /* KeyboardHelper.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -574,66 +576,6 @@ 1974FD9C07145C6500B95DA0 /* Credits.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Credits.html; sourceTree = ""; }; 1974FE7A0714861B00B95DA0 /* Dasher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Dasher.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1974FE7C0714861B00B95DA0 /* Info-Dasher.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Dasher.plist"; sourceTree = SOURCE_ROOT; }; - 19836C1D0C22A7FA00047426 /* Canvas.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Canvas.cpp; sourceTree = ""; }; - 19836C1E0C22A7FA00047426 /* Canvas.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Canvas.h; sourceTree = ""; }; - 19836C1F0C22A7FA00047426 /* CanvasExperimental.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasExperimental.cpp; sourceTree = ""; }; - 19836C200C22A7FA00047426 /* CanvasExperimental.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CanvasExperimental.h; sourceTree = ""; }; - 19836C210C22A7FA00047426 /* custom_marshal.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = custom_marshal.cpp; sourceTree = ""; }; - 19836C220C22A7FA00047426 /* custom_marshal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = custom_marshal.h; sourceTree = ""; }; - 19836C230C22A7FA00047426 /* dasher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher.h; sourceTree = ""; }; - 19836C240C22A7FA00047426 /* dasher_action.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_action.cpp; sourceTree = ""; }; - 19836C250C22A7FA00047426 /* dasher_action.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_action.h; sourceTree = ""; }; - 19836C260C22A7FA00047426 /* dasher_action_keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_action_keyboard.cpp; sourceTree = ""; }; - 19836C270C22A7FA00047426 /* dasher_action_keyboard.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_action_keyboard.h; sourceTree = ""; }; - 19836C280C22A7FA00047426 /* dasher_action_keyboard_maemo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_action_keyboard_maemo.cpp; sourceTree = ""; }; - 19836C290C22A7FA00047426 /* dasher_action_keyboard_maemo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_action_keyboard_maemo.h; sourceTree = ""; }; - 19836C2A0C22A7FA00047426 /* dasher_action_script.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_action_script.cpp; sourceTree = ""; }; - 19836C2B0C22A7FA00047426 /* dasher_action_script.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_action_script.h; sourceTree = ""; }; - 19836C2C0C22A7FA00047426 /* dasher_action_speech.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_action_speech.cpp; sourceTree = ""; }; - 19836C2D0C22A7FA00047426 /* dasher_action_speech.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_action_speech.h; sourceTree = ""; }; - 19836C2E0C22A7FA00047426 /* dasher_buffer_set.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_buffer_set.cpp; sourceTree = ""; }; - 19836C2F0C22A7FA00047426 /* dasher_buffer_set.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_buffer_set.h; sourceTree = ""; }; - 19836C300C22A7FA00047426 /* dasher_editor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_editor.cpp; sourceTree = ""; }; - 19836C310C22A7FA00047426 /* dasher_editor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_editor.h; sourceTree = ""; }; - 19836C320C22A7FA00047426 /* dasher_editor_external.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_editor_external.cpp; sourceTree = ""; }; - 19836C330C22A7FA00047426 /* dasher_editor_external.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_editor_external.h; sourceTree = ""; }; - 19836C340C22A7FA00047426 /* dasher_editor_internal.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_editor_internal.cpp; sourceTree = ""; }; - 19836C350C22A7FA00047426 /* dasher_editor_internal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_editor_internal.h; sourceTree = ""; }; - 19836C360C22A7FA00047426 /* dasher_external_buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_external_buffer.cpp; sourceTree = ""; }; - 19836C370C22A7FA00047426 /* dasher_external_buffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_external_buffer.h; sourceTree = ""; }; - 19836C380C22A7FA00047426 /* dasher_internal_buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_internal_buffer.cpp; sourceTree = ""; }; - 19836C390C22A7FA00047426 /* dasher_internal_buffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_internal_buffer.h; sourceTree = ""; }; - 19836C3A0C22A7FA00047426 /* dasher_lock_dialogue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_lock_dialogue.cpp; sourceTree = ""; }; - 19836C3B0C22A7FA00047426 /* dasher_lock_dialogue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_lock_dialogue.h; sourceTree = ""; }; - 19836C3C0C22A7FA00047426 /* dasher_maemo_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_maemo_helper.cpp; sourceTree = ""; }; - 19836C3D0C22A7FA00047426 /* dasher_maemo_helper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_maemo_helper.h; sourceTree = ""; }; - 19836C3E0C22A7FA00047426 /* dasher_main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dasher_main.cpp; sourceTree = ""; }; - 19836C3F0C22A7FA00047426 /* dasher_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dasher_main.h; sourceTree = ""; }; - 19836C400C22A7FA00047426 /* DasherAppSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DasherAppSettings.cpp; sourceTree = ""; }; - 19836C410C22A7FA00047426 /* DasherAppSettings.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DasherAppSettings.h; sourceTree = ""; }; - 19836C420C22A7FA00047426 /* DasherControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DasherControl.cpp; sourceTree = ""; }; - 19836C430C22A7FA00047426 /* DasherControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DasherControl.h; sourceTree = ""; }; - 19836C440C22A7FA00047426 /* game_mode_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = game_mode_helper.cpp; sourceTree = ""; }; - 19836C450C22A7FA00047426 /* game_mode_helper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = game_mode_helper.h; sourceTree = ""; }; - 19836C460C22A7FA00047426 /* GenerateSchema.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GenerateSchema.cpp; sourceTree = ""; }; - 19836C470C22A7FA00047426 /* gpesettings_store.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = gpesettings_store.cc; sourceTree = ""; }; - 19836C480C22A7FA00047426 /* gpesettings_store.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gpesettings_store.h; sourceTree = ""; }; - 19836C490C22A7FA00047426 /* GtkDasherControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GtkDasherControl.cpp; sourceTree = ""; }; - 19836C4A0C22A7FA00047426 /* GtkDasherControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GtkDasherControl.h; sourceTree = ""; }; - 19836C4B0C22A7FA00047426 /* joystick_input.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = joystick_input.h; sourceTree = ""; }; - 19836C4C0C22A7FA00047426 /* KeyboardHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardHelper.cpp; sourceTree = ""; }; - 19836C4D0C22A7FA00047426 /* KeyboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KeyboardHelper.h; sourceTree = ""; }; - 19836C4E0C22A7FA00047426 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 19836C4F0C22A7FA00047426 /* module_settings_window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = module_settings_window.cpp; sourceTree = ""; }; - 19836C500C22A7FA00047426 /* module_settings_window.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = module_settings_window.h; sourceTree = ""; }; - 19836C510C22A7FA00047426 /* mouse_input.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mouse_input.h; sourceTree = ""; }; - 19836C520C22A7FA00047426 /* PangoCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PangoCache.cpp; sourceTree = ""; }; - 19836C530C22A7FA00047426 /* PangoCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PangoCache.h; sourceTree = ""; }; - 19836C540C22A7FA00047426 /* Preferences.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Preferences.cpp; sourceTree = ""; }; - 19836C550C22A7FA00047426 /* Preferences.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Preferences.h; sourceTree = ""; }; - 19836C560C22A7FA00047426 /* tilt_input.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = tilt_input.h; sourceTree = ""; }; - 19836C570C22A7FA00047426 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = ""; }; - 19836C580C22A7FA00047426 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = ""; }; 1987561F071AFB470034ECCB /* Chatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Chatter.h; sourceTree = ""; }; 19875620071AFB470034ECCB /* Chatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Chatter.m; sourceTree = ""; }; 1988ABB70C9FF97000D97977 /* GameLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GameLevel.cpp; sourceTree = ""; }; @@ -860,6 +802,8 @@ 33E173C40F3E0B6400D19B38 /* training_swedish_SE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = training_swedish_SE.txt; sourceTree = ""; }; 33E173C50F3E0B6400D19B38 /* training_turkish_TR.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = training_turkish_TR.txt; sourceTree = ""; }; 33E173C60F3E0B6400D19B38 /* training_welsh_GB.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = training_welsh_GB.txt; sourceTree = ""; }; + 33E91A750F55E60B00B5F513 /* KeyboardHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardHelper.cpp; sourceTree = ""; }; + 33E91A760F55E60B00B5F513 /* KeyboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyboardHelper.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -909,6 +853,8 @@ 19D4423D04546C410000000A /* PreferencesController.mm */, 198EC7AE07153D6E00474B38 /* KeyboardEvent.h */, 198EC7AF07153D6E00474B38 /* KeyboardEvent.m */, + 33E91A760F55E60B00B5F513 /* KeyboardHelper.h */, + 33E91A750F55E60B00B5F513 /* KeyboardHelper.cpp */, 198EC7B107153D6E00474B38 /* LowLevelKeyboardHandling.h */, 198EC7B007153D6E00474B38 /* LowLevelKeyboardHandling.c */, 198EC7B207153D6E00474B38 /* UnicharGenerator.h */, @@ -1149,74 +1095,6 @@ path = View; sourceTree = ""; }; - 19836C1B0C22A7FA00047426 /* Gtk2 */ = { - isa = PBXGroup; - children = ( - 19836C1D0C22A7FA00047426 /* Canvas.cpp */, - 19836C1E0C22A7FA00047426 /* Canvas.h */, - 19836C1F0C22A7FA00047426 /* CanvasExperimental.cpp */, - 19836C200C22A7FA00047426 /* CanvasExperimental.h */, - 19836C210C22A7FA00047426 /* custom_marshal.cpp */, - 19836C220C22A7FA00047426 /* custom_marshal.h */, - 19836C230C22A7FA00047426 /* dasher.h */, - 19836C240C22A7FA00047426 /* dasher_action.cpp */, - 19836C250C22A7FA00047426 /* dasher_action.h */, - 19836C260C22A7FA00047426 /* dasher_action_keyboard.cpp */, - 19836C270C22A7FA00047426 /* dasher_action_keyboard.h */, - 19836C280C22A7FA00047426 /* dasher_action_keyboard_maemo.cpp */, - 19836C290C22A7FA00047426 /* dasher_action_keyboard_maemo.h */, - 19836C2A0C22A7FA00047426 /* dasher_action_script.cpp */, - 19836C2B0C22A7FA00047426 /* dasher_action_script.h */, - 19836C2C0C22A7FA00047426 /* dasher_action_speech.cpp */, - 19836C2D0C22A7FA00047426 /* dasher_action_speech.h */, - 19836C2E0C22A7FA00047426 /* dasher_buffer_set.cpp */, - 19836C2F0C22A7FA00047426 /* dasher_buffer_set.h */, - 19836C300C22A7FA00047426 /* dasher_editor.cpp */, - 19836C310C22A7FA00047426 /* dasher_editor.h */, - 19836C320C22A7FA00047426 /* dasher_editor_external.cpp */, - 19836C330C22A7FA00047426 /* dasher_editor_external.h */, - 19836C340C22A7FA00047426 /* dasher_editor_internal.cpp */, - 19836C350C22A7FA00047426 /* dasher_editor_internal.h */, - 19836C360C22A7FA00047426 /* dasher_external_buffer.cpp */, - 19836C370C22A7FA00047426 /* dasher_external_buffer.h */, - 19836C380C22A7FA00047426 /* dasher_internal_buffer.cpp */, - 19836C390C22A7FA00047426 /* dasher_internal_buffer.h */, - 19836C3A0C22A7FA00047426 /* dasher_lock_dialogue.cpp */, - 19836C3B0C22A7FA00047426 /* dasher_lock_dialogue.h */, - 19836C3C0C22A7FA00047426 /* dasher_maemo_helper.cpp */, - 19836C3D0C22A7FA00047426 /* dasher_maemo_helper.h */, - 19836C3E0C22A7FA00047426 /* dasher_main.cpp */, - 19836C3F0C22A7FA00047426 /* dasher_main.h */, - 19836C400C22A7FA00047426 /* DasherAppSettings.cpp */, - 19836C410C22A7FA00047426 /* DasherAppSettings.h */, - 19836C420C22A7FA00047426 /* DasherControl.cpp */, - 19836C430C22A7FA00047426 /* DasherControl.h */, - 19836C440C22A7FA00047426 /* game_mode_helper.cpp */, - 19836C450C22A7FA00047426 /* game_mode_helper.h */, - 19836C460C22A7FA00047426 /* GenerateSchema.cpp */, - 19836C470C22A7FA00047426 /* gpesettings_store.cc */, - 19836C480C22A7FA00047426 /* gpesettings_store.h */, - 19836C490C22A7FA00047426 /* GtkDasherControl.cpp */, - 19836C4A0C22A7FA00047426 /* GtkDasherControl.h */, - 19836C4B0C22A7FA00047426 /* joystick_input.h */, - 19836C4C0C22A7FA00047426 /* KeyboardHelper.cpp */, - 19836C4D0C22A7FA00047426 /* KeyboardHelper.h */, - 19836C4E0C22A7FA00047426 /* Makefile.am */, - 19836C4F0C22A7FA00047426 /* module_settings_window.cpp */, - 19836C500C22A7FA00047426 /* module_settings_window.h */, - 19836C510C22A7FA00047426 /* mouse_input.h */, - 19836C520C22A7FA00047426 /* PangoCache.cpp */, - 19836C530C22A7FA00047426 /* PangoCache.h */, - 19836C540C22A7FA00047426 /* Preferences.cpp */, - 19836C550C22A7FA00047426 /* Preferences.h */, - 19836C560C22A7FA00047426 /* tilt_input.h */, - 19836C570C22A7FA00047426 /* Timer.cpp */, - 19836C580C22A7FA00047426 /* Timer.h */, - ); - name = Gtk2; - path = ../Gtk2; - sourceTree = SOURCE_ROOT; - }; 19BEF2CD0C228F7300275D06 /* alphabets */ = { isa = PBXGroup; children = ( @@ -1417,7 +1295,6 @@ 19351BF304575C6C0000000A /* mktar.sh */, 190697550492B65B0000000A /* ReadmeDeveloper.txt */, 190697530492AACE0000000A /* Readme.html */, - 19836C1B0C22A7FA00047426 /* Gtk2 */, 19BEF4180C22922400275D06 /* controllabels */, 19BEF3FC0C2291CE00275D06 /* colours */, 19BEF2CD0C228F7300275D06 /* alphabets */, @@ -1612,6 +1489,7 @@ 1988ABBD0C9FF97000D97977 /* GameMessages.h in Headers */, 1988ABBE0C9FF97000D97977 /* GameStatistics.h in Headers */, 1988ABC00C9FF97000D97977 /* PinyinParser.h in Headers */, + 33E91A780F55E60B00B5F513 /* KeyboardHelper.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1955,6 +1833,7 @@ 19F8C7F90C858E9900276B4F /* TrainingHelper.cpp in Sources */, 1988ABBF0C9FF97000D97977 /* PinyinParser.cpp in Sources */, 1988ABCF0C9FFADA00D97977 /* GameLevel.cpp in Sources */, + 33E91A770F55E60B00B5F513 /* KeyboardHelper.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Src/MacOSX/DasherViewOpenGL.h b/Src/MacOSX/DasherViewOpenGL.h index bce7845d..353d2819 100755 --- a/Src/MacOSX/DasherViewOpenGL.h +++ b/Src/MacOSX/DasherViewOpenGL.h @@ -14,6 +14,7 @@ #import "AlphabetLetter.h" #import "ColourIO.h" #import "DasherViewCocoa.h" +#import "KeyboardHelper.h" @class NSColor, NSTimer, NSTextField, NSString, NSMutableDictionary; @class NSBezierPath; @@ -48,7 +49,7 @@ typedef struct { colour_t *colourTable; NSMutableDictionary *_letterDict; - + CKeyboardHelper *_keyboardHelper; } @@ -61,6 +62,7 @@ typedef struct { - (void)mouseDown:(NSEvent *)e; - (void)mouseUp:(NSEvent *)e; - (void)keyDown:(NSEvent *)e; +- (void)keyUp:(NSEvent *)e; - (void)circleCallbackCentrePoint:(NSPoint)aCentrePoint radius:(float)aRadius outlineColorIndex:(int)anOutlineColorIndex fillColourIndex:(int)aFillColourIndex shouldFill:(BOOL)shouldFill lineWidth:(int)aLineWidth; - (void)rectangleCallbackX1:(int)x1 y1:(int)y1 x2:(int)x2 y2:(int)y2 fillColorIndex:(int)aFillColorIndex outlineColorIndex:(int)anOutlineColorIndex shouldOutline:(BOOL)shouldOutline shouldFill:(BOOL)shouldFill lineWidth:(int)aLineWidth; - (AlphabetLetter *)letterForString:(NSString *)aString; @@ -73,7 +75,6 @@ typedef struct { - (void)adjustTrackingRect; - (BOOL)isFlipped; - (BOOL)isOpaque; -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; - (void)awakeFromNib; - (void)finishRealization; - (COSXDasherScreen *)aquaDasherScreen; diff --git a/Src/MacOSX/DasherViewOpenGL.mm b/Src/MacOSX/DasherViewOpenGL.mm index fba77951..ca6d0ecf 100755 --- a/Src/MacOSX/DasherViewOpenGL.mm +++ b/Src/MacOSX/DasherViewOpenGL.mm @@ -104,6 +104,25 @@ - (void)keyDown:(NSEvent *)e { + /*TODO, note that this isn't really "key down", rather it's "character entered" + or similar - if the key is held down long enough to repeat, we get multiple keyDowns + before a keyUp, and we just send them all along to the DasherCore code...*/ + NSString *chars = [e characters]; + if ([chars length] > 1) + NSLog(@"KeyDown event for %i chars %@ - what to do? Ignoring all but first...\n", [chars length], chars); + int keyCode = _keyboardHelper->ConvertKeyCode([chars characterAtIndex:0]); + if (keyCode != -1) + [dasherApp aquaDasherControl]->KeyDown(get_time(), keyCode); +} + +- (void)keyUp:(NSEvent *)e +{ + NSString *chars = [e characters]; + if ([chars length] > 1) + NSLog(@"KeyUp event for %i chars %@ - what to do? Ignoring all but first...\n", [chars length], chars); + int keyCode = _keyboardHelper->ConvertKeyCode([chars characterAtIndex:0]); + if (keyCode != -1) + [dasherApp aquaDasherControl]->KeyUp(get_time(), keyCode); } - (void)circleCallbackCentrePoint:(NSPoint)aCentrePoint radius:(float)aRadius outlineColorIndex:(int)anOutlineColorIndex fillColourIndex:(int)aFillColourIndex shouldFill:(BOOL)shouldFill lineWidth:(int)aLineWidth { @@ -245,6 +264,7 @@ [self blankCallback]; } + _keyboardHelper = new CKeyboardHelper(); return self; } @@ -279,11 +299,6 @@ return YES; } -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent -{ - return YES; -} - - (void)awakeFromNib { // aquaDasherScreen = new COSXDasherScreen(self); @@ -305,7 +320,7 @@ - (BOOL)acceptsFirstResponder { - return NO; + return YES; } diff --git a/Src/MacOSX/English.lproj/Preferences.nib/classes.nib b/Src/MacOSX/English.lproj/Preferences.nib/classes.nib dissimilarity index 100% index 934c22b1..99f677d0 100644 --- a/Src/MacOSX/English.lproj/Preferences.nib/classes.nib +++ b/Src/MacOSX/English.lproj/Preferences.nib/classes.nib @@ -1,12 +1,37 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - CLASS = PreferencesController; - LANGUAGE = ObjC; - OUTLETS = {panel = NSPanel; }; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -} \ No newline at end of file + + + + + IBClasses + + + ACTIONS + + makeKeyAndOrderFront + id + + CLASS + PreferencesController + LANGUAGE + ObjC + OUTLETS + + panel + NSPanel + + SUPERCLASS + NSObject + + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + diff --git a/Src/MacOSX/English.lproj/Preferences.nib/info.nib b/Src/MacOSX/English.lproj/Preferences.nib/info.nib index d4f4014a..2df8a87b 100644 --- a/Src/MacOSX/English.lproj/Preferences.nib/info.nib +++ b/Src/MacOSX/English.lproj/Preferences.nib/info.nib @@ -1,16 +1,20 @@ - + - IBDocumentLocation - 63 445 356 240 0 0 1680 1028 IBFramework Version - 482.0 + 677 + IBLastKnownRelativeProjectPath + ../Dasher.xcodeproj + IBOldestOS + 5 IBOpenObjects - 14 + 660 IBSystem Version - 8R218 + 9G55 + targetFramework + IBCocoaFramework diff --git a/Src/MacOSX/KeyboardHelper.cpp b/Src/MacOSX/KeyboardHelper.cpp new file mode 100644 index 00000000..9dd9b3f0 --- /dev/null +++ b/Src/MacOSX/KeyboardHelper.cpp @@ -0,0 +1,73 @@ +#include "KeyboardHelper.h" +#define KEYCODE_UP 63232 +#define KEYCODE_DOWN 63233 +#define KEYCODE_LEFT 63233 +#define KEYCODE_RIGHT 63234 + +/* TODO: This file essentially the same as the Win32 code - 'twas copied from there, and + only very slightly modified. Even the Win32 code contained the comment: +// TODO: This is essentially the same as the GTK code - should probably share them a little more + so we should really combine all three--- + i.e. put some kind of KeyboardHelper into DasherCore, or refactor interpretation of keycodes. +*/ + +CKeyboardHelper::CKeyboardHelper() { + // TODO: Hard code the mappings for now (slightly differently to Win32!) + + // 1 = E + // 2 = N + // 3 = W + // 4 = S + + // Left of keyboard + + m_mTable['a'] = m_mTable['A'] = 1; //a + m_mTable['s'] = m_mTable['S'] = 3; // s + m_mTable['w'] = m_mTable['W'] = 2;// w + m_mTable['z'] = m_mTable['Z'] = 4;// z + + // Right of keyboard + + m_mTable['j'] = m_mTable['J'] = 1; //a + m_mTable['k'] = m_mTable['K'] = 3; // s + m_mTable['i'] = m_mTable['I'] = 2;// w + m_mTable['m'] = m_mTable['M'] = 4;// z +/* m_mTable[0x4a] = 1; // j + m_mTable[0x4b] = 3; // k + m_mTable[0x49] = 2; // i + m_mTable[0x4d] = 4; // m +*/ + // Arrows + + m_mTable[KEYCODE_LEFT] = 1; + m_mTable[KEYCODE_RIGHT] = 3; + m_mTable[KEYCODE_UP] = 2; + m_mTable[KEYCODE_DOWN] = 4; + + // Arrows on numeric keypad + //TODO, don't have one on my MacBook, so not sure what codes to use! + /*m_mTable[VK_NUMPAD4] = 1; + m_mTable[VK_NUMPAD6] = 3; + m_mTable[VK_NUMPAD8] = 2; + m_mTable[VK_NUMPAD2] = 4;*/ + + // Numbers + + m_mTable[0x31] = 1; // 11 + m_mTable[0x32] = 2; // 2 + m_mTable[0x33] = 3; // 3 + m_mTable[0x34] = 4; // 4 + + // 0 = keyboard start/stop + + m_mTable[' '] = 0; +} + +int CKeyboardHelper::ConvertKeyCode(int iCode) { + std::map::iterator it(m_mTable.find(iCode)); + + if(it == m_mTable.end()) + return -1; + else + return it->second; +} \ No newline at end of file diff --git a/Src/MacOSX/KeyboardHelper.h b/Src/MacOSX/KeyboardHelper.h new file mode 100644 index 00000000..6c62cce8 --- /dev/null +++ b/Src/MacOSX/KeyboardHelper.h @@ -0,0 +1,15 @@ +#ifndef __KEYBOARD_HELPER_H__ +#define __KEYBOARD_HELPER_H__ + +#include + +class CKeyboardHelper { +public: + CKeyboardHelper(); + int ConvertKeyCode(int iCode); + +private: + std::map m_mTable; +}; + +#endif \ No newline at end of file -- 2.11.4.GIT