Show the "Description" field from fp-lib-table in pcbnew's module editor 'set current library' dialog.

This commit is contained in:
Dick Hollenbeck 2013-11-18 10:04:23 -06:00
parent 25bfd82240
commit 7cf3467851
7 changed files with 32 additions and 16 deletions

View File

@ -6,8 +6,6 @@ cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
# Path to local CMake modules. # Path to local CMake modules.
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules ) set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
message( STATUS "CMAKE_CXX_FLAGS_DEBUG:${CMAKE_CXX_FLAGS_DEBUG}" )
# #
# KiCad build options should be added below. # KiCad build options should be added below.
# #

View File

@ -81,7 +81,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
m_filterBox->SetFocus(); m_filterBox->SetFocus();
Layout(); Fit();
} }

View File

@ -139,6 +139,17 @@ bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
} }
const wxString& FP_LIB_TABLE::GetDescription( const wxString& aNickname )
{
// use no exception form of find row:
const ROW* row = findRow( aNickname );
if( row )
return row->description;
else
return wxEmptyString;
}
void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR ) void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR )
{ {
/* /*

View File

@ -462,6 +462,12 @@ public:
//-----</PLUGIN API SUBSET, REBASED ON aNickname>--------------------------- //-----</PLUGIN API SUBSET, REBASED ON aNickname>---------------------------
/**
* Function GetDescription
* returns the library desicription from @a aNickname, or an empty string
* if aNickname does not exist.
*/
const wxString& GetDescription( const wxString& aNickname );
/** /**
* Function InsertRow * Function InsertRow
@ -604,10 +610,10 @@ protected:
/** /**
* Function findRow * Function findRow
* returns a ROW if aNickName is found in this table or in any chained * returns a ROW if aNickname is found in this table or in any chained
* fallBack table fragment, else NULL. * fallBack table fragment, else NULL.
*/ */
ROW* findRow( const wxString& aNickName ) const; ROW* findRow( const wxString& aNickname ) const;
void reindex() void reindex()
{ {

View File

@ -75,7 +75,7 @@
#define FMT_LIBRARY _( "Library" ) // window title #define FMT_LIBRARY _( "Library" ) // window title
#define FMT_MOD_EXISTS _( "Module %s already exists in library <%s>" ) #define FMT_MOD_EXISTS _( "Module %s already exists in library <%s>" )
#define FMT_NO_REF_ABORTED _( "No reference, aborted" ) #define FMT_NO_REF_ABORTED _( "No reference, aborted" )
#define FMT_SELECT_LIB _( "Select Active Library:" ) #define FMT_SELECT_LIB _( "Select Active Library" )
static const wxString ModExportFileWildcard( _( "KiCad foot print export files (*.emp)|*.emp" ) ); static const wxString ModExportFileWildcard( _( "KiCad foot print export files (*.emp)|*.emp" ) );
@ -800,19 +800,21 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
void FOOTPRINT_EDIT_FRAME::Select_Active_Library() void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
{ {
if( m_footprintLibTable->IsEmpty() )
return;
wxArrayString headers; wxArrayString headers;
headers.Add( _( "Library" ) );
headers.Add( _( "Nickname" ) );
headers.Add( _( "Description" ) );
std::vector< wxArrayString > itemsToDisplay; std::vector< wxArrayString > itemsToDisplay;
std::vector< wxString > libNames = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > nicknames = m_footprintLibTable->GetLogicalLibs();
for( unsigned i = 0; i < libNames.size(); i++ ) for( unsigned i = 0; i < nicknames.size(); i++ )
{ {
wxArrayString item; wxArrayString item;
item.Add( libNames[i] );
item.Add( nicknames[i] );
item.Add( m_footprintLibTable->GetDescription( nicknames[i] ) );
itemsToDisplay.push_back( item ); itemsToDisplay.push_back( item );
} }

View File

@ -24,7 +24,6 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <pcb_plot_params.h> #include <pcb_plot_params.h>
#include <pcb_plot_params_lexer.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <plot_common.h> #include <plot_common.h>
#include <macros.h> #include <macros.h>