void CXTPSyntaxEditPropertiesPageFont::OnSelEndOkScript() { if (!m_wndComboScript.GetListBox().SelChanged()) return; UpdateData(); int iCurSel = m_wndComboScript.GetCurSel(); if (iCurSel == CB_ERR) return; LOGFONT lf = {0}; if (!GetSafeLogFont(lf)) return; lf.lfCharSet = (BYTE)m_wndComboScript.GetItemData(iCurSel); m_iCharSet = lf.lfCharSet; if (CreateSafeFontIndirect(m_editFont, lf)) { UpdateSampleFont(); SetModified(TRUE); UpdateData(FALSE); } }
long COptionTreeFontSel::OnSelChangeColor(UINT lParam, long wParam) { // Update the sample font UpdateSampleFont(); return TRUE; }
void CXTPSyntaxEditPropertiesPageFont::OnSelChangeComboStyles() { if (!m_wndComboStyle.GetListBox().SelChanged()) return; if (GetLBText(m_wndComboStyle, m_csStyle) == CB_ERR) return; LOGFONT lf = {0}; if (!GetSafeLogFont(lf)) return; CString csBuffer; XTPResourceManager()->LoadString(&csBuffer, XTP_IDS_EDIT_ITALIC); lf.lfItalic = (m_csStyle.Find(csBuffer) == -1)? (BYTE)FALSE: (BYTE)TRUE; XTPResourceManager()->LoadString(&csBuffer, XTP_IDS_EDIT_BOLD); lf.lfWeight = (m_csStyle.Find(csBuffer) == -1)? FW_NORMAL: FW_BOLD; if (CreateSafeFontIndirect(m_editFont, lf)) { UpdateSampleFont(); SetModified(TRUE); } }
void COptionTreeFontSel::OnObjectsChanged() { // Fill font names FillFaceNameList(); // Update sample UpdateSampleFont(); }
void CFontPropPage::OnSelchangeFontstyles() { int nEntry = m_FontStyles.GetCurSel(); m_nCurrentStyle = m_FontStyles.GetItemData(nEntry); m_nActualStyle = m_nCurrentStyle; // Update the sample font UpdateSampleFont(); }
void CFontPropPage::OnSelchangeFontsizes() { int nEntry = m_FontSizes.GetCurSel(); if (nEntry != CB_ERR) { m_FontSizes.GetLBText(nEntry, m_strFontSize); UpdateSampleFont(); } }
void COptionTreeFontSel::OnSelChangeFontStyles() { int nSel = m_ctlFontStyles.GetCurSel(); m_nCurrentStyle = m_ctlFontStyles.GetItemData(nSel); m_nActualStyle = m_nCurrentStyle; // Update the sample font UpdateSampleFont(); }
void COptionTreeFontSel::OnSelChangeFontSizes() { int nSel = m_ctlFontSizes.GetCurSel(); if (nSel != CB_ERR) { m_ctlFontSizes.GetLBText(nSel, m_strFontSize); UpdateSampleFont(); } }
void COptionTreeFontSel::OnUnderline() { if (m_ctlUnderline.GetCheck() == 1) m_bUnderline = TRUE; else m_bUnderline = FALSE; UpdateSampleFont(); }
void COptionTreeFontSel::OnStrikeout() { if (m_ctlStrikeout.GetCheck() == 1) m_bStrikeOut = TRUE; else m_bStrikeOut = FALSE; UpdateSampleFont(); }
void CFontPropPage::OnStrikeout() { CButton* pStrikeOut = (CButton*) GetDlgItem(AFX_IDC_STRIKEOUT); if (pStrikeOut->GetCheck() == 1) m_bStrikeOut = TRUE; else m_bStrikeOut = FALSE; UpdateSampleFont(); }
void CFontPropPage::OnUnderline() { CButton* pUnderline = (CButton*) GetDlgItem(AFX_IDC_UNDERLINE); if (pUnderline->GetCheck() == 1) m_bUnderline = TRUE; else m_bUnderline = FALSE; UpdateSampleFont(); }
void CFontPropPage::SelectFontFromList(CString strFaceName, MERGEOBJECT* pmobj) { // Set the effects buttons CButton* pStrikeOut = (CButton*) GetDlgItem(AFX_IDC_STRIKEOUT); if (!pmobj->bStrikethroughOK) pStrikeOut->SetCheck(2); else if (m_bStrikeOut) pStrikeOut->SetCheck(1); else pStrikeOut->SetCheck(0); CButton* pUnderline = (CButton*) GetDlgItem(AFX_IDC_UNDERLINE); if (!pmobj->bUnderlineOK) pStrikeOut->SetCheck(2); else if (m_bUnderline) pUnderline->SetCheck(1); else pUnderline->SetCheck(0); // Set the font facename if (pmobj->bNameOK) { int nEntry1 = m_FontNames.SelectString(-1, strFaceName); if (nEntry1 == CB_ERR) return; } // Fill the size list appropriately FillSizeList(); // Set the styles combo box selection BOOL bFound = FALSE; int nMaxEntries = m_FontStyles.GetCount(); for (int nEntry3 = 0; nEntry3 < nMaxEntries; nEntry3++) { if (m_FontStyles.GetItemData(nEntry3) == m_nActualStyle) { m_FontStyles.SetCurSel(nEntry3); bFound = TRUE; } } if (pmobj->bSizeOK) { if (!bFound) { m_FontStyles.SetCurSel(0); // Set style to regular m_nCurrentStyle = NTM_REGULAR; } else m_nCurrentStyle = m_nActualStyle; } UpdateSampleFont(); }
void COptionTreeFontSel::OnButtonDefault() { // Select default font SelectCurFont(m_lfDefault); // Select color m_ctlButtonColor.SetColor(m_ctlButtonColor.GetDefaultColor()); // Update sample UpdateSampleFont(); }
void COptionTreeFontSel::OnEditUpdateFontSizes() { // When the users entry matches an entry in the list, select it m_ctlFontSizes.GetWindowText(m_strFontSize); int nEntry = m_ctlFontSizes.FindStringExact(-1, m_strFontSize); if (nEntry != CB_ERR) { m_ctlFontSizes.SetCurSel(nEntry); m_ctlFontSizes.SetEditSel(-1, -1); // -- Update the sample text UpdateSampleFont(); } }
void CFontPropPage::OnEditupdateFontsizes() { // when the users entry matches an entry in the list, select it m_FontSizes.GetWindowText(m_strFontSize); int nEntry = m_FontSizes.FindStringExact(-1, m_strFontSize); if (nEntry != CB_ERR) { m_FontSizes.SetCurSel(nEntry); m_FontSizes.SetEditSel(-1, -1); // Update the sample text UpdateSampleFont(); } }
void CXTPSyntaxEditPropertiesPageFont::OnChkUnderline() { UpdateData(); LOGFONT lf = {0}; if (!GetSafeLogFont(lf)) return; lf.lfUnderline = (BYTE)m_bUnderline; if (CreateSafeFontIndirect(m_editFont, lf)) { UpdateSampleFont(); SetModified(TRUE); } }
BOOL CXTPSyntaxEditPropertiesPageFont::OnInitDialog() { CPropertyPage::OnInitDialog(); // Initialize combo boxes. InitFontCombo(); InitStyleCombo(); InitSizeCombo(); InitScriptCombo(); InitColorComboxes(); UpdateSampleFont(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COptionTreeFontSel::OnEditChangeFontStyles() { // when the users entry matches an entry in the list, select it CString str; m_ctlFontStyles.GetWindowText(str); int nEntry = m_ctlFontStyles.FindStringExact(-1, str); if (nEntry != CB_ERR) { m_ctlFontStyles.SetCurSel(nEntry); m_ctlFontStyles.SetEditSel(-1, -1); // Update the sample text m_nCurrentStyle = m_ctlFontStyles.GetItemData(nEntry); m_nActualStyle = m_nCurrentStyle; UpdateSampleFont(); } }
void CXTPSyntaxEditPropertiesPageFont::OnSelChangeComboSizes() { if (!m_wndComboSize.GetListBox().SelChanged()) return; if (GetLBText(m_wndComboSize, m_csSize) == CB_ERR) return; LOGFONT lf = {0}; if (!GetSafeLogFont(lf)) return; CWindowDC dc(NULL); lf.lfHeight = -MulDiv(_ttoi(m_csSize), ::GetDeviceCaps(dc.m_hDC, LOGPIXELSY), 72); if (CreateSafeFontIndirect(m_editFont, lf)) { UpdateSampleFont(); SetModified(TRUE); } }
void CXTPSyntaxEditPropertiesPageFont::OnSelChangeComboNames() { if (!m_wndComboName.GetListBox().SelChanged()) return; if (GetLBText(m_wndComboName, m_csName) == CB_ERR) return; LOGFONT lf = {0}; if (!GetSafeLogFont(lf)) return; STRCPY_S(lf.lfFaceName, m_csName.GetLength() + 1, m_csName); if (CreateSafeFontIndirect(m_editFont, lf)) { UpdateSampleFont(); InitSizeCombo(); InitScriptCombo(); SetModified(TRUE); } }
void COptionTreeFontSel::OnSelChangeFontScript() { // Update sample UpdateSampleFont(); }
void COptionTreeFontSel::SelectCurFont(LOGFONT lf) { // Declare variables CPaintDC dc(this); int nEntry; BOOL bFound = FALSE; int nMaxEntries; CString strFace; // Validate controls if (ValidateControls() == FALSE) { return; } // Select font name strFace.Format(_T("%s"), lf.lfFaceName); if (m_ctlFontNames.SelectFontName(strFace) == FALSE) { m_ctlFontNames.SetCurSel(0); } // Fill size list for this font name FillSizeStyleList(); // Size m_strFontSize.Format(_T("%d"), abs(MulDiv(lf.lfHeight, 72, dc.GetDeviceCaps(LOGPIXELSY)))); // Underline if (lf.lfUnderline == TRUE) { m_bUnderline = TRUE; } else { m_bUnderline = FALSE; } m_ctlUnderline.SetCheck(m_bUnderline); // Strikeout if (lf.lfStrikeOut == TRUE) { m_bStrikeOut = TRUE; } else { m_bStrikeOut = FALSE; } m_ctlStrikeout.SetCheck(m_bStrikeOut); // Styles if (lf.lfWeight >= FW_BOLD && lf.lfItalic) { m_nActualStyle = NTM_BOLD | NTM_ITALIC; } else if (lf.lfWeight >= FW_BOLD) { m_nActualStyle = NTM_BOLD; } else if (lf.lfItalic) { m_nActualStyle = NTM_ITALIC; } else { m_nActualStyle = NTM_REGULAR; } // Select the size // -- Set the point size if (m_ctlFontSizes.FindString(-1, m_strFontSize) != CB_ERR) { nEntry = m_ctlFontSizes.SelectString(-1, m_strFontSize); if (nEntry == CB_ERR) { return; } } else { // -- -- Point size is not in the list so just fill the edit box // and don't select anything from the list m_ctlFontSizes.SetCurSel(-1); m_ctlFontSizes.SetWindowText(m_strFontSize); } // Set the styles combo box selection bFound = FALSE; nMaxEntries = m_ctlFontStyles.GetCount(); for (int nEntry3 = 0; nEntry3 < nMaxEntries; nEntry3++) { if (m_ctlFontStyles.GetItemData(nEntry3) == m_nActualStyle) { m_ctlFontStyles.SetCurSel(nEntry3); bFound = TRUE; } } if (!bFound) { // -- Set style to regular m_ctlFontStyles.SetCurSel(0); m_nCurrentStyle = NTM_REGULAR; } else { m_nCurrentStyle = m_nActualStyle; } // Update sample UpdateSampleFont(); }
void CFontPropertyPage::FillSizeList() { itemChoice10->Clear(); itemChoice19->Clear(); wxString strFaceName = itemChoice7->GetStringSelection(); int entry; wxArrayInt ttSizes; ttSizes.Add( 8 ); ttSizes.Add( 9 ); ttSizes.Add( 10 ); ttSizes.Add( 11 ); ttSizes.Add( 12 ); ttSizes.Add( 14 ); ttSizes.Add( 16 ); ttSizes.Add( 18 ); ttSizes.Add( 20 ); ttSizes.Add( 22 ); ttSizes.Add( 24 ); ttSizes.Add( 26 ); ttSizes.Add( 28 ); ttSizes.Add( 36 ); ttSizes.Add( 48 ); ttSizes.Add( 72 ); HDC dc = ::GetDC( NULL ); EnumFontFamilies( dc, strFaceName, (FONTENUMPROC) CFontPropertyPage::EnumFontFamiliesCallback2, (LPARAM) this ); ::ReleaseDC( NULL, dc ); if( (int) itemChoice7->GetClientData( itemChoice7->GetSelection() ) != RASTER_FONTTYPE ) { for( unsigned int i = 0; i < ttSizes.GetCount(); i++ ) itemChoice19->AddSize( ttSizes[i], 0 ); } BOOL bRegular = (BOOL)( m_nStyles & NTM_REGULAR ); BOOL bBold = (BOOL)( m_nStyles & NTM_BOLD ); BOOL bItalic = (BOOL)( m_nStyles & NTM_ITALIC ); BOOL bBoldItalic = (BOOL)( ( m_nStyles & NTM_BOLD ) && ( m_nStyles & NTM_ITALIC ) ); if (bRegular) bBold = bItalic = TRUE; if (bBold || bItalic) bBoldItalic = TRUE; if( bRegular ) { entry = itemChoice10->Append( "Regular" ); itemChoice10->SetClientData( entry, (void *) NTM_REGULAR ); } if( bBold ) { entry = itemChoice10->Append( "Bold" ); itemChoice10->SetClientData( entry, (void *) NTM_BOLD ); } if( bItalic ) { entry = itemChoice10->Append( "Italic" ); itemChoice10->SetClientData( entry, (void *) NTM_ITALIC ); } if( bBoldItalic ) { entry = itemChoice10->Append( "Bold Italic" ); itemChoice10->SetClientData( entry, (void *) ( NTM_BOLD | NTM_ITALIC ) ); } int sel = itemChoice19->FindString( m_fontSize ); if( sel != wxNOT_FOUND ) itemChoice19->SetSelection( sel ); else itemChoice19->SetValue( m_fontSize ); bool found = false; for( unsigned int i = 0; i < itemChoice10->GetCount(); i++ ) { if( (DWORD) itemChoice10->GetClientData( i ) == m_nActualStyle ) { itemChoice10->SetSelection( i ); found = true; } } if( !found ) { itemChoice10->SetSelection( 0 ); m_nCurrentStyle = NTM_REGULAR; } else m_nCurrentStyle = m_nActualStyle; if( m_bUnderline ) itemCheckBox1->SetValue( true ); if( m_bStrikethrough ) itemCheckBox2->SetValue( true ); UpdateSampleFont(); }
void COptionTreeFontSel::FillSizeStyleList() { // Declare variables CClientDC dc(NULL); CString strFaceName; int nSel; // Validate controls if (ValidateControls() == FALSE) { return; } // Clear the size list m_ctlFontSizes.ResetContent(); m_ctlFontStyles.ResetContent(); m_nStyles = 0L; // Fill with "real" sizes nSel = m_ctlFontNames.GetCurSel(); if (nSel == CB_ERR) { return; } m_ctlFontNames.GetLBText(nSel, strFaceName); // Enumerate EnumFontFamilies(dc.GetSafeHdc(), (LPCTSTR) strFaceName, (FONTENUMPROC) COptionTreeFontSel::EnumFontFamiliesCallBack2, (LPARAM) this); // Check if we have a font that is either a vector or Truettype font if (m_ctlFontNames.GetFontType() != RASTER_FONTTYPE) { // -- Fill with "common" sizes for (int i = 0; i < _countof(_afxTTDefaults); i++) { m_ctlFontSizes.AddSize(_afxTTDefaults[i], 0); } } // See what fonts are native BOOL bRegular = (BOOL)(m_nStyles & NTM_REGULAR); BOOL bBold = (BOOL)(m_nStyles & NTM_BOLD); BOOL bItalic = (BOOL)(m_nStyles & NTM_ITALIC); BOOL bBoldItalic = (BOOL)((m_nStyles & NTM_BOLD) && (m_nStyles & NTM_ITALIC)); // Allow for "synthesized" italic && bold variants if (bRegular) { bBold = bItalic = TRUE; } if (bBold || bItalic) { bBoldItalic = TRUE; } // Fill the styles list box CString strStyle; int nEntry; if (bRegular) { strStyle.LoadString(AFX_IDS_REGULAR); nEntry = m_ctlFontStyles.AddString(strStyle); m_ctlFontStyles.SetItemData(nEntry, (DWORD)NTM_REGULAR); } if (bBold) { strStyle.LoadString(AFX_IDS_BOLD); nEntry = m_ctlFontStyles.AddString(strStyle); m_ctlFontStyles.SetItemData(nEntry, (DWORD)NTM_BOLD); } if (bItalic) { strStyle.LoadString(AFX_IDS_ITALIC); nEntry = m_ctlFontStyles.AddString(strStyle); m_ctlFontStyles.SetItemData(nEntry, (DWORD)NTM_ITALIC); } if (bBoldItalic) { strStyle.LoadString(AFX_IDS_BOLDITALIC); nEntry = m_ctlFontStyles.AddString(strStyle); m_ctlFontStyles.SetItemData(nEntry, (DWORD)NTM_ITALIC | NTM_BOLD); } // Set the point size if (m_ctlFontSizes.FindString(-1, m_strFontSize) != CB_ERR) { nEntry = m_ctlFontSizes.SelectString(-1, m_strFontSize); if (nEntry == CB_ERR) { return; } } else { // -- Point size is not in the list so just fill the edit box // and don't select anything from the list m_ctlFontSizes.SetCurSel(-1); m_ctlFontSizes.SetWindowText(m_strFontSize); } // Set the styles combo box selection BOOL bFound = FALSE; int nMaxEntries = m_ctlFontStyles.GetCount(); for (int nEntry3 = 0; nEntry3 < nMaxEntries; nEntry3++) { if (m_ctlFontStyles.GetItemData(nEntry3) == m_nActualStyle) { m_ctlFontStyles.SetCurSel(nEntry3); bFound = TRUE; } } if (bFound == FALSE) { // -- Set style to regular m_ctlFontStyles.SetCurSel(0); m_nCurrentStyle = NTM_REGULAR; } else { m_nCurrentStyle = m_nActualStyle; } // Redraw the sample UpdateSampleFont(); }