Esempio n. 1
0
void CFindPanel::OnSearch()
{
	if (!CVConGroup::isVConExists(0))
		return;

	MyGetDlgItemText(mh_Edit, 0, gpSet->FindOptions.cchTextMax, gpSet->FindOptions.pszText);
	if (gpSet->FindOptions.pszText && *gpSet->FindOptions.pszText)
	{
		int nDirection = 0;
		if (ms_PrevSearch->ms_Arg && (lstrcmp(ms_PrevSearch->ms_Arg, gpSet->FindOptions.pszText) == 0))
			nDirection = isPressed(VK_SHIFT) ? -1 : 1;
		gpConEmu->DoFindText(nDirection);
		ms_PrevSearch->Set(gpSet->FindOptions.pszText);
	}
}
Esempio n. 2
0
LRESULT CSetPgEnvironment::OnEditChanged(HWND hDlg, WORD nCtrlId)
{
	switch (nCtrlId)
	{
	case tSetCommands:
	{
		size_t cchMax = gpSet->psEnvironmentSet ? (_tcslen(gpSet->psEnvironmentSet)+1) : 0;
		MyGetDlgItemText(hDlg, tSetCommands, cchMax, gpSet->psEnvironmentSet);
	}
	break;

	default:
		_ASSERTE(FALSE && "EditBox was not processed");
	}

	return 0;
}
Esempio n. 3
0
INT_PTR CEFindDlg::findTextProc(HWND hWnd2, UINT messg, WPARAM wParam, LPARAM lParam)
{
	switch (messg)
	{
		case WM_INITDIALOG:
		{
			gpConEmu->OnOurDialogOpened();
			gpConEmu->mp_Find->mh_FindDlg = hWnd2;

			SendMessage(hWnd2, WM_SETICON, ICON_BIG, (LPARAM)hClassIcon);
			SendMessage(hWnd2, WM_SETICON, ICON_SMALL, (LPARAM)hClassIconSm);

			CDynDialog::LocalizeDialog(hWnd2);

			if (gpConEmu->mp_Find->mp_DpiAware)
			{
				gpConEmu->mp_Find->mp_DpiAware->Attach(hWnd2, ghWnd, gpConEmu->mp_Find->mp_Dlg);
			}

			#if 0
			//if (IsDebuggerPresent())
			if (!gpSet->isAlwaysOnTop)
				SetWindowPos(hWnd2, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
			#endif

			CVConGuard VCon;
			CRealConsole* pRCon = (CVConGroup::GetActiveVCon(&VCon) >= 0) ? VCon->RCon() : NULL;
			RECT rcWnd = {}; GetWindowRect(pRCon->GetView(), &rcWnd);
			RECT rcDlg = {}; GetWindowRect(hWnd2, &rcDlg);
			int nShift = max(gpFontMgr->FontWidth(),gpFontMgr->FontHeight());
			int nWidth = rcDlg.right - rcDlg.left;
			SetWindowPos(hWnd2, gpSet->isAlwaysOnTop ? HWND_TOPMOST : HWND_TOP,
				max(rcWnd.left,(rcWnd.right-nShift-nWidth)), (rcWnd.top+nShift), 0,0,
				SWP_NOSIZE);

			gpConEmu->mp_Find->UpdateFindDlgAlpha(true);
			SetTimer(hWnd2, 101, 1000, NULL);

			SetClassLongPtr(hWnd2, GCLP_HICON, (LONG_PTR)hClassIcon);
			SetDlgItemText(hWnd2, tFindText, gpSet->FindOptions.pszText ? gpSet->FindOptions.pszText : L"");
			CDlgItemHelper::checkDlgButton(hWnd2, cbFindMatchCase, gpSet->FindOptions.bMatchCase);
			CDlgItemHelper::checkDlgButton(hWnd2, cbFindWholeWords, gpSet->FindOptions.bMatchWholeWords);
			CDlgItemHelper::checkDlgButton(hWnd2, cbFindFreezeConsole, gpSet->FindOptions.bFreezeConsole);
			#if 0
			CDlgItemHelper::checkDlgButton(hWnd2, cbFindHighlightAll, gpSet->FindOptions.bHighlightAll);
			#endif
			CDlgItemHelper::checkDlgButton(hWnd2, cbFindTransparent, gpSet->FindOptions.bTransparent);

			if (gpSet->FindOptions.pszText && *gpSet->FindOptions.pszText)
				SendDlgItemMessage(hWnd2, tFindText, EM_SETSEL, 0, lstrlen(gpSet->FindOptions.pszText));

			// Зовем всегда, чтобы инициализировать буфер для поиска как минимум
			gpConEmu->DoFindText(0);
			break;
		}

		//case WM_SYSCOMMAND:
		//	if (LOWORD(wParam) == ID_ALWAYSONTOP)
		//	{
		//		BOOL lbOnTopNow = GetWindowLong(ghOpWnd, GWL_EXSTYLE) & WS_EX_TOPMOST;
		//		SetWindowPos(ghOpWnd, lbOnTopNow ? HWND_NOTOPMOST : HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
		//		CheckMenuItem(GetSystemMenu(ghOpWnd, FALSE), ID_ALWAYSONTOP, MF_BYCOMMAND |
		//		              (lbOnTopNow ? MF_UNCHECKED : MF_CHECKED));
		//		SetWindowLongPtr(hWnd2, DWLP_MSGRESULT, 0);
		//		return 1;
		//	}
		//	break;

		case WM_MOUSEMOVE:
		case WM_NCMOUSEMOVE:
		case WM_TIMER:
			gpConEmu->mp_Find->UpdateFindDlgAlpha();
			break;

		case WM_COMMAND:
			if (HIWORD(wParam) == BN_CLICKED)
			{
				int nDirection = 0;

				switch (LOWORD(wParam))
				{
				case IDCLOSE:
				case IDCANCEL:
					DestroyWindow(hWnd2);
					return 0;
				case cbFindMatchCase:
					gpSet->FindOptions.bMatchCase = CDlgItemHelper::isChecked2(hWnd2, cbFindMatchCase);
					break;
				case cbFindWholeWords:
					gpSet->FindOptions.bMatchWholeWords = CDlgItemHelper::isChecked2(hWnd2, cbFindWholeWords);
					break;
				case cbFindFreezeConsole:
					gpSet->FindOptions.bFreezeConsole = CDlgItemHelper::isChecked2(hWnd2, cbFindFreezeConsole);
					break;
				case cbFindHighlightAll:
					gpSet->FindOptions.bHighlightAll = CDlgItemHelper::isChecked2(hWnd2, cbFindHighlightAll);
					break;
				case cbFindTransparent:
					gpSet->FindOptions.bTransparent = CDlgItemHelper::isChecked2(hWnd2, cbFindTransparent);
					gpConEmu->mp_Find->UpdateFindDlgAlpha(true);
					return 0;
				case cbFindNext:
					nDirection = 1;
					break;
				case cbFindPrev:
					nDirection = -1;
					break;
				default:
					return 0;
				}

				if (gpSet->FindOptions.pszText && *gpSet->FindOptions.pszText)
					gpConEmu->DoFindText(nDirection);
			}
			else if (HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)
			{
				MyGetDlgItemText(hWnd2, tFindText, gpSet->FindOptions.cchTextMax, gpSet->FindOptions.pszText);
				if (gpSet->FindOptions.pszText && *gpSet->FindOptions.pszText)
					gpConEmu->DoFindText(0);
			}
			break;

		case WM_CLOSE:
			gpConEmu->OnOurDialogClosed();
			DestroyWindow(hWnd2);
			break;

		case WM_DESTROY:
			KillTimer(hWnd2, 101);
			gpConEmu->mp_Find->mh_FindDlg = NULL;
			gpSet->SaveFindOptions();
			gpConEmu->SkipOneAppsRelease(false);
			gpConEmu->DoEndFindText();
			if (gpConEmu->mp_Find->mp_DpiAware)
				gpConEmu->mp_Find->mp_DpiAware->Detach();
			SafeDelete(gpConEmu->mp_Find->mp_Dlg);
			break;

		default:
			if (gpConEmu->mp_Find->mp_DpiAware && gpConEmu->mp_Find->mp_DpiAware->ProcessDpiMessages(hWnd2, messg, wParam, lParam))
			{
				return TRUE;
			}
	}

	return 0;
}