Added mutli-selection to cvpcb
This commit is contained in:
parent
92f8f006fa
commit
99c1d45fa0
|
@ -17,7 +17,7 @@
|
||||||
COMPONENTS_LISTBOX::COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
COMPONENTS_LISTBOX::COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
||||||
const wxPoint& loc, const wxSize& size,
|
const wxPoint& loc, const wxSize& size,
|
||||||
int nbitems, wxString choice[] ) :
|
int nbitems, wxString choice[] ) :
|
||||||
ITEMS_LISTBOX_BASE( parent, id, loc, size )
|
ITEMS_LISTBOX_BASE( parent, id, loc, size, ~wxLC_SINGLE_SEL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ class ITEMS_LISTBOX_BASE : public wxListView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
|
ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
|
||||||
const wxPoint& aLocation, const wxSize& aSize );
|
const wxPoint& aLocation, const wxSize& aSize,
|
||||||
|
long aStyle = wxLC_SINGLE_SEL);
|
||||||
|
|
||||||
~ITEMS_LISTBOX_BASE();
|
~ITEMS_LISTBOX_BASE();
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#define LISTB_STYLE wxSUNKEN_BORDER | wxLC_NO_HEADER | \
|
#define LISTB_STYLE wxSUNKEN_BORDER | wxLC_NO_HEADER | \
|
||||||
wxLC_SINGLE_SEL | wxLC_REPORT | wxLC_VIRTUAL
|
wxLC_REPORT | wxLC_VIRTUAL
|
||||||
|
|
||||||
ITEMS_LISTBOX_BASE::ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
|
ITEMS_LISTBOX_BASE::ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
|
||||||
const wxPoint& aLocation, const wxSize& aSize ) :
|
const wxPoint& aLocation, const wxSize& aSize,
|
||||||
wxListView( aParent, aId, aLocation, aSize, LISTB_STYLE )
|
long aStyle) :
|
||||||
|
wxListView( aParent, aId, aLocation, aSize, LISTB_STYLE | aStyle )
|
||||||
{
|
{
|
||||||
InsertColumn( 0, wxEmptyString );
|
InsertColumn( 0, wxEmptyString );
|
||||||
SetColumnWidth( 0, wxLIST_AUTOSIZE );
|
SetColumnWidth( 0, wxLIST_AUTOSIZE );
|
||||||
|
|
|
@ -39,25 +39,25 @@
|
||||||
|
|
||||||
#define titleComponentLibErr _( "Component Library Error" )
|
#define titleComponentLibErr _( "Component Library Error" )
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||||
{
|
{
|
||||||
COMPONENT_INFO* Component;
|
COMPONENT_INFO* Component;
|
||||||
bool isUndefined = false;
|
bool isUndefined = false;
|
||||||
int NumCmp;
|
int NumCmp;
|
||||||
|
int LastCmp;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( m_components.empty() )
|
if( m_components.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NumCmp = m_ListCmp->GetSelection();
|
if(m_ListCmp->GetFirstSelected() < 0)
|
||||||
|
|
||||||
if( NumCmp < 0 )
|
|
||||||
{
|
{
|
||||||
NumCmp = 0;
|
NumCmp = 0;
|
||||||
m_ListCmp->SetSelection( NumCmp, true );
|
m_ListCmp->SetSelection( NumCmp, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while( (NumCmp = m_ListCmp->GetFirstSelected() ) != -1)
|
||||||
|
{
|
||||||
Component = &m_components[NumCmp];
|
Component = &m_components[NumCmp];
|
||||||
|
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
|
@ -71,7 +71,6 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||||
GetChars( Component->m_Reference ),
|
GetChars( Component->m_Reference ),
|
||||||
GetChars( Component->m_Value ),
|
GetChars( Component->m_Value ),
|
||||||
GetChars( Component->m_Footprint ) );
|
GetChars( Component->m_Footprint ) );
|
||||||
m_modified = true;
|
|
||||||
|
|
||||||
if( isUndefined )
|
if( isUndefined )
|
||||||
m_undefinedComponentCnt -= 1;
|
m_undefinedComponentCnt -= 1;
|
||||||
|
@ -79,13 +78,19 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||||
m_ListCmp->SetString( NumCmp, msg );
|
m_ListCmp->SetString( NumCmp, msg );
|
||||||
m_ListCmp->SetSelection( NumCmp, false );
|
m_ListCmp->SetSelection( NumCmp, false );
|
||||||
|
|
||||||
// We activate next component:
|
isUndefined = false;
|
||||||
if( NumCmp < (m_ListCmp->GetCount() - 1) )
|
LastCmp = NumCmp;
|
||||||
NumCmp++;
|
|
||||||
|
DisplayStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_modified = true;
|
||||||
|
|
||||||
|
if( LastCmp < (m_ListCmp->GetCount() - 1) )
|
||||||
|
NumCmp = LastCmp + 1;
|
||||||
|
|
||||||
m_ListCmp->SetSelection( NumCmp, true );
|
m_ListCmp->SetSelection( NumCmp, true );
|
||||||
|
|
||||||
DisplayStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue