summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-01-26 21:10:49 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-01-26 21:10:49 +0000
commit6694780c2d02d645f053fd60864c9ff035296a64 (patch)
treefd205fc40c3b1b0aa432bbc1bdbe2c78f3d1c60b
parentac275b89bcd8333dd1b05bfc9f6fc0accd8e065d (diff)
Moving GDI/WIN32 files to new directroy structure
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11058 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl_Device.H2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.h (renamed from src/cfg_gfx/gdi.H)0
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx (renamed from src/cfg_gfx/gdi_arci.cxx)2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx (renamed from src/cfg_gfx/gdi_color.cxx)4
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx (renamed from src/fl_font_win32.cxx)164
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx (renamed from src/cfg_gfx/gdi_line_style.cxx)3
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx (renamed from src/cfg_gfx/gdi_rect.cxx)2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx (renamed from src/cfg_gfx/gdi_vertex.cxx)2
-rw-r--r--src/fl_arci.cxx2
-rw-r--r--src/fl_color.cxx2
-rw-r--r--src/fl_font.cxx2
-rw-r--r--src/fl_line_style.cxx2
-rw-r--r--src/fl_rect.cxx2
-rw-r--r--src/fl_set_fonts_win32.cxx164
-rw-r--r--src/fl_vertex.cxx2
15 files changed, 180 insertions, 175 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H
index 0fa8d7493..07eafd853 100644
--- a/FL/Fl_Device.H
+++ b/FL/Fl_Device.H
@@ -281,7 +281,7 @@ protected:
#elif defined(WIN32) || defined(FL_DOXYGEN)
// FIXME: it should not be required to include this file here. This is nothing that the user should have access to.
-#include "src/cfg_gfx/gdi.H"
+#include "src/drivers/GDI/Fl_GDI_Graphics_Driver.h"
/**
The graphics driver used when printing on MSWindows.
diff --git a/src/cfg_gfx/gdi.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
index c38b23a5c..c38b23a5c 100644
--- a/src/cfg_gfx/gdi.H
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
diff --git a/src/cfg_gfx/gdi_arci.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
index 5cba23851..9a16e14e8 100644
--- a/src/cfg_gfx/gdi_arci.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
@@ -24,6 +24,8 @@
\brief Utility functions for drawing circles using integers
*/
+#include "Fl_GDI_Graphics_Driver.h"
+
#include <FL/math.h>
void Fl_GDI_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
diff --git a/src/cfg_gfx/gdi_color.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
index 624546f39..2113b13b5 100644
--- a/src/cfg_gfx/gdi_color.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
@@ -21,6 +21,8 @@
// changes can be made. Not to be confused with the X colormap, which
// I try to hide completely.
+#include "Fl_GDI_Graphics_Driver.h"
+
#include <config.h>
#include <FL/Fl.H>
#include <FL/x.H>
@@ -33,7 +35,7 @@
// FIXME: maybe we can forget about color mapping and assume RGB?
static unsigned fl_cmap[256] = {
-#include "fl_cmap.h" // this is a file produced by "cmap.cxx":
+#include "../../fl_cmap.h" // this is a file produced by "cmap.cxx":
};
// Translations to win32 data structures:
diff --git a/src/fl_font_win32.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx
index 5e15ec807..6f2504391 100644
--- a/src/fl_font_win32.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx
@@ -1,6 +1,170 @@
//
// "$Id$"
//
+// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file. If this
+// file is missing or damaged, see the license at:
+//
+// http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+// This function fills in the FLTK font table with all the fonts that
+// are found on the X server. It tries to place the fonts into families
+// and to sort them so the first 4 in a family are normal, bold, italic,
+// and bold italic.
+#include <FL/fl_utf8.h>
+#ifdef __CYGWIN__
+# include <wchar.h>
+#endif
+
+// Bug: older versions calculated the value for *ap as a side effect of
+// making the name, and then forgot about it. To avoid having to change
+// the header files I decided to store this value in the last character
+// of the font name array.
+#define ENDOFBUFFER 127 // sizeof(Fl_Font.fontname)-1
+
+// turn a stored font name into a pretty name:
+const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
+ Fl_Fontdesc *f = fl_fonts + fnum;
+ if (!f->fontname[0]) {
+ const char* p = f->name;
+ if (!p || !*p) {if (ap) *ap = 0; return "";}
+ int type;
+ switch (*p) {
+ case 'B': type = FL_BOLD; break;
+ case 'I': type = FL_ITALIC; break;
+ case 'P': type = FL_BOLD | FL_ITALIC; break;
+ default: type = 0; break;
+ }
+ strlcpy(f->fontname, p+1, ENDOFBUFFER);
+ if (type & FL_BOLD) strlcat(f->fontname, " bold", ENDOFBUFFER);
+ if (type & FL_ITALIC) strlcat(f->fontname, " italic", ENDOFBUFFER);
+ f->fontname[ENDOFBUFFER] = (char)type;
+ }
+ if (ap) *ap = f->fontname[ENDOFBUFFER];
+ return f->fontname;
+}
+
+static int fl_free_font = FL_FREE_FONT;
+
+static int CALLBACK
+enumcbw(CONST LOGFONTW *lpelf,
+ CONST TEXTMETRICW * /*lpntm*/,
+ DWORD /*FontType*/,
+ LPARAM p) {
+ if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
+ char *n = NULL;
+ size_t l = wcslen(lpelf->lfFaceName);
+ unsigned dstlen = fl_utf8fromwc(n, 0, (xchar*)lpelf->lfFaceName, (unsigned) l) + 1; // measure the string
+ n = (char*) malloc(dstlen);
+//n[fl_unicode2utf((xchar*)lpelf->lfFaceName, l, n)] = 0;
+ dstlen = fl_utf8fromwc(n, dstlen, (xchar*)lpelf->lfFaceName, (unsigned) l); // convert the string
+ n[dstlen] = 0;
+ for (int i=0; i<FL_FREE_FONT; i++) // skip if one of our built-in fonts
+ if (!strcmp(Fl::get_font_name((Fl_Font)i),n)) {free(n);return 1;}
+ char buffer[LF_FACESIZE + 1];
+ strcpy(buffer+1, n);
+ buffer[0] = ' '; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
+ if (lpelf->lfWeight <= 400)
+ buffer[0] = 'B', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
+ buffer[0] = 'I'; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
+ if (lpelf->lfWeight <= 400)
+ buffer[0] = 'P', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
+ free(n);
+ return 1;
+} /* enumcbw */
+
+Fl_Font Fl::set_fonts(const char* xstarname) {
+ if (fl_free_font == FL_FREE_FONT) {// if not already been called
+ if (!fl_gc) fl_GetDC(0);
+
+ EnumFontFamiliesW(fl_gc, NULL, (FONTENUMPROCW)enumcbw, xstarname != 0);
+
+ }
+ return (Fl_Font)fl_free_font;
+}
+
+
+static int nbSize;
+static int cyPerInch;
+static int sizes[128];
+static int CALLBACK
+
+EnumSizeCbW(CONST LOGFONTW * /*lpelf*/,
+ CONST TEXTMETRICW *lpntm,
+ DWORD fontType,
+ LPARAM /*p*/) {
+ if ((fontType & RASTER_FONTTYPE) == 0) {
+ sizes[0] = 0;
+ nbSize = 1;
+
+ // Scalable font
+ return 0;
+ }
+
+ int add = lpntm->tmHeight - lpntm->tmInternalLeading;
+ add = MulDiv(add, 72, cyPerInch);
+
+ int start = 0;
+ while ((start < nbSize) && (sizes[start] < add)) {
+ start++;
+ }
+
+ if ((start < nbSize) && (sizes[start] == add)) {
+ return 1;
+ }
+
+ for (int i=nbSize; i>start; i--) sizes[i] = sizes[i - 1];
+
+ sizes[start] = add;
+ nbSize++;
+
+ // Stop enum if buffer overflow
+ return nbSize < 128;
+}
+
+
+int
+Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
+ nbSize = 0;
+ Fl_Fontdesc *s = fl_fonts+fnum;
+ if (!s->name) s = fl_fonts; // empty slot in table, use entry 0
+
+ if (!fl_gc) fl_GetDC(0);
+ cyPerInch = GetDeviceCaps(fl_gc, LOGPIXELSY);
+ if (cyPerInch < 1) cyPerInch = 1;
+
+// int l = fl_utf_nb_char((unsigned char*)s->name+1, strlen(s->name+1));
+// unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
+// fl_utf2unicode((unsigned char*)s->name+1, l, (xchar*)b);
+ const char *nm = (const char*)s->name+1;
+ size_t len = strlen(s->name+1);
+ unsigned l = fl_utf8toUtf16(nm, (unsigned) len, NULL, 0); // Pass NULL to query length required
+ unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
+ l = fl_utf8toUtf16(nm, (unsigned) len, b, (l+1)); // Now do the conversion
+ b[l] = 0;
+ EnumFontFamiliesW(fl_gc, (WCHAR*)b, (FONTENUMPROCW)EnumSizeCbW, 0);
+ free(b);
+
+ sizep = sizes;
+ return nbSize;
+}
+
+
+//
+// End of "$Id$".
+//
+//
+// "$Id$"
+//
// WIN32 font selection routines for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2012 by Bill Spitzak and others.
diff --git a/src/cfg_gfx/gdi_line_style.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx
index a3ba0a71a..cd84aae0a 100644
--- a/src/cfg_gfx/gdi_line_style.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_line_style.cxx
@@ -24,7 +24,8 @@
\brief Line style drawing utility hiding different platforms.
*/
-#include "gdi.H"
+#include "Fl_GDI_Graphics_Driver.h"
+
void Fl_GDI_Graphics_Driver::line_style(int style, int width, char* dashes) {
diff --git a/src/cfg_gfx/gdi_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index 466d8d83f..5adb0056d 100644
--- a/src/cfg_gfx/gdi_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -25,7 +25,7 @@
\brief MSWindows GDI specific line and polygon drawing with integer coordinates.
*/
-#include "gdi.h"
+#include "Fl_GDI_Graphics_Driver.h"
// --- line and polygon drawing with integer coordinates
diff --git a/src/cfg_gfx/gdi_vertex.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
index 81267f1e0..ee12c9ad8 100644
--- a/src/cfg_gfx/gdi_vertex.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
@@ -25,7 +25,7 @@
simple 2D transformations, implemented for MSWindows GDI.
*/
-#include "gdi.H"
+#include "Fl_GDI_Graphics_Driver.h"
#include <FL/fl_draw.H>
#include <FL/x.H>
diff --git a/src/fl_arci.cxx b/src/fl_arci.cxx
index 97e2e08c7..3f5db09c6 100644
--- a/src/fl_arci.cxx
+++ b/src/fl_arci.cxx
@@ -50,7 +50,7 @@
#ifdef FL_CFG_GFX_GDI
-# include "cfg_gfx/gdi_arci.cxx"
+# include "drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx"
#endif
diff --git a/src/fl_color.cxx b/src/fl_color.cxx
index aebd17670..887ae8a27 100644
--- a/src/fl_color.cxx
+++ b/src/fl_color.cxx
@@ -42,7 +42,7 @@
#ifdef FL_CFG_GFX_GDI
-# include "cfg_gfx/gdi_color.cxx"
+# include "drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx"
#endif
diff --git a/src/fl_font.cxx b/src/fl_font.cxx
index b7e90790e..c69cf8e5b 100644
--- a/src/fl_font.cxx
+++ b/src/fl_font.cxx
@@ -46,7 +46,7 @@
#include <stdlib.h>
#ifdef WIN32
-# include "fl_font_win32.cxx"
+# include "drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx"
#elif defined(__APPLE__)
# include "drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx"
#elif USE_XFT
diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx
index dd62f69a0..965fb5a9e 100644
--- a/src/fl_line_style.cxx
+++ b/src/fl_line_style.cxx
@@ -50,7 +50,7 @@ int fl_line_width_ = 0;
#ifdef FL_CFG_GFX_GDI
-# include "cfg_gfx/gdi_line_style.cxx"
+# include "drivers/GDI/Fl_GDI_Graphics_Driver_style.cxx"
#endif
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx
index bdf682dec..3c6574367 100644
--- a/src/fl_rect.cxx
+++ b/src/fl_rect.cxx
@@ -77,7 +77,7 @@ Fl_Region Fl_Graphics_Driver::clip_region() {
#ifdef FL_CFG_GFX_GDI
-# include "cfg_gfx/gdi_rect.cxx"
+# include "drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx"
#endif
diff --git a/src/fl_set_fonts_win32.cxx b/src/fl_set_fonts_win32.cxx
deleted file mode 100644
index be7f48594..000000000
--- a/src/fl_set_fonts_win32.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// "$Id$"
-//
-// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2010 by Bill Spitzak and others.
-//
-// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
-// file is missing or damaged, see the license at:
-//
-// http://www.fltk.org/COPYING.php
-//
-// Please report all bugs and problems on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-// This function fills in the FLTK font table with all the fonts that
-// are found on the X server. It tries to place the fonts into families
-// and to sort them so the first 4 in a family are normal, bold, italic,
-// and bold italic.
-#include <FL/fl_utf8.h>
-#ifdef __CYGWIN__
-# include <wchar.h>
-#endif
-
-// Bug: older versions calculated the value for *ap as a side effect of
-// making the name, and then forgot about it. To avoid having to change
-// the header files I decided to store this value in the last character
-// of the font name array.
-#define ENDOFBUFFER 127 // sizeof(Fl_Font.fontname)-1
-
-// turn a stored font name into a pretty name:
-const char* Fl::get_font_name(Fl_Font fnum, int* ap) {
- Fl_Fontdesc *f = fl_fonts + fnum;
- if (!f->fontname[0]) {
- const char* p = f->name;
- if (!p || !*p) {if (ap) *ap = 0; return "";}
- int type;
- switch (*p) {
- case 'B': type = FL_BOLD; break;
- case 'I': type = FL_ITALIC; break;
- case 'P': type = FL_BOLD | FL_ITALIC; break;
- default: type = 0; break;
- }
- strlcpy(f->fontname, p+1, ENDOFBUFFER);
- if (type & FL_BOLD) strlcat(f->fontname, " bold", ENDOFBUFFER);
- if (type & FL_ITALIC) strlcat(f->fontname, " italic", ENDOFBUFFER);
- f->fontname[ENDOFBUFFER] = (char)type;
- }
- if (ap) *ap = f->fontname[ENDOFBUFFER];
- return f->fontname;
-}
-
-static int fl_free_font = FL_FREE_FONT;
-
-static int CALLBACK
-enumcbw(CONST LOGFONTW *lpelf,
- CONST TEXTMETRICW * /*lpntm*/,
- DWORD /*FontType*/,
- LPARAM p) {
- if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
- char *n = NULL;
- size_t l = wcslen(lpelf->lfFaceName);
- unsigned dstlen = fl_utf8fromwc(n, 0, (xchar*)lpelf->lfFaceName, (unsigned) l) + 1; // measure the string
- n = (char*) malloc(dstlen);
-//n[fl_unicode2utf((xchar*)lpelf->lfFaceName, l, n)] = 0;
- dstlen = fl_utf8fromwc(n, dstlen, (xchar*)lpelf->lfFaceName, (unsigned) l); // convert the string
- n[dstlen] = 0;
- for (int i=0; i<FL_FREE_FONT; i++) // skip if one of our built-in fonts
- if (!strcmp(Fl::get_font_name((Fl_Font)i),n)) {free(n);return 1;}
- char buffer[LF_FACESIZE + 1];
- strcpy(buffer+1, n);
- buffer[0] = ' '; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
- if (lpelf->lfWeight <= 400)
- buffer[0] = 'B', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
- buffer[0] = 'I'; Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
- if (lpelf->lfWeight <= 400)
- buffer[0] = 'P', Fl::set_font((Fl_Font)(fl_free_font++), strdup(buffer));
- free(n);
- return 1;
-} /* enumcbw */
-
-Fl_Font Fl::set_fonts(const char* xstarname) {
- if (fl_free_font == FL_FREE_FONT) {// if not already been called
- if (!fl_gc) fl_GetDC(0);
-
- EnumFontFamiliesW(fl_gc, NULL, (FONTENUMPROCW)enumcbw, xstarname != 0);
-
- }
- return (Fl_Font)fl_free_font;
-}
-
-
-static int nbSize;
-static int cyPerInch;
-static int sizes[128];
-static int CALLBACK
-
-EnumSizeCbW(CONST LOGFONTW * /*lpelf*/,
- CONST TEXTMETRICW *lpntm,
- DWORD fontType,
- LPARAM /*p*/) {
- if ((fontType & RASTER_FONTTYPE) == 0) {
- sizes[0] = 0;
- nbSize = 1;
-
- // Scalable font
- return 0;
- }
-
- int add = lpntm->tmHeight - lpntm->tmInternalLeading;
- add = MulDiv(add, 72, cyPerInch);
-
- int start = 0;
- while ((start < nbSize) && (sizes[start] < add)) {
- start++;
- }
-
- if ((start < nbSize) && (sizes[start] == add)) {
- return 1;
- }
-
- for (int i=nbSize; i>start; i--) sizes[i] = sizes[i - 1];
-
- sizes[start] = add;
- nbSize++;
-
- // Stop enum if buffer overflow
- return nbSize < 128;
-}
-
-
-int
-Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
- nbSize = 0;
- Fl_Fontdesc *s = fl_fonts+fnum;
- if (!s->name) s = fl_fonts; // empty slot in table, use entry 0
-
- if (!fl_gc) fl_GetDC(0);
- cyPerInch = GetDeviceCaps(fl_gc, LOGPIXELSY);
- if (cyPerInch < 1) cyPerInch = 1;
-
-// int l = fl_utf_nb_char((unsigned char*)s->name+1, strlen(s->name+1));
-// unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
-// fl_utf2unicode((unsigned char*)s->name+1, l, (xchar*)b);
- const char *nm = (const char*)s->name+1;
- size_t len = strlen(s->name+1);
- unsigned l = fl_utf8toUtf16(nm, (unsigned) len, NULL, 0); // Pass NULL to query length required
- unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
- l = fl_utf8toUtf16(nm, (unsigned) len, b, (l+1)); // Now do the conversion
- b[l] = 0;
- EnumFontFamiliesW(fl_gc, (WCHAR*)b, (FONTENUMPROCW)EnumSizeCbW, 0);
- free(b);
-
- sizep = sizes;
- return nbSize;
-}
-
-
-//
-// End of "$Id$".
-//
diff --git a/src/fl_vertex.cxx b/src/fl_vertex.cxx
index 23b56e7a4..36aae3627 100644
--- a/src/fl_vertex.cxx
+++ b/src/fl_vertex.cxx
@@ -160,7 +160,7 @@ void Fl_Graphics_Driver::fixloop() { // remove equal points from closed path
#ifdef FL_CFG_GFX_GDI
-# include "cfg_gfx/gdi_vertex.cxx"
+# include "drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx"
#endif