Annotation of previous/src/gui-sdl/dlgKeyboard.c, revision 1.1.1.1

1.1       root        1: /*
                      2:   Hatari - dlgKeyboard.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 DlgKeyboard_fileid[] = "Hatari dlgKeyboard.c : " __DATE__ " " __TIME__;
                      8: 
                      9: #include <unistd.h>
                     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 DLGKEY_SYMBOLIC  3
                     20: #define DLGKEY_SCANCODE  4
                     21: #define DLGKEY_FROMFILE  5
                     22: #define DLGKEY_MAPNAME   7
                     23: #define DLGKEY_MAPBROWSE 8
                     24: #define DLGKEY_DISREPEAT 9
                     25: #define DLGKEY_EXIT      10
                     26: 
                     27: 
                     28: /* The keyboard dialog: */
                     29: static SGOBJ keyboarddlg[] =
                     30: {
                     31:        { SGBOX, 0, 0, 0,0, 46,14, NULL },
                     32:        { SGTEXT, 0, 0, 16,1, 14,1, "Keyboard setup" },
                     33:        { SGTEXT, 0, 0, 2,3, 17,1, "Keyboard mapping:" },
                     34:        { SGRADIOBUT, 0, 0, 4,5, 10,1, "Symbolic" },
                     35:        { SGRADIOBUT, 0, 0, 17,5, 10,1, "Scancode" },
                     36:        { SGRADIOBUT, 0, 0, 30,5, 11,1, "From file" },
                     37:        { SGTEXT, 0, 0, 2,7, 13,1, "Mapping file:" },
                     38:        { SGTEXT, 0, 0, 2,8, 42,1, NULL },
                     39:        { SGBUTTON, 0, 0, 36,7, 8,1, "Browse" },
                     40:        { SGCHECKBOX, 0, 0, 2,10, 41,1, "Disable key repeat in fast forward mode" },
                     41:        { SGBUTTON, SG_DEFAULT, 0, 13,12, 20,1, "Back to main menu" },
                     42:        { -1, 0, 0, 0,0, 0,0, NULL }
                     43: };
                     44: 
                     45: 
                     46: /*-----------------------------------------------------------------------*/
                     47: /**
                     48:  * Show and process the "Keyboard" dialog.
                     49:  */
                     50: void Dialog_KeyboardDlg(void)
                     51: {
                     52:        int i, but;
                     53:        char dlgmapfile[44];
                     54: 
                     55:        SDLGui_CenterDlg(keyboarddlg);
                     56: 
                     57:        /* Set up dialog from actual values: */
                     58:        for (i = DLGKEY_SYMBOLIC; i <= DLGKEY_FROMFILE; i++)
                     59:        {
                     60:                keyboarddlg[i].state &= ~SG_SELECTED;
                     61:        }
                     62:        keyboarddlg[DLGKEY_SYMBOLIC+ConfigureParams.Keyboard.nKeymapType].state |= SG_SELECTED;
                     63: 
                     64:        File_ShrinkName(dlgmapfile, ConfigureParams.Keyboard.szMappingFileName,
                     65:                        keyboarddlg[DLGKEY_MAPNAME].w);
                     66:        keyboarddlg[DLGKEY_MAPNAME].txt = dlgmapfile;
                     67: 
                     68:        if (ConfigureParams.Keyboard.bDisableKeyRepeat)
                     69:                keyboarddlg[DLGKEY_DISREPEAT].state |= SG_SELECTED;
                     70:        else
                     71:                keyboarddlg[DLGKEY_DISREPEAT].state &= ~SG_SELECTED;
                     72: 
                     73:        /* Show the dialog: */
                     74:        do
                     75:        {
                     76:                but = SDLGui_DoDialog(keyboarddlg, NULL);
                     77: 
                     78:                if (but == DLGKEY_MAPBROWSE)
                     79:                {
                     80:                        SDLGui_FileConfSelect(dlgmapfile,
                     81:                                              ConfigureParams.Keyboard.szMappingFileName,
                     82:                                              keyboarddlg[DLGKEY_MAPNAME].w, false);
                     83:                }
                     84:        }
                     85:        while (but != DLGKEY_EXIT && but != SDLGUI_QUIT
                     86:                && but != SDLGUI_ERROR && !bQuitProgram);
                     87: 
                     88:        /* Read values from dialog: */
                     89:        if (keyboarddlg[DLGKEY_SYMBOLIC].state & SG_SELECTED)
                     90:                ConfigureParams.Keyboard.nKeymapType = KEYMAP_SYMBOLIC;
                     91:        else if (keyboarddlg[DLGKEY_SCANCODE].state & SG_SELECTED)
                     92:                ConfigureParams.Keyboard.nKeymapType = KEYMAP_SCANCODE;
                     93:        else
                     94:                ConfigureParams.Keyboard.nKeymapType = KEYMAP_LOADED;
                     95: 
                     96:        ConfigureParams.Keyboard.bDisableKeyRepeat = (keyboarddlg[DLGKEY_DISREPEAT].state & SG_SELECTED);
                     97: }

unix.superglobalmegacorp.com

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