X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/649707a5062d67b3ebd4f56ccfabc2e09703faef..d76a558d4d5216b0590907b92d3182f82057c1ae:/src/gtk/gnome/gprint.cpp diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index 2b6b50d6b8..6c947a9664 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -15,10 +15,10 @@ #pragma hdrstop #endif -#include "wx/gtk/gnome/gprint.h" - #if wxUSE_LIBGNOMEPRINT +#include "wx/gtk/gnome/gprint.h" + #ifndef WX_PRECOMP #include "wx/log.h" #include "wx/dcmemory.h" @@ -42,8 +42,8 @@ static const double RAD2DEG = 180.0 / M_PI; -#include "wx/html/forcelnk.h" -FORCE_LINK_ME(gnome_print) +#include "wx/link.h" +wxFORCE_LINK_THIS_MODULE(gnome_print) //---------------------------------------------------------------------------- // wxGnomePrintLibrary @@ -171,6 +171,8 @@ public: wxDL_METHOD_DEFINE( GtkWidget*, gnome_print_job_preview_new, (GnomePrintJob *gpm, const guchar *title), (gpm, title), NULL ) + + DECLARE_NO_COPY_CLASS(wxGnomePrintLibrary) }; wxGnomePrintLibrary::wxGnomePrintLibrary() @@ -715,7 +717,8 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) { gs_lgp->gnome_print_job_close( job ); g_object_unref (job); - sm_lastError = wxPRINTER_ERROR; + if (sm_lastError != wxPRINTER_CANCELLED) + sm_lastError = wxPRINTER_ERROR; return false; } @@ -846,6 +849,7 @@ wxGnomePrintDC::wxGnomePrintDC( wxGnomePrinter *printer ) m_layout = gs_lgp->gnome_print_pango_create_layout( m_gpc ); m_fontdesc = pango_font_description_from_string( "Sans 12" ); + m_context = NULL; m_currentRed = 0; m_currentBlue = 0; @@ -853,7 +857,7 @@ wxGnomePrintDC::wxGnomePrintDC( wxGnomePrinter *printer ) m_signX = 1; // default x-axis left to right m_signY = -1; // default y-axis bottom up -> top down - + GetSize( NULL, &m_deviceOffsetY ); } @@ -871,14 +875,15 @@ wxGnomePrintDC::wxGnomePrintDC( const wxPrintData& data ) m_layout = gs_lgp->gnome_print_pango_create_layout( m_gpc ); m_fontdesc = pango_font_description_from_string( "Sans 12" ); + m_context = NULL; m_currentRed = 0; m_currentBlue = 0; m_currentGreen = 0; m_signX = 1; // default x-axis left to right - m_signY = -1; // default y-axis bottom up -> top down - + m_signY = -1; // default y-axis bottom up -> top down + GetSize( NULL, &m_deviceOffsetY ); } @@ -952,25 +957,25 @@ void wxGnomePrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoo while (alpha2 > 360) alpha2 -= 360; } - if (m_brush.GetStyle() != wxTRANSPARENT) - { - SetBrush( m_brush ); - gs_lgp->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) ); - gs_lgp->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 ); + if (m_brush.GetStyle() != wxTRANSPARENT) + { + SetBrush( m_brush ); + gs_lgp->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) ); + gs_lgp->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 ); - gs_lgp->gnome_print_fill( m_gpc ); - } + gs_lgp->gnome_print_fill( m_gpc ); + } - if (m_pen.GetStyle() != wxTRANSPARENT) - { - SetPen (m_pen); - gs_lgp->gnome_print_newpath( m_gpc ); - gs_lgp->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) ); - gs_lgp->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 ); - gs_lgp->gnome_print_closepath( m_gpc ); + if (m_pen.GetStyle() != wxTRANSPARENT) + { + SetPen (m_pen); + gs_lgp->gnome_print_newpath( m_gpc ); + gs_lgp->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) ); + gs_lgp->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 ); + gs_lgp->gnome_print_closepath( m_gpc ); - gs_lgp->gnome_print_stroke( m_gpc ); - } + gs_lgp->gnome_print_stroke( m_gpc ); + } CalcBoundingBox (x1, y1); CalcBoundingBox (x2, y2); @@ -1713,7 +1718,7 @@ wxCoord wxGnomePrintDC::GetCharWidth() const void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading, - wxFont *theFont ) const + const wxFont *theFont ) const { if ( width ) *width = 0; @@ -1828,6 +1833,16 @@ void wxGnomePrintDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) ComputeScaleAndOrigin(); } +void wxGnomePrintDC::SetLogicalOrigin( wxCoord x, wxCoord y ) +{ + wxDC::SetLogicalOrigin( x, y ); +} + +void wxGnomePrintDC::SetDeviceOrigin( wxCoord x, wxCoord y ) +{ + wxDC::SetDeviceOrigin( x, y ); +} + void wxGnomePrintDC::SetResolution(int ppi) { } @@ -1925,7 +1940,7 @@ void wxGnomePrintPreview::DetermineScaling() m_previewPrintout->SetPPIPrinter(wxGnomePrintDC::GetResolution(), wxGnomePrintDC::GetResolution()); wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); - + // TODO: get better resolution information from wxGnomePrintDC, if possible. sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxGnomePrintDC::GetResolution() / 72.0);