git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30610
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
private:
GnomePrintContext *m_gpc;
private:
GnomePrintContext *m_gpc;
private:
DECLARE_DYNAMIC_CLASS(wxGnomePrinter)
private:
DECLARE_DYNAMIC_CLASS(wxGnomePrinter)
private:
GnomePrintContext *m_gpc;
private:
GnomePrintContext *m_gpc;
private:
DECLARE_DYNAMIC_CLASS(wxGnomePrinter)
private:
DECLARE_DYNAMIC_CLASS(wxGnomePrinter)
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-pango.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-pango.h>
#include <libgnomeprintui/gnome-print-dialog.h>
+#include <libgnomeprintui/gnome-print-job-preview.h>
//----------------------------------------------------------------------------
// wxGnomePrintNativeData
//----------------------------------------------------------------------------
// wxGnomePrintNativeData
gtk_widget_destroy(m_widget);
m_widget = NULL;
gtk_widget_destroy(m_widget);
m_widget = NULL;
+ if (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW)
+ return wxID_PREVIEW;
+
wxPrinterBase( data )
{
m_gpc = NULL;
wxPrinterBase( data )
{
m_gpc = NULL;
+ m_native_preview = false;
}
wxGnomePrinter::~wxGnomePrinter()
}
wxGnomePrinter::~wxGnomePrinter()
else
dc = new wxGnomePrintDC( this );
else
dc = new wxGnomePrintDC( this );
+ if (m_native_preview)
+ printout->SetIsPreview(true);
+
if (!dc)
{
gnome_print_job_close( job );
if (!dc)
{
gnome_print_job_close( job );
}
gnome_print_job_close( job );
}
gnome_print_job_close( job );
- gnome_print_job_print( job );
+ if (m_native_preview)
+ {
+ wxString title( _("Print preview") );
+ gtk_widget_show( gnome_print_job_preview_new( job, (const guchar*)(const char*)wxGTK_CONV(title) ));
+ }
+ else
+ {
+ gnome_print_job_print( job );
+ }
wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent )
{
wxGnomePrintDialog dialog( parent, &m_printDialogData );
wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent )
{
wxGnomePrintDialog dialog( parent, &m_printDialogData );
- if (dialog.ShowModal() == wxID_CANCEL)
+ int ret = dialog.ShowModal();
+ if (ret == wxID_CANCEL)
{
sm_lastError = wxPRINTER_ERROR;
return NULL;
}
{
sm_lastError = wxPRINTER_ERROR;
return NULL;
}
+ m_native_preview = ret == wxID_PREVIEW;
+
m_printDialogData = dialog.GetPrintDialogData();
return new wxGnomePrintDC( this );
}
m_printDialogData = dialog.GetPrintDialogData();
return new wxGnomePrintDC( this );
}
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-pango.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-pango.h>
#include <libgnomeprintui/gnome-print-dialog.h>
+#include <libgnomeprintui/gnome-print-job-preview.h>
//----------------------------------------------------------------------------
// wxGnomePrintNativeData
//----------------------------------------------------------------------------
// wxGnomePrintNativeData
gtk_widget_destroy(m_widget);
m_widget = NULL;
gtk_widget_destroy(m_widget);
m_widget = NULL;
+ if (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW)
+ return wxID_PREVIEW;
+
wxPrinterBase( data )
{
m_gpc = NULL;
wxPrinterBase( data )
{
m_gpc = NULL;
+ m_native_preview = false;
}
wxGnomePrinter::~wxGnomePrinter()
}
wxGnomePrinter::~wxGnomePrinter()
else
dc = new wxGnomePrintDC( this );
else
dc = new wxGnomePrintDC( this );
+ if (m_native_preview)
+ printout->SetIsPreview(true);
+
if (!dc)
{
gnome_print_job_close( job );
if (!dc)
{
gnome_print_job_close( job );
}
gnome_print_job_close( job );
}
gnome_print_job_close( job );
- gnome_print_job_print( job );
+ if (m_native_preview)
+ {
+ wxString title( _("Print preview") );
+ gtk_widget_show( gnome_print_job_preview_new( job, (const guchar*)(const char*)wxGTK_CONV(title) ));
+ }
+ else
+ {
+ gnome_print_job_print( job );
+ }
wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent )
{
wxGnomePrintDialog dialog( parent, &m_printDialogData );
wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent )
{
wxGnomePrintDialog dialog( parent, &m_printDialogData );
- if (dialog.ShowModal() == wxID_CANCEL)
+ int ret = dialog.ShowModal();
+ if (ret == wxID_CANCEL)
{
sm_lastError = wxPRINTER_ERROR;
return NULL;
}
{
sm_lastError = wxPRINTER_ERROR;
return NULL;
}
+ m_native_preview = ret == wxID_PREVIEW;
+
m_printDialogData = dialog.GetPrintDialogData();
return new wxGnomePrintDC( this );
}
m_printDialogData = dialog.GetPrintDialogData();
return new wxGnomePrintDC( this );
}