summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
commit998cc6df521a115454727d1ecf6bc7d4fee96f68 (patch)
tree70a1c9afffb294a75bd38484c2e6e4a042ac3426 /src
parent5bc66fafc348c547870bbf51c9c4a7215ad4ff25 (diff)
Merge of branch-1.3-Fl_Printer, with the following main changes:
(1) adding Fl_Device class (and more) for device abstraction (2) adding Fl_Pinter class (and more) for printing support. Todo: Code cleanup, update dependencies, remove/replace test print window. I'm looking into converting the test window popup in a global shortcut that would pop up the print dialog now... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7263 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx2
-rw-r--r--src/Fl_Bitmap.cxx56
-rw-r--r--src/Fl_Device.cxx160
-rw-r--r--src/Fl_GDI_Printer.cxx253
-rw-r--r--src/Fl_Gl_Choice.cxx10
-rw-r--r--src/Fl_Gl_Printer.cxx82
-rw-r--r--src/Fl_Image.cxx5
-rw-r--r--src/Fl_PS_Printer.cxx1295
-rw-r--r--src/Fl_Pixmap.cxx54
-rw-r--r--src/Fl_Printer.cxx9
-rw-r--r--src/Fl_Quartz_Printer.mm273
-rw-r--r--src/Fl_cocoa.mm61
-rw-r--r--src/Fl_win32.cxx63
-rw-r--r--src/Fl_x.cxx57
-rw-r--r--src/Makefile8
-rw-r--r--src/fl_arc.cxx2
-rw-r--r--src/fl_arci.cxx4
-rw-r--r--src/fl_color.cxx4
-rw-r--r--src/fl_color_mac.cxx4
-rw-r--r--src/fl_color_win32.cxx4
-rw-r--r--src/fl_curve.cxx2
-rw-r--r--src/fl_draw_image.cxx8
-rw-r--r--src/fl_draw_image_mac.cxx28
-rw-r--r--src/fl_draw_image_win32.cxx20
-rw-r--r--src/fl_font_mac.cxx6
-rw-r--r--src/fl_font_win32.cxx23
-rw-r--r--src/fl_font_xft.cxx46
-rw-r--r--src/fl_line_style.cxx4
-rw-r--r--src/fl_rect.cxx100
-rw-r--r--src/fl_vertex.cxx45
-rw-r--r--src/makedepend414
-rw-r--r--src/print_panel.cxx600
-rw-r--r--src/print_panel.h55
-rw-r--r--src/ps_image.cxx560
34 files changed, 4010 insertions, 307 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 9670e29c2..fce36c8b4 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1474,7 +1474,7 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
XDestroyRegion(R);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- CGRect arg = FL_CGRECTMAKE_COCOA(X, Y, W, H);
+ CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
int j; // don't add a rectangle totally inside the Fl_Region
for(j = 0; j < i->region->count; j++) {
if(CGRectContainsRect(i->region->rects[j], arg)) break;
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx
index 26019091b..513858e78 100644
--- a/src/Fl_Bitmap.cxx
+++ b/src/Fl_Bitmap.cxx
@@ -37,6 +37,7 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Bitmap.H>
+#include <FL/Fl_Printer.H>
#include "flstring.h"
#if defined(__APPLE_QUARTZ__)
@@ -264,6 +265,10 @@ Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array)
}
void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
+ if(fl_device->type() == Fl_Device::postscript_device) {
+ ((Fl_Virtual_Printer*)fl_device)->draw(this, XP, YP, WP, HP, cx, cy);
+ return;
+ }
if (!array) {
draw_empty(XP, YP);
return;
@@ -293,12 +298,51 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
#elif defined(WIN32)
if (!id) id = fl_create_bitmap(w(), h(), array);
- HDC tempdc = CreateCompatibleDC(fl_gc);
- int save = SaveDC(tempdc);
- SelectObject(tempdc, (HGDIOBJ)id);
- SelectObject(fl_gc, fl_brush());
- // secret bitblt code found in old MSWindows reference manual:
- BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
+ typedef BOOL (WINAPI* fl_transp_func) (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
+ static fl_transp_func fl_TransparentBlt;
+ HDC tempdc;
+ int save;
+ BOOL use_print_algo = false;
+ if (fl_device->type() == Fl_Device::gdi_printer) {
+ static HMODULE hMod = NULL;
+ if (!hMod) {
+ hMod = LoadLibrary("MSIMG32.DLL");
+ if (hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
+ }
+ if (hMod) use_print_algo = true;
+ }
+ if (use_print_algo) { // algorithm for bitmap output to Fl_GDI_Printer
+ Fl_Offscreen tmp_id = fl_create_offscreen(W, H);
+ fl_begin_offscreen(tmp_id);
+ Fl_Color save_c = fl_color(); // save bitmap's desired color
+ uchar r, g, b;
+ Fl::get_color(save_c, r, g, b);
+ r = 255-r;
+ g = 255-g;
+ b = 255-b;
+ Fl_Color background = fl_rgb_color(r, g, b); // a color very different from the bitmap's
+ fl_color(background);
+ fl_rectf(0,0,W,H); // use this color as offscreen background
+ fl_color(save_c); // back to bitmap's color
+ tempdc = CreateCompatibleDC(fl_gc);
+ save = SaveDC(tempdc);
+ SelectObject(tempdc, (HGDIOBJ)id);
+ SelectObject(fl_gc, fl_brush()); // use bitmap's desired color
+ BitBlt(fl_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen
+ fl_end_offscreen(); // offscreen data is in tmp_id
+ SelectObject(tempdc, (HGDIOBJ)tmp_id); // use offscreen data
+ // draw it to printer context with background color as transparent
+ fl_TransparentBlt(fl_gc, X,Y,W,H, tempdc, cx, cy, w(), h(), RGB(r, g, b) );
+ fl_delete_offscreen(tmp_id);
+ }
+ else { // algorithm for bitmap output to display
+ tempdc = CreateCompatibleDC(fl_gc);
+ save = SaveDC(tempdc);
+ SelectObject(tempdc, (HGDIOBJ)id);
+ SelectObject(fl_gc, fl_brush());
+ // secret bitblt code found in old MSWindows reference manual:
+ BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
+ }
RestoreDC(tempdc, save);
DeleteDC(tempdc);
#elif defined(__APPLE_QUARTZ__)
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
new file mode 100644
index 000000000..03e8367ac
--- /dev/null
+++ b/src/Fl_Device.cxx
@@ -0,0 +1,160 @@
+/*
+ * Fl_Device.cxx
+ *
+ */
+
+#include <FL/Fl.H>
+#include <FL/Fl_Device.H>
+#include <FL/Fl_Printer.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Image.H>
+
+extern Fl_Device *fl_device;
+
+void Fl_Device::draw(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, int cy)
+{
+ // presently, never gets called
+}
+
+void Fl_Device::draw(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int cy)
+{
+ // presently, never gets called
+}
+
+void Fl_Device::draw(Fl_RGB_Image *rgb,int XP, int YP, int WP, int HP, int cx, int cy)
+{
+ // presently, never gets called
+}
+
+void Fl_Virtual_Printer::print_widget(Fl_Widget* widget, int delta_x, int delta_y)
+{
+ int old_x, old_y, new_x, new_y, is_window;
+ if ( ! widget->visible() ) return;
+ is_window = (widget->as_window() != NULL);
+ widget->damage(FL_DAMAGE_ALL);
+ // set origin to the desired top-left position of the widget
+ origin(&old_x, &old_y);
+ new_x = old_x + delta_x;
+ new_y = old_y + delta_y;
+ if (!is_window) {
+ new_x -= widget->x();
+ new_y -= widget->y();
+ }
+ if (new_x != old_x || new_y != old_y) {
+ translate(new_x - old_x, new_y - old_y );
+ }
+ // if widget is a window, clip all drawings to the window area
+ if (is_window) fl_push_clip(0, 0, widget->w(), widget->h() );
+#ifdef __APPLE__
+ CGContextRef save_gc = fl_gc;
+#elif defined(WIN32) // && !defined(__CYGWIN__)
+ HDC save_gc = fl_gc;
+#else
+ _XGC *save_gc = fl_gc; // FIXME
+#endif
+ widget->draw();
+ fl_gc = save_gc;
+ if (is_window) fl_pop_clip();
+ // find subwindows of widget and print them
+ traverse(widget);
+ // reset origin to where it was
+ if (new_x != old_x || new_y != old_y) {
+ untranslate();
+ }
+}
+
+
+void Fl_Virtual_Printer::traverse(Fl_Widget *widget)
+{
+ Fl_Group *g = widget->as_group();
+ if (!g) return;
+ int n = g->children();
+ for (int i = 0; i < n; i++) {
+ Fl_Widget *c = g->child(i);
+ if ( !c->visible() ) continue;
+ if ( c->as_window() ) {
+ print_widget(c, c->x(), c->y());
+ }
+ else traverse(c);
+ }
+}
+
+void Fl_Virtual_Printer::origin(int *x, int *y)
+{
+ if (x) *x = x_offset;
+ if (y) *y = y_offset;
+}
+
+void Fl_Virtual_Printer::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y)
+{
+ Fl_Device::display_device()->set_current();
+ Fl_Window *save_front = Fl::first_window();
+ win->show();
+ Fl::check();
+ win->make_current();
+ uchar *image_data = fl_read_image(NULL, x, y, w, h);
+ save_front->show();
+ this->set_current();
+ Fl_RGB_Image *image = new Fl_RGB_Image(image_data, w, h);
+ image->draw(delta_x, delta_y);
+ add_image(image, image_data);
+}
+
+void Fl_Virtual_Printer::add_image(Fl_Image *image, const uchar *data)
+{
+ struct chain_elt *elt = (struct chain_elt *)calloc(sizeof(struct chain_elt), 1);
+ elt->image = image;
+ elt->data = data;
+ if (image_list_) { elt->next = image_list_; }
+ image_list_ = elt;
+}
+
+void Fl_Virtual_Printer::delete_image_list()
+{
+ while(image_list_) {
+ struct chain_elt *next = image_list_->next;
+ delete image_list_->image;
+ if (image_list_->data) delete image_list_->data;
+ free(image_list_);
+ image_list_ = next;
+ }
+}
+
+Fl_Device *Fl_Virtual_Printer::set_current(void)
+{
+#ifdef __APPLE__
+ fl_gc = (CGContextRef)gc;
+#elif defined(WIN32)
+ fl_gc = (HDC)gc;
+#else
+ fl_gc = (_XGC*)gc;
+#endif
+ return this->Fl_Device::set_current();
+}
+
+
+int Fl_Virtual_Printer::start_job(int pagecount, int *frompage, int *topage) {return 1;}
+int Fl_Virtual_Printer::start_page (void) {return 1;}
+int Fl_Virtual_Printer::printable_rect(int *w, int *h) {return 1;}
+void Fl_Virtual_Printer::margins(int *left, int *top, int *right, int *bottom) {}
+void Fl_Virtual_Printer::origin(int x, int y) {}
+void Fl_Virtual_Printer::scale (float scale_x, float scale_y) {}
+void Fl_Virtual_Printer::rotate(float angle) {}
+int Fl_Virtual_Printer::end_page (void) {return 1;}
+void Fl_Virtual_Printer::end_job (void) {}
+void Fl_Virtual_Printer::translate(int x, int y) {}
+void Fl_Virtual_Printer::untranslate(void) {}
+
+extern Fl_Device *fl_device;
+
+Fl_Device *Fl_Device::set_current(void)
+{
+ Fl_Device *current = fl_device;
+ fl_device = this;
+ return current;
+}
+
+Fl_Device *Fl_Device::current(void)
+{
+ return fl_device;
+}
diff --git a/src/Fl_GDI_Printer.cxx b/src/Fl_GDI_Printer.cxx
new file mode 100644
index 000000000..a87b0805f
--- /dev/null
+++ b/src/Fl_GDI_Printer.cxx
@@ -0,0 +1,253 @@
+/*
+ * Fl_GDI_Printer.cxx
+ */
+
+#ifdef WIN32
+#include <FL/Fl_Printer.H>
+
+
+#include <FL/fl_ask.H>
+#include <math.h>
+
+extern HWND fl_window;
+
+Fl_GDI_Printer::Fl_GDI_Printer(void) : Fl_Virtual_Printer() {
+ hPr = NULL;
+ type_ = gdi_printer;
+}
+
+static void WIN_SetupPrinterDeviceContext(HDC prHDC)
+{
+ if ( !prHDC ) return;
+
+ fl_window = 0;
+ fl_gc = prHDC;
+ SetGraphicsMode(prHDC, GM_ADVANCED); // to allow for rotations
+ SetMapMode(prHDC, MM_ANISOTROPIC);
+ SetTextAlign(prHDC, TA_BASELINE|TA_LEFT);
+ SetBkMode(prHDC, TRANSPARENT);
+ // this matches 720 logical units to the number of device units in 10 inches of paper
+ // thus the logical unit is the point (= 1/72 inch)
+ SetWindowExtEx(prHDC, 720, 720, NULL);
+ SetViewportExtEx(prHDC, 10*GetDeviceCaps(prHDC, LOGPIXELSX), 10*GetDeviceCaps(prHDC, LOGPIXELSY), NULL);
+}
+
+
+int Fl_GDI_Printer::start_job (int pagecount, int *frompage, int *topage)
+// returns 0 iff OK
+{
+ DWORD commdlgerr;
+ DOCINFO di;
+ char docName [256];
+ int err = 0;
+
+ abortPrint = FALSE;
+ memset (&pd, 0, sizeof (PRINTDLG));
+ pd.lStructSize = sizeof (PRINTDLG);
+ pd.hwndOwner = GetForegroundWindow();
+ pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE | PD_NOSELECTION;
+ pd.nMinPage = 1;
+ pd.nMaxPage = pagecount;
+ if (PrintDlg (&pd) != 0) {
+ hPr = pd.hDC;
+ if (hPr != NULL) {
+ strcpy (docName, "FLTK");
+ memset(&di, 0, sizeof(DOCINFO));
+ di.cbSize = sizeof (DOCINFO);
+ di.lpszDocName = (LPCSTR) docName;
+ prerr = StartDoc (hPr, &di);
+ if (prerr < 1) {
+ abortPrint = TRUE;
+ fl_alert ("StartDoc error %d", prerr);
+ err = 1;
+ }
+ } else {
+ commdlgerr = CommDlgExtendedError ();
+ fl_alert ("Unable to create print context, error %lu",
+ (unsigned long) commdlgerr);
+ err = 1;
+ }
+ } else {
+ err = 1;
+ }
+ if(!err) {
+ if((pd.Flags & PD_PAGENUMS) != 0 ) {
+ if (frompage) *frompage = pd.nFromPage;
+ if (topage) *topage = pd.nToPage;
+ }
+ else {
+ if (frompage) *frompage = 1;
+ if (topage) *topage = pagecount;
+ }
+ x_offset = 0;
+ y_offset = 0;
+ this->set_current();
+ }
+ return err;
+}
+
+void Fl_GDI_Printer::end_job (void)
+{
+ Fl_Device::display_device()->set_current();
+ if (hPr != NULL) {
+ if (! abortPrint) {
+ prerr = EndDoc (hPr);
+ if (prerr < 0) {
+ fl_alert ("EndDoc error %d", prerr);
+ }
+ }
+ DeleteDC (hPr);
+ if (pd.hDevMode != NULL) {
+ GlobalFree (pd.hDevMode);
+ }
+ if (pd.hDevNames != NULL) {
+ GlobalFree (pd.hDevNames);
+ }
+ }
+}
+
+void Fl_GDI_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)
+{
+ POINT physPageSize;
+ POINT pixelsPerInch;
+
+ if (hPr == NULL) return;
+ SetWindowOrgEx(fl_gc, 0, 0, NULL);
+
+ physPageSize.x = GetDeviceCaps(hPr, HORZRES);
+ physPageSize.y = GetDeviceCaps(hPr, VERTRES);
+ DPtoLP(hPr, &physPageSize, 1);
+ *w = physPageSize.x + 1;
+ *h = physPageSize.y + 1;
+ pixelsPerInch.x = GetDeviceCaps(hPr, LOGPIXELSX);
+ pixelsPerInch.y = GetDeviceCaps(hPr, LOGPIXELSY);
+ DPtoLP(hPr, &pixelsPerInch, 1);
+ left_margin = (pixelsPerInch.x / 4);
+ *w -= (pixelsPerInch.x / 2);
+ top_margin = (pixelsPerInch.y / 4);
+ *h -= (pixelsPerInch.y / 2);
+
+ *x = left_margin;
+ *y = top_margin;
+ origin(x_offset, y_offset);
+}
+
+void Fl_GDI_Printer::margins(int *left, int *top, int *right, int *bottom)
+{
+ int x, y, w, h;
+ absolute_printable_rect(&x, &y, &w, &h);
+ if (left) *left = x;
+ if (top) *top = y;
+ if (right) *right = x;
+ if (bottom) *bottom = y;
+}
+
+int Fl_GDI_Printer::printable_rect(int *w, int *h)
+{
+ int x, y;
+ absolute_printable_rect(&x, &y, w, h);
+ return 0;
+}
+
+int Fl_GDI_Printer::start_page (void)
+{
+ int rsult, w, h;
+
+ rsult = 0;
+ if (hPr != NULL) {
+ WIN_SetupPrinterDeviceContext (hPr);
+ prerr = StartPage (hPr);
+ if (prerr < 0) {
+ fl_alert ("StartPage error %d", prerr);
+ rsult = 1;
+ }
+ printable_rect(&w, &h);
+ origin(0, 0);
+ image_list_ = NULL;
+ fl_clip_region(0);
+ gc = (void *)fl_gc;
+ }
+ return rsult;
+}
+
+void Fl_GDI_Printer::origin (int deltax, int deltay)
+{
+ SetWindowOrgEx(fl_gc, - left_margin - deltax, - top_margin - deltay, NULL);
+ x_offset = deltax;
+ y_offset = deltay;
+}
+
+void Fl_GDI_Printer::scale (float scalex, float scaley)
+{
+ int w, h;
+ SetWindowExtEx(fl_gc, (int)(720 / scalex + 0.5), (int)(720 / scaley + 0.5), NULL);
+ printable_rect(&w, &h);
+ origin(0, 0);
+}
+
+void Fl_GDI_Printer::rotate (float rot_angle)
+{
+ XFORM mat;
+ float angle;
+ angle = - rot_angle * M_PI / 180.;
+ mat.eM11 = cos(angle);
+ mat.eM12 = sin(angle);
+ mat.eM21 = - mat.eM12;
+ mat.eM22 = mat.eM11;
+ mat.eDx = mat.eDy = 0;
+ SetWorldTransform(fl_gc, &mat);
+}
+
+int Fl_GDI_Printer::end_page (void)
+{
+ int rsult;
+
+ rsult = 0;
+ if (hPr != NULL) {
+ prerr = EndPage (hPr);
+ if (prerr < 0) {
+ abortPrint = TRUE;
+ fl_alert ("EndPage error %d", prerr);
+ rsult = 1;
+ }
+ }
+ delete_image_list();
+ gc = NULL;
+ return rsult;
+}
+
+static int translate_stack_depth = 0;
+const int translate_stack_max = 5;
+static int translate_stack_x[translate_stack_max];
+static int translate_stack_y[translate_stack_max];
+
+static void do_translate(int x, int y)
+{
+ XFORM tr;
+ tr.eM11 = tr.eM22 = 1;
+ tr.eM12 = tr.eM21 = 0;
+ tr.eDx = x;
+ tr.eDy = y;
+ ModifyWorldTransform(fl_gc, &tr, MWT_LEFTMULTIPLY);
+}
+
+void Fl_GDI_Printer::translate (int x, int y)
+{
+ do_translate(x, y);
+ if (translate_stack_depth < translate_stack_max) {
+ translate_stack_x[translate_stack_depth] = x;
+ translate_stack_y[translate_stack_depth] = y;
+ translate_stack_depth++;
+ }
+}
+
+void Fl_GDI_Printer::untranslate (void)
+{
+ if (translate_stack_depth > 0) {
+ translate_stack_depth--;
+ do_translate( - translate_stack_x[translate_stack_depth], - translate_stack_y[translate_stack_depth] );
+ }
+}
+
+#endif // WIN32
+
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index 88ed16d1c..75fc9dea8 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -315,11 +315,15 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
aglEnable( (GLContext)context, AGL_BUFFER_RECT );
}
#if defined(__APPLE_COCOA__)
+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- aglSetWindowRef(context, MACwindowRef(window) );
-#else
- aglSetDrawable( context, GetWindowPort( MACwindowRef(window) ) );
+ if (aglSetWindowRef != NULL) {
+ aglSetWindowRef(context, MACwindowRef(window) );
+ }
+ else
#endif
+ aglSetDrawable( context, GetWindowPort( MACwindowRef(window) ) );
+
#else
aglSetDrawable( context, GetWindowPort( fl_xid(window) ) );
#endif
diff --git a/src/Fl_Gl_Printer.cxx b/src/Fl_Gl_Printer.cxx
new file mode 100644
index 000000000..ddea19aca
--- /dev/null
+++ b/src/Fl_Gl_Printer.cxx
@@ -0,0 +1,82 @@
+/*
+ * Fl_Gl_Printer.cxx
+ */
+
+#include "FL/Fl_Gl_Printer.H"
+#include "Fl_Gl_Choice.H"
+#include "FL/Fl.H"
+#ifndef __APPLE__
+#include "FL/fl_draw.H"
+#endif
+
+void Fl_Gl_Printer::print_gl_window(Fl_Gl_Window *glw, int x, int y)
+{
+#ifdef WIN32
+ HDC save_gc = fl_gc;
+ const int bytesperpixel = 3;
+#elif defined(__APPLE__)
+ CGContextRef save_gc = fl_gc;
+ const int bytesperpixel = 4;
+#else
+ _XGC *save_gc = fl_gc; // FIXME Linux/Unix
+ const int bytesperpixel = 3;
+#endif
+ glw->redraw();
+ Fl::check();
+ glw->make_current();
+ // select front buffer as our source for pixel data
+ glReadBuffer(GL_FRONT);
+ // Read OpenGL context pixels directly.
+ // For extra safety, save & restore OpenGL states that are changed
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPixelStorei(GL_PACK_ALIGNMENT, 4); /* Force 4-byte alignment */
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_PACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+ // Read a block of pixels from the frame buffer
+ int mByteWidth = glw->w() * bytesperpixel;
+ mByteWidth = (mByteWidth + 3) & ~3; // Align to 4 bytes
+ uchar *baseAddress = (uchar*)malloc(mByteWidth * glw->h());
+ glReadPixels(0, 0, glw->w(), glw->h(),
+#ifdef WIN32
+ GL_RGB, GL_UNSIGNED_BYTE,
+#elif defined(__APPLE__)
+ GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+#else // FIXME Linux/Unix
+ GL_RGB, GL_UNSIGNED_BYTE,
+#endif
+ baseAddress);
+ glPopClientAttrib();
+ fl_gc = save_gc;
+#ifdef WIN32
+ fl_draw_image(baseAddress + (glw->h() - 1) * mByteWidth, x, y , glw->w(), glw->h(), bytesperpixel, - mByteWidth);
+#elif defined(__APPLE__)
+ CGColorSpaceRef cSpace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
+ CGContextRef bitmap = CGBitmapContextCreate(baseAddress, glw->w(), glw->h(), 8, mByteWidth, cSpace,
+#if __BIG_ENDIAN__
+ kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big /* XRGB Big Endian */);
+#else
+ kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little /* XRGB Little Endian */);
+#endif
+ if(bitmap == NULL) return;
+ CFRelease(cSpace);
+ // Make an image out of our bitmap
+ CGImageRef image = CGBitmapContextCreateImage(bitmap);
+ if(image == NULL) return;
+ CFRelease(bitmap);
+ CGContextSaveGState(fl_gc);
+ int w, h;
+ this->printable_rect(&w, &h);
+ CGContextTranslateCTM(fl_gc, 0, h);
+ CGContextScaleCTM(fl_gc, 1.0f, -1.0f);
+ CGRect rect = { { x, h - y - glw->h() }, { glw->w(), glw->h() } };
+ Fl_X::q_begin_image(rect, 0, 0, glw->w(), glw->h());
+ CGContextDrawImage(fl_gc, rect, image);
+ Fl_X::q_end_image();
+ CGContextRestoreGState(fl_gc);
+ CFRelease(image);
+#else // FIXME Linux/Unix
+ fl_draw_image(baseAddress + (glw->h() - 1) * mByteWidth, x, y , glw->w(), glw->h(), bytesperpixel, - mByteWidth);
+#endif // WIN32
+ free(baseAddress);
+}
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index 849d43f90..b11ba0ce5 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -31,6 +31,7 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Image.H>
+#include <FL/Fl_Printer.H>
#include "flstring.h"
#ifdef WIN32
@@ -434,6 +435,10 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
#endif // !WIN32 && !USE_QUARTZ
void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
+ if(fl_device->type() == Fl_Device::postscript_device) {
+ ((Fl_Virtual_Printer*)fl_device)->draw(this, XP, YP, WP, HP, cx, cy);
+ return;
+ }
// Don't draw an empty image...
if (!d() || !array) {
draw_empty(XP, YP);
diff --git a/src/Fl_PS_Printer.cxx b/src/Fl_PS_Printer.cxx
new file mode 100644
index 000000000..8504b28b7
--- /dev/null
+++ b/src/Fl_PS_Printer.cxx
@@ -0,0 +1,1295 @@
+/*
+ * Fl_PS_Printer.cxx
+ *
+ */
+#include <FL/Fl_Device.H>
+
+#include <FL/Fl.H>
+#include <FL/fl_ask.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Native_File_Chooser.H>
+#include <stdio.h>
+#include <math.h>
+
+#if ! (defined(__APPLE__) || defined(WIN32) )
+ #include "print_panel.cxx"
+#endif
+
+const struct Fl_PSfile_Device::page_format Fl_PSfile_Device::page_formats[NO_PAGE_FORMATS] = { // order of enum Page_Format
+// comes from appendix B of 5003.PPD_Spec_v4.3.pdf
+
+ // A* // index(Ai) = i
+ {2384, 3370, "A0"},
+ {1684, 2384, "A1"},
+ {1191, 1684, "A2"},
+ { 842, 1191, "A3"},
+ { 595, 842, "A4"},
+ { 420, 595, "A5"},
+ { 297, 420, "A6"},
+ { 210, 297, "A7"},
+ { 148, 210, "A8"},
+ { 105, 148, "A9"},
+
+ // B* // index(Bi) = i+10
+ {2920, 4127, "B0"},
+ {2064, 2920, "B1"},
+ {1460, 2064, "B2"},
+ {1032, 1460, "B3"},
+ { 729, 1032, "B4"},
+ { 516, 729, "B5"},
+ { 363, 516, "B6"},
+ { 258, 363, "B7"},
+ { 181, 258, "B8"},
+ { 127, 181, "B9"},
+ { 91, 127, "B10"},
+
+ // others (look at Fl_Printer.H} //
+ { 459, 649, "EnvC5"}, // envelope
+ { 312, 624, "EnvDL"}, // envelope
+ { 522, 756, "Executive"},
+ { 595, 935, "Folio"},
+ {1224, 792, "Ledger"}, // landscape
+ { 612, 1008, "Legal"},
+ { 612, 792, "Letter"},
+ { 792, 1224, "Tabloid"},
+ { 297, 684, "Env10"} // envelope
+};
+
+// Prolog string
+
+static const char * prolog =
+"%%BeginProlog\n"
+"/L { /y2 exch def\n"
+"/x2 exch def\n"
+"/y1 exch def\n"
+"/x1 exch def\n"
+"newpath x1 y1 moveto x2 y2 lineto\n"
+"stroke}\n"
+"bind def\n"
+
+
+"/R { /dy exch def\n"
+"/dx exch def\n"
+"/y exch def\n"
+"/x exch def\n"
+"newpath\n"
+"x y moveto\n"
+"dx 0 rlineto\n"
+"0 dy rlineto\n"
+"dx neg 0 rlineto\n"
+"closepath stroke\n"
+"} bind def\n"
+
+"/CL {\n"
+"/dy exch def\n"
+"/dx exch def\n"
+"/y exch def\n"
+"/x exch def\n"
+"newpath\n"
+"x y moveto\n"
+"dx 0 rlineto\n"
+"0 dy rlineto\n"
+"dx neg 0 rlineto\n"
+"closepath\n"
+"clip\n"
+"} bind def\n"
+
+"/FR { /dy exch def\n"
+"/dx exch def\n"
+"/y exch def\n"
+"/x exch def\n"
+"currentlinewidth 0 setlinewidth newpath\n"
+"x y moveto\n"
+"dx 0 rlineto\n"
+"0 dy rlineto\n"
+"dx neg 0 rlineto\n"
+"closepath fill setlinewidth\n"
+"} bind def\n"
+
+"/GS { gsave } bind def\n"
+"/GR { grestore } bind def\n"
+
+"/SP { showpage } bind def\n"
+"/LW { setlinewidth } bind def\n"
+"/CF /Courier def\n"
+"/SF { /CF exch def } bind def\n"
+"/fsize 12 def\n"
+"/FS { /fsize exch def fsize CF findfont exch scalefont setfont }def \n"
+
+
+"/GL { setgray } bind def\n"
+"/SRGB { setrgbcolor } bind def\n"
+
+// color images
+
+"/CI { GS /py exch def /px exch def /sy exch def /sx exch def\n"
+"translate \n"
+"sx sy scale px py 8 \n"
+"[ px 0 0 py neg 0 py ]\n"
+"currentfile /ASCIIHexDecode filter\n false 3"
+" colorimage GR\n"
+"} bind def\n"
+
+// gray images
+
+"/GI { GS /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale px py 8 \n"
+
+
+"[ px 0 0 py neg 0 py ]\n"
+"currentfile /ASCIIHexDecode filter\n"
+"image GR\n"
+"} bind def\n"
+
+// single-color bitmask
+
+"/MI { GS /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale px py false \n"
+"[ px 0 0 py neg 0 py ]\n"
+"currentfile /ASCIIHexDecode filter\n"
+"imagemask GR\n"
+"} bind def\n"
+
+
+// path
+
+"/BFP { newpath moveto } def\n"
+"/BP { newpath } bind def \n"
+"/PL { lineto } bind def \n"
+"/PM { moveto } bind def \n"
+"/MT { moveto } bind def \n"
+"/LT { lineto } bind def \n"
+"/EFP { closepath fill } bind def\n" //was:stroke
+"/ELP { stroke } bind def\n"
+"/ECP { closepath stroke } bind def\n" // Closed (loop)
+"/LW { setlinewidth } bind def\n"
+
+// ////////////////////////// misc ////////////////
+"/TR { translate } bind def\n"
+"/CT { concat } bind def\n"
+"/RCT { matrix invertmatrix concat} bind def\n"
+"/SC { scale } bind def\n"
+//"/GPD { currentpagedevice /PageSize get} def\n"
+
+// show at position with desired width
+// usage:
+// width (string) x y show_pos_width
+"/show_pos_width {GS moveto dup stringwidth pop 3 2 roll exch div -1 matrix scale concat "
+"show GR } bind def\n"
+//"/show_pos_width {GS moveto dup stringwidth pop 3 2 roll exch div dup /sx exch def -1 matrix scale concat "
+//"show 6 FS sx 10 string cvs show GR } bind def\n" // displays also scaling value
+
+;
+
+
+static const char * prolog_2 = // prolog relevant only if lang_level >1
+
+// color image dictionaries
+"/CII {GS /inter exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceRGB setcolorspace\n"
+"/IDD 8 dict def\n"
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+"/Decode [ 0 1 0 1 0 1 ] def\n"
+"end\n"
+"IDD image GR} bind def\n"
+
+// gray image dict
+
+
+"/GII {GS /inter exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceGray setcolorspace\n"
+"/IDD 8 dict def\n"
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+"/Decode [ 0 1 ] def\n"
+"end\n"
+"IDD image GR} bind def\n"
+
+;
+
+static const char * prolog_2_pixmap = // prolog relevant only if lang_level == 2 for pixmaps
+"/pixmap_size { /pixmap_sy exch def /pixmap_sx exch def } bind def\n"
+
+"/pixmap_mat {[ pixmap_sx 0 0 pixmap_sy neg 0 pixmap_sy ]} bind def\n"
+
+"/pixmap_dict {"
+"<< /PatternType 1 "
+"/PaintType 1 "
+"/TilingType 2 "
+"/BBox [0 0 pixmap_sx pixmap_sy] "
+"/XStep pixmap_sx "
+"/YStep pixmap_sy\n"
+"/PaintProc "
+"{ begin "
+"pixmap_sx pixmap_sy scale "
+"pixmap_sx pixmap_sy 8 "
+"pixmap_mat "
+"pixmap_data "
+"false 3 "
+"colorimage "
+"end "
+"} bind "
+">>\n"
+"} bind def\n"
+
+"/pixmap_plot {"
+"GS "
+"/pixmap_y exch def /pixmap_x exch def\n"
+"pixmap_x pixmap_y translate\n"
+"pixmap_dict matrix makepattern setpattern\n"
+"pixmap_sx pixmap_sy scale\n"
+"pixmap_sx pixmap_sy\n"
+"true\n"
+"pixmap_mat\n"
+"pixmap_mask\n"
+"imagemask\n"
+"GR\n"
+"} bind def\n"
+
+"/pixmap_loaddata { /pixmap_data currentfile pixmap_sx pixmap_sy 3 mul mul string readhexstring "
+"} bind def\n"
+
+"/pixmap_loadmask { "
+"/pixmap_mask currentfile pixmap_sx 8 div ceiling cvi pixmap_sy mul string readhexstring "
+"} bind def\n"
+;
+
+
+
+static const char * prolog_3 = // prolog relevant only if lang_level >2
+
+// masked color images
+"/CIM {GS /inter exch def /my exch def /mx exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceRGB setcolorspace\n"
+
+"/IDD 8 dict def\n"
+
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+
+"/Decode [ 0 1 0 1 0 1 ] def\n"
+"end\n"
+
+"/IMD 8 dict def\n"
+"IMD begin\n"
+"/ImageType 1 def\n"
+"/Width mx def\n"
+"/Height my def\n"
+"/BitsPerComponent 1 def\n"
+// "/Interpolate inter def\n"
+"/ImageMatrix [ mx 0 0 my neg 0 my ] def\n"
+"/Decode [ 1 0 ] def\n"
+"end\n"
+
+"<<\n"
+"/ImageType 3\n"
+"/InterleaveType 2\n"
+"/MaskDict IMD\n"
+"/DataDict IDD\n"
+">> image GR\n"
+"} bind def\n"
+
+
+// masked gray images
+"/GIM {GS /inter exch def /my exch def /mx exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceGray setcolorspace\n"
+
+"/IDD 8 dict def\n"
+
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+
+"/Decode [ 0 1 ] def\n"
+"end\n"
+
+"/IMD 8 dict def\n"
+
+"IMD begin\n"
+"/ImageType 1 def\n"
+"/Width mx def\n"
+"/Height my def\n"
+"/BitsPerComponent 1 def\n"
+"/ImageMatrix [ mx 0 0 my neg 0 my ] def\n"
+"/Decode [ 1 0 ] def\n"
+"end\n"
+
+"<<\n"
+"/ImageType 3\n"
+"/InterleaveType 2\n"
+"/MaskDict IMD\n"
+"/DataDict IDD\n"
+">> image GR\n"
+"} bind def\n"
+
+
+"\n"
+;
+
+// end prolog
+
+
+Fl_PSfile_Device::Fl_PSfile_Device(void)
+{
+ close_cmd_ = 0;
+ //lang_level_ = 3;
+ lang_level_ = 2;
+ mask = 0;
+ ps_filename_ = NULL;
+ type_ = postscript_device;
+#ifdef __APPLE__
+ gc = fl_gc; // the display context is used by fl_text_extents()
+#endif
+}
+
+int Fl_PSfile_Device::start_postscript (int pagecount, enum Page_Format format, enum Page_Layout layout)
+//returns 0 iff OK
+{
+ int w, h, x;
+ this->set_current();
+ if (format == A4) {
+ left_margin = 18;
+ top_margin = 18;
+ }
+ else {
+ left_margin = 12;
+ top_margin = 12;
+ }
+ page_format_ = (enum Page_Format)(format | layout);
+
+ fputs("%!PS-Adobe-3.0\n", output);
+ fputs("%%Creator: FLTK\n", output);
+ if (lang_level_>1)
+ fprintf(output, "%%%%LanguageLevel: %i\n" , lang_level_);
+ if ((pages_ = pagecount))
+ fprintf(output, "%%%%Pages: %i\n", pagecount);
+ else
+ fputs("%%Pages: (atend)\n", output);
+ fprintf(output, "%%%%BeginFeature: *PageSize %s\n", page_formats[format].name );
+ w = page_formats[format].width;
+ h = page_formats[format].height;
+ if (lang_level_ == 3 && (layout & LANDSCAPE) ) { x = w; w = h; h = x; }
+ fprintf(output, "<</PageSize[%d %d]>>setpagedevice\n", w, h );
+ fputs("%%EndFeature\n", output);
+ fputs("%%EndComments\n", output);
+ fputs(prolog, output);
+ if (lang_level_ > 1) {
+ fputs(prolog_2, output);
+ }
+ if (lang_level_ == 2) {
+ fputs(prolog_2_pixmap, output);
+ }
+ if (lang_level_ > 2)
+ fputs(prolog_3, output);
+ if (lang_level_ >= 3) {
+ fputs("/CS { clipsave } bind def\n", output);
+ fputs("/CR { cliprestore } bind def\n", output);
+ } else {
+ fputs("/CS { GS } bind def\n", output);
+ fputs("/CR { GR } bind def\n", output);
+ }
+ page_policy_ = 1;
+
+
+ fputs("%%EndProlog\n",output);
+ if (lang_level_ >= 2)
+ fprintf(output,"<< /Policies << /Pagesize 1 >> >> setpagedevice\n");
+
+ reset();
+ nPages=0;
+ return 0;
+}
+
+Fl_PSfile_Device::~Fl_PSfile_Device() {
+ if (ps_filename_) free(ps_filename_);
+}
+
+void Fl_PSfile_Device::recover(){
+ color(cr_,cg_,cb_);
+ line_style(linestyle_,linewidth_,linedash_);
+ font(font_,size_);
+}
+
+void Fl_PSfile_Device::reset(){
+ gap_=1;
+ clip_=0;
+ cr_=cg_=cb_=0;
+ font_=FL_HELVETICA;
+ size_=12;
+ linewidth_=0;
+ linestyle_=FL_SOLID;
+ strcpy(linedash_,"");
+ Clip *c=clip_; ////just not to have memory leaks for badly writen code (forgotten clip popping)
+
+ while(c){
+ clip_=clip_->prev;
+ delete c;
+ c=clip_;
+ }
+
+}
+
+void Fl_PSfile_Device::page_policy(int p){
+ page_policy_ = p;
+ if(lang_level_>=2)
+ fprintf(output,"<< /Policies << /Pagesize %i >> >> setpagedevice\n", p);
+}
+
+// //////////////////// paging //////////////////////////////////////////
+
+
+
+void Fl_PSfile_Device::page(double pw, double ph, int media) {
+
+ if (nPages){
+ fprintf(output, "CR\nGR\nGR\nGR\nSP\nrestore\n");
+ }
+ ++nPages;
+ fprintf(output, "%%%%Page: %i %i\n" , nPages , nPages);
+ if (pw>ph){
+ fprintf(output, "%%%%PageOrientation: Landscape\n");
+ }else{
+ fprintf(output, "%%%%PageOrientation: Portrait\n");
+ }
+
+ fprintf(output, "%%%%BeginPageSetup\n");
+ if((media & MEDIA) &&(lang_level_>1)){
+ int r = media & REVERSED;
+ if(r) r = 2;
+ fprintf(output, "<< /PageSize [%i %i] /Orientation %i>> setpagedevice\n", (int)(pw+.5), (int)(ph+.5), r);
+ }
+ fprintf(output, "%%%%EndPageSetup\n");
+
+ pw_ = pw;
+ ph_ = ph;
+ reset();
+
+ fprintf(output, "save\n");
+ fprintf(output, "GS\n");
+ fprintf(output, "%g %g TR\n", (double)0 /*lm_*/ , ph_ /* - tm_*/);
+ fprintf(output, "1 -1 SC\n");
+ line_style(0);
+ fprintf(output, "GS\n");
+
+ if (!((media & MEDIA) &&(lang_level_>1))){
+ if (pw > ph) {
+ if(media & REVERSED) {
+ fprintf(output, "-90 rotate %i 0 translate\n", int(-pw));
+ }
+ else {
+ fprintf(output, "90 rotate -%i -%i translate\n", (lang_level_ == 2 ? int(pw - ph) : 0), int(ph));
+ }
+ }
+ else {
+ if(media & REVERSED)
+ fprintf(output, "180 rotate %i %i translate\n", int(-pw), int(-ph));
+ }
+ }
+ fprintf(output, "GS\nCS\n");
+};
+
+void Fl_PSfile_Device::page(int format){
+
+
+ if(format & LANDSCAPE){
+ ph_=Fl_PSfile_Device::page_formats[format & 0xFF].width;
+ pw_=Fl_PSfile_Device::page_formats[format & 0xFF].height;
+ }else{
+ pw_=Fl_PSfile_Device::page_formats[format & 0xFF].width;
+ ph_=Fl_PSfile_Device::page_formats[format & 0xFF].height;
+ }
+ page(pw_,ph_,format & 0xFF00);//,orientation only;
+};
+
+void Fl_PSfile_Device::rect(int x, int y, int w, int h) {
+ // Commented code does not work, i can't find the bug ;-(
+ // fprintf(output, "GS\n");
+ // fprintf(output, "%i, %i, %i, %i R\n", x , y , w, h);
+ // fprintf(output, "GR\n");
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x , y);
+ fprintf(output, "%i %i LT\n", x+w-1 , y);
+ fprintf(output, "%i %i LT\n", x+w-1 , y+h-1);
+ fprintf(output, "%i %i LT\n", x , y+h-1);
+ fprintf(output, "ECP\n");
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::rectf(int x, int y, int w, int h) {
+ fprintf(output, "%g %g %i %i FR\n", x-0.5, y-0.5, w, h);
+}
+
+void Fl_PSfile_Device::line(int x1, int y1, int x2, int y2) {
+ fprintf(output, "GS\n");
+ fprintf(output, "%i %i %i %i L\n", x1 , y1, x2 ,y2);
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::line(int x0, int y0, int x1, int y1, int x2, int y2) {
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x0 , y0);
+ fprintf(output, "%i %i LT\n", x1 , y1);
+ fprintf(output, "%i %i LT\n", x2 , y2);
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::xyline(int x, int y, int x1, int y2, int x3){
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x , y );
+ fprintf(output, "%i %i LT\n", x1 , y );
+ fprintf(output, "%i %i LT\n", x1 , y2);
+ fprintf(output,"%i %i LT\n", x3 , y2);
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+};
+
+
+void Fl_PSfile_Device::xyline(int x, int y, int x1, int y2){
+
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x , y);
+ fprintf(output,"%i %i LT\n", x1 , y);
+ fprintf(output, "%i %i LT\n", x1 , y2 );
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+};
+
+void Fl_PSfile_Device::xyline(int x, int y, int x1){
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x , y);
+ fprintf(output, "%i %i LT\n", x1 , y );
+ fprintf(output, "ELP\n");
+
+ fprintf(output, "GR\n");
+};
+
+void Fl_PSfile_Device::yxline(int x, int y, int y1, int x2, int y3){
+ fprintf(output, "GS\n");
+
+ fprintf(output,"BP\n");
+ fprintf(output,"%i %i MT\n", x , y);
+ fprintf(output, "%i %i LT\n", x , y1 );
+ fprintf(output, "%i %i LT\n", x2 , y1 );
+ fprintf(output , "%i %i LT\n", x2 , y3);
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+};
+
+void Fl_PSfile_Device::yxline(int x, int y, int y1, int x2){
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x , y);
+ fprintf(output, "%i %i LT\n", x , y1);
+ fprintf(output, "%i %i LT\n", x2 , y1);
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+};
+
+void Fl_PSfile_Device::yxline(int x, int y, int y1){
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x , y);
+ fprintf(output, "%i %i LT\n", x , y1);
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+};
+
+void Fl_PSfile_Device::loop(int x0, int y0, int x1, int y1, int x2, int y2) {
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x0 , y0);
+ fprintf(output, "%i %i LT\n", x1 , y1);
+ fprintf(output, "%i %i LT\n", x2 , y2);
+ fprintf(output, "ECP\n");
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) {
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x0 , y0);
+ fprintf(output, "%i %i LT\n", x1 , y1);
+ fprintf(output, "%i %i LT\n", x2 , y2);
+ fprintf(output, "%i %i LT\n", x3 , y3);
+ fprintf(output, "ECP\n");
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::polygon(int x0, int y0, int x1, int y1, int x2, int y2) {
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x0 , y0);
+ fprintf(output,"%i %i LT\n", x1 , y1);
+ fprintf(output, "%i %i LT\n", x2 , y2);
+ fprintf(output, "EFP\n");
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) {
+ fprintf(output, "GS\n");
+ fprintf(output,"BP\n");
+ fprintf(output, "%i %i MT\n", x0 , y0 );
+ fprintf(output, "%i %i LT\n", x1 , y1 );
+ fprintf(output, "%i %i LT\n", x2 , y2 );
+ fprintf(output, "%i %i LT\n", x3 , y3 );
+
+ fprintf(output, "EFP\n");
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::point(int x, int y){
+ rectf(x,y,1,1);
+}
+
+static int dashes_flat[5][7]={
+{-1,0,0,0,0,0,0},
+{3,1,-1,0,0,0,0},
+{1,1,-1,0,0,0,0},
+{3,1,1,1,-1,0,0},
+{3,1,1,1,1,1,-1}
+};
+
+
+//yeah, hack...
+static double dashes_cap[5][7]={
+{-1,0,0,0,0,0,0},
+{2,2,-1,0,0,0,0},
+{0.01,1.99,-1,0,0,0,0},
+{2,2,0.01,1.99,-1,0,0},
+{2,2,0.01,1.99,0.01,1.99,-1}
+};
+
+
+void Fl_PSfile_Device::line_style(int style, int width, char* dashes){
+ //line_styled_=1;
+
+ linewidth_=width;
+ linestyle_=style;
+ //dashes_= dashes;
+ if(dashes){
+ if(dashes != linedash_)
+ strcpy(linedash_,dashes);
+
+ }else
+ linedash_[0]=0;
+ char width0 = 0;
+ if(!width){
+ width=1; //for screen drawing compatability
+ width0=1;
+ }
+
+ fprintf(output, "%i setlinewidth\n", width);
+
+ if(!style && (!dashes || !(*dashes)) && width0) //system lines
+ style = FL_CAP_SQUARE;
+
+ int cap = (style &0xf00) >> 8;
+ if(cap) cap--;
+ fprintf(output,"%i setlinecap\n", cap);
+
+ int join = (style & 0xf000) >> 12;
+
+ if(join) join--;
+ fprintf(output,"%i setlinejoin\n", join);
+
+
+ fprintf(output, "[");
+ if(dashes && *dashes){
+ while(*dashes){
+ fprintf(output, "%i ", *dashes);
+ dashes++;
+ }
+ }else{
+ int * ds;
+ if(style & 0x200){ // round and square caps, dash length need to be adjusted
+ double *dt = dashes_cap[style & 0xff];
+ while (*dt >= 0){
+ fprintf(output, "%g ",width * (*dt));
+ dt++;
+ }
+ }else{
+
+ ds = dashes_flat[style & 0xff];
+ while (*ds >= 0){
+ fprintf(output, "%i ",width * (*ds));
+ ds++;
+ }
+ }
+ }
+ fprintf(output, "] 0 setdash\n");
+};
+
+static const char *_fontNames[] = {
+"Helvetica",
+"Helvetica-Bold",
+"Helvetica-Oblique",
+"Helvetica-BoldOblique",
+"Courier",
+"Courier-Bold",
+"Courier-Oblique",
+"Courier-BoldOblique",
+"Times",
+"Times-Bold",
+"Times-Italic",
+"Times-BoldItalic",
+"Symbol",
+"Courier",
+"CourierBold",
+"ZapfDingbats"
+};
+
+void Fl_PSfile_Device::font(int f, int s) {
+ if (f >= FL_FREE_FONT)
+ f = FL_COURIER;
+ fprintf(output, "/%s SF\n" , _fontNames[f]);
+ fprintf(output,"%i FS\n", s);
+ Fl_Device::display_device()->font(f,s); // Use display fonts for font measurement
+ font_ = f; size_ = s;
+};
+
+void Fl_PSfile_Device::color(Fl_Color c) {
+ //colored_=1;
+ color_=c;
+ Fl::get_color(c, cr_, cg_, cb_);
+ if (cr_==cg_ && cg_==cb_) {
+ double gray = cr_/255.0;
+ fprintf(output, "%g GL\n", gray);
+
+ } else {
+ double fr, fg, fb;
+ fr = cr_/255.0;
+ fg = cg_/255.0;
+ fb = cb_/255.0;
+ fprintf(output,"%g %g %g SRGB\n", fr , fg , fb);
+ }
+}
+
+void Fl_PSfile_Device::color(unsigned char r, unsigned char g, unsigned char b) {
+ //colored_=1;
+ cr_=r;cg_=g;cb_=b;
+ if (r==g && g==b) {
+ double gray = r/255.0;
+ fprintf(output, "%g GL\n", gray);
+ } else {
+ double fr, fg, fb;
+ fr = r/255.0;
+ fg = g/255.0;
+ fb = b/255.0;
+ fprintf(output, "%g %g %g SRGB\n", fr , fg , fb);
+ }
+}
+
+void Fl_PSfile_Device::draw(int angle, const char *str, int n, int x, int y)
+{
+ fprintf(output, "GS %d %d translate %d rotate\n", x, y, - angle);
+ this->transformed_draw(str, n, 0, 0);
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::transformed_draw(const char* str, int n, double x, double y){
+ if (!n || !str || !*str)return;
+ fprintf(output,"%g (", fl_width(str, n));
+ int i=1;
+ for (int j=0;j<n;j++){
+ if (i>240){
+ fprintf(output, "\\\n");
+ i=0;
+ }
+ i++;
+ switch (*str) {
+ case '(': case ')':
+ fprintf(output, "\\%c" , *str);
+ break;
+ default:
+ fprintf(output, "%c", *str);
+ }
+ str++;
+ }
+ fprintf(output, ") %g %g show_pos_width\n", x, y);
+}
+
+struct matrix {double a, b, c, d, x, y;};
+extern matrix * fl_matrix;
+
+void Fl_PSfile_Device::concat(){
+ fprintf(output,"[%g %g %g %g %g %g] CT\n", fl_matrix->a , fl_matrix->b , fl_matrix->c , fl_matrix->d , fl_matrix->x , fl_matrix->y);
+}
+
+void Fl_PSfile_Device::reconcat(){
+ fprintf(output, "[%g %g %g %g %g %g] RCT\n" , fl_matrix->a , fl_matrix->b , fl_matrix->c , fl_matrix->d , fl_matrix->x , fl_matrix->y);
+}
+
+///////////////// transformed (double) drawings ////////////////////////////////
+
+
+void Fl_PSfile_Device::begin_points(){
+ fprintf(output, "GS\n");
+ concat();
+
+ fprintf(output, "BP\n");
+ gap_=1;
+ shape_=POINTS;
+};
+
+void Fl_PSfile_Device::begin_line(){
+ fprintf(output, "GS\n");
+ concat();
+ fprintf(output, "BP\n");
+ gap_=1;
+ shape_=LINE;
+};
+
+void Fl_PSfile_Device::begin_loop(){
+ fprintf(output, "GS\n");
+ concat();
+ fprintf(output, "BP\n");
+ gap_=1;
+ shape_=LOOP;
+};
+
+void Fl_PSfile_Device::begin_polygon(){
+ fprintf(output, "GS\n");
+ concat();
+ fprintf(output, "BP\n");
+ gap_=1;
+ shape_=POLYGON;
+};
+
+void Fl_PSfile_Device::vertex(double x, double y){
+ if(shape_==POINTS){
+ fprintf(output,"%g %g MT\n", x , y);
+ gap_=1;
+ return;
+ }
+ if(gap_){
+ fprintf(output,"%g %g MT\n", x , y);
+ gap_=0;
+ }else
+ fprintf(output, "%g %g LT\n", x , y);
+};
+
+void Fl_PSfile_Device::curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3){
+ if(shape_==NONE) return;
+ if(gap_)
+ fprintf(output,"%g %g MT\n", x , y);
+ else
+ fprintf(output, "%g %g LT\n", x , y);
+ gap_=0;
+
+ fprintf(output, "%g %g %g %g %g %g curveto \n", x1 , y1 , x2 , y2 , x3 , y3);
+};
+
+
+void Fl_PSfile_Device::circle(double x, double y, double r){
+ if(shape_==NONE){
+ fprintf(output, "GS\n");
+ concat();
+ // fprintf(output, "BP\n");
+ fprintf(output,"%g %g %g 0 360 arc\n", x , y , r);
+ reconcat();
+ // fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+ }else
+
+ fprintf(output, "%g %g %g 0 360 arc\n", x , y , r);
+
+};
+
+void Fl_PSfile_Device::arc(double x, double y, double r, double start, double a){
+ if(shape_==NONE) return;
+ gap_=0;
+ if(start>a)
+ fprintf(output, "%g %g %g %g %g arc\n", x , y , r , -start, -a);
+ else
+ fprintf(output, "%g %g %g %g %g arcn\n", x , y , r , -start, -a);
+
+};
+
+void Fl_PSfile_Device::arc(int x, int y, int w, int h, double a1, double a2) {
+ fprintf(output, "GS\n");
+ //fprintf(output, "BP\n");
+ begin_line();
+ fprintf(output, "%g %g TR\n", x + w/2.0 -0.5 , y + h/2.0 - 0.5);
+ fprintf(output, "%g %g SC\n", (w-1)/2.0 , (h-1)/2.0 );
+ arc(0,0,1,a2,a1);
+ // fprintf(output, "0 0 1 %g %g arc\n" , -a1 , -a2);
+ fprintf(output, "%g %g SC\n", 2.0/(w-1) , 2.0/(h-1) );
+ fprintf(output, "%g %g TR\n", -x - w/2.0 +0.5 , -y - h/2.0 +0.5);
+ end_line();
+
+ // fprintf(output, "%g setlinewidth\n", 2/sqrt(w*h));
+ // fprintf(output, "ELP\n");
+ // fprintf(output, 2.0/w , 2.0/w , " SC\n";
+ // fprintf(output, (-x - w/2.0) , (-y - h/2) , " TR\n";
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::pie(int x, int y, int w, int h, double a1, double a2) {
+
+ fprintf(output, "GS\n");
+ fprintf(output, "%g %g TR\n", x + w/2.0 -0.5 , y + h/2.0 - 0.5);
+ fprintf(output, "%g %g SC\n", (w-1)/2.0 , (h-1)/2.0 );
+ begin_polygon();
+ vertex(0,0);
+ arc(0.0,0.0, 1, a2, a1);
+ end_polygon();
+ fprintf(output, "GR\n");
+}
+
+void Fl_PSfile_Device::end_points(){
+ gap_=1;
+ reconcat();
+ fprintf(output, "ELP\n"); //??
+ fprintf(output, "GR\n");
+ shape_=NONE;
+}
+
+void Fl_PSfile_Device::end_line(){
+ gap_=1;
+ reconcat();
+ fprintf(output, "ELP\n");
+ fprintf(output, "GR\n");
+ shape_=NONE;
+}
+void Fl_PSfile_Device::end_loop(){
+ gap_=1;
+ reconcat();
+ fprintf(output, "ECP\n");
+ fprintf(output, "GR\n");
+ shape_=NONE;
+}
+
+void Fl_PSfile_Device::end_polygon(){
+
+ gap_=1;
+ reconcat();
+ fprintf(output, "EFP\n");
+ fprintf(output, "GR\n");
+ shape_=NONE;
+}
+
+void Fl_PSfile_Device::transformed_vertex(double x, double y){
+ reconcat();
+ if(gap_){
+ fprintf(output, "%g %g MT\n", x , y);
+ gap_=0;
+ }else
+ fprintf(output, "%g %g LT\n", x , y);
+ concat();
+};
+
+///////////////////////////// Clipping /////////////////////////////////////////////
+
+void Fl_PSfile_Device::push_clip(int x, int y, int w, int h) {
+ Clip * c=new Clip();
+ clip_box(x,y,w,h,c->x,c->y,c->w,c->h);
+ c->prev=clip_;
+ clip_=c;
+ fprintf(output, "CR\nCS\n");
+ if(lang_level_<3)
+ recover();
+ fprintf(output, "%g %g %i %i CL\n", clip_->x-0.5 , clip_->y-0.5 , clip_->w , clip_->h);
+
+}
+
+void Fl_PSfile_Device::push_no_clip() {
+ Clip * c = new Clip();
+ c->prev=clip_;
+ clip_=c;
+ clip_->x = clip_->y = clip_->w = clip_->h = -1;
+ fprintf(output, "CR\nCS\n");
+ if(lang_level_<3)
+ recover();
+}
+
+void Fl_PSfile_Device::pop_clip() {
+ if(!clip_)return;
+ Clip * c=clip_;
+ clip_=clip_->prev;
+ delete c;
+ fprintf(output, "CR\nCS\n");
+ if(clip_ && clip_->w >0)
+ fprintf(output, "%g %g %i %i CL\n", clip_->x - 0.5, clip_->y - 0.5, clip_->w , clip_->h);
+ // uh, -0.5 is to match screen clipping, for floats there should be something beter
+ if(lang_level_<3)
+ recover();
+}
+
+int Fl_PSfile_Device::clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H){
+ if(!clip_){
+ X=x;Y=y;W=w;H=h;
+ return 1;
+ }
+ if(clip_->w < 0){
+ X=x;Y=y;W=w;H=h;
+ return 1;
+ }
+ int ret=0;
+ if (x > (X=clip_->x)) {X=x; ret=1;}
+ if (y > (Y=clip_->y)) {Y=y; ret=1;}
+ if ((x+w) < (clip_->x+clip_->w)) {
+ W=x+w-X;
+
+ ret=1;
+
+ }else
+ W = clip_->x + clip_->w - X;
+ if(W<0){
+ W=0;
+ return 1;
+ }
+ if ((y+h) < (clip_->y+clip_->h)) {
+ H=y+h-Y;
+ ret=1;
+ }else
+ H = clip_->y + clip_->h - Y;
+ if(H<0){
+ W=0;
+ H=0;
+ return 1;
+ }
+ return ret;
+};
+
+int Fl_PSfile_Device::not_clipped(int x, int y, int w, int h){
+ if(!clip_) return 1;
+ if(clip_->w < 0) return 1;
+ int X, Y, W, H;
+ clip_box(x, y, w, h, X, Y, W, H);
+ if(W) return 1;
+ return 0;
+};
+
+
+void Fl_PSfile_Device::margins(int *left, int *top, int *right, int *bottom) // to implement
+{
+ if(left) *left = (int)(left_margin / scale_x + .5);
+ if(right) *right = (int)(left_margin / scale_x + .5);
+ if(top) *top = (int)(top_margin / scale_y + .5);
+ if(bottom) *bottom = (int)(top_margin / scale_y + .5);
+}
+
+int Fl_PSfile_Device::printable_rect(int *w, int *h)
+//returns 0 iff OK
+{
+ if(w) *w = (int)((pw_ - 2 * left_margin) / scale_x + .5);
+ if(h) *h = (int)((ph_ - 2 * top_margin) / scale_y + .5);
+ return 0;
+}
+
+void Fl_PSfile_Device::origin(int x, int y)
+{
+ x_offset = x;
+ y_offset = y;
+ fprintf(output, "GR GR GS %d %d TR %f %f SC %d %d TR %f rotate GS\n",
+ left_margin, top_margin, scale_x, scale_y, x, y, angle);
+}
+
+void Fl_PSfile_Device::scale (float s_x, float s_y)
+{
+ scale_x = s_x;
+ scale_y = s_y;
+ fprintf(output, "GR GR GS %d %d TR %f %f SC %f rotate GS\n",
+ left_margin, top_margin, scale_x, scale_y, angle);
+}
+
+void Fl_PSfile_Device::rotate (float rot_angle)
+{
+ angle = - rot_angle;
+ fprintf(output, "GR GR GS %d %d TR %f %f SC %d %d TR %f rotate GS\n",
+ left_margin, top_margin, scale_x, scale_y, x_offset, y_offset, angle);
+}
+
+void Fl_PSfile_Device::translate(int x, int y)
+{
+ fprintf(output, "GS %d %d translate GS\n", x, y);
+}
+
+void Fl_PSfile_Device::untranslate(void)
+{
+ fprintf(output, "GR GR\n");
+}
+
+int Fl_PSfile_Device::start_page (void)
+{
+ page(page_format_);
+ x_offset = 0;
+ y_offset = 0;
+ scale_x = scale_y = 1.;
+ angle = 0;
+ fprintf(output, "GR GR GS %d %d translate GS\n", left_margin, top_margin);
+ return 0;
+}
+
+int Fl_PSfile_Device::end_page (void)
+{
+ return 0;
+}
+
+int Fl_PSfile_Device::start_job (int pagecount, enum Page_Format format, enum Page_Layout layout)
+{
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Create a .ps file");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE);
+ fnfc.options(Fl_Native_File_Chooser::SAVEAS_CONFIRM);
+ fnfc.filter("PostScript\t*.ps\n");
+ // Show native chooser
+ if ( fnfc.show() ) return 1;
+ output = fopen(fnfc.filename(), "w");
+ if(output == NULL) return 1;
+ ps_filename_ = strdup(fnfc.filename());
+ return start_postscript(pagecount, format, layout);
+}
+
+void Fl_PSfile_Device::end_job (void)
+// finishes PostScript & closes file
+{
+ if (nPages) { // for eps nPages is 0 so it is fine ....
+ fprintf(output, "CR\nGR\nGR\nGR\nSP\n restore\n");
+ if (!pages_){
+ fprintf(output, "%%%%Trailer\n");
+ fprintf(output, "%%%%Pages: %i\n" , nPages);
+ };
+ } else
+ fprintf(output, "GR\n restore\n");
+ fputs("%%EOF",output);
+ reset();
+#if ! (defined(__APPLE__) || defined(WIN32) )
+ if (print_pipe)
+ pclose(output);
+ else
+ fclose(output);
+#else
+ fclose(output);
+#endif
+ while (clip_){
+ Clip * c= clip_;
+ clip_= clip_->prev;
+ delete c;
+ }
+ if (close_cmd_) (*close_cmd_)(output);
+ Fl_Device::display_device()->set_current();
+}
+
+#if ! (defined(__APPLE__) || defined(WIN32) )
+int Fl_PS_Printer::start_job(int pages, int *firstpage, int *lastpage) {
+ enum Page_Format format;
+ enum Page_Layout layout;
+
+ // first test version for print dialog
+
+ if (!print_panel) make_print_panel();
+ print_load();
+ print_selection->deactivate();
+ print_all->setonly();
+ print_all->do_callback();
+ print_from->value("1");
+ { char tmp[10]; snprintf(tmp, sizeof(tmp), "%d", pages); print_to->value(tmp); }
+ print_panel->show(); // this is modal
+ while (print_panel->shown()) Fl::wait();
+
+ if (!print_start) // user clicked cancel
+ return 1;
+
+ // get options
+
+ format = print_page_size->value() ? A4 : LETTER;
+ { // page range choice
+ int from = 1, to = pages;
+ if (print_pages->value()) {
+ sscanf(print_from->value(), "%d", &from);
+ sscanf(print_to->value(), "%d", &to);
+ }
+ if (from < 1) from = 1;
+ if (to > pages) to = pages;
+ if (to < from) to = from;
+ if (firstpage) *firstpage = from;
+ if (lastpage) *lastpage = to;
+ pages = to - from + 1;
+ }
+
+ if (print_output_mode[0]->value()) layout = PORTRAIT;
+ else if (print_output_mode[1]->value()) layout = LANDSCAPE;
+ else if (print_output_mode[2]->value()) layout = PORTRAIT;
+ else layout = LANDSCAPE;
+
+ print_pipe = print_choice->value(); // 0 = print to file, >0 = printer (pipe)
+
+ const char *media = print_page_size->text(print_page_size->value());
+ const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
+ if (!print_pipe) printer = "<File>";
+
+ if (!print_pipe) // fall back to file printing
+ return Fl_PSfile_Device::start_job (pages, format, layout);
+
+ // Print: pipe the output into the lp command...
+
+ char command[1024];
+ snprintf(command, sizeof(command), "lp -s -d %s -n %d -t '%s' -o media=%s",
+ printer, print_collate_button->value() ? 1 : (int)(print_copies->value() + 0.5),
+ "FLTK", media);
+
+ output = popen(command, "w");
+ if (!output) {
+ fl_alert("could not run command: %s\n",command);
+ return 1;
+ }
+
+ return Fl_PSfile_Device::start_postscript(pages, format, layout); // start printing
+}
+
+/*
+void print_cb(Fl_Return_Button *, void *) {
+ printf ("print_cb called\n"); fflush(stdout);
+ print_panel->hide();
+ // return Fl_PSfile_Device::start_postscript(pages, format); // temporary
+}
+*/
+
+#endif
+
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx
index 42ab0bb0a..ecf45915b 100644
--- a/src/Fl_Pixmap.cxx
+++ b/src/Fl_Pixmap.cxx
@@ -47,6 +47,7 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_Printer.H>
#include <stdio.h>
#include "flstring.h"
@@ -74,6 +75,10 @@ void Fl_Pixmap::measure() {
}
void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
+ if(fl_device->type() == Fl_Device::postscript_device) {
+ ((Fl_Virtual_Printer*)fl_device)->draw(this, XP, YP, WP, HP, cx, cy);
+ return;
+ }
// ignore empty or bad pixmap data:
if (!data()) {
draw_empty(XP, YP);
@@ -139,7 +144,54 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
fl_restore_clip();
}
#elif defined(WIN32)
- if (mask) {
+ if (fl_device->type() == Fl_Device::gdi_printer) {
+ typedef BOOL (WINAPI* fl_transp_func) (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
+ static HMODULE hMod = NULL;
+ static fl_transp_func fl_TransparentBlt = NULL;
+ if (!hMod) {
+ hMod = LoadLibrary("MSIMG32.DLL");
+ if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
+ }
+ if (hMod) {
+# define UNLIKELY_RGB_COLOR 2,3,4 // a nearly black color unlikely to occur in pixmaps
+# define WIN_COLOR RGB(2,3,4)
+ Fl_Offscreen tmp_id = fl_create_offscreen(w(), h());
+ fl_begin_offscreen(tmp_id);
+ uchar *bitmap = 0;
+ fl_mask_bitmap = &bitmap;
+ // draw pixmap to offscreen using the unlikely color for background
+ fl_draw_pixmap(data(), 0, 0, fl_rgb_color(UNLIKELY_RGB_COLOR) );
+ fl_end_offscreen();
+ HDC new_gc = CreateCompatibleDC(fl_gc);
+ int save = SaveDC(new_gc);
+ SelectObject(new_gc, (void*)tmp_id);
+ // print all of offscreen but its parts using unlikely color
+ fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, w(), h(), WIN_COLOR );
+ RestoreDC(new_gc,save);
+ // This is an approximate algorithm that fails to print pixmap pixels that would use the unlikely color.
+ // It can be transformed into an exact algorithm by adding the following commented out statements
+ // that print pixmap one more time hiding another color (any color would fit)
+ /*
+# define UNLIKELY_RGB_COLOR2 4,3,2
+# define WIN_COLOR2 RGB(4,3,2)
+ {
+ fl_begin_offscreen(tmp_id);
+ fl_draw_pixmap(data(), 0, 0, fl_rgb_color(UNLIKELY_RGB_COLOR2) );
+ fl_end_offscreen();
+ }
+ save = SaveDC(new_gc);
+ SelectObject(new_gc, (void*)tmp_id);
+ fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, w(), h(), WIN_COLOR2 );
+ RestoreDC(new_gc,save);
+ */
+ DeleteDC(new_gc);
+ fl_delete_offscreen(tmp_id);
+ }
+ else {
+ fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+ }
+ }
+ else if (mask) {
HDC new_gc = CreateCompatibleDC(fl_gc);
int save = SaveDC(new_gc);
SelectObject(new_gc, (void*)mask);
diff --git a/src/Fl_Printer.cxx b/src/Fl_Printer.cxx
new file mode 100644
index 000000000..41add45ce
--- /dev/null
+++ b/src/Fl_Printer.cxx
@@ -0,0 +1,9 @@
+#include <FL/Fl_Printer.H>
+
+#ifdef __APPLE__
+#include <src/Fl_Quartz_Printer.mm>
+#elif defined(WIN32)
+#include <src/Fl_GDI_Printer.cxx>
+#endif
+
+#include <src/Fl_PS_Printer.cxx>
diff --git a/src/Fl_Quartz_Printer.mm b/src/Fl_Quartz_Printer.mm
new file mode 100644
index 000000000..d4d7720cf
--- /dev/null
+++ b/src/Fl_Quartz_Printer.mm
@@ -0,0 +1,273 @@
+/*
+ * Fl_Quartz_Printer.mm
+ *
+ */
+#ifdef __APPLE__
+#include <FL/Fl_Printer.H>
+
+#include <FL/Fl.H>
+#include <FL/fl_ask.H>
+#include <FL/fl_draw.H>
+#ifdef __APPLE_COCOA__
+#import <Cocoa/Cocoa.h>
+#endif
+
+extern void fl_quartz_restore_line_style_();
+
+Fl_Quartz_Printer::Fl_Quartz_Printer(void)
+{
+ x_offset = 0;
+ y_offset = 0;
+ type_ = quartz_printer;
+}
+
+int Fl_Quartz_Printer::start_job (int pagecount, int *frompage, int *topage)
+//printing using a Quartz graphics context
+//returns 0 iff OK
+{
+ OSStatus status;
+ Fl_X::q_release_context();
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && defined(__APPLE_COCOA__)
+ if( [NSPrintPanel instancesRespondToSelector:@selector(runModalWithPrintInfo:)] &&
+ [NSPrintInfo instancesRespondToSelector:@selector(PMPrintSession)] ) {
+ NSAutoreleasePool *localPool;
+ localPool = [[NSAutoreleasePool alloc] init];
+ NSPrintInfo *info = [NSPrintInfo sharedPrintInfo];
+ NSPageLayout *layout = [NSPageLayout pageLayout];
+ NSInteger retval = [layout runModal];
+ if(retval == NSOKButton) {
+ NSPrintPanel *panel = [NSPrintPanel printPanel];
+ retval = (NSInteger)[panel runModalWithPrintInfo:info];//from 10.5 only
+ }
+ if(retval != NSOKButton) {
+ Fl::first_window()->show();
+ [localPool release];
+ return 1;
+ }
+ printSession = (PMPrintSession)[info PMPrintSession];
+ pageFormat = (PMPageFormat)[info PMPageFormat];
+ printSettings = (PMPrintSettings)[info PMPrintSettings];
+ UInt32 from32, to32;
+ PMGetFirstPage(printSettings, &from32);
+ if (frompage) *frompage = (int)from32;
+ PMGetLastPage(printSettings, &to32);
+ if (topage) *topage = (int)to32;
+ if(topage && *topage > pagecount) *topage = pagecount;
+ status = PMSessionBeginCGDocumentNoDialog(printSession, printSettings, pageFormat);
+ [localPool release];
+ }
+ else {
+#endif
+
+#if !__LP64__
+ Boolean accepted;
+ status = PMCreateSession(&printSession);
+ if (status != noErr) return 1;
+ status = PMCreatePageFormat(&pageFormat);
+ status = PMSessionDefaultPageFormat(printSession, pageFormat);
+ if (status != noErr) return 1;
+ status = PMSessionPageSetupDialog(printSession, pageFormat, &accepted);
+ if (status != noErr || !accepted) {
+ Fl::first_window()->show();
+ return 1;
+ }
+ status = PMCreatePrintSettings(&printSettings);
+ if (status != noErr || printSettings == kPMNoPrintSettings) return 1;
+ status = PMSessionDefaultPrintSettings (printSession, printSettings);
+ if (status != noErr) return 1;
+ PMSetPageRange(printSettings, 1, (UInt32)kPMPrintAllPages);
+ status = PMSessionPrintDialog(printSession, printSettings, pageFormat, &accepted);
+ if (!accepted) status = kPMCancel;
+ if (status != noErr) {
+ Fl::first_window()->show();
+ return 1;
+ }
+ UInt32 from32, to32;
+ PMGetFirstPage(printSettings, &from32);
+ if (frompage) *frompage = (int)from32;
+ PMGetLastPage(printSettings, &to32);
+ if (topage) *topage = (int)to32;
+ if(topage && *topage > pagecount) *topage = pagecount;
+ CFStringRef mystring[1];
+ mystring[0] = kPMGraphicsContextCoreGraphics;
+ CFArrayRef array = CFArrayCreate(NULL, (const void **)mystring, 1, &kCFTypeArrayCallBacks);
+ status = PMSessionSetDocumentFormatGeneration(printSession, kPMDocumentFormatDefault, array, NULL);
+ CFRelease(array);
+ status = PMSessionBeginDocumentNoDialog(printSession, printSettings, pageFormat);
+#endif //__LP64__
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && defined(__APPLE_COCOA__)
+ }
+#endif
+ if (status != noErr) return 1;
+ y_offset = x_offset = 0;
+ this->set_current();
+ return 0;
+}
+
+void Fl_Quartz_Printer::margins(int *left, int *top, int *right, int *bottom)
+{
+ PMPaper paper;
+ PMGetPageFormatPaper(pageFormat, &paper);
+ PMOrientation orientation;
+ PMGetOrientation(pageFormat, &orientation);
+ PMPaperMargins margins;
+ PMPaperGetMargins(paper, &margins);
+ if(orientation == kPMPortrait) {
+ if (left) *left = (int)(margins.left / scale_x + 0.5);
+ if (top) *top = (int)(margins.top / scale_y + 0.5);
+ if (right) *right = (int)(margins.right / scale_x + 0.5);
+ if (bottom) *bottom = (int)(margins.bottom / scale_y + 0.5);
+ }
+ else {
+ if (left) *left = (int)(margins.top / scale_x + 0.5);
+ if (top) *top = (int)(margins.left / scale_y + 0.5);
+ if (right) *right = (int)(margins.bottom / scale_x + 0.5);
+ if (bottom) *bottom = (int)(margins.right / scale_y + 0.5);
+ }
+}
+
+int Fl_Quartz_Printer::printable_rect(int *w, int *h)
+//returns 0 iff OK
+{
+ OSStatus status;
+ PMRect pmRect;
+ int x, y;
+
+ status = PMGetAdjustedPageRect(pageFormat, &pmRect);
+ if (status != noErr) return 1;
+
+ x = (int)pmRect.left;
+ y = (int)pmRect.top;
+ *w = (int)(pmRect.right - x) / scale_x + 1;
+ *h = (int)(pmRect.bottom - y) / scale_y + 1;
+ return 0;
+}
+
+void Fl_Quartz_Printer::origin(int x, int y)
+{
+ x_offset = x;
+ y_offset = y;
+ CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(fl_gc);
+ CGContextSaveGState(fl_gc);
+ CGContextScaleCTM(fl_gc, scale_x, scale_y);
+ CGContextTranslateCTM(fl_gc, x, y);
+ CGContextRotateCTM(fl_gc, angle);
+ CGContextSaveGState(fl_gc);
+}
+
+void Fl_Quartz_Printer::scale (float s_x, float s_y)
+{
+ scale_x = s_x;
+ scale_y = s_y;
+ CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(fl_gc);
+ CGContextSaveGState(fl_gc);
+ CGContextScaleCTM(fl_gc, scale_x, scale_y);
+ CGContextRotateCTM(fl_gc, angle);
+ x_offset = y_offset = 0;
+ CGContextSaveGState(fl_gc);
+}
+
+void Fl_Quartz_Printer::rotate (float rot_angle)
+{
+ angle = - rot_angle * M_PI / 180.;
+ CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(fl_gc);
+ CGContextSaveGState(fl_gc);
+ CGContextScaleCTM(fl_gc, scale_x, scale_y);
+ CGContextTranslateCTM(fl_gc, x_offset, y_offset);
+ CGContextRotateCTM(fl_gc, angle);
+ CGContextSaveGState(fl_gc);
+}
+
+void Fl_Quartz_Printer::translate(int x, int y)
+{
+ CGContextSaveGState(fl_gc);
+ CGContextTranslateCTM(fl_gc, x, y );
+ CGContextSaveGState(fl_gc);
+}
+
+void Fl_Quartz_Printer::untranslate(void)
+{
+ CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(fl_gc);
+}
+
+int Fl_Quartz_Printer::start_page (void)
+{
+ OSStatus status = PMSessionBeginPageNoDialog(printSession, pageFormat, NULL);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if ( PMSessionGetCGGraphicsContext != NULL ) {
+ status = PMSessionGetCGGraphicsContext(printSession, &fl_gc);
+ }
+ else {
+#endif
+#if ! __LP64__
+ status = PMSessionGetGraphicsContext(printSession,NULL,(void **)&fl_gc);
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ }
+#endif
+ PMRect pmRect;
+ float win_scale_x, win_scale_y;
+
+ PMPaper paper;
+ PMGetPageFormatPaper(pageFormat, &paper);
+ PMPaperMargins margins;
+ PMPaperGetMargins(paper, &margins);
+ PMOrientation orientation;
+ PMGetOrientation(pageFormat, &orientation);
+
+ status = PMGetAdjustedPageRect(pageFormat, &pmRect);
+ double h = pmRect.bottom - pmRect.top;
+ x_offset = 0;
+ y_offset = 0;
+ angle = 0;
+ scale_x = scale_y = 1;
+ win_scale_x = win_scale_y = 1;
+ image_list_ = NULL;
+ if(orientation == kPMPortrait)
+ CGContextTranslateCTM(fl_gc, margins.left, margins.bottom + h);
+ else
+ CGContextTranslateCTM(fl_gc, margins.top, margins.right + h);
+ CGContextScaleCTM(fl_gc, win_scale_x, - win_scale_y);
+ fl_quartz_restore_line_style_();
+ CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSaveGState(fl_gc);
+ CGContextSaveGState(fl_gc);
+ fl_line_style(FL_SOLID);
+ fl_window = (void *)1; // TODO: something better
+ fl_clip_region(0);
+ if( status == noErr) gc = fl_gc;
+ return status != noErr;
+}
+
+int Fl_Quartz_Printer::end_page (void)
+{
+ CGContextFlush(fl_gc);
+ CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(fl_gc);
+ OSStatus status = PMSessionEndPageNoDialog(printSession);
+ delete_image_list();
+ gc = NULL;
+ return status != noErr;
+}
+
+void Fl_Quartz_Printer::end_job (void)
+{
+ OSStatus status;
+
+ status = PMSessionError(printSession);
+ if (status != noErr) {
+ fl_alert ("PM Session error %d", (int)status);
+ }
+ PMSessionEndDocumentNoDialog(printSession);
+ Fl_Device::display_device()->set_current();
+ fl_gc = 0;
+ Fl::first_window()->show();
+}
+
+#endif // __APPLE__
+
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 0770fd47a..adda86b0f 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -90,6 +90,7 @@ extern "C" {
}
+#include <FL/Fl_Device.H>
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/Fl_Window.H>
@@ -151,6 +152,10 @@ static void createAppleMenu(void);
static Fl_Region MacRegionMinusRect(Fl_Region r, int x,int y,int w,int h);
static void cocoaMouseHandler(NSEvent *theEvent);
+static Fl_Quartz_Display fl_quartz_device;
+FL_EXPORT Fl_Display *fl_display_device = (Fl_Display*)&fl_quartz_device; // does not change
+FL_EXPORT Fl_Device *fl_device = (Fl_Device*)&fl_quartz_device; // the current target device of graphics operations
+
// public variables
int fl_screen;
CGContextRef fl_gc = 0;
@@ -2490,7 +2495,7 @@ void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
rect.origin.x = -(mx.tx+0.5f) + rect.origin.x - cx;
rect.origin.y = (mx.ty+0.5f) - rect.origin.y - h + cy;
rect.size.width = w;
- rect.size.height = h;
+ rect.size.height = h;
}
*/
void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
@@ -2790,7 +2795,7 @@ static Fl_Region MacRegionMinusRect(Fl_Region r, int x,int y,int w,int h)
Fl_Region outr = (Fl_Region)malloc(sizeof(*outr));
outr->rects = (CGRect*)malloc(4 * r->count * sizeof(CGRect));
outr->count = 0;
- CGRect rect = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect rect = fl_cgrectmake_cocoa(x, y, w, h);
for( int i = 0; i < r->count; i++) {
CGRect A = r->rects[i];
CGRect test = CGRectIntersection(A, rect);
@@ -2835,7 +2840,7 @@ Fl_Region MacRectRegionIntersect(Fl_Region current, int x,int y,int w, int h)
*/
{
if (current == NULL) return XRectangleRegion(x,y,w,h);
- CGRect r = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect r = fl_cgrectmake_cocoa(x, y, w, h);
Fl_Region outr = (Fl_Region)malloc(sizeof(*outr));
outr->count = current->count;
outr->rects =(CGRect*)malloc(outr->count * sizeof(CGRect));
@@ -2968,6 +2973,7 @@ int MACscreen_init(XRectangle screens[])
{
}
- (void)showPanel;
+- (void)printPanel;
@end
@implementation FLaboutItemTarget
- (void)showPanel
@@ -2979,6 +2985,37 @@ int MACscreen_init(XRectangle screens[])
nil];
[NSApp orderFrontStandardAboutPanelWithOptions:options];
}
+#include <FL/Fl_Printer.H>
+- (void)printPanel
+{
+ Fl_Printer printer;
+// Fl_PSfile_Device printer;
+ int w, h;
+ Fl_Window *win = Fl::first_window();
+ if(!win) return;
+ if( printer.start_job(1) ) return;
+ if( printer.start_page() ) return;
+ // scale the printer device so that the window fits on the page
+ float scale = 1;
+ printer.printable_rect(&w, &h);
+ if (win->w()>w || win->h()>h) {
+ scale = (float)w/win->w();
+ if ((float)h/win->h() < scale) scale = (float)h/win->h();
+ printer.scale(scale, scale);
+ }
+#ifdef ROTATE
+ printer.scale(scale * 0.8, scale * 0.8);
+ printer.printable_rect(&w, &h);
+ printer.origin(w/2, h/2 );
+ printer.rotate(20.);
+ printer.print_widget( win, - win->w()/2, - win->h()/2 );
+#else
+ printer.print_widget( win);
+ //printer.print_window_part( win, 0,0, win->w(), win->h() );
+#endif
+ printer.end_page();
+ printer.end_job();
+}
@end
static NSMenu *appleMenu;
@@ -2998,10 +3035,17 @@ static void createAppleMenu(void)
appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */
title = [@"About " stringByAppendingString:(NSString*)nsappname];
- [appleMenu addItemWithTitle:title action:@selector(showPanel) keyEquivalent:@""];
+ menuItem = [appleMenu addItemWithTitle:title action:@selector(showPanel) keyEquivalent:@""];
FLaboutItemTarget *about = [[FLaboutItemTarget alloc] init];
- [[appleMenu itemAtIndex:0] setTarget:about];
+ [menuItem setTarget:about];
[appleMenu addItem:[NSMenuItem separatorItem]];
+// temporary for testing Fl_Printer. Contains also printPanel of class FLaboutItemTarget.
+ menuItem = [appleMenu addItemWithTitle:@"Print front window" action:@selector(printPanel) keyEquivalent:@"p"];
+ [menuItem setTarget:about];
+ [appleMenu setAutoenablesItems:NO];
+ [menuItem setEnabled:YES];
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+// end of temporary for testing Fl_Printer
// Services Menu
services = [[NSMenu alloc] init];
[appleMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
@@ -3457,6 +3501,13 @@ WindowRef MACwindowRef(Fl_Window *w)
{
return (WindowRef)[(FLWindow*)Fl_X::i(w)->xid windowRef];
}
+
+// so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes
+CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h) {
+ if (Fl_Device::current()->type() == Fl_Device::quartz_printer) return CGRectMake(x, y, w-1.5 , h-1.5 );
+ return CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0);
+}
+
#endif // FL_DOXYGEN
//
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 8db05169d..2b123422c 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -95,6 +95,10 @@
for async mode proper operation, not mentioning the side effects...
*/
+static Fl_GDI_Display fl_gdi_device;
+FL_EXPORT Fl_Display *fl_display_device = (Fl_Display*)&fl_gdi_device; // does not change
+FL_EXPORT Fl_Device *fl_device = (Fl_Device*)&fl_gdi_device; // the current target device of graphics operations
+
// dynamic wsock dll handling api:
#if defined(__CYGWIN__) && !defined(SOCKET)
# define SOCKET int
@@ -1777,6 +1781,8 @@ void Fl_Window::show() {
if (!fl_capture) BringWindowToTop(i->xid);
//ShowWindow(i->xid,fl_capture?SW_SHOWNOACTIVATE:SW_RESTORE);
}
+void preparePrintFront(void);
+preparePrintFront();
}
Fl_Window *Fl_Window::current_;
@@ -1915,6 +1921,63 @@ void fl_cleanup_dc_list(void) { // clean up the list
t = win_DC_list;
} while(t);
}
+
+Fl_Region XRectangleRegion(int x, int y, int w, int h) {
+ if (Fl_Device::current()->type() < 256) return CreateRectRgn(x,y,x+w,y+h);
+ // because rotation may apply, the rectangle becomes a polygon in device coords
+ POINT pt[4] = { {x, y}, {x + w, y}, {x + w, y + h}, {x, y + h} };
+ LPtoDP(fl_gc, pt, 4);
+ return CreatePolygonRgn(pt, 4, ALTERNATE);
+}
+
+// temporary for testing purposes of the Fl_Printer class
+// contains also preparePrintFront call above
+#include <FL/Fl_Printer.H>
+#include <FL/Fl_Button.H>
+void printFront(Fl_Widget *o, void *data)
+{
+ Fl_Printer printer;
+ o->window()->hide();
+ Fl_Window *win = Fl::first_window();
+ if(!win) return;
+ int w, h;
+ if( printer.start_job(1) ) { o->window()->show(); return; }
+ if( printer.start_page() ) { o->window()->show(); return; }
+ printer.printable_rect(&w,&h);
+ // scale the printer device so that the window fits on the page
+ float scale = 1;
+ if (win->w() > w || win->h() > h) {
+ scale = (float)w/win->w();
+ if ((float)h/win->h() < scale) scale = (float)h/win->h();
+ printer.scale(scale, scale);
+ }
+// #define ROTATE 20.0
+#ifdef ROTATE
+ printer.scale(scale * 0.8, scale * 0.8);
+ printer.printable_rect(&w, &h);
+ printer.origin(w/2, h/2 );
+ printer.rotate(ROTATE);
+ printer.print_widget( win, - win->w()/2, - win->h()/2 );
+#else
+ printer.print_widget( win );
+#endif
+ //printer.print_window_part( win, 0,0, win->w(), win->h(), - win->w()/2, - win->h()/2 );
+ printer.end_page();
+ printer.end_job();
+ o->window()->show();
+}
+
+void preparePrintFront(void)
+{
+ static BOOL first=TRUE;
+ if(!first) return;
+ first=FALSE;
+ static Fl_Window w(0,0,120,30);
+ static Fl_Button b(0,0,w.w(),w.h(), "Print front window");
+ b.callback(printFront);
+ w.end();
+ w.show();
+}
#endif // FL_DOXYGEN
//
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index ce1fc036f..e7cdf6e43 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -51,6 +51,10 @@
# include <X11/Xlocale.h>
# include <X11/Xlib.h>
+static Fl_Xlib_Display fl_xlib_device;
+FL_EXPORT Fl_Display *fl_display_device = (Fl_Display*)&fl_xlib_device; // does not change
+FL_EXPORT Fl_Device *fl_device = (Fl_Device*)&fl_xlib_device; // the current target device of graphics operations
+
////////////////////////////////////////////////////////////////
// interface to poll/select call:
@@ -1731,6 +1735,8 @@ void Fl_Window::show() {
} else {
XMapRaised(fl_display, i->xid);
}
+void preparePrintFront(void);
+preparePrintFront();
}
Window fl_window;
@@ -1753,6 +1759,57 @@ void Fl_Window::make_current() {
}
+// temporary for testing purposes of the Fl_Printer class
+// contains also preparePrintFront call above
+#include <FL/Fl_Printer.H>
+#include <FL/Fl_Button.H>
+void printFront(Fl_Widget *o, void *data)
+{
+ Fl_Printer printer;
+ o->window()->hide();
+ Fl_Window *win = Fl::first_window();
+ if(!win) return;
+ int w, h;
+ if( printer.start_job(1) ) { o->window()->show(); return; }
+ if( printer.start_page() ) { o->window()->show(); return; }
+ printer.printable_rect(&w,&h);
+ // scale the printer device so that the window fits on the page
+ float scale = 1;
+ if (win->w() > w || win->h() > h) {
+ scale = (float)w/win->w();
+ if ((float)h/win->h() < scale) scale = (float)h/win->h();
+ printer.scale(scale, scale);
+ }
+
+// #define ROTATE 20.0
+#ifdef ROTATE
+ printer.scale(scale * 0.8, scale * 0.8);
+ printer.printable_rect(&w, &h);
+ printer.origin(w/2, h/2 );
+ printer.rotate(ROTATE);
+ printer.print_widget( win, - win->w()/2, - win->h()/2 );
+#else
+ printer.print_widget( win );
+#endif
+
+ //printer.print_window_part( win, 0,0,win->w(), win->h() );
+ printer.end_page();
+ printer.end_job();
+ o->window()->show();
+}
+
+void preparePrintFront(void)
+{
+ static int first=1;
+ if(!first) return;
+ first=0;
+ static Fl_Window w(0,0,150,30);
+ static Fl_Button b(0,0,w.w(),w.h(), "Print front window");
+ b.callback(printFront);
+ w.end();
+ w.show();
+}
+
#endif
//
diff --git a/src/Makefile b/src/Makefile
index 7061ff71a..3d7d3c4bd 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -42,6 +42,7 @@ CPPFILES = \
Fl_Color_Chooser.cxx \
Fl_Counter.cxx \
Fl_Dial.cxx \
+ Fl_Device.cxx \
Fl_Double_Window.cxx \
Fl_File_Browser.cxx \
Fl_File_Chooser.cxx \
@@ -69,6 +70,7 @@ CPPFILES = \
Fl_Pixmap.cxx \
Fl_Positioner.cxx \
Fl_Preferences.cxx \
+ Fl_Printer.cxx \
Fl_Progress.cxx \
Fl_Repeat_Button.cxx \
Fl_Return_Button.cxx \
@@ -161,7 +163,8 @@ CPPFILES = \
fl_symbols.cxx \
fl_vertex.cxx \
screen_xywh.cxx \
- fl_utf8.cxx
+ fl_utf8.cxx \
+ ps_image.cxx
FLCPPFILES = \
forms_compatability.cxx \
@@ -175,6 +178,7 @@ GLCPPFILES = \
Fl_Gl_Choice.cxx \
Fl_Gl_Overlay.cxx \
Fl_Gl_Window.cxx \
+ Fl_Gl_Printer.cxx \
freeglut_geometry.cxx \
freeglut_stroke_mono_roman.cxx \
freeglut_stroke_roman.cxx \
@@ -488,6 +492,7 @@ fl_font.o: fl_font_mac.cxx fl_font_x.cxx fl_font_xft.cxx fl_font_win32.cxx
fl_read_image.o: fl_read_image_mac.cxx fl_read_image_win32.cxx
fl_set_fonts.o: fl_set_fonts_mac.cxx fl_set_fonts_x.cxx \
fl_set_fonts_xft.cxx fl_set_fonts_win32.cxx
+Fl_Printer.o: Fl_Quartz_Printer.mm Fl_GDI_Printer.cxx Fl_PS_Printer.cxx
fl_arci.o: ../FL/mac.H ../FL/win32.H
Fl_arg.o: ../FL/mac.H ../FL/win32.H
@@ -521,6 +526,7 @@ fl_overlay_visual.o: ../FL/mac.H ../FL/win32.H
Fl_Overlay_Window.o: ../FL/mac.H ../FL/win32.H
Fl_own_colormap.o: ../FL/mac.H ../FL/win32.H
Fl_Pixmap.o: ../FL/mac.H ../FL/win32.H
+Fl_Printer.o: ../FL/mac.H ../FL/win32.H
fl_read_image.o: ../FL/mac.H ../FL/win32.H
fl_read_image_mac.o: ../FL/mac.H ../FL/win32.H
fl_read_image_win32.o: ../FL/mac.H ../FL/win32.H
diff --git a/src/fl_arc.cxx b/src/fl_arc.cxx
index e82b72594..6b0cb13ea 100644
--- a/src/fl_arc.cxx
+++ b/src/fl_arc.cxx
@@ -51,7 +51,7 @@ static double _fl_hypot(double x, double y) {
counter-clockwise from 3 o'clock. If \p end is less than \p start
then it draws the arc in a clockwise direction.
*/
-void fl_arc(double x, double y, double r, double start, double end) {
+void Fl_Device::arc(double x, double y, double r, double start, double end) {
// draw start point accurately:
diff --git a/src/fl_arci.cxx b/src/fl_arci.cxx
index 47db7b3fc..81414599c 100644
--- a/src/fl_arci.cxx
+++ b/src/fl_arci.cxx
@@ -69,7 +69,7 @@
counter-clockwise from 3 o'clock. \p a2 must be greater
than or equal to \p a1.
*/
-void fl_arc(int x,int y,int w,int h,double a1,double a2) {
+void Fl_Device::arc(int x,int y,int w,int h,double a1,double a2) {
if (w <= 0 || h <= 0) return;
#if defined(USE_X11)
@@ -120,7 +120,7 @@ void fl_arc(int x,int y,int w,int h,double a1,double a2) {
counter-clockwise from 3 o'clock. \p a2 must be greater
than or equal to \p a1.
*/
-void fl_pie(int x,int y,int w,int h,double a1,double a2) {
+void Fl_Device::pie(int x,int y,int w,int h,double a1,double a2) {
if (w <= 0 || h <= 0) return;
#if defined(USE_X11)
diff --git a/src/fl_color.cxx b/src/fl_color.cxx
index 55672d794..33f92478d 100644
--- a/src/fl_color.cxx
+++ b/src/fl_color.cxx
@@ -171,7 +171,7 @@ ulong fl_xpixel(uchar r,uchar g,uchar b) {
the foreground is not set for the current window.
\param[in] r,g,b color components
*/
-void fl_color(uchar r,uchar g,uchar b) {
+void Fl_Device::color(uchar r,uchar g,uchar b) {
fl_color_ = fl_rgb_color(r, g, b);
if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b));
@@ -328,7 +328,7 @@ Fl_Color fl_color_;
the foreground is not set for the current window.
\param[in] i color
*/
-void fl_color(Fl_Color i) {
+void Fl_Device::color(Fl_Color i) {
if (i & 0xffffff00) {
unsigned rgb = (unsigned)i;
fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
diff --git a/src/fl_color_mac.cxx b/src/fl_color_mac.cxx
index 075169d5c..6b23e6523 100644
--- a/src/fl_color_mac.cxx
+++ b/src/fl_color_mac.cxx
@@ -49,7 +49,7 @@ Fl_XMap* fl_current_xmap;
Fl_Color fl_color_;
-void fl_color(Fl_Color i) {
+void Fl_Device::color(Fl_Color i) {
fl_color_ = i;
int index;
uchar r, g, b;
@@ -78,7 +78,7 @@ void fl_color(Fl_Color i) {
#endif
}
-void fl_color(uchar r, uchar g, uchar b) {
+void Fl_Device::color(uchar r, uchar g, uchar b) {
fl_color_ = fl_rgb_color(r, g, b);
#if defined(__APPLE_QUARTZ__)
float fr = r/255.0f;
diff --git a/src/fl_color_win32.cxx b/src/fl_color_win32.cxx
index 74a39e700..f9cd7cc5d 100644
--- a/src/fl_color_win32.cxx
+++ b/src/fl_color_win32.cxx
@@ -94,7 +94,7 @@ static void set_xmap(Fl_XMap& xmap, COLORREF c) {
Fl_Color fl_color_;
-void fl_color(Fl_Color i) {
+void Fl_Device::color(Fl_Color i) {
if (i & 0xffffff00) {
unsigned rgb = (unsigned)i;
fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
@@ -118,7 +118,7 @@ void fl_color(Fl_Color i) {
}
}
-void fl_color(uchar r, uchar g, uchar b) {
+void Fl_Device::color(uchar r, uchar g, uchar b) {
static Fl_XMap xmap;
COLORREF c = RGB(r,g,b);
fl_color_ = fl_rgb_color(r, g, b);
diff --git a/src/fl_curve.cxx b/src/fl_curve.cxx
index d1dbe92e1..c6663a739 100644
--- a/src/fl_curve.cxx
+++ b/src/fl_curve.cxx
@@ -46,7 +46,7 @@
\param[in] X2,Y2 curve control point
\param[in] X3,Y3 curve end point
*/
-void fl_curve(double X0, double Y0,
+void Fl_Device::curve(double X0, double Y0,
double X1, double Y1,
double X2, double Y2,
double X3, double Y3) {
diff --git a/src/fl_draw_image.cxx b/src/fl_draw_image.cxx
index d100d8609..9542a9f0a 100644
--- a/src/fl_draw_image.cxx
+++ b/src/fl_draw_image.cxx
@@ -543,17 +543,17 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
}
-void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Device::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
}
-void fl_draw_image(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Device::draw_image(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
}
-void fl_draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Device::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
innards(buf,x,y,w,h,d,l,1,0,0);
}
-void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Device::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
innards(0,x,y,w,h,d,0,1,cb,data);
}
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx
index 5e7a1ce1e..d22d96c10 100644
--- a/src/fl_draw_image_mac.cxx
+++ b/src/fl_draw_image_mac.cxx
@@ -34,6 +34,11 @@
#define MAXBUFFER 0x40000 // 256k
+static void dataReleaseCB(void *info, const void *data, size_t size)
+{
+ delete[] (uchar *)data;
+}
+
/**
* draw an image based on the input parameters
*
@@ -73,7 +78,17 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
lut = CGColorSpaceCreateDeviceGray();
else
lut = CGColorSpaceCreateDeviceRGB();
- CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H, 0L);
+ // a release callback is necessary when the fl_gc is a print context because the image data
+ // must be kept until the page is closed. Thus tmpBuf can't be deleted here. It's too early.
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+ typedef void (*CGDataProviderReleaseDataCallback) (
+ void *info,
+ const void *data,
+ size_t size
+ );
+#endif
+ CGDataProviderReleaseDataCallback releaseCB = ( cb ? dataReleaseCB : NULL);
+ CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H, releaseCB);
CGImageRef img = CGImageCreate( W, H, 8, 8*delta, linedelta,
//lut, delta&1?kCGImageAlphaNone:kCGImageAlphaNoneSkipLast,
lut, delta&1?kCGImageAlphaNone:kCGImageAlphaLast,
@@ -89,9 +104,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
CGColorSpaceRelease(lut);
CGDataProviderRelease(src);
- if (cb) {
- delete[] tmpBuf;
- }
if (img) return; // else fall through to slow mode
// following the very save (and very slow) way to write the image into the give port
CGContextSetShouldAntialias(fl_gc, false);
@@ -140,17 +152,17 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
#endif
}
-void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Device::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
}
-void fl_draw_image(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Device::draw_image(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
}
-void fl_draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Device::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
innards(buf,x,y,w,h,d,l,1,0,0);
}
-void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Device::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
innards(0,x,y,w,h,d,0,1,cb,data);
}
diff --git a/src/fl_draw_image_win32.cxx b/src/fl_draw_image_win32.cxx
index a881eb1cf..e735dcaa0 100644
--- a/src/fl_draw_image_win32.cxx
+++ b/src/fl_draw_image_win32.cxx
@@ -254,21 +254,21 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
}
}
- SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
- (LPSTR)((uchar*)buffer+(blocking-k)*linesize),
- &bmi,
+ SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
+ (LPSTR)((uchar*)buffer+(blocking-k)*linesize),
+ &bmi,
#if USE_COLORMAP
- indexed ? DIB_PAL_COLORS : DIB_RGB_COLORS
+ indexed ? DIB_PAL_COLORS : DIB_RGB_COLORS
#else
- DIB_RGB_COLORS
+ DIB_RGB_COLORS
#endif
- );
+ );
}
}
static int fl_abs(int v) { return v<0 ? -v : v; }
-void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Device::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
d ^= FL_IMAGE_WITH_ALPHA;
innards(buf,x,y,w,h,d,l,fl_abs(d),0,0);
@@ -277,7 +277,7 @@ void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
}
}
-void fl_draw_image(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Device::draw_image(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
d ^= FL_IMAGE_WITH_ALPHA;
@@ -287,7 +287,7 @@ void fl_draw_image(Fl_Draw_Image_Cb cb, void* data,
}
}
-void fl_draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Device::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
d ^= FL_IMAGE_WITH_ALPHA;
innards(buf,x,y,w,h,d,l,1,0,0);
@@ -296,7 +296,7 @@ void fl_draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int
}
}
-void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Device::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
d ^= FL_IMAGE_WITH_ALPHA;
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index 50c1c613e..634e68dec 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -245,7 +245,7 @@ Fl_Font fl_font_ = 0;
Fl_Fontsize fl_size_ = 0;
-void fl_font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_Device::font(Fl_Font fnum, Fl_Fontsize size) {
if (fnum==-1) {
fl_font_ = 0;
fl_size_ = 0;
@@ -408,7 +408,7 @@ void fl_text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
void fl_draw(const char *str, int n, float x, float y);
-void fl_draw(const char* str, int n, int x, int y) {
+void Fl_Device::draw(const char* str, int n, int x, int y) {
fl_draw(str, n, (float)x-0.0f, (float)y-0.5f);
}
@@ -492,7 +492,7 @@ void fl_draw(const char *str, int n, float x, float y) {
#endif
}
-void fl_draw(int angle, const char *str, int n, int x, int y) {
+void Fl_Device::draw(int angle, const char *str, int n, int x, int y) {
#if defined(__APPLE_COCOA__)
CGContextSaveGState(fl_gc);
CGContextTranslateCTM(fl_gc, x, y);
diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx
index 92279ffcb..fd0e3fdbf 100644
--- a/src/fl_font_win32.cxx
+++ b/src/fl_font_win32.cxx
@@ -143,7 +143,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
fl_fontsize = find(fnum, size, angle);
}
-void fl_font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_Device::font(Fl_Font fnum, Fl_Fontsize size) {
fl_font(fnum, size, 0);
}
@@ -234,6 +234,21 @@ static void GetGlyphIndices_init() {
have_loaded_GetGlyphIndices = -1; // set this non-zero when we have attempted to load GetGlyphIndicesW
} // GetGlyphIndices_init function
+static void on_printer_extents_update(int &dx, int &dy, int &w, int &h)
+// converts text extents from device coords to logical coords
+{
+ POINT pt[3] = { {0, 0}, {dx, dy}, {dx+w, dy+h} };
+ DPtoLP(fl_gc, pt, 3);
+ w = pt[2].x - pt[1].x;
+ h = pt[2].y - pt[1].y;
+ dx = pt[1].x - pt[0].x;
+ dy = pt[1].y - pt[0].y;
+}
+
+// if printer context, extents shd be converted to logical coords
+#define EXTENTS_UPDATE(x,y,w,h) \
+ if (Fl_Device::current()->type() == Fl_Device::gdi_printer) { on_printer_extents_update(x,y,w,h); }
+
static unsigned short *ext_buff = NULL; // UTF-16 converted version of input UTF-8 string
static unsigned wc_len = 0; // current string buffer dimension
static WORD *gi = NULL; // glyph indices array
@@ -303,6 +318,7 @@ void fl_text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
h = maxh + miny;
dx = minx;
dy = -miny;
+ EXTENTS_UPDATE(dx, dy, w, h);
return; // normal exit
exit_error:
@@ -311,10 +327,11 @@ exit_error:
h = fl_height();
dx = 0;
dy = fl_descent() - h;
+ EXTENTS_UPDATE(dx, dy, w, h);
return;
} // fl_text_extents
-void fl_draw(const char* str, int n, int x, int y) {
+void Fl_Device::draw(const char* str, int n, int x, int y) {
int i = 0;
int lx = 0;
char *end = (char *)&str[n];
@@ -342,7 +359,7 @@ void fl_draw(const char* str, int n, int x, int y) {
SetTextColor(fl_gc, oldColor);
}
-void fl_draw(int angle, const char* str, int n, int x, int y) {
+void Fl_Device::draw(int angle, const char* str, int n, int x, int y) {
fl_font(fl_font_, fl_size_, angle);
// fl_draw(str, n, (int)x, (int)y);
int i = 0, i2=0;
diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx
index 487cd00a3..108905d4b 100644
--- a/src/fl_font_xft.cxx
+++ b/src/fl_font_xft.cxx
@@ -132,7 +132,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
fl_xftfont = (void*)f->font;
}
-void fl_font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_Device::font(Fl_Font fnum, Fl_Fontsize size) {
fl_font(fnum,size,0);
}
@@ -482,7 +482,7 @@ extern XVisualInfo* fl_overlay_visual;
// still exists in an XftDraw structure. It would be nice if this is not
// true, a lot of junk is needed to try to stop this:
-static XftDraw* draw;
+static XftDraw* draw_;
static Window draw_window;
#if USE_OVERLAY
static XftDraw* draw_overlay;
@@ -491,36 +491,36 @@ static Window draw_overlay_window;
void fl_destroy_xft_draw(Window id) {
if (id == draw_window)
- XftDrawChange(draw, draw_window = fl_message_window);
+ XftDrawChange(draw_, draw_window = fl_message_window);
#if USE_OVERLAY
if (id == draw_overlay_window)
XftDrawChange(draw_overlay, draw_overlay_window = fl_message_window);
#endif
}
-void fl_draw(const char *str, int n, int x, int y) {
+void Fl_Device::draw(const char *str, int n, int x, int y) {
if ( !current_font ) {
fl_font(FL_HELVETICA, 14);
}
#if USE_OVERLAY
- XftDraw*& draw = fl_overlay ? draw_overlay : ::draw;
+ XftDraw*& draw_ = fl_overlay ? draw_overlay : ::draw_;
if (fl_overlay) {
- if (!draw)
- draw = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
+ if (!draw_)
+ draw_ = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
fl_overlay_visual->visual, fl_overlay_colormap);
else //if (draw_overlay_window != fl_window)
- XftDrawChange(draw, draw_overlay_window = fl_window);
+ XftDrawChange(draw_, draw_overlay_window = fl_window);
} else
#endif
- if (!draw)
- draw = XftDrawCreate(fl_display, draw_window = fl_window,
+ if (!draw_)
+ draw_ = XftDrawCreate(fl_display, draw_window = fl_window,
fl_visual->visual, fl_colormap);
else //if (draw_window != fl_window)
- XftDrawChange(draw, draw_window = fl_window);
+ XftDrawChange(draw_, draw_window = fl_window);
Region region = fl_clip_region();
if (region && XEmptyRegion(region)) return;
- XftDrawSetClip(draw, region);
+ XftDrawSetClip(draw_, region);
// Use fltk's color allocator, copy the results to match what
// XftCollorAllocValue returns:
@@ -532,10 +532,10 @@ void fl_draw(const char *str, int n, int x, int y) {
color.color.blue = ((int)b)*0x101;
color.color.alpha = 0xffff;
- XftDrawStringUtf8(draw, &color, current_font, x, y, (XftChar8 *)str, n);
+ XftDrawStringUtf8(draw_, &color, current_font, x, y, (XftChar8 *)str, n);
}
-void fl_draw(int angle, const char *str, int n, int x, int y) {
+void Fl_Device::draw(int angle, const char *str, int n, int x, int y) {
fl_font(fl_font_, fl_size_, angle);
fl_draw(str, n, (int)x, (int)y);
fl_font(fl_font_, fl_size_);
@@ -547,24 +547,24 @@ void fl_draw(const char* str, int n, float x, float y) {
static void fl_drawUCS4(const FcChar32 *str, int n, int x, int y) {
#if USE_OVERLAY
- XftDraw*& draw = fl_overlay ? draw_overlay : ::draw;
+ XftDraw*& draw_ = fl_overlay ? draw_overlay : ::draw_;
if (fl_overlay) {
- if (!draw)
- draw = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
+ if (!draw_)
+ draw_ = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
fl_overlay_visual->visual, fl_overlay_colormap);
else //if (draw_overlay_window != fl_window)
- XftDrawChange(draw, draw_overlay_window = fl_window);
+ XftDrawChange(draw_, draw_overlay_window = fl_window);
} else
#endif
- if (!draw)
- draw = XftDrawCreate(fl_display, draw_window = fl_window,
+ if (!draw_)
+ draw_ = XftDrawCreate(fl_display, draw_window = fl_window,
fl_visual->visual, fl_colormap);
else //if (draw_window != fl_window)
- XftDrawChange(draw, draw_window = fl_window);
+ XftDrawChange(draw_, draw_window = fl_window);
Region region = fl_clip_region();
if (region && XEmptyRegion(region)) return;
- XftDrawSetClip(draw, region);
+ XftDrawSetClip(draw_, region);
// Use fltk's color allocator, copy the results to match what
// XftCollorAllocValue returns:
@@ -576,7 +576,7 @@ static void fl_drawUCS4(const FcChar32 *str, int n, int x, int y) {
color.color.blue = ((int)b)*0x101;
color.color.alpha = 0xffff;
- XftDrawString32(draw, &color, current_font, x, y, (FcChar32 *)str, n);
+ XftDrawString32(draw_, &color, current_font, x, y, (FcChar32 *)str, n);
}
diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx
index bf299bbc7..b73074323 100644
--- a/src/fl_line_style.cxx
+++ b/src/fl_line_style.cxx
@@ -77,7 +77,7 @@ void fl_quartz_restore_line_style_() {
\note The \p dashes array does not work under Windows 95, 98 or Me,
since those operating systems do not support complex line styles.
*/
-void fl_line_style(int style, int width, char* dashes) {
+void Fl_Device::line_style(int style, int width, char* dashes) {
#if defined(USE_X11)
int ndashes = dashes ? strlen(dashes) : 0;
@@ -143,6 +143,8 @@ void fl_line_style(int style, int width, char* dashes) {
if (width<1) width = 1;
fl_quartz_line_width_ = (float)width;
fl_quartz_line_cap_ = Cap[(style>>8)&3];
+ // when printing kCGLineCapSquare seems better for solid lines
+ if (Fl_Device::current()->type() == quartz_printer && style == FL_SOLID) fl_quartz_line_cap_ = kCGLineCapSquare;
fl_quartz_line_join_ = Join[(style>>12)&3];
char *d = dashes;
static CGFloat pattern[16];
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx
index 4e78d73d9..4585fe334 100644
--- a/src/fl_rect.cxx
+++ b/src/fl_rect.cxx
@@ -43,12 +43,16 @@
#ifdef __APPLE_QUARTZ__
extern float fl_quartz_line_width_;
+#ifdef __APPLE_COCOA__
+#define USINGQUARTZPRINTER (Fl_Device::current()->type() == quartz_printer)
+#endif
#endif
/**
Draws a 1-pixel border \e inside the given bounding box
*/
-void fl_rect(int x, int y, int w, int h) {
+void Fl_Device::rect(int x, int y, int w, int h) {
+
if (w<=0 || h<=0) return;
#if defined(USE_X11)
XDrawRectangle(fl_display, fl_window, fl_gc, x, y, w-1, h-1);
@@ -60,14 +64,14 @@ void fl_rect(int x, int y, int w, int h) {
LineTo(fl_gc, x, y);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextStrokeRect(fl_gc, rect);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -79,7 +83,7 @@ void fl_rect(int x, int y, int w, int h) {
/**
Colors a rectangle that exactly fills the given bounding box
*/
-void fl_rectf(int x, int y, int w, int h) {
+void Fl_Device::rectf(int x, int y, int w, int h) {
if (w<=0 || h<=0) return;
#if defined(USE_X11)
if (w && h) XFillRectangle(fl_display, fl_window, fl_gc, x, y, w, h);
@@ -90,14 +94,14 @@ void fl_rectf(int x, int y, int w, int h) {
FillRect(fl_gc, &rect, fl_brush());
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextFillRect(fl_gc, rect);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -109,14 +113,14 @@ void fl_rectf(int x, int y, int w, int h) {
/**
Draws a horizontal line from (x,y) to (x1,y)
*/
-void fl_xyline(int x, int y, int x1) {
+void Fl_Device::xyline(int x, int y, int x1) {
#if defined(USE_X11)
XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y);
#elif defined(WIN32)
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -124,7 +128,7 @@ void fl_xyline(int x, int y, int x1) {
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -136,7 +140,7 @@ void fl_xyline(int x, int y, int x1) {
/**
Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2)
*/
-void fl_xyline(int x, int y, int x1, int y2) {
+void Fl_Device::xyline(int x, int y, int x1, int y2) {
#if defined (USE_X11)
XPoint p[3];
p[0].x = x; p[0].y = p[1].y = y;
@@ -150,7 +154,7 @@ void fl_xyline(int x, int y, int x1, int y2) {
LineTo(fl_gc, x1, y2);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -159,7 +163,7 @@ void fl_xyline(int x, int y, int x1, int y2) {
CGContextAddLineToPoint(fl_gc, x1, y2);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -172,7 +176,7 @@ void fl_xyline(int x, int y, int x1, int y2) {
Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2)
and then another horizontal from (x1,y2) to (x3,y2)
*/
-void fl_xyline(int x, int y, int x1, int y2, int x3) {
+void Fl_Device::xyline(int x, int y, int x1, int y2, int x3) {
#if defined(USE_X11)
XPoint p[4];
p[0].x = x; p[0].y = p[1].y = y;
@@ -188,7 +192,7 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
LineTo(fl_gc, x3, y2);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -198,7 +202,7 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
CGContextAddLineToPoint(fl_gc, x3, y2);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -210,7 +214,7 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
/**
Draws a vertical line from (x,y) to (x,y1)
*/
-void fl_yxline(int x, int y, int y1) {
+void Fl_Device::yxline(int x, int y, int y1) {
#if defined(USE_X11)
XDrawLine(fl_display, fl_window, fl_gc, x, y, x, y1);
#elif defined(WIN32)
@@ -219,7 +223,7 @@ void fl_yxline(int x, int y, int y1) {
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -227,7 +231,7 @@ void fl_yxline(int x, int y, int y1) {
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -239,7 +243,7 @@ void fl_yxline(int x, int y, int y1) {
/**
Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)
*/
-void fl_yxline(int x, int y, int y1, int x2) {
+void Fl_Device::yxline(int x, int y, int y1, int x2) {
#if defined(USE_X11)
XPoint p[3];
p[0].x = p[1].x = x; p[0].y = y;
@@ -253,7 +257,7 @@ void fl_yxline(int x, int y, int y1, int x2) {
LineTo(fl_gc, x2, y1);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -262,7 +266,7 @@ void fl_yxline(int x, int y, int y1, int x2) {
CGContextAddLineToPoint(fl_gc, x2, y1);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -275,7 +279,7 @@ void fl_yxline(int x, int y, int y1, int x2) {
Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1)
to (x2,y1), then another vertical from (x2,y1) to (x2,y3)
*/
-void fl_yxline(int x, int y, int y1, int x2, int y3) {
+void Fl_Device::yxline(int x, int y, int y1, int x2, int y3) {
#if defined(USE_X11)
XPoint p[4];
p[0].x = p[1].x = x; p[0].y = y;
@@ -291,7 +295,7 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
LineTo(fl_gc, x2, y3);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -301,7 +305,7 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
CGContextAddLineToPoint(fl_gc, x2, y3);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -313,7 +317,7 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
/**
Draws a line from (x,y) to (x1,y1)
*/
-void fl_line(int x, int y, int x1, int y1) {
+void Fl_Device::line(int x, int y, int x1, int y1) {
#if defined(USE_X11)
XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y1);
#elif defined(WIN32)
@@ -344,7 +348,7 @@ void fl_line(int x, int y, int x1, int y1) {
/**
Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2)
*/
-void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
+void Fl_Device::line(int x, int y, int x1, int y1, int x2, int y2) {
#if defined(USE_X11)
XPoint p[3];
p[0].x = x; p[0].y = y;
@@ -381,7 +385,7 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
/**
Outlines a 3-sided polygon with lines
*/
-void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
+void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2) {
#if defined(USE_X11)
XPoint p[4];
p[0].x = x; p[0].y = y;
@@ -414,7 +418,7 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
/**
Outlines a 4-sided polygon with lines
*/
-void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
+void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
#if defined(USE_X11)
XPoint p[5];
p[0].x = x; p[0].y = y;
@@ -450,7 +454,7 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
/**
Fills a 3-sided polygon. The polygon must be convex.
*/
-void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
+void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2) {
XPoint p[4];
p[0].x = x; p[0].y = y;
p[1].x = x1; p[1].y = y1;
@@ -482,7 +486,7 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
/**
Fills a 4-sided polygon. The polygon must be convex.
*/
-void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
+void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
XPoint p[5];
p[0].x = x; p[0].y = y;
p[1].x = x1; p[1].y = y1;
@@ -516,7 +520,7 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
/**
Draws a single pixel at the given coordinates
*/
-void fl_point(int x, int y) {
+void Fl_Device::point(int x, int y) {
#if defined(USE_X11)
XDrawPoint(fl_display, fl_window, fl_gc, x, y);
#elif defined(WIN32)
@@ -645,7 +649,7 @@ Fl_Region fl_clip_region() {
new region onto the stack.
\param[in] x,y,w,h position and size
*/
-void fl_push_clip(int x, int y, int w, int h) {
+void Fl_Device::push_clip(int x, int y, int w, int h) {
Fl_Region r;
if (w > 0 && h > 0) {
r = XRectangleRegion(x,y,w,h);
@@ -694,7 +698,7 @@ void fl_push_clip(int x, int y, int w, int h) {
/**
Pushes an empty clip region onto the stack so nothing will be clipped.
*/
-void fl_push_no_clip() {
+void Fl_Device::push_no_clip() {
if (rstackptr < STACK_MAX) rstack[++rstackptr] = 0;
else Fl::warning("fl_push_no_clip: clip stack overflow!\n");
fl_restore_clip();
@@ -708,7 +712,7 @@ void fl_push_no_clip() {
Unpredictable results may occur if the clip stack is not empty when
you return to FLTK.
*/
-void fl_pop_clip() {
+void Fl_Device::pop_clip() {
if (rstackptr > 0) {
Fl_Region oldr = rstack[rstackptr--];
if (oldr) XDestroyRegion(oldr);
@@ -726,7 +730,7 @@ void fl_pop_clip() {
Under X this returns 2 if the rectangle is partially clipped,
and 1 if it is entirely inside the clip region.
*/
-int fl_not_clipped(int x, int y, int w, int h) {
+int Fl_Device::not_clipped(int x, int y, int w, int h) {
if (x+w <= 0 || y+h <= 0) return 0;
Fl_Region r = rstack[rstackptr];
#if defined (USE_X11)
@@ -734,12 +738,19 @@ int fl_not_clipped(int x, int y, int w, int h) {
#elif defined(WIN32)
if (!r) return 1;
RECT rect;
- rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
+ if (Fl_Device::current()->type() == Fl_Device::gdi_printer) { // in case of print context, convert coords from logical to device
+ POINT pt[2] = { {x, y}, {x + w, y + h} };
+ LPtoDP(fl_gc, pt, 2);
+ rect.left = pt[0].x; rect.top = pt[0].y; rect.right = pt[1].x; rect.bottom = pt[1].y;
+ }
+ else {
+ rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
+ }
return RectInRegion(r,&rect);
#elif defined(__APPLE_QUARTZ__)
if (!r) return 1;
#ifdef __APPLE_COCOA__
- CGRect arg = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
for(int i = 0; i < r->count; i++) {
CGRect test = CGRectIntersection(r->rects[i], arg);
if( ! CGRectIsEmpty(test)) return 1;
@@ -770,7 +781,7 @@ int fl_not_clipped(int x, int y, int w, int h) {
completely outside the region.
\returns Non-zero if the resulting rectangle is different to the original.
*/
-int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
+int Fl_Device::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
X = x; Y = y; W = w; H = h;
Fl_Region r = rstack[rstackptr];
if (!r) return 0;
@@ -806,10 +817,17 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
ret = 2;
} else if (EqualRgn(temp, rr)) { // complete
ret = 0;
- } else { // parital intersection
+ } else { // partial intersection
RECT rect;
GetRgnBox(temp, &rect);
- X = rect.left; Y = rect.top; W = rect.right - X; H = rect.bottom - Y;
+ if(Fl_Device::current()->type() == Fl_Device::gdi_printer) { // if print context, convert coords from device to logical
+ POINT pt[2] = { {rect.left, rect.top}, {rect.right, rect.bottom} };
+ DPtoLP(fl_gc, pt, 2);
+ X = pt[0].x; Y = pt[0].y; W = pt[1].x - X; H = pt[1].y - Y;
+ }
+ else {
+ X = rect.left; Y = rect.top; W = rect.right - X; H = rect.bottom - Y;
+ }
ret = 1;
}
DeleteObject(temp);
@@ -817,7 +835,7 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
return ret;
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- CGRect arg = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
CGRect u = CGRectMake(0,0,0,0);
CGRect test;
for(int i = 0; i < r->count; i++) {
diff --git a/src/fl_vertex.cxx b/src/fl_vertex.cxx
index 36e0aaae9..d2823391d 100644
--- a/src/fl_vertex.cxx
+++ b/src/fl_vertex.cxx
@@ -49,6 +49,7 @@ struct matrix {double a, b, c, d, x, y;};
static matrix m = {1, 0, 0, 1, 0, 0};
static matrix stack[32];
+matrix * fl_matrix = &m;
static int sptr = 0;
/**
@@ -147,22 +148,22 @@ enum {LINE, LOOP, POLYGON, POINT_};
/**
Starts drawing a list of points. Points are added to the list with fl_vertex()
*/
-void fl_begin_points() {n = 0; what = POINT_;}
+void Fl_Device::begin_points() {n = 0; what = POINT_;}
/**
Starts drawing a list of lines.
*/
-void fl_begin_line() {n = 0; what = LINE;}
+void Fl_Device::begin_line() {n = 0; what = LINE;}
/**
Starts drawing a closed sequence of lines.
*/
-void fl_begin_loop() {n = 0; what = LOOP;}
+void Fl_Device::begin_loop() {n = 0; what = LOOP;}
/**
Starts drawing a convex filled polygon.
*/
-void fl_begin_polygon() {n = 0; what = POLYGON;}
+void Fl_Device::begin_polygon() {n = 0; what = POLYGON;}
/**
Transforms coordinate using the current transformation matrix.
@@ -204,7 +205,7 @@ static void fl_transformed_vertex(COORD_T x, COORD_T y) {
Adds coordinate pair to the vertex list without further transformations.
\param[in] xf,yf transformed coordinate
*/
-void fl_transformed_vertex(double xf, double yf) {
+void Fl_Device::transformed_vertex(double xf, double yf) {
#ifdef __APPLE_QUARTZ__
fl_transformed_vertex(COORD_T(xf), COORD_T(yf));
#else
@@ -216,14 +217,14 @@ void fl_transformed_vertex(double xf, double yf) {
Adds a single vertex to the current path.
\param[in] x,y coordinate
*/
-void fl_vertex(double x,double y) {
+void Fl_Device::vertex(double x,double y) {
fl_transformed_vertex(x*m.a + y*m.c + m.x, x*m.b + y*m.d + m.y);
}
/**
Ends list of points, and draws.
*/
-void fl_end_points() {
+void Fl_Device::end_points() {
#if defined(USE_X11)
if (n>1) XDrawPoints(fl_display, fl_window, fl_gc, p, n, 0);
#elif defined(WIN32)
@@ -252,7 +253,7 @@ void fl_end_points() {
/**
Ends list of lines, and draws.
*/
-void fl_end_line() {
+void Fl_Device::end_line() {
if (n < 2) {
fl_end_points();
return;
@@ -285,7 +286,7 @@ static void fixloop() { // remove equal points from closed path
/**
Ends closed sequence of lines, and draws.
*/
-void fl_end_loop() {
+void Fl_Device::end_loop() {
fixloop();
if (n>2) fl_transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
fl_end_line();
@@ -294,7 +295,7 @@ void fl_end_loop() {
/**
Ends convex filled polygon, and draws.
*/
-void fl_end_polygon() {
+void Fl_Device::end_polygon() {
fixloop();
if (n < 3) {
fl_end_line();
@@ -325,7 +326,7 @@ void fl_end_polygon() {
#endif
}
-static int gap;
+static int gap_;
#if defined(WIN32)
static int counts[20];
static int numcount;
@@ -345,9 +346,9 @@ static int numcount;
whether "even/odd" or "non-zero" winding rules are used to fill them.
Holes should be drawn in the opposite direction to the outside loop.
*/
-void fl_begin_complex_polygon() {
+void Fl_Device::begin_complex_polygon() {
fl_begin_polygon();
- gap = 0;
+ gap_ = 0;
#if defined(WIN32)
numcount = 0;
#endif
@@ -359,23 +360,23 @@ void fl_begin_complex_polygon() {
It is unnecessary but harmless to call fl_gap() before the first vertex,
after the last vertex, or several times in a row.
*/
-void fl_gap() {
- while (n>gap+2 && p[n-1].x == p[gap].x && p[n-1].y == p[gap].y) n--;
- if (n > gap+2) {
- fl_transformed_vertex((COORD_T)p[gap].x, (COORD_T)p[gap].y);
+void Fl_Device::gap() {
+ while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
+ if (n > gap_+2) {
+ fl_transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
#if defined(WIN32)
- counts[numcount++] = n-gap;
+ counts[numcount++] = n-gap_;
#endif
- gap = n;
+ gap_ = n;
} else {
- n = gap;
+ n = gap_;
}
}
/**
Ends complex filled polygon, and draws.
*/
-void fl_end_complex_polygon() {
+void Fl_Device::end_complex_polygon() {
fl_gap();
if (n < 3) {
fl_end_line();
@@ -417,7 +418,7 @@ void fl_end_complex_polygon() {
a complex polygon you must use fl_arc()
\param[in] x,y,r center and radius of circle
*/
-void fl_circle(double x, double y,double r) {
+void Fl_Device::circle(double x, double y,double r) {
double xt = fl_transform_x(x,y);
double yt = fl_transform_y(x,y);
double rx = r * (m.c ? sqrt(m.a*m.a+m.c*m.c) : fabs(m.a));
diff --git a/src/makedepend b/src/makedepend
index 6aba8ccd1..025abad77 100644
--- a/src/makedepend
+++ b/src/makedepend
@@ -4,30 +4,33 @@ Fl.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl.o: ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
-Fl.o: flstring.h ../FL/fl_draw.H
+Fl.o: flstring.h ../FL/fl_draw.H ../FL/Fl_Device.H
Fl_Adjuster.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Adjuster.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Adjuster.o: ../FL/fl_types.h ../FL/Fl_Adjuster.H ../FL/Fl_Valuator.H
Fl_Adjuster.o: ../FL/Fl_Widget.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
-Fl_Adjuster.o: ../FL/fl_draw.H ../FL/Fl_Window.H fastarrow.h mediumarrow.h
-Fl_Adjuster.o: slowarrow.h
+Fl_Adjuster.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Adjuster.o: fastarrow.h mediumarrow.h slowarrow.h
Fl_Bitmap.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Bitmap.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Bitmap.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H
-Fl_Bitmap.o: ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H
-Fl_Bitmap.o: ../FL/Fl_Image.H ../FL/Fl_Bitmap.H flstring.h ../config.h
+Fl_Bitmap.o: ../FL/Fl_Device.H ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H
+Fl_Bitmap.o: ../FL/Fl_Widget.H ../FL/Fl_Image.H ../FL/Fl_Bitmap.H
+Fl_Bitmap.o: ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/Fl_Pixmap.H
+Fl_Bitmap.o: ../FL/Fl_RGB_Image.H flstring.h ../config.h
Fl_Browser.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Browser.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Browser.o: ../FL/fl_types.h ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
Fl_Browser.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
Fl_Browser.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Image.H
-Fl_Browser.o: ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h ../config.h
+Fl_Browser.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Browser.o: flstring.h ../config.h
Fl_Browser_.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Browser_.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Browser_.o: ../FL/fl_types.h ../FL/Fl_Widget.H ../FL/Fl_Browser_.H
Fl_Browser_.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
Fl_Browser_.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
-Fl_Browser_.o: ../FL/Fl_Window.H
+Fl_Browser_.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Browser_load.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Browser_load.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Browser_load.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Browser.H
@@ -43,15 +46,15 @@ Fl_Button.o: ../FL/Fl_Group.H ../FL/Fl_Window.H ../FL/Fl_Group.H
Fl_Chart.o: ../FL/math.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Chart.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Chart.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Chart.H
-Fl_Chart.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h
-Fl_Chart.o: ../config.h
+Fl_Chart.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Chart.o: ../FL/Fl_Device.H ../FL/x.H flstring.h ../config.h
Fl_Check_Browser.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/fl_draw.H
Fl_Check_Browser.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
-Fl_Check_Browser.o: ../FL/Fl_Window.H ../FL/Fl_Check_Browser.H ../FL/Fl.H
-Fl_Check_Browser.o: ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
-Fl_Check_Browser.o: ../FL/Fl_Browser_.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
-Fl_Check_Browser.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
-Fl_Check_Browser.o: ../FL/Fl_Valuator.H ../FL/Fl.H
+Fl_Check_Browser.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Check_Browser.o: ../FL/Xutf8.h ../FL/Fl_Check_Browser.H ../FL/Fl.H
+Fl_Check_Browser.o: ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Fl_Browser_.H
+Fl_Check_Browser.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
+Fl_Check_Browser.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl.H
Fl_Check_Button.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Check_Button.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Check_Button.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Check_Button.H
@@ -61,11 +64,12 @@ Fl_Choice.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Choice.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Choice.o: ../FL/fl_types.h ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
Fl_Choice.o: ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H
-Fl_Choice.o: ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h ../config.h
+Fl_Choice.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Choice.o: flstring.h ../config.h
Fl_Clock.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Clock.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Clock.o: ../FL/fl_types.h ../FL/Fl_Clock.H ../FL/Fl_Widget.H
-Fl_Clock.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Clock.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Color_Chooser.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Color_Chooser.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Color_Chooser.o: ../FL/Fl_Export.H ../FL/fl_types.h
@@ -75,21 +79,29 @@ Fl_Color_Chooser.o: ../FL/Fl_Button.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
Fl_Color_Chooser.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H
Fl_Color_Chooser.o: ../FL/Fl_Value_Input.H ../FL/Fl_Valuator.H
Fl_Color_Chooser.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/fl_draw.H
-Fl_Color_Chooser.o: ../FL/Fl_Window.H ../FL/math.h ../FL/Fl_Window.H
-Fl_Color_Chooser.o: ../FL/Fl_Group.H
+Fl_Color_Chooser.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Color_Chooser.o: ../FL/math.h ../FL/Fl_Window.H ../FL/Fl_Group.H
Fl_Counter.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Counter.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Counter.o: ../FL/fl_types.h ../FL/Fl_Counter.H ../FL/Fl_Valuator.H
Fl_Counter.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Counter.o: ../FL/Fl_Device.H ../FL/x.H
Fl_Dial.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Dial.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Dial.o: ../FL/fl_types.h ../FL/Fl_Dial.H ../FL/Fl_Valuator.H
-Fl_Dial.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/math.h
+Fl_Dial.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Dial.o: ../FL/Fl_Device.H ../FL/x.H ../FL/math.h
+Fl_Device.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
+Fl_Device.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
+Fl_Device.o: ../FL/fl_types.h ../FL/Fl_Device.H ../FL/Fl_Printer.H
+Fl_Device.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Device.o: ../FL/Fl_Pixmap.H ../FL/Fl_Image.H ../FL/Fl_RGB_Image.H
+Fl_Device.o: ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
Fl_Double_Window.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Double_Window.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Double_Window.o: ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Double_Window.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/x.H
-Fl_Double_Window.o: ../FL/fl_draw.H
+Fl_Double_Window.o: ../FL/fl_draw.H ../FL/Fl_Device.H
Fl_File_Browser.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H
Fl_File_Browser.o: ../FL/Fl_Browser_.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_File_Browser.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
@@ -97,8 +109,9 @@ Fl_File_Browser.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
Fl_File_Browser.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_File_Browser.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Fl_Image.H
Fl_File_Browser.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H
-Fl_File_Browser.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/filename.H
-Fl_File_Browser.o: ../FL/Fl_Image.H flstring.h ../config.h
+Fl_File_Browser.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H
+Fl_File_Browser.o: ../FL/x.H ../FL/filename.H ../FL/Fl_Image.H flstring.h
+Fl_File_Browser.o: ../config.h
Fl_File_Chooser.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/fl_utf8.h
Fl_File_Chooser.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Xutf8.h
Fl_File_Chooser.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
@@ -114,7 +127,7 @@ Fl_File_Chooser.o: ../FL/filename.H ../FL/Fl_Box.H ../FL/Fl_Check_Button.H
Fl_File_Chooser.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
Fl_File_Chooser.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
Fl_File_Chooser.o: ../FL/Fl_Return_Button.H ../FL/fl_ask.H ../FL/fl_draw.H
-Fl_File_Chooser.o: ../FL/Fl_Bitmap.H
+Fl_File_Chooser.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Bitmap.H
Fl_File_Chooser2.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/fl_utf8.h
Fl_File_Chooser2.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Xutf8.h
Fl_File_Chooser2.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
@@ -136,54 +149,61 @@ Fl_File_Icon.o: ../FL/fl_utf8.h flstring.h ../FL/Fl_Export.H ../config.h
Fl_File_Icon.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/fl_utf8.h
Fl_File_Icon.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_File_Icon.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Widget.H
-Fl_File_Icon.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/filename.H
+Fl_File_Icon.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_File_Icon.o: ../FL/filename.H
Fl_File_Input.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_File_Input.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_File_Input.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_File_Input.H
Fl_File_Input.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Window.H
Fl_File_Input.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_File_Input.o: ../FL/Fl_Window.H flstring.h ../config.h
+Fl_File_Input.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H flstring.h
+Fl_File_Input.o: ../config.h
Fl_Group.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Group.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Group.o: ../FL/fl_types.h ../FL/Fl_Group.H ../FL/Fl_Window.H
Fl_Group.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_Group.o: ../FL/Fl_Window.H
+Fl_Group.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Help_View.o: ../FL/Fl_Help_View.H ../FL/Fl.H ../FL/fl_utf8.h
Fl_Help_View.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Xutf8.h
Fl_Help_View.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Help_View.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
Fl_Help_View.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
-Fl_Help_View.o: ../FL/Fl_Window.H ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H
-Fl_Help_View.o: ../FL/Fl_Window.H ../FL/Fl_Pixmap.H ../FL/x.H ../FL/fl_utf8.h
-Fl_Help_View.o: ../FL/filename.H flstring.h ../config.h
+Fl_Help_View.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Help_View.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/Fl_Window.H
+Fl_Help_View.o: ../FL/Fl_Pixmap.H ../FL/fl_utf8.h ../FL/filename.H flstring.h
+Fl_Help_View.o: ../config.h
Fl_Image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Image.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
-Fl_Image.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/x.H
-Fl_Image.o: ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H
-Fl_Image.o: ../FL/Fl_Image.H ../FL/Fl_Image.H flstring.h ../config.h
+Fl_Image.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Image.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Widget.H
+Fl_Image.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../FL/Fl_Image.H
+Fl_Image.o: ../FL/Fl_Image.H ../FL/Fl_Printer.H ../FL/Fl_Device.H
+Fl_Image.o: ../FL/Fl_Pixmap.H ../FL/Fl_RGB_Image.H ../FL/Fl_Bitmap.H
+Fl_Image.o: flstring.h ../config.h
Fl_Input.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Input.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Input.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Group.H
Fl_Input.o: ../FL/Fl_Widget.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
-Fl_Input.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/fl_ask.H flstring.h
-Fl_Input.o: ../config.h
+Fl_Input.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Input.o: ../FL/fl_ask.H flstring.h ../config.h
Fl_Input_.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Input_.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Input_.o: ../FL/fl_types.h ../FL/Fl_Input_.H ../FL/Fl_Widget.H
Fl_Input_.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/fl_draw.H
-Fl_Input_.o: ../FL/Fl_Window.H ../FL/fl_ask.H ../FL/fl_utf8.h flstring.h
-Fl_Input_.o: ../config.h
+Fl_Input_.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H ../FL/fl_ask.H
+Fl_Input_.o: ../FL/fl_utf8.h flstring.h ../config.h
Fl_Light_Button.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Light_Button.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Light_Button.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Light_Button.H
Fl_Light_Button.o: ../FL/Fl_Button.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_Light_Button.o: ../FL/Fl_Window.H flstring.h ../config.h
+Fl_Light_Button.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H flstring.h
+Fl_Light_Button.o: ../config.h
Fl_Menu.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Menu.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Menu.o: ../FL/fl_types.h ../FL/Fl_Menu_Window.H ../FL/Fl_Single_Window.H
Fl_Menu.o: ../FL/Fl_Window.H ../FL/Fl_Menu_.H ../FL/Fl_Widget.H
-Fl_Menu.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H ../FL/fl_draw.H flstring.h
-Fl_Menu.o: ../config.h
+Fl_Menu.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H ../FL/fl_draw.H
+Fl_Menu.o: ../FL/Fl_Device.H ../FL/x.H flstring.h ../config.h
Fl_Menu_.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Menu_.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Menu_.o: ../FL/fl_types.h ../FL/Fl_Menu_.H ../FL/Fl_Widget.H
@@ -192,17 +212,18 @@ Fl_Menu_Bar.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Menu_Bar.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Menu_Bar.o: ../FL/fl_types.h ../FL/Fl_Menu_Bar.H ../FL/Fl_Menu_.H
Fl_Menu_Bar.o: ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H
-Fl_Menu_Bar.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Menu_Bar.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Menu_Button.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Menu_Button.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Menu_Button.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Menu_Button.H
Fl_Menu_Button.o: ../FL/Fl_Menu_.H ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H
Fl_Menu_Button.o: ../FL/Fl_Image.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Menu_Button.o: ../FL/Fl_Device.H ../FL/x.H
Fl_Menu_Window.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Menu_Window.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Menu_Window.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/x.H
-Fl_Menu_Window.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Menu_Window.H
-Fl_Menu_Window.o: ../FL/Fl_Single_Window.H
+Fl_Menu_Window.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H
+Fl_Menu_Window.o: ../FL/Fl_Menu_Window.H ../FL/Fl_Single_Window.H
Fl_Menu_add.o: ../FL/Fl_Menu_.H ../FL/Fl_Widget.H ../FL/Enumerations.H
Fl_Menu_add.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Menu_Item.H
Fl_Menu_add.o: ../FL/Fl_Image.H flstring.h ../FL/Fl_Export.H ../config.h
@@ -243,34 +264,59 @@ Fl_Overlay_Window.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Overlay_Window.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Overlay_Window.o: ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Overlay_Window.o: ../FL/Fl_Overlay_Window.H ../FL/Fl_Double_Window.H
-Fl_Overlay_Window.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/x.H
+Fl_Overlay_Window.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H
+Fl_Overlay_Window.o: ../FL/x.H
Fl_Pack.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Pack.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Pack.o: ../FL/fl_types.h ../FL/Fl_Pack.H ../FL/Fl_Group.H ../FL/fl_draw.H
-Fl_Pack.o: ../FL/Fl_Window.H
+Fl_Pack.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Pixmap.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Pixmap.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
-Fl_Pixmap.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/x.H
-Fl_Pixmap.o: ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H
-Fl_Pixmap.o: ../FL/Fl_Image.H ../FL/Fl_Pixmap.H flstring.h ../config.h
+Fl_Pixmap.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Pixmap.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Widget.H
+Fl_Pixmap.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../FL/Fl_Image.H
+Fl_Pixmap.o: ../FL/Fl_Pixmap.H ../FL/Fl_Printer.H ../FL/Fl_Device.H
+Fl_Pixmap.o: ../FL/Fl_RGB_Image.H ../FL/Fl_Bitmap.H flstring.h ../config.h
Fl_Positioner.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Positioner.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Positioner.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Positioner.H
Fl_Positioner.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Positioner.o: ../FL/Fl_Device.H ../FL/x.H
Fl_Preferences.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Preferences.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Preferences.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Preferences.H
Fl_Preferences.o: ../FL/Fl_Plugin.H ../FL/Fl_Preferences.H ../FL/Fl_Tree.H
Fl_Preferences.o: ../FL/Fl_Group.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
Fl_Preferences.o: ../FL/Fl_Valuator.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_Preferences.o: ../FL/Fl_Window.H ../FL/Fl_Tree_Item.H ../FL/Fl_Widget.H
-Fl_Preferences.o: ../FL/Fl_Image.H ../FL/Fl_Tree_Item_Array.H
-Fl_Preferences.o: ../FL/Fl_Tree_Prefs.H ../FL/filename.H ../FL/fl_utf8.h
-Fl_Preferences.o: flstring.h ../config.h
+Fl_Preferences.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Preferences.o: ../FL/Fl_Tree_Item.H ../FL/Fl_Widget.H ../FL/Fl_Image.H
+Fl_Preferences.o: ../FL/Fl_Tree_Item_Array.H ../FL/Fl_Tree_Prefs.H
+Fl_Preferences.o: ../FL/filename.H ../FL/fl_utf8.h flstring.h ../config.h
+Fl_Printer.o: ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/fl_draw.H
+Fl_Printer.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
+Fl_Printer.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H ../FL/Xutf8.h
+Fl_Printer.o: ../FL/Fl_Pixmap.H ../FL/Fl_Image.H ../FL/Fl_RGB_Image.H
+Fl_Printer.o: ../FL/Fl_Bitmap.H ../src/Fl_PS_Printer.cxx ../FL/Fl.H
+Fl_Printer.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
+Fl_Printer.o: ../FL/fl_ask.H ../FL/Fl_Native_File_Chooser.H
+Fl_Printer.o: ../FL/Fl_Native_File_Chooser_FLTK.H ../FL/Fl_File_Chooser.H
+Fl_Printer.o: ../FL/Fl_Double_Window.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
+Fl_Printer.o: ../FL/Fl_Menu_.H ../FL/Fl_Widget.H ../FL/Fl_Menu_Item.H
+Fl_Printer.o: ../FL/Fl_Menu_Button.H ../FL/Fl_Button.H ../FL/Fl_Preferences.H
+Fl_Printer.o: ../FL/Fl_Tile.H ../FL/Fl_Group.H ../FL/Fl_File_Browser.H
+Fl_Printer.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
+Fl_Printer.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H
+Fl_Printer.o: ../FL/Fl.H ../FL/filename.H ../FL/Fl_Box.H
+Fl_Printer.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
+Fl_Printer.o: ../FL/Fl_Button.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
+Fl_Printer.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H print_panel.cxx
+Fl_Printer.o: print_panel.h ../FL/Fl_Round_Button.H ../FL/Fl_Spinner.H
+Fl_Printer.o: ../FL/Enumerations.H ../FL/Fl_Repeat_Button.H
+Fl_Printer.o: ../FL/Fl_Progress.H ../src/flstring.h ../config.h
Fl_Progress.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Progress.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Progress.o: ../FL/fl_types.h ../FL/Fl_Progress.H ../FL/Fl_Widget.H
-Fl_Progress.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Progress.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Repeat_Button.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Repeat_Button.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Repeat_Button.o: ../FL/Fl_Export.H ../FL/fl_types.h
@@ -281,10 +327,12 @@ Fl_Return_Button.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Return_Button.o: ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Return_Button.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H
Fl_Return_Button.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Return_Button.o: ../FL/Fl_Device.H ../FL/x.H
Fl_Roller.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Roller.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Roller.o: ../FL/fl_types.h ../FL/Fl_Roller.H ../FL/Fl_Valuator.H
Fl_Roller.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Roller.o: ../FL/Fl_Device.H ../FL/x.H
Fl_Round_Button.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Round_Button.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Round_Button.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Round_Button.H
@@ -295,12 +343,13 @@ Fl_Scroll.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Scroll.o: ../FL/fl_types.h ../FL/Fl_Tiled_Image.H ../FL/Fl_Image.H
Fl_Scroll.o: ../FL/Fl_Scroll.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_Scroll.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
-Fl_Scroll.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Scroll.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Scrollbar.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Scrollbar.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Scrollbar.o: ../FL/fl_types.h ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
Fl_Scrollbar.o: ../FL/Fl_Valuator.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_Scrollbar.o: ../FL/Fl_Window.H flstring.h ../config.h
+Fl_Scrollbar.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H flstring.h
+Fl_Scrollbar.o: ../config.h
Fl_Shared_Image.o: ../FL/fl_utf8.h flstring.h ../FL/Fl_Export.H ../config.h
Fl_Shared_Image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
Fl_Shared_Image.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
@@ -311,26 +360,28 @@ Fl_Single_Window.o: ../FL/Fl_Single_Window.H ../FL/Fl_Window.H
Fl_Slider.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Slider.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Slider.o: ../FL/fl_types.h ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
-Fl_Slider.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h
-Fl_Slider.o: ../config.h
+Fl_Slider.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Slider.o: ../FL/Fl_Device.H ../FL/x.H flstring.h ../config.h
Fl_Table.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
-Fl_Table.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Table.H ../FL/Fl.H
-Fl_Table.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Xutf8.h
-Fl_Table.o: ../FL/Fl_Group.H ../FL/Fl_Scroll.H ../FL/Fl_Group.H
-Fl_Table.o: ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
-Fl_Table.o: ../FL/Fl_Valuator.H ../FL/Fl_Box.H ../FL/Fl_Scrollbar.H
+Fl_Table.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Table.o: ../FL/Xutf8.h ../FL/Fl_Table.H ../FL/Fl.H ../FL/fl_utf8.h
+Fl_Table.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Group.H
+Fl_Table.o: ../FL/Fl_Scroll.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
+Fl_Table.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
+Fl_Table.o: ../FL/Fl_Box.H ../FL/Fl_Scrollbar.H
Fl_Table_Row.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Table_Row.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Table_Row.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
-Fl_Table_Row.o: ../FL/Fl_Table_Row.H ../FL/Fl_Table.H ../FL/Fl_Group.H
-Fl_Table_Row.o: ../FL/Fl_Scroll.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
-Fl_Table_Row.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
-Fl_Table_Row.o: ../FL/Fl_Box.H ../FL/Fl_Scrollbar.H
+Fl_Table_Row.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Table_Row.H
+Fl_Table_Row.o: ../FL/Fl_Table.H ../FL/Fl_Group.H ../FL/Fl_Scroll.H
+Fl_Table_Row.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
+Fl_Table_Row.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Box.H
+Fl_Table_Row.o: ../FL/Fl_Scrollbar.H
Fl_Tabs.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Tabs.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Tabs.o: ../FL/fl_types.h ../FL/Fl_Tabs.H ../FL/Fl_Group.H
Fl_Tabs.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
-Fl_Tabs.o: ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
+Fl_Tabs.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
Fl_Text_Buffer.o: ../FL/fl_utf8.h flstring.h ../FL/Fl_Export.H ../config.h
Fl_Text_Buffer.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
Fl_Text_Buffer.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
@@ -339,18 +390,18 @@ Fl_Text_Display.o: ../FL/fl_utf8.h flstring.h ../FL/Fl_Export.H ../config.h
Fl_Text_Display.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
Fl_Text_Display.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Text_Display.o: ../FL/Fl_Text_Buffer.H ../FL/Fl_Text_Display.H
-Fl_Text_Display.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Group.H
-Fl_Text_Display.o: ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
-Fl_Text_Display.o: ../FL/Fl_Valuator.H ../FL/Fl_Text_Buffer.H
-Fl_Text_Display.o: ../FL/Fl_Window.H
+Fl_Text_Display.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H
+Fl_Text_Display.o: ../FL/x.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
+Fl_Text_Display.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
+Fl_Text_Display.o: ../FL/Fl_Text_Buffer.H ../FL/Fl_Window.H
Fl_Text_Editor.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/Fl.H
Fl_Text_Editor.o: ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
Fl_Text_Editor.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Text_Editor.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_Text_Editor.o: ../FL/Fl_Text_Editor.H ../FL/Fl_Text_Display.H
-Fl_Text_Editor.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Scrollbar.H
-Fl_Text_Editor.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
-Fl_Text_Editor.o: ../FL/Fl_Text_Buffer.H ../FL/fl_ask.H
+Fl_Text_Editor.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H
+Fl_Text_Editor.o: ../FL/x.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
+Fl_Text_Editor.o: ../FL/Fl_Valuator.H ../FL/Fl_Text_Buffer.H ../FL/fl_ask.H
Fl_Tile.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Tile.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Tile.o: ../FL/fl_types.h ../FL/Fl_Tile.H ../FL/Fl_Group.H
@@ -359,25 +410,26 @@ Fl_Tiled_Image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Tiled_Image.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Tiled_Image.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Tiled_Image.H
Fl_Tiled_Image.o: ../FL/Fl_Image.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Tiled_Image.o: ../FL/Fl_Device.H ../FL/x.H
Fl_Tree.o: ../FL/Fl_Tree.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Tree.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Tree.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Group.H
Fl_Tree.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
Fl_Tree.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
-Fl_Tree.o: ../FL/Fl_Tree_Item.H ../FL/Fl_Widget.H ../FL/Fl_Image.H
-Fl_Tree.o: ../FL/Fl_Tree_Item_Array.H ../FL/Fl_Tree_Prefs.H
+Fl_Tree.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Tree_Item.H ../FL/Fl_Widget.H
+Fl_Tree.o: ../FL/Fl_Image.H ../FL/Fl_Tree_Item_Array.H ../FL/Fl_Tree_Prefs.H
Fl_Tree_Item.o: ../FL/Fl_Widget.H ../FL/Fl_Tree_Item.H ../FL/Fl.H
Fl_Tree_Item.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Tree_Item.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Tree_Item.o: ../FL/fl_types.h ../FL/Fl_Image.H ../FL/fl_draw.H
-Fl_Tree_Item.o: ../FL/Fl_Window.H ../FL/Fl_Tree_Item_Array.H
-Fl_Tree_Item.o: ../FL/Fl_Tree_Prefs.H
+Fl_Tree_Item.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Tree_Item.o: ../FL/Fl_Tree_Item_Array.H ../FL/Fl_Tree_Prefs.H
Fl_Tree_Item_Array.o: ../FL/Fl_Tree_Item_Array.H ../FL/Fl_Tree_Item.H
Fl_Tree_Item_Array.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Tree_Item_Array.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Tree_Item_Array.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Widget.H
Fl_Tree_Item_Array.o: ../FL/Fl_Image.H ../FL/fl_draw.H ../FL/Fl_Window.H
-Fl_Tree_Item_Array.o: ../FL/Fl_Tree_Prefs.H
+Fl_Tree_Item_Array.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Tree_Prefs.H
Fl_Tree_Prefs.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Tree_Prefs.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Tree_Prefs.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Pixmap.H
@@ -385,8 +437,8 @@ Fl_Tree_Prefs.o: ../FL/Fl_Image.H ../FL/Fl_Tree_Prefs.H
Fl_Tooltip.o: ../FL/Fl_Tooltip.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Tooltip.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Tooltip.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Widget.H
-Fl_Tooltip.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Menu_Window.H
-Fl_Tooltip.o: ../FL/Fl_Single_Window.H
+Fl_Tooltip.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_Tooltip.o: ../FL/Fl_Menu_Window.H ../FL/Fl_Single_Window.H
Fl_Valuator.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Valuator.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Valuator.o: ../FL/fl_types.h ../FL/Fl_Valuator.H ../FL/Fl_Widget.H
@@ -400,17 +452,18 @@ Fl_Value_Output.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Value_Output.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Value_Output.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Value_Output.H
Fl_Value_Output.o: ../FL/Fl_Valuator.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_Value_Output.o: ../FL/Fl_Window.H
+Fl_Value_Output.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Value_Slider.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Value_Slider.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Value_Slider.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Value_Slider.H
Fl_Value_Slider.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Widget.H
-Fl_Value_Slider.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Value_Slider.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H
+Fl_Value_Slider.o: ../FL/x.H
Fl_Widget.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Widget.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Widget.o: ../FL/fl_types.h ../FL/Fl_Widget.H ../FL/Fl_Group.H
-Fl_Widget.o: ../FL/Fl_Tooltip.H ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h
-Fl_Widget.o: ../config.h
+Fl_Widget.o: ../FL/Fl_Tooltip.H ../FL/fl_draw.H ../FL/Fl_Window.H
+Fl_Widget.o: ../FL/Fl_Device.H ../FL/x.H flstring.h ../config.h
Fl_Window.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Window.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Window.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H
@@ -429,7 +482,7 @@ Fl_Window_iconize.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Xutf8.h
Fl_Wizard.o: ../FL/Fl_Wizard.H ../FL/Fl_Group.H ../FL/Fl_Window.H
Fl_Wizard.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Enumerations.H
Fl_Wizard.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-Fl_Wizard.o: ../FL/Fl_Window.H
+Fl_Wizard.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H ../FL/Xutf8.h
Fl_XBM_Image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_XBM_Image.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_XBM_Image.o: ../FL/fl_types.h ../FL/Fl_XBM_Image.H ../FL/Fl_Bitmap.H
@@ -448,8 +501,8 @@ Fl_arg.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_arg.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_arg.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Window.H
Fl_arg.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Tooltip.H
-Fl_arg.o: ../FL/Fl_Widget.H ../FL/filename.H ../FL/fl_draw.H flstring.h
-Fl_arg.o: ../config.h
+Fl_arg.o: ../FL/Fl_Widget.H ../FL/filename.H ../FL/fl_draw.H
+Fl_arg.o: ../FL/Fl_Device.H flstring.h ../config.h
Fl_compose.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_compose.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_compose.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H
@@ -462,8 +515,8 @@ Fl_get_key.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H
Fl_get_system_colors.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_get_system_colors.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_get_system_colors.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-Fl_get_system_colors.o: ../FL/Fl_Window.H ../FL/x.H ../FL/math.h
-Fl_get_system_colors.o: ../FL/fl_utf8.h flstring.h ../config.h
+Fl_get_system_colors.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_get_system_colors.o: ../FL/math.h ../FL/fl_utf8.h flstring.h ../config.h
Fl_get_system_colors.o: ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
Fl_get_system_colors.o: ../FL/Fl_Tiled_Image.H tile.xpm
Fl_grab.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
@@ -483,7 +536,10 @@ Fl_x.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_x.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_x.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Window.H
Fl_x.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/fl_utf8.h ../FL/Fl_Tooltip.H
-Fl_x.o: ../FL/Fl_Widget.H ../FL/fl_draw.H flstring.h
+Fl_x.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Device.H flstring.h
+Fl_x.o: ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/Fl_Pixmap.H
+Fl_x.o: ../FL/Fl_Image.H ../FL/Fl_RGB_Image.H ../FL/Fl_Bitmap.H
+Fl_x.o: ../FL/Fl_Button.H
filename_absolute.o: ../FL/filename.H ../FL/fl_utf8.h flstring.h
filename_absolute.o: ../FL/Fl_Export.H ../config.h
filename_expand.o: ../FL/filename.H ../FL/fl_utf8.h flstring.h
@@ -495,10 +551,11 @@ filename_list.o: ../FL/filename.H flstring.h ../FL/Fl_Export.H ../config.h
filename_match.o: ../FL/filename.H
filename_setext.o: ../FL/filename.H flstring.h ../FL/Fl_Export.H ../config.h
fl_arc.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_arc.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/math.h
+fl_arc.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+fl_arc.o: ../FL/Xutf8.h ../FL/math.h
fl_arci.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_arci.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/x.H ../FL/Xutf8.h
-fl_arci.o: ../config.h
+fl_arci.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+fl_arci.o: ../FL/Xutf8.h ../config.h
fl_ask.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/Fl.H ../FL/fl_utf8.h
fl_ask.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_ask.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_ask.H ../FL/Fl_Box.H
@@ -506,24 +563,27 @@ fl_ask.o: ../FL/Fl_Widget.H ../FL/Fl_Button.H ../FL/Fl_Return_Button.H
fl_ask.o: ../FL/Fl_Button.H ../FL/Fl_Window.H ../FL/Fl_Group.H
fl_ask.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Secret_Input.H
fl_ask.o: ../FL/Fl_Input.H ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H
+fl_ask.o: ../FL/Fl_Device.H
fl_boxtype.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_boxtype.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_boxtype.o: ../FL/fl_types.h ../FL/Fl_Widget.H ../FL/fl_draw.H
-fl_boxtype.o: ../FL/Fl_Window.H ../config.h
+fl_boxtype.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H ../config.h
fl_color.o: Fl_XColor.H ../config.h ../FL/Enumerations.H ../FL/Fl.H
fl_color.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Xutf8.h
fl_color.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h ../FL/x.H
-fl_color.o: ../FL/Fl_Window.H ../FL/fl_draw.H fl_cmap.h
+fl_color.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H fl_cmap.h
fl_cursor.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_cursor.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_cursor.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Group.H
fl_cursor.o: ../FL/Fl_Widget.H ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H
+fl_cursor.o: ../FL/Fl_Device.H
fl_curve.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_curve.o: ../FL/fl_types.h ../FL/Fl_Window.H
+fl_curve.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+fl_curve.o: ../FL/Xutf8.h
fl_diamond_box.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_diamond_box.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_diamond_box.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_diamond_box.o: ../FL/Fl_Window.H
+fl_diamond_box.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
fl_dnd.o: fl_dnd_x.cxx ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_dnd.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_dnd.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Window.H
@@ -532,27 +592,32 @@ fl_dnd.o: flstring.h ../config.h
fl_draw.o: ../FL/fl_utf8.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_draw.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_draw.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_draw.o: ../FL/Fl_Window.H ../FL/Fl_Image.H flstring.h ../config.h
+fl_draw.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Image.H
+fl_draw.o: flstring.h ../config.h
fl_draw_image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_draw_image.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_draw_image.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_draw_image.o: ../FL/Fl_Window.H ../FL/x.H Fl_XColor.H ../config.h
-fl_draw_image.o: ../FL/Enumerations.H flstring.h
+fl_draw_image.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H Fl_XColor.H
+fl_draw_image.o: ../config.h ../FL/Enumerations.H flstring.h
fl_draw_pixmap.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_draw_pixmap.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_draw_pixmap.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_draw_pixmap.o: ../FL/Fl_Window.H ../FL/x.H flstring.h ../config.h
+fl_draw_pixmap.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H flstring.h
+fl_draw_pixmap.o: ../config.h
fl_encoding_latin1.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_encoding_latin1.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Enumerations.H
-fl_encoding_latin1.o: flstring.h ../FL/Fl_Export.H ../config.h
+fl_encoding_latin1.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Device.H
+fl_encoding_latin1.o: ../FL/x.H ../FL/Xutf8.h ../FL/Enumerations.H flstring.h
+fl_encoding_latin1.o: ../FL/Fl_Export.H ../config.h
fl_encoding_mac_roman.o: ../FL/fl_draw.H ../FL/Enumerations.H
fl_encoding_mac_roman.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Window.H
+fl_encoding_mac_roman.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Xutf8.h
fl_encoding_mac_roman.o: ../FL/Enumerations.H flstring.h ../FL/Fl_Export.H
fl_encoding_mac_roman.o: ../config.h
fl_engraved_label.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_engraved_label.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_engraved_label.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Widget.H
-fl_engraved_label.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_engraved_label.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H
+fl_engraved_label.o: ../FL/x.H
fl_file_dir.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/filename.H
fl_file_dir.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/fl_utf8.h
fl_file_dir.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
@@ -570,51 +635,55 @@ fl_file_dir.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/fl_ask.H
fl_font.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/Fl.H
fl_font.o: ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
fl_font.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
-fl_font.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/x.H Fl_Font.H
-fl_font.o: fl_font_xft.cxx
+fl_font.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+fl_font.o: Fl_Font.H fl_font_xft.cxx
fl_gtk.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_gtk.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_gtk.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_gtk.o: ../FL/Fl_Device.H ../FL/x.H
fl_labeltype.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_labeltype.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_labeltype.o: ../FL/fl_types.h ../FL/Fl_Widget.H ../FL/Fl_Group.H
-fl_labeltype.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Image.H
-fl_labeltype.o: ../FL/Fl_Input_.H ../FL/Fl_Widget.H
+fl_labeltype.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+fl_labeltype.o: ../FL/Fl_Image.H ../FL/Fl_Input_.H ../FL/Fl_Widget.H
fl_line_style.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_line_style.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_line_style.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_line_style.o: ../FL/Fl_Window.H ../FL/x.H flstring.h ../config.h
+fl_line_style.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H flstring.h
+fl_line_style.o: ../config.h
fl_open_uri.o: ../FL/filename.H flstring.h ../FL/Fl_Export.H ../config.h
fl_oval_box.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_oval_box.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_oval_box.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_oval_box.o: ../FL/Fl_Device.H ../FL/x.H
fl_overlay.o: ../FL/x.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_overlay.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Xutf8.h
-fl_overlay.o: ../FL/fl_draw.H
+fl_overlay.o: ../FL/fl_draw.H ../FL/Fl_Device.H
fl_overlay_visual.o: ../config.h
fl_plastic.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_plastic.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_plastic.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h
-fl_plastic.o: ../config.h
+fl_plastic.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_plastic.o: ../FL/Fl_Device.H ../FL/x.H flstring.h ../config.h
fl_read_image.o: ../FL/x.H ../FL/Enumerations.H ../FL/Fl_Export.H
fl_read_image.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Xutf8.h ../FL/Fl.H
fl_read_image.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
-fl_read_image.o: ../FL/fl_draw.H flstring.h ../config.h
+fl_read_image.o: ../FL/fl_draw.H ../FL/Fl_Device.H flstring.h ../config.h
fl_rect.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_rect.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_rect.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Widget.H
-fl_rect.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/x.H
+fl_rect.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
fl_round_box.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_round_box.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_round_box.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_round_box.o: ../FL/Fl_Device.H ../FL/x.H
fl_rounded_box.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_rounded_box.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_rounded_box.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_rounded_box.o: ../FL/Fl_Window.H
+fl_rounded_box.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
fl_set_font.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_set_font.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_set_font.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H
-fl_set_font.o: flstring.h ../config.h Fl_Font.H
+fl_set_font.o: ../FL/Fl_Device.H flstring.h ../config.h Fl_Font.H
fl_set_fonts.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_set_fonts.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_set_fonts.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H Fl_Font.H
@@ -622,39 +691,46 @@ fl_set_fonts.o: ../config.h flstring.h fl_set_fonts_xft.cxx
fl_scroll_area.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_scroll_area.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_scroll_area.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/x.H
-fl_scroll_area.o: ../FL/Fl_Window.H ../FL/fl_draw.H
+fl_scroll_area.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H
fl_shadow_box.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_shadow_box.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_shadow_box.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/fl_draw.H
-fl_shadow_box.o: ../FL/Fl_Window.H
+fl_shadow_box.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
fl_shortcut.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_shortcut.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
fl_shortcut.o: ../FL/fl_types.h ../FL/Fl_Widget.H ../FL/Fl_Button.H
-fl_shortcut.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H flstring.h
-fl_shortcut.o: ../config.h ../FL/x.H
+fl_shortcut.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_shortcut.o: ../FL/Fl_Device.H ../FL/x.H flstring.h ../config.h
fl_show_colormap.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fl_show_colormap.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fl_show_colormap.o: ../FL/Fl_Export.H ../FL/fl_types.h
fl_show_colormap.o: ../FL/Fl_Single_Window.H ../FL/Fl_Window.H
-fl_show_colormap.o: ../FL/fl_draw.H ../FL/fl_show_colormap.H ../config.h
+fl_show_colormap.o: ../FL/fl_draw.H ../FL/Fl_Device.H ../FL/x.H
+fl_show_colormap.o: ../FL/fl_show_colormap.H ../config.h
fl_symbols.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
fl_symbols.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
-fl_symbols.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/math.h
-fl_symbols.o: flstring.h ../config.h
+fl_symbols.o: ../FL/fl_types.h ../FL/fl_draw.H ../FL/Fl_Window.H
+fl_symbols.o: ../FL/Fl_Device.H ../FL/x.H ../FL/math.h flstring.h ../config.h
fl_vertex.o: ../config.h ../FL/fl_draw.H ../FL/Enumerations.H
-fl_vertex.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Window.H ../FL/x.H
-fl_vertex.o: ../FL/Xutf8.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
-fl_vertex.o: ../FL/fl_types.h ../FL/math.h
+fl_vertex.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Window.H
+fl_vertex.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Xutf8.h ../FL/Fl.H
+fl_vertex.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h ../FL/math.h
screen_xywh.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
screen_xywh.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
screen_xywh.o: ../FL/fl_types.h ../FL/x.H ../FL/Fl_Window.H ../config.h
fl_utf8.o: ../config.h ../FL/filename.H ../FL/Xutf8.h ../FL/fl_utf8.h
+ps_image.o: ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/fl_draw.H
+ps_image.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
+ps_image.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H ../FL/Xutf8.h
+ps_image.o: ../FL/Fl_Pixmap.H ../FL/Fl_Image.H ../FL/Fl_RGB_Image.H
+ps_image.o: ../FL/Fl_Bitmap.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
+ps_image.o: ../FL/fl_types.h
forms_compatability.o: ../FL/forms.H ../FL/Fl.H ../FL/fl_utf8.h
forms_compatability.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Xutf8.h
forms_compatability.o: ../FL/Enumerations.H ../FL/Fl_Export.H
forms_compatability.o: ../FL/fl_types.h ../FL/Fl_Group.H ../FL/Fl_Widget.H
-forms_compatability.o: ../FL/Fl_Window.H ../FL/fl_draw.H
-forms_compatability.o: ../FL/Fl_FormsBitmap.H ../FL/Fl_Bitmap.H
+forms_compatability.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H
+forms_compatability.o: ../FL/x.H ../FL/Fl_FormsBitmap.H ../FL/Fl_Bitmap.H
forms_compatability.o: ../FL/Fl_Image.H ../FL/Fl_FormsPixmap.H
forms_compatability.o: ../FL/Fl_Pixmap.H ../FL/Fl_Box.H ../FL/Fl_Browser.H
forms_compatability.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
@@ -681,16 +757,16 @@ forms_bitmap.o: ../FL/forms.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
forms_bitmap.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
forms_bitmap.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Group.H
forms_bitmap.o: ../FL/Fl_Widget.H ../FL/Fl_Window.H ../FL/fl_draw.H
-forms_bitmap.o: ../FL/Fl_FormsBitmap.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
-forms_bitmap.o: ../FL/Fl_FormsPixmap.H ../FL/Fl_Pixmap.H ../FL/Fl_Box.H
-forms_bitmap.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
-forms_bitmap.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl.H
-forms_bitmap.o: ../FL/Fl_Button.H ../FL/Fl_Light_Button.H
-forms_bitmap.o: ../FL/Fl_Round_Button.H ../FL/Fl_Check_Button.H
-forms_bitmap.o: ../FL/Fl_Chart.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
-forms_bitmap.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H ../FL/Fl_Counter.H
-forms_bitmap.o: ../FL/Fl_Dial.H ../FL/Fl_Free.H ../FL/fl_ask.H
-forms_bitmap.o: ../FL/fl_show_colormap.H ../FL/filename.H
+forms_bitmap.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_FormsBitmap.H
+forms_bitmap.o: ../FL/Fl_Bitmap.H ../FL/Fl_Image.H ../FL/Fl_FormsPixmap.H
+forms_bitmap.o: ../FL/Fl_Pixmap.H ../FL/Fl_Box.H ../FL/Fl_Browser.H
+forms_bitmap.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
+forms_bitmap.o: ../FL/Fl_Valuator.H ../FL/Fl.H ../FL/Fl_Button.H
+forms_bitmap.o: ../FL/Fl_Light_Button.H ../FL/Fl_Round_Button.H
+forms_bitmap.o: ../FL/Fl_Check_Button.H ../FL/Fl_Chart.H ../FL/Fl_Choice.H
+forms_bitmap.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H
+forms_bitmap.o: ../FL/Fl_Counter.H ../FL/Fl_Dial.H ../FL/Fl_Free.H
+forms_bitmap.o: ../FL/fl_ask.H ../FL/fl_show_colormap.H ../FL/filename.H
forms_bitmap.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Double_Window.H
forms_bitmap.o: ../FL/Fl_Group.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Button.H
forms_bitmap.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
@@ -707,16 +783,16 @@ forms_fselect.o: ../FL/forms.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
forms_fselect.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
forms_fselect.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Group.H
forms_fselect.o: ../FL/Fl_Widget.H ../FL/Fl_Window.H ../FL/fl_draw.H
-forms_fselect.o: ../FL/Fl_FormsBitmap.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
-forms_fselect.o: ../FL/Fl_FormsPixmap.H ../FL/Fl_Pixmap.H ../FL/Fl_Box.H
-forms_fselect.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
-forms_fselect.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl.H
-forms_fselect.o: ../FL/Fl_Button.H ../FL/Fl_Light_Button.H
-forms_fselect.o: ../FL/Fl_Round_Button.H ../FL/Fl_Check_Button.H
-forms_fselect.o: ../FL/Fl_Chart.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
-forms_fselect.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H ../FL/Fl_Counter.H
-forms_fselect.o: ../FL/Fl_Dial.H ../FL/Fl_Free.H ../FL/fl_ask.H
-forms_fselect.o: ../FL/fl_show_colormap.H ../FL/filename.H
+forms_fselect.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_FormsBitmap.H
+forms_fselect.o: ../FL/Fl_Bitmap.H ../FL/Fl_Image.H ../FL/Fl_FormsPixmap.H
+forms_fselect.o: ../FL/Fl_Pixmap.H ../FL/Fl_Box.H ../FL/Fl_Browser.H
+forms_fselect.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
+forms_fselect.o: ../FL/Fl_Valuator.H ../FL/Fl.H ../FL/Fl_Button.H
+forms_fselect.o: ../FL/Fl_Light_Button.H ../FL/Fl_Round_Button.H
+forms_fselect.o: ../FL/Fl_Check_Button.H ../FL/Fl_Chart.H ../FL/Fl_Choice.H
+forms_fselect.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H
+forms_fselect.o: ../FL/Fl_Counter.H ../FL/Fl_Dial.H ../FL/Fl_Free.H
+forms_fselect.o: ../FL/fl_ask.H ../FL/fl_show_colormap.H ../FL/filename.H
forms_fselect.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Double_Window.H
forms_fselect.o: ../FL/Fl_Group.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Button.H
forms_fselect.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
@@ -730,16 +806,16 @@ forms_pixmap.o: ../FL/forms.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
forms_pixmap.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
forms_pixmap.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Group.H
forms_pixmap.o: ../FL/Fl_Widget.H ../FL/Fl_Window.H ../FL/fl_draw.H
-forms_pixmap.o: ../FL/Fl_FormsBitmap.H ../FL/Fl_Bitmap.H ../FL/Fl_Image.H
-forms_pixmap.o: ../FL/Fl_FormsPixmap.H ../FL/Fl_Pixmap.H ../FL/Fl_Box.H
-forms_pixmap.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
-forms_pixmap.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl.H
-forms_pixmap.o: ../FL/Fl_Button.H ../FL/Fl_Light_Button.H
-forms_pixmap.o: ../FL/Fl_Round_Button.H ../FL/Fl_Check_Button.H
-forms_pixmap.o: ../FL/Fl_Chart.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H
-forms_pixmap.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H ../FL/Fl_Counter.H
-forms_pixmap.o: ../FL/Fl_Dial.H ../FL/Fl_Free.H ../FL/fl_ask.H
-forms_pixmap.o: ../FL/fl_show_colormap.H ../FL/filename.H
+forms_pixmap.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_FormsBitmap.H
+forms_pixmap.o: ../FL/Fl_Bitmap.H ../FL/Fl_Image.H ../FL/Fl_FormsPixmap.H
+forms_pixmap.o: ../FL/Fl_Pixmap.H ../FL/Fl_Box.H ../FL/Fl_Browser.H
+forms_pixmap.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
+forms_pixmap.o: ../FL/Fl_Valuator.H ../FL/Fl.H ../FL/Fl_Button.H
+forms_pixmap.o: ../FL/Fl_Light_Button.H ../FL/Fl_Round_Button.H
+forms_pixmap.o: ../FL/Fl_Check_Button.H ../FL/Fl_Chart.H ../FL/Fl_Choice.H
+forms_pixmap.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H
+forms_pixmap.o: ../FL/Fl_Counter.H ../FL/Fl_Dial.H ../FL/Fl_Free.H
+forms_pixmap.o: ../FL/fl_ask.H ../FL/fl_show_colormap.H ../FL/filename.H
forms_pixmap.o: ../FL/Fl_File_Chooser.H ../FL/Fl_Double_Window.H
forms_pixmap.o: ../FL/Fl_Group.H ../FL/Fl_Choice.H ../FL/Fl_Menu_Button.H
forms_pixmap.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
@@ -752,7 +828,7 @@ forms_pixmap.o: ../FL/Fl_Timer.H
forms_timer.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
forms_timer.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
forms_timer.o: ../FL/fl_types.h ../FL/Fl_Timer.H ../FL/Fl_Widget.H
-forms_timer.o: ../FL/fl_draw.H ../FL/Fl_Window.H
+forms_timer.o: ../FL/fl_draw.H ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
Fl_Gl_Choice.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
Fl_Gl_Choice.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_Gl_Choice.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/x.H
@@ -767,6 +843,13 @@ Fl_Gl_Window.o: ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
Fl_Gl_Window.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
Fl_Gl_Window.o: ../FL/x.H ../FL/Fl_Window.H Fl_Gl_Choice.H
Fl_Gl_Window.o: ../FL/Fl_Gl_Window.H ../FL/fl_utf8.h
+Fl_Gl_Printer.o: ../FL/Fl_Gl_Printer.H ../FL/Fl_Printer.H ../FL/Fl_Device.H
+Fl_Gl_Printer.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
+Fl_Gl_Printer.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Device.H
+Fl_Gl_Printer.o: ../FL/x.H ../FL/Xutf8.h ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
+Fl_Gl_Printer.o: ../FL/Fl_RGB_Image.H ../FL/Fl_Bitmap.H ../FL/Fl_Gl_Window.H
+Fl_Gl_Printer.o: Fl_Gl_Choice.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
+Fl_Gl_Printer.o: ../FL/fl_types.h
freeglut_geometry.o: ../FL/glut.H ../FL/gl.h ../FL/Enumerations.H
freeglut_geometry.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl.H
freeglut_geometry.o: ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
@@ -789,13 +872,13 @@ freeglut_teapot.o: freeglut_teapot_data.h
gl_draw.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/Fl.H
gl_draw.o: ../FL/fl_utf8.h ../FL/fl_types.h ../FL/Xutf8.h
gl_draw.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h ../FL/gl.h
-gl_draw.o: ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H Fl_Gl_Choice.H
-gl_draw.o: Fl_Font.H ../FL/fl_utf8.h ../FL/Xutf8.h
+gl_draw.o: ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H
+gl_draw.o: Fl_Gl_Choice.H Fl_Font.H ../FL/fl_utf8.h ../FL/Xutf8.h
gl_start.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
gl_start.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
gl_start.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Window.H
gl_start.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/x.H ../FL/Fl_Window.H
-gl_start.o: ../FL/fl_draw.H Fl_Gl_Choice.H
+gl_start.o: ../FL/fl_draw.H ../FL/Fl_Device.H Fl_Gl_Choice.H
glut_compatability.o: flstring.h ../FL/Fl_Export.H ../config.h ../FL/glut.H
glut_compatability.o: ../FL/gl.h ../FL/Enumerations.H ../FL/Fl_Export.H
glut_compatability.o: ../FL/fl_types.h ../FL/Fl.H ../FL/fl_utf8.h
@@ -819,7 +902,8 @@ Fl_File_Icon2.o: ../FL/math.h ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/fl_utf8.h
Fl_File_Icon2.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
Fl_File_Icon2.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Shared_Image.H
Fl_File_Icon2.o: ../FL/Fl_Image.H ../FL/Fl_Widget.H ../FL/fl_draw.H
-Fl_File_Icon2.o: ../FL/Fl_Window.H ../FL/filename.H
+Fl_File_Icon2.o: ../FL/Fl_Window.H ../FL/Fl_Device.H ../FL/x.H
+Fl_File_Icon2.o: ../FL/filename.H
Fl_GIF_Image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
Fl_GIF_Image.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_GIF_Image.o: ../FL/fl_types.h ../FL/Fl_GIF_Image.H ../FL/Fl_Pixmap.H
@@ -832,8 +916,8 @@ Fl_Help_Dialog.o: ../FL/Fl_Button.H ../FL/Fl_Widget.H ../FL/Fl_Input.H
Fl_Help_Dialog.o: ../FL/Fl_Input_.H ../FL/Fl_Box.H ../FL/Fl_Help_View.H
Fl_Help_Dialog.o: ../FL/Fl.H ../FL/Fl_Group.H ../FL/Fl_Scrollbar.H
Fl_Help_Dialog.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
-Fl_Help_Dialog.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H flstring.h
-Fl_Help_Dialog.o: ../config.h ../FL/fl_ask.H
+Fl_Help_Dialog.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Shared_Image.H
+Fl_Help_Dialog.o: ../FL/Fl_Image.H flstring.h ../config.h ../FL/fl_ask.H
Fl_JPEG_Image.o: ../FL/Fl_JPEG_Image.H ../FL/Fl_Image.H ../FL/Enumerations.H
Fl_JPEG_Image.o: ../FL/Fl_Export.H ../FL/fl_types.h ../config.h
Fl_PNG_Image.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
diff --git a/src/print_panel.cxx b/src/print_panel.cxx
new file mode 100644
index 000000000..866488615
--- /dev/null
+++ b/src/print_panel.cxx
@@ -0,0 +1,600 @@
+//
+// "$Id$"
+//
+// Print panel for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2009 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+//
+// This file is "work in progress". The main parts have been copied
+// from fluid's print_panel{.fl|.h|.cxx} and hand-edited to produce
+// a working version w/o global variables. The intention is to move
+// all static variables into an own class, and to name this class
+// Fl_Printer_Chooser or similar...
+//
+// Todo:
+//
+// - Currently preferences can't be saved, and there are options that
+// are not yet used for printing.
+// - This file can only be used as an include file in Fl_PS_Printer.cxx
+// - The use of static variables should be avoided.
+// - Probably much more ...
+//
+
+#include "print_panel.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "../src/flstring.h"
+#include <FL/Fl_Preferences.H>
+#include <FL/Fl_Int_Input.H>
+
+// extern Fl_Preferences fluid_prefs;
+
+static Fl_Double_Window *print_panel=(Fl_Double_Window *)0;
+static Fl_Group *print_panel_controls=(Fl_Group *)0;
+static Fl_Choice *print_choice=(Fl_Choice *)0;
+static Fl_Button *print_properties=(Fl_Button *)0;
+static Fl_Box *print_status=(Fl_Box *)0;
+static Fl_Round_Button *print_all=(Fl_Round_Button *)0;
+static Fl_Round_Button *print_pages=(Fl_Round_Button *)0;
+static Fl_Round_Button *print_selection=(Fl_Round_Button *)0;
+static Fl_Check_Button *print_collate_button=(Fl_Check_Button *)0;
+static Fl_Group *print_collate_group[2]={(Fl_Group *)0};
+static Fl_Progress *print_progress=(Fl_Progress *)0;
+static Fl_Double_Window *print_properties_panel=(Fl_Double_Window *)0;
+static Fl_Choice *print_page_size=(Fl_Choice *)0;
+static Fl_Int_Input *print_from=(Fl_Int_Input *)0;
+static Fl_Int_Input *print_to=(Fl_Int_Input *)0;
+static Fl_Spinner *print_copies=(Fl_Spinner *)0;
+
+static int print_start = 0; // 1 if print_okay has been clicked
+static int print_pipe = 0; // 0 = file, 1 = pipe (lp)
+
+static void cb_print_choice(Fl_Choice*, void*) {
+ print_update_status();
+}
+
+static void cb_print_properties(Fl_Button*, void*) {
+ print_properties_panel->show();
+}
+
+static void cb_print_all(Fl_Round_Button*, void*) {
+ print_from->deactivate();
+ print_to->deactivate();
+}
+
+static void cb_print_pages(Fl_Round_Button*, void*) {
+ print_from->activate();
+ print_to->activate();
+}
+
+static void cb_print_selection(Fl_Round_Button*, void*) {
+ print_from->deactivate();
+ print_to->deactivate();
+}
+
+static void cb_print_copies(Fl_Spinner*, void*) {
+ if (print_copies->value() == 1) {
+ print_collate_button->deactivate();
+ print_collate_group[0]->deactivate();
+ print_collate_group[1]->deactivate();
+ } else {
+/* print_collate_button->activate(); // TODO: manage collate options
+ print_collate_group[0]->activate();
+ print_collate_group[1]->activate(); */
+ };
+}
+
+static void cb_print_collate_button(Fl_Check_Button*, void*) {
+ int i = print_collate_button->value() != 0;
+ print_collate_group[i]->show();
+ print_collate_group[1 - i]->hide();
+}
+
+static void cb_Cancel(Fl_Button*, void*) {
+ print_start = 0;
+ print_panel->hide();
+}
+
+static void cb_print_properties_panel(Fl_Double_Window*, void*) {
+ print_properties_panel->hide();
+ print_update_status();
+}
+
+static Fl_Menu_Item menu_print_page_size[] = {
+ {"Letter", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+ {"A4", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
+ {0,0,0,0,0,0,0,0,0}
+};
+
+#include <FL/Fl_Pixmap.H>
+static const char *idata_print_color[] = {
+"24 24 17 1",
+" \tc None",
+".\tc #FFFF00",
+"+\tc #C8FF00",
+"@\tc #00FF00",
+"#\tc #FFC800",
+"$\tc #FF0000",
+"%\tc #00FFFF",
+"&\tc #000000",
+"*\tc #FF00FF",
+"=\tc #00FFC8",
+"-\tc #FF00C8",
+";\tc #00C800",
+">\tc #C80000",
+",\tc #0000C8",
+"\'\tc #0000FF",
+")\tc #00C8FF",
+"!\tc #C800FF",
+" ...... ",
+" .......... ",
+" ............ ",
+" .............. ",
+" .............. ",
+" ................ ",
+" ................ ",
+" ................ ",
+" +@@@@@@+#$$$$$$# ",
+" %@@@@@@@&&$$$$$$$* ",
+" %%@@@@@@&&&&$$$$$$** ",
+" %%%=@@@@&&&&&&$$$$-*** ",
+" %%%%@@@;&&&&&&>$$$**** ",
+"%%%%%%@@&&&&&&&&$$******",
+"%%%%%%%@&&&&&&&&$*******",
+"%%%%%%%%,&&&&&&,********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+" %%%%%%%)\'\'\'\'\'\'!******* ",
+" %%%%%%%%\'\'\'\'\'\'******** ",
+" %%%%%%%%\'\'\'\'******** ",
+" %%%%%%%%\'\'******** ",
+" %%%%%% ****** "
+};
+static Fl_Pixmap image_print_color(idata_print_color);
+
+static const char *idata_print_gray[] = {
+"24 24 17 1",
+" \tc None",
+".\tc #E3E3E3",
+"+\tc #D2D2D2",
+"@\tc #969696",
+"#\tc #C2C2C2",
+"$\tc #4C4C4C",
+"%\tc #B2B2B2",
+"&\tc #000000",
+"*\tc #696969",
+"=\tc #ACACAC",
+"-\tc #626262",
+";\tc #767676",
+">\tc #3C3C3C",
+",\tc #161616",
+"\'\tc #1C1C1C",
+")\tc #929292",
+"!\tc #585858",
+" ...... ",
+" .......... ",
+" ............ ",
+" .............. ",
+" .............. ",
+" ................ ",
+" ................ ",
+" ................ ",
+" +@@@@@@+#$$$$$$# ",
+" %@@@@@@@&&$$$$$$$* ",
+" %%@@@@@@&&&&$$$$$$** ",
+" %%%=@@@@&&&&&&$$$$-*** ",
+" %%%%@@@;&&&&&&>$$$**** ",
+"%%%%%%@@&&&&&&&&$$******",
+"%%%%%%%@&&&&&&&&$*******",
+"%%%%%%%%,&&&&&&,********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+" %%%%%%%)\'\'\'\'\'\'!******* ",
+" %%%%%%%%\'\'\'\'\'\'******** ",
+" %%%%%%%%\'\'\'\'******** ",
+" %%%%%%%%\'\'******** ",
+" %%%%%% ****** "
+};
+static Fl_Pixmap image_print_gray(idata_print_gray);
+
+static Fl_Button *print_output_mode[4]={(Fl_Button *)0};
+
+static void cb_Save(Fl_Return_Button*, void*) {
+ print_properties_panel->hide();
+
+ char name[1024];
+ int val;
+ const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
+
+ snprintf(name, sizeof(name), "%s/page_size", printer);
+ // fluid_prefs.set(name, print_page_size->value());
+
+ snprintf(name, sizeof(name), "%s/output_mode", printer);
+ for (val = 0; val < 4; val ++) {
+ if (print_output_mode[val]->value()) break;
+ }
+ // fluid_prefs.set(name, val); // FIXME -- save prefs
+}
+
+static void cb_Cancel1(Fl_Button*, void*) {
+ print_properties_panel->hide();
+ print_update_status();
+}
+
+static void cb_Use(Fl_Button*, void*) {
+ print_properties_panel->hide();
+}
+
+Fl_Double_Window* make_print_panel() {
+ { print_panel = new Fl_Double_Window(465, 235, "Print");
+ { print_panel_controls = new Fl_Group(10, 10, 447, 216);
+ { print_choice = new Fl_Choice(113, 10, 181, 25, "Printer:");
+ print_choice->down_box(FL_BORDER_BOX);
+ print_choice->labelfont(1);
+ print_choice->callback((Fl_Callback*)cb_print_choice);
+ print_choice->when(FL_WHEN_CHANGED);
+ } // Fl_Choice* print_choice
+ { print_properties = new Fl_Button(294, 10, 105, 25, "Properties...");
+ print_properties->callback((Fl_Callback*)cb_print_properties);
+ } // Fl_Button* print_properties
+ { print_status = new Fl_Box(111, 41, 288, 17, "printer/job status");
+ print_status->align(Fl_Align(68|FL_ALIGN_INSIDE));
+ } // Fl_Box* print_status
+ { Fl_Group* o = new Fl_Group(10, 86, 227, 105, "Print Range");
+ o->box(FL_THIN_DOWN_BOX);
+ o->labelfont(1);
+ o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
+ { print_all = new Fl_Round_Button(20, 96, 38, 25, "All");
+ print_all->type(102);
+ print_all->down_box(FL_ROUND_DOWN_BOX);
+ print_all->value(1);
+ print_all->callback((Fl_Callback*)cb_print_all);
+ } // Fl_Round_Button* print_all
+ { print_pages = new Fl_Round_Button(20, 126, 64, 25, "Pages");
+ print_pages->type(102);
+ print_pages->down_box(FL_ROUND_DOWN_BOX);
+ print_pages->callback((Fl_Callback*)cb_print_pages);
+ } // Fl_Round_Button* print_pages
+ { print_selection = new Fl_Round_Button(20, 156, 82, 25, "Selection");
+ print_selection->type(102);
+ print_selection->down_box(FL_ROUND_DOWN_BOX);
+ print_selection->callback((Fl_Callback*)cb_print_selection);
+ } // Fl_Round_Button* print_selection
+ { print_from = new Fl_Int_Input(136, 126, 28, 25, "From:");
+ print_from->type(2);
+ print_from->textfont(4);
+ print_from->deactivate();
+ } // Fl_Int_Input* print_from
+ { print_to = new Fl_Int_Input(199, 126, 28, 25, "To:");
+ print_to->type(2);
+ print_to->textfont(4);
+ print_to->deactivate();
+ } // Fl_Int_Input* print_to
+ o->end();
+ } // Fl_Group* o
+ { Fl_Group* o = new Fl_Group(247, 86, 210, 105, "Copies");
+ o->box(FL_THIN_DOWN_BOX);
+ o->labelfont(1);
+ o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
+ { print_copies = new Fl_Spinner(321, 96, 45, 25, "# Copies:");
+ print_copies->callback((Fl_Callback*)cb_print_copies);
+ print_copies->when(FL_WHEN_CHANGED);
+ } // Fl_Spinner* print_copies
+ { print_collate_button = new Fl_Check_Button(376, 96, 64, 25, "Collate");
+ print_collate_button->down_box(FL_DOWN_BOX);
+ print_collate_button->callback((Fl_Callback*)cb_print_collate_button);
+ print_collate_button->when(FL_WHEN_CHANGED);
+ print_collate_button->deactivate();
+ } // Fl_Check_Button* print_collate_button
+ { print_collate_group[0] = new Fl_Group(257, 131, 191, 50);
+ print_collate_group[0]->deactivate();
+ { Fl_Box* o = new Fl_Box(287, 141, 30, 40, "1");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(272, 136, 30, 40, "1");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(352, 141, 30, 40, "2");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(322, 131, 30, 40, "2");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(402, 136, 30, 40, "3");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(387, 131, 30, 40, "3");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ o->deactivate();
+ } // Fl_Box* o
+ print_collate_group[0]->end();
+ } // Fl_Group* print_collate_group[0]
+ { print_collate_group[1] = new Fl_Group(257, 131, 191, 50);
+ print_collate_group[1]->hide();
+ print_collate_group[1]->deactivate();
+ { Fl_Box* o = new Fl_Box(287, 141, 30, 40, "3");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(272, 136, 30, 40, "2");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(352, 141, 30, 40, "3");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(322, 131, 30, 40, "1");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(402, 136, 30, 40, "2");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ { Fl_Box* o = new Fl_Box(387, 131, 30, 40, "1");
+ o->box(FL_BORDER_BOX);
+ o->color(FL_BACKGROUND2_COLOR);
+ o->labelsize(11);
+ o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE));
+ } // Fl_Box* o
+ print_collate_group[1]->end();
+ } // Fl_Group* print_collate_group[1]
+ o->end();
+ } // Fl_Group* o
+ { Fl_Return_Button* o = new Fl_Return_Button(309, 201, 70, 25, "Print");
+ o->callback((Fl_Callback*)print_cb);
+ } // Fl_Return_Button* o
+ { Fl_Button* o = new Fl_Button(389, 201, 68, 25, "Cancel");
+ o->callback((Fl_Callback*)cb_Cancel);
+ } // Fl_Button* o
+ print_panel_controls->end();
+ } // Fl_Group* print_panel_controls
+ { print_progress = new Fl_Progress(10, 203, 289, 21);
+ print_progress->selection_color((Fl_Color)4);
+ print_progress->hide();
+ } // Fl_Progress* print_progress
+ print_panel->set_modal();
+ print_panel->end();
+ } // Fl_Double_Window* print_panel
+ { print_properties_panel = new Fl_Double_Window(290, 130, "Printer Properties");
+ print_properties_panel->callback((Fl_Callback*)cb_print_properties_panel);
+ { print_page_size = new Fl_Choice(110, 10, 80, 25, "Page Size:");
+ print_page_size->down_box(FL_BORDER_BOX);
+ print_page_size->labelfont(1);
+ print_page_size->menu(menu_print_page_size);
+ } // Fl_Choice* print_page_size
+ { Fl_Group* o = new Fl_Group(110, 45, 170, 40, "Output Mode:");
+ o->labelfont(1);
+ o->align(Fl_Align(FL_ALIGN_LEFT));
+ { print_output_mode[0] = new Fl_Button(110, 45, 30, 40);
+ print_output_mode[0]->type(102);
+ print_output_mode[0]->box(FL_BORDER_BOX);
+ print_output_mode[0]->down_box(FL_BORDER_BOX);
+ print_output_mode[0]->value(1);
+ print_output_mode[0]->color(FL_BACKGROUND2_COLOR);
+ print_output_mode[0]->selection_color(FL_FOREGROUND_COLOR);
+ print_output_mode[0]->image(image_print_color);
+ } // Fl_Button* print_output_mode[0]
+ { print_output_mode[1] = new Fl_Button(150, 50, 40, 30);
+ print_output_mode[1]->type(102);
+ print_output_mode[1]->box(FL_BORDER_BOX);
+ print_output_mode[1]->down_box(FL_BORDER_BOX);
+ print_output_mode[1]->color(FL_BACKGROUND2_COLOR);
+ print_output_mode[1]->selection_color(FL_FOREGROUND_COLOR);
+ print_output_mode[1]->image(image_print_color);
+ } // Fl_Button* print_output_mode[1]
+ { print_output_mode[2] = new Fl_Button(200, 45, 30, 40);
+ print_output_mode[2]->type(102);
+ print_output_mode[2]->box(FL_BORDER_BOX);
+ print_output_mode[2]->down_box(FL_BORDER_BOX);
+ print_output_mode[2]->color(FL_BACKGROUND2_COLOR);
+ print_output_mode[2]->selection_color(FL_FOREGROUND_COLOR);
+ print_output_mode[2]->image(image_print_gray);
+ } // Fl_Button* print_output_mode[2]
+ { print_output_mode[3] = new Fl_Button(240, 50, 40, 30);
+ print_output_mode[3]->type(102);
+ print_output_mode[3]->box(FL_BORDER_BOX);
+ print_output_mode[3]->down_box(FL_BORDER_BOX);
+ print_output_mode[3]->color(FL_BACKGROUND2_COLOR);
+ print_output_mode[3]->selection_color(FL_FOREGROUND_COLOR);
+ print_output_mode[3]->image(image_print_gray);
+ } // Fl_Button* print_output_mode[3]
+ o->end();
+ } // Fl_Group* o
+ { Fl_Return_Button* o = new Fl_Return_Button(123, 95, 79, 25, "Save");
+ o->callback((Fl_Callback*)cb_Save);
+ } // Fl_Return_Button* o
+ { Fl_Button* o = new Fl_Button(212, 95, 68, 25, "Cancel");
+ o->callback((Fl_Callback*)cb_Cancel1);
+ } // Fl_Button* o
+ { Fl_Button* o = new Fl_Button(60, 95, 53, 25, "Use");
+ o->callback((Fl_Callback*)cb_Use);
+ } // Fl_Button* o
+ print_properties_panel->set_modal();
+ print_properties_panel->end();
+ } // Fl_Double_Window* print_properties_panel
+ return print_properties_panel;
+}
+
+void print_cb(Fl_Return_Button *, void *) {
+ print_start = 1;
+ print_panel->hide();
+}
+
+void print_load() {
+ FILE *lpstat;
+ char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024];
+ int i;
+
+ if (print_choice->size() > 1) {
+ for (i = 1; print_choice->text(i); i ++) {
+ free(print_choice->menu()[i].user_data());
+ }
+ }
+
+ print_choice->clear();
+ print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER);
+ print_choice->value(0);
+
+ print_start = 0;
+
+ defname[0] = '\0';
+
+ if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) {
+ while (fgets(line, sizeof(line), lpstat)) {
+ if (!strncmp(line, "printer ", 8) &&
+ sscanf(line + 8, "%s", name) == 1) {
+ for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) {
+ if (*nptr == '/') *qptr++ = '\\';
+ }
+ *qptr = '\0';
+
+ print_choice->add(qname, 0, 0, (void *)strdup(name), 0);
+ } else if (!strncmp(line, "system default destination: ", 28)) {
+ if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0';
+ }
+ }
+ pclose(lpstat);
+ }
+
+ if (defname[0]) {
+ for (i = 1; print_choice->text(i); i ++) {
+ if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) {
+ print_choice->value(i);
+ break;
+ }
+ }
+ } else if (print_choice->size() > 2) print_choice->value(1);
+
+ print_update_status();
+
+} // print_load()
+
+void print_update_status() {
+ FILE *lpstat;
+ char command[1024];
+ static char status[1024];
+ const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
+
+ if (print_choice->value()) {
+ snprintf(command, sizeof(command), "lpstat -p '%s'", printer);
+ if ((lpstat = popen(command, "r")) != NULL) {
+ fgets(status, sizeof(status), lpstat);
+ pclose(lpstat);
+ } else strcpy(status, "printer status unavailable");
+ } else status[0] = '\0';
+
+ print_status->label(status);
+
+ char name[1024];
+ // int val;
+ int val = 0; // FIXME -- see below: read preferences !
+
+ snprintf(name, sizeof(name), "%s/page_size", printer);
+ // fluid_prefs.get(name, val, 0);
+ print_page_size->value(1); // FIXME
+
+ snprintf(name, sizeof(name), "%s/output_mode", printer);
+ // fluid_prefs.get(name, val, 0);
+ print_output_mode[val]->setonly();
+}
+
+//
+// End of "$Id$".
+//
diff --git a/src/print_panel.h b/src/print_panel.h
new file mode 100644
index 000000000..3fde5375c
--- /dev/null
+++ b/src/print_panel.h
@@ -0,0 +1,55 @@
+//
+// "$Id$"
+//
+// Print panel for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2009 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+//
+// This is a temporary file. It is only for development and will
+// probably be removed later.
+//
+
+#ifndef print_panel_h
+#define print_panel_h
+#include <FL/Fl.H>
+#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_Group.H>
+#include <FL/Fl_Choice.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Round_Button.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Spinner.H>
+#include <FL/Fl_Check_Button.H>
+#include <FL/Fl_Return_Button.H>
+#include <FL/Fl_Progress.H>
+static Fl_Double_Window* make_print_panel();
+static void print_cb(Fl_Return_Button *, void *);
+static void print_load();
+static void print_update_status();
+#endif
+
+//
+// End of "$Id$".
+//
diff --git a/src/ps_image.cxx b/src/ps_image.cxx
new file mode 100644
index 000000000..4596e692f
--- /dev/null
+++ b/src/ps_image.cxx
@@ -0,0 +1,560 @@
+//
+// "$Id: image.cxx 4324 2005-05-09 21:47:22Z rokan $"
+//
+// Postscript image drawing implementation for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2005 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to "fltk-bugs@fltk.org".
+//
+
+
+
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#include <FL/Fl_Printer.H>
+#include <FL/Fl.H>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_Bitmap.H>
+
+
+
+int Fl_PSfile_Device::alpha_mask(const uchar * data, int w, int h, int D, int LD){
+
+ mask = 0;
+ if((D/2)*2 != D){ //no mask info
+ return 0;
+ }
+ int xx;
+ int i,j, k, l;
+ LD += w*D;
+ int V255=0;
+ int V0 =0;
+ int V_=0;
+// uchar d;
+ for(j=0;j<h;j++){
+ for(i=0;i<w;i++)
+ switch(data[j*LD+D*i+D-1]){
+ case 255: V255 = 1; break;
+ case 0: V0 = 1; break;
+ default: V_= 1;
+ }
+ if(V_) break;
+ };
+ if(!V_){
+ if(V0)
+ if(V255){// not true alpha, only masking
+ xx = (w+7)/8;
+ mask = new uchar[h * xx];
+ for(i=0;i<h * xx;i++) mask[i]=0;
+ for(j=0;j<h;j++)
+ for(i=0;i<w;i++)
+ if(data[j*LD+D*i+D-1])
+ mask[j*xx+i/8] |= 1 << (i % 8);
+ mx = w;
+ my = h; //mask imensions
+ return 0;
+ }else{
+ mask=0;
+ return 1; //everything masked
+ }
+ else
+ return 0;
+ }
+
+
+
+ ///// Alpha dither, generating (4*w) * 4 mask area /////
+ ///// with Floyd-Steinberg error diffusion /////
+
+ mask = new uchar[((w+1)/2) * h * 4];
+
+ for(i=0;i<((w+1)/2) * h * 4; i++) mask[i] = 0; //cleaning
+
+
+
+ mx= w*4;
+ my=h*4; // mask dimensions
+
+ xx = (w+1)/2; // mask line width in bytes
+
+ short * errors1 = new short [w*4+2]; // two rows of dither errors
+ short * errors2 = new short [w*4+2]; // two rows of dither errors
+
+ for(i=0;i<w*4+2;i++) errors2[i] = 0; // cleaning,after first swap will become current
+ for(i=0;i<w*4+2;i++) errors1[i] = 0; // cleaning,after first swap will become current
+
+ short * current = errors1;
+ short * next = errors2;
+ short * swap;
+
+ for(j=0;j<h;j++){
+ for(l=0;l<4;){ // generating 4 rows of mask lines for 1 RGB line
+ int jj = j*4+l;
+
+ /// mask row index
+ swap = next;
+ next = current;
+ current = swap;
+ *(next+1) = 0; // must clean the first cell, next are overriden by *1
+ for(i=0;i<w;i++){
+ for(k=0;k<4;k++){ // generating 4 x-pixels for 1 RGB
+ short error, o1, o2, o3;
+ int ii = i*4+k; // mask cell index
+ short val = data[j*LD+D*i+D-1] + current[1+ii];
+ if (val>127){
+ mask[jj*xx+ii/8] |= 1 << (ii % 8); //set mask bit
+ error = val-255;
+ }else
+ error = val;
+
+ ////// error spreading /////
+ if(error >0){
+ next[ii] += o1 = (error * 3 + 8)/16;
+ current[ii+2] += o2 = (error * 7 + 8)/16;
+ next[ii+2] = o3 =(error + 8)/16; // *1 - ok replacing (cleaning)
+ }else{
+ next[ii] += o1 = (error * 3 - 8)/16;
+ current[ii+2] += o2 = (error * 7 - 8)/16;
+ next[ii+2] = o3 = (error - 8)/16;
+ }
+ next[1+ii] += error - o1 - o2 - o3;
+ }
+ }
+ l++;
+
+ ////// backward
+
+ jj = j*4+l;
+ swap = next;
+ next = current;
+ current = swap;
+ *(next+1) = 0; // must clean the first cell, next are overriden by *1
+
+ for(i=w-1;i>=0;i--){
+
+ for(k=3;k>=0;k--){ // generating 4 x-pixels for 1 RGB
+ short error, o1, o2, o3;
+
+ int ii = i*4+k; // mask cell index
+ short val = data[j*LD+D*i+D-1] + current[1+ii];
+ if (val>127){
+
+ mask[jj*xx+ii/8] |= 1 << (ii % 8); //set mask bit
+ error = val-255;
+ }else
+ error = val;
+
+ ////// error spreading /////
+ if(error >0){
+ next[ii+2] += o1 = (error * 3 + 8)/16;
+ current[ii] += o2 = (error * 7 + 8)/16;
+ next[ii] = o3 =(error + 8)/16; // *1 - ok replacing (cleaning)
+ }else{
+ next[ii+2] += o1 = (error * 3 - 8)/16;
+
+ current[ii] += o2 = (error * 7 - 8)/16;
+ next[ii] = o3 = (error - 8)/16;
+ }
+ next[1+ii] += error - o1 - o2 - o3;
+ }
+ }
+ l++;
+ }
+ }
+ delete[] errors1;
+ delete[] errors2;
+ return 0;
+}
+
+
+
+// TODO: anybody has more efficient algoritm?
+static inline uchar swap_byte(const uchar i){
+ uchar b =0;
+ if(i & 1) b |= 128;
+ if(i & 2) b |= 64;
+ if(i & 4) b |= 32;
+ if(i & 8) b |= 16;
+ if(i & 16) b |= 8;
+ if(i & 32) b |= 4;
+ if(i & 64) b |= 2;
+ if(i & 128) b |= 1;
+ return b;
+}
+
+
+extern uchar **fl_mask_bitmap;
+
+
+void Fl_PSfile_Device::draw_scaled_image(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D, int LD) {
+
+
+ if(D<3){ //mono
+ draw_scaled_image_mono(data, x, y, w, h, iw, ih, D, LD);
+ return;
+ }
+
+
+ int i,j, k;
+
+ fprintf(output,"save\n");
+
+ char * interpol;
+ if(lang_level_>1){
+ if(interpolate_)
+ interpol="true";
+ else
+ interpol="false";
+ if(mask && lang_level_>2)
+ fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+ else
+ fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol);
+ }else
+ fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih);
+
+
+ if(!LD) LD = iw*D;
+ uchar *curmask=mask;
+
+ for (j=0; j<ih;j++){
+ if(mask){
+
+ for(k=0;k<my/ih;k++){
+ for (i=0; i<((mx+7)/8);i++){
+ if (!(i%80)) fprintf(output, "\n");
+ fprintf(output, "%.2x",swap_byte(*curmask));
+ curmask++;
+ }
+ fprintf(output,"\n");
+ }
+ }
+ const uchar *curdata=data+j*LD;
+ for(i=0 ; i<iw ; i++) {
+ uchar r = curdata[0];
+ uchar g = curdata[1];
+ uchar b = curdata[2];
+ if(lang_level_<3 && D>3) { //can do mixing using bg_* colors)
+ unsigned int a2 = curdata[3]; //must be int
+ unsigned int a = 255-a2;
+ r = (a2 * r + bg_r * a)/255;
+ g = (a2 * g + bg_g * a)/255;
+ b = (a2 * b + bg_b * a)/255;
+ }
+ if (!(i%40)) fprintf(output, "\n");
+ fprintf(output, "%.2x%.2x%.2x", r, g, b);
+ curdata +=D;
+ }
+ fprintf(output,"\n");
+
+ }
+
+ fprintf(output," >\nrestore\n" );
+
+
+};
+
+void Fl_PSfile_Device::draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D) {
+
+ int level2_mask = 0;
+ fprintf(output,"save\n");
+ int i,j,k;
+ char * interpol;
+ if (lang_level_ > 1) {
+ if (interpolate_) interpol="true";
+ else interpol="false";
+ if (mask && lang_level_ > 2) {
+ fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+ }
+ else if (mask && lang_level_ == 2) {
+ level2_mask = 1; // use method for drawing masked color image with PostScript level 2
+ fprintf(output, "%d %d pixmap_size\n pixmap_loadmask\n", iw, ih);
+ }
+ else {
+ fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol);
+ }
+ } else {
+ fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih);
+ }
+
+ int LD=iw*D;
+ uchar *rgbdata=new uchar[LD];
+ uchar *curmask=mask;
+
+ if(level2_mask) {
+ for (j = ih - 1; j >= 0; j--) {
+ curmask = mask + j * my/ih * ((mx+7)/8);
+ for(k=0; k < my/ih; k++) { // output mask data
+ for (i=0; i < ((mx+7)/8); i++) {
+ fprintf(output, "%.2x",swap_byte(*curmask));
+ curmask++;
+ }
+ fprintf(output,"\n");
+ }
+ }
+ fprintf(output,"pop def\n\npixmap_loaddata\n");
+ for (j = ih - 1; j >= 0; j--) { // output full image data
+ call(data,0,j,iw,rgbdata);
+ uchar *curdata=rgbdata;
+ for(i=0 ; i<iw ; i++) {
+ uchar r = curdata[0];
+ uchar g = curdata[1];
+ uchar b = curdata[2];
+ //if (!(i%40)) fprintf(output, "\n");
+ fprintf(output, "%.2x%.2x%.2x", r, g, b);
+ curdata += D;
+ }
+ fprintf(output,"\n");
+ }
+ fprintf(output,"pop def\n\n%g %g pixmap_plot\n", x, y); // draw the masked image
+ }
+ else {
+ for (j=0; j<ih;j++) {
+ if(mask && lang_level_ > 2) { // InterleaveType 2 mask data
+ for(k=0; k<my/ih;k++) { //for alpha pseudo-masking
+ for (i=0; i<((mx+7)/8);i++) {
+ if (!(i%40)) fprintf(output, "\n");
+ fprintf(output, "%.2x",swap_byte(*curmask));
+ curmask++;
+ }
+ fprintf(output,"\n");
+ }
+ }
+ call(data,0,j,iw,rgbdata);
+ uchar *curdata=rgbdata;
+ for(i=0 ; i<iw ; i++) {
+ uchar r = curdata[0];
+ uchar g = curdata[1];
+ uchar b = curdata[2];
+
+ if (!(i%40)) fprintf(output, "\n");
+ fprintf(output, "%.2x%.2x%.2x", r, g, b);
+
+ curdata +=D;
+ }
+ fprintf(output,"\n");
+
+ }
+ fprintf(output,">\n");
+ }
+
+ fprintf(output,"restore\n");
+ delete[] rgbdata;
+}
+
+void Fl_PSfile_Device::draw_scaled_image_mono(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D, int LD) {
+
+ fprintf(output,"save\n");
+
+ int i,j, k;
+
+ char * interpol;
+ if(lang_level_>1){
+ if(interpolate_)
+ interpol="true";
+ else
+ interpol="false";
+ if(mask && lang_level_>2)
+ fprintf(output, "%g %g %g %g %i %i %i %i %s GIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+ else
+ fprintf(output, "%g %g %g %g %i %i %s GII\n", x , y+h , w , -h , iw , ih, interpol);
+ }else
+ fprintf(output , "%g %g %g %g %i %i GI", x , y+h , w , -h , iw , ih);
+
+
+ if(!LD) LD = iw*D;
+
+
+ int bg = (bg_r + bg_g + bg_b)/3;
+
+ uchar *curmask=mask;
+ for (j=0; j<ih;j++){
+ if(mask){
+ for(k=0;k<my/ih;k++){
+ for (i=0; i<((mx+7)/8);i++){
+ if (!(i%80)) fprintf(output, "\n");
+ fprintf(output, "%.2x",swap_byte(*curmask));
+ curmask++;
+ }
+ fprintf(output,"\n");
+ }
+ }
+ const uchar *curdata=data+j*LD;
+ for(i=0 ; i<iw ; i++) {
+ if (!(i%80)) fprintf(output, "\n");
+ uchar r = curdata[0];
+ if(lang_level_<3 && D>1) { //can do mixing
+
+ unsigned int a2 = curdata[1]; //must be int
+ unsigned int a = 255-a2;
+ r = (a2 * r + bg * a)/255;
+ }
+ if (!(i%120)) fprintf(output, "\n");
+ fprintf(output, "%.2x", r);
+ curdata +=D;
+ }
+ fprintf(output,"\n");
+
+ }
+
+ fprintf(output," >\nrestore\n" );
+
+};
+
+
+
+void Fl_PSfile_Device::draw_scaled_image_mono(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D) {
+
+ fprintf(output,"save\n");
+ int i,j,k;
+ char * interpol;
+ if(lang_level_>1){
+ if(interpolate_) interpol="true";
+ else interpol="false";
+ if(mask && lang_level_>2)
+ fprintf(output, "%g %g %g %g %i %i %i %i %s GIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+ else
+ fprintf(output, "%g %g %g %g %i %i %s GII\n", x , y+h , w , -h , iw , ih, interpol);
+ }else
+ fprintf(output , "%g %g %g %g %i %i GI", x , y+h , w , -h , iw , ih);
+
+ int LD=iw*D;
+ uchar *rgbdata=new uchar[LD];
+ uchar *curmask=mask;
+ for (j=0; j<ih;j++){
+
+ if(mask && lang_level_>2){ // InterleaveType 2 mask data
+ for(k=0; k<my/ih;k++){ //for alpha pseudo-masking
+ for (i=0; i<((mx+7)/8);i++){
+ if (!(i%40)) fprintf(output, "\n");
+ fprintf(output, "%.2x",swap_byte(*curmask));
+ curmask++;
+ }
+ fprintf(output,"\n");
+ }
+ }
+ call(data,0,j,iw,rgbdata);
+ uchar *curdata=rgbdata;
+ for(i=0 ; i<iw ; i++) {
+ uchar r = curdata[0];
+ if (!(i%120)) fprintf(output, "\n");
+ fprintf(output, "%.2x", r);
+ curdata +=D;
+ }
+ fprintf(output,"\n");
+ }
+ fprintf(output,">\n");
+ fprintf(output,"restore\n");
+ delete[] rgbdata;
+}
+
+
+////////////////////////////// Image classes //////////////////////
+
+
+void Fl_PSfile_Device::draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy){
+ const char * const * di =pxm->data();
+ int w,h;
+ if (!fl_measure_pixmap(di, w, h)) return;
+ mask=0;
+ fl_mask_bitmap=&mask;
+ mx = WP;
+ my = HP;
+ push_clip(XP, YP, WP, HP);
+ fl_draw_pixmap(di,XP -cx, YP -cy, FL_BLACK );
+ pop_clip();
+ delete[] mask;
+ mask=0;
+ fl_mask_bitmap=0;
+};
+
+void Fl_PSfile_Device::draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy){
+ const uchar * di = rgb->array;
+ int w = rgb->w();
+ int h = rgb->h();
+ mask=0;
+ if(lang_level_>2) //when not true, not making alphamask, mixing colors instead...
+ if (alpha_mask(di, w, h, rgb->d(),rgb->ld())) return; //everthing masked, no need for painting!
+ push_clip(XP, YP, WP, HP);
+ draw_scaled_image(di, XP + cx, YP + cy, w, h, w, h, rgb->d(), rgb->ld());
+ pop_clip();
+ delete[]mask;
+ mask=0;
+};
+
+void Fl_PSfile_Device::draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy){
+ const uchar * di = bitmap->array;
+ int w,h;
+ int LD=(bitmap->w()+7)/8;
+ int xx;
+
+ if (WP> bitmap->w() - cx){// to assure that it does not go out of bounds;
+ w = bitmap->w() - cx;
+ xx = (bitmap->w()+7)/8 - cx/8; //length of mask in bytes
+ }else{
+ w =WP;
+ xx = (w+7)/8 - cx/8;
+ }
+ if( HP > bitmap->h()-cy)
+ h = bitmap->h() - cy;
+ else
+ h = HP;
+
+ di += cy*LD + cx/8;
+ int si = cx % 8; // small shift to be clipped, it is simpler than shifting whole mask
+
+ int i,j;
+ push_clip(XP, YP, WP, HP);
+ fprintf(output , "%i %i %i %i %i %i MI", XP - si, YP + HP , WP , -HP , w , h);
+
+ for (j=0; j<HP; j++){
+ for (i=0; i<xx; i++){
+ if (!(i%80)) fprintf(output, "\n"); // not have lines longer than 255 chars
+ fprintf(output, "%.2x",swap_byte(~(*di)));
+ di++;
+ }
+ fprintf(output,"\n");
+ }
+ fprintf(output,">\n");
+ pop_clip();
+};
+
+
+//
+// End of "$Id: image.cxx 4324 2005-05-09 21:47:22Z rokan $"
+//
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+