|
|
1.1 root 1: /*
2: Prevous - dlgPrinter.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
6: */
7: const char DlgPrinter_fileid[] = "Previous dlgPrinter.c : " __DATE__ " " __TIME__;
8:
9: #include "main.h"
10: #include "configuration.h"
11: #include "dialog.h"
12: #include "sdlgui.h"
13: #include "file.h"
14: #include "paths.h"
15:
16:
17: #define DLGPRINT_CONNECTED 3
18: #define DLGPRINT_A4 6
19: #define DLGPRINT_LETTER 7
20: #define DLGPRINT_B5 8
21: #define DLGPRINT_LEGAL 9
22:
23: #define DLGPRINT_BROWSE 12
24: #define DLGPRINT_DIRECTORY 13
25:
26: #define DLGPRINT_EXIT 14
27:
28: char dlgprint_dirname[64];
29:
30: /* The Printer options dialog: */
31: static SGOBJ printerdlg[] =
32: {
33: { SGBOX, 0, 0, 0,0, 47,23, NULL },
34: { SGTEXT, 0, 0, 16,1, 9,1, "Printer options" },
35:
36: { SGBOX, 0, 0, 1,4, 22,8, NULL },
37: { SGCHECKBOX, 0, 0, 2,5, 19,1, "Printer connected" },
38:
39: { SGBOX, 0, 0, 24,4, 22,8, NULL },
40: { SGTEXT, 0, 0, 25,5, 30,1, "Paper size:" },
41: { SGRADIOBUT, 0, 0, 25,7, 4,1, "A4" },
42: { SGRADIOBUT, 0, 0, 25,8, 8,1, "Letter" },
43: { SGRADIOBUT, 0, 0, 25,9, 4,1, "B5" },
44: { SGRADIOBUT, 0, 0, 25,10, 7,1, "Legal" },
45:
46: { SGBOX, 0, 0, 1,13, 45,5, NULL },
47: { SGTEXT, 0, 0, 2,14, 19,1, "Directory to save printer output:" },
48: { SGBUTTON, 0, 0, 37,14, 8,1, "Browse" },
49: { SGTEXT, 0, 0, 2,16, 43,1, dlgprint_dirname },
50:
51: { SGBUTTON, SG_DEFAULT, 0, 13,20, 21,1, "Back to main menu" },
52: { -1, 0, 0, 0,0, 0,0, NULL }
53: };
54:
55:
56:
57: /*-----------------------------------------------------------------------*/
58: /**
59: * Show and process the Printer options dialog.
60: */
61: void DlgPrinter_Main(void)
62: {
63: int but;
64:
65: SDLGui_CenterDlg(printerdlg);
66:
67: /* Set up the dialog from actual values */
68: if (ConfigureParams.Printer.bPrinterConnected)
69: printerdlg[DLGPRINT_CONNECTED].state |= SG_SELECTED;
70: else
71: printerdlg[DLGPRINT_CONNECTED].state &= ~SG_SELECTED;
72:
73: printerdlg[DLGPRINT_A4].state &= ~SG_SELECTED;
74: printerdlg[DLGPRINT_LETTER].state &= ~SG_SELECTED;
75: printerdlg[DLGPRINT_B5].state &= ~SG_SELECTED;
76: printerdlg[DLGPRINT_LEGAL].state &= ~SG_SELECTED;
77:
78: switch (ConfigureParams.Printer.nPaperSize) {
79: case PAPER_A4:
80: printerdlg[DLGPRINT_A4].state |= SG_SELECTED;
81: break;
82: case PAPER_LETTER:
83: printerdlg[DLGPRINT_LETTER].state |= SG_SELECTED;
84: break;
85: case PAPER_B5:
86: printerdlg[DLGPRINT_B5].state |= SG_SELECTED;
87: break;
88: case PAPER_LEGAL:
89: printerdlg[DLGPRINT_LEGAL].state |= SG_SELECTED;
90: break;
91:
92: default:
93: printerdlg[DLGPRINT_A4].state |= SG_SELECTED;
94: break;
95: }
96:
97: File_ShrinkName(dlgprint_dirname, ConfigureParams.Printer.szPrintToFileName,
98: printerdlg[DLGPRINT_DIRECTORY].w);
99:
100:
101: /* Draw and process the dialog */
102:
103: do
104: {
105: but = SDLGui_DoDialog(printerdlg, NULL);
106:
107: if (but == DLGPRINT_BROWSE) {
108: SDLGui_DirectorySelect(dlgprint_dirname,
109: ConfigureParams.Printer.szPrintToFileName,
110: printerdlg[DLGPRINT_DIRECTORY].w);
111: }
112: }
113: while (but != DLGPRINT_EXIT && but != SDLGUI_QUIT
114: && but != SDLGUI_ERROR && !bQuitProgram);
115:
116:
117: /* Read values from dialog */
118: ConfigureParams.Printer.bPrinterConnected = printerdlg[DLGPRINT_CONNECTED].state & SG_SELECTED;
119:
120: if (printerdlg[DLGPRINT_A4].state & SG_SELECTED)
121: ConfigureParams.Printer.nPaperSize = PAPER_A4;
122: else if (printerdlg[DLGPRINT_LETTER].state & SG_SELECTED)
123: ConfigureParams.Printer.nPaperSize = PAPER_LETTER;
124: else if (printerdlg[DLGPRINT_B5].state & SG_SELECTED)
125: ConfigureParams.Printer.nPaperSize = PAPER_B5;
126: else if (printerdlg[DLGPRINT_LEGAL].state & SG_SELECTED)
127: ConfigureParams.Printer.nPaperSize = PAPER_LEGAL;
128: else
129: ConfigureParams.Printer.nPaperSize = PAPER_A4;
130: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.