Exemple #1
0
LRESULT CSetPgFarMacro::OnInitDialog(HWND hDlg, bool abInitial)
{
	_ASSERTE(gpSet->isRClickSendKey==0 || gpSet->isRClickSendKey==1 || gpSet->isRClickSendKey==2);

	checkDlgButton(hDlg, cbRClick, gpSet->isRClickSendKey);
	checkDlgButton(hDlg, cbSafeFarClose, gpSet->isSafeFarClose);

	struct MacroItem {
		int nDlgItem;
		LPCWSTR pszEditor;
		LPCWSTR pszVariants[6];
	} Macros[] = {
		{tRClickMacro, gpSet->RClickMacro(fmv_Default),
			{FarRClickMacroDefault2, FarRClickMacroDefault3, NULL}},
		{tSafeFarCloseMacro, gpSet->SafeFarCloseMacro(fmv_Default),
		{FarSafeCloseMacroDefault2, FarSafeCloseMacroDefault3, FarSafeCloseMacroDefaultD2, FarSafeCloseMacroDefaultD3, L"#Close(0)", NULL}},
		{tCloseTabMacro, gpSet->TabCloseMacro(fmv_Default),
			{FarTabCloseMacroDefault2, FarTabCloseMacroDefault3, NULL}},
		{tSaveAllMacro, gpSet->SaveAllMacro(fmv_Default),
			{FarSaveAllMacroDefault2, FarSaveAllMacroDefault3, NULL}},
		{0}
	};

	for (MacroItem* p = Macros; p->nDlgItem; p++)
	{
		HWND hCombo = GetDlgItem(hDlg, p->nDlgItem);

		CSetDlgLists::FillCBList(hCombo, abInitial, p->pszVariants, p->pszEditor);
	}

	return 0;
}
Exemple #2
0
void CSetPgBase::setHotkeyCheckbox(HWND hDlg, WORD nCtrlId, int iHotkeyId, LPCWSTR pszFrom, LPCWSTR pszTo, UINT uChecked)
{
	wchar_t szKeyFull[128] = L"";
	gpSet->GetHotkeyNameById(iHotkeyId, szKeyFull, false);
	if (szKeyFull[0] == 0)
	{
		EnableWindow(GetDlgItem(hDlg, nCtrlId), FALSE);
		checkDlgButton(hDlg, nCtrlId, BST_UNCHECKED);
	}
	else
	{
		if (pszFrom)
		{
			wchar_t* ptr = (wchar_t*)wcsstr(szKeyFull, pszFrom);
			if (ptr)
			{
				*ptr = 0;
				if (pszTo)
				{
					wcscat_c(szKeyFull, pszTo);
				}
			}
		}

		CEStr lsText(GetDlgItemTextPtr(hDlg, nCtrlId));
		LPCWSTR pszTail = lsText.IsEmpty() ? NULL : wcsstr(lsText, L" - ");
		if (pszTail)
		{
			CEStr lsNew(szKeyFull, pszTail);
			SetDlgItemText(hDlg, nCtrlId, lsNew);
		}

		checkDlgButton(hDlg, nCtrlId, uChecked);
	}
}
Exemple #3
0
LRESULT CSetPgPaste::OnInitDialog(HWND hDlg, bool abInitial)
{
	PasteLinesMode mode;

	mode = gpSet->AppStd.isPasteAllLines;
	checkRadioButton(hDlg, rPasteM1MultiLine, rPasteM1Nothing,
		(mode == plm_FirstLine) ? rPasteM1FirstLine
		: (mode == plm_SingleLine) ? rPasteM1SingleLine
		: (mode == plm_Nothing) ? rPasteM1Nothing
		: rPasteM1MultiLine);

	mode = gpSet->AppStd.isPasteFirstLine;
	checkRadioButton(hDlg, rPasteM2MultiLine, rPasteM2Nothing,
		(mode == plm_MultiLine) ? rPasteM2MultiLine
		: (mode == plm_FirstLine) ? rPasteM2FirstLine
		: (mode == plm_Nothing) ? rPasteM2Nothing
		: rPasteM2SingleLine);

	checkDlgButton(hDlg, cbClipConfirmEnter, gpSet->isPasteConfirmEnter);

	checkDlgButton(hDlg, cbClipConfirmLimit, (gpSet->nPasteConfirmLonger!=0));
	SetDlgItemInt(hDlg, tClipConfirmLimit, gpSet->nPasteConfirmLonger, FALSE);

	return 0;
}
Exemple #4
0
LRESULT CSetPgHilight::OnInitDialog(HWND hDlg, bool abInitial)
{
    // Hyperlinks & compiler errors
    checkDlgButton(hDlg, cbFarGotoEditor, gpSet->isFarGotoEditor);
    UINT VkMod = gpSet->GetHotkeyById(vkFarGotoEditorVk);
    CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbFarGotoEditorVk), CSetDlgLists::eKeysAct, VkMod, false);

    LPCWSTR ppszDefEditors[] = {
        HI_GOTO_EDITOR_FAR,    // Far Manager
        HI_GOTO_EDITOR_SCITE,  // SciTE (Scintilla)
        HI_GOTO_EDITOR_NPADP,  // Notepad++
        HI_GOTO_EDITOR_VIMW,   // Vim, official, using Windows paths
        HI_GOTO_EDITOR_SUBLM,  // Sublime text
        HI_GOTO_EDITOR_CMD,    // Just ‘start’ highlighted file via cmd.exe
        HI_GOTO_EDITOR_CMD_NC, // Just ‘start’ highlighted file via cmd.exe, same as prev. but without close confirmation
        NULL
    };
    CSetDlgLists::FillCBList(GetDlgItem(hDlg, lbGotoEditorCmd), abInitial, ppszDefEditors, gpSet->sFarGotoEditor);

    // Highlight full row/column under mouse cursor
    checkDlgButton(hDlg, cbHighlightMouseRow, gpSet->isHighlightMouseRow);
    checkDlgButton(hDlg, cbHighlightMouseCol, gpSet->isHighlightMouseCol);

    // This modifier (lbFarGotoEditorVk) is not checked
    // CheckSelectionModifiers(hDlg);

    return 0;
}
LRESULT CSetPgEnvironment::OnInitDialog(HWND hDlg, bool abInitial)
{
	checkDlgButton(hDlg, cbAddConEmu2Path, (gpSet->ComSpec.AddConEmu2Path & CEAP_AddConEmuExeDir) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbAddConEmuBase2Path, (gpSet->ComSpec.AddConEmu2Path & CEAP_AddConEmuBaseDir) ? BST_CHECKED : BST_UNCHECKED);

	SetDlgItemText(hDlg, tSetCommands, gpSet->psEnvironmentSet ? gpSet->psEnvironmentSet : L"");

	return 0;
}
Exemple #6
0
LRESULT CSetPgConfirm::OnInitDialog(HWND hDlg, bool abInitial)
{
	checkDlgButton(hDlg, cbNewConfirm, gpSet->isMultiNewConfirm);
	checkDlgButton(hDlg, cbDupConfirm, gpSet->isMultiDupConfirm);
	checkDlgButton(hDlg, cbCloseWindowConfirm, (gpSet->nCloseConfirmFlags & Settings::cc_Window) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbCloseConsoleConfirm, (gpSet->nCloseConfirmFlags & Settings::cc_Console) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbConfirmCloseRunning, (gpSet->nCloseConfirmFlags & Settings::cc_Running) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbCloseEditViewConfirm, (gpSet->nCloseConfirmFlags & Settings::cc_FarEV) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbConfirmDetach, gpSet->isMultiDetachConfirm);
	checkDlgButton(hDlg, cbShowWasHiddenMsg, gpSet->isDownShowHiddenMessage ? BST_UNCHECKED : BST_CHECKED);
	checkDlgButton(hDlg, cbShowWasSetOnTopMsg, gpSet->isDownShowExOnTopMessage ? BST_UNCHECKED : BST_CHECKED);

	return 0;
}
Exemple #7
0
LRESULT CSetPgQuake::OnInitDialog(HWND hDlg, bool abInitial)
{
	// Quake style
	checkDlgButton(hDlg, cbQuakeStyle, gpSet->isQuakeStyle ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbQuakeAutoHide, (gpSet->isQuakeStyle == 2) ? BST_CHECKED : BST_UNCHECKED);
	// Show/Hide/Slide timeout
	SetDlgItemInt(hDlg, tQuakeAnimation, gpSet->nQuakeAnimation, FALSE);

	EnableWindow(GetDlgItem(hDlg, cbQuakeAutoHide), gpSet->isQuakeStyle);

	// Frame hide options
	SetDlgItemInt(hDlg, tHideCaptionAlwaysFrame, gpSet->HideCaptionAlwaysFrame(), TRUE);
	SetDlgItemInt(hDlg, tHideCaptionAlwaysDelay, gpSet->nHideCaptionAlwaysDelay, FALSE);
	SetDlgItemInt(hDlg, tHideCaptionAlwaysDissapear, gpSet->nHideCaptionAlwaysDisappear, FALSE);

	checkDlgButton(hDlg, cbAlwaysOnTop, gpSet->isAlwaysOnTop);

	return 0;
}
Exemple #8
0
LRESULT CSetPgComspec::OnInitDialog(HWND hDlg, bool abInitial)
{
	_ASSERTE((rbComspecAuto+cst_Explicit)==rbComspecExplicit && (rbComspecAuto+cst_Cmd)==rbComspecCmd  && (rbComspecAuto+cst_EnvVar)==rbComspecEnvVar);
	checkRadioButton(hDlg, rbComspecAuto, rbComspecExplicit, rbComspecAuto+gpSet->ComSpec.csType);

	SetDlgItemText(hDlg, tComspecExplicit, gpSet->ComSpec.ComspecExplicit);
	SendDlgItemMessage(hDlg, tComspecExplicit, EM_SETLIMITTEXT, countof(gpSet->ComSpec.ComspecExplicit)-1, 0);

	_ASSERTE((rbComspec_OSbit+csb_SameApp)==rbComspec_AppBit && (rbComspec_OSbit+csb_x32)==rbComspec_x32);
	checkRadioButton(hDlg, rbComspec_OSbit, rbComspec_x32, rbComspec_OSbit+gpSet->ComSpec.csBits);

	checkDlgButton(hDlg, cbComspecUpdateEnv, gpSet->ComSpec.isUpdateEnv ? BST_CHECKED : BST_UNCHECKED);
	enableDlgItem(hDlg, cbComspecUpdateEnv, (gpSet->ComSpec.csType!=cst_EnvVar));

	checkDlgButton(hDlg, cbComspecUncPaths, gpSet->ComSpec.isAllowUncPaths ? BST_CHECKED : BST_UNCHECKED);

	// Autorun (autoattach) with "cmd.exe" or "tcc.exe"
	ReloadAutorun();

	return 0;
}
Exemple #9
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;
}
Exemple #10
0
LRESULT CSetPgStatus::OnInitDialog(HWND hDlg, bool abInitial)
{
	SetDlgItemText(hDlg, tStatusFontFace, gpSet->sStatusFontFace);

	if (CSetDlgFonts::EnumFontsFinished())  // Если шрифты уже считаны
	{
		CSetPgFonts* pFonts = NULL;
		if (gpSetCls->GetPageObj(pFonts))
		{
			pFonts->CopyFontsTo(hDlg, tStatusFontFace, 0); // можно скопировать список с вкладки [thi_Fonts]
		}
	}

	UINT nVal = gpSet->nStatusFontHeight;
	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tStatusFontHeight), CSetDlgLists::eFSizesSmall, nVal, true);

	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tStatusFontCharset), CSetDlgLists::eCharSets, gpSet->nStatusFontCharSet, false);

	// Colors
	for (uint c = c35; c <= c37; c++)
		CSetDlgColors::ColorSetEdit(hDlg, c);

	checkDlgButton(hDlg, cbStatusVertSep, (gpSet->isStatusBarFlags & csf_VertDelim) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbStatusHorzSep, (gpSet->isStatusBarFlags & csf_HorzDelim) ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbStatusVertPad, (gpSet->isStatusBarFlags & csf_NoVerticalPad)==0 ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbStatusSystemColors, (gpSet->isStatusBarFlags & csf_SystemColors) ? BST_CHECKED : BST_UNCHECKED);

	CSetDlgLists::EnableDlgItems(hDlg, CSetDlgLists::eStatusColorIds, !(gpSet->isStatusBarFlags & csf_SystemColors));

	checkDlgButton(hDlg, cbShowStatusBar, gpSet->isStatusBarShow);

	//for (size_t i = 0; i < countof(SettingsNS::StatusItems); i++)
	//{
	//	checkDlgButton(hDlg, SettingsNS::StatusItems[i].nDlgID, !gpSet->isStatusColumnHidden[SettingsNS::StatusItems[i].stItem]);
	//}

	UpdateStatusItems(hDlg);

	return 0;
}
Exemple #11
0
LRESULT CSetPgIntegr::OnInitDialog(HWND hDlg, bool abInitial)
{
	MSetter lSkip(&mb_SkipSelChange);

	int iHere = 0, iInside = 0;
	ReloadHereList(&iHere, &iInside);

	// Возвращает NULL, если строка пустая
	wchar_t* pszCurInside = GetDlgItemTextPtr(hDlg, cbInsideName);
	_ASSERTE((pszCurInside==NULL) || (*pszCurInside!=0));
	wchar_t* pszCurHere   = GetDlgItemTextPtr(hDlg, cbHereName);
	_ASSERTE((pszCurHere==NULL) || (*pszCurHere!=0));

	wchar_t szIcon[MAX_PATH+32];
	_wsprintf(szIcon, SKIPLEN(countof(szIcon)) L"%s,0", gpConEmu->ms_ConEmuExe);

	if ((iInside > 0) && pszCurInside)
	{
		FillHereValues(cbInsideName);
	}
	else if (abInitial)
	{
		SetDlgItemText(hDlg, cbInsideName, L"ConEmu Inside");
		SetDlgItemText(hDlg, tInsideConfig, L"shell");
		SetDlgItemText(hDlg, tInsideShell, CONEMU_HERE_POSH);
		//SetDlgItemText(hDlg, tInsideIcon, szIcon);
		SetDlgItemText(hDlg, tInsideIcon, L"powershell.exe");
		checkDlgButton(hDlg, cbInsideSyncDir, gpConEmu->mp_Inside && gpConEmu->mp_Inside->mb_InsideSynchronizeCurDir);
		SetDlgItemText(hDlg, tInsideSyncDir, L""); // Auto
	}

	if ((iHere > 0) && pszCurHere)
	{
		FillHereValues(cbHereName);
	}
	else if (abInitial)
	{
		SetDlgItemText(hDlg, cbHereName, L"ConEmu Here");
		SetDlgItemText(hDlg, tHereConfig, L"");
		SetDlgItemText(hDlg, tHereShell, CONEMU_HERE_CMD);
		SetDlgItemText(hDlg, tHereIcon, szIcon);
	}

	SafeFree(pszCurInside);
	SafeFree(pszCurHere);

	return 0;
}
Exemple #12
0
LRESULT CSetPgUpdate::OnInitDialog(HWND hDlg, bool abInitial)
{
	ConEmuUpdateSettings* p = &gpSet->UpdSet;

	SetDlgItemText(hDlg, tUpdateVerLocation, p->UpdateVerLocation());

	checkDlgButton(hDlg, cbUpdateCheckOnStartup, p->isUpdateCheckOnStartup);
	checkDlgButton(hDlg, cbUpdateCheckHourly, p->isUpdateCheckHourly);
	checkDlgButton(hDlg, cbUpdateConfirmDownload, !p->isUpdateConfirmDownload);
	checkRadioButton(hDlg, rbUpdateStableOnly, rbUpdateLatestAvailable,
		(p->isUpdateUseBuilds==1) ? rbUpdateStableOnly : (p->isUpdateUseBuilds==3) ? rbUpdatePreview : rbUpdateLatestAvailable);

	checkDlgButton(hDlg, cbUpdateInetTool, p->isUpdateInetTool);
	SetDlgItemText(hDlg, tUpdateInetTool, p->GetUpdateInetToolCmd());

	checkDlgButton(hDlg, cbUpdateUseProxy, p->isUpdateUseProxy);
	SetDlgItemText(hDlg, tUpdateProxy, p->szUpdateProxy);
	SetDlgItemText(hDlg, tUpdateProxyUser, p->szUpdateProxyUser);
	SetDlgItemText(hDlg, tUpdateProxyPassword, p->szUpdateProxyPassword);

	OnButtonClicked(hDlg, NULL, cbUpdateInetTool); // Enable/Disable command field, button '...' and ‘Proxy’ fields

	int nPackage = p->UpdateDownloadSetup(); // 1-exe, 2-7zip
	checkRadioButton(hDlg, rbUpdateUseExe, rbUpdateUseArc, (nPackage==1) ? rbUpdateUseExe : rbUpdateUseArc);
	wchar_t szCPU[4] = L"";
	SetDlgItemText(hDlg, tUpdateExeCmdLine, p->UpdateExeCmdLine(szCPU));
	SetDlgItemText(hDlg, tUpdateArcCmdLine, p->UpdateArcCmdLine());
	SetDlgItemText(hDlg, tUpdatePostUpdateCmd, p->szUpdatePostUpdateCmd);
	enableDlgItem(hDlg, (nPackage==1) ? tUpdateArcCmdLine : tUpdateExeCmdLine, FALSE);
	// Show used or preferred installer bitness
	CEStr szFormat, szTitle; INT_PTR iLen;
	if ((iLen = GetString(hDlg, rbUpdateUseExe, &szFormat.ms_Val)) > 0)
	{
		if (wcsstr(szFormat.ms_Val, L"%s") != NULL)
		{
			wchar_t* psz = szTitle.GetBuffer(iLen+4);
			if (psz)
			{
				_wsprintf(psz, SKIPLEN(iLen+4) szFormat.ms_Val, (nPackage == 1) ? szCPU : WIN3264TEST(L"x86",L"x64"));
				SetDlgItemText(hDlg, rbUpdateUseExe, szTitle);
			}
		}
	}

	checkDlgButton(hDlg, cbUpdateLeavePackages, p->isUpdateLeavePackages);
	SetDlgItemText(hDlg, tUpdateDownloadPath, p->szUpdateDownloadPath);

	return 0;
}
Exemple #13
0
LRESULT CSetPgDebug::OnInitDialog(HWND hDlg, bool abInitial)
{
	if (abInitial)
	{
		checkDlgButton(hDlg, rbActivityDisabled, BST_CHECKED);

		HWND hList = GetDlgItem(hDlg, lbActivityLog);
		ListView_SetExtendedListViewStyleEx(hList,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT);
		ListView_SetExtendedListViewStyleEx(hList,LVS_EX_LABELTIP|LVS_EX_INFOTIP,LVS_EX_LABELTIP|LVS_EX_INFOTIP);

		LVCOLUMN col = {
			LVCF_WIDTH|LVCF_TEXT|LVCF_FMT, LVCFMT_LEFT,
			gpSetCls->EvalSize(60, esf_Horizontal|esf_CanUseDpi)};
		wchar_t szTitle[4]; col.pszText = szTitle;
		wcscpy_c(szTitle, L" ");		ListView_InsertColumn(hList, 0, &col);

		HWND hTip = ListView_GetToolTips(hList);
		SetWindowPos(hTip, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
	}

	return 0;
}
Exemple #14
0
void CSetPgComspec::ReloadAutorun()
{
	wchar_t *pszCmd = NULL;

	BOOL bForceNewWnd = isChecked(mh_Dlg, cbCmdAutorunNewWnd);

	HKEY hkDir = NULL;
	if (0 == RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Command Processor", 0, KEY_READ, &hkDir))
	{
		pszCmd = LoadAutorunValue(hkDir, false);
		if (pszCmd && *pszCmd)
		{
			bForceNewWnd = (StrStrI(pszCmd, L"/GHWND=NEW") != NULL);
		}
		RegCloseKey(hkDir);
	}

	SetDlgItemText(mh_Dlg, tCmdAutoAttach, pszCmd ? pszCmd : L"");
	checkDlgButton(mh_Dlg, cbCmdAutorunNewWnd, bForceNewWnd);

	SafeFree(pszCmd);
}
Exemple #15
0
void CSetPgApps::DoEnableControls(WORD nGroupCtrlId)
{
	bool bAllowed = false;

	const AppSettings* pApp = NULL;
	int iCur = (int)SendDlgItemMessage(mh_Dlg, lbAppDistinct, LB_GETCURSEL, 0,0);
	if (iCur >= 0)
		pApp = gpSet->GetAppSettings(iCur);
	if (pApp && pApp->AppNames)
	{
		bAllowed = true;
	}

	for (size_t i = 0; i < countof(DistinctControls); i++)
	{
		if (nGroupCtrlId && (nGroupCtrlId != DistinctControls[i].nOverrideID))
			continue;

		bool bEnabled = bAllowed
			? (DistinctControls[i].nOverrideID ? isChecked2(mh_Child, DistinctControls[i].nOverrideID) : true)
			: FALSE;

		HWND hDlgCtrl = DistinctControls[i].nOverrideID ? mh_Child : mh_Dlg;

		if (DistinctControls[i].nOverrideID)
		{
			enableDlgItem(hDlgCtrl, DistinctControls[i].nOverrideID, bAllowed);
			if (!bAllowed)
				checkDlgButton(hDlgCtrl, DistinctControls[i].nOverrideID, BST_UNCHECKED);
		}

		_ASSERTE(DistinctControls[i].nCtrls[countof(DistinctControls[i].nCtrls)-1]==0 && "Overflow check of nCtrls[]")

		CSetDlgLists::EnableDlgItems(hDlgCtrl, DistinctControls[i].nCtrls, countof(DistinctControls[i].nCtrls), bEnabled);
	}

	InvalidateCtrl(mh_Child, FALSE);
}
Exemple #16
0
LRESULT CSetPgSizePos::OnEditChanged(HWND hDlg, WORD nCtrlId)
{
	switch (nCtrlId)
	{
	case tWndX:
	case tWndY:
		if (isChecked(hDlg, rNormal) == BST_CHECKED)
		{
			wchar_t *pVal = GetDlgItemTextPtr(hDlg, nCtrlId);
			bool bValid = (pVal && isDigit(*pVal));
			enableDlgItem(hDlg, cbApplyPos, bValid);
			SafeFree(pVal);
		}
		break; // case tWndX: case tWndY:
	case tWndWidth:
	case tWndHeight:
		if (isChecked(hDlg, rNormal) == BST_CHECKED)
		{
			CESize sz = {0};
			wchar_t *pVal = GetDlgItemTextPtr(hDlg, nCtrlId);
			bool bValid = (pVal && sz.SetFromString(false, pVal));
			enableDlgItem(hDlg, cbApplyPos, bValid);
			SafeFree(pVal);
		}
		break; // case tWndWidth: case tWndHeight:

	case tPadSize:
	{
		BOOL bPadOk = FALSE;
		UINT nNewPad = GetDlgItemInt(hDlg, nCtrlId, &bPadOk, FALSE);

		if (nNewPad >= CENTERCONSOLEPAD_MIN && nNewPad <= CENTERCONSOLEPAD_MAX)
			gpSet->nCenterConsolePad = nNewPad;
		else if (nNewPad > CENTERCONSOLEPAD_MAX)
			SetDlgItemInt(hDlg, nCtrlId, CENTERCONSOLEPAD_MAX, FALSE);
		// Если юзер ставит "бордюр" то нужно сразу включить опцию, чтобы он работал
		if (gpSet->nCenterConsolePad && !isChecked(hDlg, cbTryToCenter))
		{
			gpSet->isTryToCenter = true;
			checkDlgButton(hDlg, cbTryToCenter, BST_CHECKED);
		}
		// Update window/console size
		if (gpSet->isTryToCenter)
			gpConEmu->OnSize();
		break;
	}

	case tLongOutputHeight:
	{
		BOOL lbOk = FALSE;
		wchar_t szTemp[16];
		UINT nNewVal = GetDlgItemInt(hDlg, nCtrlId, &lbOk, FALSE);

		if (lbOk)
		{
			if (nNewVal >= LONGOUTPUTHEIGHT_MIN && nNewVal <= LONGOUTPUTHEIGHT_MAX)
				gpSet->DefaultBufferHeight = nNewVal;
			else if (nNewVal > LONGOUTPUTHEIGHT_MAX)
				SetDlgItemInt(hDlg, nCtrlId, gpSet->DefaultBufferHeight, FALSE);
		}
		else
		{
			SetDlgItemText(hDlg, nCtrlId, _ltow(gpSet->DefaultBufferHeight, szTemp, 10));
		}
		break;
	} //case tLongOutputHeight:

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

	return 0;
}
Exemple #17
0
LRESULT CSetPgAppear::OnInitDialog(HWND hDlg, bool abInitial)
{
	checkDlgButton(hDlg, cbHideCaption, gpSet->isHideCaption);

	checkDlgButton(hDlg, cbHideCaptionAlways, gpSet->isHideCaptionAlways());
	EnableWindow(GetDlgItem(hDlg, cbHideCaptionAlways), !gpSet->isForcedHideCaptionAlways());

	// Скрытие рамки
	SetDlgItemInt(hDlg, tHideCaptionAlwaysFrame, gpSet->HideCaptionAlwaysFrame(), TRUE);
	SetDlgItemInt(hDlg, tHideCaptionAlwaysDelay, gpSet->nHideCaptionAlwaysDelay, FALSE);
	SetDlgItemInt(hDlg, tHideCaptionAlwaysDissapear, gpSet->nHideCaptionAlwaysDisappear, FALSE);

	checkDlgButton(hDlg, cbEnhanceGraphics, gpSet->isEnhanceGraphics);

	//checkDlgButton(hDlg, cbEnhanceButtons, gpSet->isEnhanceButtons);

	//checkDlgButton(hDlg, cbAlwaysShowScrollbar, gpSet->isAlwaysShowScrollbar);
	checkRadioButton(hDlg, rbScrollbarHide, rbScrollbarAuto, (gpSet->isAlwaysShowScrollbar==0) ? rbScrollbarHide : (gpSet->isAlwaysShowScrollbar==1) ? rbScrollbarShow : rbScrollbarAuto);
	checkDlgButton(hDlg, cbScrollbarDynamic, gpSet->isDynamicBufferHeight);
	SetDlgItemInt(hDlg, tScrollAppearDelay, gpSet->nScrollBarAppearDelay, FALSE);
	SetDlgItemInt(hDlg, tScrollDisappearDelay, gpSet->nScrollBarDisappearDelay, FALSE);

	checkDlgButton(hDlg, cbAlwaysOnTop, gpSet->isAlwaysOnTop);

	checkDlgButton(hDlg, cbNumberInCaption, gpSet->isNumberInCaption);

	checkDlgButton(hDlg, cbMultiCon, gpSet->mb_isMulti);
	checkDlgButton(hDlg, cbMultiShowButtons, gpSet->isMultiShowButtons);
	checkDlgButton(hDlg, cbMultiShowSearch, gpSet->isMultiShowSearch);

	checkDlgButton(hDlg, cbSingleInstance, gpSetCls->IsSingleInstanceArg());
	enableDlgItem(hDlg, cbSingleInstance, (gpSet->isQuakeStyle == 0));

	checkDlgButton(hDlg, cbShowHelpTooltips, gpSet->isShowHelpTooltips);

	return 0;
}
Exemple #18
0
LRESULT CSetPgTaskbar::OnInitDialog(HWND hDlg, bool abInitial)
{
	checkDlgButton(hDlg, cbMinToTray, gpSet->mb_MinToTray);
	EnableWindow(GetDlgItem(hDlg, cbMinToTray), !gpConEmu->ForceMinimizeToTray);

	checkDlgButton(hDlg, cbAlwaysShowTrayIcon, gpSet->isAlwaysShowTrayIcon());

	Settings::TabsOnTaskbar tabsOnTaskbar = gpSet->GetRawTabsOnTaskBar();
	checkRadioButton(hDlg, rbTaskbarBtnActive, rbTaskbarBtnHidden,
		(tabsOnTaskbar == Settings::tot_DontShow) ? rbTaskbarBtnHidden :
		(tabsOnTaskbar == Settings::tot_AllTabsWin7) ? rbTaskbarBtnWin7 :
		(tabsOnTaskbar == Settings::tot_AllTabsAllOS) ? rbTaskbarBtnAll
		: rbTaskbarBtnActive);
	checkDlgButton(hDlg, cbTaskbarOverlay, gpSet->isTaskbarOverlay);
	checkDlgButton(hDlg, cbTaskbarProgress, gpSet->isTaskbarProgress);

	//
	checkDlgButton(hDlg, cbCloseConEmuWithLastTab, gpSet->isCloseOnLastTabClose() ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbCloseConEmuOnCrossClicking, gpSet->isCloseOnCrossClick() ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbMinimizeOnLastTabClose, gpSet->isMinOnLastTabClose() ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbHideOnLastTabClose, gpSet->isHideOnLastTabClose() ? BST_CHECKED : BST_UNCHECKED);
	//
	enableDlgItem(hDlg, cbCloseConEmuOnCrossClicking, !gpSet->isCloseOnLastTabClose());
	enableDlgItem(hDlg, cbMinimizeOnLastTabClose, !gpSet->isCloseOnLastTabClose());
	enableDlgItem(hDlg, cbHideOnLastTabClose, !gpSet->isCloseOnLastTabClose() && gpSet->isMinOnLastTabClose());


	checkDlgButton(hDlg, cbMinimizeOnLoseFocus, gpSet->mb_MinimizeOnLoseFocus);
	EnableWindow(GetDlgItem(hDlg, cbMinimizeOnLoseFocus), (gpSet->isQuakeStyle == 0));


	checkRadioButton(hDlg, rbMinByEscAlways, rbMinByEscNever,
		(gpSet->isMultiMinByEsc == Settings::mbe_NoConsoles) ? rbMinByEscEmpty : gpSet->isMultiMinByEsc ? rbMinByEscAlways : rbMinByEscNever);
	checkDlgButton(hDlg, cbMapShiftEscToEsc, gpSet->isMapShiftEscToEsc);
	EnableWindow(GetDlgItem(hDlg, cbMapShiftEscToEsc), (gpSet->isMultiMinByEsc == Settings::mbe_Always));

	checkDlgButton(hDlg, cbCmdTaskbarTasks, gpSet->isStoreTaskbarkTasks);
	checkDlgButton(hDlg, cbCmdTaskbarCommands, gpSet->isStoreTaskbarCommands);
	EnableWindow(GetDlgItem(hDlg, cbCmdTaskbarUpdate), (gnOsVer >= 0x601));

	return 0;
}
Exemple #19
0
LRESULT CSetPgMarkCopy::OnInitDialog(HWND hDlg, bool abInitial)
{
	checkDlgButton(hDlg, cbCTSIntelligent, gpSet->isCTSIntelligent);
	wchar_t* pszExcept = gpSet->GetIntelligentExceptions();
	SetDlgItemText(hDlg, tCTSIntelligentExceptions, pszExcept ? pszExcept : L"");
	SafeFree(pszExcept);

	checkDlgButton(hDlg, cbCTSAutoCopy, gpSet->isCTSAutoCopy);
	checkDlgButton(hDlg, cbCTSResetOnRelease, (gpSet->isCTSResetOnRelease && gpSet->isCTSAutoCopy));
	enableDlgItem(hDlg, cbCTSResetOnRelease, gpSet->isCTSAutoCopy);

	checkDlgButton(hDlg, cbCTSIBeam, gpSet->isCTSIBeam);

	checkDlgButton(hDlg, cbCTSEndOnTyping, (gpSet->isCTSEndOnTyping != 0));
	checkDlgButton(hDlg, cbCTSEndOnKeyPress, (gpSet->isCTSEndOnTyping != 0) && gpSet->isCTSEndOnKeyPress);
	checkDlgButton(hDlg, cbCTSEndCopyBefore, (gpSet->isCTSEndOnTyping == 1));
	checkDlgButton(hDlg, cbCTSEraseBeforeReset, gpSet->isCTSEraseBeforeReset);
	enableDlgItem(hDlg, cbCTSEndOnKeyPress, gpSet->isCTSEndOnTyping!=0);
	enableDlgItem(hDlg, cbCTSEndCopyBefore, gpSet->isCTSEndOnTyping!=0);
	enableDlgItem(hDlg, cbCTSEraseBeforeReset, gpSet->isCTSEndOnTyping!=0);

	checkDlgButton(hDlg, cbCTSFreezeBeforeSelect, gpSet->isCTSFreezeBeforeSelect);
	checkDlgButton(hDlg, cbCTSBlockSelection, gpSet->isCTSSelectBlock);
	UINT VkMod = gpSet->GetHotkeyById(vkCTSVkBlock);
	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbCTSBlockSelection), CSetDlgLists::eKeysAct, VkMod, true);
	checkDlgButton(hDlg, cbCTSTextSelection, gpSet->isCTSSelectText);
	VkMod = gpSet->GetHotkeyById(vkCTSVkText);
	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbCTSTextSelection), CSetDlgLists::eKeysAct, VkMod, true);
	VkMod = gpSet->GetHotkeyById(vkCTSVkAct);

	UINT idxBack = CONBACKCOLOR(gpSet->isCTSColorIndex);
	UINT idxFore = CONFORECOLOR(gpSet->isCTSColorIndex);
	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbCTSForeIdx), CSetDlgLists::eColorIdx16, idxFore, false);
	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbCTSBackIdx), CSetDlgLists::eColorIdx16, idxBack, false);

	if (abInitial)
	{
		mf_MarkCopyPreviewProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, stCTSPreview), GWLP_WNDPROC, (LONG_PTR)MarkCopyPreviewProc);
	}

	checkDlgButton(hDlg, cbCTSDetectLineEnd, gpSet->AppStd.isCTSDetectLineEnd);
	checkDlgButton(hDlg, cbCTSBashMargin, gpSet->AppStd.isCTSBashMargin);
	checkDlgButton(hDlg, cbCTSTrimTrailing, gpSet->AppStd.isCTSTrimTrailing);
	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbCTSEOL), CSetDlgLists::eCRLF, gpSet->AppStd.isCTSEOL, false);

	checkDlgButton(hDlg, cbCTSShiftArrowStartSel, gpSet->AppStd.isCTSShiftArrowStart);

	CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbCopyFormat), CSetDlgLists::eCopyFormat, gpSet->isCTSHtmlFormat, false);

	gpSetCls->CheckSelectionModifiers(hDlg);

	return 0;
}
Exemple #20
0
LRESULT CSetPgFonts::OnInitDialog(HWND hDlg, bool abInitial)
{
	SetDlgItemText(hDlg, tFontFace, gpFontMgr->FontFaceName());
	SetDlgItemText(hDlg, tFontFace2, gpFontMgr->BorderFontFaceName());

	if (abInitial)
	{
		// Добавить шрифты рисованные ConEmu
		for (INT_PTR j = 0; j < gpFontMgr->m_RegFonts.size(); ++j)
		{
			const RegFont* iter = &(gpFontMgr->m_RegFonts[j]);

			if (iter->pCustom)
			{
				BOOL bMono = iter->pCustom->GetFont(0,0,0,0)->IsMonospace();

				int nIdx = SendDlgItemMessage(hDlg, tFontFace, CB_ADDSTRING, 0, (LPARAM)iter->szFontName);
				SendDlgItemMessage(hDlg, tFontFace, CB_SETITEMDATA, nIdx, bMono ? 1 : 0);

				nIdx = SendDlgItemMessage(hDlg, tFontFace2, CB_ADDSTRING, 0, (LPARAM)iter->szFontName);
				SendDlgItemMessage(hDlg, tFontFace2, CB_SETITEMDATA, nIdx, bMono ? 1 : 0);
			}
		}

		CSetDlgFonts::StartEnumFontsThread();

		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tFontSizeY), CSetDlgLists::eFSizesY, gpSet->FontSizeY, true);

		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tFontSizeX), CSetDlgLists::eFSizesX, gpSet->FontSizeX, true);
		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tFontSizeX2), CSetDlgLists::eFSizesX, gpSet->FontSizeX2, true);
		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tFontSizeX3), CSetDlgLists::eFSizesX, gpSet->FontSizeX3, true);

		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbExtendFontBoldIdx), CSetDlgLists::eColorIdx, gpSet->AppStd.nFontBoldColor, false);
		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbExtendFontItalicIdx), CSetDlgLists::eColorIdx, gpSet->AppStd.nFontItalicColor, false);
		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, lbExtendFontNormalIdx), CSetDlgLists::eColorIdx, gpSet->AppStd.nFontNormalColor, false);

		CSetDlgLists::FillListBoxItems(GetDlgItem(hDlg, tFontCharset), CSetDlgLists::eCharSets, gpFontMgr->LogFont.lfCharSet, false);
	}
	else
	{
		//TODO: Обновить значения в списках?
	}

	checkDlgButton(hDlg, cbExtendFonts, gpSet->AppStd.isExtendFonts);
	CSetDlgLists::EnableDlgItems(hDlg, CSetDlgLists::eExtendFonts, gpSet->AppStd.isExtendFonts);

	checkDlgButton(hDlg, cbFontAuto, gpSet->isFontAutoSize);

	MCHKHEAP

	checkRadioButton(hDlg, rNoneAA, rCTAA,
		(gpFontMgr->LogFont.lfQuality == CLEARTYPE_NATURAL_QUALITY) ? rCTAA :
		(gpFontMgr->LogFont.lfQuality == ANTIALIASED_QUALITY) ? rStandardAA : rNoneAA);

	// 3d state - force center symbols in cells
	checkDlgButton(hDlg, cbMonospace, BST(gpSet->isMonospace));

	checkDlgButton(hDlg, cbBold, (gpFontMgr->LogFont.lfWeight == FW_BOLD) ? BST_CHECKED : BST_UNCHECKED);

	checkDlgButton(hDlg, cbItalic, gpFontMgr->LogFont.lfItalic ? BST_CHECKED : BST_UNCHECKED);

	/* Alternative font, initially created for prettifying Far Manager borders */
	{
		checkDlgButton(hDlg, cbFixFarBorders, BST(gpSet->isFixFarBorders));

		checkDlgButton(hDlg, cbFont2AA, gpSet->isAntiAlias2 ? BST_CHECKED : BST_UNCHECKED);

		LPCWSTR cszFontRanges[] = {
			L"Far Manager borders: 2500-25C4;",
			L"Dashes and Borders: 2013-2015;2500-25C4;",
			L"Pseudographics: 2013-25C4;",
			L"CJK: 2E80-9FC3;AC00-D7A3;F900-FAFF;FE30-FE4F;FF01-FF60;FFE0-FFE6;",
			NULL
		};
		CEStr szCharRanges(gpSet->CreateCharRanges(gpSet->mpc_CharAltFontRanges));
		LPCWSTR pszCurrentRange = szCharRanges.ms_Val;
		bool bExist = false;

		HWND hCombo = GetDlgItem(hDlg, tUnicodeRanges);
		SendDlgItemMessage(hDlg, tUnicodeRanges, CB_RESETCONTENT, 0,0);

		// Fill our drop down with font ranges
		for (INT_PTR i = 0; cszFontRanges[i]; i++)
		{
			LPCWSTR pszRange = wcsstr(cszFontRanges[i], L": ");
			if (!pszRange) { _ASSERTE(pszRange); continue; }

			SendMessageW(hCombo, CB_ADDSTRING, 0, (LPARAM)cszFontRanges[i]);

			if (!bExist && (lstrcmpi(pszRange+2, pszCurrentRange) == 0))
			{
				pszCurrentRange = cszFontRanges[i];
				bExist = true;
			}
		}
		if (pszCurrentRange && *pszCurrentRange && !bExist)
			SendMessageW(hCombo, CB_ADDSTRING, 0, (LPARAM)pszCurrentRange);
		// And show current value
		SetWindowText(hCombo, pszCurrentRange ? pszCurrentRange : L"");
	}
	/* Alternative font ends */

	checkDlgButton(hDlg, cbFontMonitorDpi, gpSet->FontUseDpi ? BST_CHECKED : BST_UNCHECKED);
	checkDlgButton(hDlg, cbFontAsDeviceUnits, gpSet->FontUseUnits ? BST_CHECKED : BST_UNCHECKED);

	gpSetCls->mn_LastChangingFontCtrlId = 0;
	return 0;
}
Exemple #21
0
LRESULT CSetPgFeatures::OnInitDialog(HWND hDlg, bool abInitial)
{
	checkDlgButton(hDlg, cbAutoRegFonts, gpSet->isAutoRegisterFonts);

	checkDlgButton(hDlg, cbDebugSteps, gpSet->isDebugSteps);

	checkDlgButton(hDlg, cbDebugLog, gpSet->isLogging());
	UpdateLogLocation();

	checkDlgButton(hDlg, cbMonitorConsoleLang, gpSet->isMonitorConsoleLang ? BST_CHECKED : BST_UNCHECKED);

	checkDlgButton(hDlg, cbSleepInBackground, gpSet->isSleepInBackground);

	checkDlgButton(hDlg, cbRetardInactivePanes, gpSet->isRetardInactivePanes);

	checkDlgButton(hDlg, cbVisible, gpSet->isConVisible);

	checkDlgButton(hDlg, cbUseInjects, gpSet->isUseInjects);

	checkDlgButton(hDlg, cbProcessAnsi, gpSet->isProcessAnsi);

	checkDlgButton(hDlg, cbAnsiLog, gpSet->isAnsiLog);
	SetDlgItemText(hDlg, tAnsiLogPath, gpSet->pszAnsiLog ? gpSet->pszAnsiLog : L"");

	checkDlgButton(hDlg, cbProcessNewConArg, gpSet->isProcessNewConArg);
	checkDlgButton(hDlg, cbProcessCmdStart, gpSet->isProcessCmdStart);
	checkDlgButton(hDlg, cbProcessCtrlZ, gpSet->isProcessCtrlZ);

	checkDlgButton(hDlg, cbSuppressBells, gpSet->isSuppressBells);

	checkDlgButton(hDlg, cbConsoleExceptionHandler, gpSet->isConsoleExceptionHandler);

	checkDlgButton(hDlg, cbUseClink, gpSet->isUseClink() ? BST_CHECKED : BST_UNCHECKED);

	checkDlgButton(hDlg, cbDosBox, gpConEmu->mb_DosBoxExists);
	// изменение пока запрещено
	// или чтобы ругнуться, если DosBox не установлен
	EnableWindow(GetDlgItem(hDlg, cbDosBox), !gpConEmu->mb_DosBoxExists);
	//EnableWindow(GetDlgItem(hDlg, bDosBoxSettings), FALSE); // изменение пока запрещено
	ShowWindow(GetDlgItem(hDlg, bDosBoxSettings), SW_HIDE);

	checkDlgButton(hDlg, cbDisableAllFlashing, gpSet->isDisableAllFlashing);

	checkDlgButton(hDlg, cbFocusInChildWindows, gpSet->isFocusInChildWindows);

	return 0;
}
Exemple #22
0
INT_PTR CSetPgIntegr::PageDlgProc(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam)
{
	static bool bSkipCbSel = FALSE;
	INT_PTR iRc = 0;

	switch (messg)
	{
	case WM_NOTIFY:
		{
			LPNMHDR phdr = (LPNMHDR)lParam;

			if (phdr->code == TTN_GETDISPINFO)
			{
				return gpSetCls->ProcessTipHelp(hDlg, messg, wParam, lParam);
			}

			break;
		}
	case WM_INITDIALOG:
		{
			bSkipCbSel = true;

			PageDlgProc(hDlg, UM_RELOAD_HERE_LIST, UM_RELOAD_HERE_LIST, 0);

			//-- moved to "ComSpec" page
			//PageDlgProc(hDlg, UM_RELOAD_AUTORUN, UM_RELOAD_AUTORUN, 0);

			// Возвращает NULL, если строка пустая
			wchar_t* pszCurInside = GetDlgItemTextPtr(hDlg, cbInsideName);
			_ASSERTE((pszCurInside==NULL) || (*pszCurInside!=0));
			wchar_t* pszCurHere   = GetDlgItemTextPtr(hDlg, cbHereName);
			_ASSERTE((pszCurHere==NULL) || (*pszCurHere!=0));

			wchar_t szIcon[MAX_PATH+32];
			_wsprintf(szIcon, SKIPLEN(countof(szIcon)) L"%s,0", gpConEmu->ms_ConEmuExe);

			if (pszCurInside)
			{
				bSkipCbSel = false;
				PageDlgProc(hDlg, WM_COMMAND, MAKELONG(cbInsideName,CBN_SELCHANGE), 0);
				bSkipCbSel = true;
			}
			else
			{
				SetDlgItemText(hDlg, cbInsideName, L"ConEmu Inside");
				SetDlgItemText(hDlg, tInsideConfig, L"shell");
				SetDlgItemText(hDlg, tInsideShell, CONEMU_HERE_POSH);
				//SetDlgItemText(hDlg, tInsideIcon, szIcon);
				SetDlgItemText(hDlg, tInsideIcon, L"powershell.exe");
				checkDlgButton(hDlg, cbInsideSyncDir, gpConEmu->mp_Inside && gpConEmu->mp_Inside->mb_InsideSynchronizeCurDir);
				SetDlgItemText(hDlg, tInsideSyncDir, L""); // Auto
			}

			if (pszCurHere)
			{
				bSkipCbSel = false;
				PageDlgProc(hDlg, WM_COMMAND, MAKELONG(cbHereName,CBN_SELCHANGE), 0);
				bSkipCbSel = true;
			}
			else
			{
				SetDlgItemText(hDlg, cbHereName, L"ConEmu Here");
				SetDlgItemText(hDlg, tHereConfig, L"");
				SetDlgItemText(hDlg, tHereShell, CONEMU_HERE_CMD);
				SetDlgItemText(hDlg, tHereIcon, szIcon);
			}

			bSkipCbSel = false;

			SafeFree(pszCurInside);
			SafeFree(pszCurHere);

		}
		break; // WM_INITDIALOG

	case WM_COMMAND:
		switch (HIWORD(wParam))
		{
		case BN_CLICKED:
			{
				WORD CB = LOWORD(wParam);

				switch (CB)
				{
				case cbInsideSyncDir:
					if (gpConEmu->mp_Inside)
					{
						gpConEmu->mp_Inside->mb_InsideSynchronizeCurDir = isChecked(hDlg, CB);
					}
					break;
				case bInsideRegister:
				case bInsideUnregister:
					ShellIntegration(hDlg, ShellIntgr_Inside, CB==bInsideRegister);
					PageDlgProc(hDlg, UM_RELOAD_HERE_LIST, UM_RELOAD_HERE_LIST, 0);
					if (CB==bInsideUnregister)
						PageDlgProc(hDlg, WM_COMMAND, MAKELONG(cbInsideName,CBN_SELCHANGE), 0);
					break;
				case bHereRegister:
				case bHereUnregister:
					ShellIntegration(hDlg, ShellIntgr_Here, CB==bHereRegister);
					PageDlgProc(hDlg, UM_RELOAD_HERE_LIST, UM_RELOAD_HERE_LIST, 0);
					if (CB==bHereUnregister)
						PageDlgProc(hDlg, WM_COMMAND, MAKELONG(cbHereName,CBN_SELCHANGE), 0);
					break;
				}
			}
			break; // BN_CLICKED
		case EN_CHANGE:
			{
				WORD EB = LOWORD(wParam);
				switch (EB)
				{
				case tInsideSyncDir:
					if (gpConEmu->mp_Inside)
					{
						SafeFree(gpConEmu->mp_Inside->ms_InsideSynchronizeCurDir);
						gpConEmu->mp_Inside->ms_InsideSynchronizeCurDir = GetDlgItemTextPtr(hDlg, tInsideSyncDir);
					}
					break;
				}
			}
			break; // EN_CHANGE
		case CBN_SELCHANGE:
			{
				WORD CB = LOWORD(wParam);
				switch (CB)
				{
				case cbInsideName:
				case cbHereName:
					if (!bSkipCbSel)
					{
						wchar_t *pszCfg = NULL, *pszIco = NULL, *pszFull = NULL, *pszDirSync = NULL;
						LPCWSTR pszCmd = NULL;
						INT_PTR iSel = SendDlgItemMessage(hDlg, CB, CB_GETCURSEL, 0,0);
						if (iSel >= 0)
						{
							INT_PTR iLen = SendDlgItemMessage(hDlg, CB, CB_GETLBTEXTLEN, iSel, 0);
							size_t cchMax = iLen+128;
							wchar_t* pszName = (wchar_t*)calloc(cchMax,sizeof(*pszName));
							if ((iLen > 0) && pszName)
							{
								_wcscpy_c(pszName, cchMax, L"Directory\\shell\\");
								SendDlgItemMessage(hDlg, CB, CB_GETLBTEXT, iSel, (LPARAM)(pszName+_tcslen(pszName)));

								HKEY hkShell = NULL;
								if (0 == RegOpenKeyEx(HKEY_CLASSES_ROOT, pszName, 0, KEY_READ, &hkShell))
								{
									DWORD nType;
									DWORD nSize = MAX_PATH*2*sizeof(wchar_t);
									pszIco = (wchar_t*)calloc(nSize+2,1);
									if (0 != RegQueryValueEx(hkShell, L"Icon", NULL, &nType, (LPBYTE)pszIco, &nSize) || nType != REG_SZ)
										SafeFree(pszIco);
									HKEY hkCmd = NULL;
									if (0 == RegOpenKeyEx(hkShell, L"command", 0, KEY_READ, &hkCmd))
									{
										DWORD nSize = MAX_PATH*8*sizeof(wchar_t);
										pszFull = (wchar_t*)calloc(nSize+2,1);
										if (0 != RegQueryValueEx(hkCmd, NULL, NULL, &nType, (LPBYTE)pszFull, &nSize) || nType != REG_SZ)
										{
											SafeFree(pszIco);
										}
										else
										{
											LPCWSTR psz = pszFull;
											LPCWSTR pszPrev = pszFull;
											CEStr szArg;
											while (0 == NextArg(&psz, szArg, &pszPrev))
											{
												if (*szArg != L'/')
													continue;

												if ((lstrcmpi(szArg, L"/inside") == 0)
													|| (lstrcmpi(szArg, L"/here") == 0)
													)
												{
													// Nop
												}
												else if (lstrcmpni(szArg, L"/inside=", 8) == 0)
												{
													pszDirSync = lstrdup(szArg+8); // may be empty!
												}
												else if (lstrcmpi(szArg, L"/config") == 0)
												{
													if (0 != NextArg(&psz, szArg))
														break;
													pszCfg = lstrdup(szArg);
												}
												else if (lstrcmpi(szArg, L"/dir") == 0)
												{
													if (0 != NextArg(&psz, szArg))
														break;
													_ASSERTE(lstrcmpi(szArg, L"%1")==0);
												}
												else //if (lstrcmpi(szArg, L"/cmd") == 0)
												{
													if (lstrcmpi(szArg, L"/cmd") == 0)
														pszCmd = psz;
													else
														pszCmd = pszPrev;
													break;
												}
											}
										}
										RegCloseKey(hkCmd);
									}
									RegCloseKey(hkShell);
								}
							}
							SafeFree(pszName);
						}

						SetDlgItemText(hDlg, (CB==cbInsideName) ? tInsideConfig : tHereConfig,
							pszCfg ? pszCfg : L"");
						SetDlgItemText(hDlg, (CB==cbInsideName) ? tInsideShell : tHereShell,
							pszCmd ? pszCmd : L"");
						SetDlgItemText(hDlg, (CB==cbInsideName) ? tInsideIcon : tHereIcon,
							pszIco ? pszIco : L"");

						if (CB==cbInsideName)
						{
							SetDlgItemText(hDlg, tInsideSyncDir, pszDirSync ? pszDirSync : L"");
							checkDlgButton(hDlg, cbInsideSyncDir, (pszDirSync && *pszDirSync) ? BST_CHECKED : BST_UNCHECKED);
						}

						SafeFree(pszCfg);
						SafeFree(pszFull);
						SafeFree(pszIco);
						SafeFree(pszDirSync);
					}
					break;
				}
			}
			break; // CBN_SELCHANGE
		} // switch (HIWORD(wParam))
		break; // WM_COMMAND

	case UM_RELOAD_HERE_LIST:
		if (wParam == UM_RELOAD_HERE_LIST)
		{
			HKEY hkDir = NULL;
			size_t cchCmdMax = 65535;
			wchar_t* pszCmd = (wchar_t*)calloc(cchCmdMax,sizeof(*pszCmd));
			if (!pszCmd)
				break;

			// Возвращает NULL, если строка пустая
			wchar_t* pszCurInside = GetDlgItemTextPtr(hDlg, cbInsideName);
			_ASSERTE((pszCurInside==NULL) || (*pszCurInside!=0));
			wchar_t* pszCurHere   = GetDlgItemTextPtr(hDlg, cbHereName);
			_ASSERTE((pszCurHere==NULL) || (*pszCurHere!=0));

			bool lbOldSkip = bSkipCbSel; bSkipCbSel = true;

			SendDlgItemMessage(hDlg, cbInsideName, CB_RESETCONTENT, 0, 0);
			SendDlgItemMessage(hDlg, cbHereName, CB_RESETCONTENT, 0, 0);

			if (0 == RegOpenKeyEx(HKEY_CLASSES_ROOT, L"Directory\\shell", 0, KEY_READ, &hkDir))
			{
				for (DWORD i = 0; i < 512; i++)
				{
					wchar_t szName[MAX_PATH+32] = {};
					DWORD cchMax = countof(szName) - 32;
					if (0 != RegEnumKeyEx(hkDir, i, szName, &cchMax, NULL, NULL, NULL, NULL))
						break;
					wchar_t* pszSlash = szName + _tcslen(szName);
					wcscat_c(szName, L"\\command");
					HKEY hkCmd = NULL;
					if (0 == RegOpenKeyEx(hkDir, szName, 0, KEY_READ, &hkCmd))
					{
						DWORD cbMax = (cchCmdMax-2) * sizeof(*pszCmd);
						if (0 == RegQueryValueEx(hkCmd, NULL, NULL, NULL, (LPBYTE)pszCmd, &cbMax))
						{
							pszCmd[cbMax>>1] = 0;
							*pszSlash = 0;
							LPCWSTR pszInside = StrStrI(pszCmd, L"/inside");
							LPCWSTR pszConEmu = StrStrI(pszCmd, L"conemu");
							if (pszConEmu)
							{
								SendDlgItemMessage(hDlg,
									pszInside ? cbInsideName : cbHereName,
									CB_ADDSTRING, 0, (LPARAM)szName);
								if ((pszInside ? pszCurInside : pszCurHere) == NULL)
								{
									if (pszInside)
										pszCurInside = lstrdup(szName);
									else
										pszCurHere = lstrdup(szName);
								}
							}
						}
						RegCloseKey(hkCmd);
					}
				}
				RegCloseKey(hkDir);
			}
Exemple #23
0
INT_PTR CSetPgTasks::OnComboBox(HWND hWnd2, WORD nCtrlId, WORD code)
{
	// Other codes are not interesting yet
	if (code != CBN_SELCHANGE)
	{
		return 0;
	}

	switch (nCtrlId)
	{
	case lbCmdTasks:
		{
			if (mb_IgnoreCmdGroupList)
				break;
			MSetter lIgnoreEdit(&mb_IgnoreCmdGroupEdit);

			const CommandTasks* pCmd = NULL;
			int* Items = NULL;
			int iSelCount = GetListboxSelection(hWnd2, lbCmdTasks, Items);
			int iCur = (iSelCount == 1) ? Items[0] : -1;
			if (iCur >= 0)
				pCmd = gpSet->CmdTaskGet(iCur);
			bool lbEnable = false;
			if (pCmd)
			{
				_ASSERTE(pCmd->pszName);
				wchar_t* pszNoBrk = lstrdup(!pCmd->pszName ? L"" : (pCmd->pszName[0] != TaskBracketLeft) ? pCmd->pszName : (pCmd->pszName+1));
				if (*pszNoBrk && (pszNoBrk[_tcslen(pszNoBrk)-1] == TaskBracketRight))
					pszNoBrk[_tcslen(pszNoBrk)-1] = 0;
				SetDlgItemText(hWnd2, tCmdGroupName, pszNoBrk);
				SafeFree(pszNoBrk);

				wchar_t szKey[128] = L"";
				SetDlgItemText(hWnd2, tCmdGroupKey, pCmd->HotKey.GetHotkeyName(szKey));

				SetDlgItemText(hWnd2, tCmdGroupGuiArg, pCmd->pszGuiArgs ? pCmd->pszGuiArgs : L"");
				SetDlgItemText(hWnd2, tCmdGroupCommands, pCmd->pszCommands ? pCmd->pszCommands : L"");

				checkDlgButton(hWnd2, cbCmdGrpDefaultNew, (pCmd->Flags & CETF_NEW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
				checkDlgButton(hWnd2, cbCmdGrpDefaultCmd, (pCmd->Flags & CETF_CMD_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
				checkDlgButton(hWnd2, cbCmdGrpTaskbar, ((pCmd->Flags & CETF_NO_TASKBAR) == CETF_NONE) ? BST_CHECKED : BST_UNCHECKED);
				checkDlgButton(hWnd2, cbCmdGrpToolbar, (pCmd->Flags & CETF_ADD_TOOLBAR) ? BST_CHECKED : BST_UNCHECKED);

				lbEnable = true;
			}
			else
			{
				SetDlgItemText(hWnd2, tCmdGroupName, L"");
				SetDlgItemText(hWnd2, tCmdGroupGuiArg, L"");
				SetDlgItemText(hWnd2, tCmdGroupCommands, L"");
			}
			//for (size_t i = 0; i < countof(SettingsNS::nTaskCtrlId); i++)
			//	EnableWindow(GetDlgItem(hWnd2, SettingsNS::nTaskCtrlId[i]), lbEnable);
			EnableDlgItems(hWnd2, eTaskCtrlId, lbEnable);

			delete[] Items;

			break;
		} // lbCmdTasks:

	#ifdef _DEBUG
	default:
		_ASSERTE(FALSE && "ComboBox was not processed by CSetPgTasks::OnComboBox");
	#endif
	}
	return 0;
}
Exemple #24
0
// IDD_SPG_SIZEPOS / thi_SizePos
LRESULT CSetPgSizePos::OnInitDialog(HWND hDlg, bool abInitial)
{
	_ASSERTE(gpSetCls->GetPage(thi_SizePos) == hDlg);

	checkDlgButton(hDlg, cbAutoSaveSizePos, gpSet->isAutoSaveSizePos);

	checkDlgButton(hDlg, cbUseCurrentSizePos, gpSet->isUseCurrentSizePos);

	ConEmuWindowMode wMode;
	if (gpSet->isQuakeStyle || !gpSet->isUseCurrentSizePos)
		wMode = (ConEmuWindowMode)gpSet->_WindowMode;
	else if (gpConEmu->isFullScreen())
		wMode = wmFullScreen;
	else if (gpConEmu->isZoomed())
		wMode = wmMaximized;
	else
		wMode = wmNormal;
	checkRadioButton(hDlg, rNormal, rFullScreen,
		(wMode == wmFullScreen) ? rFullScreen
		: (wMode == wmMaximized) ? rMaximized
		: rNormal);

	SendDlgItemMessage(hDlg, tWndWidth, EM_SETLIMITTEXT, 6, 0);
	SendDlgItemMessage(hDlg, tWndHeight, EM_SETLIMITTEXT, 6, 0);

	gpSetCls->UpdateSize(gpConEmu->WndWidth, gpConEmu->WndHeight);

	EnableWindow(GetDlgItem(hDlg, cbApplyPos), FALSE);
	SendDlgItemMessage(hDlg, tWndX, EM_SETLIMITTEXT, 6, 0);
	SendDlgItemMessage(hDlg, tWndY, EM_SETLIMITTEXT, 6, 0);
	EnablePosSizeControls(hDlg);
	MCHKHEAP

	gpSetCls->UpdatePos(gpConEmu->wndX, gpConEmu->wndY, true);

	checkRadioButton(hDlg, rCascade, rFixed, gpSet->wndCascade ? rCascade : rFixed);
	if (!abInitial)
		OnPostLocalize(hDlg);

	checkDlgButton(hDlg, cbLongOutput, gpSet->AutoBufferHeight);
	TODO("Надо бы увеличить, но нужно сервер допиливать");
	SendDlgItemMessage(hDlg, tLongOutputHeight, EM_SETLIMITTEXT, 5, 0);
	SetDlgItemInt(hDlg, tLongOutputHeight, gpSet->DefaultBufferHeight, FALSE);
	//EnableWindow(GetDlgItem(hDlg, tLongOutputHeight), gpSet->AutoBufferHeight);


	// 16bit Height
	if (abInitial)
	{
		SendDlgItemMessage(hDlg, lbNtvdmHeight, CB_ADDSTRING, 0, (LPARAM) L"Auto");
		SendDlgItemMessage(hDlg, lbNtvdmHeight, CB_ADDSTRING, 0, (LPARAM) L"25 lines");
		SendDlgItemMessage(hDlg, lbNtvdmHeight, CB_ADDSTRING, 0, (LPARAM) L"28 lines");
		SendDlgItemMessage(hDlg, lbNtvdmHeight, CB_ADDSTRING, 0, (LPARAM) L"43 lines");
		SendDlgItemMessage(hDlg, lbNtvdmHeight, CB_ADDSTRING, 0, (LPARAM) L"50 lines");
	}
	SendDlgItemMessage(hDlg, lbNtvdmHeight, CB_SETCURSEL, !gpSet->ntvdmHeight ? 0 :
	                   ((gpSet->ntvdmHeight == 25) ? 1 : ((gpSet->ntvdmHeight == 28) ? 2 : ((gpSet->ntvdmHeight == 43) ? 3 : 4))), 0); //-V112


	checkDlgButton(hDlg, cbTryToCenter, gpSet->isTryToCenter);
	SetDlgItemInt(hDlg, tPadSize, gpSet->nCenterConsolePad, FALSE);

	checkDlgButton(hDlg, cbIntegralSize, !gpSet->mb_IntegralSize);

	checkDlgButton(hDlg, cbRestore2ActiveMonitor, gpSet->isRestore2ActiveMon);

	checkDlgButton(hDlg, cbSnapToDesktopEdges, gpSet->isSnapToDesktopEdges);

	return 0;
}
Exemple #25
0
void CSetPgApps::DoFillControls(const AppSettings* pApp)
{
	if (!pApp)
	{
		_ASSERTE(pApp);
		return;
	}

	checkRadioButton(mh_Dlg, rbAppDistinctElevatedOn, rbAppDistinctElevatedIgnore,
		(pApp->Elevated == 1) ? rbAppDistinctElevatedOn :
		(pApp->Elevated == 2) ? rbAppDistinctElevatedOff : rbAppDistinctElevatedIgnore);

	BYTE b;

	checkDlgButton(mh_Child, cbExtendFontsOverride, pApp->OverrideExtendFonts);
	checkDlgButton(mh_Child, cbExtendFonts, pApp->isExtendFonts);

	b = pApp->nFontBoldColor;
	CSetDlgLists::FillListBoxItems(GetDlgItem(mh_Child, lbExtendFontBoldIdx), CSetDlgLists::eColorIdx, b, false);
	b = pApp->nFontItalicColor;
	CSetDlgLists::FillListBoxItems(GetDlgItem(mh_Child, lbExtendFontItalicIdx), CSetDlgLists::eColorIdx, b, false);
	b = pApp->nFontNormalColor;
	CSetDlgLists::FillListBoxItems(GetDlgItem(mh_Child, lbExtendFontNormalIdx), CSetDlgLists::eColorIdx, b, false);

	checkDlgButton(mh_Child, cbCursorOverride, pApp->OverrideCursor);
	CSetPgCursor::InitCursorCtrls(mh_Child, pApp);

	checkDlgButton(mh_Child, cbColorsOverride, pApp->OverridePalette);
	// Don't add unknown palettes in the list!
	int nIdx = SendDlgItemMessage(mh_Child, lbColorsOverride, CB_FINDSTRINGEXACT, -1, (LPARAM)pApp->szPaletteName);
	SendDlgItemMessage(mh_Child, lbColorsOverride, CB_SETCURSEL, klMax(nIdx, 0), 0);

	checkDlgButton(mh_Child, cbClipboardOverride, pApp->OverrideClipboard);
	//
	checkDlgButton(mh_Child, cbCTSDetectLineEnd, pApp->isCTSDetectLineEnd);
	checkDlgButton(mh_Child, cbCTSBashMargin, pApp->isCTSBashMargin);
	checkDlgButton(mh_Child, cbCTSTrimTrailing, pApp->isCTSTrimTrailing);
	b = pApp->isCTSEOL;
	CSetDlgLists::FillListBoxItems(GetDlgItem(mh_Child, lbCTSEOL), CSetDlgLists::eCRLF, b, false);

	//
	PasteLinesMode mode;
	mode = pApp->isPasteAllLines;
	checkRadioButton(mh_Child, rPasteM1MultiLine, rPasteM1Nothing,
		(mode == plm_FirstLine) ? rPasteM1FirstLine
		: (mode == plm_SingleLine) ? rPasteM1SingleLine
		: (mode == plm_Nothing) ? rPasteM1Nothing
		: rPasteM1MultiLine);
	checkDlgButton(mh_Child, cbPasteM1Posix, (pApp->isPosixAllLines != pxm_Intact) ? BST_CHECKED : BST_UNCHECKED);
	mode = pApp->isPasteFirstLine;
	checkRadioButton(mh_Child, rPasteM2MultiLine, rPasteM2Nothing,
		(mode == plm_MultiLine) ? rPasteM2MultiLine
		: (mode == plm_FirstLine) ? rPasteM2FirstLine
		: (mode == plm_Nothing) ? rPasteM2Nothing
		: rPasteM2SingleLine);
	checkDlgButton(mh_Child, cbPasteM2Posix, (pApp->isPosixFirstLine != pxm_Intact) ? BST_CHECKED : BST_UNCHECKED);
	//
	checkDlgButton(mh_Child, cbCTSClickPromptPosition, pApp->isCTSClickPromptPosition);
	//
	checkDlgButton(mh_Child, cbCTSDeleteLeftWord, pApp->isCTSDeleteLeftWord);

}