Commit 92ac2ac4 authored by jean-pierre charras's avatar jean-pierre charras

Cvpcb: Bug fix: Select previous free component crashes Cvpcb when no previous...

Cvpcb: Bug fix: Select previous free component crashes Cvpcb when no previous free component found, and both Select next and  previous free component where not working very well.
parent a287f893
...@@ -6,6 +6,7 @@ Contribute to KiCad (under Linux) ...@@ -6,6 +6,7 @@ Contribute to KiCad (under Linux)
sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev
sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
sudo apt-get install cmake bzr sudo apt-get install cmake bzr
sudo apt-get install cmake bzr bzrtools
2) initialize Bazaar: 2) initialize Bazaar:
bzr whoami "John Doe <john.doe@gmail.com>" bzr whoami "John Doe <john.doe@gmail.com>"
...@@ -14,7 +15,8 @@ Contribute to KiCad (under Linux) ...@@ -14,7 +15,8 @@ Contribute to KiCad (under Linux)
cd ~/ cd ~/
bzr branch lp:kicad kicad_john bzr branch lp:kicad kicad_john
4) create a copy of this folder and zip it away (just in case). 4) Read coding_style_policy.pdt, in <kicad_sources>/Documentation,
and other docs.
5) Modify/add source code. 5) Modify/add source code.
cd kicad_john cd kicad_john
...@@ -28,7 +30,7 @@ Contribute to KiCad (under Linux) ...@@ -28,7 +30,7 @@ Contribute to KiCad (under Linux)
or or
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release
to build a release version to build a release version
make -j 4 # this is for a 4 core machine make
7) Repeat step 5 and 6 until satisfied. 7) Repeat step 5 and 6 until satisfied.
......
...@@ -332,60 +332,50 @@ void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight ) ...@@ -332,60 +332,50 @@ void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )
void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event ) void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
{ {
int ii = 0;
int selection;
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
selection = m_ListCmp->GetSelection(); long selection = m_ListCmp->GetFirstSelected();
if( selection < 0 ) if( selection < 0 )
selection = 0; selection = -1; // We will start to 0 for the first search , if no item selected
for( unsigned jj = 0; jj < m_netlist.GetCount(); jj++ ) for( unsigned jj = selection+1; jj < m_netlist.GetCount(); jj++ )
{ {
if( m_netlist.GetComponent( jj )->GetFootprintName().IsEmpty() && ii > selection ) if( m_netlist.GetComponent( jj )->GetFootprintName().IsEmpty() )
{ {
m_ListCmp->SetSelection( ii ); m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections
m_ListCmp->SetSelection( jj );
SendMessageToEESCHEMA(); SendMessageToEESCHEMA();
return; return;
} }
ii++;
} }
m_ListCmp->SetSelection( selection );
} }
void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event ) void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
{ {
int ii;
int selection;
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
ii = m_ListCmp->GetCount() - 1; int selection = m_ListCmp->GetFirstSelected();
selection = m_ListCmp->GetSelection();
if( selection < 0 ) if( selection < 0 )
selection = m_ListCmp->GetCount() - 1; selection = m_ListCmp->GetCount();
else
while( m_ListCmp->GetNextSelected( selection ) >= 0 )
selection = m_ListCmp->GetNextSelected( selection );
for( unsigned kk = m_netlist.GetCount() - 1; kk >= 0; kk-- ) for( int kk = selection-1; kk >= 0; kk-- )
{ {
if( m_netlist.GetComponent( kk )->GetFootprintName().IsEmpty() && ii < selection ) if( m_netlist.GetComponent( kk )->GetFootprintName().IsEmpty() )
{ {
m_ListCmp->SetSelection( ii ); m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections
m_ListCmp->SetSelection( kk );
SendMessageToEESCHEMA(); SendMessageToEESCHEMA();
return; return;
} }
ii--;
} }
m_ListCmp->SetSelection( selection );
} }
...@@ -618,9 +608,8 @@ void CVPCB_MAINFRAME::DisplayStatus() ...@@ -618,9 +608,8 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
wxString footprintName = m_FootprintList->GetSelectedFootprint(); wxString footprintName = m_FootprintList->GetSelectedFootprint();
FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName ); FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
wxASSERT( module );
if( module ) if( module ) // can be NULL if no netlist loaded
{ {
msg = _( "Description: " ) + module->m_Doc; msg = _( "Description: " ) + module->m_Doc;
SetStatusText( msg, 0 ); SetStatusText( msg, 0 );
......
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