Moved enums Page_Format and Page_Layout to class Fl_Paged_Device
where they are better located. Small reorganization of device-related include files. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8017 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
fc25ffc246
commit
495b3b5af5
@ -26,7 +26,8 @@
|
|||||||
// http://www.fltk.org/str.php
|
// http://www.fltk.org/str.php
|
||||||
//
|
//
|
||||||
/** \file Fl_Device.H
|
/** \file Fl_Device.H
|
||||||
\brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device.
|
\brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device,
|
||||||
|
Fl_Display_Device, Fl_Device_Plugin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef Fl_Device_H
|
#ifndef Fl_Device_H
|
||||||
@ -374,6 +375,28 @@ public:
|
|||||||
static Fl_Display_Device *display_device() { return fl_display_device; };
|
static Fl_Display_Device *display_device() { return fl_display_device; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
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
|
||||||
|
service for OpenGL windows, if linked with fltk_gl.
|
||||||
|
*/
|
||||||
|
class Fl_Device_Plugin : public Fl_Plugin {
|
||||||
|
public:
|
||||||
|
/** \brief The constructor */
|
||||||
|
Fl_Device_Plugin(const char *name)
|
||||||
|
: Fl_Plugin(klass(), name) { }
|
||||||
|
/** \brief Returns the class name */
|
||||||
|
virtual const char *klass() { return "fltk:device"; }
|
||||||
|
/** \brief Returns the plugin name */
|
||||||
|
virtual const char *name() = 0;
|
||||||
|
/** \brief Prints a widget
|
||||||
|
\param w the widget
|
||||||
|
\param x,y offsets where to print relatively to coordinates origin
|
||||||
|
\param height height of the current drawing area
|
||||||
|
*/
|
||||||
|
virtual int print(Fl_Widget* w, int x, int y, int height) { return 0; }
|
||||||
|
};
|
||||||
|
|
||||||
#endif // Fl_Device_H
|
#endif // Fl_Device_H
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <FL/Fl_Device.H>
|
#include <FL/Fl_Device.H>
|
||||||
|
|
||||||
|
#define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Represents page-structured drawing surfaces.
|
\brief Represents page-structured drawing surfaces.
|
||||||
*
|
*
|
||||||
@ -41,6 +43,69 @@
|
|||||||
or Fl_PostScript_File_Device instead.
|
or Fl_PostScript_File_Device instead.
|
||||||
*/
|
*/
|
||||||
class Fl_Paged_Device : public Fl_Surface_Device {
|
class Fl_Paged_Device : public Fl_Surface_Device {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
\brief Possible page formats.
|
||||||
|
|
||||||
|
All paper formats with pre-defined width and height.
|
||||||
|
*/
|
||||||
|
enum Page_Format {
|
||||||
|
A0 = 0, /**< A0 format */
|
||||||
|
A1,
|
||||||
|
A2,
|
||||||
|
A3,
|
||||||
|
A4, /**< A4 format */
|
||||||
|
A5,
|
||||||
|
A6,
|
||||||
|
A7,
|
||||||
|
A8,
|
||||||
|
A9,
|
||||||
|
B0,
|
||||||
|
B1,
|
||||||
|
B2,
|
||||||
|
B3,
|
||||||
|
B4,
|
||||||
|
B5,
|
||||||
|
B6,
|
||||||
|
B7,
|
||||||
|
B8,
|
||||||
|
B9,
|
||||||
|
B10,
|
||||||
|
C5E,
|
||||||
|
DLE,
|
||||||
|
EXECUTIVE,
|
||||||
|
FOLIO,
|
||||||
|
LEDGER,
|
||||||
|
LEGAL,
|
||||||
|
LETTER, /**< Letter format */
|
||||||
|
TABLOID,
|
||||||
|
ENVELOPE,
|
||||||
|
MEDIA = 0x1000
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
\brief Possible page layouts.
|
||||||
|
*/
|
||||||
|
enum Page_Layout {
|
||||||
|
PORTRAIT = 0, /**< Portrait orientation */
|
||||||
|
LANDSCAPE = 0x100, /**< Landscape orientation */
|
||||||
|
REVERSED = 0x200, /**< Reversed orientation */
|
||||||
|
ORIENTATION = 0x300 /**< orientation */
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief width, height and name of a page format
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
/** \brief width in points */
|
||||||
|
int width;
|
||||||
|
/** \brief height in points */
|
||||||
|
int height;
|
||||||
|
/** \brief format name */
|
||||||
|
const char *name;
|
||||||
|
} page_format;
|
||||||
|
/** \brief width, height and name of all elements of the enum \ref Page_Format.
|
||||||
|
*/
|
||||||
|
static const page_format page_formats[NO_PAGE_FORMATS];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
struct chain_elt {
|
struct chain_elt {
|
||||||
|
|||||||
@ -35,8 +35,6 @@
|
|||||||
#include <FL/Fl_Paged_Device.H>
|
#include <FL/Fl_Paged_Device.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
#define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief PostScript graphical backend.
|
\brief PostScript graphical backend.
|
||||||
*
|
*
|
||||||
@ -66,58 +64,10 @@
|
|||||||
class Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
|
class Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
|
||||||
public:
|
public:
|
||||||
static const char *device_type;
|
static const char *device_type;
|
||||||
/**
|
|
||||||
\brief Possible page formats.
|
|
||||||
*/
|
|
||||||
enum Page_Format {
|
|
||||||
A0 = 0,
|
|
||||||
A1,
|
|
||||||
A2,
|
|
||||||
A3,
|
|
||||||
A4,
|
|
||||||
A5,
|
|
||||||
A6,
|
|
||||||
A7,
|
|
||||||
A8,
|
|
||||||
A9,
|
|
||||||
B0,
|
|
||||||
B1,
|
|
||||||
B2,
|
|
||||||
B3,
|
|
||||||
B4,
|
|
||||||
B5,
|
|
||||||
B6,
|
|
||||||
B7,
|
|
||||||
B8,
|
|
||||||
B9,
|
|
||||||
B10,
|
|
||||||
C5E,
|
|
||||||
DLE,
|
|
||||||
EXECUTIVE,
|
|
||||||
FOLIO,
|
|
||||||
LEDGER,
|
|
||||||
LEGAL,
|
|
||||||
LETTER,
|
|
||||||
TABLOID,
|
|
||||||
ENVELOPE,
|
|
||||||
MEDIA = 0x1000
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Possible page layouts.
|
|
||||||
*/
|
|
||||||
enum Page_Layout {PORTRAIT = 0, LANDSCAPE = 0x100, REVERSED = 0x200, ORIENTATION = 0x300};
|
|
||||||
|
|
||||||
#ifndef FL_DOXYGEN
|
#ifndef FL_DOXYGEN
|
||||||
public:
|
public:
|
||||||
enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
|
enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
|
||||||
|
|
||||||
typedef struct page_format {
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
const char *name;
|
|
||||||
} page_format;
|
|
||||||
|
|
||||||
class Clip {
|
class Clip {
|
||||||
public:
|
public:
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
@ -162,10 +112,9 @@ class Clip {
|
|||||||
|
|
||||||
FILE *output;
|
FILE *output;
|
||||||
double pw_, ph_;
|
double pw_, ph_;
|
||||||
static const page_format page_formats[NO_PAGE_FORMATS];
|
|
||||||
|
|
||||||
uchar bg_r, bg_g, bg_b;
|
uchar bg_r, bg_g, bg_b;
|
||||||
int start_postscript (int pagecount, enum Page_Format format, enum Page_Layout layout);
|
int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout);
|
||||||
/* int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
|
/* int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
|
||||||
*/
|
*/
|
||||||
void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
|
void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
|
||||||
@ -178,7 +127,7 @@ class Clip {
|
|||||||
void draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D);
|
void draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D);
|
||||||
void 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);
|
void 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);
|
||||||
|
|
||||||
enum Page_Format page_format_;
|
enum Fl_Paged_Device::Page_Format page_format_;
|
||||||
char *ps_filename_;
|
char *ps_filename_;
|
||||||
// implementation of drawing methods
|
// implementation of drawing methods
|
||||||
void color(Fl_Color c);
|
void color(Fl_Color c);
|
||||||
@ -280,10 +229,10 @@ public:
|
|||||||
static const char *device_type;
|
static const char *device_type;
|
||||||
Fl_PostScript_File_Device();
|
Fl_PostScript_File_Device();
|
||||||
~Fl_PostScript_File_Device();
|
~Fl_PostScript_File_Device();
|
||||||
int start_job(int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format = Fl_PostScript_Graphics_Driver::A4,
|
int start_job(int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
|
||||||
enum Fl_PostScript_Graphics_Driver::Page_Layout layout = Fl_PostScript_Graphics_Driver::PORTRAIT);
|
enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
|
||||||
int start_job(FILE *ps_output, int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format = Fl_PostScript_Graphics_Driver::A4,
|
int start_job(FILE *ps_output, int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
|
||||||
enum Fl_PostScript_Graphics_Driver::Page_Layout layout = Fl_PostScript_Graphics_Driver::PORTRAIT);
|
enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
|
||||||
int start_page (void);
|
int start_page (void);
|
||||||
int printable_rect(int *w, int *h);
|
int printable_rect(int *w, int *h);
|
||||||
void margins(int *left, int *top, int *right, int *bottom);
|
void margins(int *left, int *top, int *right, int *bottom);
|
||||||
|
|||||||
@ -239,28 +239,6 @@ public:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
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
|
|
||||||
service for OpenGL windows, if linked with fltk_gl.
|
|
||||||
*/
|
|
||||||
class Fl_Device_Plugin : public Fl_Plugin {
|
|
||||||
public:
|
|
||||||
/** \brief The constructor */
|
|
||||||
Fl_Device_Plugin(const char *name)
|
|
||||||
: Fl_Plugin(klass(), name) { }
|
|
||||||
/** \brief Returns the class name */
|
|
||||||
virtual const char *klass() { return "fltk:device"; }
|
|
||||||
/** \brief Returns the plugin name */
|
|
||||||
virtual const char *name() = 0;
|
|
||||||
/** \brief Prints a widget
|
|
||||||
\param w the widget
|
|
||||||
\param x,y offsets where to print relatively to coordinates origin
|
|
||||||
\param height height of the current drawing area
|
|
||||||
*/
|
|
||||||
virtual int print(Fl_Widget* w, int x, int y, int height) { return 0; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // Fl_Printer_H
|
#endif // Fl_Printer_H
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -28,8 +28,9 @@
|
|||||||
\brief implementation of class Fl_Paged_Device.
|
\brief implementation of class Fl_Paged_Device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <FL/Fl_Paged_Device.H>
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Printer.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
const char *Fl_Paged_Device::device_type = "Fl_Paged_Device";
|
const char *Fl_Paged_Device::device_type = "Fl_Paged_Device";
|
||||||
|
|
||||||
@ -286,6 +287,47 @@ void Fl_Paged_Device::translate(int x, int y) {}
|
|||||||
*/
|
*/
|
||||||
void Fl_Paged_Device::untranslate(void) {}
|
void Fl_Paged_Device::untranslate(void) {}
|
||||||
|
|
||||||
|
const Fl_Paged_Device::page_format Fl_Paged_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
|
||||||
|
{ 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
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
|||||||
@ -87,7 +87,8 @@ Fl_PostScript_Graphics_Driver *Fl_PostScript_File_Device::driver()
|
|||||||
@param layout Desired page layout.
|
@param layout Desired page layout.
|
||||||
@return 0 iff OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.
|
@return 0 iff OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.
|
||||||
*/
|
*/
|
||||||
int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format, enum Fl_PostScript_Graphics_Driver::Page_Layout layout)
|
int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_Paged_Device::Page_Format format,
|
||||||
|
enum Fl_Paged_Device::Page_Layout layout)
|
||||||
{
|
{
|
||||||
Fl_Native_File_Chooser fnfc;
|
Fl_Native_File_Chooser fnfc;
|
||||||
fnfc.title(Fl_PostScript_File_Device::file_chooser_title);
|
fnfc.title(Fl_PostScript_File_Device::file_chooser_title);
|
||||||
@ -120,7 +121,8 @@ static int dont_close(FILE *f)
|
|||||||
@param layout Desired page layout.
|
@param layout Desired page layout.
|
||||||
@return always 0.
|
@return always 0.
|
||||||
*/
|
*/
|
||||||
int Fl_PostScript_File_Device::start_job (FILE *ps_output, int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format, enum Fl_PostScript_Graphics_Driver::Page_Layout layout)
|
int Fl_PostScript_File_Device::start_job (FILE *ps_output, int pagecount,
|
||||||
|
enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout)
|
||||||
{
|
{
|
||||||
Fl_PostScript_Graphics_Driver *ps = driver();
|
Fl_PostScript_Graphics_Driver *ps = driver();
|
||||||
ps->output = ps_output;
|
ps->output = ps_output;
|
||||||
@ -145,46 +147,6 @@ Fl_PostScript_File_Device::~Fl_PostScript_File_Device() {
|
|||||||
#include "print_panel.cxx"
|
#include "print_panel.cxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const Fl_PostScript_Graphics_Driver::page_format Fl_PostScript_Graphics_Driver::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
|
|
||||||
{ 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
|
// Prolog string
|
||||||
|
|
||||||
static const char * prolog =
|
static const char * prolog =
|
||||||
@ -566,11 +528,12 @@ static const char * prolog_3 = // prolog relevant only if lang_level >2
|
|||||||
|
|
||||||
// end prolog
|
// end prolog
|
||||||
|
|
||||||
int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format, enum Fl_PostScript_Graphics_Driver::Page_Layout layout)
|
int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount,
|
||||||
|
enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout)
|
||||||
//returns 0 iff OK
|
//returns 0 iff OK
|
||||||
{
|
{
|
||||||
int w, h, x;
|
int w, h, x;
|
||||||
if (format == A4) {
|
if (format == Fl_Paged_Device::A4) {
|
||||||
left_margin = 18;
|
left_margin = 18;
|
||||||
top_margin = 18;
|
top_margin = 18;
|
||||||
}
|
}
|
||||||
@ -578,7 +541,7 @@ int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_Post
|
|||||||
left_margin = 12;
|
left_margin = 12;
|
||||||
top_margin = 12;
|
top_margin = 12;
|
||||||
}
|
}
|
||||||
page_format_ = (enum Page_Format)(format | layout);
|
page_format_ = (enum Fl_Paged_Device::Page_Format)(format | layout);
|
||||||
|
|
||||||
fputs("%!PS-Adobe-3.0\n", output);
|
fputs("%!PS-Adobe-3.0\n", output);
|
||||||
fputs("%%Creator: FLTK\n", output);
|
fputs("%%Creator: FLTK\n", output);
|
||||||
@ -588,10 +551,10 @@ int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_Post
|
|||||||
fprintf(output, "%%%%Pages: %i\n", pagecount);
|
fprintf(output, "%%%%Pages: %i\n", pagecount);
|
||||||
else
|
else
|
||||||
fputs("%%Pages: (atend)\n", output);
|
fputs("%%Pages: (atend)\n", output);
|
||||||
fprintf(output, "%%%%BeginFeature: *PageSize %s\n", page_formats[format].name );
|
fprintf(output, "%%%%BeginFeature: *PageSize %s\n", Fl_Paged_Device::page_formats[format].name );
|
||||||
w = page_formats[format].width;
|
w = Fl_Paged_Device::page_formats[format].width;
|
||||||
h = page_formats[format].height;
|
h = Fl_Paged_Device::page_formats[format].height;
|
||||||
if (lang_level_ == 3 && (layout & LANDSCAPE) ) { x = w; w = h; h = x; }
|
if (lang_level_ == 3 && (layout & Fl_Paged_Device::LANDSCAPE) ) { x = w; w = h; h = x; }
|
||||||
fprintf(output, "<</PageSize[%d %d]>>setpagedevice\n", w, h );
|
fprintf(output, "<</PageSize[%d %d]>>setpagedevice\n", w, h );
|
||||||
fputs("%%EndFeature\n", output);
|
fputs("%%EndFeature\n", output);
|
||||||
fputs("%%EndComments\n", output);
|
fputs("%%EndComments\n", output);
|
||||||
@ -672,8 +635,8 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(output, "%%%%BeginPageSetup\n");
|
fprintf(output, "%%%%BeginPageSetup\n");
|
||||||
if((media & MEDIA) &&(lang_level_>1)){
|
if((media & Fl_Paged_Device::MEDIA) &&(lang_level_>1)){
|
||||||
int r = media & REVERSED;
|
int r = media & Fl_Paged_Device::REVERSED;
|
||||||
if(r) r = 2;
|
if(r) r = 2;
|
||||||
fprintf(output, "<< /PageSize [%i %i] /Orientation %i>> setpagedevice\n", (int)(pw+.5), (int)(ph+.5), r);
|
fprintf(output, "<< /PageSize [%i %i] /Orientation %i>> setpagedevice\n", (int)(pw+.5), (int)(ph+.5), r);
|
||||||
}
|
}
|
||||||
@ -690,9 +653,9 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
|
|||||||
line_style(0);
|
line_style(0);
|
||||||
fprintf(output, "GS\n");
|
fprintf(output, "GS\n");
|
||||||
|
|
||||||
if (!((media & MEDIA) &&(lang_level_>1))){
|
if (!((media & Fl_Paged_Device::MEDIA) &&(lang_level_>1))){
|
||||||
if (pw > ph) {
|
if (pw > ph) {
|
||||||
if(media & REVERSED) {
|
if(media & Fl_Paged_Device::REVERSED) {
|
||||||
fprintf(output, "-90 rotate %i 0 translate\n", int(-pw));
|
fprintf(output, "-90 rotate %i 0 translate\n", int(-pw));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -700,7 +663,7 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(media & REVERSED)
|
if(media & Fl_Paged_Device::REVERSED)
|
||||||
fprintf(output, "180 rotate %i %i translate\n", int(-pw), int(-ph));
|
fprintf(output, "180 rotate %i %i translate\n", int(-pw), int(-ph));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,12 +673,12 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
|
|||||||
void Fl_PostScript_Graphics_Driver::page(int format){
|
void Fl_PostScript_Graphics_Driver::page(int format){
|
||||||
|
|
||||||
|
|
||||||
if(format & LANDSCAPE){
|
if(format & Fl_Paged_Device::LANDSCAPE){
|
||||||
ph_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].width;
|
ph_=Fl_Paged_Device::page_formats[format & 0xFF].width;
|
||||||
pw_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].height;
|
pw_=Fl_Paged_Device::page_formats[format & 0xFF].height;
|
||||||
}else{
|
}else{
|
||||||
pw_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].width;
|
pw_=Fl_Paged_Device::page_formats[format & 0xFF].width;
|
||||||
ph_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].height;
|
ph_=Fl_Paged_Device::page_formats[format & 0xFF].height;
|
||||||
}
|
}
|
||||||
page(pw_,ph_,format & 0xFF00);//,orientation only;
|
page(pw_,ph_,format & 0xFF00);//,orientation only;
|
||||||
}
|
}
|
||||||
@ -1488,8 +1451,8 @@ void Fl_PostScript_File_Device::end_job (void)
|
|||||||
|
|
||||||
#if ! (defined(__APPLE__) || defined(WIN32) )
|
#if ! (defined(__APPLE__) || defined(WIN32) )
|
||||||
int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
|
int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
|
||||||
enum Fl_PostScript_Graphics_Driver::Page_Format format;
|
enum Fl_Paged_Device::Page_Format format;
|
||||||
enum Fl_PostScript_Graphics_Driver::Page_Layout layout;
|
enum Fl_Paged_Device::Page_Layout layout;
|
||||||
|
|
||||||
// first test version for print dialog
|
// first test version for print dialog
|
||||||
if (!print_panel) make_print_panel();
|
if (!print_panel) make_print_panel();
|
||||||
@ -1507,7 +1470,7 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
|
|||||||
|
|
||||||
// get options
|
// get options
|
||||||
|
|
||||||
format = print_page_size->value() ? Fl_PostScript_Graphics_Driver::A4 : Fl_PostScript_Graphics_Driver::LETTER;
|
format = print_page_size->value() ? Fl_Paged_Device::A4 : Fl_Paged_Device::LETTER;
|
||||||
{ // page range choice
|
{ // page range choice
|
||||||
int from = 1, to = pages;
|
int from = 1, to = pages;
|
||||||
if (print_pages->value()) {
|
if (print_pages->value()) {
|
||||||
@ -1522,10 +1485,10 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
|
|||||||
pages = to - from + 1;
|
pages = to - from + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print_output_mode[0]->value()) layout = Fl_PostScript_Graphics_Driver::PORTRAIT;
|
if (print_output_mode[0]->value()) layout = Fl_Paged_Device::PORTRAIT;
|
||||||
else if (print_output_mode[1]->value()) layout = Fl_PostScript_Graphics_Driver::LANDSCAPE;
|
else if (print_output_mode[1]->value()) layout = Fl_Paged_Device::LANDSCAPE;
|
||||||
else if (print_output_mode[2]->value()) layout = Fl_PostScript_Graphics_Driver::PORTRAIT;
|
else if (print_output_mode[2]->value()) layout = Fl_Paged_Device::PORTRAIT;
|
||||||
else layout = Fl_PostScript_Graphics_Driver::LANDSCAPE;
|
else layout = Fl_Paged_Device::LANDSCAPE;
|
||||||
|
|
||||||
int print_pipe = print_choice->value(); // 0 = print to file, >0 = printer (pipe)
|
int print_pipe = print_choice->value(); // 0 = print to file, >0 = printer (pipe)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user