|
Last change
on this file was
287,
checked in by westram, 24 years ago
|
|
* empty log message *
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
2.7 KB
|
| Line | |
|---|
| 1 | // ==================================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : AWT_hotkeys.cxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // Time-stamp: <Sat Aug/18/2001 13:21 MET Coder@ReallySoft.de> // |
|---|
| 6 | // // |
|---|
| 7 | // // |
|---|
| 8 | // Coded by Ralf Westram (coder@reallysoft.de) in August 2001 // |
|---|
| 9 | // Copyright Department of Microbiology (Technical University Munich) // |
|---|
| 10 | // // |
|---|
| 11 | // Visit our web site at: http://www.arb-home.de/ // |
|---|
| 12 | // // |
|---|
| 13 | // // |
|---|
| 14 | // ==================================================================== // |
|---|
| 15 | |
|---|
| 16 | #include "awt_hotkeys.hxx" |
|---|
| 17 | #include <ctype.h> |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | using namespace std; |
|---|
| 21 | |
|---|
| 22 | // ----------------------------------------------------- |
|---|
| 23 | // const char* awt_hotkeys::artifical_hotkey() |
|---|
| 24 | // ----------------------------------------------------- |
|---|
| 25 | const char* awt_hotkeys::artifical_hotkey() { |
|---|
| 26 | if (artifical <= '9') { |
|---|
| 27 | current[0] = artifical++; |
|---|
| 28 | } |
|---|
| 29 | else { |
|---|
| 30 | int i; |
|---|
| 31 | for (i = 25; i >= 0; --i) { |
|---|
| 32 | if (!used[i]) { |
|---|
| 33 | current[0] = 'a'+i; |
|---|
| 34 | used[i] = true; |
|---|
| 35 | break; |
|---|
| 36 | } |
|---|
| 37 | if (!USED[i]) { |
|---|
| 38 | current[0] = 'A'+i; |
|---|
| 39 | USED[i] = true; |
|---|
| 40 | break; |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | if (i == 26) current[0] = 0; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | return current; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | // ----------------------------------------------------------------------- |
|---|
| 51 | // const char* awt_hotkeys::hotkey_internal(const string& label) |
|---|
| 52 | // ----------------------------------------------------------------------- |
|---|
| 53 | const char* awt_hotkeys::hotkey(const string& label) { |
|---|
| 54 | if (label.length()) { |
|---|
| 55 | for (string::const_iterator ch = label.begin(); ch != label.end(); ++ch) { |
|---|
| 56 | if (islower(*ch)) { |
|---|
| 57 | if (!used[*ch-'a']) { |
|---|
| 58 | used[*ch-'a'] = true; |
|---|
| 59 | current[0] = *ch; |
|---|
| 60 | return current; |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | else if (isupper(*ch)) { |
|---|
| 64 | if (!USED[*ch-'A']) { |
|---|
| 65 | USED[*ch-'A'] = true; |
|---|
| 66 | current[0] = *ch; |
|---|
| 67 | return current; |
|---|
| 68 | } |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | } |
|---|
| 72 | return artifical_hotkey(); |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.