Formatting.
This commit is contained in:
parent
ea4ade7350
commit
fa78c24a16
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -30,29 +30,25 @@
|
||||||
|
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <listboxes.h>
|
|
||||||
#include <tools/cvpcb_actions.h>
|
#include <tools/cvpcb_actions.h>
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX::FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id ) :
|
FOOTPRINTS_LISTBOX::FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id ) :
|
||||||
ITEMS_LISTBOX_BASE( parent, id, wxDefaultPosition, wxDefaultSize, wxLC_SINGLE_SEL|wxNO_BORDER )
|
ITEMS_LISTBOX_BASE( parent, id, wxDefaultPosition, wxDefaultSize,
|
||||||
{
|
wxLC_SINGLE_SEL | wxNO_BORDER )
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX::~FOOTPRINTS_LISTBOX()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int FOOTPRINTS_LISTBOX::GetCount()
|
int FOOTPRINTS_LISTBOX::GetCount()
|
||||||
{
|
{
|
||||||
return m_footprintList.Count();
|
return (int) m_footprintList.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
||||||
{
|
{
|
||||||
unsigned count = m_footprintList.Count();
|
unsigned count = m_footprintList.Count();
|
||||||
|
|
||||||
if( count > 0 )
|
if( count > 0 )
|
||||||
{
|
{
|
||||||
if( linecount >= count )
|
if( linecount >= count )
|
||||||
|
@ -60,6 +56,7 @@ void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
||||||
|
|
||||||
m_footprintList[linecount] = text;
|
m_footprintList[linecount] = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWidth( linecount );
|
UpdateWidth( linecount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,15 +78,6 @@ wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text )
|
|
||||||
{
|
|
||||||
m_footprintList.Add( text );
|
|
||||||
int lines = m_footprintList.Count();
|
|
||||||
SetItemCount( lines );
|
|
||||||
UpdateWidth( lines - 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
|
wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
|
||||||
{
|
{
|
||||||
if( item < 0 || item >= (long)m_footprintList.GetCount() )
|
if( item < 0 || item >= (long)m_footprintList.GetCount() )
|
||||||
|
@ -104,7 +92,7 @@ void FOOTPRINTS_LISTBOX::SetSelection( int aIndex, bool aState )
|
||||||
if( aIndex >= GetCount() )
|
if( aIndex >= GetCount() )
|
||||||
aIndex = GetCount() - 1;
|
aIndex = GetCount() - 1;
|
||||||
|
|
||||||
if(( aIndex >= 0) && ( GetCount() > 0) )
|
if( aIndex >= 0 && GetCount() > 0)
|
||||||
{
|
{
|
||||||
Select( aIndex, aState );
|
Select( aIndex, aState );
|
||||||
EnsureVisible( aIndex );
|
EnsureVisible( aIndex );
|
||||||
|
@ -249,7 +237,8 @@ void FOOTPRINTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; jj < text.Len(); jj++ )
|
for( ; jj < text.Len(); jj++ )
|
||||||
{ // skip blanks
|
{
|
||||||
|
// skip blanks
|
||||||
if( text[jj] != ' ' )
|
if( text[jj] != ' ' )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -21,15 +21,9 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file library_listbox.cpp
|
|
||||||
* class to display used library and selecting it
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
|
|
||||||
#include <cvpcb_mainframe.h>
|
#include <cvpcb_mainframe.h>
|
||||||
#include <listboxes.h>
|
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include "lib_tree_model_adapter.h"
|
#include "lib_tree_model_adapter.h"
|
||||||
|
@ -40,25 +34,21 @@
|
||||||
/***************************************/
|
/***************************************/
|
||||||
|
|
||||||
LIBRARY_LISTBOX::LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id ) :
|
LIBRARY_LISTBOX::LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id ) :
|
||||||
ITEMS_LISTBOX_BASE( parent, id, wxDefaultPosition, wxDefaultSize, wxLC_SINGLE_SEL )
|
ITEMS_LISTBOX_BASE( parent, id, wxDefaultPosition, wxDefaultSize, wxLC_SINGLE_SEL )
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LIBRARY_LISTBOX::~LIBRARY_LISTBOX()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIBRARY_LISTBOX::GetCount()
|
int LIBRARY_LISTBOX::GetCount()
|
||||||
{
|
{
|
||||||
return m_libraryList.Count();
|
return (int) m_libraryList.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
||||||
{
|
{
|
||||||
unsigned count = m_libraryList.Count();
|
unsigned count = m_libraryList.Count();
|
||||||
|
|
||||||
if( count > 0 )
|
if( count > 0 )
|
||||||
{
|
{
|
||||||
if( linecount >= count )
|
if( linecount >= count )
|
||||||
|
@ -129,11 +119,13 @@ void LIBRARY_LISTBOX::Finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIBRARY_LISTBOX::ClearList()
|
void LIBRARY_LISTBOX::ClearList()
|
||||||
{
|
{
|
||||||
m_libraryList.clear();
|
m_libraryList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE )
|
BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE )
|
||||||
EVT_CHAR( LIBRARY_LISTBOX::OnChar )
|
EVT_CHAR( LIBRARY_LISTBOX::OnChar )
|
||||||
EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, LIBRARY_LISTBOX::OnSelectLibrary )
|
EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, LIBRARY_LISTBOX::OnSelectLibrary )
|
||||||
|
@ -180,7 +172,8 @@ void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; jj < text.Len(); jj++ )
|
for( ; jj < text.Len(); jj++ )
|
||||||
{ // skip blanks
|
{
|
||||||
|
// skip blanks
|
||||||
if( text[jj] != ' ' )
|
if( text[jj] != ' ' )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,13 +98,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
||||||
~FOOTPRINTS_LISTBOX();
|
~FOOTPRINTS_LISTBOX() override {};
|
||||||
|
|
||||||
int GetCount();
|
int GetCount();
|
||||||
void SetSelection( int aIndex, bool aState = true );
|
void SetSelection( int aIndex, bool aState = true );
|
||||||
void SetSelectedFootprint( const LIB_ID& aFPID );
|
void SetSelectedFootprint( const LIB_ID& aFPID );
|
||||||
void SetString( unsigned linecount, const wxString& text );
|
void SetString( unsigned linecount, const wxString& text );
|
||||||
void AppendLine( const wxString& text );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate the wxListCtrl with the footprints from \a aList that meet the filter
|
* Populate the wxListCtrl with the footprints from \a aList that meet the filter
|
||||||
|
@ -144,7 +143,7 @@ class LIBRARY_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
||||||
~LIBRARY_LISTBOX();
|
~LIBRARY_LISTBOX() override {};
|
||||||
|
|
||||||
int GetCount();
|
int GetCount();
|
||||||
void SetSelection( int index, bool State = true );
|
void SetSelection( int index, bool State = true );
|
||||||
|
|
Loading…
Reference in New Issue