XForms-compatable shortcut strings modified so that "0xabcd" can specify

an arbitrary key by hex code.  Lame but needed for some DD software...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1113 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2000-05-10 16:43:36 +00:00
parent 2099173761
commit eb63364311
2 changed files with 16 additions and 13 deletions

View File

@ -1,6 +1,6 @@
#include <stdio.h>
//
// "$Id: Fl.cxx,v 1.24.2.18 2000/04/25 22:16:17 mike Exp $"
// "$Id: Fl.cxx,v 1.24.2.19 2000/05/10 16:43:35 bill Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@ -696,15 +696,6 @@ void Fl_Window::flush() {
draw();
}
int fl_old_shortcut(const char* s) {
if (!s || !*s) return 0;
int n = 0;
if (*s == '#') {n |= FL_ALT; s++;}
if (*s == '+') {n |= FL_SHIFT; s++;}
if (*s == '^') {n |= FL_CTRL; s++;}
return n | *s;
}
//
// End of "$Id: Fl.cxx,v 1.24.2.18 2000/04/25 22:16:17 mike Exp $".
// End of "$Id: Fl.cxx,v 1.24.2.19 2000/05/10 16:43:35 bill Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_shortcut.cxx,v 1.4.2.4 2000/04/25 22:16:45 mike Exp $"
// "$Id: fl_shortcut.cxx,v 1.4.2.5 2000/05/10 16:43:36 bill Exp $"
//
// Shortcut support routines for the Fast Light Tool Kit (FLTK).
//
@ -158,6 +158,18 @@ const char * fl_shortcut_label(int shortcut) {
#endif
}
// Emulation of XForms named shortcuts
#include <stdlib.h>
int fl_old_shortcut(const char* s) {
if (!s || !*s) return 0;
int n = 0;
if (*s == '#') {n |= FL_ALT; s++;}
if (*s == '+') {n |= FL_SHIFT; s++;}
if (*s == '^') {n |= FL_CTRL; s++;}
if (s[1]) return n | (int)strtol(s,0,0); // allow 0xf00 to get any key
return n | *s;
}
// Tests for &x shortcuts in button labels:
int Fl_Widget::test_shortcut(const char *label) {
@ -179,5 +191,5 @@ int Fl_Widget::test_shortcut() {
}
//
// End of "$Id: fl_shortcut.cxx,v 1.4.2.4 2000/04/25 22:16:45 mike Exp $".
// End of "$Id: fl_shortcut.cxx,v 1.4.2.5 2000/05/10 16:43:36 bill Exp $".
//