|
|
| version 1.2, 2003/10/23 06:26:16 | version 1.5, 2003/10/24 20:46:13 |
|---|---|
| Line 1 | Line 1 |
| /* | /* |
| * configure.cpp | * configure.cpp |
| * drom Neko Project IIx 0.3 | * from Neko Project IIx 0.3 |
| * | * |
| * Created by tk800 on Mon Sep 23 2002. | * Created by tk800 on Mon Sep 23 2002. |
| * | * |
| Line 12 | Line 12 |
| #include "ini.h" | #include "ini.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| #include "configure.h" | #include "configure.h" |
| #include "dialogutils.h" | |
| int sound_renewals = 0; | int sound_renewals = 0; |
| static WindowRef configWin; | static WindowRef configWin; |
| Line 19 static WindowRef configWin; | Line 20 static WindowRef configWin; |
| #define AVE(a, b) \ | #define AVE(a, b) \ |
| (((a) + (b)) / 2) | (((a) + (b)) / 2) |
| static void endLoop(void) { | #define getSelectedValue(a,b) GetControlValue(getControlRefByID(a,b,configWin)) |
| 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; | |
| } | |
| static int getMultiple(void) { | static int getMultiple(void) { |
| int multi; | int multi; |
| Line 169 static void initConfigWindow(void) { | Line 147 static void initConfigWindow(void) { |
| NumToString(np2cfg.delayms, title); | NumToString(np2cfg.delayms, title); |
| SetControlData(getControlRefByID('Bufr', 7, configWin), kControlNoPart, kControlStaticTextTextTag, *title, title+1); | 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) { | static pascal OSStatus cfWinproc(EventHandlerCallRef myHandler, EventRef event, void* userData) { |
| Line 250 static pascal OSStatus cfWinproc(EventHa | Line 230 static pascal OSStatus cfWinproc(EventHa |
| update |= SYS_UPDATECFG | SYS_UPDATESBUF; | 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); | sysmng_update(update); |
| endLoop(); | endLoop(configWin); |
| err=noErr; | err=noErr; |
| break; | break; |
| case kHICommandCancel: | case kHICommandCancel: |
| endLoop(); | endLoop(configWin); |
| err=noErr; | err=noErr; |
| break; | break; |
| } | } |
| Line 278 static void makeNibWindow (IBNibRef nibR | Line 269 static void makeNibWindow (IBNibRef nibR |
| { kEventClassWindow, kEventWindowActivated } }; | { kEventClassWindow, kEventWindowActivated } }; |
| EventHandlerRef ref; | EventHandlerRef ref; |
| InstallWindowEventHandler (configWin, NewEventHandlerUPP(cfWinproc), 2, list, (void *)configWin, &ref); | InstallWindowEventHandler (configWin, NewEventHandlerUPP(cfWinproc), GetEventTypeCount(list), list, (void *)configWin, &ref); |
| ShowSheetWindow(configWin, hWndMain); | ShowSheetWindow(configWin, hWndMain); |
| err=RunAppModalLoopForWindow(configWin); | err=RunAppModalLoopForWindow(configWin); |