X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5bfe9bbc658328942c516f30a454c8a955e1391e..9406d962ccf50d63f163896a2dd94123a2a8664a:/src/common/postscrp.cpp diff --git a/src/common/postscrp.cpp b/src/common/postscrp.cpp index d36e6fa015..bee66a51cf 100644 --- a/src/common/postscrp.cpp +++ b/src/common/postscrp.cpp @@ -44,7 +44,7 @@ #include "wx/dcmemory.h" -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #include "wx/msw/private.h" #endif @@ -62,7 +62,7 @@ #include #include -#ifdef __GTK__ +#ifdef __WXGTK__ #include "gdk/gdkx.h" // GDK_DISPLAY #include "gdk/gdkprivate.h" // XImage @@ -71,7 +71,7 @@ #endif -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #ifdef DrawText #undef DrawText @@ -105,7 +105,7 @@ // SGI's Display Postscript Previewer //# define PS_VIEWER_PROG "dps" # define PS_VIEWER_PROG "xpsview" -#elif defined(__X__) || defined(__GTK__) +#elif defined(__X__) || defined(__WXGTK__) // Front-end to ghostscript # define PS_VIEWER_PROG "ghostview" #else @@ -175,7 +175,7 @@ wxPostScriptDC::wxPostScriptDC (void) m_pstream = NULL; -#ifdef __WINDOWS__ +#ifdef __WXMSW__ // Can only send to file in Windows wxThePrintSetupData->SetPrinterMode(PS_FILE); #endif @@ -205,7 +205,7 @@ bool wxPostScriptDC::Create(const wxString& file, bool interactive, wxWindow *pa m_filename = file; m_pstream = NULL; -#ifdef __WINDOWS__ +#ifdef __WXMSW__ // Can only send to file in Windows wxThePrintSetupData->SetPrinterMode(PS_FILE); #endif @@ -669,7 +669,7 @@ void wxPostScriptDC::DrawEllipse (long x, long y, long width, long height) void wxPostScriptDC::DrawIcon (const wxIcon& icon, long x, long y) { -#if defined(__X__) || defined(__GTK__) +#if defined(__X__) || defined(__WXGTK__) wxMemoryDC memDC; memDC.SelectObject(icon); Blit(x, y, icon.GetWidth(), icon.GetHeight(), &memDC, 0, 0); @@ -690,8 +690,8 @@ void wxPostScriptDC::SetFont (const wxFont& the_font) return; char buf[100]; - char *name; - char *style = ""; + const char *name; + const char *style = ""; int Style = m_font.GetStyle (); int Weight = m_font.GetWeight (); @@ -790,12 +790,12 @@ void wxPostScriptDC::SetPen (const wxPen& pen) will be first black line *2* units long, then space 4 units, then the pattern of *3* units black, 4 units space will be repeated. */ - static char *dotted = "[2 5] 2"; - static char *short_dashed = "[4 4] 2"; - static char *long_dashed = "[4 8] 2"; - static char *dotted_dashed = "[6 6 2 6] 4"; + static const char *dotted = "[2 5] 2"; + static const char *short_dashed = "[4 4] 2"; + static const char *long_dashed = "[4 8] 2"; + static const char *dotted_dashed = "[6 6 2 6] 4"; - char *psdash = NULL; + const char *psdash = NULL; switch (m_pen.GetStyle ()) { case wxDOT: @@ -1272,7 +1272,7 @@ void wxPostScriptDC::EndDoc (void) wxRemoveFile (wxThePrintSetupData->GetPrinterFile()); wxRenameFile(tmp_file, wxThePrintSetupData->GetPrinterFile()); -#if defined(__X__) || defined(__GTK__) +#if defined(__X__) || defined(__WXGTK__) if (m_ok) { switch (wxThePrintSetupData->GetPrinterMode()) { @@ -1406,7 +1406,7 @@ Blit (long xdest, long ydest, long fwidth, long fheight, { long width, height, x, y; -#if !defined(__X__) && !defined(__GTK__) +#if !defined(__X__) && !defined(__WXGTK__) return FALSE; #endif @@ -1428,7 +1428,7 @@ Blit (long xdest, long ydest, long fwidth, long fheight, *m_pstream << " currentfile DataString readhexstring pop\n"; *m_pstream << "} bind image\n"; -#if defined(__X__) || defined(__GTK__) +#if defined(__X__) || defined(__WXGTK__) /* Output data as hex digits: */ Display *d; @@ -1437,7 +1437,7 @@ Blit (long xdest, long ydest, long fwidth, long fheight, long j, i; char s[3]; -#ifdef __GTK__ +#ifdef __WXGTK__ d = gdk_display; cm = ((GdkColormapPrivate*)gdk_colormap_get_system())->xcolormap; @@ -1446,7 +1446,7 @@ Blit (long xdest, long ydest, long fwidth, long fheight, #else -#ifdef __MOTIF__ +#ifdef __WXMOTIF__ d = source->display; #else d = wxGetDisplay(); @@ -1640,7 +1640,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, // 1. construct filename ****************************************** /* MATTHEW: [2] Use wxTheFontNameDirectory */ - char *name; + const char *name; // Julian - we'll need to do this a different way now we've removed the // font directory system. Must find Stefan's original code. @@ -1983,7 +1983,7 @@ long wxPostScriptDC::LogicalToDeviceYRel (long y) const void wxPostScriptDC::GetSize(int* width, int* height) const { - char *paperType = wxThePrintSetupData->GetPaperName(); + const char *paperType = wxThePrintSetupData->GetPaperName(); if (!paperType) paperType = "A4 210 x 297 mm"; @@ -2004,7 +2004,7 @@ void wxPostScriptDC::GetSize(int* width, int* height) const void wxPostScriptDC::GetSizeMM(long *width, long *height) const { - char *paperType = wxThePrintSetupData->GetPaperName(); + const char *paperType = wxThePrintSetupData->GetPaperName(); if (!paperType) paperType = "A4 210 x 297 mm"; @@ -2037,7 +2037,7 @@ void wxPostScriptDC::CalcBoundingBox(long x, long y) IMPLEMENT_CLASS(wxPostScriptPrintDialog, wxDialog) wxPostScriptPrintDialog::wxPostScriptPrintDialog (wxWindow *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, const long style): + const wxPoint& pos, const wxSize& size, long style): wxDialog(parent, -1, title, pos, size, style) { wxBeginBusyCursor(); @@ -2047,16 +2047,16 @@ wxDialog(parent, -1, title, pos, size, style) (void) new wxButton (this, wxID_CANCEL, _("Cancel"), wxPoint(40, 5)); okBut->SetDefault(); - int yPos = 30; + int yPos = 40; -#ifdef __X__ - (void) new wxStaticText(this, -1, "Printer Command: ", wxPoint(5, yPos)); +#if defined(__WXGTK__) || defined (__WXMOTIF__) + (void) new wxStaticText(this, -1, _("Printer Command: "), wxPoint(5, yPos)); wxTextCtrl *text_prt = new wxTextCtrl(this, wxID_PRINTER_COMMAND, wxThePrintSetupData->GetPrinterCommand(), wxPoint(100, yPos), wxSize(100, -1)); - + (void) new wxStaticText(this, -1, "Printer Options: ", wxPoint(210, yPos)); - wxTextCtrl *text0 = new wxTextCtrl(this, wxID_PRINTER_OPTIONS, wxThePrintSetupData->GetPrinterOptions(), wxPoint(305, -1), wxSize(150, -1)); + wxTextCtrl *text0 = new wxTextCtrl(this, wxID_PRINTER_OPTIONS, wxThePrintSetupData->GetPrinterOptions(), wxPoint(305, yPos), wxSize(150, -1)); - yPos += 25; + yPos += 40; #endif wxString orientation[2]; @@ -2082,7 +2082,7 @@ wxDialog(parent, -1, title, pos, size, style) wxRadioBox *radio1 = new wxRadioBox(this, wxID_PRINTER_MODES, "PostScript:", wxPoint(150, yPos), wxSize(-1,-1), features, print_modes, features, 0); -#ifdef __WINDOWS__ +#ifdef __WXMSW__ radio1->Enable(0, FALSE); if (wxThePrintSetupData->GetPrintPreviewCommand() && *wxThePrintSetupData->GetPrintPreviewCommand()) radio1->Enable(2, FALSE); @@ -2097,24 +2097,24 @@ wxDialog(parent, -1, title, pos, size, style) sprintf (buf, "%.2f", wx_printer_scale_x); - yPos += 60; + 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, -1), wxSize(100, -1)); + /* 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(120, yPos)); - /* wxTextCtrl *text2 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_SCALE, buf, wxPoint(230, -1), wxSize(100, -1)); + (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; (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, -1), wxSize(100, -1)); + /* 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(120, yPos)); + (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(230, -1), wxSize(100, -1)); + /* wxTextCtrl *text4 = */ (void) new wxTextCtrl(this, wxID_PRINTER_Y_TRANS, buf, wxPoint(320, yPos), wxSize(100, -1)); Fit (); @@ -2148,9 +2148,9 @@ int wxPostScriptPrintDialog::ShowModal (void) // C++ wants this switch ( radio1->GetSelection() ) { - case PS_PREVIEW: wxThePrintSetupData->SetPrinterMode(PS_PREVIEW); break; - case PS_FILE: wxThePrintSetupData->SetPrinterMode(PS_FILE); break; - case PS_PRINTER: wxThePrintSetupData->SetPrinterMode(PS_PRINTER); break; + case 0: wxThePrintSetupData->SetPrinterMode(PS_PRINTER); break; + case 1: wxThePrintSetupData->SetPrinterMode(PS_FILE); break; + case 2: wxThePrintSetupData->SetPrinterMode(PS_PREVIEW); break; } return wxID_OK; } @@ -2491,12 +2491,12 @@ void wxInitializePrintSetupData(bool init) wxThePrintSetupData->SetPrinterOptions("/nonotify/queue=psqueue"); wxThePrintSetupData->SetAFMPath("sys$ps_font_metrics:"); #endif -#ifdef __WINDOWS__ +#ifdef __WXMSW__ wxThePrintSetupData->SetPrinterCommand("print"); wxThePrintSetupData->SetAFMPath("c:\\windows\\system\\"); wxThePrintSetupData->SetPrinterOptions(NULL); #endif -#if !defined(__VMS__) && !defined(__WINDOWS__) +#if !defined(__VMS__) && !defined(__WXMSW__) wxThePrintSetupData->SetPrinterCommand("lpr"); wxThePrintSetupData->SetPrinterOptions(NULL); wxThePrintSetupData->SetAFMPath(NULL); @@ -2565,7 +2565,7 @@ void wxPrintPaperDatabase::AddPaperType(char *name, int wmm, int hmm, int wp, in Append(name, new wxPrintPaperType(name, wmm, hmm, wp, hp)); } -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(char *name) +wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const char *name) { wxNode *node = Find(name); if (node)