Cvpcb: fix incorrect behavior when clicking on a component
This commit is contained in:
parent
e50d18bc1b
commit
ccb910eb62
|
@ -500,36 +500,47 @@ void CVPCB_MAINFRAME::OnLeftDClick( wxListEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Called when clicking on a component in component list window
|
||||
* * Updates the filtered foorprint list, if the filtered list option is selected
|
||||
* * Updates the current selected footprint in footprint list
|
||||
* * Updates the footprint shown in footprint display window (if opened)
|
||||
*/
|
||||
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||
{
|
||||
int selection;
|
||||
#define REDRAW_LIST true
|
||||
#define SELECT_FULL_LIST true
|
||||
int selection = -1;
|
||||
|
||||
if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
||||
|
||||
else
|
||||
{
|
||||
m_FootprintList->SetActiveFootprintList( true, true );
|
||||
return;
|
||||
selection = m_ListCmp->GetSelection();
|
||||
|
||||
if( selection < 0 )
|
||||
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
||||
|
||||
else
|
||||
{
|
||||
if( &m_components[ selection ] == NULL )
|
||||
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
||||
else
|
||||
m_FootprintList->SetFootprintFilteredList( &m_components[ selection ],
|
||||
m_footprints );
|
||||
}
|
||||
}
|
||||
|
||||
selection = m_ListCmp->GetSelection();
|
||||
|
||||
if( selection < 0 )
|
||||
{
|
||||
m_FootprintList->SetActiveFootprintList( true, true );
|
||||
return;
|
||||
}
|
||||
|
||||
if( &m_components[ selection ] == NULL )
|
||||
{
|
||||
m_FootprintList->SetActiveFootprintList( true, true );
|
||||
return;
|
||||
}
|
||||
|
||||
m_FootprintList->SetFootprintFilteredList( &m_components[ selection ], m_footprints );
|
||||
|
||||
// Preview of the already assigned footprint.
|
||||
// Find the footprint that was already choosen for this component and select it.
|
||||
wxString module = *(&m_components[ selection ].m_Module);
|
||||
|
||||
bool found = false;
|
||||
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
|
||||
{
|
||||
wxString footprintName;
|
||||
|
@ -539,10 +550,23 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
|||
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
||||
|
||||
if( module.Cmp( footprintName ) == 0 )
|
||||
{
|
||||
m_FootprintList->SetSelection( ii, true );
|
||||
else
|
||||
m_FootprintList->SetSelection( ii, false );
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ! found )
|
||||
{
|
||||
int ii = m_FootprintList->GetSelection();
|
||||
if ( ii >= 0 )
|
||||
m_FootprintList->SetSelection( ii, false );
|
||||
if( m_DisplayFootprintFrame )
|
||||
{
|
||||
CreateScreenCmp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SendMessageToEESCHEMA();
|
||||
DisplayStatus();
|
||||
|
|
|
@ -54,6 +54,14 @@ public:
|
|||
|
||||
void OnLeftClick( wxListEvent& event );
|
||||
void OnLeftDClick( wxListEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnSelectComponent
|
||||
* Called when clicking on a component in component list window
|
||||
* * Updates the filtered foorprint list, if the filtered list option is selected
|
||||
* * Updates the current selected footprint in footprint list
|
||||
* * Updates the footprint shown in footprint display window (if opened)
|
||||
*/
|
||||
void OnSelectComponent( wxListEvent& event );
|
||||
|
||||
void OnQuit( wxCommandEvent& event );
|
||||
|
|
|
@ -84,13 +84,22 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
|
|||
|
||||
m_DisplayFootprintFrame->Zoom_Automatique( false );
|
||||
m_DisplayFootprintFrame->DrawPanel->Refresh();
|
||||
m_DisplayFootprintFrame->UpdateStatusBar(); /* Display new cursor coordinates and zoom value */
|
||||
// Display new cursor coordinates and zoom value:
|
||||
m_DisplayFootprintFrame->UpdateStatusBar();
|
||||
|
||||
if( m_DisplayFootprintFrame->m_Draw3DFrame )
|
||||
m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay();
|
||||
}
|
||||
else if( !IsNew )
|
||||
else if( !IsNew ) // No footprint to display. Erase old footprint, if any
|
||||
{
|
||||
if( m_DisplayFootprintFrame->GetBoard()->m_Modules.GetCount() )
|
||||
{
|
||||
m_DisplayFootprintFrame->GetBoard()->m_Modules.DeleteAll();
|
||||
m_DisplayFootprintFrame->Zoom_Automatique( false );
|
||||
m_DisplayFootprintFrame->SetStatusText( wxEmptyString, 0 );
|
||||
m_DisplayFootprintFrame->UpdateStatusBar();
|
||||
}
|
||||
|
||||
m_DisplayFootprintFrame->Refresh();
|
||||
|
||||
if( m_DisplayFootprintFrame->m_Draw3DFrame )
|
||||
|
@ -98,8 +107,6 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Draws the current highlighted footprint.
|
||||
*/
|
||||
|
@ -131,21 +138,3 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
|
|||
m_Modules->Draw( aPanel, aDC, GR_COPY );
|
||||
}
|
||||
}
|
||||
|
||||
/* dummy_functions:
|
||||
*
|
||||
* These functions are used in some classes.
|
||||
* they are useful in Pcbnew, but have no meaning or are never used
|
||||
* in CvPcb or GerbView.
|
||||
* but they must exist because they appear in some classes.
|
||||
* Do nothing in CvPcb.
|
||||
*/
|
||||
TRACK* MarkTrace( BOARD* aPcb,
|
||||
TRACK* aStartSegm,
|
||||
int* aSegmCount,
|
||||
int* aTrackLen,
|
||||
int* aLenDie,
|
||||
bool aReorder )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue