void CSetPgSizePos::FillSizeControls(HWND hDlg) { { MSetter lIgnoreEdit(&mb_IgnoreEditChanged); SetDlgItemText(hDlg, tWndWidth, gpSet->isUseCurrentSizePos ? gpConEmu->WndWidth.AsString() : gpSet->wndWidth.AsString()); SetDlgItemText(hDlg, tWndHeight, gpSet->isUseCurrentSizePos ? gpConEmu->WndHeight.AsString() : gpSet->wndHeight.AsString()); } // Во избежание недоразумений - запретим элементы размера для Max/Fullscreen bool bNormalChecked = isChecked2(hDlg, rNormal); //for (size_t i = 0; i < countof(SettingsNS::nSizeCtrlId); i++) //{ // EnableWindow(GetDlgItem(hDlg, SettingsNS::nSizeCtrlId[i]), bNormalChecked); //} CSetDlgLists::EnableDlgItems(hDlg, CSetDlgLists::eSizeCtrlId, bNormalChecked); }
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); }
INT_PTR CSetPgApps::OnButtonClicked(HWND hDlg, HWND hBtn, WORD nCtrlId) { // First we process "Main" buttons, controlling application list switch (nCtrlId) { case cbAppDistinctReload: DoReloadApps(); return 0; case cbAppDistinctAdd: DoAppAdd(); return 0; case cbAppDistinctDel: DoAppDel(); return 0; case cbAppDistinctUp: case cbAppDistinctDown: DoAppMove(nCtrlId == cbAppDistinctUp); return 0; } BOOL bChecked; int iCur = mb_SkipSelChange ? -1 : (int)SendDlgItemMessage(hDlg, lbAppDistinct, LB_GETCURSEL, 0,0); AppSettings* pApp = (iCur < 0) ? NULL : gpSet->GetAppSettingsPtr(iCur); _ASSERTE((iCur<0) || (pApp && pApp->AppNames)); if (!pApp) { _ASSERTE(pApp!=NULL); return 0; } switch (nCtrlId) { case rbAppDistinctElevatedOn: case rbAppDistinctElevatedOff: case rbAppDistinctElevatedIgnore: pApp->Elevated = isChecked(hDlg, rbAppDistinctElevatedOn) ? 1 : isChecked(hDlg, rbAppDistinctElevatedOff) ? 2 : 0; mb_Refill = true; mb_Redraw = true; break; case cbColorsOverride: bChecked = isChecked(mh_Child, nCtrlId); DoEnableControls(cbColorsOverride); pApp->OverridePalette = _bool(bChecked); mb_Redraw = true; // Обновить палитры gpSet->PaletteSetStdIndexes(); // Обновить консоли (считаем, что меняется только TextAttr, Popup не трогать gpSetCls->UpdateTextColorSettings(TRUE, FALSE, pApp); break; case cbCursorOverride: bChecked = isChecked(mh_Child, nCtrlId); DoEnableControls(cbCursorOverride); pApp->OverrideCursor = _bool(bChecked); mb_Redraw = true; break; case rCursorH: case rCursorV: case rCursorB: case rCursorR: case cbCursorColor: case cbCursorBlink: case cbCursorIgnoreSize: case cbInactiveCursor: case rInactiveCursorH: case rInactiveCursorV: case rInactiveCursorB: case rInactiveCursorR: case cbInactiveCursorColor: case cbInactiveCursorBlink: case cbInactiveCursorIgnoreSize: OnButtonClicked_Cursor(mh_Child, nCtrlId, isChecked(hDlg, nCtrlId), pApp); mb_Redraw = true; break; case cbExtendFontsOverride: bChecked = isChecked(mh_Child, nCtrlId); DoEnableControls(cbExtendFontsOverride); pApp->OverrideExtendFonts = isChecked2(mh_Child, nCtrlId); mb_Redraw = true; break; case cbExtendFonts: pApp->isExtendFonts = isChecked2(mh_Child, nCtrlId); mb_Redraw = true; break; case cbClipboardOverride: bChecked = isChecked(mh_Child, nCtrlId); DoEnableControls(cbClipboardOverride); pApp->OverrideClipboard = isChecked2(mh_Child, nCtrlId); break; case rPasteM1MultiLine: case rPasteM1FirstLine: case rPasteM1SingleLine: case rPasteM1Nothing: switch (nCtrlId) { case rPasteM1MultiLine: pApp->isPasteAllLines = plm_Default; break; case rPasteM1FirstLine: pApp->isPasteAllLines = plm_FirstLine; break; case rPasteM1SingleLine: pApp->isPasteAllLines = plm_SingleLine; break; case rPasteM1Nothing: pApp->isPasteAllLines = plm_Nothing; break; } break; case cbPasteM1Posix: pApp->isPosixAllLines = isChecked2(mh_Child, nCtrlId) ? pxm_Auto : pxm_Intact; break; case rPasteM2MultiLine: case rPasteM2FirstLine: case rPasteM2SingleLine: case rPasteM2Nothing: switch (nCtrlId) { case rPasteM2MultiLine: gpSet->AppStd.isPasteFirstLine = plm_MultiLine; break; case rPasteM2FirstLine: gpSet->AppStd.isPasteFirstLine = plm_FirstLine; break; case rPasteM2SingleLine: gpSet->AppStd.isPasteFirstLine = plm_Default; break; case rPasteM2Nothing: gpSet->AppStd.isPasteFirstLine = plm_Nothing; break; } break; case cbPasteM2Posix: pApp->isPosixFirstLine = isChecked2(mh_Child, nCtrlId) ? pxm_Auto : pxm_Intact; break; case cbCTSDetectLineEnd: pApp->isCTSDetectLineEnd = isChecked2(mh_Child, nCtrlId); break; case cbCTSBashMargin: pApp->isCTSBashMargin = isChecked2(mh_Child, nCtrlId); break; case cbCTSTrimTrailing: pApp->isCTSTrimTrailing = isChecked(mh_Child, nCtrlId); break; case cbCTSClickPromptPosition: pApp->isCTSClickPromptPosition = isChecked(mh_Child, nCtrlId); break; case cbCTSDeleteLeftWord: pApp->isCTSDeleteLeftWord = isChecked(mh_Child, nCtrlId); break; } return 0; }
INT_PTR CSetPgIntegr::PageDlgProc(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam) { 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: { _ASSERTE(FALSE && "Unexpected, CSetPgIntegr::OnInitDialog must be called instead!"); } 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 = isChecked2(hDlg, CB); } break; case bInsideRegister: case bInsideUnregister: ShellIntegration(hDlg, ShellIntgr_Inside, CB==bInsideRegister); ReloadHereList(); if (CB==bInsideUnregister) FillHereValues(cbInsideName); break; case bHereRegister: case bHereUnregister: ShellIntegration(hDlg, ShellIntgr_Here, CB==bHereRegister); ReloadHereList(); if (CB==bHereUnregister) FillHereValues(cbHereName); 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 (!mb_SkipSelChange) { FillHereValues(CB); } break; } } break; // CBN_SELCHANGE } // switch (HIWORD(wParam)) break; // WM_COMMAND } return iRc; }