From 337489c77d0ec6c2fde8bc06f44871ac12ffe743 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Sun, 3 Mar 2024 21:18:36 +0300 Subject: [PATCH] Do not reload window sizes when changing 3D viewer settings. --- 3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp | 26 +++++++++++++-------- 3d-viewer/3d_viewer/eda_3d_viewer_frame.h | 4 +++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index 9bb9b7c92a..cb757782dc 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015-2016 Mario Luzeiro * Copyright (C) 2023 CERN - * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -568,7 +568,8 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg ) if( cfg ) { - m_boardAdapter.m_Cfg = cfg; + applySettings( cfg ); + m_boardAdapter.SetBoard( GetBoard() ); // When opening the 3D viewer, we use the OpenGL mode, never the ray tracing engine @@ -576,13 +577,6 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg ) // (freeze window) with large boards. m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL; - m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled ); - m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier ); - m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode ); - - - m_canvas->SetVcSettings( EDA_DRAW_PANEL_GAL::GetVcSettings() ); - if( cfg->m_CurrentPreset == LEGACY_PRESET_FLAG ) { wxString legacyColorsPresetName = _( "legacy colors" ); @@ -645,7 +639,7 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex ReCreateMainToolbar(); loadCommonSettings(); - LoadSettings( Pgm().GetSettingsManager().GetAppSettings() ); + applySettings( Pgm().GetSettingsManager().GetAppSettings() ); m_appearancePanel->CommonSettingsChanged(); @@ -824,3 +818,15 @@ void EDA_3D_VIEWER_FRAME::loadCommonSettings() // TODO(JE) use all control options m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0; } + + +void EDA_3D_VIEWER_FRAME::applySettings( EDA_3D_VIEWER_SETTINGS* cfg ) +{ + m_boardAdapter.m_Cfg = cfg; + + m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled ); + m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier ); + m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode ); + + m_canvas->SetVcSettings( EDA_DRAW_PANEL_GAL::GetVcSettings() ); +} diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.h b/3d-viewer/3d_viewer/eda_3d_viewer_frame.h index 222a69986c..b1381d219a 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.h +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.h @@ -5,7 +5,7 @@ * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh * Copyright (C) 2023 CERN - * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -167,6 +167,8 @@ private: */ void loadCommonSettings(); + void applySettings( EDA_3D_VIEWER_SETTINGS* aSettings ); + private: wxFileName m_defaultSaveScreenshotFileName;