Example #1
0
static LRESULT CALLBACK ListEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_LBUTTONUP:
		mir_callNextSubclass(hwnd, ListEditSubclassProc, msg, wParam, lParam);
		{
			POINT pt = { (short)LOWORD(lParam), (short)HIWORD(lParam) };
			ClientToScreen(hwnd, &pt);
			if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y)) == HTVSCROLL)
				break;

			int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
			if (dataListEdit)
				dataListEdit->EndListEdit(i != LB_ERR);
		}
		return 0;

	case WM_CHAR:
		if (wParam != '\r') break;
		{
			int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
			if (dataListEdit)
				dataListEdit->EndListEdit(i != LB_ERR);
		}
		return 0;

	case WM_KILLFOCUS:
		if (dataListEdit)
			dataListEdit->EndListEdit(1);
		return 0;
	}
	return mir_callNextSubclass(hwnd, ListEditSubclassProc, msg, wParam, lParam);
}
Example #2
0
LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (!IsWindowEnabled(hwnd))
		return mir_callNextSubclass(hwnd, AlphaTrackBarWndProc, msg, wParam, lParam);

	static int oldVal = -1;
	switch (msg) {
	case WM_MOUSEWHEEL:
	case WM_KEYDOWN:
	case WM_KEYUP:
		if (!IsWindowVisible(hwndBox))
			break;

	case WM_MOUSEMOVE:
		{
			TRACKMOUSEEVENT tme;
			tme.cbSize = sizeof(tme);
			tme.dwFlags = TME_LEAVE;
			tme.dwHoverTime = HOVER_DEFAULT;
			tme.hwndTrack = hwnd;
			_TrackMouseEvent(&tme);

			int newVal = (BYTE)SendMessage(hwnd, TBM_GETPOS, 0, 0);
			if (oldVal != newVal)
			{

				if (oldVal < 0)
				{
					SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1);
					RECT rc; GetWindowRect(hwnd, &rc);
					SetWindowPos(hwndBox, NULL,
						(rc.left+rc.right-170)/2, rc.bottom+2, 170, 50,
						SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW);
					SetWindowRgn(hwndBox, NULL, TRUE);
				}
				SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED);
				SetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA);

				oldVal = newVal;
			}
		}
		break;

	case WM_MOUSELEAVE:
		SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED);
		SetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA);

		ShowWindow(hwndBox, SW_HIDE);
		oldVal = -1;
		break;
	}
	return mir_callNextSubclass(hwnd, AlphaTrackBarWndProc, msg, wParam, lParam);
}
Example #3
0
LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (!IsWindowEnabled(hwnd))
		return mir_callNextSubclass(hwnd, AvatarTrackBarWndProc, msg, wParam, lParam);

	static int oldVal = -1;
	switch (msg) {
	case WM_MOUSEWHEEL:
	case WM_KEYDOWN:
	case WM_KEYUP:
		if (!IsWindowVisible(hwndBox))
			break;

	case WM_MOUSEMOVE:
		{
			TRACKMOUSEEVENT tme;
			tme.cbSize = sizeof(tme);
			tme.dwFlags = TME_LEAVE;
			tme.dwHoverTime = HOVER_DEFAULT;
			tme.hwndTrack = hwnd;
			_TrackMouseEvent(&tme);

			int newVal = (BYTE)SendMessage(hwnd, TBM_GETPOS, 0, 0);
			if (oldVal != newVal) {
				if (oldVal < 0)
					SetWindowLongPtr(hwndBox, GWLP_USERDATA, 0);

				RECT rc; GetWindowRect(hwnd, &rc);
				SetWindowPos(hwndBox, NULL,
					(rc.left+rc.right-newVal)/2, rc.bottom+2, newVal, newVal,
					SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW);

				HRGN rgn = CreateRoundRectRgn(0, 0, newVal, newVal, 2 * PopupOptions.avatarRadius, 2 * PopupOptions.avatarRadius);
				SetWindowRgn(hwndBox, rgn, TRUE);
				InvalidateRect(hwndBox, NULL, FALSE);
				oldVal = newVal;
			}
		}
		break;

	case WM_MOUSELEAVE:
		SetWindowRgn(hwndBox, NULL, TRUE);
		ShowWindow(hwndBox, SW_HIDE);
		oldVal = -1;
		break;
	}
	return mir_callNextSubclass(hwnd, AvatarTrackBarWndProc, msg, wParam, lParam);
}
Example #4
0
static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_KEYDOWN:
		switch (wParam) {
		case VK_RETURN:
			cli.pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
			return 0;
		case VK_ESCAPE:
			cli.pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 0);
			return 0;
		}
		break;
	case WM_GETDLGCODE:
		if (lParam) {
			MSG *msg = (MSG *) lParam;
			if (msg->message == WM_KEYDOWN && msg->wParam == VK_TAB)
				return 0;
			if (msg->message == WM_CHAR && msg->wParam == '\t')
				return 0;
		}
		return DLGC_WANTMESSAGE;
	case WM_KILLFOCUS:
		cli.pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
		return 0;
	}
	return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam);
}
Example #5
0
// token + input dialog proc
// from SRMM
static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	RECT rc;

	switch (msg) {
	case WM_NCHITTEST:
		return HTCLIENT;

	case WM_SETCURSOR:
		GetClientRect(hwnd, &rc);
		//SetCursor(rc.right > rc.bottom ? hCurSplitNS : hCurSplitWE);
		if (rc.right > rc.bottom)
			SetCursor(hCurSplitNS);

		return TRUE;

	case WM_LBUTTONDOWN:
		SetCapture(hwnd);
		return 0;

	case WM_MOUSEMOVE:
		if (GetCapture() == hwnd) {
			GetClientRect(hwnd, &rc);
			SendMessage(GetParent(hwnd), DM_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
		}
		return 0;

	case WM_LBUTTONUP:
		ReleaseCapture();
		return 0;
	}
	return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
Example #6
0
/*
Splitter function.
Taken from srmm-plugin.... 
*/
LRESULT CALLBACK SplitterProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

	switch (msg) {
	case WM_NCHITTEST:
		return HTCLIENT;
		break;
	case WM_SETCURSOR: {
		RECT rc;
		GetClientRect(hWnd, &rc);
		SetCursor(splitCursor);
		return TRUE;
		} break;
	case WM_LBUTTONDOWN:
		SetCapture(hWnd);
		return 0;
		break;
	case WM_MOUSEMOVE:
		if (GetCapture() == hWnd) {
			RECT rc;
			GetClientRect(hWnd, &rc);
			SendMessage( GetParent(hWnd), DM_LINKSPLITTER, (WPARAM)(HIWORD(GetMessagePos()) + rc.bottom / 2), (LPARAM)hWnd);
		}
		return 0;
		break;
	case WM_LBUTTONUP:
		ReleaseCapture();
		return 0;
	}
	return mir_callNextSubclass(hWnd, SplitterProc, msg, wParam, lParam);
}
Example #7
0
static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)  {
	case WM_KEYDOWN:
		switch (wParam) {
		case VK_RETURN:
			pcli->pfnEndRename(GetParent(hwnd), (ClcData*)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1);
			return 0;
		case VK_ESCAPE:
			pcli->pfnEndRename(GetParent(hwnd), (ClcData*)GetWindowLongPtr(hwnd, GWLP_USERDATA), 0);
			return 0;
		}
		break;
	case WM_GETDLGCODE:
		if (lParam) {
			MSG *msg = (MSG*)lParam;
			if (msg->message == WM_KEYDOWN && msg->wParam == VK_TAB) return 0;
			if (msg->message == WM_CHAR && msg->wParam == '\t') return 0;
		}
		return DLGC_WANTMESSAGE;
	case WM_KILLFOCUS:
		pcli->pfnEndRename(GetParent(hwnd), (ClcData*)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1);
		SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0);
		return 0;
	}
	return mir_callNextSubclass(hwnd, RenameEditSubclassProc, uMsg, wParam, lParam);
}
Example #8
0
static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_CTLCOLOREDIT:
		if (!GetPropA((HWND)lParam, "Miranda.AeroRender.Active"))
			RedrawWindow((HWND)lParam, NULL, NULL, RDW_INVALIDATE);
		break;

	case WM_ERASEBKGND:
		return TRUE;

	case WM_PRINT:
	case WM_PRINTCLIENT:
		AeroPaintControl(hwnd, (HDC)wParam, AeroPaintSubclassProc, msg, lParam);
		return TRUE;

	case WM_PAINT:
	{
						 PAINTSTRUCT ps;
						 HDC hdc = BeginPaint(hwnd, &ps);
						 AeroPaintControl(hwnd, hdc, AeroPaintSubclassProc);
						 EndPaint(hwnd, &ps);
	}
		return TRUE;

	case WM_DESTROY:
		RemovePropA(hwnd, "Miranda.AeroRender.Active");
		break;
	}
	return mir_callNextSubclass(hwnd, AeroPaintSubclassProc, msg, wParam, lParam);
}
Example #9
0
static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = WM_PRINT, LPARAM lpFlags = PRF_CLIENT | PRF_NONCLIENT)
{
	HBITMAP hBmp, hOldBmp;
	RECT rc; GetClientRect(hwnd, &rc);
	BYTE *pBits;

	HDC tempDC = CreateCompatibleDC(hdc);

	BITMAPINFO bmi;
	bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
	bmi.bmiHeader.biWidth = rc.right;
	bmi.bmiHeader.biHeight = -rc.bottom;
	bmi.bmiHeader.biPlanes = 1;
	bmi.bmiHeader.biBitCount = 32;
	bmi.bmiHeader.biCompression = BI_RGB;
	hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, NULL, 0);

	hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);

	//paint
	SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
	mir_callNextSubclass(hwnd, OldWndProc, msg, (WPARAM)tempDC, lpFlags);
	SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);

	// Fix alpha channel
	GdiFlush();
	for (int i = 0; i < rc.right*rc.bottom; i++, pBits += 4)
	if (!pBits[3]) pBits[3] = 255;

	//Copy to output
	BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
	SelectObject(tempDC, hOldBmp);
	DeleteObject(hBmp);
	DeleteDC(tempDC);
}
Example #10
0
static LRESULT __stdcall newMirandaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (uMsg == WM_WINDOWPOSCHANGED) {
		WINDOWPOS *wp = (WINDOWPOS*)lParam;
		if (wp->flags & SWP_HIDEWINDOW) {
			bIsCListShow = FALSE;
			ShowThumbsOnHideCList();
		}
		else if (wp->flags & SWP_SHOWWINDOW) {
			bIsCListShow = TRUE;
			HideThumbsOnShowCList();
		}
		else if (!(wp->flags & SWP_NOMOVE)) {
			BYTE method = db_get_b(NULL, "ModernData", "HideBehind", 0);
			if (method) {
				WORD wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", 0);
				RECT rc = { wp->x, wp->y, wp->x + wp->cx, wp->y + wp->cy };
				RECT rcScr = { wBehindEdgeBorderSize*(2 - method), 0, GetSystemMetrics(SM_CXSCREEN) - wBehindEdgeBorderSize*(method - 1), GetSystemMetrics(SM_CYSCREEN) };
				RECT rcOverlap;
				BOOL isIntersect = IntersectRect(&rcOverlap, &rc, &rcScr);
				if (!isIntersect && bIsCListShow) {
					bIsCListShow = FALSE;
					ShowThumbsOnHideCList();
				}
				else if (isIntersect && !bIsCListShow) {
					bIsCListShow = TRUE;
					HideThumbsOnShowCList();
				}
			}
		}
	}
	return mir_callNextSubclass(hwnd, newMirandaWndProc, uMsg, wParam, lParam);
}
Example #11
0
static LRESULT CALLBACK toolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	ModernToolbarCtrl* pMTBInfo = (ModernToolbarCtrl*)GetWindowLongPtr(hwnd, 0);

	switch (msg) {
	case WM_ERASEBKGND:
		return (g_CluiData.fDisableSkinEngine) ? sttDrawToolBarBackground(hwnd, (HDC)wParam, NULL, pMTBInfo) : 0;

	case WM_NCPAINT:
	case WM_PAINT:
	{
		PAINTSTRUCT ps;
		BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList);
		if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat) {
			BeginPaint(hwnd, &ps);
			if ((!g_CluiData.fLayered || bFloat) && !g_CluiData.fDisableSkinEngine)
				sttDrawNonLayeredSkinedBar(hwnd, ps.hdc);
			else
				sttDrawToolBarBackground(hwnd, ps.hdc, &ps.rcPaint, pMTBInfo);
			EndPaint(hwnd, &ps);
		}
	}
	return DefWindowProc(hwnd, msg, wParam, lParam);

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->code == BUTTONNEEDREDRAW)
			pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
		return 0;

	case MTBM_LAYEREDPAINT:
	{
		RECT MyRect = { 0 };
		HDC hDC = (HDC)wParam;
		GetWindowRect(hwnd, &MyRect);

		RECT rcClient;
		GetClientRect(hwnd, &rcClient);
		SkinDrawGlyph(hDC, &rcClient, &rcClient, "Bar,ID=ToolBar,Part=Background");

		for (int i = 0; i < pMTBInfo->pButtonList->realCount; i++) {
			RECT childRect;
			POINT Offset;
			TTBCtrlButton* mtbi = (TTBCtrlButton*)pMTBInfo->pButtonList->items[i];
			GetWindowRect(mtbi->hWindow, &childRect);
			Offset.x = childRect.left - MyRect.left;
			Offset.y = childRect.top - MyRect.top;
			SendMessage(mtbi->hWindow, BUTTONDRAWINPARENT, (WPARAM)hDC, (LPARAM)&Offset);
		}
	}
	return 0;

	case WM_DESTROY:
		xpt_FreeThemeForWindow(hwnd);
		CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)hwnd, 0);
		break;
	}

	return mir_callNextSubclass(hwnd, toolbarWndProc, msg, wParam, lParam);
}
Example #12
0
static LRESULT CALLBACK LabelEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_GETDLGCODE:
		return DLGC_WANTALLKEYS;
	} 
	return mir_callNextSubclass(hwnd, LabelEditSubclassProc, msg, wParam, lParam);
}
Example #13
0
static LRESULT CALLBACK SliderWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_ERASEBKGND:
		return TRUE;
	}
	return mir_callNextSubclass(hwnd, SliderWndProc, msg, wParam, lParam);
}
Example #14
0
LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
	switch(msg){
	case WM_SETCURSOR:
		SetCursor(LoadCursor(NULL,IDC_ARROW));
		return 1;
	}
	return mir_callNextSubclass(hdlg, EditProc, msg, wparam, lparam);
}
Example #15
0
static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (msg == WM_CHAR) {
		if (_tcschr(_T(".?/\\#' "), (TCHAR)wParam) != 0)
			return 0;
		PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0);
	}
	return mir_callNextSubclass(edit, ProfileNameValidate, msg, wParam, lParam);
}
Example #16
0
LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_KEYDOWN:
		SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
		break;
	}
	return mir_callNextSubclass(hwnd, MyEditProc, message, wParam, lParam);
}
/**
 * name:		PlacesBarSubclassProc
 * params:		hWnd	- handle, to control's window
 *				uMsg	- the message to handle
 *				wParam	- message dependend parameter
 *				lParam	- message dependend parameter
 * return:		depends on message
 **/
static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (uMsg == TB_ADDBUTTONS) {
		TBBUTTON *tbb = (TBBUTTON *)lParam;
		TCHAR szBtnText[MAX_PATH];
		int iString;
		HWND hWndToolTip;

		if (tbb) {
			// miranda button
			switch (tbb->idCommand) {
			case 41063:
				ZeroMemory(szBtnText, sizeof(szBtnText));

				mir_tcsncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
				iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
				if (iString != -1) tbb->iString = iString;
				// set tooltip
				hWndToolTip = (HWND)SendMessage(hWnd, TB_GETTOOLTIPS, NULL, NULL);
				if (hWndToolTip) {
					TOOLINFO ti;

					ZeroMemory(&ti, sizeof(ti));
					ti.cbSize = sizeof(ti);
					ti.hwnd = hWnd;
					ti.lpszText = TranslateT("Shows Miranda's installation directory.");
					ti.uId = tbb->idCommand;
					SendMessage(hWndToolTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
				}
				break;
				// profile button
			case 41064:
				// set button text
				iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM) TranslateT("Profile"));
				if (iString != -1) tbb->iString = iString;

				// set tooltip
				hWndToolTip = (HWND)SendMessage(hWnd, TB_GETTOOLTIPS, NULL, NULL);
				if (hWndToolTip) {
					TOOLINFO ti;

					ZeroMemory(&ti, sizeof(ti));
					ti.cbSize = sizeof(ti);
					ti.hwnd = hWnd;
					ti.lpszText = TranslateT("Shows the directory with all your Miranda's profiles.");
					ti.uId = tbb->idCommand;
					SendMessage(hWndToolTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
				}
				// unmap registry and delete keys
				ResetAlteredPlaceBars();
				break;
			}
		}
	}
	return mir_callNextSubclass(hWnd, PlacesBarSubclassProc, uMsg, wParam,lParam);
}
Example #18
0
static LRESULT CALLBACK TlenValidateUsernameWndProc(HWND hwndEdit, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_CHAR:
		if (strchr("\"&'/:<>@", wParam&0xff) != NULL)
			return 0;
		break;
	}
	return mir_callNextSubclass(hwndEdit, TlenValidateUsernameWndProc, msg, wParam, lParam);
}
Example #19
0
static LRESULT CALLBACK ProgressBarSubclassProc(HWND hwndProgress, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_ERASEBKGND:
		return TRUE;
	case WM_LBUTTONDOWN:
	case WM_LBUTTONDBLCLK:
		return SendMessage(GetParent(hwndProgress), msg, wParam, lParam);
	}
	return mir_callNextSubclass(hwndProgress, ProgressBarSubclassProc, msg, wParam, lParam);
}
Example #20
0
/**
 * name:	TPropsheetTree_LabelEditProc()
 * desc:	subclussproc of the label editcontrol
 * return:	0
 **/
static LRESULT CALLBACK TPropsheetTree_LabelEditProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	switch(uMsg) {
	case WM_KEYDOWN:
		switch(wParam) {
		case VK_RETURN:
			return ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(TRUE);
		case VK_TAB:
		case VK_ESCAPE:
			return ((CPsTree*)GetUserData(hwnd))->EndLabelEdit(FALSE);
		}
		break;

	case WM_KILLFOCUS:
		((CPsTree*)GetUserData(hwnd))->EndLabelEdit(FALSE);
		break;

	case WM_GETDLGCODE:
		return DLGC_WANTALLKEYS | mir_callNextSubclass(hwnd, TPropsheetTree_LabelEditProc, uMsg, wParam, lParam );
	}
	return mir_callNextSubclass(hwnd, TPropsheetTree_LabelEditProc, uMsg, wParam, lParam);
}
Example #21
0
static LRESULT CALLBACK StatusMsgEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_CHAR:
		if (wParam == 0x0a && (GetKeyState(VK_CONTROL) & 0x8000) != 0) {
			PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
			return 0;
		}
		break;
	}

	return mir_callNextSubclass(hwnd, StatusMsgEditSubclassProc, msg, wParam, lParam);
}
Example #22
0
LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (!wndPreview)
		return mir_callNextSubclass(hwnd, WndProcPreviewBox, msg, wParam, lParam);

	switch (msg) {
	case WM_PAINT:
		if (GetUpdateRect(hwnd, 0, FALSE))
		{
			PAINTSTRUCT ps;
			HDC hdc = BeginPaint(hwnd, &ps);
			DrawPreview(hwnd, hdc);
			EndPaint(hwnd, &ps);
			return 0;
		}

	case WM_PRINT:
	case WM_PRINTCLIENT:
		HDC hdc = (HDC)wParam;
		DrawPreview(hwnd, hdc);
		return 0;
	}
	return mir_callNextSubclass(hwnd, WndProcPreviewBox, msg, wParam, lParam);
}
Example #23
0
static LRESULT CALLBACK ModuleTreeLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_KEYUP:
		switch (wParam) {
		case VK_RETURN:
			TreeView_EndEditLabelNow(GetParent(hwnd), 0);
			return 0;
		case VK_ESCAPE:
			TreeView_EndEditLabelNow(GetParent(hwnd), 1);
			return 0;
		}
		break;
	}
	return mir_callNextSubclass(hwnd, ModuleTreeLabelEditSubClassProc, msg, wParam, lParam);
}
Example #24
0
static LRESULT CALLBACK SendEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg) {
	case WM_CHAR:
		if (wParam == '\n' && GetKeyState(VK_CONTROL)&0x8000) {
			PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
			return 0;
		}
		break;
	case WM_SYSCHAR:
		if ((wParam == 's' || wParam == 'S') && GetKeyState(VK_MENU)&0x8000) {
			PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
			return 0;
		}
		break;
	}
	return mir_callNextSubclass(hwnd, SendEditSubclassProc, msg, wParam, lParam);
}
Example #25
0
static LRESULT CALLBACK RichEditOwnerSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	RichEditOwnerData* rdto = g_RichEditOwnerList.find((RichEditOwnerData*)&hwnd);
	if (rdto == NULL)
		return 0;

	switch(uMsg) {
	case WM_COMMAND:
		if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
			RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
			if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
				rdt->dontReplace = true;
				CHARRANGE sel = allsel;
				ReplaceSmileysWithText(rdt->hwnd, sel, false);
			}
		}
		break;

	case WM_DESTROY:
		RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
		if (rdt && (!rdt->inputarea || opt.InputSmileys)) {
			CHARRANGE sel = allsel;
			rdt->dontReplace = true;
			ReplaceSmileysWithText(rdt->hwnd, sel, false);
		}
		break;
	}

	LRESULT result = mir_callNextSubclass(hwnd, RichEditOwnerSubclass, uMsg, wParam, lParam); 

	switch(uMsg) {
	case WM_COMMAND:
		if (LOWORD(wParam) == IDOK || LOWORD(wParam) == 1624) {
			RichEditData* rdt = g_RichEditList.find((RichEditData*)&rdto->hwndInput);
			if (rdt) {
				CHARRANGE sel = allsel;
				if (!result) ReplaceContactSmileys(rdt, sel, false, false);
				rdt->dontReplace = false;
			}
		}
		break;
	}
	return result;
}
Example #26
0
//subclass proc for the list view
static LRESULT CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_CONTEXTMENU:
		{
			int x = LOWORD(lParam);
			int y = HIWORD(lParam);
			int selection;		

			HMENU hMenu = CreatePopupMenu();
			AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard"));
			AppendMenu(hMenu, MF_STRING, POPUPMENU_MESSAGE, TranslateT("Copy message to clipboard"));
			AppendMenu(hMenu, MF_STRING, POPUPMENU_TIMESTAMP, TranslateT("Copy timestamp to clipboard"));
			selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hWnd, NULL);
			DestroyMenu(hMenu);
			if (selection)
			{
				CopyPopupDataToClipboard(hWnd, selection);
			}

			break;
		}

	case WM_KEYUP:
		switch (wParam) {
		case 'C':
			if (GetKeyState(VK_CONTROL))
				CopyPopupDataToClipboard(hWnd, POPUPMENU_MESSAGE);
			break;

		case VK_ESCAPE:
			SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
			break;
		}
		break;

	case WM_SYSKEYDOWN:
		if (wParam == 'X')
			SendMessage(GetParent(hWnd), WM_CLOSE, 0, 0);
		break;
	}

	return mir_callNextSubclass(hWnd, PopupsListSubclassProc, msg, wParam, lParam);
}
Example #27
0
static LRESULT CALLBACK OnlyCharsEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	Data *data = (Data *) GetWindowLongPtr(hwnd, GWLP_USERDATA);

	switch(msg) {
	case WM_CHAR:
		if (wParam == VK_BACK)
			break;
		if (lParam & (1 << 28))	// ALT key
			break;
		if (GetKeyState(VK_CONTROL) & 0x8000)	// CTRL key
			break;
		{
			TCHAR c = (TCHAR) wParam;
			if (!data->dict->autoReplace->isWordChar(c))
				return 1;

			TCHAR tmp[2] = { c, 0 };
			CharLower(tmp);
			wParam = tmp[0];

			break;
		}
	}

	LRESULT ret = mir_callNextSubclass(hwnd, OnlyCharsEditProc, msg, wParam, lParam);

	switch(msg) {
	case EM_PASTESPECIAL:
	case WM_PASTE:
		TCHAR text[256];
		GetWindowText(hwnd, text, SIZEOF(text));

		scoped_free<TCHAR> dest = data->dict->autoReplace->filterText(text);
		SetWindowText(hwnd, dest);
		break;
	}

	return ret;
}
Example #28
0
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg) {
	case WM_CHAR:
		if (wParam == '\n' && GetKeyState(VK_CONTROL) & 0x8000)
		{
			PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
			return 0;
		}
		if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) //ctrl-a
		{
			SendMessage(hwnd, EM_SETSEL, 0, -1);
			return 0;
		}
		if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) // ctrl-w
		{
			SendMessage(GetParent(hwnd), WM_CLOSE, 0, 0);
			return 0;
		}
		if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) //ctrl-backspace
		{
			DWORD start, end;
			TCHAR *text;
			int textLen;
			SendMessage(hwnd, EM_GETSEL, (WPARAM)&end, 0);
			SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
			SendMessage(hwnd, EM_GETSEL, (WPARAM)&start, 0);
			textLen = GetWindowTextLength(hwnd);
			text = (TCHAR *)alloca(sizeof(TCHAR) * (textLen + 1));
			GetWindowText(hwnd, text, textLen + 1);
			memmove(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
			SetWindowText(hwnd, text);
			SendMessage(hwnd, EM_SETSEL, start, start);
			SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
			return 0;
		}
		break;
	}
	return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}
Example #29
0
static LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	HWND hParent = GetParent(hwnd);
	switch (msg) {
	case WM_GETDLGCODE:
		return DLGC_WANTALLKEYS|DLGC_HASSETSEL;
	
	case WM_SETFOCUS:
		PostMessage(hwnd,EM_SETSEL,0,-1);
		break;
	
	case WM_KEYDOWN:
		{
			if(wParam==VK_RETURN)
				if(hwnd==GetDlgItem(hParent,IDC_BUTTONNAME))
					SendMessage(hParent,WM_COMMAND,IDC_BLISTADD,0);
				else 
					SendMessage(hParent,WM_COMMAND,IDC_MTREEADD,0);
		}break;
	} 
	
	return mir_callNextSubclass(hwnd, EditSubclassProc, msg, wParam, lParam);
}
Example #30
0
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)  {
	case WM_CHAR:
		if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) 
		{	// ctrl-a
			SendMessage(hwnd, EM_SETSEL, 0, -1);
			return 0;
		}

		if (wParam == 26 && GetKeyState(VK_CONTROL) & 0x8000) 
		{	// ctrl-z
			SendMessage(hwnd, EM_UNDO, 0, 0);
			return 0;
		}

		if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) 
		{	// ctrl-backspace
			DWORD start, end;
			WCHAR text[1024];

			SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
			SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
			SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
			GetWindowText(hwnd, text, _countof(text));
			memmove(text + start, text + end, sizeof(WCHAR) * (mir_wstrlen(text) + 1 - end));
			SetWindowText(hwnd, text);
			SendMessage(hwnd, EM_SETSEL, start, start);
			SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM) hwnd);
			return 0;
		}
		break;
	}

	return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam);
}