Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

View File

@@ -0,0 +1,35 @@
#include "stdafx.h"
#include "About.h"
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_ABOUT_EMAIL, m_ctrlEmail);
//}}AFX_DATA_MAP
}
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString strMailTo = _T("");
strMailTo.LoadString(IDS_MAILTO);
m_ctrlEmail.SetURL(strMailTo);
CenterWindow();
return TRUE;
}

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
#ifndef ABOUT_H
#define ABOUT_H
#include "xhyperlink.h"
#include "resource.h"
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CXHyperLink m_ctrlEmail;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif //ABOUT_H

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// XMonoFontDialogTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,41 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifndef STDAFX_H
#define STDAFX_H
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#if _MSC_VER >= 1400
#ifndef WINVER
#define WINVER 0x0501
#endif
#endif
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#if _MFC_VER > 0x700
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
#endif
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // STDAFX_H

View File

@@ -0,0 +1,78 @@
// XFontSize.cpp Version 1.0
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
//#include "windows.h"
#define XFONTSIZE_CPP
#include "XFontSize.h"
#include "tchar.h"
int CXFontSize::m_cyPixelsPerInch = 0;
//=============================================================================
CXFontSize::CXFontSize()
//=============================================================================
{
Init();
}
//=============================================================================
void CXFontSize::Init()
//=============================================================================
{
if (m_cyPixelsPerInch == 0)
{
HDC hdc = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
if (hdc)
{
m_cyPixelsPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
::DeleteDC(hdc);
}
}
}
//=============================================================================
CXFontSize::~CXFontSize()
//=============================================================================
{
}
//=============================================================================
int CXFontSize::GetFontPointSize(int nHeight)
//=============================================================================
{
Init();
int nPointSize = 0;
if (m_cyPixelsPerInch)
{
nPointSize = MulDiv(nHeight, 72, m_cyPixelsPerInch);
if (nPointSize < 0)
nPointSize = -nPointSize;
}
return nPointSize;
}
//=============================================================================
int CXFontSize::GetFontHeight(int nPointSize)
//=============================================================================
{
Init();
int nHeight = 0;
if (m_cyPixelsPerInch)
{
nHeight = -MulDiv(nPointSize, m_cyPixelsPerInch, 72);
}
return nHeight;
}

View File

@@ -0,0 +1,47 @@
// XFontSize.h Version 1.0
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XFONTSIZE_H
#define XFONTSIZE_H
//=============================================================================
class CXFontSize
//=============================================================================
{
// Construction
public:
CXFontSize();
virtual ~CXFontSize();
void Init();
// Operations
public:
int GetFontPointSize(int nHeight);
int GetFontHeight(int nPointSize);
// Implementation
private:
static int m_cyPixelsPerInch;
};
//=============================================================================
// CXFontSize instance
//
#ifndef XFONTSIZE_CPP
// include an instance in each file; the namespace insures uniqueness
namespace { CXFontSize FontSize; }
#endif
#endif //XFONTSIZE_H

View File

@@ -0,0 +1,629 @@
// XHyperLink.cpp Version 1.0
//
// XHyperLink static control. Will open the default browser with the given URL
// when the user clicks on the link.
//
// Copyright (C) 1997 - 1999 Chris Maunder
// All rights reserved. May not be sold for profit.
//
// Thanks to P<>l K. T<>nder for auto-size and window caption changes.
//
// "GotoURL" function by Stuart Patterson
// As seen in the August, 1997 Windows Developer's Journal.
// Copyright 1997 by Miller Freeman, Inc. All rights reserved.
// Modified by Chris Maunder to use TCHARs instead of chars.
//
// "Default hand cursor" from Paul DiLascia's Jan 1998 MSJ article.
//
// 2/29/00 -- P. Shaffer standard font mod.
//
///////////////////////////////////////////////////////////////////////////////
//
// Modified by: Hans Dietrich
// hdietrich@gmail.com
//
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "XHyperLink.h"
#include "atlconv.h" // for Unicode conversion
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma warning(disable : 4996) // This function or variable may be unsafe
#define TOOLTIP_ID 1
// Uncomment following line to enable error message box for URL navigation
//#define XHYPERLINK_REPORT_ERROR
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649) // From WINUSER.H
#endif
// sends message to parent when hyperlink is clicked (see SetNotifyParent())
UINT WM_XHYPERLINK_CLICKED = ::RegisterWindowMessage(_T("WM_XHYPERLINK_CLICKED"));
///////////////////////////////////////////////////////////////////////////////
// CXHyperLink
BEGIN_MESSAGE_MAP(CXHyperLink, CStatic)
//{{AFX_MSG_MAP(CXHyperLink)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_SETCURSOR()
ON_WM_MOUSEMOVE()
ON_WM_TIMER()
ON_CONTROL_REFLECT(STN_CLICKED, OnClicked)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////////
// ctor
CXHyperLink::CXHyperLink()
{
m_hLinkCursor = NULL; // No cursor as yet
m_crLinkColour = RGB(0,0,238); // Blue
m_crVisitedColour = RGB(85,26,139); // Purple
m_crHoverColour = RGB(255,0,0); // Red
m_bOverControl = FALSE; // Cursor not yet over control
m_bVisited = FALSE; // Hasn't been visited yet.
m_nUnderline = ulHover; // Underline the link?
m_bAdjustToFit = TRUE; // Resize the window to fit the text?
m_strURL = _T("");
m_nTimerID = 100;
m_bNotifyParent = FALSE; // TRUE = notify parent
m_bIsURLEnabled = TRUE; // TRUE = navigate to url
m_bToolTip = TRUE; // TRUE = display tooltip
m_crBackground = (UINT) -1; // set to default (no bg color)
m_bAlwaysOpenNew = FALSE; // TRUE = always open new browser window
}
///////////////////////////////////////////////////////////////////////////////
// dtor
CXHyperLink::~CXHyperLink()
{
TRACE(_T("in CXHyperLink::~CXHyperLink\n"));
if (m_hLinkCursor)
DestroyCursor(m_hLinkCursor);
m_hLinkCursor = NULL;
m_UnderlineFont.DeleteObject();
if (m_Brush.GetSafeHandle())
m_Brush.DeleteObject();
}
/////////////////////////////////////////////////////////////////////////////
// CXHyperLink overrides
///////////////////////////////////////////////////////////////////////////////
// DestroyWindow
BOOL CXHyperLink::DestroyWindow()
{
KillTimer(m_nTimerID);
return CStatic::DestroyWindow();
}
///////////////////////////////////////////////////////////////////////////////
// PreTranslateMessage
BOOL CXHyperLink::PreTranslateMessage(MSG* pMsg)
{
m_ToolTip.RelayEvent(pMsg);
return CStatic::PreTranslateMessage(pMsg);
}
///////////////////////////////////////////////////////////////////////////////
// PreSubclassWindow
void CXHyperLink::PreSubclassWindow()
{
// We want to get mouse clicks via STN_CLICKED
DWORD dwStyle = GetStyle();
::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
// Set the URL as the window text
if (m_strURL.IsEmpty())
GetWindowText(m_strURL);
// Check that the window text isn't empty. If it is, set it as the URL.
CString strWndText;
GetWindowText(strWndText);
if (strWndText.IsEmpty())
{
ASSERT(!m_strURL.IsEmpty()); // Window and URL both NULL. DUH!
SetWindowText(m_strURL);
}
CFont* pFont = GetFont();
if (!pFont)
{
HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
if (hFont == NULL)
hFont = (HFONT) GetStockObject(ANSI_VAR_FONT);
if (hFont)
pFont = CFont::FromHandle(hFont);
}
ASSERT(pFont->GetSafeHandle());
// Create the underline font
LOGFONT lf;
pFont->GetLogFont(&lf);
m_StdFont.CreateFontIndirect(&lf);
lf.lfUnderline = (BYTE) TRUE;
m_UnderlineFont.CreateFontIndirect(&lf);
PositionWindow(); // Adjust size of window to fit URL if necessary
SetDefaultCursor(); // Try and load up a "hand" cursor
SetUnderline();
// Create the tooltip
if (m_bToolTip)
{
CRect rect;
GetClientRect(rect);
m_ToolTip.Create(this);
m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
}
CStatic::PreSubclassWindow();
}
/////////////////////////////////////////////////////////////////////////////
// CXHyperLink message handlers
///////////////////////////////////////////////////////////////////////////////
// OnClicked
void CXHyperLink::OnClicked()
{
m_bOverControl = FALSE;
int result = HINSTANCE_ERROR + 1;
if (m_bIsURLEnabled)
result = (int)(INT_PTR)GotoURL(m_strURL, SW_SHOW, m_bAlwaysOpenNew);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited)
{
MessageBeep(MB_ICONEXCLAMATION); // Unable to follow link
ReportError(result);
}
else
SetVisited(); // Repaint to show visited colour
NotifyParent();
}
///////////////////////////////////////////////////////////////////////////////
// CtlColor
#ifdef _DEBUG
HBRUSH CXHyperLink::CtlColor(CDC* pDC, UINT nCtlColor)
#else
HBRUSH CXHyperLink::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
#endif
{
ASSERT(nCtlColor == CTLCOLOR_STATIC);
if (m_bOverControl)
pDC->SetTextColor(m_crHoverColour);
else if (m_bVisited)
pDC->SetTextColor(m_crVisitedColour);
else
pDC->SetTextColor(m_crLinkColour);
// transparent text.
pDC->SetBkMode(TRANSPARENT);
if (m_Brush.GetSafeHandle())
{
pDC->SetBkColor(m_crBackground);
return (HBRUSH) m_Brush;
}
else
{
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
}
///////////////////////////////////////////////////////////////////////////////
// OnMouseMove
void CXHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
if (!m_bOverControl) // Cursor has just moved over control
{
m_bOverControl = TRUE;
if (m_nUnderline == ulHover)
SetFont(&m_UnderlineFont);
Invalidate();
SetTimer(m_nTimerID, 100, NULL);
}
CStatic::OnMouseMove(nFlags, point);
}
///////////////////////////////////////////////////////////////////////////////
// OnTimer
void CXHyperLink::OnTimer(UINT nIDEvent)
{
CPoint p(GetMessagePos());
ScreenToClient(&p);
CRect rect;
GetClientRect(rect);
if (!rect.PtInRect(p))
{
m_bOverControl = FALSE;
KillTimer(m_nTimerID);
if (m_nUnderline != ulAlways)
SetFont(&m_StdFont);
rect.bottom+=10;
InvalidateRect(rect);
}
CStatic::OnTimer(nIDEvent);
}
///////////////////////////////////////////////////////////////////////////////
// OnSetCursor
BOOL CXHyperLink::OnSetCursor(CWnd* /*pWnd*/, UINT /*nHitTest*/, UINT /*message*/)
{
if (m_hLinkCursor)
{
::SetCursor(m_hLinkCursor);
return TRUE;
}
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////
// OnEraseBkgnd
BOOL CXHyperLink::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);
if (m_crBackground != (UINT)-1)
pDC->FillSolidRect(rect, m_crBackground);
else
pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CXHyperLink operations
///////////////////////////////////////////////////////////////////////////////
// SetURL
void CXHyperLink::SetURL(CString strURL)
{
m_strURL = strURL;
if (::IsWindow(GetSafeHwnd()))
{
PositionWindow();
m_ToolTip.UpdateTipText(strURL, this, TOOLTIP_ID);
}
}
///////////////////////////////////////////////////////////////////////////////
// SetColours
void CXHyperLink::SetColours(COLORREF crLinkColour,
COLORREF crVisitedColour,
COLORREF crHoverColour /* = -1 */)
{
m_crLinkColour = crLinkColour;
m_crVisitedColour = crVisitedColour;
if (crHoverColour == -1)
m_crHoverColour = ::GetSysColor(COLOR_HIGHLIGHT);
else
m_crHoverColour = crHoverColour;
if (::IsWindow(m_hWnd))
Invalidate();
}
///////////////////////////////////////////////////////////////////////////////
// SetBackgroundColour
void CXHyperLink::SetBackgroundColour(COLORREF crBackground)
{
m_crBackground = crBackground;
if (m_Brush.GetSafeHandle())
m_Brush.DeleteObject();
m_Brush.CreateSolidBrush(m_crBackground);
}
///////////////////////////////////////////////////////////////////////////////
// SetVisited
void CXHyperLink::SetVisited(BOOL bVisited /* = TRUE */)
{
m_bVisited = bVisited;
if (::IsWindow(GetSafeHwnd()))
Invalidate();
}
///////////////////////////////////////////////////////////////////////////////
// SetLinkCursor
void CXHyperLink::SetLinkCursor(HCURSOR hCursor)
{
m_hLinkCursor = hCursor;
if (m_hLinkCursor == NULL)
SetDefaultCursor();
}
///////////////////////////////////////////////////////////////////////////////
// SetUnderline
void CXHyperLink::SetUnderline(int nUnderline /*=ulHover*/)
{
if (m_nUnderline == nUnderline)
return;
if (::IsWindow(GetSafeHwnd()))
{
if (nUnderline == ulAlways)
SetFont(&m_UnderlineFont);
else
SetFont(&m_StdFont);
Invalidate();
}
m_nUnderline = nUnderline;
}
///////////////////////////////////////////////////////////////////////////////
// SetAutoSize
void CXHyperLink::SetAutoSize(BOOL bAutoSize /* = TRUE */)
{
m_bAdjustToFit = bAutoSize;
if (::IsWindow(GetSafeHwnd()))
PositionWindow();
}
///////////////////////////////////////////////////////////////////////////////
// SetWindowText
void CXHyperLink::SetWindowText(LPCTSTR lpszString)
{
ASSERT(lpszString);
if (!lpszString)
return;
CStatic::SetWindowText(_T(""));
RedrawWindow();
CStatic::SetWindowText(lpszString);
PositionWindow();
}
///////////////////////////////////////////////////////////////////////////////
// PositionWindow
// Move and resize the window so that the window is the same size
// as the hyperlink text. This stops the hyperlink cursor being active
// when it is not directly over the text. If the text is left justified
// then the window is merely shrunk, but if it is centred or right
// justified then the window will have to be moved as well.
//
// Suggested by P<>l K. T<>nder
//
void CXHyperLink::PositionWindow()
{
if (!::IsWindow(GetSafeHwnd()) || !m_bAdjustToFit)
return;
// Get the current window position
CRect WndRect, ClientRect;
GetWindowRect(WndRect);
GetClientRect(ClientRect);
ClientToScreen(ClientRect);
CWnd* pParent = GetParent();
if (pParent)
{
pParent->ScreenToClient(WndRect);
pParent->ScreenToClient(ClientRect);
}
// Get the size of the window text
CString strWndText;
GetWindowText(strWndText);
CDC* pDC = GetDC();
CFont* pOldFont = pDC->SelectObject(&m_UnderlineFont);
CSize Extent = pDC->GetTextExtent(strWndText);
pDC->SelectObject(pOldFont);
ReleaseDC(pDC);
// Adjust for window borders
Extent.cx += WndRect.Width() - ClientRect.Width();
Extent.cy += WndRect.Height() - ClientRect.Height();
// Get the text justification via the window style
DWORD dwStyle = GetStyle();
// Recalc the window size and position based on the text justification
if (dwStyle & SS_CENTERIMAGE)
WndRect.DeflateRect(0, (WndRect.Height() - Extent.cy)/2);
else
WndRect.bottom = WndRect.top + Extent.cy;
if (dwStyle & SS_CENTER)
WndRect.DeflateRect((WndRect.Width() - Extent.cx)/2, 0);
else if (dwStyle & SS_RIGHT)
WndRect.left = WndRect.right - Extent.cx;
else // SS_LEFT = 0, so we can't test for it explicitly
WndRect.right = WndRect.left + Extent.cx;
// Move the window
SetWindowPos(NULL,
WndRect.left, WndRect.top,
WndRect.Width(), WndRect.Height(),
SWP_NOZORDER);
}
/////////////////////////////////////////////////////////////////////////////
// CXHyperLink implementation
///////////////////////////////////////////////////////////////////////////////
// SetDefaultCursor
void CXHyperLink::SetDefaultCursor()
{
if (m_hLinkCursor == NULL) // No cursor handle - try to load one
{
// First try to load the Win98 / Windows 2000 hand cursor
TRACE(_T("loading from IDC_HAND\n"));
m_hLinkCursor = AfxGetApp()->LoadStandardCursor(IDC_HAND);
if (m_hLinkCursor == NULL) // Still no cursor handle -
// load the WinHelp hand cursor
{
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module.
TRACE(_T("loading from winhlp32\n"));
// Get the windows directory
CString strWndDir;
GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
strWndDir.ReleaseBuffer();
strWndDir += _T("\\winhlp32.exe");
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(strWndDir);
if (hModule)
{
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
FreeLibrary(hModule);
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
// GetRegKey
LONG CXHyperLink::GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if (retval == ERROR_SUCCESS)
{
long datasize = MAX_PATH;
TCHAR data[MAX_PATH];
RegQueryValue(hkey, NULL, data, &datasize);
_tcscpy(retdata, data);
RegCloseKey(hkey);
}
return retval;
}
///////////////////////////////////////////////////////////////////////////////
// ReportError
void CXHyperLink::ReportError(int nError)
{
#ifdef XHYPERLINK_REPORT_ERROR
CString str;
switch (nError)
{
case 0: str = "The operating system is out\nof memory or resources."; break;
case SE_ERR_PNF: str = "The specified path was not found."; break;
case SE_ERR_FNF: str = "The specified file was not found."; break;
case ERROR_BAD_FORMAT: str = "The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."; break;
case SE_ERR_ACCESSDENIED: str = "The operating system denied\naccess to the specified file."; break;
case SE_ERR_ASSOCINCOMPLETE: str = "The filename association is\nincomplete or invalid."; break;
case SE_ERR_DDEBUSY: str = "The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."; break;
case SE_ERR_DDEFAIL: str = "The DDE transaction failed."; break;
case SE_ERR_DDETIMEOUT: str = "The DDE transaction could not\nbe completed because the request timed out."; break;
case SE_ERR_DLLNOTFOUND: str = "The specified dynamic-link library was not found."; break;
case SE_ERR_NOASSOC: str = "There is no application associated\nwith the given filename extension."; break;
case SE_ERR_OOM: str = "There was not enough memory to complete the operation."; break;
case SE_ERR_SHARE: str = "A sharing violation occurred. ";
default: str.Format(_T("Unknown Error (%d) occurred."), nError); break;
}
str = "Unable to open hyperlink:\n\n" + str;
AfxMessageBox(str, MB_ICONEXCLAMATION | MB_OK);
#else
UNUSED_ALWAYS(nError);
#endif // XHYPERLINK_REPORT_ERROR
}
///////////////////////////////////////////////////////////////////////////////
// NotifyParent
void CXHyperLink::NotifyParent()
{
if (m_bNotifyParent)
{
CWnd *pParent = GetParent();
if (pParent && ::IsWindow(pParent->m_hWnd))
{
// wParam will contain control id
pParent->SendMessage(WM_XHYPERLINK_CLICKED, GetDlgCtrlID());
}
}
}
///////////////////////////////////////////////////////////////////////////////
// GotoURL
HINSTANCE CXHyperLink::GotoURL(LPCTSTR url, int showcmd, BOOL bAlwaysOpenNew /*= FALSE*/)
{
// if no url then this is not an internet link
if (!url || url[0] == _T('\0'))
return (HINSTANCE) HINSTANCE_ERROR + 1;
TCHAR key[MAX_PATH*2];
// First try ShellExecute()
TCHAR *verb = _T("open");
if (bAlwaysOpenNew)
verb = _T("new");
HINSTANCE result = ShellExecute(NULL, verb, url, NULL,NULL, showcmd);
// If it failed, get the .htm regkey and lookup the program
if (result <= (HINSTANCE)HINSTANCE_ERROR)
{
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS)
{
_tcscat(key, _T("\\shell\\open\\command"));
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
{
TCHAR *pos;
pos = _tcsstr(key, _T("\"%1\""));
if (pos == NULL)
{ // No quotes found
pos = _tcsstr(key, _T("%1")); // Check for %1, without quotes
if (pos == NULL) // No parameter at all...
pos = key + _tcslen(key)-1;
else
*pos = _T('\0'); // Remove the parameter
}
else
{
*pos = _T('\0'); // Remove the parameter
}
_tcscat(pos, _T(" "));
_tcscat(pos, url);
USES_CONVERSION;
result = (HINSTANCE) (UINT_PTR) WinExec(T2A(key),showcmd);
}
}
}
return result;
}

View File

@@ -0,0 +1,185 @@
// XHyperLink.h Version 1.0
//
// XHyperLink static control. Will open the default browser with the given URL
// when the user clicks on the link.
//
// Copyright Chris Maunder, 1997-1999 (cmaunder@mail.com)
// Feel free to use and distribute. May not be sold for profit.
//
// 2/29/00 -- P. Shaffer standard font mod.
//
///////////////////////////////////////////////////////////////////////////////
//
// Modified by: Hans Dietrich
// hdietrich@gmail.com
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XHYPERLINK_H
#define XHYPERLINK_H
extern UINT WM_XHYPERLINK_CLICKED;
/////////////////////////////////////////////////////////////////////////////
// CXHyperLink window
class CXHyperLink : public CStatic
{
// Construction/destruction
public:
CXHyperLink();
virtual ~CXHyperLink();
public:
enum UnderLineOptions { ulHover = -1, ulNone = 0, ulAlways = 1};
// Attributes
public:
void SetURL(CString strURL);
CString GetURL() const
{
return m_strURL;
}
void EnableURL(BOOL bFlag) { m_bIsURLEnabled = bFlag; }
BOOL IsURLEnabled() const { return m_bIsURLEnabled; }
void SetColours(COLORREF crLinkColour,
COLORREF crVisitedColour,
COLORREF crHoverColour = -1);
COLORREF GetLinkColour() const
{
return m_crLinkColour;
}
COLORREF GetVisitedColour() const
{
return m_crVisitedColour;
}
COLORREF GetHoverColour() const
{
return m_crHoverColour;
}
void SetBackgroundColour(COLORREF crBackground);
COLORREF GetBackgroundColour() const
{
return m_crBackground;
}
void SetVisited(BOOL bVisited = TRUE);
BOOL GetVisited() const
{
return m_bVisited;
}
void SetLinkCursor(HCURSOR hCursor);
HCURSOR CXHyperLink::GetLinkCursor() const
{
return m_hLinkCursor;
}
void SetUnderline(int nUnderline = ulHover);
int GetUnderline() const
{
return m_nUnderline;
}
void SetAutoSize(BOOL bAutoSize = TRUE);
BOOL GetAutoSize() const
{
return m_bAdjustToFit;
}
void SetNotifyParent(BOOL bFlag) { m_bNotifyParent = bFlag; }
BOOL GetNotifyParent() const { return m_bNotifyParent; }
void EnableTooltip(BOOL bFlag)
{
m_bToolTip = bFlag;
m_ToolTip.Activate(m_bToolTip);
}
BOOL IsTooltipEmabled() const
{
return m_bToolTip;
}
void SetAlwaysOpenNew(BOOL bFlag)
{
m_bAlwaysOpenNew = bFlag;
}
BOOL GetAlwaysOpenNew() const
{
return m_bAlwaysOpenNew;
}
void SetWindowText(LPCTSTR lpszString);
// Operations
public:
static HINSTANCE GotoURL(LPCTSTR url, int showcmd, BOOL bAlwaysOpenNew = FALSE);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXHyperLink)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL DestroyWindow();
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
protected:
static LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void NotifyParent();
void PositionWindow();
void ReportError(int nError);
void SetDefaultCursor();
// Protected attributes
protected:
COLORREF m_crLinkColour; // Hyperlink colours
COLORREF m_crVisitedColour;
COLORREF m_crHoverColour; // Hover colour
COLORREF m_crBackground; // background color
CBrush m_Brush; // background brush
BOOL m_bOverControl; // cursor over control?
BOOL m_bVisited; // Has it been visited?
int m_nUnderline; // underline hyperlink?
BOOL m_bAdjustToFit; // Adjust window size to fit text?
CString m_strURL; // hyperlink URL
CFont m_UnderlineFont; // Font for underline display
CFont m_StdFont; // Standard font
HCURSOR m_hLinkCursor; // Cursor for hyperlink
CToolTipCtrl m_ToolTip; // The tooltip
UINT m_nTimerID;
BOOL m_bIsURLEnabled; // TRUE = navigate to url
BOOL m_bNotifyParent; // TRUE = notify parent
BOOL m_bToolTip; // TRUE = display tooltip
BOOL m_bAlwaysOpenNew; // TRUE = always open new browser window
// Generated message map functions
protected:
//{{AFX_MSG(CXHyperLink)
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnClicked();
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif //XHYPERLINK_H

View File

@@ -0,0 +1,424 @@
// XMonoFontDialog.cpp Version 1.1
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// Description:
// XMonoFontDialog.cpp implements CXMonoFontDialog, a class to display
// a customized CFontDialog.
//
// History
// Version 1.1 - 2008 October 29
// - Fixed problem with small point sizes
//
// Version 1.0 - 2008 October 22
// - Initial public release
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "XMonoFontDialog.h"
#include "XMonoFontDialogRes.h"
#include "XFontSize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifndef __noop
#if _MSC_VER < 1300
#define __noop ((void)0)
#endif
#endif
#undef TRACE
#define TRACE __noop
//=============================================================================
// if you want to see the TRACE output, uncomment this line:
//#include "XTrace.h"
//=============================================================================
#pragma warning(disable : 4996) // disable bogus deprecation warning
#define TIMER_FONTLIST_SELCHANGE 1
#define TIMER_FONTSIZES_SELCHANGE 2
#define TIMER_FONTSIZES_UPDATE 3
static int CALLBACK EnumFontFamExProcSizes(const ENUMLOGFONTEX *lpelfe,
const NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam);
IMPLEMENT_DYNAMIC(CXMonoFontDialog, CDialog)
//=============================================================================
BEGIN_MESSAGE_MAP(CXMonoFontDialog, CDialog)
//=============================================================================
//{{AFX_MSG_MAP(CXMonoFontDialog)
ON_WM_CTLCOLOR()
ON_WM_TIMER()
ON_CBN_SELCHANGE(IDC_FONT_LIST, OnSelchangeFontList)
ON_CBN_SELCHANGE(IDC_FONT_SIZE, OnSelchangeFontSize)
ON_CBN_EDITCHANGE(IDC_FONT_SIZE, OnEditchangeFontSize)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//=============================================================================
CXMonoFontDialog::CXMonoFontDialog(LPLOGFONT lplfInitial,
DWORD /*dwFlags*/, // compatibility with CFontDialog
CDC* /*pdcPrinter*/, // compatibility with CFontDialog
CWnd* pParentWnd /*= NULL*/) :
// use string resource name to avoid resource id conflicts
CDialog(_T("IDD_XMONOFONTDIALOG"), pParentWnd)
//CDialog(IDD_XMONOFONTDIALOG, pParentWnd)
//=============================================================================
{
m_strFaceName = _T("");
m_strCaption = _T("Font");
m_strSampleText = _T("AaBbYyZz 0123456789");
m_strMonospacedLabel = _T("MONOSPACED");
m_Height = 0;
m_dwFontFilter = 0;
m_bShowMonospacedLabel = TRUE;
m_bShowMonospacedAsBold = TRUE;
memset(&m_lfInitial, 0, sizeof(LOGFONT));
memset(&m_lfCurrent, 0, sizeof(LOGFONT));
if (lplfInitial)
{
memcpy(&m_lfInitial, lplfInitial, sizeof(LOGFONT));
}
else
{
m_lfInitial.lfCharSet = DEFAULT_CHARSET;
_tcscpy(m_lfInitial.lfFaceName, _T("Courier"));
m_lfInitial.lfHeight = FontSize.GetFontHeight(10);
}
memcpy(&m_lfCurrent, &m_lfInitial, sizeof(LOGFONT));
m_nPointSize = FontSize.GetFontPointSize(m_lfInitial.lfHeight);
m_strFaceName = m_lfInitial.lfFaceName;
}
//=============================================================================
CXMonoFontDialog::~CXMonoFontDialog()
//=============================================================================
{
if (m_SampleFont.GetSafeHandle())
m_SampleFont.DeleteObject();
}
//=============================================================================
void CXMonoFontDialog::DoDataExchange(CDataExchange* pDX)
//=============================================================================
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CXMonoFontDialog)
DDX_Control(pDX, IDC_FONT_SIZE, m_FontSizes);
DDX_Control(pDX, IDC_FONT_SAMPLE, m_Sample);
DDX_Control(pDX, IDC_FONT_MONOSPACED, m_MonospacedLabel);
DDX_Control(pDX, IDC_FONT_LIST, m_FontList);
//}}AFX_DATA_MAP
}
//=============================================================================
BOOL CXMonoFontDialog::OnInitDialog()
//=============================================================================
{
m_FontList.SetFontFilter(m_dwFontFilter)
.SetFont(m_lfInitial)
.ShowMonospacedAsBold(m_bShowMonospacedAsBold);
CDialog::OnInitDialog();
// at this point the font list combo has been filled with font names
m_MonospacedLabel.SetWindowText(m_strMonospacedLabel);
int h = m_FontList.GetItemHeight(0);
m_FontSizes.SetItemHeight(-1, h);
SetWindowText(m_strCaption);
m_Sample.SetWindowText(m_strSampleText);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//=============================================================================
HBRUSH CXMonoFontDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
//=============================================================================
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// set MONOSPACED label to blue
CWnd *pMonoSpaced = GetDlgItem(IDC_FONT_MONOSPACED);
if (pMonoSpaced && pWnd)
{
if (pWnd->m_hWnd == pMonoSpaced->m_hWnd)
pDC->SetTextColor(RGB(0,0,255));
}
return hbr;
}
//=============================================================================
void CXMonoFontDialog::GetCurrentFont(LPLOGFONT lplf)
//=============================================================================
{
ASSERT(lplf);
if (lplf)
memcpy(lplf, &m_lfCurrent, sizeof(LOGFONT));
}
//=============================================================================
// called when user selects size in combo list
void CXMonoFontDialog::OnSelchangeFontSize()
//=============================================================================
{
TRACE(_T("in CXMonoFontDialog::OnSelchangeFontSize\n"));
SetTimer(TIMER_FONTSIZES_SELCHANGE, 50, 0);
}
//=============================================================================
// called when user types in size combo edit box
void CXMonoFontDialog::OnEditchangeFontSize()
//=============================================================================
{
TRACE(_T("in CXMonoFontDialog::OnEditchangeFontSize\n"));
SetTimer(TIMER_FONTSIZES_UPDATE, 50, 0);
}
//=============================================================================
// called when user selects font in combo list
void CXMonoFontDialog::OnSelchangeFontList()
//=============================================================================
{
TRACE(_T("in CXMonoFontDialog::OnSelchangeFontList\n"));
CString s = _T("");
CString strFont = _T("");
int index = m_FontList.GetCurSel();
if (index != CB_ERR)
{
m_FontList.GetLBText(index, strFont);
m_FontList.SetWindowText(strFont);
m_FontSizes.ResetContent();
DWORD dwFlags = m_FontList.GetItemData(index);
if (dwFlags & (XFONT_TRUETYPE | XFONT_OPENTYPE | XFONT_VECTOR))
{
// use standard set of sizes
TRACE(_T("open or true type or vector\n"));
static int nSizes[] = { 8, 9, 10, 11, 12, 14, 16, 18,
20, 22, 24, 26, 28, 36, 48, 72, -1 };
for (int i = 0; nSizes[i] != -1; i++)
{
s.Format(_T("%d"), nSizes[i]);
m_FontSizes.AddString(s);
}
}
else
{
// some other font type - enumerate sizes
m_FontList.GetLBText(index, s);
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfCharSet = DEFAULT_CHARSET;
_tcsncpy(lf.lfFaceName, s, sizeof(lf.lfFaceName)/sizeof(TCHAR)-1);
CClientDC dcClient(this);
TRACE(_T("===== STARTING SIZE ENUMERATION ===========\n"));
EnumFontFamiliesEx(dcClient, &lf,
(FONTENUMPROC) EnumFontFamExProcSizes, (LPARAM)&m_FontSizes, 0);
TRACE(_T("===== ENDING SIZE ENUMERATION ===========\n"));
}
}
// clear size selection
m_FontSizes.SetCurSel(-1);
// set size in combo edit box
s.Format(_T("%d"), m_nPointSize);
m_FontSizes.SetWindowText(s);
// try to select size in combo
index = m_FontSizes.FindStringExact(-1, s);
if (index != CB_ERR)
m_FontSizes.SetCurSel(index);
SetCurFont();
}
//=============================================================================
void CXMonoFontDialog::SetCurFont()
//=============================================================================
{
TRACE(_T("in CXMonoFontDialog::SetCurFont\n"));
int index = m_FontList.GetCurSel();
if (index != CB_ERR)
{
m_dwXFontFlags = m_FontList.GetItemData(index);
m_FontList.GetLBText(index, m_strFaceName);
}
CString s = _T("");
m_FontSizes.GetWindowText(s);
if (s.IsEmpty())
s = _T("10");
int n = _ttoi(s);
if (n > 0)
m_nPointSize = n;
TRACE(_T("SetCurFont: setting font to %s(%d)\n"), m_strFaceName, m_nPointSize);
// set sample font
memset(&m_lfCurrent, 0, sizeof(LOGFONT));
m_lfCurrent.lfHeight = FontSize.GetFontHeight(m_nPointSize);
m_Height = m_lfCurrent.lfHeight;
m_lfCurrent.lfCharSet = DEFAULT_CHARSET;
_tcsncpy(m_lfCurrent.lfFaceName, m_strFaceName,
sizeof(m_lfCurrent.lfFaceName)/sizeof(TCHAR)-1);
DWORD weight = (m_dwXFontFlags & XFONT_WEIGHT_MASK) >> 16;
m_lfCurrent.lfWeight = weight;
m_lfCurrent.lfItalic = (BYTE) (m_dwXFontFlags & XFONT_ITALIC);
if (m_SampleFont.GetSafeHandle())
m_SampleFont.DeleteObject();
m_SampleFont.CreateFontIndirect(&m_lfCurrent);
m_Sample.SetFont(&m_SampleFont);
// show / hide MONOSPACED label
BOOL bIsMonospaced = m_dwXFontFlags & XFONT_MONOSPACED;
m_MonospacedLabel.ShowWindow((bIsMonospaced && m_bShowMonospacedLabel) ?
SW_SHOW : SW_HIDE);
// enable bold typeface in combo list
m_FontList.SetBold(bIsMonospaced && m_bShowMonospacedAsBold);
}
//=============================================================================
void CXMonoFontDialog::OnOK()
//=============================================================================
{
CString s = _T("");
m_FontSizes.GetWindowText(s);
if (s.IsEmpty())
s = _T("10");
m_nPointSize = _ttoi(s);
if (m_nPointSize <= 0)
m_nPointSize = 10;
memset(&m_lfCurrent, 0, sizeof(LOGFONT));
m_lfCurrent.lfHeight = FontSize.GetFontHeight(m_nPointSize);
m_Height = m_lfCurrent.lfHeight;
m_lfCurrent.lfCharSet = DEFAULT_CHARSET;
_tcsncpy(m_lfCurrent.lfFaceName, m_strFaceName,
sizeof(m_lfCurrent.lfFaceName)/sizeof(TCHAR)-1);
DWORD weight = (m_dwXFontFlags & XFONT_WEIGHT_MASK) >> 16;
m_lfCurrent.lfWeight = weight;
m_lfCurrent.lfItalic = (BYTE) (m_dwXFontFlags & XFONT_ITALIC);
CDialog::OnOK();
}
//=============================================================================
void CXMonoFontDialog::OnTimer(UINT nIDEvent)
//=============================================================================
{
KillTimer(nIDEvent);
if (nIDEvent == TIMER_FONTSIZES_SELCHANGE)
{
SetCurFont();
}
else if (nIDEvent == TIMER_FONTSIZES_UPDATE)
{
// user is typing into combo edit box - check if what he has typed
// so far is a valid size, and select it if it is
CString strSize = _T("");
m_FontSizes.GetWindowText(strSize);
int index = m_FontSizes.FindStringExact(-1, strSize);
if (index != CB_ERR)
{
TRACE(_T("found size at %d\n"), index);
m_FontSizes.SetCurSel(index);
}
OnSelchangeFontSize();
}
CDialog::OnTimer(nIDEvent);
}
#pragma warning(push)
#pragma warning(disable: 4100)
//=============================================================================
// This function is the enumeration callback for font sizes.
// Its purpose is to fill the size combo with non-duplicate
// sizes, making sure that they are entered in numerical order.
int CALLBACK EnumFontFamExProcSizes(const ENUMLOGFONTEX *lpelfe,
const NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam)
//=============================================================================
{
// the lParam is a pointer to the size combobox
CComboBox *pCombo = (CComboBox *) lParam;
ASSERT(pCombo);
ASSERT(IsWindow(pCombo->m_hWnd));
int nFontHeight = lpntme->ntmTm.tmHeight - lpntme->ntmTm.tmInternalLeading;
int nPointSize = FontSize.GetFontPointSize(nFontHeight);
TRACE(_T("_____ %s nPointSize=%d FontType=0x%X\n"),
lpelfe->elfLogFont.lfFaceName,
nPointSize,
FontType);
TCHAR szSize[100];
_stprintf(szSize, _T("%d"), nPointSize);
if (pCombo->FindStringExact(-1, szSize) == CB_ERR)
{
// size is not in list
// the sizes are not always enumerated in numerical order,
// so we have to check where to insert this size
// (example: Terminal font)
BOOL bAdded = FALSE;
int n = 0;
int count = pCombo->GetCount();
TCHAR szEntry[100];
for (int i = 0; i < count; i++)
{
szEntry[0] = 0;
pCombo->GetLBText(i, szEntry);
n = _ttoi(szEntry);
if (nPointSize < n)
{
VERIFY(pCombo->InsertString(i, szSize) >= 0);
bAdded = TRUE;
break;
}
}
if (!bAdded)
VERIFY(pCombo->AddString(szSize) >= 0);
}
return TRUE; // continue enumeration
}
#pragma warning(pop)

View File

@@ -0,0 +1,152 @@
// XMonoFontDialog.h Version 1.1
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XMONOFONTDIALOG_H
#define XMONOFONTDIALOG_H
#include "XMonoFontListCombo.h"
//=============================================================================
// font filters
//=============================================================================
#define XFONT_SHOW_SYMBOL 0x01 // show symbol fonts
#define XFONT_SHOW_MONOSPACED 0x02 // show monospaced fonts
#define XFONT_SHOW_BOLD 0x04 // show bold fonts
#define XFONT_SHOW_ITALIC 0x08 // show italic fonts
#define XFONT_SHOW_NORMAL 0x10 // show normal fonts
#define XFONT_SHOW_ALL 0xFF // show all
//=============================================================================
// bit definitions for m_dwXFontFlags
//=============================================================================
#define XFONT_TRUETYPE 0x00000001
#define XFONT_OPENTYPE 0x00000002
#define XFONT_RASTER 0x00000004
#define XFONT_VECTOR 0x00000008
#define XFONT_FAMILY_MASK 0x000000F0
#define XFONT_BOLD 0x00000100
#define XFONT_ITALIC 0x00000200
#define XFONT_SYMBOL 0x00000400
#define XFONT_MONOSPACED 0x00000800
#define XFONT_OEM 0x00001000
#define XFONT_WEIGHT_MASK 0x0FFF0000
//=============================================================================
class CXMonoFontDialog : public CDialog
//=============================================================================
{
DECLARE_DYNAMIC(CXMonoFontDialog)
// Construction
public:
CXMonoFontDialog(LPLOGFONT lplfInitial = NULL,
DWORD dwFlags = 0,
CDC *pdcPrinter = NULL,
CWnd *pParentWnd = NULL);
virtual ~CXMonoFontDialog();
// Dialog Data
//{{AFX_DATA(CXMonoFontDialog)
CXMonoFontListCombo m_FontList;
CComboBox m_FontSizes;
CStatic m_Sample;
CStatic m_MonospacedLabel;
//}}AFX_DATA
// Attributes
public:
// CFontDialog
COLORREF GetColor() const { return RGB(0,0,0); }
void GetCurrentFont(LPLOGFONT lplf);
CString GetFaceName() const { return m_strFaceName; }
int GetSize() const { return 10*m_nPointSize; }
CString GetStyleName() const { return _T(""); }
int GetWeight() const
{ return (m_dwXFontFlags & XFONT_WEIGHT_MASK) >> 16; }
// the following 4 functions report the selection in the style combo,
// which we do not use
BOOL IsBold() const { return FALSE; }
BOOL IsItalic() const { return FALSE; }
BOOL IsStrikeOut() const { return FALSE; }
BOOL IsUnderline() const { return FALSE; }
// CXMonoFontDialog
CString GetCaption() { return m_strCaption; }
DWORD GetFontData() { return m_dwXFontFlags; }
DWORD GetFontFilter() { return m_dwFontFilter; }
CString GetSampleText() { return m_strSampleText; }
LONG GetTmHeight() { return m_Height; }
BOOL IsMonospaced() { return (m_dwXFontFlags & XFONT_MONOSPACED); }
BOOL IsOpenType() { return (m_dwXFontFlags & XFONT_OPENTYPE); }
BOOL IsSymbol() { return (m_dwXFontFlags & XFONT_SYMBOL); }
BOOL IsTrueType() { return (m_dwXFontFlags & XFONT_TRUETYPE); }
BOOL IsVector() { return (m_dwXFontFlags & XFONT_VECTOR); }
CXMonoFontDialog& SetCaption(LPCTSTR strCaption)
{ m_strCaption = strCaption; return *this; }
CXMonoFontDialog& SetFontFilter(DWORD dwFontFilter)
{ m_dwFontFilter = dwFontFilter; return *this; }
CXMonoFontDialog& SetMonospacedLabel(LPCTSTR lpszLabel)
{ m_strMonospacedLabel = lpszLabel; return *this; }
CXMonoFontDialog& SetSampleText(LPCTSTR lpszSampleText)
{ m_strSampleText = lpszSampleText; return *this; }
CXMonoFontDialog& ShowMonospacedLabel(BOOL bShow)
{ m_bShowMonospacedLabel = bShow; return *this; }
CXMonoFontDialog& ShowMonospacedAsBold(BOOL bShow)
{ m_bShowMonospacedAsBold = bShow; return *this; }
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXMonoFontDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
LOGFONT m_lfInitial;
CFont m_SampleFont;
CString m_strCaption;
CString m_strSampleText;
CString m_strMonospacedLabel;
DWORD m_dwFontFilter;
BOOL m_bShowMonospacedLabel;
BOOL m_bShowMonospacedAsBold;
CImageList m_FontType;
// current font
CString m_strFaceName;
LONG m_Height;
int m_nPointSize;
LOGFONT m_lfCurrent;
DWORD m_dwXFontFlags;
void SetCurFont();
//{{AFX_MSG(CXMonoFontDialog)
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeFontList();
afx_msg void OnSelchangeFontSize();
afx_msg void OnEditchangeFontSize();
afx_msg void OnTimer(UINT nIDEvent);
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif //XMONOFONTDIALOG_H

View File

@@ -0,0 +1,110 @@
//Microsoft Developer Studio generated resource script.
//
#include "XMonoFontDialogRes.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"XMonoFontDialogRes.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_XMONOFONTDIALOG DIALOG DISCARDABLE 0, 0, 235, 170
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Font"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Font:",IDC_STATIC,11,7,17,8
LTEXT "MONOSPACED",IDC_FONT_MONOSPACED,49,7,55,8,NOT
WS_VISIBLE
LTEXT "&Size:",IDC_STATIC,144,7,30,9,NOT WS_GROUP
COMBOBOX IDC_FONT_LIST,10,16,130,97,CBS_SIMPLE |
CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT |
CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL |
WS_TABSTOP
COMBOBOX IDC_FONT_SIZE,144,16,30,97,CBS_SIMPLE |
CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Sample",IDC_STATIC,10,118,215,43,WS_GROUP
CTEXT "AaBbYyZz 0123456789",IDC_FONT_SAMPLE,15,129,205,25,
SS_NOPREFIX | SS_CENTERIMAGE
DEFPUSHBUTTON "OK",IDOK,182,16,44,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,182,34,44,14,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_XMONOFONTDIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 163
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by XMonoFontDialog.rc
//
//#define IDD_XMONOFONTDIALOG 999
#define IDC_FONT_LIST 1001
#define IDC_FONT_SIZE 1002
#define IDC_FONT_SAMPLE 1003
#define IDC_FONT_MONOSPACED 1004
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,52 @@
// XMonoFontDialogTest.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "XMonoFontDialogTest.h"
#include "XMonoFontDialogTestDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CXMonoFontDialogTestApp
BEGIN_MESSAGE_MAP(CXMonoFontDialogTestApp, CWinApp)
//{{AFX_MSG_MAP(CXMonoFontDialogTestApp)
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CXMonoFontDialogTestApp construction
CXMonoFontDialogTestApp::CXMonoFontDialogTestApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CXMonoFontDialogTestApp object
CXMonoFontDialogTestApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CXMonoFontDialogTestApp initialization
BOOL CXMonoFontDialogTestApp::InitInstance()
{
#if _MFC_VER < 0x700
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#endif
CXMonoFontDialogTestDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
return FALSE;
}

View File

@@ -0,0 +1,42 @@
// XMonoFontDialogTest.h
//
#ifndef XMONOFONTDIALOGTEST_H
#define XMONOFONTDIALOGTEST_H
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CXMonoFontDialogTestApp:
// See XMonoFontDialogTest.cpp for the implementation of this class
//
class CXMonoFontDialogTestApp : public CWinApp
{
public:
CXMonoFontDialogTestApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXMonoFontDialogTestApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CXMonoFontDialogTestApp)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif //XMONOFONTDIALOGTEST_H

View File

@@ -0,0 +1,258 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#include ""XMonoFontDialog.rc""\r\n"
"#endif\r\n"
"#ifdef _VC60\r\n"
"/////////////////////////////////////////////////////////////////////////////\r\n"
"//\r\n"
"// 24\r\n"
"//\r\n"
"1 24 MOVEABLE PURE ""app.manifest""\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "hans.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 270, 131
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About XMonoFontDialogTest"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,14,20,20,SS_CENTERIMAGE |
WS_BORDER
LTEXT "XMonoFontDialogTest Version 1.1",IDC_STATIC,40,13,140,8,
SS_NOPREFIX
LTEXT "Copyright <20> 2008 Hans Dietrich",IDC_STATIC,40,27,165,8
LTEXT "This software is released into the public domain. You are free to use it in any way you like.",
IDC_STATIC,40,43,165,18
LTEXT "This software is provided ""as is"" with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause. ",
IDC_STATIC,40,67,165,34
LTEXT "Send email to Hans Dietrich",IDC_ABOUT_EMAIL,90,113,90,
8,SS_CENTERIMAGE
DEFPUSHBUTTON "OK",IDOK,209,9,50,14,WS_GROUP
END
IDD_XMONOFONTDIALOGTEST_DIALOG DIALOGEX 0, 0, 305, 262
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "XMonoFontDialogTest"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Sample",IDC_GROUPBOX,10,8,285,50,WS_GROUP
CTEXT "This is a sample 0123456789",IDC_SAMPLE,20,16,265,40,
SS_CENTERIMAGE
LTEXT "",IDC_PROPERTIES,10,58,285,10,SS_SUNKEN
LTEXT "Note: GetSize() returns tenths of a point",IDC_NOTE,13,
69,157,8,NOT WS_VISIBLE
GROUPBOX "Filters",IDC_STATIC,10,84,285,56,WS_GROUP
CONTROL "Show all fonts",IDC_ALL_FONTS,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,18,97,60,10
CONTROL "Show symbol fonts only",IDC_SYMBOL,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,18,108,89,10
CONTROL "Show all fonts except symbol fonts",IDC_EXCEPT_SYMBOL,
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,18,119,124,10
CONTROL "Show monospaced fonts only",IDC_MONOSPACED,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,148,97,109,10
CONTROL "Show all fonts except monospaced fonts",
IDC_EXCEPT_MONOSPACED,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,148,108,143,10
CONTROL "Show all fonts except monospaced and symbol fonts",
IDC_EXCEPT_MONOSPACED_AND_SYMBOL,"Button",
BS_AUTORADIOBUTTON | BS_TOP | BS_MULTILINE | WS_TABSTOP,
148,119,141,16
GROUPBOX "Sample Text",IDC_STATIC,10,186,285,35,WS_GROUP
EDITTEXT IDC_SAMPLE_TEXT,20,200,265,12,ES_AUTOHSCROLL | WS_GROUP
PUSHBUTTON "CFontDialog",IDC_TEST2,10,230,80,23,WS_GROUP
DEFPUSHBUTTON "CXMonoFontDialog",IDC_TEST,106,230,94,23
PUSHBUTTON "Help",IDC_ONLINE_HELP,215,230,80,23
GROUPBOX "Monospaced Options",IDC_STATIC,10,146,285,34,WS_GROUP
CONTROL "Show Monospaced Label",IDC_SHOW_MONOSPACED_LABEL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,19,161,99,10
CONTROL "Show Monospaced As Bold",IDC_SHOW_MONOSPACED_AS_BOLD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,161,105,10
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,0,1
PRODUCTVERSION 1,1,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "Article", "www.codeproject.com\0"
VALUE "E-mail", "hdietrich@gmail.com\0"
VALUE "FileDescription", "XMonoFontDialogTest.exe\0"
VALUE "FileVersion", "1, 1, 0, 1\0"
VALUE "LegalCopyright", "Copyright <20> 2008 Hans Dietrich\0"
VALUE "OriginalFilename", "XMonoFontDialogTest.exe\0"
VALUE "ProductName", "XMonoFontDialogTest\0"
VALUE "ProductVersion", "1, 1, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_XMONOFONTDIALOGTEST_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 298
TOPMARGIN, 7
BOTTOMMARGIN, 255
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About XMonoFontDialogTest..."
IDS_MAILTO "mailto:hdietrich@gmail.com?subject=XMonoFontDialog"
IDS_ONLINE_HELP "http://www.codeproject.com/KB/dialog/XMonoFontDialog.aspx"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "afxres.rc" // Standard components
#include "XMonoFontDialog.rc"
#endif
#ifdef _VC60
/////////////////////////////////////////////////////////////////////////////
//
// 24
//
1 24 MOVEABLE PURE "app.manifest"
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,341 @@
// XMonoFontDialogTestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "XMonoFontDialogTest.h"
#include "XMonoFontDialogTestDlg.h"
#include "XMonoFontDialog.h"
#include "about.h"
#include "XTrace.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma warning(disable : 4996) // disable bogus deprecation warning
//=============================================================================
BEGIN_MESSAGE_MAP(CXMonoFontDialogTestDlg, CDialog)
//=============================================================================
//{{AFX_MSG_MAP(CXMonoFontDialogTestDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_TEST, OnCXMonoFontDialog)
ON_BN_CLICKED(IDC_TEST2, OnCFontDialog)
ON_BN_CLICKED(IDC_ONLINE_HELP, OnOnlineHelp)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//=============================================================================
CXMonoFontDialogTestDlg::CXMonoFontDialogTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CXMonoFontDialogTestDlg::IDD, pParent)
//=============================================================================
{
//{{AFX_DATA_INIT(CXMonoFontDialogTestDlg)
m_nFonts = 0;
m_strSampleText = _T("AaBbYyZz 0123456789");
m_bShowMonospacedAsBold = TRUE;
m_bShowMonospacedLabel = TRUE;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
//=============================================================================
CXMonoFontDialogTestDlg::~CXMonoFontDialogTestDlg()
//=============================================================================
{
m_font.DeleteObject();
m_buttonfont.DeleteObject();
}
//=============================================================================
void CXMonoFontDialogTestDlg::DoDataExchange(CDataExchange* pDX)
//=============================================================================
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CXMonoFontDialogTestDlg)
DDX_Control(pDX, IDC_NOTE, m_Note);
DDX_Control(pDX, IDC_PROPERTIES, m_Properties);
DDX_Control(pDX, IDC_SAMPLE, m_Sample);
DDX_Radio(pDX, IDC_ALL_FONTS, m_nFonts);
DDX_Text(pDX, IDC_SAMPLE_TEXT, m_strSampleText);
DDX_Check(pDX, IDC_SHOW_MONOSPACED_AS_BOLD, m_bShowMonospacedAsBold);
DDX_Check(pDX, IDC_SHOW_MONOSPACED_LABEL, m_bShowMonospacedLabel);
//}}AFX_DATA_MAP
}
//=============================================================================
BOOL CXMonoFontDialogTestDlg::OnInitDialog()
//=============================================================================
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_Sample.SetWindowText(m_strSampleText);
// create font for sample
LOGFONT lf;
CFont *pFont = GetFont();
pFont->GetLogFont(&lf);
m_nHeight = lf.lfHeight;
m_strFaceName = lf.lfFaceName;
m_font.CreateFontIndirect(&lf);
m_Sample.SetFont(&m_font);
if (lf.lfHeight < 0)
lf.lfHeight -= 1;
else
lf.lfHeight += 1;
//lf.lfWeight = FW_BOLD;
m_buttonfont.CreateFontIndirect(&lf);
GetDlgItem(IDC_TEST)->SetFont(&m_buttonfont);
GetDlgItem(IDC_TEST2)->SetFont(&m_buttonfont);
GetDlgItem(IDC_ONLINE_HELP)->SetFont(&m_buttonfont);
// display font name in sample groupbox
GetDlgItem(IDC_GROUPBOX)->SetWindowText(lf.lfFaceName);
return TRUE; // return TRUE unless you set the focus to a control
}
//=============================================================================
void CXMonoFontDialogTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
//=============================================================================
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
//=============================================================================
void CXMonoFontDialogTestDlg::OnPaint()
//=============================================================================
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
//=============================================================================
HCURSOR CXMonoFontDialogTestDlg::OnQueryDragIcon()
//=============================================================================
{
return (HCURSOR) m_hIcon;
}
//=============================================================================
void CXMonoFontDialogTestDlg::OnCXMonoFontDialog()
//=============================================================================
{
UpdateData(TRUE);
// get font for current dialog, just to fill in LOGFONT
LOGFONT lf;
CFont *pFont = GetFont();
pFont->GetLogFont(&lf);
// use last font height
lf.lfHeight = m_nHeight;
// use last face name
_tcscpy(lf.lfFaceName, m_strFaceName);
TRACE(_T("m_strFaceName=%s\n"), m_strFaceName);
// display CXMonoFontDialog
CXMonoFontDialog dlg(&lf);
DWORD dwFonts = XFONT_SHOW_ALL;
// get font filters
switch (m_nFonts)
{
case 0:
dwFonts = XFONT_SHOW_ALL;
break;
case 1:
dwFonts = XFONT_SHOW_SYMBOL;
break;
case 2:
dwFonts &= ~XFONT_SHOW_SYMBOL;
break;
case 3:
dwFonts = XFONT_SHOW_MONOSPACED;
break;
case 4:
dwFonts &= ~XFONT_SHOW_MONOSPACED;
break;
case 5:
dwFonts &= ~(XFONT_SHOW_MONOSPACED|XFONT_SHOW_SYMBOL);
break;
default:
dwFonts = 0;
break;
}
dlg.SetFontFilter(dwFonts)
.SetCaption(_T("XMonoFontDialog"))
.SetSampleText(m_strSampleText)
.ShowMonospacedLabel(m_bShowMonospacedLabel)
.ShowMonospacedAsBold(m_bShowMonospacedAsBold);
if (dlg.DoModal() == IDOK)
{
// display properties for selected font
CString strProperties = _T("");
strProperties.Format(_T(" tmHeight = %d "), dlg.GetTmHeight());
CString str;
str.Format(_T("GetSize() = %d "), dlg.GetSize());
strProperties += str;
if (dlg.IsMonospaced())
strProperties += _T("Monospaced ");
if (dlg.IsSymbol())
strProperties += _T("Symbol ");
if (dlg.IsTrueType())
strProperties += _T("TrueType ");
if (dlg.IsOpenType())
strProperties += _T("OpenType ");
if (dlg.IsVector())
strProperties += _T("Vector ");
m_Properties.SetWindowText(strProperties);
m_Note.ShowWindow(SW_SHOW);
dlg.GetCurrentFont(&lf);
TRACE(_T("lfCharSet=%d\n"), lf.lfCharSet);
m_nHeight = lf.lfHeight;
m_strFaceName = lf.lfFaceName;
GetDlgItem(IDC_GROUPBOX)->SetWindowText(lf.lfFaceName);
m_font.DeleteObject();
m_font.CreateFontIndirect(&lf);
m_Sample.SetWindowText(m_strSampleText);
m_Sample.SetFont(&m_font);
}
}
//=============================================================================
void CXMonoFontDialogTestDlg::OnCFontDialog()
//=============================================================================
{
TRACE(_T("in CXMonoFontDialogTestDlg::OnCFontDialog\n"));
UpdateData(TRUE);
// get font for current dialog, just to fill in LOGFONT
LOGFONT lf;
CFont *pFont = GetFont();
pFont->GetLogFont(&lf);
// use last font height
lf.lfHeight = m_nHeight;
// use last face name
_tcscpy(lf.lfFaceName, m_strFaceName);
// display CFontDialog
CFontDialog dlg(&lf);
if (m_nFonts == 3)
dlg.m_cf.Flags |= CF_FIXEDPITCHONLY;
dlg.m_cf.Flags |= CF_PRINTERFONTS;
//dlg.m_cf.Flags &= ~CF_EFFECTS; // remove the Effects controls
//dlg.m_cf.Flags |= CF_NOSCRIPTSEL; // disable the script combo
if (dlg.DoModal() == IDOK)
{
CString strProperties = _T("");
CString str;
str.Format(_T(" GetSize() = %d "), dlg.GetSize());
strProperties += str;
m_Properties.SetWindowText(strProperties);
m_Note.ShowWindow(SW_SHOW);
dlg.GetCurrentFont(&lf);
m_nHeight = lf.lfHeight;
m_strFaceName = lf.lfFaceName;
TRACE(_T("lfCharSet=%d\n"), lf.lfCharSet);
//TRACE(_T("GetStyleName=%s\n"), dlg.GetStyleName());
TRACE(_T("IsBold=%d lfWeight=%d\n"), dlg.IsBold(), lf.lfWeight);
GetDlgItem(IDC_GROUPBOX)->SetWindowText(lf.lfFaceName);
m_font.DeleteObject();
m_font.CreateFontIndirect(&lf);
m_Sample.SetWindowText(m_strSampleText);
m_Sample.SetFont(&m_font);
}
}
//=============================================================================
void CXMonoFontDialogTestDlg::OnOnlineHelp()
//=============================================================================
{
CString strHelp = _T("");
VERIFY(strHelp.LoadString(IDS_ONLINE_HELP));
CXHyperLink::GotoURL(strHelp, SW_SHOW, TRUE);
}
//=============================================================================
HBRUSH CXMonoFontDialogTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
//=============================================================================
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CWnd *pNote = GetDlgItem(IDC_NOTE);
if (pWnd->m_hWnd == pNote->m_hWnd)
pDC->SetTextColor(RGB(0,0,255));
return hbr;
}

View File

@@ -0,0 +1,59 @@
// XMonoFontDialogTestDlg.h : header file
//
#ifndef XMONOFONTDIALOGTESTDLG_H
#define XMONOFONTDIALOGTESTDLG_H
//=============================================================================
class CXMonoFontDialogTestDlg : public CDialog
//=============================================================================
{
// Construction
public:
CXMonoFontDialogTestDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CXMonoFontDialogTestDlg();
// Dialog Data
//{{AFX_DATA(CXMonoFontDialogTestDlg)
enum { IDD = IDD_XMONOFONTDIALOGTEST_DIALOG };
CStatic m_Note;
CStatic m_Properties;
CStatic m_Sample;
int m_nFonts;
CString m_strSampleText;
BOOL m_bShowMonospacedAsBold;
BOOL m_bShowMonospacedLabel;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXMonoFontDialogTestDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
CFont m_font;
CFont m_buttonfont;
CString m_strFaceName;
int m_nHeight;
// Generated message map functions
//{{AFX_MSG(CXMonoFontDialogTestDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnCXMonoFontDialog();
afx_msg void OnCFontDialog();
afx_msg void OnOnlineHelp();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif //XMONOFONTDIALOGTESTDLG_H

View File

@@ -0,0 +1,535 @@
// XMonoFontListCombo.cpp
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// Description:
// XMonoFontListCombo.cpp implements CXMonoFontListCombo, a class used by
// CXMonoFontDialog to display font names.
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "XMonoFontListCombo.h"
#include "XMonoFontDialog.h"
#include "XFontSize.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifndef __noop
#if _MSC_VER < 1300
#define __noop ((void)0)
#endif
#endif
#undef TRACE
#define TRACE __noop
//=============================================================================
// if you want to see the TRACE output, uncomment this line:
//#include "XTrace.h"
//=============================================================================
#pragma warning(disable : 4996) // disable bogus deprecation warning
#define GLYPH_SIZE 12
#define TIMER_INIT 1
static int CALLBACK EnumFontFamExProc(const ENUMLOGFONTEX *lpelfe,
const NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam);
//=============================================================================
BEGIN_MESSAGE_MAP(CXMonoFontListCombo, CComboBox)
//=============================================================================
//{{AFX_MSG_MAP(CXMonoFontListCombo)
ON_WM_TIMER()
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//=============================================================================
CXMonoFontListCombo::CXMonoFontListCombo()
//=============================================================================
{
m_bShowMonospacedAsBold = TRUE;
m_pDC = 0;
m_dwFontFilter = 0;
memset(&m_lfInitial, 0, sizeof(LOGFONT));
m_lfInitial.lfCharSet = DEFAULT_CHARSET;
_tcscpy(m_lfInitial.lfFaceName, _T("Courier"));
m_lfInitial.lfHeight = FontSize.GetFontHeight(8);
memcpy(&m_lfCurrent, &m_lfInitial, sizeof(LOGFONT));
}
//=============================================================================
CXMonoFontListCombo::~CXMonoFontListCombo()
//=============================================================================
{
if (m_BoldFont.GetSafeHandle())
m_BoldFont.DeleteObject();
m_FontType.DeleteImageList();
}
//=============================================================================
void CXMonoFontListCombo::PreSubclassWindow()
//=============================================================================
{
TRACE(_T("in CXMonoFontListCombo::PreSubclassWindow\n"));
TRACE(_T("m_dwFontFilter=%X\n"), m_dwFontFilter);
CreateFontTypeImages();
CFont *pFont = GetFont();
if (!pFont)
pFont = GetParent()->GetFont();
if (pFont)
{
LOGFONT lf;
pFont->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
m_BoldFont.CreateFontIndirect(&lf);
}
// enumerate fonts, fill combo
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfCharSet = DEFAULT_CHARSET;
m_pDC = GetDC(); // use one dc for enumeration
if (m_pDC)
{
int nSavedDC = m_pDC->SaveDC();
EnumFontFamiliesEx(m_pDC->m_hDC,
&lf,
(FONTENUMPROC)EnumFontFamExProc,
(LPARAM)this,
0);
TEXTMETRIC tm;
m_pDC->GetTextMetrics(&tm);
m_pDC->RestoreDC(nSavedDC);
ReleaseDC(m_pDC);
// set height of edit box and combo list entries
int h = tm.tmHeight - tm.tmInternalLeading;
SetItemHeight(0, h);
SetItemHeight(-1, h);
}
m_pDC = 0;
// select initial font
int index = FindStringExact(-1, m_lfInitial.lfFaceName);
if (index == CB_ERR)
{
if (GetCount() > 0)
index = 0;
}
m_CurIndex = index;
if (index >= 0)
{
SetCurSel(index);
SetTimer(TIMER_INIT, 50, 0);
}
TRACE(_T("exiting CXMonoFontListCombo::PreSubclassWindow\n"));
CComboBox::PreSubclassWindow();
}
//=============================================================================
void CXMonoFontListCombo::CreateFontTypeImages()
//=============================================================================
{
ASSERT(m_FontType.GetSafeHandle() == 0);
// We load the font type images from resource 38 in COMDLG32.DLL.
// This bitmap is 100 x 24, and has 2 rows of 5 images
HMODULE hModule = ::LoadLibraryEx(_T("COMDLG32.DLL"), NULL,
DONT_RESOLVE_DLL_REFERENCES);
ASSERT(hModule);
if (!hModule)
return;
HBITMAP hBmp = (HBITMAP)::LoadImage(hModule, MAKEINTRESOURCE(38),
IMAGE_BITMAP, 100, 24, LR_DEFAULTCOLOR);
::FreeLibrary(hModule);
ASSERT(hBmp);
if (!hBmp)
return;
CClientDC dcClient(this);
// We create one image list for the selected and non-selected
// glyphs. The images are:
// 0 - TrueType non-selected
// 1 - OpenType non-selected
// 2 - TrueType selected
// 3 - OpenType selected
if (m_FontType.Create(GLYPH_SIZE, GLYPH_SIZE, ILC_COLOR32 | ILC_MASK, 4, 1))
{
CDC dcMem;
dcMem.CreateCompatibleDC(&dcClient);
CBitmap *pBmp = CBitmap::FromHandle(hBmp);
CBitmap *pOldBitmap = dcMem.SelectObject(pBmp);
// dcMem now contains the 100 x 24 bitmap (2 rows) from COMDLG32.DLL.
// The individual images are at 0, 20, 40, 60, and 80.
// We want the images at 0 and 40 in each row.
CDC dcBitmap1;
dcBitmap1.CreateCompatibleDC(&dcClient);
CBitmap bmp1;
bmp1.CreateCompatibleBitmap(&dcClient, 2*GLYPH_SIZE, GLYPH_SIZE);
// extract non-selected images from top row
CBitmap *pOldBitmap1 = dcBitmap1.SelectObject(&bmp1);
dcBitmap1.FillSolidRect(0, 0, 2*GLYPH_SIZE, GLYPH_SIZE, GetSysColor(COLOR_WINDOW));
// we want 1st (TrueType) and 3rd (OpenType) images
dcBitmap1.BitBlt(0, 0, GLYPH_SIZE, GLYPH_SIZE, &dcMem, 3, 0, SRCCOPY);
dcBitmap1.BitBlt(GLYPH_SIZE, 0, GLYPH_SIZE, GLYPH_SIZE, &dcMem, 43, 0, SRCCOPY);
dcBitmap1.SelectObject(pOldBitmap1);
m_FontType.Add(&bmp1, RGB(0,0,255)); // different mask color for each row
// extract selected images from 2nd row
dcBitmap1.SelectObject(&bmp1);
dcBitmap1.FillSolidRect(0, 0, 2*GLYPH_SIZE, GLYPH_SIZE, GetSysColor(COLOR_WINDOW));
// we want 1st (TrueType) and 3rd (OpenType) images
dcBitmap1.BitBlt(0, 0, GLYPH_SIZE, GLYPH_SIZE, &dcMem, 3, GLYPH_SIZE, SRCCOPY);
dcBitmap1.BitBlt(GLYPH_SIZE, 0, GLYPH_SIZE, GLYPH_SIZE, &dcMem, 43, GLYPH_SIZE, SRCCOPY);
dcBitmap1.SelectObject(pOldBitmap1);
m_FontType.Add(&bmp1, RGB(255,0,255)); // different mask color for each row
dcBitmap1.DeleteDC();
bmp1.DeleteObject();
dcMem.SelectObject(pOldBitmap);
dcMem.DeleteDC();
}
::DeleteObject(hBmp);
}
//=============================================================================
CXMonoFontListCombo& CXMonoFontListCombo::SetFont(LOGFONT& lf)
//=============================================================================
{
memcpy(&m_lfInitial, &lf, sizeof(LOGFONT));
memcpy(&m_lfCurrent, &lf, sizeof(LOGFONT));
return *this;
}
//=============================================================================
void CXMonoFontListCombo::DrawItem(LPDRAWITEMSTRUCT lpDIS)
//=============================================================================
{
if (lpDIS->itemID == -1)
return;
ASSERT(lpDIS->CtlType == ODT_COMBOBOX);
CRect rect = lpDIS->rcItem;
int nSavedDC = ::SaveDC(lpDIS->hDC);
CDC dc;
dc.Attach(lpDIS->hDC);
if (lpDIS->itemState & ODS_FOCUS)
dc.DrawFocusRect(&rect);
COLORREF crText = ::GetSysColor(COLOR_WINDOWTEXT);
COLORREF crBackground = ::GetSysColor(COLOR_WINDOW);
if (lpDIS->itemState & ODS_SELECTED)
{
crText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
crBackground = ::GetSysColor(COLOR_HIGHLIGHT);
}
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(crText);
dc.FillSolidRect(&rect, crBackground);
CString strFontName = _T("");
GetLBText(lpDIS->itemID, strFontName);
// draw the font type glyph
DWORD dwData = GetItemData(lpDIS->itemID);
//TRACE(_T("dwData=0x%X for %s\n"), dwData, strFontName);
CPoint point(rect.left+3, rect.top);
int nImage = -1;
if (dwData & XFONT_TRUETYPE)
nImage = 0;
else if (dwData & XFONT_OPENTYPE)
nImage = 1;
if (nImage != -1)
{
if (lpDIS->itemState & ODS_SELECTED)
nImage += 2;
if (m_FontType.GetSafeHandle())
m_FontType.Draw(&dc, nImage, point, ILD_TRANSPARENT);
}
if ((dwData & XFONT_MONOSPACED) && m_bShowMonospacedAsBold)
{
if (m_BoldFont.GetSafeHandle())
dc.SelectObject(&m_BoldFont);
}
rect.left += GLYPH_SIZE + 8;
// draw the text
dc.TextOut(rect.left, rect.top, strFontName);
dc.Detach();
::RestoreDC(lpDIS->hDC, nSavedDC);
}
//=============================================================================
// This function is the enumeration callback for font names.
// Its purpose is to fill the font combo with non-duplicate names,
// and screen out unwanted fonts based on font filter.
int CALLBACK EnumFontFamExProc(const ENUMLOGFONTEX *lpelfe,
const NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam)
//=============================================================================
{
CXMonoFontListCombo *pCombo = (CXMonoFontListCombo *) lParam;
ASSERT(lpelfe);
ASSERT(lpntme);
ASSERT(pCombo);
if (!lpelfe || !lpntme || !pCombo)
return FALSE; // something seriously wrong
if (pCombo->FindStringExact(-1, lpelfe->elfLogFont.lfFaceName) != CB_ERR)
{
// already in combo
return TRUE; // continue enumeration
}
// save font attributes - this will be stored in combobox item data
DWORD dwData = 0;
UINT fonttype = lpntme->ntmTm.tmPitchAndFamily & 0x6;
if (fonttype == 0)
dwData |= XFONT_RASTER;
if (fonttype == 2)
dwData |= XFONT_VECTOR;
if (lpntme->ntmTm.tmCharSet == OEM_CHARSET)
dwData |= XFONT_OEM;
if (lpntme->ntmTm.tmCharSet == SYMBOL_CHARSET)
dwData |= XFONT_SYMBOL;
if (lpntme->ntmTm.tmWeight > 600)
dwData |= XFONT_BOLD;
if (lpntme->ntmTm.tmItalic)
dwData |= XFONT_ITALIC;
DWORD weight = lpntme->ntmTm.tmWeight;
weight = weight << 16;
dwData |= weight;
UINT family = lpntme->ntmTm.tmPitchAndFamily & 0xF0;
dwData |= family;
// check if monospaced
if (pCombo->m_pDC)
{
BOOL bMonoSpaced = FALSE;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
_tcsncpy(lf.lfFaceName, lpelfe->elfLogFont.lfFaceName,
sizeof(lf.lfFaceName)/sizeof(TCHAR)-1);
lf.lfFaceName[sizeof(lf.lfFaceName)/sizeof(TCHAR)-1] = 0;
lf.lfWeight = FW_NORMAL;
lf.lfCharSet = DEFAULT_CHARSET;
HFONT hFont = ::CreateFontIndirect(&lf);
ASSERT(hFont);
if (hFont)
{
// font is monospaced if
// (1) width of W == width of !
// (2) it is not a symbol font
HFONT hFontOld = (HFONT)::SelectObject(pCombo->m_pDC->m_hDC, hFont);
TEXTMETRIC tm;
::GetTextMetrics(pCombo->m_pDC->m_hDC, &tm);
SIZE sizeChar1;
::GetTextExtentPoint32(pCombo->m_pDC->m_hDC, _T("W"), 1, &sizeChar1);
SIZE sizeChar2;
::GetTextExtentPoint32(pCombo->m_pDC->m_hDC, _T("!"), 1, &sizeChar2);
bMonoSpaced = sizeChar1.cx == sizeChar2.cx;
if (tm.tmCharSet == SYMBOL_CHARSET)
bMonoSpaced = FALSE;
if (hFontOld)
::SelectObject(pCombo->m_pDC->m_hDC, hFontOld);
::DeleteObject(hFont);
}
if (bMonoSpaced)
dwData |= XFONT_MONOSPACED;
}
BOOL bOkToAdd = TRUE;
TRACE(_T("m_dwFontFilter=%X\n"), pCombo->m_dwFontFilter);
if (bOkToAdd && ((pCombo->m_dwFontFilter & XFONT_SHOW_SYMBOL) == 0))
{
// don't show symbol fonts
if (dwData & XFONT_SYMBOL)
bOkToAdd = FALSE;
}
if (bOkToAdd && ((pCombo->m_dwFontFilter & XFONT_SHOW_ITALIC) == 0))
{
// don't show italic fonts
if (dwData & XFONT_ITALIC)
bOkToAdd = FALSE;
}
if (bOkToAdd && ((pCombo->m_dwFontFilter & XFONT_SHOW_BOLD) == 0))
{
// don't show bold fonts
if (dwData & XFONT_BOLD)
bOkToAdd = FALSE;
}
if (bOkToAdd && ((pCombo->m_dwFontFilter & XFONT_SHOW_MONOSPACED) == 0))
{
// don't show monospaced fonts
if (dwData & XFONT_MONOSPACED)
bOkToAdd = FALSE;
}
DWORD dwSpecial = XFONT_BOLD|XFONT_ITALIC|XFONT_SYMBOL|XFONT_MONOSPACED;
if (bOkToAdd && ((pCombo->m_dwFontFilter & XFONT_SHOW_NORMAL) == 0))
{
// don't show normal fonts
if ((dwData & dwSpecial) == 0)
bOkToAdd = FALSE;
}
if (bOkToAdd)
{
// According to docs, "The function uses the NEWTEXTMETRICEX structure
// for TrueType fonts; and the TEXTMETRIC structure for other fonts."
// In practice, it seems that a NEWTEXTMETRICEX struct is always returned,
// but just to be safe we prepare for an exception.
__try
{
if ((lpntme->ntmTm.ntmFlags & NTM_TT_OPENTYPE) ||
(lpntme->ntmTm.ntmFlags & NTM_PS_OPENTYPE))
{
dwData |= XFONT_OPENTYPE;
}
else if (FontType & TRUETYPE_FONTTYPE)
{
dwData |= XFONT_TRUETYPE;
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
TRACE(_T("ERROR: exception in EnumFontFamExProc()\n"));
}
int index = pCombo->AddString(lpelfe->elfLogFont.lfFaceName);
ASSERT(index >= 0);
if (index >= 0)
{
VERIFY(pCombo->SetItemData(index, dwData) != CB_ERR);
}
TRACE(_T("_____ added %s [%s] FontType=0x%X ntmFlags=0x%X tmCharSet=%d tmPitchAndFamily=0x%X dwData=0x%X \n"),
lpelfe->elfLogFont.lfFaceName,
lpelfe->elfFullName,
FontType,
lpntme->ntmTm.ntmFlags,
lpntme->ntmTm.tmCharSet,
lpntme->ntmTm.tmPitchAndFamily,
dwData);
}
return TRUE;
}
//=============================================================================
void CXMonoFontListCombo::OnTimer(UINT nIDEvent)
//=============================================================================
{
KillTimer(nIDEvent);
if (nIDEvent == TIMER_INIT)
{
// send initial selection message
GetParent()->SendMessage(WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(), CBN_SELCHANGE),
(LPARAM)m_hWnd);
if (m_CurIndex >= 0)
{
DWORD dwData = GetItemData(m_CurIndex);
// set bold typeface in edit box
SetBold(m_bShowMonospacedAsBold && (dwData & XFONT_MONOSPACED));
}
}
CComboBox::OnTimer(nIDEvent);
}
//=============================================================================
HBRUSH CXMonoFontListCombo::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
//=============================================================================
{
if (nCtlColor == CTLCOLOR_EDIT)
{
if (m_edit.GetSafeHwnd() == NULL)
{
// subclass edit box
m_edit.SubclassWindow(pWnd->GetSafeHwnd());
m_edit.SetReadOnly(TRUE);
}
}
return CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);
}
//=============================================================================
LRESULT CXMonoFontListCombo::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
//=============================================================================
{
if (message == WM_CHAR)
{
// try to match first character of font name
TCHAR s[2] = { 0 };
s[0] = (TCHAR) wParam;
int index = FindString(-1, s);
if (index >= 0)
{
SetCurSel(index);
// tell parent that selection has changed
GetParent()->SendMessage(WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(), CBN_SELCHANGE), (LPARAM)m_hWnd);
}
return TRUE;
}
return CComboBox::WindowProc(message, wParam, lParam);
}

View File

@@ -0,0 +1,90 @@
// XMonoFontListCombo.h
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XMONOFONTLISTCOMBO_H
#define XMONOFONTLISTCOMBO_H
#include "XMonoFontListComboEdit.h"
//=============================================================================
class CXMonoFontListCombo : public CComboBox
//=============================================================================
{
// Construction
public:
CXMonoFontListCombo();
virtual ~CXMonoFontListCombo();
// Attributes
public:
CDC * m_pDC;
DWORD m_dwFontFilter;
CXMonoFontListComboEdit m_edit;
CXMonoFontListCombo& SetBold(BOOL bBold)
{
if (IsWindow(m_edit.m_hWnd))
{
m_edit.SetBold(bBold);
m_edit.RedrawWindow();
}
return *this;
}
CXMonoFontListCombo& SetFont(LOGFONT& lf);
CXMonoFontListCombo& SetFontFilter(DWORD dwFontFilter)
{ m_dwFontFilter = dwFontFilter; return *this; }
CXMonoFontListCombo& ShowMonospacedAsBold(BOOL bShow)
{ m_bShowMonospacedAsBold = bShow; return *this; }
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXMonoFontListCombo)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
protected:
virtual void PreSubclassWindow();
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
protected:
CImageList m_FontType;
CFont m_BoldFont;
BOOL m_bShowMonospacedAsBold;
LOGFONT m_lfInitial;
LOGFONT m_lfCurrent;
int m_CurIndex;
void CreateFontTypeImages();
// Generated message map functions
protected:
//{{AFX_MSG(CXMonoFontListCombo)
afx_msg void OnTimer(UINT nIDEvent);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif //XMONOFONTLISTCOMBO_H

View File

@@ -0,0 +1,233 @@
// XMonoFontListComboEdit.cpp
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// Description:
// XMonoFontListComboEdit.cpp implements CXMonoFontListComboEdit, a class
// used by CXMonoFontListCombo.
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "XMonoFontListComboEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifndef __noop
#if _MSC_VER < 1300
#define __noop ((void)0)
#endif
#endif
#undef TRACE
#define TRACE __noop
//=============================================================================
// if you want to see the TRACE output, uncomment this line:
//#include "XTrace.h"
//=============================================================================
//=============================================================================
BEGIN_MESSAGE_MAP(CXMonoFontListComboEdit, CEdit)
//=============================================================================
//{{AFX_MSG_MAP(CXMonoFontListComboEdit)
ON_CONTROL_REFLECT(EN_SETFOCUS, OnSetfocus)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
ON_WM_PAINT()
END_MESSAGE_MAP()
//=============================================================================
CXMonoFontListComboEdit::CXMonoFontListComboEdit()
//=============================================================================
{
m_bBold = FALSE;
m_strText = _T("");
}
//=============================================================================
CXMonoFontListComboEdit::~CXMonoFontListComboEdit()
//=============================================================================
{
if (m_Font.GetSafeHandle())
m_Font.DeleteObject();
if (m_BoldFont.GetSafeHandle())
m_BoldFont.DeleteObject();
if (m_brush.GetSafeHandle())
m_brush.DeleteObject();
}
//=============================================================================
void CXMonoFontListComboEdit::PreSubclassWindow()
//=============================================================================
{
TRACE(_T("in CXMonoFontListComboEdit::PreSubclassWindow ================\n"));
// get current font
CFont* pFont = GetSafeFont();
// create the font for this control
LOGFONT lf;
pFont->GetLogFont(&lf);
m_Font.CreateFontIndirect(&lf);
lf.lfWeight = FW_BOLD;
m_BoldFont.CreateFontIndirect(&lf);
m_brush.CreateSolidBrush(GetSysColor(COLOR_WINDOW));
CEdit::PreSubclassWindow();
}
//=============================================================================
void CXMonoFontListComboEdit::OnPaint()
//=============================================================================
{
CPaintDC dc(this); // device context for painting
BOOL bFocus = FALSE;
CWnd *pWndFocus = GetFocus();
if (pWndFocus && IsWindow(pWndFocus->m_hWnd))
{
if (pWndFocus->m_hWnd == m_hWnd)
bFocus = TRUE;
}
CString strText = m_strText;
if (strText.IsEmpty())
GetWindowText(strText);
TRACE(_T("strText=%s\n"), strText);
CRect rc;
GetClientRect(&rc);
dc.FillSolidRect(&rc, GetSysColor(COLOR_WINDOW));
CEdit::SetSel(0, 0);
CFont *pOldFont = 0;
if (m_bBold)
pOldFont = dc.SelectObject(&m_BoldFont);
else
pOldFont = dc.SelectObject(&m_Font);
dc.SetBkMode(OPAQUE);
if (bFocus)
{
dc.SetTextColor(GetSysColor(COLOR_WINDOW));
dc.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
}
else
{
dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
dc.SetBkColor(GetSysColor(COLOR_WINDOW));
}
dc.TextOut(rc.left, rc.top, strText);
dc.SelectObject(pOldFont);
}
//=============================================================================
CFont * CXMonoFontListComboEdit::GetSafeFont()
//=============================================================================
{
// get current font
CFont *pFont = CWnd::GetFont();
if (pFont == 0)
{
// try to get parent font
CWnd *pParent = GetParent();
if (pParent && IsWindow(pParent->m_hWnd))
pFont = pParent->GetFont();
if (pFont == 0)
{
// no font, so get a system font
HFONT hFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if (hFont == 0)
hFont = (HFONT)::GetStockObject(SYSTEM_FONT);
if (hFont == 0)
hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT);
if (hFont)
pFont = CFont::FromHandle(hFont);
}
}
return pFont;
}
//=============================================================================
void CXMonoFontListComboEdit::SetWindowText(LPCTSTR lpszString)
//=============================================================================
{
m_strText = lpszString;
RedrawWindow();
}
//=============================================================================
LRESULT CXMonoFontListComboEdit::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
//=============================================================================
{
if (message == WM_SETTEXT)
{
// don't allow CEdit to paint text
m_strText = (LPCTSTR) lParam;
lParam = (LPARAM)_T("");
RedrawWindow();
}
else if ((message == WM_LBUTTONDOWN) ||
(message == WM_LBUTTONDBLCLK))
{
GetParent()->SendMessage(message, wParam, lParam);
return TRUE;
}
else if (message == WM_CHAR)
{
// let combobox handle it
GetParent()->SendMessage(message, wParam, lParam);
return TRUE;
}
else if (message == WM_CONTEXTMENU)
{
// suppress context menu
return TRUE;
}
else if (message == WM_ERASEBKGND)
{
// entire control is painted in OnPaint
return TRUE;
}
return CEdit::WindowProc(message, wParam, lParam);
}
//=============================================================================
void CXMonoFontListComboEdit::OnSetfocus()
//=============================================================================
{
RedrawWindow();
}
//=============================================================================
HBRUSH CXMonoFontListComboEdit::CtlColor(CDC* /*pDC*/, UINT /*nCtlColor*/)
//=============================================================================
{
// this is necessary on Vista
return m_brush;
}

View File

@@ -0,0 +1,70 @@
// XMonoFontListComboEdit.h
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// License:
// This software is released into the public domain. You are free to use
// it in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this
// software may cause.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XMONOFONTLISTCOMBOEDIT_H
#define XMONOFONTLISTCOMBOEDIT_H
//=============================================================================
class CXMonoFontListComboEdit : public CEdit
//=============================================================================
{
// Construction
public:
CXMonoFontListComboEdit();
virtual ~CXMonoFontListComboEdit();
// Attributes
public:
void SetBold(BOOL bBold) { m_bBold = bBold; }
void SetWindowText(LPCTSTR lpszString);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXMonoFontListComboEdit)
protected:
virtual void PreSubclassWindow();
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
public:
CFont m_Font;
CFont m_BoldFont;
BOOL m_bBold;
CString m_strText;
CBrush m_brush;
CFont * GetSafeFont();
// Generated message map functions
protected:
//{{AFX_MSG(CXMonoFontListComboEdit)
afx_msg void OnSetfocus();
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
//}}AFX_MSG
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif //XMONOFONTLISTCOMBOEDIT_H

View File

@@ -0,0 +1,299 @@
// XTrace.h Version 1.2
//
// Author: Paul Mclachlan
//
// Modified by: Hans Dietrich
// hdietrich@gmail.com
//
// Version 1.2 fixed macro redefinition warnings
//
// Version 1.1: added Unicode support
// added optional thread id to output string
// added option to enable/disable full path
// added TRACERECT macro
// changed name to avoid conflicts with Paul's class.
//
// This code was taken from article by Paul Mclachlan, "Getting around
// the need for a vararg #define just to automatically use __FILE__ and
// __LINE__ in a TRACE macro". For original article, see
// http://www.codeproject.com/useritems/location_trace.asp
//
// XTrace.h is a drop-in replacement for MFC's TRACE facility. It has no
// dependency on MFC. It is thread-safe and uses no globals or statics.
//
// It optionally adds source module/line number and thread id to each line
// of TRACE output. To control these features, use the following defines:
//
// XTRACE_SHOW_FULLPATH
// XTRACE_SHOW_THREAD_ID
//
// XTrace.h also provides the TRACERECT macro, which outputs the contents
// of a RECT struct. In Release builds, no output will be produced.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef XTRACE_H
#define XTRACE_H
#include <stdarg.h>
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
#pragma warning(disable : 4996) // disable bogus deprecation warning
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
#define XTRACE_SHOW_FULLPATH FALSE // FALSE = only show base name of file
#define XTRACE_SHOW_THREAD_ID TRUE // TRUE = include thread id in output
#define XTRACE_FILE FALSE // TRUE = output to file
class xtracing_output_debug_string
{
public:
xtracing_output_debug_string(LPCTSTR lpszFile, int line) :
m_file(lpszFile),
m_line(line)
{
}
void operator() (LPCTSTR lpszFormat, ...)
{
va_list va;
va_start(va, lpszFormat);
TCHAR buf1[BUFFER_SIZE];
TCHAR buf2[BUFFER_SIZE];
// add the __FILE__ and __LINE__ to the front
TCHAR *cp = (LPTSTR) m_file;
if (!XTRACE_SHOW_FULLPATH)
{
cp = (TCHAR *)_tcsrchr(m_file, _T('\\'));
if (cp)
cp++;
}
if (XTRACE_SHOW_THREAD_ID)
{
if (_sntprintf(buf1, BUFFER_SIZE-1, _T("%s(%d) : [%X] %s"),
cp, m_line, GetCurrentThreadId(), lpszFormat) < 0)
buf1[BUFFER_SIZE-1] = _T('\0');
}
else
{
if (_sntprintf(buf1, BUFFER_SIZE-1, _T("%s(%d) : %s"),
cp, m_line, lpszFormat) < 0)
buf1[BUFFER_SIZE-1] = _T('\0');
}
// format the message as requested
if (_vsntprintf(buf2, BUFFER_SIZE-1, buf1, va) < 0)
buf2[BUFFER_SIZE-1] = _T('\0');
va_end(va);
if (XTRACE_FILE)
{
TCHAR szPathName[MAX_PATH*2] = { 0 };
::GetModuleFileName(NULL, szPathName, sizeof(szPathName)/sizeof(TCHAR)-2);
TCHAR *cp = _tcsrchr(szPathName, _T('\\'));
if (cp != NULL)
*(cp+1) = _T('\0');
_tcscat(szPathName, _T("\\_trace.log"));
HANDLE hFile = ::CreateFile(szPathName, GENERIC_WRITE, FILE_SHARE_WRITE,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
DWORD dwRC = ::SetFilePointer(hFile, // handle to file
0, // bytes to move pointer
NULL, // bytes to move pointer
FILE_END); // starting point
if (dwRC != INVALID_SET_FILE_POINTER)
{
DWORD dwWritten = 0;
::WriteFile(hFile, // handle to file
buf2, // data buffer
(DWORD)_tcslen(buf2)*sizeof(TCHAR), // number of bytes to write
&dwWritten, // number of bytes written
NULL); // overlapped buffer
}
::CloseHandle(hFile);
}
}
else
{
// write it out
OutputDebugString(buf2);
}
}
private:
LPCTSTR m_file;
int m_line;
enum { BUFFER_SIZE = 4096 };
};
class xtracing_entry_output_debug_string
{
public:
xtracing_entry_output_debug_string(LPCTSTR lpszFile, int line) :
m_file(lpszFile),
m_line(line)
{
}
~xtracing_entry_output_debug_string()
{
TCHAR buf3[BUFFER_SIZE*3];
_stprintf(buf3, _T("====== exiting scope: %s"), buf2);
OutputDebugString(buf3);
}
void operator() (LPCTSTR lpszFormat, ...)
{
va_list va;
va_start(va, lpszFormat);
TCHAR buf1[BUFFER_SIZE];
// add the __FILE__ and __LINE__ to the front
TCHAR *cp = (LPTSTR) m_file;
if (!XTRACE_SHOW_FULLPATH)
{
cp = (TCHAR *)_tcsrchr(m_file, _T('\\'));
if (cp)
cp++;
}
if (XTRACE_SHOW_THREAD_ID)
{
if (_sntprintf(buf1, BUFFER_SIZE-1, _T("%s(%d) : [%X] ====== %s"),
cp, m_line, GetCurrentThreadId(), lpszFormat) < 0)
buf1[BUFFER_SIZE-1] = _T('\0');
}
else
{
if (_sntprintf(buf1, BUFFER_SIZE-1, _T("%s(%d) : ====== %s"),
cp, m_line, lpszFormat) < 0)
buf1[BUFFER_SIZE-1] = _T('\0');
}
// format the message as requested
if (_vsntprintf(buf2, BUFFER_SIZE-1, buf1, va) < 0)
buf2[BUFFER_SIZE-1] = _T('\0');
va_end(va);
if (XTRACE_FILE)
{
TCHAR szPathName[MAX_PATH*2] = { 0 };
::GetModuleFileName(NULL, szPathName, sizeof(szPathName)/sizeof(TCHAR)-2);
TCHAR *cp = _tcsrchr(szPathName, _T('\\'));
if (cp != NULL)
*(cp+1) = _T('\0');
_tcscat(szPathName, _T("\\_trace.log"));
HANDLE hFile = ::CreateFile(szPathName, GENERIC_WRITE, FILE_SHARE_WRITE,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
DWORD dwRC = ::SetFilePointer(hFile, // handle to file
0, // bytes to move pointer
NULL, // bytes to move pointer
FILE_END); // starting point
if (dwRC != INVALID_SET_FILE_POINTER)
{
DWORD dwWritten = 0;
::WriteFile(hFile, // handle to file
buf2, // data buffer
(DWORD)_tcslen(buf2)*sizeof(TCHAR), // number of bytes to write
&dwWritten, // number of bytes written
NULL); // overlapped buffer
}
::CloseHandle(hFile);
}
}
else
{
// write it out
OutputDebugString(buf2);
}
}
private:
LPCTSTR m_file;
int m_line;
enum { BUFFER_SIZE = 4096 };
TCHAR buf2[BUFFER_SIZE*2];
};
#undef TRACE
#undef TRACE0
#undef TRACE1
#undef TRACE2
#undef TRACERECT
#undef TRACEPOINT
#undef TRACESIZE
#undef TRACEHILO
#define _DEBUGnow
#ifdef _DEBUG
#define TRACE (xtracing_output_debug_string(_T(__FILE__), __LINE__ ))
#define TRACEENTRY (xtracing_output_debug_string(_T(__FILE__), __LINE__ ))
#define TRACEERROR (xtracing_output_debug_string(_T(__FILE__), __LINE__ ))
#define TRACE0 TRACE
#define TRACE1 TRACE
#define TRACE2 TRACE
#define TRACEHILO(d) \
WORD ___hi = HIWORD(d); WORD ___lo = LOWORD(d); \
TRACE(_T(#d) _T(": HIWORD = %u LOWORD = %u\n"), ___hi, ___lo)
#define TRACESIZE(s) TRACE(_T(#s) _T(": cx = %d cy = %d\n"), \
(s).cx, (s).cy)
#define TRACEPOINT(p) TRACE(_T(#p) _T(": x = %d y = %d\n"), \
(p).x, (p).y)
#define TRACERECT(r) TRACE(_T(#r) _T(": left = %d top = %d right = %d bottom = %d\n"), \
(r).left, (r).top, (r).right, (r).bottom)
#else
#ifndef __noop
#if _MSC_VER < 1300
#define __noop ((void)0)
#endif
#endif
#define TRACE __noop
#define TRACEERROR __noop
#define TRACE0 __noop
#define TRACE1 __noop
#define TRACE2 __noop
#define TRACERECT __noop
#define TRACEPOINT __noop
#define TRACESIZE __noop
#define TRACEHILO __noop
#endif //_DEBUG
#pragma warning(pop)
#endif //XTRACE_H

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.atest"
type="win32"
/>
<description>description</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,41 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by XMonoFontDialogTest.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_XMONOFONTDIALOGTEST_DIALOG 102
#define IDS_MAILTO 103
#define IDS_ONLINE_HELP 104
#define IDR_MAINFRAME 128
#define IDC_ABOUT_EMAIL 1001
#define IDC_ABOUT_HYPERLINK 1002
#define IDC_GROUPBOX 1003
#define IDC_SAMPLE 1004
#define IDC_ALL_FONTS 1005
#define IDC_SYMBOL 1006
#define IDC_EXCEPT_SYMBOL 1007
#define IDC_MONOSPACED 1008
#define IDC_EXCEPT_MONOSPACED 1009
#define IDC_EXCEPT_MONOSPACED_AND_SYMBOL 1010
#define IDC_PROPERTIES 1011
#define IDC_NOTE 1012
#define IDC_TEST 1013
#define IDC_TEST2 1014
#define IDC_SAMPLE_TEXT 1015
#define IDC_SCRIPT 1016
#define IDC_ONLINE_HELP 1017
#define IDC_SHOW_MONOSPACED_LABEL 1018
#define IDC_SHOW_MONOSPACED_AS_BOLD 1019
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1020
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XMonoFontDialogTest", "XMonoFontDialogTest.vcproj", "{77B69CB3-4461-4711-9FD8-A5DC6846AEDC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{77B69CB3-4461-4711-9FD8-A5DC6846AEDC}.Debug|Win32.ActiveCfg = Debug|Win32
{77B69CB3-4461-4711-9FD8-A5DC6846AEDC}.Debug|Win32.Build.0 = Debug|Win32
{77B69CB3-4461-4711-9FD8-A5DC6846AEDC}.Release|Win32.ActiveCfg = Release|Win32
{77B69CB3-4461-4711-9FD8-A5DC6846AEDC}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,308 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="XMonoFontDialogTest"
ProjectGUID="{77B69CB3-4461-4711-9FD8-A5DC6846AEDC}"
RootNamespace="XMonoFontDialogTest"
Keyword="MFCProj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
ValidateParameters="false"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
ValidateParameters="false"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
MinimalRebuild="false"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\About.cpp"
>
</File>
<File
RelativePath="..\src\StdAfx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\XFontSize.cpp"
>
</File>
<File
RelativePath="..\src\XHyperLink.cpp"
>
</File>
<File
RelativePath="..\src\XMonoFontDialog.cpp"
>
</File>
<File
RelativePath="..\src\XMonoFontDialogTest.cpp"
>
</File>
<File
RelativePath="..\src\XMonoFontDialogTestDlg.cpp"
>
</File>
<File
RelativePath="..\src\XMonoFontListCombo.cpp"
>
</File>
<File
RelativePath="..\src\XMonoFontListComboEdit.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\About.h"
>
</File>
<File
RelativePath="..\src\resource.h"
>
</File>
<File
RelativePath="..\src\StdAfx.h"
>
</File>
<File
RelativePath="..\src\XFontSize.h"
>
</File>
<File
RelativePath="..\src\XHyperLink.h"
>
</File>
<File
RelativePath="..\src\XMonoFontDialog.h"
>
</File>
<File
RelativePath="..\src\XMonoFontDialogRes.h"
>
</File>
<File
RelativePath="..\src\XMonoFontDialogTest.h"
>
</File>
<File
RelativePath="..\src\XMonoFontDialogTestDlg.h"
>
</File>
<File
RelativePath="..\src\XMonoFontListCombo.h"
>
</File>
<File
RelativePath="..\src\XMonoFontListComboEdit.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\src\XMonoFontDialogTest.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>