Annotation of hatari/src/gui-sdl/dlgKeyboard.c, revision 1.1.1.7

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: */
1.1.1.7 ! root        7: const char DlgKeyboard_fileid[] = "Hatari dlgKeyboard.c : " __DATE__ " " __TIME__;
1.1       root        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
1.1.1.5   root       24: #define DLGKEY_DISREPEAT 9
                     25: #define DLGKEY_EXIT      10
1.1       root       26: 
                     27: 
                     28: /* The keyboard dialog: */
                     29: static SGOBJ keyboarddlg[] =
                     30: {
1.1.1.5   root       31:        { SGBOX, 0, 0, 0,0, 46,14, NULL },
                     32:        { SGTEXT, 0, 0, 16,1, 14,1, "Keyboard setup" },
1.1.1.4   root       33:        { SGTEXT, 0, 0, 2,3, 17,1, "Keyboard mapping:" },
1.1.1.5   root       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" },
1.1.1.4   root       37:        { SGTEXT, 0, 0, 2,7, 13,1, "Mapping file:" },
1.1.1.5   root       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" },
1.1.1.4   root       42:        { -1, 0, 0, 0,0, 0,0, NULL }
1.1       root       43: };
                     44: 
                     45: 
                     46: /*-----------------------------------------------------------------------*/
1.1.1.4   root       47: /**
                     48:  * Show and process the "Keyboard" dialog.
                     49:  */
1.1       root       50: void Dialog_KeyboardDlg(void)
                     51: {
1.1.1.4   root       52:        int i, but;
1.1.1.5   root       53:        char dlgmapfile[44];
1.1       root       54: 
1.1.1.4   root       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:        }
1.1.1.5   root       62:        keyboarddlg[DLGKEY_SYMBOLIC+ConfigureParams.Keyboard.nKeymapType].state |= SG_SELECTED;
1.1.1.4   root       63: 
1.1.1.5   root       64:        File_ShrinkName(dlgmapfile, ConfigureParams.Keyboard.szMappingFileName,
1.1.1.4   root       65:                        keyboarddlg[DLGKEY_MAPNAME].w);
                     66:        keyboarddlg[DLGKEY_MAPNAME].txt = dlgmapfile;
                     67: 
1.1.1.5   root       68:        if (ConfigureParams.Keyboard.bDisableKeyRepeat)
                     69:                keyboarddlg[DLGKEY_DISREPEAT].state |= SG_SELECTED;
                     70:        else
                     71:                keyboarddlg[DLGKEY_DISREPEAT].state &= ~SG_SELECTED;
                     72: 
1.1.1.4   root       73:        /* Show the dialog: */
                     74:        do
                     75:        {
                     76:                but = SDLGui_DoDialog(keyboarddlg, NULL);
                     77: 
                     78:                if (but == DLGKEY_MAPBROWSE)
                     79:                {
                     80:                        SDLGui_FileConfSelect(dlgmapfile,
1.1.1.5   root       81:                                              ConfigureParams.Keyboard.szMappingFileName,
1.1.1.7 ! root       82:                                              keyboarddlg[DLGKEY_MAPNAME].w, false);
1.1.1.4   root       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)
1.1.1.5   root       90:                ConfigureParams.Keyboard.nKeymapType = KEYMAP_SYMBOLIC;
1.1.1.4   root       91:        else if (keyboarddlg[DLGKEY_SCANCODE].state & SG_SELECTED)
1.1.1.5   root       92:                ConfigureParams.Keyboard.nKeymapType = KEYMAP_SCANCODE;
1.1.1.4   root       93:        else
1.1.1.5   root       94:                ConfigureParams.Keyboard.nKeymapType = KEYMAP_LOADED;
                     95: 
                     96:        ConfigureParams.Keyboard.bDisableKeyRepeat = (keyboarddlg[DLGKEY_DISREPEAT].state & SG_SELECTED);
1.1       root       97: }

unix.superglobalmegacorp.com

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