1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-03 14:03:52 +00:00

Add support for handling keyboard shortcuts.

This commit is contained in:
Bartosz Taudul 2018-12-22 17:36:20 +01:00
parent 4bb4a568ca
commit 2d143ce516
2 changed files with 18 additions and 1 deletions

View File

@ -482,6 +482,17 @@ bool View::DrawImpl()
return !wasCancelled; return !wasCancelled;
} }
const auto& io = ImGui::GetIO();
assert( m_shortcut == ShortcutAction::None );
if( io.KeyCtrl )
{
if( ImGui::IsKeyPressed( 'F' ) )
{
m_shortcut = ShortcutAction::OpenFind;
}
}
if( !m_frames ) m_frames = m_worker.GetFramesBase(); if( !m_frames ) m_frames = m_worker.GetFramesBase();
const auto th = ImGui::GetTextLineHeight(); const auto th = ImGui::GetTextLineHeight();
@ -700,7 +711,6 @@ bool View::DrawImpl()
if( m_goToFrame ) DrawGoToFrame(); if( m_goToFrame ) DrawGoToFrame();
if( m_lockInfoWindow != InvalidId ) DrawLockInfoWindow(); if( m_lockInfoWindow != InvalidId ) DrawLockInfoWindow();
const auto& io = ImGui::GetIO();
if( m_zoomAnim.active ) if( m_zoomAnim.active )
{ {
m_zoomAnim.progress += io.DeltaTime * m_zoomAnim.lenMod; m_zoomAnim.progress += io.DeltaTime * m_zoomAnim.lenMod;

View File

@ -64,6 +64,12 @@ private:
Short Short
}; };
enum class ShortcutAction : uint8_t
{
None,
OpenFind
};
enum { InvalidId = 0xFFFFFFFF }; enum { InvalidId = 0xFFFFFFFF };
void InitTextEditor(); void InitTextEditor();
@ -256,6 +262,7 @@ private:
bool m_showCallstackFrameAddress = false; bool m_showCallstackFrameAddress = false;
bool m_showUnknownFrames = true; bool m_showUnknownFrames = true;
ShortcutAction m_shortcut = ShortcutAction::None;
Namespace m_namespace = Namespace::Full; Namespace m_namespace = Namespace::Full;
Animation m_zoomAnim; Animation m_zoomAnim;
BuzzAnim<int> m_callstackBuzzAnim; BuzzAnim<int> m_callstackBuzzAnim;