Fix warnings and modernize demo code

Fix wxFont, wxPen and wxBrush style deprecation warnings.
Add wxFALLTHROUGH to resolve implicit fallthrough warnings in switch statements.
Fix build error when using long for GetTextExtent (with wxUSE_GRID 0).
Remove unused icon from fractal demo.
This commit is contained in:
Maarten Bent
2017-11-25 17:39:44 +01:00
parent dc6858d905
commit 4d8fad3d80
12 changed files with 32 additions and 39 deletions

View File

@@ -33,14 +33,6 @@ void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
wxString buf;
wxCoord chw, chh;
wxColour wxYellow = wxTheColourDatabase->Find(wxT("YELLOW"));
wxColour wxFocused = wxTheColourDatabase->Find(wxT("GREY"));
wxPen *bluePen = wxThePenList->FindOrCreatePen(*wxBLUE, 1, wxSOLID);
wxBrush *focusedBrush = wxTheBrushList->FindOrCreateBrush(wxFocused, wxSOLID);
wxBrush *yellowBrush = wxTheBrushList->FindOrCreateBrush(wxYellow, wxSOLID);
dc->SetPen(*wxBLACK_PEN);
int x, y;
@@ -52,8 +44,7 @@ void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
dc->DrawLine(0, y*m_cellHeight*Y_UNIT, xMax, y*m_cellHeight*Y_UNIT);
wxFont font= BOMBS_FONT;
dc->SetFont(font);
dc->SetFont(BOMBS_FONT);
for(x=xc1; x<=xc2; x++)
for(y=yc1; y<=yc2; y++)
@@ -63,7 +54,7 @@ void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
dc->SetPen(*wxBLACK_PEN);
if (m_game->IsFocussed(x, y))
dc->SetBrush(*focusedBrush);
dc->SetBrush(*wxMEDIUM_GREY_BRUSH);
else
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
@@ -94,7 +85,7 @@ void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
{
dc->SetPen(*wxBLACK_PEN);
if (m_game->IsFocussed(x, y))
dc->SetBrush(*focusedBrush);
dc->SetBrush(*wxMEDIUM_GREY_BRUSH);
else
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
@@ -116,7 +107,7 @@ void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
y*m_cellHeight*Y_UNIT + (m_cellHeight*Y_UNIT-chh)/2);
if (m_game->IsExploded(x,y))
{
dc->SetPen(*bluePen);
dc->SetPen(*wxBLUE_PEN);
dc->DrawLine(x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
(x+1)*m_cellWidth*X_UNIT, (y+1)*m_cellHeight*Y_UNIT);
dc->DrawLine(x*m_cellWidth*X_UNIT, (y+1)*m_cellHeight*Y_UNIT,
@@ -127,11 +118,11 @@ void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
{
dc->SetPen(*wxBLACK_PEN);
if (m_game->IsFocussed(x, y))
dc->SetBrush(*focusedBrush);
dc->SetBrush(*wxMEDIUM_GREY_BRUSH);
else if (m_game->IsSelected(x,y))
dc->SetBrush(*wxWHITE_BRUSH);
else
dc->SetBrush(*yellowBrush);
dc->SetBrush(*wxYELLOW_BRUSH);
dc->DrawRectangle( x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
m_cellWidth*X_UNIT+1, m_cellHeight*Y_UNIT+1);