Improve drawing

This commit is contained in:
Loic Guegan 2022-12-28 10:37:57 +01:00
parent 35d9a6f0d9
commit 2151ccbe65
3 changed files with 21 additions and 16 deletions

View file

@ -37,6 +37,7 @@ wxPoint EditorCanvas::Middle(cgeditor::Element e) {
}
void EditorCanvas::DrawElement(const cgeditor::Element &e) {
// TODO: Optimize brush!!!! Always instanciated at each call
dc->SetPen(wxNullPen);
dc->SetBrush(*wxRED_BRUSH);
if (e.prop & cgeditor::Property::Rectangle) {
@ -45,7 +46,7 @@ void EditorCanvas::DrawElement(const cgeditor::Element &e) {
} else if (e.prop & cgeditor::Property::Scrollbar) {
dc->SetBrush(*wxGREY_BRUSH);
} else if (e.prop & cgeditor::Property::Margin) {
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
dc->SetBrush(wxBrush(wxColour(243,243,243)));
} else if (e.prop & cgeditor::Property::Button) {
if (e.prop & cgeditor::Property::On) {
dc->DrawBitmap(hide_icon, e.x, e.y);
@ -77,25 +78,25 @@ 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(*wxLIGHT_GREY_BRUSH);
dc->SetBrush(wxBrush(wxColour(216, 216, 216)));
dc->DrawRectangle(recToDraw);
}
dc->DrawBitmap(*t.Get(p), e.x, y);
} else if (e.prop & cgeditor::Property::Comment) {
wxRect recToDraw(e.x, e.y, e.width, e.height);
dc->SetBrush(*wxYELLOW_BRUSH);
dc->SetBrush(wxBrush(wxColour(255, 255, 204)));
dc->DrawRectangle(recToDraw);
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(*wxLIGHT_GREY_BRUSH);
dc->SetBrush(wxBrush(wxColour(216, 216, 216)));
dc->DrawRectangle(recToDraw);
dc->DrawText(wxString(e.text), wxPoint(e.x, Middle(e).y));
} else {
if (e.prop & cgeditor::Property::Move) {
if (e.prop & cgeditor::Property::Current) {
wxRect recToDraw(e.x, e.y, e.width, e.height);
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
dc->SetBrush(wxBrush(wxColour(216, 216, 216)));
dc->DrawRectangle(recToDraw);
}
if (CGEditor::status.UseMoveIcons) {