From 5607057ac33ce3b6933697134b20d7ef0b1a43be Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 1 Jan 2023 12:15:08 +0100 Subject: Debug and clean the game tab code --- src/game_tab/right_panel/editor/EditorCanvas.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/game_tab/right_panel/editor/EditorCanvas.cpp') diff --git a/src/game_tab/right_panel/editor/EditorCanvas.cpp b/src/game_tab/right_panel/editor/EditorCanvas.cpp index b65ece8..ae0c096 100644 --- a/src/game_tab/right_panel/editor/EditorCanvas.cpp +++ b/src/game_tab/right_panel/editor/EditorCanvas.cpp @@ -5,7 +5,16 @@ EditorCanvas::EditorCanvas(wxFrame *parent) hide_icon = LoadPNG("hide", wxSize(CGEditor::status.MoveIconWidth, CGEditor::status.MoveIconWidth)); t.ResizePieces(CGEditor::status.MoveIconWidth); + + // Theme: default_font=wxFont(*wxNORMAL_FONT).MakeBold(); + color_scrollbar_bg=wxColour(243,243,243); + color_scrollbar=*wxLIGHT_GREY; + color_margin=wxColour(243,243,243); + color_comments_bg=wxColour(255, 255, 204); + color_current_move_bg=wxColour(216, 216, 216); + color_menu_item_bg=wxColour(216, 216, 216); + Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();}); Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();}); } @@ -46,13 +55,13 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) { dc->SetFont(default_font); if (e.prop & cgeditor::Property::Rectangle) { if (e.prop & cgeditor::Property::Scrollbarbg) { - dc->SetBrush(wxColour(243,243,243)); + dc->SetBrush(color_scrollbar_bg); } else if (e.prop & cgeditor::Property::Scrollbar) { - dc->SetBrush(*wxGREY_BRUSH); + dc->SetBrush(color_scrollbar); } else if (e.prop & cgeditor::Property::Margin) { - dc->SetBrush(wxBrush(wxColour(243,243,243))); + dc->SetBrush(wxBrush(color_margin)); } else if (e.prop & cgeditor::Property::Comment) { - dc->SetBrush(wxBrush(wxColour(255, 255, 204))); + dc->SetBrush(wxBrush(color_comments_bg)); } else if (e.prop & cgeditor::Property::Button) { if (e.prop & cgeditor::Property::On) { dc->DrawBitmap(hide_icon, e.x, e.y); @@ -84,7 +93,7 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) { } if (e.prop & cgeditor::Property::Current) { wxRect recToDraw(e.x, e.y, e.width, e.height); - dc->SetBrush(wxBrush(wxColour(216, 216, 216))); + dc->SetBrush(wxBrush(color_current_move_bg)); dc->DrawRectangle(recToDraw); } dc->DrawBitmap(*t.Get(p), e.x, y); @@ -92,7 +101,7 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) { dc->DrawText(wxString(e.text), wxPoint(e.x, e.y)); } else if (e.prop & cgeditor::Property::Menuitem) { wxRect recToDraw(e.x, e.y, e.width, e.height); - dc->SetBrush(wxBrush(wxColour(216, 216, 216))); + dc->SetBrush(wxBrush(color_menu_item_bg)); dc->DrawRectangle(recToDraw); dc->DrawText(wxString(e.text), wxPoint(e.x, Middle(e).y)); } else { @@ -100,7 +109,7 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) { if (e.prop & cgeditor::Property::Move) { if (e.prop & cgeditor::Property::Current) { wxRect recToDraw(e.x, e.y, e.width, e.height); - dc->SetBrush(wxBrush(wxColour(216, 216, 216))); + dc->SetBrush(wxBrush(color_current_move_bg)); dc->DrawRectangle(recToDraw); } if(e.prop & cgeditor::Property::Nag){ -- cgit v1.2.3