diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2012-01-26 11:00:31 +0100 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2012-01-27 12:42:27 +0100 |
commit | 2233aa52da14ec85331aee1163b885fe9a9fb507 (patch) | |
tree | 27ad302c05bf95d85186b705a2784f6a342cb34d /vcl/unx/generic/app/keysymnames.cxx | |
parent | f3c1af57010033c40bfda0711cce7b83e2afdf51 (diff) |
keysymnames: get rid of some insanity
getKeysymReplacementName() returned a translated keyname, now
XKeysymToString() is called directly. This change had no negative
effect to me. I tried it with a fixed string as return value for
getKeysymReplacementName() on a german interface. INSRT is still
translated to EINFG as this is done by po files.
Diffstat (limited to 'vcl/unx/generic/app/keysymnames.cxx')
-rw-r--r-- | vcl/unx/generic/app/keysymnames.cxx | 364 |
1 files changed, 0 insertions, 364 deletions
diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index 45690918e5a1..ce6a7e721423 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -64,370 +64,6 @@ #include <string.h> -namespace vcl_sal { - - struct KeysymNameReplacement - { - KeySym aSymbol; - const char* pName; - }; - - struct KeyboardReplacements - { - const char* pKeyboardName; - const KeysymNameReplacement* pReplacements; - int nReplacements; - }; - - // ==================================================================== - // - // CAUTION CAUTION CAUTION - // every string value in the replacements tables must be in UTF8 - // be careful with your editor ! - // - // ==================================================================== - - static const struct KeysymNameReplacement aImplReplacements_English[] = - { - { XK_Control_L, "Ctrl" }, - { XK_Control_R, "Ctrl" }, - { XK_Escape, "Esc" }, - { XK_space, "Space" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Turkish[] = - { - { XK_Control_L, "Ctrl" }, - { XK_Control_R, "Ctrl" }, - { XK_Right, "Sağ" }, - { XK_Left, "Sol" }, - { XK_Up, "Yukarı" }, - { XK_Down, "Aşağı" }, - { XK_space, "Boşluk" } - }; - - static const struct KeysymNameReplacement aImplReplacements_Russian[] = - { - { XK_Right, "Вправо" }, - { XK_Left, "Влево" }, - { XK_Up, "Вверх" }, - { XK_Down, "Вниз" }, - { XK_space, "Пробел" } - }; - - static const struct KeysymNameReplacement aImplReplacements_German[] = - { - { XK_Control_L, "Strg" }, - { XK_Control_R, "Strg" }, - { XK_Shift_L, "Umschalt" }, - { XK_Shift_R, "Umschalt" }, - { XK_Alt_L, "Alt" }, - { XK_Alt_R, "Alt Gr" }, - { XK_Page_Up, "Bild auf" }, - { XK_Page_Down, "Bild ab" }, - { XK_End, "Ende" }, - { XK_Home, "Pos 1" }, - { XK_Insert, "Einfg" }, - { XK_Delete, "Entf" }, - { XK_Escape, "Esc" }, - { XK_Right, "Rechts" }, - { XK_Left, "Links" }, - { XK_Up, "Oben" }, - { XK_Down, "Unten" }, - { XK_BackSpace, "Rückschritt" }, - { XK_Return, "Eingabe" }, - { XK_slash, "Schrägstrich" }, - { XK_space, "Leertaste" }, - { SunXK_Stop, "Stop" }, - { SunXK_Again, "Wiederholen" }, - { SunXK_Props, "Eigenschaften" }, - { SunXK_Undo, "Zurücknehmen" }, - { SunXK_Front, "Vordergrund" }, - { SunXK_Copy, "Kopieren" }, - { SunXK_Open, "Öffnen" }, - { SunXK_Paste, "Einsetzen" }, - { SunXK_Find, "Suchen" }, - { SunXK_Cut, "Ausschneiden" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_French[] = - { - { XK_Shift_L, "Maj" }, - { XK_Shift_R, "Maj" }, - { XK_Page_Up, "Pg. Préc" }, - { XK_Page_Down, "Pg. Suiv" }, - { XK_End, "Fin" }, - { XK_Home, "Origine" }, - { XK_Insert, "Insérer" }, - { XK_Delete, "Suppr" }, - { XK_Escape, "Esc" }, - { XK_Right, "Droite" }, - { XK_Left, "Gauche" }, - { XK_Up, "Haut" }, - { XK_Down, "Bas" }, - { XK_BackSpace, "Ret. Arr" }, - { XK_Return, "Retour" }, - { XK_KP_Enter, "Entrée" }, - { SunXK_Stop, "Stop" }, - { SunXK_Again, "Encore" }, - { SunXK_Props, "Props" }, - { SunXK_Undo, "Annuler" }, - { SunXK_Front, "Devant" }, - { SunXK_Copy, "Copy" }, - { SunXK_Open, "Ouvrir" }, - { SunXK_Paste, "Coller" }, - { SunXK_Find, "Cher." }, - { SunXK_Cut, "Couper" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Italian[] = - { - { XK_Shift_L, "Maiusc" }, - { XK_Shift_R, "Maiusc" }, - { XK_Page_Up, "PgSu" }, - { XK_Page_Down, "PgGiu" }, - { XK_End, "Fine" }, - { XK_Insert, "Ins" }, - { XK_Delete, "Canc" }, - { XK_Escape, "Esc" }, - { XK_Right, "A destra" }, - { XK_Left, "A sinistra" }, - { XK_Up, "Sposta verso l'alto" }, - { XK_Down, "Sposta verso il basso" }, - { XK_BackSpace, "Backspace" }, - { XK_Return, "Invio" }, - { XK_space, "Spazio" }, - { SunXK_Stop, "Stop" }, - { SunXK_Again, "Ancora" }, - { SunXK_Props, "Proprietà" }, - { SunXK_Undo, "Annulla" }, - { SunXK_Front, "Davanti" }, - { SunXK_Copy, "Copia" }, - { SunXK_Open, "Apri" }, - { SunXK_Paste, "Incolla" }, - { SunXK_Find, "Trova" }, - { SunXK_Cut, "Taglia" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Dutch[] = - { - { XK_Page_Up, "PageUp" }, - { XK_Page_Down, "PageDown" }, - { XK_Escape, "Esc" }, - { XK_Right, "Rechts" }, - { XK_Left, "Links" }, - { XK_Up, "Boven" }, - { XK_Down, "Onder" }, - { XK_BackSpace, "Backspace" }, - { XK_Return, "Return" }, - { XK_space, "Spatiebalk" }, - { SunXK_Stop, "Stop" }, - { SunXK_Again, "Again" }, - { SunXK_Props, "Props" }, - { SunXK_Undo, "Undo" }, - { SunXK_Front, "Front" }, - { SunXK_Copy, "Copy" }, - { SunXK_Open, "Open" }, - { SunXK_Paste, "Paste" }, - { SunXK_Find, "Find" }, - { SunXK_Cut, "Cut" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Norwegian[] = - { - { XK_Shift_L, "Skift" }, - { XK_Shift_R, "Skift" }, - { XK_Page_Up, "PageUp" }, - { XK_Page_Down, "PageDown" }, - { XK_Escape, "Esc" }, - { XK_Right, "Hyre" }, - { XK_Left, "Venstre" }, - { XK_Up, "Opp" }, - { XK_Down, "Ned" }, - { XK_BackSpace, "Tilbake" }, - { XK_Return, "Enter" }, - { SunXK_Stop, "Avbryt" }, - { SunXK_Again, "Gjenta" }, - { SunXK_Props, "Egenskaper" }, - { SunXK_Undo, "Angre" }, - { SunXK_Front, "Front" }, - { SunXK_Copy, "Kopi" }, - { SunXK_Open, "Åpne" }, - { SunXK_Paste, "Lim" }, - { SunXK_Find, "Søk" }, - { SunXK_Cut, "Klipp" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Swedish[] = - { - { XK_Shift_L, "Skift" }, - { XK_Shift_R, "Skift" }, - { XK_Page_Up, "PageUp" }, - { XK_Page_Down, "PageDown" }, - { XK_Escape, "Esc" }, - { XK_Right, "Höger" }, - { XK_Left, "Vänster" }, - { XK_Up, "Up" }, - { XK_Down, "Ned" }, - { XK_BackSpace, "Backsteg" }, - { XK_Return, "Retur" }, - { XK_space, "Blank" }, - { SunXK_Stop, "Avbryt" }, - { SunXK_Again, "Upprepa" }, - { SunXK_Props, "Egenskaper" }, - { SunXK_Undo, "Ångra" }, - { SunXK_Front, "Fram" }, - { SunXK_Copy, "Kopiera" }, - { SunXK_Open, "Öppna" }, - { SunXK_Paste, "Klistra in" }, - { SunXK_Find, "Sök" }, - { SunXK_Cut, "Klipp ut" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Portuguese[] = - { - { XK_Page_Up, "PageUp" }, - { XK_Page_Down, "PageDown" }, - { XK_Escape, "Esc" }, - { XK_Right, "Direita" }, - { XK_Left, "Esquerda" }, - { XK_Up, "Acima" }, - { XK_Down, "Abaixo" }, - { XK_BackSpace, "Backspace" }, - { XK_Return, "Enter" }, - { XK_slash, "Barra" }, - { SunXK_Stop, "Stop" }, - { SunXK_Again, "Again" }, - { SunXK_Props, "Props" }, - { SunXK_Undo, "Undo" }, - { SunXK_Front, "Front" }, - { SunXK_Copy, "Copy" }, - { SunXK_Open, "Open" }, - { SunXK_Paste, "Paste" }, - { SunXK_Find, "Find" }, - { SunXK_Cut, "Cut" }, - }; - - static const struct KeysymNameReplacement aImplReplacements_Spanish[] = - { - { XK_Shift_L, "Mayús" }, - { XK_Shift_R, "Mayús" }, - { XK_Page_Up, "RePág" }, - { XK_Page_Down, "AvPág" }, - { XK_End, "Fin" }, - { XK_Home, "Inicio" }, - { XK_Delete, "Supr" }, - { XK_Escape, "Esc" }, - { XK_Right, "Hacia la derecha" }, - { XK_Left, "Hacia la izquierda" }, - { XK_Up, "Hacia arriba" }, - { XK_Down, "Hacia abajo" }, - { XK_BackSpace, "Ret" }, - { XK_Return, "Entrada" }, - { XK_space, "Espacio" }, - { XK_KP_Enter, "Intro" }, - { SunXK_Stop, "Stop" }, - { SunXK_Again, "Repetir" }, - { SunXK_Props, "Props" }, - { SunXK_Undo, "Anular" }, - { SunXK_Front, "Delante" }, - { SunXK_Copy, "Copiar" }, - { SunXK_Open, "Abrir" }, - { SunXK_Paste, "Pegar" }, - { SunXK_Find, "Buscar" }, - { SunXK_Cut, "Cortar" }, - }; - - static const struct KeyboardReplacements aKeyboards[] = - { -#ifdef SOLARIS - { "Germany5", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, - { "Germany4", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, - { "France5", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, - { "France6", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, - { "France_x86", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, - { "Italy5", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, - { "Italy5-Hobo", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, - { "Italy4", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, - { "Italy6", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, - { "Italy_x86", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, - { "Netherland4", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - { "Netherland5", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - { "Netherland5-Hobo", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - { "Netherland6", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - { "Netherland_x86", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - { "Norway5", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, - { "Norway5-Hobo", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, - { "Norway4", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, - { "Norway6", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, - { "Norway_x86", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, - { "Portugal5", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, - { "Portugal5-Hobo", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, - { "Portugal4", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, - { "Portugal6", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, - { "Portugal_x86", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, - { "Spain5", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - { "Spain5-Hobo", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - { "Spain4", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - { "Spain6", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - { "Spain_x86", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - { "Sweden5", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, - { "Sweden5-Hobo", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, - { "Sweden4", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, - { "Sweden6", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, - { "Sweden_x86", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, -#endif - { "U.S. English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }, - { "United Kingdom", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }, - // Germany, German - { "German", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) }, - { "France", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, - { "French", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) }, - // Italy, Italian - { "Ital", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) }, - // Norway, Norwegian - { "Norw", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) }, - // Portugal, Portuguese - { "Portu", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) }, - { "Spain", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - { "Spanish", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) }, - // Sweden, Swedish - { "Swed", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) }, - { "Netherland", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - { "Dutch", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) }, - // Turkish, Turkey - { "Turk", aImplReplacements_Turkish, SAL_N_ELEMENTS(aImplReplacements_Turkish) }, - // Russian, Russia - { "Russia", aImplReplacements_Russian, SAL_N_ELEMENTS(aImplReplacements_Russian) }, - { "English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) } - }; - - rtl::OUString getKeysymReplacementName( const char* pKeyboard, KeySym nSymbol ) - { - for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ ) - { - if( ! strncasecmp( pKeyboard, aKeyboards[n].pKeyboardName, strlen( aKeyboards[n].pKeyboardName ) ) ) - { - const struct KeysymNameReplacement* pRepl = aKeyboards[n].pReplacements; - for( int m = aKeyboards[n].nReplacements ; m ; ) - { - if( nSymbol == pRepl[--m].aSymbol ) - return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 ); - } - } - } - // try english fallbacks - const struct KeysymNameReplacement* pRepl = aImplReplacements_English; - for( int m = SAL_N_ELEMENTS(aImplReplacements_English); m ; ) - { - if( nSymbol == pRepl[--m].aSymbol ) - return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 ); - } - return rtl::OUString(); - } - -} - #ifdef SOLARIS typedef struct { int n_layout; |