Debug and clean the game tab code

This commit is contained in:
Loic Guegan 2023-01-01 12:15:08 +01:00
parent 1eb91c5926
commit 5607057ac3
9 changed files with 89 additions and 121 deletions

View file

@ -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){