Annotation of hatari/src/gui-sdl/dlgDevice.c, revision 1.1.1.11

1.1       root        1: /*
                      2:   Hatari - dlgDevice.c
                      3: 
1.1.1.9   root        4:   This file is distributed under the GNU General Public License, version 2
                      5:   or at your option any later version. Read the file gpl.txt for details.
1.1       root        6: 
                      7:   Device (Printer etc.) setup dialog
                      8: */
1.1.1.7   root        9: const char DlgDevice_fileid[] = "Hatari dlgDevice.c : " __DATE__ " " __TIME__;
1.1       root       10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "dialog.h"
                     14: #include "sdlgui.h"
                     15: #include "file.h"
                     16: #include "screen.h"
                     17: 
                     18: 
                     19: #define DEVDLG_PRNENABLE       3
1.1.1.3   root       20: #define DEVDLG_PRNBROWSE       5
1.1       root       21: #define DEVDLG_PRNFILENAME     6
                     22: #define DEVDLG_RS232ENABLE     8
                     23: #define DEVDLG_RS232OUTBROWSE  10
                     24: #define DEVDLG_RS232OUTNAME    11
                     25: #define DEVDLG_RS232INBROWSE   13
                     26: #define DEVDLG_RS232INNAME     14
                     27: #define DEVDLG_MIDIENABLE      16
1.1.1.6   root       28: #define DEVDLG_MIDIINBROWSE    18
                     29: #define DEVDLG_MIDIINNAME      19
                     30: #define DEVDLG_MIDIOUTBROWSE   21
                     31: #define DEVDLG_MIDIOUTNAME     22
                     32: #define DEVDLG_EXIT            23
1.1       root       33: 
                     34: 
1.1.1.4   root       35: #define MAX_DLG_FILENAME 46+1
                     36: static char dlgPrinterName[MAX_DLG_FILENAME];
                     37: static char dlgRs232OutName[MAX_DLG_FILENAME];
                     38: static char dlgRs232InName[MAX_DLG_FILENAME];
1.1.1.6   root       39: static char dlgMidiInName[MAX_DLG_FILENAME];
1.1.1.4   root       40: static char dlgMidiOutName[MAX_DLG_FILENAME];
1.1       root       41: 
                     42: /* The devices dialog: */
                     43: static SGOBJ devicedlg[] =
                     44: {
1.1.1.6   root       45:        { SGBOX, 0, 0, 0,0, 52,24, NULL },
1.1       root       46:        { SGTEXT, 0, 0, 20,1, 13,1, "Devices setup" },
                     47: 
                     48:        { SGBOX, 0, 0, 1,3, 50,4, NULL },
1.1.1.10  root       49:        { SGCHECKBOX, 0, 0,  2,3, 26,1, "Enable _printer emulation" },
1.1       root       50:        { SGTEXT, 0, 0, 2,5, 10,1, "Print to file:" },
1.1.1.10  root       51:        { SGBUTTON,   0, 0, 42,5,  8,1, "_Browse" },
1.1       root       52:        { SGTEXT, 0, 0, 3,6, 46,1, dlgPrinterName },
                     53: 
                     54:        { SGBOX, 0, 0, 1,8, 50,6, NULL },
1.1.1.10  root       55:        { SGCHECKBOX, 0, 0,  2,8, 24,1, "Enable _RS232 emulation" },
1.1       root       56:        { SGTEXT, 0, 0, 2,10, 10,1, "Write RS232 output to file:" },
1.1.1.10  root       57:        { SGBUTTON,   0, 0, 42,10, 8,1, "Br_owse" },
1.1       root       58:        { SGTEXT, 0, 0, 3,11, 46,1, dlgRs232OutName },
                     59:        { SGTEXT, 0, 0, 2,12, 10,1, "Read RS232 input from file:" },
1.1.1.10  root       60:        { SGBUTTON,   0, 0, 42,12, 8,1, "Bro_wse" },
1.1       root       61:        { SGTEXT, 0, 0, 3,13, 46,1, dlgRs232InName },
                     62: 
1.1.1.6   root       63:        { SGBOX, 0, 0, 1,15, 50,6, NULL },
1.1.1.10  root       64:        { SGCHECKBOX, 0, 0, 2,15, 23,1, "Enable _MIDI emulation" },
1.1.1.6   root       65:        { SGTEXT, 0, 0, 2,17, 26,1, "Read MIDI input from file:" },
1.1.1.10  root       66:        { SGBUTTON,   0, 0, 42,17, 8,1, "Brow_se" },
1.1.1.6   root       67:        { SGTEXT, 0, 0, 3,18, 46,1, dlgMidiInName },
                     68:        { SGTEXT, 0, 0, 2,19, 26,1, "Write MIDI output to file:" },
1.1.1.10  root       69:        { SGBUTTON,   0, 0, 42,19, 8,1, "Brows_e" },
1.1.1.6   root       70:        { SGTEXT, 0, 0, 3,20, 46,1, dlgMidiOutName },
1.1       root       71: 
1.1.1.6   root       72:        { SGBUTTON, SG_DEFAULT, 0, 16,22, 20,1, "Back to main menu" },
1.1.1.11! root       73:        { SGSTOP, 0, 0, 0,0, 0,0, NULL }
1.1       root       74: };
                     75: 
                     76: 
                     77: /*-----------------------------------------------------------------------*/
1.1.1.8   root       78: /**
                     79:  * Show and process the "Device" dialog.
                     80:  */
1.1       root       81: void Dialog_DeviceDlg(void)
                     82: {
                     83:        int but;
                     84: 
                     85:        SDLGui_CenterDlg(devicedlg);
                     86: 
                     87:        /* Set up dialog from actual values: */
                     88: 
1.1.1.5   root       89:        if (ConfigureParams.Printer.bEnablePrinting)
1.1       root       90:                devicedlg[DEVDLG_PRNENABLE].state |= SG_SELECTED;
                     91:        else
                     92:                devicedlg[DEVDLG_PRNENABLE].state &= ~SG_SELECTED;
1.1.1.5   root       93:        File_ShrinkName(dlgPrinterName, ConfigureParams.Printer.szPrintToFileName, devicedlg[DEVDLG_PRNFILENAME].w);
1.1       root       94: 
1.1.1.5   root       95:        if (ConfigureParams.RS232.bEnableRS232)
1.1       root       96:                devicedlg[DEVDLG_RS232ENABLE].state |= SG_SELECTED;
                     97:        else
                     98:                devicedlg[DEVDLG_RS232ENABLE].state &= ~SG_SELECTED;
1.1.1.5   root       99:        File_ShrinkName(dlgRs232OutName, ConfigureParams.RS232.szOutFileName, devicedlg[DEVDLG_RS232OUTNAME].w);
                    100:        File_ShrinkName(dlgRs232InName, ConfigureParams.RS232.szInFileName, devicedlg[DEVDLG_RS232INNAME].w);
1.1       root      101: 
1.1.1.5   root      102:        if (ConfigureParams.Midi.bEnableMidi)
1.1       root      103:                devicedlg[DEVDLG_MIDIENABLE].state |= SG_SELECTED;
                    104:        else
                    105:                devicedlg[DEVDLG_MIDIENABLE].state &= ~SG_SELECTED;
1.1.1.6   root      106:        File_ShrinkName(dlgMidiInName, ConfigureParams.Midi.sMidiInFileName, devicedlg[DEVDLG_MIDIINNAME].w);
                    107:        File_ShrinkName(dlgMidiOutName, ConfigureParams.Midi.sMidiOutFileName, devicedlg[DEVDLG_MIDIOUTNAME].w);
1.1       root      108: 
                    109:        /* The devices dialog main loop */
                    110:        do
                    111:        {
1.1.1.10  root      112:                but = SDLGui_DoDialog(devicedlg, NULL, false);
1.1       root      113: 
                    114:                switch(but)
                    115:                {
                    116:                 case DEVDLG_PRNBROWSE:                 /* Choose a new printer file */
1.1.1.10  root      117:                        SDLGui_FileConfSelect("Printer output:", dlgPrinterName,
1.1.1.5   root      118:                                               ConfigureParams.Printer.szPrintToFileName,
1.1.1.4   root      119:                                               devicedlg[DEVDLG_PRNFILENAME].w,
1.1.1.7   root      120:                                               true);
1.1       root      121:                        break;
                    122:                 case DEVDLG_RS232OUTBROWSE:            /* Choose a new RS232 output file */
1.1.1.10  root      123:                        SDLGui_FileConfSelect("RS232 output:", dlgRs232OutName,
1.1.1.5   root      124:                                               ConfigureParams.RS232.szOutFileName,
1.1.1.4   root      125:                                               devicedlg[DEVDLG_RS232OUTNAME].w,
1.1.1.7   root      126:                                               true);
1.1       root      127:                        break;
                    128:                 case DEVDLG_RS232INBROWSE:             /* Choose a new RS232 input file */
1.1.1.10  root      129:                        SDLGui_FileConfSelect("RS232 input:", dlgRs232InName,
1.1.1.5   root      130:                                               ConfigureParams.RS232.szInFileName,
1.1.1.4   root      131:                                               devicedlg[DEVDLG_RS232INNAME].w,
1.1.1.7   root      132:                                               true);
1.1       root      133:                        break;
1.1.1.6   root      134:                 case DEVDLG_MIDIINBROWSE:              /* Choose a new MIDI file */
1.1.1.10  root      135:                        SDLGui_FileConfSelect("MIDI input:", dlgMidiInName,
1.1.1.6   root      136:                                               ConfigureParams.Midi.sMidiInFileName,
                    137:                                               devicedlg[DEVDLG_MIDIINNAME].w,
1.1.1.7   root      138:                                               true);
1.1.1.6   root      139:                        break;
                    140:                 case DEVDLG_MIDIOUTBROWSE:             /* Choose a new MIDI file */
1.1.1.10  root      141:                        SDLGui_FileConfSelect("MIDI output:", dlgMidiOutName,
1.1.1.6   root      142:                                               ConfigureParams.Midi.sMidiOutFileName,
1.1.1.4   root      143:                                               devicedlg[DEVDLG_MIDIOUTNAME].w,
1.1.1.7   root      144:                                               true);
1.1       root      145:                        break;
                    146:                }
                    147:        }
1.1.1.4   root      148:        while (but != DEVDLG_EXIT && but != SDLGUI_QUIT
                    149:               && but != SDLGUI_ERROR && !bQuitProgram);
1.1       root      150: 
                    151:        /* Read values from dialog */
1.1.1.5   root      152:        ConfigureParams.Printer.bEnablePrinting = (devicedlg[DEVDLG_PRNENABLE].state & SG_SELECTED);
                    153:        ConfigureParams.RS232.bEnableRS232 = (devicedlg[DEVDLG_RS232ENABLE].state & SG_SELECTED);
                    154:        ConfigureParams.Midi.bEnableMidi = (devicedlg[DEVDLG_MIDIENABLE].state & SG_SELECTED);
1.1       root      155: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.