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

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

unix.superglobalmegacorp.com

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