Add dynamic colors, force colors, shorten name to global options.

This commit is contained in:
Bartosz Taudul 2024-06-30 20:13:11 +02:00
parent f8023ba698
commit 9688152505
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 36 additions and 0 deletions

View File

@ -224,6 +224,9 @@ static void LoadConfig()
if( ini_sget( ini, "core", "threadedRendering", "%d", &v ) ) s_config.threadedRendering = v; if( ini_sget( ini, "core", "threadedRendering", "%d", &v ) ) s_config.threadedRendering = v;
if( ini_sget( ini, "core", "focusLostLimit", "%d", &v ) ) s_config.focusLostLimit = v; if( ini_sget( ini, "core", "focusLostLimit", "%d", &v ) ) s_config.focusLostLimit = v;
if( ini_sget( ini, "timeline", "targetFps", "%d", &v ) && v >= 1 && v < 10000 ) s_config.targetFps = v; if( ini_sget( ini, "timeline", "targetFps", "%d", &v ) && v >= 1 && v < 10000 ) s_config.targetFps = v;
if( ini_sget( ini, "timeline", "dynamicColors", "%d", &v ) ) s_config.dynamicColors = v;
if( ini_sget( ini, "timeline", "forceColors", "%d", &v ) ) s_config.forceColors = v;
if( ini_sget( ini, "timeline", "shortenName", "%d", &v ) ) s_config.shortenName = v;
if( ini_sget( ini, "memory", "limit", "%d", &v ) ) s_config.memoryLimit = v; if( ini_sget( ini, "memory", "limit", "%d", &v ) ) s_config.memoryLimit = v;
if( ini_sget( ini, "memory", "percent", "%d", &v ) && v >= 1 && v < 1000 ) s_config.memoryLimitPercent = v; if( ini_sget( ini, "memory", "percent", "%d", &v ) && v >= 1 && v < 1000 ) s_config.memoryLimitPercent = v;
if( ini_sget( ini, "achievements", "enabled", "%d", &v ) ) s_config.achievements = v; if( ini_sget( ini, "achievements", "enabled", "%d", &v ) ) s_config.achievements = v;
@ -244,6 +247,9 @@ static bool SaveConfig()
fprintf( f, "\n[timeline]\n" ); fprintf( f, "\n[timeline]\n" );
fprintf( f, "targetFps = %i\n", s_config.targetFps ); fprintf( f, "targetFps = %i\n", s_config.targetFps );
fprintf( f, "dynamicColors = %i\n", s_config.dynamicColors );
fprintf( f, "forceColors = %i\n", (int)s_config.forceColors );
fprintf( f, "shortenName = %i\n", s_config.shortenName );
fprintf( f, "\n[memory]\n" ); fprintf( f, "\n[memory]\n" );
fprintf( f, "limit = %i\n", (int)s_config.memoryLimit ); fprintf( f, "limit = %i\n", (int)s_config.memoryLimit );
@ -741,6 +747,28 @@ static void DrawContents()
ImGui::SetNextItemWidth( 90 * dpiScale ); ImGui::SetNextItemWidth( 90 * dpiScale );
if( ImGui::InputInt( "##targetfps", &tmp ) ) { s_config.targetFps = std::clamp( tmp, 1, 9999 ); SaveConfig(); } if( ImGui::InputInt( "##targetfps", &tmp ) ) { s_config.targetFps = std::clamp( tmp, 1, 9999 ); SaveConfig(); }
ImGui::Spacing();
ImGui::TextUnformatted( ICON_FA_PALETTE " Zone colors" );
ImGui::SameLine();
tracy::SmallCheckbox( "Ignore custom", &s_config.forceColors );
ImGui::Indent();
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
ImGui::RadioButton( "Static", &s_config.dynamicColors, 0 );
ImGui::RadioButton( "Thread dynamic", &s_config.dynamicColors, 1 );
ImGui::RadioButton( "Source location dynamic", &s_config.dynamicColors, 2 );
ImGui::PopStyleVar();
ImGui::Unindent();
ImGui::TextUnformatted( ICON_FA_RULER_HORIZONTAL " Zone name shortening" );
ImGui::Indent();
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
ImGui::RadioButton( "Disabled", &s_config.shortenName, (uint8_t)tracy::ShortenName::Never );
ImGui::RadioButton( "Minimal length", &s_config.shortenName, (uint8_t)tracy::ShortenName::Always );
ImGui::RadioButton( "Only normalize", &s_config.shortenName, (uint8_t)tracy::ShortenName::OnlyNormalize );
ImGui::RadioButton( "As needed", &s_config.shortenName, (uint8_t)tracy::ShortenName::NoSpace );
ImGui::RadioButton( "As needed + normalize", &s_config.shortenName, (uint8_t)tracy::ShortenName::NoSpaceAndNormalize );
ImGui::PopStyleVar();
ImGui::Unindent();
if( s_totalMem == 0 ) if( s_totalMem == 0 )
{ {
ImGui::BeginDisabled(); ImGui::BeginDisabled();

View File

@ -1,6 +1,8 @@
#ifndef __TRACYCONFIG_HPP__ #ifndef __TRACYCONFIG_HPP__
#define __TRACYCONFIG_HPP__ #define __TRACYCONFIG_HPP__
#include "TracyUtility.hpp"
namespace tracy namespace tracy
{ {
@ -13,6 +15,9 @@ struct Config
int memoryLimitPercent = 80; int memoryLimitPercent = 80;
bool achievements = false; bool achievements = false;
bool achievementsAsked = false; bool achievementsAsked = false;
int dynamicColors = 1;
bool forceColors = false;
int shortenName = (int)ShortenName::NoSpaceAndNormalize;
}; };
} }

View File

@ -124,6 +124,9 @@ void View::InitTextEditor()
void View::SetupConfig( const Config& config ) void View::SetupConfig( const Config& config )
{ {
m_vd.frameTarget = config.targetFps; m_vd.frameTarget = config.targetFps;
m_vd.dynamicColors = config.dynamicColors;
m_vd.forceColors = config.forceColors;
m_vd.shortenName = (ShortenName)config.shortenName;
} }
void View::Achieve( const char* id ) void View::Achieve( const char* id )