Example #1
0
bool CSetDlgColors::ColorEditDialog(HWND hWnd2, WORD c)
{
	_ASSERTE(hWnd2!=NULL);
	bool bChanged = false;
	COLORREF color = 0;
	GetColorById(c, &color);
	//wchar_t temp[16];
	COLORREF colornew = color;

	if (ShowColorDialog(ghOpWnd, &colornew) && colornew != color)
	{
		SetColorById(c, colornew);
		//_wsprintf(temp, SKIPLEN(countof(temp)) L"%i %i %i", getR(colornew), getG(colornew), getB(colornew));
		//SetDlgItemText(hWnd2, c + (tc0-c0), temp);
		ColorSetEdit(hWnd2, c);
		CSettings::InvalidateCtrl(GetDlgItem(hWnd2, c), TRUE);
		bChanged = true;
	}

	return bChanged;
}
Example #2
0
LRESULT CSetPgTransparent::OnInitDialog(HWND hDlg, bool abInitial)
{
	// +Color key
	ColorSetEdit(hDlg, c38);

	checkDlgButton(hDlg, cbTransparent, (gpSet->nTransparent!=MAX_ALPHA_VALUE) ? BST_CHECKED : BST_UNCHECKED);
	SendDlgItemMessage(hDlg, slTransparent, TBM_SETRANGE, (WPARAM) true, (LPARAM) MAKELONG(MIN_ALPHA_VALUE, MAX_ALPHA_VALUE));
	SendDlgItemMessage(hDlg, slTransparent, TBM_SETPOS  , (WPARAM) true, (LPARAM) gpSet->nTransparent);
	checkDlgButton(hDlg, cbTransparentSeparate, gpSet->isTransparentSeparate ? BST_CHECKED : BST_UNCHECKED);
	//EnableWindow(GetDlgItem(hDlg, cbTransparentInactive), gpSet->isTransparentSeparate);
	//checkDlgButton(hDlg, cbTransparentInactive, (gpSet->nTransparentInactive!=MAX_ALPHA_VALUE) ? BST_CHECKED : BST_UNCHECKED);
	EnableWindow(GetDlgItem(hDlg, slTransparentInactive), gpSet->isTransparentSeparate);
	EnableWindow(GetDlgItem(hDlg, stTransparentInactive), gpSet->isTransparentSeparate);
	EnableWindow(GetDlgItem(hDlg, stOpaqueInactive), gpSet->isTransparentSeparate);
	SendDlgItemMessage(hDlg, slTransparentInactive, TBM_SETRANGE, (WPARAM) true, (LPARAM) MAKELONG(MIN_INACTIVE_ALPHA_VALUE, MAX_ALPHA_VALUE));
	SendDlgItemMessage(hDlg, slTransparentInactive, TBM_SETPOS  , (WPARAM) true, (LPARAM) gpSet->isTransparentSeparate ? gpSet->nTransparentInactive : gpSet->nTransparent);
	checkDlgButton(hDlg, cbUserScreenTransparent, gpSet->isUserScreenTransparent ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbColorKeyTransparent, gpSet->isColorKeyTransparent);

	return 0;
}
Example #3
0
LRESULT CSetDlgColors::ColorBoxProc(HWND hCtrl, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRc = 0;
	WNDPROC pfnOldProc = NULL;
	gColorBoxMap.Get(hCtrl, &pfnOldProc);

	UINT CB = GetWindowLong(hCtrl, GWL_ID);

	static bool bHooked = false, bClicked = false;
	static COLORREF clrPrevValue = 0;

	switch (uMsg)
	{
	case WM_LBUTTONDOWN:
		SetCapture(hCtrl);
		GetColorById(CB, &clrPrevValue);
		bHooked = bClicked = true;
		goto wrap;
	case WM_LBUTTONUP:
		if (bHooked)
		{
			bHooked = false;
			SetCapture(NULL);
		}
		if (bClicked)
		{
			CSettings::OnBtn_ColorField(hCtrl, CB, 0);
		}
		goto wrap;
	case WM_RBUTTONDOWN:
		if (bHooked)
		{
			SetColorById(CB, clrPrevValue);
			ColorSetEdit(GetParent(hCtrl), CB);
			CSettings::InvalidateCtrl(hCtrl, TRUE);
			gpConEmu->InvalidateAll();
			gpConEmu->Update(true);
		}
		goto wrap;
	case WM_RBUTTONUP:
		goto wrap;
	case WM_MOUSEMOVE:
		if (bHooked)
		{
			POINT ptCur = {}; GetCursorPos(&ptCur);
			RECT rcSelf = {}; GetWindowRect(hCtrl, &rcSelf);
			if (!PtInRect(&rcSelf, ptCur))
			{
				bClicked = false;
				HDC hdc = GetDC(NULL);
				if (hdc)
				{
					COLORREF clr = GetPixel(hdc, ptCur.x, ptCur.y);
					if (clr != CLR_INVALID)
					{
						SetColorById(CB, clr);
						ColorSetEdit(GetParent(hCtrl), CB);
						CSettings::InvalidateCtrl(hCtrl, TRUE);
						gpConEmu->InvalidateAll();
						gpConEmu->Update(true);
					}
					ReleaseDC(NULL, hdc);
				}
			}
		}
		goto wrap;
	case WM_DESTROY:
		if (bHooked)
		{
			bHooked = false;
			SetCapture(NULL);
		}
		gColorBoxMap.Get(hCtrl, NULL, true);
		break;
	}

	if (pfnOldProc)
		lRc = ::CallWindowProc(pfnOldProc, hCtrl, uMsg, wParam, lParam);
	else
		lRc = ::DefWindowProc(hCtrl, uMsg, wParam, lParam);
wrap:
	return lRc;
}