Annotation of hatari/src/dialog.c, revision 1.1

1.1     ! root        1: /*
        !             2:   Hatari
        !             3: 
        !             4:   This is normal 'C' code to handle our options dialog. We keep all our configuration details
        !             5:   in a variable 'ConfigureParams'. When we open our dialog we copy this and then when we 'OK'
        !             6:   or 'Cancel' the dialog we can compare and makes the necessary changes. As the 'ConfigureParams'
        !             7:   is always up to date this is where we load/save data to the registry.
        !             8: */
        !             9: 
        !            10: #include "main.h"
        !            11: #include "configuration.h"
        !            12: #include "audio.h"
        !            13: #include "debug.h"
        !            14: #include "dialog.h"
        !            15: #include "file.h"
        !            16: #include "floppy.h"
        !            17: #include "reset.h"
        !            18: #include "joy.h"
        !            19: #include "keymap.h"
        !            20: #include "m68000.h"
        !            21: #include "memAlloc.h"
        !            22: #include "memorySnapShot.h"
        !            23: #include "misc.h"
        !            24: #include "printer.h"
        !            25: #include "rs232.h"
        !            26: #include "screen.h"
        !            27: #include "sound.h"
        !            28: #include "tos.h"
        !            29: #include "vdi.h"
        !            30: #include "video.h"
        !            31: #include "view.h"
        !            32: 
        !            33: 
        !            34: 
        !            35: DLG_PARAMS ConfigureParams,DialogParams;    /* List of configuration for system and dialog(so can choose 'Cancel') */
        !            36: BOOL bOKDialog;                             /* Did user 'OK' dialog? */
        !            37: int nLastOpenPage = 0;                      /* Last property page opened(so can re-open on this next time) */
        !            38: 
        !            39: 
        !            40: //-----------------------------------------------------------------------
        !            41: /*
        !            42:   Check if need to warn user that changes will take place after reset
        !            43:   Return TRUE if wants to reset
        !            44: */
        !            45: /*
        !            46: BOOL Dialog_DoNeedReset(void)
        !            47: {
        !            48:   // Did we change colour/mono monitor? If so, must reset
        !            49:   if (ConfigureParams.Screen.bUseHighRes!=DialogParams.Screen.bUseHighRes)
        !            50:     return(TRUE);
        !            51:   // Did change to GEM VDI display?
        !            52:   if (ConfigureParams.TOSGEM.bUseExtGEMResolutions!=DialogParams.TOSGEM.bUseExtGEMResolutions)
        !            53:     return(TRUE);
        !            54:   // Did change GEM resolution or colour depth?
        !            55:   if ( (ConfigureParams.TOSGEM.nGEMResolution!=DialogParams.TOSGEM.nGEMResolution)
        !            56:    || (ConfigureParams.TOSGEM.nGEMColours!=DialogParams.TOSGEM.nGEMColours) )
        !            57:     return(TRUE);
        !            58: 
        !            59:   return(FALSE);
        !            60: }
        !            61: */
        !            62: 
        !            63: //-----------------------------------------------------------------------
        !            64: /*
        !            65:   Copy details back to configuration and perform reset
        !            66: */
        !            67: /*
        !            68: void Dialog_CopyDialogParamsToConfiguration(BOOL bForceReset)
        !            69: {
        !            70:   BOOL NeedReset;
        !            71: 
        !            72:   // Do we need to warn user of that changes will only take effect after reset?
        !            73:   if (bForceReset)
        !            74:     NeedReset = bForceReset;
        !            75:   else
        !            76:     NeedReset = Dialog_DoNeedReset();
        !            77: 
        !            78:   // Do need to change DirectX resolution? Need if change display/overscan settings (if switch between Colour/Mono cause reset later)
        !            79:   if (bInFullScreen) {
        !            80:     if ( (DialogParams.Screen.ChosenDisplayMode!=ConfigureParams.Screen.ChosenDisplayMode)
        !            81:      || (DialogParams.Screen.Advanced.bAllowOverscan!=ConfigureParams.Screen.Advanced.bAllowOverscan) ) {
        !            82:       Screen_ReturnFromFullScreen();
        !            83:       ConfigureParams.Screen.ChosenDisplayMode = DialogParams.Screen.ChosenDisplayMode;
        !            84:       ConfigureParams.Screen.Advanced.bAllowOverscan = DialogParams.Screen.Advanced.bAllowOverscan;
        !            85:       Screen_EnterFullScreen();
        !            86:     }
        !            87:   }
        !            88:   // Did set new printer parameters?
        !            89:   if ( (DialogParams.Printer.bEnablePrinting!=ConfigureParams.Printer.bEnablePrinting)
        !            90:    || (DialogParams.Printer.bPrintToFile!=ConfigureParams.Printer.bPrintToFile)
        !            91:    || (stricmp(DialogParams.Printer.szPrintToFileName,ConfigureParams.Printer.szPrintToFileName)) )
        !            92:     Printer_CloseAllConnections();
        !            93:   // Did set new RS232 parameters?
        !            94:   if ( (DialogParams.RS232.bEnableRS232!=ConfigureParams.RS232.bEnableRS232)
        !            95:    || (DialogParams.RS232.nCOMPort!=ConfigureParams.RS232.nCOMPort) )
        !            96:     RS232_CloseCOMPort();
        !            97:   // Did stop sound? Or change playback Hz. If so, also stop sound recording
        !            98:   if ( (!DialogParams.Sound.bEnableSound) || (DialogParams.Sound.nPlaybackQuality!=ConfigureParams.Sound.nPlaybackQuality) ) {
        !            99:     if (Sound_AreWeRecording())
        !           100:       Sound_EndRecording(NULL);
        !           101:   }
        !           102: 
        !           103:   // Copy details to configuration, so can be saved out or set on reset
        !           104:   ConfigureParams = DialogParams;
        !           105:   // And write to configuration now, so don't loose
        !           106:   Configuration_UnInit();
        !           107: 
        !           108:   // Copy details to global, if we reset copy them all
        !           109:   Dialog_CopyDetailsFromConfiguration(NeedReset);
        !           110:   // Set keyboard remap file
        !           111:   Keymap_LoadRemapFile(ConfigureParams.Keyboard.szMappingFileName);
        !           112:   // Set new sound playback rate
        !           113:   DAudio_ReCreateDirectSoundBuffer();
        !           114:   // Resize window if need
        !           115:   if (!ConfigureParams.TOSGEM.bUseExtGEMResolutions)
        !           116:     View_ResizeWindowToFull();
        !           117: 
        !           118:   // Do we need to perform reset?
        !           119:   if (NeedReset) {
        !           120:     Reset_Cold();
        !           121:     Main_UnPauseEmulation();
        !           122:     View_ToggleWindowsMouse(MOUSE_ST);
        !           123:   }
        !           124: 
        !           125:   // Go into/return from full screen if flagged
        !           126:   if ( (!bInFullScreen) && (DialogParams.Screen.bFullScreen) )
        !           127:     Screen_EnterFullScreen();
        !           128:   else if ( bInFullScreen && (!DialogParams.Screen.bFullScreen) )
        !           129:     Screen_ReturnFromFullScreen();
        !           130: }
        !           131: */
        !           132: 
        !           133: //-----------------------------------------------------------------------
        !           134: /*
        !           135:   Default elements of configuration structure
        !           136: */
        !           137: /*
        !           138: void Dialog_DefaultConfigurationDetails(void)
        !           139: {
        !           140:   // Clear parameters
        !           141:   Memory_Clear(&ConfigureParams,sizeof(DLG_PARAMS));
        !           142: 
        !           143:   // Set defaults
        !           144:   Dialog_Configure_SetDefaults();
        !           145:   Dialog_Screen_SetDefaults();
        !           146:   Dialog_Joysticks_SetDefaults();
        !           147:   Dialog_Keyboard_SetDefaults();
        !           148:   Dialog_Sound_SetDefaults();
        !           149:   Dialog_Memory_SetDefaults();
        !           150:   Dialog_DiscImage_SetDefaults();
        !           151:   Dialog_HardDisc_SetDefaults();
        !           152:   Dialog_TOSGEM_SetDefaults();
        !           153:   Dialog_RS232_SetDefaults();
        !           154:   Dialog_Printer_SetDefaults();
        !           155:   Dialog_Favourites_SetDefaults();
        !           156: }
        !           157: */
        !           158: 
        !           159: //-----------------------------------------------------------------------
        !           160: /*
        !           161:   Copy details from configuration structure into global variables for system
        !           162: */
        !           163: /*
        !           164: void Dialog_CopyDetailsFromConfiguration(BOOL bReset)
        !           165: {
        !           166:   // Set new timer thread
        !           167:   Main_SetSpeedThreadTimer(ConfigureParams.Configure.nMinMaxSpeed);
        !           168:   // Set resolution change
        !           169:   if (bReset) {
        !           170:     bUseVDIRes = ConfigureParams.TOSGEM.bUseExtGEMResolutions;
        !           171:     bUseHighRes = ConfigureParams.Screen.bUseHighRes || (bUseVDIRes && (ConfigureParams.TOSGEM.nGEMColours==GEMCOLOUR_2));
        !           172:     VDI_SetResolution(VDIModeOptions[ConfigureParams.TOSGEM.nGEMResolution],ConfigureParams.TOSGEM.nGEMColours);
        !           173:   }
        !           174:   // Set playback frequency
        !           175:   DAudio_SetOutputAudioFreq(ConfigureParams.Sound.nPlaybackQuality);
        !           176: 
        !           177:   // Remove back-slashes, etc.. from names
        !           178:   File_CleanFileName(ConfigureParams.TOSGEM.szTOSImageFileName);
        !           179: }
        !           180: */
        !           181: 
        !           182: //-----------------------------------------------------------------------
        !           183: /*
        !           184:   Open Property sheet Options dialog
        !           185:   Return TRUE is use chose OK, or FALSE if cancel!
        !           186: */
        !           187: /*
        !           188: BOOL Dialog_DoProperty(int StartingPage,BOOL bForceReset)
        !           189: {
        !           190:     PROPSHEETPAGE psp[NUM_PROPERTY_PAGES];
        !           191:     PROPSHEETHEADER psh;
        !           192:   int i;
        !           193: 
        !           194:   // Copy details to DialogParams(this is so can restore if 'Cancel' dialog)
        !           195:   ConfigureParams.Screen.bFullScreen = bInFullScreen;
        !           196:   DialogParams = ConfigureParams;
        !           197: 
        !           198:   // Create property pages for dialog
        !           199:   for(i=0; i<NUM_PROPERTY_PAGES; i++) {
        !           200:       psp[i].dwSize = sizeof(PROPSHEETPAGE);
        !           201:     psp[i].dwFlags = PSP_USETITLE | PSP_HASHELP;
        !           202:       psp[i].hInstance = hInst;
        !           203:     psp[i].pszTemplate = MAKEINTRESOURCE(DialogPages[i].PageIDD);
        !           204:       psp[i].pszIcon = NULL;
        !           205:     psp[i].pfnDlgProc = DialogPages[i].pDlgProc;
        !           206:       psp[i].pszTitle = DialogPages[i].pTitle;
        !           207:     psp[i].lParam = 0;
        !           208:     psp[i].pfnCallback = NULL;
        !           209:   }
        !           210: 
        !           211:   // Set up property page
        !           212:     psh.dwSize = sizeof(PROPSHEETHEADER);
        !           213:     psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_HASHELP | PSH_USECALLBACK;
        !           214:     psh.hwndParent = hWnd;
        !           215:     psh.hInstance = hInst;
        !           216:     psh.pszIcon = NULL;
        !           217:     psh.pszCaption = (LPSTR)"Hatari Options";
        !           218:     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
        !           219:     psh.nStartPage = StartingPage;
        !           220:     psh.ppsp = (LPCPROPSHEETPAGE)&psp;
        !           221:     psh.pfnCallback = Dialog_PropertyCallBack;    // Callback to store of window handle
        !           222: 
        !           223:   // Clear handles(used to access other pages of dialog from another)
        !           224:   Dialog_Configure_ClearHandle();
        !           225:   Dialog_Screen_ClearHandle();
        !           226:   Dialog_Sound_ClearHandle();
        !           227: 
        !           228:   bOKDialog = FALSE;                // Reset OK flag
        !           229:   bSaveMemoryState = FALSE;
        !           230:   bRestoreMemoryState = FALSE;
        !           231:     PropertySheet(&psh);
        !           232: 
        !           233:   // Copy details to configuration, and ask user if wishes to reset
        !           234:   if (bOKDialog)
        !           235:     Dialog_CopyDialogParamsToConfiguration(bForceReset);
        !           236:   // Did want to save/restore memory save? If did, need to re-enter emulation mode so can save in 'safe-zone'
        !           237:   if (bSaveMemoryState || bRestoreMemoryState) {
        !           238:     // Back into emulation mode, when next VBL occurs state will be safed - otherwise registers are unknown
        !           239:     View_ToggleWindowsMouse(MOUSE_ST);
        !           240:   }
        !           241: 
        !           242:   return(bOKDialog);
        !           243: }
        !           244: */
        !           245: 
        !           246: //-----------------------------------------------------------------------
        !           247: /*
        !           248:   Simple call back to store off hWnd of Property sheet dialog so can choose 'OK' when dbl-click Favourites
        !           249: */
        !           250: /*
        !           251: BOOL CALLBACK Dialog_PropertyCallBack(HWND hDlg,UINT wParam, LONG lParam)
        !           252: {
        !           253:   // Just store, handle when Initialised
        !           254:   PropHWnd =  hDlg;
        !           255: 
        !           256:   return(FALSE);
        !           257: }
        !           258: */
        !           259: 
        !           260: //-----------------------------------------------------------------------
        !           261: /*
        !           262:   Set status of dialog button using flag
        !           263: */
        !           264: /*
        !           265: void Dialog_SetButton(HWND hDlg,int ButtonID,int Flag)
        !           266: {
        !           267:   if (hDlg) {
        !           268:     if (Flag)
        !           269:       CheckDlgButton(hDlg,ButtonID,BST_CHECKED);
        !           270:     else
        !           271:       CheckDlgButton(hDlg,ButtonID,BST_UNCHECKED);
        !           272:   }
        !           273: }
        !           274: */
        !           275: 
        !           276: //-----------------------------------------------------------------------
        !           277: /*
        !           278:   Read status of dialog button
        !           279: */
        !           280: /*
        !           281: BOOL Dialog_ReadButton(HWND hDlg,int ButtonID)
        !           282: {
        !           283:   if (IsDlgButtonChecked(hDlg,ButtonID)==BST_CHECKED)
        !           284:     return(TRUE);
        !           285:   else
        !           286:     return(FALSE);
        !           287: }
        !           288: 
        !           289: //-----------------------------------------------------------------------
        !           290: /*
        !           291:   Enable dialog item
        !           292: */
        !           293: /*
        !           294: void Dialog_EnableItem(HWND hDlg,int ButtonID,int State)
        !           295: {
        !           296:   EnableWindow(GetDlgItem(hDlg,ButtonID),State);
        !           297: }
        !           298: */
        !           299: 
        !           300: //-----------------------------------------------------------------------
        !           301: /*
        !           302:   Enable dialog items
        !           303: */
        !           304: /*
        !           305: void Dialog_EnableItems(HWND hDlg,int *pButtonIDs,int State)
        !           306: {
        !           307:   int i=0;
        !           308: 
        !           309:   // Enable each button in list
        !           310:   while(pButtonIDs[i]) {
        !           311:     Dialog_EnableItem(hDlg,pButtonIDs[i],State);
        !           312:     i++;
        !           313:   }
        !           314: }
        !           315: */
        !           316: 
        !           317: //-----------------------------------------------------------------------
        !           318: /*
        !           319:   Show dialog items, in range(ie controls all have consecutive IDs - dodgy very very handy!)
        !           320: */
        !           321: /*
        !           322: void Dialog_ShowItemRange(HWND hDlg,int LowButtonID,int HighButtonID,int Show)
        !           323: {
        !           324:   int i;
        !           325: 
        !           326:   for(i=LowButtonID; i<=HighButtonID; i++)
        !           327:     ShowWindow(GetDlgItem(hDlg,i),Show);
        !           328: }
        !           329: */
        !           330: 
        !           331: //-----------------------------------------------------------------------
        !           332: /*
        !           333:   Set text item in dialog
        !           334: */
        !           335: /*
        !           336: void Dialog_SetText(HWND hDlg,int ButtonID,char *szString)
        !           337: {
        !           338:   SendDlgItemMessage(hDlg,ButtonID,WM_SETTEXT,0,(LPARAM)szString);
        !           339: }
        !           340: */
        !           341: 
        !           342: //-----------------------------------------------------------------------
        !           343: /*
        !           344:   Read text item from dialog
        !           345: */
        !           346: /*
        !           347: void Dialog_ReadText(HWND hDlg,int ButtonID,char *szString)
        !           348: {
        !           349:   SendDlgItemMessage(hDlg,ButtonID,WM_GETTEXT,1024,(LPARAM)szString);
        !           350: }
        !           351: */
        !           352: 
        !           353: //-----------------------------------------------------------------------
        !           354: /*
        !           355:   Set Trackbar control range and select
        !           356: */
        !           357: /*
        !           358: void Dialog_SetTrackBar(HWND hDlg, int nTrackBarID, int nMin, int nMax, int nSelected)
        !           359: {
        !           360:   SendDlgItemMessage(hDlg,nTrackBarID,TBM_SETRANGE,TRUE,(LPARAM)MAKELONG(nMin,nMax));
        !           361:   SendDlgItemMessage(hDlg,nTrackBarID,TBM_SETPOS,TRUE,(LPARAM)nSelected);
        !           362: }
        !           363: */
        !           364: 
        !           365: //-----------------------------------------------------------------------
        !           366: /*
        !           367:   Read Trackbar control selection
        !           368: */
        !           369: /*
        !           370: int Dialog_GetTrackBar(HWND hDlg, int nTrackBarID)
        !           371: {
        !           372:   int nSelectedItem;
        !           373: 
        !           374:   // Read selected item, if error default to first item in list
        !           375:   nSelectedItem = SendDlgItemMessage(hDlg,nTrackBarID,TBM_GETPOS,0,(LONG)0);
        !           376:   if (nSelectedItem==CB_ERR)
        !           377:     nSelectedItem = 0;
        !           378: 
        !           379:   return(nSelectedItem);
        !           380: }
        !           381: */
        !           382: 
        !           383: //-----------------------------------------------------------------------
        !           384: /*
        !           385:   Add string items to a Combo Box
        !           386: */
        !           387: /*
        !           388: void Dialog_SetComboBoxItems(HWND hDlg, int ComboBoxID, char *pComboBoxStrings[], int nSelectedItem)
        !           389: {
        !           390:   int i=0;
        !           391: 
        !           392:   // Reset items
        !           393:   SendDlgItemMessage(hDlg,ComboBoxID,CB_RESETCONTENT,0,(LONG)0);
        !           394:   // Add items strings
        !           395:   while(pComboBoxStrings[i]) {
        !           396:     if (strlen(pComboBoxStrings[i])>0)
        !           397:       SendDlgItemMessage(hDlg,ComboBoxID,CB_ADDSTRING,0,(LONG)pComboBoxStrings[i]);
        !           398:     i++;
        !           399:   }
        !           400: 
        !           401:   // And select chosen item
        !           402:   SendDlgItemMessage(hDlg,ComboBoxID,CB_SETCURSEL,nSelectedItem,(LONG)0);
        !           403: }
        !           404: */
        !           405: 
        !           406: //-----------------------------------------------------------------------
        !           407: /*
        !           408:   Select string items in a Combo Box
        !           409: */
        !           410: /*
        !           411: void Dialog_ComboBoxSelectString(HWND hDlg, int ComboBoxID, char *pszSelectedString)
        !           412: {
        !           413:   // And select chosen item
        !           414:   SendDlgItemMessage(hDlg,ComboBoxID,CB_SELECTSTRING,0,(LONG)pszSelectedString);
        !           415: }
        !           416: */
        !           417: 
        !           418: //-----------------------------------------------------------------------
        !           419: /*
        !           420:   Read selected item index from a Combo Box
        !           421: */
        !           422: /*
        !           423: int Dialog_GetSelectedComboBoxItem(HWND hDlg, int ComboBoxID)
        !           424: {
        !           425:   int nSelectedItem;
        !           426: 
        !           427:   // Read selected item, if error default to first item in list
        !           428:   nSelectedItem = SendDlgItemMessage(hDlg,ComboBoxID,CB_GETCURSEL,0,(LONG)0);
        !           429:   if (nSelectedItem==CB_ERR)
        !           430:     nSelectedItem = 0;
        !           431: 
        !           432:   return(nSelectedItem);
        !           433: }
        !           434: */
        !           435: //-----------------------------------------------------------------------
        !           436: /*
        !           437:   Add string items to a List Box
        !           438: */
        !           439: /*
        !           440: void Dialog_SetListBoxItems(HWND hDlg, int ListBoxID, char *pListBoxStrings[], int nSelectedItem)
        !           441: {
        !           442:   int i=0;
        !           443: 
        !           444:   // Reset items
        !           445:   SendDlgItemMessage(hDlg,ListBoxID,LB_RESETCONTENT,0,(LONG)0);
        !           446:   // Add items strings
        !           447:   while(pListBoxStrings[i]) {
        !           448:     SendDlgItemMessage(hDlg,ListBoxID,LB_ADDSTRING,0,(LONG)pListBoxStrings[i]);
        !           449:     i++;
        !           450:   }
        !           451: 
        !           452:   // And select chosen item
        !           453:   SendDlgItemMessage(hDlg,ListBoxID,LB_SETCURSEL,nSelectedItem,(LONG)0);
        !           454: }
        !           455: */
        !           456: 
        !           457: //-----------------------------------------------------------------------
        !           458: /*
        !           459:   Read selected item index from a List Box
        !           460: */
        !           461: /*
        !           462: int Dialog_GetSelectedListBoxItem(HWND hDlg, int ListBoxID)
        !           463: {
        !           464:   int nSelectedItem;
        !           465: 
        !           466:   // Read selected item, if error default to first item in list
        !           467:   nSelectedItem = SendDlgItemMessage(hDlg,ListBoxID,LB_GETCURSEL,0,(LONG)0);
        !           468:   if (nSelectedItem==LB_ERR)
        !           469:     nSelectedItem = 0;
        !           470: 
        !           471:   return(nSelectedItem);
        !           472: }
        !           473: */
        !           474: 
        !           475: //-----------------------------------------------------------------------
        !           476: /*
        !           477:   Set Spin control range and select item
        !           478: */
        !           479: /*
        !           480: int Dialog_SetSpinList(HWND hDlg, int nEditBoxID, int nSpinID, char *pSpinStrings[], int nItems, int nSelectedItem)
        !           481: {
        !           482:   // Limit selection
        !           483:   nSelectedItem = Misc_LimitInt(nSelectedItem, 0,nItems-1);
        !           484: 
        !           485:   // Fill text with selected item
        !           486:   Dialog_SetText(hDlg,nEditBoxID,pSpinStrings[nSelectedItem]);
        !           487:   // Set range and selection of Spin control
        !           488:   if (nItems==1) {
        !           489:     Dialog_EnableItem(hDlg,nSpinID,FALSE);
        !           490:   }
        !           491:   else {
        !           492:     SendDlgItemMessage(hDlg,nSpinID,UDM_SETRANGE,0,(LPARAM)MAKELONG(nItems-1,0));
        !           493:     SendDlgItemMessage(hDlg,nSpinID,UDM_SETPOS,0,(LPARAM)nSelectedItem);
        !           494:     Dialog_EnableItem(hDlg,nSpinID,TRUE);
        !           495:   }
        !           496: 
        !           497:   return(nSelectedItem);
        !           498: }
        !           499: */
        !           500: 
        !           501: //-----------------------------------------------------------------------
        !           502: /*
        !           503:   Get Spin control item
        !           504: */
        !           505: /*
        !           506: int Dialog_GetSpinList(HWND hDlg, int nSpinID)
        !           507: {
        !           508:   return( LOWORD(SendDlgItemMessage(hDlg,nSpinID,UDM_GETPOS,0,(LPARAM)0)) );
        !           509: }
        !           510: */
        !           511: 
        !           512: //-----------------------------------------------------------------------
        !           513: /*
        !           514:   Update Spin control with new selection, called from WM_VSCROLL
        !           515: */
        !           516: /*
        !           517: int Dialog_UpdateSpinList(HWND hDlg, int nEditBoxID, char *pSpinStrings[], int nNumSpinItems, int nNewSelectedItem)
        !           518: {
        !           519:   // Is item within range?
        !           520:   if (nNewSelectedItem<0)
        !           521:     nNewSelectedItem = 0;
        !           522:   if (nNewSelectedItem>=nNumSpinItems)
        !           523:     nNewSelectedItem = nNumSpinItems-1;
        !           524: 
        !           525:   // Fill text with new selected item
        !           526:   Dialog_SetText(hDlg,nEditBoxID,pSpinStrings[nNewSelectedItem]);
        !           527: 
        !           528:   // Return new value
        !           529:   return(nNewSelectedItem);
        !           530: }
        !           531: */
        !           532: 
        !           533: //-----------------------------------------------------------------------
        !           534: /*
        !           535:   Set number of dialog radio buttons
        !           536: */
        !           537: /*
        !           538: void Dialog_SetRadioButtons(HWND hDlg,int StartButtonID,int EndButtonID,int nSelectedItem)
        !           539: {
        !           540:   CheckRadioButton(hDlg,StartButtonID,EndButtonID,StartButtonID+nSelectedItem);  // Run ST speed or max?  
        !           541: }
        !           542: */
        !           543: 
        !           544: //-----------------------------------------------------------------------
        !           545: /*
        !           546:   Read status of dialog radio buttons, return index of chosen option from '0'
        !           547: */
        !           548: /*
        !           549: int Dialog_ReadRadioButtons(HWND hDlg,int StartButtonID,int EndButtonID)
        !           550: {
        !           551:   int i;
        !           552: 
        !           553:   for(i=StartButtonID; i<=EndButtonID; i++) {
        !           554:     if (IsDlgButtonChecked(hDlg,i)==BST_CHECKED)
        !           555:       return(i-StartButtonID);
        !           556:   }
        !           557: 
        !           558:   return(0);
        !           559: }
        !           560: */
        !           561: 
        !           562: //-----------------------------------------------------------------------
        !           563: /*
        !           564:   Add 'Column' to List View
        !           565: */
        !           566: /*
        !           567: void Dialog_AddListViewColumn(HWND hDlg, int ListViewID, int Order, char *pString, int Width)
        !           568: {
        !           569:   LVCOLUMN LvColumn;
        !           570: 
        !           571:   // Build structure
        !           572:   LvColumn.mask = LVCF_FMT|LVCF_TEXT|LVCF_WIDTH;
        !           573:   LvColumn.fmt = LVCFMT_LEFT;
        !           574:   LvColumn.cx = Width;
        !           575:   LvColumn.pszText = pString;
        !           576:   LvColumn.cchTextMax = 0;
        !           577:   LvColumn.iSubItem = 0;
        !           578:   LvColumn.iImage = 0;
        !           579:   LvColumn.iOrder = 0;
        !           580: 
        !           581:   // Add Column
        !           582:   SendDlgItemMessage(hDlg,ListViewID,LVM_INSERTCOLUMN,Order,(LONG)&LvColumn);
        !           583: }
        !           584: */

unix.superglobalmegacorp.com

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