mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Register line selection.
This commit is contained in:
parent
8b2b2f650f
commit
f4b06ed1fc
@ -74,6 +74,7 @@ SourceView::SourceView( ImFont* font )
|
|||||||
, m_dataSize( 0 )
|
, m_dataSize( 0 )
|
||||||
, m_targetLine( 0 )
|
, m_targetLine( 0 )
|
||||||
, m_selectedLine( 0 )
|
, m_selectedLine( 0 )
|
||||||
|
, m_asmSelected( -1 )
|
||||||
, m_hoveredLine( 0 )
|
, m_hoveredLine( 0 )
|
||||||
, m_hoveredSource( 0 )
|
, m_hoveredSource( 0 )
|
||||||
, m_codeLen( 0 )
|
, m_codeLen( 0 )
|
||||||
@ -2084,11 +2085,20 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto asmIdx = &line - m_asm.data();
|
||||||
|
|
||||||
const auto msz = line.mnemonic.size();
|
const auto msz = line.mnemonic.size();
|
||||||
memcpy( buf, line.mnemonic.c_str(), msz );
|
memcpy( buf, line.mnemonic.c_str(), msz );
|
||||||
memset( buf+msz, ' ', m_maxMnemonicLen-msz );
|
memset( buf+msz, ' ', m_maxMnemonicLen-msz );
|
||||||
memcpy( buf+m_maxMnemonicLen, line.operands.c_str(), line.operands.size() + 1 );
|
memcpy( buf+m_maxMnemonicLen, line.operands.c_str(), line.operands.size() + 1 );
|
||||||
ImGui::TextUnformatted( buf );
|
if( asmIdx == m_asmSelected )
|
||||||
|
{
|
||||||
|
TextColoredUnformatted( ImVec4( 1, 0.25f, 0.25f, 1 ), buf );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted( buf );
|
||||||
|
}
|
||||||
|
|
||||||
if( ImGui::IsItemHovered() )
|
if( ImGui::IsItemHovered() )
|
||||||
{
|
{
|
||||||
@ -2243,6 +2253,14 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
|
|||||||
if( m_font ) ImGui::PushFont( m_font );
|
if( m_font ) ImGui::PushFont( m_font );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( ImGui::IsMouseClicked( 0 ) )
|
||||||
|
{
|
||||||
|
m_asmSelected = asmIdx;
|
||||||
|
}
|
||||||
|
else if( ImGui::IsMouseClicked( 1 ) )
|
||||||
|
{
|
||||||
|
m_asmSelected = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( line.jumpAddr != 0 )
|
if( line.jumpAddr != 0 )
|
||||||
|
@ -176,6 +176,7 @@ private:
|
|||||||
size_t m_dataSize;
|
size_t m_dataSize;
|
||||||
int m_targetLine;
|
int m_targetLine;
|
||||||
int m_selectedLine;
|
int m_selectedLine;
|
||||||
|
int m_asmSelected;
|
||||||
DecayValue<int> m_hoveredLine;
|
DecayValue<int> m_hoveredLine;
|
||||||
DecayValue<uint32_t> m_hoveredSource;
|
DecayValue<uint32_t> m_hoveredSource;
|
||||||
int m_displayMode;
|
int m_displayMode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user