Fix merge issue.
Some legacy_gal code leaked into legacy_wx. Fixes: lp:1827270 * https://bugs.launchpad.net/kicad/+bug/1827270
This commit is contained in:
parent
4d776034ca
commit
2e8d930250
|
@ -624,6 +624,24 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetNextGrid()
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "Obsolete! Should go through ToolManager." );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetPrevGrid()
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "Obsolete! Should go through ToolManager." );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "Obsolete! Should go through ToolManager." );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -531,7 +531,13 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||||
|
|
||||||
int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
|
int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
|
||||||
|
|
||||||
GetToolManager()->RunAction( "common.Control.gridPreset", true, idx );
|
// Notify GAL
|
||||||
|
TOOL_MANAGER* mgr = GetToolManager();
|
||||||
|
|
||||||
|
if( mgr && IsGalCanvasActive() )
|
||||||
|
mgr->RunAction( "common.Control.gridPreset", true, idx );
|
||||||
|
else
|
||||||
|
SetPresetGrid( idx );
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -674,6 +680,65 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetNextGrid()
|
||||||
|
{
|
||||||
|
BASE_SCREEN * screen = GetScreen();
|
||||||
|
|
||||||
|
int new_grid_cmd = screen->GetGridCmdId();
|
||||||
|
|
||||||
|
// if the grid id is the not the last, increment it
|
||||||
|
if( screen->GridExists( new_grid_cmd + 1 ) )
|
||||||
|
new_grid_cmd += 1;
|
||||||
|
|
||||||
|
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetPrevGrid()
|
||||||
|
{
|
||||||
|
BASE_SCREEN * screen = GetScreen();
|
||||||
|
|
||||||
|
int new_grid_cmd = screen->GetGridCmdId();
|
||||||
|
|
||||||
|
// if the grid id is the not the first, increment it
|
||||||
|
if( screen->GridExists( new_grid_cmd - 1 ) )
|
||||||
|
new_grid_cmd -= 1;
|
||||||
|
|
||||||
|
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
|
||||||
|
{
|
||||||
|
BASE_SCREEN * screen = GetScreen();
|
||||||
|
|
||||||
|
if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||||
|
aIndex = screen->GetGrids()[0].m_CmdId;
|
||||||
|
|
||||||
|
// aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code.
|
||||||
|
// we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId):
|
||||||
|
int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId;
|
||||||
|
|
||||||
|
if( m_gridSelectBox )
|
||||||
|
{
|
||||||
|
if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() - 2 )
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( false, "Invalid grid index" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_gridSelectBox->SetSelection( glistIdx );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Be sure m_LastGridSizeId is up to date.
|
||||||
|
m_LastGridSizeId = aIndex;
|
||||||
|
GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 );
|
||||||
|
|
||||||
|
// Put cursor on new grid
|
||||||
|
SetCrossHairPosition( RefPos( true ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -566,6 +566,23 @@ public:
|
||||||
*/
|
*/
|
||||||
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the grid size settings to the next one available.
|
||||||
|
*/
|
||||||
|
virtual void SetNextGrid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the grid size settings to the previous one available.
|
||||||
|
*/
|
||||||
|
virtual void SetPrevGrid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the grid size to one of the preset values.
|
||||||
|
*
|
||||||
|
* @param aIndex is the index from the list.
|
||||||
|
*/
|
||||||
|
void SetPresetGrid( int aIndex );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command event handler for selecting grid sizes.
|
* Command event handler for selecting grid sizes.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue