Bind Ctrl+plus / Ctrl+minus / Ctrl+0 to the user interface scale.

This commit is contained in:
Bartosz Taudul
2026-09-13 16:15:33 +02:00
parent 1381f40bd9
commit edc649cdec
3 changed files with 23 additions and 1 deletions

View File

@@ -3827,7 +3827,7 @@ The control menu (top row of buttons) provides access to various profiler featur
\item \emph{\faImages{}~Frame statistics} -- Display frame statistics window (section~\ref{framestatistics}).
\end{itemize}
\item \emph{ \faBook{}~User manual} -- Opens the user manual for quick reference. Note that the version of the user manual available directly in the profiler is an inferior quality version compared to the proper PDF.
\item \emph{\faMagnifyingGlassPlus{}~Display scale} -- Enables run-time resizing of the displayed content. This may be useful in environments with potentially reduced visibility, e.g. during a presentation. Note that this setting is independent to the UI scaling coming from the system DPI settings. The scale will be preserved across multiple profiler sessions if the \emph{Save UI scale} option is selected in global settings.
\item \emph{\faMagnifyingGlassPlus{}~Display scale} -- Enables run-time resizing of the displayed content. This may be useful in environments with potentially reduced visibility, e.g. during a presentation. Note that this setting is independent to the UI scaling coming from the system DPI settings. The scale will be preserved across multiple profiler sessions if the \emph{Save UI scale} option is selected in global settings. The user interface scale can also be adjusted with \keys{\ctrl + {+}} and \keys{\ctrl + \textminus}, or reset to 100\% with \keys{\ctrl + 0}.
\item \emph{\faRobot{}~Tracy Assist} -- Shows the automated assistant chat window (section~\ref{tracyassist}). Only available if enabled in global settings (section~\ref{aboutwindow}).
\end{itemize}

View File

@@ -169,6 +169,12 @@ void View::SetZoomPreset( int idx )
if( m_sscb ) m_sscb( idx );
}
void View::ZoomUserScale( int dir )
{
const int idx = dir == 0 ? s_zoomPreset100 : s_config.zoomLevel + dir;
if( idx >= 0 && idx < s_zoomPresetCount ) SetZoomPreset( idx );
}
void View::ViewSource( const char* fileName, int line )
{
assert( fileName );
@@ -793,6 +799,21 @@ bool View::DrawImpl()
m_findZone.show = true;
m_shortcut = ShortcutAction::OpenFind;
}
if( m_sscb )
{
if( ImGui::IsKeyPressed( ImGuiKey_Equal, false ) || ImGui::IsKeyPressed( ImGuiKey_KeypadAdd, false ) )
{
ZoomUserScale( 1 );
}
else if( ImGui::IsKeyPressed( ImGuiKey_Minus, false ) || ImGui::IsKeyPressed( ImGuiKey_KeypadSubtract, false ) )
{
ZoomUserScale( -1 );
}
else if( ImGui::IsKeyPressed( ImGuiKey_0, false ) || ImGui::IsKeyPressed( ImGuiKey_Keypad0, false ) )
{
ZoomUserScale( 0 );
}
}
}
if( !m_frames ) m_frames = m_worker.GetFramesBase();

View File

@@ -305,6 +305,7 @@ private:
void Achieve( const char* id );
void SaveUserData();
void SetZoomPreset( int idx );
void ZoomUserScale( int dir );
bool DrawImpl();
void DrawFrameImage( FrameImageCache& cache, const FrameImage& fi, float scale = GetScale() );