Set source view content width to max value, regardless of clipping.

This commit is contained in:
Bartosz Taudul 2020-06-06 12:31:47 +02:00
parent 4dc07d6e60
commit ecfeb01aad
2 changed files with 16 additions and 2 deletions

View File

@ -436,6 +436,7 @@ void SourceView::ParseSource( const char* fileName, const Worker& worker, const
{
if( m_file != fileName )
{
m_srcWidth = 0;
m_file = fileName;
m_fileStringIdx = worker.FindStringIdx( fileName );
m_lines.clear();
@ -510,6 +511,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker )
m_maxJumpLevel = 0;
m_asmSelected = -1;
m_asmCountBase = -1;
m_asmWidth = 0;
if( symAddr == 0 ) return false;
m_cpuArch = worker.GetCpuArch();
if( m_cpuArch == CpuArchUnknown ) return false;
@ -889,6 +891,7 @@ void SourceView::Render( const Worker& worker, View& view )
void SourceView::RenderSimpleSourceView()
{
ImGui::SetNextWindowContentSize( ImVec2( m_srcWidth, 0 ) );
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true, ImGuiWindowFlags_HorizontalScrollbar );
if( m_font ) ImGui::PushFont( m_font );
@ -915,6 +918,8 @@ void SourceView::RenderSimpleSourceView()
}
RenderLine( line, lineNum++, 0, 0, 0, nullptr );
}
const auto& win = ImGui::GetCurrentWindow();
m_srcWidth = win->DC.CursorMaxPos.x - win->DC.CursorStartPos.x;
}
else
{
@ -1376,6 +1381,7 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
}
const float bottom = m_srcSampleSelect.empty() ? 0 : ImGui::GetFrameHeight();
ImGui::SetNextWindowContentSize( ImVec2( m_srcWidth, 0 ) );
ImGui::BeginChild( "##sourceView", ImVec2( 0, -bottom ), true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_HorizontalScrollbar );
if( m_font ) ImGui::PushFont( m_font );
@ -1410,6 +1416,8 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
}
RenderLine( line, lineNum++, 0, iptotal, ipmax, &worker );
}
const auto& win = ImGui::GetCurrentWindow();
m_srcWidth = win->DC.CursorMaxPos.x - win->DC.CursorStartPos.x;
}
else
{
@ -1654,6 +1662,7 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map<u
#endif
const float bottom = m_asmSampleSelect.empty() ? 0 : ImGui::GetFrameHeight();
ImGui::SetNextWindowContentSize( ImVec2( m_asmWidth, 0 ) );
ImGui::BeginChild( "##asmView", ImVec2( 0, -bottom ), true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_HorizontalScrollbar );
if( m_font ) ImGui::PushFont( m_font );
@ -1680,6 +1689,8 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map<u
}
RenderAsmLine( line, 0, iptotal, ipmax, worker, jumpOut, maxAddrLen, view );
}
const auto& win = ImGui::GetCurrentWindow();
m_asmWidth = win->DC.CursorMaxPos.x - win->DC.CursorStartPos.x;
}
else
{
@ -2080,7 +2091,7 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint
{
const auto ty = ImGui::GetFontSize();
auto draw = ImGui::GetWindowDrawList();
const auto w = ImGui::GetWindowWidth();
const auto w = m_srcWidth;
const auto wpos = ImGui::GetCursorScreenPos();
if( m_fileStringIdx == m_hoveredSource && lineNum == m_hoveredLine )
{
@ -2257,7 +2268,7 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal,
{
const auto ty = ImGui::GetFontSize();
auto draw = ImGui::GetWindowDrawList();
const auto w = ImGui::GetWindowWidth();
const auto w = m_asmWidth;
const auto wpos = ImGui::GetCursorScreenPos();
if( m_selectedAddressesHover.find( line.addr ) != m_selectedAddressesHover.end() )
{

View File

@ -239,6 +239,9 @@ private:
unordered_flat_set<uint32_t> m_srcSampleSelect;
uint32_t m_asmGroupSelect = -1;
uint32_t m_srcGroupSelect = -1;
float m_srcWidth;
float m_asmWidth;
};
}