static pascal OSStatus s86proc(EventHandlerCallRef myHandler, EventRef event, void* userData) { OSStatus err = eventNotHandledErr; HIPoint pos; Point p; Rect ctrlbounds, winbounds; PicHandle pict; if (GetEventClass(event)==kEventClassControl && GetEventKind(event)==kEventControlClick ) { err = noErr; GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pos); GetControlBounds((ControlRef)userData, &ctrlbounds); GetWindowBounds(soundWin, kWindowContentRgn, &winbounds); p.h = (short)pos.x; p.h -= (ctrlbounds.left + winbounds.left); p.h /= 8; if ((p.h < 2) || (p.h >= 10)) { return(err); } p.h -= 2; snd86 ^= (1 << p.h); set86s(); setbmp(dipswbmp_getsnd86(snd86), &pict); SetControlData((ControlRef)userData, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict); Draw1Control((ControlRef)userData); } (void)myHandler; (void)userData; return err; }
/** * CWndProc オブジェクトの Windows プロシージャ (WindowProc) が用意されています * @param[in] nMsg 処理される Windows メッセージを指定します * @param[in] wParam メッセージの処理で使う付加情報を提供します。このパラメータの値はメッセージに依存します * @param[in] lParam メッセージの処理で使う付加情報を提供します。このパラメータの値はメッセージに依存します * @return メッセージに依存する値を返します */ LRESULT SndOpt86Page::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam) { switch (nMsg) { case WM_DRAWITEM: if (LOWORD(wParam) == IDC_SND86DIP) { UINT8* pBitmap = dipswbmp_getsnd86(m_snd86); m_dipsw.Draw((reinterpret_cast<LPDRAWITEMSTRUCT>(lParam))->hDC, pBitmap); _MFREE(pBitmap); } return FALSE; } return CDlgProc::WindowProc(nMsg, wParam, lParam); }
static void initSoundWindow(void) { PicHandle pict; ControlRef disp; BYTE data[5]; short i; for (i=0;i<5;i++) { data[i] = *(cfg[i]); } initMixer(data); init14(np2cfg.vol14); snd26 = np2cfg.snd26opt; uncheckAllPopupMenuItems('26io', 2, soundWin); uncheckAllPopupMenuItems('26in', 4, soundWin); uncheckAllPopupMenuItems('26rm', 5, soundWin); set26s(snd26, '26io', '26in', '26rm'); disp = getControlRefByID('BMP ', 0, soundWin); setbmp(dipswbmp_getsnd26(snd26), &pict); SetControlData(disp, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict); snd86 = np2cfg.snd86opt; uncheckAllPopupMenuItems('86io', 2, soundWin); uncheckAllPopupMenuItems('86in', 4, soundWin); uncheckAllPopupMenuItems('86id', 8, soundWin); set86s(); disp = getControlRefByID('BMP ', 1, soundWin); setbmp(dipswbmp_getsnd86(snd86), &pict); SetControlData(disp, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict); spb = np2cfg.spbopt; spbvrc = np2cfg.spb_vrc; // ver0.30 uncheckAllPopupMenuItems('spio', 2, soundWin); uncheckAllPopupMenuItems('spin', 4, soundWin); uncheckAllPopupMenuItems('sprm', 5, soundWin); setSPB(); setControlValue('splv', 0, np2cfg.spb_vrl); setControlValue('sprv', 0, np2cfg.spb_x); disp = getControlRefByID('BMP ', 2, soundWin); setbmp(dipswbmp_getsndspb(spb, spbvrc), &pict); SetControlData(disp, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict); initJoyPad(); }
static LRESULT CALLBACK Snd86optDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { HWND sub; switch(msg) { case WM_INITDIALOG: snd86 = np2cfg.snd86opt; dlgs_setcbitem(hWnd, IDC_SND86IO, cpIO86, NELEMENTS(cpIO86)); setsnd86io(hWnd, IDC_SND86IO, snd86); SetDlgItemCheck(hWnd, IDC_SND86INT, snd86 & 0x10); dlgs_setcbitem(hWnd, IDC_SND86INTA, cpInt86, NELEMENTS(cpInt86)); setsnd86int(hWnd, IDC_SND86INTA, snd86); dlgs_setcbitem(hWnd, IDC_SND86ID, cpID, NELEMENTS(cpID)); setsnd86id(hWnd, IDC_SND86ID, snd86); SetDlgItemCheck(hWnd, IDC_SND86ROM, snd86 & 2); sub = GetDlgItem(hWnd, IDC_SND86DIP); SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + (GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK))); return(TRUE); case WM_COMMAND: switch(LOWORD(wp)) { case IDC_SND86IO: set86jmp(hWnd, getsnd86io(hWnd, IDC_SND86IO), 0x01); break; case IDC_SND86INT: set86jmp(hWnd, (GetDlgItemCheck(hWnd, IDC_SND86INT))?0x10:0x00, 0x10); break; case IDC_SND86INTA: set86jmp(hWnd, getsnd86int(hWnd, IDC_SND86INTA), 0x0c); break; case IDC_SND86ROM: set86jmp(hWnd, (GetDlgItemCheck(hWnd, IDC_SND86ROM))?0x02:0x00, 0x02); break; case IDC_SND86ID: set86jmp(hWnd, getsnd86id(hWnd, IDC_SND86ID), 0xe0); break; case IDC_SND86DEF: snd86 = 0x7f; setsnd86io(hWnd, IDC_SND86IO, snd86); SetDlgItemCheck(hWnd, IDC_SND86INT, TRUE); setsnd86int(hWnd, IDC_SND86INTA, snd86); setsnd86id(hWnd, IDC_SND86ID, snd86); SetDlgItemCheck(hWnd, IDC_SND86ROM, TRUE); InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); break; case IDC_SND86DIP: snd86cmddipsw(hWnd); break; } break; case WM_NOTIFY: if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { if (np2cfg.snd86opt != snd86) { np2cfg.snd86opt = snd86; sysmng_update(SYS_UPDATECFG); } return(TRUE); } break; case WM_DRAWITEM: if (LOWORD(wp) == IDC_SND86DIP) { dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, dipswbmp_getsnd86(snd86)); } return(FALSE); } return(FALSE); }