#include "wx/defs.h"
-#if USE_POSTSCRIPT
+#if wxUSE_POSTSCRIPT
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/frame.h"
-#include "wx/postscrp.h"
#include "wx/utils.h"
#include "wx/filedlg.h"
#include "wx/msgdlg.h"
#include "wx/list.h"
#endif
+#include "wx/postscrp.h"
#include "wx/dcmemory.h"
#ifdef __WXMSW__
#include "wx/msw/private.h"
#endif
-#if USE_IOSTREAMH
+#if wxUSE_IOSTREAMH
#include <iostream.h>
+#include <fstream.h>
#else
#include <iostream>
+#include <fstream>
+# ifdef _MSC_VER
+ using namespace std;
+# endif
#endif
-#include <fstream.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
wxPrintSetupData *wxThePrintSetupData = (wxPrintSetupData *) NULL;
+#if !USE_SHARED_LIBRARY
+IMPLEMENT_DYNAMIC_CLASS(wxPostScriptModule, wxModule)
+IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
+IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
+#endif
+
+#ifndef __WXGTK__
+
// these should move into wxPostscriptDC:
double UnderlinePosition = 0.0F;
double UnderlineThickness = 0.0F;
#define _MAXPATHLEN 500
/* See "wxspline.inc" and "xfspline.inc" */
-#if USE_XFIG_SPLINE_CODE
+#if wxUSE_XFIG_SPLINE_CODE
static const char *wxPostScriptHeaderSpline = " \
/DrawSplineSection {\n\
/y3 exch def\n\
// No extra PS header for this spline implementation.
static const char *wxPostScriptHeaderSpline = (char *) NULL;
-#endif /* USE_XFIG_SPLINE_CODE */
+#endif /* wxUSE_XFIG_SPLINE_CODE */
// steve, 05.09.94
// VMS has a bug in the ofstream class.
static char *fileBuffer = NULL;
#endif
-#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
-#endif
-
-wxPostScriptDC::wxPostScriptDC (void)
+wxPostScriptDC::wxPostScriptDC ()
{
// m_yOrigin = 792; // For EPS output
m_yOrigin = 842; // For A4 output
return m_ok;
}
-wxPostScriptDC::~wxPostScriptDC (void)
+wxPostScriptDC::~wxPostScriptDC ()
{
if (m_pstream)
delete m_pstream;
*m_pstream << "gsave\n";
*m_pstream << "newpath\n";
*m_pstream << cx << " " << YSCALE (cy) << " moveto\n";
- *m_pstream << cx + cw << " " << YSCALE (cy) << " lineto\n";
+ *m_pstream << (cx + cw) << " " << YSCALE (cy) << " lineto\n";
*m_pstream << cx + cw << " " << YSCALE (cy + ch) << " lineto\n";
*m_pstream << cx << " " << YSCALE (cy + ch) << " lineto\n";
*m_pstream << "closepath clip newpath\n";
}
-void wxPostScriptDC::DestroyClippingRegion (void)
+void wxPostScriptDC::SetClippingRegion( const wxRegion &WXUNUSED(region) )
+{
+}
+
+void wxPostScriptDC::DestroyClippingRegion ()
{
if (!m_pstream)
return;
}
}
-void wxPostScriptDC::Clear (void)
+void wxPostScriptDC::Clear ()
{
}
-void wxPostScriptDC::FloodFill (long WXUNUSED(x), long WXUNUSED(y), wxColour * WXUNUSED(col), int WXUNUSED(style))
+void wxPostScriptDC::FloodFill (long WXUNUSED(x), long WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
{
}
{
SetBrush (m_brush);
- *m_pstream <<
+ *m_pstream <<
"newpath\n" <<
- x+w/2 << " " << YSCALE (y+h/2) << " " <<
- w/2 << " " << h/2 << " " <<
+ (x+w/2) << " " << YSCALE (y+h/2) << " " <<
+ w/2 << " " << (h/2) << " " <<
int(sa) <<" "<< int(ea)<<" true ellipticarc\n";
CalcBoundingBox (x , (long)YSCALE (y ));
{
SetPen (m_pen);
- *m_pstream <<
+ *m_pstream <<
"newpath\n" <<
- x+w/2 << " " << YSCALE (y+h/2) << " " <<
- w/2 << " " << h/2 << " " <<
+ (x+w/2) << " " << YSCALE (y+h/2) << " " <<
+ (w/2) << " " << (h/2) << " " <<
int(sa) <<" "<< int(ea)<<" false ellipticarc\n";
CalcBoundingBox (x , (long)YSCALE (y ));
*m_pstream << "newpath\n";
*m_pstream << x << " " << YSCALE (y) << " moveto\n";
- *m_pstream << x + width << " " << YSCALE (y) << " lineto\n";
- *m_pstream << x + width << " " << YSCALE (y + height) << " lineto\n";
+ *m_pstream << (x + width) << " " << YSCALE (y) << " lineto\n";
+ *m_pstream << (x + width) << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << x << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << "closepath\n";
*m_pstream << "fill\n";
*m_pstream << "newpath\n";
*m_pstream << x << " " << YSCALE (y) << " moveto\n";
- *m_pstream << x + width << " " << YSCALE (y) << " lineto\n";
- *m_pstream << x + width << " " << YSCALE (y + height) << " lineto\n";
+ *m_pstream << (x + width) << " " << YSCALE (y) << " lineto\n";
+ *m_pstream << (x + width) << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << x << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << "closepath\n";
*m_pstream << "stroke\n";
SetBrush (m_brush);
// Draw rectangle anticlockwise
*m_pstream << "newpath\n";
- *m_pstream << x + radius << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
+ *m_pstream << (x + radius) << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
*m_pstream << x << " " << YSCALE (y + radius) << " moveto\n";
- *m_pstream << x + radius << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
- *m_pstream << x + width - radius << " " << YSCALE (y + height) << " lineto\n";
+ *m_pstream << (x + radius) << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
+ *m_pstream << (x + width - radius) << " " << YSCALE (y + height) << " lineto\n";
- *m_pstream << x + width - radius << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
- *m_pstream << x + width << " " << YSCALE (y + radius) << " lineto\n";
+ *m_pstream << (x + width - radius) << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
+ *m_pstream << (x + width) << " " << YSCALE (y + radius) << " lineto\n";
- *m_pstream << x + width - radius << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
+ *m_pstream << (x + width - radius) << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
- *m_pstream << x + radius << " " << YSCALE (y) << " lineto\n";
+ *m_pstream << (x + radius) << " " << YSCALE (y) << " lineto\n";
*m_pstream << "closepath\n";
SetPen (m_pen);
// Draw rectangle anticlockwise
*m_pstream << "newpath\n";
- *m_pstream << x + radius << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
+ *m_pstream << (x + radius) << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
*m_pstream << x << " " << YSCALE (y + height - radius) << " lineto\n";
- *m_pstream << x + radius << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
- *m_pstream << x + width - radius << " " << YSCALE (y + height) << " lineto\n";
+ *m_pstream << (x + radius) << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
+ *m_pstream << (x + width - radius) << " " << YSCALE (y + height) << " lineto\n";
- *m_pstream << x + width - radius << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
- *m_pstream << x + width << " " << YSCALE (y + radius) << " lineto\n";
+ *m_pstream << (x + width - radius) << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
+ *m_pstream << (x + width) << " " << YSCALE (y + radius) << " lineto\n";
- *m_pstream << x + width - radius << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
+ *m_pstream << (x + width - radius) << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
- *m_pstream << x + radius << " " << YSCALE (y) << " lineto\n";
+ *m_pstream << (x + radius) << " " << YSCALE (y) << " lineto\n";
*m_pstream << "closepath\n";
SetBrush (m_brush);
*m_pstream << "newpath\n";
- *m_pstream << x + width / 2 << " " << YSCALE (y + height / 2) << " ";
- *m_pstream << width / 2 << " " << height / 2 << " 0 360 ellipse\n";
+ *m_pstream << (x + width / 2) << " " << YSCALE (y + height / 2) << " ";
+ *m_pstream << (width / 2) << " " << (height / 2) << " 0 360 ellipse\n";
*m_pstream << "fill\n";
CalcBoundingBox (x - width, (long)YSCALE (y - height));
SetPen (m_pen);
*m_pstream << "newpath\n";
- *m_pstream << x + width / 2 << " " << YSCALE (y + height / 2) << " ";
- *m_pstream << width / 2 << " " << height / 2 << " 0 360 ellipse\n";
+ *m_pstream << (x + width / 2) << " " << YSCALE (y + height / 2) << " ";
+ *m_pstream << (width / 2) << " " << (height / 2) << " 0 360 ellipse\n";
*m_pstream << "stroke\n";
CalcBoundingBox (x - width, (long)YSCALE (y - height));
#endif
}
+void wxPostScriptDC::DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask )
+{
+}
+
void wxPostScriptDC::SetFont (const wxFont& the_font)
{
if (!m_pstream)
strcpy (buf, name);
strcat (buf, style);
*m_pstream << buf << " findfont\n";
- *m_pstream << m_font.GetPointSize() * m_scaleFactor << " scalefont setfont\n";
+ *m_pstream << (m_font.GetPointSize() * m_scaleFactor) << " scalefont setfont\n";
}
void wxPostScriptDC::SetPen (const wxPen& pen)
*m_pstream << "gsave " << x << " " << YSCALE (y + size - UnderlinePosition)
<< " moveto\n"
<< UnderlineThickness << " setlinewidth "
- << x + w << " " << YSCALE (y + size - UnderlinePosition)
+ << (x + w) << " " << YSCALE (y + size - UnderlinePosition)
<< " lineto stroke grestore\n";
}
-
+
CalcBoundingBox (x, (long)YSCALE (y + size));
CalcBoundingBox (x + size * strlen ((char *)(const char *)text), (long)YSCALE (y));
}
// VMS is sh*t!
m_pstream = new ofstream;
if(fileBuffer) delete[] fileBuffer;
- fileBuffer = new char[VMS_BUFSIZ];
+ fileBuffer = new char[VMS_BUFSIZ];
m_pstream->setbuf(fileBuffer,VMS_BUFSIZ);
m_pstream->open(wxThePrintSetupData->GetPrinterFile());
#else
}
-void wxPostScriptDC::EndDoc (void)
+void wxPostScriptDC::EndDoc ()
{
static char wxPostScriptHeaderReencodeISO1[] =
"\n/reencodeISO {\n"
*m_pstream << "%%BoundingBox: "
<< floor((double)llx) << " " << floor((double)lly) << " "
<< ceil((double)urx) << " " << ceil((double)ury) << "\n";
- *m_pstream << "%%Pages: " << wxPageNumber - 1 << "\n";
+ *m_pstream << "%%Pages: " << (wxPageNumber - 1) << "\n";
*m_pstream << "%%EndComments\n\n";
// To check the correctness of the bounding box, postscript commands
if (wxThePrintSetupData->GetPrinterOrientation() == PS_LANDSCAPE)
{
real_translate_y -= m_maxY;
- // The following line can be used instead of the adjustment to
+ // The following line can be used instead of the adjustment to
// llx and urx above.
// real_translate_y -= m_minX;
*m_pstream << "90 rotate\n";
* We should rationalise the scaling code to one place. JACS, October 1995
* Do we take the next 2 lines out or not?
*/
-
+
*m_pstream << wx_printer_scale_x << " " << wx_printer_scale_y << " scale\n";
*m_pstream << wx_printer_translate_x << " " << real_translate_y << " translate\n";
#endif
char * opts = wxThePrintSetupData->GetPrinterOptions();
if (opts && *opts)
argv[argc++] = opts;
-
+
argv[argc++] = wxThePrintSetupData->GetPrinterFile();
argv[argc++] = (char *) NULL;
wxExecute (argv, TRUE);
#endif
}
-void wxPostScriptDC::StartPage (void)
+void wxPostScriptDC::StartPage ()
{
if (!m_pstream)
return;
- *m_pstream << "%%Page: " << wxPageNumber++ << "\n";
+ *m_pstream << "%%Page: " << (wxPageNumber++) << "\n";
// *m_pstream << "matrix currentmatrix\n";
// Added by Chris Breeze
*m_pstream << translate_x << " " << translate_y << " translate\n";
}
-void wxPostScriptDC::EndPage (void)
+void wxPostScriptDC::EndPage ()
{
if (!m_pstream)
return;
#endif
}
-/* MATTHEW: Implement Blit: */
-/* MATTHEW: [4] Re-wrote to use colormap */
bool wxPostScriptDC::
Blit (long xdest, long ydest, long fwidth, long fheight,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(rop), bool WXUNUSED(useMask))
XImage *image;
long j, i;
char s[3];
-
+
#ifdef __WXGTK__
d = gdk_display;
GdkWindow *gwin = ((wxClientDC*)source)->GetWindow();
image = XGetImage(d, ((GdkWindowPrivate*)gwin)->xwindow, x, y, width, height, AllPlanes, ZPixmap);
-#else
+#else
#ifdef __WXMOTIF__
// TODO. for now, use global display
cm = (Colormap) wxTheApp->GetMainColormap((WXDisplay*) d);
// TODO - implement GetPixmap() and uncomment this line
// image = XGetImage(d, source->GetPixmap(), x, y, width, height, AllPlanes, ZPixmap);
-
+
#endif
pixel = cachedest[k];
goto install;
}
-
+
cachesrc[cache_pos] = xcol.pixel = spixel;
XQueryColor(d, cm, &xcol);
-
+
long r, g, b;
r = (long)((double)(xcol.red) / MAX_COLOR);
pixel = (int)(255 * sqrt(((r * r) + (g * g) + (b * b)) / 3));
cachedest[cache_pos] = pixel;
-
+
if (++cache_pos >= CM_CACHE_SIZE) {
cache_pos = 0;
all_cache = TRUE;
}
- install:
+ install:
int h, l;
h = (pixel >> 4) & 0xF;
s[1] = '0' + l;
else
s[1] = 'a' + (l - 10);
-
+
*m_pstream << s;
}
*m_pstream << "\n";
return TRUE;
}
-long wxPostScriptDC::GetCharHeight (void)
+long wxPostScriptDC::GetCharHeight ()
{
if (m_font.Ok())
return m_font.GetPointSize ();
*externalLeading = 0;
#else
// +++++ start of contributed code +++++
-
+
// ************************************************************
// method for calculating string widths in postscript:
// read in the AFM (adobe font metrics) file for the
//
// C 63 ; WX 444 ; N question ; B 49 -14 395 676 ;
//
- // that means, we have a character with ascii code 63, and width
+ // that means, we have a character with ascii code 63, and width
// (444/1000 * fontSize) points.
// the other data is ignored for now!
//
// when the font has changed, we read in the right AFM file and store the
// character widths in an array, which is processed below (see point 3.).
-
+
// new elements JC Sun Aug 25 23:21:44 MET DST 1996
-
+
strcat(afmName,name);
strcat(afmName,".afm");
FILE *afmFile = fopen(afmName,"r");
if(lastDescender!=INT_MIN){
height += (long)(((-lastDescender)/1000.0F) * Size); /* MATTHEW: forgot scale */
}
-
+
// return size values
*x = widthSum;
*y = height;
#endif
}
-void wxPostScriptDC::DrawOpenSpline( wxList *points )
+void wxPostScriptDC::DrawSpline( wxList *points )
{
double a, b, c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q;
x3 = a = (double)(x1 + c) / 2;
y3 = b = (double)(y1 + d) / 2;
- *(GetStream()) << "newpath " << x1 << " " << GetYOrigin() - y1 << " moveto " << x3 << " " << GetYOrigin() - y3;
+ *(GetStream()) << "newpath " << x1 << " " << (GetYOrigin() - y1) << " moveto " << x3 << " " << (GetYOrigin() - y3);
*(GetStream()) << " lineto\n";
CalcBoundingBox( (long)x1, (long)(GetYOrigin() - y1));
CalcBoundingBox( (long)x3, (long)(GetYOrigin() - y3));
c = q->x; d = q->y;
x3 = (double)(x2 + c) / 2;
y3 = (double)(y2 + d) / 2;
- *(GetStream()) << x1 << " " << GetYOrigin() - y1 << " " << x2 << " " << GetYOrigin() - y2 << " ";
- *(GetStream()) << x3 << " " << GetYOrigin() - y3 << " DrawSplineSection\n";
+ *(GetStream()) << x1 << " " << (GetYOrigin() - y1) << " " << x2 << " " << (GetYOrigin() - y2) << " ";
+ *(GetStream()) << x3 << " " << (GetYOrigin() - y3) << " DrawSplineSection\n";
CalcBoundingBox( (long)x1, (long)(GetYOrigin() - y1));
CalcBoundingBox( (long)x3, (long)(GetYOrigin() - y3));
}
/*
- * At this point, (x2,y2) and (c,d) are the position of the
+ * At this point, (x2,y2) and (c,d) are the position of the
* next-to-last and last point respectively, in the point list
*/
- *(GetStream()) << c << " " << GetYOrigin() - d << " lineto stroke\n";
+ *(GetStream()) << c << " " << (GetYOrigin() - d) << " lineto stroke\n";
}
-long wxPostScriptDC::GetCharWidth (void)
+long wxPostScriptDC::GetCharWidth ()
{
// Chris Breeze: reasonable approximation using wxMODERN/Courier
return (long) (GetCharHeight() * 72.0 / 120.0);
if (device_y > m_maxY) m_maxY = device_y;
}
+#endif
+ // __WXGTK__
+
IMPLEMENT_CLASS(wxPostScriptPrintDialog, wxDialog)
wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style):
-wxDialog(parent, -1, title, pos, size, style)
+ wxDialog(parent, -1, title, pos, size, style)
{
- wxBeginBusyCursor();
- char buf[100];
+ wxBeginBusyCursor();
- wxButton *okBut = new wxButton (this, wxID_OK, _("OK"), wxPoint(5, 5));
- (void) new wxButton (this, wxID_CANCEL, _("Cancel"), wxPoint(40, 5));
- okBut->SetDefault();
+ char buf[100];
+ int yPos = 40;
+ wxString
+ *orientation = new wxString[2],
+ *print_modes = new wxString[3];
+ int features;
+ long wx_printer_translate_x, wx_printer_translate_y;
+ double wx_printer_scale_x, wx_printer_scale_y;
+
+ orientation[0] = _("Portrait");
+ orientation[1] = _("Landscape");
+
+ print_modes[0] = _("Send to Printer");
+ print_modes[1] = _("Print to File");
+ print_modes[2] = _("Preview Only");
- int yPos = 40;
-#if defined(__WXGTK__) || defined (__WXMOTIF__)
- (void) new wxStaticText( this, -1, _("Printer Command: "),
- wxPoint(5, yPos) );
- (void) new wxTextCtrl( this, wxID_PRINTER_COMMAND, wxThePrintSetupData->GetPrinterCommand(),
- wxPoint(100, yPos), wxSize(100, -1) );
- (void) new wxStaticText( this, -1, _("Printer Options: "),
- wxPoint(210, yPos) );
- (void) new wxTextCtrl( this, wxID_PRINTER_OPTIONS, wxThePrintSetupData->GetPrinterOptions(),
- wxPoint(305, yPos), wxSize(150, -1) );
+ wxButton *okBut = new wxButton (this, wxID_OK, _("OK"), wxPoint(5, 5));
+ (void) new wxButton (this, wxID_CANCEL, _("Cancel"), wxPoint(40, 5));
+ okBut->SetDefault();
+
+
+#if defined(__WXGTK__) || defined (__WXMOTIF__)
+ (void) new wxStaticText( this, -1, _("Printer Command: "),
+ wxPoint(5, yPos) );
+ (void) new wxTextCtrl( this, wxID_PRINTER_COMMAND, wxThePrintSetupData->GetPrinterCommand(),
+ wxPoint(100, yPos), wxSize(100, -1) );
+
+ (void) new wxStaticText( this, -1, _("Printer Options: "),
+ wxPoint(210, yPos) );
+ (void) new wxTextCtrl( this, wxID_PRINTER_OPTIONS, wxThePrintSetupData->GetPrinterOptions(),
+ wxPoint(305, yPos), wxSize(150, -1) );
- yPos += 40;
+ yPos += 40;
#endif
- wxString orientation[2];
- orientation[0] = _("Portrait");
- orientation[1] = _("Landscape");
- wxRadioBox *radio0 = new wxRadioBox(this, wxID_PRINTER_ORIENTATION, "Orientation: ", wxPoint(5, yPos), wxSize(-1,-1),
- 2,orientation,2,0);
- radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
+ wxRadioBox *radio0 = new wxRadioBox(this, wxID_PRINTER_ORIENTATION, "Orientation: ", wxPoint(5, yPos), wxSize(-1,-1),
+ 2,orientation,2,0);
+ radio0->SetSelection((int)wxThePrintSetupData->GetPrinterOrientation() - 1);
// @@@ Configuration hook
- if (wxThePrintSetupData->GetPrintPreviewCommand() == NULL)
- wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
+ if (wxThePrintSetupData->GetPrintPreviewCommand() == NULL)
+ wxThePrintSetupData->SetPrintPreviewCommand(PS_VIEWER_PROG);
- wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->previewCommand);
+ wxGetResource ("wxWindows", "PSView", &wxThePrintSetupData->previewCommand);
- wxString print_modes[3];
- print_modes[0] = _("Send to Printer");
- print_modes[1] = _("Print to File");
- print_modes[2] = _("Preview Only");
-
- int features = (wxThePrintSetupData->GetPrintPreviewCommand() && *wxThePrintSetupData->GetPrintPreviewCommand()) ? 3 : 2;
- wxRadioBox *radio1 = new wxRadioBox(this, wxID_PRINTER_MODES, _("PostScript:"),
- wxPoint(150, yPos), wxSize(-1,-1), features, print_modes, features, 0);
+ features = (wxThePrintSetupData->GetPrintPreviewCommand() &&
+ *wxThePrintSetupData->GetPrintPreviewCommand()) ? 3 : 2;
+
+ wxRadioBox *radio1 = new wxRadioBox(this, wxID_PRINTER_MODES, _("PostScript:"),
+ wxPoint(150, yPos),
+ wxSize(-1,-1), features,
+ print_modes, features, 0);
#ifdef __WXMSW__
- radio1->Enable(0, FALSE);
- if (wxThePrintSetupData->GetPrintPreviewCommand() && *wxThePrintSetupData->GetPrintPreviewCommand())
- radio1->Enable(2, FALSE);
+ radio1->Enable(0, FALSE);
+ if (wxThePrintSetupData->GetPrintPreviewCommand() && *wxThePrintSetupData->GetPrintPreviewCommand())
+ radio1->Enable(2, FALSE);
#endif
- radio1->SetSelection((int)wxThePrintSetupData->GetPrinterMode());
-
- long wx_printer_translate_x, wx_printer_translate_y;
- double wx_printer_scale_x, wx_printer_scale_y;
- wxThePrintSetupData->GetPrinterTranslation(&wx_printer_translate_x, &wx_printer_translate_y);
- wxThePrintSetupData->GetPrinterScaling(&wx_printer_scale_x, &wx_printer_scale_y);
-
- sprintf (buf, "%.2f", wx_printer_scale_x);
+ radio1->SetSelection((int)wxThePrintSetupData->GetPrinterMode());
+ wxThePrintSetupData->GetPrinterTranslation(&wx_printer_translate_x, &wx_printer_translate_y);
+ wxThePrintSetupData->GetPrinterScaling(&wx_printer_scale_x, &wx_printer_scale_y);
- yPos += 90;
+ sprintf (buf, "%.2f", wx_printer_scale_x);
- (void) new wxStaticText(this, -1, _("X Scaling"), wxPoint(5, yPos));
- /* wxTextCtrl *text1 = */ (void) new wxTextCtrl(this, wxID_PRINTER_X_SCALE, buf, wxPoint(100, yPos), wxSize(100, -1));
+ yPos += 90;
+ (void) new wxStaticText(this, -1, _("X Scaling"), wxPoint(5, yPos));
+ /* wxTextCtrl *text1 = */ (void) new wxTextCtrl(this, wxID_PRINTER_X_SCALE, buf, wxPoint(100, yPos), wxSize(100, -1));
- sprintf (buf, "%.2f", wx_printer_scale_y);
- (void) new wxStaticText(this, -1, _("Y Scaling"), wxPoint(220, yPos));
- /* wxTextCtrl *text2 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_SCALE, buf, wxPoint(320, yPos), wxSize(100, -1));
+ sprintf (buf, "%.2f", wx_printer_scale_y);
+ (void) new wxStaticText(this, -1, _("Y Scaling"), wxPoint(220, yPos));
+ /* wxTextCtrl *text2 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_SCALE, buf, wxPoint(320, yPos), wxSize(100, -1));
- yPos += 25;
+ yPos += 25;
- (void) new wxStaticText(this, -1, _("X Translation"), wxPoint(5, yPos));
- sprintf (buf, "%.2ld", wx_printer_translate_x);
- /* wxTextCtrl *text3 = */ (void) new wxTextCtrl(this, wxID_PRINTER_X_TRANS, buf, wxPoint(100, yPos), wxSize(100, -1));
+ (void) new wxStaticText(this, -1, _("X Translation"), wxPoint(5, yPos));
+ sprintf (buf, "%.2ld", wx_printer_translate_x);
+ /* wxTextCtrl *text3 = */ (void) new wxTextCtrl(this, wxID_PRINTER_X_TRANS, buf, wxPoint(100, yPos), wxSize(100, -1));
- (void) new wxStaticText(this, -1, _("Y Translation"), wxPoint(220, yPos));
- sprintf (buf, "%.2ld", wx_printer_translate_y);
- /* wxTextCtrl *text4 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_TRANS, buf, wxPoint(320, yPos), wxSize(100, -1));
+ (void) new wxStaticText(this, -1, _("Y Translation"), wxPoint(220, yPos));
+ sprintf (buf, "%.2ld", wx_printer_translate_y);
+ /* wxTextCtrl *text4 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_TRANS, buf, wxPoint(320, yPos), wxSize(100, -1));
+
+ Fit ();
- Fit ();
+ delete[] orientation;
+ delete[] print_modes;
- wxEndBusyCursor();
+ wxEndBusyCursor();
}
-int wxPostScriptPrintDialog::ShowModal (void)
+int wxPostScriptPrintDialog::ShowModal ()
{
if ( wxDialog::ShowModal() == wxID_OK )
{
}
// Get current values
-char *wxGetPrinterCommand(void)
+char *wxGetPrinterCommand()
{
return wxThePrintSetupData->GetPrinterCommand();
}
-char *wxGetPrintPreviewCommand(void)
+char *wxGetPrintPreviewCommand()
{
return wxThePrintSetupData->GetPrintPreviewCommand();
}
-char *wxGetPrinterOptions(void)
+char *wxGetPrinterOptions()
{
return wxThePrintSetupData->GetPrinterOptions();
}
-char *wxGetPrinterFile(void)
+char *wxGetPrinterFile()
{
return wxThePrintSetupData->GetPrinterFile();
}
-int wxGetPrinterOrientation(void)
+int wxGetPrinterOrientation()
{
return wxThePrintSetupData->GetPrinterOrientation();
}
wxThePrintSetupData->GetPrinterTranslation(x, y);
}
-int wxGetPrinterMode(void)
+int wxGetPrinterMode()
{
return wxThePrintSetupData->GetPrinterMode();
}
-char *wxGetAFMPath(void)
+char *wxGetAFMPath()
{
return wxThePrintSetupData->GetAFMPath();
}
* Print setup data
*/
-wxPrintSetupData::wxPrintSetupData(void)
+wxPrintSetupData::wxPrintSetupData()
{
printerCommand = (char *) NULL;
previewCommand = (char *) NULL;
printerFile = (char *) NULL;
}
-wxPrintSetupData::~wxPrintSetupData(void)
+wxPrintSetupData::~wxPrintSetupData()
{
if (printerCommand)
delete[] printerCommand;
{
if (cmd == previewCommand)
return;
-
+
if (previewCommand)
delete[] previewCommand;
if (cmd)
{
if (printerFlags == flags)
return;
-
+
if (printerFlags)
delete[] printerFlags;
if (flags)
{
if (f == printerFile)
return;
-
+
if (printerFile)
delete[] printerFile;
if (f)
{
if (f == afmPath)
return;
-
+
if (afmPath)
delete[] afmPath;
if (f)
}
// Get current values
-char *wxPrintSetupData::GetPrinterCommand(void)
+char *wxPrintSetupData::GetPrinterCommand()
{
return printerCommand;
}
-char *wxPrintSetupData::GetPrintPreviewCommand(void)
+char *wxPrintSetupData::GetPrintPreviewCommand()
{
return previewCommand;
}
-char *wxPrintSetupData::GetPrinterOptions(void)
+char *wxPrintSetupData::GetPrinterOptions()
{
return printerFlags;
}
-char *wxPrintSetupData::GetPrinterFile(void)
+char *wxPrintSetupData::GetPrinterFile()
{
return printerFile;
}
-char *wxPrintSetupData::GetPaperName(void)
+char *wxPrintSetupData::GetPaperName()
{
return paperName;
}
-int wxPrintSetupData::GetPrinterOrientation(void)
+int wxPrintSetupData::GetPrinterOrientation()
{
return printerOrient;
}
*y = printerTranslateY;
}
-int wxPrintSetupData::GetPrinterMode(void)
+int wxPrintSetupData::GetPrinterMode()
{
return printerMode;
}
-char *wxPrintSetupData::GetAFMPath(void)
+char *wxPrintSetupData::GetAFMPath()
{
return afmPath;
}
-bool wxPrintSetupData::GetColour(void)
+bool wxPrintSetupData::GetColour()
{
return printColour;
}
pageName = copystring(name);
}
-wxPrintPaperType::~wxPrintPaperType(void)
+wxPrintPaperType::~wxPrintPaperType()
{
delete[] pageName;
}
-wxPrintPaperDatabase::wxPrintPaperDatabase(void):wxList(wxKEY_STRING)
+/*
+ * Print paper database for PostScript
+ */
+
+#if !USE_SHARED_LIBRARIES
+IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
+#endif
+
+wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING)
{
DeleteContents(TRUE);
}
-wxPrintPaperDatabase::~wxPrintPaperDatabase(void)
+wxPrintPaperDatabase::~wxPrintPaperDatabase()
{
}
-void wxPrintPaperDatabase::CreateDatabase(void)
+void wxPrintPaperDatabase::CreateDatabase()
{
// Need correct values for page size in pixels.
// Each unit is one 'point' = 1/72 of an inch.
// Can't remember where the PostScript origin is by default.
// Heck, someone will know how to make it hunky-dory...
// JACS 25/5/95
-
+
AddPaperType(_("A4 210 x 297 mm"), 210, 297, 595, 842);
AddPaperType(_("A3 297 x 420 mm"), 297, 420, 842, 1191);
AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279, 612, 791);
AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 612, 1009);
+
+/*
+ This is for 100 ppi
+
+ AddPaperType(_("A4 210 x 297 mm"), 210, 297, 210*4, 297*4 );
+ AddPaperType(_("A3 297 x 420 mm"), 297, 420, 297*4, 420*4 );
+ AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279, 216*4, 279*4 );
+ AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356, 216*4, 356*4 );
+*/
}
-void wxPrintPaperDatabase::ClearDatabase(void)
+void wxPrintPaperDatabase::ClearDatabase()
{
Clear();
}
return (wxPrintPaperType *) NULL;
}
+/*
+ * Initialization/cleanup module
+ */
+
+bool wxPostScriptModule::OnInit()
+{
+ wxInitializePrintSetupData();
+ wxThePrintPaperDatabase = new wxPrintPaperDatabase;
+ wxThePrintPaperDatabase->CreateDatabase();
+
+ return TRUE;
+}
+
+void wxPostScriptModule::OnExit()
+{
+ wxInitializePrintSetupData(FALSE);
+ delete wxThePrintPaperDatabase;
+ wxThePrintPaperDatabase = NULL;
+}
+
+
#endif