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
This commit is contained in:
parent
1c4661c481
commit
8e3f66073f
10
FL/Fl.H
10
FL/Fl.H
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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; }
|
||||
};
|
||||
|
@ -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);
|
||||
|
16
FL/mac.H
16
FL/mac.H
@ -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;
|
||||
|
12
src/Fl.cxx
12
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>
|
||||
|
@ -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() */
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -60,19 +60,8 @@ void load_file(const char *n) {
|
||||
img = img2;
|
||||
b->labelsize(14);
|
||||
b->labelcolor(FL_FOREGROUND_COLOR);
|
||||
#if FLTK_ABI_VERSION >= 10304
|
||||
b->image(img);
|
||||
img->scale(b->w(), b->h());
|
||||
#else
|
||||
if (img->w() <= b->w() && img->h() <= b->h()) b->image(img);
|
||||
else {
|
||||
float fw = img->w() / float(b->w());
|
||||
float fh = img->h() / float(b->h());
|
||||
float f = fw > fh ? fw : fh;
|
||||
b->image(img->copy(img->w()/f, img->h()/f));
|
||||
img->release();
|
||||
}
|
||||
#endif
|
||||
b->label(NULL);
|
||||
b->redraw();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user