summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Mainz <roland.mainz@nrubsig.org>2005-01-03 01:06:35 +0000
committerRoland Mainz <roland.mainz@nrubsig.org>2005-01-03 01:06:35 +0000
commita42a211aba369513bf31d6d34c966c36c1ccc714 (patch)
tree2b28eb5a9744d19f752e9fe9e893d78532486087
parent6abedd2bce33d244546a3efed44beb95c6571157 (diff)
xc/lib/XprintAppUtil/xpapputil.cXORG-6_8_99_1
xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz <roland.mainz@nrubsig.org> and Julien Lafon <julien.lafon@gmail.com>.
-rw-r--r--Xman-xprint.ad2
-rw-r--r--handler.c3
-rw-r--r--print.c45
-rw-r--r--print.h1
4 files changed, 35 insertions, 16 deletions
diff --git a/Xman-xprint.ad b/Xman-xprint.ad
index 8b342a2..2598a98 100644
--- a/Xman-xprint.ad
+++ b/Xman-xprint.ad
@@ -265,6 +265,8 @@
*printdialogshell*setup*orientationlist.tip: Select page orientation
*printdialogshell*setup*plexlist.fromHoriz: orientationlist
*printdialogshell*setup*plexlist.tip: Select page plex mode (simplex, duplex, etc.)
+*printdialogshell*setup*colorspacelist.fromHoriz: plexlist
+*printdialogshell*setup*colorspacelist.tip: Select color space (color, grayscale, CYMK, etc.)
*printdialogshell*setup*jobcopieslabel.fromVert: paperlist
*printdialogshell*setup*jobcopieslabel.tip: Set number of job copies
*printdialogshell*setup*jobcopieslabel.label: Job Copies:
diff --git a/handler.c b/handler.c
index bff4ba4..f89cdd6 100644
--- a/handler.c
+++ b/handler.c
@@ -631,7 +631,8 @@ printOKXtProc(Widget w, XtPointer client_data, XtPointer callData)
DoPrintManpage("Xman",
file, topwindow,
- pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc,
+ pdcs->pdpy, pdcs->pcontext, pdcs->colorspace,
+ printshellDestroyXtProc,
mg->manpage_title,
pdcs->printToFile?pdcs->printToFileName:NULL);
diff --git a/print.c b/print.c
index bf1e669..0d5b1d3 100644
--- a/print.c
+++ b/print.c
@@ -41,7 +41,8 @@ in this Software without prior written authorization from The Open Group.
static Widget
CreatePrintShell(Widget videoshell,
- Screen *pscreen,
+ Screen *pscreen,
+ Visual *pvisual,
String printshell_name,
ArgList args,
Cardinal numargs)
@@ -53,6 +54,9 @@ CreatePrintShell(Widget videoshell,
Display *pdpy = XDisplayOfScreen(pscreen);
int dummyc = 0;
String dummys = "";
+ Cardinal shell_n;
+ Arg shell_args[5];
+
XtGetApplicationNameAndClass(XtDisplay(videoshell),
&videoname, &videoclass);
@@ -62,11 +66,15 @@ CreatePrintShell(Widget videoshell,
NULL, 0,
&dummyc, &dummys);
- pappshell = XtVaAppCreateShell(videoname, videoclass,
+ shell_n = 0;
+ XtSetArg(shell_args[shell_n], XtNscreen, pscreen); shell_n++;
+ if (pvisual) {
+ XtSetArg(shell_args[shell_n], XtNvisual, pvisual); shell_n++;
+ }
+ pappshell = XtAppCreateShell(videoname, videoclass,
applicationShellWidgetClass,
pdpy,
- XtNscreen, pscreen,
- NULL);
+ shell_args, shell_n);
printshell = XtCreatePopupShell(printshell_name,
xawPrintShellWidgetClass,
pappshell, args, numargs);
@@ -224,19 +232,19 @@ void PrintEndJobCB(Widget pshell, XtPointer client_data, XtPointer call_data)
}
static
-XFontStruct *GetPrintTextFont(Display *pdpy, const char *fontprefix, long dpi)
+XFontStruct *GetPrintTextFont(Display *pdpy, const char *fontprefix, long dpi_x, long dpi_y)
{
XFontStruct *font;
char fontname[1024];
- sprintf(fontname, "%s--*-120-%ld-%ld-*-*-iso8859-1", fontprefix, dpi, dpi);
+ sprintf(fontname, "%s--*-120-%ld-%ld-*-*-iso8859-1", fontprefix, dpi_x, dpi_y);
font = XLoadQueryFont(pdpy, fontname);
if (!font) {
- sprintf(fontname, "-adobe-courier-medium-r-normal--*-120-%ld-%ld-*-*-iso8859-1", dpi, dpi);
+ sprintf(fontname, "-adobe-courier-medium-r-normal--*-120-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y);
font = XLoadQueryFont(pdpy, fontname);
}
if (!font) {
- sprintf(fontname, "-*-*-*-*-*-*-*-120-%ld-%ld-*-*-iso8859-1", dpi, dpi);
+ sprintf(fontname, "-*-*-*-*-*-*-*-120-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y);
font = XLoadQueryFont(pdpy, fontname);
}
if (!font)
@@ -248,10 +256,12 @@ XFontStruct *GetPrintTextFont(Display *pdpy, const char *fontprefix, long dpi)
void DoPrintManpage(const char *programname,
FILE *manpagefile, Widget toplevel,
Display *pdpy, XPContext pcontext,
+ XpuColorspaceRec *colorspace,
XtCallbackProc pdpyDestroyCB,
const char *jobtitle, const char *toFile)
{
- long dpi = 0;
+ long dpi_x = 0L,
+ dpi_y = 0L;
int n;
Arg args[20];
XFontStruct *printFontNormal;
@@ -281,7 +291,7 @@ void DoPrintManpage(const char *programname,
XpSetContext(pdpy, pcontext);
/* Get default printer resolution */
- if (XpuGetResolution(pdpy, pcontext, &dpi) != 1) {
+ if (XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1) {
fprintf(stderr, "%s: No default resolution for printer.\n", apd->programname);
XpuClosePrinterDisplay(pdpy, pcontext);
return;
@@ -299,17 +309,22 @@ void DoPrintManpage(const char *programname,
* |XawPrintLAYOUTMODE_PAGESIZE| are used. */
XtSetArg(args[n], XtNgeometry, "+0+0"); n++;
XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++;
- apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "printshell", args, n);
+ if (colorspace) {
+ printf("Setting visual to id=0x%lx.\n", colorspace->visualinfo.visualid);
+ }
+ apd->printshell = CreatePrintShell(toplevel, apd->pscreen,
+ (colorspace?(colorspace->visualinfo.visual):(NULL)),
+ "printshell", args, n);
n = 0;
XtSetArg(args[n], XtNresizable, True); n++;
XtSetArg(args[n], XtNright, XtChainRight); n++;
apd->content.form = XtCreateManagedWidget("form", formWidgetClass, apd->printshell, args, n);
- printFontNormal = GetPrintTextFont(pdpy, "-*-courier-medium-r-*", dpi);
- printFontBold = GetPrintTextFont(pdpy, "-*-courier-bold-r-*", dpi);
- printFontItalic = GetPrintTextFont(pdpy, "-*-courier-medium-o-*", dpi);
- printFontSymbol = GetPrintTextFont(pdpy, "-*-symbol-*-*-*", dpi);
+ printFontNormal = GetPrintTextFont(pdpy, "-*-courier-medium-r-*", dpi_x, dpi_y);
+ printFontBold = GetPrintTextFont(pdpy, "-*-courier-bold-r-*", dpi_x, dpi_y);
+ printFontItalic = GetPrintTextFont(pdpy, "-*-courier-medium-o-*", dpi_x, dpi_y);
+ printFontSymbol = GetPrintTextFont(pdpy, "-*-symbol-*-*-*", dpi_x, dpi_y);
n = 0;
XtSetArg(args[n], XtNfromHoriz, NULL); n++;
diff --git a/print.h b/print.h
index 0466563..7eb2e9a 100644
--- a/print.h
+++ b/print.h
@@ -40,6 +40,7 @@ void DoPrintManpage(const char *programname,
FILE *manpage,
Widget toplevel,
Display *pdpy, XPContext pcontext,
+ XpuColorspaceRec *colorspace,
XtCallbackProc printDisplayDestroyCallback,
const char *jobTitle,
const char *toFile);