Don't use deprecated wxBOLD, wxNORMAL and similar constants.
Replace them with wxFONTWEIGHT_BOLD, wxFONTSTYLE_NORMAL or wxFONTWEIGHT_NORMAL and equivalents in the code of the library itself and in the samples. Also simplify font construction using wxFontInfo where possible to avoid specifying these constants at all if they are not needed. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1041,8 +1041,8 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
|
||||
|
||||
m_font = font;
|
||||
|
||||
int Style = m_font.GetStyle();
|
||||
int Weight = m_font.GetWeight();
|
||||
wxFontStyle Style = m_font.GetStyle();
|
||||
wxFontWeight Weight = m_font.GetWeight();
|
||||
|
||||
const char *name;
|
||||
switch (m_font.GetFamily())
|
||||
@@ -1050,16 +1050,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
|
||||
case wxTELETYPE:
|
||||
case wxMODERN:
|
||||
{
|
||||
if (Style == wxITALIC)
|
||||
if (Style == wxFONTSTYLE_ITALIC)
|
||||
{
|
||||
if (Weight == wxBOLD)
|
||||
if (Weight == wxFONTWEIGHT_BOLD)
|
||||
name = "/Courier-BoldOblique";
|
||||
else
|
||||
name = "/Courier-Oblique";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Weight == wxBOLD)
|
||||
if (Weight == wxFONTWEIGHT_BOLD)
|
||||
name = "/Courier-Bold";
|
||||
else
|
||||
name = "/Courier";
|
||||
@@ -1068,16 +1068,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
|
||||
}
|
||||
case wxROMAN:
|
||||
{
|
||||
if (Style == wxITALIC)
|
||||
if (Style == wxFONTSTYLE_ITALIC)
|
||||
{
|
||||
if (Weight == wxBOLD)
|
||||
if (Weight == wxFONTWEIGHT_BOLD)
|
||||
name = "/Times-BoldItalic";
|
||||
else
|
||||
name = "/Times-Italic";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Weight == wxBOLD)
|
||||
if (Weight == wxFONTWEIGHT_BOLD)
|
||||
name = "/Times-Bold";
|
||||
else
|
||||
name = "/Times-Roman";
|
||||
@@ -1092,16 +1092,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font )
|
||||
case wxSWISS:
|
||||
default:
|
||||
{
|
||||
if (Style == wxITALIC)
|
||||
if (Style == wxFONTSTYLE_ITALIC)
|
||||
{
|
||||
if (Weight == wxBOLD)
|
||||
if (Weight == wxFONTWEIGHT_BOLD)
|
||||
name = "/Helvetica-BoldOblique";
|
||||
else
|
||||
name = "/Helvetica-Oblique";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Weight == wxBOLD)
|
||||
if (Weight == wxFONTWEIGHT_BOLD)
|
||||
name = "/Helvetica-Bold";
|
||||
else
|
||||
name = "/Helvetica";
|
||||
@@ -2092,7 +2092,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
|
||||
/ dc.StartDoc("Test");
|
||||
/ dc.StartPage();
|
||||
/ wxCoord w,h;
|
||||
/ dc.SetFont(new wxFont(10, wxROMAN, wxNORMAL, wxNORMAL));
|
||||
/ dc.SetFont(new wxFontInfo(10).Family(wxFONTFAMILY_ROMAN));
|
||||
/ dc.GetTextExtent("Hallo",&w,&h);
|
||||
/ dc.EndPage();
|
||||
/ dc.EndDoc();
|
||||
@@ -2135,17 +2135,17 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
|
||||
case wxMODERN:
|
||||
case wxTELETYPE:
|
||||
{
|
||||
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBoO.afm");
|
||||
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBo.afm");
|
||||
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("CourO.afm");
|
||||
if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("CourBoO.afm");
|
||||
else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("CourBo.afm");
|
||||
else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("CourO.afm");
|
||||
else name = wxT("Cour.afm");
|
||||
break;
|
||||
}
|
||||
case wxROMAN:
|
||||
{
|
||||
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBoO.afm");
|
||||
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBo.afm");
|
||||
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("TimesO.afm");
|
||||
if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("TimesBoO.afm");
|
||||
else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("TimesBo.afm");
|
||||
else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("TimesO.afm");
|
||||
else name = wxT("TimesRo.afm");
|
||||
break;
|
||||
}
|
||||
@@ -2157,9 +2157,9 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
|
||||
case wxSWISS:
|
||||
default:
|
||||
{
|
||||
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBoO.afm");
|
||||
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBo.afm");
|
||||
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("HelvO.afm");
|
||||
if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("HelvBoO.afm");
|
||||
else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("HelvBo.afm");
|
||||
else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("HelvO.afm");
|
||||
else name = wxT("Helv.afm");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ static const wxChar *wxFontWeightIntToString(int weight)
|
||||
{
|
||||
switch (weight)
|
||||
{
|
||||
case wxLIGHT:
|
||||
case wxFONTWEIGHT_LIGHT:
|
||||
return wxT("Light");
|
||||
case wxBOLD:
|
||||
case wxFONTWEIGHT_BOLD:
|
||||
return wxT("Bold");
|
||||
case wxNORMAL:
|
||||
case wxFONTWEIGHT_NORMAL:
|
||||
default:
|
||||
return wxT("Normal");
|
||||
}
|
||||
@@ -108,11 +108,11 @@ static const wxChar *wxFontStyleIntToString(int style)
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
case wxITALIC:
|
||||
case wxFONTSTYLE_ITALIC:
|
||||
return wxT("Italic");
|
||||
case wxSLANT:
|
||||
case wxFONTSTYLE_SLANT:
|
||||
return wxT("Slant");
|
||||
case wxNORMAL:
|
||||
case wxFONTSTYLE_NORMAL:
|
||||
default:
|
||||
return wxT("Normal");
|
||||
}
|
||||
@@ -122,62 +122,62 @@ static const wxChar *wxFontFamilyIntToString(int family)
|
||||
{
|
||||
switch (family)
|
||||
{
|
||||
case wxROMAN:
|
||||
case wxFONTFAMILY_ROMAN:
|
||||
return wxT("Roman");
|
||||
case wxDECORATIVE:
|
||||
case wxFONTFAMILY_DECORATIVE:
|
||||
return wxT("Decorative");
|
||||
case wxMODERN:
|
||||
case wxFONTFAMILY_MODERN:
|
||||
return wxT("Modern");
|
||||
case wxSCRIPT:
|
||||
case wxFONTFAMILY_SCRIPT:
|
||||
return wxT("Script");
|
||||
case wxTELETYPE:
|
||||
case wxFONTFAMILY_TELETYPE:
|
||||
return wxT("Teletype");
|
||||
case wxSWISS:
|
||||
case wxFONTFAMILY_SWISS:
|
||||
default:
|
||||
return wxT("Swiss");
|
||||
}
|
||||
}
|
||||
|
||||
static int wxFontFamilyStringToInt(const wxString& family)
|
||||
static wxFontFamily wxFontFamilyStringToInt(const wxString& family)
|
||||
{
|
||||
if (family.empty())
|
||||
return wxSWISS;
|
||||
return wxFONTFAMILY_SWISS;
|
||||
|
||||
if (wxStrcmp(family, wxT("Roman")) == 0)
|
||||
return wxROMAN;
|
||||
return wxFONTFAMILY_ROMAN;
|
||||
else if (wxStrcmp(family, wxT("Decorative")) == 0)
|
||||
return wxDECORATIVE;
|
||||
return wxFONTFAMILY_DECORATIVE;
|
||||
else if (wxStrcmp(family, wxT("Modern")) == 0)
|
||||
return wxMODERN;
|
||||
return wxFONTFAMILY_MODERN;
|
||||
else if (wxStrcmp(family, wxT("Script")) == 0)
|
||||
return wxSCRIPT;
|
||||
return wxFONTFAMILY_SCRIPT;
|
||||
else if (wxStrcmp(family, wxT("Teletype")) == 0)
|
||||
return wxTELETYPE;
|
||||
else return wxSWISS;
|
||||
return wxFONTFAMILY_TELETYPE;
|
||||
else return wxFONTFAMILY_SWISS;
|
||||
}
|
||||
|
||||
static int wxFontStyleStringToInt(const wxString& style)
|
||||
static wxFontStyle wxFontStyleStringToInt(const wxString& style)
|
||||
{
|
||||
if (style.empty())
|
||||
return wxNORMAL;
|
||||
return wxFONTSTYLE_NORMAL;
|
||||
if (wxStrcmp(style, wxT("Italic")) == 0)
|
||||
return wxITALIC;
|
||||
return wxFONTSTYLE_ITALIC;
|
||||
else if (wxStrcmp(style, wxT("Slant")) == 0)
|
||||
return wxSLANT;
|
||||
return wxFONTSTYLE_SLANT;
|
||||
else
|
||||
return wxNORMAL;
|
||||
return wxFONTSTYLE_NORMAL;
|
||||
}
|
||||
|
||||
static int wxFontWeightStringToInt(const wxString& weight)
|
||||
static wxFontWeight wxFontWeightStringToInt(const wxString& weight)
|
||||
{
|
||||
if (weight.empty())
|
||||
return wxNORMAL;
|
||||
return wxFONTWEIGHT_NORMAL;
|
||||
if (wxStrcmp(weight, wxT("Bold")) == 0)
|
||||
return wxBOLD;
|
||||
return wxFONTWEIGHT_BOLD;
|
||||
else if (wxStrcmp(weight, wxT("Light")) == 0)
|
||||
return wxLIGHT;
|
||||
return wxFONTWEIGHT_LIGHT;
|
||||
else
|
||||
return wxNORMAL;
|
||||
return wxFONTWEIGHT_NORMAL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -543,9 +543,9 @@ void wxGenericFontDialog::CreateWidgets()
|
||||
|
||||
void wxGenericFontDialog::InitializeFont()
|
||||
{
|
||||
int fontFamily = wxSWISS;
|
||||
int fontWeight = wxNORMAL;
|
||||
int fontStyle = wxNORMAL;
|
||||
wxFontFamily fontFamily = wxFONTFAMILY_SWISS;
|
||||
wxFontWeight fontWeight = wxFONTWEIGHT_NORMAL;
|
||||
wxFontStyle fontStyle = wxFONTSTYLE_NORMAL;
|
||||
int fontSize = 12;
|
||||
bool fontUnderline = false;
|
||||
|
||||
@@ -574,9 +574,9 @@ void wxGenericFontDialog::DoChangeFont()
|
||||
{
|
||||
if (!m_useEvents) return;
|
||||
|
||||
int fontFamily = wxFontFamilyStringToInt(m_familyChoice->GetStringSelection());
|
||||
int fontWeight = wxFontWeightStringToInt(m_weightChoice->GetStringSelection());
|
||||
int fontStyle = wxFontStyleStringToInt(m_styleChoice->GetStringSelection());
|
||||
wxFontFamily fontFamily = wxFontFamilyStringToInt(m_familyChoice->GetStringSelection());
|
||||
wxFontWeight fontWeight = wxFontWeightStringToInt(m_weightChoice->GetStringSelection());
|
||||
wxFontStyle fontStyle = wxFontStyleStringToInt(m_styleChoice->GetStringSelection());
|
||||
#if USE_SPINCTRL_FOR_POINT_SIZE
|
||||
wxSpinCtrl* fontSizeCtrl = wxDynamicCast(FindWindow(wxID_FONT_SIZE), wxSpinCtrl);
|
||||
int fontSize = fontSizeCtrl->GetValue();
|
||||
|
||||
@@ -7254,9 +7254,9 @@ void wxGrid::SetColLabelAlignment( int horiz, int vert )
|
||||
// Note: under MSW, the default column label font must be changed because it
|
||||
// does not support vertical printing
|
||||
//
|
||||
// Example: wxFont font(9, wxSWISS, wxNORMAL, wxBOLD);
|
||||
// pGrid->SetLabelFont(font);
|
||||
// pGrid->SetColLabelTextOrientation(wxVERTICAL);
|
||||
// Example:
|
||||
// pGrid->SetLabelFont(wxFontInfo(9).Family(wxFONTFAMILY_SWISS));
|
||||
// pGrid->SetColLabelTextOrientation(wxVERTICAL);
|
||||
//
|
||||
void wxGrid::SetColLabelTextOrientation( int textOrientation )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user