From a49d3f41612545f3839b0ea9226f3c3129d4759b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Jan 2014 22:20:36 +0000 Subject: [PATCH] Fix tons of warnings in wxMSW after deprecating wxPen/wxBrush int styles &c. Replacement of FUTURE_WXWIN_COMPATIBILITY_3_0 with WXWIN_COMPATIBILITY_3_0 in r75532 resulted in tons of warnings as all code using wxSOLID and similar constants now uses the deprecated methods taking int instead of the preferred ones taking wx{Pen,Brush}Style (and similarly for wxFont{Style,Weight,Family}). Fix all of them but this also would seem to mean that this change might not be such a good idea at all. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/aui/auibook.cpp | 4 +-- src/aui/tabart.cpp | 4 +-- src/common/dcgraph.cpp | 8 ++--- src/generic/calctrlg.cpp | 4 +-- src/generic/grid.cpp | 2 +- src/html/htmlcell.cpp | 5 ++- src/propgrid/advprops.cpp | 12 +++---- src/propgrid/editors.cpp | 2 +- src/propgrid/property.cpp | 4 +-- src/propgrid/propgrid.cpp | 8 ++--- src/richtext/richtextbuffer.cpp | 56 ++++++++++++++++----------------- src/xrc/xmlres.cpp | 26 +++++++-------- 12 files changed, 67 insertions(+), 68 deletions(-) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 2d1787ee0a..29a06eabf7 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -1686,7 +1686,7 @@ void wxAuiNotebook::InitNotebook(long style) m_normalFont = *wxNORMAL_FONT; m_selectedFont = *wxNORMAL_FONT; - m_selectedFont.SetWeight(wxBOLD); + m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); SetArtProvider(new wxAuiDefaultTabArt); @@ -3236,7 +3236,7 @@ bool wxAuiNotebook::SetFont(const wxFont& font) wxFont normalFont(font); wxFont selectedFont(normalFont); - selectedFont.SetWeight(wxBOLD); + selectedFont.SetWeight(wxFONTWEIGHT_BOLD); SetNormalFont(normalFont); SetSelectedFont(selectedFont); diff --git a/src/aui/tabart.cpp b/src/aui/tabart.cpp index f736f0b6e5..bc37671da8 100644 --- a/src/aui/tabart.cpp +++ b/src/aui/tabart.cpp @@ -156,7 +156,7 @@ wxAuiGenericTabArt::wxAuiGenericTabArt() { m_normalFont = *wxNORMAL_FONT; m_selectedFont = *wxNORMAL_FONT; - m_selectedFont.SetWeight(wxBOLD); + m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); m_measuringFont = m_selectedFont; m_fixedTabWidth = 100; @@ -851,7 +851,7 @@ wxAuiSimpleTabArt::wxAuiSimpleTabArt() { m_normalFont = *wxNORMAL_FONT; m_selectedFont = *wxNORMAL_FONT; - m_selectedFont.SetWeight(wxBOLD); + m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); m_measuringFont = m_selectedFont; m_flags = 0; diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index a44ac2cb91..74c0e55063 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -231,9 +231,9 @@ void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, if ( bmp.GetDepth() == 1 ) { m_graphicContext->SetPen(*wxTRANSPARENT_PEN); - m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) ); + m_graphicContext->SetBrush(m_textBackgroundColour); m_graphicContext->DrawRectangle( x, y, w, h ); - m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) ); + m_graphicContext->SetBrush(m_textForegroundColour); m_graphicContext->DrawBitmap( bmp, x, y, w, h ); m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush)); m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen)); @@ -921,7 +921,7 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, if ( m_backgroundMode == wxTRANSPARENT ) m_graphicContext->DrawText( str, x ,y , DegToRad(angle )); else - m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); + m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush(m_textBackgroundColour) ); } void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) @@ -949,7 +949,7 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) if ( m_backgroundMode == wxTRANSPARENT ) m_graphicContext->DrawText( str, x ,y); else - m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); + m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush(m_textBackgroundColour) ); } bool wxGCDCImpl::CanGetTextExtent() const diff --git a/src/generic/calctrlg.cpp b/src/generic/calctrlg.cpp index 40a549fbf4..ae814e767b 100644 --- a/src/generic/calctrlg.cpp +++ b/src/generic/calctrlg.cpp @@ -916,8 +916,8 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) if ( HasFlag( wxCAL_SHOW_WEEK_NUMBERS ) && IsExposed( 0, y, m_calendarWeekWidth, m_heightRow * 6 )) { dc.SetBackgroundMode(wxTRANSPARENT); - dc.SetBrush(wxBrush(m_colHeaderBg, wxSOLID)); - dc.SetPen(wxPen(m_colHeaderBg, 1, wxSOLID)); + dc.SetBrush(wxBrush(m_colHeaderBg, wxBRUSHSTYLE_SOLID)); + dc.SetPen(wxPen(m_colHeaderBg, 1, wxPENSTYLE_SOLID)); dc.DrawRectangle( 0, y, m_calendarWeekWidth, m_heightRow * 6 ); wxDateTime date = GetStartDate(); for ( size_t i = 0; i < 6; ++i ) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 572ed18815..579076688c 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2449,7 +2449,7 @@ void wxGrid::Init() m_attrCache.attr = NULL; m_labelFont = GetFont(); - m_labelFont.SetWeight( wxBOLD ); + m_labelFont.SetWeight( wxFONTWEIGHT_BOLD ); m_rowLabelHorizAlign = wxALIGN_CENTRE; m_rowLabelVertAlign = wxALIGN_CENTRE; diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 1a40443828..cdee47bb1d 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -435,8 +435,7 @@ static void SwitchSelState(wxDC& dc, wxHtmlRenderingInfo& info, dc.SetBackgroundMode(wxSOLID); dc.SetTextForeground(info.GetStyle().GetSelectedTextColour(fg)); dc.SetTextBackground(info.GetStyle().GetSelectedTextBgColour(bg)); - dc.SetBackground(wxBrush(info.GetStyle().GetSelectedTextBgColour(bg), - wxBRUSHSTYLE_SOLID)); + dc.SetBackground(info.GetStyle().GetSelectedTextBgColour(bg)); } else { @@ -445,7 +444,7 @@ static void SwitchSelState(wxDC& dc, wxHtmlRenderingInfo& info, dc.SetTextForeground(fg); dc.SetTextBackground(bg); if ( mode != wxTRANSPARENT ) - dc.SetBackground(wxBrush(bg, mode)); + dc.SetBackground(bg); } } diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 4dc1956222..4f6940be06 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -751,7 +751,7 @@ wxVariant wxFontProperty::ChildChanged( wxVariant& thisValue, st != wxFONTSTYLE_SLANT && st != wxFONTSTYLE_ITALIC ) st = wxFONTWEIGHT_NORMAL; - font.SetStyle( st ); + font.SetStyle( static_cast(st) ); } else if ( ind == 3 ) { @@ -760,7 +760,7 @@ wxVariant wxFontProperty::ChildChanged( wxVariant& thisValue, wt != wxFONTWEIGHT_LIGHT && wt != wxFONTWEIGHT_BOLD ) wt = wxFONTWEIGHT_NORMAL; - font.SetWeight( wt ); + font.SetWeight( static_cast(wt) ); } else if ( ind == 4 ) { @@ -769,10 +769,10 @@ wxVariant wxFontProperty::ChildChanged( wxVariant& thisValue, else if ( ind == 5 ) { int fam = childValue.GetLong(); - if ( fam < wxDEFAULT || - fam > wxTELETYPE ) - fam = wxDEFAULT; - font.SetFamily( fam ); + if ( fam < wxFONTFAMILY_DEFAULT || + fam > wxFONTFAMILY_TELETYPE ) + fam = wxFONTFAMILY_DEFAULT; + font.SetFamily( static_cast(fam) ); } wxVariant newVariant; diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 3b0d7973fe..bc8a3b55d7 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -1454,7 +1454,7 @@ static void DrawSimpleCheckBox( wxDC& dc, const wxRect& rect, int box_hei, else { // Pen for bold rectangle. - wxPen linepen(useCol,2,wxSOLID); + wxPen linepen(useCol,2,wxPENSTYLE_SOLID); linepen.SetJoin(wxJOIN_MITER); // This prevents round edges. dc.SetPen(linepen); r.x++; diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index bafa791fc4..1cb4fa0ff6 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -62,7 +62,7 @@ static void wxPGDrawFocusRect( wxDC& dc, const wxRect& rect ) // Also, it seems that this code may not work in future wx versions. dc.SetLogicalFunction(wxINVERT); - wxPen pen(*wxBLACK,1,wxDOT); + wxPen pen(*wxBLACK,1,wxPENSTYLE_DOT); pen.SetCap(wxCAP_BUTT); dc.SetPen(pen); dc.SetBrush(*wxTRANSPARENT_BRUSH); @@ -244,7 +244,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect, wxPG_CUSTOM_IMAGE_WIDTH, rect.height-(wxPG_CUSTOM_IMAGE_SPACINGY*2)); - dc.SetPen( wxPen(propertyGrid->GetCellTextColour(), 1, wxSOLID) ); + dc.SetPen( wxPen(propertyGrid->GetCellTextColour(), 1, wxPENSTYLE_SOLID) ); paintdata.m_drawnWidth = imageSize.x; paintdata.m_drawnHeight = imageSize.y; diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 7e6628c825..58724127ff 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1275,7 +1275,7 @@ void wxPropertyGrid::CalculateFontAndBitmapStuff( int vspacing ) if ( !(m_windowStyle & wxPG_HIDE_MARGIN) ) m_marginWidth = m_gutterWidth*2 + m_iconWidth; - m_captionFont.SetWeight(wxBOLD); + m_captionFont.SetWeight(wxFONTWEIGHT_BOLD); GetTextExtent(wxS("jG"), &x, &y, 0, 0, &m_captionFont); m_lineHeight = m_fontHeight+(2*m_spacingy)+1; @@ -2112,8 +2112,8 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, wxBrush marginBrush(m_colMargin); wxPen marginPen(m_colMargin); - wxBrush capbgbrush(m_colCapBack,wxSOLID); - wxPen linepen(m_colLine,1,wxSOLID); + wxBrush capbgbrush(m_colCapBack,wxBRUSHSTYLE_SOLID); + wxPen linepen(m_colLine,1,wxPENSTYLE_SOLID); wxColour selBackCol; if ( isPgEnabled ) @@ -2122,7 +2122,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, selBackCol = m_colMargin; // pen that has same colour as text - wxPen outlinepen(m_colPropFore,1,wxSOLID); + wxPen outlinepen(m_colPropFore,1,wxPENSTYLE_SOLID); // // Clear margin with background colour diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 969cb5a7cf..04fc44bfde 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -773,11 +773,11 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRi { borderLeft = converter.GetPixels(borders.GetLeft().GetWidth()); wxColour col(borders.GetLeft().GetColour()); - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetLeft().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetLeft().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; wxPen pen(col, borderLeft, penStyle); dc.SetPen(pen); dc.SetBrush(*wxTRANSPARENT_BRUSH); @@ -792,11 +792,11 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRi { borderLeft = converter.GetPixels(borders.GetLeft().GetWidth()); wxColour col(borders.GetLeft().GetColour()); - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetLeft().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetLeft().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; wxPen pen(col, borderLeft, penStyle); pen.SetJoin(wxJOIN_MITER); dc.SetPen(pen); @@ -809,13 +809,13 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRi { borderLeft = converter.GetPixels(borders.GetLeft().GetWidth()); wxColour col(borders.GetLeft().GetColour()); - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetLeft().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetLeft().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; - if (borderLeft == 1 || penStyle != wxSOLID) + if (borderLeft == 1 || penStyle != wxPENSTYLE_SOLID) { wxPen pen(col, borderLeft, penStyle); dc.SetPen(pen); @@ -838,13 +838,13 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRi borderRight = converter.GetPixels(borders.GetRight().GetWidth()); wxColour col(borders.GetRight().GetColour()); - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetRight().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetRight().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; - if (borderRight == 1 || penStyle != wxSOLID) + if (borderRight == 1 || penStyle != wxPENSTYLE_SOLID) { wxPen pen(col, borderRight, penStyle); dc.SetPen(pen); @@ -867,19 +867,19 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRi borderTop = converter.GetPixels(borders.GetTop().GetWidth()); wxColour col(borders.GetTop().GetColour()); - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetRight().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetRight().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; - if (borderTop == 1 || penStyle != wxSOLID) + if (borderTop == 1 || penStyle != wxPENSTYLE_SOLID) { - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetTop().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetTop().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; wxPen pen(col, borderTop, penStyle); dc.SetPen(pen); dc.DrawLine(rect.x, rect.y, rect.x + rect.width, rect.y); @@ -899,13 +899,13 @@ bool wxRichTextObject::DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRi { borderBottom = converter.GetPixels(borders.GetBottom().GetWidth()); wxColour col(borders.GetBottom().GetColour()); - int penStyle = wxSOLID; + wxPenStyle penStyle = wxPENSTYLE_SOLID; if (borders.GetBottom().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DOTTED) - penStyle = wxDOT; + penStyle = wxPENSTYLE_DOT; else if (borders.GetBottom().GetStyle() == wxTEXT_BOX_ATTR_BORDER_DASHED) - penStyle = wxLONG_DASH; + penStyle = wxPENSTYLE_LONG_DASH; - if (borderBottom == 1 || penStyle != wxSOLID) + if (borderBottom == 1 || penStyle != wxPENSTYLE_SOLID) { wxPen pen(col, borderBottom, penStyle); dc.SetPen(pen); @@ -9254,7 +9254,7 @@ bool wxRichTextFieldTypeStandard::Draw(wxRichTextField* obj, wxDC& dc, wxRichTex { int borderSize = 1; - wxPen borderPen(m_borderColour, 1, wxSOLID); + wxPen borderPen(m_borderColour, 1, wxPENSTYLE_SOLID); wxBrush backgroundBrush(m_backgroundColour); wxColour textColour(m_textColour); @@ -9263,11 +9263,11 @@ bool wxRichTextFieldTypeStandard::Draw(wxRichTextField* obj, wxDC& dc, wxRichTex wxColour highlightColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); wxColour highlightTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); - borderPen = wxPen(highlightTextColour, 1, wxSOLID); + borderPen = wxPen(highlightTextColour, 1, wxPENSTYLE_SOLID); backgroundBrush = wxBrush(highlightColour); wxCheckSetBrush(dc, backgroundBrush); - wxCheckSetPen(dc, wxPen(highlightColour, 1, wxSOLID)); + wxCheckSetPen(dc, wxPen(highlightColour, 1, wxPENSTYLE_SOLID)); dc.DrawRectangle(rect); } diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 862eabdbab..49967c1024 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -2219,15 +2219,15 @@ wxFont wxXmlResourceHandlerImpl::GetFont(const wxString& param, wxWindow* parent isize = GetLong(wxT("size"), -1); // style - int istyle = wxNORMAL; + wxFontStyle istyle = wxFONTSTYLE_NORMAL; bool hasStyle = HasParam(wxT("style")); if (hasStyle) { wxString style = GetParamValue(wxT("style")); if (style == wxT("italic")) - istyle = wxITALIC; + istyle = wxFONTSTYLE_ITALIC; else if (style == wxT("slant")) - istyle = wxSLANT; + istyle = wxFONTSTYLE_SLANT; else if (style != wxT("normal")) { ReportParamError @@ -2239,15 +2239,15 @@ wxFont wxXmlResourceHandlerImpl::GetFont(const wxString& param, wxWindow* parent } // weight - int iweight = wxNORMAL; + wxFontWeight iweight = wxFONTWEIGHT_NORMAL; bool hasWeight = HasParam(wxT("weight")); if (hasWeight) { wxString weight = GetParamValue(wxT("weight")); if (weight == wxT("bold")) - iweight = wxBOLD; + iweight = wxFONTWEIGHT_BOLD; else if (weight == wxT("light")) - iweight = wxLIGHT; + iweight = wxFONTWEIGHT_LIGHT; else if (weight != wxT("normal")) { ReportParamError @@ -2263,17 +2263,17 @@ wxFont wxXmlResourceHandlerImpl::GetFont(const wxString& param, wxWindow* parent bool underlined = hasUnderlined ? GetBool(wxT("underlined"), false) : false; // family and facename - int ifamily = wxDEFAULT; + wxFontFamily ifamily = wxFONTFAMILY_DEFAULT; bool hasFamily = HasParam(wxT("family")); if (hasFamily) { wxString family = GetParamValue(wxT("family")); - if (family == wxT("decorative")) ifamily = wxDECORATIVE; - else if (family == wxT("roman")) ifamily = wxROMAN; - else if (family == wxT("script")) ifamily = wxSCRIPT; - else if (family == wxT("swiss")) ifamily = wxSWISS; - else if (family == wxT("modern")) ifamily = wxMODERN; - else if (family == wxT("teletype")) ifamily = wxTELETYPE; + if (family == wxT("decorative")) ifamily = wxFONTFAMILY_DECORATIVE; + else if (family == wxT("roman")) ifamily = wxFONTFAMILY_ROMAN; + else if (family == wxT("script")) ifamily = wxFONTFAMILY_SCRIPT; + else if (family == wxT("swiss")) ifamily = wxFONTFAMILY_SWISS; + else if (family == wxT("modern")) ifamily = wxFONTFAMILY_MODERN; + else if (family == wxT("teletype")) ifamily = wxFONTFAMILY_TELETYPE; else { ReportParamError