From a22791b691ff93e2facd4510a240c5fa517b44ca Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 4 Apr 2016 11:31:51 +0000 Subject: Have the device demo operate also the Fl_PostScript_File_Device class. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11527 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/device.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/device.cxx b/test/device.cxx index 60450c43d..e3f422296 100644 --- a/test/device.cxx +++ b/test/device.cxx @@ -31,6 +31,7 @@ #include +#include #include #include @@ -600,9 +601,18 @@ void copy(Fl_Widget *, void *data) { Fl_Display_Device::display_device()->set_current(); } - if (strcmp(operation, "Fl_Printer") == 0) { - Fl_Printer * p = new Fl_Printer(); - if (!p->start_job(1)) { + if (strcmp(operation, "Fl_Printer") == 0 || strcmp(operation, "Fl_PostScript_File_Device") == 0) { + Fl_Paged_Device *p; + int err; + if (strcmp(operation, "Fl_Printer") == 0) { + p = new Fl_Printer(); + err = p->start_job(1); + } + else { + p = new Fl_PostScript_File_Device(); + err = ((Fl_PostScript_File_Device*)p)->start_job(1); + } + if (!err) { p->start_page(); if (target->as_window()) p->print_window(target->as_window()); else p->print_widget(target); @@ -715,13 +725,14 @@ int main(int argc, char ** argv) { c2->end(); Fl_Radio_Round_Button *rb; - Fl_Window *w3 = new Fl_Window(2,5,w2->w()-10,55); + Fl_Window *w3 = new Fl_Window(2,5,w2->w()-10,60); w3->box(FL_DOWN_BOX); Fl_Group *g1 = new Fl_Group(w3->x(),w3->y(),w3->w(),w3->h()); rb = new Fl_Radio_Round_Button(5,5,150,12, "Fl_Image_Surface"); - rb->set(); rb->callback(operation_cb, NULL); operation = rb->label(); - rb = new Fl_Radio_Round_Button(5,22,150,12, "Fl_Copy_Surface"); rb->callback(operation_cb, NULL); - rb = new Fl_Radio_Round_Button(5,39,150,12, "Fl_Printer"); rb->callback(operation_cb, NULL); + rb->set(); rb->callback(operation_cb, NULL); operation = rb->label(); rb->labelsize(12); + rb = new Fl_Radio_Round_Button(5,18,150,12, "Fl_Copy_Surface"); rb->callback(operation_cb, NULL); rb->labelsize(12); + rb = new Fl_Radio_Round_Button(5,31,150,12, "Fl_Printer"); rb->callback(operation_cb, NULL); rb->labelsize(12); + rb = new Fl_Radio_Round_Button(5,44,150,12, "Fl_PostScript_File_Device"); rb->callback(operation_cb, NULL); rb->labelsize(12); g1->end(); Fl_Group *g2 = new Fl_Group(w3->x(),w3->y(),w3->w(),w3->h()); -- cgit v1.2.3