Make GtkPageSetup-related functions private
These functions don't need to be members of wxGtkPrintNativeData as they don't use this object at all, so one shouldn't be required to call them. And rather than making them static, just make them private functions instead. No real changes, this is just a refactoring.
This commit is contained in:
@@ -197,10 +197,6 @@ public:
|
|||||||
GtkPrintContext *GetPrintContext() { return m_context; }
|
GtkPrintContext *GetPrintContext() { return m_context; }
|
||||||
void SetPrintContext(GtkPrintContext *context) {m_context = context; }
|
void SetPrintContext(GtkPrintContext *context) {m_context = context; }
|
||||||
|
|
||||||
|
|
||||||
GtkPageSetup* GetPageSetupFromSettings(GtkPrintSettings* settings);
|
|
||||||
void SetPageSetupToSettings(GtkPrintSettings* settings, GtkPageSetup* page_setup);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// NB: m_config is created and owned by us, but the other objects are not
|
// NB: m_config is created and owned by us, but the other objects are not
|
||||||
// and their accessors don't change their ref count.
|
// and their accessors don't change their ref count.
|
||||||
|
@@ -583,8 +583,11 @@ void wxGtkPrintNativeData::SetPrintConfig( GtkPrintSettings * config )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
// Extract page setup from settings.
|
// Extract page setup from settings.
|
||||||
GtkPageSetup* wxGtkPrintNativeData::GetPageSetupFromSettings(GtkPrintSettings* settings)
|
GtkPageSetup* GetPageSetupFromSettings(GtkPrintSettings* settings)
|
||||||
{
|
{
|
||||||
GtkPageSetup* page_setup = gtk_page_setup_new();
|
GtkPageSetup* page_setup = gtk_page_setup_new();
|
||||||
gtk_page_setup_set_orientation (page_setup, gtk_print_settings_get_orientation (settings));
|
gtk_page_setup_set_orientation (page_setup, gtk_print_settings_get_orientation (settings));
|
||||||
@@ -600,12 +603,14 @@ GtkPageSetup* wxGtkPrintNativeData::GetPageSetupFromSettings(GtkPrintSettings* s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert page setup into a given GtkPrintSettings.
|
// Insert page setup into a given GtkPrintSettings.
|
||||||
void wxGtkPrintNativeData::SetPageSetupToSettings(GtkPrintSettings* settings, GtkPageSetup* page_setup)
|
void SetPageSetupToSettings(GtkPrintSettings* settings, GtkPageSetup* page_setup)
|
||||||
{
|
{
|
||||||
gtk_print_settings_set_orientation ( settings, gtk_page_setup_get_orientation (page_setup));
|
gtk_print_settings_set_orientation ( settings, gtk_page_setup_get_orientation (page_setup));
|
||||||
gtk_print_settings_set_paper_size ( settings, gtk_page_setup_get_paper_size (page_setup));
|
gtk_print_settings_set_paper_size ( settings, gtk_page_setup_get_paper_size (page_setup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// wxGtkPrintDialog
|
// wxGtkPrintDialog
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -692,7 +697,7 @@ int wxGtkPrintDialog::ShowModal()
|
|||||||
// If the settings are OK, we restore it.
|
// If the settings are OK, we restore it.
|
||||||
if (settings != NULL)
|
if (settings != NULL)
|
||||||
gtk_print_operation_set_print_settings (printOp, settings);
|
gtk_print_operation_set_print_settings (printOp, settings);
|
||||||
GtkPageSetup* pgSetup = native->GetPageSetupFromSettings(settings);
|
GtkPageSetup* pgSetup = GetPageSetupFromSettings(settings);
|
||||||
gtk_print_operation_set_default_page_setup (printOp, pgSetup);
|
gtk_print_operation_set_default_page_setup (printOp, pgSetup);
|
||||||
g_object_unref(pgSetup);
|
g_object_unref(pgSetup);
|
||||||
|
|
||||||
@@ -733,7 +738,7 @@ int wxGtkPrintDialog::ShowModal()
|
|||||||
g_object_get(printOp, "default-page-setup", &defPageSetup, NULL);
|
g_object_get(printOp, "default-page-setup", &defPageSetup, NULL);
|
||||||
if ( defPageSetup )
|
if ( defPageSetup )
|
||||||
{
|
{
|
||||||
native->SetPageSetupToSettings(newSettings, defPageSetup);
|
SetPageSetupToSettings(newSettings, defPageSetup);
|
||||||
g_object_unref(defPageSetup);
|
g_object_unref(defPageSetup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,7 +821,7 @@ int wxGtkPageSetupDialog::ShowModal()
|
|||||||
GtkPrintSettings* nativeData = native->GetPrintConfig();
|
GtkPrintSettings* nativeData = native->GetPrintConfig();
|
||||||
|
|
||||||
// We only need the pagesetup data which are part of the settings.
|
// We only need the pagesetup data which are part of the settings.
|
||||||
GtkPageSetup* oldPageSetup = native->GetPageSetupFromSettings(nativeData);
|
GtkPageSetup* oldPageSetup = GetPageSetupFromSettings(nativeData);
|
||||||
|
|
||||||
// If the user used a custom paper format the last time he printed, we have to restore it too.
|
// If the user used a custom paper format the last time he printed, we have to restore it too.
|
||||||
wxPaperSize paperId = m_pageDialogData.GetPrintData().GetPaperId();
|
wxPaperSize paperId = m_pageDialogData.GetPrintData().GetPaperId();
|
||||||
@@ -871,7 +876,7 @@ int wxGtkPageSetupDialog::ShowModal()
|
|||||||
wxGtkObject<GtkPageSetup>
|
wxGtkObject<GtkPageSetup>
|
||||||
newPageSetup(gtk_page_setup_unix_dialog_get_page_setup(
|
newPageSetup(gtk_page_setup_unix_dialog_get_page_setup(
|
||||||
GTK_PAGE_SETUP_UNIX_DIALOG(dlg)));
|
GTK_PAGE_SETUP_UNIX_DIALOG(dlg)));
|
||||||
native->SetPageSetupToSettings(nativeData, newPageSetup);
|
SetPageSetupToSettings(nativeData, newPageSetup);
|
||||||
|
|
||||||
m_pageDialogData.GetPrintData().ConvertFromNative();
|
m_pageDialogData.GetPrintData().ConvertFromNative();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user