mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Add scroll modifier options
This commit is contained in:
parent
3c0db7e3c3
commit
0cac843ad7
@ -224,12 +224,15 @@ 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", "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, "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;
|
||||
@ -253,6 +256,8 @@ static bool SaveConfig()
|
||||
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, "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 );
|
||||
@ -794,6 +799,19 @@ static void DrawContents()
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::Unindent();
|
||||
|
||||
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();
|
||||
|
@ -11,6 +11,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;
|
||||
|
@ -56,6 +56,8 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char*
|
||||
, m_cbMainThread( cbMainThread )
|
||||
, m_achievementsMgr( amgr )
|
||||
, m_achievements( config.achievements )
|
||||
, m_horizontalScrollMultiplier( config.horizontalScrollMultiplier )
|
||||
, m_verticalScrollMultiplier( config.verticalScrollMultiplier )
|
||||
#ifdef __EMSCRIPTEN__
|
||||
, m_td( 2, "ViewMt" )
|
||||
#else
|
||||
@ -85,6 +87,8 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
|
||||
, m_cbMainThread( cbMainThread )
|
||||
, m_achievementsMgr( amgr )
|
||||
, m_achievements( config.achievements )
|
||||
, m_horizontalScrollMultiplier( config.horizontalScrollMultiplier )
|
||||
, m_verticalScrollMultiplier( config.verticalScrollMultiplier )
|
||||
#ifdef __EMSCRIPTEN__
|
||||
, m_td( 2, "ViewMt" )
|
||||
#else
|
||||
|
@ -904,6 +904,9 @@ private:
|
||||
AchievementsMgr* m_achievementsMgr;
|
||||
bool m_achievements = false;
|
||||
|
||||
double m_horizontalScrollMultiplier = 1.0;
|
||||
double m_verticalScrollMultiplier = 1.0;
|
||||
|
||||
TaskDispatch m_td;
|
||||
std::vector<FlameGraphItem> m_flameGraphData;
|
||||
struct
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user