diff options
| author | Manolo Gouy <Manolo> | 2016-04-13 14:05:34 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-04-13 14:05:34 +0000 |
| commit | b590bc49f9dc2f33ebc51026bf1d7a7e519de4ad (patch) | |
| tree | 7e3c0a66ea91c6ea240c60ecc96de36a6e937b1d | |
| parent | a1ffa85a1ee978c2ee75526c68a16a4bfec6dab5 (diff) | |
Rewrite fl_encoding_latin1.cxx under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11599 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_System_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 2 | ||||
| -rw-r--r-- | src/fl_encoding_latin1.cxx | 29 |
3 files changed, 26 insertions, 8 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index 8b7146161..a45a64700 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -174,6 +174,9 @@ public: virtual int dot_file_hidden() {return 0;} // return TRUE when file names are case insensitive virtual int case_insensitive_filenames() {return 0;} + // the implementations of local_to_latin1() and latin1_to_local() are in fl_encoding_latin1.cxx + virtual const char *local_to_latin1(const char *t, int n); + virtual const char *latin1_to_local(const char *t, int n); }; #endif // FL_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index ac08fd8f4..8ee7f7a84 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -59,6 +59,8 @@ public: virtual void newUUID(char *uuidBuffer); virtual char *preference_rootnode(Fl_Preferences *prefs, Fl_Preferences::Root root, const char *vendor, const char *application); + virtual const char *local_to_latin1(const char *t, int n); + virtual const char *latin1_to_local(const char *t, int n); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/fl_encoding_latin1.cxx b/src/fl_encoding_latin1.cxx index f7adc3459..9e3d16cfc 100644 --- a/src/fl_encoding_latin1.cxx +++ b/src/fl_encoding_latin1.cxx @@ -16,13 +16,17 @@ // http://www.fltk.org/str.php // +#include "config_lib.h" #include <FL/fl_draw.H> +#include <FL/Fl.H> +#include <FL/Fl_System_Driver.H> #include <FL/Enumerations.H> #include <stdlib.h> #include "flstring.h" -#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform text encoding - +#ifdef FL_CFG_WIN_COCOA +#include "drivers/Darwin/Fl_Darwin_System_Driver.H" + // These function assume a western code page. If you need to support // scripts that are not part of this code page, you might want to // take a look at FLTK2, which uses utf8 for text encoding. @@ -67,7 +71,7 @@ static uchar roman2latin[128] = { static char *buf = 0; static int n_buf = 0; -const char *fl_latin1_to_local(const char *t, int n) +const char *Fl_Darwin_System_Driver::latin1_to_local(const char *t, int n) { if (n==-1) n = strlen(t); if (n<=n_buf) { @@ -88,7 +92,7 @@ const char *fl_latin1_to_local(const char *t, int n) return buf; } -const char *fl_local_to_latin1(const char *t, int n) +const char *Fl_Darwin_System_Driver::local_to_latin1(const char *t, int n) { if (n==-1) n = strlen(t); if (n<=n_buf) { @@ -109,19 +113,28 @@ const char *fl_local_to_latin1(const char *t, int n) return buf; } -#else +#endif -const char *fl_latin1_to_local(const char *t, int) +const char *Fl_System_Driver::latin1_to_local(const char *t, int) { return t; } -const char *fl_local_to_latin1(const char *t, int) +const char *Fl_System_Driver::local_to_latin1(const char *t, int) { return t; } -#endif +const char *fl_latin1_to_local(const char *t, int n) +{ + return Fl::system_driver()->latin1_to_local(t, n); +} + +const char *fl_local_to_latin1(const char *t, int n) +{ + return Fl::system_driver()->local_to_latin1(t, n); +} + // // End of "$Id$". |
