From 7cf346785140adf1cdd39cc94a78197a8469967c Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Mon, 18 Nov 2013 10:04:23 -0600 Subject: [PATCH] Show the "Description" field from fp-lib-table in pcbnew's module editor 'set current library' dialog. --- CMakeLists.txt | 2 -- common/CMakeLists.txt | 4 ++-- common/displlst.cpp | 2 +- common/fp_lib_table.cpp | 11 +++++++++++ include/fp_lib_table.h | 10 ++++++++-- pcbnew/librairi.cpp | 18 ++++++++++-------- pcbnew/pcb_plot_params.cpp | 1 - 7 files changed, 32 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8f6a09dc2..c5acfa0ac2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. # diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 6a226f0b9f..b4d676ef67 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -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 ) diff --git a/common/displlst.cpp b/common/displlst.cpp index 3cc2097e9b..8aacb4be46 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -81,7 +81,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl m_filterBox->SetFocus(); - Layout(); + Fit(); } diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 6f5fcd4d25..e0dd00d710 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -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 ) { /* diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 9f0e97a8b8..b6b491ba68 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -462,6 +462,12 @@ public: //-------------------------------- + /** + * 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() { diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index d2187d7ab7..2db0b816a2 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -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 ); } diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 7c4bf15ed3..326c33d056 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include