diff options
| author | Manolo Gouy <Manolo> | 2016-01-27 18:11:20 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-01-27 18:11:20 +0000 |
| commit | 8e3f66073f8e30e874eb3e6cf76ab0a614c39aad (patch) | |
| tree | de1aaad8e102b792439c7cdef6dbb826d6d1ae90 /FL | |
| parent | 1c4661c4816d9e9b8cc37165a554a4d60c5339da (diff) | |
1) Added a new way to detect whether the drawing operation is using the platform's native driver
and whether we are printing: virtual int Fl_Graphics_Driver::has_feature(driver_feature feature)
This is also because it is not convenient to derive a printer-specific driver with its own
implementation of virtual functions when this implementation differs only in one line of code.
2) Solved the problem of inclusion of non public header by the public header FL/Fl_Device.H:
bracket this with #if FL_LIBRARY / #endif so this non public header is included only when building
FLTK itself.
3) Removed several (but not all) of the FLTK_ABI_VERSION guards that are no longer
useful for code targeting FLTK 1.4.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11063 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl.H | 10 | ||||
| -rw-r--r-- | FL/Fl_Device.H | 33 | ||||
| -rw-r--r-- | FL/Fl_Help_View.H | 8 | ||||
| -rw-r--r-- | FL/Fl_Native_File_Chooser.H | 25 | ||||
| -rw-r--r-- | FL/Fl_Paged_Device.H | 6 | ||||
| -rw-r--r-- | FL/Fl_Pixmap.H | 3 | ||||
| -rw-r--r-- | FL/Fl_Scroll.H | 8 | ||||
| -rw-r--r-- | FL/Fl_Shared_Image.H | 4 | ||||
| -rw-r--r-- | FL/Fl_Window.H | 31 | ||||
| -rw-r--r-- | FL/mac.H | 16 |
10 files changed, 17 insertions, 127 deletions
@@ -895,12 +895,7 @@ public: To copy graphical data, use the Fl_Copy_Surface class. The \p type argument may allow in the future to copy other kinds of data. */ -#if FLTK_ABI_VERSION >= 10303 || defined(FL_DOXYGEN) static void copy(const char* stuff, int len, int destination = 0, const char *type = Fl::clipboard_plain_text); // platform dependent -#else - static void copy(const char* stuff, int len, int destination, const char *type); - static void copy(const char* stuff, int len, int destination = 0); -#endif #if defined(__APPLE__) // not needed @@ -945,12 +940,7 @@ public: can be pasted as image data. */ -#if FLTK_ABI_VERSION >= 10303 || defined(FL_DOXYGEN) static void paste(Fl_Widget &receiver, int source, const char *type = Fl::clipboard_plain_text); // platform dependent -#else - static void paste(Fl_Widget &receiver, int source, const char *type); - static void paste(Fl_Widget &receiver, int source /*=0*/); -#endif /** FLTK will call the registered callback whenever there is a change to the selection buffer or the clipboard. The source argument indicates which diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index fbab76feb..20ac74893 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -119,6 +119,12 @@ class FL_EXPORT Fl_Graphics_Driver : public Fl_Device { public: /** A 2D coordinate transformation matrix */ struct matrix {double a, b, c, d, x, y;}; + /** Features that a derived class may possess. */ + typedef enum { + NATIVE = 1, /**< native graphics driver for the platform */ + PRINTER = 2 /**< graphics driver for a printer drawing surface */ + } driver_feature; + int fl_clip_state_number; protected: static const matrix m0; @@ -220,6 +226,8 @@ public: virtual void draw(const char *str, int n, float x, float y) { draw(str, n, (int)(x+0.5), (int)(y+0.5));} virtual void draw(int angle, const char *str, int n, int x, int y) { draw(str, n, x, y); } virtual void rtl_draw(const char *str, int n, int x, int y) { draw(str, n, x, y); } + /** Returns non-zero if the graphics driver possesses the \p feature */ + virtual int has_feature(driver_feature feature) { return 0; } virtual void font(Fl_Font face, Fl_Fontsize fsize) {font_ = face; size_ = fsize;} virtual Fl_Font font() {return font_; } virtual Fl_Fontsize size() {return size_; } @@ -266,28 +274,15 @@ protected: #if defined(__APPLE__) -// FIXME: add Fl_Quartz_Printer_Graphics_Driver -// FIXME: it should not be required to include this file here. This is nothing that the user should have access to. +#if FL_LIBRARY #include "src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h" +#endif #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. +#if FL_LIBRARY #include "src/drivers/GDI/Fl_GDI_Graphics_Driver.h" - -/** - The graphics driver used when printing on MSWindows. - * - This class is implemented only on the MSWindows platform. It 's extremely similar to Fl_GDI_Graphics_Driver. - */ -class FL_EXPORT Fl_GDI_Printer_Graphics_Driver : public Fl_GDI_Graphics_Driver { -public: - static const char *class_id; - const char *class_name() {return class_id;}; - void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); - void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy); - int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP); -}; +#endif #elif defined(FL_PORTING) @@ -301,9 +296,9 @@ protected: #else // X11 -// FIXME: it should not be required to include this file here. This is nothing that the user should have access to. +#if FL_LIBRARY #include "src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h" - +#endif #endif diff --git a/FL/Fl_Help_View.H b/FL/Fl_Help_View.H index a370c3011..abc5bc739 100644 --- a/FL/Fl_Help_View.H +++ b/FL/Fl_Help_View.H @@ -260,13 +260,9 @@ class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget void add_target(const char *n, int yy); static int compare_targets(const Fl_Help_Target *t0, const Fl_Help_Target *t1); int do_align(Fl_Help_Block *block, int line, int xx, int a, int &l); -#if FLTK_ABI_VERSION >= 10303 protected: -#endif void draw(); -#if FLTK_ABI_VERSION >= 10303 private: -#endif void format(); void format_table(int *table_width, int *columns, const char *table); void free_data(); @@ -275,13 +271,9 @@ private: Fl_Color get_color(const char *n, Fl_Color c); Fl_Shared_Image *get_image(const char *name, int W, int H); int get_length(const char *l); -#if FLTK_ABI_VERSION >= 10303 public: -#endif int handle(int); -#if FLTK_ABI_VERSION >= 10303 private: -#endif void hv_draw(const char *t, int x, int y); char begin_selection(); diff --git a/FL/Fl_Native_File_Chooser.H b/FL/Fl_Native_File_Chooser.H index 135f0399c..0bf4b11ab 100644 --- a/FL/Fl_Native_File_Chooser.H +++ b/FL/Fl_Native_File_Chooser.H @@ -27,16 +27,8 @@ #ifdef WIN32 // #define _WIN32_WINNT 0x0501 // needed for OPENFILENAME's 'FlagsEx' -#if defined(FL_LIBRARY) || FLTK_ABI_VERSION < 10304 -# include <windows.h> -# include <commdlg.h> // OPENFILENAMEW, GetOpenFileName() -# include <shlobj.h> // BROWSEINFOW, SHBrowseForFolder() -typedef OPENFILENAMEW fl_OPENFILENAMEW; -typedef BROWSEINFOW fl_BROWSEINFOW; -#else typedef void fl_OPENFILENAMEW; typedef void fl_BROWSEINFOW; -#endif # include <FL/filename.H> // FL_EXPORT // Use Apple's chooser @@ -162,13 +154,8 @@ public: private: int _btype; // kind-of browser to show() int _options; // general options -#if FLTK_ABI_VERSION >= 10304 fl_OPENFILENAMEW *_ofn_ptr; // GetOpenFileName() & GetSaveFileName() struct fl_BROWSEINFOW *_binf_ptr; // SHBrowseForFolder() struct -#else - fl_OPENFILENAMEW _ofn; - fl_BROWSEINFOW _binf; -#endif char **_pathnames; // array of pathnames int _tpathnames; // total pathnames char *_directory; // default pathname to use @@ -240,18 +227,6 @@ private: #else private: -#if FLTK_ABI_VERSION <= 10302 - int _btype; // kind-of browser to show() - int _options; // general options - int _nfilters; - char *_filter; // user supplied filter - char *_parsedfilt; // parsed filter - int _filtvalue; // selected filter - char *_preset_file; - char *_prevvalue; // Returned filename - char *_directory; - char *_errmsg; // error message -#endif static int have_looked_for_GTK_libs; union { Fl_FLTK_File_Chooser *_x11_file_chooser; diff --git a/FL/Fl_Paged_Device.H b/FL/Fl_Paged_Device.H index 968f87b74..164cf247f 100644 --- a/FL/Fl_Paged_Device.H +++ b/FL/Fl_Paged_Device.H @@ -110,15 +110,9 @@ protected: int y_offset; /** \brief The constructor */ Fl_Paged_Device() : Fl_Surface_Device(NULL), x_offset(0), y_offset(0) {}; -#if FLTK_ABI_VERSION >= 10301 public: /** \brief The destructor */ virtual ~Fl_Paged_Device() {}; -#else - /** \brief The destructor */ - virtual ~Fl_Paged_Device() {}; -public: -#endif // FLTK_ABI_VERSION static const char *class_id; const char *class_name() {return class_id;}; virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL); diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H index 06b28f8dd..65f056b84 100644 --- a/FL/Fl_Pixmap.H +++ b/FL/Fl_Pixmap.H @@ -60,9 +60,6 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image { private: #if defined(WIN32) -#if FLTK_ABI_VERSION < 10301 - static // a static member is needed for ABI compatibility -#endif UINT pixmap_bg_color; // RGB color used for pixmap background void *id_; // for internal use void *mask_; // for internal use (mask bitmap) diff --git a/FL/Fl_Scroll.H b/FL/Fl_Scroll.H index f1c2deca6..f7192a01d 100644 --- a/FL/Fl_Scroll.H +++ b/FL/Fl_Scroll.H @@ -94,16 +94,12 @@ class FL_EXPORT Fl_Scroll : public Fl_Group { void fix_scrollbar_order(); static void draw_clip(void*,int,int,int,int); -#if FLTK_ABI_VERSION >= 10303 -protected: // NEW (STR#1895) -#else -private: // OLD -#endif +protected: // (STR#1895) /** Structure to manage scrollbar and widget interior sizes. This is filled out by recalc_scrollbars() for use in calculations that need to know the visible scroll area size, etc. - \note Availability in FLTK_ABI_VERSION 10303 or higher. + \note Availability in FL_ABI_VERSION 10303 or higher. */ typedef struct { /// A local struct to manage a region defined by xywh diff --git a/FL/Fl_Shared_Image.H b/FL/Fl_Shared_Image.H index 09bd636b2..2bc490688 100644 --- a/FL/Fl_Shared_Image.H +++ b/FL/Fl_Shared_Image.H @@ -44,9 +44,7 @@ class FL_EXPORT Fl_Shared_Image : public Fl_Image { private: static Fl_RGB_Scaling scaling_algorithm_; // method used to rescale RGB source images -#if FLTK_ABI_VERSION >= 10304 Fl_Image *scaled_image_; -#endif protected: static Fl_Shared_Image **images_; // Shared images @@ -101,7 +99,7 @@ public: and then drawing the resized copy. This occurs, e.g., when drawing to screen under Linux or MSWindows after having called Fl_Shared_Image::scale(). This function controls what method is used when the image to be resized is an Fl_RGB_Image. - \version 1.3.4 and requires compiling with FLTK_ABI_VERSION = 10304 + \version 1.3.4 and requires compiling with FL_ABI_VERSION = 10304 */ static void scaling_algorithm(Fl_RGB_Scaling algorithm) {scaling_algorithm_ = algorithm; } }; diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index 0a69a4c13..a8f2515e8 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -60,37 +60,13 @@ class FL_EXPORT Fl_Window : public Fl_Group { // Note: we must use separate statements for each of the following 8 variables, // with the static attribute, otherwise MS VC++ 2008/2010 complains :-( // AlbrechtS 04/2012 -#if FLTK_ABI_VERSION < 10301 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int no_fullscreen_x; -#if FLTK_ABI_VERSION < 10301 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int no_fullscreen_y; -#if FLTK_ABI_VERSION < 10301 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int no_fullscreen_w; -#if FLTK_ABI_VERSION < 10301 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int no_fullscreen_h; -#if FLTK_ABI_VERSION < 10303 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int fullscreen_screen_top; -#if FLTK_ABI_VERSION < 10303 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int fullscreen_screen_bottom; -#if FLTK_ABI_VERSION < 10303 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int fullscreen_screen_left; -#if FLTK_ABI_VERSION < 10303 - static // when these members are static, ABI compatibility with 1.3.0 is respected -#endif int fullscreen_screen_right; friend class Fl_X; @@ -121,10 +97,6 @@ class FL_EXPORT Fl_Window : public Fl_Group { uchar size_range_set; // cursor stuff Fl_Cursor cursor_default; -#if FLTK_ABI_VERSION < 10303 - // legacy, not used - Fl_Color cursor_fg, cursor_bg; -#endif protected: /** Data supporting a non-rectangular window shape */ @@ -145,9 +117,6 @@ protected: Fl_Bitmap *todelete_; ///< auxiliary bitmap image }; -#if FLTK_ABI_VERSION < 10303 && !defined(FL_DOXYGEN) - static -#endif shape_data_type *shape_data_; ///< non-null means the window has a non-rectangular shape private: void shape_bitmap_(Fl_Image* b); @@ -144,14 +144,7 @@ public: Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window) Fl_Window *w; // FLTK window for Fl_Region region; -#if FLTK_ABI_VERSION < 10304 - Fl_Region subRegion; // for ABI compatibility, recycled to replace subRect_ -#endif Fl_X *next; // chain of mapped windows -#if FLTK_ABI_VERSION < 10304 - Fl_X *xidChildren; // useless with true subwindows, recycled to replace mapped_to_retina_ - Fl_X *xidNext; // useless with true subwindows -#endif int wait_for_expose; NSCursor *cursor; static Fl_X* first; @@ -160,13 +153,8 @@ public: static void make(Fl_Window*); void flush(); static void set_high_resolution(bool); -#if FLTK_ABI_VERSION >= 10304 CGRect* subRect() { return subRect_; } // getter void subRect(CGRect *r) { subRect_ = r; } // setter -#else - CGRect* subRect() { return (CGRect*)subRegion; } // getter - void subRect(CGRect *r) { subRegion = (Fl_Region)r; } // setter -#endif bool mapped_to_retina(); // is window mapped to retina display? void mapped_to_retina(bool); // sets whether window is mapped to retina display bool changed_resolution(); // did window just moved to display with another resolution? @@ -213,14 +201,10 @@ public: static int calc_mac_os_version(void); // computes the fl_mac_os_version global variable static void clip_to_rounded_corners(CGContextRef gc, int w, int h); private: -#if FLTK_ABI_VERSION >= 10304 CGRect* subRect_; // makes sure subwindow remains inside its parent window // stores 3 binary flags: whether window is mapped to retina display; whether resolution just changed; // whether window is OpenGL and is currently being resized. unsigned mapped_to_retina_; -#else - bool subwindow; // for ABI compatibility, useless with true subwindows -#endif }; extern Window fl_window; |
