void CEditReplaceDlg:: OnEditSkip () { if (!UpdateData ()) return; m_ctlFindText.SaveState(_T("Files\\ReplaceInFile")); m_ctlReplText.SaveState(_T("Files\\ReplaceWithInFile")); UpdateLastSearch (); CButton *pSkip = (CButton*) GetDlgItem (IDC_EDIT_SKIP); CButton *pRepl = (CButton*) GetDlgItem (IDC_EDIT_REPLACE); if (!m_bFound) { m_ptFoundAt = m_ptCurrentPos; m_bFound = DoHighlightText ( TRUE ); if (m_bFound) { pSkip->SetButtonStyle (pSkip->GetButtonStyle () & ~BS_DEFPUSHBUTTON); pRepl->SetButtonStyle (pRepl->GetButtonStyle () | BS_DEFPUSHBUTTON); // pRepl->SetFocus (); } else { pRepl->SetButtonStyle (pRepl->GetButtonStyle () & ~BS_DEFPUSHBUTTON); pSkip->SetButtonStyle (pSkip->GetButtonStyle () | BS_DEFPUSHBUTTON); // pSkip->SetFocus (); } return; } if (!m_pBuddy->m_nLastFindWhatLen) if (m_ptFoundAt.y + 1 < m_pBuddy->GetLineCount ()) { m_ptFoundAt.x = 0; m_ptFoundAt.y++; } else { m_bFound = FALSE; return; } else m_ptFoundAt.x += 1; m_bFound = DoHighlightText ( TRUE ); if (m_bFound) { pSkip->SetButtonStyle (pSkip->GetButtonStyle () & ~BS_DEFPUSHBUTTON); pRepl->SetButtonStyle (pRepl->GetButtonStyle () | BS_DEFPUSHBUTTON); // pRepl->SetFocus (); } else { pRepl->SetButtonStyle (pRepl->GetButtonStyle () & ~BS_DEFPUSHBUTTON); pSkip->SetButtonStyle (pSkip->GetButtonStyle () | BS_DEFPUSHBUTTON); // pSkip->SetFocus (); } }
void CUsersDlgGeneral::OnSelchangeGroup() { if (m_cGroup.GetCurSel() <= 0) { m_pUser->group = _T(""); UpdateData(TRUE); m_pOwner->SetCtrlState(); if (m_nMaxUsersBypass == 2) m_nMaxUsersBypass = 0; if (m_nEnabled == 2) m_nEnabled = 1; UpdateData(FALSE); m_cMaxUsersBypass.SetButtonStyle(BS_AUTOCHECKBOX); m_cEnabled.SetButtonStyle(BS_AUTOCHECKBOX); m_pOwner->m_pSpeedLimitPage->UpdateData(TRUE); CButton *pButton = reinterpret_cast<CButton *>(m_pOwner->m_pSpeedLimitPage->GetDlgItem(IDC_USERS_SPEEDLIMIT_SERVERBYPASS_DOWNLOAD)); if (pButton->GetCheck() == 2) pButton->SetCheck(0); pButton->SetButtonStyle(BS_AUTOCHECKBOX); pButton = reinterpret_cast<CButton *>(m_pOwner->m_pSpeedLimitPage->GetDlgItem(IDC_USERS_SPEEDLIMIT_SERVERBYPASS_DOWNLOAD)); if (pButton->GetCheck() == 2) pButton->SetCheck(0); pButton->SetButtonStyle(BS_AUTOCHECKBOX); m_pOwner->m_pSpeedLimitPage->UpdateData(FALSE); } else { m_cGroup.GetLBText(m_cGroup.GetCurSel(), m_pUser->group); m_cMaxUsersBypass.SetButtonStyle(BS_AUTO3STATE); m_cEnabled.SetButtonStyle(BS_AUTO3STATE); ((CButton *)m_pOwner->m_pSpeedLimitPage->GetDlgItem(IDC_USERS_SPEEDLIMIT_SERVERBYPASS_DOWNLOAD))->SetButtonStyle(BS_AUTO3STATE); ((CButton *)m_pOwner->m_pSpeedLimitPage->GetDlgItem(IDC_USERS_SPEEDLIMIT_SERVERBYPASS_UPLOAD))->SetButtonStyle(BS_AUTO3STATE); } }
LRESULT CConfirmDlg::OnInitDialog(HWND hwndFocus, LPARAM lParam) { m_wndDontShowAgain.Attach(GetDlgItem(IDC_DONT_SHOW_AGAIN)); m_wndMessage.Attach(GetDlgItem(IDC_CONFIRM_MESSAGE)); m_wndIcon.Attach(GetDlgItem(IDC_CONFIRM_ICON)); m_wndHidden.Attach(GetDlgItem(IDC_HIDDEN)); HICON hIcon = ::LoadIcon(NULL,IDI_QUESTION); m_wndIcon.SetIcon(hIcon); m_wndMessage.SetWindowText(m_szMessage); SetWindowText(m_szTitle); if (IDYES == m_iDefaultButton || IDNO == m_iDefaultButton) { CButton wnd = GetDlgItem(m_iDefaultButton); wnd.SetButtonStyle(BS_DEFPUSHBUTTON); } m_wndHidden.ShowWindow(SW_HIDE); if (!m_fShowDontShow) { CRect rect, rectDlg; m_wndHidden.GetWindowRect(rect); GetWindowRect(rectDlg); MoveWindow(rectDlg.left,rectDlg.top, rectDlg.Width(), rectDlg.Height() - rect.Height()); } if (m_fDontShow) { INT iCheck = m_fDontShow ? BST_CHECKED : BST_UNCHECKED; m_wndDontShowAgain.SetCheck(iCheck); } CenterWindow(); return 1; }
//----------------------------------------------------------------------------- // Purpose: // Input : *pOnlyFace - //----------------------------------------------------------------------------- void CFaceEditMaterialPage::UpdateDialogData( CMapFace *pOnlyFace ) { BOOL bFirst; int nFaceAlignCount; int nWorldAlignCount; float fshiftX = NOT_INIT; float fshiftY = NOT_INIT; float fscaleX = NOT_INIT; float fscaleY = NOT_INIT; float frotate = NOT_INIT; //float fsmooth = NOT_INIT; int material = NOT_INIT; int nLightmapScale = NOT_INIT; CString strTexture; bFirst = TRUE; nFaceAlignCount = 0; nWorldAlignCount = 0; CFaceEditSheet *pSheet = ( CFaceEditSheet* )GetParent(); int faceCount = pSheet->GetFaceListCount(); for( int i = 0; i < faceCount || pOnlyFace; i++ ) { CMapFace *pFace; if( pOnlyFace ) { pFace = pOnlyFace; } else { pFace = pSheet->GetFaceListDataFace( i ); } TEXTURE &t = pFace->texture; // // Gather statistics about the texture alignment of all the selected faces. // This is used later to set the state of the alignment checkboxes. // int nAlignment = pFace->GetTextureAlignment(); if (nAlignment & TEXTURE_ALIGN_FACE) { nFaceAlignCount++; } if (nAlignment & TEXTURE_ALIGN_WORLD) { nWorldAlignCount++; } // // First update - copy first face's stuff into edit fields. // if (bFirst) { fshiftX = t.UAxis[3]; fshiftY = t.VAxis[3]; fscaleX = t.scale[0]; fscaleY = t.scale[1]; frotate = t.rotate; material = t.material; strTexture = t.texture; nLightmapScale = t.nLightmapScale; // // Get the face's orientation. This is used by Apply to make intelligent decisions. // m_eOrientation = pFace->GetOrientation(); Assert(m_eOrientation != FACE_ORIENTATION_INVALID); // // Set the appropriate checkbox state for the face attributes. // m_FaceContents = t.q2contents; m_FaceSurface = t.q2surface; for (int nItem = 0; nItem < sizeof(FaceAttributes) / sizeof(FaceAttributes[0]); nItem++) { int nSet = ((*FaceAttributes[nItem].puAttribute & FaceAttributes[nItem].uFlag) != 0); CButton *pButton = (CButton *)GetDlgItem(FaceAttributes[nItem].uControlID); if (pButton != NULL) { pButton->SetCheck(nSet); } } bFirst = FALSE; if (pOnlyFace) // use one face - now break { break; } } else { // update fields with face's data if (t.UAxis[3] != fshiftX) { fshiftX = NOT_INIT; } if (t.VAxis[3] != fshiftY) { fshiftY = NOT_INIT; } if (t.scale[0] != fscaleX) { fscaleX = NOT_INIT; } if (t.scale[1] != fscaleY) { fscaleY = NOT_INIT; } if (t.rotate != frotate) { frotate = NOT_INIT; } if (t.material != material) { material = NOT_INIT; } if (t.nLightmapScale != nLightmapScale) { nLightmapScale = NOT_INIT; } if (!strTexture.IsEmpty() && strTexture != t.texture) { strTexture = ""; } // // Update the checkbox state for the face attributes. If any of this face's // attributes are different from the current checkbox state, set the checkbox // to the undefined state. // m_FaceContents = t.q2contents; m_FaceSurface = t.q2surface; for (int nItem = 0; nItem < sizeof(FaceAttributes) / sizeof(FaceAttributes[0]); nItem++) { int nSet = ((*FaceAttributes[nItem].puAttribute & FaceAttributes[nItem].uFlag) != 0); CButton *pButton = (CButton *)GetDlgItem(FaceAttributes[nItem].uControlID); if (pButton != NULL) { if (pButton->GetCheck() != nSet) { pButton->SetButtonStyle(BS_AUTO3STATE); pButton->SetCheck(2); } } } } } // // Set the state of the face alignment checkbox. // CButton *pFaceAlign = (CButton *)GetDlgItem(IDC_ALIGN_FACE); if (nFaceAlignCount == 0) { pFaceAlign->SetCheck(0); } else if (nFaceAlignCount == faceCount) { pFaceAlign->SetCheck(1); } else { pFaceAlign->SetCheck(2); } // // Set the state of the world alignment checkbox. // CButton *pWorldAlign = (CButton *)GetDlgItem(IDC_ALIGN_WORLD); if (nWorldAlignCount == 0) { pWorldAlign->SetCheck(0); } else if (nWorldAlignCount == faceCount) { pWorldAlign->SetCheck(1); } else { pWorldAlign->SetCheck(2); } // // Set up fields. // FloatToSpin(fshiftX, (CSpinButtonCtrl*)GetDlgItem(IDC_SPINSHIFTX), FALSE); FloatToSpin(fshiftY, (CSpinButtonCtrl*)GetDlgItem(IDC_SPINSHIFTY), FALSE); IntegerToSpin(nLightmapScale, (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_LIGHTMAP_SCALE)); FloatToWnd(fscaleX, &m_scaleX); FloatToWnd(fscaleY, &m_scaleY); FloatToSpin(frotate, (CSpinButtonCtrl*)GetDlgItem(IDC_SPINROTATE), TRUE); if (!strTexture.IsEmpty()) { SelectTexture( strTexture ); } else { // make empty m_TextureList.SetCurSel( -1 ); } // // if no faces selected -- get selection from texture bar // if( faceCount == 0 ) { CString strTexName = GetDefaultTextureName(); SelectTexture( strTexName ); } // // Call ctexturebar implementation because OUR implementation sets the // q2 checkboxes, which flashes the screen a bit (cuz we change them // again three lines down.) // UpdateTexture(); // Update the smoothing group data. if ( GetMaterialPageTool() == MATERIALPAGETOOL_SMOOTHING_GROUP ) { m_FaceSmoothDlg.UpdateControls(); } }
void CEditReplaceDlg:: OnEditReplace () { if (!UpdateData ()) return; m_ctlFindText.SaveState(_T("Files\\ReplaceInFile")); m_ctlReplText.SaveState(_T("Files\\ReplaceWithInFile")); UpdateLastSearch (); if (!m_bFound) { m_ptFoundAt = m_ptCurrentPos; m_bFound = DoHighlightText ( TRUE ); CButton *pSkip = (CButton*) GetDlgItem (IDC_EDIT_SKIP); CButton *pRepl = (CButton*) GetDlgItem (IDC_EDIT_REPLACE); if (m_bFound) { pSkip->SetButtonStyle (pSkip->GetButtonStyle () & ~BS_DEFPUSHBUTTON); pRepl->SetButtonStyle (pRepl->GetButtonStyle () | BS_DEFPUSHBUTTON); // pRepl->SetFocus (); } else { pRepl->SetButtonStyle (pRepl->GetButtonStyle () & ~BS_DEFPUSHBUTTON); pSkip->SetButtonStyle (pSkip->GetButtonStyle () | BS_DEFPUSHBUTTON); // pSkip->SetFocus (); } return; } DWORD dwSearchFlags = 0; if (m_bMatchCase) dwSearchFlags |= FIND_MATCH_CASE; if (m_bWholeWord) dwSearchFlags |= FIND_WHOLE_WORD; if (m_bRegExp) dwSearchFlags |= FIND_REGEXP; // We have highlighted text VERIFY (m_pBuddy->ReplaceSelection (m_sNewText, m_sNewText.GetLength(), dwSearchFlags)); // Manually recalculate points if (m_bEnableScopeSelection) { if (m_ptBlockBegin.y == m_ptFoundAt.y && m_ptBlockBegin.x > m_ptFoundAt.x) { m_ptBlockBegin.x -= m_pBuddy->m_nLastFindWhatLen; m_ptBlockBegin.x += m_pBuddy->m_nLastReplaceLen; } if (m_ptBlockEnd.y == m_ptFoundAt.y && m_ptBlockEnd.x > m_ptFoundAt.x) { m_ptBlockEnd.x -= m_pBuddy->m_nLastFindWhatLen; m_ptBlockEnd.x += m_pBuddy->m_nLastReplaceLen; } } if (!m_pBuddy->m_nLastFindWhatLen) if (m_ptFoundAt.y + 1 < m_pBuddy->GetLineCount ()) { m_ptFoundAt.x = 0; m_ptFoundAt.y++; } else { m_bFound = FALSE; return; } else { m_ptFoundAt.x += m_pBuddy->m_nLastReplaceLen; m_ptFoundAt = m_pBuddy->GetCursorPos (); } m_bFound = DoHighlightText ( TRUE ); }