From c75a6b31c688efae4b1b1f3025edb615e5c29eef Mon Sep 17 00:00:00 2001 From: divverent Date: Wed, 7 Jan 2009 08:37:33 +0000 Subject: [PATCH] new toys :P git-svn-id: svn://svn.icculus.org/netradiant/trunk@153 61c419a2-8eb2-4b30-bcec-8cead039b335 --- ChangeLog | 20 +++++++++ libs/gtkutil/accelerator.cpp | 87 ++++++------------------------------ radiant/commands.cpp | 19 +++----- 3 files changed, 39 insertions(+), 87 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0661ebf0..fb149be7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2009-01-07 Rudolf Polzer divVerent(at)alientrap.org + * radiant: handle ALL key binds properly using GDK methods + +2009-01-03 Rudolf Polzer divVerent(at)alientrap.org + * radiant: fix the translation of entities used by mirroring or scaling + +2009-01-02 Rudolf Polzer divVerent(at)alientrap.org + * radiant: command "regroup entities", allows moving brushes in/out of + entities + +2009-01-01 Rudolf Polzer divVerent(at)alientrap.org + * radiant: "clone selection" no longer changes targetnames by default. + Hold shift while pressing space to do change them as before. + * all: handle "origin" keys for brush entities (more consistency, should + break no maps) + +2008-12-10 Rudolf Polzer divVerent(at)alientrap.org + * radiant: properly handle the [ and ] keys on german layout + * q3map2: fix dotProduct2scale to match the documentation + 2008-11-28 Rudolf Polzer divVerent(at)alientrap.org * q3map2: -dirty: don't treat skybox surfaces as solid for dirtmapping; prevents Quake 2-ish "dark near skybox" effect. diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index 0228a1be..49da674c 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -39,85 +39,26 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -struct SKeyInfo -{ - const char* m_strName; - unsigned int m_nVKKey; -}; - -SKeyInfo g_Keys[] = -{ - {"Space", GDK_space}, - {"Backspace", GDK_BackSpace}, - {"Escape", GDK_Escape}, - {"End", GDK_End}, - {"Insert", GDK_Insert}, - {"Delete", GDK_Delete}, - {"PageUp", GDK_Prior}, - {"PageDown", GDK_Next}, - {"Up", GDK_Up}, - {"Down", GDK_Down}, - {"Left", GDK_Left}, - {"Right", GDK_Right}, - {"F1", GDK_F1}, - {"F2", GDK_F2}, - {"F3", GDK_F3}, - {"F4", GDK_F4}, - {"F5", GDK_F5}, - {"F6", GDK_F6}, - {"F7", GDK_F7}, - {"F8", GDK_F8}, - {"F9", GDK_F9}, - {"F10", GDK_F10}, - {"F11", GDK_F11}, - {"F12", GDK_F12}, - {"Tab", GDK_Tab}, - {"Return", GDK_Return}, - {"Comma", GDK_comma}, - {"Period", GDK_period}, - {"Plus", GDK_KP_Add}, - {"Multiply", GDK_multiply}, - {"Minus", GDK_KP_Subtract}, - {"NumPad0", GDK_KP_0}, - {"NumPad1", GDK_KP_1}, - {"NumPad2", GDK_KP_2}, - {"NumPad3", GDK_KP_3}, - {"NumPad4", GDK_KP_4}, - {"NumPad5", GDK_KP_5}, - {"NumPad6", GDK_KP_6}, - {"NumPad7", GDK_KP_7}, - {"NumPad8", GDK_KP_8}, - {"NumPad9", GDK_KP_9}, - {"[", GDK_bracketleft}, - {"]", GDK_bracketright}, - {"\\", 220}, - {"Home", GDK_Home} -}; - -int g_nKeyCount = sizeof(g_Keys) / sizeof(SKeyInfo); - const char* global_keys_find(unsigned int key) { - for(int i = 0; i < g_nKeyCount; ++i) - { - if(g_Keys[i].m_nVKKey == key) - { - return g_Keys[i].m_strName; - } - } - return ""; + const char *s; + if(key == 0) + return ""; + s = gdk_keyval_name(key); + if(!s) + return ""; + return s; } unsigned int global_keys_find(const char* name) { - for(int i = 0; i < g_nKeyCount; ++i) - { - if(string_equal_nocase(g_Keys[i].m_strName, name)) - { - return g_Keys[i].m_nVKKey; - } - } - return 0; + guint k; + if(!name || !*name) + return 0; + k = gdk_keyval_from_name(name); + if(k == GDK_VoidSymbol) + return 0; + return k; } void accelerator_write(const Accelerator& accelerator, TextOutputStream& ostream) diff --git a/radiant/commands.cpp b/radiant/commands.cpp index 03daeea5..448fae57 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -272,10 +272,6 @@ void SaveCommandMap(const char* path) { m_file << key; } - else if(accelerator.key != 0) - { - m_file << gdk_keyval_name(accelerator.key); - } if(accelerator.modifiers & GDK_MOD1_MASK) { @@ -357,15 +353,6 @@ public: accelerator.modifiers = (GdkModifierType)modifiers; - // strBuff has been cleaned of it's modifiers .. switch between a regular key and a virtual one - // based on length - if(keyEnd - value == 1 && std::isalnum(value[0])) // most often case.. deal with first - { - accelerator.key = std::toupper(value[0]); - ++m_count; - } - else // special key - { CopiedString keyName(StringRange(value, keyEnd)); accelerator.key = global_keys_find(keyName.c_str()); if(accelerator.key != 0) @@ -376,7 +363,11 @@ public: { globalOutputStream() << "WARNING: failed to parse user command " << makeQuoted(value) << ": unknown key " << makeQuoted(keyName.c_str()) << "\n"; } - } + + accelerator.key = gdk_keyval_from_name(CopiedString(StringRange(value, keyEnd)).c_str()); + if(accelerator.key == GDK_VoidSymbol) + accelerator.key = 0; + } } std::size_t count() const -- 2.39.2