Annotation of previous/src/gui-sdl/dlgDimension.c, revision 1.1.1.2

1.1       root        1: /*
                      2:   Previous - dlgDimension.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: */
                      8: 
                      9: const char DlgDimension_fileid[] = "Previous dlgDimension.c : " __DATE__ " " __TIME__;
                     10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "dialog.h"
                     14: #include "sdlgui.h"
                     15: #include "file.h"
                     16: 
                     17: 
                     18: #define DLGND_ENABLE        4
                     19: #define DLGND_CUSTOMIZE     5
1.1.1.2 ! root       20: #define DLGND_I860THREAD    6
        !            21: #define DLGND_MEMSIZE       13
        !            22: #define DLGND_BROWSE        18
        !            23: #define DLGND_NAME          19
        !            24: #define DLGND_COLOR         22
        !            25: #define DLGND_MONOCHROME    23
        !            26: #define DLGND_BOTH          24
        !            27: #define DLGND_DISPLAY          25
        !            28: #define DLGND_EXIT          27
1.1       root       29: 
                     30: /* Variable strings */
                     31: char dimension_memory[16] = "64 MB";
                     32: 
                     33: /* Additional functions */
                     34: void print_nd_overview(void);
                     35: void update_monitor_selection(void);
                     36: void get_nd_default_values(void);
                     37: 
                     38: static SGOBJ dimensiondlg[] =
                     39: {
1.1.1.2 ! root       40:     { SGBOX,      0, 0, 0,  0, 58, 30, NULL },
        !            41:     { SGTEXT,     0, 0, 18, 1, 21, 1, "NeXTdimension options" },
1.1       root       42:     
1.1.1.2 ! root       43:     { SGBOX,      0, 0, 2,  3, 26, 8, NULL },
        !            44:     { SGTEXT,     0, 0, 3,  4, 19, 1, "NeXTdimension board" },
        !            45:     { SGCHECKBOX, 0, 0, 4,  6, 9,  1, "Enabled" },
        !            46:     { SGBUTTON,   0, 0, 15, 6, 11, 1, "Customize" },
        !            47:     { SGCHECKBOX, 0, 0, 6,  8, 21,  1, "Run separate thread" },
        !            48:        
1.1       root       49:     { SGTEXT, 0, 0, 30,4, 13,1, "System overview:" },
                     50:     { SGTEXT, 0, 0, 30,6, 13,1, "CPU type:" },
1.1.1.2 ! root       51:     { SGTEXT, 0, 0, 44,6, 13,1, "i860XR" },
1.1       root       52:     { SGTEXT, 0, 0, 30,7, 13,1, "CPU clock:" },
                     53:     { SGTEXT, 0, 0, 44,7, 13,1, "33 MHz" },
                     54:     { SGTEXT, 0, 0, 30,8, 13,1, "Memory size:" },
                     55:     { SGTEXT, 0, 0, 44,8, 13,1, dimension_memory },
                     56:     { SGTEXT, 0, 0, 30,9, 13,1, "NBIC:" },
                     57:     { SGTEXT, 0, 0, 44,9, 13,1, "present" },
                     58: 
1.1.1.2 ! root       59:     { SGBOX, 0, 0, 2,12, 54,5, NULL },
        !            60:     { SGTEXT, 0, 0, 3,13, 22,1, "ROM for NeXTdimension:" },
        !            61:     { SGBUTTON, 0, 0, 27,13, 8,1, "Browse" },
        !            62:     { SGTEXT, 0, 0, 4,15, 50,1, NULL },
        !            63:        
        !            64:        { SGBOX, 0, 0, 2,18, 54,5, NULL },
        !            65:        { SGTEXT, 0, 0, 3,19, 13,1, "Show display:" },
        !            66:        { SGRADIOBUT, 0, 0, 18,  19, 7, 1, "Color" },
        !            67:        { SGRADIOBUT, 0, 0, 26, 19, 12, 1, "Monochrome" },
        !            68:        { SGRADIOBUT, 0, 0, 39, 19, 6, 1, "Both" },
        !            69:        { SGCHECKBOX, 0, 0, 5,21, 33,1, "System display on NeXTdimension" },
1.1       root       70: 
1.1.1.2 ! root       71:     { SGTEXT, 0, 0, 3,24, 52,1, "Note: NeXTdimension does not work with NeXTstations." },
1.1       root       72:     
1.1.1.2 ! root       73:     { SGBUTTON, SG_DEFAULT, 0, 18,27, 21,1, "Back to main menu" },
1.1       root       74: 
                     75:     { -1, 0, 0, 0,0, 0,0, NULL }
                     76: };
                     77: 
                     78: 
                     79: /* Function to set NeXTdimension memory options */
                     80: void Dialog_NDMemDlg(int *membank);
                     81: 
                     82: /* Function to print system overview */
                     83: void print_nd_overview(void) {
                     84:     sprintf(dimension_memory, "%i MB", Configuration_CheckDimensionMemory(ConfigureParams.Dimension.nMemoryBankSize));
                     85:     
                     86:     update_monitor_selection();
                     87: }
                     88: 
                     89: /* Function to select and unselect system options */
                     90: void update_monitor_selection(void) {
                     91: 
                     92: }
                     93: 
                     94: /* Function to get default values for each system */
                     95: void get_nd_default_values(void) {
                     96:     int i;
                     97:     
                     98:     for (i = 0; i < 4; i++) {
                     99:         ConfigureParams.Dimension.nMemoryBankSize[i] = 4;
                    100:     }
                    101: }
                    102: 
                    103: 
                    104: /*-----------------------------------------------------------------------*/
                    105: /**
                    106:   * Show and process the "System" dialog (specific to winUAE cpu).
                    107:   */
                    108: void Dialog_DimensionDlg(void)
                    109: {
                    110:     int but;
                    111:     char dlgname_ndrom[64];
                    112:  
                    113:        SDLGui_CenterDlg(dimensiondlg);
                    114:  
                    115:        /* Set up dialog from actual values: */
                    116:     
1.1.1.2 ! root      117:     if (ConfigureParams.Dimension.bEnabled) dimensiondlg[DLGND_ENABLE].state |= SG_SELECTED;
        !           118:     else                                    dimensiondlg[DLGND_ENABLE].state &= ~SG_SELECTED;
        !           119: 
        !           120:     if (ConfigureParams.Dimension.bI860Thread) dimensiondlg[DLGND_I860THREAD].state |= SG_SELECTED;
        !           121:     else                                       dimensiondlg[DLGND_I860THREAD].state &= ~SG_SELECTED;
        !           122: 
        !           123:     dimensiondlg[DLGND_COLOR].state      &= ~SG_SELECTED;
1.1       root      124:     dimensiondlg[DLGND_MONOCHROME].state &= ~SG_SELECTED;
1.1.1.2 ! root      125:     dimensiondlg[DLGND_BOTH].state       &= ~SG_SELECTED;
        !           126:        
        !           127:        if (ConfigureParams.Dimension.bMainDisplay) dimensiondlg[DLGND_DISPLAY].state |= SG_SELECTED;
        !           128:        else                                        dimensiondlg[DLGND_DISPLAY].state &= ~SG_SELECTED;
        !           129:        
1.1       root      130:     switch (ConfigureParams.Screen.nMonitorType) {
                    131:         case MONITOR_TYPE_DUAL:
                    132:             dimensiondlg[DLGND_BOTH].state |= SG_SELECTED;
                    133:             break;
                    134:         case MONITOR_TYPE_CPU:
                    135:             dimensiondlg[DLGND_MONOCHROME].state |= SG_SELECTED;
                    136:             break;
                    137:         case MONITOR_TYPE_DIMENSION:
                    138:             dimensiondlg[DLGND_COLOR].state |= SG_SELECTED;
                    139:             break;
                    140:             
                    141:         default:
                    142:             break;
                    143:     }
                    144:     
                    145:     File_ShrinkName(dlgname_ndrom, ConfigureParams.Dimension.szRomFileName,
                    146:                         dimensiondlg[DLGND_NAME].w);
                    147:     dimensiondlg[DLGND_NAME].txt = dlgname_ndrom;
                    148: 
                    149:     /* System overview */
                    150:     print_nd_overview();
1.1.1.2 ! root      151:     
1.1       root      152:        /* Draw and process the dialog: */
                    153: 
1.1.1.2 ! root      154:     do{
1.1       root      155:         but = SDLGui_DoDialog(dimensiondlg, NULL);
                    156:         
                    157:         switch (but) {
                    158:             case DLGND_BROWSE:
                    159:                 SDLGui_FileConfSelect(dlgname_ndrom,
                    160:                                       ConfigureParams.Dimension.szRomFileName,
                    161:                                       dimensiondlg[DLGND_NAME].w,
                    162:                                       false);
                    163:                 break;
                    164:                 
                    165:             case DLGND_CUSTOMIZE:
                    166:                 Dialog_NDMemDlg(ConfigureParams.Dimension.nMemoryBankSize);
                    167:                 print_nd_overview();
                    168:                 break;
                    169:                 
                    170:             default:
                    171:                 break;
                    172:         }
                    173:     }
                    174:     while (but != DLGND_EXIT && but != SDLGUI_QUIT
                    175:            && but != SDLGUI_ERROR && !bQuitProgram);
                    176:     
                    177:     /* Read values from dialog */
1.1.1.2 ! root      178:     ConfigureParams.Dimension.bEnabled     = (dimensiondlg[DLGND_ENABLE].    state&SG_SELECTED) != 0;
        !           179:     ConfigureParams.Dimension.bI860Thread  = (dimensiondlg[DLGND_I860THREAD].state&SG_SELECTED) != 0;
        !           180:        ConfigureParams.Dimension.bMainDisplay = (dimensiondlg[DLGND_DISPLAY].state&SG_SELECTED) != 0;
        !           181:        
        !           182:     if (ConfigureParams.Dimension.bEnabled)
1.1       root      183:         ConfigureParams.System.bNBIC = true;
                    184:     
1.1.1.2 ! root      185:     if      (dimensiondlg[DLGND_COLOR].state&SG_SELECTED) ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_DIMENSION;
        !           186:     else if (dimensiondlg[DLGND_BOTH]. state&SG_SELECTED) ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_DUAL;
        !           187:     else                                                  ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_CPU;
1.1       root      188: }
                    189: 
                    190: 
                    191: #define DLGNDMEM_BANK0_4MB     4
                    192: #define DLGNDMEM_BANK0_16MB    5
                    193: #define DLGNDMEM_BANK0_NONE    6
                    194: 
                    195: #define DLGNDMEM_BANK1_4MB     9
                    196: #define DLGNDMEM_BANK1_16MB    10
                    197: #define DLGNDMEM_BANK1_NONE    11
                    198: 
                    199: #define DLGNDMEM_BANK2_4MB     14
                    200: #define DLGNDMEM_BANK2_16MB    15
                    201: #define DLGNDMEM_BANK2_NONE    16
                    202: 
                    203: #define DLGNDMEM_BANK3_4MB     19
                    204: #define DLGNDMEM_BANK3_16MB    20
                    205: #define DLGNDMEM_BANK3_NONE    21
                    206: 
                    207: #define DLGNDMEM_DEFAULT       23
                    208: #define DLGNDMEM_EXIT          24
                    209: 
                    210: 
                    211: void Dialog_NDMemDraw(int *memorybank);
                    212: void Dialog_NDMemRead(int *memorybank);
                    213: 
                    214: static SGOBJ ndmemdlg[] =
                    215: {
                    216:     { SGBOX, 0, 0, 0,0, 55,18, NULL },
                    217:     { SGTEXT, 0, 0, 18,1, 19,1, "Custom memory setup" },
                    218:     
                    219:     { SGBOX, 0, 0, 2,4, 12,7, NULL },
                    220:     { SGTEXT, 0, 0, 3,5, 14,1, "Bank0" },
                    221:     { SGRADIOBUT, 0, 0, 4,7, 6,1, "4 MB" },
                    222:     { SGRADIOBUT, 0, 0, 4,8, 7,1, "16 MB" },
                    223:     { SGRADIOBUT, 0, 0, 4,9, 6,1, "none" },
                    224:     
                    225:     { SGBOX, 0, 0, 15,4, 12,7, NULL },
                    226:     { SGTEXT, 0, 0, 16,5, 14,1, "Bank1" },
                    227:     { SGRADIOBUT, 0, 0, 17,7, 6,1, "4 MB" },
                    228:     { SGRADIOBUT, 0, 0, 17,8, 7,1, "16 MB" },
                    229:     { SGRADIOBUT, 0, 0, 17,9, 6,1, "none" },
                    230:     
                    231:     { SGBOX, 0, 0, 28,4, 12,7, NULL },
                    232:     { SGTEXT, 0, 0, 29,5, 14,1, "Bank2" },
                    233:     { SGRADIOBUT, 0, 0, 30,7, 6,1, "4 MB" },
                    234:     { SGRADIOBUT, 0, 0, 30,8, 7,1, "16 MB" },
                    235:     { SGRADIOBUT, 0, 0, 30,9, 6,1, "none" },
                    236:     
                    237:     { SGBOX, 0, 0, 41,4, 12,7, NULL },
                    238:     { SGTEXT, 0, 0, 42,5, 14,1, "Bank3" },
                    239:     { SGRADIOBUT, 0, 0, 43,7, 6,1, "4 MB" },
                    240:     { SGRADIOBUT, 0, 0, 43,8, 7,1, "16 MB" },
                    241:     { SGRADIOBUT, 0, 0, 43,9, 6,1, "none" },
                    242:     
                    243:     { SGTEXT, 0, 0, 5,12, 14,1, "Bank0 must contain at least 4 MB of memory." },
                    244:     
                    245:     { SGBUTTON, 0, 0, 15,15, 10,1, "Defaults" },
                    246:     { SGBUTTON, SG_DEFAULT, 0, 30,15, 10,1, "OK" },
                    247:     { -1, 0, 0, 0,0, 0,0, NULL }
                    248: };
                    249: 
                    250: 
                    251: 
                    252: /*-----------------------------------------------------------------------*/
                    253: /**
                    254:  * Show and process the "Memory Advanced" dialog.
                    255:  */
                    256: void Dialog_NDMemDlg(int *membank) {
                    257:     
                    258:     int but;
                    259:     
                    260:     SDLGui_CenterDlg(ndmemdlg);
                    261:     
                    262:     /* Set up dialog from actual values: */
                    263:     Dialog_NDMemDraw(membank);
                    264:     
                    265:     /* Draw and process the dialog: */
                    266:     do
                    267:     {
                    268:         but = SDLGui_DoDialog(ndmemdlg, NULL);
                    269: 
                    270:         switch (but) {
                    271:             case DLGNDMEM_DEFAULT:
                    272:                 membank[0] = membank[1] = membank[2] = membank[3] = 4;
                    273:                 Configuration_CheckDimensionMemory(membank);
                    274:                 Dialog_NDMemDraw(membank);
                    275:                 break;
                    276:             default:
                    277:                 break;
                    278:         }
                    279:     }
                    280:     while (but != DLGNDMEM_EXIT && but != SDLGUI_QUIT
                    281:            && but != SDLGUI_ERROR && !bQuitProgram);
                    282:     
                    283:     
                    284:     /* Read values from dialog: */
                    285:     Dialog_NDMemRead(membank);
                    286: }
                    287: 
                    288: 
                    289: /* Function to set up the dialog from the actual values */
                    290: void Dialog_NDMemDraw(int *bank) {
                    291:     int i, j;
                    292:     for (i = 0; i<4; i++) {
                    293:         
                    294:         for (j = (DLGNDMEM_BANK0_4MB+(5*i)); j <= (DLGNDMEM_BANK0_NONE+(5*i)); j++)
                    295:         {
                    296:             ndmemdlg[j].state &= ~SG_SELECTED;
                    297:         }
                    298:         
                    299:         switch (bank[i])
                    300:         {
                    301:             case 0:
                    302:                 ndmemdlg[DLGNDMEM_BANK0_NONE+(i*5)].state |= SG_SELECTED;
                    303:                 break;
                    304:             case 4:
                    305:                 ndmemdlg[DLGNDMEM_BANK0_4MB+(i*5)].state |= SG_SELECTED;
                    306:                 break;
                    307:             case 16:
                    308:                 ndmemdlg[DLGNDMEM_BANK0_16MB+(i*5)].state |= SG_SELECTED;
                    309:                 break;
                    310:                 
                    311:             default:
                    312:                 break;
                    313:         }
                    314:     }
                    315: }
                    316: 
                    317: 
                    318: /* Function to read the actual values from the dialog */
                    319: void Dialog_NDMemRead(int *bank) {
                    320:     int i;
                    321:     for (i = 0; i<4; i++) {
                    322:         if (ndmemdlg[(DLGNDMEM_BANK0_4MB)+(i*5)].state & SG_SELECTED)
                    323:             bank[i] = 4;
                    324:         else if (ndmemdlg[(DLGNDMEM_BANK0_16MB)+(i*5)].state & SG_SELECTED)
                    325:             bank[i] = 16;
                    326:         else
                    327:             bank[i] = 0;
                    328:     }
                    329: }

unix.superglobalmegacorp.com

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