diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-15 09:49:07 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-15 09:49:07 +0000 |
| commit | f36963610f3133822aba49a2ce02cc234ea4e8ee (patch) | |
| tree | 69e1bc1c487a46e7826c7ae52dba369a6c8784e1 /src | |
| parent | 67f0018dca4aa6eac36a2d90d4d4c9bfdd7a21a1 (diff) | |
Fixing FIXME's and tab characters in fl_shortcut.cxx.
Yes, I am bored otherwise.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12749 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_shortcut.cxx | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx index 2386d2d19..2fec02bad 100644 --- a/src/fl_shortcut.cxx +++ b/src/fl_shortcut.cxx @@ -147,7 +147,7 @@ const char* fl_shortcut_label(unsigned int shortcut) { */ static char *add_modifier_key(char *p, const char *end, const char *name) { - int ln = strlen(name); + size_t ln = strlen(name); if (p+ln > end) { // string too long if (p+4 <= end) { // can replace with "..." ? strcpy(p,"..."); @@ -160,7 +160,7 @@ static char *add_modifier_key(char *p, const char *end, const char *name) { } if (p[-1] == '\\') // remove (last) '\' character p--; - else if (p[-1] == '+') // don't add another '+' character + else if (p[-1] == '+') // don't add another '+' character {/*empty*/} else // not a '\' or '+' *p++ = '+'; // add a '+' character @@ -270,18 +270,18 @@ const char* fl_shortcut_label(unsigned int shortcut, const char **eom) { key to be modified is a single alpha-numeric character [A-Z,a-z,0-9), it's probably best to use the numeric equivalents. - \todo Fix these silly legacy issues in a future release - to support more predictable behavior for the modifier keys. + \remarks Don't fix these silly legacy issues in a future release. + Nobody is using this anymore. */ unsigned int fl_old_shortcut(const char* s) { if (!s || !*s) return 0; - if (s[1]==0 && strchr("@!",s[0])) return s[0]; // maintain legacy behavior for "!" and "@" + if (s[1]==0 && strchr("@!",s[0])) return (unsigned int)s[0]; // maintain legacy behavior for "!" and "@" unsigned int n = 0; if (*s == '#') {n |= FL_ALT; s++;} if (*s == '+') {n |= FL_SHIFT; s++;} if (*s == '^') {n |= FL_CTRL; s++;} - if (*s == '!') {n |= FL_META; s++;} // added in 1.3.3 - if (*s == '@') {n |= FL_COMMAND; s++;} // added in 1.3.3 + if (*s == '!') {n |= FL_META; s++;} // added in 1.3.3 + if (*s == '@') {n |= FL_COMMAND; s++;} // added in 1.3.3 if (*s && s[1]) return n | (int)strtol(s,0,0); // allow 0xf00 to get any key return n | *s; } @@ -329,7 +329,7 @@ unsigned int Fl_Widget::label_shortcut(const char *t) { \param require_alt if true: match only if Alt key is pressed. \return true, if the entered text matches the '&x' shortcut in \p t - false (0) otherwise. + false (0) otherwise. \note Internal use only. */ @@ -363,7 +363,7 @@ int Fl_Widget::test_shortcut(const char *t, const bool require_alt) { Fl::event_text() is used to get the entered key value. \return true, if the entered text matches the widget's'&x' shortcut, - false (0) otherwise. + false (0) otherwise. \note Internal use only. */ @@ -376,75 +376,75 @@ int Fl_Widget::test_shortcut() { #if defined(FL_CFG_GFX_GDI) || defined(FL_PORTING) || defined(__ANDROID__) // This table must be in numeric order by fltk (X) keysym number: Fl_System_Driver::Keyname Fl_System_Driver::table[] = { - {' ', "Space"}, - {FL_BackSpace, "Backspace"}, - {FL_Tab, "Tab"}, + {' ', "Space"}, + {FL_BackSpace, "Backspace"}, + {FL_Tab, "Tab"}, {0xff0b/*XK_Clear*/, "Clear"}, - {FL_Enter, "Enter"}, // X says "Enter" - {FL_Pause, "Pause"}, + {FL_Enter, "Enter"}, // X says "Enter" + {FL_Pause, "Pause"}, {FL_Scroll_Lock, "Scroll_Lock"}, - {FL_Escape, "Escape"}, - {FL_Home, "Home"}, - {FL_Left, "Left"}, - {FL_Up, "Up"}, - {FL_Right, "Right"}, - {FL_Down, "Down"}, - {FL_Page_Up, "Page_Up"}, // X says "Prior" - {FL_Page_Down,"Page_Down"}, // X says "Next" - {FL_End, "End"}, - {FL_Print, "Print"}, - {FL_Insert, "Insert"}, - {FL_Menu, "Menu"}, - {FL_Num_Lock, "Num_Lock"}, - {FL_KP_Enter, "KP_Enter"}, - {FL_Shift_L, "Shift_L"}, - {FL_Shift_R, "Shift_R"}, - {FL_Control_L,"Control_L"}, - {FL_Control_R,"Control_R"}, - {FL_Caps_Lock,"Caps_Lock"}, - {FL_Meta_L, "Meta_L"}, - {FL_Meta_R, "Meta_R"}, - {FL_Alt_L, "Alt_L"}, - {FL_Alt_R, "Alt_R"}, - {FL_Delete, "Delete"} + {FL_Escape, "Escape"}, + {FL_Home, "Home"}, + {FL_Left, "Left"}, + {FL_Up, "Up"}, + {FL_Right, "Right"}, + {FL_Down, "Down"}, + {FL_Page_Up, "Page_Up"}, // X says "Prior" + {FL_Page_Down, "Page_Down"}, // X says "Next" + {FL_End, "End"}, + {FL_Print, "Print"}, + {FL_Insert, "Insert"}, + {FL_Menu, "Menu"}, + {FL_Num_Lock, "Num_Lock"}, + {FL_KP_Enter, "KP_Enter"}, + {FL_Shift_L, "Shift_L"}, + {FL_Shift_R, "Shift_R"}, + {FL_Control_L, "Control_L"}, + {FL_Control_R, "Control_R"}, + {FL_Caps_Lock, "Caps_Lock"}, + {FL_Meta_L, "Meta_L"}, + {FL_Meta_R, "Meta_R"}, + {FL_Alt_L, "Alt_L"}, + {FL_Alt_R, "Alt_R"}, + {FL_Delete, "Delete"} }; #endif #if defined(FL_CFG_GFX_QUARTZ) // This table must be in numeric order by fltk (X) keysym number: Fl_System_Driver::Keyname Fl_System_Driver::table[] = { - // v - this column may contain UTF-8 characters - {' ', "Space"}, - {FL_BackSpace,"\xe2\x8c\xab"}, // erase to the left - {FL_Tab, "\xe2\x87\xa5"}, // rightwards arrow to bar - {0xff0b, "\xe2\x8c\xa6"}, // erase to the right - {FL_Enter, "\xe2\x86\xa9"}, // leftwards arrow with hook - {FL_Pause, "Pause"}, + // v - this column may contain UTF-8 characters + {' ', "Space"}, + {FL_BackSpace, "\xe2\x8c\xab"}, // erase to the left + {FL_Tab, "\xe2\x87\xa5"}, // rightwards arrow to bar + {0xff0b, "\xe2\x8c\xa6"}, // erase to the right + {FL_Enter, "\xe2\x86\xa9"}, // leftwards arrow with hook + {FL_Pause, "Pause"}, {FL_Scroll_Lock, "Scroll_Lock"}, - {FL_Escape, "\xe2\x90\x9b"}, - {FL_Home, "\xe2\x86\x96"}, // north west arrow - {FL_Left, "\xe2\x86\x90"}, // leftwards arrow - {FL_Up, "\xe2\x86\x91"}, // upwards arrow - {FL_Right, "\xe2\x86\x92"}, // rightwards arrow - {FL_Down, "\xe2\x86\x93"}, // downwards arrow - {FL_Page_Up, "\xe2\x87\x9e"}, // upwards arrow with double stroke - {FL_Page_Down,"\xe2\x87\x9f"}, // downwards arrow with double stroke - {FL_End, "\xe2\x86\x98"}, // south east arrow - {FL_Print, "Print"}, - {FL_Insert, "Insert"}, - {FL_Menu, "Menu"}, - {FL_Num_Lock, "Num_Lock"}, - {FL_KP_Enter, "\xe2\x8c\xa4"}, // up arrow head between two horizontal bars - {FL_Shift_L, "Shift_L"}, - {FL_Shift_R, "Shift_R"}, - {FL_Control_L,"Control_L"}, - {FL_Control_R,"Control_R"}, - {FL_Caps_Lock,"\xe2\x87\xaa"}, // upwards white arrow from bar - {FL_Meta_L, "Meta_L"}, - {FL_Meta_R, "Meta_R"}, - {FL_Alt_L, "Alt_L"}, - {FL_Alt_R, "Alt_R"}, - {FL_Delete, "\xe2\x8c\xa7"} // x in a rectangle box + {FL_Escape, "\xe2\x90\x9b"}, + {FL_Home, "\xe2\x86\x96"}, // north west arrow + {FL_Left, "\xe2\x86\x90"}, // leftwards arrow + {FL_Up, "\xe2\x86\x91"}, // upwards arrow + {FL_Right, "\xe2\x86\x92"}, // rightwards arrow + {FL_Down, "\xe2\x86\x93"}, // downwards arrow + {FL_Page_Up, "\xe2\x87\x9e"}, // upwards arrow with double stroke + {FL_Page_Down, "\xe2\x87\x9f"}, // downwards arrow with double stroke + {FL_End, "\xe2\x86\x98"}, // south east arrow + {FL_Print, "Print"}, + {FL_Insert, "Insert"}, + {FL_Menu, "Menu"}, + {FL_Num_Lock, "Num_Lock"}, + {FL_KP_Enter, "\xe2\x8c\xa4"}, // up arrow head between two horizontal bars + {FL_Shift_L, "Shift_L"}, + {FL_Shift_R, "Shift_R"}, + {FL_Control_L, "Control_L"}, + {FL_Control_R, "Control_R"}, + {FL_Caps_Lock, "\xe2\x87\xaa"}, // upwards white arrow from bar + {FL_Meta_L, "Meta_L"}, + {FL_Meta_R, "Meta_R"}, + {FL_Alt_L, "Alt_L"}, + {FL_Alt_R, "Alt_R"}, + {FL_Delete, "\xe2\x8c\xa7"} // x in a rectangle box }; #endif @@ -479,8 +479,8 @@ const char *Fl_System_Driver::shortcut_add_key_name(unsigned key, char *p, char { if (key >= FL_F && key <= FL_F_Last) { *p++ = 'F'; - if (key > FL_F+9) *p++ = (key-FL_F)/10+'0'; - *p++ = (key-FL_F)%10 + '0'; + if (key > FL_F+9) *p++ = (char)((key-FL_F)/10+'0'); + *p++ = (char)((key-FL_F)%10 + '0'); } else { // binary search the table for a match: int a = 0; |
