Ejemplo n.º 1
0
void CFontPropPage::FillFacenameList()
{
	// Clear the list
	m_FontNames.ResetContent();

	// Create a DC to enumerate
	CClientDC dc(NULL);
	EnumFontFamilies(dc.GetSafeHdc(), (LPCTSTR) NULL,
		(FONTENUMPROC)CFontPropPage::EnumFontFamiliesCallBack, (LPARAM) this);

	// Select the first one
	if (m_FontNames.SetCurSel(0) != CB_ERR)
	{
		// Fill the size list
		FillSizeList();
	}
	else
	{
		m_FontNames.EnableWindow(FALSE);
		m_FontSizes.EnableWindow(FALSE);
		m_FontStyles.EnableWindow(FALSE);
		GetDlgItem(AFX_IDC_STRIKEOUT)->EnableWindow(FALSE);
		GetDlgItem(AFX_IDC_UNDERLINE)->EnableWindow(FALSE);
	}
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
void CFontPropertyPage::OnChangeFont(wxCommandEvent &event)
{
    if( !m_dirty )
        m_dirty = true;
    if( event.GetEventObject() == itemChoice7 )
    {
        m_faceName = itemChoice7->GetValue();
        FillSizeList();
    }
    if( event.GetEventObject() == itemChoice10 )
    {
        wxString style = itemChoice10->GetValue();
        if( style == "Bold" || style == "Bold Italic" )
        {
            m_weight = wxFONTWEIGHT_BOLD;
            m_font.MakeBold();
        }
        if( style == "Italic" || style == "Bold Italic" )
        {
            m_style = wxFONTSTYLE_ITALIC;
            m_font.MakeItalic();
        }
        if( style == "Regular" )
        {
            m_weight = wxFONTWEIGHT_NORMAL;
            m_style = wxFONTSTYLE_NORMAL;
            m_font.SetStyle( wxFONTSTYLE_NORMAL );
            m_font.SetWeight( wxFONTWEIGHT_NORMAL );
        }
    }
    if( event.GetEventObject() == itemChoice19 )
    {
        m_ptSize = wxAtoi( itemChoice19->GetValue() );
        m_font.SetPointSize( wxAtoi( itemChoice19->GetValue() ) );
    }
    if( event.GetEventObject() == itemCheckBox1 )
    {
        m_striken = itemCheckBox1->GetValue();
        m_font.SetUnderlined( itemCheckBox1->GetValue() );
    }
    if( event.GetEventObject() == itemCheckBox2 )
    {
        m_underline = itemCheckBox2->GetValue();
        m_font.SetStrikethrough( itemCheckBox2->GetValue() );
    }
    itemWindow24->SetFont( m_font );
    itemWindow24->Refresh();
    GetParent()->FindWindowById( wxID_APPLY )->Enable();
}
Ejemplo n.º 4
0
void CFontPropPage::OnEditupdateFontnames()
{
	// When the users entry matches an entry in the list, select it
	CString str;
	m_FontNames.GetWindowText(str);
	int nEntry = m_FontNames.FindStringExact(-1, str);
	if (nEntry != CB_ERR)
	{
		m_FontNames.SetCurSel(nEntry);
		m_FontNames.SetEditSel(-1, -1);

		// Re-fill the size list
		FillSizeList();
	}
}
Ejemplo n.º 5
0
void CFontPropertyPage::set_properties()
{
    FillFacenameList();
    itemChoice10->AppendString( "Regular" );
    itemChoice10->AppendString( "Italic" );
    itemChoice10->AppendString( "Bold" );
    itemChoice10->AppendString( "Bold Italic" );
    if( m_font.IsOk() )
    {
        int sel = itemChoice7->FindString( m_font.GetFaceName() );
        if( sel != wxNOT_FOUND )
        {
            itemChoice7->SetSelection( sel );
            FillSizeList();
        }
    }
    itemChoice16->SetValue( m_textStr );
    itemChoice17->SetValue( m_backgroundStr );
    if( m_bUnderline )
        itemCheckBox1->Enable( true );
    if( m_bStrikethrough )
        itemCheckBox2->Enable( true );
    if( m_font.IsOk() )
    {
        if( m_font.GetStyle() == wxFONTSTYLE_ITALIC && m_font.GetWeight() == wxFONTWEIGHT_BOLD )
            itemChoice10->SetSelection( itemChoice10->FindString( "Bold Italic" ) );
        else if( m_font.GetStyle() == wxFONTSTYLE_ITALIC )
            itemChoice10->SetSelection( itemChoice10->FindString( "Italic" ) );
        else if( m_font.GetWeight() == wxFONTWEIGHT_BOLD )
            itemChoice10->SetSelection( itemChoice10->FindString( "Bold" ) );
        else
            itemChoice10->SetSelection( itemChoice10->FindString( "Regular" ) );
    }
    else
    {
        itemChoice10->SetSelection( itemChoice10->FindString( "Regular" ) );
        itemChoice19->SetSelection( itemChoice19->FindString( "0" ) );
    }
}
Ejemplo n.º 6
0
void CFontPropPage::OnSelchangeFontnames()
{
	FillSizeList();
}