made the keyboard shortcuts case-insensitive (part of #1617)

This commit is contained in:
fgerlits 2006-02-17 13:20:28 +00:00
parent a8e7bf1931
commit 451fa4f1c8
5 changed files with 8 additions and 18 deletions

View file

@ -344,23 +344,19 @@
<windowName>masterPanelWindow</windowName> <windowName>masterPanelWindow</windowName>
<keyboardShortcut> <keyboardShortcut>
<action>playAudio</action> <action>playAudio</action>
<key>x</key>
<key>X</key> <key>X</key>
<key>Space</key> <key>Space</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>pauseAudio</action> <action>pauseAudio</action>
<key>v</key>
<key>V</key> <key>V</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>stopAudio</action> <action>stopAudio</action>
<key>c</key>
<key>C</key> <key>C</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>nextTrack</action> <action>nextTrack</action>
<key>b</key>
<key>B</key> <key>B</key>
</keyboardShortcut> </keyboardShortcut>
</keyboardShortcutContainer> </keyboardShortcutContainer>
@ -381,7 +377,6 @@
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>playAudio</action> <action>playAudio</action>
<key>x</key>
<key>X</key> <key>X</key>
<key>Space</key> <key>Space</key>
</keyboardShortcut> </keyboardShortcut>

View file

@ -344,23 +344,19 @@
<windowName>masterPanelWindow</windowName> <windowName>masterPanelWindow</windowName>
<keyboardShortcut> <keyboardShortcut>
<action>playAudio</action> <action>playAudio</action>
<key>x</key>
<key>X</key> <key>X</key>
<key>Space</key> <key>Space</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>pauseAudio</action> <action>pauseAudio</action>
<key>v</key>
<key>V</key> <key>V</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>stopAudio</action> <action>stopAudio</action>
<key>c</key>
<key>C</key> <key>C</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>nextTrack</action> <action>nextTrack</action>
<key>b</key>
<key>B</key> <key>B</key>
</keyboardShortcut> </keyboardShortcut>
</keyboardShortcutContainer> </keyboardShortcutContainer>
@ -381,7 +377,6 @@
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>playAudio</action> <action>playAudio</action>
<key>x</key>
<key>X</key> <key>X</key>
<key>Space</key> <key>Space</key>
</keyboardShortcut> </keyboardShortcut>

View file

@ -344,23 +344,19 @@
<windowName>masterPanelWindow</windowName> <windowName>masterPanelWindow</windowName>
<keyboardShortcut> <keyboardShortcut>
<action>playAudio</action> <action>playAudio</action>
<key>x</key>
<key>X</key> <key>X</key>
<key>Space</key> <key>Space</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>pauseAudio</action> <action>pauseAudio</action>
<key>v</key>
<key>V</key> <key>V</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>stopAudio</action> <action>stopAudio</action>
<key>c</key>
<key>C</key> <key>C</key>
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>nextTrack</action> <action>nextTrack</action>
<key>b</key>
<key>B</key> <key>B</key>
</keyboardShortcut> </keyboardShortcut>
</keyboardShortcutContainer> </keyboardShortcutContainer>
@ -381,7 +377,6 @@
</keyboardShortcut> </keyboardShortcut>
<keyboardShortcut> <keyboardShortcut>
<action>playAudio</action> <action>playAudio</action>
<key>x</key>
<key>X</key> <key>X</key>
<key>Space</key> <key>Space</key>
</keyboardShortcut> </keyboardShortcut>

View file

@ -113,7 +113,7 @@ KeyboardShortcut :: addKey(unsigned int modifiers,
unsigned int key) throw () unsigned int key) throw ()
{ {
modifierList.push_back(modifiers); modifierList.push_back(modifiers);
keyList.push_back(key); keyList.push_back(gdk_keyval_to_upper(key));
} }
@ -186,11 +186,14 @@ bool
KeyboardShortcut :: isTriggeredBy(unsigned int modifiers, KeyboardShortcut :: isTriggeredBy(unsigned int modifiers,
unsigned int key) const throw () unsigned int key) const throw ()
{ {
unsigned int myKey = gdk_keyval_to_upper(key);
unsigned int myModifiers = modifiers & modifiersChecked;
KeyListType::const_iterator modifierIt = modifierList.begin(); KeyListType::const_iterator modifierIt = modifierList.begin();
KeyListType::const_iterator keyIt = keyList.begin(); KeyListType::const_iterator keyIt = keyList.begin();
while (keyIt != keyList.end()) { while (keyIt != keyList.end()) {
if (*modifierIt == (modifiers & modifiersChecked) && *keyIt == key) { if (*modifierIt == myModifiers && *keyIt == myKey) {
return true; return true;
} }
++modifierIt; ++modifierIt;

View file

@ -44,6 +44,7 @@
#include <vector> #include <vector>
#include <gdk/gdktypes.h> #include <gdk/gdktypes.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include <gdk/gdkkeys.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/Configurable.h" #include "LiveSupport/Core/Configurable.h"
@ -82,7 +83,8 @@ using namespace LiveSupport::Core;
* *
* The possible action values are the members of the Action enumeration. * The possible action values are the members of the Action enumeration.
* *
* The possible key values are the letters a-z, A-Z, the numbers 0-9, * The possible key values are the letters A-Z (or a-z; they are not
* case-sensitive), the numbers 0-9,
* plus Space, Esc (or Escape), Tab, Backspace, Delete (Del), Home, End, * plus Space, Esc (or Escape), Tab, Backspace, Delete (Del), Home, End,
* Up, Down, Left, Right, PgUp (PageUp), PgDown (PageDown, PgDn), * Up, Down, Left, Right, PgUp (PageUp), PgDown (PageDown, PgDn),
* and the function keys F1 through F12. * and the function keys F1 through F12.