Fix grid update when edited from menubar.
Fixes: lp:1833399 * https://bugs.launchpad.net/kicad/+bug/1833399
This commit is contained in:
parent
730b89af6d
commit
eb95202708
|
@ -352,7 +352,7 @@ int COMMON_TOOLS::GridNext( const TOOL_EVENT& aEvent )
|
|||
const OPT<int> next_grid_id = getNextPreviousGrid( *m_frame->GetScreen(), 1 );
|
||||
|
||||
if( next_grid_id )
|
||||
return doGridPreset( *next_grid_id - ID_POPUP_GRID_LEVEL_1000 );
|
||||
return GridPreset( *next_grid_id - ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
|
|||
const OPT<int> next_grid_id = getNextPreviousGrid( *m_frame->GetScreen(), -1 );
|
||||
|
||||
if( next_grid_id )
|
||||
return doGridPreset( *next_grid_id - ID_POPUP_GRID_LEVEL_1000 );
|
||||
return GridPreset( *next_grid_id - ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -371,11 +371,11 @@ int COMMON_TOOLS::GridPrev( const TOOL_EVENT& aEvent )
|
|||
|
||||
int COMMON_TOOLS::GridPreset( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
return doGridPreset( aEvent.Parameter<intptr_t>() );
|
||||
return GridPreset( aEvent.Parameter<intptr_t>() );
|
||||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::doGridPreset( int idx )
|
||||
int COMMON_TOOLS::GridPreset( int idx )
|
||||
{
|
||||
BASE_SCREEN* screen = m_frame->GetScreen();
|
||||
|
||||
|
|
|
@ -85,4 +85,7 @@ void SCH_BASE_FRAME::OnGridSettings( wxCommandEvent& aEvent )
|
|||
DIALOG_SET_GRID dlg( this );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
UpdateStatusBar();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
|
|
@ -78,13 +78,14 @@ public:
|
|||
int GridPreset( const TOOL_EVENT& aEvent );
|
||||
int ToggleGrid( const TOOL_EVENT& aEvent );
|
||||
int GridProperties( const TOOL_EVENT& aEvent );
|
||||
int GridPreset( int idx );
|
||||
|
||||
int SwitchCanvas( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
||||
private:
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
///> Pointer to the currently used edit frame.
|
||||
EDA_DRAW_FRAME* m_frame;
|
||||
|
||||
|
@ -92,8 +93,6 @@ private:
|
|||
|
||||
///> Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
|
||||
int doZoomToPreset( int idx, bool aCenterOnCursor );
|
||||
|
||||
int doGridPreset( int idx );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <tools/pcb_actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <tool/common_tools.h>
|
||||
|
||||
// Max values for grid size
|
||||
static const int MAX_GRID_SIZE = KiROUND( 1000.0 * IU_PER_MM );
|
||||
|
@ -110,13 +111,8 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
|
|||
|
||||
// Notify GAL
|
||||
TOOL_MANAGER* mgr = m_parent->GetToolManager();
|
||||
|
||||
mgr->RunAction( "common.Control.gridPreset", true,
|
||||
screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
TOOL_EVENT gridOriginUpdate = ACTIONS::gridSetOrigin.MakeEvent();
|
||||
gridOriginUpdate.SetParameter( new VECTOR2D( m_parent->GetGridOrigin() ) );
|
||||
mgr->ProcessEvent( gridOriginUpdate );
|
||||
mgr->GetTool<COMMON_TOOLS>()->GridPreset( screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 );
|
||||
mgr->RunAction( ACTIONS::gridSetOrigin, true, new VECTOR2D( m_parent->GetGridOrigin() ) );
|
||||
|
||||
m_parent->UpdateGridSelectBox();
|
||||
|
||||
|
@ -151,14 +147,12 @@ void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
bool PCB_BASE_EDIT_FRAME::InvokeDialogGrid()
|
||||
{
|
||||
DIALOG_SET_GRID dlg( this, m_gridSelectBox->GetStrings() );
|
||||
return dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::OnGridSettings( wxCommandEvent& event )
|
||||
{
|
||||
InvokeDialogGrid();
|
||||
DIALOG_SET_GRID dlg( this, m_gridSelectBox->GetStrings() );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
UpdateStatusBar();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
|
|
@ -179,7 +179,6 @@ public:
|
|||
virtual void SetBoard( BOARD* aBoard ) override;
|
||||
|
||||
void OnGridSettings( wxCommandEvent& aEvent ) override;
|
||||
bool InvokeDialogGrid();
|
||||
|
||||
protected:
|
||||
/// User defined rotation angle (in tenths of a degree).
|
||||
|
|
Loading…
Reference in New Issue