diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 46c4a7ce..fd2cc3df 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -221,9 +221,12 @@ static void LoadConfig() if( !ini ) return; int v; + double v1; 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, "timeline", "targetFps", "%d", &v ) && v >= 1 && v < 10000 ) s_config.targetFps = v; + if( ini_sget( ini, "timeline", "horizontalScrollMultiplier", "%lf", &v1 ) && v1 > 0.0 ) s_config.horizontalScrollMultiplier = v1; + if( ini_sget( ini, "timeline", "verticalScrollMultiplier", "%lf", &v1 ) && v1 > 0.0 ) s_config.verticalScrollMultiplier = v1; 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, "achievements", "enabled", "%d", &v ) ) s_config.achievements = v; @@ -244,6 +247,8 @@ static bool SaveConfig() fprintf( f, "\n[timeline]\n" ); fprintf( f, "targetFps = %i\n", s_config.targetFps ); + fprintf( f, "horizontalScrollMultiplier = %lf\n", s_config.horizontalScrollMultiplier ); + fprintf( f, "verticalScrollMultiplier = %lf\n", s_config.verticalScrollMultiplier ); fprintf( f, "\n[memory]\n" ); fprintf( f, "limit = %i\n", (int)s_config.memoryLimit ); @@ -741,6 +746,19 @@ static void DrawContents() ImGui::SetNextItemWidth( 90 * dpiScale ); if( ImGui::InputInt( "##targetfps", &tmp ) ) { s_config.targetFps = std::clamp( tmp, 1, 9999 ); SaveConfig(); } + ImGui::Spacing(); + ImGui::TextUnformatted( "Scroll Multipliers" ); + ImGui::SameLine(); + tracy::DrawHelpMarker( "The multipliers to the amount to scroll by horizontally and vertically. This is used in the timeline and setting this value can help compensate for scroll wheel sensitivity." ); + ImGui::SameLine(); + double tmpScroll = s_config.horizontalScrollMultiplier; + ImGui::SetNextItemWidth( 45 * dpiScale ); + if( ImGui::InputDouble( "##horizontalscrollmultiplier", &tmpScroll ) ) { s_config.horizontalScrollMultiplier = std::max( tmpScroll, 0.01 ); SaveConfig(); } + tmpScroll = s_config.verticalScrollMultiplier; + ImGui::SameLine(); + ImGui::SetNextItemWidth( 45 * dpiScale ); + if( ImGui::InputDouble( "##verticalscrollmultiplier", &tmpScroll ) ) { s_config.verticalScrollMultiplier = std::max( tmpScroll, 0.01 ); SaveConfig(); } + if( s_totalMem == 0 ) { ImGui::BeginDisabled(); diff --git a/profiler/src/profiler/TracyConfig.hpp b/profiler/src/profiler/TracyConfig.hpp index 71f216ab..e2e121be 100644 --- a/profiler/src/profiler/TracyConfig.hpp +++ b/profiler/src/profiler/TracyConfig.hpp @@ -9,6 +9,8 @@ struct Config bool threadedRendering = true; bool focusLostLimit = true; int targetFps = 60; + double horizontalScrollMultiplier = 1.0; + double verticalScrollMultiplier = 1.0; bool memoryLimit = false; int memoryLimitPercent = 80; bool achievements = false; diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 9e0b3cd2..ff5895d6 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -57,6 +57,8 @@ View::View( void(*cbMainThread)(const std::function&, bool), const char* , m_cbMainThread( cbMainThread ) , m_achievementsMgr( amgr ) , m_achievements( config.achievements ) + , m_horizontalScrollMultiplier( config.horizontalScrollMultiplier ) + , m_verticalScrollMultiplier( config.verticalScrollMultiplier ) { InitTextEditor(); @@ -82,6 +84,8 @@ View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f , m_cbMainThread( cbMainThread ) , m_achievementsMgr( amgr ) , m_achievements( config.achievements ) + , m_horizontalScrollMultiplier( config.horizontalScrollMultiplier ) + , m_verticalScrollMultiplier( config.verticalScrollMultiplier ) { m_notificationTime = 4; m_notificationText = std::string( "Trace loaded in " ) + TimeToString( m_worker.GetLoadTime() ); diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index b73ad30d..1eed987c 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -872,6 +872,8 @@ private: AchievementsMgr* m_achievementsMgr; bool m_achievements = false; + double m_horizontalScrollMultiplier = 1.0; + double m_verticalScrollMultiplier = 1.0; }; } diff --git a/profiler/src/profiler/TracyView_FrameOverview.cpp b/profiler/src/profiler/TracyView_FrameOverview.cpp index 91c24e3f..a24fce89 100644 --- a/profiler/src/profiler/TracyView_FrameOverview.cpp +++ b/profiler/src/profiler/TracyView_FrameOverview.cpp @@ -95,7 +95,7 @@ void View::DrawFrames() if( hover ) { - const auto hwheel_delta = io.MouseWheelH * 100.f; + const auto hwheel_delta = io.MouseWheelH * 100.f * m_horizontalScrollMultiplier; if( IsMouseDragging( 1 ) || hwheel_delta != 0 ) { m_viewMode = ViewMode::Paused; diff --git a/profiler/src/profiler/TracyView_Timeline.cpp b/profiler/src/profiler/TracyView_Timeline.cpp index d9b0d70b..64f602e8 100644 --- a/profiler/src/profiler/TracyView_Timeline.cpp +++ b/profiler/src/profiler/TracyView_Timeline.cpp @@ -86,7 +86,7 @@ void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w ) } } - const auto hwheel_delta = io.MouseWheelH * 100.f; + const auto hwheel_delta = io.MouseWheelH * 100.f * m_horizontalScrollMultiplier; if( IsMouseDragging( 1 ) || hwheel_delta != 0 ) { m_viewMode = ViewMode::Paused; @@ -143,6 +143,8 @@ void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w ) if( io.KeyCtrl ) mod = 0.05; else if( io.KeyShift ) mod = 0.5; + mod *= m_verticalScrollMultiplier; + if( wheel > 0 ) { t0 += int64_t( p1 * mod );