summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-01-27 18:24:25 +0000
committerManolo Gouy <Manolo>2016-01-27 18:24:25 +0000
commit6177c23d901c8748fd908b3bd1106b403f017d7f (patch)
tree69f3767c7c403b183713c62b6bfa145b704181df /src
parent8e3f66073f8e30e874eb3e6cf76ab0a614c39aad (diff)
Further things related to the r11063 commit.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11064 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Native_File_Chooser_FLTK.cxx11
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.h16
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h11
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx33
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h1
5 files changed, 41 insertions, 31 deletions
diff --git a/src/Fl_Native_File_Chooser_FLTK.cxx b/src/Fl_Native_File_Chooser_FLTK.cxx
index 64da6e69d..c72ee74d0 100644
--- a/src/Fl_Native_File_Chooser_FLTK.cxx
+++ b/src/Fl_Native_File_Chooser_FLTK.cxx
@@ -50,17 +50,6 @@ int Fl_Native_File_Chooser::have_looked_for_GTK_libs = 0;
which can also be changed with type().
*/
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
-#if FLTK_ABI_VERSION <= 10302
- _btype = val;
- _options = NO_OPTIONS;
- _filter = NULL;
- _filtvalue = 0;
- _parsedfilt = NULL;
- _preset_file = NULL;
- _prevvalue = NULL;
- _directory = NULL;
- _errmsg = NULL;
-#endif // FLTK_ABI_VERSION
if (have_looked_for_GTK_libs == 0) {
// First Time here, try to find the GTK libs if they are installed
#if HAVE_DLSYM && HAVE_DLFCN_H
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
index 61dc888f2..86f16b31b 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
@@ -40,6 +40,7 @@ protected:
public:
static const char *class_id;
const char *class_name() {return class_id;};
+ virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
void draw(const char* str, int n, int x, int y);
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* str, int n, int x, int y);
@@ -108,6 +109,21 @@ protected:
void color(uchar r, uchar g, uchar b);
};
+/**
+ 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;
+ virtual int has_feature(driver_feature mask) { return mask & (NATIVE | PRINTER); }
+ 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 // FL_GDI_GRAPHICS_DRIVER_H
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h
index ae597fe13..150e51358 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h
@@ -39,10 +39,11 @@
*
This class is implemented only on the Mac OS X platform.
*/
-class FL_EXPORT Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
+class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
public:
static const char *class_id;
const char *class_name() {return class_id;};
+ virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
@@ -116,6 +117,14 @@ protected:
};
+/** Graphics driver used for Mac OS X printing. */
+class Fl_Quartz_Printer_Graphics_Driver : public Fl_Quartz_Graphics_Driver {
+public:
+ virtual int has_feature(driver_feature mask) { return mask & (NATIVE | PRINTER); }
+};
+
+
+
#endif // FL_CFG_GFX_QUARTZ_H
//
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
index 63dcd07a8..c4f3c9973 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
@@ -32,10 +32,6 @@
extern float fl_quartz_line_width_;
-// FIXME: the use of the macro below can be avoided by adding a specific class
-// for drawing to the prinitng context
-#define USINGQUARTZPRINTER (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id)
-
// --- line and polygon drawing with integer coordinates
@@ -45,11 +41,10 @@ void Fl_Quartz_Graphics_Driver::point(int x, int y) {
void Fl_Quartz_Graphics_Driver::rect(int x, int y, int w, int h) {
if (w<=0 || h<=0) return;
- // FIXME: there should be a quartz graphics driver for the printer device that makes the USINGQUARTZPRINTER obsolete
- if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextStrokeRect(fl_gc, rect);
- if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::rectf(int x, int y, int w, int h) {
@@ -76,7 +71,7 @@ void Fl_Quartz_Graphics_Driver::line(int x, int y, int x1, int y1, int x2, int y
}
void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1) {
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextStrokePath(fl_gc);
@@ -88,11 +83,11 @@ void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1) {
CGContextFillRect(fl_gc, CGRectMake(x-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
CGContextFillRect(fl_gc, CGRectMake(x1-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1, int y2) {
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextAddLineToPoint(fl_gc, x1, y2);
@@ -101,11 +96,11 @@ void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1, int y2) {
CGContextFillRect(fl_gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
CGContextFillRect(fl_gc, CGRectMake(x1 - fl_quartz_line_width_/2, y2-0.5, fl_quartz_line_width_, 1));
}
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) {
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextAddLineToPoint(fl_gc, x1, y2);
@@ -115,11 +110,11 @@ void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) {
CGContextFillRect(fl_gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
CGContextFillRect(fl_gc, CGRectMake(x3-0.5, y2 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1) {
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextStrokePath(fl_gc);
@@ -127,11 +122,11 @@ void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1) {
CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y1-0.5, fl_quartz_line_width_, 1));
}
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1, int x2) {
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextAddLineToPoint(fl_gc, x2, y1);
@@ -140,11 +135,11 @@ void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1, int x2) {
CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
CGContextFillRect(fl_gc, CGRectMake(x2-0.5, y1 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) {
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextAddLineToPoint(fl_gc, x2, y1);
@@ -154,7 +149,7 @@ void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) {
CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
CGContextFillRect(fl_gc, CGRectMake(x2 - fl_quartz_line_width_/2, y3-0.5, fl_quartz_line_width_, 1));
}
- if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
}
void Fl_Quartz_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2) {
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h
index 255e5f16b..bf5b2d3cd 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h
@@ -36,6 +36,7 @@ class FL_EXPORT Fl_Xlib_Graphics_Driver : public Fl_Graphics_Driver {
public:
static const char *class_id;
const char *class_name() {return class_id;};
+ virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
void draw(const char* str, int n, int x, int y);
void draw(int angle, const char *str, int n, int x, int y);
void rtl_draw(const char* str, int n, int x, int y);