|
|
| version 1.11, 2003/11/09 21:57:04 | version 1.14, 2003/11/13 07:47:17 |
|---|---|
| Line 34 | Line 34 |
| #define USE_RESUME | #define USE_RESUME |
| NP2OSCFG np2oscfg = {0, 2, 0, 0, 0, 0, 0}; | NP2OSCFG np2oscfg = {100, 100, 0, 2, 0, 0, 0, 0, 0}; |
| WindowPtr hWndMain; | WindowPtr hWndMain; |
| BOOL np2running; | BOOL np2running; |
| Line 98 static void InitToolBox(void) { | Line 98 static void InitToolBox(void) { |
| static void MenuBarInit(void) { | static void MenuBarInit(void) { |
| Handle hMenu; | Handle hdl; |
| MenuHandle happlemenu; | MenuHandle hmenu; |
| hMenu = GetNewMBar(IDM_MAINMENU); | hdl = GetNewMBar(IDM_MAINMENU); |
| if (!hMenu) { | if (hdl == NULL) { |
| ExitToShell(); | ExitToShell(); |
| } | } |
| SetMenuBar(hMenu); | SetMenuBar(hdl); |
| happlemenu = GetMenuHandle(IDM_APPLE); | hmenu = GetMenuHandle(IDM_APPLE); |
| if (happlemenu) { | if (hmenu) { |
| AppendResMenu(happlemenu, 'DRVR'); | AppendResMenu(hmenu, 'DRVR'); |
| } | } |
| InsertMenu(GetMenu(IDM_SASI1), -1); | InsertMenu(GetMenu(IDM_SASI1), -1); |
| InsertMenu(GetMenu(IDM_SASI2), -1); | InsertMenu(GetMenu(IDM_SASI2), -1); |
| InsertMenu(GetMenu(IDM_KEYBOARD), -1); | InsertMenu(GetMenu(IDM_KEYBOARD), -1); |
| InsertMenu(GetMenu(IDM_SOUND), -1); | InsertMenu(GetMenu(IDM_SOUND), -1); |
| InsertMenu(GetMenu(IDM_MEMORY), -1); | InsertMenu(GetMenu(IDM_MEMORY), -1); |
| SetMenuItemModifiers(GetMenuHandle(IDM_FDD2), LoWord(IDM_FDD2OPEN), | |
| kMenuOptionModifier); | |
| SetMenuItemModifiers(GetMenuHandle(IDM_FDD2), LoWord(IDM_FDD2EJECT), | |
| kMenuOptionModifier); | |
| SetMenuItemModifiers(GetMenuHandle(IDM_SASI2), LoWord(IDM_SASI2OPEN), | |
| kMenuOptionModifier); | |
| #if TARGET_API_MAC_CARBON | #if TARGET_API_MAC_CARBON |
| DisableMenuItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); | hmenu = GetMenuHandle(IDM_FDD2); |
| DisableMenuItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE)); | SetItemCmd(hmenu, LoWord(IDM_FDD2OPEN), 'D'); |
| SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2OPEN), kMenuOptionModifier); | |
| SetItemCmd(hmenu, LoWord(IDM_FDD2EJECT), 'E'); | |
| SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2EJECT), kMenuOptionModifier); | |
| hmenu = GetMenuHandle(IDM_SASI2); | |
| SetItemCmd(hmenu, LoWord(IDM_FDD2OPEN), 'O'); | |
| SetMenuItemModifiers(hmenu, LoWord(IDM_SASI2OPEN), kMenuOptionModifier); | |
| #else | |
| EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE)); | |
| EnableItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE)); | |
| #endif | #endif |
| DrawMenuBar(); | DrawMenuBar(); |
| } | } |
| Line 258 static void HandleMenuChoice(long wParam | Line 262 static void HandleMenuChoice(long wParam |
| dialog_scropt(); | dialog_scropt(); |
| break; | break; |
| case IDM_MOUSE: | case IDM_MOUSE: |
| mousemng_toggle(MOUSEPROC_SYSTEM); | mousemng_toggle(MOUSEPROC_SYSTEM); |
| menu_setmouse(np2oscfg.MOUSE_SW ^ 1); | menu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| sysmng_update(SYS_UPDATECFG); | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_MIDIPANIC: | case IDM_MIDIPANIC: |
| Line 392 static void HandleMenuChoice(long wParam | Line 396 static void HandleMenuChoice(long wParam |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| break; | break; |
| case IDM_AMD98: | |
| menu_setsound(0x80); | |
| update |= SYS_UPDATECFG; | |
| break; | |
| case IDM_SEEKSND: | case IDM_SEEKSND: |
| menu_setmotorflg(np2cfg.MOTOR ^ 1); | menu_setmotorflg(np2cfg.MOTOR ^ 1); |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| Line 483 static void HandleMouseDown(EventRecord | Line 492 static void HandleMouseDown(EventRecord |
| case inMenuBar: | case inMenuBar: |
| if (np2running) { | if (np2running) { |
| soundmng_stop(); | soundmng_stop(); |
| mousemng_disable(MOUSEPROC_MACUI); | |
| HandleMenuChoice(MenuSelect(pevent->where)); | HandleMenuChoice(MenuSelect(pevent->where)); |
| mousemng_enable(MOUSEPROC_MACUI); | |
| soundmng_play(); | soundmng_play(); |
| } | } |
| break; | break; |
| Line 518 static void HandleMouseDown(EventRecord | Line 529 static void HandleMouseDown(EventRecord |
| static void eventproc(EventRecord *event) { | static void eventproc(EventRecord *event) { |
| int keycode; | |
| keycode = (event->message & keyCodeMask) >> 8; | |
| switch(event->what) { | switch(event->what) { |
| case mouseDown: | case mouseDown: |
| HandleMouseDown(event); | HandleMouseDown(event); |
| Line 529 static void eventproc(EventRecord *event | Line 543 static void eventproc(EventRecord *event |
| case keyDown: | case keyDown: |
| case autoKey: | case autoKey: |
| if (np2running) { | if (!np2running) { |
| mackbd_f12down(((event->message) & keyCodeMask) >> 8); | break; |
| if (event->modifiers & cmdKey) { | } |
| soundmng_stop(); | #if !TARGET_API_MAC_CARBON |
| HandleMenuChoice(MenuKey(event->message & charCodeMask)); | if ((keycode == 0x6f) && (np2oscfg.F12COPY == 0)) { |
| soundmng_play(); | HandleMenuChoice(IDM_MOUSE); |
| } | break; |
| } | |
| #endif | |
| if (event->modifiers & cmdKey) { | |
| soundmng_stop(); | |
| mousemng_disable(MOUSEPROC_MACUI); | |
| HandleMenuChoice(MenuKey(event->message & charCodeMask)); | |
| mousemng_enable(MOUSEPROC_MACUI); | |
| soundmng_play(); | |
| } | |
| else { | |
| mackbd_keydown(keycode); | |
| } | } |
| break; | break; |
| case keyUp: | case keyUp: |
| mackbd_f12up(((event->message) & keyCodeMask) >> 8); | mackbd_keyup(keycode); |
| break; | break; |
| case mouseUp: | case mouseUp: |
| Line 622 int main(int argc, char *argv[]) { | Line 647 int main(int argc, char *argv[]) { |
| Rect wRect; | Rect wRect; |
| EventRecord event; | EventRecord event; |
| UINT t; | UINT t; |
| GrafPtr saveport; | |
| Point pt; | |
| dosio_init(); | dosio_init(); |
| file_setcd(target); | file_setcd(target); |
| Line 634 int main(int argc, char *argv[]) { | Line 661 int main(int argc, char *argv[]) { |
| TRACEINIT(); | TRACEINIT(); |
| SetRect(&wRect, 100, 100, 100, 100); | SetRect(&wRect, np2oscfg.posx, np2oscfg.posy, 100, 100); |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, | hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | noGrowDocProc, (WindowPtr)-1, TRUE, 0); |
| if (!hWndMain) { | if (!hWndMain) { |
| Line 766 int main(int argc, char *argv[]) { | Line 793 int main(int argc, char *argv[]) { |
| } | } |
| } | } |
| } | } |
| GetPort(&saveport); | |
| #if TARGET_API_MAC_CARBON | |
| SetPortWindowPort(hWndMain); | |
| #else | |
| SetPort(hWndMain); | |
| #endif | |
| pt.h = 0; | |
| pt.v = 0; | |
| LocalToGlobal(&pt); | |
| SetPort(saveport); | |
| if ((np2oscfg.posx != pt.h) || (np2oscfg.posy != pt.v)) { | |
| np2oscfg.posx = pt.h; | |
| np2oscfg.posy = pt.v; | |
| sysmng_update(SYS_UPDATEOSCFG); | |
| } | |
| np2running = FALSE; | np2running = FALSE; |
| pccore_cfgupdate(); | pccore_cfgupdate(); |