+bool wxGnomePrintDialog::TransferDataToWindow()
+{
+ return true;
+}
+
+bool wxGnomePrintDialog::TransferDataFromWindow()
+{
+ return true;
+}
+
+//----------------------------------------------------------------------------
+// wxGnomePageSetupDialog
+//----------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxGnomePageSetupDialog, wxPageSetupDialogBase)
+
+wxGnomePageSetupDialog::wxGnomePageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData* data )
+{
+ if (data)
+ m_pageDialogData = *data;
+
+ wxGnomePrintNativeData *native =
+ (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
+
+ // This is required as the page setup dialog
+ // calculates wrong values otherwise.
+ gnome_print_config_set( native->GetPrintConfig(),
+ (const guchar*) GNOME_PRINT_KEY_PREFERED_UNIT,
+ (const guchar*) "Pts" );
+
+ m_widget = gtk_dialog_new();
+
+ gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( _("Page setup") ) );
+
+ GtkWidget *main = gnome_paper_selector_new_with_flags( native->GetPrintConfig(),
+ GNOME_PAPER_SELECTOR_MARGINS|GNOME_PAPER_SELECTOR_FEED_ORIENTATION );
+ gtk_container_set_border_width (GTK_CONTAINER (main), 8);
+ gtk_widget_show (main);
+
+ gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main );
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (m_widget),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (m_widget),
+ GTK_RESPONSE_OK);
+}
+
+wxGnomePageSetupDialog::~wxGnomePageSetupDialog()
+{
+}
+
+wxPageSetupDialogData& wxGnomePageSetupDialog::GetPageSetupDialogData()
+{
+ return m_pageDialogData;
+}
+
+int wxGnomePageSetupDialog::ShowModal()
+{
+ wxGnomePrintNativeData *native =
+ (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
+ GnomePrintConfig *config = native->GetPrintConfig();
+
+ // Transfer data from m_pageDialogData to native dialog
+
+ int ret = gtk_dialog_run( GTK_DIALOG(m_widget) );
+
+ if (ret == GTK_RESPONSE_OK)
+ {
+ // Transfer data back to m_pageDialogData
+
+ // I don't know how querying the last parameter works
+ // I cannot test it as the dialog is currently broken
+ // anyways (it only works for points).
+ double ml,mr,mt,mb,pw,ph;
+ gnome_print_config_get_length (config,
+ (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &ml, NULL);
+ gnome_print_config_get_length (config,
+ (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &mr, NULL);
+ gnome_print_config_get_length (config,
+ (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &mt, NULL);
+ gnome_print_config_get_length (config,
+ (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &mb, NULL);
+ gnome_print_config_get_length (config,
+ (const guchar*) GNOME_PRINT_KEY_PAPER_WIDTH, &pw, NULL);
+ gnome_print_config_get_length (config,
+ (const guchar*) GNOME_PRINT_KEY_PAPER_HEIGHT, &ph, NULL);
+
+ // This probably assumes that the user entered the
+ // values in Pts. Since that is the only the dialog
+ // works right now, we need to fix this later.
+ const GnomePrintUnit *mm_unit = gnome_print_unit_get_by_abbreviation( (const guchar*) "mm" );
+ const GnomePrintUnit *pts_unit = gnome_print_unit_get_by_abbreviation( (const guchar*) "Pts" );
+ gnome_print_convert_distance( &ml, pts_unit, mm_unit );
+ gnome_print_convert_distance( &mr, pts_unit, mm_unit );
+ gnome_print_convert_distance( &mt, pts_unit, mm_unit );
+ gnome_print_convert_distance( &mb, pts_unit, mm_unit );
+ gnome_print_convert_distance( &pw, pts_unit, mm_unit );
+ gnome_print_convert_distance( &ph, pts_unit, mm_unit );
+
+ m_pageDialogData.SetMarginTopLeft( wxPoint( (int)(ml+0.5), (int)(mt+0.5)) );
+ m_pageDialogData.SetMarginBottomRight( wxPoint( (int)(mr+0.5), (int)(mb+0.5)) );
+
+ m_pageDialogData.SetPaperSize( wxSize( (int)(pw+0.5), (int)(ph+0.5) ) );
+
+#if 0
+ wxPrintf( wxT("paper %d %d, top margin %d\n"),
+ m_pageDialogData.GetPaperSize().x,
+ m_pageDialogData.GetPaperSize().y,
+ m_pageDialogData.GetMarginTopLeft().x );
+#endif
+
+ ret = wxID_OK;
+ }
+ else
+ {
+ ret = wxID_CANCEL;
+ }
+
+ gtk_widget_destroy( m_widget );
+ m_widget = NULL;
+
+ return ret;
+}
+
+bool wxGnomePageSetupDialog::Validate()