Esempio n. 1
0
ATOM VDVideoDisplayWindow::Register() {
	WNDCLASS wc;
	HMODULE hInst = VDGetLocalModuleHandleW32();

	if (!sChildWindowClass) {
		wc.style			= CS_HREDRAW | CS_VREDRAW;
		wc.lpfnWndProc		= StaticChildWndProc;
		wc.cbClsExtra		= 0;
		wc.cbWndExtra		= sizeof(VDVideoDisplayWindow *);
		wc.hInstance		= hInst;
		wc.hIcon			= 0;
		wc.hCursor			= LoadCursor(NULL, IDC_ARROW);
		wc.hbrBackground	= 0;
		wc.lpszMenuName		= 0;
		wc.lpszClassName	= "phaeronVideoDisplayChild";

		sChildWindowClass = RegisterClass(&wc);
		if (!sChildWindowClass)
			return NULL;
	}

	wc.style			= CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc		= StaticWndProc;
	wc.cbClsExtra		= 0;
	wc.cbWndExtra		= sizeof(VDVideoDisplayWindow *);
	wc.hInstance		= hInst;
	wc.hIcon			= 0;
	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground	= 0;
	wc.lpszMenuName		= 0;
	wc.lpszClassName	= g_szVideoDisplayControlName;

	return RegisterClass(&wc);
}
Esempio n. 2
0
void VDSetDialogDefaultIcons(HWND hdlg) {
	HINSTANCE hInst = VDGetLocalModuleHandleW32();

	HANDLE hLargeIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_VIRTUALDUB), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_SHARED);
	if (hLargeIcon)
		SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)hLargeIcon);

	HANDLE hSmallIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_VIRTUALDUB), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
	if (hSmallIcon)
		SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)hSmallIcon);
}
Esempio n. 3
0
bool WarpResizeFilter::Configure(VDXHWND hwnd) {
	bool saveGrad = mbShowGradientMap;
	int saveW = mTargetWidth;
	int saveH = mTargetHeight;

	bool success = 0 != Show(VDGetLocalModuleHandleW32(), MAKEINTRESOURCE(IDD_FILTER_WARPRESIZE), (HWND)hwnd);
	if (!success) {
		mbShowGradientMap = saveGrad;
		mTargetWidth = saveW;
		mTargetHeight = saveH;
	}

	return success;
}
Esempio n. 4
0
bool VDUIRegisterHotKeyExControl() {
	WNDCLASS wc;

	wc.style		= CS_VREDRAW | CS_HREDRAW;
	wc.lpfnWndProc	= VDUIHotKeyExControlW32::StaticWndProc;
	wc.cbClsExtra	= 0;
	wc.cbWndExtra	= sizeof(IVDUnknown *);
	wc.hInstance	= VDGetLocalModuleHandleW32();
	wc.hIcon		= NULL;
	wc.hCursor		= LoadCursor(NULL, IDC_IBEAM);
	wc.hbrBackground= (HBRUSH)(COLOR_3DFACE + 1);
	wc.lpszMenuName	= NULL;
	wc.lpszClassName= VDUIHOTKEYEXCLASS;

	return RegisterClass(&wc) != 0;
}
Esempio n. 5
0
LRESULT VDUIBaseWindowW32::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) {
	switch(msg) {
		case WM_INITDIALOG:
			{
				RECT r;
				GetWindowRect(mhwnd, &r);
				MapWindowPoints(mhwnd, ::GetParent(mhwnd), (LPPOINT)&r, 2);
				mArea.left = r.left;
				mArea.top = r.top;
				mArea.right = r.right;
				mArea.bottom = r.bottom;

				DispatchEvent(this, mID, IVDUICallback::kEventCreate, 0);

				DWORD dwStyle = GetWindowLong(mhwnd, GWL_STYLE);

				if (dwStyle & WS_THICKFRAME) {
					EnumResourceNames(VDGetLocalModuleHandleW32(), RT_GROUP_ICON, SetApplicationIconOnDialog, (LONG_PTR)mhwnd);
				}

				if (!(dwStyle & DS_CONTROL))
					Relayout();

				ExecuteAllLinks();
			}
			return FALSE;
   
		case WM_GETMINMAXINFO:
			{
				MINMAXINFO *pmmi = (MINMAXINFO *)lParam;
   
				pmmi->ptMinTrackSize.x = mLayoutSpecs.minsize.w;
				pmmi->ptMinTrackSize.y = mLayoutSpecs.minsize.h;
   
				if ((mAlignX & nsVDUI::kAlignTypeMask) != nsVDUI::kFill)
					pmmi->ptMaxTrackSize.x = mLayoutSpecs.minsize.w;
   
				if ((mAlignY & nsVDUI::kAlignTypeMask) != nsVDUI::kFill)
					pmmi->ptMaxTrackSize.y = mLayoutSpecs.minsize.h;
			}
			return 0;

		case WM_SIZE:
			if (!(GetWindowLong(mhwnd, GWL_STYLE) & WS_CHILD)) {
				vduirect r(GetClientArea());

				if (r.size() != GetArea().size()) {
					r.left   += mInsets.left;
					r.top    += mInsets.top;
					r.right  -= mInsets.right;
					r.bottom -= mInsets.bottom;

					tChildren::iterator it(mChildren.begin()), itEnd(mChildren.end());

					for(; it!=itEnd; ++it) {
						IVDUIWindow *pWin = *it;

						pWin->PostLayout(r);
					}
				}
			}
			return 0;

		case WM_CLOSE:
			if (DispatchEvent(this, mID, IVDUICallback::kEventClose, 0))
				return 0;
			goto handle_cancel;

		case WM_NOTIFYFORMAT:
			return VDIsWindowsNT() ? NFR_UNICODE : NFR_ANSI;

		case WM_COMMAND:
			// special handling for commands that have have keyboard equivalents in
			// the dialog manager; we never assign these native IDs so it's safe to
			// shortcut them
			if (LOWORD(wParam) == IDOK) {
				DispatchEvent(this, 10, IVDUICallback::kEventSelect, 0);
				return 0;
			} else if (LOWORD(wParam) == IDCANCEL) {
handle_cancel:
				if (!DispatchEvent(this, 11, IVDUICallback::kEventSelect, 0)) {
					if (mpModal)
						EndModal(-1);
					else
						Shutdown();
				}
				return 0;
			} else if (!lParam) {
				// dispatch menu/accelerator commands
				DispatchEvent(this, LOWORD(wParam), IVDUICallback::kEventSelect, 0);
				return 0;
			}
			break;
	}

	return VDUICustomControlW32::WndProc(msg, wParam, lParam);
}
Esempio n. 6
0
VDStringW VDGetLocalModulePath() {
    return VDGetModulePathW32(VDGetLocalModuleHandleW32());
}
Esempio n. 7
0
bool VDVideoDisplayMinidriverOpenGL::Init(HWND hwnd, const VDVideoDisplaySourceInfo& info) {
	mSource = info;
	mhwnd = hwnd;

	// Format check....
	switch(info.pixmap.format) {
		case nsVDPixmap::kPixFormat_XRGB1555:
		case nsVDPixmap::kPixFormat_RGB565:
		case nsVDPixmap::kPixFormat_RGB888:
		case nsVDPixmap::kPixFormat_XRGB8888:
			break;

		default:
			return false;
	}

	// OpenGL doesn't allow upside-down texture uploads, so we simply
	// upload the surface inverted and then reinvert on display.
	mbVerticalFlip = false;
	if (mSource.pixmap.pitch < 0) {
		mSource.pixmap.data = (char *)mSource.pixmap.data + mSource.pixmap.pitch*(mSource.pixmap.h - 1);
		mSource.pixmap.pitch = -mSource.pixmap.pitch;
		mbVerticalFlip = true;
	}

	RECT r;
	GetClientRect(mhwnd, &r);

	static ATOM wndClass = Register();

	if (!mGL.Init())
		return false;

	// We have to create a separate window because the NVIDIA driver subclasses the
	// window and doesn't unsubclass it even after the OpenGL context is deleted.
	// If we use the main window instead then the app will bomb the moment we unload
	// OpenGL.

	mhwndOGL = CreateWindowEx(WS_EX_TRANSPARENT, (LPCSTR)wndClass, "", WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0, 0, r.right, r.bottom, mhwnd, NULL, VDGetLocalModuleHandleW32(), this);
	if (!mhwndOGL)
		return false;

	if (!SendMessage(mhwndOGL, MYWM_OGLINIT, 0, 0)) {
		DestroyWindow(mhwndOGL);
		mhwndOGL = 0;
		return false;
	}

	mbValid = false;
	mbFirstPresent = true;
	return true;
}