Annotation of hatari/src/gui-sdl/dlgScreen.c, revision 1.1.1.17

1.1       root        1: /*
                      2:   Hatari - dlgScreen.c
                      3: 
1.1.1.13  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.1.9   root        6: 
                      7:  Atari monitor and Hatari window settings.
1.1       root        8: */
1.1.1.8   root        9: const char DlgScreen_fileid[] = "Hatari dlgScreen.c : " __DATE__ " " __TIME__;
1.1       root       10: 
                     11: #include "main.h"
                     12: #include "configuration.h"
                     13: #include "dialog.h"
                     14: #include "sdlgui.h"
1.1.1.15  root       15: #include "options.h"
1.1       root       16: #include "screen.h"
                     17: #include "screenSnapShot.h"
1.1.1.10  root       18: #include "resolution.h"
1.1.1.2   root       19: #include "vdi.h"
1.1.1.6   root       20: #include "video.h"
1.1.1.9   root       21: #include "avi_record.h"
                     22: #include "statusbar.h"
1.1.1.10  root       23: #include "clocks_timings.h"
1.1.1.5   root       24: 
1.1.1.9   root       25: 
                     26: /* The Monitor dialog: */
                     27: #define DLGSCRN_MONO         3
                     28: #define DLGSCRN_RGB          4
                     29: #define DLGSCRN_VGA          5
                     30: #define DLGSCRN_TV           6
                     31: #define DLGSCRN_OVERSCAN     7
                     32: #define DLGSCRN_USEVDIRES    9
                     33: #define DLGSCRN_VDI_WLESS    11
                     34: #define DLGSCRN_VDI_WTEXT    12
                     35: #define DLGSCRN_VDI_WMORE    13
                     36: #define DLGSCRN_VDI_HLESS    15
                     37: #define DLGSCRN_VDI_HTEXT    16
                     38: #define DLGSCRN_VDI_HMORE    17
                     39: #define DLGSCRN_BPP1         18
                     40: #define DLGSCRN_BPP2         19
                     41: #define DLGSCRN_BPP4         20
                     42: #define DLGSCRN_EXIT_MONITOR 21
1.1.1.5   root       43: 
                     44: /* Strings for VDI resolution width and height */
                     45: static char sVdiWidth[5];
                     46: static char sVdiHeight[5];
1.1       root       47: 
1.1.1.9   root       48: static SGOBJ monitordlg[] =
1.1       root       49: {
1.1.1.10  root       50:        { SGBOX, 0, 0, 0,0, 34,18, NULL },
1.1.1.9   root       51: 
1.1.1.10  root       52:        { SGBOX,      0, 0,  1,1, 32,6, NULL },
                     53:        { SGTEXT,     0, 0, 10,1, 14,1, "Atari monitor" },
1.1.1.15  root       54:        { SGRADIOBUT, 0, 0,  4,3,  6,1, "_Mono" },
                     55:        { SGRADIOBUT, 0, 0, 12,3,  5,1, "_RGB" },
                     56:        { SGRADIOBUT, 0, 0, 19,3,  5,1, "_VGA" },
                     57:        { SGRADIOBUT, 0, 0, 26,3,  4,1, "_TV" },
                     58:        { SGCHECKBOX, 0, 0, 12,5, 14,1, "Show _borders" },
1.1.1.10  root       59: 
                     60:        { SGBOX,      0, 0,  1,8, 32,7, NULL },
1.1.1.15  root       61:        { SGCHECKBOX, 0, 0,  4,9, 25,1, "Use _extended VDI screen" },
1.1.1.10  root       62:        { SGTEXT,     0, 0,  4,11, 5,1, "Size:" },
1.1.1.15  root       63:        { SGBUTTON,   0, 0,  6,12, 1,1, "\x04", SG_SHORTCUT_LEFT },
1.1.1.10  root       64:        { SGTEXT,     0, 0,  8,12, 4,1, sVdiWidth },
1.1.1.15  root       65:        { SGBUTTON,   0, 0, 13,12, 1,1, "\x03", SG_SHORTCUT_RIGHT },
1.1.1.10  root       66:        { SGTEXT,     0, 0,  4,13, 1,1, "x" },
1.1.1.15  root       67:        { SGBUTTON,   0, 0,  6,13, 1,1, "\x04", SG_SHORTCUT_UP },
1.1.1.10  root       68:        { SGTEXT,     0, 0,  8,13, 4,1, sVdiHeight },
1.1.1.15  root       69:        { SGBUTTON,   0, 0, 13,13, 1,1, "\x03", SG_SHORTCUT_DOWN },
1.1.1.9   root       70: 
1.1.1.15  root       71:        { SGRADIOBUT, SG_EXIT, 0, 18,11, 11,1, " _2 colors" },
                     72:        { SGRADIOBUT, SG_EXIT, 0, 18,12, 11,1, " _4 colors" },
                     73:        { SGRADIOBUT, SG_EXIT, 0, 18,13, 11,1, "1_6 colors" },
1.1.1.9   root       74: 
1.1.1.10  root       75:        { SGBUTTON, SG_DEFAULT, 0, 7,16, 20,1, "Back to main menu" },
1.1.1.16  root       76:        { SGSTOP, 0, 0, 0,0, 0,0, NULL }
1.1.1.9   root       77: };
                     78: 
                     79: 
                     80: /* The window dialog: */
                     81: #define DLGSCRN_FULLSCRN    3
1.1.1.10  root       82: #define DLGSCRN_STATUSBAR   5
1.1.1.15  root       83: #define DLGSCRN_DRIVELED    6
1.1.1.10  root       84: #define DLGSCRN_NONE        7
                     85: #define DLGSCRN_SKIP0       9
                     86: #define DLGSCRN_SKIP1       10
                     87: #define DLGSCRN_SKIP2       11
                     88: #define DLGSCRN_SKIP3       12
                     89: #define DLGSCRN_SKIP4       13
1.1.1.14  root       90: #define DLGSCRN_KEEP_RES_ST 16
                     91: #define DLGSCRN_KEEP_RES    17
                     92: #define DLGSCRN_MAX_WLESS   19
                     93: #define DLGSCRN_MAX_WTEXT   20
                     94: #define DLGSCRN_MAX_WMORE   21
                     95: #define DLGSCRN_MAX_HLESS   23
                     96: #define DLGSCRN_MAX_HTEXT   24
                     97: #define DLGSCRN_MAX_HMORE   25
                     98: #define DLGSCRN_CROP        28
                     99: #define DLGSCRN_CAPTURE     29
                    100: #define DLGSCRN_RECANIM     30
1.1.1.15  root      101: #if WITH_SDL2
                    102: #define DLGSCRN_LINEARSCALE 33
1.1.1.17! root      103: #define DLGSCRN_RESIZABLE   34
        !           104: #define DLGSCRN_VSYNC       35
        !           105: #define DLGSCRN_EXIT_WINDOW 36
1.1.1.15  root      106: #else
1.1.1.14  root      107: #define DLGSCRN_EXIT_WINDOW 31
1.1.1.15  root      108: #endif
1.1.1.9   root      109: 
                    110: /* needs to match Frame skip values in windowdlg[]! */
                    111: static const int skip_frames[] = { 0, 1, 2, 4, AUTO_FRAMESKIP_LIMIT };
                    112: 
                    113: /* Strings for doubled resolution max width and height */
                    114: static char sMaxWidth[5];
                    115: static char sMaxHeight[5];
                    116: 
                    117: #define MAX_SIZE_STEP 8
1.1.1.2   root      118: 
1.1.1.9   root      119: /* The window dialog: */
                    120: static SGOBJ windowdlg[] =
                    121: {
1.1.1.15  root      122: #if WITH_SDL2
                    123:        { SGBOX, 0, 0, 0,0, 52,25, NULL },
                    124: #else
1.1.1.10  root      125:        { SGBOX, 0, 0, 0,0, 52,20, NULL },
1.1.1.15  root      126: #endif
1.1.1.10  root      127:        { SGBOX,      0, 0,  1,1, 50,10, NULL },
                    128:        { SGTEXT,     0, 0,  4,2, 20,1, "Hatari screen options" },
1.1.1.15  root      129:        { SGCHECKBOX, 0, 0,  4,4, 12,1, "_Fullscreen" },
1.1.1.10  root      130:        { SGTEXT,     0, 0,  4,6, 12,1, "Indicators:" },
1.1.1.15  root      131:        { SGRADIOBUT, 0, 0,  6,7, 11,1, "Status_bar" },
                    132:        { SGRADIOBUT, 0, 0,  6,8, 11,1, "Drive _led" },
                    133:        { SGRADIOBUT, 0, 0,  6,9,  6,1, "_None" },
1.1.1.10  root      134:        { SGTEXT,     0, 0, 19,4, 12,1, "Frame skip:" },
1.1.1.15  root      135:        { SGRADIOBUT, 0, 0, 21,5,  5,1, "_Off" },
                    136:        { SGRADIOBUT, 0, 0, 21,6,  3,1, "_1" },
                    137:        { SGRADIOBUT, 0, 0, 21,7,  3,1, "_2" },
                    138:        { SGRADIOBUT, 0, 0, 21,8,  3,1, "_4" },
                    139:        { SGRADIOBUT, 0, 0, 21,9,  6,1, "_Auto" },
1.1.1.16  root      140: #if WITH_SDL2
                    141:        { SGTEXT,     0, 0, 35,4, 10,1, "resolution" },
                    142:        { SGTEXT,     0, 0, 35,5, 13,1, "in fullscreen" },
                    143:        { SGTEXT,     0, 0, 33,2,  1,1, "" },
                    144:        { SGCHECKBOX, 0, 0, 33,3, 14,1, "_Keep desktop" },
                    145: #else
1.1.1.14  root      146:        { SGTEXT,     0, 0, 33,2, 14,1, "Keep desktop" },
                    147:        { SGTEXT,     0, 0, 33,3, 14,1, "resolution:" },
1.1.1.15  root      148:        { SGCHECKBOX, 0, 0, 35,4,  8,1, "ST/ST_e" },
                    149:        { SGCHECKBOX, 0, 0, 35,5, 11,1, "_TT/Falcon" },
1.1.1.16  root      150: #endif
1.1.1.10  root      151:        { SGTEXT,     0, 0, 33,7, 15,1, "Max zoomed win:" },
1.1.1.15  root      152:        { SGBUTTON,   0, 0, 35,8,  1,1, "\x04", SG_SHORTCUT_LEFT },
1.1.1.10  root      153:        { SGTEXT,     0, 0, 37,8,  4,1, sMaxWidth },
1.1.1.15  root      154:        { SGBUTTON,   0, 0, 43,8,  1,1, "\x03", SG_SHORTCUT_RIGHT },
1.1.1.10  root      155:        { SGTEXT,     0, 0, 33,9,  1,1, "x" },
1.1.1.15  root      156:        { SGBUTTON,   0, 0, 35,9,  1,1, "\x04", SG_SHORTCUT_UP },
1.1.1.10  root      157:        { SGTEXT,     0, 0, 37,9,  4,1, sMaxHeight },
1.1.1.15  root      158:        { SGBUTTON,   0, 0, 43,9,  1,1, "\x03", SG_SHORTCUT_DOWN },
1.1.1.10  root      159: 
                    160:        { SGBOX,      0, 0,  1,12, 50,5, NULL },
                    161:        { SGTEXT,     0, 0,  7,13, 16,1, "Screen capture" },
1.1.1.15  root      162:        { SGCHECKBOX, 0, 0,  8,15, 16,1, "_Crop statusbar" },
                    163:        { SGBUTTON,   0, 0, 29,13, 14,1, " _Screenshot " },
                    164:        { SGBUTTON,   0, 0, 29,15, 14,1, NULL },      /* Record text set later */
                    165: 
                    166: #if WITH_SDL2
                    167:        { SGBOX,      0, 0,  1,18, 50,4, NULL },
                    168:        { SGTEXT,     0, 0, 20,18, 12,1, "SDL2 options" },
1.1.1.17! root      169:        { SGCHECKBOX, 0, 0,  4,20, 20,1, "Linear scal_ing" },
        !           170:        { SGCHECKBOX, 0, 0, 23,20, 20,1, "Resi_zable" },
        !           171:        { SGCHECKBOX, 0, 0, 36,20, 11,1, "_VSync" },
1.1.1.15  root      172:        { SGBUTTON, SG_DEFAULT, 0, 17,23, 20,1, "Back to main menu" },
                    173: #else
1.1.1.10  root      174:        { SGBUTTON, SG_DEFAULT, 0, 17,18, 20,1, "Back to main menu" },
1.1.1.15  root      175: #endif
1.1.1.16  root      176:        { SGSTOP, 0, 0, 0,0, 0,0, NULL }
1.1       root      177: };
                    178: 
1.1.1.15  root      179: /* for record button */
                    180: #define RECORD_START "_Record AVI"
                    181: #define RECORD_STOP "Stop _record"
                    182: 
1.1       root      183: 
1.1.1.9   root      184: /* ---------------------------------------------------------------- */
1.1.1.5   root      185: 
1.1.1.9   root      186: static int nVdiStepX, nVdiStepY;   /* VDI resolution changing steps */
1.1.1.5   root      187: 
                    188: /**
                    189:  * Set width and height stepping for VDI resolution changing.
                    190:  * Depending on the color depth we can only change the VDI resolution
                    191:  * in certain steps:
                    192:  * - The screen width must be dividable by 16 bytes (i.e. 128 pixels in
                    193:  *   monochrome, 32 pixels in 16 color mode), or the text mode scrolling
                    194:  *   function of TOS will fail.
                    195:  * - The screen height must be a multiple of the character cell height
                    196:  *   (i.e. 16 pixels in monochrome, 8 pixels in color mode).
                    197:  */
1.1.1.9   root      198: static void DlgMonitor_SetVdiStepping(void)
1.1.1.5   root      199: {
1.1.1.9   root      200:        if (monitordlg[DLGSCRN_BPP1].state & SG_SELECTED)
1.1.1.5   root      201:        {
                    202:                nVdiStepX = 128;
                    203:                nVdiStepY = 16;
                    204:        }
1.1.1.9   root      205:        else if (monitordlg[DLGSCRN_BPP2].state & SG_SELECTED)
1.1.1.5   root      206:        {
                    207:                nVdiStepX = 64;
                    208:                nVdiStepY = 8;
                    209:        }
                    210:        else
                    211:        {
                    212:                nVdiStepX = 32;
                    213:                nVdiStepY = 8;
                    214:        }
                    215: }
                    216: 
                    217: 
1.1       root      218: /*-----------------------------------------------------------------------*/
1.1.1.5   root      219: /**
1.1.1.9   root      220:  * Show and process the monitor dialog.
1.1.1.5   root      221:  */
1.1.1.9   root      222: void Dialog_MonitorDlg(void)
1.1       root      223: {
1.1.1.15  root      224:        int but, vdiw, vdih;
1.1.1.5   root      225:        unsigned int i;
1.1.1.8   root      226:        MONITORTYPE     mti;
1.1       root      227: 
1.1.1.9   root      228:        SDLGui_CenterDlg(monitordlg);
1.1       root      229: 
1.1.1.9   root      230:        /* Set up general monitor options in the dialog from actual values: */
1.1.1.5   root      231: 
1.1.1.6   root      232:        if (ConfigureParams.Screen.bAllowOverscan)
1.1.1.9   root      233:                monitordlg[DLGSCRN_OVERSCAN].state |= SG_SELECTED;
1.1.1.5   root      234:        else
1.1.1.9   root      235:                monitordlg[DLGSCRN_OVERSCAN].state &= ~SG_SELECTED;
1.1.1.5   root      236: 
                    237:        for (i = DLGSCRN_MONO; i <= DLGSCRN_TV; i++)
1.1.1.9   root      238:                monitordlg[i].state &= ~SG_SELECTED;
                    239:        monitordlg[DLGSCRN_MONO+ConfigureParams.Screen.nMonitorType].state |= SG_SELECTED;
1.1.1.5   root      240: 
                    241:        /* Initialize VDI resolution options: */
                    242: 
1.1.1.6   root      243:        if (ConfigureParams.Screen.bUseExtVdiResolutions)
1.1.1.9   root      244:                monitordlg[DLGSCRN_USEVDIRES].state |= SG_SELECTED;
1.1.1.5   root      245:        else
1.1.1.9   root      246:                monitordlg[DLGSCRN_USEVDIRES].state &= ~SG_SELECTED;
1.1.1.5   root      247:        for (i=0; i<3; i++)
1.1.1.9   root      248:                monitordlg[DLGSCRN_BPP1 + i].state &= ~SG_SELECTED;
                    249:        monitordlg[DLGSCRN_BPP1 + ConfigureParams.Screen.nVdiColors - GEMCOLOR_2].state |= SG_SELECTED;
1.1.1.15  root      250: 
                    251:        vdiw = ConfigureParams.Screen.nVdiWidth;
                    252:        vdih = ConfigureParams.Screen.nVdiHeight;
                    253:        sprintf(sVdiWidth, "%4i", vdiw);
                    254:        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.9   root      255:        DlgMonitor_SetVdiStepping();
1.1.1.5   root      256: 
1.1.1.9   root      257:        /* The monitor dialog main loop */
1.1.1.5   root      258:        do
                    259:        {
1.1.1.15  root      260:                but = SDLGui_DoDialog(monitordlg, NULL, false);
1.1.1.5   root      261:                switch (but)
                    262:                {
1.1.1.9   root      263:                 case DLGSCRN_VDI_WLESS:
1.1.1.15  root      264:                        vdiw = Opt_ValueAlignMinMax(vdiw - nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
                    265:                        sprintf(sVdiWidth, "%4i", vdiw);
1.1.1.5   root      266:                        break;
1.1.1.9   root      267:                 case DLGSCRN_VDI_WMORE:
1.1.1.15  root      268:                        vdiw = Opt_ValueAlignMinMax(vdiw + nVdiStepX, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
                    269:                        sprintf(sVdiWidth, "%4i", vdiw);
1.1.1.5   root      270:                        break;
                    271: 
1.1.1.9   root      272:                 case DLGSCRN_VDI_HLESS:
1.1.1.15  root      273:                        vdih = Opt_ValueAlignMinMax(vdih - nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
                    274:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      275:                        break;
1.1.1.9   root      276:                 case DLGSCRN_VDI_HMORE:
1.1.1.15  root      277:                        vdih = Opt_ValueAlignMinMax(vdih + nVdiStepY, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
                    278:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      279:                        break;
                    280: 
                    281:                 case DLGSCRN_BPP1:
                    282:                 case DLGSCRN_BPP2:
                    283:                 case DLGSCRN_BPP4:
1.1.1.9   root      284:                        DlgMonitor_SetVdiStepping();
1.1.1.5   root      285:                        /* Align resolution to actual conditions: */
1.1.1.15  root      286:                        vdiw = Opt_ValueAlignMinMax(vdiw, nVdiStepX, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
                    287:                        vdih = Opt_ValueAlignMinMax(vdih, nVdiStepY, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
                    288:                        sprintf(sVdiWidth, "%4i", vdiw);
                    289:                        sprintf(sVdiHeight, "%4i", vdih);
1.1.1.5   root      290:                        break;
1.1.1.9   root      291:                }
                    292:        }
                    293:        while (but != DLGSCRN_EXIT_MONITOR && but != SDLGUI_QUIT
                    294:                && but != SDLGUI_ERROR && !bQuitProgram);
                    295: 
                    296:        /* Read new values from dialog: */
                    297: 
                    298:        ConfigureParams.Screen.bAllowOverscan = (monitordlg[DLGSCRN_OVERSCAN].state & SG_SELECTED);
                    299: 
                    300:        for (mti = MONITOR_TYPE_MONO; mti <= MONITOR_TYPE_TV; mti++)
                    301:        {
                    302:                if (monitordlg[mti + DLGSCRN_MONO].state & SG_SELECTED)
                    303:                {
                    304:                        ConfigureParams.Screen.nMonitorType = mti;
                    305:                        break;
                    306:                }
                    307:        }
1.1.1.15  root      308:        ConfigureParams.Screen.nVdiWidth = vdiw;
                    309:        ConfigureParams.Screen.nVdiHeight = vdih;
1.1.1.9   root      310: 
                    311:        ConfigureParams.Screen.bUseExtVdiResolutions = (monitordlg[DLGSCRN_USEVDIRES].state & SG_SELECTED);
                    312:        for (i=0; i<3; i++)
                    313:        {
                    314:                if (monitordlg[DLGSCRN_BPP1 + i].state & SG_SELECTED)
                    315:                        ConfigureParams.Screen.nVdiColors = GEMCOLOR_2 + i;
                    316:        }
                    317: }
                    318: 
                    319: 
                    320: /*-----------------------------------------------------------------------*/
                    321: /**
                    322:  * Show and process the window dialog.
                    323:  */
                    324: void Dialog_WindowDlg(void)
                    325: {
1.1.1.15  root      326:        int maxw, maxh, deskw, deskh, but, skip = 0;
1.1.1.9   root      327:        unsigned int i;
                    328: 
                    329:        SDLGui_CenterDlg(windowdlg);
                    330: 
                    331:        /* Set up general window options in the dialog from actual values: */
                    332: 
                    333:        if (ConfigureParams.Screen.bFullScreen)
                    334:                windowdlg[DLGSCRN_FULLSCRN].state |= SG_SELECTED;
                    335:        else
                    336:                windowdlg[DLGSCRN_FULLSCRN].state &= ~SG_SELECTED;
                    337: 
1.1.1.10  root      338:        if (ConfigureParams.Screen.bKeepResolution)
                    339:                windowdlg[DLGSCRN_KEEP_RES].state |= SG_SELECTED;
                    340:        else
                    341:                windowdlg[DLGSCRN_KEEP_RES].state &= ~SG_SELECTED;
1.1.1.16  root      342: #if !WITH_SDL2
1.1.1.14  root      343:        if (ConfigureParams.Screen.bKeepResolutionST)
                    344:                windowdlg[DLGSCRN_KEEP_RES_ST].state |= SG_SELECTED;
                    345:        else
                    346:                windowdlg[DLGSCRN_KEEP_RES_ST].state &= ~SG_SELECTED;
1.1.1.16  root      347: #endif
1.1.1.10  root      348: 
                    349:        windowdlg[DLGSCRN_STATUSBAR].state &= ~SG_SELECTED;
                    350:        windowdlg[DLGSCRN_DRIVELED].state &= ~SG_SELECTED;
                    351:        windowdlg[DLGSCRN_NONE].state &= ~SG_SELECTED;
1.1.1.9   root      352:        if (ConfigureParams.Screen.bShowStatusbar)
                    353:                windowdlg[DLGSCRN_STATUSBAR].state |= SG_SELECTED;
1.1.1.10  root      354:        else if (ConfigureParams.Screen.bShowDriveLed)
                    355:                windowdlg[DLGSCRN_DRIVELED].state |= SG_SELECTED;
1.1.1.11  root      356:        else
                    357:                windowdlg[DLGSCRN_NONE].state |= SG_SELECTED;
1.1.1.9   root      358: 
1.1.1.16  root      359:        for (i = 0; i < ARRAY_SIZE(skip_frames); i++)
1.1.1.9   root      360:        {
                    361:                if (ConfigureParams.Screen.nFrameSkips >= skip_frames[i])
                    362:                        skip = i;
                    363:                windowdlg[i+DLGSCRN_SKIP0].state &= ~SG_SELECTED;
                    364:        }
                    365:        windowdlg[DLGSCRN_SKIP0+skip].state |= SG_SELECTED;
                    366: 
1.1.1.10  root      367:        Resolution_GetDesktopSize(&deskw, &deskh);
1.1.1.15  root      368:        maxw = ConfigureParams.Screen.nMaxWidth;
                    369:        maxh = ConfigureParams.Screen.nMaxHeight;
                    370:        sprintf(sMaxWidth, "%4i", maxw);
                    371:        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      372: 
                    373:        /* Initialize window capture options: */
                    374: 
1.1.1.10  root      375:        if (ConfigureParams.Screen.bCrop)
                    376:                windowdlg[DLGSCRN_CROP].state |= SG_SELECTED;
1.1.1.9   root      377:        else
1.1.1.10  root      378:                windowdlg[DLGSCRN_CROP].state &= ~SG_SELECTED;
1.1.1.9   root      379: 
                    380:        if (Avi_AreWeRecording())
1.1.1.15  root      381:                windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP;
1.1.1.9   root      382:        else
1.1.1.15  root      383:                windowdlg[DLGSCRN_RECANIM].txt = RECORD_START;
                    384: 
                    385: #if WITH_SDL2
                    386:        /* SDL2 options */
1.1.1.17! root      387:        if (ConfigureParams.Screen.bResizable)
        !           388:                windowdlg[DLGSCRN_RESIZABLE].state |= SG_SELECTED;
        !           389:        else
        !           390:                windowdlg[DLGSCRN_RESIZABLE].state &= ~SG_SELECTED;
1.1.1.15  root      391:        if (ConfigureParams.Screen.nRenderScaleQuality)
                    392:                windowdlg[DLGSCRN_LINEARSCALE].state |= SG_SELECTED;
                    393:        else
                    394:                windowdlg[DLGSCRN_LINEARSCALE].state &= ~SG_SELECTED;
                    395: 
                    396:        if (ConfigureParams.Screen.bUseVsync)
                    397:                windowdlg[DLGSCRN_VSYNC].state |= SG_SELECTED;
                    398:        else
                    399:                windowdlg[DLGSCRN_VSYNC].state &= ~SG_SELECTED;
                    400: #endif
1.1.1.9   root      401: 
                    402:        /* The window dialog main loop */
                    403:        do
                    404:        {
1.1.1.15  root      405:                but = SDLGui_DoDialog(windowdlg, NULL, false);
1.1.1.9   root      406:                switch (but)
                    407:                {
                    408:                 case DLGSCRN_MAX_WLESS:
1.1.1.15  root      409:                        maxw = Opt_ValueAlignMinMax(maxw - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw);
                    410:                        sprintf(sMaxWidth, "%4i", maxw);
1.1.1.9   root      411:                        break;
                    412:                 case DLGSCRN_MAX_WMORE:
1.1.1.15  root      413:                        maxw = Opt_ValueAlignMinMax(maxw + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_WIDTH, deskw);
                    414:                        sprintf(sMaxWidth, "%4i", maxw);
1.1.1.9   root      415:                        break;
                    416: 
                    417:                 case DLGSCRN_MAX_HLESS:
1.1.1.15  root      418:                        maxh = Opt_ValueAlignMinMax(maxh - MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh);
                    419:                        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      420:                        break;
                    421:                 case DLGSCRN_MAX_HMORE:
1.1.1.15  root      422:                        maxh = Opt_ValueAlignMinMax(maxh + MAX_SIZE_STEP, MAX_SIZE_STEP, MIN_VDI_HEIGHT, deskh);
                    423:                        sprintf(sMaxHeight, "%4i", maxh);
1.1.1.9   root      424:                        break;
1.1.1.5   root      425: 
                    426:                 case DLGSCRN_CAPTURE:
                    427:                        SDL_UpdateRect(sdlscrn, 0,0,0,0);
1.1.1.10  root      428:                        ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
1.1.1.5   root      429:                        ScreenSnapShot_SaveScreen();
                    430:                        break;
1.1.1.9   root      431: 
                    432:                case DLGSCRN_RECANIM:
                    433:                        if (Avi_AreWeRecording())
1.1.1.5   root      434:                        {
1.1.1.9   root      435:                                /* AVI indexing can take a while for larger files */
                    436:                                Statusbar_AddMessage("Finishing AVI file...", 100);
1.1.1.14  root      437:                                Statusbar_Update(sdlscrn, true);
1.1.1.9   root      438:                                Avi_StopRecording();
1.1.1.15  root      439:                                windowdlg[DLGSCRN_RECANIM].txt = RECORD_START;
1.1.1.9   root      440:                                Statusbar_AddMessage("Emulation paused", 100);
1.1.1.14  root      441:                                Statusbar_Update(sdlscrn, true);
1.1.1.5   root      442:                        }
                    443:                        else
                    444:                        {
1.1.1.10  root      445:                                ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
                    446:                                Avi_StartRecording ( ConfigureParams.Video.AviRecordFile , ConfigureParams.Screen.bCrop ,
                    447:                                        ConfigureParams.Video.AviRecordFps == 0 ?
                    448:                                                ClocksTimings_GetVBLPerSec ( ConfigureParams.System.nMachineType , nScreenRefreshRate ) :
                    449:                                                (Uint32)ConfigureParams.Video.AviRecordFps << CLOCKS_TIMINGS_SHIFT_VBL ,
                    450:                                        1 << CLOCKS_TIMINGS_SHIFT_VBL ,
                    451:                                        ConfigureParams.Video.AviRecordVcodec );
1.1.1.15  root      452:                                windowdlg[DLGSCRN_RECANIM].txt = RECORD_STOP;
1.1.1.5   root      453:                        }
                    454:                        break;
                    455:                }
                    456:        }
1.1.1.9   root      457:        while (but != DLGSCRN_EXIT_WINDOW && but != SDLGUI_QUIT
1.1.1.5   root      458:                && but != SDLGUI_ERROR && !bQuitProgram);
                    459: 
                    460:        /* Read new values from dialog: */
                    461: 
1.1.1.9   root      462:        ConfigureParams.Screen.bFullScreen = (windowdlg[DLGSCRN_FULLSCRN].state & SG_SELECTED);
1.1.1.10  root      463:        ConfigureParams.Screen.bKeepResolution = (windowdlg[DLGSCRN_KEEP_RES].state & SG_SELECTED);
1.1.1.16  root      464: #if !WITH_SDL2
1.1.1.14  root      465:        ConfigureParams.Screen.bKeepResolutionST = (windowdlg[DLGSCRN_KEEP_RES_ST].state & SG_SELECTED);
1.1.1.16  root      466: #endif
1.1.1.5   root      467: 
1.1.1.15  root      468:        ConfigureParams.Screen.nMaxWidth = maxw;
                    469:        ConfigureParams.Screen.nMaxHeight = maxh;
                    470: 
1.1.1.10  root      471:        ConfigureParams.Screen.bShowStatusbar = false;
                    472:        ConfigureParams.Screen.bShowDriveLed = false;
1.1.1.9   root      473:        if (windowdlg[DLGSCRN_STATUSBAR].state & SG_SELECTED)
1.1.1.8   root      474:                ConfigureParams.Screen.bShowStatusbar = true;
1.1.1.10  root      475:        else if (windowdlg[DLGSCRN_DRIVELED].state & SG_SELECTED)
                    476:                ConfigureParams.Screen.bShowDriveLed = true;
1.1.1.5   root      477: 
                    478:        for (i = DLGSCRN_SKIP0; i <= DLGSCRN_SKIP4; i++)
                    479:        {
1.1.1.9   root      480:                if (windowdlg[i].state & SG_SELECTED)
1.1.1.5   root      481:                {
1.1.1.6   root      482:                        ConfigureParams.Screen.nFrameSkips = skip_frames[i-DLGSCRN_SKIP0];
1.1.1.5   root      483:                        break;
                    484:                }
                    485:        }
1.1.1.2   root      486: 
1.1.1.10  root      487:        ConfigureParams.Screen.bCrop = (windowdlg[DLGSCRN_CROP].state & SG_SELECTED);
1.1.1.15  root      488: 
                    489: #if WITH_SDL2
1.1.1.17! root      490:        ConfigureParams.Screen.bResizable = (windowdlg[DLGSCRN_RESIZABLE].state & SG_SELECTED);
1.1.1.15  root      491:        ConfigureParams.Screen.nRenderScaleQuality = (windowdlg[DLGSCRN_LINEARSCALE].state & SG_SELECTED) ? 1 : 0;
                    492:        ConfigureParams.Screen.bUseVsync = (windowdlg[DLGSCRN_VSYNC].state & SG_SELECTED);
                    493: #endif
1.1       root      494: }

unix.superglobalmegacorp.com

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