wxUSE_SPLINES markup and other cleanings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-09-15 15:26:27 +00:00
parent b11729f149
commit 389076f148
6 changed files with 570 additions and 555 deletions

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dcps.h // Name: wx/generic/dcps.h
// Purpose: wxPostScriptDC class // Purpose: wxPostScriptDC class
// Author: Julian Smart and others // Author: Julian Smart and others
// Modified by: // Modified by:
@@ -66,8 +66,9 @@ public:
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(wxList *points); void DoDrawSpline(wxList *points);
#endif // wxUSE_SPLINES
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);

View File

@@ -1,8 +1,9 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gprint.h // Name: wx/gtk/gnome/gprint.h
// Author: Robert Roebling // Author: Robert Roebling
// Purpose: GNOME printing support // Purpose: GNOME printing support
// Created: 09/20/04 // Created: 09/20/04
// RCS-ID: $Id$
// Copyright: Robert Roebling // Copyright: Robert Roebling
// Licence: wxWindows Licence // Licence: wxWindows Licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -223,7 +224,9 @@ public:
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0); void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(wxList *points); void DoDrawSpline(wxList *points);
#endif // wxUSE_SPLINES
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,

View File

@@ -1,8 +1,9 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gprint.h // Name: wx/gtk/gnome/gprint.h
// Author: Robert Roebling // Author: Robert Roebling
// Purpose: GNOME printing support // Purpose: GNOME printing support
// Created: 09/20/04 // Created: 09/20/04
// RCS-ID: $Id$
// Copyright: Robert Roebling // Copyright: Robert Roebling
// Licence: wxWindows Licence // Licence: wxWindows Licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -223,7 +224,9 @@ public:
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0); void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(wxList *points); void DoDrawSpline(wxList *points);
#endif // wxUSE_SPLINES
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dcpsg.cpp // Name: src/generic/dcpsg.cpp
// Purpose: Generic wxPostScriptDC implementation // Purpose: Generic wxPostScriptDC implementation
// Author: Julian Smart, Robert Roebling, Markus Holzhem // Author: Julian Smart, Robert Roebling, Markus Holzhem
// Modified by: // Modified by:
@@ -1385,6 +1385,7 @@ void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function))
wxFAIL_MSG( wxT("wxPostScriptDC::SetLogicalFunction not implemented.") ); wxFAIL_MSG( wxT("wxPostScriptDC::SetLogicalFunction not implemented.") );
} }
#if wxUSE_SPLINES
void wxPostScriptDC::DoDrawSpline( wxList *points ) void wxPostScriptDC::DoDrawSpline( wxList *points )
{ {
wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -1459,6 +1460,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
wxT("stroke\n"), wxT("stroke\n"),
LogicalToDeviceX((wxCoord)c), LogicalToDeviceY((wxCoord)d) ); LogicalToDeviceX((wxCoord)c), LogicalToDeviceY((wxCoord)d) );
} }
#endif // wxUSE_SPLINES
wxCoord wxPostScriptDC::GetCharWidth() const wxCoord wxPostScriptDC::GetCharWidth() const
{ {

View File

@@ -1,8 +1,9 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gprint.cpp // Name: src/gtk/gnome/gprint.cpp
// Author: Robert Roebling // Author: Robert Roebling
// Purpose: Implement GNOME printing support // Purpose: Implement GNOME printing support
// Created: 09/20/04 // Created: 09/20/04
// RCS-ID: $Id$
// Copyright: Robert Roebling // Copyright: Robert Roebling
// Licence: wxWindows Licence // Licence: wxWindows Licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -451,7 +452,7 @@ int wxGnomePrintDialog::ShowModal()
int response = gtk_dialog_run (GTK_DIALOG (m_widget)); int response = gtk_dialog_run (GTK_DIALOG (m_widget));
if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL) if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL)
{ {
gtk_widget_destroy(m_widget); gtk_widget_destroy(m_widget);
m_widget = NULL; m_widget = NULL;
@@ -546,15 +547,15 @@ wxGnomePageSetupDialog::wxGnomePageSetupDialog( wxWindow *parent,
gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main ); gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main );
gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE); gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (m_widget), gtk_dialog_add_buttons (GTK_DIALOG (m_widget),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_default_response (GTK_DIALOG (m_widget), gtk_dialog_set_default_response (GTK_DIALOG (m_widget),
GTK_RESPONSE_OK); GTK_RESPONSE_OK);
} }
wxGnomePageSetupDialog::~wxGnomePageSetupDialog() wxGnomePageSetupDialog::~wxGnomePageSetupDialog()
@@ -584,18 +585,18 @@ int wxGnomePageSetupDialog::ShowModal()
// I cannot test it as the dialog is currently broken // I cannot test it as the dialog is currently broken
// anyways (it only works for points). // anyways (it only works for points).
double ml,mr,mt,mb,pw,ph; double ml,mr,mt,mb,pw,ph;
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &ml, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &ml, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &mr, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &mr, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &mt, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &mt, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &mb, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &mb, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAPER_WIDTH, &pw, NULL); (const guchar*) GNOME_PRINT_KEY_PAPER_WIDTH, &pw, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAPER_HEIGHT, &ph, NULL); (const guchar*) GNOME_PRINT_KEY_PAPER_HEIGHT, &ph, NULL);
// This probably assumes that the user entered the // This probably assumes that the user entered the
// values in Pts. Since that is the only the dialog // values in Pts. Since that is the only the dialog
@@ -1098,24 +1099,24 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
gs_lgp->gnome_print_newpath(m_gpc); gs_lgp->gnome_print_newpath(m_gpc);
gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + rad),YLOG2DEV(y), XLOG2DEV(x + rad),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y), XLOG2DEV(x),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y + rad)); XLOG2DEV(x),YLOG2DEV(y + rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x),YLOG2DEV(y + height - rad), XLOG2DEV(x),YLOG2DEV(y + height - rad),
XLOG2DEV(x),YLOG2DEV(y + height), XLOG2DEV(x),YLOG2DEV(y + height),
XLOG2DEV(x + rad),YLOG2DEV(y + height)); XLOG2DEV(x + rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width - rad),YLOG2DEV(y + height), XLOG2DEV(x + width - rad),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height), XLOG2DEV(x + width),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height - rad)); XLOG2DEV(x + width),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width),YLOG2DEV(y + rad), XLOG2DEV(x + width),YLOG2DEV(y + rad),
XLOG2DEV(x + width),YLOG2DEV(y), XLOG2DEV(x + width),YLOG2DEV(y),
XLOG2DEV(x + width - rad),YLOG2DEV(y)); XLOG2DEV(x + width - rad),YLOG2DEV(y));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_closepath(m_gpc); gs_lgp->gnome_print_closepath(m_gpc);
gs_lgp->gnome_print_fill(m_gpc); gs_lgp->gnome_print_fill(m_gpc);
@@ -1130,24 +1131,24 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
gs_lgp->gnome_print_newpath(m_gpc); gs_lgp->gnome_print_newpath(m_gpc);
gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + rad),YLOG2DEV(y), XLOG2DEV(x + rad),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y), XLOG2DEV(x),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y + rad)); XLOG2DEV(x),YLOG2DEV(y + rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x),YLOG2DEV(y + height - rad), XLOG2DEV(x),YLOG2DEV(y + height - rad),
XLOG2DEV(x),YLOG2DEV(y + height), XLOG2DEV(x),YLOG2DEV(y + height),
XLOG2DEV(x + rad),YLOG2DEV(y + height)); XLOG2DEV(x + rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width - rad),YLOG2DEV(y + height), XLOG2DEV(x + width - rad),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height), XLOG2DEV(x + width),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height - rad)); XLOG2DEV(x + width),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width),YLOG2DEV(y + rad), XLOG2DEV(x + width),YLOG2DEV(y + rad),
XLOG2DEV(x + width),YLOG2DEV(y), XLOG2DEV(x + width),YLOG2DEV(y),
XLOG2DEV(x + width - rad),YLOG2DEV(y)); XLOG2DEV(x + width - rad),YLOG2DEV(y));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_closepath(m_gpc); gs_lgp->gnome_print_closepath(m_gpc);
gs_lgp->gnome_print_stroke(m_gpc); gs_lgp->gnome_print_stroke(m_gpc);
@@ -1212,6 +1213,7 @@ void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord
} }
} }
#if wxUSE_SPLINES
void wxGnomePrintDC::DoDrawSpline(wxList *points) void wxGnomePrintDC::DoDrawSpline(wxList *points)
{ {
SetPen (m_pen); SetPen (m_pen);
@@ -1269,6 +1271,7 @@ void wxGnomePrintDC::DoDrawSpline(wxList *points)
gs_lgp->gnome_print_stroke( m_gpc ); gs_lgp->gnome_print_stroke( m_gpc );
} }
#endif // wxUSE_SPLINES
bool wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask,
@@ -1301,22 +1304,22 @@ void wxGnomePrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y,
if (bitmap.HasPixbuf()) if (bitmap.HasPixbuf())
{ {
GdkPixbuf *pixbuf = bitmap.GetPixbuf(); GdkPixbuf *pixbuf = bitmap.GetPixbuf();
guchar *raw_image = gdk_pixbuf_get_pixels( pixbuf ); guchar *raw_image = gdk_pixbuf_get_pixels( pixbuf );
bool has_alpha = gdk_pixbuf_get_has_alpha( pixbuf ); bool has_alpha = gdk_pixbuf_get_has_alpha( pixbuf );
int rowstride = gdk_pixbuf_get_rowstride( pixbuf ); int rowstride = gdk_pixbuf_get_rowstride( pixbuf );
int height = gdk_pixbuf_get_height( pixbuf ); int height = gdk_pixbuf_get_height( pixbuf );
int width = gdk_pixbuf_get_width( pixbuf ); int width = gdk_pixbuf_get_width( pixbuf );
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
double matrix[6]; double matrix[6];
matrix[0] = XLOG2DEVREL(width); matrix[0] = XLOG2DEVREL(width);
matrix[1] = 0; matrix[1] = 0;
matrix[2] = 0; matrix[2] = 0;
matrix[3] = YLOG2DEVREL(height); matrix[3] = YLOG2DEVREL(height);
matrix[4] = XLOG2DEV(x); matrix[4] = XLOG2DEV(x);
matrix[5] = YLOG2DEV(y+height); matrix[5] = YLOG2DEV(y+height);
gs_lgp->gnome_print_concat( m_gpc, matrix ); gs_lgp->gnome_print_concat( m_gpc, matrix );
gs_lgp->gnome_print_moveto( m_gpc, 0, 0 ); gs_lgp->gnome_print_moveto( m_gpc, 0, 0 );
if (has_alpha) if (has_alpha)
gs_lgp->gnome_print_rgbaimage( m_gpc, (guchar *)raw_image, width, height, rowstride ); gs_lgp->gnome_print_rgbaimage( m_gpc, (guchar *)raw_image, width, height, rowstride );
else else
@@ -1331,14 +1334,14 @@ void wxGnomePrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y,
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
double matrix[6]; double matrix[6];
matrix[0] = XLOG2DEVREL(image.GetWidth()); matrix[0] = XLOG2DEVREL(image.GetWidth());
matrix[1] = 0; matrix[1] = 0;
matrix[2] = 0; matrix[2] = 0;
matrix[3] = YLOG2DEVREL(image.GetHeight()); matrix[3] = YLOG2DEVREL(image.GetHeight());
matrix[4] = XLOG2DEV(x); matrix[4] = XLOG2DEV(x);
matrix[5] = YLOG2DEV(y+image.GetHeight()); matrix[5] = YLOG2DEV(y+image.GetHeight());
gs_lgp->gnome_print_concat( m_gpc, matrix ); gs_lgp->gnome_print_concat( m_gpc, matrix );
gs_lgp->gnome_print_moveto( m_gpc, 0, 0 ); gs_lgp->gnome_print_moveto( m_gpc, 0, 0 );
gs_lgp->gnome_print_rgbimage( m_gpc, (guchar*) image.GetData(), image.GetWidth(), image.GetHeight(), image.GetWidth()*3 ); gs_lgp->gnome_print_rgbimage( m_gpc, (guchar*) image.GetData(), image.GetWidth(), image.GetHeight(), image.GetWidth()*3 );
gs_lgp->gnome_print_grestore( m_gpc ); gs_lgp->gnome_print_grestore( m_gpc );
} }
@@ -1425,17 +1428,17 @@ void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord
} }
#endif #endif
// Draw layout. // Draw layout.
gs_lgp->gnome_print_moveto (m_gpc, x, y); gs_lgp->gnome_print_moveto (m_gpc, x, y);
if (fabs(angle) > 0.00001) if (fabs(angle) > 0.00001)
{ {
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
gs_lgp->gnome_print_rotate( m_gpc, angle ); gs_lgp->gnome_print_rotate( m_gpc, angle );
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
gs_lgp->gnome_print_grestore( m_gpc ); gs_lgp->gnome_print_grestore( m_gpc );
} }
else else
{ {
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
} }
// reset unscaled size // reset unscaled size
@@ -1456,17 +1459,17 @@ void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord
} }
#endif #endif
// Draw layout. // Draw layout.
gs_lgp->gnome_print_moveto (m_gpc, x, y); gs_lgp->gnome_print_moveto (m_gpc, x, y);
if (fabs(angle) > 0.00001) if (fabs(angle) > 0.00001)
{ {
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
gs_lgp->gnome_print_rotate( m_gpc, angle ); gs_lgp->gnome_print_rotate( m_gpc, angle );
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
gs_lgp->gnome_print_grestore( m_gpc ); gs_lgp->gnome_print_grestore( m_gpc );
} }
else else
{ {
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
} }
} }
@@ -1610,12 +1613,12 @@ void wxGnomePrintDC::EndDoc()
void wxGnomePrintDC::StartPage() void wxGnomePrintDC::StartPage()
{ {
gs_lgp->gnome_print_beginpage( m_gpc, (const guchar*) "page" ); gs_lgp->gnome_print_beginpage( m_gpc, (const guchar*) "page" );
} }
void wxGnomePrintDC::EndPage() void wxGnomePrintDC::EndPage()
{ {
gs_lgp->gnome_print_showpage( m_gpc ); gs_lgp->gnome_print_showpage( m_gpc );
} }
wxCoord wxGnomePrintDC::GetCharHeight() const wxCoord wxGnomePrintDC::GetCharHeight() const
@@ -1652,7 +1655,7 @@ void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxC
if ( externalLeading ) if ( externalLeading )
*externalLeading = 0; *externalLeading = 0;
if (string.IsEmpty()) if (string.empty())
{ {
return; return;
} }

View File

@@ -1,8 +1,9 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gprint.cpp // Name: src/gtk/gnome/gprint.cpp
// Author: Robert Roebling // Author: Robert Roebling
// Purpose: Implement GNOME printing support // Purpose: Implement GNOME printing support
// Created: 09/20/04 // Created: 09/20/04
// RCS-ID: $Id$
// Copyright: Robert Roebling // Copyright: Robert Roebling
// Licence: wxWindows Licence // Licence: wxWindows Licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -451,7 +452,7 @@ int wxGnomePrintDialog::ShowModal()
int response = gtk_dialog_run (GTK_DIALOG (m_widget)); int response = gtk_dialog_run (GTK_DIALOG (m_widget));
if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL) if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL)
{ {
gtk_widget_destroy(m_widget); gtk_widget_destroy(m_widget);
m_widget = NULL; m_widget = NULL;
@@ -546,15 +547,15 @@ wxGnomePageSetupDialog::wxGnomePageSetupDialog( wxWindow *parent,
gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main ); gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main );
gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE); gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (m_widget), gtk_dialog_add_buttons (GTK_DIALOG (m_widget),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_default_response (GTK_DIALOG (m_widget), gtk_dialog_set_default_response (GTK_DIALOG (m_widget),
GTK_RESPONSE_OK); GTK_RESPONSE_OK);
} }
wxGnomePageSetupDialog::~wxGnomePageSetupDialog() wxGnomePageSetupDialog::~wxGnomePageSetupDialog()
@@ -584,18 +585,18 @@ int wxGnomePageSetupDialog::ShowModal()
// I cannot test it as the dialog is currently broken // I cannot test it as the dialog is currently broken
// anyways (it only works for points). // anyways (it only works for points).
double ml,mr,mt,mb,pw,ph; double ml,mr,mt,mb,pw,ph;
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &ml, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &ml, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &mr, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &mr, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &mt, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &mt, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &mb, NULL); (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &mb, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAPER_WIDTH, &pw, NULL); (const guchar*) GNOME_PRINT_KEY_PAPER_WIDTH, &pw, NULL);
gs_lgp->gnome_print_config_get_length (config, gs_lgp->gnome_print_config_get_length (config,
(const guchar*) GNOME_PRINT_KEY_PAPER_HEIGHT, &ph, NULL); (const guchar*) GNOME_PRINT_KEY_PAPER_HEIGHT, &ph, NULL);
// This probably assumes that the user entered the // This probably assumes that the user entered the
// values in Pts. Since that is the only the dialog // values in Pts. Since that is the only the dialog
@@ -1098,24 +1099,24 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
gs_lgp->gnome_print_newpath(m_gpc); gs_lgp->gnome_print_newpath(m_gpc);
gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + rad),YLOG2DEV(y), XLOG2DEV(x + rad),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y), XLOG2DEV(x),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y + rad)); XLOG2DEV(x),YLOG2DEV(y + rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x),YLOG2DEV(y + height - rad), XLOG2DEV(x),YLOG2DEV(y + height - rad),
XLOG2DEV(x),YLOG2DEV(y + height), XLOG2DEV(x),YLOG2DEV(y + height),
XLOG2DEV(x + rad),YLOG2DEV(y + height)); XLOG2DEV(x + rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width - rad),YLOG2DEV(y + height), XLOG2DEV(x + width - rad),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height), XLOG2DEV(x + width),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height - rad)); XLOG2DEV(x + width),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width),YLOG2DEV(y + rad), XLOG2DEV(x + width),YLOG2DEV(y + rad),
XLOG2DEV(x + width),YLOG2DEV(y), XLOG2DEV(x + width),YLOG2DEV(y),
XLOG2DEV(x + width - rad),YLOG2DEV(y)); XLOG2DEV(x + width - rad),YLOG2DEV(y));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_closepath(m_gpc); gs_lgp->gnome_print_closepath(m_gpc);
gs_lgp->gnome_print_fill(m_gpc); gs_lgp->gnome_print_fill(m_gpc);
@@ -1130,24 +1131,24 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
gs_lgp->gnome_print_newpath(m_gpc); gs_lgp->gnome_print_newpath(m_gpc);
gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + rad),YLOG2DEV(y), XLOG2DEV(x + rad),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y), XLOG2DEV(x),YLOG2DEV(y),
XLOG2DEV(x),YLOG2DEV(y + rad)); XLOG2DEV(x),YLOG2DEV(y + rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x),YLOG2DEV(y + height - rad), XLOG2DEV(x),YLOG2DEV(y + height - rad),
XLOG2DEV(x),YLOG2DEV(y + height), XLOG2DEV(x),YLOG2DEV(y + height),
XLOG2DEV(x + rad),YLOG2DEV(y + height)); XLOG2DEV(x + rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width - rad),YLOG2DEV(y + height), XLOG2DEV(x + width - rad),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height), XLOG2DEV(x + width),YLOG2DEV(y + height),
XLOG2DEV(x + width),YLOG2DEV(y + height - rad)); XLOG2DEV(x + width),YLOG2DEV(y + height - rad));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad));
gs_lgp->gnome_print_curveto(m_gpc, gs_lgp->gnome_print_curveto(m_gpc,
XLOG2DEV(x + width),YLOG2DEV(y + rad), XLOG2DEV(x + width),YLOG2DEV(y + rad),
XLOG2DEV(x + width),YLOG2DEV(y), XLOG2DEV(x + width),YLOG2DEV(y),
XLOG2DEV(x + width - rad),YLOG2DEV(y)); XLOG2DEV(x + width - rad),YLOG2DEV(y));
gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y)); gs_lgp->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
gs_lgp->gnome_print_closepath(m_gpc); gs_lgp->gnome_print_closepath(m_gpc);
gs_lgp->gnome_print_stroke(m_gpc); gs_lgp->gnome_print_stroke(m_gpc);
@@ -1212,6 +1213,7 @@ void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord
} }
} }
#if wxUSE_SPLINES
void wxGnomePrintDC::DoDrawSpline(wxList *points) void wxGnomePrintDC::DoDrawSpline(wxList *points)
{ {
SetPen (m_pen); SetPen (m_pen);
@@ -1269,6 +1271,7 @@ void wxGnomePrintDC::DoDrawSpline(wxList *points)
gs_lgp->gnome_print_stroke( m_gpc ); gs_lgp->gnome_print_stroke( m_gpc );
} }
#endif // wxUSE_SPLINES
bool wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask,
@@ -1301,22 +1304,22 @@ void wxGnomePrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y,
if (bitmap.HasPixbuf()) if (bitmap.HasPixbuf())
{ {
GdkPixbuf *pixbuf = bitmap.GetPixbuf(); GdkPixbuf *pixbuf = bitmap.GetPixbuf();
guchar *raw_image = gdk_pixbuf_get_pixels( pixbuf ); guchar *raw_image = gdk_pixbuf_get_pixels( pixbuf );
bool has_alpha = gdk_pixbuf_get_has_alpha( pixbuf ); bool has_alpha = gdk_pixbuf_get_has_alpha( pixbuf );
int rowstride = gdk_pixbuf_get_rowstride( pixbuf ); int rowstride = gdk_pixbuf_get_rowstride( pixbuf );
int height = gdk_pixbuf_get_height( pixbuf ); int height = gdk_pixbuf_get_height( pixbuf );
int width = gdk_pixbuf_get_width( pixbuf ); int width = gdk_pixbuf_get_width( pixbuf );
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
double matrix[6]; double matrix[6];
matrix[0] = XLOG2DEVREL(width); matrix[0] = XLOG2DEVREL(width);
matrix[1] = 0; matrix[1] = 0;
matrix[2] = 0; matrix[2] = 0;
matrix[3] = YLOG2DEVREL(height); matrix[3] = YLOG2DEVREL(height);
matrix[4] = XLOG2DEV(x); matrix[4] = XLOG2DEV(x);
matrix[5] = YLOG2DEV(y+height); matrix[5] = YLOG2DEV(y+height);
gs_lgp->gnome_print_concat( m_gpc, matrix ); gs_lgp->gnome_print_concat( m_gpc, matrix );
gs_lgp->gnome_print_moveto( m_gpc, 0, 0 ); gs_lgp->gnome_print_moveto( m_gpc, 0, 0 );
if (has_alpha) if (has_alpha)
gs_lgp->gnome_print_rgbaimage( m_gpc, (guchar *)raw_image, width, height, rowstride ); gs_lgp->gnome_print_rgbaimage( m_gpc, (guchar *)raw_image, width, height, rowstride );
else else
@@ -1331,14 +1334,14 @@ void wxGnomePrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y,
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
double matrix[6]; double matrix[6];
matrix[0] = XLOG2DEVREL(image.GetWidth()); matrix[0] = XLOG2DEVREL(image.GetWidth());
matrix[1] = 0; matrix[1] = 0;
matrix[2] = 0; matrix[2] = 0;
matrix[3] = YLOG2DEVREL(image.GetHeight()); matrix[3] = YLOG2DEVREL(image.GetHeight());
matrix[4] = XLOG2DEV(x); matrix[4] = XLOG2DEV(x);
matrix[5] = YLOG2DEV(y+image.GetHeight()); matrix[5] = YLOG2DEV(y+image.GetHeight());
gs_lgp->gnome_print_concat( m_gpc, matrix ); gs_lgp->gnome_print_concat( m_gpc, matrix );
gs_lgp->gnome_print_moveto( m_gpc, 0, 0 ); gs_lgp->gnome_print_moveto( m_gpc, 0, 0 );
gs_lgp->gnome_print_rgbimage( m_gpc, (guchar*) image.GetData(), image.GetWidth(), image.GetHeight(), image.GetWidth()*3 ); gs_lgp->gnome_print_rgbimage( m_gpc, (guchar*) image.GetData(), image.GetWidth(), image.GetHeight(), image.GetWidth()*3 );
gs_lgp->gnome_print_grestore( m_gpc ); gs_lgp->gnome_print_grestore( m_gpc );
} }
@@ -1425,17 +1428,17 @@ void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord
} }
#endif #endif
// Draw layout. // Draw layout.
gs_lgp->gnome_print_moveto (m_gpc, x, y); gs_lgp->gnome_print_moveto (m_gpc, x, y);
if (fabs(angle) > 0.00001) if (fabs(angle) > 0.00001)
{ {
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
gs_lgp->gnome_print_rotate( m_gpc, angle ); gs_lgp->gnome_print_rotate( m_gpc, angle );
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
gs_lgp->gnome_print_grestore( m_gpc ); gs_lgp->gnome_print_grestore( m_gpc );
} }
else else
{ {
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
} }
// reset unscaled size // reset unscaled size
@@ -1456,17 +1459,17 @@ void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord
} }
#endif #endif
// Draw layout. // Draw layout.
gs_lgp->gnome_print_moveto (m_gpc, x, y); gs_lgp->gnome_print_moveto (m_gpc, x, y);
if (fabs(angle) > 0.00001) if (fabs(angle) > 0.00001)
{ {
gs_lgp->gnome_print_gsave( m_gpc ); gs_lgp->gnome_print_gsave( m_gpc );
gs_lgp->gnome_print_rotate( m_gpc, angle ); gs_lgp->gnome_print_rotate( m_gpc, angle );
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
gs_lgp->gnome_print_grestore( m_gpc ); gs_lgp->gnome_print_grestore( m_gpc );
} }
else else
{ {
gs_lgp->gnome_print_pango_layout( m_gpc, m_layout ); gs_lgp->gnome_print_pango_layout( m_gpc, m_layout );
} }
} }
@@ -1610,12 +1613,12 @@ void wxGnomePrintDC::EndDoc()
void wxGnomePrintDC::StartPage() void wxGnomePrintDC::StartPage()
{ {
gs_lgp->gnome_print_beginpage( m_gpc, (const guchar*) "page" ); gs_lgp->gnome_print_beginpage( m_gpc, (const guchar*) "page" );
} }
void wxGnomePrintDC::EndPage() void wxGnomePrintDC::EndPage()
{ {
gs_lgp->gnome_print_showpage( m_gpc ); gs_lgp->gnome_print_showpage( m_gpc );
} }
wxCoord wxGnomePrintDC::GetCharHeight() const wxCoord wxGnomePrintDC::GetCharHeight() const
@@ -1652,7 +1655,7 @@ void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxC
if ( externalLeading ) if ( externalLeading )
*externalLeading = 0; *externalLeading = 0;
if (string.IsEmpty()) if (string.empty())
{ {
return; return;
} }