Esempio n. 1
0
/**
 * CWndProc オブジェクトの Windows プロシージャ (WindowProc) が用意されています
 * @param[in] nMsg 処理される Windows メッセージを指定します
 * @param[in] wParam メッセージの処理で使う付加情報を提供します。このパラメータの値はメッセージに依存します
 * @param[in] lParam メッセージの処理で使う付加情報を提供します。このパラメータの値はメッセージに依存します
 * @return メッセージに依存する値を返します
 */
LRESULT SndOpt26Page::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	switch (nMsg)
	{
		case WM_DRAWITEM:
			if (LOWORD(wParam) == IDC_SND26JMP)
			{
				UINT8* pBitmap = dipswbmp_getsnd26(m_snd26);
				m_dipsw.Draw((reinterpret_cast<LPDRAWITEMSTRUCT>(lParam))->hDC, pBitmap);
				_MFREE(pBitmap);
			}
			return FALSE;
	}
	return CDlgProc::WindowProc(nMsg, wParam, lParam);
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
static LRESULT CALLBACK Snd26optDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	HWND	sub;

	switch(msg) {
		case WM_INITDIALOG:
			snd26 = np2cfg.snd26opt;
			dlgs_setcbitem(hWnd, IDC_SND26IO, cpIO26, NELEMENTS(cpIO26));
			dlgs_setcbitem(hWnd, IDC_SND26INT, cpInt26, NELEMENTS(cpInt26));
			dlgs_setcbitem(hWnd, IDC_SND26ROM, cpAddr, NELEMENTS(cpAddr));
			snd26set(hWnd, snd26);
			sub = GetDlgItem(hWnd, IDC_SND26JMP);
			SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW +
							(GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK)));
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_SND26IO:
					set26jmp(hWnd, getsnd26io(hWnd, IDC_SND26IO), 0x10);
					break;

				case IDC_SND26INT:
					set26jmp(hWnd, getsnd26int(hWnd, IDC_SND26INT), 0xc0);
					break;

				case IDC_SND26ROM:
					set26jmp(hWnd, getsnd26rom(hWnd, IDC_SND26ROM), 0x07);
					break;

				case IDC_SND26DEF:
					snd26 = 0xd1;
					snd26set(hWnd, snd26);
					InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE);
					break;

				case IDC_SND26JMP:
					snd26cmdjmp(hWnd);
					break;
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				if (np2cfg.snd26opt != snd26) {
					np2cfg.snd26opt = snd26;
					sysmng_update(SYS_UPDATECFG);
				}
				return(TRUE);
			}
			break;

		case WM_DRAWITEM:
			if (LOWORD(wp) == IDC_SND26JMP) {
				dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC,
												dipswbmp_getsnd26(snd26));
			}
			break;
	}
	return(FALSE);
}
Esempio n. 4
0
static pascal OSStatus s26proc(EventHandlerCallRef myHandler, EventRef event, void* userData) {
    OSStatus	err = eventNotHandledErr;
	HIPoint		pos;
	Point		p;
	BYTE		bit, b;
	Rect		ctrlbounds, winbounds;
	PicHandle   pict;
	BOOL		redraw = FALSE;

    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.v = (short)pos.y;
		p.h -= (ctrlbounds.left + winbounds.left);
		p.h /= 9;
		p.v -= (ctrlbounds.top + winbounds.top);
		p.v /= 9;
		if ((p.v < 1) || (p.v >= 3)) {
			return(err);
		}
		if ((p.h >= 2) && (p.h < 7)) {
			b = (BYTE)(p.h - 2);
			if ((snd26 ^ b) & 7) {
				snd26 &= ~0x07;
				snd26 |= b;
				redraw = TRUE;
			}
		}
		else if ((p.h >= 9) && (p.h < 12)) {
			b = snd26;
			bit = 0x40 << (2 - p.v);
			switch(p.h) {
				case 9:
					b |= bit;
					break;

				case 10:
					b ^= bit;
					break;

				case 11:
					b &= ~bit;
					break;
			}
			if (snd26 != b) {
				snd26 = b;
				redraw = TRUE;
			}
		}
		else if ((p.h >= 15) && (p.h < 17)) {
			b = (BYTE)((p.h - 15) << 4);
			if ((snd26 ^ b) & 0x10) {
				snd26 &= ~0x10;
				snd26 |= b;
				redraw = TRUE;
			}
		}
		if (redraw) {
			set26s(snd26, '26io', '26in', '26rm');
			setbmp(dipswbmp_getsnd26(snd26), &pict);
			SetControlData((ControlRef)userData, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict);
			Draw1Control((ControlRef)userData);
		}
	}

	(void)myHandler;
	(void)userData;
    return err;
}