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.
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.
#

View File

@ -159,7 +159,7 @@ set(COMMON_SRCS
math/math_util.cpp
system/fcontext.s
tool/tool_base.cpp
tool/tool_manager.cpp
tool/tool_dispatcher.cpp
@ -231,7 +231,7 @@ set(PCB_COMMON_SRCS
)
set(PCB_COMMON_SRCS
${PCB_COMMON_SRCS}
${PCB_COMMON_SRCS}
../pcbnew/pcb_painter.cpp
)

View File

@ -81,7 +81,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
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 )
{
/*

View File

@ -462,6 +462,12 @@ public:
//-----</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
@ -604,10 +610,10 @@ protected:
/**
* 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.
*/
ROW* findRow( const wxString& aNickName ) const;
ROW* findRow( const wxString& aNickname ) const;
void reindex()
{

View File

@ -75,7 +75,7 @@
#define FMT_LIBRARY _( "Library" ) // window title
#define FMT_MOD_EXISTS _( "Module %s already exists in library <%s>" )
#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" ) );
@ -800,19 +800,21 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
{
if( m_footprintLibTable->IsEmpty() )
return;
wxArrayString headers;
headers.Add( _( "Library" ) );
headers.Add( _( "Nickname" ) );
headers.Add( _( "Description" ) );
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;
item.Add( libNames[i] );
item.Add( nicknames[i] );
item.Add( m_footprintLibTable->GetDescription( nicknames[i] ) );
itemsToDisplay.push_back( item );
}

View File

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