diff --git a/src/gui/efglayout.cc b/src/gui/efglayout.cc index 145cbc22d..6e41cf11d 100644 --- a/src/gui/efglayout.cc +++ b/src/gui/efglayout.cc @@ -67,8 +67,28 @@ void TreeLayout::DrawNode(wxDC &p_dc, const std::shared_ptr &p_entry, } const auto color = m_doc->GetStyle().GetPlayerColor(p_entry->m_node->GetPlayer()); - p_dc.SetPen(*wxThePenList->FindOrCreatePen(color, (p_selection == p_entry->m_node) ? 6 : 3, - wxPENSTYLE_SOLID)); + const bool selected = (p_selection == p_entry->m_node); + + if (selected) { + constexpr int selectionPadding = 6; + const int selectionSize = p_entry->m_size + 2 * selectionPadding; + + p_dc.SetPen(*wxTRANSPARENT_PEN); + p_dc.SetBrush(wxBrush(wxColour(235, 235, 235), wxBRUSHSTYLE_SOLID)); + + if (GetTokenForNode(m_doc->GetStyle(), p_entry->m_node) == GBT_NODE_TOKEN_LINE) { + p_dc.DrawRoundedRectangle(p_entry->m_x - selectionPadding, p_entry->m_y - selectionPadding, + p_entry->m_size + 2 * selectionPadding, 2 * selectionPadding, + selectionPadding); + } + else { + p_dc.DrawEllipse(p_entry->m_x - selectionPadding, + p_entry->m_y - p_entry->m_size / 2 - selectionPadding, selectionSize, + selectionSize); + } + } + + p_dc.SetPen(*wxThePenList->FindOrCreatePen(color, 3, wxPENSTYLE_SOLID)); p_dc.SetTextForeground(color); if (GetTokenForNode(m_doc->GetStyle(), p_entry->m_node) == GBT_NODE_TOKEN_LINE) { @@ -106,6 +126,25 @@ void TreeLayout::DrawNode(wxDC &p_dc, const std::shared_ptr &p_entry, p_entry->m_size); } + if (selected) { + constexpr int selectionPadding = 6; + const int selectionSize = p_entry->m_size + 2 * selectionPadding; + + p_dc.SetBrush(*wxTRANSPARENT_BRUSH); + p_dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxPENSTYLE_SOLID)); + + if (GetTokenForNode(m_doc->GetStyle(), p_entry->m_node) == GBT_NODE_TOKEN_LINE) { + p_dc.DrawRoundedRectangle(p_entry->m_x - selectionPadding, p_entry->m_y - selectionPadding, + p_entry->m_size + 2 * selectionPadding, 2 * selectionPadding, + selectionPadding); + } + else { + p_dc.DrawEllipse(p_entry->m_x - selectionPadding, + p_entry->m_y - p_entry->m_size / 2 - selectionPadding, selectionSize, + selectionSize); + } + } + int textWidth, textHeight; p_dc.SetFont(m_doc->GetStyle().GetFont()); p_dc.GetTextExtent(p_entry->m_nodeAboveLabel, &textWidth, &textHeight);