Added prefs support for margins, complete support for printer preferences in

Unix postscript printing. r=ben. Fixes bugs 4637 and 4638.
This commit is contained in:
syd%netscape.com 2006-02-07 01:12:12 +00:00
Родитель b21d06ecd5
Коммит 504bddf1ef
2 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -108,7 +108,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet)
PRBool reversed = PR_FALSE, color = PR_FALSE, landscape = PR_FALSE;
PRInt32 paper_size = NS_LETTER_SIZE;
float left, right, top, bottom; // XXX later
int ileft = 500, iright = 0, itop = 500, ibottom = 0;
char *command;
nsresult rv;
@ -120,6 +120,10 @@ NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet)
(void) pPrefs->GetBoolPref("print.print_landscape", &landscape);
(void) pPrefs->GetIntPref("print.print_paper_size", &paper_size);
(void) pPrefs->CopyCharPref("print.print_command", (char **) &command);
(void) pPrefs->GetIntPref("print.print_margin_top", &itop);
(void) pPrefs->GetIntPref("print.print_margin_left", &ileft);
(void) pPrefs->GetIntPref("print.print_margin_bottom", &ibottom);
(void) pPrefs->GetIntPref("print.print_margin_right", &iright);
sprintf( mPrData.command, command );
} else {
#ifndef VMS
@ -131,6 +135,10 @@ NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet)
#endif
}
mPrData.top = itop / 1000.0;
mPrData.bottom = ibottom / 1000.0;
mPrData.left = ileft / 1000.0;
mPrData.right = iright / 1000.0;
mPrData.toPrinter = PR_TRUE;
mPrData.fpf = !reversed;
mPrData.grayscale = !color;
@ -155,6 +163,10 @@ NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet)
pPrefs->SetBoolPref("print.print_color", !mPrData.grayscale);
pPrefs->SetBoolPref("print.print_landscape", landscape);
pPrefs->SetIntPref("print.print_paper_size", mPrData.size);
pPrefs->SetIntPref("print.print_margin_top", (int)(mPrData.top * 1000));
pPrefs->SetIntPref("print.print_margin_left", (int)(mPrData.left * 1000));
pPrefs->SetIntPref("print.print_margin_bottom", (int)(mPrData.bottom * 1000));
pPrefs->SetIntPref("print.print_margin_right", (int)(mPrData.right * 1000));
if ( mPrData.toPrinter == PR_FALSE )
pPrefs->SetCharPref("print.print_command", mPrData.command);
}

Просмотреть файл

@ -160,7 +160,7 @@ GetPrPath (GtkWidget *widget, UnixPrOps *prOps)
{
GtkWidget *fs;
fs = gtk_file_selection_new("Netscape: File Browser");
fs = gtk_file_selection_new("File Browser");
gtk_file_selection_set_filename( GTK_FILE_SELECTION(fs),
prOps->prData->path );
@ -369,7 +369,7 @@ DoPrintGTK (GtkWidget *widget, UnixPrOps *prOps)
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new( "Top: " );
gtk_box_pack_start (GTK_BOX (hbox), label, PR_TRUE, PR_FALSE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new (0.5, 0.0, 999.0,
adj = (GtkAdjustment *) gtk_adjustment_new ( prOps->prData->top, 0.0, 999.0,
0.25, 1.0, 0.0);
prOps->widgets.topSpinner = spinner1 =
gtk_spin_button_new (adj, 1.0, 2);
@ -379,7 +379,7 @@ DoPrintGTK (GtkWidget *widget, UnixPrOps *prOps)
label = gtk_label_new( "Bottom: " );
gtk_box_pack_start (GTK_BOX (hbox), label, PR_TRUE, PR_FALSE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 999.0,
adj = (GtkAdjustment *) gtk_adjustment_new ( prOps->prData->bottom, 0.0, 999.0,
0.25, 1.0, 0.0);
prOps->widgets.bottomSpinner = spinner1 =
gtk_spin_button_new (adj, 1.0, 2);
@ -393,7 +393,7 @@ DoPrintGTK (GtkWidget *widget, UnixPrOps *prOps)
label = gtk_label_new( "Left: " );
gtk_box_pack_start (GTK_BOX (hbox), label, PR_TRUE, PR_FALSE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new (0.5, 0.0, 999.0,
adj = (GtkAdjustment *) gtk_adjustment_new ( prOps->prData->left, 0.0, 999.0,
0.25, 1.0, 0.0);
prOps->widgets.leftSpinner = spinner1 =
gtk_spin_button_new (adj, 1.0, 2);
@ -403,7 +403,7 @@ DoPrintGTK (GtkWidget *widget, UnixPrOps *prOps)
label = gtk_label_new( "Right: " );
gtk_box_pack_start (GTK_BOX (hbox), label, PR_TRUE, PR_FALSE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 999.0,
adj = (GtkAdjustment *) gtk_adjustment_new ( prOps->prData->right, 0.0, 999.0,
0.25, 1.0, 0.0);
prOps->widgets.rightSpinner = spinner1 =
gtk_spin_button_new (adj, 1.0, 2);