aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-06-15 20:01:53 +0800
committerChristian Persch <chpe@src.gnome.org>2003-06-15 20:01:53 +0800
commit5a927d2793acbd7ca212812048e41891cda8a6e9 (patch)
treec1d9fe682c7af65fda89ab591e7e9b729ac0596a /embed
parentfa31654eac12411d58ab603924953410c53e1426 (diff)
downloadgsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.gz
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.bz2
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.lz
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.xz
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.zst
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.zip
Convert dialog to metric units and default paper to A4. Fixes #112619
2003-06-15 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/MozillaPrivate.cpp: (MozillaCollatePrintSettings): * embed/ephy-embed.h: * embed/print-dialog.c: (print_dialog_init), (print_free_info), (print_get_info): * data/epiphany.schemas.in: * data/glade/print.glade: Convert dialog to metric units and default paper to A4. Fixes #112619
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.h10
-rw-r--r--embed/mozilla/MozillaPrivate.cpp17
-rwxr-xr-xembed/print-dialog.c15
3 files changed, 24 insertions, 18 deletions
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index c4cac0aef..a80d11d80 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -108,11 +108,11 @@ typedef struct
gboolean print_to_file;
gchar *printer;
gchar *file;
- gint paper;
- gdouble top_margin;
- gdouble bottom_margin;
- gdouble left_margin;
- gdouble right_margin;
+ gchar *paper;
+ gint top_margin;
+ gint bottom_margin;
+ gint left_margin;
+ gint right_margin;
gint pages;
gint from_page;
gint to_page;
diff --git a/embed/mozilla/MozillaPrivate.cpp b/embed/mozilla/MozillaPrivate.cpp
index 0847f3473..46ece8418 100644
--- a/embed/mozilla/MozillaPrivate.cpp
+++ b/embed/mozilla/MozillaPrivate.cpp
@@ -37,6 +37,7 @@ GtkWidget *MozillaFindGtkParent (nsIDOMWindow *aDOMWindow)
return gtk_widget_get_toplevel (GTK_WIDGET(mozembed));
}
+#define MM_TO_INCH(x) (((double) x) / 25.4)
NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
nsIPrintSettings *options)
@@ -46,11 +47,6 @@ NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
nsIPrintSettings::kSelectedFrame,
nsIPrintSettings::kEachFrameSep
};
- /* these should match the order of the radiobuttons in the dialog
- * and the paper names in the default print provider PS*/
- const static char *PaperSizeNames[] = {
- "Letter","Legal","Executive","A4"
- };
switch (info->pages)
@@ -68,10 +64,10 @@ NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
break;
}
- options->SetMarginTop (info->top_margin);
- options->SetMarginBottom (info->bottom_margin);
- options->SetMarginLeft (info->left_margin);
- options->SetMarginRight (info->right_margin);
+ options->SetMarginTop (MM_TO_INCH (info->top_margin));
+ options->SetMarginBottom (MM_TO_INCH (info->bottom_margin));
+ options->SetMarginLeft (MM_TO_INCH (info->left_margin));
+ options->SetMarginRight (MM_TO_INCH (info->right_margin));
options->SetPrinterName(NS_LITERAL_STRING("PostScript/default").get());
@@ -95,8 +91,7 @@ NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
/* native paper size formats. Our dialog does not support custom yet */
options->SetPaperSize (nsIPrintSettings::kPaperSizeNativeData);
- int tps = (info->paper >= 0 || info->paper < 4) ? info->paper : 0;
- options->SetPaperName (NS_ConvertUTF8toUCS2(PaperSizeNames[tps]).get());
+ options->SetPaperName (NS_ConvertUTF8toUCS2(info->paper).get());
options->SetPrintInColor (info->print_color);
options->SetOrientation (info->orientation);
diff --git a/embed/print-dialog.c b/embed/print-dialog.c
index baf636cd0..f69ee8811 100755
--- a/embed/print-dialog.c
+++ b/embed/print-dialog.c
@@ -95,7 +95,7 @@ EphyDialogProperty properties [] =
{ PRINTON_PROP, "printer_radiobutton", CONF_PRINT_PRINTON, PT_NORMAL, NULL },
{ PRINTER_PROP, "printer_entry", CONF_PRINT_PRINTER, PT_NORMAL, NULL },
{ FILE_PROP, "file_entry", CONF_PRINT_FILE, PT_NORMAL, NULL },
- { PAPER_PROP,"letter_radiobutton", CONF_PRINT_PAPER, PT_NORMAL, NULL },
+ { PAPER_PROP,"A4_radiobutton", CONF_PRINT_PAPER, PT_NORMAL, NULL },
{ TOP_PROP, "top_spinbutton", CONF_PRINT_TOP_MARGIN, PT_NORMAL, NULL },
{ BOTTOM_PROP, "bottom_spinbutton", CONF_PRINT_BOTTOM_MARGIN, PT_NORMAL, NULL },
{ LEFT_PROP,"left_spinbutton", CONF_PRINT_LEFT_MARGIN, PT_NORMAL, NULL },
@@ -113,6 +113,13 @@ EphyDialogProperty properties [] =
{ -1, NULL, NULL }
};
+static const
+char *paper_format_enum [] =
+{
+ "A4", "Letter", "Legal", "Executive"
+};
+static guint n_paper_format_enum = G_N_ELEMENTS (paper_format_enum);
+
static guint print_dialog_signals[LAST_SIGNAL] = { 0 };
GType
@@ -179,6 +186,9 @@ print_dialog_init (PrintDialog *dialog)
"print.glade", "print_dialog");
dialog->priv->window = ephy_dialog_get_control (EPHY_DIALOG(dialog), WINDOW_PROP);
+
+ ephy_dialog_add_enum (EPHY_DIALOG (dialog), PAPER_PROP,
+ n_paper_format_enum, paper_format_enum);
icon = gtk_widget_render_icon (dialog->priv->window,
GTK_STOCK_PRINT,
@@ -244,6 +254,7 @@ print_free_info (EmbedPrintInfo *info)
{
g_free (info->printer);
g_free (info->file);
+ g_free (info->paper);
g_free (info->header_left_string);
g_free (info->header_right_string);
g_free (info->footer_left_string);
@@ -303,7 +314,7 @@ print_get_info (EphyDialog *dialog)
info->to_page = g_value_get_float (&to_page);
ephy_dialog_get_value (dialog, PAPER_PROP, &paper);
- info->paper = g_value_get_int (&paper);
+ info->paper = g_strdup (paper_format_enum[g_value_get_int (&paper)]);
ephy_dialog_get_value (dialog, ALL_PAGES_PROP, &pages);
info->pages = g_value_get_int (&pages);