X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/36b3b54ad8431bca0fa53fa8acae5ba6d4c3e9c7..debdd17e991830c4ced82f5e4672fe2b32a684c2:/src/generic/dcpsg.cpp diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 60758bcb9b..f592a769c8 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -335,12 +335,13 @@ bool wxPostScriptDC::PrinterDialog(wxWindow *parent) } else if ((m_filename == "") && (wxThePrintSetupData->GetPrinterMode() == PS_FILE)) { - char *file = wxSaveFileSelector (_("PostScript"), "ps"); - if (!file) + wxString file = wxSaveFileSelector (_("PostScript"), "ps"); + if ( file.IsEmpty() ) { m_ok = FALSE; return FALSE; } + wxThePrintSetupData->SetPrinterFile(file); m_filename = file; m_ok = TRUE; @@ -1464,20 +1465,32 @@ void wxPostScriptDC::EndPage () *m_pstream << "showpage\n"; } -bool wxPostScriptDC::Blit( long WXUNUSED(xdest), long WXUNUSED(ydest), - long WXUNUSED(fwidth), long WXUNUSED(fheight), - wxDC *WXUNUSED(source), - long WXUNUSED(xsrc), long WXUNUSED(ysrc), - int WXUNUSED(rop), bool WXUNUSED(useMask) ) +bool wxPostScriptDC::Blit( long xdest, long ydest, + long fwidth, long fheight, + wxDC *source, + long xsrc, long ysrc, + int rop, bool WXUNUSED(useMask) ) { wxCHECK_MSG( m_ok && m_pstream, FALSE, "invalid postscript dc" ); - wxFAIL_MSG( "wxPostScriptDC::Blit no yet implemented." ); + wxCHECK_MSG( source, FALSE, "invalid source dc" ); + + /* blit into a bitmap */ + + wxBitmap bitmap( fwidth, fheight ); + wxMemoryDC memDC; + memDC.SelectObject(bitmap); + memDC.Blit(0, 0, fwidth, fheight, source, xsrc, ysrc, rop); /* TODO: Blit transparently? */ + memDC.SelectObject(wxNullBitmap); + + /* draw bitmap. scaling and positioning is done there */ + + DrawBitmap( bitmap, xdest, ydest ); return TRUE; } -long wxPostScriptDC::GetCharHeight () +long wxPostScriptDC::GetCharHeight() { if (m_font.Ok()) return m_font.GetPointSize(); @@ -1485,9 +1498,9 @@ long wxPostScriptDC::GetCharHeight () return 12; } -void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, - long *descent, long *externalLeading, wxFont *theFont, - bool WXUNUSED(use16)) +void wxPostScriptDC::GetTextExtent( const wxString& string, long *x, long *y, + long *descent, long *externalLeading, wxFont *theFont, + bool WXUNUSED(use16) ) { wxFont *fontToUse = theFont; @@ -1599,7 +1612,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y, if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "HelvBoO"; else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "HelvBo"; else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "Helv0"; - else if ((Style != wxITALIC) && (Weight != wxBOLD)) name = "Helv"; + else name = "Helv"; } break; }