fixed code to better comply with the coding style guidelines
This commit is contained in:
parent
97f4d18a13
commit
29240fd14b
|
@ -41,56 +41,73 @@
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||||
{
|
{
|
||||||
COMPONENT_INFO* Component;
|
COMPONENT_INFO* component;
|
||||||
bool isUndefined = false;
|
bool hasFootprint = false;
|
||||||
int NumCmp;
|
int componentIndex;
|
||||||
int LastCmp;
|
wxString description;
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
if( m_components.empty() )
|
if( m_components.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// if no component is selected, select the first one
|
||||||
|
|
||||||
if(m_ListCmp->GetFirstSelected() < 0)
|
if(m_ListCmp->GetFirstSelected() < 0)
|
||||||
{
|
{
|
||||||
NumCmp = 0;
|
componentIndex = 0;
|
||||||
m_ListCmp->SetSelection( NumCmp, true );
|
m_ListCmp->SetSelection( componentIndex, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( (NumCmp = m_ListCmp->GetFirstSelected() ) != -1)
|
// iterate over the selection
|
||||||
{
|
|
||||||
Component = &m_components[NumCmp];
|
|
||||||
|
|
||||||
if( Component == NULL )
|
while( m_ListCmp->GetFirstSelected() != -1)
|
||||||
|
{
|
||||||
|
// get the component for the current iteration
|
||||||
|
|
||||||
|
componentIndex = m_ListCmp->GetFirstSelected();
|
||||||
|
component = &m_components[componentIndex];
|
||||||
|
|
||||||
|
if( component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isUndefined = Component->m_Footprint.IsEmpty();
|
// check to see if the component has allready a footprint set.
|
||||||
|
|
||||||
Component->m_Footprint = aFootprintName;
|
hasFootprint = !(component->m_Footprint.IsEmpty());
|
||||||
|
|
||||||
msg.Printf( CMP_FORMAT, NumCmp + 1,
|
component->m_Footprint = aFootprintName;
|
||||||
GetChars( Component->m_Reference ),
|
|
||||||
GetChars( Component->m_Value ),
|
|
||||||
GetChars( Component->m_Footprint ) );
|
|
||||||
|
|
||||||
if( isUndefined )
|
// create the new component description
|
||||||
|
|
||||||
|
description.Printf( CMP_FORMAT, componentIndex + 1,
|
||||||
|
GetChars( component->m_Reference ),
|
||||||
|
GetChars( component->m_Value ),
|
||||||
|
GetChars( component->m_Footprint ) );
|
||||||
|
|
||||||
|
// if the component hasn't had a footprint associated with it
|
||||||
|
// it now has, so we decrement the count of components without
|
||||||
|
// a footprint assigned.
|
||||||
|
|
||||||
|
if( !hasFootprint )
|
||||||
|
{
|
||||||
|
hasFootprint = true;
|
||||||
m_undefinedComponentCnt -= 1;
|
m_undefinedComponentCnt -= 1;
|
||||||
|
|
||||||
m_ListCmp->SetString( NumCmp, msg );
|
|
||||||
m_ListCmp->SetSelection( NumCmp, false );
|
|
||||||
|
|
||||||
isUndefined = false;
|
|
||||||
LastCmp = NumCmp;
|
|
||||||
|
|
||||||
DisplayStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the new description and deselect the processed component
|
||||||
|
m_ListCmp->SetString( componentIndex, description );
|
||||||
|
m_ListCmp->SetSelection( componentIndex, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
// mark this "session" as modified
|
||||||
m_modified = true;
|
m_modified = true;
|
||||||
|
|
||||||
if( LastCmp < (m_ListCmp->GetCount() - 1) )
|
// select the next component, if there is one
|
||||||
NumCmp = LastCmp + 1;
|
if( componentIndex < (m_ListCmp->GetCount() - 1) )
|
||||||
|
componentIndex++;
|
||||||
|
|
||||||
m_ListCmp->SetSelection( NumCmp, true );
|
m_ListCmp->SetSelection( componentIndex, true );
|
||||||
|
|
||||||
|
// update the statusbar
|
||||||
|
DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue