Optional namespace shortening for ghost zones.

This commit is contained in:
Bartosz Taudul 2020-11-14 16:23:35 +01:00
parent 2ac7048248
commit 81dcd2c767

View File

@ -4081,13 +4081,19 @@ int View::DrawGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns,
const auto& sym = frame->data[ghostKey.inlineFrame];
const auto isInline = ghostKey.inlineFrame != frame->size-1;
const auto col = isInline ? DarkenColor( color ) : color;
const auto symName = m_worker.GetString( sym.name );
auto symName = m_worker.GetString( sym.name );
uint32_t txtColor = symName[0] == '[' ? 0xFF999999 : 0xFFFFFFFF;
const auto tsz = ImGui::CalcTextSize( symName );
auto tsz = ImGui::CalcTextSize( symName );
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), col );
draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), outline, 0.f, -1 );
if( tsz.x > zsz )
{
symName = ShortenNamespace( symName );
tsz = ImGui::CalcTextSize( symName );
}
if( tsz.x < zsz )
{
const auto x = ( ev.start.Val() - m_vd.zvStart ) * pxns + ( ( end - ev.start.Val() ) * pxns - tsz.x ) / 2;