Fix missing user grid in COMMON_TOOLS.
Fixes https://gitlab.com/kicad/code/kicad/issues/4702
This commit is contained in:
parent
104ff29e5f
commit
18ab3c4714
|
@ -29,7 +29,7 @@
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/actions.h>
|
#include <tool/actions.h>
|
||||||
#include <tool/grid_menu.h>
|
#include <tool/grid_menu.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
|
||||||
DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ):
|
DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ):
|
||||||
DIALOG_GRID_SETTINGS_BASE( aParent ),
|
DIALOG_GRID_SETTINGS_BASE( aParent ),
|
||||||
|
@ -87,8 +87,11 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
|
||||||
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();
|
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();
|
||||||
gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection();
|
gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection();
|
||||||
|
|
||||||
// Notify GAL
|
// Notify TOOLS
|
||||||
TOOL_MANAGER* mgr = m_parent->GetToolManager();
|
TOOL_MANAGER* mgr = m_parent->GetToolManager();
|
||||||
|
mgr->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||||
|
|
||||||
|
// Notify GAL
|
||||||
mgr->RunAction( ACTIONS::gridPreset, true, gridCfg.last_size_idx );
|
mgr->RunAction( ACTIONS::gridPreset, true, gridCfg.last_size_idx );
|
||||||
mgr->RunAction( ACTIONS::gridSetOrigin, true, new VECTOR2D( m_parent->GetGridOrigin() ) );
|
mgr->RunAction( ACTIONS::gridSetOrigin, true, new VECTOR2D( m_parent->GetGridOrigin() ) );
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,19 @@ void COMMON_TOOLS::Reset( RESET_REASON aReason )
|
||||||
{
|
{
|
||||||
m_frame = getEditFrame<EDA_DRAW_FRAME>();
|
m_frame = getEditFrame<EDA_DRAW_FRAME>();
|
||||||
|
|
||||||
|
GRID_SETTINGS& settings = m_toolMgr->GetSettings()->m_Window.grid;
|
||||||
|
|
||||||
m_grids.clear();
|
m_grids.clear();
|
||||||
|
|
||||||
for( const wxString& gridDef : m_toolMgr->GetSettings()->m_Window.grid.sizes )
|
for( const wxString& gridDef : settings.sizes )
|
||||||
{
|
{
|
||||||
int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef, true );
|
int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef, true );
|
||||||
m_grids.emplace_back( gridSize, gridSize );
|
m_grids.emplace_back( gridSize, gridSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x, true ),
|
||||||
|
ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_y, true ) );
|
||||||
|
|
||||||
OnGridChanged();
|
OnGridChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ private:
|
||||||
int doZoomToPreset( int idx, bool aCenterOnCursor );
|
int doZoomToPreset( int idx, bool aCenterOnCursor );
|
||||||
|
|
||||||
std::vector<VECTOR2I> m_grids; // grids from APP_SETTINGS converted to internal units
|
std::vector<VECTOR2I> m_grids; // grids from APP_SETTINGS converted to internal units
|
||||||
|
// and with the user grid appended
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -279,8 +279,8 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||||
m_Pcb->SynchronizeNetsAndNetClasses();
|
m_Pcb->SynchronizeNetsAndNetClasses();
|
||||||
m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
|
m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
|
||||||
|
|
||||||
if( auto toolmgr = m_Frame->GetToolManager() )
|
if( m_Frame->GetToolManager() )
|
||||||
toolmgr->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
m_Frame->GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue