summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-01-27 18:11:20 +0000
committerManolo Gouy <Manolo>2016-01-27 18:11:20 +0000
commit8e3f66073f8e30e874eb3e6cf76ab0a614c39aad (patch)
treede1aaad8e102b792439c7cdef6dbb826d6d1ae90 /src
parent1c4661c4816d9e9b8cc37165a554a4d60c5339da (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 'src')
-rw-r--r--src/Fl.cxx12
-rw-r--r--src/Fl_Double_Window.cxx24
-rw-r--r--src/Fl_Gl_Device_Plugin.cxx2
-rw-r--r--src/Fl_Image.cxx2
-rw-r--r--src/Fl_Pixmap.cxx3
-rw-r--r--src/Fl_Quartz_Printer.mm2
-rw-r--r--src/Fl_Shared_Image.cxx15
-rw-r--r--src/Fl_Window.cxx2
-rw-r--r--src/Fl_Window_fullscreen.cxx13
-rw-r--r--src/Fl_Window_shape.cxx7
-rw-r--r--src/Fl_cocoa.mm38
-rw-r--r--src/fl_set_fonts.cxx2
12 files changed, 7 insertions, 115 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 1ac703b9c..9e421f0ff 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1846,18 +1846,6 @@ void Fl::selection(Fl_Widget &owner, const char* text, int len) {
void Fl::paste(Fl_Widget &receiver) {
Fl::paste(receiver, 0);
}
-#if FLTK_ABI_VERSION >= 10303
-#elif !defined(FL_DOXYGEN)
-void Fl::paste(Fl_Widget &receiver, int source)
-{
- Fl::paste(receiver, source, Fl::clipboard_plain_text);
-}
-
-void Fl::copy(const char* stuff, int len, int destination) {
- Fl::copy(stuff, len, destination, Fl::clipboard_plain_text);
-}
-
-#endif
////////////////////////////////////////////////////////////////
#include <FL/fl_draw.H>
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index 559056a46..b3b82d851 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -90,33 +90,9 @@ void Fl_Double_Window::show() {
\param pixmap offscreen buffer containing the rectangle to copy
\param srcx,srcy origin in offscreen buffer of rectangle to copy
*/
-#if FLTK_ABI_VERSION >= 10301
void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
fl_graphics_driver->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
}
-#else
-void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
-#ifdef WIN32
- if (fl_graphics_driver->class_name() == Fl_GDI_Graphics_Driver::class_id ||
- fl_graphics_driver->class_name() == Fl_GDI_Printer_Graphics_Driver::class_id) {
-#else
- if (fl_graphics_driver->class_name() == Fl_Display_Device::display_device()->driver()->class_name()) {
-#endif
-#ifdef USE_X11
- ((Fl_Xlib_Graphics_Driver*)fl_graphics_driver)->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
-#elif defined(WIN32)
- ((Fl_GDI_Graphics_Driver*)fl_graphics_driver)->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
-#elif defined(__APPLE__)
- ((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: call your version of fl_copy_offscreen here"
-#endif
- }
- else { // when copy is not to the display
- fl_graphics_driver->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
- }
-}
-#endif // FLTK_ABI_VERSION
/** @} */
/** see fl_copy_offscreen() */
diff --git a/src/Fl_Gl_Device_Plugin.cxx b/src/Fl_Gl_Device_Plugin.cxx
index ded54219b..16af6fbdb 100644
--- a/src/Fl_Gl_Device_Plugin.cxx
+++ b/src/Fl_Gl_Device_Plugin.cxx
@@ -149,7 +149,7 @@ public:
if (!glw) return 0;
Fl_RGB_Image *img = capture_gl_rectangle(glw, 0, 0, glw->w(), glw->h());
#ifdef __APPLE__
- if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+ if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) {
// convert the image to CGImage, and draw it at full res (useful on retina display)
CGColorSpaceRef cSpace = CGColorSpaceCreateDeviceRGB();
CGDataProviderRef provider = CGDataProviderCreateWithData(img, img->array, img->ld() * img->h(), imgProviderReleaseData);
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index 08cdeba7c..da049386a 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -690,7 +690,7 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP,
CGDataProviderRelease(src);
}
if (img->id_ && fl_gc) {
- if (!img->alloc_array && Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id && !CGImageGetShouldInterpolate((CGImageRef)img->id_)) {
+ if (!img->alloc_array && has_feature(PRINTER) && !CGImageGetShouldInterpolate((CGImageRef)img->id_)) {
// When printing, the image data is used when the page is completed, that is, after return from this function.
// If the image has alloc_array = 0, we must protect against image data being freed before it is used:
// we duplicate the image data and have it deleted after use by the release-callback of the CGImage data provider
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx
index a340048fe..da0c35c65 100644
--- a/src/Fl_Pixmap.cxx
+++ b/src/Fl_Pixmap.cxx
@@ -173,9 +173,6 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP
}
}
-#if FLTK_ABI_VERSION < 10301
-UINT Fl_Pixmap::pixmap_bg_color = 0;
-#endif
void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
diff --git a/src/Fl_Quartz_Printer.mm b/src/Fl_Quartz_Printer.mm
index a323d5844..58153489b 100644
--- a/src/Fl_Quartz_Printer.mm
+++ b/src/Fl_Quartz_Printer.mm
@@ -47,7 +47,7 @@ Fl_System_Printer::Fl_System_Printer(void)
y_offset = 0;
scale_x = scale_y = 1.;
gc = 0;
- driver(new Fl_Quartz_Graphics_Driver);
+ driver(new Fl_Quartz_Printer_Graphics_Driver);
}
Fl_System_Printer::~Fl_System_Printer(void) {
diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx
index 13a0eb5bc..757c51b42 100644
--- a/src/Fl_Shared_Image.cxx
+++ b/src/Fl_Shared_Image.cxx
@@ -90,9 +90,7 @@ Fl_Shared_Image::Fl_Shared_Image() : Fl_Image(0,0,0) {
original_ = 0;
image_ = 0;
alloc_image_ = 0;
-#if FLTK_ABI_VERSION >= 10304
scaled_image_= 0;
-#endif
}
@@ -113,9 +111,7 @@ Fl_Shared_Image::Fl_Shared_Image(const char *n, // I - Filename
image_ = img;
alloc_image_ = !img;
original_ = 1;
-#if FLTK_ABI_VERSION >= 10304
scaled_image_= 0;
-#endif
if (!img) reload();
else update();
@@ -177,9 +173,7 @@ Fl_Shared_Image::update() {
Fl_Shared_Image::~Fl_Shared_Image() {
if (name_) delete[] (char *)name_;
if (alloc_image_) delete image_;
-#if FLTK_ABI_VERSION >= 10304
delete scaled_image_;
-#endif
}
@@ -328,7 +322,6 @@ Fl_Shared_Image::desaturate() {
// 'Fl_Shared_Image::draw()' - Draw a shared image...
//
void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
-#if FLTK_ABI_VERSION >= 10304
if (!image_) {
Fl_Image::draw(X, Y, W, H, cx, cy);
return;
@@ -357,10 +350,6 @@ void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
scaled_image_->draw(X-cx, Y-cy, scaled_image_->w(), scaled_image_->h(), 0, 0);
}
fl_pop_clip();
-#else
- if (image_) image_->draw(X, Y, W, H, cx, cy);
- else Fl_Image::draw(X, Y, W, H, cx, cy);
-#endif // FLTK_ABI_VERSION
}
/** Sets the drawing size of the shared image.
@@ -375,7 +364,7 @@ void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
\param proportional if not null, keep the width and height of the shared image proportional to those of its original image
\param can_expand if null, the width and height of the shared image will not exceed those of the original 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
Example code: scale an image to fit in a box
\code
@@ -388,7 +377,6 @@ void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
*/
void Fl_Shared_Image::scale(int width, int height, int proportional, int can_expand)
{
-#if FLTK_ABI_VERSION >= 10304
w(width);
h(height);
if (!image_) return;
@@ -404,7 +392,6 @@ void Fl_Shared_Image::scale(int width, int height, int proportional, int can_exp
}
w(image_->w() / fw);
h(image_->h() / fh);
-#endif
}
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index dcab9dd62..3271b4db6 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -53,12 +53,10 @@ void Fl_Window::_Fl_Window() {
size_range_set = 0;
minw = maxw = minh = maxh = 0;
shape_data_ = NULL;
-#if FLTK_ABI_VERSION >= 10301
no_fullscreen_x = 0;
no_fullscreen_y = 0;
no_fullscreen_w = w();
no_fullscreen_h = h();
-#endif
callback((Fl_Callback*)default_callback);
}
diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx
index fa1d267dc..aa4b5f92c 100644
--- a/src/Fl_Window_fullscreen.cxx
+++ b/src/Fl_Window_fullscreen.cxx
@@ -31,19 +31,6 @@
#include <config.h>
-#if FLTK_ABI_VERSION < 10301
-int Fl_Window::no_fullscreen_x = 0;
-int Fl_Window::no_fullscreen_y = 0;
-int Fl_Window::no_fullscreen_w = 0;
-int Fl_Window::no_fullscreen_h = 0;
-#endif
-
-#if FLTK_ABI_VERSION < 10303
-int Fl_Window::fullscreen_screen_top = -1;
-int Fl_Window::fullscreen_screen_bottom = -1;
-int Fl_Window::fullscreen_screen_left = -1;
-int Fl_Window::fullscreen_screen_right = -1;
-#endif
void Fl_Window::border(int b) {
if (b) {
diff --git a/src/Fl_Window_shape.cxx b/src/Fl_Window_shape.cxx
index da9423841..37bda6884 100644
--- a/src/Fl_Window_shape.cxx
+++ b/src/Fl_Window_shape.cxx
@@ -285,9 +285,6 @@ void Fl_Window::shape_pixmap_(Fl_Image* pixmap) {
delete rgba;
}
-#if FLTK_ABI_VERSION < 10303 && !defined(FL_DOXYGEN)
-Fl_Window::shape_data_type* Fl_Window::shape_data_ = NULL;
-#endif
/** Assigns a non-rectangular shape to the window.
This function gives an arbitrary shape (not just a rectangular region) to an Fl_Window.
@@ -323,10 +320,9 @@ Fl_Window::shape_data_type* Fl_Window::shape_data_ = NULL;
A usage example is found at example/shapedwindow.cxx.
- \version 1.3.3 (and requires compilation with FLTK_ABI_VERSION >= 10303)
+ \version 1.3.3 (and requires compilation with FL_ABI_VERSION >= 10303)
*/
void Fl_Window::shape(const Fl_Image* img) {
-#if FLTK_ABI_VERSION >= 10303
if (shape_data_) {
if (shape_data_->todelete_) { delete shape_data_->todelete_; }
#if defined(__APPLE__)
@@ -343,7 +339,6 @@ void Fl_Window::shape(const Fl_Image* img) {
else if (d == 0) shape_bitmap_((Fl_Image*)img);
else if (d == 2 || d == 4) shape_alpha_((Fl_Image*)img, d - 1);
else if ((d == 1 || d == 3) && img->count() == 1) shape_alpha_((Fl_Image*)img, 0);
-#endif
}
void Fl_Window::draw() {
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 45dd10fc0..7c12a2136 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -1207,72 +1207,36 @@ static void orderfront_subwindows(FLWindow *xid)
}
}
-#if FLTK_ABI_VERSION >= 10304
static const unsigned windowDidResize_mask = 1;
-#else
-static const unsigned long windowDidResize_mask = 1;
-#endif
bool Fl_X::in_windowDidResize() {
-#if FLTK_ABI_VERSION >= 10304
return mapped_to_retina_ & windowDidResize_mask;
-#else
- return (unsigned long)xidChildren & windowDidResize_mask;
-#endif
}
void Fl_X::in_windowDidResize(bool b) {
-#if FLTK_ABI_VERSION >= 10304
if (b) mapped_to_retina_ |= windowDidResize_mask;
else mapped_to_retina_ &= ~windowDidResize_mask;
-#else
- if (b) xidChildren = (Fl_X*)((unsigned long)xidChildren | windowDidResize_mask);
- else xidChildren = (Fl_X*)((unsigned long)xidChildren & ~windowDidResize_mask);
-#endif
}
-#if FLTK_ABI_VERSION >= 10304
static const unsigned mapped_mask = 2;
static const unsigned changed_mask = 4;
-#else
-static const unsigned long mapped_mask = 2; // sizeof(unsigned long) = sizeof(Fl_X*)
-static const unsigned long changed_mask = 4;
-#endif
bool Fl_X::mapped_to_retina() {
-#if FLTK_ABI_VERSION >= 10304
return mapped_to_retina_ & mapped_mask;
-#else
- return (unsigned long)xidChildren & mapped_mask;
-#endif
}
void Fl_X::mapped_to_retina(bool b) {
-#if FLTK_ABI_VERSION >= 10304
if (b) mapped_to_retina_ |= mapped_mask;
else mapped_to_retina_ &= ~mapped_mask;
-#else
- if (b) xidChildren = (Fl_X*)((unsigned long)xidChildren | mapped_mask);
- else xidChildren = (Fl_X*)((unsigned long)xidChildren & ~mapped_mask);
-#endif
}
bool Fl_X::changed_resolution() {
-#if FLTK_ABI_VERSION >= 10304
return mapped_to_retina_ & changed_mask;
-#else
- return (unsigned long)xidChildren & changed_mask;
-#endif
}
void Fl_X::changed_resolution(bool b) {
-#if FLTK_ABI_VERSION >= 10304
if (b) mapped_to_retina_ |= changed_mask;
else mapped_to_retina_ &= ~changed_mask;
-#else
- if (b) xidChildren = (Fl_X*)((unsigned long)xidChildren | changed_mask);
- else xidChildren = (Fl_X*)((unsigned long)xidChildren & ~changed_mask);
-#endif
}
@@ -4445,7 +4409,7 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
}
int bx, by, bt;
get_window_frame_sizes(bx, by, bt);
- BOOL to_quartz = (this->driver()->class_name() == Fl_Quartz_Graphics_Driver::class_id);
+ BOOL to_quartz = (this->driver()->has_feature(Fl_Graphics_Driver::NATIVE));
CALayer *layer = get_titlebar_layer(win);
if (layer) { // if title bar uses a layer
if (to_quartz) { // to Quartz printer
diff --git a/src/fl_set_fonts.cxx b/src/fl_set_fonts.cxx
index 8118619a6..f65d6f85e 100644
--- a/src/fl_set_fonts.cxx
+++ b/src/fl_set_fonts.cxx
@@ -26,7 +26,7 @@
//# include "fl_set_fonts_win32.cxx"
// now included for fl_font.cxx, but will be its own source code module in drivers/Xlib/Fl_Xlib_Graphics_Driver_font..."
#elif defined(__APPLE__)
-//# include "fl_set_fonts_mac.cxx"
+# include "fl_set_fonts_mac.cxx"
// now included for fl_font.cxx, but will be its own source code module in drivers/Xlib/Fl_Xlib_Graphics_Driver_font..."
#elif USE_XFT
//# include "fl_set_fonts_xft.cxx"