Add range limit UI to symbol view.

This commit is contained in:
Bartosz Taudul 2020-08-09 21:11:18 +02:00
parent 900fbe5df8
commit 85f54499fe
2 changed files with 44 additions and 4 deletions

View File

@ -1106,7 +1106,6 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view )
{
ImGui::RadioButton( "Assembly", &m_displayMode, DisplayAsm );
}
ImGui::PopStyleVar();
if( !m_asm.empty() )
{
@ -1148,8 +1147,47 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view )
ImGui::Spacing();
ImGui::SameLine();
TextFocused( ICON_FA_EYE_DROPPER " Samples:", RealToString( iptotalAsm ) );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
if( !worker.AreSymbolSamplesReady() )
{
view.m_statRange.active = false;
bool val = false;
ImGui::PushItemFlag( ImGuiItemFlags_Disabled, true );
ImGui::PushStyleVar( ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f );
ImGui::Checkbox( "Limit range", &val );
ImGui::PopItemFlag();
ImGui::PopStyleVar();
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Waiting for background tasks to finish" );
ImGui::EndTooltip();
}
}
else
{
if( ImGui::Checkbox( "Limit range", &view.m_statRange.active ) )
{
if( view.m_statRange.active && view.m_statRange.min == 0 && view.m_statRange.max == 0 )
{
const auto& vd = view.GetViewData();
view.m_statRange.min = vd.zvStart;
view.m_statRange.max = vd.zvEnd;
}
}
if( view.m_statRange.active )
{
ImGui::SameLine();
TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE );
ImGui::SameLine();
ToggleButton( ICON_FA_RULER " Limits", view.m_showRanges );
}
}
}
ImGui::PopStyleVar();
ImGui::Separator();
uint64_t jumpOut = 0;

View File

@ -94,6 +94,11 @@ public:
const char* SourceSubstitution( const char* srcFile ) const;
void ShowSampleParents( uint64_t symAddr ) { m_sampleParents.symAddr = symAddr; m_sampleParents.sel = 0; }
const ViewData& GetViewData() const { return m_vd; }
bool m_showRanges = false;
Range m_statRange;
private:
enum class Namespace : uint8_t
@ -341,8 +346,6 @@ private:
bool m_reactToCrash = false;
ImGuiTextFilter m_statisticsFilter;
Range m_statRange;
RangeSlim m_statRangeSlim;
Region m_highlight;
Region m_highlightZoom;
@ -359,7 +362,6 @@ private:
bool m_showPlayback = false;
bool m_showCpuDataWindow = false;
bool m_showAnnotationList = false;
bool m_showRanges = false;
enum class CpuDataSortBy
{