1 | /* |
---|
2 | Copyright (C) 1991,1992 Adobe Systems Incorporated. |
---|
3 | All rights reserved |
---|
4 | RCSID: $Header: /afs/dev.mit.edu/source/repository/third/transcript/src/printpanel/PrintPanel.c,v 1.1.1.1 1996-10-07 20:25:54 ghudson Exp $ |
---|
5 | */ |
---|
6 | /* RCSLOG: |
---|
7 | * $Log: not supported by cvs2svn $ |
---|
8 | * Revision 4.5 1993/12/01 21:05:18 snichols |
---|
9 | * pass feature requests like PageSize to enscript. |
---|
10 | * |
---|
11 | * Revision 4.4 1993/08/25 22:12:36 snichols |
---|
12 | * added ScrolledWindow widget to accomodate printers with lots of features. |
---|
13 | * |
---|
14 | * Revision 4.3 1993/08/23 22:59:07 snichols |
---|
15 | * fixed problems with Motif 1.2, and a problem with an uninitialized variable. |
---|
16 | * |
---|
17 | * Revision 4.2 1993/08/19 17:25:58 snichols |
---|
18 | * updated for Motif 1.2 |
---|
19 | * |
---|
20 | * Revision 4.1 1992/12/15 17:36:24 snichols |
---|
21 | * handle constraints where all options are constrained. |
---|
22 | * |
---|
23 | * Revision 4.0 1992/08/21 16:24:13 snichols |
---|
24 | * Release 4.0 |
---|
25 | * |
---|
26 | * Revision 1.18 1992/08/19 23:45:38 snichols |
---|
27 | * counter incremented one too far in BuildFeatures. |
---|
28 | * |
---|
29 | * Revision 1.17 1992/08/19 21:55:54 snichols |
---|
30 | * In InitList, if no item matches, shouldn't select any. |
---|
31 | * |
---|
32 | * Revision 1.16 1992/07/29 21:39:44 snichols |
---|
33 | * cleaned up several small bugs: dialog title on message box, size of file |
---|
34 | * selection boxes, don't unmanage null child when deselecting NONE filter, |
---|
35 | * and handle transition on printer features boxes better. |
---|
36 | * |
---|
37 | * Revision 1.15 1992/07/14 23:12:56 snichols |
---|
38 | * Updated copyright. |
---|
39 | * |
---|
40 | * Revision 1.14 1992/07/14 23:09:47 snichols |
---|
41 | * Added RCS header. |
---|
42 | * |
---|
43 | * Revision 1.13 1992/07/10 21:44:51 snichols |
---|
44 | * support for psdraft, plus graying out overtranslate and shrink to fit |
---|
45 | * unless landscape is selected. |
---|
46 | * |
---|
47 | * Revision 1.12 1992/06/23 17:13:20 snichols |
---|
48 | * fixed a couple of bugs with default choices on printer feature panel, with |
---|
49 | * graying things out, and added support for using PPD to determine fax |
---|
50 | * availability. |
---|
51 | * |
---|
52 | * Revision 1.11 1992/06/01 23:57:28 snichols |
---|
53 | * screwed up RCSID. |
---|
54 | * |
---|
55 | * Revision 1.10 1992/06/01 23:05:46 snichols |
---|
56 | * more support for command-line options, support for specifying |
---|
57 | * previewer in a file, and more SYSV support. |
---|
58 | * |
---|
59 | * |
---|
60 | */ |
---|
61 | |
---|
62 | #include <stdio.h> |
---|
63 | #include <ctype.h> |
---|
64 | #ifdef XPG3 |
---|
65 | #include <stdlib.h> |
---|
66 | #endif |
---|
67 | #include <string.h> |
---|
68 | #include <sys/wait.h> |
---|
69 | #include <X11/StringDefs.h> |
---|
70 | #include <X11/IntrinsicP.h> |
---|
71 | #include <Xm/Xm.h> |
---|
72 | #if XmVersion > 1001 |
---|
73 | #include <Xm/ManagerP.h> |
---|
74 | #else |
---|
75 | #include <Xm/XmP.h> |
---|
76 | #endif |
---|
77 | #include <Xm/Form.h> |
---|
78 | #include <Xm/List.h> |
---|
79 | #include <Xm/Label.h> |
---|
80 | #include <Xm/PushB.h> |
---|
81 | #include <Xm/PushBG.h> |
---|
82 | #include <Xm/RowColumn.h> |
---|
83 | #include <Xm/ToggleB.h> |
---|
84 | #include <Xm/TextF.h> |
---|
85 | #include <Xm/FileSB.h> |
---|
86 | #include <Xm/Separator.h> |
---|
87 | #include <Xm/MessageB.h> |
---|
88 | #include <Xm/ScrolledW.h> |
---|
89 | #include <Xm/ScrollBar.h> |
---|
90 | #include <Xm/DialogS.h> |
---|
91 | |
---|
92 | #include "config.h" |
---|
93 | #include "transcript.h" |
---|
94 | |
---|
95 | #include "PrintPaneP.h" |
---|
96 | |
---|
97 | #define CS(str) XmStringCreate(str, XmSTRING_DEFAULT_CHARSET) |
---|
98 | static XmString CSempty; |
---|
99 | |
---|
100 | |
---|
101 | /* need to figure out resources */ |
---|
102 | #define Offset(field) XtOffsetOf(PrintPanelRec, printpanel.field) |
---|
103 | |
---|
104 | static XtResource resources[] = { |
---|
105 | {XtNinputFileName, XtCString, XtRString, sizeof(String), |
---|
106 | Offset(in_file_name), XtRString, (XtPointer) NULL}, |
---|
107 | {XtNfilterName, XtCString, XtRString, sizeof(String), |
---|
108 | Offset(filter_name), XtRString, (XtPointer) NULL}, |
---|
109 | {XtNprinterName, XtCString, XtRString, sizeof(String), |
---|
110 | Offset(printer_name), XtRString, (XtPointer) NULL}, |
---|
111 | {XtNokCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), |
---|
112 | Offset(ok_callback), XtRCallback, (XtPointer) NULL}, |
---|
113 | {XtNcancelCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), |
---|
114 | Offset(cancel_callback), XtRCallback, (XtPointer) NULL} |
---|
115 | }; |
---|
116 | |
---|
117 | /* forward decls */ |
---|
118 | |
---|
119 | static void Initialize(), Destroy(), ChangeManaged(), Resize(); |
---|
120 | static Boolean SetValues(); |
---|
121 | static XtGeometryResult GeometryManager(); |
---|
122 | |
---|
123 | |
---|
124 | PrintPanelClassRec printPanelClassRec = { |
---|
125 | /* core class part */ |
---|
126 | { |
---|
127 | (WidgetClass) &xmManagerClassRec, /* superclass */ |
---|
128 | "PrintPanel", /* class_name */ |
---|
129 | sizeof(PrintPanelRec), /* widget_size */ |
---|
130 | NULL, /* class_initialize */ |
---|
131 | NULL, /* class_part_initialize */ |
---|
132 | FALSE, /* class_inited */ |
---|
133 | Initialize, /* initialize */ |
---|
134 | NULL, /* initialize_hook */ |
---|
135 | XtInheritRealize, /* realize */ |
---|
136 | NULL, /* actions */ |
---|
137 | 0, /* num_actions */ |
---|
138 | resources, /* resources */ |
---|
139 | XtNumber(resources), /* num_resources */ |
---|
140 | NULLQUARK, /* xrm_class */ |
---|
141 | TRUE, /* compress_motion */ |
---|
142 | XtExposeCompressMultiple, /* compress_exposure */ |
---|
143 | TRUE, /* compress_enterleave */ |
---|
144 | FALSE, /* visible_interest */ |
---|
145 | Destroy, /* destroy */ |
---|
146 | Resize, /* resize */ |
---|
147 | NULL, /* expose */ |
---|
148 | NULL, /* set_values */ |
---|
149 | NULL, /* set_values_hook */ |
---|
150 | XtInheritSetValuesAlmost, /* set_values_almost */ |
---|
151 | NULL, /* get_values_hook */ |
---|
152 | NULL, /* accept_focus */ |
---|
153 | XtVersion, /* version */ |
---|
154 | NULL, /* callback_offsets */ |
---|
155 | NULL, /* tm_table */ |
---|
156 | XtInheritQueryGeometry, /* query_geometry */ |
---|
157 | NULL, /* display_accelerator */ |
---|
158 | NULL, /* extension */ |
---|
159 | }, |
---|
160 | /* Composite class part */ |
---|
161 | { |
---|
162 | GeometryManager, /* geometry_manager */ |
---|
163 | ChangeManaged, /* change_managed */ |
---|
164 | XtInheritInsertChild, /* insert_child */ |
---|
165 | XtInheritDeleteChild, /* delete_child */ |
---|
166 | NULL, /* extension */ |
---|
167 | }, |
---|
168 | { |
---|
169 | /* Constraint class part */ |
---|
170 | NULL, /* resources */ |
---|
171 | 0, /* num_resources */ |
---|
172 | 0, /* constraint_size */ |
---|
173 | NULL, /* initialize */ |
---|
174 | NULL, /* destroy */ |
---|
175 | NULL, /* set_values */ |
---|
176 | NULL, /* extension */ |
---|
177 | }, |
---|
178 | /* Manager class part */ |
---|
179 | { |
---|
180 | XtInheritTranslations, /* translations */ |
---|
181 | NULL, /* syn_resources */ |
---|
182 | 0, /* num_syn_resources */ |
---|
183 | NULL, /* syn_constraint_resources */ |
---|
184 | 0, /* num_syn_constraint_resources */ |
---|
185 | XmInheritParentProcess, /* parent_process */ |
---|
186 | NULL, /* extension */ |
---|
187 | }, |
---|
188 | /* PrintPanel class part */ |
---|
189 | { |
---|
190 | NULL, /* extension */ |
---|
191 | } |
---|
192 | }; |
---|
193 | |
---|
194 | WidgetClass printPanelWidgetClass = (WidgetClass) &printPanelClassRec; |
---|
195 | |
---|
196 | |
---|
197 | /* forward dec'ls */ |
---|
198 | static void okCallback(); |
---|
199 | static void applyCallback(); |
---|
200 | static void resetCallback(); |
---|
201 | static void cancelCallback(); |
---|
202 | static void RadioCallback(); |
---|
203 | static void PrinterStatusCallback(); |
---|
204 | static void SecondaryCallback(); |
---|
205 | static void ListSelection(); |
---|
206 | static void RangeCallback(); |
---|
207 | static void IntTextFieldChange(); |
---|
208 | static void FilterFieldChange(); |
---|
209 | static void ChooseFileCallback(); |
---|
210 | static void CancelPopup(); |
---|
211 | static void ReadErrors(); |
---|
212 | static void CreateFSB(); |
---|
213 | static void CreateFeaturePanel(); |
---|
214 | static void CreateFaxPanel(); |
---|
215 | static void CleanupOldFeatures(); |
---|
216 | static void CleanupPhoneEntry(); |
---|
217 | static void CreateSpecialFeatures(); |
---|
218 | static void CreateDraftPanel(); |
---|
219 | static void BuildFeatures(); |
---|
220 | static void BuildPhoneEntry(); |
---|
221 | static void CreateGenericPanel(); |
---|
222 | static void CreatePtroffPanel(); |
---|
223 | static void CreatePsroffPanel(); |
---|
224 | static void CreatePlotPanel(); |
---|
225 | static void Create630Panel(); |
---|
226 | static void Create4014Panel(); |
---|
227 | static void CreateEnscriptPanel(); |
---|
228 | static void AddToCompoundList(); |
---|
229 | static int addarg(); |
---|
230 | static int GetPrinterList(); |
---|
231 | static int GetSysVPrinterList(); |
---|
232 | extern int GetPhonebookKeys(); |
---|
233 | static void SetFax(); |
---|
234 | static void StringTextFieldChange(); |
---|
235 | |
---|
236 | typedef struct _FilterData { |
---|
237 | char *name; |
---|
238 | int can_spool; |
---|
239 | int can_write; |
---|
240 | char *spool_flag; |
---|
241 | char *stdout_flag; |
---|
242 | char *file_flag; |
---|
243 | } FilterData; |
---|
244 | |
---|
245 | FilterData filter_array[] = { |
---|
246 | { "enscript", TRUE, TRUE, "-P", "-p-", "-p" }, |
---|
247 | { "psroff", TRUE, FALSE, "-P", "-t", NULL }, |
---|
248 | { "ptroff", TRUE, FALSE, "-P", "-t", NULL }, |
---|
249 | { "ps630", FALSE, TRUE, NULL, NULL, "-p" }, |
---|
250 | { "ps4014", FALSE, TRUE, NULL, NULL, "-p" }, |
---|
251 | { "psplot", FALSE, FALSE, NULL, NULL, NULL }, |
---|
252 | { "none", FALSE, FALSE, NULL, NULL, NULL } |
---|
253 | }; |
---|
254 | |
---|
255 | static int num_filter_array = 7; |
---|
256 | |
---|
257 | static char *truevalue = "True"; |
---|
258 | #ifdef BSD |
---|
259 | static char *lprname = "lpr"; |
---|
260 | static char *printerstring = "-P"; |
---|
261 | #endif |
---|
262 | #ifdef SYSV |
---|
263 | static char *lprname = "lp"; |
---|
264 | static char *printerstring = "-d"; |
---|
265 | #endif |
---|
266 | |
---|
267 | |
---|
268 | |
---|
269 | static void Destroy(widget) |
---|
270 | Widget widget; |
---|
271 | { |
---|
272 | PrintPanelWidget p = (PrintPanelWidget) widget; |
---|
273 | |
---|
274 | /* this is just a place holder for the time being. When I fix up the |
---|
275 | rest of the code so that there is alloc'ed storage in some places |
---|
276 | where there are currently arrays, I'll free them here */ |
---|
277 | } |
---|
278 | |
---|
279 | static void Resize(widget) |
---|
280 | Widget widget; |
---|
281 | { |
---|
282 | PrintPanelWidget p = (PrintPanelWidget) widget; |
---|
283 | |
---|
284 | XtResizeWidget(p->printpanel.panel_child, p->core.width, |
---|
285 | p->core.height, 0); |
---|
286 | } |
---|
287 | |
---|
288 | static XtGeometryResult GeometryManager(w, desired, allowed) |
---|
289 | Widget w; |
---|
290 | XtWidgetGeometry *desired, *allowed; |
---|
291 | { |
---|
292 | |
---|
293 | #define WANTS(flag) (desired->request_mode & flag) |
---|
294 | |
---|
295 | if (WANTS(XtCWQueryOnly)) return XtGeometryYes; |
---|
296 | |
---|
297 | if (WANTS(CWWidth)) w->core.width = desired->width; |
---|
298 | if (WANTS(CWHeight)) w->core.height = desired->height; |
---|
299 | if (WANTS(CWX)) w->core.x = desired->x; |
---|
300 | if (WANTS(CWY)) w->core.y = desired->y; |
---|
301 | if (WANTS(CWBorderWidth)) { |
---|
302 | w->core.border_width = desired->border_width; |
---|
303 | } |
---|
304 | |
---|
305 | return XtGeometryYes; |
---|
306 | #undef WANTS |
---|
307 | } |
---|
308 | |
---|
309 | static void ChangeManaged(w) |
---|
310 | Widget w; |
---|
311 | { |
---|
312 | PrintPanelWidget p = (PrintPanelWidget) w; |
---|
313 | |
---|
314 | w->core.width = p->composite.children[0]->core.width; |
---|
315 | w->core.height = p->composite.children[0]->core.height; |
---|
316 | } |
---|
317 | |
---|
318 | int GetFilter(p, str) |
---|
319 | PrintPanelWidget p; |
---|
320 | char *str; |
---|
321 | { |
---|
322 | int i; |
---|
323 | |
---|
324 | for (i = 0; i < p->printpanel.num_filters; i++) { |
---|
325 | if (strcmp(str, p->printpanel.filterlist[i].name) == 0) |
---|
326 | return i; |
---|
327 | } |
---|
328 | return -1; |
---|
329 | } |
---|
330 | |
---|
331 | static void InitList(num, namelist, listchild, select) |
---|
332 | int num; |
---|
333 | char *namelist[]; |
---|
334 | Widget listchild; |
---|
335 | char *select; |
---|
336 | { |
---|
337 | int i; |
---|
338 | int sel = -1; |
---|
339 | XmString *names; |
---|
340 | |
---|
341 | names = (XmString *) XtCalloc(num, sizeof(XmString)); |
---|
342 | |
---|
343 | for (i = 0; i < num; i++) { |
---|
344 | names[i] = CS(namelist[i]); |
---|
345 | if (strcmp(namelist[i], select) == 0) |
---|
346 | sel = i; |
---|
347 | } |
---|
348 | |
---|
349 | XtVaSetValues(listchild, XmNitemCount, num, XmNitems, names, NULL); |
---|
350 | |
---|
351 | if (sel != -1) { |
---|
352 | XmListSelectItem(listchild, names[sel], TRUE); |
---|
353 | } |
---|
354 | XtFree(names); |
---|
355 | } |
---|
356 | |
---|
357 | void Cleanup(p, filt) |
---|
358 | PrintPanelWidget p; |
---|
359 | int filt; |
---|
360 | { |
---|
361 | XtVaSetValues(p->printpanel.generic_label_child, XmNbottomWidget, |
---|
362 | p->printpanel.generic_separator_child, NULL); |
---|
363 | if (filt != NONE) |
---|
364 | XtUnmanageChildren(p->printpanel.option_children[filt].child, |
---|
365 | p->printpanel.option_children[filt].num_children); |
---|
366 | } |
---|
367 | |
---|
368 | static void ReadyOptions(p, filt, width, height, attach, labelstring) |
---|
369 | PrintPanelWidget p; |
---|
370 | int filt; |
---|
371 | int width, height; |
---|
372 | int attach; |
---|
373 | char *labelstring; |
---|
374 | { |
---|
375 | p->printpanel.option_callback_data.which_widget = |
---|
376 | p->printpanel.generic_panel_child; |
---|
377 | p->printpanel.option_callback_data.which_filter = filt; |
---|
378 | |
---|
379 | /* I don't have the slightest clue why you have to unmanage the label |
---|
380 | child, manage the rest of the children, change the constraint on the |
---|
381 | label child, then manage it, but this works */ |
---|
382 | |
---|
383 | XtUnmanageChild(p->printpanel.generic_label_child); |
---|
384 | if (filt == PSROFF) |
---|
385 | XtManageChildren(p->printpanel.option_children[PTROFF].child, |
---|
386 | p->printpanel.option_children[PTROFF].num_children); |
---|
387 | XtManageChildren(p->printpanel.option_children[filt].child, |
---|
388 | p->printpanel.option_children[filt].num_children); |
---|
389 | |
---|
390 | XtVaSetValues(p->printpanel.generic_panel_child, XmNwidth, width, |
---|
391 | XmNheight, height, NULL); |
---|
392 | |
---|
393 | XtVaSetValues(p->printpanel.generic_label_child, XmNlabelString, |
---|
394 | CS(labelstring), XmNbottomWidget, |
---|
395 | p->printpanel.option_children[filt].child[attach], NULL); |
---|
396 | XtManageChild(p->printpanel.generic_label_child); |
---|
397 | } |
---|
398 | |
---|
399 | |
---|
400 | void SetupFilter(p, fil) |
---|
401 | PrintPanelWidget p; |
---|
402 | int fil; |
---|
403 | { |
---|
404 | switch (fil) { |
---|
405 | case ENSCRIPT: |
---|
406 | ReadyOptions(p, fil, 500, 370, ROTATE, "Enscript Options"); |
---|
407 | break; |
---|
408 | case PSROFF: |
---|
409 | ReadyOptions(p, fil, 300, 230, DIRFIELD, "Psroff Options"); |
---|
410 | break; |
---|
411 | case PTROFF: |
---|
412 | ReadyOptions(p, fil, 300, 200, OPTFIELD, "Ptroff Options"); |
---|
413 | break; |
---|
414 | case PSPLT: |
---|
415 | ReadyOptions(p, fil, 350, 150, PROBUTTON, "Psplot Options"); |
---|
416 | break; |
---|
417 | case PS630: |
---|
418 | ReadyOptions(p, fil, 420, 187, BODYFIELD, "Ps630 Options"); |
---|
419 | break; |
---|
420 | case PS4014: |
---|
421 | ReadyOptions(p, fil, 450, 280, NOLFTOG, "Ps4014 Options"); |
---|
422 | break; |
---|
423 | default: |
---|
424 | break; |
---|
425 | } |
---|
426 | } |
---|
427 | |
---|
428 | static void CreateStandardButtons(form, ok, apply, reset, cancel, sep, name) |
---|
429 | Widget form; |
---|
430 | Widget *ok; |
---|
431 | Widget *apply; |
---|
432 | Widget *reset; |
---|
433 | Widget *cancel; |
---|
434 | Widget *sep; |
---|
435 | char *name; |
---|
436 | { |
---|
437 | char tmpname[100]; |
---|
438 | strcpy(tmpname, name); |
---|
439 | strcat(tmpname, "OK"); |
---|
440 | *ok = XtVaCreateManagedWidget(tmpname, xmPushButtonWidgetClass, form, |
---|
441 | XmNleftAttachment, XmATTACH_FORM, |
---|
442 | XmNbottomAttachment, XmATTACH_FORM, |
---|
443 | XmNlabelString, CS("OK"), XmNwidth, 60, |
---|
444 | XmNheight, 30, XmNbottomOffset, 10, |
---|
445 | XmNleftOffset, 10, NULL); |
---|
446 | |
---|
447 | strcpy(tmpname, name); |
---|
448 | strcat(tmpname, "Apply"); |
---|
449 | *apply = XtVaCreateManagedWidget(tmpname, xmPushButtonWidgetClass, form, |
---|
450 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
451 | XmNleftWidget, *ok, |
---|
452 | XmNbottomAttachment, XmATTACH_FORM, |
---|
453 | XmNlabelString, CS("Apply"), |
---|
454 | XmNwidth, 60, XmNheight, 30, |
---|
455 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
456 | NULL); |
---|
457 | |
---|
458 | strcpy(tmpname, name); |
---|
459 | strcat(tmpname, "Reset"); |
---|
460 | *reset = XtVaCreateManagedWidget(tmpname, xmPushButtonWidgetClass, form, |
---|
461 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
462 | XmNleftWidget, *apply, |
---|
463 | XmNbottomAttachment, XmATTACH_FORM, |
---|
464 | XmNlabelString, CS("Reset"), XmNwidth, |
---|
465 | 60, XmNheight, 30, XmNbottomOffset, 10, |
---|
466 | XmNleftOffset, 10, NULL); |
---|
467 | |
---|
468 | strcpy(tmpname, name); |
---|
469 | strcat(tmpname, "Cancel"); |
---|
470 | *cancel = XtVaCreateManagedWidget(tmpname, xmPushButtonWidgetClass, |
---|
471 | form, XmNleftAttachment, |
---|
472 | XmATTACH_WIDGET, XmNleftWidget, *reset, |
---|
473 | XmNbottomAttachment, XmATTACH_FORM, |
---|
474 | XmNlabelString, CS("Cancel"), |
---|
475 | XmNwidth, 60, XmNheight, 30, |
---|
476 | XmNbottomOffset, 10, XmNleftOffset, |
---|
477 | 10, NULL); |
---|
478 | strcpy(tmpname, name); |
---|
479 | strcat(tmpname, "Separator"); |
---|
480 | *sep = XtVaCreateManagedWidget(tmpname, xmSeparatorWidgetClass, |
---|
481 | form, XmNleftAttachment, |
---|
482 | XmATTACH_FORM, XmNrightAttachment, |
---|
483 | XmATTACH_FORM, XmNbottomAttachment, |
---|
484 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
485 | *ok, XmNbottomOffset, 10, NULL); |
---|
486 | } |
---|
487 | |
---|
488 | static void LayoutPanel(p) |
---|
489 | PrintPanelWidget p; |
---|
490 | { |
---|
491 | Arg args[10]; |
---|
492 | int i; |
---|
493 | char *filterlist[20]; |
---|
494 | |
---|
495 | p->printpanel.panel_child = |
---|
496 | XtVaCreateManagedWidget("ppanel", |
---|
497 | xmFormWidgetClass, (Widget) p, |
---|
498 | XmNwidth, 650, XmNheight, 485, |
---|
499 | NULL); |
---|
500 | /* |
---|
501 | XmNx, 100, XmNy, 80, NULL); |
---|
502 | */ |
---|
503 | |
---|
504 | |
---|
505 | /* secondary panels */ |
---|
506 | CreateSpecialFeatures(p); |
---|
507 | CreateDraftPanel(p); |
---|
508 | CreateFeaturePanel(p); |
---|
509 | CreateFaxPanel(p); |
---|
510 | CreateGenericPanel(p); |
---|
511 | CreateEnscriptPanel(p); |
---|
512 | CreatePtroffPanel(p); |
---|
513 | CreatePsroffPanel(p); |
---|
514 | CreatePlotPanel(p); |
---|
515 | Create630Panel(p); |
---|
516 | Create4014Panel(p); |
---|
517 | |
---|
518 | /* for now, just the built in filters; later, want to allow filter list |
---|
519 | to be specified in a resource */ |
---|
520 | for (i = 0; i < num_filter_array; i++) { |
---|
521 | strcpy(p->printpanel.filterlist[i].name, filter_array[i].name); |
---|
522 | p->printpanel.filterlist[i].index = i; |
---|
523 | p->printpanel.num_filters++; |
---|
524 | } |
---|
525 | if (p->printpanel.default_filter_name) { |
---|
526 | p->printpanel.filter = |
---|
527 | GetFilter(p, p->printpanel.default_filter_name); |
---|
528 | SetupFilter(p, p->printpanel.filter); |
---|
529 | } |
---|
530 | |
---|
531 | |
---|
532 | /* primary panel */ |
---|
533 | p->printpanel.ok_button_child = |
---|
534 | XtVaCreateManagedWidget("okButton", |
---|
535 | xmPushButtonWidgetClass, |
---|
536 | p->printpanel.panel_child, |
---|
537 | XmNleftAttachment, |
---|
538 | XmATTACH_FORM, |
---|
539 | XmNbottomAttachment, |
---|
540 | XmATTACH_FORM, |
---|
541 | XmNbottomOffset, 10, |
---|
542 | XmNleftOffset, 10, |
---|
543 | XmNwidth, 60, |
---|
544 | XmNheight, 30, |
---|
545 | XmNlabelString, CS("OK"), NULL); |
---|
546 | XtAddCallback(p->printpanel.ok_button_child, XmNactivateCallback, |
---|
547 | okCallback, p); |
---|
548 | |
---|
549 | p->printpanel.apply_button_child = |
---|
550 | XtVaCreateManagedWidget("applyButton", |
---|
551 | xmPushButtonWidgetClass, |
---|
552 | p->printpanel.panel_child, |
---|
553 | XmNleftAttachment, |
---|
554 | XmATTACH_WIDGET, |
---|
555 | XmNleftWidget, |
---|
556 | p->printpanel.ok_button_child, |
---|
557 | XmNbottomAttachment, XmATTACH_FORM, |
---|
558 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
559 | XmNlabelString, CS("Apply"), XmNwidth, 60, |
---|
560 | XmNheight, 30, NULL); |
---|
561 | XtAddCallback(p->printpanel.apply_button_child, XmNactivateCallback, |
---|
562 | applyCallback, p); |
---|
563 | |
---|
564 | p->printpanel.reset_button_child = |
---|
565 | XtVaCreateManagedWidget("resetButton", |
---|
566 | xmPushButtonWidgetClass, |
---|
567 | p->printpanel.panel_child, |
---|
568 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
569 | XmNleftWidget, |
---|
570 | p->printpanel.apply_button_child, |
---|
571 | XmNbottomAttachment, XmATTACH_FORM, |
---|
572 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
573 | XmNlabelString, CS("Reset"), XmNwidth, 60, |
---|
574 | XmNheight, 30, NULL); |
---|
575 | XtAddCallback(p->printpanel.reset_button_child, XmNactivateCallback, |
---|
576 | resetCallback, p); |
---|
577 | |
---|
578 | p->printpanel.cancel_button_child = |
---|
579 | XtVaCreateManagedWidget("cancelButton", |
---|
580 | xmPushButtonWidgetClass, |
---|
581 | p->printpanel.panel_child, |
---|
582 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
583 | XmNleftWidget, |
---|
584 | p->printpanel.reset_button_child, |
---|
585 | XmNbottomAttachment, XmATTACH_FORM, |
---|
586 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
587 | XmNlabelString, CS("Cancel"), XmNwidth, 60, |
---|
588 | XmNheight, 30, NULL); |
---|
589 | |
---|
590 | XtAddCallback(p->printpanel.cancel_button_child, XmNactivateCallback, |
---|
591 | cancelCallback, p); |
---|
592 | |
---|
593 | p->printpanel.bottom_separator_child = |
---|
594 | XtVaCreateManagedWidget("separator", |
---|
595 | xmSeparatorWidgetClass, |
---|
596 | p->printpanel.panel_child, |
---|
597 | XmNleftAttachment, XmATTACH_FORM, |
---|
598 | XmNrightAttachment, XmATTACH_FORM, |
---|
599 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
600 | XmNbottomWidget, |
---|
601 | p->printpanel.ok_button_child, |
---|
602 | XmNbottomOffset, 10, NULL); |
---|
603 | |
---|
604 | |
---|
605 | i = 0; |
---|
606 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
607 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
608 | XtSetArg(args[i], XmNbottomWidget, |
---|
609 | p->printpanel.bottom_separator_child); i++; |
---|
610 | p->printpanel.radio_box_child = |
---|
611 | XmCreateRadioBox(p->printpanel.panel_child, "radio", args, i); |
---|
612 | |
---|
613 | XtAddCallback(p->printpanel.radio_box_child, XmNentryCallback, |
---|
614 | RadioCallback, p); |
---|
615 | |
---|
616 | XtManageChild(p->printpanel.radio_box_child); |
---|
617 | |
---|
618 | p->printpanel.print_toggle_child = |
---|
619 | XtVaCreateManagedWidget("print", |
---|
620 | xmToggleButtonWidgetClass, |
---|
621 | p->printpanel.radio_box_child, |
---|
622 | XmNlabelString, CS("Print"), NULL); |
---|
623 | p->printpanel.save_toggle_child = |
---|
624 | XtVaCreateManagedWidget("save", |
---|
625 | xmToggleButtonWidgetClass, |
---|
626 | p->printpanel.radio_box_child, |
---|
627 | XmNlabelString, CS("Save"), NULL); |
---|
628 | p->printpanel.preview_toggle_child = |
---|
629 | XtVaCreateManagedWidget("preview", |
---|
630 | xmToggleButtonWidgetClass, |
---|
631 | p->printpanel.radio_box_child, |
---|
632 | XmNlabelString, CS("Preview"), NULL); |
---|
633 | p->printpanel.fax_toggle_child = |
---|
634 | XtVaCreateManagedWidget("fax", |
---|
635 | xmToggleButtonWidgetClass, |
---|
636 | p->printpanel.radio_box_child, |
---|
637 | XmNlabelString, CS("Fax"), NULL); |
---|
638 | |
---|
639 | p->printpanel.open_button_child = |
---|
640 | XtVaCreateManagedWidget("openFile", |
---|
641 | xmPushButtonWidgetClass, |
---|
642 | p->printpanel.panel_child, |
---|
643 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
644 | XmNbottomWidget, |
---|
645 | p->printpanel.radio_box_child, |
---|
646 | XmNleftAttachment, XmATTACH_FORM, |
---|
647 | XmNlabelString, CS("Open File..."), |
---|
648 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
649 | XmNheight, 30, NULL); |
---|
650 | |
---|
651 | p->printpanel.open_field_child = |
---|
652 | XtVaCreateManagedWidget("openField", |
---|
653 | xmTextFieldWidgetClass, |
---|
654 | p->printpanel.panel_child, |
---|
655 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
656 | XmNbottomWidget, |
---|
657 | p->printpanel.radio_box_child, |
---|
658 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
659 | XmNleftWidget, |
---|
660 | p->printpanel.open_button_child, |
---|
661 | XmNwidth, 300, XmNleftOffset, 10, |
---|
662 | XmNbottomOffset, 10, NULL); |
---|
663 | |
---|
664 | XtAddCallback(p->printpanel.open_field_child, XmNvalueChangedCallback, |
---|
665 | StringTextFieldChange, &p->printpanel.input_file); |
---|
666 | |
---|
667 | p->printpanel.status_button_child = |
---|
668 | XtVaCreateManagedWidget("statusButton", |
---|
669 | xmPushButtonWidgetClass, |
---|
670 | p->printpanel.panel_child, |
---|
671 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
672 | XmNbottomWidget, |
---|
673 | p->printpanel.open_button_child, |
---|
674 | XmNleftAttachment, XmATTACH_FORM, |
---|
675 | XmNlabelString, CS("Queue Status..."), |
---|
676 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
677 | XmNheight, 30, NULL); |
---|
678 | |
---|
679 | |
---|
680 | XtAddCallback(p->printpanel.status_button_child, XmNactivateCallback, |
---|
681 | PrinterStatusCallback, NULL); |
---|
682 | |
---|
683 | |
---|
684 | p->printpanel.printer_option_button_child = |
---|
685 | XtVaCreateManagedWidget("printerOptions", |
---|
686 | xmPushButtonWidgetClass, |
---|
687 | p->printpanel.panel_child, |
---|
688 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
689 | XmNbottomWidget, |
---|
690 | p->printpanel.status_button_child, |
---|
691 | XmNleftAttachment, XmATTACH_FORM, |
---|
692 | XmNlabelString, CS("Printer Features..."), |
---|
693 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
694 | XmNheight, 30, NULL); |
---|
695 | |
---|
696 | XtAddCallback(p->printpanel.printer_option_button_child, |
---|
697 | XmNactivateCallback, SecondaryCallback, |
---|
698 | &p->printpanel.feature_panel_child); |
---|
699 | |
---|
700 | p->printpanel.filter_option_button_child = |
---|
701 | XtVaCreateManagedWidget("filterOptions", |
---|
702 | xmPushButtonWidgetClass, |
---|
703 | p->printpanel.panel_child, |
---|
704 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
705 | XmNbottomWidget, |
---|
706 | p->printpanel.status_button_child, |
---|
707 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
708 | XmNleftWidget, |
---|
709 | p->printpanel.printer_option_button_child, |
---|
710 | XmNlabelString, CS("Filter Options..."), |
---|
711 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
712 | XmNheight, 30, NULL); |
---|
713 | |
---|
714 | XtAddCallback(p->printpanel.filter_option_button_child, |
---|
715 | XmNactivateCallback, SecondaryCallback, |
---|
716 | &p->printpanel.generic_panel_child); |
---|
717 | |
---|
718 | p->printpanel.special_button_child = |
---|
719 | XtVaCreateManagedWidget("specialFilter", |
---|
720 | xmPushButtonWidgetClass, |
---|
721 | p->printpanel.panel_child, |
---|
722 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
723 | XmNbottomWidget, |
---|
724 | p->printpanel.open_button_child, |
---|
725 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
726 | XmNleftWidget, |
---|
727 | p->printpanel.status_button_child, |
---|
728 | XmNlabelString, CS("Special Features..."), |
---|
729 | XmNbottomOffset, 10, XmNleftOffset, 10, |
---|
730 | XmNheight, 30, NULL); |
---|
731 | |
---|
732 | XtAddCallback(p->printpanel.special_button_child, XmNactivateCallback, |
---|
733 | SecondaryCallback, &(p->printpanel.special_form_child)); |
---|
734 | |
---|
735 | p->printpanel.top_separator_child = |
---|
736 | XtVaCreateManagedWidget("topSeparator", |
---|
737 | xmSeparatorWidgetClass, |
---|
738 | p->printpanel.panel_child, |
---|
739 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
740 | XmNbottomWidget, |
---|
741 | p->printpanel.printer_option_button_child, |
---|
742 | XmNleftAttachment, XmATTACH_FORM, |
---|
743 | XmNrightAttachment, XmATTACH_FORM, |
---|
744 | XmNbottomOffset, 10, NULL); |
---|
745 | |
---|
746 | p->printpanel.printer_field_child = |
---|
747 | XtVaCreateManagedWidget("printerField", |
---|
748 | xmTextFieldWidgetClass, |
---|
749 | p->printpanel.panel_child, |
---|
750 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
751 | XmNbottomWidget, |
---|
752 | p->printpanel.top_separator_child, |
---|
753 | XmNleftAttachment, XmATTACH_FORM, |
---|
754 | XmNwidth, 200, NULL); |
---|
755 | |
---|
756 | p->printpanel.fax_label_child = |
---|
757 | XtVaCreateManagedWidget("faxToLabel", |
---|
758 | xmLabelWidgetClass, |
---|
759 | p->printpanel.panel_child, |
---|
760 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
761 | XmNleftWidget, |
---|
762 | p->printpanel.radio_box_child, |
---|
763 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
764 | XmNbottomWidget, |
---|
765 | p->printpanel.bottom_separator_child, |
---|
766 | XmNbottomOffset, 7, |
---|
767 | XmNlabelString, CS("to"), NULL); |
---|
768 | |
---|
769 | XtSetSensitive(p->printpanel.fax_label_child, FALSE); |
---|
770 | |
---|
771 | p->printpanel.fax_text_child = |
---|
772 | XtVaCreateManagedWidget("faxTextField", |
---|
773 | xmTextFieldWidgetClass, |
---|
774 | p->printpanel.panel_child, |
---|
775 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
776 | XmNleftWidget, |
---|
777 | p->printpanel.fax_label_child, |
---|
778 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
779 | XmNbottomWidget, |
---|
780 | p->printpanel.bottom_separator_child, |
---|
781 | XmNbottomOffset, 4, XmNwidth, 300, NULL); |
---|
782 | |
---|
783 | XtSetSensitive(p->printpanel.fax_text_child, FALSE); |
---|
784 | |
---|
785 | p->printpanel.fax_button_child = |
---|
786 | XtVaCreateManagedWidget("faxButton", |
---|
787 | xmPushButtonWidgetClass, |
---|
788 | p->printpanel.panel_child, |
---|
789 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
790 | XmNleftWidget, |
---|
791 | p->printpanel.fax_text_child, |
---|
792 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
793 | XmNbottomWidget, |
---|
794 | p->printpanel.bottom_separator_child, |
---|
795 | XmNlabelString, CS("..."), |
---|
796 | XmNbottomOffset, 5, XmNwidth, 40, NULL); |
---|
797 | |
---|
798 | XtSetSensitive(p->printpanel.fax_button_child, FALSE); |
---|
799 | XtAddCallback(p->printpanel.fax_button_child, XmNactivateCallback, |
---|
800 | SecondaryCallback, &(p->printpanel.fax_panel_child)); |
---|
801 | |
---|
802 | p->printpanel.save_label_child = |
---|
803 | XtVaCreateManagedWidget("saveAsLabel", |
---|
804 | xmLabelWidgetClass, |
---|
805 | p->printpanel.panel_child, |
---|
806 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
807 | XmNleftWidget, |
---|
808 | p->printpanel.radio_box_child, |
---|
809 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
810 | XmNbottomWidget, |
---|
811 | p->printpanel.fax_label_child, |
---|
812 | XmNbottomOffset, 40, |
---|
813 | XmNlabelString, CS("as"), NULL); |
---|
814 | |
---|
815 | XtSetSensitive(p->printpanel.save_label_child, FALSE); |
---|
816 | |
---|
817 | p->printpanel.save_text_child = |
---|
818 | XtVaCreateManagedWidget("saveTextField", |
---|
819 | xmTextFieldWidgetClass, |
---|
820 | p->printpanel.panel_child, |
---|
821 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
822 | XmNleftWidget, |
---|
823 | p->printpanel.save_label_child, |
---|
824 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
825 | XmNbottomWidget, |
---|
826 | p->printpanel.fax_text_child, |
---|
827 | XmNbottomOffset, 27, XmNwidth, 300, NULL); |
---|
828 | |
---|
829 | XtSetSensitive(p->printpanel.save_text_child, FALSE); |
---|
830 | XtAddCallback(p->printpanel.save_text_child, XmNvalueChangedCallback, |
---|
831 | StringTextFieldChange, &p->printpanel.output_file); |
---|
832 | |
---|
833 | p->printpanel.save_button_child = |
---|
834 | XtVaCreateManagedWidget("saveButton", |
---|
835 | xmPushButtonWidgetClass, |
---|
836 | p->printpanel.panel_child, |
---|
837 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
838 | XmNleftWidget, |
---|
839 | p->printpanel.save_text_child, |
---|
840 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
841 | XmNbottomWidget, |
---|
842 | p->printpanel.fax_button_child, |
---|
843 | XmNbottomOffset, 30, XmNwidth, 40, |
---|
844 | XmNlabelString, CS("..."), NULL); |
---|
845 | |
---|
846 | XtSetSensitive(p->printpanel.save_button_child, FALSE); |
---|
847 | |
---|
848 | p->printpanel.printer_label_child = |
---|
849 | XtVaCreateManagedWidget("printerLabel", |
---|
850 | xmLabelWidgetClass, |
---|
851 | p->printpanel.panel_child, |
---|
852 | XmNtopAttachment, XmATTACH_FORM, |
---|
853 | XmNtopOffset, 5, |
---|
854 | XmNleftAttachment, XmATTACH_FORM, |
---|
855 | XmNlabelString, CS("Select Printer"), NULL); |
---|
856 | |
---|
857 | p->printpanel.filter_label_child = |
---|
858 | XtVaCreateManagedWidget("filterLabel", |
---|
859 | xmLabelWidgetClass, |
---|
860 | p->printpanel.panel_child, |
---|
861 | XmNtopAttachment, XmATTACH_FORM, |
---|
862 | XmNtopOffset, 5, |
---|
863 | XmNleftAttachment, XmATTACH_POSITION, |
---|
864 | XmNleftPosition, 50, |
---|
865 | XmNlabelString, CS("Select Filter"), NULL); |
---|
866 | |
---|
867 | i = 0; |
---|
868 | XtSetArg(args[i], XmNitemCount, 1); i++; |
---|
869 | XtSetArg(args[i], XmNitems, &CSempty); i++; |
---|
870 | p->printpanel.printer_list_child = |
---|
871 | XmCreateScrolledList(p->printpanel.panel_child, |
---|
872 | "printerList", args, i); |
---|
873 | p->printpanel.filter_list_child = |
---|
874 | XmCreateScrolledList(p->printpanel.panel_child, |
---|
875 | "filterList", args, i); |
---|
876 | |
---|
877 | XtVaSetValues(XtParent(p->printpanel.printer_list_child), |
---|
878 | XmNtopAttachment, XmATTACH_WIDGET, |
---|
879 | XmNtopWidget, p->printpanel.printer_label_child, |
---|
880 | XmNleftAttachment, XmATTACH_FORM, |
---|
881 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
882 | XmNbottomWidget, p->printpanel.printer_field_child, |
---|
883 | XmNrightAttachment, XmATTACH_POSITION, |
---|
884 | XmNrightPosition, 35, NULL); |
---|
885 | |
---|
886 | XtManageChild(p->printpanel.printer_list_child); |
---|
887 | XtAddCallback(p->printpanel.printer_list_child, XmNbrowseSelectionCallback, |
---|
888 | ListSelection, p); |
---|
889 | |
---|
890 | InitList(p->printpanel.num_printers, p->printpanel.printers, |
---|
891 | p->printpanel.printer_list_child, |
---|
892 | p->printpanel.current_printer_name); |
---|
893 | |
---|
894 | p->printpanel.page_label_child = |
---|
895 | XtVaCreateManagedWidget("pageLabel", |
---|
896 | xmLabelWidgetClass, |
---|
897 | p->printpanel.panel_child, |
---|
898 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
899 | XmNbottomWidget, |
---|
900 | p->printpanel.open_field_child, |
---|
901 | XmNbottomOffset, 50, |
---|
902 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
903 | XmNleftWidget, |
---|
904 | p->printpanel.open_field_child, |
---|
905 | XmNlabelString, CS("Pages:"), NULL); |
---|
906 | |
---|
907 | i = 0; |
---|
908 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++; |
---|
909 | XtSetArg(args[i], XmNleftWidget, p->printpanel.page_label_child); i++; |
---|
910 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
911 | XtSetArg(args[i], XmNbottomWidget, p->printpanel.open_field_child); i++; |
---|
912 | XtSetArg(args[i], XmNbottomOffset, 7); i++; |
---|
913 | p->printpanel.page_box_child = |
---|
914 | XmCreateRadioBox(p->printpanel.panel_child, "page", args, i); |
---|
915 | XtAddCallback(p->printpanel.page_box_child, XmNentryCallback, |
---|
916 | RangeCallback, p); |
---|
917 | XtManageChild(p->printpanel.page_box_child); |
---|
918 | |
---|
919 | p->printpanel.all_toggle_child = |
---|
920 | XtVaCreateManagedWidget("all", |
---|
921 | xmToggleButtonWidgetClass, |
---|
922 | p->printpanel.page_box_child, |
---|
923 | XmNlabelString, CS("All"), NULL); |
---|
924 | |
---|
925 | p->printpanel.range_toggle_child = |
---|
926 | XtVaCreateManagedWidget("range", |
---|
927 | xmToggleButtonWidgetClass, |
---|
928 | p->printpanel.page_box_child, |
---|
929 | XmNlabelString, CS("from"), NULL); |
---|
930 | |
---|
931 | p->printpanel.begin_field_child = |
---|
932 | XtVaCreateManagedWidget("rangeBegin", |
---|
933 | xmTextFieldWidgetClass, |
---|
934 | p->printpanel.panel_child, |
---|
935 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
936 | XmNleftWidget, |
---|
937 | p->printpanel.page_box_child, |
---|
938 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
939 | XmNbottomWidget, |
---|
940 | p->printpanel.open_field_child, |
---|
941 | XmNbottomOffset, 7, XmNwidth, 40, NULL); |
---|
942 | |
---|
943 | XtSetSensitive(p->printpanel.begin_field_child, FALSE); |
---|
944 | XtAddCallback(p->printpanel.begin_field_child, XmNvalueChangedCallback, |
---|
945 | IntTextFieldChange, &(p->printpanel.page_ranges[0].begin)); |
---|
946 | |
---|
947 | p->printpanel.range_label_child = |
---|
948 | XtVaCreateManagedWidget("toLabel", |
---|
949 | xmLabelWidgetClass, |
---|
950 | p->printpanel.panel_child, |
---|
951 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
952 | XmNleftWidget, |
---|
953 | p->printpanel.begin_field_child, |
---|
954 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
955 | XmNbottomWidget, |
---|
956 | p->printpanel.open_field_child, |
---|
957 | XmNbottomOffset, 10, |
---|
958 | XmNlabelString, CS("to"), NULL); |
---|
959 | |
---|
960 | p->printpanel.end_field_child = |
---|
961 | XtVaCreateManagedWidget("rangeEnd", |
---|
962 | xmTextFieldWidgetClass, |
---|
963 | p->printpanel.panel_child, |
---|
964 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
965 | XmNleftWidget, |
---|
966 | p->printpanel.range_label_child, |
---|
967 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
968 | XmNbottomWidget, |
---|
969 | p->printpanel.open_field_child, |
---|
970 | XmNbottomOffset, 7, XmNwidth, 40, NULL); |
---|
971 | |
---|
972 | XtSetSensitive(p->printpanel.end_field_child, FALSE); |
---|
973 | XtAddCallback(p->printpanel.end_field_child, XmNvalueChangedCallback, |
---|
974 | IntTextFieldChange, &(p->printpanel.page_ranges[0].end)); |
---|
975 | |
---|
976 | p->printpanel.copy_label_child = |
---|
977 | XtVaCreateManagedWidget("copyLabel", |
---|
978 | xmLabelWidgetClass, |
---|
979 | p->printpanel.panel_child, |
---|
980 | XmNtopAttachment, XmATTACH_WIDGET, |
---|
981 | XmNtopWidget, p->printpanel.page_box_child, |
---|
982 | XmNtopOffset, 20, |
---|
983 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
984 | XmNleftWidget, |
---|
985 | p->printpanel.save_button_child, |
---|
986 | XmNleftOffset, 10, |
---|
987 | XmNlabelString, CS("Copies:"), NULL); |
---|
988 | |
---|
989 | p->printpanel.copy_field_child = |
---|
990 | XtVaCreateManagedWidget("copyField", |
---|
991 | xmTextFieldWidgetClass, |
---|
992 | p->printpanel.panel_child, |
---|
993 | XmNtopAttachment, XmATTACH_WIDGET, |
---|
994 | XmNtopWidget, p->printpanel.page_box_child, |
---|
995 | XmNtopOffset, 15, |
---|
996 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
997 | XmNleftWidget, |
---|
998 | p->printpanel.copy_label_child, |
---|
999 | XmNvalue, "1", XmNwidth, 40, NULL); |
---|
1000 | |
---|
1001 | XtAddCallback(p->printpanel.copy_field_child, XmNvalueChangedCallback, |
---|
1002 | IntTextFieldChange, &p->printpanel.copies); |
---|
1003 | |
---|
1004 | p->printpanel.filter_field_child = |
---|
1005 | XtVaCreateManagedWidget("filterField", |
---|
1006 | xmTextFieldWidgetClass, |
---|
1007 | p->printpanel.panel_child, |
---|
1008 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
1009 | XmNbottomWidget, |
---|
1010 | p->printpanel.top_separator_child, |
---|
1011 | XmNleftAttachment, XmATTACH_POSITION, |
---|
1012 | XmNleftPosition, 50, XmNwidth, 200, NULL); |
---|
1013 | |
---|
1014 | XtAddCallback(p->printpanel.filter_field_child, XmNvalueChangedCallback, |
---|
1015 | FilterFieldChange, p); |
---|
1016 | |
---|
1017 | XtVaSetValues(XtParent(p->printpanel.filter_list_child), |
---|
1018 | XmNtopAttachment, XmATTACH_WIDGET, |
---|
1019 | XmNtopWidget, p->printpanel.filter_label_child, |
---|
1020 | XmNleftAttachment, XmATTACH_POSITION, |
---|
1021 | XmNleftPosition, 50, |
---|
1022 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
1023 | XmNbottomWidget, p->printpanel.filter_field_child, |
---|
1024 | XmNrightAttachment, XmATTACH_POSITION, |
---|
1025 | XmNrightPosition, 85, NULL); |
---|
1026 | |
---|
1027 | XtManageChild(p->printpanel.filter_list_child); |
---|
1028 | XtAddCallback(p->printpanel.filter_list_child, XmNbrowseSelectionCallback, |
---|
1029 | ListSelection, p); |
---|
1030 | |
---|
1031 | for (i = 0; i < p->printpanel.num_filters; i++) |
---|
1032 | filterlist[i] = p->printpanel.filterlist[i].name; |
---|
1033 | InitList(p->printpanel.num_filters, filterlist, |
---|
1034 | p->printpanel.filter_list_child, |
---|
1035 | p->printpanel.filterlist[p->printpanel.filter].name); |
---|
1036 | |
---|
1037 | XmToggleButtonSetState(p->printpanel.print_toggle_child, TRUE, TRUE); |
---|
1038 | XmToggleButtonSetState(p->printpanel.all_toggle_child, TRUE, TRUE); |
---|
1039 | |
---|
1040 | CreateFSB(p); |
---|
1041 | XtAddCallback(p->printpanel.open_button_child, XmNactivateCallback, |
---|
1042 | ChooseFileCallback, |
---|
1043 | p->printpanel.input_file_selection_child); |
---|
1044 | XtAddCallback(p->printpanel.save_button_child, XmNactivateCallback, |
---|
1045 | ChooseFileCallback, |
---|
1046 | p->printpanel.output_file_selection_child); |
---|
1047 | |
---|
1048 | i = 0; |
---|
1049 | XtSetArg(args[i], XmNdialogTitle, CS("Message Box")); i++; |
---|
1050 | p->printpanel.message_dialog_child = |
---|
1051 | XmCreateMessageDialog(p->printpanel.panel_child, "Message", args, |
---|
1052 | i); |
---|
1053 | XtAddCallback(p->printpanel.message_dialog_child, XmNokCallback, |
---|
1054 | CancelPopup, NULL); |
---|
1055 | |
---|
1056 | XtUnmanageChild(XmMessageBoxGetChild(p->printpanel.message_dialog_child, |
---|
1057 | XmDIALOG_CANCEL_BUTTON)); |
---|
1058 | XtUnmanageChild(XmMessageBoxGetChild(p->printpanel.message_dialog_child, |
---|
1059 | XmDIALOG_HELP_BUTTON)); |
---|
1060 | } |
---|
1061 | |
---|
1062 | static void Initialize(request, new, args, num_args) |
---|
1063 | Widget request, new; |
---|
1064 | ArgList args; |
---|
1065 | Cardinal *num_args; |
---|
1066 | { |
---|
1067 | int i; |
---|
1068 | char *tmp; |
---|
1069 | FILE *fp; |
---|
1070 | char fname[1024]; |
---|
1071 | int gray = FALSE; |
---|
1072 | |
---|
1073 | PrintPanelWidget p = (PrintPanelWidget) new; |
---|
1074 | |
---|
1075 | p->printpanel.save_fd = -1; |
---|
1076 | CSempty = CS(""); |
---|
1077 | p->printpanel.builtup_line[0] = '\0'; |
---|
1078 | p->printpanel.use_pslpr = FALSE; |
---|
1079 | p->printpanel.use_psnup = FALSE; |
---|
1080 | p->printpanel.copies = 1; |
---|
1081 | p->printpanel.filter = NONE; |
---|
1082 | p->printpanel.nup_info.rows = p->printpanel.nup_info.columns = |
---|
1083 | p->printpanel.tmp_nup_info.rows = |
---|
1084 | p->printpanel.tmp_nup_info.columns = 2; |
---|
1085 | p->printpanel.nup_info.gaudy = p->printpanel.nup_info.rotated = FALSE; |
---|
1086 | p->printpanel.tmp_nup_info.gaudy = |
---|
1087 | p->printpanel.tmp_nup_info.rotated = FALSE; |
---|
1088 | for (i = 0; i < 10; i++) { |
---|
1089 | p->printpanel.page_ranges[i].begin = -1; |
---|
1090 | p->printpanel.page_ranges[i].end = -1; |
---|
1091 | } |
---|
1092 | #ifdef BSD |
---|
1093 | if ((i = GetPrinterList(p->printpanel.printers, |
---|
1094 | &p->printpanel.num_printers, MAXPRINTERS, |
---|
1095 | "/etc/printcap")) != 0) { |
---|
1096 | fprintf(stderr, "Could not get list of printers, error %d.\n", i); |
---|
1097 | } |
---|
1098 | #endif |
---|
1099 | #ifdef SYSV |
---|
1100 | if (GetSysVPrinterList(p->printpanel.printers, |
---|
1101 | &p->printpanel.num_printers, MAXPRINTERS) == |
---|
1102 | FALSE) { |
---|
1103 | fprintf(stderr, "ppanel: couldn't get list of printers.\n"); |
---|
1104 | } |
---|
1105 | #endif /* SYSV */ |
---|
1106 | |
---|
1107 | p->printpanel.default_printer_name = getenv("PRINTER"); |
---|
1108 | if (p->printpanel.printer_name != NULL) |
---|
1109 | p->printpanel.default_printer_name = p->printpanel.printer_name; |
---|
1110 | if (p->printpanel.default_printer_name) |
---|
1111 | strncpy(p->printpanel.current_printer_name, |
---|
1112 | p->printpanel.default_printer_name, 30); |
---|
1113 | p->printpanel.default_filter_name = getenv("TSFILTER"); |
---|
1114 | |
---|
1115 | |
---|
1116 | p->printpanel.enscript_info.font = |
---|
1117 | p->printpanel.enscript_info.header_font = |
---|
1118 | p->printpanel.enscript_info.header = NULL; |
---|
1119 | p->printpanel.tmp_enscript_info.font = |
---|
1120 | p->printpanel.tmp_enscript_info.header_font = |
---|
1121 | p->printpanel.tmp_enscript_info.header = NULL; |
---|
1122 | p->printpanel.enscript_info.font_size = |
---|
1123 | p->printpanel.enscript_info.header_font_size = |
---|
1124 | p->printpanel.tmp_enscript_info.font_size = |
---|
1125 | p->printpanel.tmp_enscript_info.header_font_size = -1; |
---|
1126 | p->printpanel.enscript_info.tab_width = |
---|
1127 | p->printpanel.enscript_info.columns = |
---|
1128 | p->printpanel.enscript_info.lines = -1; |
---|
1129 | p->printpanel.tmp_enscript_info.tab_width = |
---|
1130 | p->printpanel.tmp_enscript_info.columns = |
---|
1131 | p->printpanel.tmp_enscript_info.lines = -1; |
---|
1132 | p->printpanel.enscript_info.rotated = |
---|
1133 | p->printpanel.enscript_info.norotate = |
---|
1134 | p->printpanel.enscript_info.gaudy = |
---|
1135 | p->printpanel.enscript_info.lpt_mode = |
---|
1136 | p->printpanel.enscript_info.no_header = |
---|
1137 | p->printpanel.enscript_info.truncate_lines = 0; |
---|
1138 | p->printpanel.tmp_enscript_info.rotated = |
---|
1139 | p->printpanel.tmp_enscript_info.norotate = |
---|
1140 | p->printpanel.tmp_enscript_info.gaudy = |
---|
1141 | p->printpanel.tmp_enscript_info.lpt_mode = |
---|
1142 | p->printpanel.tmp_enscript_info.no_header = |
---|
1143 | p->printpanel.tmp_enscript_info.truncate_lines = 0; |
---|
1144 | p->printpanel.enscript_info.ignore_binary = |
---|
1145 | p->printpanel.enscript_info.report_missing_chars = |
---|
1146 | p->printpanel.enscript_info.quiet_mode = |
---|
1147 | p->printpanel.enscript_info.no_burst_page = 0; |
---|
1148 | p->printpanel.tmp_enscript_info.ignore_binary = |
---|
1149 | p->printpanel.tmp_enscript_info.report_missing_chars = |
---|
1150 | p->printpanel.tmp_enscript_info.quiet_mode = |
---|
1151 | p->printpanel.tmp_enscript_info.no_burst_page = 0; |
---|
1152 | |
---|
1153 | p->printpanel.num_feature_children = 0; |
---|
1154 | p->printpanel.num_features = 0; |
---|
1155 | p->printpanel.tmp_line[0] = '\0'; |
---|
1156 | if (p->printpanel.filter_name != NULL) { |
---|
1157 | p->printpanel.default_filter_name = p->printpanel.filter_name; |
---|
1158 | } |
---|
1159 | LayoutPanel(p); |
---|
1160 | if (p->printpanel.in_file_name != NULL) { |
---|
1161 | p->printpanel.input_file = p->printpanel.in_file_name; |
---|
1162 | XmTextFieldSetString(p->printpanel.open_field_child, |
---|
1163 | p->printpanel.input_file); |
---|
1164 | } |
---|
1165 | tmp = getenv("PREVIEWER"); |
---|
1166 | if (tmp) |
---|
1167 | p->printpanel.preview_path = tmp; |
---|
1168 | else { |
---|
1169 | /* find info file */ |
---|
1170 | tmp = getenv("PSLIBDIR"); |
---|
1171 | if (tmp) |
---|
1172 | strcpy(fname, tmp); |
---|
1173 | else |
---|
1174 | strcpy(fname, PSLibDir); |
---|
1175 | strcat(fname, "/preview.info"); |
---|
1176 | if ((fp = fopen(fname, "r")) == NULL) { |
---|
1177 | gray = TRUE; |
---|
1178 | } |
---|
1179 | else { |
---|
1180 | if (fgets(fname, 1024, fp)) { |
---|
1181 | tmp = strchr(fname, '\n'); |
---|
1182 | if (tmp) *tmp = '\0'; |
---|
1183 | /* assign preview path */ |
---|
1184 | p->printpanel.preview_path = (char *) malloc(strlen(fname)+1); |
---|
1185 | strcpy(p->printpanel.preview_path, fname); |
---|
1186 | } |
---|
1187 | else gray = TRUE; |
---|
1188 | } |
---|
1189 | } |
---|
1190 | if (gray) { |
---|
1191 | /* gray out preview option */ |
---|
1192 | XtSetSensitive(p->printpanel.preview_toggle_child, FALSE); |
---|
1193 | } |
---|
1194 | tmp = getenv("PSFAX"); |
---|
1195 | if (tmp) |
---|
1196 | p->printpanel.fax_path = tmp; |
---|
1197 | else |
---|
1198 | p->printpanel.fax_path = "psfax"; |
---|
1199 | } |
---|
1200 | |
---|
1201 | void DisplayError(w, msg) |
---|
1202 | Widget w; |
---|
1203 | char *msg; |
---|
1204 | { |
---|
1205 | int i; |
---|
1206 | Arg args[10]; |
---|
1207 | XmString errMsg; |
---|
1208 | |
---|
1209 | errMsg = CS(msg); |
---|
1210 | i = 0; |
---|
1211 | XtSetArg(args[i], XmNmessageString, errMsg); i++; |
---|
1212 | XtSetValues(w, args, i); |
---|
1213 | |
---|
1214 | XtManageChild(w); |
---|
1215 | } |
---|
1216 | |
---|
1217 | void DisplayCompound(w, xstr) |
---|
1218 | Widget w; |
---|
1219 | XmString xstr; |
---|
1220 | { |
---|
1221 | Arg args[10]; |
---|
1222 | int i; |
---|
1223 | |
---|
1224 | i = 0; |
---|
1225 | XtSetArg(args[i], XmNmessageString, xstr); i++; |
---|
1226 | XtSetValues(w, args, i); |
---|
1227 | XtManageChild(w); |
---|
1228 | } |
---|
1229 | |
---|
1230 | static void GrabData(p, source, id) |
---|
1231 | PrintPanelWidget p; |
---|
1232 | int *source; |
---|
1233 | XtInputId *id; |
---|
1234 | { |
---|
1235 | int cnt; |
---|
1236 | char buf[1024]; |
---|
1237 | FILE *fp; |
---|
1238 | |
---|
1239 | if (p->printpanel.save_fd == -1) { |
---|
1240 | if ((fp = fopen(p->printpanel.output_file, "w")) == NULL) { |
---|
1241 | sprintf(buf, "Couldn't open output file %s", |
---|
1242 | p->printpanel.output_file); |
---|
1243 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1244 | close(*source); |
---|
1245 | XtRemoveInput(*id); |
---|
1246 | p->printpanel.save_fd = -1; |
---|
1247 | return; |
---|
1248 | } |
---|
1249 | p->printpanel.save_fd = fileno(fp); |
---|
1250 | } |
---|
1251 | |
---|
1252 | if ((cnt = read(*source, buf, 1024)) > 0) { |
---|
1253 | if (write(p->printpanel.save_fd, buf, cnt) != cnt) { |
---|
1254 | DisplayError(p->printpanel.message_dialog_child, |
---|
1255 | "Failure in write"); |
---|
1256 | close(*source); |
---|
1257 | XtRemoveInput(*id); |
---|
1258 | return; |
---|
1259 | } |
---|
1260 | } |
---|
1261 | else { |
---|
1262 | /* finish up */ |
---|
1263 | close(p->printpanel.save_fd); |
---|
1264 | p->printpanel.save_fd = -1; |
---|
1265 | close(*source); |
---|
1266 | XtRemoveInput(*id); |
---|
1267 | return; |
---|
1268 | } |
---|
1269 | } |
---|
1270 | |
---|
1271 | |
---|
1272 | static void ExecuteProg(argvec) |
---|
1273 | char *argvec[]; |
---|
1274 | { |
---|
1275 | int i; |
---|
1276 | execvp(argvec[0], argvec); |
---|
1277 | } |
---|
1278 | |
---|
1279 | |
---|
1280 | static void Execute(p, nvec, argvec, catch, usestdin) |
---|
1281 | PrintPanelWidget p; |
---|
1282 | int nvec; |
---|
1283 | char **argvec[]; |
---|
1284 | int catch; |
---|
1285 | int usestdin; |
---|
1286 | { |
---|
1287 | /* this assumes that the 0'th argv includes the file name, so a pipe |
---|
1288 | isn't necessary for connecting to 0'th child's stdin, and further |
---|
1289 | assumes that unless catch is true, a pipe isn't necessary for |
---|
1290 | connecting to last child's stdout */ |
---|
1291 | |
---|
1292 | int cpids[10]; |
---|
1293 | int datapipes[10][2]; |
---|
1294 | int errorpipe[2]; |
---|
1295 | int i; |
---|
1296 | int j; |
---|
1297 | char buf[256]; |
---|
1298 | int status; |
---|
1299 | int cfd; |
---|
1300 | |
---|
1301 | if (pipe(errorpipe)) { |
---|
1302 | DisplayError(p->printpanel.message_dialog_child, |
---|
1303 | "Error pipe failed."); |
---|
1304 | return; |
---|
1305 | } |
---|
1306 | for (i = 0; i < nvec; i++) { |
---|
1307 | if (pipe(datapipes[i])) { |
---|
1308 | sprintf(buf, "Data pipe %d failed", i); |
---|
1309 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1310 | return; |
---|
1311 | } |
---|
1312 | } |
---|
1313 | |
---|
1314 | for (i = 0; i < nvec; i++) { |
---|
1315 | if ((cpids[i] = fork()) < 0) { |
---|
1316 | sprintf(buf, "Fork %d failed.", i); |
---|
1317 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1318 | return; |
---|
1319 | } |
---|
1320 | if (cpids[i] == 0) { |
---|
1321 | /* child */ |
---|
1322 | if (i > 0) { |
---|
1323 | /* don't need this for first child */ |
---|
1324 | if (dup2(datapipes[i-1][0], 0) < 0) { |
---|
1325 | sprintf(buf, "Dup %d failed.", i); |
---|
1326 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1327 | return; |
---|
1328 | } |
---|
1329 | } |
---|
1330 | if (i < nvec - 1 || catch) { |
---|
1331 | if (dup2(datapipes[i][1], 1) < 0) { |
---|
1332 | sprintf(buf, "Dup %d failed.", i); |
---|
1333 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1334 | return; |
---|
1335 | } |
---|
1336 | } |
---|
1337 | if ((dup2(errorpipe[1], 2) < 0) || close(errorpipe[1]) || |
---|
1338 | close(errorpipe[0])) { |
---|
1339 | perror(""); |
---|
1340 | sprintf(buf, "Error dup in child %d failed.", i); |
---|
1341 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1342 | return; |
---|
1343 | } |
---|
1344 | for (j = 0; j < nvec; j++) { |
---|
1345 | if (close(datapipes[j][0]) || close(datapipes[j][1])) { |
---|
1346 | sprintf(buf, "Data close in child %d failed.", i); |
---|
1347 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
1348 | return; |
---|
1349 | } |
---|
1350 | } |
---|
1351 | ExecuteProg(argvec[i]); |
---|
1352 | exit(0); |
---|
1353 | } |
---|
1354 | } |
---|
1355 | /* parent */ |
---|
1356 | if ((dup2(errorpipe[0], p->printpanel.error_fd) < 0) || |
---|
1357 | close(errorpipe[0]) || close(errorpipe[1])) { |
---|
1358 | perror(""); |
---|
1359 | DisplayError(p->printpanel.message_dialog_child, |
---|
1360 | "Error dup in parent failed."); |
---|
1361 | return; |
---|
1362 | } |
---|
1363 | if (catch) { |
---|
1364 | cfd = dup(0); |
---|
1365 | if ((dup2(datapipes[nvec -1][0], cfd) < 0)) { |
---|
1366 | DisplayError(p->printpanel.message_dialog_child, |
---|
1367 | "Capture dup in parent failed"); |
---|
1368 | return; |
---|
1369 | } |
---|
1370 | XtAppAddInput(XtWidgetToApplicationContext(p), cfd, |
---|
1371 | XtInputReadMask, GrabData, p); |
---|
1372 | } |
---|
1373 | for (j = 0; j < nvec; j++) { |
---|
1374 | if (close(datapipes[j][0]) || close(datapipes[j][1])) { |
---|
1375 | DisplayError(p->printpanel.message_dialog_child, |
---|
1376 | "Data close in parent failed."); |
---|
1377 | return; |
---|
1378 | } |
---|
1379 | } |
---|
1380 | } |
---|
1381 | |
---|
1382 | static void FilterArgs(p, argvec, nargs) |
---|
1383 | PrintPanelWidget p; |
---|
1384 | char **argvec; |
---|
1385 | int *nargs; |
---|
1386 | { |
---|
1387 | char buf[1024]; |
---|
1388 | int n; |
---|
1389 | int i, j; |
---|
1390 | |
---|
1391 | n = *nargs; |
---|
1392 | |
---|
1393 | addarg(argvec, n++, |
---|
1394 | p->printpanel.filterlist[p->printpanel.filter].name); |
---|
1395 | switch (p->printpanel.filter) { |
---|
1396 | case ENSCRIPT: |
---|
1397 | /* enscript */ |
---|
1398 | if (p->printpanel.enscript_info.font) { |
---|
1399 | if (p->printpanel.enscript_info.font_size != -1) { |
---|
1400 | sprintf(buf, "-f%s%f", p->printpanel.enscript_info.font, |
---|
1401 | p->printpanel.enscript_info.font_size); |
---|
1402 | addarg(argvec, n++, buf); |
---|
1403 | } |
---|
1404 | else { |
---|
1405 | DisplayError(p->printpanel.message_dialog_child, |
---|
1406 | "Must specify font size!"); |
---|
1407 | return; |
---|
1408 | } |
---|
1409 | } |
---|
1410 | if (p->printpanel.enscript_info.header_font) { |
---|
1411 | if (p->printpanel.enscript_info.header_font_size != -1) { |
---|
1412 | sprintf(buf, "-F%s%f", |
---|
1413 | p->printpanel.enscript_info.header_font, |
---|
1414 | p->printpanel.enscript_info.header_font_size); |
---|
1415 | addarg(argvec, n++, buf); |
---|
1416 | } |
---|
1417 | else { |
---|
1418 | DisplayError(p->printpanel.message_dialog_child, |
---|
1419 | "Must specify header font size!"); |
---|
1420 | return; |
---|
1421 | } |
---|
1422 | } |
---|
1423 | if (p->printpanel.enscript_info.header) { |
---|
1424 | sprintf(buf, "-b%s", p->printpanel.enscript_info.header); |
---|
1425 | addarg(argvec, n++, buf); |
---|
1426 | } |
---|
1427 | if (p->printpanel.enscript_info.tab_width != -1) { |
---|
1428 | sprintf(buf, "-T%d", p->printpanel.enscript_info.tab_width); |
---|
1429 | addarg(argvec, n++, buf); |
---|
1430 | } |
---|
1431 | if (p->printpanel.enscript_info.columns != -1) { |
---|
1432 | sprintf(buf, "-v%d", p->printpanel.enscript_info.columns); |
---|
1433 | addarg(argvec, n++, buf); |
---|
1434 | } |
---|
1435 | if (p->printpanel.enscript_info.lines != -1) { |
---|
1436 | sprintf(buf, "-L%d", p->printpanel.enscript_info.lines); |
---|
1437 | addarg(argvec, n++, buf); |
---|
1438 | } |
---|
1439 | if (p->printpanel.enscript_info.rotated) |
---|
1440 | addarg(argvec, n++, "-r"); |
---|
1441 | if (p->printpanel.enscript_info.norotate) |
---|
1442 | addarg(argvec, n++, "-R"); |
---|
1443 | if (p->printpanel.enscript_info.gaudy) |
---|
1444 | addarg(argvec, n++, "-G"); |
---|
1445 | if (p->printpanel.enscript_info.lpt_mode) |
---|
1446 | addarg(argvec, n++, "-l"); |
---|
1447 | if (p->printpanel.enscript_info.no_header) |
---|
1448 | addarg(argvec, n++, "-B"); |
---|
1449 | if (p->printpanel.enscript_info.truncate_lines) |
---|
1450 | addarg(argvec, n++, "-c"); |
---|
1451 | if (p->printpanel.enscript_info.ignore_binary) |
---|
1452 | addarg(argvec, n++, "-g"); |
---|
1453 | if (p->printpanel.enscript_info.report_missing_chars) |
---|
1454 | addarg(argvec, n++, "-o"); |
---|
1455 | if (p->printpanel.enscript_info.quiet_mode) |
---|
1456 | addarg(argvec, n++, "-q"); |
---|
1457 | if (p->printpanel.enscript_info.no_burst_page) |
---|
1458 | addarg(argvec, n++, "-h"); |
---|
1459 | for (i = 0; i <= p->printpanel.num_features; i++) { |
---|
1460 | for (j = 0; j < p->printpanel.feature_info[i].num; j++) { |
---|
1461 | if (p->printpanel.feature_info[i].value[j]) { |
---|
1462 | sprintf(buf, "-S%s=%s", |
---|
1463 | p->printpanel.feature_info[i].name, |
---|
1464 | p->printpanel.feature_info[i].value[j]); |
---|
1465 | addarg(argvec, n++, buf); |
---|
1466 | } |
---|
1467 | } |
---|
1468 | } |
---|
1469 | sprintf(buf, "%s%s", printerstring, |
---|
1470 | p->printpanel.current_printer_name); |
---|
1471 | addarg(argvec, n++, buf); |
---|
1472 | break; |
---|
1473 | case PSROFF: |
---|
1474 | if (p->printpanel.roff_info.font_dir != NULL) { |
---|
1475 | addarg(argvec, n++, "-D"); |
---|
1476 | addarg(argvec, n++, p->printpanel.roff_info.font_dir); |
---|
1477 | } |
---|
1478 | case PTROFF: |
---|
1479 | if (p->printpanel.roff_info.font != NULL) { |
---|
1480 | addarg(argvec, n++, "-F"); |
---|
1481 | addarg(argvec, n++, p->printpanel.roff_info.font); |
---|
1482 | } |
---|
1483 | if (p->printpanel.roff_info.options != NULL) { |
---|
1484 | addarg(argvec, n++, p->printpanel.roff_info.options); |
---|
1485 | } |
---|
1486 | break; |
---|
1487 | case PSPLT: |
---|
1488 | if (p->printpanel.plot_profile != NULL) { |
---|
1489 | sprintf(buf, "-g%s", p->printpanel.plot_profile); |
---|
1490 | addarg(argvec, n++, buf); |
---|
1491 | } |
---|
1492 | break; |
---|
1493 | case PS630: |
---|
1494 | if (p->printpanel.ps630_info.bold_font != NULL) { |
---|
1495 | sprintf(buf, "-F%s", p->printpanel.ps630_info.bold_font); |
---|
1496 | addarg(argvec, n++, buf); |
---|
1497 | } |
---|
1498 | if (p->printpanel.ps630_info.body_font != NULL) { |
---|
1499 | sprintf(buf, "-f%s", p->printpanel.ps630_info.body_font); |
---|
1500 | addarg(argvec, n++, buf); |
---|
1501 | } |
---|
1502 | if (p->printpanel.ps630_info.pitch != NULL) { |
---|
1503 | sprintf(buf, "-s%s", p->printpanel.ps630_info.pitch); |
---|
1504 | addarg(argvec, n++, buf); |
---|
1505 | } |
---|
1506 | case PS4014: |
---|
1507 | if (p->printpanel.ps4014_info.scale != NULL) { |
---|
1508 | sprintf(buf, "-S%s", p->printpanel.ps4014_info.scale); |
---|
1509 | addarg(argvec, n++, buf); |
---|
1510 | } |
---|
1511 | if (p->printpanel.ps4014_info.left != NULL && |
---|
1512 | p->printpanel.ps4014_info.bottom != NULL) { |
---|
1513 | sprintf(buf, "-l%s,%s", p->printpanel.ps4014_info.left, |
---|
1514 | p->printpanel.ps4014_info.bottom); |
---|
1515 | addarg(argvec, n++, buf); |
---|
1516 | } |
---|
1517 | if (p->printpanel.ps4014_info.width != NULL && |
---|
1518 | p->printpanel.ps4014_info.height != NULL) { |
---|
1519 | sprintf(buf, "-s%s,%s", p->printpanel.ps4014_info.width, |
---|
1520 | p->printpanel.ps4014_info.height); |
---|
1521 | addarg(argvec, n++, buf); |
---|
1522 | } |
---|
1523 | if (p->printpanel.ps4014_info.portrait) { |
---|
1524 | addarg(argvec, n++, "-R"); |
---|
1525 | } |
---|
1526 | if (p->printpanel.ps4014_info.cr_no_lf) { |
---|
1527 | addarg(argvec, n++, "-C"); |
---|
1528 | } |
---|
1529 | if (p->printpanel.ps4014_info.lf_no_cr) { |
---|
1530 | addarg(argvec, n++, "-N"); |
---|
1531 | } |
---|
1532 | if (p->printpanel.ps4014_info.margin_2) { |
---|
1533 | addarg(argvec, n++, "-m"); |
---|
1534 | } |
---|
1535 | default: |
---|
1536 | break; |
---|
1537 | } |
---|
1538 | *nargs = n; |
---|
1539 | } |
---|
1540 | |
---|
1541 | |
---|
1542 | |
---|
1543 | static void PreviewArgs(p, argvec, nargs) |
---|
1544 | PrintPanelWidget p; |
---|
1545 | char **argvec; |
---|
1546 | int *nargs; |
---|
1547 | { |
---|
1548 | char buf[100]; |
---|
1549 | int n; |
---|
1550 | |
---|
1551 | n = *nargs; |
---|
1552 | addarg(argvec, n++, p->printpanel.preview_path); |
---|
1553 | *nargs = n; |
---|
1554 | } |
---|
1555 | |
---|
1556 | static void FaxArgs(p, argvec, nargs) |
---|
1557 | PrintPanelWidget p; |
---|
1558 | char **argvec; |
---|
1559 | int *nargs; |
---|
1560 | { |
---|
1561 | char buf[100]; |
---|
1562 | int n; |
---|
1563 | |
---|
1564 | n = *nargs; |
---|
1565 | addarg(argvec, n++, p->printpanel.fax_path); |
---|
1566 | |
---|
1567 | sprintf(buf, "-P%s", p->printpanel.current_printer_name); |
---|
1568 | addarg(argvec, n++, buf); |
---|
1569 | |
---|
1570 | if (p->printpanel.fax_data.key[0] != '\0') { |
---|
1571 | sprintf(buf, "-k%s", p->printpanel.fax_data.key); |
---|
1572 | addarg(argvec, n++, buf); |
---|
1573 | } |
---|
1574 | else { |
---|
1575 | fprintf(stderr, "%s %s\n", p->printpanel.fax_data.phone, |
---|
1576 | p->printpanel.fax_data.name); |
---|
1577 | if (p->printpanel.fax_data.phone[0] != '\0') { |
---|
1578 | sprintf(buf, "-d%s", p->printpanel.fax_data.phone); |
---|
1579 | addarg(argvec, n++, buf); |
---|
1580 | } |
---|
1581 | if (p->printpanel.fax_data.name[0] != '\0') { |
---|
1582 | sprintf(buf, "-n%s", p->printpanel.fax_data.name); |
---|
1583 | addarg(argvec, n++, buf); |
---|
1584 | } |
---|
1585 | } |
---|
1586 | if (p->printpanel.fax_data.sendps) { |
---|
1587 | addarg(argvec, n++, "-t"); |
---|
1588 | if (p->printpanel.fax_data.passwd[0] != '\0') { |
---|
1589 | sprintf(buf, "-SPostScriptPassword=%s", |
---|
1590 | p->printpanel.fax_data.passwd); |
---|
1591 | addarg(argvec, n++, buf); |
---|
1592 | } |
---|
1593 | } |
---|
1594 | if (p->printpanel.fax_data.save) { |
---|
1595 | if (p->printpanel.fax_data.filename[0] != '\0') { |
---|
1596 | sprintf(buf, "-p%s", p->printpanel.fax_data.filename); |
---|
1597 | addarg(argvec, n++, buf); |
---|
1598 | } |
---|
1599 | else { |
---|
1600 | DisplayError(p->printpanel.message_dialog_child, |
---|
1601 | "Must specify a file name to save!"); |
---|
1602 | return; |
---|
1603 | } |
---|
1604 | } |
---|
1605 | *nargs = n; |
---|
1606 | } |
---|
1607 | |
---|
1608 | static void PsdraftArgs(p, argvec, nargs) |
---|
1609 | PrintPanelWidget p; |
---|
1610 | char **argvec; |
---|
1611 | int *nargs; |
---|
1612 | { |
---|
1613 | char buf[100]; |
---|
1614 | int n; |
---|
1615 | |
---|
1616 | n = *nargs; |
---|
1617 | |
---|
1618 | addarg(argvec, n++, "psdraft"); |
---|
1619 | sprintf(buf, "-P%s", p->printpanel.current_printer_name); |
---|
1620 | addarg(argvec, n++, buf); |
---|
1621 | if (p->printpanel.psdraft_info.draftstring) { |
---|
1622 | sprintf(buf, "-s%s", p->printpanel.psdraft_info.draftstring); |
---|
1623 | addarg(argvec, n++, buf); |
---|
1624 | } |
---|
1625 | if (p->printpanel.psdraft_info.xpos) { |
---|
1626 | sprintf(buf, "-x%f", p->printpanel.psdraft_info.xpos); |
---|
1627 | addarg(argvec, n++, buf); |
---|
1628 | } |
---|
1629 | if (p->printpanel.psdraft_info.ypos) { |
---|
1630 | sprintf(buf, "-y%f", p->printpanel.psdraft_info.ypos); |
---|
1631 | addarg(argvec, n++, buf); |
---|
1632 | } |
---|
1633 | if (p->printpanel.psdraft_info.angle) { |
---|
1634 | sprintf(buf, "-r%f", p->printpanel.psdraft_info.angle); |
---|
1635 | addarg(argvec, n++, buf); |
---|
1636 | } |
---|
1637 | if (p->printpanel.psdraft_info.font) { |
---|
1638 | sprintf(buf, "-f%s%f", p->printpanel.psdraft_info.font, |
---|
1639 | p->printpanel.psdraft_info.size); |
---|
1640 | addarg(argvec, n++, buf); |
---|
1641 | } |
---|
1642 | if (p->printpanel.psdraft_info.gray) { |
---|
1643 | sprintf(buf, "-g%f", p->printpanel.psdraft_info.gray); |
---|
1644 | addarg(argvec, n++, buf); |
---|
1645 | } |
---|
1646 | if (p->printpanel.psdraft_info.outline) { |
---|
1647 | addarg(argvec, n++, "-o"); |
---|
1648 | } |
---|
1649 | } |
---|
1650 | |
---|
1651 | |
---|
1652 | |
---|
1653 | |
---|
1654 | static void PsnupArgs(p, argvec, nargs) |
---|
1655 | PrintPanelWidget p; |
---|
1656 | char **argvec; |
---|
1657 | int *nargs; |
---|
1658 | { |
---|
1659 | char buf[100]; |
---|
1660 | int n; |
---|
1661 | |
---|
1662 | n = *nargs; |
---|
1663 | |
---|
1664 | addarg(argvec, n++, "psnup"); |
---|
1665 | sprintf(buf, "-P%s", p->printpanel.current_printer_name); |
---|
1666 | addarg(argvec, n++, buf); |
---|
1667 | sprintf(buf, "-n%dx%d", p->printpanel.nup_info.rows, |
---|
1668 | p->printpanel.nup_info.columns); |
---|
1669 | addarg(argvec, n++, buf); |
---|
1670 | if (p->printpanel.nup_info.rotated) { |
---|
1671 | addarg(argvec, n++, "-r"); |
---|
1672 | } |
---|
1673 | if (p->printpanel.nup_info.gaudy) { |
---|
1674 | addarg(argvec, n++, "-G"); |
---|
1675 | } |
---|
1676 | *nargs = n; |
---|
1677 | } |
---|
1678 | |
---|
1679 | static void SpoolerArgs(p, argvec, nargs) |
---|
1680 | PrintPanelWidget p; |
---|
1681 | char **argvec; |
---|
1682 | int *nargs; |
---|
1683 | { |
---|
1684 | char buf[100]; |
---|
1685 | int i, j; |
---|
1686 | int n; |
---|
1687 | |
---|
1688 | n = *nargs; |
---|
1689 | |
---|
1690 | if (p->printpanel.use_pslpr) { |
---|
1691 | addarg(argvec, n++, "pslpr"); |
---|
1692 | if (p->printpanel.range == RANGE) { |
---|
1693 | sprintf(buf, "-i %d-%d", p->printpanel.page_ranges[0].begin, |
---|
1694 | p->printpanel.page_ranges[0].end); |
---|
1695 | addarg(argvec, n++, buf); |
---|
1696 | } |
---|
1697 | if (p->printpanel.pslpr_info.showpage) |
---|
1698 | addarg(argvec, n++, "-e"); |
---|
1699 | if (p->printpanel.pslpr_info.landscape) |
---|
1700 | addarg(argvec, n++, "-L"); |
---|
1701 | if (p->printpanel.pslpr_info.squeeze) |
---|
1702 | addarg(argvec, n++, "-q"); |
---|
1703 | if (p->printpanel.pslpr_info.overtranslate) |
---|
1704 | addarg(argvec, n++, "-u"); |
---|
1705 | for (i = 0; i <= p->printpanel.num_features; i++) { |
---|
1706 | for (j = 0; j < p->printpanel.feature_info[i].num; j++) { |
---|
1707 | if (p->printpanel.feature_info[i].value[j]) { |
---|
1708 | sprintf(buf, "-S%s=%s", |
---|
1709 | p->printpanel.feature_info[i].name, |
---|
1710 | p->printpanel.feature_info[i].value[j]); |
---|
1711 | addarg(argvec, n++, buf); |
---|
1712 | } |
---|
1713 | } |
---|
1714 | } |
---|
1715 | } |
---|
1716 | else |
---|
1717 | addarg(argvec, n++, lprname); |
---|
1718 | sprintf(buf, "%s%s", printerstring, p->printpanel.current_printer_name); |
---|
1719 | addarg(argvec, n++, buf); |
---|
1720 | if (p->printpanel.copies > 1) { |
---|
1721 | sprintf(buf, "-#%d", p->printpanel.copies); |
---|
1722 | addarg(argvec, n++, buf); |
---|
1723 | } |
---|
1724 | *nargs = n; |
---|
1725 | } |
---|
1726 | |
---|
1727 | void PlanExecution(p) |
---|
1728 | PrintPanelWidget p; |
---|
1729 | { |
---|
1730 | int nprogs; |
---|
1731 | char *filargs[100]; |
---|
1732 | int nfilargs = 0; |
---|
1733 | char *draftargs[100]; |
---|
1734 | int ndraftargs = 0; |
---|
1735 | int catch = FALSE; |
---|
1736 | char *nupargs[100]; |
---|
1737 | int nnupargs = 0; |
---|
1738 | char *pslprargs[100]; |
---|
1739 | int npslprargs = 0; |
---|
1740 | char *spoolargs[100]; |
---|
1741 | int nspoolargs = 0; |
---|
1742 | char *prevargs[100]; |
---|
1743 | int nprevargs = 0; |
---|
1744 | char *faxargs[100]; |
---|
1745 | int nfaxargs = 0; |
---|
1746 | int ndex; |
---|
1747 | char buf[255]; |
---|
1748 | int nvectors = 0; |
---|
1749 | char **vectors[10]; |
---|
1750 | int i, j; |
---|
1751 | int usestdin = FALSE; |
---|
1752 | |
---|
1753 | if (p->printpanel.input_file[0] == '-') |
---|
1754 | usestdin = TRUE; |
---|
1755 | |
---|
1756 | if (p->printpanel.filter != NONE) { |
---|
1757 | /* we have a filter */ |
---|
1758 | FilterArgs(p, filargs, &nfilargs); |
---|
1759 | ndex = p->printpanel.filterlist[p->printpanel.filter].index; |
---|
1760 | if (p->printpanel.action == PRINT && !p->printpanel.use_pslpr && |
---|
1761 | !p->printpanel.use_psnup && !p->printpanel.use_psdraft && |
---|
1762 | filter_array[ndex].can_spool) { |
---|
1763 | /* simple case, nothing special, just filter and spool */ |
---|
1764 | sprintf(buf, "%s%s", filter_array[ndex].spool_flag, |
---|
1765 | p->printpanel.current_printer_name); |
---|
1766 | addarg(filargs, nfilargs++, buf); |
---|
1767 | if (!usestdin) |
---|
1768 | addarg(filargs, nfilargs++, p->printpanel.input_file); |
---|
1769 | vectors[nvectors++] = filargs; |
---|
1770 | |
---|
1771 | Execute(p, nvectors, vectors, FALSE, usestdin); |
---|
1772 | return; |
---|
1773 | } |
---|
1774 | /* handle all other cases */ |
---|
1775 | if (p->printpanel.use_psnup || p->printpanel.use_pslpr || |
---|
1776 | p->printpanel.use_psdraft || |
---|
1777 | (p->printpanel.action == SAVE && |
---|
1778 | !filter_array[ndex].can_write) || p->printpanel.action == |
---|
1779 | PREVIEW || p->printpanel.action == FAX) { |
---|
1780 | /* need to send filter output to stdout */ |
---|
1781 | if (filter_array[ndex].stdout_flag) { |
---|
1782 | addarg(filargs, nfilargs++, |
---|
1783 | filter_array[ndex].stdout_flag); |
---|
1784 | } |
---|
1785 | /* set catch to TRUE; we'll unset it if need be later */ |
---|
1786 | /* catch tells us whether we need to handle catching the final |
---|
1787 | output or not */ |
---|
1788 | catch = TRUE; |
---|
1789 | } |
---|
1790 | else if (p->printpanel.action == SAVE && |
---|
1791 | filter_array[ndex].can_write) { |
---|
1792 | /* no more processes needed, filter can write to file directly |
---|
1793 | */ |
---|
1794 | sprintf(buf, "%s%s", filter_array[ndex].file_flag, |
---|
1795 | p->printpanel.output_file); |
---|
1796 | addarg(filargs, nfilargs++, buf); |
---|
1797 | } |
---|
1798 | if (!usestdin) |
---|
1799 | addarg(filargs, nfilargs++, p->printpanel.input_file); |
---|
1800 | vectors[nvectors++] = filargs; |
---|
1801 | if (p->printpanel.use_psdraft) { |
---|
1802 | PsdraftArgs(p, draftargs, &ndraftargs); |
---|
1803 | if (p->printpanel.action == SAVE && !p->printpanel.use_psnup && |
---|
1804 | !p->printpanel.use_pslpr) { |
---|
1805 | /* if we're saving, and there are no more processes after |
---|
1806 | us, need to save to file here */ |
---|
1807 | sprintf(buf, "-p%s", p->printpanel.output_file); |
---|
1808 | addarg(draftargs, ndraftargs++, buf); |
---|
1809 | catch = FALSE; |
---|
1810 | } |
---|
1811 | vectors[nvectors++] = draftargs; |
---|
1812 | } |
---|
1813 | if (p->printpanel.use_psnup) { |
---|
1814 | PsnupArgs(p, nupargs, &nnupargs); |
---|
1815 | if (p->printpanel.use_pslpr) { |
---|
1816 | /* if we need both pslpr and psnup, we want to run pslpr |
---|
1817 | first */ |
---|
1818 | SpoolerArgs(p, pslprargs, &npslprargs); |
---|
1819 | addarg(pslprargs, npslprargs++, "-p-"); |
---|
1820 | vectors[nvectors++] = pslprargs; |
---|
1821 | p->printpanel.use_pslpr = FALSE; |
---|
1822 | } |
---|
1823 | if (p->printpanel.action == SAVE) { |
---|
1824 | /* psnup is always last in chain, have it write the |
---|
1825 | file */ |
---|
1826 | sprintf(buf, "-p%s", p->printpanel.output_file); |
---|
1827 | addarg(nupargs, nnupargs++, buf); |
---|
1828 | catch = FALSE; |
---|
1829 | } |
---|
1830 | vectors[nvectors++] = nupargs; |
---|
1831 | } |
---|
1832 | if (p->printpanel.action == PRINT) { |
---|
1833 | /* SpoolerArgs will handle the pslpr/lpr distinction */ |
---|
1834 | SpoolerArgs(p, spoolargs, &nspoolargs); |
---|
1835 | vectors[nvectors++] = spoolargs; |
---|
1836 | p->printpanel.use_pslpr = FALSE; |
---|
1837 | catch = FALSE; |
---|
1838 | } |
---|
1839 | if (p->printpanel.use_pslpr) { |
---|
1840 | /* already handled psnup, and if we've already handled |
---|
1841 | pslpr, use_pslpr is now set to FALSE */ |
---|
1842 | SpoolerArgs(p, pslprargs, &npslprargs); |
---|
1843 | /* since we've handled PRINT already, should either save to |
---|
1844 | file or send to stdout */ |
---|
1845 | if (p->printpanel.action == SAVE) { |
---|
1846 | sprintf(buf, "-p%s", p->printpanel.output_file); |
---|
1847 | addarg(pslprargs, npslprargs++, buf); |
---|
1848 | catch = FALSE; |
---|
1849 | } |
---|
1850 | else { |
---|
1851 | addarg(pslprargs, npslprargs++, "-p-"); |
---|
1852 | } |
---|
1853 | vectors[nvectors++] = pslprargs; |
---|
1854 | p->printpanel.use_pslpr = FALSE; |
---|
1855 | } |
---|
1856 | if (p->printpanel.action == PREVIEW) { |
---|
1857 | PreviewArgs(p, prevargs, &nprevargs); |
---|
1858 | addarg(prevargs, nprevargs++, "-"); |
---|
1859 | vectors[nvectors++] = prevargs; |
---|
1860 | catch = FALSE; |
---|
1861 | } |
---|
1862 | if (p->printpanel.action == FAX) { |
---|
1863 | FaxArgs(p, faxargs, &nfaxargs); |
---|
1864 | vectors[nvectors++] = faxargs; |
---|
1865 | catch = FALSE; |
---|
1866 | } |
---|
1867 | Execute(p, nvectors, vectors, catch, usestdin); |
---|
1868 | } |
---|
1869 | else { |
---|
1870 | /* no filter requested */ |
---|
1871 | if (p->printpanel.use_psdraft) { |
---|
1872 | PsdraftArgs(p, draftargs, &ndraftargs); |
---|
1873 | if (p->printpanel.action == SAVE && !p->printpanel.use_psnup && |
---|
1874 | !p->printpanel.use_pslpr) { |
---|
1875 | /* if we're saving, and there are no more processes after |
---|
1876 | us, need to save to file here */ |
---|
1877 | sprintf(buf, "-p%s", p->printpanel.output_file); |
---|
1878 | addarg(draftargs, ndraftargs++, buf); |
---|
1879 | catch = FALSE; |
---|
1880 | } |
---|
1881 | /* this will be first in chain */ |
---|
1882 | if (!usestdin) |
---|
1883 | addarg(draftargs, ndraftargs++, p->printpanel.input_file); |
---|
1884 | vectors[nvectors++] = draftargs; |
---|
1885 | } |
---|
1886 | if (p->printpanel.use_psnup) { |
---|
1887 | PsnupArgs(p, nupargs, &nnupargs); |
---|
1888 | if (p->printpanel.action == SAVE) { |
---|
1889 | sprintf(buf, "-p%s", p->printpanel.output_file); |
---|
1890 | addarg(nupargs, nnupargs++, buf); |
---|
1891 | } |
---|
1892 | if (p->printpanel.use_pslpr) { |
---|
1893 | /* it will be ahead of psnup in chain if needed */ |
---|
1894 | SpoolerArgs(p, pslprargs, &npslprargs); |
---|
1895 | addarg(pslprargs, npslprargs++, "-p-"); |
---|
1896 | if (!usestdin && !p->printpanel.use_psdraft) |
---|
1897 | addarg(pslprargs, npslprargs++, |
---|
1898 | p->printpanel.input_file); |
---|
1899 | p->printpanel.use_pslpr = FALSE; |
---|
1900 | vectors[nvectors++] = pslprargs; |
---|
1901 | } |
---|
1902 | else { |
---|
1903 | /* psnup is first in chain */ |
---|
1904 | if (!usestdin && !p->printpanel.use_psdraft) |
---|
1905 | addarg(nupargs, nnupargs++, p->printpanel.input_file); |
---|
1906 | } |
---|
1907 | vectors[nvectors++] = nupargs; |
---|
1908 | } |
---|
1909 | if (p->printpanel.action == PRINT) { |
---|
1910 | SpoolerArgs(p, spoolargs, &nspoolargs); |
---|
1911 | if (!p->printpanel.use_psnup && !usestdin) |
---|
1912 | addarg(spoolargs, nspoolargs++, p->printpanel.input_file); |
---|
1913 | vectors[nvectors++] = spoolargs; |
---|
1914 | p->printpanel.use_pslpr = FALSE; |
---|
1915 | } |
---|
1916 | if (p->printpanel.use_pslpr) { |
---|
1917 | SpoolerArgs(p, pslprargs, &npslprargs); |
---|
1918 | if (p->printpanel.action == SAVE) { |
---|
1919 | sprintf(buf, "-p%s", p->printpanel.output_file); |
---|
1920 | addarg(pslprargs, npslprargs++, buf); |
---|
1921 | } |
---|
1922 | else { |
---|
1923 | addarg(pslprargs, npslprargs++, "-p-"); |
---|
1924 | } |
---|
1925 | if (!usestdin && !p->printpanel.use_psdraft) |
---|
1926 | addarg(pslprargs, npslprargs++, p->printpanel.input_file); |
---|
1927 | vectors[nvectors++] = pslprargs; |
---|
1928 | } |
---|
1929 | if (p->printpanel.action == PREVIEW) { |
---|
1930 | PreviewArgs(p, prevargs, &nprevargs); |
---|
1931 | if (p->printpanel.use_pslpr || p->printpanel.use_psnup || |
---|
1932 | p->printpanel.use_psdraft || usestdin) { |
---|
1933 | addarg(prevargs, nprevargs++, "-"); |
---|
1934 | } |
---|
1935 | else |
---|
1936 | addarg(prevargs, nprevargs++, p->printpanel.input_file); |
---|
1937 | vectors[nvectors++] = prevargs; |
---|
1938 | } |
---|
1939 | if (p->printpanel.action == FAX) { |
---|
1940 | FaxArgs(p, faxargs, &nfaxargs); |
---|
1941 | if (!p->printpanel.use_pslpr && !p->printpanel.use_psnup && |
---|
1942 | !p->printpanel.use_psdraft && !usestdin) { |
---|
1943 | addarg(faxargs, nfaxargs++, p->printpanel.input_file); |
---|
1944 | } |
---|
1945 | vectors[nvectors++] = faxargs; |
---|
1946 | } |
---|
1947 | Execute(p, nvectors, vectors, catch, stdin); |
---|
1948 | } |
---|
1949 | } |
---|
1950 | |
---|
1951 | static void DoWork(p) |
---|
1952 | PrintPanelWidget p; |
---|
1953 | { |
---|
1954 | int i, j; |
---|
1955 | |
---|
1956 | p->printpanel.use_pslpr = FALSE; |
---|
1957 | if (p->printpanel.range == RANGE) { |
---|
1958 | if (p->printpanel.page_ranges[0].begin == -1 || |
---|
1959 | p->printpanel.page_ranges[0].end == -1) { |
---|
1960 | DisplayError(p->printpanel.message_dialog_child, |
---|
1961 | "Must specify page numbers for range."); |
---|
1962 | return; |
---|
1963 | } |
---|
1964 | p->printpanel.use_pslpr = TRUE; |
---|
1965 | } |
---|
1966 | if (p->printpanel.pslpr_info.showpage || |
---|
1967 | p->printpanel.pslpr_info.landscape || |
---|
1968 | p->printpanel.pslpr_info.squeeze || |
---|
1969 | p->printpanel.pslpr_info.overtranslate) |
---|
1970 | p->printpanel.use_pslpr = TRUE; |
---|
1971 | for (i = 0; i <= p->printpanel.num_features; i++) { |
---|
1972 | for (j = 0; j < p->printpanel.feature_info[i].num; j++) { |
---|
1973 | if (p->printpanel.feature_info[i].value[j] != NULL) { |
---|
1974 | p->printpanel.use_pslpr = TRUE; |
---|
1975 | break; |
---|
1976 | } |
---|
1977 | if (j < p->printpanel.feature_info[i].num) |
---|
1978 | break; |
---|
1979 | } |
---|
1980 | } |
---|
1981 | p->printpanel.error_fd = dup(0); |
---|
1982 | XtAppAddInput(XtWidgetToApplicationContext(p), p->printpanel.error_fd, |
---|
1983 | XtInputReadMask, ReadErrors, p); |
---|
1984 | |
---|
1985 | /* for now, our only input source is a file name, so complain if there |
---|
1986 | isn't one */ |
---|
1987 | if (p->printpanel.input_file == NULL) { |
---|
1988 | DisplayError(p->printpanel.message_dialog_child, |
---|
1989 | "You must specify an input file!"); |
---|
1990 | return; |
---|
1991 | } |
---|
1992 | if (p->printpanel.action == SAVE && p->printpanel.output_file == NULL) { |
---|
1993 | DisplayError(p->printpanel.message_dialog_child, |
---|
1994 | "You must specify an output file!"); |
---|
1995 | return; |
---|
1996 | } |
---|
1997 | PlanExecution(p); |
---|
1998 | } |
---|
1999 | |
---|
2000 | /* callbacks */ |
---|
2001 | |
---|
2002 | static void okCallback(w, p, call_data) |
---|
2003 | Widget w; |
---|
2004 | PrintPanelWidget p; |
---|
2005 | XmAnyCallbackStruct *call_data; |
---|
2006 | { |
---|
2007 | DoWork(p); |
---|
2008 | XtCallCallbackList(w, p->printpanel.ok_callback, (XtPointer) NULL); |
---|
2009 | } |
---|
2010 | |
---|
2011 | static void applyCallback(w, p, call_data) |
---|
2012 | Widget w; |
---|
2013 | PrintPanelWidget p; |
---|
2014 | XmAnyCallbackStruct *call_data; |
---|
2015 | { |
---|
2016 | DoWork(p); |
---|
2017 | } |
---|
2018 | |
---|
2019 | static void resetCallback(w, p, call_data) |
---|
2020 | Widget w; |
---|
2021 | PrintPanelWidget p; |
---|
2022 | XmAnyCallbackStruct *call_data; |
---|
2023 | { |
---|
2024 | |
---|
2025 | p->printpanel.action = PRINT; |
---|
2026 | XmToggleButtonSetState(p->printpanel.print_toggle_child, TRUE, TRUE); |
---|
2027 | XmListSelectItem(p->printpanel.filter_list_child, |
---|
2028 | CS(p->printpanel.default_filter_name), TRUE); |
---|
2029 | XmListSelectItem(p->printpanel.printer_list_child, |
---|
2030 | CS(p->printpanel.default_printer_name), TRUE); |
---|
2031 | XmToggleButtonSetState(p->printpanel.all_toggle_child, TRUE, TRUE); |
---|
2032 | p->printpanel.use_pslpr = FALSE; |
---|
2033 | p->printpanel.use_psnup = FALSE; |
---|
2034 | p->printpanel.copies = 1; |
---|
2035 | XmTextFieldSetString(p->printpanel.copy_field_child, "1"); |
---|
2036 | XmTextFieldSetString(p->printpanel.begin_field_child, ""); |
---|
2037 | XmTextFieldSetString(p->printpanel.end_field_child, ""); |
---|
2038 | XmTextFieldSetString(p->printpanel.open_field_child, ""); |
---|
2039 | XmTextFieldSetString(p->printpanel.save_text_child, ""); |
---|
2040 | XmTextFieldSetString(p->printpanel.fax_text_child, ""); |
---|
2041 | |
---|
2042 | |
---|
2043 | } |
---|
2044 | static void cancelCallback(w, p, call_data) |
---|
2045 | Widget w; |
---|
2046 | PrintPanelWidget p; |
---|
2047 | XmAnyCallbackStruct *call_data; |
---|
2048 | { |
---|
2049 | XtCallCallbackList(w, p->printpanel.cancel_callback, (XtPointer) NULL); |
---|
2050 | } |
---|
2051 | |
---|
2052 | static void ListSelection(w, p, call_data) |
---|
2053 | Widget w; |
---|
2054 | PrintPanelWidget p; |
---|
2055 | XmListCallbackStruct *call_data; |
---|
2056 | { |
---|
2057 | char *text; |
---|
2058 | FILE *fp; |
---|
2059 | int ret; |
---|
2060 | |
---|
2061 | if (XmStringGetLtoR(call_data->item, XmSTRING_DEFAULT_CHARSET, |
---|
2062 | &text)) { |
---|
2063 | if (w == p->printpanel.printer_list_child) { |
---|
2064 | XmTextFieldSetString(p->printpanel.printer_field_child, text); |
---|
2065 | strncpy(p->printpanel.current_printer_name, text, 30); |
---|
2066 | fp = (FILE *) GetPPD(p->printpanel.current_printer_name); |
---|
2067 | ret = ReadPPD(p, fp); |
---|
2068 | if (ret == FALSE) { |
---|
2069 | CleanupOldFeatures(p); |
---|
2070 | if (p->printpanel.message_dialog_child) |
---|
2071 | DisplayError(p->printpanel.message_dialog_child, |
---|
2072 | "Error reading PPD file\n"); |
---|
2073 | else |
---|
2074 | fprintf(stderr, "Error reading PPD file\n"); |
---|
2075 | return; |
---|
2076 | } |
---|
2077 | CleanupOldFeatures(p); |
---|
2078 | BuildFeatures(p); |
---|
2079 | if (p->printpanel.features.supports_fax != TRUE) |
---|
2080 | XtSetSensitive(p->printpanel.fax_toggle_child, FALSE); |
---|
2081 | } |
---|
2082 | else if (w == p->printpanel.filter_list_child) { |
---|
2083 | XmTextFieldSetString(p->printpanel.filter_field_child, text); |
---|
2084 | p->printpanel.old_filter = p->printpanel.filter; |
---|
2085 | p->printpanel.filter = GetFilter(p, text); |
---|
2086 | /* clean up old filter */ |
---|
2087 | if (p->printpanel.old_filter != p->printpanel.filter) { |
---|
2088 | Cleanup(p, p->printpanel.old_filter); |
---|
2089 | if (p->printpanel.old_filter == PSROFF) |
---|
2090 | Cleanup(p, PTROFF); |
---|
2091 | SetupFilter(p, p->printpanel.filter); |
---|
2092 | } |
---|
2093 | } |
---|
2094 | else if (w == p->printpanel.fax_phone_list_child) { |
---|
2095 | strcpy(p->printpanel.tmp_fax_data.key, text); |
---|
2096 | CleanupPhoneEntry(p); |
---|
2097 | BuildPhoneEntry(p); |
---|
2098 | } |
---|
2099 | } |
---|
2100 | } |
---|
2101 | |
---|
2102 | |
---|
2103 | void SensitizeFax(p, value) |
---|
2104 | PrintPanelWidget p; |
---|
2105 | int value; |
---|
2106 | { |
---|
2107 | XtSetSensitive(p->printpanel.fax_label_child, value); |
---|
2108 | XtSetSensitive(p->printpanel.fax_text_child, value); |
---|
2109 | XtSetSensitive(p->printpanel.fax_button_child, value); |
---|
2110 | } |
---|
2111 | |
---|
2112 | void SensitizeSave(p, value) |
---|
2113 | PrintPanelWidget p; |
---|
2114 | int value; |
---|
2115 | { |
---|
2116 | XtSetSensitive(p->printpanel.save_label_child, value); |
---|
2117 | XtSetSensitive(p->printpanel.save_text_child, value); |
---|
2118 | XtSetSensitive(p->printpanel.save_button_child, value); |
---|
2119 | } |
---|
2120 | |
---|
2121 | static void ToggleCallback(w, data, call_data) |
---|
2122 | Widget w; |
---|
2123 | int *data; |
---|
2124 | XmToggleButtonCallbackStruct *call_data; |
---|
2125 | { |
---|
2126 | *data = call_data->set; |
---|
2127 | } |
---|
2128 | |
---|
2129 | static void DraftToggleCallback(w, p, call_data) |
---|
2130 | Widget w; |
---|
2131 | PrintPanelWidget p; |
---|
2132 | XmToggleButtonCallbackStruct *call_data; |
---|
2133 | { |
---|
2134 | p->printpanel.tmp_psdraft = call_data->set; |
---|
2135 | |
---|
2136 | if (p->printpanel.tmp_psdraft) { |
---|
2137 | XtSetSensitive(p->printpanel.special_draft_button_child, TRUE); |
---|
2138 | } |
---|
2139 | else { |
---|
2140 | XtSetSensitive(p->printpanel.special_draft_button_child, FALSE); |
---|
2141 | } |
---|
2142 | } |
---|
2143 | |
---|
2144 | static void LandscapeToggleCallback(w, data, call_data) |
---|
2145 | Widget w; |
---|
2146 | int *data; |
---|
2147 | XmToggleButtonCallbackStruct *call_data; |
---|
2148 | { |
---|
2149 | PrintPanelWidget p = (PrintPanelWidget) |
---|
2150 | XtParent(XtParent(XtParent(XtParent(w)))); |
---|
2151 | *data= call_data->set; |
---|
2152 | |
---|
2153 | if (call_data->set) { |
---|
2154 | XtSetSensitive(p->printpanel.special_overtranslate_toggle_child, |
---|
2155 | TRUE); |
---|
2156 | XtSetSensitive(p->printpanel.special_squeeze_toggle_child, TRUE); |
---|
2157 | } |
---|
2158 | else { |
---|
2159 | XtSetSensitive(p->printpanel.special_overtranslate_toggle_child, |
---|
2160 | FALSE); |
---|
2161 | XtSetSensitive(p->printpanel.special_squeeze_toggle_child, FALSE); |
---|
2162 | } |
---|
2163 | } |
---|
2164 | |
---|
2165 | static void FaxToggleCallback(w, p, call_data) |
---|
2166 | Widget w; |
---|
2167 | PrintPanelWidget p; |
---|
2168 | XmToggleButtonCallbackStruct *call_data; |
---|
2169 | { |
---|
2170 | p->printpanel.tmp_fax_data.save = call_data->set; |
---|
2171 | |
---|
2172 | if (p->printpanel.tmp_fax_data.save) |
---|
2173 | XtSetSensitive(p->printpanel.fax_save_button_child, TRUE); |
---|
2174 | else |
---|
2175 | XtSetSensitive(p->printpanel.fax_save_button_child, FALSE); |
---|
2176 | } |
---|
2177 | |
---|
2178 | static void NupToggleCallback(w, p, call_data) |
---|
2179 | Widget w; |
---|
2180 | PrintPanelWidget p; |
---|
2181 | XmToggleButtonCallbackStruct *call_data; |
---|
2182 | { |
---|
2183 | |
---|
2184 | p->printpanel.tmp_psnup = call_data->set; |
---|
2185 | |
---|
2186 | if (p->printpanel.tmp_psnup) { |
---|
2187 | XtSetSensitive(p->printpanel.special_gaudy_toggle_child, TRUE); |
---|
2188 | XtSetSensitive(p->printpanel.special_rotate_toggle_child, TRUE); |
---|
2189 | XtSetSensitive(p->printpanel.special_nup_column_label_child, TRUE); |
---|
2190 | XtSetSensitive(p->printpanel.special_nup_column_field_child, TRUE); |
---|
2191 | XtSetSensitive(p->printpanel.special_nup_row_label_child, TRUE); |
---|
2192 | XtSetSensitive(p->printpanel.special_nup_row_field_child, TRUE); |
---|
2193 | } |
---|
2194 | else { |
---|
2195 | XtSetSensitive(p->printpanel.special_gaudy_toggle_child, FALSE); |
---|
2196 | XtSetSensitive(p->printpanel.special_rotate_toggle_child, FALSE); |
---|
2197 | XtSetSensitive(p->printpanel.special_nup_column_label_child, FALSE); |
---|
2198 | XtSetSensitive(p->printpanel.special_nup_column_field_child, FALSE); |
---|
2199 | XtSetSensitive(p->printpanel.special_nup_row_label_child, FALSE); |
---|
2200 | XtSetSensitive(p->printpanel.special_nup_row_field_child, FALSE); |
---|
2201 | } |
---|
2202 | } |
---|
2203 | |
---|
2204 | static void RadioCallback(w, p, call_data) |
---|
2205 | Widget w; |
---|
2206 | PrintPanelWidget p; |
---|
2207 | XmRowColumnCallbackStruct *call_data; |
---|
2208 | { |
---|
2209 | XmToggleButtonCallbackStruct *cdata; |
---|
2210 | |
---|
2211 | cdata = (XmToggleButtonCallbackStruct *) call_data->callbackstruct; |
---|
2212 | if (call_data->widget == p->printpanel.print_toggle_child && |
---|
2213 | cdata->set) { |
---|
2214 | p->printpanel.action = PRINT; |
---|
2215 | } |
---|
2216 | else if (call_data->widget == p->printpanel.preview_toggle_child && |
---|
2217 | cdata->set ) { |
---|
2218 | p->printpanel.action = PREVIEW; |
---|
2219 | } |
---|
2220 | else if (call_data->widget == p->printpanel.save_toggle_child) { |
---|
2221 | if (cdata->set) { |
---|
2222 | p->printpanel.action = SAVE; |
---|
2223 | SensitizeSave(p, TRUE); |
---|
2224 | } |
---|
2225 | else SensitizeSave(p, FALSE); |
---|
2226 | } |
---|
2227 | else if (call_data->widget == p->printpanel.fax_toggle_child) { |
---|
2228 | if (cdata->set) { |
---|
2229 | p->printpanel.action = FAX; |
---|
2230 | SensitizeFax(p, TRUE); |
---|
2231 | } |
---|
2232 | else SensitizeFax(p, FALSE); |
---|
2233 | } |
---|
2234 | } |
---|
2235 | |
---|
2236 | static void FaxFormatCallback(w, p, call_data) |
---|
2237 | Widget w; |
---|
2238 | PrintPanelWidget p; |
---|
2239 | XmRowColumnCallbackStruct *call_data; |
---|
2240 | { |
---|
2241 | |
---|
2242 | XmToggleButtonCallbackStruct *cdata; |
---|
2243 | |
---|
2244 | cdata = (XmToggleButtonCallbackStruct *)call_data->callbackstruct; |
---|
2245 | |
---|
2246 | if (call_data->widget == p->printpanel.fax_teleps_toggle_child) { |
---|
2247 | if (cdata->set) { |
---|
2248 | XtSetSensitive(p->printpanel.fax_teleps_field_child, TRUE); |
---|
2249 | XtSetSensitive(p->printpanel.fax_teleps_label_child, TRUE); |
---|
2250 | p->printpanel.tmp_fax_data.sendps = TRUE; |
---|
2251 | } |
---|
2252 | else { |
---|
2253 | XtSetSensitive(p->printpanel.fax_teleps_field_child, FALSE); |
---|
2254 | XtSetSensitive(p->printpanel.fax_teleps_label_child, FALSE); |
---|
2255 | p->printpanel.tmp_fax_data.sendps = FALSE; |
---|
2256 | } |
---|
2257 | } |
---|
2258 | } |
---|
2259 | |
---|
2260 | |
---|
2261 | static void FieldChange(w, p, call_data) |
---|
2262 | Widget w; |
---|
2263 | PrintPanelWidget p; |
---|
2264 | XmAnyCallbackStruct *call_data; |
---|
2265 | { |
---|
2266 | char *value; |
---|
2267 | |
---|
2268 | value = XmTextFieldGetString(w); |
---|
2269 | if (*value == '\0') |
---|
2270 | return; |
---|
2271 | if (w == p->printpanel.fax_rec_field_child) { |
---|
2272 | strcpy(p->printpanel.tmp_fax_data.name, value); |
---|
2273 | } |
---|
2274 | else if (w == p->printpanel.fax_num_field_child) { |
---|
2275 | strcpy(p->printpanel.tmp_fax_data.phone, value); |
---|
2276 | } |
---|
2277 | } |
---|
2278 | |
---|
2279 | static void FilterFieldChange(w, p, call_data) |
---|
2280 | Widget w; |
---|
2281 | PrintPanelWidget p; |
---|
2282 | XmAnyCallbackStruct *call_data; |
---|
2283 | { |
---|
2284 | char *value; |
---|
2285 | int i; |
---|
2286 | |
---|
2287 | value = XmTextFieldGetString(w); |
---|
2288 | if (*value == '\0') |
---|
2289 | XmListDeselectAllItems(p->printpanel.filter_list_child); |
---|
2290 | else { |
---|
2291 | for (i = 0; i < p->printpanel.num_filters; i++) { |
---|
2292 | if (strncmp(value, p->printpanel.filterlist[i].name, |
---|
2293 | strlen(value)) == 0) { |
---|
2294 | XmListSelectItem(p->printpanel.filter_list_child, |
---|
2295 | CS(p->printpanel.filterlist[i].name), |
---|
2296 | FALSE); |
---|
2297 | break; |
---|
2298 | } |
---|
2299 | } |
---|
2300 | if (i == 7) |
---|
2301 | XmListDeselectAllItems(p->printpanel.filter_list_child); |
---|
2302 | } |
---|
2303 | } |
---|
2304 | |
---|
2305 | static void ChooseFileCallback(w, whichfile, call_data) |
---|
2306 | Widget w; |
---|
2307 | Widget whichfile; |
---|
2308 | XmAnyCallbackStruct *call_data; |
---|
2309 | { |
---|
2310 | XtManageChild(whichfile); |
---|
2311 | } |
---|
2312 | |
---|
2313 | static void FileOKCallback(w, mydata, call_data) |
---|
2314 | Widget w; |
---|
2315 | FileSBData *mydata; |
---|
2316 | XmAnyCallbackStruct *call_data; |
---|
2317 | { |
---|
2318 | PrintPanelWidget p = (PrintPanelWidget) mydata->head; |
---|
2319 | XmString val; |
---|
2320 | int i; |
---|
2321 | Arg args[10]; |
---|
2322 | |
---|
2323 | i = 0; |
---|
2324 | XtSetArg(args[i], XmNtextString, &val); i++; |
---|
2325 | XtGetValues(mydata->which_sb, args, i); |
---|
2326 | if (!XmStringGetLtoR(val, XmSTRING_DEFAULT_CHARSET, mydata->name)) |
---|
2327 | DisplayError(p->printpanel.message_dialog_child, |
---|
2328 | "Value of field unreadable."); |
---|
2329 | if (mydata->which_field != NULL) |
---|
2330 | XmTextFieldSetString(mydata->which_field, *(mydata->name)); |
---|
2331 | XtUnmanageChild(mydata->which_sb); |
---|
2332 | } |
---|
2333 | |
---|
2334 | static void FileCancelCallback(w, mydata, call_data) |
---|
2335 | Widget w; |
---|
2336 | FileSBData *mydata; |
---|
2337 | XmAnyCallbackStruct *call_data; |
---|
2338 | { |
---|
2339 | XtUnmanageChild(mydata->which_sb); |
---|
2340 | } |
---|
2341 | |
---|
2342 | static void RangeCallback(w, p, call_data) |
---|
2343 | Widget w; |
---|
2344 | PrintPanelWidget p; |
---|
2345 | XmRowColumnCallbackStruct *call_data; |
---|
2346 | { |
---|
2347 | XmToggleButtonCallbackStruct *cdata; |
---|
2348 | |
---|
2349 | cdata = (XmToggleButtonCallbackStruct *) call_data->callbackstruct; |
---|
2350 | |
---|
2351 | if (call_data->widget == p->printpanel.all_toggle_child && cdata->set) { |
---|
2352 | p->printpanel.range = ALL; |
---|
2353 | XtSetSensitive(p->printpanel.begin_field_child, FALSE); |
---|
2354 | XtSetSensitive(p->printpanel.end_field_child, FALSE); |
---|
2355 | } |
---|
2356 | else if (call_data->widget == p->printpanel.range_toggle_child && |
---|
2357 | cdata->set) { |
---|
2358 | p->printpanel.range = RANGE; |
---|
2359 | XtSetSensitive(p->printpanel.begin_field_child, TRUE); |
---|
2360 | XtSetSensitive(p->printpanel.end_field_child, TRUE); |
---|
2361 | } |
---|
2362 | } |
---|
2363 | |
---|
2364 | static void IntTextFieldChange(w, data, call_data) |
---|
2365 | Widget w; |
---|
2366 | int *data; |
---|
2367 | XmAnyCallbackStruct *call_data; |
---|
2368 | { |
---|
2369 | char *value; |
---|
2370 | |
---|
2371 | value = XmTextFieldGetString(w); |
---|
2372 | *data = atoi(value); |
---|
2373 | } |
---|
2374 | |
---|
2375 | static void RealTextFieldChange(w, data, call_data) |
---|
2376 | Widget w; |
---|
2377 | float *data; |
---|
2378 | XmAnyCallbackStruct *call_data; |
---|
2379 | { |
---|
2380 | char *value; |
---|
2381 | |
---|
2382 | value = XmTextFieldGetString(w); |
---|
2383 | *data = strtod(value, NULL); |
---|
2384 | } |
---|
2385 | |
---|
2386 | static void StringTextFieldChange(w, data, call_data) |
---|
2387 | Widget w; |
---|
2388 | char **data; |
---|
2389 | XmAnyCallbackStruct *call_data; |
---|
2390 | { |
---|
2391 | *data = XmTextFieldGetString(w); |
---|
2392 | if (**data == '\0') |
---|
2393 | *data = NULL; |
---|
2394 | } |
---|
2395 | |
---|
2396 | static void FindLines(str, carryover, list) |
---|
2397 | char *str; |
---|
2398 | char *carryover; |
---|
2399 | XmString *list; |
---|
2400 | { |
---|
2401 | char *p, *q; |
---|
2402 | |
---|
2403 | q = str; |
---|
2404 | while ((p = strchr(q, '\n')) != NULL) { |
---|
2405 | *p = '\0'; |
---|
2406 | p++; |
---|
2407 | if (*carryover != '\0') { |
---|
2408 | /* tack new stuff onto old stuff */ |
---|
2409 | strcat(carryover, q); |
---|
2410 | AddToCompoundList(list, carryover); |
---|
2411 | *carryover = '\0'; |
---|
2412 | } |
---|
2413 | else |
---|
2414 | AddToCompoundList(list, q); |
---|
2415 | q = p; |
---|
2416 | if (*q == '\0') |
---|
2417 | break; |
---|
2418 | } |
---|
2419 | if (*q != '\0') |
---|
2420 | /* save the fragment */ |
---|
2421 | strcat(carryover, q); |
---|
2422 | } |
---|
2423 | |
---|
2424 | static void ReadErrors(p, source, id) |
---|
2425 | PrintPanelWidget p; |
---|
2426 | int *source; |
---|
2427 | XtInputId *id; |
---|
2428 | { |
---|
2429 | int cnt; |
---|
2430 | FILE *fp; |
---|
2431 | char buf[1024]; |
---|
2432 | |
---|
2433 | |
---|
2434 | buf[0] = '\0'; |
---|
2435 | cnt = 0; |
---|
2436 | if ((cnt = read(*source, buf, 1024)) > 0) { |
---|
2437 | buf[cnt] = '\0'; |
---|
2438 | FindLines(buf, p->printpanel.tmp_line, &p->printpanel.err_list); |
---|
2439 | } |
---|
2440 | else { |
---|
2441 | if (p->printpanel.tmp_line[0] != '\0') |
---|
2442 | AddToCompoundList(&p->printpanel.err_list, p->printpanel.tmp_line); |
---|
2443 | if (p->printpanel.err_list) { |
---|
2444 | DisplayCompound(p->printpanel.message_dialog_child, |
---|
2445 | p->printpanel.err_list); |
---|
2446 | XtFree(p->printpanel.err_list); |
---|
2447 | p->printpanel.err_list = (XmString) NULL; |
---|
2448 | } |
---|
2449 | close(*source); |
---|
2450 | XtRemoveInput(*id); |
---|
2451 | p->printpanel.tmp_line[0] = '\0'; |
---|
2452 | } |
---|
2453 | } |
---|
2454 | |
---|
2455 | static void CancelPopup(w, call_data) |
---|
2456 | Widget w; |
---|
2457 | XmAnyCallbackStruct *call_data; |
---|
2458 | { |
---|
2459 | XtUnmanageChild(w); |
---|
2460 | } |
---|
2461 | |
---|
2462 | static XtInputCallbackProc ReadStatus(client_data, source, id) |
---|
2463 | XtPointer client_data; |
---|
2464 | int *source; |
---|
2465 | XtInputId *id; |
---|
2466 | { |
---|
2467 | int cnt; |
---|
2468 | FILE *fp; |
---|
2469 | char buf[1024]; |
---|
2470 | PrintPanelWidget p = (PrintPanelWidget) client_data; |
---|
2471 | |
---|
2472 | |
---|
2473 | if ((cnt = read(*source, buf, 1024)) > 0) { |
---|
2474 | buf[cnt] = '\0'; |
---|
2475 | FindLines(buf, p->printpanel.tmp_line, &p->printpanel.status_list); |
---|
2476 | } |
---|
2477 | else { |
---|
2478 | if (p->printpanel.tmp_line[0] != '\0') |
---|
2479 | AddToCompoundList(&p->printpanel.status_list, p->printpanel.tmp_line); |
---|
2480 | DisplayCompound(p->printpanel.message_dialog_child, |
---|
2481 | p->printpanel.status_list); |
---|
2482 | close(*source); |
---|
2483 | XtRemoveInput(*id); |
---|
2484 | p->printpanel.status_list = (XmString) NULL; |
---|
2485 | XtFree(p->printpanel.status_list); |
---|
2486 | p->printpanel.tmp_line[0] = '\0'; |
---|
2487 | } |
---|
2488 | } |
---|
2489 | |
---|
2490 | static void PrinterStatusCallback(w, call_data) |
---|
2491 | Widget w; |
---|
2492 | XmAnyCallbackStruct *call_data; |
---|
2493 | { |
---|
2494 | int statuspipe[2]; |
---|
2495 | int fpid; |
---|
2496 | char *argstr[10]; |
---|
2497 | int nargs = 0; |
---|
2498 | char buf[100]; |
---|
2499 | PrintPanelWidget p = (PrintPanelWidget) XtParent(XtParent(w)); |
---|
2500 | #ifdef SYSV |
---|
2501 | #define PSTAT "lpstat" |
---|
2502 | #else |
---|
2503 | #define PSTAT "lpq" |
---|
2504 | #endif |
---|
2505 | |
---|
2506 | addarg(argstr, nargs++, PSTAT); |
---|
2507 | #ifdef SYSV |
---|
2508 | sprintf(buf, "-p%s", p->printpanel.current_printer_name); |
---|
2509 | #else |
---|
2510 | sprintf(buf, "-P%s", p->printpanel.current_printer_name); |
---|
2511 | #endif |
---|
2512 | addarg(argstr, nargs++, buf); |
---|
2513 | |
---|
2514 | p->printpanel.status_fd = dup(0); |
---|
2515 | XtAppAddInput(XtWidgetToApplicationContext(p), p->printpanel.status_fd, |
---|
2516 | XtInputReadMask, ReadStatus, p); |
---|
2517 | |
---|
2518 | if (pipe(statuspipe)) { |
---|
2519 | DisplayError(p->printpanel.message_dialog_child, |
---|
2520 | "Pipe creation failed.\n"); |
---|
2521 | return; |
---|
2522 | } |
---|
2523 | |
---|
2524 | if ((fpid = fork()) < 0) { |
---|
2525 | DisplayError(p->printpanel.message_dialog_child, |
---|
2526 | "Process fork failed.\n"); |
---|
2527 | return; |
---|
2528 | } |
---|
2529 | |
---|
2530 | if (fpid == 0) { |
---|
2531 | /* child process */ |
---|
2532 | if ((dup2(statuspipe[1], 1) < 0) || close(statuspipe[0]) || |
---|
2533 | close(statuspipe[1])) { |
---|
2534 | DisplayError(p->printpanel.message_dialog_child, |
---|
2535 | "Pipe error in child process.\n"); |
---|
2536 | exit(1); |
---|
2537 | } |
---|
2538 | execvp(PSTAT, argstr); |
---|
2539 | DisplayError(p->printpanel.message_dialog_child, |
---|
2540 | "Could not get printer status"); |
---|
2541 | exit(1); |
---|
2542 | } |
---|
2543 | /* parent */ |
---|
2544 | if ((dup2(statuspipe[0], p->printpanel.status_fd) < 0) || |
---|
2545 | close(statuspipe[0]) || close(statuspipe[1])) { |
---|
2546 | DisplayError(p->printpanel.message_dialog_child, |
---|
2547 | "Pipe error in parent process."); |
---|
2548 | return; |
---|
2549 | } |
---|
2550 | } |
---|
2551 | |
---|
2552 | static void ResetOptions(p) |
---|
2553 | PrintPanelWidget p; |
---|
2554 | { |
---|
2555 | int i; |
---|
2556 | int num; |
---|
2557 | WidgetClass wclass; |
---|
2558 | Widget w; |
---|
2559 | |
---|
2560 | num = p->printpanel.option_children[p->printpanel.filter].num_children; |
---|
2561 | for (i = 0; i < num; i++) { |
---|
2562 | w = p->printpanel.option_children[p->printpanel.filter].child[i]; |
---|
2563 | wclass = XtClass(w); |
---|
2564 | |
---|
2565 | if (wclass == xmTextFieldWidgetClass) { |
---|
2566 | /* text field; set to null */ |
---|
2567 | XmTextFieldSetString(w, ""); |
---|
2568 | } |
---|
2569 | else if (wclass == xmToggleButtonWidgetClass) { |
---|
2570 | /* toggle button; set to false */ |
---|
2571 | XmToggleButtonSetState(w, FALSE, TRUE); |
---|
2572 | } |
---|
2573 | } |
---|
2574 | } |
---|
2575 | |
---|
2576 | static void SecondaryResetCallback(w, p, call_data) |
---|
2577 | Widget w; |
---|
2578 | PrintPanelWidget p; |
---|
2579 | XmAnyCallbackStruct *call_data; |
---|
2580 | { |
---|
2581 | if (w == p->printpanel.special_reset_button_child) { |
---|
2582 | XmToggleButtonSetState(p->printpanel.special_nup_toggle_child, |
---|
2583 | FALSE, TRUE); |
---|
2584 | XmTextFieldSetString(p->printpanel.special_nup_row_field_child, |
---|
2585 | "2"); |
---|
2586 | XmTextFieldSetString(p->printpanel.special_nup_column_field_child, |
---|
2587 | "2"); |
---|
2588 | XmToggleButtonSetState(p->printpanel.special_gaudy_toggle_child, |
---|
2589 | FALSE, TRUE); |
---|
2590 | XmToggleButtonSetState(p->printpanel.special_rotate_toggle_child, |
---|
2591 | FALSE, TRUE); |
---|
2592 | XmToggleButtonSetState(p->printpanel.special_overtranslate_toggle_child, |
---|
2593 | FALSE, TRUE); |
---|
2594 | XmToggleButtonSetState(p->printpanel.special_squeeze_toggle_child, |
---|
2595 | FALSE, TRUE); |
---|
2596 | XmToggleButtonSetState(p->printpanel.special_showpage_toggle_child, |
---|
2597 | FALSE, TRUE); |
---|
2598 | XmToggleButtonSetState(p->printpanel.special_landscape_toggle_child, |
---|
2599 | FALSE, TRUE); |
---|
2600 | } |
---|
2601 | else if (w == p->printpanel.generic_reset_button_child) { |
---|
2602 | ResetOptions(p); |
---|
2603 | } |
---|
2604 | } |
---|
2605 | |
---|
2606 | static void SecondaryCancelCallback(w, whichone, call_data) |
---|
2607 | Widget w; |
---|
2608 | Widget *whichone; |
---|
2609 | XmAnyCallbackStruct *call_data; |
---|
2610 | { |
---|
2611 | XtUnmanageChild(*whichone); |
---|
2612 | } |
---|
2613 | |
---|
2614 | static void SecondaryCallback(w, whichone, call_data) |
---|
2615 | Widget w; |
---|
2616 | Widget *whichone; |
---|
2617 | XmAnyCallbackStruct *call_data; |
---|
2618 | { |
---|
2619 | int i; |
---|
2620 | Arg args[10]; |
---|
2621 | Dimension width; |
---|
2622 | Dimension height; |
---|
2623 | int test; |
---|
2624 | PrintPanelWidget p = (PrintPanelWidget) XtParent(XtParent(w)); |
---|
2625 | |
---|
2626 | if (*whichone == p->printpanel.generic_panel_child && |
---|
2627 | p->printpanel.filter == -1) |
---|
2628 | return; |
---|
2629 | if (*whichone == NULL) |
---|
2630 | return; |
---|
2631 | |
---|
2632 | XtRealizeWidget(*whichone); |
---|
2633 | XtManageChild(*whichone); |
---|
2634 | } |
---|
2635 | |
---|
2636 | static void SetOptions(p, filt) |
---|
2637 | PrintPanelWidget p; |
---|
2638 | int filt; |
---|
2639 | { |
---|
2640 | switch (filt) { |
---|
2641 | case ENSCRIPT: |
---|
2642 | p->printpanel.enscript_info.font = |
---|
2643 | p->printpanel.tmp_enscript_info.font; |
---|
2644 | p->printpanel.enscript_info.header_font = |
---|
2645 | p->printpanel.tmp_enscript_info.header_font; |
---|
2646 | p->printpanel.enscript_info.font_size = |
---|
2647 | p->printpanel.tmp_enscript_info.font_size; |
---|
2648 | p->printpanel.enscript_info.header_font_size = |
---|
2649 | p->printpanel.tmp_enscript_info.header_font_size; |
---|
2650 | p->printpanel.enscript_info.header = |
---|
2651 | p->printpanel.tmp_enscript_info.header; |
---|
2652 | p->printpanel.enscript_info.tab_width = |
---|
2653 | p->printpanel.tmp_enscript_info.tab_width; |
---|
2654 | p->printpanel.enscript_info.columns = |
---|
2655 | p->printpanel.tmp_enscript_info.columns; |
---|
2656 | p->printpanel.enscript_info.lines = |
---|
2657 | p->printpanel.tmp_enscript_info.lines; |
---|
2658 | p->printpanel.enscript_info.rotated = |
---|
2659 | p->printpanel.tmp_enscript_info.rotated; |
---|
2660 | p->printpanel.enscript_info.norotate = |
---|
2661 | p->printpanel.tmp_enscript_info.norotate; |
---|
2662 | p->printpanel.enscript_info.gaudy = |
---|
2663 | p->printpanel.tmp_enscript_info.gaudy; |
---|
2664 | p->printpanel.enscript_info.lpt_mode = |
---|
2665 | p->printpanel.tmp_enscript_info.lpt_mode; |
---|
2666 | p->printpanel.enscript_info.no_header = |
---|
2667 | p->printpanel.tmp_enscript_info.no_header; |
---|
2668 | p->printpanel.enscript_info.truncate_lines = |
---|
2669 | p->printpanel.tmp_enscript_info.truncate_lines; |
---|
2670 | p->printpanel.enscript_info.ignore_binary = |
---|
2671 | p->printpanel.tmp_enscript_info.ignore_binary; |
---|
2672 | p->printpanel.enscript_info.report_missing_chars = |
---|
2673 | p->printpanel.tmp_enscript_info.report_missing_chars; |
---|
2674 | p->printpanel.enscript_info.quiet_mode = |
---|
2675 | p->printpanel.tmp_enscript_info.quiet_mode; |
---|
2676 | p->printpanel.enscript_info.no_burst_page = |
---|
2677 | p->printpanel.tmp_enscript_info.no_burst_page; |
---|
2678 | break; |
---|
2679 | case PSROFF: |
---|
2680 | p->printpanel.roff_info.font_dir = |
---|
2681 | p->printpanel.tmp_roff_info.font_dir; |
---|
2682 | case PTROFF: |
---|
2683 | p->printpanel.roff_info.font = p->printpanel.tmp_roff_info.font; |
---|
2684 | p->printpanel.roff_info.options = |
---|
2685 | p->printpanel.tmp_roff_info.options ; |
---|
2686 | break; |
---|
2687 | case PS4014: |
---|
2688 | p->printpanel.ps4014_info.scale = |
---|
2689 | p->printpanel.tmp_ps4014_info.scale; |
---|
2690 | p->printpanel.ps4014_info.left = |
---|
2691 | p->printpanel.tmp_ps4014_info.left; |
---|
2692 | p->printpanel.ps4014_info.bottom = |
---|
2693 | p->printpanel.tmp_ps4014_info.bottom; |
---|
2694 | p->printpanel.ps4014_info.width = |
---|
2695 | p->printpanel.tmp_ps4014_info.width; |
---|
2696 | p->printpanel.ps4014_info.height = |
---|
2697 | p->printpanel.tmp_ps4014_info.height; |
---|
2698 | p->printpanel.ps4014_info.portrait = |
---|
2699 | p->printpanel.tmp_ps4014_info.portrait; |
---|
2700 | p->printpanel.ps4014_info.cr_no_lf = |
---|
2701 | p->printpanel.tmp_ps4014_info.cr_no_lf; |
---|
2702 | p->printpanel.ps4014_info.lf_no_cr = |
---|
2703 | p->printpanel.tmp_ps4014_info.lf_no_cr; |
---|
2704 | p->printpanel.ps4014_info.margin_2 = |
---|
2705 | p->printpanel.tmp_ps4014_info.margin_2; |
---|
2706 | break; |
---|
2707 | case PSPLT: |
---|
2708 | p->printpanel.plot_profile = p->printpanel.tmp_plot_profile; |
---|
2709 | break; |
---|
2710 | case PS630: |
---|
2711 | p->printpanel.ps630_info.bold_font = |
---|
2712 | p->printpanel.tmp_ps630_info.bold_font; |
---|
2713 | p->printpanel.ps630_info.body_font = |
---|
2714 | p->printpanel.tmp_ps630_info.body_font; |
---|
2715 | p->printpanel.ps630_info.pitch = |
---|
2716 | p->printpanel.tmp_ps630_info.pitch; |
---|
2717 | break; |
---|
2718 | case NONE: |
---|
2719 | default: |
---|
2720 | break; |
---|
2721 | } |
---|
2722 | } |
---|
2723 | |
---|
2724 | static void SetFeatures(p) |
---|
2725 | PrintPanelWidget p; |
---|
2726 | { |
---|
2727 | int i; |
---|
2728 | int j; |
---|
2729 | char **ptr; |
---|
2730 | |
---|
2731 | p->printpanel.use_pslpr = FALSE; |
---|
2732 | for (i = 0; i <= p->printpanel.num_features; i++) { |
---|
2733 | for (j = 0; j < p->printpanel.feature_info[i].num; j++) { |
---|
2734 | if (p->printpanel.feature_info[i].tmpvalue[j]) { |
---|
2735 | p->printpanel.feature_info[i].value[j] = |
---|
2736 | p->printpanel.feature_info[i].tmpvalue[j]; |
---|
2737 | } |
---|
2738 | } |
---|
2739 | } |
---|
2740 | } |
---|
2741 | |
---|
2742 | static void SetDraftFields(p) |
---|
2743 | PrintPanelWidget p; |
---|
2744 | { |
---|
2745 | p->printpanel.psdraft_info.font = p->printpanel.tmp_psdraft_info.font; |
---|
2746 | p->printpanel.psdraft_info.size = p->printpanel.tmp_psdraft_info.size; |
---|
2747 | p->printpanel.psdraft_info.angle = p->printpanel.tmp_psdraft_info.angle; |
---|
2748 | p->printpanel.psdraft_info.gray = p->printpanel.tmp_psdraft_info.gray; |
---|
2749 | p->printpanel.psdraft_info.xpos = p->printpanel.tmp_psdraft_info.xpos; |
---|
2750 | p->printpanel.psdraft_info.ypos = p->printpanel.tmp_psdraft_info.ypos; |
---|
2751 | p->printpanel.psdraft_info.draftstring = |
---|
2752 | p->printpanel.tmp_psdraft_info.draftstring; |
---|
2753 | p->printpanel.psdraft_info.outline = |
---|
2754 | p->printpanel.tmp_psdraft_info.outline; |
---|
2755 | } |
---|
2756 | |
---|
2757 | |
---|
2758 | static void DraftOKCallback(w, p, call_data) |
---|
2759 | Widget w; |
---|
2760 | PrintPanelWidget p; |
---|
2761 | XmAnyCallbackStruct *call_data; |
---|
2762 | { |
---|
2763 | SetDraftFields(p); |
---|
2764 | XtUnmanageChild(p->printpanel.draft_form_child); |
---|
2765 | } |
---|
2766 | |
---|
2767 | static void DraftApplyCallback(w, p, call_data) |
---|
2768 | Widget w; |
---|
2769 | PrintPanelWidget p; |
---|
2770 | XmAnyCallbackStruct *call_data; |
---|
2771 | { |
---|
2772 | SetDraftFields(p); |
---|
2773 | } |
---|
2774 | |
---|
2775 | static void DraftResetCallback(w, p, call_data) |
---|
2776 | Widget w; |
---|
2777 | PrintPanelWidget p; |
---|
2778 | XmAnyCallbackStruct *call_data; |
---|
2779 | { |
---|
2780 | } |
---|
2781 | |
---|
2782 | static void SetSpecialOptions(p) |
---|
2783 | PrintPanelWidget p; |
---|
2784 | { |
---|
2785 | p->printpanel.use_psnup = p->printpanel.tmp_psnup; |
---|
2786 | if (p->printpanel.use_psnup) { |
---|
2787 | p->printpanel.nup_info.rows = p->printpanel.tmp_nup_info.rows; |
---|
2788 | p->printpanel.nup_info.columns = |
---|
2789 | p->printpanel.tmp_nup_info.columns; |
---|
2790 | p->printpanel.nup_info.gaudy = |
---|
2791 | p->printpanel.tmp_nup_info.gaudy; |
---|
2792 | p->printpanel.nup_info.rotated = |
---|
2793 | p->printpanel.tmp_nup_info.rotated; |
---|
2794 | } |
---|
2795 | p->printpanel.use_psdraft = p->printpanel.tmp_psdraft; |
---|
2796 | p->printpanel.pslpr_info.showpage = |
---|
2797 | p->printpanel.tmp_pslpr_info.showpage; |
---|
2798 | p->printpanel.pslpr_info.landscape = |
---|
2799 | p->printpanel.tmp_pslpr_info.landscape; |
---|
2800 | p->printpanel.pslpr_info.squeeze = |
---|
2801 | p->printpanel.tmp_pslpr_info.squeeze; |
---|
2802 | p->printpanel.pslpr_info.overtranslate = |
---|
2803 | p->printpanel.tmp_pslpr_info.overtranslate; |
---|
2804 | } |
---|
2805 | |
---|
2806 | |
---|
2807 | static void SecondaryOKCallback(w, mycalldata, call_data) |
---|
2808 | Widget w; |
---|
2809 | SecondaryData *mycalldata; |
---|
2810 | XmAnyCallbackStruct *call_data; |
---|
2811 | { |
---|
2812 | PrintPanelWidget p = (PrintPanelWidget) |
---|
2813 | XtParent(XtParent(XtParent(XtParent(w)))); |
---|
2814 | |
---|
2815 | if (mycalldata->which_widget == p->printpanel.generic_panel_child) { |
---|
2816 | SetOptions(p, mycalldata->which_filter); |
---|
2817 | } |
---|
2818 | if (mycalldata->which_widget == p->printpanel.special_form_child) { |
---|
2819 | SetSpecialOptions(p); |
---|
2820 | } |
---|
2821 | if (mycalldata->which_widget == p->printpanel.feature_panel_child) { |
---|
2822 | SetFeatures(p); |
---|
2823 | } |
---|
2824 | if (mycalldata->which_widget == p->printpanel.fax_panel_child) { |
---|
2825 | SetFax(p); |
---|
2826 | } |
---|
2827 | XtUnmanageChild(mycalldata->which_widget); |
---|
2828 | } |
---|
2829 | |
---|
2830 | static void SecondaryApplyCallback(w, mycalldata, call_data) |
---|
2831 | Widget w; |
---|
2832 | SecondaryData *mycalldata; |
---|
2833 | XmAnyCallbackStruct *call_data; |
---|
2834 | { |
---|
2835 | PrintPanelWidget p = (PrintPanelWidget) |
---|
2836 | XtParent(XtParent(XtParent(XtParent(w)))); |
---|
2837 | |
---|
2838 | if (mycalldata->which_widget == p->printpanel.generic_panel_child) { |
---|
2839 | SetOptions(p, mycalldata->which_filter); |
---|
2840 | } |
---|
2841 | if (mycalldata->which_widget == p->printpanel.special_form_child) { |
---|
2842 | SetSpecialOptions(p); |
---|
2843 | } |
---|
2844 | if (mycalldata->which_widget == p->printpanel.feature_panel_child) { |
---|
2845 | SetFeatures(p); |
---|
2846 | } |
---|
2847 | if (mycalldata->which_widget == p->printpanel.fax_panel_child) { |
---|
2848 | SetFax(p); |
---|
2849 | } |
---|
2850 | } |
---|
2851 | |
---|
2852 | static void SetFaxFields(p) |
---|
2853 | PrintPanelWidget p; |
---|
2854 | { |
---|
2855 | if (p->printpanel.tmp_fax_data.name[0] != '\0') |
---|
2856 | XmTextFieldSetString(p->printpanel.fax_rec_field_child, |
---|
2857 | p->printpanel.tmp_fax_data.name); |
---|
2858 | if (p->printpanel.tmp_fax_data.phone[0] != '\0') |
---|
2859 | XmTextFieldSetString(p->printpanel.fax_num_field_child, |
---|
2860 | p->printpanel.tmp_fax_data.phone); |
---|
2861 | |
---|
2862 | } |
---|
2863 | |
---|
2864 | static void SetFax(p) |
---|
2865 | PrintPanelWidget p; |
---|
2866 | { |
---|
2867 | strcpy(p->printpanel.fax_data.key, p->printpanel.tmp_fax_data.key); |
---|
2868 | strcpy(p->printpanel.fax_data.name, p->printpanel.tmp_fax_data.name); |
---|
2869 | strcpy(p->printpanel.fax_data.phone, p->printpanel.tmp_fax_data.phone); |
---|
2870 | strcpy(p->printpanel.fax_data.passwd, p->printpanel.tmp_fax_data.passwd); |
---|
2871 | p->printpanel.fax_data.filename = p->printpanel.tmp_fax_data.filename; |
---|
2872 | p->printpanel.fax_data.sendps = p->printpanel.tmp_fax_data.sendps; |
---|
2873 | p->printpanel.fax_data.save = p->printpanel.tmp_fax_data.save; |
---|
2874 | |
---|
2875 | XmTextFieldSetString(p->printpanel.fax_text_child, |
---|
2876 | p->printpanel.fax_data.phone); |
---|
2877 | |
---|
2878 | } |
---|
2879 | |
---|
2880 | static void PhoneOKCallback(w, p, call_data) |
---|
2881 | Widget w; |
---|
2882 | PrintPanelWidget p; |
---|
2883 | XmAnyCallbackStruct *call_data; |
---|
2884 | { |
---|
2885 | SetFaxFields(p); |
---|
2886 | XtUnmanageChild(p->printpanel.fax_phone_panel_child); |
---|
2887 | } |
---|
2888 | |
---|
2889 | static void PhoneApplyCallback(w, p, call_data) |
---|
2890 | Widget w; |
---|
2891 | PrintPanelWidget p; |
---|
2892 | XmAnyCallbackStruct *call_data; |
---|
2893 | { |
---|
2894 | SetFaxFields(p); |
---|
2895 | } |
---|
2896 | |
---|
2897 | static void SetPitch10(w, callData) |
---|
2898 | Widget w; |
---|
2899 | XmAnyCallbackStruct *callData; |
---|
2900 | { |
---|
2901 | PrintPanelWidget p = (PrintPanelWidget) |
---|
2902 | XtParent(XtParent(XtParent(XtParent(XtParent(XtParent(w)))))); |
---|
2903 | p->printpanel.tmp_ps630_info.pitch = "10"; |
---|
2904 | } |
---|
2905 | |
---|
2906 | static void SetPitch12(w, callData) |
---|
2907 | Widget w; |
---|
2908 | XmAnyCallbackStruct *callData; |
---|
2909 | { |
---|
2910 | PrintPanelWidget p = (PrintPanelWidget) |
---|
2911 | XtParent(XtParent(XtParent(XtParent(XtParent(XtParent(w)))))); |
---|
2912 | p->printpanel.tmp_ps630_info.pitch = "12"; |
---|
2913 | } |
---|
2914 | |
---|
2915 | static void SetPitch15(w, callData) |
---|
2916 | Widget w; |
---|
2917 | XmAnyCallbackStruct *callData; |
---|
2918 | { |
---|
2919 | PrintPanelWidget p = (PrintPanelWidget) |
---|
2920 | XtParent(XtParent(XtParent(XtParent(XtParent(XtParent(w)))))); |
---|
2921 | p->printpanel.tmp_ps630_info.pitch = "15"; |
---|
2922 | } |
---|
2923 | |
---|
2924 | static void PickManyCallback(w, mycalldata, callData) |
---|
2925 | Widget w; |
---|
2926 | FeatureValueData *mycalldata; |
---|
2927 | XmToggleButtonCallbackStruct *callData; |
---|
2928 | { |
---|
2929 | PrintPanelWidget p = (PrintPanelWidget) mycalldata->head; |
---|
2930 | int i, j; |
---|
2931 | int ndex = mycalldata->which_option; |
---|
2932 | OptionData *op; |
---|
2933 | OptionData *noopt; |
---|
2934 | |
---|
2935 | op = |
---|
2936 | &p->printpanel.features.uis[mycalldata->which_key].options[mycalldata->which_option]; |
---|
2937 | |
---|
2938 | |
---|
2939 | if (callData->set) { |
---|
2940 | p->printpanel.feature_info[mycalldata->which_feature].tmpvalue[ndex] |
---|
2941 | = mycalldata->choice; |
---|
2942 | |
---|
2943 | for (i = 0; i < op->num_constraints; i++) { |
---|
2944 | if (op->constraints[i].no_key->type == BOOL) { |
---|
2945 | XtSetSensitive(op->constraints[i].no_key->imp, FALSE); |
---|
2946 | } |
---|
2947 | else { |
---|
2948 | if (op->constraints[i].no_option) { |
---|
2949 | noopt = op->constraints[i].no_option; |
---|
2950 | if (noopt->imp) { |
---|
2951 | XtSetSensitive(noopt->imp, FALSE); |
---|
2952 | XmToggleButtonSetState(noopt->imp, FALSE, TRUE); |
---|
2953 | } |
---|
2954 | } |
---|
2955 | else { |
---|
2956 | /* all options are constrained */ |
---|
2957 | for (j = 0; j < op->constraints[i].no_key->num_options; |
---|
2958 | j++) { |
---|
2959 | noopt = &op->constraints[i].no_key->options[j]; |
---|
2960 | if (noopt->imp) { |
---|
2961 | XtSetSensitive(noopt->imp, FALSE); |
---|
2962 | XmToggleButtonSetState(noopt->imp, FALSE, TRUE); |
---|
2963 | } |
---|
2964 | } |
---|
2965 | } |
---|
2966 | } |
---|
2967 | } |
---|
2968 | } |
---|
2969 | else { |
---|
2970 | p->printpanel.feature_info[mycalldata->which_feature].tmpvalue[ndex] |
---|
2971 | = NULL; |
---|
2972 | for (i = 0; i < op->num_constraints; i++) { |
---|
2973 | if (op->constraints[i].no_key->type == BOOL) { |
---|
2974 | if (op->constraints[i].no_key->imp) |
---|
2975 | XtSetSensitive(op->constraints[i].no_key->imp, TRUE); |
---|
2976 | } |
---|
2977 | else { |
---|
2978 | if (op->constraints[i].no_option) { |
---|
2979 | if (op->constraints[i].no_option->imp && |
---|
2980 | !op->constraints[i].no_option->gray) |
---|
2981 | XtSetSensitive(op->constraints[i].no_option->imp, |
---|
2982 | TRUE); |
---|
2983 | } |
---|
2984 | else { |
---|
2985 | /* all are constrained */ |
---|
2986 | for (j = 0; j < op->constraints[i].no_key->num_options; |
---|
2987 | j++) { |
---|
2988 | noopt = &op->constraints[i].no_key->options[j]; |
---|
2989 | if (noopt->imp && !noopt->gray) { |
---|
2990 | XtSetSensitive(noopt->imp, TRUE); |
---|
2991 | } |
---|
2992 | } |
---|
2993 | } |
---|
2994 | } |
---|
2995 | } |
---|
2996 | } |
---|
2997 | } |
---|
2998 | |
---|
2999 | static void SetFeatureValue(w, mycalldata, callData) |
---|
3000 | Widget w; |
---|
3001 | FeatureValueData *mycalldata; |
---|
3002 | XmToggleButtonCallbackStruct *callData; |
---|
3003 | { |
---|
3004 | int i, j; |
---|
3005 | PrintPanelWidget p = (PrintPanelWidget) mycalldata->head; |
---|
3006 | OptionData *op; |
---|
3007 | OptionData *noopt; |
---|
3008 | |
---|
3009 | op = |
---|
3010 | &p->printpanel.features.uis[mycalldata->which_key].options[mycalldata->which_option]; |
---|
3011 | |
---|
3012 | if (callData->set) { |
---|
3013 | p->printpanel.feature_info[mycalldata->which_feature].tmpvalue[0] = |
---|
3014 | mycalldata->choice; |
---|
3015 | |
---|
3016 | for (i = 0; i < op->num_constraints; i++) { |
---|
3017 | if (op->constraints[i].no_key->type == BOOL) { |
---|
3018 | if (op->constraints[i].no_key->imp) |
---|
3019 | XtSetSensitive(op->constraints[i].no_key->imp, FALSE); |
---|
3020 | } |
---|
3021 | else { |
---|
3022 | if (op->constraints[i].no_option) { |
---|
3023 | noopt = op->constraints[i].no_option; |
---|
3024 | if (noopt->imp) { |
---|
3025 | XtSetSensitive(noopt->imp, FALSE); |
---|
3026 | XmToggleButtonSetState(noopt->imp, FALSE, TRUE); |
---|
3027 | } |
---|
3028 | } |
---|
3029 | else { |
---|
3030 | /* all options are constrained */ |
---|
3031 | for (j = 0; j < op->constraints[i].no_key->num_options; |
---|
3032 | j++) { |
---|
3033 | noopt = &op->constraints[i].no_key->options[j]; |
---|
3034 | if (noopt->imp) { |
---|
3035 | XtSetSensitive(noopt->imp, FALSE); |
---|
3036 | XmToggleButtonSetState(noopt->imp, FALSE, TRUE); |
---|
3037 | } |
---|
3038 | } |
---|
3039 | } |
---|
3040 | } |
---|
3041 | } |
---|
3042 | } |
---|
3043 | else { |
---|
3044 | p->printpanel.feature_info[mycalldata->which_feature].tmpvalue[0] = |
---|
3045 | NULL; |
---|
3046 | for (i = 0; i < op->num_constraints; i++) { |
---|
3047 | if (op->constraints[i].no_key->type == BOOL) { |
---|
3048 | if (op->constraints[i].no_key->imp) |
---|
3049 | XtSetSensitive(op->constraints[i].no_key->imp, TRUE); |
---|
3050 | } |
---|
3051 | else { |
---|
3052 | if (op->constraints[i].no_option) { |
---|
3053 | if (op->constraints[i].no_option->imp && |
---|
3054 | !op->constraints[i].no_option->gray) |
---|
3055 | XtSetSensitive(op->constraints[i].no_option->imp, |
---|
3056 | TRUE); |
---|
3057 | } |
---|
3058 | else { |
---|
3059 | /* all are constrained */ |
---|
3060 | for (j = 0; j < op->constraints[i].no_key->num_options; |
---|
3061 | j++) { |
---|
3062 | noopt = &op->constraints[i].no_key->options[j]; |
---|
3063 | if (noopt->imp && !noopt->gray) { |
---|
3064 | XtSetSensitive(noopt->imp, TRUE); |
---|
3065 | } |
---|
3066 | } |
---|
3067 | } |
---|
3068 | } |
---|
3069 | } |
---|
3070 | } |
---|
3071 | } |
---|
3072 | |
---|
3073 | static void SetToggleFeature(w, mycalldata, call_data) |
---|
3074 | Widget w; |
---|
3075 | FeatureValueData *mycalldata; |
---|
3076 | XmToggleButtonCallbackStruct *call_data; |
---|
3077 | { |
---|
3078 | PrintPanelWidget p = (PrintPanelWidget) mycalldata->head; |
---|
3079 | int i, j; |
---|
3080 | UIData *uiptr; |
---|
3081 | OptionData *op; |
---|
3082 | OptionData *noopt; |
---|
3083 | |
---|
3084 | uiptr = &p->printpanel.features.uis[mycalldata->which_key]; |
---|
3085 | op = &uiptr->options[!mycalldata->which_option]; |
---|
3086 | |
---|
3087 | if (call_data->set) { |
---|
3088 | p->printpanel.feature_info[mycalldata->which_feature].tmpvalue[0] = |
---|
3089 | truevalue; |
---|
3090 | for (i = 0; i < op->num_constraints; i++) { |
---|
3091 | if (op->constraints[i].no_key->type == BOOL) { |
---|
3092 | XtSetSensitive(op->constraints[i].no_key->imp, FALSE); |
---|
3093 | } |
---|
3094 | else { |
---|
3095 | if (op->constraints[i].no_option) { |
---|
3096 | noopt = op->constraints[i].no_option; |
---|
3097 | if (noopt->imp) { |
---|
3098 | XtSetSensitive(noopt->imp, FALSE); |
---|
3099 | XmToggleButtonSetState(noopt->imp, FALSE, TRUE); |
---|
3100 | } |
---|
3101 | } |
---|
3102 | else { |
---|
3103 | /* all options are constrained */ |
---|
3104 | for (j = 0; j < op->constraints[i].no_key->num_options; |
---|
3105 | j++) { |
---|
3106 | noopt = &op->constraints[i].no_key->options[j]; |
---|
3107 | if (noopt->imp) { |
---|
3108 | XtSetSensitive(noopt->imp, FALSE); |
---|
3109 | XmToggleButtonSetState(noopt->imp, FALSE, TRUE); |
---|
3110 | } |
---|
3111 | } |
---|
3112 | } |
---|
3113 | } |
---|
3114 | } |
---|
3115 | } |
---|
3116 | else { |
---|
3117 | p->printpanel.feature_info[mycalldata->which_feature].tmpvalue[0] = |
---|
3118 | NULL; |
---|
3119 | for (i = 0; i < op->num_constraints; i++) { |
---|
3120 | if (op->constraints[i].no_key->type == BOOL) { |
---|
3121 | if (op->constraints[i].no_key->imp) |
---|
3122 | XtSetSensitive(op->constraints[i].no_key->imp, TRUE); |
---|
3123 | } |
---|
3124 | else { |
---|
3125 | if (op->constraints[i].no_option) { |
---|
3126 | if (op->constraints[i].no_option->imp && |
---|
3127 | !op->constraints[i].no_option->gray) |
---|
3128 | XtSetSensitive(op->constraints[i].no_option->imp, |
---|
3129 | TRUE); |
---|
3130 | } |
---|
3131 | else { |
---|
3132 | /* all are constrained */ |
---|
3133 | for (j = 0; j < op->constraints[i].no_key->num_options; |
---|
3134 | j++) { |
---|
3135 | noopt = &op->constraints[i].no_key->options[j]; |
---|
3136 | if (!noopt->gray && noopt->imp) { |
---|
3137 | XtSetSensitive(noopt->imp, TRUE); |
---|
3138 | } |
---|
3139 | } |
---|
3140 | } |
---|
3141 | } |
---|
3142 | } |
---|
3143 | } |
---|
3144 | } |
---|
3145 | |
---|
3146 | static void CreateFSB(p) |
---|
3147 | PrintPanelWidget p; |
---|
3148 | { |
---|
3149 | Widget tmp; |
---|
3150 | int i; |
---|
3151 | Arg args[10]; |
---|
3152 | |
---|
3153 | i = 0; |
---|
3154 | XtSetArg(args[i], XmNdialogTitle, CS("Input File Selection")); i++; |
---|
3155 | XtSetArg(args[i], XmNwidth, 325); i++; |
---|
3156 | XtSetArg(args[i], XmNresizePolicy, XmRESIZE_NONE); i++; |
---|
3157 | p->printpanel.input_file_selection_child = |
---|
3158 | XmCreateFileSelectionDialog(p->printpanel.panel_child, |
---|
3159 | "Input File", args, i); |
---|
3160 | |
---|
3161 | tmp = |
---|
3162 | XmFileSelectionBoxGetChild(p->printpanel.input_file_selection_child, |
---|
3163 | XmDIALOG_HELP_BUTTON); |
---|
3164 | XtUnmanageChild(tmp); |
---|
3165 | |
---|
3166 | p->printpanel.input_sb_data.head = (Widget) p; |
---|
3167 | p->printpanel.input_sb_data.which_sb = |
---|
3168 | p->printpanel.input_file_selection_child; |
---|
3169 | p->printpanel.input_sb_data.which_field = |
---|
3170 | p->printpanel.open_field_child; |
---|
3171 | p->printpanel.input_sb_data.name = &p->printpanel.input_file; |
---|
3172 | XtAddCallback(p->printpanel.input_file_selection_child, XmNokCallback, |
---|
3173 | FileOKCallback, &p->printpanel.input_sb_data); |
---|
3174 | XtAddCallback(p->printpanel.input_file_selection_child, |
---|
3175 | XmNcancelCallback, FileCancelCallback, |
---|
3176 | &p->printpanel.input_sb_data); |
---|
3177 | |
---|
3178 | i = 0; |
---|
3179 | XtSetArg(args[i], XmNdialogTitle, CS("Output File Selection")); i++; |
---|
3180 | XtSetArg(args[i], XmNwidth, 325); i++; |
---|
3181 | XtSetArg(args[i], XmNresizePolicy, XmRESIZE_NONE); i++; |
---|
3182 | p->printpanel.output_file_selection_child = |
---|
3183 | XmCreateFileSelectionDialog(p->printpanel.panel_child, |
---|
3184 | "Save to File", args, i); |
---|
3185 | tmp = |
---|
3186 | XmFileSelectionBoxGetChild(p->printpanel.output_file_selection_child, |
---|
3187 | XmDIALOG_HELP_BUTTON); |
---|
3188 | XtUnmanageChild(tmp); |
---|
3189 | |
---|
3190 | p->printpanel.output_sb_data.head = (Widget) p; |
---|
3191 | p->printpanel.output_sb_data.which_sb = |
---|
3192 | p->printpanel.output_file_selection_child; |
---|
3193 | p->printpanel.output_sb_data.which_field = p->printpanel.save_text_child; |
---|
3194 | p->printpanel.output_sb_data.name = &p->printpanel.output_file; |
---|
3195 | XtAddCallback(p->printpanel.output_file_selection_child, XmNokCallback, |
---|
3196 | FileOKCallback, &p->printpanel.output_sb_data); |
---|
3197 | XtAddCallback(p->printpanel.output_file_selection_child, |
---|
3198 | XmNcancelCallback, FileCancelCallback, |
---|
3199 | &p->printpanel.output_sb_data); |
---|
3200 | } |
---|
3201 | |
---|
3202 | static void CreateDraftPanel(p) |
---|
3203 | PrintPanelWidget p; |
---|
3204 | { |
---|
3205 | int i; |
---|
3206 | Arg args[10]; |
---|
3207 | |
---|
3208 | i = 0; |
---|
3209 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
3210 | XtSetArg(args[i], XmNdialogTitle, CS("Psdraft Options")); i++; |
---|
3211 | XtSetArg(args[i], XmNwidth, 360); i++; |
---|
3212 | XtSetArg(args[i], XmNheight, 280); i++; |
---|
3213 | p->printpanel.draft_form_child = |
---|
3214 | XmCreateFormDialog(p->printpanel.special_form_child, "draftForm", |
---|
3215 | args, i); |
---|
3216 | |
---|
3217 | CreateStandardButtons(p->printpanel.draft_form_child, |
---|
3218 | &p->printpanel.draft_ok_button_child, |
---|
3219 | &p->printpanel.draft_apply_button_child, |
---|
3220 | &p->printpanel.draft_reset_button_child, |
---|
3221 | &p->printpanel.draft_cancel_button_child, |
---|
3222 | &p->printpanel.draft_separator_child, |
---|
3223 | "draft"); |
---|
3224 | |
---|
3225 | XtAddCallback(p->printpanel.draft_ok_button_child, XmNactivateCallback, |
---|
3226 | DraftOKCallback, p); |
---|
3227 | XtAddCallback(p->printpanel.draft_apply_button_child, |
---|
3228 | XmNactivateCallback, DraftApplyCallback, p); |
---|
3229 | XtAddCallback(p->printpanel.draft_reset_button_child, |
---|
3230 | XmNactivateCallback, DraftResetCallback, p); |
---|
3231 | XtAddCallback(p->printpanel.draft_cancel_button_child, |
---|
3232 | XmNactivateCallback, SecondaryCancelCallback, |
---|
3233 | &p->printpanel.draft_form_child); |
---|
3234 | |
---|
3235 | p->printpanel.draft_angle_label_child = |
---|
3236 | XtVaCreateManagedWidget("draftAngleLabel", xmLabelWidgetClass, |
---|
3237 | p->printpanel.draft_form_child, |
---|
3238 | XmNleftAttachment, XmATTACH_FORM, |
---|
3239 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3240 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3241 | p->printpanel.draft_separator_child, |
---|
3242 | XmNbottomOffset, 10, |
---|
3243 | XmNlabelString, CS("Rotation (degrees)"), |
---|
3244 | NULL); |
---|
3245 | |
---|
3246 | p->printpanel.draft_angle_field_child = |
---|
3247 | XtVaCreateManagedWidget("draftAngleField", xmTextFieldWidgetClass, |
---|
3248 | p->printpanel.draft_form_child, |
---|
3249 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3250 | XmNleftWidget, |
---|
3251 | p->printpanel.draft_angle_label_child, |
---|
3252 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3253 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3254 | p->printpanel.draft_separator_child, |
---|
3255 | XmNbottomOffset, 10, |
---|
3256 | XmNwidth, 40, NULL); |
---|
3257 | |
---|
3258 | XtAddCallback(p->printpanel.draft_angle_field_child, |
---|
3259 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
3260 | &p->printpanel.tmp_psdraft_info.angle); |
---|
3261 | XmTextFieldSetString(p->printpanel.draft_angle_field_child, "90"); |
---|
3262 | |
---|
3263 | p->printpanel.draft_gray_label_child = |
---|
3264 | XtVaCreateManagedWidget("draftGrayLabel", xmLabelWidgetClass, |
---|
3265 | p->printpanel.draft_form_child, |
---|
3266 | XmNleftAttachment, XmATTACH_FORM, |
---|
3267 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3268 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3269 | p->printpanel.draft_angle_field_child, |
---|
3270 | XmNbottomOffset, 10, |
---|
3271 | XmNlabelString, CS("Gray level (0-1)"), |
---|
3272 | NULL); |
---|
3273 | |
---|
3274 | p->printpanel.draft_gray_field_child = |
---|
3275 | XtVaCreateManagedWidget("draftGrayField", xmTextFieldWidgetClass, |
---|
3276 | p->printpanel.draft_form_child, |
---|
3277 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3278 | XmNleftWidget, |
---|
3279 | p->printpanel.draft_gray_label_child, |
---|
3280 | XmNleftOffset, 23, XmNbottomAttachment, |
---|
3281 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3282 | p->printpanel.draft_angle_field_child, |
---|
3283 | XmNbottomOffset, 10, |
---|
3284 | XmNwidth, 40, NULL); |
---|
3285 | |
---|
3286 | XtAddCallback(p->printpanel.draft_gray_field_child, |
---|
3287 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
3288 | &p->printpanel.tmp_psdraft_info.gray); |
---|
3289 | XmTextFieldSetString(p->printpanel.draft_gray_field_child, "0"); |
---|
3290 | |
---|
3291 | p->printpanel.draft_outline_toggle_child = |
---|
3292 | XtVaCreateManagedWidget("draftOutlineToggle", |
---|
3293 | xmToggleButtonWidgetClass, |
---|
3294 | p->printpanel.draft_form_child, |
---|
3295 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3296 | XmNbottomWidget, |
---|
3297 | p->printpanel.draft_angle_field_child, |
---|
3298 | XmNbottomOffset, 10, XmNleftAttachment, |
---|
3299 | XmATTACH_WIDGET, XmNleftWidget, |
---|
3300 | p->printpanel.draft_gray_field_child, |
---|
3301 | XmNleftOffset, 10, |
---|
3302 | XmNlabelString, CS("Outlined letters"), |
---|
3303 | NULL); |
---|
3304 | XtAddCallback(p->printpanel.draft_outline_toggle_child, |
---|
3305 | XmNvalueChangedCallback, ToggleCallback, |
---|
3306 | &p->printpanel.tmp_psdraft_info.outline); |
---|
3307 | |
---|
3308 | p->printpanel.draft_x_label_child = |
---|
3309 | XtVaCreateManagedWidget("draftXLabel", xmLabelWidgetClass, |
---|
3310 | p->printpanel.draft_form_child, |
---|
3311 | XmNleftAttachment, XmATTACH_FORM, |
---|
3312 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3313 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3314 | p->printpanel.draft_gray_field_child, |
---|
3315 | XmNbottomOffset, 10, |
---|
3316 | XmNlabelString, CS("X (pts)"), |
---|
3317 | NULL); |
---|
3318 | |
---|
3319 | p->printpanel.draft_x_field_child = |
---|
3320 | XtVaCreateManagedWidget("draftXField", xmTextFieldWidgetClass, |
---|
3321 | p->printpanel.draft_form_child, |
---|
3322 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3323 | XmNleftWidget, |
---|
3324 | p->printpanel.draft_x_label_child, |
---|
3325 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3326 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3327 | p->printpanel.draft_gray_field_child, |
---|
3328 | XmNbottomOffset, 10, XmNwidth, 50, NULL); |
---|
3329 | |
---|
3330 | XtAddCallback(p->printpanel.draft_x_field_child, |
---|
3331 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
3332 | &p->printpanel.tmp_psdraft_info.xpos); |
---|
3333 | XmTextFieldSetString(p->printpanel.draft_x_field_child, "575"); |
---|
3334 | |
---|
3335 | p->printpanel.draft_y_label_child = |
---|
3336 | XtVaCreateManagedWidget("draftYLabel", xmLabelWidgetClass, |
---|
3337 | p->printpanel.draft_form_child, |
---|
3338 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3339 | XmNleftWidget, |
---|
3340 | p->printpanel.draft_x_field_child, |
---|
3341 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3342 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3343 | p->printpanel.draft_gray_field_child, |
---|
3344 | XmNbottomOffset, 10, |
---|
3345 | XmNlabelString, CS("Y (pts)"), |
---|
3346 | NULL); |
---|
3347 | |
---|
3348 | p->printpanel.draft_y_field_child = |
---|
3349 | XtVaCreateManagedWidget("draftYField", xmTextFieldWidgetClass, |
---|
3350 | p->printpanel.draft_form_child, |
---|
3351 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3352 | XmNleftWidget, |
---|
3353 | p->printpanel.draft_y_label_child, |
---|
3354 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3355 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3356 | p->printpanel.draft_gray_field_child, |
---|
3357 | XmNbottomOffset, 10, XmNwidth, 50, NULL); |
---|
3358 | |
---|
3359 | XtAddCallback(p->printpanel.draft_y_field_child, |
---|
3360 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
3361 | &p->printpanel.tmp_psdraft_info.ypos); |
---|
3362 | XmTextFieldSetString(p->printpanel.draft_y_field_child, "300"); |
---|
3363 | |
---|
3364 | p->printpanel.draft_font_label_child = |
---|
3365 | XtVaCreateManagedWidget("draftFontLabel", xmLabelWidgetClass, |
---|
3366 | p->printpanel.draft_form_child, |
---|
3367 | XmNleftAttachment, XmATTACH_FORM, |
---|
3368 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3369 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3370 | p->printpanel.draft_x_field_child, |
---|
3371 | XmNbottomOffset, 10, |
---|
3372 | XmNlabelString, CS("Font"), |
---|
3373 | NULL); |
---|
3374 | p->printpanel.draft_font_field_child = |
---|
3375 | XtVaCreateManagedWidget("draftFontField", xmTextFieldWidgetClass, |
---|
3376 | p->printpanel.draft_form_child, |
---|
3377 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3378 | XmNleftWidget, |
---|
3379 | p->printpanel.draft_font_label_child, |
---|
3380 | XmNleftOffset, 20, XmNbottomAttachment, |
---|
3381 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3382 | p->printpanel.draft_x_field_child, |
---|
3383 | XmNbottomOffset, 10, NULL); |
---|
3384 | |
---|
3385 | XtAddCallback(p->printpanel.draft_font_field_child, |
---|
3386 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
3387 | &p->printpanel.tmp_psdraft_info.font); |
---|
3388 | XmTextFieldSetString(p->printpanel.draft_font_field_child, |
---|
3389 | "Times-Roman"); |
---|
3390 | |
---|
3391 | p->printpanel.draft_size_label_child = |
---|
3392 | XtVaCreateManagedWidget("draftSizeLabel", xmLabelWidgetClass, |
---|
3393 | p->printpanel.draft_form_child, |
---|
3394 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3395 | XmNleftWidget, |
---|
3396 | p->printpanel.draft_font_field_child, |
---|
3397 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3398 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3399 | p->printpanel.draft_x_field_child, |
---|
3400 | XmNbottomOffset, 10, |
---|
3401 | XmNlabelString, CS("Size"), |
---|
3402 | NULL); |
---|
3403 | |
---|
3404 | p->printpanel.draft_size_field_child = |
---|
3405 | XtVaCreateManagedWidget("draftSizeField", xmTextFieldWidgetClass, |
---|
3406 | p->printpanel.draft_form_child, |
---|
3407 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3408 | XmNleftWidget, |
---|
3409 | p->printpanel.draft_size_label_child, |
---|
3410 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3411 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3412 | p->printpanel.draft_x_field_child, |
---|
3413 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
3414 | |
---|
3415 | XtAddCallback(p->printpanel.draft_size_field_child, |
---|
3416 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
3417 | &p->printpanel.tmp_psdraft_info.size); |
---|
3418 | XmTextFieldSetString(p->printpanel.draft_size_field_child, "30"); |
---|
3419 | |
---|
3420 | p->printpanel.draft_string_label_child = |
---|
3421 | XtVaCreateManagedWidget("draftStringLabel", xmLabelWidgetClass, |
---|
3422 | p->printpanel.draft_form_child, |
---|
3423 | XmNleftAttachment, XmATTACH_FORM, |
---|
3424 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3425 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3426 | p->printpanel.draft_font_field_child, |
---|
3427 | XmNbottomOffset, 10, |
---|
3428 | XmNlabelString, CS("String"), |
---|
3429 | NULL); |
---|
3430 | |
---|
3431 | p->printpanel.draft_string_field_child = |
---|
3432 | XtVaCreateManagedWidget("draftStringField", xmTextFieldWidgetClass, |
---|
3433 | p->printpanel.draft_form_child, |
---|
3434 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3435 | XmNleftWidget, |
---|
3436 | p->printpanel.draft_string_label_child, |
---|
3437 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
3438 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3439 | p->printpanel.draft_font_field_child, |
---|
3440 | XmNbottomOffset, 10, |
---|
3441 | XmNrightAttachment, XmATTACH_FORM, |
---|
3442 | XmNrightOffset, 20, NULL); |
---|
3443 | |
---|
3444 | XtAddCallback(p->printpanel.draft_string_field_child, |
---|
3445 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
3446 | &p->printpanel.tmp_psdraft_info.draftstring); |
---|
3447 | XmTextFieldSetString(p->printpanel.draft_string_field_child, "DRAFT"); |
---|
3448 | /* |
---|
3449 | p->printpanel.draft_label_child = |
---|
3450 | XtVaCreateManagedWidget("draftLabel", xmLabelWidgetClass, |
---|
3451 | p->printpanel.draft_form_child, |
---|
3452 | XmNleftAttachment, XmATTACH_POSITION, |
---|
3453 | XmNleftPosition, 35, XmNtopAttachment, |
---|
3454 | XmATTACH_FORM, XmNtopOffset, 20, |
---|
3455 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3456 | XmNbottomWidget, |
---|
3457 | p->printpanel.draft_string_field_child, |
---|
3458 | XmNbottomOffset, 20, XmNlabelString, |
---|
3459 | CS("Psdraft Options"), NULL); |
---|
3460 | */ |
---|
3461 | } |
---|
3462 | |
---|
3463 | |
---|
3464 | |
---|
3465 | |
---|
3466 | static void CreateSpecialFeatures(p) |
---|
3467 | PrintPanelWidget p; |
---|
3468 | { |
---|
3469 | int i; |
---|
3470 | Arg args[10]; |
---|
3471 | |
---|
3472 | i = 0; |
---|
3473 | XtSetArg(args[i], XmNheight, 240); i++; |
---|
3474 | XtSetArg(args[i], XmNwidth, 380); i++; |
---|
3475 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
3476 | XtSetArg(args[i], XmNdialogTitle, CS("Special Features")); i++; |
---|
3477 | p->printpanel.special_form_child = |
---|
3478 | XmCreateFormDialog(p->printpanel.panel_child, |
---|
3479 | "specialForm", args, i); |
---|
3480 | |
---|
3481 | p->printpanel.special_call_data.which_widget = |
---|
3482 | p->printpanel.special_form_child; |
---|
3483 | p->printpanel.special_call_data.which_filter = NONE; |
---|
3484 | |
---|
3485 | CreateStandardButtons(p->printpanel.special_form_child, |
---|
3486 | &p->printpanel.special_ok_button_child, |
---|
3487 | &p->printpanel.special_apply_button_child, |
---|
3488 | &p->printpanel.special_reset_button_child, |
---|
3489 | &p->printpanel.special_cancel_button_child, |
---|
3490 | &p->printpanel.special_separator_child, |
---|
3491 | "special"); |
---|
3492 | |
---|
3493 | XtAddCallback(p->printpanel.special_ok_button_child, XmNactivateCallback, |
---|
3494 | SecondaryOKCallback, &p->printpanel.special_call_data); |
---|
3495 | XtAddCallback(p->printpanel.special_apply_button_child, |
---|
3496 | XmNactivateCallback, SecondaryApplyCallback, |
---|
3497 | &p->printpanel.special_call_data); |
---|
3498 | XtAddCallback(p->printpanel.special_reset_button_child, |
---|
3499 | XmNactivateCallback, SecondaryResetCallback, p); |
---|
3500 | XtAddCallback(p->printpanel.special_cancel_button_child, |
---|
3501 | XmNactivateCallback, SecondaryCancelCallback, |
---|
3502 | &p->printpanel.special_form_child); |
---|
3503 | |
---|
3504 | p->printpanel.special_gaudy_toggle_child = |
---|
3505 | XtVaCreateManagedWidget("specialGaudyToggle", |
---|
3506 | xmToggleButtonWidgetClass, |
---|
3507 | p->printpanel.special_form_child, |
---|
3508 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3509 | XmNbottomWidget, |
---|
3510 | p->printpanel.special_separator_child, |
---|
3511 | XmNbottomOffset, 10, |
---|
3512 | XmNleftAttachment, XmATTACH_FORM, |
---|
3513 | XmNleftOffset, 10, |
---|
3514 | XmNlabelString, CS("Gaudy"), NULL); |
---|
3515 | |
---|
3516 | XtAddCallback(p->printpanel.special_gaudy_toggle_child, |
---|
3517 | XmNvalueChangedCallback, ToggleCallback, |
---|
3518 | &(p->printpanel.tmp_nup_info.gaudy)); |
---|
3519 | XtSetSensitive(p->printpanel.special_gaudy_toggle_child, FALSE); |
---|
3520 | |
---|
3521 | p->printpanel.special_rotate_toggle_child = |
---|
3522 | XtVaCreateManagedWidget("specialRotateToggle", |
---|
3523 | xmToggleButtonWidgetClass, |
---|
3524 | p->printpanel.special_form_child, |
---|
3525 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3526 | XmNbottomWidget, |
---|
3527 | p->printpanel.special_separator_child, |
---|
3528 | XmNbottomOffset, 10, |
---|
3529 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3530 | XmNleftWidget, |
---|
3531 | p->printpanel.special_gaudy_toggle_child, |
---|
3532 | XmNlabelString, CS("Rotated"), NULL); |
---|
3533 | |
---|
3534 | XtAddCallback(p->printpanel.special_rotate_toggle_child, |
---|
3535 | XmNvalueChangedCallback, ToggleCallback, |
---|
3536 | &(p->printpanel.tmp_nup_info.rotated)); |
---|
3537 | XtSetSensitive(p->printpanel.special_rotate_toggle_child, FALSE); |
---|
3538 | |
---|
3539 | p->printpanel.special_nup_column_label_child = |
---|
3540 | XtVaCreateManagedWidget("columnLabel", |
---|
3541 | xmLabelWidgetClass, |
---|
3542 | p->printpanel.special_form_child, |
---|
3543 | XmNleftAttachment, XmATTACH_FORM, |
---|
3544 | XmNleftOffset, 10, |
---|
3545 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3546 | XmNbottomWidget, |
---|
3547 | p->printpanel.special_gaudy_toggle_child, |
---|
3548 | XmNbottomOffset, 25, |
---|
3549 | XmNlabelString, CS("Columns"), NULL); |
---|
3550 | |
---|
3551 | XtSetSensitive(p->printpanel.special_nup_column_label_child, FALSE); |
---|
3552 | |
---|
3553 | p->printpanel.special_nup_column_field_child = |
---|
3554 | XtVaCreateManagedWidget("columnField", |
---|
3555 | xmTextFieldWidgetClass, |
---|
3556 | p->printpanel.special_form_child, |
---|
3557 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3558 | XmNleftWidget, |
---|
3559 | p->printpanel.special_nup_column_label_child, |
---|
3560 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3561 | XmNbottomWidget, |
---|
3562 | p->printpanel.special_gaudy_toggle_child, |
---|
3563 | XmNbottomOffset, 20, XmNwidth, 40, NULL); |
---|
3564 | |
---|
3565 | XmTextFieldSetString(p->printpanel.special_nup_column_field_child, "2"); |
---|
3566 | XtAddCallback(p->printpanel.special_nup_column_field_child, |
---|
3567 | XmNvalueChangedCallback, IntTextFieldChange, |
---|
3568 | &(p->printpanel.tmp_nup_info.columns)); |
---|
3569 | XtSetSensitive(p->printpanel.special_nup_column_field_child, FALSE); |
---|
3570 | |
---|
3571 | p->printpanel.special_nup_row_label_child = |
---|
3572 | XtVaCreateManagedWidget("rowLabel", |
---|
3573 | xmLabelWidgetClass, |
---|
3574 | p->printpanel.special_form_child, |
---|
3575 | XmNleftAttachment, XmATTACH_FORM, |
---|
3576 | XmNleftOffset, 10, |
---|
3577 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3578 | XmNbottomWidget, |
---|
3579 | p->printpanel.special_nup_column_field_child, |
---|
3580 | XmNbottomOffset, 25, XmNlabelString, |
---|
3581 | CS("Rows"), NULL); |
---|
3582 | |
---|
3583 | XtSetSensitive(p->printpanel.special_nup_row_label_child, FALSE); |
---|
3584 | |
---|
3585 | p->printpanel.special_nup_row_field_child = |
---|
3586 | XtVaCreateManagedWidget("rowField", |
---|
3587 | xmTextFieldWidgetClass, |
---|
3588 | p->printpanel.special_form_child, |
---|
3589 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3590 | XmNleftWidget, |
---|
3591 | p->printpanel.special_nup_row_label_child, |
---|
3592 | XmNleftOffset, 15, |
---|
3593 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3594 | XmNbottomWidget, |
---|
3595 | p->printpanel.special_nup_column_field_child, |
---|
3596 | XmNbottomOffset, 20, XmNwidth, 40, NULL); |
---|
3597 | |
---|
3598 | XmTextFieldSetString(p->printpanel.special_nup_row_field_child, "2"); |
---|
3599 | XtAddCallback(p->printpanel.special_nup_row_field_child, |
---|
3600 | XmNvalueChangedCallback, IntTextFieldChange, |
---|
3601 | &(p->printpanel.tmp_nup_info.rows)); |
---|
3602 | XtSetSensitive(p->printpanel.special_nup_row_field_child, FALSE); |
---|
3603 | |
---|
3604 | p->printpanel.special_draft_toggle_child = |
---|
3605 | XtVaCreateManagedWidget("draftToggle", xmToggleButtonWidgetClass, |
---|
3606 | p->printpanel.special_form_child, |
---|
3607 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3608 | XmNbottomWidget, |
---|
3609 | p->printpanel.special_separator_child, |
---|
3610 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3611 | XmNleftWidget, |
---|
3612 | p->printpanel.special_rotate_toggle_child, |
---|
3613 | XmNleftOffset, 40, XmNbottomOffset, 10, |
---|
3614 | XmNlabelString, CS("Add draft string"), |
---|
3615 | NULL); |
---|
3616 | XtAddCallback(p->printpanel.special_draft_toggle_child, |
---|
3617 | XmNvalueChangedCallback, DraftToggleCallback, p); |
---|
3618 | |
---|
3619 | p->printpanel.special_draft_button_child = |
---|
3620 | XtVaCreateManagedWidget("draftButton", xmPushButtonWidgetClass, |
---|
3621 | p->printpanel.special_form_child, |
---|
3622 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3623 | XmNbottomWidget, |
---|
3624 | p->printpanel.special_separator_child, |
---|
3625 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3626 | XmNleftWidget, |
---|
3627 | p->printpanel.special_draft_toggle_child, |
---|
3628 | XmNleftOffset, 10, XmNbottomOffset, 10, |
---|
3629 | XmNheight, 30, XmNwidth, 40, |
---|
3630 | XmNlabelString, CS("..."), |
---|
3631 | NULL); |
---|
3632 | |
---|
3633 | XtAddCallback(p->printpanel.special_draft_button_child, |
---|
3634 | XmNactivateCallback, SecondaryCallback, |
---|
3635 | &p->printpanel.draft_form_child); |
---|
3636 | XtSetSensitive(p->printpanel.special_draft_button_child, FALSE); |
---|
3637 | |
---|
3638 | p->printpanel.special_showpage_toggle_child = |
---|
3639 | XtVaCreateManagedWidget("showpageToggle", |
---|
3640 | xmToggleButtonWidgetClass, |
---|
3641 | p->printpanel.special_form_child, |
---|
3642 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3643 | XmNleftWidget, |
---|
3644 | p->printpanel.special_rotate_toggle_child, |
---|
3645 | XmNleftOffset, 40, XmNbottomAttachment, |
---|
3646 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3647 | p->printpanel.special_draft_button_child, |
---|
3648 | XmNbottomOffset, 10, XmNlabelString, |
---|
3649 | CS("Add showpage"), NULL); |
---|
3650 | |
---|
3651 | XtAddCallback(p->printpanel.special_showpage_toggle_child, |
---|
3652 | XmNvalueChangedCallback, ToggleCallback, |
---|
3653 | &p->printpanel.tmp_pslpr_info.showpage); |
---|
3654 | |
---|
3655 | p->printpanel.special_squeeze_toggle_child = |
---|
3656 | XtVaCreateManagedWidget("squeezeToggle", |
---|
3657 | xmToggleButtonWidgetClass, |
---|
3658 | p->printpanel.special_form_child, |
---|
3659 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3660 | XmNleftWidget, |
---|
3661 | p->printpanel.special_rotate_toggle_child, |
---|
3662 | XmNleftOffset, 40, XmNbottomAttachment, |
---|
3663 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3664 | p->printpanel.special_showpage_toggle_child, |
---|
3665 | XmNbottomOffset, 10, XmNlabelString, |
---|
3666 | CS("ShrinkToFit"), NULL); |
---|
3667 | |
---|
3668 | XtAddCallback(p->printpanel.special_squeeze_toggle_child, |
---|
3669 | XmNvalueChangedCallback, ToggleCallback, |
---|
3670 | &p->printpanel.tmp_pslpr_info.squeeze); |
---|
3671 | |
---|
3672 | XtSetSensitive(p->printpanel.special_squeeze_toggle_child, FALSE); |
---|
3673 | |
---|
3674 | p->printpanel.special_overtranslate_toggle_child = |
---|
3675 | XtVaCreateManagedWidget("overtranslateToggle", |
---|
3676 | xmToggleButtonWidgetClass, |
---|
3677 | p->printpanel.special_form_child, |
---|
3678 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3679 | XmNleftWidget, |
---|
3680 | p->printpanel.special_rotate_toggle_child, |
---|
3681 | XmNleftOffset, 40, XmNbottomAttachment, |
---|
3682 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3683 | p->printpanel.special_squeeze_toggle_child, |
---|
3684 | XmNbottomOffset, 10, XmNlabelString, |
---|
3685 | CS("Overtranslate"), NULL); |
---|
3686 | |
---|
3687 | XtAddCallback(p->printpanel.special_overtranslate_toggle_child, |
---|
3688 | XmNvalueChangedCallback, ToggleCallback, |
---|
3689 | &p->printpanel.tmp_pslpr_info.overtranslate); |
---|
3690 | |
---|
3691 | XtSetSensitive(p->printpanel.special_overtranslate_toggle_child, FALSE); |
---|
3692 | |
---|
3693 | p->printpanel.special_landscape_toggle_child = |
---|
3694 | XtVaCreateManagedWidget("landscapeToggle", |
---|
3695 | xmToggleButtonWidgetClass, |
---|
3696 | p->printpanel.special_form_child, |
---|
3697 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3698 | XmNleftWidget, |
---|
3699 | p->printpanel.special_rotate_toggle_child, |
---|
3700 | XmNleftOffset, 40, XmNbottomAttachment, |
---|
3701 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
3702 | p->printpanel.special_overtranslate_toggle_child, |
---|
3703 | XmNbottomOffset, 10, XmNlabelString, |
---|
3704 | CS("Landscape"), NULL); |
---|
3705 | |
---|
3706 | XtAddCallback(p->printpanel.special_landscape_toggle_child, |
---|
3707 | XmNvalueChangedCallback, LandscapeToggleCallback, |
---|
3708 | &p->printpanel.tmp_pslpr_info.landscape); |
---|
3709 | |
---|
3710 | p->printpanel.special_nup_toggle_child = |
---|
3711 | XtVaCreateManagedWidget("n-upToggle", |
---|
3712 | xmToggleButtonWidgetClass, |
---|
3713 | p->printpanel.special_form_child, |
---|
3714 | XmNleftAttachment, XmATTACH_FORM, |
---|
3715 | XmNleftOffset, 10, |
---|
3716 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3717 | XmNbottomWidget, |
---|
3718 | p->printpanel.special_nup_row_label_child, |
---|
3719 | XmNbottomOffset, 30, |
---|
3720 | XmNlabelString, CS("N-up Printing"), NULL); |
---|
3721 | |
---|
3722 | XtAddCallback(p->printpanel.special_nup_toggle_child, |
---|
3723 | XmNvalueChangedCallback, NupToggleCallback, p); |
---|
3724 | } |
---|
3725 | |
---|
3726 | static void CreateFeaturePanel(p) |
---|
3727 | PrintPanelWidget p; |
---|
3728 | { |
---|
3729 | int i; |
---|
3730 | Arg args[10]; |
---|
3731 | |
---|
3732 | i = 0; |
---|
3733 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
3734 | XtSetArg(args[i], XmNdialogTitle, CS("Printer Features")); i++; |
---|
3735 | p->printpanel.feature_panel_child = |
---|
3736 | XmCreateFormDialog(p->printpanel.panel_child, "featurePanel", args, |
---|
3737 | i); |
---|
3738 | |
---|
3739 | p->printpanel.feature_ok_button_child = |
---|
3740 | XtVaCreateManagedWidget("featureOK", |
---|
3741 | xmPushButtonWidgetClass, |
---|
3742 | p->printpanel.feature_panel_child, |
---|
3743 | XmNleftAttachment, XmATTACH_FORM, |
---|
3744 | XmNbottomAttachment, XmATTACH_FORM, |
---|
3745 | XmNlabelString, CS("OK"), XmNwidth, 60, |
---|
3746 | XmNheight, 30, XmNbottomOffset, 10, |
---|
3747 | XmNleftOffset, 10, NULL); |
---|
3748 | |
---|
3749 | p->printpanel.feature_apply_button_child = |
---|
3750 | XtVaCreateManagedWidget("featureApply", |
---|
3751 | xmPushButtonWidgetClass, |
---|
3752 | p->printpanel.feature_panel_child, |
---|
3753 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3754 | XmNleftWidget, |
---|
3755 | p->printpanel.feature_ok_button_child, |
---|
3756 | XmNbottomAttachment, XmATTACH_FORM, |
---|
3757 | XmNlabelString, CS("Apply"), XmNwidth, 60, |
---|
3758 | XmNheight, 30, XmNbottomOffset, 10, |
---|
3759 | XmNleftOffset, 10, NULL); |
---|
3760 | |
---|
3761 | p->printpanel.feature_cancel_button_child = |
---|
3762 | XtVaCreateManagedWidget("featureCancel", |
---|
3763 | xmPushButtonWidgetClass, |
---|
3764 | p->printpanel.feature_panel_child, |
---|
3765 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
3766 | XmNleftWidget, |
---|
3767 | p->printpanel.feature_apply_button_child, |
---|
3768 | XmNbottomAttachment, XmATTACH_FORM, |
---|
3769 | XmNlabelString, CS("Cancel"), XmNwidth, 60, |
---|
3770 | XmNheight, 30, XmNbottomOffset, 10, |
---|
3771 | XmNleftOffset, 10, NULL); |
---|
3772 | |
---|
3773 | |
---|
3774 | XtAddCallback(p->printpanel.feature_cancel_button_child, |
---|
3775 | XmNactivateCallback, SecondaryCancelCallback, |
---|
3776 | &p->printpanel.feature_panel_child); |
---|
3777 | XtAddCallback(p->printpanel.feature_ok_button_child, XmNactivateCallback, |
---|
3778 | SecondaryOKCallback, &p->printpanel.feature_callback_data); |
---|
3779 | XtAddCallback(p->printpanel.feature_apply_button_child, |
---|
3780 | XmNactivateCallback, SecondaryApplyCallback, |
---|
3781 | &p->printpanel.feature_callback_data); |
---|
3782 | |
---|
3783 | p->printpanel.feature_separator_child = |
---|
3784 | XtVaCreateManagedWidget("featureSeparator", |
---|
3785 | xmSeparatorWidgetClass, |
---|
3786 | p->printpanel.feature_panel_child, |
---|
3787 | XmNleftAttachment, XmATTACH_FORM, |
---|
3788 | XmNrightAttachment, XmATTACH_FORM, |
---|
3789 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
3790 | XmNbottomWidget, |
---|
3791 | p->printpanel.feature_ok_button_child, |
---|
3792 | XmNbottomOffset, 10, NULL); |
---|
3793 | |
---|
3794 | i = 0; |
---|
3795 | XtSetArg(args[i], XmNscrollingPolicy, XmAUTOMATIC); i++; |
---|
3796 | XtSetArg(args[i], XmNheight, 450); i++; |
---|
3797 | XtSetArg(args[i], XmNwidth, 250); i++; |
---|
3798 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
3799 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
3800 | XtSetArg(args[i], XmNbottomWidget, |
---|
3801 | p->printpanel.feature_separator_child); i++; |
---|
3802 | p->printpanel.feature_window_child = |
---|
3803 | XmCreateScrolledWindow(p->printpanel.feature_panel_child, |
---|
3804 | "featureWindow", args, i); |
---|
3805 | XtManageChild(p->printpanel.feature_window_child); |
---|
3806 | i = 0; |
---|
3807 | XtSetArg(args[i], XmNorientation, XmVERTICAL); i++; |
---|
3808 | XtSetArg(args[i], XmNpacking, XmPACK_TIGHT); i++; |
---|
3809 | p->printpanel.feature_form_child = |
---|
3810 | XmCreateForm(p->printpanel.feature_window_child, |
---|
3811 | "featureForm", args, i); |
---|
3812 | XtManageChild(p->printpanel.feature_form_child); |
---|
3813 | |
---|
3814 | i = 0; |
---|
3815 | XtSetArg(args[i], XmNworkWindow, |
---|
3816 | p->printpanel.feature_form_child); i++; |
---|
3817 | XtSetValues(p->printpanel.feature_window_child, args, i); |
---|
3818 | |
---|
3819 | p->printpanel.feature_callback_data.which_widget = |
---|
3820 | p->printpanel.feature_panel_child; |
---|
3821 | p->printpanel.feature_callback_data.which_filter = NONE; |
---|
3822 | |
---|
3823 | } |
---|
3824 | |
---|
3825 | static void CleanupPhoneEntry(p) |
---|
3826 | PrintPanelWidget p; |
---|
3827 | { |
---|
3828 | int i; |
---|
3829 | |
---|
3830 | for (i = 0; i < p->printpanel.fax_phone_num_children; i++) { |
---|
3831 | XtDestroyWidget(p->printpanel.fax_phone_children[i]); |
---|
3832 | p->printpanel.fax_phone_children[i] = NULL; |
---|
3833 | } |
---|
3834 | p->printpanel.fax_phone_num_children = 0; |
---|
3835 | } |
---|
3836 | |
---|
3837 | |
---|
3838 | static void CleanupOldFeatures(p) |
---|
3839 | PrintPanelWidget p; |
---|
3840 | { |
---|
3841 | int i; |
---|
3842 | int j; |
---|
3843 | |
---|
3844 | for (i = 0; i < p->printpanel.features.num_uis; i++) { |
---|
3845 | p->printpanel.features.uis[i].imp = 0; |
---|
3846 | for (j = 0; j < p->printpanel.features.uis[i].num_options; j++) { |
---|
3847 | p->printpanel.features.uis[i].options[j].imp = 0; |
---|
3848 | } |
---|
3849 | } |
---|
3850 | for (i = p->printpanel.num_feature_children - 1; i >= 0; i--) { |
---|
3851 | XtUnmanageChild(p->printpanel.feature_children[i]); |
---|
3852 | XtDestroyWidget(p->printpanel.feature_children[i]); |
---|
3853 | p->printpanel.feature_children[i] = NULL; |
---|
3854 | } |
---|
3855 | p->printpanel.num_feature_children = 0; |
---|
3856 | #if XmVersion <= 1001 |
---|
3857 | XtUnrealizeWidget(p->printpanel.feature_panel_child); |
---|
3858 | #endif |
---|
3859 | } |
---|
3860 | |
---|
3861 | struct FaxPhoneEntry { |
---|
3862 | char option[200]; |
---|
3863 | char value[200]; |
---|
3864 | }; |
---|
3865 | |
---|
3866 | static void BuildPhoneEntry(p) |
---|
3867 | PrintPanelWidget p; |
---|
3868 | { |
---|
3869 | struct FaxPhoneEntry entrylist[10]; |
---|
3870 | int nelist = 0; |
---|
3871 | int maxlist = 10; |
---|
3872 | int k; |
---|
3873 | int j; |
---|
3874 | char buf[1024]; |
---|
3875 | int i; |
---|
3876 | Arg args[20]; |
---|
3877 | int prev; |
---|
3878 | char *q; |
---|
3879 | |
---|
3880 | |
---|
3881 | if (!FindPhoneEntry(p->printpanel.tmp_fax_data.key, entrylist, &nelist, |
---|
3882 | &maxlist, p->printpanel.faxdb)) { |
---|
3883 | sprintf(buf, "Couldn't find entry for key %s", |
---|
3884 | p->printpanel.tmp_fax_data.key); |
---|
3885 | DisplayError(p->printpanel.message_dialog_child, buf); |
---|
3886 | return; |
---|
3887 | } |
---|
3888 | |
---|
3889 | prev = -1; |
---|
3890 | |
---|
3891 | i = 0; |
---|
3892 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
3893 | XtSetArg(args[i], XmNdialogTitle, CS("Fax Phonebook Entry")); i++; |
---|
3894 | p->printpanel.fax_phone_children[0] = |
---|
3895 | XmCreateFormDialog(p->printpanel.fax_phone_panel_child, |
---|
3896 | "entryPanel", args, i); |
---|
3897 | |
---|
3898 | p->printpanel.fax_phone_children[1] = |
---|
3899 | XtVaCreateManagedWidget("entryOK", xmPushButtonWidgetClass, |
---|
3900 | p->printpanel.fax_phone_children[0], |
---|
3901 | XmNleftAttachment, XmATTACH_POSITION, |
---|
3902 | XmNleftPosition, 40, XmNbottomAttachment, |
---|
3903 | XmATTACH_FORM, |
---|
3904 | XmNlabelString, CS("OK"), NULL); |
---|
3905 | |
---|
3906 | XtAddCallback(p->printpanel.fax_phone_children[1], XmNactivateCallback, |
---|
3907 | SecondaryCancelCallback, |
---|
3908 | &p->printpanel.fax_phone_children[0]); |
---|
3909 | |
---|
3910 | j = 2; |
---|
3911 | prev = 1; |
---|
3912 | |
---|
3913 | for (k = nelist - 1; k > -1; k--) { |
---|
3914 | i = 0; |
---|
3915 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
3916 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
3917 | XtSetArg(args[i], XmNbottomWidget, |
---|
3918 | p->printpanel.fax_phone_children[prev]); |
---|
3919 | i++; |
---|
3920 | sprintf(buf, "%s: ", entrylist[k].option); |
---|
3921 | XtSetArg(args[i], XmNlabelString, CS(buf)); i++; |
---|
3922 | sprintf(buf, "faxPhone%dLabel", j); |
---|
3923 | p->printpanel.fax_phone_children[j++] = |
---|
3924 | XtCreateManagedWidget(buf, xmLabelWidgetClass, |
---|
3925 | p->printpanel.fax_phone_children[0], |
---|
3926 | args, i); |
---|
3927 | i = 0; |
---|
3928 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++; |
---|
3929 | XtSetArg(args[i], XmNleftWidget, |
---|
3930 | p->printpanel.fax_phone_children[j-1]); i++; |
---|
3931 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
3932 | XtSetArg(args[i], XmNbottomWidget, |
---|
3933 | p->printpanel.fax_phone_children[prev]); |
---|
3934 | i++; |
---|
3935 | XtSetArg(args[i], XmNlabelString, CS(entrylist[k].value)); i++; |
---|
3936 | sprintf(buf, "faxPhone%dLabel", j); |
---|
3937 | prev = j; |
---|
3938 | p->printpanel.fax_phone_children[j++] = |
---|
3939 | XtCreateManagedWidget(buf, xmLabelWidgetClass, |
---|
3940 | p->printpanel.fax_phone_children[0], |
---|
3941 | args, i); |
---|
3942 | |
---|
3943 | if (strcmp(entrylist[k].option, "RecipientName") == 0) |
---|
3944 | strcpy(p->printpanel.tmp_fax_data.name, entrylist[k].value); |
---|
3945 | if (strcmp(entrylist[k].option, "DialCallee") == 0) |
---|
3946 | strcpy(p->printpanel.tmp_fax_data.phone, entrylist[k].value); |
---|
3947 | |
---|
3948 | } |
---|
3949 | q = strchr(p->printpanel.tmp_fax_data.key, '|'); |
---|
3950 | if (q) *q = '\0'; |
---|
3951 | p->printpanel.fax_phone_num_children = j; |
---|
3952 | XtManageChild(p->printpanel.fax_phone_children[0]); |
---|
3953 | } |
---|
3954 | |
---|
3955 | |
---|
3956 | static void BuildFeatures(p) |
---|
3957 | PrintPanelWidget p; |
---|
3958 | { |
---|
3959 | int i, j, k; |
---|
3960 | Arg args[20]; |
---|
3961 | char buf[1024]; |
---|
3962 | int def; |
---|
3963 | int pull; |
---|
3964 | int lastone = -1; |
---|
3965 | char *q; |
---|
3966 | int test; |
---|
3967 | PrintPanelPart *h; |
---|
3968 | |
---|
3969 | |
---|
3970 | h = &p->printpanel; |
---|
3971 | h->num_feature_children = 0; |
---|
3972 | p->printpanel.num_features = -1; |
---|
3973 | |
---|
3974 | for (j = 0; j < p->printpanel.features.num_uis; j++) { |
---|
3975 | def = -1; |
---|
3976 | if (strcmp(p->printpanel.features.uis[j].keyword, "*PageRegion") == 0) |
---|
3977 | continue; |
---|
3978 | if (p->printpanel.features.uis[j].display == FALSE) |
---|
3979 | continue; |
---|
3980 | q = p->printpanel.features.uis[j].keyword; |
---|
3981 | q++; |
---|
3982 | p->printpanel.feature_info[++p->printpanel.num_features].name = q; |
---|
3983 | switch (p->printpanel.features.uis[j].type) { |
---|
3984 | case PICKONE: |
---|
3985 | /* option menu */ |
---|
3986 | sprintf(buf, "radio%d", j); |
---|
3987 | i = 0; |
---|
3988 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
3989 | if (lastone == -1) { |
---|
3990 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++; |
---|
3991 | } |
---|
3992 | else { |
---|
3993 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
3994 | XtSetArg(args[i], XmNbottomWidget, |
---|
3995 | h->feature_children[lastone]); i++; |
---|
3996 | } |
---|
3997 | XtSetArg(args[i], XmNradioAlwaysOne, FALSE); i++; |
---|
3998 | sprintf(buf, "%sRadioBox", |
---|
3999 | p->printpanel.feature_info[p->printpanel.num_features].name); |
---|
4000 | h->feature_children[h->num_feature_children] = |
---|
4001 | XmCreateRadioBox(h->feature_form_child, buf, args, i); |
---|
4002 | pull = h->num_feature_children; |
---|
4003 | XtManageChild(h->feature_children[h->num_feature_children]); |
---|
4004 | h->features.uis[j].imp = |
---|
4005 | h->feature_children[h->num_feature_children]; |
---|
4006 | lastone = h->num_feature_children; |
---|
4007 | h->num_feature_children++; |
---|
4008 | p->printpanel.feature_info[p->printpanel.num_features].num = 1; |
---|
4009 | for (k = 0; k < p->printpanel.features.uis[j].num_options; k++) { |
---|
4010 | i = 0; |
---|
4011 | if (h->features.uis[j].options[k].name_tran[0] != '\0') |
---|
4012 | q = h->features.uis[j].options[k].name_tran; |
---|
4013 | else |
---|
4014 | q = h->features.uis[j].options[k].name; |
---|
4015 | h->feature_children[h->num_feature_children] = |
---|
4016 | XmCreateToggleButton(h->feature_children[pull], q, |
---|
4017 | args, i); |
---|
4018 | h->features.uis[j].options[k].imp = |
---|
4019 | h->feature_children[h->num_feature_children]; |
---|
4020 | h->choice_callback_data[h->num_feature_children].choice = |
---|
4021 | p->printpanel.features.uis[j].options[k].name; |
---|
4022 | h->choice_callback_data[h->num_feature_children].which_feature |
---|
4023 | = p->printpanel.num_features; |
---|
4024 | h->choice_callback_data[h->num_feature_children].head = |
---|
4025 | (Widget) p; |
---|
4026 | h->choice_callback_data[h->num_feature_children].which_key |
---|
4027 | = j; |
---|
4028 | h->choice_callback_data[h->num_feature_children].which_option |
---|
4029 | = k; |
---|
4030 | XtAddCallback(h->feature_children[h->num_feature_children], |
---|
4031 | XmNvalueChangedCallback, SetFeatureValue, |
---|
4032 | &h->choice_callback_data[h->num_feature_children]); |
---|
4033 | if (k == p->printpanel.features.uis[j].default_option) |
---|
4034 | def = h->num_feature_children; |
---|
4035 | if (h->features.uis[j].options[k].gray) { |
---|
4036 | XtSetSensitive(h->feature_children[h->num_feature_children], |
---|
4037 | FALSE); |
---|
4038 | } |
---|
4039 | XtManageChild(h->feature_children[h->num_feature_children]); |
---|
4040 | h->num_feature_children++; |
---|
4041 | } |
---|
4042 | if (def > -1) |
---|
4043 | XmToggleButtonSetState(h->feature_children[def], TRUE, |
---|
4044 | TRUE); |
---|
4045 | /* create label */ |
---|
4046 | i = 0; |
---|
4047 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
4048 | if (lastone == -1) { |
---|
4049 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++; |
---|
4050 | } |
---|
4051 | else { |
---|
4052 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
4053 | XtSetArg(args[i], XmNbottomWidget, |
---|
4054 | h->feature_children[lastone]); i++; |
---|
4055 | } |
---|
4056 | if (p->printpanel.features.uis[j].key_tran[0] != '\0') { |
---|
4057 | XtSetArg(args[i], XmNlabelString, |
---|
4058 | CS(p->printpanel.features.uis[j].key_tran)); |
---|
4059 | i++; |
---|
4060 | } |
---|
4061 | else { |
---|
4062 | XtSetArg(args[i], XmNlabelString, |
---|
4063 | CS(h->feature_info[h->num_features].name)); |
---|
4064 | i++; |
---|
4065 | } |
---|
4066 | sprintf(buf, "%sLabel", |
---|
4067 | p->printpanel.feature_info[p->printpanel.num_features].name); |
---|
4068 | h->feature_children[h->num_feature_children] = |
---|
4069 | XtCreateWidget(buf, xmLabelWidgetClass, |
---|
4070 | h->feature_form_child, args, i); |
---|
4071 | XtManageChild(h->feature_children[h->num_feature_children]); |
---|
4072 | lastone = h->num_feature_children; |
---|
4073 | h->num_feature_children++; |
---|
4074 | break; |
---|
4075 | case BOOL: |
---|
4076 | /* toggle button */ |
---|
4077 | p->printpanel.feature_info[p->printpanel.num_features].num = 1; |
---|
4078 | sprintf(buf, "toggle%d", j); |
---|
4079 | i = 0; |
---|
4080 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
4081 | if (lastone == -1) { |
---|
4082 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++; |
---|
4083 | } |
---|
4084 | else { |
---|
4085 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
4086 | XtSetArg(args[i], XmNbottomWidget, |
---|
4087 | h->feature_children[lastone]); i++; |
---|
4088 | } |
---|
4089 | if (p->printpanel.features.uis[j].key_tran[0] != '\0') { |
---|
4090 | XtSetArg(args[i], XmNlabelString, |
---|
4091 | CS(p->printpanel.features.uis[j].key_tran)); |
---|
4092 | i++; |
---|
4093 | } |
---|
4094 | else { |
---|
4095 | XtSetArg(args[i], XmNlabelString, |
---|
4096 | CS(h->feature_info[h->num_features].name)); |
---|
4097 | i++; |
---|
4098 | } |
---|
4099 | h->feature_children[h->num_feature_children] = |
---|
4100 | XtCreateManagedWidget(buf, xmToggleButtonWidgetClass, |
---|
4101 | h->feature_form_child, args, i); |
---|
4102 | h->features.uis[j].imp = |
---|
4103 | h->feature_children[h->num_feature_children]; |
---|
4104 | def = p->printpanel.features.uis[j].default_option; |
---|
4105 | if (def > -1) { |
---|
4106 | if (strcmp(p->printpanel.features.uis[j].options[def].name, |
---|
4107 | "True") == 0) { |
---|
4108 | XmToggleButtonSetState(h->feature_children[h->num_feature_children], TRUE, TRUE); |
---|
4109 | } |
---|
4110 | } |
---|
4111 | h->choice_callback_data[h->num_feature_children].head = |
---|
4112 | (Widget) p; |
---|
4113 | h->choice_callback_data[h->num_feature_children].which_feature |
---|
4114 | = p->printpanel.num_features; |
---|
4115 | h->choice_callback_data[h->num_feature_children].which_key = j; |
---|
4116 | for (k = 0; k < h->features.uis[j].num_options; k++) { |
---|
4117 | if (strcmp(h->features.uis[j].options[k].name, "False") == |
---|
4118 | 0) { |
---|
4119 | h->choice_callback_data[h->num_feature_children].choice |
---|
4120 | = h->features.uis[j].options[k].name; |
---|
4121 | h->choice_callback_data[h->num_feature_children].which_option = k; |
---|
4122 | } |
---|
4123 | if (h->features.uis[j].options[k].gray) { |
---|
4124 | XtSetSensitive(h->feature_children[h->num_feature_children], |
---|
4125 | FALSE); |
---|
4126 | } |
---|
4127 | } |
---|
4128 | XtAddCallback(h->feature_children[h->num_feature_children], |
---|
4129 | XmNvalueChangedCallback, SetToggleFeature, |
---|
4130 | &h->choice_callback_data[h->num_feature_children]); |
---|
4131 | lastone = h->num_feature_children; |
---|
4132 | h->num_feature_children++; |
---|
4133 | break; |
---|
4134 | case PICKMANY: |
---|
4135 | /* rowcolumn */ |
---|
4136 | sprintf(buf, "radio%d", j); |
---|
4137 | i = 0; |
---|
4138 | i = 0; |
---|
4139 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
4140 | if (lastone == -1) { |
---|
4141 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++; |
---|
4142 | } |
---|
4143 | else { |
---|
4144 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
4145 | XtSetArg(args[i], XmNbottomWidget, |
---|
4146 | h->feature_children[lastone]); i++; |
---|
4147 | } |
---|
4148 | XtSetArg(args[i], XmNpacking, XmPACK_COLUMN); i++; |
---|
4149 | XtSetArg(args[i], XmNisHomogeneous, TRUE); i++; |
---|
4150 | XtSetArg(args[i], XmNentryClass, xmToggleButtonWidgetClass); i++; |
---|
4151 | pull = h->num_feature_children; |
---|
4152 | h->feature_children[h->num_feature_children] = |
---|
4153 | XmCreateRowColumn(h->feature_form_child, buf, args, i); |
---|
4154 | XtManageChild(h->feature_children[h->num_feature_children]); |
---|
4155 | h->features.uis[j].imp = |
---|
4156 | h->feature_children[h->num_feature_children]; |
---|
4157 | lastone = h->num_feature_children; |
---|
4158 | h->num_feature_children++; |
---|
4159 | p->printpanel.feature_info[p->printpanel.num_features].num = 0; |
---|
4160 | for (k = 0; k < h->features.uis[j].num_options; k++) { |
---|
4161 | i = 0; |
---|
4162 | sprintf(buf, "button%d", k); |
---|
4163 | if (h->features.uis[j].options[k].name_tran[0] != '\0') { |
---|
4164 | XtSetArg(args[i], XmNlabelString, |
---|
4165 | CS(h->features.uis[j].options[k].name_tran)); i++; |
---|
4166 | } |
---|
4167 | else { |
---|
4168 | XtSetArg(args[i], XmNlabelString, |
---|
4169 | CS(h->features.uis[j].options[k].name)); i++; |
---|
4170 | } |
---|
4171 | h->feature_children[h->num_feature_children] = |
---|
4172 | XtCreateManagedWidget(buf, xmToggleButtonWidgetClass, |
---|
4173 | h->feature_children[pull], args, |
---|
4174 | i); |
---|
4175 | h->features.uis[j].options[k].imp = |
---|
4176 | h->feature_children[h->num_feature_children]; |
---|
4177 | h->choice_callback_data[h->num_feature_children].which_key = j; |
---|
4178 | h->choice_callback_data[h->num_feature_children].which_option |
---|
4179 | = k; |
---|
4180 | h->choice_callback_data[h->num_feature_children].choice = |
---|
4181 | h->features.uis[j].options[k].name; |
---|
4182 | h->choice_callback_data[h->num_feature_children].which_feature |
---|
4183 | = p->printpanel.num_features; |
---|
4184 | h->choice_callback_data[h->num_feature_children].head = |
---|
4185 | (Widget) p; |
---|
4186 | XtAddCallback(h->feature_children[h->num_feature_children], |
---|
4187 | XmNvalueChangedCallback, PickManyCallback, |
---|
4188 | &h->choice_callback_data[h->num_feature_children]); |
---|
4189 | if (h->features.uis[j].options[k].gray) { |
---|
4190 | XtSetSensitive(h->feature_children[h->num_feature_children], |
---|
4191 | FALSE); |
---|
4192 | } |
---|
4193 | h->num_feature_children++; |
---|
4194 | p->printpanel.feature_info[p->printpanel.num_features].num++; |
---|
4195 | } |
---|
4196 | i = 0; |
---|
4197 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
4198 | if (lastone == -1) { |
---|
4199 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++; |
---|
4200 | } |
---|
4201 | else { |
---|
4202 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
4203 | XtSetArg(args[i], XmNbottomWidget, |
---|
4204 | h->feature_children[lastone]); i++; |
---|
4205 | } |
---|
4206 | if (p->printpanel.features.uis[j].key_tran[0] != '\0') { |
---|
4207 | XtSetArg(args[i], XmNlabelString, |
---|
4208 | CS(p->printpanel.features.uis[j].key_tran)); |
---|
4209 | i++; |
---|
4210 | } |
---|
4211 | else { |
---|
4212 | XtSetArg(args[i], XmNlabelString, |
---|
4213 | CS(h->feature_info[h->num_features].name)); |
---|
4214 | i++; |
---|
4215 | } |
---|
4216 | sprintf(buf, "%sLabel", h->features.uis[j].keyword); |
---|
4217 | h->feature_children[h->num_feature_children] = |
---|
4218 | XtCreateManagedWidget(buf, xmLabelWidgetClass, |
---|
4219 | h->feature_form_child, args, i); |
---|
4220 | lastone = h->num_feature_children; |
---|
4221 | h->num_feature_children++; |
---|
4222 | break; |
---|
4223 | default: |
---|
4224 | break; |
---|
4225 | } |
---|
4226 | } |
---|
4227 | } |
---|
4228 | |
---|
4229 | |
---|
4230 | static void CreateGenericPanel(p) |
---|
4231 | PrintPanelWidget p; |
---|
4232 | { |
---|
4233 | int i; |
---|
4234 | Arg args[10]; |
---|
4235 | |
---|
4236 | i = 0; |
---|
4237 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
4238 | XtSetArg(args[i], XmNdialogTitle, CS("Filter Options")); i++; |
---|
4239 | p->printpanel.generic_panel_child = |
---|
4240 | XmCreateFormDialog(p->printpanel.panel_child, |
---|
4241 | "genericPanel", args, i); |
---|
4242 | |
---|
4243 | CreateStandardButtons(p->printpanel.generic_panel_child, |
---|
4244 | &p->printpanel.generic_ok_button_child, |
---|
4245 | &p->printpanel.generic_apply_button_child, |
---|
4246 | &p->printpanel.generic_reset_button_child, |
---|
4247 | &p->printpanel.generic_cancel_button_child, |
---|
4248 | &p->printpanel.generic_separator_child, |
---|
4249 | "generic"); |
---|
4250 | |
---|
4251 | /* |
---|
4252 | p->printpanel.generic_ok_button_child = |
---|
4253 | XtVaCreateManagedWidget("genericOK", |
---|
4254 | xmPushButtonWidgetClass, |
---|
4255 | p->printpanel.generic_panel_child, |
---|
4256 | XmNleftAttachment, XmATTACH_FORM, |
---|
4257 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4258 | XmNlabelString, CS("OK"), XmNwidth, 60, |
---|
4259 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4260 | XmNleftOffset, 10, NULL); |
---|
4261 | |
---|
4262 | p->printpanel.generic_apply_button_child = |
---|
4263 | XtVaCreateManagedWidget("genericApply", |
---|
4264 | xmPushButtonWidgetClass, |
---|
4265 | p->printpanel.generic_panel_child, |
---|
4266 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4267 | XmNleftWidget, |
---|
4268 | p->printpanel.generic_ok_button_child, |
---|
4269 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4270 | XmNlabelString, CS("Apply"), XmNwidth, 60, |
---|
4271 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4272 | XmNleftOffset, 10, NULL); |
---|
4273 | |
---|
4274 | p->printpanel.generic_reset_button_child = |
---|
4275 | XtVaCreateManagedWidget("genericReset", |
---|
4276 | xmPushButtonWidgetClass, |
---|
4277 | p->printpanel.generic_panel_child, |
---|
4278 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4279 | XmNleftWidget, |
---|
4280 | p->printpanel.generic_apply_button_child, |
---|
4281 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4282 | XmNlabelString, CS("Reset"), XmNwidth, 60, |
---|
4283 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4284 | XmNleftOffset, 10, NULL); |
---|
4285 | |
---|
4286 | p->printpanel.generic_cancel_button_child = |
---|
4287 | XtVaCreateManagedWidget("genericCancel", |
---|
4288 | xmPushButtonWidgetClass, |
---|
4289 | p->printpanel.generic_panel_child, |
---|
4290 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4291 | XmNleftWidget, |
---|
4292 | p->printpanel.generic_reset_button_child, |
---|
4293 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4294 | XmNlabelString, CS("Cancel"), XmNwidth, 60, |
---|
4295 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4296 | XmNleftOffset, 10, NULL); |
---|
4297 | */ |
---|
4298 | |
---|
4299 | XtAddCallback(p->printpanel.generic_cancel_button_child, |
---|
4300 | XmNactivateCallback, SecondaryCancelCallback, |
---|
4301 | &p->printpanel.generic_panel_child); |
---|
4302 | XtAddCallback(p->printpanel.generic_ok_button_child, XmNactivateCallback, |
---|
4303 | SecondaryOKCallback, |
---|
4304 | &p->printpanel.option_callback_data); |
---|
4305 | XtAddCallback(p->printpanel.generic_apply_button_child, |
---|
4306 | XmNactivateCallback, SecondaryApplyCallback, |
---|
4307 | &p->printpanel.option_callback_data); |
---|
4308 | XtAddCallback(p->printpanel.generic_reset_button_child, |
---|
4309 | XmNactivateCallback, SecondaryResetCallback, p); |
---|
4310 | |
---|
4311 | /* |
---|
4312 | p->printpanel.generic_separator_child = |
---|
4313 | XtVaCreateManagedWidget("genericSeparator", |
---|
4314 | xmSeparatorWidgetClass, |
---|
4315 | p->printpanel.generic_panel_child, |
---|
4316 | XmNleftAttachment, XmATTACH_FORM, |
---|
4317 | XmNrightAttachment, XmATTACH_FORM, |
---|
4318 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4319 | XmNbottomWidget, |
---|
4320 | p->printpanel.generic_ok_button_child, |
---|
4321 | XmNbottomOffset, 10, NULL); |
---|
4322 | */ |
---|
4323 | p->printpanel.generic_label_child = |
---|
4324 | XtVaCreateManagedWidget("genericLabel", |
---|
4325 | xmLabelWidgetClass, |
---|
4326 | p->printpanel.generic_panel_child, |
---|
4327 | XmNleftAttachment, XmATTACH_POSITION, |
---|
4328 | XmNleftPosition, 35, XmNtopAttachment, |
---|
4329 | XmATTACH_FORM, XmNtopOffset, 20, |
---|
4330 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4331 | XmNbottomWidget, |
---|
4332 | p->printpanel.generic_separator_child, |
---|
4333 | XmNbottomOffset, 20, XmNwidth, 100, NULL); |
---|
4334 | } |
---|
4335 | |
---|
4336 | static void InitPhoneList(p) |
---|
4337 | PrintPanelWidget p; |
---|
4338 | { |
---|
4339 | int i; |
---|
4340 | XmString *k_names; |
---|
4341 | |
---|
4342 | k_names = (XmString *) XtCalloc(p->printpanel.num_keys, |
---|
4343 | sizeof(XmString)); |
---|
4344 | |
---|
4345 | for (i = 0; i < p->printpanel.num_keys; i++) { |
---|
4346 | k_names[i] = CS(p->printpanel.keys[i]); |
---|
4347 | } |
---|
4348 | |
---|
4349 | XtVaSetValues(p->printpanel.fax_phone_list_child, XmNitemCount, |
---|
4350 | p->printpanel.num_keys, XmNitems, k_names, NULL); |
---|
4351 | |
---|
4352 | XtFree(k_names); |
---|
4353 | } |
---|
4354 | |
---|
4355 | |
---|
4356 | static void CreatePhonebookPanel(p) |
---|
4357 | PrintPanelWidget p; |
---|
4358 | { |
---|
4359 | int i; |
---|
4360 | Arg args[10]; |
---|
4361 | char *faxdb; |
---|
4362 | |
---|
4363 | faxdb = getenv("PSFAXDB"); |
---|
4364 | if (faxdb == NULL) { |
---|
4365 | faxdb = getenv("HOME"); |
---|
4366 | if (faxdb) { |
---|
4367 | strcpy(p->printpanel.faxdb, faxdb); |
---|
4368 | strcat(p->printpanel.faxdb, "/.faxdb"); |
---|
4369 | } |
---|
4370 | } |
---|
4371 | else { |
---|
4372 | strcpy(p->printpanel.faxdb, faxdb); |
---|
4373 | } |
---|
4374 | |
---|
4375 | p->printpanel.max_keys = 20; |
---|
4376 | p->printpanel.num_keys = 0; |
---|
4377 | if ((i = GetPhonebookKeys(p->printpanel.keys, |
---|
4378 | &p->printpanel.num_keys, |
---|
4379 | &p->printpanel.max_keys, |
---|
4380 | p->printpanel.faxdb)) != 0) { |
---|
4381 | fprintf(stderr, "Could not get list of keys in fax phonebook\n"); |
---|
4382 | } |
---|
4383 | |
---|
4384 | i = 0; |
---|
4385 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
4386 | XtSetArg(args[i], XmNdialogTitle, CS("Fax Phonebook")); i++; |
---|
4387 | p->printpanel.fax_phone_panel_child = |
---|
4388 | XmCreateFormDialog(p->printpanel.fax_panel_child, "faxPhonePanel", |
---|
4389 | args, i); |
---|
4390 | |
---|
4391 | CreateStandardButtons(p->printpanel.fax_phone_panel_child, |
---|
4392 | &p->printpanel.fax_phone_ok_button_child, |
---|
4393 | &p->printpanel.fax_phone_apply_button_child, |
---|
4394 | &p->printpanel.fax_phone_reset_button_child, |
---|
4395 | &p->printpanel.fax_phone_cancel_button_child, |
---|
4396 | &p->printpanel.fax_phone_separator_child, |
---|
4397 | "faxPhone"); |
---|
4398 | |
---|
4399 | /* |
---|
4400 | p->printpanel.fax_phone_ok_button_child = |
---|
4401 | XtVaCreateManagedWidget("faxOK", |
---|
4402 | xmPushButtonWidgetClass, |
---|
4403 | p->printpanel.fax_phone_panel_child, |
---|
4404 | XmNleftAttachment, XmATTACH_FORM, |
---|
4405 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4406 | XmNlabelString, CS("OK"), XmNwidth, 60, |
---|
4407 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4408 | XmNleftOffset, 10, NULL); |
---|
4409 | |
---|
4410 | p->printpanel.fax_phone_apply_button_child = |
---|
4411 | XtVaCreateManagedWidget("faxApply", |
---|
4412 | xmPushButtonWidgetClass, |
---|
4413 | p->printpanel.fax_phone_panel_child, |
---|
4414 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4415 | XmNleftWidget, |
---|
4416 | p->printpanel.fax_phone_ok_button_child, |
---|
4417 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4418 | XmNlabelString, CS("Apply"), XmNwidth, 60, |
---|
4419 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4420 | XmNleftOffset, 10, NULL); |
---|
4421 | |
---|
4422 | p->printpanel.fax_phone_reset_button_child = |
---|
4423 | XtVaCreateManagedWidget("faxReset", |
---|
4424 | xmPushButtonWidgetClass, |
---|
4425 | p->printpanel.fax_phone_panel_child, |
---|
4426 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4427 | XmNleftWidget, |
---|
4428 | p->printpanel.fax_phone_apply_button_child, |
---|
4429 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4430 | XmNlabelString, CS("Reset"), XmNwidth, 60, |
---|
4431 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4432 | XmNleftOffset, 10, NULL); |
---|
4433 | |
---|
4434 | p->printpanel.fax_phone_cancel_button_child = |
---|
4435 | XtVaCreateManagedWidget("faxCancel", |
---|
4436 | xmPushButtonWidgetClass, |
---|
4437 | p->printpanel.fax_phone_panel_child, |
---|
4438 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4439 | XmNleftWidget, |
---|
4440 | p->printpanel.fax_phone_reset_button_child, |
---|
4441 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4442 | XmNlabelString, CS("Cancel"), XmNwidth, 60, |
---|
4443 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4444 | XmNrightOffset, 10, |
---|
4445 | XmNleftOffset, 10, NULL); |
---|
4446 | */ |
---|
4447 | |
---|
4448 | XtAddCallback(p->printpanel.fax_phone_cancel_button_child, |
---|
4449 | XmNactivateCallback, SecondaryCancelCallback, |
---|
4450 | &p->printpanel.fax_phone_panel_child); |
---|
4451 | XtAddCallback(p->printpanel.fax_phone_ok_button_child, XmNactivateCallback, |
---|
4452 | PhoneOKCallback, p); |
---|
4453 | XtAddCallback(p->printpanel.fax_phone_apply_button_child, |
---|
4454 | XmNactivateCallback, PhoneApplyCallback, p); |
---|
4455 | |
---|
4456 | /* |
---|
4457 | p->printpanel.fax_phone_separator_child = |
---|
4458 | XtVaCreateManagedWidget("faxSeparator", |
---|
4459 | xmSeparatorWidgetClass, |
---|
4460 | p->printpanel.fax_phone_panel_child, |
---|
4461 | XmNleftAttachment, XmATTACH_FORM, |
---|
4462 | XmNrightAttachment, XmATTACH_FORM, |
---|
4463 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4464 | XmNbottomWidget, |
---|
4465 | p->printpanel.fax_phone_ok_button_child, |
---|
4466 | XmNbottomOffset, 10, NULL); |
---|
4467 | */ |
---|
4468 | |
---|
4469 | p->printpanel.fax_phone_label_child = |
---|
4470 | XtVaCreateManagedWidget("faxPhoneLabel", xmLabelWidgetClass, |
---|
4471 | p->printpanel.fax_phone_panel_child, |
---|
4472 | XmNtopAttachment, XmATTACH_FORM, |
---|
4473 | XmNleftAttachment, XmATTACH_FORM, |
---|
4474 | XmNtopOffset, 10, XmNleftOffset, 10, |
---|
4475 | XmNlabelString, CS("Keys from phonebook"), |
---|
4476 | NULL); |
---|
4477 | i = 0; |
---|
4478 | XtSetArg(args[i], XmNitemCount, 1); i++; |
---|
4479 | XtSetArg(args[i], XmNitems, &CSempty); i++; |
---|
4480 | XtSetArg(args[i], XmNheight, 100); i++; |
---|
4481 | p->printpanel.fax_phone_list_child = |
---|
4482 | XmCreateScrolledList(p->printpanel.fax_phone_panel_child, |
---|
4483 | "phoneList", args, i); |
---|
4484 | |
---|
4485 | XtVaSetValues(XtParent(p->printpanel.fax_phone_list_child), |
---|
4486 | XmNtopAttachment, XmATTACH_WIDGET, |
---|
4487 | XmNtopWidget, p->printpanel.fax_phone_label_child, |
---|
4488 | XmNleftAttachment, XmATTACH_FORM, |
---|
4489 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4490 | XmNbottomWidget, p->printpanel.fax_phone_separator_child, |
---|
4491 | XmNbottomOffset, 10, |
---|
4492 | NULL); |
---|
4493 | |
---|
4494 | XtManageChild(p->printpanel.fax_phone_list_child); |
---|
4495 | XtAddCallback(p->printpanel.fax_phone_list_child, |
---|
4496 | XmNbrowseSelectionCallback, ListSelection, p); |
---|
4497 | InitPhoneList(p); |
---|
4498 | } |
---|
4499 | |
---|
4500 | static void CreateFaxPanel(p) |
---|
4501 | PrintPanelWidget p; |
---|
4502 | { |
---|
4503 | int i; |
---|
4504 | Arg args[10]; |
---|
4505 | Widget tmp; |
---|
4506 | |
---|
4507 | i = 0; |
---|
4508 | XtSetArg(args[i], XmNautoUnmanage, FALSE); i++; |
---|
4509 | XtSetArg(args[i], XmNdialogTitle, CS("Fax")); i++; |
---|
4510 | p->printpanel.fax_panel_child = |
---|
4511 | XmCreateFormDialog(p->printpanel.panel_child, "faxPanel", args, i); |
---|
4512 | |
---|
4513 | p->printpanel.fax_callback_data.which_widget = |
---|
4514 | p->printpanel.fax_panel_child; |
---|
4515 | p->printpanel.fax_callback_data.which_filter = NONE; |
---|
4516 | |
---|
4517 | |
---|
4518 | CreateStandardButtons(p->printpanel.fax_panel_child, |
---|
4519 | &p->printpanel.fax_ok_button_child, |
---|
4520 | &p->printpanel.fax_apply_button_child, |
---|
4521 | &p->printpanel.fax_reset_button_child, |
---|
4522 | &p->printpanel.fax_cancel_button_child, |
---|
4523 | &p->printpanel.fax_separator_child, |
---|
4524 | "fax"); |
---|
4525 | |
---|
4526 | /* |
---|
4527 | p->printpanel.fax_ok_button_child = |
---|
4528 | XtVaCreateManagedWidget("faxOK", |
---|
4529 | xmPushButtonWidgetClass, |
---|
4530 | p->printpanel.fax_panel_child, |
---|
4531 | XmNleftAttachment, XmATTACH_FORM, |
---|
4532 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4533 | XmNlabelString, CS("OK"), XmNwidth, 60, |
---|
4534 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4535 | XmNleftOffset, 10, NULL); |
---|
4536 | |
---|
4537 | p->printpanel.fax_apply_button_child = |
---|
4538 | XtVaCreateManagedWidget("faxApply", |
---|
4539 | xmPushButtonWidgetClass, |
---|
4540 | p->printpanel.fax_panel_child, |
---|
4541 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4542 | XmNleftWidget, |
---|
4543 | p->printpanel.fax_ok_button_child, |
---|
4544 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4545 | XmNlabelString, CS("Apply"), XmNwidth, 60, |
---|
4546 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4547 | XmNleftOffset, 10, NULL); |
---|
4548 | |
---|
4549 | p->printpanel.fax_reset_button_child = |
---|
4550 | XtVaCreateManagedWidget("faxReset", |
---|
4551 | xmPushButtonWidgetClass, |
---|
4552 | p->printpanel.fax_panel_child, |
---|
4553 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4554 | XmNleftWidget, |
---|
4555 | p->printpanel.fax_apply_button_child, |
---|
4556 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4557 | XmNlabelString, CS("Reset"), XmNwidth, 60, |
---|
4558 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4559 | XmNleftOffset, 10, NULL); |
---|
4560 | |
---|
4561 | p->printpanel.fax_cancel_button_child = |
---|
4562 | XtVaCreateManagedWidget("faxCancel", |
---|
4563 | xmPushButtonWidgetClass, |
---|
4564 | p->printpanel.fax_panel_child, |
---|
4565 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4566 | XmNleftWidget, |
---|
4567 | p->printpanel.fax_reset_button_child, |
---|
4568 | XmNbottomAttachment, XmATTACH_FORM, |
---|
4569 | XmNlabelString, CS("Cancel"), XmNwidth, 60, |
---|
4570 | XmNheight, 30, XmNbottomOffset, 10, |
---|
4571 | XmNleftOffset, 10, NULL); |
---|
4572 | |
---|
4573 | */ |
---|
4574 | XtAddCallback(p->printpanel.fax_cancel_button_child, |
---|
4575 | XmNactivateCallback, SecondaryCancelCallback, |
---|
4576 | &p->printpanel.fax_panel_child); |
---|
4577 | XtAddCallback(p->printpanel.fax_ok_button_child, XmNactivateCallback, |
---|
4578 | SecondaryOKCallback, |
---|
4579 | &p->printpanel.fax_callback_data); |
---|
4580 | XtAddCallback(p->printpanel.fax_apply_button_child, |
---|
4581 | XmNactivateCallback, SecondaryApplyCallback, |
---|
4582 | &p->printpanel.fax_callback_data); |
---|
4583 | |
---|
4584 | /* |
---|
4585 | p->printpanel.fax_separator_child = |
---|
4586 | XtVaCreateManagedWidget("faxSeparator", |
---|
4587 | xmSeparatorWidgetClass, |
---|
4588 | p->printpanel.fax_panel_child, |
---|
4589 | XmNleftAttachment, XmATTACH_FORM, |
---|
4590 | XmNrightAttachment, XmATTACH_FORM, |
---|
4591 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4592 | XmNbottomWidget, |
---|
4593 | p->printpanel.fax_ok_button_child, |
---|
4594 | XmNbottomOffset, 10, NULL); |
---|
4595 | */ |
---|
4596 | |
---|
4597 | p->printpanel.fax_save_toggle_child = |
---|
4598 | XtVaCreateManagedWidget("faxSaveToggle", xmToggleButtonWidgetClass, |
---|
4599 | p->printpanel.fax_panel_child, |
---|
4600 | XmNleftAttachment, XmATTACH_FORM, |
---|
4601 | XmNleftOffset, 10, |
---|
4602 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4603 | XmNbottomWidget, |
---|
4604 | p->printpanel.fax_separator_child, |
---|
4605 | XmNlabelString, CS("Save to file"), |
---|
4606 | XmNbottomOffset, 10, NULL); |
---|
4607 | XtAddCallback(p->printpanel.fax_save_toggle_child, |
---|
4608 | XmNvalueChangedCallback, FaxToggleCallback, p); |
---|
4609 | |
---|
4610 | p->printpanel.fax_save_button_child = |
---|
4611 | XtVaCreateManagedWidget("faxSaveButton", xmPushButtonWidgetClass, |
---|
4612 | p->printpanel.fax_panel_child, |
---|
4613 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4614 | XmNleftWidget, |
---|
4615 | p->printpanel.fax_save_toggle_child, |
---|
4616 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
4617 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
4618 | p->printpanel.fax_separator_child, |
---|
4619 | XmNwidth, 40, |
---|
4620 | XmNlabelString, CS("..."), XmNbottomOffset, |
---|
4621 | 10, NULL); |
---|
4622 | XtSetSensitive(p->printpanel.fax_save_button_child, FALSE); |
---|
4623 | |
---|
4624 | i = 0; |
---|
4625 | XtSetArg(args[i], XmNdialogTitle, CS("Fax Save File Selection")); i++; |
---|
4626 | XtSetArg(args[i], XmNwidth, 325); i++; |
---|
4627 | XtSetArg(args[i], XmNresizePolicy, XmRESIZE_NONE); i++; |
---|
4628 | p->printpanel.fax_save_selection_child = |
---|
4629 | XmCreateFileSelectionDialog(p->printpanel.fax_panel_child, |
---|
4630 | "faxSaveFile", args, i); |
---|
4631 | |
---|
4632 | tmp = |
---|
4633 | XmFileSelectionBoxGetChild(p->printpanel.fax_save_selection_child, |
---|
4634 | XmDIALOG_HELP_BUTTON); |
---|
4635 | XtUnmanageChild(tmp); |
---|
4636 | |
---|
4637 | p->printpanel.fax_file_data.head = (Widget) p; |
---|
4638 | p->printpanel.fax_file_data.which_sb = |
---|
4639 | p->printpanel.fax_save_selection_child; |
---|
4640 | p->printpanel.fax_file_data.which_field = NULL; |
---|
4641 | p->printpanel.fax_file_data.name = &p->printpanel.tmp_fax_data.filename; |
---|
4642 | XtAddCallback(p->printpanel.fax_save_selection_child, XmNokCallback, |
---|
4643 | FileOKCallback, &p->printpanel.fax_file_data); |
---|
4644 | XtAddCallback(p->printpanel.fax_save_selection_child, |
---|
4645 | XmNcancelCallback, FileCancelCallback, |
---|
4646 | &p->printpanel.fax_file_data); |
---|
4647 | |
---|
4648 | XtAddCallback(p->printpanel.fax_save_button_child, XmNactivateCallback, |
---|
4649 | ChooseFileCallback, |
---|
4650 | p->printpanel.fax_save_selection_child); |
---|
4651 | |
---|
4652 | p->printpanel.fax_phone_button_child = |
---|
4653 | XtVaCreateManagedWidget("faxPhoneButton", xmPushButtonWidgetClass, |
---|
4654 | p->printpanel.fax_panel_child, |
---|
4655 | XmNleftAttachment, XmATTACH_FORM, |
---|
4656 | XmNleftOffset, 10, |
---|
4657 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4658 | XmNbottomWidget, |
---|
4659 | p->printpanel.fax_save_toggle_child, |
---|
4660 | XmNlabelString, CS("Phonebook..."), |
---|
4661 | XmNheight, 30, |
---|
4662 | XmNbottomOffset, 10, NULL); |
---|
4663 | |
---|
4664 | XtAddCallback(p->printpanel.fax_phone_button_child, |
---|
4665 | XmNactivateCallback, SecondaryCallback, |
---|
4666 | &(p->printpanel.fax_phone_panel_child)); |
---|
4667 | |
---|
4668 | /* |
---|
4669 | p->printpanel.fax_add_button_child = |
---|
4670 | XtVaCreateManagedWidget("faxAddButton", xmPushButtonWidgetClass, |
---|
4671 | p->printpanel.fax_panel_child, |
---|
4672 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4673 | XmNleftWidget, |
---|
4674 | p->printpanel.fax_phone_button_child, |
---|
4675 | XmNleftOffset, 10, |
---|
4676 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4677 | XmNbottomWidget, |
---|
4678 | p->printpanel.fax_save_toggle_child, |
---|
4679 | XmNlabelString, CS("Add to Phonebook"), |
---|
4680 | XmNheight, 30, |
---|
4681 | XmNbottomOffset, 10, NULL); |
---|
4682 | */ |
---|
4683 | |
---|
4684 | /* |
---|
4685 | p->printpanel.fax_extra_button_child = |
---|
4686 | XtVaCreateManagedWidget("faxExtraButton", xmPushButtonWidgetClass, |
---|
4687 | p->printpanel.fax_panel_child, |
---|
4688 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4689 | XmNleftWidget, |
---|
4690 | p->printpanel.fax_add_button_child, |
---|
4691 | XmNleftOffset, 10, |
---|
4692 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4693 | XmNbottomWidget, |
---|
4694 | p->printpanel.fax_save_toggle_child, |
---|
4695 | XmNlabelString, CS("Extra Options..."), |
---|
4696 | XmNheight, 30, |
---|
4697 | XmNbottomOffset, 10, NULL); |
---|
4698 | */ |
---|
4699 | i = 0; |
---|
4700 | XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++; |
---|
4701 | XtSetArg(args[i], XmNleftOffset, 10); i++; |
---|
4702 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
4703 | XtSetArg(args[i], XmNbottomWidget, |
---|
4704 | p->printpanel.fax_phone_button_child); i++; |
---|
4705 | XtSetArg(args[i], XmNbottomOffset, 10); i++; |
---|
4706 | XtSetArg(args[i], XmNorientation, XmHORIZONTAL); i++; |
---|
4707 | XtSetArg(args[i], XmNpacking, XmPACK_TIGHT); i++; |
---|
4708 | p->printpanel.fax_format_radio_child = |
---|
4709 | XmCreateRadioBox(p->printpanel.fax_panel_child, "formatRadio", |
---|
4710 | args, i); |
---|
4711 | XtAddCallback(p->printpanel.fax_format_radio_child, XmNentryCallback, |
---|
4712 | FaxFormatCallback, p); |
---|
4713 | |
---|
4714 | XtManageChild(p->printpanel.fax_format_radio_child); |
---|
4715 | |
---|
4716 | p->printpanel.fax_standard_toggle_child = |
---|
4717 | XtVaCreateManagedWidget("faxStandardToggle", |
---|
4718 | xmToggleButtonWidgetClass, |
---|
4719 | p->printpanel.fax_format_radio_child, |
---|
4720 | XmNlabelString, CS("Standard"), NULL); |
---|
4721 | |
---|
4722 | p->printpanel.fax_fine_toggle_child = |
---|
4723 | XtVaCreateManagedWidget("faxFineToggle", xmToggleButtonWidgetClass, |
---|
4724 | p->printpanel.fax_format_radio_child, |
---|
4725 | XmNlabelString, CS("Fine"), NULL); |
---|
4726 | |
---|
4727 | |
---|
4728 | p->printpanel.fax_teleps_toggle_child = |
---|
4729 | XtVaCreateManagedWidget("faxPSToggle", xmToggleButtonWidgetClass, |
---|
4730 | p->printpanel.fax_format_radio_child, |
---|
4731 | XmNlabelString, CS("PostScript"), NULL); |
---|
4732 | |
---|
4733 | p->printpanel.fax_teleps_label_child = |
---|
4734 | XtVaCreateManagedWidget("faxPSLabel", xmLabelWidgetClass, |
---|
4735 | p->printpanel.fax_panel_child, |
---|
4736 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4737 | XmNleftWidget, |
---|
4738 | p->printpanel.fax_phone_button_child, |
---|
4739 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
4740 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
4741 | p->printpanel.fax_save_toggle_child, |
---|
4742 | XmNbottomOffset, 10, XmNlabelString, |
---|
4743 | CS("Password"), NULL); |
---|
4744 | |
---|
4745 | XtSetSensitive(p->printpanel.fax_teleps_label_child, FALSE); |
---|
4746 | |
---|
4747 | p->printpanel.fax_teleps_field_child = |
---|
4748 | XtVaCreateManagedWidget("faxPSField", xmTextFieldWidgetClass, |
---|
4749 | p->printpanel.fax_panel_child, |
---|
4750 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4751 | XmNleftWidget, |
---|
4752 | p->printpanel.fax_teleps_label_child, |
---|
4753 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
4754 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
4755 | p->printpanel.fax_save_toggle_child, |
---|
4756 | XmNbottomOffset, 10, NULL); |
---|
4757 | |
---|
4758 | XtSetSensitive(p->printpanel.fax_teleps_field_child, FALSE); |
---|
4759 | XtAddCallback(p->printpanel.fax_teleps_field_child, |
---|
4760 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
4761 | &(p->printpanel.tmp_fax_data.passwd)); |
---|
4762 | |
---|
4763 | p->printpanel.fax_rec_label_child = |
---|
4764 | XtVaCreateManagedWidget("faxRecLabel", |
---|
4765 | xmLabelWidgetClass, |
---|
4766 | p->printpanel.fax_panel_child, |
---|
4767 | XmNleftAttachment, XmATTACH_FORM, |
---|
4768 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
4769 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
4770 | p->printpanel.fax_format_radio_child, |
---|
4771 | XmNbottomOffset, 10, XmNlabelString, |
---|
4772 | CS("Recipient Name"), NULL); |
---|
4773 | |
---|
4774 | p->printpanel.fax_rec_field_child = |
---|
4775 | XtVaCreateManagedWidget("faxRecField", |
---|
4776 | xmTextFieldWidgetClass, |
---|
4777 | p->printpanel.fax_panel_child, |
---|
4778 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4779 | XmNleftOffset, 10, XmNleftWidget, |
---|
4780 | p->printpanel.fax_rec_label_child, |
---|
4781 | XmNrightAttachment, XmATTACH_FORM, |
---|
4782 | XmNrightOffset, 10, |
---|
4783 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4784 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
4785 | p->printpanel.fax_format_radio_child, |
---|
4786 | NULL); |
---|
4787 | |
---|
4788 | XtAddCallback(p->printpanel.fax_rec_field_child, |
---|
4789 | XmNvalueChangedCallback, FieldChange, p); |
---|
4790 | |
---|
4791 | p->printpanel.fax_num_label_child = |
---|
4792 | XtVaCreateManagedWidget("faxNumLabel", |
---|
4793 | xmLabelWidgetClass, |
---|
4794 | p->printpanel.fax_panel_child, |
---|
4795 | XmNleftAttachment, XmATTACH_FORM, |
---|
4796 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
4797 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
4798 | p->printpanel.fax_rec_field_child, |
---|
4799 | XmNbottomOffset, 10, XmNlabelString, |
---|
4800 | CS("Fax Phone Number"), NULL); |
---|
4801 | |
---|
4802 | p->printpanel.fax_num_field_child = |
---|
4803 | XtVaCreateManagedWidget("faxNumField", |
---|
4804 | xmTextFieldWidgetClass, |
---|
4805 | p->printpanel.fax_panel_child, |
---|
4806 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4807 | XmNleftOffset, 10, XmNleftWidget, |
---|
4808 | p->printpanel.fax_num_label_child, |
---|
4809 | XmNrightAttachment, XmATTACH_FORM, |
---|
4810 | XmNrightOffset, 10, |
---|
4811 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4812 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
4813 | p->printpanel.fax_rec_field_child, NULL); |
---|
4814 | |
---|
4815 | XtAddCallback(p->printpanel.fax_num_field_child, |
---|
4816 | XmNvalueChangedCallback, FieldChange, p); |
---|
4817 | |
---|
4818 | p->printpanel.fax_panel_label_child = |
---|
4819 | XtVaCreateManagedWidget("faxPanelLabel", |
---|
4820 | xmLabelWidgetClass, |
---|
4821 | p->printpanel.fax_panel_child, |
---|
4822 | XmNleftAttachment, XmATTACH_POSITION, |
---|
4823 | XmNleftPosition, 35, XmNtopAttachment, |
---|
4824 | XmATTACH_FORM, XmNtopOffset, 20, |
---|
4825 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4826 | XmNbottomWidget, |
---|
4827 | p->printpanel.fax_num_field_child, |
---|
4828 | XmNlabelString, CS("Fax Options"), |
---|
4829 | XmNbottomOffset, 20, XmNwidth, 100, NULL); |
---|
4830 | |
---|
4831 | CreatePhonebookPanel(p); |
---|
4832 | } |
---|
4833 | |
---|
4834 | static void CreatePtroffPanel(p) |
---|
4835 | PrintPanelWidget p; |
---|
4836 | { |
---|
4837 | int i; |
---|
4838 | Arg args[10]; |
---|
4839 | |
---|
4840 | p->printpanel.option_children[PTROFF].child[FAMLAB] = |
---|
4841 | XtVaCreateWidget("familyLabel", |
---|
4842 | xmLabelWidgetClass, |
---|
4843 | p->printpanel.generic_panel_child, |
---|
4844 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
4845 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4846 | XmNbottomWidget, |
---|
4847 | p->printpanel.generic_separator_child, |
---|
4848 | XmNbottomOffset, 10, XmNwidth, 85, XmNlabelString, |
---|
4849 | CS("Font Family"), NULL); |
---|
4850 | |
---|
4851 | p->printpanel.option_children[PTROFF].num_children++; |
---|
4852 | |
---|
4853 | p->printpanel.option_children[PTROFF].child[FAMFIELD] = |
---|
4854 | XtVaCreateWidget("familyField", |
---|
4855 | xmTextFieldWidgetClass, |
---|
4856 | p->printpanel.generic_panel_child, |
---|
4857 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4858 | XmNleftOffset, 10, XmNleftWidget, |
---|
4859 | p->printpanel.option_children[PTROFF].child[FAMLAB], |
---|
4860 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4861 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
4862 | p->printpanel.generic_separator_child, |
---|
4863 | XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, |
---|
4864 | 20, NULL); |
---|
4865 | |
---|
4866 | XtAddCallback(p->printpanel.option_children[PTROFF].child[FAMFIELD], |
---|
4867 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
4868 | &p->printpanel.tmp_roff_info.font); |
---|
4869 | |
---|
4870 | p->printpanel.option_children[PTROFF].num_children++; |
---|
4871 | |
---|
4872 | p->printpanel.option_children[PTROFF].child[OPTLAB] = |
---|
4873 | XtVaCreateWidget("macroLabel", |
---|
4874 | xmLabelWidgetClass, |
---|
4875 | p->printpanel.generic_panel_child, |
---|
4876 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
4877 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4878 | XmNbottomWidget, |
---|
4879 | p->printpanel.option_children[PTROFF].child[FAMFIELD], |
---|
4880 | XmNbottomOffset, 10, XmNwidth, 85, XmNlabelString, |
---|
4881 | CS("Troff Options"), NULL); |
---|
4882 | |
---|
4883 | p->printpanel.option_children[PTROFF].num_children++; |
---|
4884 | |
---|
4885 | p->printpanel.option_children[PTROFF].child[OPTFIELD] = |
---|
4886 | XtVaCreateWidget("macroField", |
---|
4887 | xmTextFieldWidgetClass, |
---|
4888 | p->printpanel.generic_panel_child, |
---|
4889 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
4890 | 10, XmNleftWidget, |
---|
4891 | p->printpanel.option_children[PTROFF].child[OPTLAB], |
---|
4892 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4893 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
4894 | p->printpanel.option_children[PTROFF].child[FAMFIELD], |
---|
4895 | XmNwidth, 85, XmNrightAttachment, XmATTACH_FORM, |
---|
4896 | XmNrightOffset, 20, NULL); |
---|
4897 | |
---|
4898 | XtAddCallback(p->printpanel.option_children[PTROFF].child[OPTFIELD], |
---|
4899 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
4900 | &p->printpanel.tmp_roff_info.options); |
---|
4901 | |
---|
4902 | p->printpanel.option_children[PTROFF].num_children++; |
---|
4903 | |
---|
4904 | } |
---|
4905 | |
---|
4906 | static void CreatePsroffPanel(p) |
---|
4907 | PrintPanelWidget p; |
---|
4908 | { |
---|
4909 | |
---|
4910 | p->printpanel.option_children[PSROFF].child[DIRLAB] = |
---|
4911 | XtVaCreateWidget("dirLabel", |
---|
4912 | xmLabelWidgetClass, |
---|
4913 | p->printpanel.generic_panel_child, |
---|
4914 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
4915 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4916 | XmNbottomWidget, |
---|
4917 | p->printpanel.option_children[PTROFF].child[OPTFIELD], |
---|
4918 | XmNbottomOffset, 10, XmNwidth, 85, XmNlabelString, |
---|
4919 | CS("Font Directory"), NULL); |
---|
4920 | |
---|
4921 | p->printpanel.option_children[PSROFF].num_children++; |
---|
4922 | |
---|
4923 | p->printpanel.option_children[PSROFF].child[DIRFIELD] = |
---|
4924 | XtVaCreateWidget("dirField", |
---|
4925 | xmTextFieldWidgetClass, |
---|
4926 | p->printpanel.generic_panel_child, |
---|
4927 | XmNleftAttachment, XmATTACH_WIDGET, |
---|
4928 | XmNleftOffset, 10, XmNleftWidget, |
---|
4929 | p->printpanel.option_children[PSROFF].child[DIRLAB], |
---|
4930 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4931 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
4932 | p->printpanel.option_children[PTROFF].child[OPTFIELD], |
---|
4933 | XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, |
---|
4934 | 20, NULL); |
---|
4935 | |
---|
4936 | XtAddCallback(p->printpanel.option_children[PSROFF].child[DIRFIELD], |
---|
4937 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
4938 | &p->printpanel.tmp_roff_info.font_dir); |
---|
4939 | |
---|
4940 | p->printpanel.option_children[PSROFF].num_children++; |
---|
4941 | } |
---|
4942 | |
---|
4943 | static void CreatePlotPanel(p) |
---|
4944 | PrintPanelWidget p; |
---|
4945 | { |
---|
4946 | int i; |
---|
4947 | Arg args[10]; |
---|
4948 | Widget tmp; |
---|
4949 | |
---|
4950 | p->printpanel.option_children[PSPLT].child[PROBUTTON] = |
---|
4951 | XtVaCreateWidget("prologButton", |
---|
4952 | xmPushButtonWidgetClass, |
---|
4953 | p->printpanel.generic_panel_child, |
---|
4954 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4955 | XmNbottomWidget, |
---|
4956 | p->printpanel.generic_separator_child, |
---|
4957 | XmNlabelString, CS("..."), XmNrightAttachment, |
---|
4958 | XmATTACH_FORM, XmNrightOffset, 20, NULL); |
---|
4959 | |
---|
4960 | p->printpanel.option_children[PSPLT].num_children++; |
---|
4961 | |
---|
4962 | p->printpanel.option_children[PSPLT].child[PROLAB] = |
---|
4963 | XtVaCreateWidget("prologLabel", |
---|
4964 | xmLabelWidgetClass, |
---|
4965 | p->printpanel.generic_panel_child, |
---|
4966 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
4967 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4968 | XmNbottomWidget, |
---|
4969 | p->printpanel.generic_separator_child , |
---|
4970 | XmNbottomOffset, 10, XmNwidth, 85, XmNlabelString, |
---|
4971 | CS("Prolog File"), NULL); |
---|
4972 | |
---|
4973 | p->printpanel.option_children[PSPLT].num_children++; |
---|
4974 | |
---|
4975 | p->printpanel.option_children[PSPLT].child[PROFIELD] = |
---|
4976 | XtVaCreateWidget("prologField", |
---|
4977 | xmTextFieldWidgetClass, |
---|
4978 | p->printpanel.generic_panel_child, |
---|
4979 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
4980 | 10, XmNleftWidget, |
---|
4981 | p->printpanel.option_children[PSPLT].child[PROLAB], |
---|
4982 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
4983 | XmNrightWidget, |
---|
4984 | p->printpanel.option_children[PSPLT].child[PROBUTTON], |
---|
4985 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
4986 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
4987 | p->printpanel.generic_separator_child, NULL); |
---|
4988 | |
---|
4989 | p->printpanel.option_children[PSPLT].num_children++; |
---|
4990 | |
---|
4991 | i = 0; |
---|
4992 | XtSetArg(args[i], XmNdialogTitle, CS("Prologue File Selection")); i++; |
---|
4993 | XtSetArg(args[i], XmNwidth, 325); i++; |
---|
4994 | XtSetArg(args[i], XmNresizePolicy, XmRESIZE_NONE); i++; |
---|
4995 | p->printpanel.plot_selection_box = |
---|
4996 | XmCreateFileSelectionDialog(p->printpanel.generic_panel_child, |
---|
4997 | "Plot Prologue", args, i); |
---|
4998 | tmp = |
---|
4999 | XmFileSelectionBoxGetChild(p->printpanel.plot_selection_box, |
---|
5000 | XmDIALOG_HELP_BUTTON); |
---|
5001 | XtUnmanageChild(tmp); |
---|
5002 | |
---|
5003 | p->printpanel.plot_data.head = (Widget) p; |
---|
5004 | p->printpanel.plot_data.which_sb = p->printpanel.plot_selection_box; |
---|
5005 | p->printpanel.plot_data.which_field = |
---|
5006 | p->printpanel.option_children[PSPLT].child[PROFIELD]; |
---|
5007 | p->printpanel.plot_data.name = &p->printpanel.tmp_plot_profile; |
---|
5008 | XtAddCallback(p->printpanel.plot_selection_box, XmNokCallback, |
---|
5009 | FileOKCallback, &p->printpanel.plot_data); |
---|
5010 | XtAddCallback(p->printpanel.plot_selection_box, XmNcancelCallback, |
---|
5011 | FileCancelCallback, &p->printpanel.plot_data); |
---|
5012 | |
---|
5013 | XtAddCallback(p->printpanel.option_children[PSPLT].child[PROBUTTON], |
---|
5014 | XmNactivateCallback, ChooseFileCallback, |
---|
5015 | p->printpanel.plot_selection_box); |
---|
5016 | } |
---|
5017 | |
---|
5018 | static void Create630Panel(p) |
---|
5019 | PrintPanelWidget p; |
---|
5020 | { |
---|
5021 | int i; |
---|
5022 | Arg args[20]; |
---|
5023 | |
---|
5024 | i = 0; |
---|
5025 | p->printpanel.pulldown_menu_child = |
---|
5026 | XmCreatePulldownMenu(p->printpanel.generic_panel_child, "sizeMenu", |
---|
5027 | args, i); |
---|
5028 | |
---|
5029 | i = 0; |
---|
5030 | XtSetArg(args[i], XmNwidth, 50); i++; |
---|
5031 | XtSetArg(args[i], XmNheight, 50); i++; |
---|
5032 | p->printpanel.pulldown_buttons[0] = |
---|
5033 | XmCreatePushButtonGadget(p->printpanel.pulldown_menu_child, "10", |
---|
5034 | args, i); |
---|
5035 | XtAddCallback(p->printpanel.pulldown_buttons[0], XmNactivateCallback, |
---|
5036 | SetPitch10, NULL); |
---|
5037 | p->printpanel.pulldown_buttons[1] = |
---|
5038 | XmCreatePushButtonGadget(p->printpanel.pulldown_menu_child, "12", |
---|
5039 | args, i); |
---|
5040 | XtAddCallback(p->printpanel.pulldown_buttons[1], XmNactivateCallback, |
---|
5041 | SetPitch12, NULL); |
---|
5042 | p->printpanel.pulldown_buttons[2] = |
---|
5043 | XmCreatePushButtonGadget(p->printpanel.pulldown_menu_child, "15", |
---|
5044 | args, i); |
---|
5045 | XtAddCallback(p->printpanel.pulldown_buttons[2], XmNactivateCallback, |
---|
5046 | SetPitch15, NULL); |
---|
5047 | XtManageChildren(p->printpanel.pulldown_buttons, 3); |
---|
5048 | |
---|
5049 | i = 0; |
---|
5050 | XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++; |
---|
5051 | XtSetArg(args[i], XmNrightOffset, 20); i++; |
---|
5052 | XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++; |
---|
5053 | XtSetArg(args[i], XmNbottomWidget, |
---|
5054 | p->printpanel.generic_separator_child); i++; |
---|
5055 | XtSetArg(args[i], XmNbottomOffset, 10); i++; |
---|
5056 | XtSetArg(args[i], XmNsubMenuId, p->printpanel.pulldown_menu_child); |
---|
5057 | i++; |
---|
5058 | XtSetArg(args[i], XmNmenuHistory, p->printpanel.pulldown_buttons[1]); |
---|
5059 | i++; |
---|
5060 | p->printpanel.option_children[PS630].child[OPTIONSIZE] = |
---|
5061 | XmCreateOptionMenu(p->printpanel.generic_panel_child, |
---|
5062 | "sizeOptionMenu", args, i); |
---|
5063 | |
---|
5064 | p->printpanel.option_children[PS630].num_children++; |
---|
5065 | |
---|
5066 | p->printpanel.option_children[PS630].child[SIZEOPTLAB] = |
---|
5067 | XtVaCreateWidget("optLabel", xmLabelWidgetClass, |
---|
5068 | p->printpanel.generic_panel_child, |
---|
5069 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
5070 | XmNrightWidget, |
---|
5071 | p->printpanel.option_children[PS630].child[OPTIONSIZE], |
---|
5072 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5073 | XmNbottomWidget, |
---|
5074 | p->printpanel.generic_separator_child, |
---|
5075 | XmNbottomOffset, 10, XmNlabelString, CS("Size"), |
---|
5076 | NULL); |
---|
5077 | |
---|
5078 | p->printpanel.option_children[PS630].num_children++; |
---|
5079 | |
---|
5080 | p->printpanel.option_children[PS630].child[BOLDLAB] = |
---|
5081 | XtVaCreateWidget("boldLabel", |
---|
5082 | xmLabelWidgetClass, |
---|
5083 | p->printpanel.generic_panel_child, |
---|
5084 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5085 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5086 | XmNbottomWidget, |
---|
5087 | p->printpanel.generic_separator_child, |
---|
5088 | XmNbottomOffset, 10, XmNwidth, 85, XmNlabelString, |
---|
5089 | CS("Bold Font"), NULL); |
---|
5090 | |
---|
5091 | p->printpanel.option_children[PS630].num_children++; |
---|
5092 | |
---|
5093 | p->printpanel.option_children[PS630].child[BOLDFIELD] = |
---|
5094 | XtVaCreateWidget("boldField", |
---|
5095 | xmTextFieldWidgetClass, |
---|
5096 | p->printpanel.generic_panel_child, |
---|
5097 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5098 | 10, XmNleftWidget, |
---|
5099 | p->printpanel.option_children[PS630].child[BOLDLAB], |
---|
5100 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
5101 | XmNrightWidget, |
---|
5102 | p->printpanel.option_children[PS630].child[SIZEOPTLAB], |
---|
5103 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5104 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
5105 | p->printpanel.generic_separator_child, NULL); |
---|
5106 | |
---|
5107 | XtAddCallback(p->printpanel.option_children[PS630].child[BOLDFIELD], |
---|
5108 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5109 | &p->printpanel.tmp_ps630_info.bold_font); |
---|
5110 | |
---|
5111 | p->printpanel.option_children[PS630].num_children++; |
---|
5112 | |
---|
5113 | p->printpanel.option_children[PS630].child[BODYLAB] = |
---|
5114 | XtVaCreateWidget("fontLabel", |
---|
5115 | xmLabelWidgetClass, |
---|
5116 | p->printpanel.generic_panel_child, |
---|
5117 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5118 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5119 | XmNbottomWidget, |
---|
5120 | p->printpanel.option_children[PS630].child[BOLDFIELD], |
---|
5121 | XmNbottomOffset, 10, XmNwidth, 85, XmNlabelString, |
---|
5122 | CS("Body Font"), NULL); |
---|
5123 | |
---|
5124 | p->printpanel.option_children[PS630].num_children++; |
---|
5125 | |
---|
5126 | p->printpanel.option_children[PS630].child[BODYFIELD] = |
---|
5127 | XtVaCreateWidget("bodyField", |
---|
5128 | xmTextFieldWidgetClass, |
---|
5129 | p->printpanel.generic_panel_child, |
---|
5130 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5131 | 10, XmNleftWidget, |
---|
5132 | p->printpanel.option_children[PS630].child[BODYLAB], |
---|
5133 | XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, |
---|
5134 | 115, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5135 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
5136 | p->printpanel.option_children[PS630].child[BOLDFIELD], |
---|
5137 | NULL); |
---|
5138 | |
---|
5139 | XtAddCallback(p->printpanel.option_children[PS630].child[BODYFIELD], |
---|
5140 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5141 | &p->printpanel.tmp_ps630_info.body_font); |
---|
5142 | |
---|
5143 | p->printpanel.option_children[PS630].num_children++; |
---|
5144 | } |
---|
5145 | |
---|
5146 | |
---|
5147 | static void Create4014Panel(p) |
---|
5148 | PrintPanelWidget p; |
---|
5149 | { |
---|
5150 | int i; |
---|
5151 | Arg args[10]; |
---|
5152 | |
---|
5153 | p->printpanel.option_children[PS4014].child[SCALELAB] = |
---|
5154 | XtVaCreateWidget("scaleLabel", |
---|
5155 | xmLabelWidgetClass, |
---|
5156 | p->printpanel.generic_panel_child, |
---|
5157 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5158 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5159 | XmNbottomWidget, |
---|
5160 | p->printpanel.generic_separator_child, |
---|
5161 | XmNbottomOffset, 10, XmNwidth, 120, |
---|
5162 | XmNlabelString, CS("Scaled Width (in)"), NULL); |
---|
5163 | |
---|
5164 | p->printpanel.option_children[PS4014].num_children++; |
---|
5165 | |
---|
5166 | p->printpanel.option_children[PS4014].child[SCALEFIELD] = |
---|
5167 | XtVaCreateWidget("scaleField", |
---|
5168 | xmTextFieldWidgetClass, |
---|
5169 | p->printpanel.generic_panel_child, |
---|
5170 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5171 | 10, XmNleftWidget, |
---|
5172 | p->printpanel.option_children[PS4014].child[SCALELAB], |
---|
5173 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5174 | XmNbottomWidget, |
---|
5175 | p->printpanel.generic_separator_child, |
---|
5176 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5177 | |
---|
5178 | XtAddCallback(p->printpanel.option_children[PS4014].child[SCALEFIELD], |
---|
5179 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5180 | &p->printpanel.tmp_ps4014_info.scale); |
---|
5181 | |
---|
5182 | p->printpanel.option_children[PS4014].num_children++; |
---|
5183 | |
---|
5184 | p->printpanel.option_children[PS4014].child[WIDLAB] = |
---|
5185 | XtVaCreateWidget("widthLabel", xmLabelWidgetClass, |
---|
5186 | p->printpanel.generic_panel_child, |
---|
5187 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5188 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5189 | XmNbottomWidget, |
---|
5190 | p->printpanel.option_children[PS4014].child[SCALEFIELD], |
---|
5191 | XmNbottomOffset, 10, XmNwidth, 120, |
---|
5192 | XmNlabelString, CS("Width of image (in)"), NULL); |
---|
5193 | |
---|
5194 | p->printpanel.option_children[PS4014].num_children++; |
---|
5195 | |
---|
5196 | p->printpanel.option_children[PS4014].child[WIDFIELD] = |
---|
5197 | XtVaCreateWidget("widthField", |
---|
5198 | xmTextFieldWidgetClass, |
---|
5199 | p->printpanel.generic_panel_child, |
---|
5200 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5201 | 10, XmNleftWidget, |
---|
5202 | p->printpanel.option_children[PS4014].child[WIDLAB], |
---|
5203 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5204 | XmNbottomWidget, |
---|
5205 | p->printpanel.option_children[PS4014].child[SCALEFIELD], |
---|
5206 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5207 | |
---|
5208 | XtAddCallback(p->printpanel.option_children[PS4014].child[WIDFIELD], |
---|
5209 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5210 | &p->printpanel.tmp_ps4014_info.width); |
---|
5211 | |
---|
5212 | p->printpanel.option_children[PS4014].num_children++; |
---|
5213 | |
---|
5214 | p->printpanel.option_children[PS4014].child[HGTLAB] = |
---|
5215 | XtVaCreateWidget("heightLabel", xmLabelWidgetClass, |
---|
5216 | p->printpanel.generic_panel_child, |
---|
5217 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5218 | 10, XmNleftWidget, |
---|
5219 | p->printpanel.option_children[PS4014].child[WIDFIELD], |
---|
5220 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5221 | XmNbottomWidget, |
---|
5222 | p->printpanel.option_children[PS4014].child[SCALEFIELD], |
---|
5223 | XmNbottomOffset, 10, XmNwidth, 120, |
---|
5224 | XmNlabelString, CS("Height of image (in)"), NULL); |
---|
5225 | |
---|
5226 | p->printpanel.option_children[PS4014].num_children++; |
---|
5227 | |
---|
5228 | p->printpanel.option_children[PS4014].child[HGTFIELD] = |
---|
5229 | XtVaCreateWidget("heightField", xmTextFieldWidgetClass, |
---|
5230 | p->printpanel.generic_panel_child, |
---|
5231 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5232 | 10, XmNleftWidget, |
---|
5233 | p->printpanel.option_children[PS4014].child[HGTLAB], |
---|
5234 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5235 | XmNbottomWidget, |
---|
5236 | p->printpanel.option_children[PS4014].child[SCALEFIELD], |
---|
5237 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5238 | |
---|
5239 | XtAddCallback(p->printpanel.option_children[PS4014].child[HGTFIELD], |
---|
5240 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5241 | &p->printpanel.tmp_ps4014_info.height); |
---|
5242 | |
---|
5243 | p->printpanel.option_children[PS4014].num_children++; |
---|
5244 | |
---|
5245 | p->printpanel.option_children[PS4014].child[LEFTLAB] = |
---|
5246 | XtVaCreateWidget("leftLabel", xmLabelWidgetClass, |
---|
5247 | p->printpanel.generic_panel_child, |
---|
5248 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5249 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5250 | XmNbottomWidget, |
---|
5251 | p->printpanel.option_children[PS4014].child[WIDFIELD], |
---|
5252 | XmNbottomOffset, 10, XmNwidth, 120, |
---|
5253 | XmNlabelString, CS("Left margin (in)"), NULL); |
---|
5254 | |
---|
5255 | p->printpanel.option_children[PS4014].num_children++; |
---|
5256 | |
---|
5257 | p->printpanel.option_children[PS4014].child[LEFTFIELD] = |
---|
5258 | XtVaCreateWidget("leftField", xmTextFieldWidgetClass, |
---|
5259 | p->printpanel.generic_panel_child, |
---|
5260 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5261 | 10, XmNleftWidget, |
---|
5262 | p->printpanel.option_children[PS4014].child[LEFTLAB], |
---|
5263 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5264 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
5265 | p->printpanel.option_children[PS4014].child[WIDFIELD], |
---|
5266 | XmNwidth, 40, NULL); |
---|
5267 | |
---|
5268 | XtAddCallback(p->printpanel.option_children[PS4014].child[LEFTFIELD], |
---|
5269 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5270 | &p->printpanel.tmp_ps4014_info.left); |
---|
5271 | |
---|
5272 | p->printpanel.option_children[PS4014].num_children++; |
---|
5273 | |
---|
5274 | p->printpanel.option_children[PS4014].child[BOTLAB] = |
---|
5275 | XtVaCreateWidget("bottomLabel", xmLabelWidgetClass, |
---|
5276 | p->printpanel.generic_panel_child, |
---|
5277 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5278 | 10, XmNleftWidget, |
---|
5279 | p->printpanel.option_children[PS4014].child[LEFTFIELD], |
---|
5280 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5281 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
5282 | p->printpanel.option_children[PS4014].child[WIDFIELD], |
---|
5283 | XmNwidth, 120, XmNlabelString, |
---|
5284 | CS("Bottom Margin (in)"), NULL); |
---|
5285 | |
---|
5286 | p->printpanel.option_children[PS4014].num_children++; |
---|
5287 | |
---|
5288 | p->printpanel.option_children[PS4014].child[BOTFIELD] = |
---|
5289 | XtVaCreateWidget("bottomField", xmTextFieldWidgetClass, |
---|
5290 | p->printpanel.generic_panel_child, |
---|
5291 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, |
---|
5292 | 10, XmNleftWidget, |
---|
5293 | p->printpanel.option_children[PS4014].child[BOTLAB], |
---|
5294 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5295 | XmNbottomOffset, 10, XmNbottomWidget, |
---|
5296 | p->printpanel.option_children[PS4014].child[WIDFIELD], |
---|
5297 | XmNwidth, 40, NULL); |
---|
5298 | |
---|
5299 | XtAddCallback(p->printpanel.option_children[PS4014].child[BOTFIELD], |
---|
5300 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5301 | &p->printpanel.tmp_ps4014_info.bottom); |
---|
5302 | |
---|
5303 | p->printpanel.option_children[PS4014].num_children++; |
---|
5304 | |
---|
5305 | p->printpanel.option_children[PS4014].child[NOLFTOG] = |
---|
5306 | XtVaCreateWidget("noLFToggle", xmToggleButtonWidgetClass, |
---|
5307 | p->printpanel.generic_panel_child, |
---|
5308 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5309 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5310 | XmNbottomWidget, |
---|
5311 | p->printpanel.option_children[PS4014].child[LEFTFIELD], |
---|
5312 | XmNbottomOffset, 10, XmNlabelString, |
---|
5313 | CS("No LF on CR"), NULL); |
---|
5314 | |
---|
5315 | XtAddCallback(p->printpanel.option_children[PS4014].child[NOLFTOG], |
---|
5316 | XmNvalueChangedCallback, ToggleCallback, |
---|
5317 | &p->printpanel.tmp_ps4014_info.cr_no_lf); |
---|
5318 | |
---|
5319 | p->printpanel.option_children[PS4014].num_children++; |
---|
5320 | |
---|
5321 | p->printpanel.option_children[PS4014].child[NOCRTOG] = |
---|
5322 | XtVaCreateWidget("noCRToggle", xmToggleButtonWidgetClass, |
---|
5323 | p->printpanel.generic_panel_child, |
---|
5324 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5325 | p->printpanel.option_children[PS4014].child[NOLFTOG], |
---|
5326 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
5327 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5328 | p->printpanel.option_children[PS4014].child[LEFTFIELD], |
---|
5329 | XmNbottomOffset, 10, XmNlabelString, |
---|
5330 | CS("No CR on LF"), NULL); |
---|
5331 | |
---|
5332 | XtAddCallback(p->printpanel.option_children[PS4014].child[NOCRTOG], |
---|
5333 | XmNvalueChangedCallback, ToggleCallback, |
---|
5334 | &p->printpanel.tmp_ps4014_info.lf_no_cr); |
---|
5335 | |
---|
5336 | p->printpanel.option_children[PS4014].num_children++; |
---|
5337 | |
---|
5338 | p->printpanel.option_children[PS4014].child[MARTOG] = |
---|
5339 | XtVaCreateWidget("margin2Toggle", xmToggleButtonWidgetClass, |
---|
5340 | p->printpanel.generic_panel_child, |
---|
5341 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5342 | p->printpanel.option_children[PS4014].child[NOCRTOG], |
---|
5343 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
5344 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5345 | p->printpanel.option_children[PS4014].child[LEFTFIELD], |
---|
5346 | XmNbottomOffset, 10, XmNlabelString, |
---|
5347 | CS("Margin 2 Mode"), NULL); |
---|
5348 | |
---|
5349 | XtAddCallback(p->printpanel.option_children[PS4014].child[MARTOG], |
---|
5350 | XmNvalueChangedCallback, ToggleCallback, |
---|
5351 | &p->printpanel.tmp_ps4014_info.margin_2); |
---|
5352 | |
---|
5353 | p->printpanel.option_children[PS4014].num_children++; |
---|
5354 | |
---|
5355 | p->printpanel.option_children[PS4014].child[PORTTOG] = |
---|
5356 | XtVaCreateWidget("portraitToggle", xmToggleButtonWidgetClass, |
---|
5357 | p->printpanel.generic_panel_child, |
---|
5358 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5359 | p->printpanel.option_children[PS4014].child[MARTOG], |
---|
5360 | XmNleftOffset, 10, XmNbottomAttachment, |
---|
5361 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5362 | p->printpanel.option_children[PS4014].child[LEFTFIELD], |
---|
5363 | XmNbottomOffset, 10, XmNlabelString, |
---|
5364 | CS("Portrait"), NULL); |
---|
5365 | |
---|
5366 | XtAddCallback(p->printpanel.option_children[PS4014].child[PORTTOG], |
---|
5367 | XmNvalueChangedCallback, ToggleCallback, |
---|
5368 | &p->printpanel.tmp_ps4014_info.portrait); |
---|
5369 | |
---|
5370 | p->printpanel.option_children[PS4014].num_children++; |
---|
5371 | } |
---|
5372 | |
---|
5373 | static void CreateEnscriptPanel(p) |
---|
5374 | PrintPanelWidget p; |
---|
5375 | { |
---|
5376 | int i; |
---|
5377 | Arg args[20]; |
---|
5378 | |
---|
5379 | p->printpanel.option_children[ENSCRIPT].child[HSIZEFIELD] = |
---|
5380 | XtVaCreateWidget("headerSizeField", xmTextFieldWidgetClass, |
---|
5381 | p->printpanel.generic_panel_child, |
---|
5382 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5383 | XmNbottomWidget, |
---|
5384 | p->printpanel.generic_separator_child, |
---|
5385 | XmNbottomOffset, 10, XmNrightAttachment, |
---|
5386 | XmATTACH_FORM, XmNrightOffset, 110, |
---|
5387 | XmNwidth, 40, NULL); |
---|
5388 | |
---|
5389 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5390 | |
---|
5391 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[HSIZEFIELD], |
---|
5392 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
5393 | &(p->printpanel.tmp_enscript_info.header_font_size)); |
---|
5394 | |
---|
5395 | p->printpanel.option_children[ENSCRIPT].child[HSIZELAB] = |
---|
5396 | XtVaCreateWidget("headerSizeLabel", |
---|
5397 | xmLabelWidgetClass, |
---|
5398 | p->printpanel.generic_panel_child, |
---|
5399 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
5400 | XmNrightWidget, |
---|
5401 | p->printpanel.option_children[ENSCRIPT].child[HSIZEFIELD], |
---|
5402 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5403 | XmNbottomWidget, |
---|
5404 | p->printpanel.generic_separator_child, |
---|
5405 | XmNbottomOffset, 10, XmNlabelString, |
---|
5406 | CS("Point Size"), NULL); |
---|
5407 | |
---|
5408 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5409 | |
---|
5410 | p->printpanel.option_children[ENSCRIPT].child[HFONTLAB] = |
---|
5411 | XtVaCreateWidget("headerFontLabel", xmLabelWidgetClass, |
---|
5412 | p->printpanel.generic_panel_child, |
---|
5413 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5414 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5415 | XmNbottomWidget, |
---|
5416 | p->printpanel.generic_separator_child, |
---|
5417 | XmNbottomOffset, 10, XmNlabelString, |
---|
5418 | CS("Header Font"), XmNwidth, 85, NULL); |
---|
5419 | |
---|
5420 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5421 | |
---|
5422 | p->printpanel.option_children[ENSCRIPT].child[HFONTFIELD] = |
---|
5423 | XtVaCreateWidget("headerFontField", xmTextFieldWidgetClass, |
---|
5424 | p->printpanel.generic_panel_child, |
---|
5425 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5426 | p->printpanel.option_children[ENSCRIPT].child[HFONTLAB], |
---|
5427 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
5428 | XmNrightWidget, |
---|
5429 | p->printpanel.option_children[ENSCRIPT].child[HSIZELAB], |
---|
5430 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5431 | XmNbottomWidget, |
---|
5432 | p->printpanel.generic_separator_child, |
---|
5433 | XmNbottomOffset, 10, NULL); |
---|
5434 | |
---|
5435 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5436 | |
---|
5437 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[HFONTFIELD], |
---|
5438 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5439 | &(p->printpanel.tmp_enscript_info.header_font)); |
---|
5440 | |
---|
5441 | p->printpanel.option_children[ENSCRIPT].child[SIZEFIELD] = |
---|
5442 | XtVaCreateWidget("sizeField", xmTextFieldWidgetClass, |
---|
5443 | p->printpanel.generic_panel_child, |
---|
5444 | XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, |
---|
5445 | 110, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5446 | XmNbottomWidget, |
---|
5447 | p->printpanel.option_children[ENSCRIPT].child[HFONTFIELD], |
---|
5448 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5449 | |
---|
5450 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[SIZEFIELD], |
---|
5451 | XmNvalueChangedCallback, RealTextFieldChange, |
---|
5452 | &(p->printpanel.tmp_enscript_info.font_size)); |
---|
5453 | |
---|
5454 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5455 | |
---|
5456 | p->printpanel.option_children[ENSCRIPT].child[SIZELAB] = |
---|
5457 | XtVaCreateWidget("sizeLabel", xmLabelWidgetClass, |
---|
5458 | p->printpanel.generic_panel_child, |
---|
5459 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
5460 | XmNrightWidget, |
---|
5461 | p->printpanel.option_children[ENSCRIPT].child[SIZEFIELD], |
---|
5462 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5463 | XmNbottomWidget, |
---|
5464 | p->printpanel.option_children[ENSCRIPT].child[HFONTFIELD], |
---|
5465 | XmNbottomOffset, 10, XmNlabelString, |
---|
5466 | CS("Point Size"), NULL); |
---|
5467 | |
---|
5468 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5469 | |
---|
5470 | p->printpanel.option_children[ENSCRIPT].child[FONTLAB] = |
---|
5471 | XtVaCreateWidget("fontLabel", xmLabelWidgetClass, |
---|
5472 | p->printpanel.generic_panel_child, |
---|
5473 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5474 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5475 | XmNbottomWidget, |
---|
5476 | p->printpanel.option_children[ENSCRIPT].child[HFONTFIELD], |
---|
5477 | XmNbottomOffset, 10, XmNlabelString, |
---|
5478 | CS("Body Font"), XmNwidth, 85, NULL); |
---|
5479 | |
---|
5480 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5481 | |
---|
5482 | p->printpanel.option_children[ENSCRIPT].child[FONTFIELD] = |
---|
5483 | XtVaCreateWidget("fontField", xmTextFieldWidgetClass, |
---|
5484 | p->printpanel.generic_panel_child, |
---|
5485 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5486 | p->printpanel.option_children[ENSCRIPT].child[FONTLAB], |
---|
5487 | XmNrightAttachment, XmATTACH_WIDGET, |
---|
5488 | XmNrightWidget, |
---|
5489 | p->printpanel.option_children[ENSCRIPT].child[SIZELAB], |
---|
5490 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5491 | XmNbottomWidget, |
---|
5492 | p->printpanel.option_children[ENSCRIPT].child[HFONTFIELD], |
---|
5493 | XmNbottomOffset, 10, NULL); |
---|
5494 | |
---|
5495 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[FONTFIELD], |
---|
5496 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5497 | &(p->printpanel.tmp_enscript_info.font)); |
---|
5498 | |
---|
5499 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5500 | |
---|
5501 | p->printpanel.option_children[ENSCRIPT].child[HEADLAB] = |
---|
5502 | XtVaCreateWidget("headerLabel", xmLabelWidgetClass, |
---|
5503 | p->printpanel.generic_panel_child, |
---|
5504 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5505 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5506 | XmNbottomWidget, |
---|
5507 | p->printpanel.option_children[ENSCRIPT].child[FONTFIELD], |
---|
5508 | XmNbottomOffset, 10, XmNlabelString, CS("Header"), |
---|
5509 | XmNwidth, 85, NULL); |
---|
5510 | |
---|
5511 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5512 | |
---|
5513 | p->printpanel.option_children[ENSCRIPT].child[HEADFIELD] = |
---|
5514 | XtVaCreateWidget("headerField", xmTextFieldWidgetClass, |
---|
5515 | p->printpanel.generic_panel_child, |
---|
5516 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5517 | p->printpanel.option_children[ENSCRIPT].child[HEADLAB], |
---|
5518 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5519 | XmNbottomWidget, |
---|
5520 | p->printpanel.option_children[ENSCRIPT].child[FONTFIELD], |
---|
5521 | XmNbottomOffset, 10, XmNrightAttachment, |
---|
5522 | XmATTACH_FORM, XmNrightOffset, 20, XmNwidth, 150, |
---|
5523 | NULL); |
---|
5524 | |
---|
5525 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5526 | |
---|
5527 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[HEADFIELD], |
---|
5528 | XmNvalueChangedCallback, StringTextFieldChange, |
---|
5529 | &(p->printpanel.tmp_enscript_info.header)); |
---|
5530 | |
---|
5531 | p->printpanel.option_children[ENSCRIPT].child[TABLAB] = |
---|
5532 | XtVaCreateWidget("tabLabel", xmLabelWidgetClass, |
---|
5533 | p->printpanel.generic_panel_child, |
---|
5534 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5535 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5536 | XmNbottomWidget, |
---|
5537 | p->printpanel.option_children[ENSCRIPT].child[HEADFIELD], |
---|
5538 | XmNbottomOffset, 10, XmNlabelString, |
---|
5539 | CS("Tab Width"), XmNwidth, 85, NULL); |
---|
5540 | |
---|
5541 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5542 | |
---|
5543 | p->printpanel.option_children[ENSCRIPT].child[TABFIELD] = |
---|
5544 | XtVaCreateWidget("tabField", xmTextFieldWidgetClass, |
---|
5545 | p->printpanel.generic_panel_child, |
---|
5546 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5547 | p->printpanel.option_children[ENSCRIPT].child[TABLAB], |
---|
5548 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5549 | XmNbottomWidget, |
---|
5550 | p->printpanel.option_children[ENSCRIPT].child[HEADFIELD], |
---|
5551 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5552 | |
---|
5553 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5554 | |
---|
5555 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[TABFIELD], |
---|
5556 | XmNvalueChangedCallback, IntTextFieldChange, |
---|
5557 | &(p->printpanel.tmp_enscript_info.tab_width)); |
---|
5558 | |
---|
5559 | p->printpanel.option_children[ENSCRIPT].child[LINELAB] = |
---|
5560 | XtVaCreateWidget("linesLabel", xmLabelWidgetClass, |
---|
5561 | p->printpanel.generic_panel_child, |
---|
5562 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5563 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5564 | XmNbottomWidget, |
---|
5565 | p->printpanel.option_children[ENSCRIPT].child[TABFIELD], |
---|
5566 | XmNbottomOffset, 10, XmNlabelString, CS("Lines"), |
---|
5567 | XmNwidth, 85, NULL); |
---|
5568 | |
---|
5569 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5570 | |
---|
5571 | p->printpanel.option_children[ENSCRIPT].child[LINEFIELD] = |
---|
5572 | XtVaCreateWidget("linesField", xmTextFieldWidgetClass, |
---|
5573 | p->printpanel.generic_panel_child, |
---|
5574 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5575 | p->printpanel.option_children[ENSCRIPT].child[LINELAB], |
---|
5576 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5577 | XmNbottomWidget, |
---|
5578 | p->printpanel.option_children[ENSCRIPT].child[TABFIELD], |
---|
5579 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5580 | |
---|
5581 | |
---|
5582 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[LINEFIELD], |
---|
5583 | XmNvalueChangedCallback, IntTextFieldChange, |
---|
5584 | &(p->printpanel.tmp_enscript_info.lines)); |
---|
5585 | |
---|
5586 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5587 | |
---|
5588 | p->printpanel.option_children[ENSCRIPT].child[COLLAB] = |
---|
5589 | XtVaCreateWidget("columnsLabel", xmLabelWidgetClass, |
---|
5590 | p->printpanel.generic_panel_child, |
---|
5591 | XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, |
---|
5592 | 10, XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5593 | XmNbottomWidget, |
---|
5594 | p->printpanel.option_children[ENSCRIPT].child[LINEFIELD], |
---|
5595 | XmNbottomOffset, 10, XmNlabelString, |
---|
5596 | CS("Columns"), XmNwidth, 85, NULL); |
---|
5597 | |
---|
5598 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5599 | |
---|
5600 | p->printpanel.option_children[ENSCRIPT].child[COLFIELD] = |
---|
5601 | XtVaCreateWidget("columnsField", xmTextFieldWidgetClass, |
---|
5602 | p->printpanel.generic_panel_child, |
---|
5603 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5604 | p->printpanel.option_children[ENSCRIPT].child[COLLAB], |
---|
5605 | XmNbottomAttachment, XmATTACH_WIDGET, |
---|
5606 | XmNbottomWidget, |
---|
5607 | p->printpanel.option_children[ENSCRIPT].child[LINEFIELD], |
---|
5608 | XmNbottomOffset, 10, XmNwidth, 40, NULL); |
---|
5609 | |
---|
5610 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[COLFIELD], |
---|
5611 | XmNvalueChangedCallback, IntTextFieldChange, |
---|
5612 | &(p->printpanel.tmp_enscript_info.columns)); |
---|
5613 | |
---|
5614 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5615 | |
---|
5616 | p->printpanel.option_children[ENSCRIPT].child[NOHEAD] = |
---|
5617 | XtVaCreateWidget("noHeadingsToggle", xmToggleButtonWidgetClass, |
---|
5618 | p->printpanel.generic_panel_child, |
---|
5619 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5620 | p->printpanel.option_children[ENSCRIPT].child[COLFIELD], |
---|
5621 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5622 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5623 | p->printpanel.option_children[ENSCRIPT].child[HEADFIELD], |
---|
5624 | XmNbottomOffset, 10, XmNlabelString, |
---|
5625 | CS("No page headings"), NULL); |
---|
5626 | |
---|
5627 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[NOHEAD], |
---|
5628 | XmNvalueChangedCallback, ToggleCallback, |
---|
5629 | &(p->printpanel.tmp_enscript_info.no_header)); |
---|
5630 | |
---|
5631 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5632 | |
---|
5633 | p->printpanel.option_children[ENSCRIPT].child[LP] = |
---|
5634 | XtVaCreateWidget("linePrinterToggle", xmToggleButtonWidgetClass, |
---|
5635 | p->printpanel.generic_panel_child, |
---|
5636 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5637 | p->printpanel.option_children[ENSCRIPT].child[COLFIELD], |
---|
5638 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5639 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5640 | p->printpanel.option_children[ENSCRIPT].child[NOHEAD], |
---|
5641 | XmNlabelString, CS("Line Printer Mode"), NULL); |
---|
5642 | |
---|
5643 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5644 | XmNvalueChangedCallback, ToggleCallback, |
---|
5645 | &(p->printpanel.tmp_enscript_info.lpt_mode)); |
---|
5646 | |
---|
5647 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5648 | |
---|
5649 | p->printpanel.option_children[ENSCRIPT].child[GAUDY] = |
---|
5650 | XtVaCreateWidget("gaudyToggle", xmToggleButtonWidgetClass, |
---|
5651 | p->printpanel.generic_panel_child, |
---|
5652 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5653 | p->printpanel.option_children[ENSCRIPT].child[COLFIELD], |
---|
5654 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5655 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5656 | p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5657 | XmNlabelString, CS("Gaudy Mode"), NULL); |
---|
5658 | |
---|
5659 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[GAUDY], |
---|
5660 | XmNvalueChangedCallback, ToggleCallback, |
---|
5661 | &(p->printpanel.tmp_enscript_info.gaudy)); |
---|
5662 | |
---|
5663 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5664 | |
---|
5665 | p->printpanel.option_children[ENSCRIPT].child[OVERRIDE] = |
---|
5666 | XtVaCreateWidget("noRotateToggle", xmToggleButtonWidgetClass, |
---|
5667 | p->printpanel.generic_panel_child, |
---|
5668 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5669 | p->printpanel.option_children[ENSCRIPT].child[COLFIELD], |
---|
5670 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5671 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5672 | p->printpanel.option_children[ENSCRIPT].child[GAUDY], |
---|
5673 | XmNlabelString, CS("No rotation"), NULL); |
---|
5674 | |
---|
5675 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[OVERRIDE], |
---|
5676 | XmNvalueChangedCallback, ToggleCallback, |
---|
5677 | &(p->printpanel.tmp_enscript_info.norotate)); |
---|
5678 | |
---|
5679 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5680 | |
---|
5681 | p->printpanel.option_children[ENSCRIPT].child[ROTATE] = |
---|
5682 | XtVaCreateWidget("rotateToggle", xmToggleButtonWidgetClass, |
---|
5683 | p->printpanel.generic_panel_child, |
---|
5684 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5685 | p->printpanel.option_children[ENSCRIPT].child[COLFIELD], |
---|
5686 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5687 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5688 | p->printpanel.option_children[ENSCRIPT].child[OVERRIDE], |
---|
5689 | XmNlabelString, CS("Rotate"), NULL); |
---|
5690 | |
---|
5691 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[ROTATE], |
---|
5692 | XmNvalueChangedCallback, ToggleCallback, |
---|
5693 | &(p->printpanel.tmp_enscript_info.rotated)); |
---|
5694 | |
---|
5695 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5696 | |
---|
5697 | p->printpanel.option_children[ENSCRIPT].child[NOBURST] = |
---|
5698 | XtVaCreateWidget("noburstToggle", xmToggleButtonWidgetClass, |
---|
5699 | p->printpanel.generic_panel_child, |
---|
5700 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5701 | p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5702 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5703 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5704 | p->printpanel.option_children[ENSCRIPT].child[HEADFIELD], |
---|
5705 | XmNbottomOffset, 10, XmNlabelString, |
---|
5706 | CS("Suppress burst page"), NULL); |
---|
5707 | |
---|
5708 | |
---|
5709 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[NOBURST], |
---|
5710 | XmNvalueChangedCallback, ToggleCallback, |
---|
5711 | &(p->printpanel.tmp_enscript_info.no_burst_page)); |
---|
5712 | |
---|
5713 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5714 | |
---|
5715 | p->printpanel.option_children[ENSCRIPT].child[QUIET] = |
---|
5716 | XtVaCreateWidget("quietToggle", xmToggleButtonWidgetClass, |
---|
5717 | p->printpanel.generic_panel_child, |
---|
5718 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5719 | p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5720 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5721 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5722 | p->printpanel.option_children[ENSCRIPT].child[NOBURST], |
---|
5723 | XmNlabelString, CS("Quiet Mode"), NULL); |
---|
5724 | |
---|
5725 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[QUIET], |
---|
5726 | XmNvalueChangedCallback, ToggleCallback, |
---|
5727 | &(p->printpanel.tmp_enscript_info.quiet_mode)); |
---|
5728 | |
---|
5729 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5730 | |
---|
5731 | p->printpanel.option_children[ENSCRIPT].child[MISSCHAR] = |
---|
5732 | XtVaCreateWidget("missingCharsToggle", xmToggleButtonWidgetClass, |
---|
5733 | p->printpanel.generic_panel_child, |
---|
5734 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5735 | p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5736 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5737 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5738 | p->printpanel.option_children[ENSCRIPT].child[QUIET], |
---|
5739 | XmNlabelString, CS("List missing characters"), |
---|
5740 | NULL); |
---|
5741 | |
---|
5742 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[MISSCHAR], |
---|
5743 | XmNvalueChangedCallback, ToggleCallback, |
---|
5744 | &(p->printpanel.tmp_enscript_info.report_missing_chars)); |
---|
5745 | |
---|
5746 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5747 | |
---|
5748 | p->printpanel.option_children[ENSCRIPT].child[IGNORE] = |
---|
5749 | XtVaCreateWidget("ignoreToggle", xmToggleButtonWidgetClass, |
---|
5750 | p->printpanel.generic_panel_child, |
---|
5751 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5752 | p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5753 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5754 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5755 | p->printpanel.option_children[ENSCRIPT].child[MISSCHAR], |
---|
5756 | XmNlabelString, CS("Ignore garbage"), NULL); |
---|
5757 | |
---|
5758 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[IGNORE], |
---|
5759 | XmNvalueChangedCallback, ToggleCallback, |
---|
5760 | &(p->printpanel.tmp_enscript_info.ignore_binary)); |
---|
5761 | |
---|
5762 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5763 | |
---|
5764 | p->printpanel.option_children[ENSCRIPT].child[TRUNC] = |
---|
5765 | XtVaCreateWidget("truncateToggle", xmToggleButtonWidgetClass, |
---|
5766 | p->printpanel.generic_panel_child, |
---|
5767 | XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, |
---|
5768 | p->printpanel.option_children[ENSCRIPT].child[LP], |
---|
5769 | XmNleftOffset, 30, XmNbottomAttachment, |
---|
5770 | XmATTACH_WIDGET, XmNbottomWidget, |
---|
5771 | p->printpanel.option_children[ENSCRIPT].child[IGNORE], |
---|
5772 | XmNlabelString, CS("Truncate"), NULL); |
---|
5773 | |
---|
5774 | XtAddCallback(p->printpanel.option_children[ENSCRIPT].child[TRUNC], |
---|
5775 | XmNvalueChangedCallback, ToggleCallback, |
---|
5776 | &(p->printpanel.tmp_enscript_info.truncate_lines)); |
---|
5777 | |
---|
5778 | p->printpanel.option_children[ENSCRIPT].num_children++; |
---|
5779 | } |
---|
5780 | |
---|
5781 | #define TRUE 1 |
---|
5782 | #define FALSE 0 |
---|
5783 | |
---|
5784 | #ifdef BSD |
---|
5785 | static int GetPrinterList(plist, nprinters, maxprinters, filename) |
---|
5786 | char *plist[]; |
---|
5787 | int *nprinters; |
---|
5788 | int maxprinters; |
---|
5789 | char *filename; |
---|
5790 | { |
---|
5791 | FILE *fp; |
---|
5792 | char buf[1024]; |
---|
5793 | char *p; |
---|
5794 | int i; |
---|
5795 | char *pname; |
---|
5796 | |
---|
5797 | if ((fp = fopen(filename, "r")) == NULL) |
---|
5798 | return -1; |
---|
5799 | |
---|
5800 | i = 0; |
---|
5801 | |
---|
5802 | while (fgets(buf, 1024, fp)) { |
---|
5803 | if (buf[0] == '#') |
---|
5804 | continue; |
---|
5805 | if (buf[0] == '\t' || buf[0] == ':') |
---|
5806 | continue; |
---|
5807 | if (buf[0] == '\n' || buf[0] == ' ') |
---|
5808 | continue; |
---|
5809 | pname = buf; |
---|
5810 | |
---|
5811 | if ((p = strchr(buf,'|')) != NULL) |
---|
5812 | *p = '\0'; |
---|
5813 | else if ((p = strchr(buf, ':')) != NULL) |
---|
5814 | *p = '\0'; |
---|
5815 | else if ((p = strchr(buf, '\n')) != NULL) |
---|
5816 | *p = '\0'; |
---|
5817 | else { |
---|
5818 | fclose(fp); |
---|
5819 | return -2; |
---|
5820 | } |
---|
5821 | if (i == maxprinters) { |
---|
5822 | fclose(fp); |
---|
5823 | return -3; |
---|
5824 | } |
---|
5825 | plist[i] = (char *) malloc(strlen(pname)+1); |
---|
5826 | strcpy (plist[i], pname); |
---|
5827 | i++; |
---|
5828 | } |
---|
5829 | *nprinters = i; |
---|
5830 | fclose(fp); |
---|
5831 | return 0; |
---|
5832 | } |
---|
5833 | #endif /* BSD */ |
---|
5834 | |
---|
5835 | #ifdef SYSV |
---|
5836 | static int GetSysVPrinterList(plist, nprinters, maxprinters) |
---|
5837 | char *plist[]; |
---|
5838 | int *nprinters; |
---|
5839 | int maxprinters; |
---|
5840 | { |
---|
5841 | FILE *fp; |
---|
5842 | char fname[255]; |
---|
5843 | char buf[1024]; |
---|
5844 | char *pname, *p; |
---|
5845 | int i; |
---|
5846 | |
---|
5847 | |
---|
5848 | p = getenv("PSLIBDIR"); |
---|
5849 | if (p) |
---|
5850 | strcpy(fname, p); |
---|
5851 | else |
---|
5852 | strcpy(fname, PSLibDir); |
---|
5853 | strcat(fname, "/printer.list"); |
---|
5854 | if ((fp = fopen(fname, "r")) == NULL) |
---|
5855 | return FALSE; |
---|
5856 | |
---|
5857 | i = 0; |
---|
5858 | while (fgets(buf, 1024, fp)) { |
---|
5859 | if (buf[0] == '#') |
---|
5860 | continue; |
---|
5861 | pname = buf; |
---|
5862 | if (p = strchr(buf, '\n')) *p = '\0'; |
---|
5863 | if (i == maxprinters) { |
---|
5864 | fclose(fp); |
---|
5865 | return FALSE; |
---|
5866 | } |
---|
5867 | plist[i] = (char *) malloc(strlen(pname)+1); |
---|
5868 | strcpy(plist[i], pname); |
---|
5869 | i++; |
---|
5870 | } |
---|
5871 | *nprinters = i; |
---|
5872 | fclose(fp); |
---|
5873 | return TRUE; |
---|
5874 | } |
---|
5875 | #endif /* SYSV */ |
---|
5876 | |
---|
5877 | |
---|
5878 | static int addarg(argstr, nargs, arg) |
---|
5879 | char *argstr[]; |
---|
5880 | int nargs; |
---|
5881 | char *arg; |
---|
5882 | { |
---|
5883 | char *p; |
---|
5884 | |
---|
5885 | if ((p = (char *) malloc(strlen(arg) + 1)) == NULL) { |
---|
5886 | return -1; |
---|
5887 | } |
---|
5888 | strcpy(p, arg); |
---|
5889 | argstr[nargs] = p; |
---|
5890 | argstr[nargs+1] = NULL; |
---|
5891 | return 1; |
---|
5892 | } |
---|
5893 | |
---|
5894 | |
---|
5895 | static void AddToCompoundList(xstr, msg) |
---|
5896 | XmString *xstr; |
---|
5897 | char *msg; |
---|
5898 | { |
---|
5899 | if (*xstr != NULL) |
---|
5900 | *xstr = XmStringConcat(*xstr, XmStringSeparatorCreate()); |
---|
5901 | *xstr = XmStringConcat(*xstr, CS(msg)); |
---|
5902 | } |
---|