diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 37 | ||||
| -rw-r--r-- | src/Fl_Image.cxx | 20 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx | 6 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx | 10 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 10 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx | 13 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx | 12 | ||||
| -rw-r--r-- | src/fl_arci.cxx | 10 | ||||
| -rw-r--r-- | src/fl_color.cxx | 14 | ||||
| -rw-r--r-- | src/fl_draw_image.cxx | 13 | ||||
| -rw-r--r-- | src/fl_font.cxx | 10 | ||||
| -rw-r--r-- | src/fl_line_style.cxx | 9 | ||||
| -rw-r--r-- | src/fl_rect.cxx | 9 | ||||
| -rw-r--r-- | src/fl_vertex.cxx | 8 |
15 files changed, 178 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ef9cd040..83fac14ad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -147,6 +147,34 @@ set(CPPFILES fl_encoding_mac_roman.cxx ) +set(DRIVER_FILES) + +if (USE_X11) + # FILE(GLOB DRIVER_FILES drivers/Xlib/Fl_Xlib_Graphics_Driver_*.cxx) + set(DRIVER_FILES + drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx + drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx + drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx + drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx + drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx + drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx + ) + if (USE_XFT) + set(DRIVER_FILES ${DRIVER_FILES} + drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx + ) + else () + set(DRIVER_FILES ${DRIVER_FILES} + drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx + ) + endif (USE_XFT) +endif (USE_X11) + +set(CPPFILES + ${CPPFILES} + ${DRIVER_FILES} +) + set(FLCPPFILES forms_compatability.cxx forms_bitmap.cxx @@ -197,7 +225,16 @@ set(CFILES fl_utf.c ) +# Add preprocessor macro FL_LIBRARY_CMAKE temporarily until the build +# system transition is completed. +# *** currently LINUX only *** + +if (UNIX) + add_definitions(-DFL_LIBRARY_CMAKE) +endif (UNIX) + add_definitions(-DFL_LIBRARY) + if(APPLE AND NOT OPTION_APPLE_X11) set(MMFILES Fl_cocoa.mm diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index b4f6ddb9a..32b2de609 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -73,6 +73,26 @@ void Fl_Image::draw(int XP, int YP, int, int, int, int) { draw_empty(XP, YP); } + +#if defined(WIN32) || defined (USE_X11) +static int start(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, + int &X, int &Y, int &W, int &H) +{ + // account for current clip region (faster on Irix): + fl_clip_box(XP,YP,WP,HP,X,Y,W,H); + cx += X-XP; cy += Y-YP; + // clip the box down to the size of image, quit if empty: + if (cx < 0) {W += cx; X -= cx; cx = 0;} + if (cx+W > w) W = w-cx; + if (W <= 0) return 1; + if (cy < 0) {H += cy; Y -= cy; cy = 0;} + if (cy+H > h) H = h-cy; + if (H <= 0) return 1; + return 0; +} +#endif // defined(WIN32) || defined (USE_X11) + + /** The protected method draw_empty() draws a box with an X in it. It can be used to draw any image that lacks image diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx index 118e683a1..429e6fc7e 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx @@ -19,6 +19,10 @@ #ifndef FL_CFG_GFX_XLIB_ARCI_CXX #define FL_CFG_GFX_XLIB_ARCI_CXX +#include <FL/fl_draw.H> +#include <config.h> +#include "../../config_lib.h" + /** \file xlib_arci.cxx \brief Utility functions for drawing circles using integers diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx index 1f7561831..fecd840a4 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx @@ -36,6 +36,8 @@ # include <FL/x.H> # include <FL/fl_draw.H> +extern unsigned fl_cmap[256]; // defined in fl_color.cxx + //////////////////////////////////////////////////////////////// // figure_out_visual() calculates masks & shifts for generating // pixels in true-color visuals: @@ -91,10 +93,6 @@ static void figure_out_visual() { } -static unsigned fl_cmap[256] = { -#include "../../fl_cmap.h" // this is a file produced by "cmap.cxx": -}; - # if HAVE_OVERLAY /** HAVE_OVERLAY determines whether fl_xmap is one or two planes */ Fl_XColor fl_xmap[2][256]; diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx index cec910f30..691c1f0d2 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx @@ -16,6 +16,16 @@ // http://www.fltk.org/str.php // +// Select fonts from the FLTK font table. +#include "../../flstring.h" +#include <FL/Fl.H> +#include <FL/fl_draw.H> +#include <FL/x.H> +#include "../../Fl_Font.H" + +#include <stdio.h> +#include <stdlib.h> + // 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, diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx index 91ee460ce..33c8d3379 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx @@ -16,6 +16,16 @@ // http://www.fltk.org/str.php // +// Select fonts from the FLTK font table. +#include "../../flstring.h" +#include <FL/Fl.H> +#include <FL/fl_draw.H> +#include <FL/x.H> +#include "../../Fl_Font.H" + +#include <stdio.h> +#include <stdlib.h> + #include <X11/Xft/Xft.h> // This function fills in the fltk font table with all the fonts that diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx index a20ace778..834682ea3 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx @@ -24,8 +24,21 @@ \brief Line style drawing utility hiding different platforms. */ +#include "../../config_lib.h" +#include <FL/Fl.H> +#include <FL/fl_draw.H> +#include <FL/x.H> +#include <FL/Fl_Printer.H> +#include "../../flstring.h" +#include <stdio.h> + #include "Fl_Xlib_Graphics_Driver.h" +// We save the current line width (absolute value) here. +// This is currently used only for X11 clipping, see src/fl_rect.cxx. +// FIXME: this would probably better be in class Fl:: +extern int fl_line_width_; + void Fl_Xlib_Graphics_Driver::line_style(int style, int width, char* dashes) { // save line width in global variable for X11 clipping diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx index 225b578d1..92328b088 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx @@ -26,6 +26,13 @@ \brief X11 Xlib specific line and polygon drawing with integer coordinates. */ +#include <config.h> +#include "../../config_lib.h" +#include <FL/Fl.H> +#include <FL/Fl_Widget.H> +#include <FL/Fl_Printer.H> +#include <FL/fl_draw.H> +#include <FL/x.H> #include "Fl_Xlib_Graphics_Driver.h" @@ -34,6 +41,11 @@ #define SHRT_MAX (32767) #endif +// fl_line_width_ must contain the absolute value of the current +// line width to be used for X11 clipping (see below). +// This is defined in src/fl_line_style.cxx +extern int fl_line_width_; + /* We need to check some coordinates for areas for clipping before we use X functions, because X can't handle coordinates outside the 16-bit diff --git a/src/fl_arci.cxx b/src/fl_arci.cxx index b436ae900..955e9f32a 100644 --- a/src/fl_arci.cxx +++ b/src/fl_arci.cxx @@ -35,9 +35,13 @@ #include <config.h> #include "config_lib.h" +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: +#ifndef FL_LIBRARY_CMAKE -// Apple Quartz driver in "drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx" +// ----------------------------------------------------------------------------- +// Apple Quartz driver in "drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx" // ----------------------------------------------------------------------------- @@ -61,6 +65,10 @@ // ----------------------------------------------------------------------------- +#endif // FL_LIBRARY_CMAKE + +// ----------------------------------------------------------------------------- + // // End of "$Id$". // diff --git a/src/fl_color.cxx b/src/fl_color.cxx index d2d737bbb..e0aa7bd3f 100644 --- a/src/fl_color.cxx +++ b/src/fl_color.cxx @@ -23,6 +23,7 @@ // Implementation of fl_color(i), fl_color(r,g,b). +# include <FL/Fl.H> #include <FL/Fl_Device.H> #include <FL/Fl.H> #include <config.h> @@ -30,6 +31,10 @@ // Apple Quartz driver in "drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx" +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: +#ifndef FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- static unsigned fl_cmap[256] = { #include "fl_cmap.h" // this is a file produced by "cmap.cxx": @@ -58,9 +63,18 @@ static unsigned fl_cmap[256] = { // ----------------------------------------------------------------------------- +#endif // FL_LIBRARY_CMAKE + +// ----------------------------------------------------------------------------- + /** \addtogroup fl_attributes @{ */ +/* static */ +unsigned fl_cmap[256] = { +#include "fl_cmap.h" // this is a file produced by "cmap.cxx": +}; + /** Returns the RGB value(s) for the given FLTK color index. diff --git a/src/fl_draw_image.cxx b/src/fl_draw_image.cxx index a4741c746..912063ccb 100644 --- a/src/fl_draw_image.cxx +++ b/src/fl_draw_image.cxx @@ -27,7 +27,14 @@ // defeat some of the shortcuts in translating the image for X. // FIXME: use the correct macros for these conditions -// FIXME: eventuay get rid of this file and use the source files as modules. +// FIXME: eventually get rid of this file and use the source files as modules. + +// ----------------------------------------------------------------------------- +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: +#ifndef FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- + #ifdef WIN32 # include "drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx" #elif defined(__APPLE__) @@ -36,6 +43,10 @@ # include "drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx" #endif +// ----------------------------------------------------------------------------- +#endif // FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- + // // End of "$Id$". // diff --git a/src/fl_font.cxx b/src/fl_font.cxx index 38088d69f..501fb3f02 100644 --- a/src/fl_font.cxx +++ b/src/fl_font.cxx @@ -45,6 +45,12 @@ #include <stdio.h> #include <stdlib.h> +// ----------------------------------------------------------------------------- +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: + +#ifndef FL_LIBRARY_CMAKE + #ifdef WIN32 # include "drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx" #elif defined(__APPLE__) @@ -57,6 +63,10 @@ # include "drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx" #endif // WIN32 +#endif // FL_LIBRARY_CMAKE + +// ----------------------------------------------------------------------------- + #if defined(WIN32) || defined(__APPLE__) #elif defined(FL_PORTING) # pragma message "FL_PORTING: do you need the XFontStruct" diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx index da601fe8e..6b44256d3 100644 --- a/src/fl_line_style.cxx +++ b/src/fl_line_style.cxx @@ -35,8 +35,13 @@ int fl_line_width_ = 0; -// Apple Quartz driver in "drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx" +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: +#ifndef FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- + +// Apple Quartz driver in "drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx" // ----------------------------------------------------------------------------- @@ -60,6 +65,8 @@ int fl_line_width_ = 0; // ----------------------------------------------------------------------------- +#endif // FL_LIBRARY_CMAKE + // // End of "$Id$". // diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index 5530ccfbb..44b303f83 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -64,6 +64,11 @@ Fl_Region Fl_Graphics_Driver::clip_region() { } +// ----------------------------------------------------------------------------- +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: +#ifndef FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- // Apple Quartz driver in "drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx" @@ -87,6 +92,10 @@ Fl_Region Fl_Graphics_Driver::clip_region() { #endif +// ----------------------------------------------------------------------------- +#endif // FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- + // // End of "$Id$". diff --git a/src/fl_vertex.cxx b/src/fl_vertex.cxx index 80f76d3e7..5ff5f644e 100644 --- a/src/fl_vertex.cxx +++ b/src/fl_vertex.cxx @@ -146,6 +146,10 @@ void Fl_Graphics_Driver::fixloop() { // remove equal points from closed path // ----------------------------------------------------------------------------- +// Remove #ifndef FL_LIBRARY_CMAKE and the entire block of #include +// statements when the new build system is ready: +#ifndef FL_LIBRARY_CMAKE +// ----------------------------------------------------------------------------- // Apple Quartz graphics driver "drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx" @@ -173,6 +177,10 @@ void Fl_Graphics_Driver::fixloop() { // remove equal points from closed path // ----------------------------------------------------------------------------- +#endif // FL_LIBRARY_CMAKE + +// ----------------------------------------------------------------------------- + // // End of "$Id$". |
