aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-09-05 20:27:04 +0800
committerChristian Persch <chpe@src.gnome.org>2005-09-05 20:27:04 +0800
commit2400a887ee9deb7acb756629e0fe73770a385e07 (patch)
treef674f28fdb73635b7a23ea06cf9af22f90645b13 /embed
parent9a6f3cde561ae6d3a0f272219735d1ec538b00b5 (diff)
downloadgsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.tar
gsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.tar.gz
gsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.tar.bz2
gsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.tar.lz
gsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.tar.xz
gsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.tar.zst
gsoc2013-epiphany-2400a887ee9deb7acb756629e0fe73770a385e07.zip
Mozilla printing code is braindead. Bug #163255.
2005-09-05 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyUtils.cpp: Mozilla printing code is braindead. Bug #163255.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/EphyUtils.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/embed/mozilla/EphyUtils.cpp b/embed/mozilla/EphyUtils.cpp
index 66ac7b4f3..d6ad177e7 100644
--- a/embed/mozilla/EphyUtils.cpp
+++ b/embed/mozilla/EphyUtils.cpp
@@ -155,7 +155,7 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info,
const GnomePrintUnit *unit, *inch, *mm;
double value;
-
+
mm = gnome_print_unit_get_by_abbreviation ((const guchar *) "mm");
inch = gnome_print_unit_get_by_abbreviation ((const guchar *) "in");
g_assert (mm != NULL && inch != NULL);
@@ -251,6 +251,15 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info,
options->SetPaperSize (nsIPrintSettings::kPaperSizeDefined);
options->SetPaperSizeUnit (nsIPrintSettings::kPaperSizeMillimeters);
+ /* NOTE: Due to completely braindead mozilla code, the paper
+ * dimensions aren't actually used. We have to set the paper name,
+ * and only 6 papers formats are accepted
+ * (A3, A4, A5, Letter, Legal, Executive).
+ *
+ * See http://lxr.mozilla.org/seamonkey/source/gfx/src/ps/nsPostScriptObj.cpp#301 and
+ * http://lxr.mozilla.org/seamonkey/source/gfx/src/psshared/nsPaperPS.cpp#46 .
+ */
+#if 0
if (gnome_print_config_get_length (info->config,
(const guchar *) GNOME_PRINT_KEY_PAPER_WIDTH,
&value, &unit)
@@ -266,13 +275,38 @@ EphyUtils::CollatePrintSettings (EmbedPrintInfo *info,
{
options->SetPaperHeight (value);
}
-
+#endif
+
+ /* Gnome-Print names some papers differently than what moz understands */
+ static const struct
+ {
+ const char *gppaper;
+ const char *mozpaper;
+ }
+ paper_table [] =
+ {
+ { "USLetter", "Letter" },
+ { "USLegal", "Legal" }
+ };
+
char *string;
/* paper name */
string = (char *) gnome_print_config_get (info->config,
(const guchar *) GNOME_PRINT_KEY_PAPER_SIZE);
- NS_CStringToUTF16 (nsEmbedCString(string),
+
+ const char *paper = string;
+ for (PRUint32 i = 0; i < G_N_ELEMENTS (paper_table); i++)
+ {
+ if (string != NULL &&
+ g_ascii_strcasecmp (paper_table[i].gppaper, string) == 0)
+ {
+ paper = paper_table[i].mozpaper;
+ break;
+ }
+ }
+
+ NS_CStringToUTF16 (nsEmbedCString(paper),
NS_CSTRING_ENCODING_UTF8, tmp);
options->SetPaperName (tmp.get());
g_free (string);