|
|
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,22, NULL }, ! 34: { SGTEXT, 0, 0, 16,1, 9,1, "Printer options" }, ! 35: ! 36: { SGBOX, 0, 0, 1,3, 22,8, NULL }, ! 37: { SGCHECKBOX, 0, 0, 2,4, 19,1, "Printer connected" }, ! 38: ! 39: { SGBOX, 0, 0, 24,3, 22,8, NULL }, ! 40: { SGTEXT, 0, 0, 25,4, 30,1, "Paper size:" }, ! 41: { SGRADIOBUT, 0, 0, 25,6, 4,1, "A4" }, ! 42: { SGRADIOBUT, 0, 0, 25,7, 8,1, "Letter" }, ! 43: { SGRADIOBUT, 0, 0, 25,8, 4,1, "B5" }, ! 44: { SGRADIOBUT, 0, 0, 25,9, 7,1, "Legal" }, ! 45: #if HAVE_LIBPNG ! 46: { SGBOX, 0, 0, 1,12, 45,5, NULL }, ! 47: { SGTEXT, 0, 0, 2,13, 19,1, "Directory to save printer output:" }, ! 48: { SGBUTTON, 0, 0, 37,13, 8,1, "Browse" }, ! 49: { SGTEXT, 0, 0, 2,15, 43,1, dlgprint_dirname }, ! 50: #else ! 51: { SGBOX, 0, 0, 1,12, 45,5, NULL }, ! 52: { SGTEXT, 0, 0, 2,13, 40,1, "This build of Previous is not configured" }, ! 53: { SGTEXT, 0, 0, 2,14, 1,1, "" }, ! 54: { SGTEXT, 0, 0, 2,15, 17,1, "for PNG printing." }, ! 55: #endif ! 56: { SGBUTTON, SG_DEFAULT, 0, 13,19, 21,1, "Back to main menu" }, ! 57: { -1, 0, 0, 0,0, 0,0, NULL } ! 58: }; ! 59: ! 60: ! 61: ! 62: /*-----------------------------------------------------------------------*/ ! 63: /** ! 64: * Show and process the Printer options dialog. ! 65: */ ! 66: void DlgPrinter_Main(void) ! 67: { ! 68: int but; ! 69: ! 70: SDLGui_CenterDlg(printerdlg); ! 71: ! 72: /* Set up the dialog from actual values */ ! 73: if (ConfigureParams.Printer.bPrinterConnected) ! 74: printerdlg[DLGPRINT_CONNECTED].state |= SG_SELECTED; ! 75: else ! 76: printerdlg[DLGPRINT_CONNECTED].state &= ~SG_SELECTED; ! 77: ! 78: printerdlg[DLGPRINT_A4].state &= ~SG_SELECTED; ! 79: printerdlg[DLGPRINT_LETTER].state &= ~SG_SELECTED; ! 80: printerdlg[DLGPRINT_B5].state &= ~SG_SELECTED; ! 81: printerdlg[DLGPRINT_LEGAL].state &= ~SG_SELECTED; ! 82: ! 83: switch (ConfigureParams.Printer.nPaperSize) { ! 84: case PAPER_A4: ! 85: printerdlg[DLGPRINT_A4].state |= SG_SELECTED; ! 86: break; ! 87: case PAPER_LETTER: ! 88: printerdlg[DLGPRINT_LETTER].state |= SG_SELECTED; ! 89: break; ! 90: case PAPER_B5: ! 91: printerdlg[DLGPRINT_B5].state |= SG_SELECTED; ! 92: break; ! 93: case PAPER_LEGAL: ! 94: printerdlg[DLGPRINT_LEGAL].state |= SG_SELECTED; ! 95: break; ! 96: ! 97: default: ! 98: printerdlg[DLGPRINT_A4].state |= SG_SELECTED; ! 99: break; ! 100: } ! 101: ! 102: File_ShrinkName(dlgprint_dirname, ConfigureParams.Printer.szPrintToFileName, ! 103: printerdlg[DLGPRINT_DIRECTORY].w); ! 104: ! 105: ! 106: /* Draw and process the dialog */ ! 107: ! 108: do ! 109: { ! 110: but = SDLGui_DoDialog(printerdlg, NULL); ! 111: ! 112: if (but == DLGPRINT_BROWSE) { ! 113: SDLGui_DirectorySelect(dlgprint_dirname, ! 114: ConfigureParams.Printer.szPrintToFileName, ! 115: printerdlg[DLGPRINT_DIRECTORY].w); ! 116: } ! 117: } ! 118: while (but != DLGPRINT_EXIT && but != SDLGUI_QUIT ! 119: && but != SDLGUI_ERROR && !bQuitProgram); ! 120: ! 121: ! 122: /* Read values from dialog */ ! 123: ConfigureParams.Printer.bPrinterConnected = printerdlg[DLGPRINT_CONNECTED].state & SG_SELECTED; ! 124: ! 125: if (printerdlg[DLGPRINT_A4].state & SG_SELECTED) ! 126: ConfigureParams.Printer.nPaperSize = PAPER_A4; ! 127: else if (printerdlg[DLGPRINT_LETTER].state & SG_SELECTED) ! 128: ConfigureParams.Printer.nPaperSize = PAPER_LETTER; ! 129: else if (printerdlg[DLGPRINT_B5].state & SG_SELECTED) ! 130: ConfigureParams.Printer.nPaperSize = PAPER_B5; ! 131: else if (printerdlg[DLGPRINT_LEGAL].state & SG_SELECTED) ! 132: ConfigureParams.Printer.nPaperSize = PAPER_LEGAL; ! 133: else ! 134: ConfigureParams.Printer.nPaperSize = PAPER_A4; ! 135: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.