Commit 3a43f052 authored by Maciej Suminski's avatar Maciej Suminski

Changed void BASE_SCREEN::GetGrids( GRIDS& aList ) to const GRIDS& BASE_SCREEN::GetGrids().

Refactored:
- EDA_DRAW_FRAME::SetNextGrid() & SetPrevGrid()
- PCB_BASE_FRAME::SetFastGrid1() & SetFastGrid2()
Removed a warning from RN_DATA::updateNet(int).
parent c7116e9d
......@@ -175,13 +175,6 @@ void BASE_SCREEN::SetGridList( GRIDS& gridlist )
}
void BASE_SCREEN::GetGrids( GRIDS& aList )
{
for( size_t i = 0; i < m_grids.size(); i++ )
aList.push_back( m_grids[ i ] );
}
int BASE_SCREEN::SetGrid( const wxRealPoint& size )
{
wxASSERT( !m_grids.empty() );
......
......@@ -395,7 +395,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x,
screen->GetGrid().m_Size.y ) );
screen->GetGrid().m_Size.y ) );
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
......@@ -532,6 +532,38 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
}
void EDA_DRAW_FRAME::SetNextGrid()
{
if( m_gridSelectBox )
{
m_gridSelectBox->SetSelection( ( m_gridSelectBox->GetSelection() + 1 ) %
m_gridSelectBox->GetCount() );
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
// cmd.SetEventObject( this );
OnSelectGrid( cmd );
}
}
void EDA_DRAW_FRAME::SetPrevGrid()
{
if( m_gridSelectBox )
{
int cnt = m_gridSelectBox->GetSelection();
if( --cnt < 0 )
cnt = m_gridSelectBox->GetCount() - 1;
m_gridSelectBox->SetSelection( cnt );
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
// cmd.SetEventObject( this );
OnSelectGrid( cmd );
}
}
int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
{
return 0;
......
......@@ -255,9 +255,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
{
wxArrayString units;
GRIDS grid_list;
GetScreen()->GetGrids( grid_list );
GRIDS grid_list = GetScreen()->GetGrids();
DIALOG_EESCHEMA_OPTIONS dlg( this );
......
......@@ -65,7 +65,7 @@ public:
};
typedef std::vector< GRID_TYPE > GRIDS;
typedef std::vector<GRID_TYPE> GRIDS;
/**
......@@ -445,11 +445,12 @@ public:
/**
* Function GetGrids().
* Copy the grid list to \a aList.
*
* @param aList - List to copy to.
* Returns the current list of grids.
*/
void GetGrids( GRIDS& aList );
const GRIDS& GetGrids() const
{
return m_grids;
}
/**
* Function GetClass
......
......@@ -76,8 +76,8 @@ public:
EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize;
int m_FastGrid1;
int m_FastGrid2;
int m_FastGrid1; // 1st fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
EDA_3D_FRAME* m_Draw3DFrame;
......@@ -220,13 +220,10 @@ public:
* Function BestZoom
* @return the "best" zoom to show the entire board or footprint on the screen.
*/
virtual double BestZoom();
virtual void Show3D_Frame( wxCommandEvent& event );
public:
// Read/write functions:
EDA_ITEM* ReadDrawSegmentDescr( LINE_READER* aReader );
int ReadListeSegmentDescr( LINE_READER* aReader,
......@@ -680,6 +677,20 @@ public:
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
/**
* Function SetFastGrid1()
*
* Switches grid settings to the 1st "fast" setting predefined by user.
*/
void SetFastGrid1();
/**
* Function SetFastGrid2()
*
* Switches grid settings to the 1st "fast" setting predefined by user.
*/
void SetFastGrid2();
DECLARE_EVENT_TABLE()
};
......
......@@ -727,6 +727,18 @@ public:
*/
wxPoint GetGridPosition( const wxPoint& aPosition ) const;
/**
* Function SetNextGrid()
* changes the grid size settings to the next one available.
*/
virtual void SetNextGrid();
/**
* Function SetPrevGrid()
* changes the grid size settings to the previous one available.
*/
virtual void SetPrevGrid();
/**
* Command event handler for selecting grid sizes.
*
......
......@@ -914,6 +914,7 @@ void PCB_BASE_FRAME::updateGridSelectBox()
}
}
void PCB_BASE_FRAME::updateZoomSelectBox()
{
if( m_zoomSelectBox == NULL )
......@@ -943,3 +944,29 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
m_zoomSelectBox->SetSelection( i + 1 );
}
}
void PCB_BASE_FRAME::SetFastGrid1()
{
if( m_gridSelectBox )
{
m_gridSelectBox->SetSelection( m_FastGrid1 );
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
cmd.SetEventObject( this );
OnSelectGrid( cmd );
}
}
void PCB_BASE_FRAME::SetFastGrid2()
{
if( m_gridSelectBox )
{
m_gridSelectBox->SetSelection( m_FastGrid2 );
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
cmd.SetEventObject( this );
OnSelectGrid( cmd );
}
}
......@@ -68,8 +68,6 @@ namespace KIGFX
// non-owning container of item candidates when searching for items on the same track.
typedef std::vector< TRACK* > TRACK_PTRS;
#define HISTORY_MAX_COUNT 8
/**
* Enum LAYER_T
......@@ -305,13 +303,13 @@ public:
// the first value is always the value of the current NetClass
// The others values are extra values
/// Vias size and drill list(max count = HISTORY_MAX_COUNT)
std::vector <VIA_DIMENSION> m_ViasDimensionsList;
// The first value is the current netclass via size // TODO verify
/// Vias size and drill list
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
// The first value is the current netclass via size
// tracks widths (max count = HISTORY_MAX_COUNT)
// The first value is the current netclass track width
std::vector <int> m_TrackWidthList;
// The first value is the current netclass track width // TODO verify
/// Track width list
std::vector<int> m_TrackWidthList;
BOARD();
......
......@@ -216,50 +216,19 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_SWITCH_GRID_TO_FASTGRID1:
if( m_gridSelectBox )
{
m_gridSelectBox->SetSelection( m_FastGrid1 );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
SetFastGrid1();
break;
case HK_SWITCH_GRID_TO_FASTGRID2:
if( m_gridSelectBox )
{
m_gridSelectBox->SetSelection( m_FastGrid2 );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
SetFastGrid2();
break;
case HK_SWITCH_GRID_TO_NEXT:
if( m_gridSelectBox )
{
m_gridSelectBox->SetSelection( ( m_gridSelectBox->GetSelection() + 1 ) %
m_gridSelectBox->GetCount() );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
SetNextGrid();
break;
case HK_SWITCH_GRID_TO_PREVIOUS:
if( m_gridSelectBox )
{
cnt = m_gridSelectBox->GetSelection();
if ( cnt == 0 )
cnt = m_gridSelectBox->GetCount() - 1;
else
cnt--;
m_gridSelectBox->SetSelection( cnt );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
SetPrevGrid();
break;
case HK_SWITCH_LAYER_TO_PREVIOUS:
......
......@@ -1024,7 +1024,7 @@ void RN_DATA::updateNet( int aNetCode )
{
assert( aNetCode < (int) m_nets.size() );
if( aNetCode < 1 || aNetCode > m_nets.size() )
if( aNetCode < 1 || aNetCode > (int) m_nets.size() )
return;
m_nets[aNetCode].ClearSimple();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment