Author: manolo
Date: 2010-04-21 13:59:54 -0700 (Wed, 21 Apr 2010)
New Revision: 7554
Log:
Class Fl_Printer is explicitly documented as deriving from Fl_System_Printer or
Fl_PostScript_Printer depending on the platform
Modified:
branches/branch-1.3-Fl_Printer/FL/Fl_Device.H
branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H
branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx
branches/branch-1.3-Fl_Printer/src/Fl_Printer.cxx
branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm
Modified: branches/branch-1.3-Fl_Printer/FL/Fl_Device.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/Fl_Device.H 2010-04-21 12:00:55 UTC
(rev 7553)
+++ branches/branch-1.3-Fl_Printer/FL/Fl_Device.H 2010-04-21 20:59:54 UTC
(rev 7554)
@@ -364,6 +364,7 @@
class Fl_Display_Device : public Fl_Surface_Device {
public:
static const char *device_type;
+ /** \brief A constructor that sets the graphics driver used by the display */
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device(
graphics_driver) { type_ = device_type; };
/**
@brief Returns the platform's display device.
Modified: branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H 2010-04-21 12:00:55 UTC
(rev 7553)
+++ branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H 2010-04-21 20:59:54 UTC
(rev 7554)
@@ -37,45 +37,22 @@
#include <FL/Fl_RGB_Image.H>
#include <FL/Fl_Bitmap.H>
#include <stdio.h>
+#if !(defined(__APPLE__) || defined(WIN32))
+#include <FL/Fl_PSfile_Device.H>
+#endif
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
/**
- * @brief Provides an OS-independent interface to printing.
+ \brief A synonym of Fl_Printer under MSWindows and Mac OS X
*
- It allows to use all FLTK drawing, color, text, and clip functions, and to
have them operate
- on printed page(s). There are two main, non exclusive, ways to use it.
- <ul><li>Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it
appears
- on screen, with optional translation and scaling. This is done by calling
print_widget()
- or print_window_part().
- <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors,
clip) to
- compose a page appropriately shaped for printing.
- </ul>
- In both cases, begin by start_job(), start_page(), printable_rect() and
origin() calls
- and finish by end_page() and end_job() calls.
- <p><b>Platform specifics</b>
- <ul>
- <li>Xlib-based platforms (<i>e.g.</i>, Linux, Unix): this class is
implemented as
- a subclass of Fl_PostScript_File_Device.
- Use the static public attributes of this class to set the print dialog to
other languages
- than English. For example, the "Printer:" dialog item
Fl_Printer::dialog_printer can be set to French with:
- \code
- Fl_Printer::dialog_printer = "Imprimante:";
- Fl_Printer myprinter;
- myprinter.start_job();
- \endcode
- Use Fl_PostScript_File_Device::file_chooser_title to customize the title of
the file chooser dialog that opens
- when using the "Print To File" option of the print dialog.
- Class Fl_RGB_Image prints but loses its transparency if it has one.
- <li>MSWindows platform: Transparent Fl_RGB_Image 's don't print with exact
transparency on most printers.
- Fl_RGB_Image 's don't rotate() well.
- A workaround is to use the print_window_part() call.
- <li>Mac OS X platform: all graphics requests print as on display.
- </ul>
+ This class is implemented under MSWindows and Mac OS X only. Use Fl_Printer
instead that is cross-platform
+ and has the same API.
*/
-class Fl_Printer : public Fl_Paged_Device {
+class Fl_System_Printer : public Fl_Paged_Device {
private:
/** \brief the printer's graphics context, if there's one, NULL otherwise */
void *gc;
+ void set_current();
#ifdef __APPLE__
float scale_x;
float scale_y;
@@ -93,10 +70,11 @@
void absolute_printable_rect(int *x, int *y, int *w, int *h);
#endif
public:
+ static const char *device_type;
/**
@brief The constructor.
*/
- Fl_Printer(void);
+ Fl_System_Printer(void);
int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
int start_page (void);
int printable_rect(int *w, int *h);
@@ -112,70 +90,155 @@
/**
@brief The destructor.
*/
- ~Fl_Printer(void);
-
-#else // Xlib (Linux/Unix)
-
-#include <FL/Fl_PSfile_Device.H>
-
-class Fl_Printer : public Fl_PostScript_File_Device {
+ ~Fl_System_Printer(void);
+#ifndef FL_DOXYGEN
public:
- int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
+ static const char *dialog_title;
+ static const char *dialog_printer;
+ static const char *dialog_range;
+ static const char *dialog_copies;
+ static const char *dialog_all;
+ static const char *dialog_pages;
+ static const char *dialog_from;
+ static const char *dialog_to;
+ static const char *dialog_properties;
+ static const char *dialog_copyNo;
+ static const char *dialog_print_button;
+ static const char *dialog_cancel_button;
+ static const char *dialog_print_to_file;
+ static const char *property_title;
+ static const char *property_pagesize;
+ static const char *property_mode;
+ static const char *property_use;
+ static const char *property_save;
+ static const char *property_cancel;
+#endif // FL_DOXYGEN
+}; // class Fl_System_Printer
-#endif // Fl_Printer (platform-dependent)
-
- // Fl_Printer:: common for all platforms
+/** \brief OS-independant class name */
+typedef Fl_System_Printer Fl_Printer;
+#endif
+
+#if !(defined(__APPLE__) || defined(WIN32))
+/**
+ \brief A synonym of Fl_Printer for the X11 platform
+ *
+ This class is implemented for the X11 platform only. Use Fl_Printer instead
that is cross-platform
+ and has the same API.
+ */
+class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
private:
void set_current();
public:
static const char *device_type;
+ int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
+#ifndef FL_DOXYGEN
+ static const char *dialog_title;
+ static const char *dialog_printer;
+ static const char *dialog_range;
+ static const char *dialog_copies;
+ static const char *dialog_all;
+ static const char *dialog_pages;
+ static const char *dialog_from;
+ static const char *dialog_to;
+ static const char *dialog_properties;
+ static const char *dialog_copyNo;
+ static const char *dialog_print_button;
+ static const char *dialog_cancel_button;
+ static const char *dialog_print_to_file;
+ static const char *property_title;
+ static const char *property_pagesize;
+ static const char *property_mode;
+ static const char *property_use;
+ static const char *property_save;
+ static const char *property_cancel;
+#endif // FL_DOXYGEN
+};
- /** \name These attributes apply to the Xlib platform only.
+/** \brief OS-independant class name */
+typedef Fl_PostScript_Printer Fl_Printer;
+#endif
+
+#ifdef FL_DOXYGEN
+/**
+ * @brief Provides an OS-independent interface to printing.
+ *
+ It allows to use all FLTK drawing, color, text, and clip functions, and to
have them operate
+ on printed page(s). There are two main, non exclusive, ways to use it.
+ <ul><li>Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it
appears
+ on screen, with optional translation and scaling. This is done by calling
print_widget()
+ or print_window_part().
+ <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors,
clip) to
+ compose a page appropriately shaped for printing.
+ </ul>
+ In both cases, begin by start_job(), start_page(), printable_rect() and
origin() calls
+ and finish by end_page() and end_job() calls.
+ <p><b>Platform specifics</b>
+ <br>Class Fl_Printer is a synonym of Fl_PostScript_Printer under the X11
platform
+ and of Fl_System_Printer otherwise.
+ <ul>
+ <li>Xlib-based platforms (<i>e.g.</i>, Linux, Unix):
+ Use the static public attributes of this class to set the print dialog to
other languages
+ than English. For example, the "Printer:" dialog item
Fl_Printer::dialog_printer can be set to French with:
+ \code
+ Fl_Printer::dialog_printer = "Imprimante:";
+ Fl_Printer myprinter;
+ myprinter.start_job();
+ \endcode
+ Use Fl_PostScript_File_Device::file_chooser_title to customize the title of
the file chooser dialog that opens
+ when using the "Print To File" option of the print dialog.
+ Class Fl_RGB_Image prints but loses its transparency if it has one.
+ <li>MSWindows platform: Transparent Fl_RGB_Image 's don't print with exact
transparency on most printers.
+ Fl_RGB_Image 's don't rotate() well.
+ A workaround is to use the print_window_part() call.
+ <li>Mac OS X platform: all graphics requests print as on display.
+ </ul>
+ */
+// this pseudo-class is for Doxygen documentation purpose only
+class Fl_Printer : public Fl_System_Printer, Fl_PostScript_Printer {
+public:
+ static const char *device_type;
+ Fl_Printer(void);
+ int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
+ 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 scale(float scale_x, float scale_y);
+ void rotate(float angle);
+ void translate(int x, int y);
+ void untranslate(void);
+ int end_page (void);
+ void end_job (void);
+ ~Fl_Printer(void);
+
+ /** \name These attributes are effective under the Xlib platform only.
\{
*/
- /** [this text may be customized at run-time] */
static const char *dialog_title;
- /** [this text may be customized at run-time] */
static const char *dialog_printer;
- /** [this text may be customized at run-time] */
static const char *dialog_range;
- /** [this text may be customized at run-time] */
static const char *dialog_copies;
- /** [this text may be customized at run-time] */
static const char *dialog_all;
- /** [this text may be customized at run-time] */
static const char *dialog_pages;
- /** [this text may be customized at run-time] */
static const char *dialog_from;
- /** [this text may be customized at run-time] */
static const char *dialog_to;
- /** "Properties..." [this text may be customized at run-time] */
static const char *dialog_properties;
- /** [this text may be customized at run-time] */
static const char *dialog_copyNo;
- /** [this text may be customized at run-time] */
static const char *dialog_print_button;
- /** [this text may be customized at run-time] */
static const char *dialog_cancel_button;
- /** [this text may be customized at run-time] */
static const char *dialog_print_to_file;
- /** [this text may be customized at run-time] */
static const char *property_title;
- /** [this text may be customized at run-time] */
static const char *property_pagesize;
- /** [this text may be customized at run-time] */
static const char *property_mode;
- /** [this text may be customized at run-time] */
static const char *property_use;
- /** [this text may be customized at run-time] */
static const char *property_save;
- /** [this text may be customized at run-time] */
static const char *property_cancel;
- /** \} */
+ /** \} */
+};
+#endif
-}; // class Fl_Printer
-
/**
This plugin socket allows the integration of new device drivers for special
window or screen types. It is currently used to provide an automated printing
Modified: branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx 2010-04-21
12:00:55 UTC (rev 7553)
+++ branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx 2010-04-21
20:59:54 UTC (rev 7554)
@@ -34,13 +34,13 @@
extern HWND fl_window;
-Fl_Printer::Fl_Printer(void) : Fl_Paged_Device() {
+Fl_Printer::Fl_System_Printer(void) : Fl_Paged_Device() {
hPr = NULL;
type_ = device_type;
driver(fl_device);
}
-Fl_Printer::~Fl_Printer(void) {
+Fl_Printer::~Fl_System_Printer(void) {
if (hPr) end_job();
}
Modified: branches/branch-1.3-Fl_Printer/src/Fl_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Printer.cxx 2010-04-21 12:00:55 UTC
(rev 7553)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Printer.cxx 2010-04-21 20:59:54 UTC
(rev 7554)
@@ -37,25 +37,43 @@
#include <src/Fl_PS_Printer.cxx>
// print dialog customization strings
-
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_title = "Print";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_printer = "Printer:";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_range = "Print Range";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_copies = "Copies";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_all = "All";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_pages = "Pages";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_from = "From:";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_to = "To:";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_properties = "Properties...";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_copyNo = "# Copies:";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_print_button = "Print";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_cancel_button = "Cancel";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::dialog_print_to_file = "Print To File";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::property_title = "Printer Properties";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::property_pagesize = "Page Size:";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::property_mode = "Output Mode:";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::property_use = "Use";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::property_save = "Save";
+/** [this text may be customized at run-time] */
const char *Fl_Printer::property_cancel = "Cancel";
const char *Fl_Printer::device_type = "Fl_Printer";
Modified: branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm 2010-04-21
12:00:55 UTC (rev 7553)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm 2010-04-21
20:59:54 UTC (rev 7554)
@@ -35,7 +35,7 @@
extern void fl_quartz_restore_line_style_();
-Fl_Printer::Fl_Printer(void)
+Fl_System_Printer::Fl_System_Printer(void)
{
x_offset = 0;
y_offset = 0;
@@ -44,7 +44,7 @@
driver(fl_device);
}
-Fl_Printer::~Fl_Printer(void) {}
+Fl_System_Printer::~Fl_System_Printer(void) {}
int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
//printing using a Quartz graphics context
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit