From 535f0c2d3b17b20723bd5520d91531eda62e5ffe Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 31 Jan 2011 15:53:23 +0000 Subject: [PATCH] Introduction of the Fl_Printer class requires all member functions of class Fl_Paged_Device to be virtual. That is done here. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8342 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Paged_Device.H | 8 ++++---- FL/Fl_PostScript.H | 1 + FL/Fl_Printer.H | 7 ++++--- src/Fl_PostScript.cxx | 5 +++++ src/Fl_Printer.cxx | 22 ++++++++++++++++++---- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/FL/Fl_Paged_Device.H b/FL/Fl_Paged_Device.H index 05db7fda5..592ef82be 100644 --- a/FL/Fl_Paged_Device.H +++ b/FL/Fl_Paged_Device.H @@ -123,7 +123,7 @@ protected: int y_offset; #ifdef __APPLE__ struct chain_elt *image_list_; // chained list of images used in this page - virtual void add_image(const uchar *data); // adds an image to the page image list + void add_image(const uchar *data); // adds an image to the page image list void delete_image_list(); // deletes the page image list #endif /** \brief The constructor */ @@ -137,13 +137,13 @@ public: virtual int printable_rect(int *w, int *h); virtual void margins(int *left, int *top, int *right, int *bottom); virtual void origin(int x, int y); - void origin(int *x, int *y); + virtual void origin(int *x, int *y); virtual void scale(float scale_x, float scale_y); virtual void rotate(float angle); virtual void translate(int x, int y); virtual void untranslate(void); - void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0); - void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0); + virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0); + virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0); virtual int end_page (void); virtual void end_job (void); }; diff --git a/FL/Fl_PostScript.H b/FL/Fl_PostScript.H index 43c08b7eb..2a734480a 100644 --- a/FL/Fl_PostScript.H +++ b/FL/Fl_PostScript.H @@ -232,6 +232,7 @@ public: int start_page (void); int printable_rect(int *w, int *h); void margins(int *left, int *top, int *right, int *bottom); + void origin(int *x, int *y); void origin(int x, int y); void scale (float scale_x, float scale_y); void rotate(float angle); diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H index 092bec18f..cc6e4cedc 100644 --- a/FL/Fl_Printer.H +++ b/FL/Fl_Printer.H @@ -83,6 +83,7 @@ public: int start_page (void); int printable_rect(int *w, int *h); void margins(int *left, int *top, int *right, int *bottom); + void origin(int *x, int *y); void origin(int x, int y); void scale (float scale_x, float scale_y); void rotate(float angle); @@ -157,6 +158,7 @@ public: int start_page(void); int printable_rect(int *w, int *h); void margins(int *left, int *top, int *right, int *bottom); + void origin(int *x, int *y); void origin(int x, int y); void scale(float scale_x, float scale_y); void rotate(float angle); @@ -164,9 +166,8 @@ public: void untranslate(void); int end_page (void); void end_job (void); -#ifdef __APPLE__ - void add_image(const uchar *data); -#endif + void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0); + void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0); /** \brief The destructor */ ~Fl_Printer(void); diff --git a/src/Fl_PostScript.cxx b/src/Fl_PostScript.cxx index 712cd3253..bca764493 100644 --- a/src/Fl_PostScript.cxx +++ b/src/Fl_PostScript.cxx @@ -1386,6 +1386,11 @@ int Fl_PostScript_File_Device::printable_rect(int *w, int *h) return 0; } +void Fl_PostScript_File_Device::origin(int *x, int *y) +{ + Fl_Paged_Device::origin(x, y); +} + void Fl_PostScript_File_Device::origin(int x, int y) { x_offset = x; diff --git a/src/Fl_Printer.cxx b/src/Fl_Printer.cxx index 40b37ccbe..2ff206eff 100644 --- a/src/Fl_Printer.cxx +++ b/src/Fl_Printer.cxx @@ -94,6 +94,12 @@ void Fl_System_Printer::set_current(void) #endif this->Fl_Surface_Device::set_current(); } + +void Fl_System_Printer::origin(int *x, int *y) +{ + Fl_Paged_Device::origin(x, y); +} + #endif Fl_Printer::Fl_Printer(void) { @@ -125,6 +131,11 @@ void Fl_Printer::margins(int *left, int *top, int *right, int *bottom) printer->margins(left, top, right, bottom); } +void Fl_Printer::origin(int *x, int *y) +{ + printer->origin(x, y); +} + void Fl_Printer::origin(int x, int y) { printer->origin(x, y); @@ -160,12 +171,15 @@ void Fl_Printer::end_job (void) printer->end_job(); } -#ifdef __APPLE__ -void Fl_Printer::add_image(const uchar *data) +void Fl_Printer::print_widget(Fl_Widget* widget, int delta_x, int delta_y) { - printer->add_image(data); + printer->print_widget(widget, delta_x, delta_y); +} + +void Fl_Printer::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y) +{ + printer->print_window_part(win, x, y, w, h, delta_x, delta_y); } -#endif Fl_Printer::~Fl_Printer(void) {