Font fixes for the font dialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16459 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9bc138582e
commit
07df68c89a
@ -22,20 +22,40 @@
|
||||
|
||||
class WXDLLEXPORT wxFontDialog: public wxFontDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
||||
public:
|
||||
wxFontDialog();
|
||||
wxFontDialog(wxWindow *parent, const wxFontData& rData);
|
||||
wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
|
||||
wxFontDialog (wxWindow* pParent) : wxFontDialogBase(pParent) { Create(pParent); }
|
||||
wxFontDialog( wxWindow* pParent
|
||||
,const wxFontData& rData
|
||||
)
|
||||
: wxFontDialogBase( pParent
|
||||
,rData
|
||||
)
|
||||
{
|
||||
Create( pParent
|
||||
,rData
|
||||
);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, const wxFontData& rData);
|
||||
virtual int ShowModal();
|
||||
|
||||
int ShowModal();
|
||||
wxFontData& GetFontData() { return m_fontData; }
|
||||
|
||||
//EK protected:
|
||||
wxWindow* m_dialogParent;
|
||||
wxFontData m_fontData;
|
||||
};
|
||||
//
|
||||
// Deprecated interface, don't use
|
||||
//
|
||||
wxFontDialog( wxWindow* pParent
|
||||
,const wxFontData* pData
|
||||
)
|
||||
: wxFontDialogBase( pParent
|
||||
,pData
|
||||
)
|
||||
{
|
||||
Create( pParent
|
||||
,pData
|
||||
);
|
||||
}
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
||||
}; // end of CLASS wxFontDialog
|
||||
|
||||
#endif
|
||||
// _WX_FONTDLG_H_
|
||||
|
@ -351,7 +351,7 @@ void wxFontRefData::Init(
|
||||
if (m_hPS == NULLHANDLE)
|
||||
{
|
||||
m_hPS = ::WinGetPS(HWND_DESKTOP);
|
||||
m_bInternalPS;
|
||||
m_bInternalPS = TRUE;
|
||||
}
|
||||
else
|
||||
m_hPS = (HPS)hPS;
|
||||
@ -386,7 +386,15 @@ bool wxFontRefData::Alloc(
|
||||
);
|
||||
m_bNativeFontInfoOk = TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (flId == 0L)
|
||||
flId = 1L;
|
||||
else
|
||||
flId++;
|
||||
if (flId > 254)
|
||||
flId = 1L;
|
||||
}
|
||||
if((lRc = ::GpiCreateLogFont( m_hPS
|
||||
,NULL
|
||||
,flId
|
||||
@ -418,23 +426,33 @@ bool wxFontRefData::Alloc(
|
||||
// The GpiCreateLogFont will do enough by selecting the right family,
|
||||
// and face name.
|
||||
//
|
||||
if (strcmp(m_vNativeFontInfo.fa.szFacename, "Times New Roman") == 0)
|
||||
if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Times New Roman") == 0)
|
||||
m_nFamily = wxROMAN;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Tms Rmn") == 0)
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Times New Roman MT 30") == 0)
|
||||
m_nFamily = wxROMAN;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "@Times New Roman MT 30") == 0)
|
||||
m_nFamily = wxROMAN;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Tms Rmn") == 0)
|
||||
m_nFamily = wxROMAN;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "WarpSans") == 0)
|
||||
m_nFamily = wxDECORATIVE;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Helvitica") == 0)
|
||||
m_nFamily = wxSWISS;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "WarpSans") == 0)
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Helv") == 0)
|
||||
m_nFamily = wxSWISS;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Helvitica") == 0)
|
||||
m_nFamily = wxSWISS;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Helv") == 0)
|
||||
m_nFamily = wxSWISS;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Script") == 0)
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Script") == 0)
|
||||
m_nFamily = wxSCRIPT;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier New") == 0)
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Courier New") == 0)
|
||||
m_nFamily = wxTELETYPE;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier") == 0)
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Courier") == 0)
|
||||
m_nFamily = wxTELETYPE;
|
||||
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "System VIO") == 0)
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "System Monospaced") == 0)
|
||||
m_nFamily = wxTELETYPE;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "System VIO") == 0)
|
||||
m_nFamily = wxTELETYPE;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "System Proportional") == 0)
|
||||
m_nFamily = wxMODERN;
|
||||
else if (strcmp(m_vNativeFontInfo.fm.szFamilyname, "Arial") == 0)
|
||||
m_nFamily = wxMODERN;
|
||||
else
|
||||
m_nFamily = wxSWISS;
|
||||
@ -567,13 +585,33 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
|
||||
//
|
||||
// Extract family from facename
|
||||
//
|
||||
if (strcmp(fa.szFacename, "Times New Roman") == 0)
|
||||
if (strcmp(fm.szFamilyname, "Times New Roman") == 0)
|
||||
nFamily = wxROMAN;
|
||||
else if (strcmp(fa.szFacename, "WarpSans") == 0)
|
||||
else if (strcmp(fm.szFamilyname, "Times New Roman MT 30") == 0)
|
||||
nFamily = wxROMAN;
|
||||
else if (strcmp(fm.szFamilyname, "@Times New Roman MT 30") == 0)
|
||||
nFamily = wxROMAN;
|
||||
else if (strcmp(fm.szFamilyname, "Tms Rmn") == 0)
|
||||
nFamily = wxROMAN;
|
||||
else if (strcmp(fm.szFamilyname, "WarpSans") == 0)
|
||||
nFamily = wxDECORATIVE;
|
||||
else if (strcmp(fm.szFamilyname, "Helvitica") == 0)
|
||||
nFamily = wxSWISS;
|
||||
else if (strcmp(fa.szFacename, "Script") == 0)
|
||||
else if (strcmp(fm.szFamilyname, "Helv") == 0)
|
||||
nFamily = wxSWISS;
|
||||
else if (strcmp(fm.szFamilyname, "Script") == 0)
|
||||
nFamily = wxSCRIPT;
|
||||
else if (strcmp(fa.szFacename, "Courier New") == 0)
|
||||
else if (strcmp(fm.szFamilyname, "Courier New") == 0)
|
||||
nFamily = wxTELETYPE;
|
||||
else if (strcmp(fm.szFamilyname, "Courier") == 0)
|
||||
nFamily = wxTELETYPE;
|
||||
else if (strcmp(fm.szFamilyname, "System Monospaced") == 0)
|
||||
nFamily = wxTELETYPE;
|
||||
else if (strcmp(fm.szFamilyname, "System VIO") == 0)
|
||||
nFamily = wxTELETYPE;
|
||||
else if (strcmp(fm.szFamilyname, "System Proportional") == 0)
|
||||
nFamily = wxMODERN;
|
||||
else if (strcmp(fm.szFamilyname, "Arial") == 0)
|
||||
nFamily = wxMODERN;
|
||||
else
|
||||
nFamily = wxSWISS;
|
||||
@ -660,29 +698,32 @@ void wxNativeFontInfo::SetFamily(
|
||||
switch (eFamily)
|
||||
{
|
||||
case wxSCRIPT:
|
||||
sFacename = _T("Script");
|
||||
sFacename = wxT("Script");
|
||||
break;
|
||||
|
||||
case wxDECORATIVE:
|
||||
sFacename = _T("Times New Roman");
|
||||
sFacename = wxT("WarpSans");
|
||||
break;
|
||||
|
||||
case wxROMAN:
|
||||
sFacename = _T("Times New Roman");
|
||||
sFacename = wxT("Times New Roman");
|
||||
break;
|
||||
|
||||
case wxTELETYPE:
|
||||
sFacename = wxT("Courier New") ;
|
||||
break;
|
||||
|
||||
case wxMODERN:
|
||||
sFacename = _T("Courier New");
|
||||
sFacename = wxT("Arial") ;
|
||||
break;
|
||||
|
||||
case wxSWISS:
|
||||
sFacename = _T("WarpSans");
|
||||
sFacename = wxT("Helv") ;
|
||||
break;
|
||||
|
||||
case wxDEFAULT:
|
||||
default:
|
||||
sFacename = _T("Helv");
|
||||
sFacename = wxT("System Proportional") ;
|
||||
}
|
||||
|
||||
if (!wxStrlen(fa.szFacename) )
|
||||
|
@ -32,35 +32,87 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define wxDIALOG_DEFAULT_X 300
|
||||
#define wxDIALOG_DEFAULT_Y 300
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
||||
|
||||
/*
|
||||
* wxFontDialog
|
||||
*/
|
||||
wxFontDialog::wxFontDialog()
|
||||
{
|
||||
m_dialogParent = NULL;
|
||||
}
|
||||
|
||||
wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData& rData)
|
||||
{
|
||||
Create(parent, rData);
|
||||
}
|
||||
|
||||
bool wxFontDialog::Create(wxWindow *parent, const wxFontData& rData)
|
||||
{
|
||||
m_dialogParent = parent;
|
||||
|
||||
m_fontData = rData;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxFontDialog::ShowModal()
|
||||
{
|
||||
// TODO: show (maybe create) the dialog
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
FONTDLG vFontDlg;
|
||||
char zCurrentFont[FACESIZE];
|
||||
HWND hWndFontDlg;
|
||||
FONTMETRICS vFm;
|
||||
FACENAMEDESC vFn;
|
||||
|
||||
memset(&vFontDlg, '\0', sizeof(FONTDLG));
|
||||
zCurrentFont[0] = '\0';
|
||||
|
||||
//
|
||||
// Set the fontdlg fields
|
||||
//
|
||||
vFontDlg.cbSize = sizeof(FONTDLG);
|
||||
vFontDlg.hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
|
||||
vFontDlg.hpsPrinter = NULL;
|
||||
vFontDlg.pszFamilyname = zCurrentFont;
|
||||
vFontDlg.fxPointSize = MAKEFIXED(12,0);
|
||||
vFontDlg.usFamilyBufLen = FACESIZE;
|
||||
vFontDlg.fl = FNTS_CENTER;
|
||||
vFontDlg.clrFore = CLR_BLACK;
|
||||
vFontDlg.clrBack = CLR_WHITE;
|
||||
|
||||
hWndFontDlg = WinFontDlg( HWND_DESKTOP
|
||||
,GetParent()->GetHWND()
|
||||
,&vFontDlg
|
||||
);
|
||||
if (hWndFontDlg && vFontDlg.lReturn == DID_OK)
|
||||
{
|
||||
wxColour vColour((unsigned long)0x00000000);
|
||||
wxNativeFontInfo vInfo;
|
||||
|
||||
m_fontData.fontColour = vColour;
|
||||
|
||||
memset(&vFn, '\0', sizeof(FACENAMEDESC));
|
||||
vFn.usSize = sizeof(FACENAMEDESC);
|
||||
vFn.usWeightClass = vFontDlg.usWeight;
|
||||
vFn.usWidthClass = vFontDlg.usWidth;
|
||||
|
||||
memcpy(&vInfo.fa, &vFontDlg.fAttrs, sizeof(FATTRS));
|
||||
memcpy(&vInfo.fn, &vFn, sizeof(FACENAMEDESC));
|
||||
|
||||
//
|
||||
// Debugging
|
||||
//
|
||||
wxFont vChosenFont(vInfo);
|
||||
int nFamily;
|
||||
int nPointSize;
|
||||
int nStyle;
|
||||
int nWeight;
|
||||
bool bUnderlined;
|
||||
wxString sFaceName;
|
||||
wxNativeFontInfo* pInfo;
|
||||
|
||||
nFamily = vChosenFont.GetFamily();
|
||||
nPointSize = vChosenFont.GetPointSize();
|
||||
nStyle = vChosenFont.GetStyle();
|
||||
nWeight = vChosenFont.GetWeight();
|
||||
bUnderlined = vChosenFont.GetUnderlined();
|
||||
sFaceName = vChosenFont.GetFaceName();
|
||||
pInfo = vChosenFont.GetNativeFontInfo();
|
||||
|
||||
|
||||
m_fontData.chosenFont = vChosenFont;
|
||||
|
||||
nFamily = m_fontData.chosenFont.GetFamily();
|
||||
nPointSize = m_fontData.chosenFont.GetPointSize();
|
||||
nStyle = m_fontData.chosenFont.GetStyle();
|
||||
nWeight = m_fontData.chosenFont.GetWeight();
|
||||
bUnderlined = m_fontData.chosenFont.GetUnderlined();
|
||||
sFaceName = m_fontData.chosenFont.GetFaceName();
|
||||
pInfo = m_fontData.chosenFont.GetNativeFontInfo();
|
||||
|
||||
m_fontData.EncodingInfo().facename = vFontDlg.fAttrs.szFacename;
|
||||
m_fontData.EncodingInfo().charset = vFontDlg.fAttrs.usCodePage;
|
||||
|
||||
return wxID_OK;
|
||||
}
|
||||
return wxID_CANCEL;
|
||||
} // end of wxFontDialg::ShowModal
|
||||
|
||||
|
@ -453,16 +453,19 @@ void wxOS2SelectMatchingFontByName(
|
||||
break;
|
||||
|
||||
case wxDECORATIVE:
|
||||
sFaceName = wxT("WarpSans");
|
||||
break;
|
||||
|
||||
case wxROMAN:
|
||||
sFaceName = wxT("Tms Rmn");
|
||||
sFaceName = wxT("Times New Roman");
|
||||
break;
|
||||
|
||||
case wxTELETYPE:
|
||||
sFaceName = wxT("Courier") ;
|
||||
sFaceName = wxT("Courier New") ;
|
||||
break;
|
||||
|
||||
case wxMODERN:
|
||||
sFaceName = wxT("System VIO") ;
|
||||
sFaceName = wxT("Arial") ;
|
||||
break;
|
||||
|
||||
case wxSWISS:
|
||||
@ -471,7 +474,7 @@ void wxOS2SelectMatchingFontByName(
|
||||
|
||||
case wxDEFAULT:
|
||||
default:
|
||||
sFaceName = wxT("System VIO") ;
|
||||
sFaceName = wxT("System Proportional") ;
|
||||
}
|
||||
|
||||
switch (pFont->GetWeight())
|
||||
|
@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
|
||||
CODE LOADONCALL
|
||||
|
||||
EXPORTS
|
||||
;From library: H:\DEV\WX2\WXWINDOWS\LIB\wx.lib
|
||||
;From library: F:\Dev\Wx2\WxWindows\lib\wx.lib
|
||||
;From object file: dummy.cpp
|
||||
;PUBDEFs (Symbols available from object file):
|
||||
wxDummyChar
|
||||
@ -1955,7 +1955,7 @@ EXPORTS
|
||||
wxEVT_NC_LEFT_DCLICK
|
||||
wxEVT_INIT_DIALOG
|
||||
wxEVT_COMMAND_SET_FOCUS
|
||||
;From object file: H:\DEV\WX2\WXWINDOWS\src\common\extended.c
|
||||
;From object file: F:\DEV\WX2\WXWINDOWS\src\common\extended.c
|
||||
;PUBDEFs (Symbols available from object file):
|
||||
ConvertToIeeeExtended
|
||||
ConvertFromIeeeExtended
|
||||
@ -4302,6 +4302,8 @@ EXPORTS
|
||||
ClearData__18wxMimeTypesManagerFv
|
||||
;wxArrayFileTypeInfo::operator=(const wxArrayFileTypeInfo&)
|
||||
__as__19wxArrayFileTypeInfoFRC19wxArrayFileTypeInfo
|
||||
;wxFileType::GetOpenCommand(const wxString&) const
|
||||
GetOpenCommand__10wxFileTypeCFRC8wxString
|
||||
;wxFileType::GetOpenCommand(wxString*,const wxFileType::MessageParameters&) const
|
||||
GetOpenCommand__10wxFileTypeCFP8wxStringRCQ2_10wxFileType17MessageParameters
|
||||
;wxFileType::GetMimeType(wxString*) const
|
||||
@ -6178,7 +6180,7 @@ EXPORTS
|
||||
Read32__17wxTextInputStreamFv
|
||||
;wxTextInputStream::SkipIfEndOfLine(char)
|
||||
SkipIfEndOfLine__17wxTextInputStreamFc
|
||||
;From object file: H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
|
||||
;From object file: F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
|
||||
;PUBDEFs (Symbols available from object file):
|
||||
unzReadCurrentFile
|
||||
unzGetCurrentFileInfo
|
||||
@ -12779,12 +12781,6 @@ EXPORTS
|
||||
;wxConstructorForwxFontDialog()
|
||||
wxConstructorForwxFontDialog__Fv
|
||||
__vft12wxFontDialog8wxObject
|
||||
;wxFontDialog::Create(wxWindow*,const wxFontData&)
|
||||
Create__12wxFontDialogFP8wxWindowRC10wxFontData
|
||||
;wxFontDialog::wxFontDialog(wxWindow*,const wxFontData&)
|
||||
__ct__12wxFontDialogFP8wxWindowRC10wxFontData
|
||||
;wxFontDialog::wxFontDialog()
|
||||
__ct__12wxFontDialogFv
|
||||
;wxFontDialog::ShowModal()
|
||||
ShowModal__12wxFontDialogFv
|
||||
;wxFontDialog::sm_classwxFontDialog
|
||||
|
Loading…
Reference in New Issue
Block a user