mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Change "go to frame" window to popup.
This commit is contained in:
parent
d4e490f47e
commit
222d3d661e
@ -628,13 +628,31 @@ bool View::DrawImpl()
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ToggleButton( ICON_FA_CROSSHAIRS, m_goToFrame );
|
||||
if( ImGui::Button( ICON_FA_CROSSHAIRS ) ) ImGui::OpenPopup( "GoToFramePopup" );
|
||||
if( ImGui::IsItemHovered() )
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted( "Go to frame" );
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
if( ImGui::BeginPopup( "GoToFramePopup" ) )
|
||||
{
|
||||
static int frameNum = 1;
|
||||
const bool mainFrameSet = m_frames->name == 0;
|
||||
const auto numFrames = mainFrameSet ? m_frames->frames.size() - 1 : m_frames->frames.size();
|
||||
const auto frameOffset = mainFrameSet ? 0 : 1;
|
||||
bool goClicked = false;
|
||||
ImGui::SetNextItemWidth( 120 );
|
||||
goClicked |= ImGui::InputInt( "##goToFrame", &frameNum, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue );
|
||||
frameNum = std::min( std::max( frameNum, 1 ), int( numFrames ) );
|
||||
ImGui::SameLine();
|
||||
goClicked |= ImGui::Button( ICON_FA_CROSSHAIRS " Go to frame" );
|
||||
if( goClicked )
|
||||
{
|
||||
ZoomToRange( m_worker.GetFrameBegin( *m_frames, frameNum - frameOffset ), m_worker.GetFrameEnd( *m_frames, frameNum - frameOffset ) );
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
{
|
||||
ImGui::SameLine();
|
||||
@ -729,7 +747,6 @@ bool View::DrawImpl()
|
||||
if( m_memoryAllocInfoWindow >= 0 ) DrawMemoryAllocWindow();
|
||||
if( m_showInfo ) DrawInfo();
|
||||
if( m_sourceViewFile ) DrawTextEditor();
|
||||
if( m_goToFrame ) DrawGoToFrame();
|
||||
if( m_lockInfoWindow != InvalidId ) DrawLockInfoWindow();
|
||||
if( m_showPlayback ) DrawPlayback();
|
||||
if( m_showCpuDataWindow ) DrawCpuDataWindow();
|
||||
@ -13127,28 +13144,6 @@ void View::DrawTextEditor()
|
||||
if( !show ) m_sourceViewFile = nullptr;
|
||||
}
|
||||
|
||||
void View::DrawGoToFrame()
|
||||
{
|
||||
static int frameNum = 1;
|
||||
|
||||
const bool mainFrameSet = m_frames->name == 0;
|
||||
const auto numFrames = mainFrameSet ? m_frames->frames.size() - 1 : m_frames->frames.size();
|
||||
const auto frameOffset = mainFrameSet ? 0 : 1;
|
||||
|
||||
bool goClicked = false;
|
||||
ImGui::Begin( "Go to frame", &m_goToFrame, ImGuiWindowFlags_AlwaysAutoResize );
|
||||
ImGui::SetNextItemWidth( 120 );
|
||||
goClicked |= ImGui::InputInt( "##goToFrame", &frameNum, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue );
|
||||
frameNum = std::min( std::max( frameNum, 1 ), int( numFrames ) );
|
||||
ImGui::SameLine();
|
||||
goClicked |= ImGui::Button( ICON_FA_CROSSHAIRS " Go to" );
|
||||
if( goClicked )
|
||||
{
|
||||
ZoomToRange( m_worker.GetFrameBegin( *m_frames, frameNum - frameOffset ), m_worker.GetFrameEnd( *m_frames, frameNum - frameOffset ) );
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void View::DrawLockInfoWindow()
|
||||
{
|
||||
auto it = m_worker.GetLockMap().find( m_lockInfoWindow );
|
||||
|
@ -161,7 +161,6 @@ private:
|
||||
void DrawMemoryAllocWindow();
|
||||
void DrawInfo();
|
||||
void DrawTextEditor();
|
||||
void DrawGoToFrame();
|
||||
void DrawLockInfoWindow();
|
||||
void DrawPlayback();
|
||||
void DrawCpuDataWindow();
|
||||
@ -345,7 +344,6 @@ private:
|
||||
bool m_showInfo = false;
|
||||
bool m_showPlayback = false;
|
||||
bool m_showCpuDataWindow = false;
|
||||
bool m_goToFrame = false;
|
||||
bool m_showAnnotationList = false;
|
||||
|
||||
enum class CpuDataSortBy
|
||||
|
Loading…
Reference in New Issue
Block a user