--- np2/macosx/Attic/configure.cpp 2003/10/23 06:26:16 1.2 +++ np2/macosx/Attic/configure.cpp 2003/10/24 20:46:13 1.5 @@ -1,6 +1,6 @@ /* * configure.cpp - * drom Neko Project IIx 0.3 + * from Neko Project IIx 0.3 * * Created by tk800 on Mon Sep 23 2002. * @@ -12,6 +12,7 @@ #include "ini.h" #include "sysmng.h" #include "configure.h" +#include "dialogutils.h" int sound_renewals = 0; static WindowRef configWin; @@ -19,30 +20,7 @@ static WindowRef configWin; #define AVE(a, b) \ (((a) + (b)) / 2) -static void endLoop(void) { - OSStatus err; - HideSheetWindow(configWin); - DisposeWindow(configWin); - err=QuitAppModalLoopForWindow(configWin); -} - -ControlRef getControlRefByID(OSType sign, int id, WindowRef win) { - ControlRef conRef; - ControlID conID; - - conID.signature=sign; - conID.id=id; - GetControlByID(win, &conID, &conRef); - return conRef; -} - -static SInt16 getSelectedValue(OSType sign, int id) { - SInt16 value; - - value=GetControlValue(getControlRefByID(sign, id, configWin)); - - return value; -} +#define getSelectedValue(a,b) GetControlValue(getControlRefByID(a,b,configWin)) static int getMultiple(void) { int multi; @@ -169,6 +147,8 @@ static void initConfigWindow(void) { NumToString(np2cfg.delayms, title); SetControlData(getControlRefByID('Bufr', 7, configWin), kControlNoPart, kControlStaticTextTextTag, *title, title+1); + SetControlValue(getControlRefByID('cnfm', 0, configWin), np2oscfg.comfirm); + SetControlValue(getControlRefByID('rsum', 0, configWin), np2oscfg.resume); } static pascal OSStatus cfWinproc(EventHandlerCallRef myHandler, EventRef event, void* userData) { @@ -250,13 +230,24 @@ static pascal OSStatus cfWinproc(EventHa update |= SYS_UPDATECFG | SYS_UPDATESBUF; } } + dval=getSelectedValue('cnfm', 0); + if (dval != np2oscfg.comfirm) { + np2oscfg.comfirm = dval; + update |= SYS_UPDATEOSCFG; + } + dval=getSelectedValue('rsum', 0); + if (dval != np2oscfg.resume) { + np2oscfg.resume = dval; + update |= SYS_UPDATEOSCFG; + } + sysmng_update(update); - endLoop(); + endLoop(configWin); err=noErr; break; case kHICommandCancel: - endLoop(); + endLoop(configWin); err=noErr; break; } @@ -278,7 +269,7 @@ static void makeNibWindow (IBNibRef nibR { kEventClassWindow, kEventWindowActivated } }; EventHandlerRef ref; - InstallWindowEventHandler (configWin, NewEventHandlerUPP(cfWinproc), 2, list, (void *)configWin, &ref); + InstallWindowEventHandler (configWin, NewEventHandlerUPP(cfWinproc), GetEventTypeCount(list), list, (void *)configWin, &ref); ShowSheetWindow(configWin, hWndMain); err=RunAppModalLoopForWindow(configWin);