Esempio n. 1
0
void CListOptionCtrl::SetItemFont() 
{
	if(!UpdateData(TRUE))
		return;
	
	int nIndex = m_listBoxEx.GetCurSel();
  	
	COLORREF colorItemText;
	CFont fontItem;
	CFont* pFont=  m_arrFonts[nIndex];
	ASSERT(pFont!=NULL);
	
	
	LOGFONT lf;
	
	CFontDialog dlgFont; 
	dlgFont.m_cf.lpLogFont = &lf;
	

	if(dlgFont.DoModal() == IDOK)
	{
		//VERIFY(fontItem.GetLogFont(&lf));
		colorItemText = dlgFont.GetColor();
	
		if(pFont->m_hObject!=NULL)
			VERIFY(pFont->DeleteObject());
		
		VERIFY(pFont->CreateFontIndirect(&lf));
		VERIFY(m_listBoxEx.SetItemFont(nIndex, pFont));
		VERIFY(m_listBoxEx.SetItemTextColor(nIndex, colorItemText));
	}
}
Esempio n. 2
0
BOOL COXFontPickerButton::OnClicked()
{
    ASSERT(::IsWindow(m_hWnd));

    // Use font common dialog
    CFontDialog* pFontDlg;
    CFont* pFont=GetBuddyFont();
    LOGFONT lf;
    if(pFont==NULL)
    {
        pFontDlg=new CFontDialog();
    }
    else
    {
        pFont->GetLogFont(&lf);
        pFontDlg=new CFontDialog(&lf);
    }

    pFontDlg->m_cf.rgbColors=GetBuddyTextColor();
    if(pFontDlg->DoModal()==IDOK && m_pBuddy!=NULL)
    {
        pFontDlg->GetCurrentFont(&lf);
        SetBuddyLogFont(&lf,FALSE);
        COLORREF clr=pFontDlg->GetColor();
        SetBuddyTextColor(clr,TRUE);
    }

    delete pFontDlg;

    return FALSE;
}
Esempio n. 3
0
void CVisualSynanView::OnFonts() 
{
	CFontDialog dlgFonts;	

	if( dlgFonts.DoModal() != IDOK)
		return;

	LOGFONT lfOldFont;
	LogFontCpy(&lfOldFont, m_LogFontForWords);
	dlgFonts.GetCurrentFont(&m_LogFontForWords);
	CString str = dlgFonts.GetFaceName();
	CClientDC dc(this);
	EnumFontFamiliesEx(dc.m_hDC, &m_LogFontForWords, &TestIfTrueTypeEx,(LPARAM)this,0);
	if( !m_bExistUsefulFont )
	{
		::AfxMessageBox(IDS_NOT_TRUE_TYPE);
		LogFontCpy(&m_LogFontForWords,lfOldFont);
		return;
	}
	if(!(m_LogFontForWords.lfCharSet & RUSSIAN_CHARSET) )
	{
		::AfxMessageBox(IDS_NOT_RUSSIAN_CHARSET);
		LogFontCpy(&m_LogFontForWords,lfOldFont);
		return;
	};

	// m_LogFontForWords has changed!!
	UpdateFontsFromLogFont();

	CClientDC clDC(this);
	Recalculate(clDC);
	Invalidate();
}
LRESULT CMainFrame::OnEditFont(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	HRESULT hr = E_FAIL;
	if (m_view.GetSelection().size() > 0)
	{
		CTextObject* pTextObject = dynamic_cast<CTextObject*>(m_view.GetSelection().front());
		if (pTextObject)
		{
			//LOGFONT		defaultFont = {0};
			//StringCchCopy(defaultFont.lfFaceName, _countof(defaultFont.lfFaceName), TEXT("Times New Roman"));
			//defaultFont.lfHeight = 18;

			//HFONT hDefaultFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
			CFontDialog dlg;
			dlg.DoModal();
			LONG nFontHeight = -MulDiv(dlg.m_cf.lpLogFont->lfHeight, 72, 96);
			pTextObject->GetRichEditPanel()->SetTextFontName(0, 0, dlg.m_cf.lpLogFont->lfFaceName);
			pTextObject->GetRichEditPanel()->SetTextFontSize(0, 0, nFontHeight);
			pTextObject->GetRichEditPanel()->SetTextForeColor(0, 0, dlg.m_cf.rgbColors);
			//COM_VERIFY(pTextObject->GetRichEditPanel()->SetTextFont(0, 0, dlg.m_cf.lpLogFont , 0xFFFFFFFF));

			//COM_VERIFY(pTextObject->GetRichEditPanel()->SetTextForeColor(0, 0, dlg.m_cf.rgbColors));
		}
	}
	return 0;
}
void CStyleDlgFonts::OnButtonFont() 
{
	CFontDialog dlg (m_stcFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
	dlg.m_cf.rgbColors = m_stcFont.GetColor ();

	if (dlg.DoModal () == IDOK)
	{
		m_stcFont.SetPreviewFont (&dlg.m_cf);

		memcpy (&m_pStyle->m_lfTitle[m_RenderType], dlg.m_cf.lpLogFont, sizeof (LOGFONT));
		if (dlg.m_cf.rgbColors)
			m_pStyle->m_crTitle[m_RenderType] = dlg.m_cf.rgbColors;

		CMDIChildWnd* pChild = ((CMDIFrameWnd*) AfxGetMainWnd ())->MDIGetActive ();
		if (pChild != NULL)
		{
			CCdCoverCreator2Doc* pDoc = (CCdCoverCreator2Doc*) pChild->GetActiveDocument ();
			if (pDoc != NULL)
			{
//				pDoc->m_pTracks->SetRTFTitle ("", m_RenderType);
				pDoc->ApplyStyleToRTFTitles (m_pStyle, m_RenderType);
				pDoc->UpdateAllViews (NULL);
				pDoc->CheckPoint ();
			}
		}
	}
}
Esempio n. 6
0
UINT CALLBACK CPPgDisplay::ChooseFontHook(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	UINT uResult;

	// Call MFC's common dialog Hook function
	if (_pfnChooseFontHook != NULL)
		uResult = (*_pfnChooseFontHook)(hdlg, uiMsg, wParam, lParam);
	else
		uResult = 0;

	// Do our own Hook processing
	switch (uiMsg)
	{
	case WM_COMMAND:
		if (LOWORD(wParam) == psh3/*Apply*/ && HIWORD(wParam) == BN_CLICKED)
		{
			LOGFONT lf;
			CFontDialog *pDlg = (CFontDialog *)CWnd::FromHandle(hdlg);
			ASSERT( pDlg != NULL );
			if (pDlg != NULL)
			{
				pDlg->GetCurrentFont(&lf);
				if (_pThis->m_eSelectFont == sfLog)
					theApp.emuledlg->ApplyLogFont(&lf);
				else
					theApp.emuledlg->ApplyHyperTextFont(&lf);
			}
		}
		break;
	}

	// If the hook procedure returns zero, the default dialog box procedure processes the message.
	return uResult;
}
Esempio n. 7
0
void CPropertyDialog::OnButtonfont() 
{
	// TODO: Add your control notification handler code here
	CFontDialog dlg;
	dlg.m_cf.rgbColors=(m_shape->GetClr());
    dlg.m_cf.lpLogFont->lfHeight = m_shape->GetlogFont()->lfHeight;
    dlg.m_cf.lpLogFont->lfWidth   = m_shape->GetlogFont()->lfWidth;
    dlg.m_cf.lpLogFont->lfEscapement = m_shape->GetlogFont()->lfEscapement;
    dlg.m_cf.lpLogFont->lfOrientation = m_shape->GetlogFont()->lfOrientation;
    dlg.m_cf.lpLogFont->lfWeight = m_shape->GetlogFont()->lfWeight;
    dlg.m_cf.lpLogFont->lfItalic = m_shape->GetlogFont()->lfItalic;
    dlg.m_cf.lpLogFont->lfUnderline = m_shape->GetlogFont()->lfUnderline;
    dlg.m_cf.lpLogFont->lfStrikeOut = m_shape->GetlogFont()->lfStrikeOut;
    dlg.m_cf.lpLogFont->lfCharSet = m_shape->GetlogFont()->lfCharSet;
    dlg.m_cf.lpLogFont->lfOutPrecision = m_shape->GetlogFont()->lfOutPrecision;
    dlg.m_cf.lpLogFont->lfClipPrecision = m_shape->GetlogFont()->lfClipPrecision;
    dlg.m_cf.lpLogFont->lfQuality = m_shape->GetlogFont()->lfQuality;
    dlg.m_cf.lpLogFont->lfPitchAndFamily=m_shape->GetlogFont()->lfPitchAndFamily;
    strcpy (dlg.m_cf.lpLogFont->lfFaceName, m_shape->GetlogFont()->lfFaceName);
	if(IDOK==dlg.DoModal())
	{
		if((m_shape->GetFont())->m_hObject)
			(m_shape->GetFont())->DeleteObject();
		(m_shape->GetFont())->CreateFontIndirect(dlg.m_cf.lpLogFont);
        m_shape->SetClr(dlg.m_cf.rgbColors);
		m_shape->SetlogFont(dlg.m_cf.lpLogFont);
		Invalidate();
	}
}
Esempio n. 8
0
void CGraphicView::OnFont() 
{
	CFontDialog dlg;
	if(IDOK==dlg.DoModal())
	{
		if(m_font.m_hObject)
			m_font.DeleteObject();
		m_font.CreateFontIndirect(dlg.m_cf.lpLogFont);
		m_strFontName=dlg.m_cf.lpLogFont->lfFaceName;
		Invalidate();
	}
}
Esempio n. 9
0
void DlgSetPrintStyle::OnButtonSelectFont() 
{
	// TODO: Add your control notification handler code here
	CFontDialog cfd;
	
	cfd.m_cf.Flags |= ( CF_NOSTYLESEL | CF_NOSIZESEL);

	if (cfd.DoModal() == IDOK)
	{
		m_strFont = cfd.GetFaceName();
		m_wndFontName.SetWindowText(m_strFont);
	}
}
Esempio n. 10
0
void CTextView::OnFormatFont()
{
	CFontDialog fd;
	if (IDOK == fd.DoModal())
	{
		if (NULL != font.m_hObject)
		{
			font.DeleteObject();
		}
		font.CreateFontIndirect(&fd.m_lf);
		SetFont(&font, TRUE);
	}
}
Esempio n. 11
0
void CTextPadDlg::OnBnClickedFontsetbtn()
{
	// TODO: Add your control notification handler code here
	CFontDialog dlg;
	
	//CFontDialog로 현재 폰트 변경
	if(dlg.DoModal() == IDOK){
		color = dlg.GetColor();
		dlg.GetCurrentFont(&log);
		font.DeleteObject();
		font.CreateFontIndirect(&log);
		GetDlgItem(IDC_EDIT1)->SetFont(&font);
	}
}
Esempio n. 12
0
void CLabelDlg::OnFont() 
{
	CFontDialog dlg;
	
	if (dlg.DoModal() == IDOK)
	{
		LOGFONT logFont;
		dlg.GetCurrentFont (&logFont);
		m_pLabel->SetFont (&logFont);
		m_pLabel->SetTextColor(dlg.GetColor ());
		OnChanged();
	}
	
}
Esempio n. 13
0
LRESULT CTextView::OnFormatFont(WORD wNotifyCode, WORD wID, HWND hWndCtl)
{
	CFontDialog fd;
	if (IDOK == fd.DoModal())
	{
		if (NULL != font.m_hFont)
		{
			font.DeleteObject();
		}
		font.CreateFontIndirect(&fd.m_lf);
		SetFont(font, TRUE);
	}

	return 0;
}
void COptionPageTextFormat::OnEditorSelectfont()
{
    // select font for editor
    CFontDialog fontdlg;
    LOGFONT tmpFont = m_logfont;

    fontdlg.m_cf.lpLogFont = &tmpFont;
    fontdlg.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT;
    fontdlg.m_cf.Flags &= ~CF_EFFECTS;

    if (fontdlg.DoModal() == IDOK)
        fontdlg.GetCurrentFont(&m_logfont);

    UpdateFontExample();
}
void CSTWTitleFontsPage::OnButtonTitlefontInlaysidefont() 
{
	CFontDialog dlg (m_InlaySideFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
	dlg.m_cf.rgbColors = m_InlaySideFont.GetColor ();

	if (dlg.DoModal () == IDOK)
	{
		m_InlaySideFont.SetPreviewFont (&dlg.m_cf);

		CStyleTemplate* pTmp = ((CStyleTemplateWizard*) GetParent ())->m_pTemplate;
		memcpy (&pTmp->m_lfInlaySide, dlg.m_cf.lpLogFont, sizeof (LOGFONT));
		if (dlg.m_cf.rgbColors)
			pTmp->m_crInlaySide = dlg.m_cf.rgbColors;
		((CStyleTemplateWizard*) GetParent ())->m_wndPreview.InvalidateRect (NULL);
	}
}
void CStyleDlgFonts::OnButtonTrackgroupingremarksFont() 
{
	CFontDialog dlg (m_stcTrkgpRemarks.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
	dlg.m_cf.rgbColors = m_stcTrkgpRemarks.GetColor ();

	if (dlg.DoModal () == IDOK)
	{
		m_stcTrkgpRemarks.SetPreviewFont (&dlg.m_cf);

		memcpy (&m_pStyle->m_lfTrackGroupingRemarks, dlg.m_cf.lpLogFont, sizeof (LOGFONT));
		if (dlg.m_cf.rgbColors)
			m_pStyle->m_crTrackGroupingRemarks = dlg.m_cf.rgbColors;

		UpdateDoc ();
	}
}
void CSTWTrackFontsPage::OnButtonTrackGroupingRemarksfont()
{
    CFontDialog dlg (m_TrackGroupingRemarksFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
    dlg.m_cf.rgbColors = m_TrackGroupingRemarksFont.GetColor ();

    if (dlg.DoModal () == IDOK)
    {
        m_TrackGroupingRemarksFont.SetPreviewFont (&dlg.m_cf);

        CStyleTemplate* pTmp = ((CStyleTemplateWizard*) GetParent ())->m_pTemplate;
        memcpy (&pTmp->m_lfTrackGroupingRemarks, dlg.m_cf.lpLogFont, sizeof (LOGFONT));
        if (dlg.m_cf.rgbColors)
            pTmp->m_crTrackGroupingRemarks = dlg.m_cf.rgbColors;
        ((CStyleTemplateWizard*) GetParent ())->m_wndPreview.InvalidateRect (NULL);
    }
}
Esempio n. 18
0
void mydialog::sfont()
{
    CFontDialog dlg;
    CString str;
    int size;
    long style;

    CFont ff;
    int i=dlg.DoModal();
    if(i==IDCANCEL)
        return;
    str=dlg.GetFaceName();

    size=dlg.GetSize();


    LOGFONT lf;
    lf.lfHeight =dlg.GetSize();

    memset(&lf,0,sizeof lf);


    str=dlg.GetFaceName();
    if(dlg.IsItalic())
        lf.lfItalic =1;

    if(dlg.IsUnderline())
        lf.lfUnderline=1;

    if(dlg.IsBold())
        lf.lfWeight=700;

    if(dlg.IsStrikeOut())
        lf.lfStrikeOut=1;

    lf.lfHeight =size/10+10;


    char s[32]="Arial";
    strcpy(lf.lfFaceName,str);

    ff.CreateFontIndirect(&lf);

    e1.SetWindowText("dfdfsdfsfsd");
    e1.SetFont(&ff);

}
Esempio n. 19
0
//*****************************************************************************************
void CFontItem::OnClickButton (CPoint /*point*/)
{
	CBCGPGridCtrl* pGridCtrl = GetOwnerList();
	ASSERT_VALID (pGridCtrl);

	ASSERT_VALID (this);
	ASSERT_VALID (m_pWndInPlace);
	ASSERT (::IsWindow (m_pWndInPlace->GetSafeHwnd ()));

	m_bButtonIsDown = TRUE;
	Redraw ();

	CFontDialog dlg (&m_lf);

	if (m_Color != (COLORREF)-1)
	{
		dlg.m_cf.rgbColors = m_Color;
	}

	if (dlg.DoModal () == IDOK)
	{
		dlg.GetCurrentFont (&m_lf);
		m_Color = dlg.GetColor ();

		if (m_pWndInPlace != NULL)
		{
			m_pWndInPlace->SetWindowText (FormatProperty ());
		}
		else
		{
			m_varValue = (LPCTSTR) FormatProperty ();
		}
	}

	if (m_pWndInPlace != NULL)
	{
		m_pWndInPlace->SetFocus ();
	}
	else
	{
		pGridCtrl->SetFocus ();
	}

	m_bButtonIsDown = FALSE;
	Redraw ();
}
/////////////////////////////////////
// @mfunc menu handler - display a window font selection dialog and set font attributes for style at caret position
// @rvalue void | not used
//
void CScintillamfcView::OnOptionsSetfont() 
{
	CFontDialog dlg;
	if (dlg.DoModal() == IDOK)
	{
		m_wndScintilla.SetFontname(m_wndScintilla.GetCurrentStyle(), dlg.GetFaceName());
		m_wndScintilla.SetFontheight(m_wndScintilla.GetCurrentStyle(), dlg.GetSize()/10);
		m_wndScintilla.SetBold(m_wndScintilla.GetCurrentStyle(), dlg.IsBold());
		m_wndScintilla.SetItalic(m_wndScintilla.GetCurrentStyle(), dlg.IsItalic());
		m_wndScintilla.SetUnderline(m_wndScintilla.GetCurrentStyle(), dlg.IsUnderline());
	}
}
Esempio n. 21
0
void CfgAppearanceFontDlg::OnCustomFontTextBrowse(void) 
{
    xpr_tchar_t sFont[MAX_FONT_TEXT + 1] = {0};
    GetDlgItemText(IDC_CFG_FONT_CUSTOM_FONT_TEXT, sFont, MAX_FONT_TEXT);

    LOGFONT sLogFont = {0};
    StringToLogFont(sFont, sLogFont);

    CFontDialog sDlg;
    sDlg.m_cf.Flags &= ~CF_EFFECTS;
    sDlg.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT;
    memcpy(sDlg.m_cf.lpLogFont, &sLogFont, sizeof(LOGFONT));
    if (sDlg.DoModal() == IDOK)
    {
        xpr_tchar_t sText[MAX_FONT_TEXT + 1] = {0};
        FontDlgToString(sDlg.GetFaceName(), sDlg.GetSize(), sDlg.GetWeight(), sDlg.IsItalic(), sDlg.IsStrikeOut(), sDlg.IsUnderline(), sText);

        SetDlgItemText(IDC_CFG_FONT_CUSTOM_FONT_TEXT, sText);

        setModified();
    }
}