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

1.1       root        1: /*
                      2:   Hatari - dlgScreen.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 DlgScreen_rcsid[] = "Hatari $Id: dlgScreen.c,v 1.6 2006/02/08 22:46:10 eerot Exp $";
1.1       root        8: 
                      9: #include "main.h"
                     10: #include "configuration.h"
                     11: #include "dialog.h"
                     12: #include "sdlgui.h"
                     13: #include "screen.h"
                     14: #include "screenSnapShot.h"
1.1.1.2   root       15: #include "vdi.h"
1.1       root       16: 
                     17: 
                     18: #define DLGSCRN_FULLSCRN   3
1.1.1.2   root       19: #define DLGSCRN_FRAMESKIP  4
                     20: #define DLGSCRN_OVERSCAN   5
                     21: #define DLGSCRN_INTERLEAVE 6
1.1       root       22: #define DLGSCRN_8BPP       7
1.1.1.2   root       23: #define DLGSCRN_ZOOMLOWRES 8
                     24: #define DLGSCRN_COLOR      10
                     25: #define DLGSCRN_MONO       11
                     26: #define DLGSCRN_USEVDIRES  13
                     27: #define DLGSCRN_RES640     15
                     28: #define DLGSCRN_RES800     16
                     29: #define DLGSCRN_RES1024    17
                     30: #define DLGSCRN_BPP1       19
                     31: #define DLGSCRN_BPP2       20
                     32: #define DLGSCRN_BPP4       21
                     33: #define DLGSCRN_ONCHANGE   24
                     34: #define DLGSCRN_FPSPOPUP   26
                     35: #define DLGSCRN_CAPTURE    27
                     36: #define DLGSCRN_RECANIM    28
                     37: #define DLGSCRN_EXIT       29
1.1       root       38: 
                     39: 
                     40: /* The screen dialog: */
                     41: static SGOBJ screendlg[] =
                     42: {
1.1.1.2   root       43:   { SGBOX, 0, 0, 0,0, 50,25, NULL },
                     44: 
                     45:   { SGBOX, 0, 0, 1,1, 48,7, NULL },
                     46:   { SGTEXT, 0, 0, 18,1, 14,1, "Screen options" },
                     47:   { SGCHECKBOX, 0, 0, 4,3, 12,1, "Fullscreen" },
                     48:   { SGCHECKBOX, 0, 0, 4,4, 12,1, "Frame skip" },
                     49:   { SGCHECKBOX, 0, 0, 4,5, 13,1, "Use borders" },
                     50:   { SGCHECKBOX, 0, 0, 25,3, 18,1, "Interleaved mode" },
                     51:   { SGCHECKBOX, 0, 0, 25,4, 13,1, "Force 8 bpp" },
                     52:   { SGCHECKBOX, 0, 0, 25,5, 18,1, "Zoom ST-low res." },
                     53:   { SGTEXT, 0, 0, 4,7, 8,1, "Monitor:" },
                     54:   { SGRADIOBUT, 0, 0, 16,7, 7,1, "Color" },
                     55:   { SGRADIOBUT, 0, 0, 26,7, 6,1, "Mono" },
                     56: 
                     57:   { SGBOX, 0, 0, 1,9, 48,6, NULL },
                     58:   { SGCHECKBOX, 0, 0, 2,10, 33,1, "Use extended GEM VDI resolution" },
                     59:   { SGTEXT, 0, 0, 2,12, 11,1, "Resolution:" },
                     60:   { SGRADIOBUT, 0, 0, 15,12, 9,1, "640x480" },
                     61:   { SGRADIOBUT, 0, 0, 26,12, 9,1, "800x600" },
                     62:   { SGRADIOBUT, 0, 0, 37,12, 10,1, "1024x768" },
                     63:   { SGTEXT, 0, 0, 2,13, 12,1, "Color Depth:" },
                     64:   { SGRADIOBUT, 0, 0, 17,13, 7,1, "1 bpp" },
                     65:   { SGRADIOBUT, 0, 0, 26,13, 7,1, "2 bpp" },
                     66:   { SGRADIOBUT, 0, 0, 35,13, 7,1, "4 bpp" },
                     67: 
                     68:   { SGBOX, 0, 0, 1,16, 48,6, NULL },
                     69:   { SGTEXT, 0, 0, 18,16, 14,1, "Screen capture" },
                     70:   { SGCHECKBOX, 0, 0, 4,18, 39,1, "Capture only when display changes" },
                     71:   { SGTEXT, 0, 0, 31,19, 4,1, ""/*"FPS:"*/ },
                     72:   { SGTEXT/*SGPOPUP*/, 0, 0, 36,19, 3,1, ""/*"25"*/ },
                     73:   { SGBUTTON, 0, 0, 6,20, 16,1, "Capture screen" },
                     74:   { SGBUTTON, 0, 0, 26,20, 18,1, NULL },
                     75: 
                     76:   { SGBUTTON, 0, 0, 15,23, 20,1, "Back to main menu" },
1.1       root       77:   { -1, 0, 0, 0,0, 0,0, NULL }
                     78: };
                     79: 
                     80: 
                     81: /*-----------------------------------------------------------------------*/
                     82: /*
                     83:   Show and process the screen dialog.
                     84: */
                     85: void Dialog_ScreenDlg(void)
                     86: {
1.1.1.2   root       87:   int but;
                     88:   int i;
1.1       root       89: 
                     90:   SDLGui_CenterDlg(screendlg);
                     91: 
1.1.1.2   root       92:   /* Set up general screen options in the dialog from actual values: */
1.1       root       93: 
1.1.1.2   root       94:   if (DialogParams.Screen.bFullScreen)
1.1       root       95:     screendlg[DLGSCRN_FULLSCRN].state |= SG_SELECTED;
                     96:   else
                     97:     screendlg[DLGSCRN_FULLSCRN].state &= ~SG_SELECTED;
                     98: 
1.1.1.2   root       99:   if (DialogParams.Screen.bFrameSkip)
1.1       root      100:     screendlg[DLGSCRN_FRAMESKIP].state |= SG_SELECTED;
                    101:   else
                    102:     screendlg[DLGSCRN_FRAMESKIP].state &= ~SG_SELECTED;
                    103: 
1.1.1.2   root      104:   if (DialogParams.Screen.bAllowOverscan)
1.1       root      105:     screendlg[DLGSCRN_OVERSCAN].state |= SG_SELECTED;
                    106:   else
                    107:     screendlg[DLGSCRN_OVERSCAN].state &= ~SG_SELECTED;
                    108: 
1.1.1.2   root      109:   if (DialogParams.Screen.bInterleavedScreen)
                    110:     screendlg[DLGSCRN_INTERLEAVE].state |= SG_SELECTED;
                    111:   else
                    112:     screendlg[DLGSCRN_INTERLEAVE].state &= ~SG_SELECTED;
                    113: 
                    114:   if (DialogParams.Screen.ChosenDisplayMode <= DISPLAYMODE_LOWCOL_LOWRES
                    115:       || DialogParams.Screen.ChosenDisplayMode <= DISPLAYMODE_LOWCOL_HIGHRES)
                    116:     screendlg[DLGSCRN_8BPP].state |= SG_SELECTED;
                    117:   else
                    118:     screendlg[DLGSCRN_8BPP].state &= ~SG_SELECTED;
                    119: 
                    120:   if (DialogParams.Screen.ChosenDisplayMode == DISPLAYMODE_LOWCOL_HIGHRES
                    121:       || DialogParams.Screen.ChosenDisplayMode == DISPLAYMODE_HICOL_HIGHRES)
                    122:     screendlg[DLGSCRN_ZOOMLOWRES].state |= SG_SELECTED;
                    123:   else
                    124:     screendlg[DLGSCRN_ZOOMLOWRES].state &= ~SG_SELECTED;
1.1       root      125: 
1.1.1.2   root      126:   if (DialogParams.Screen.bUseHighRes)
1.1       root      127:   {
                    128:     screendlg[DLGSCRN_COLOR].state &= ~SG_SELECTED;
                    129:     screendlg[DLGSCRN_MONO].state |= SG_SELECTED;
                    130:   }
                    131:   else
                    132:   {
                    133:     screendlg[DLGSCRN_COLOR].state |= SG_SELECTED;
                    134:     screendlg[DLGSCRN_MONO].state &= ~SG_SELECTED;
                    135:   }
                    136: 
1.1.1.2   root      137:   /* Initialize VDI resolution options: */
1.1       root      138: 
1.1.1.2   root      139:   if (DialogParams.Screen.bUseExtVdiResolutions)
                    140:     screendlg[DLGSCRN_USEVDIRES].state |= SG_SELECTED;
1.1       root      141:   else
1.1.1.2   root      142:     screendlg[DLGSCRN_USEVDIRES].state &= ~SG_SELECTED;
                    143: 
                    144:   for (i=0; i<3; i++)
1.1       root      145:   {
1.1.1.2   root      146:     screendlg[DLGSCRN_RES640 + i].state &= ~SG_SELECTED;
                    147:     screendlg[DLGSCRN_BPP1 + i].state &= ~SG_SELECTED;
1.1       root      148:   }
1.1.1.2   root      149:   screendlg[DLGSCRN_RES640 + DialogParams.Screen.nVdiResolution - GEMRES_640x480].state |= SG_SELECTED;
                    150:   screendlg[DLGSCRN_BPP1 + DialogParams.Screen.nVdiColors - GEMCOLOUR_2].state |= SG_SELECTED;
                    151: 
                    152:   /* Initialize screen capture options: */
1.1       root      153: 
                    154:   if( DialogParams.Screen.bCaptureChange )
                    155:     screendlg[DLGSCRN_ONCHANGE].state |= SG_SELECTED;
                    156:   else
                    157:     screendlg[DLGSCRN_ONCHANGE].state &= ~SG_SELECTED;
                    158: 
                    159:   if( ScreenSnapShot_AreWeRecording() )
                    160:     screendlg[DLGSCRN_RECANIM].txt = "Stop recording";
                    161:   else
                    162:     screendlg[DLGSCRN_RECANIM].txt = "Record animation";
                    163: 
                    164:   /* The screen dialog main loop */
                    165:   do
                    166:   {
1.1.1.3   root      167:     but = SDLGui_DoDialog(screendlg, NULL);
1.1       root      168:     switch( but )
                    169:     {
                    170:       case DLGSCRN_FPSPOPUP:
                    171:         fprintf(stderr,"Sorry, popup menus don't work yet\n");
                    172:         break;
                    173:       case DLGSCRN_CAPTURE:
                    174:         SDL_UpdateRect(sdlscrn, 0,0,0,0);
                    175:         ScreenSnapShot_SaveScreen();
                    176:         break;
                    177:       case DLGSCRN_RECANIM:
                    178:         if( ScreenSnapShot_AreWeRecording() )
                    179:         {
                    180:           screendlg[DLGSCRN_RECANIM].txt = "Record animation";
                    181:           ScreenSnapShot_EndRecording();
                    182:         }
                    183:         else
                    184:         {
                    185:           screendlg[DLGSCRN_RECANIM].txt = "Stop recording";
                    186:           DialogParams.Screen.bCaptureChange = (screendlg[DLGSCRN_ONCHANGE].state & SG_SELECTED);
                    187:           ScreenSnapShot_BeginRecording(DialogParams.Screen.bCaptureChange, 25);
                    188:         }
                    189:         break;
                    190:     }
                    191:   }
1.1.1.3   root      192:   while (but != DLGSCRN_EXIT && but != SDLGUI_QUIT && !bQuitProgram);
1.1       root      193: 
1.1.1.2   root      194:   /* Read new values from dialog: */
                    195: 
1.1       root      196:   DialogParams.Screen.bFullScreen = (screendlg[DLGSCRN_FULLSCRN].state & SG_SELECTED);
                    197:   DialogParams.Screen.bFrameSkip = (screendlg[DLGSCRN_FRAMESKIP].state & SG_SELECTED);
                    198:   DialogParams.Screen.bAllowOverscan = (screendlg[DLGSCRN_OVERSCAN].state & SG_SELECTED);
1.1.1.2   root      199:   DialogParams.Screen.bInterleavedScreen = (screendlg[DLGSCRN_INTERLEAVE].state & SG_SELECTED);
1.1       root      200:   DialogParams.Screen.bUseHighRes = (screendlg[DLGSCRN_MONO].state & SG_SELECTED);
                    201: 
1.1.1.2   root      202:   if (screendlg[DLGSCRN_8BPP].state & SG_SELECTED)
1.1       root      203:   {
1.1.1.2   root      204:     if (screendlg[DLGSCRN_ZOOMLOWRES].state & SG_SELECTED)
                    205:       DialogParams.Screen.ChosenDisplayMode = DISPLAYMODE_LOWCOL_HIGHRES;
                    206:     else
                    207:       DialogParams.Screen.ChosenDisplayMode = DISPLAYMODE_LOWCOL_LOWRES;
                    208:   }
                    209:   else
                    210:   {
                    211:     if (screendlg[DLGSCRN_ZOOMLOWRES].state & SG_SELECTED)
                    212:       DialogParams.Screen.ChosenDisplayMode = DISPLAYMODE_HICOL_HIGHRES;
                    213:     else
                    214:       DialogParams.Screen.ChosenDisplayMode = DISPLAYMODE_HICOL_LOWRES;
1.1       root      215:   }
                    216: 
1.1.1.2   root      217:   DialogParams.Screen.bUseExtVdiResolutions = (screendlg[DLGSCRN_USEVDIRES].state & SG_SELECTED);
                    218:   for(i=0; i<3; i++)
                    219:   {
                    220:     if(screendlg[DLGSCRN_RES640 + i].state & SG_SELECTED)
                    221:       DialogParams.Screen.nVdiResolution = GEMRES_640x480 + i;
                    222:     if(screendlg[DLGSCRN_BPP1 + i].state & SG_SELECTED)
                    223:       DialogParams.Screen.nVdiColors = GEMCOLOUR_2 + i;
                    224:   }
                    225: 
                    226:   DialogParams.Screen.bCaptureChange = (screendlg[DLGSCRN_ONCHANGE].state & SG_SELECTED);
1.1       root      227: }

unix.superglobalmegacorp.com

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