Convert the initialisation of global variables fl_local_shift, fl_local_meta, etc... using the driver approach.

This avoids repeating the default values "Shift", "Meta", etc... for several platforms.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12463 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2017-09-19 19:33:54 +00:00
parent 213b955442
commit da2d4a8ee5
7 changed files with 29 additions and 30 deletions

View File

@ -213,6 +213,11 @@ public:
virtual void open_callback(void (*)(const char *));
// The default implementation may be enough.
virtual void gettime(time_t *sec, int *usec);
// The default implementation of the next 4 functions may be enough.
virtual const char *shift_name() { return "Shift"; }
virtual const char *meta_name() { return "Meta"; }
virtual const char *alt_name() { return "Alt"; }
virtual const char *control_name() { return "Ctrl"; }
};
#endif // FL_SYSTEM_DRIVER_H

View File

@ -2030,6 +2030,13 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
return Fl_Graphics_Driver::default_driver().get_font_sizes(fnum, sizep);
}
// Pointers you can use to change FLTK to another language.
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
FL_EXPORT const char* fl_local_shift = Fl::system_driver()->shift_name();
FL_EXPORT const char* fl_local_meta = Fl::system_driver()->meta_name();
FL_EXPORT const char* fl_local_alt = Fl::system_driver()->alt_name();
FL_EXPORT const char* fl_local_ctrl = Fl::system_driver()->control_name();
//
// End of "$Id$".
//

View File

@ -77,6 +77,10 @@ public:
virtual void remove_fd(int, int when);
virtual void remove_fd(int);
virtual void open_callback(void (*)(const char *));
virtual const char *shift_name();
virtual const char *meta_name();
virtual const char *alt_name();
virtual const char *control_name();
};
#endif // FL_DARWIN_SYSTEM_DRIVER_H

View File

@ -38,15 +38,18 @@
#include <sys/mount.h>
#include <sys/stat.h>
//const char* fl_local_alt = "\xe2\x8c\xa5\\"; // U+2325 (option key)
const char* fl_local_alt = "\\"; // U+2325 (option key)
//const char* fl_local_ctrl = "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
const char* fl_local_ctrl = "\\"; // U+2303 (up arrowhead)
//const char* fl_local_meta = "\xe2\x8c\x98\\"; // U+2318 (place of interest sign)
const char* fl_local_meta = "\\"; // U+2318 (place of interest sign)
//const char* fl_local_shift = "\xe2\x87\xa7\\"; // U+21E7 (upwards white arrow)
const char* fl_local_shift = "\\"; // U+21E7 (upwards white arrow)
const char *Fl_Darwin_System_Driver::shift_name() {
return "\\"; // "\xe2\x87\xa7\\"; // U+21E7 (upwards white arrow)
}
const char *Fl_Darwin_System_Driver::meta_name() {
return "\\"; // "\xe2\x8c\x98\\"; // U+2318 (place of interest sign)
}
const char *Fl_Darwin_System_Driver::alt_name() {
return "\\"; // "\xe2\x8c\xa5\\"; // U+2325 (option key)
}
const char *Fl_Darwin_System_Driver::control_name() {
return "\\"; // "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
}
/*
Creates a driver that manages all system related calls.

View File

@ -25,13 +25,6 @@
#include <FL/Fl_Window.H>
const char *fl_local_alt = "alt";
const char *fl_local_ctrl = "ctrl";
const char *fl_local_meta = "meta";
const char *fl_local_shift = "shift";
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win)
{
return new Fl_PicoSDL_Window_Driver(win);
@ -119,4 +112,4 @@ void Fl_PicoSDL_Window_Driver::show() {
//
// End of "$Id$".
//
//

View File

@ -53,13 +53,6 @@ typedef RPC_STATUS (WINAPI* uuid_func)(UUID __RPC_FAR *Uuid);
inline int isdirsep(char c) { return c == '/' || c == '\\'; }
#if !defined(FL_DOXYGEN)
const char* fl_local_alt = "Alt";
const char* fl_local_ctrl = "Ctrl";
const char* fl_local_meta = "Meta";
const char* fl_local_shift = "Shift";
#endif
static wchar_t *mbwbuf = NULL;
static wchar_t *wbuf = NULL;
static wchar_t *wbuf1 = NULL;

View File

@ -58,12 +58,6 @@ extern "C" {
}
#endif
// Pointers you can use to change FLTK to another language.
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
const char* fl_local_alt = "Alt";
const char* fl_local_ctrl = "Ctrl";
const char* fl_local_meta = "Meta";
const char* fl_local_shift = "Shift";
/**
Creates a driver that manages all system related calls.