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).
This commit is contained in:
Maciej Suminski 2014-03-21 18:00:11 +01:00
parent c7116e9d03
commit 3a43f0527f
10 changed files with 106 additions and 65 deletions

View File

@ -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 ) int BASE_SCREEN::SetGrid( const wxRealPoint& size )
{ {
wxASSERT( !m_grids.empty() ); wxASSERT( !m_grids.empty() );

View File

@ -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 ) int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
{ {
return 0; return 0;

View File

@ -255,9 +255,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
{ {
wxArrayString units; wxArrayString units;
GRIDS grid_list; GRIDS grid_list = GetScreen()->GetGrids();
GetScreen()->GetGrids( grid_list );
DIALOG_EESCHEMA_OPTIONS dlg( this ); DIALOG_EESCHEMA_OPTIONS dlg( this );

View File

@ -445,11 +445,12 @@ public:
/** /**
* Function GetGrids(). * Function GetGrids().
* Copy the grid list to \a aList. * Returns the current list of grids.
*
* @param aList - List to copy to.
*/ */
void GetGrids( GRIDS& aList ); const GRIDS& GetGrids() const
{
return m_grids;
}
/** /**
* Function GetClass * Function GetClass

View File

@ -76,8 +76,8 @@ public:
EDA_UNITS_T m_UserGridUnit; EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize; wxRealPoint m_UserGridSize;
int m_FastGrid1; int m_FastGrid1; // 1st fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
int m_FastGrid2; int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
EDA_3D_FRAME* m_Draw3DFrame; EDA_3D_FRAME* m_Draw3DFrame;
@ -220,13 +220,10 @@ public:
* Function BestZoom * Function BestZoom
* @return the "best" zoom to show the entire board or footprint on the screen. * @return the "best" zoom to show the entire board or footprint on the screen.
*/ */
virtual double BestZoom(); virtual double BestZoom();
virtual void Show3D_Frame( wxCommandEvent& event ); virtual void Show3D_Frame( wxCommandEvent& event );
public:
// Read/write functions: // Read/write functions:
EDA_ITEM* ReadDrawSegmentDescr( LINE_READER* aReader ); EDA_ITEM* ReadDrawSegmentDescr( LINE_READER* aReader );
int ReadListeSegmentDescr( LINE_READER* aReader, int ReadListeSegmentDescr( LINE_READER* aReader,
@ -680,6 +677,20 @@ public:
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent ); void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( 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() DECLARE_EVENT_TABLE()
}; };

View File

@ -727,6 +727,18 @@ public:
*/ */
wxPoint GetGridPosition( const wxPoint& aPosition ) const; 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. * Command event handler for selecting grid sizes.
* *

View File

@ -914,6 +914,7 @@ void PCB_BASE_FRAME::updateGridSelectBox()
} }
} }
void PCB_BASE_FRAME::updateZoomSelectBox() void PCB_BASE_FRAME::updateZoomSelectBox()
{ {
if( m_zoomSelectBox == NULL ) if( m_zoomSelectBox == NULL )
@ -943,3 +944,29 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
m_zoomSelectBox->SetSelection( i + 1 ); 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 );
}
}

View File

@ -68,8 +68,6 @@ namespace KIGFX
// non-owning container of item candidates when searching for items on the same track. // non-owning container of item candidates when searching for items on the same track.
typedef std::vector< TRACK* > TRACK_PTRS; typedef std::vector< TRACK* > TRACK_PTRS;
#define HISTORY_MAX_COUNT 8
/** /**
* Enum LAYER_T * Enum LAYER_T
@ -305,12 +303,12 @@ public:
// the first value is always the value of the current NetClass // the first value is always the value of the current NetClass
// The others values are extra values // The others values are extra values
/// Vias size and drill list(max count = HISTORY_MAX_COUNT) // The first value is the current netclass via size // TODO verify
/// Vias size and drill list
std::vector<VIA_DIMENSION> m_ViasDimensionsList; std::vector<VIA_DIMENSION> m_ViasDimensionsList;
// The first value is the current netclass via size // The first value is the current netclass track width // TODO verify
// tracks widths (max count = HISTORY_MAX_COUNT) /// Track width list
// The first value is the current netclass track width
std::vector<int> m_TrackWidthList; std::vector<int> m_TrackWidthList;

View File

@ -216,50 +216,19 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_SWITCH_GRID_TO_FASTGRID1: case HK_SWITCH_GRID_TO_FASTGRID1:
if( m_gridSelectBox ) SetFastGrid1();
{
m_gridSelectBox->SetSelection( m_FastGrid1 );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
break; break;
case HK_SWITCH_GRID_TO_FASTGRID2: case HK_SWITCH_GRID_TO_FASTGRID2:
if( m_gridSelectBox ) SetFastGrid2();
{
m_gridSelectBox->SetSelection( m_FastGrid2 );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
break; break;
case HK_SWITCH_GRID_TO_NEXT: case HK_SWITCH_GRID_TO_NEXT:
if( m_gridSelectBox ) SetNextGrid();
{
m_gridSelectBox->SetSelection( ( m_gridSelectBox->GetSelection() + 1 ) %
m_gridSelectBox->GetCount() );
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
break; break;
case HK_SWITCH_GRID_TO_PREVIOUS: case HK_SWITCH_GRID_TO_PREVIOUS:
if( m_gridSelectBox ) SetPrevGrid();
{
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 );
}
break; break;
case HK_SWITCH_LAYER_TO_PREVIOUS: case HK_SWITCH_LAYER_TO_PREVIOUS:

View File

@ -1024,7 +1024,7 @@ void RN_DATA::updateNet( int aNetCode )
{ {
assert( aNetCode < (int) m_nets.size() ); assert( aNetCode < (int) m_nets.size() );
if( aNetCode < 1 || aNetCode > m_nets.size() ) if( aNetCode < 1 || aNetCode > (int) m_nets.size() )
return; return;
m_nets[aNetCode].ClearSimple(); m_nets[aNetCode].ClearSimple();