Rework footprint library table for use in symbol library table.

Factor out ROW object from FP_LIB_TABLE so it can be reused to create a
symbol library table row object.

Create base LIB_TABLE_ROW object from ROW object common code.

Derived FP_LIB_TABLE_ROW object from LIB_TABLE_ROW to provide support for
footprint library table rows.

Update all instances of FP_LIB_TABLE::ROW with FP_LIB_TABLE_ROW.

Purge wxT() macros from modified files where possible.
This commit is contained in:
Wayne Stambaugh 2016-10-28 09:11:23 -04:00
parent 86dcfeb69d
commit 192d4b87ad
5 changed files with 369 additions and 297 deletions

View File

@ -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) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2016 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
@ -48,7 +48,7 @@ using namespace FP_LIB_TABLE_T;
static const wxChar global_tbl_name[] = wxT( "fp-lib-table" ); static const wxChar global_tbl_name[] = wxT( "fp-lib-table" );
void FP_LIB_TABLE::ROW::SetType( const wxString& aType ) void FP_LIB_TABLE_ROW::SetType( const wxString& aType )
{ {
type = IO_MGR::EnumFromStr( aType ); type = IO_MGR::EnumFromStr( aType );
@ -57,7 +57,7 @@ void FP_LIB_TABLE::ROW::SetType( const wxString& aType )
} }
void FP_LIB_TABLE::ROW::SetFullURI( const wxString& aFullURI ) void LIB_TABLE_ROW::SetFullURI( const wxString& aFullURI )
{ {
uri_user = aFullURI; uri_user = aFullURI;
@ -67,7 +67,7 @@ void FP_LIB_TABLE::ROW::SetFullURI( const wxString& aFullURI )
} }
const wxString FP_LIB_TABLE::ROW::GetFullURI( bool aSubstituted ) const const wxString LIB_TABLE_ROW::GetFullURI( bool aSubstituted ) const
{ {
if( aSubstituted ) if( aSubstituted )
{ {
@ -83,9 +83,8 @@ const wxString FP_LIB_TABLE::ROW::GetFullURI( bool aSubstituted ) const
} }
FP_LIB_TABLE::ROW::ROW( const ROW& a ) : LIB_TABLE_ROW::LIB_TABLE_ROW( const LIB_TABLE_ROW& a ) :
nickName( a.nickName ), nickName( a.nickName ),
type( a.type ),
options( a.options ), options( a.options ),
description( a.description ), description( a.description ),
properties( 0 ) properties( 0 )
@ -98,10 +97,9 @@ FP_LIB_TABLE::ROW::ROW( const ROW& a ) :
} }
FP_LIB_TABLE::ROW& FP_LIB_TABLE::ROW::operator=( const ROW& r ) LIB_TABLE_ROW& LIB_TABLE_ROW::operator=( const LIB_TABLE_ROW& r )
{ {
nickName = r.nickName; nickName = r.nickName;
type = r.type;
options = r.options; options = r.options;
description = r.description; description = r.description;
properties = r.properties ? new PROPERTIES( *r.properties ) : NULL; properties = r.properties ? new PROPERTIES( *r.properties ) : NULL;
@ -109,22 +107,64 @@ FP_LIB_TABLE::ROW& FP_LIB_TABLE::ROW::operator=( const ROW& r )
// may call ExpandSubstitutions() // may call ExpandSubstitutions()
SetFullURI( r.uri_user ); SetFullURI( r.uri_user );
// Do not copy the PLUGIN, it is lazily created. Delete any existing return *this;
// destination plugin. }
bool LIB_TABLE_ROW::operator==( const LIB_TABLE_ROW& r ) const
{
return nickName == r.nickName
&& uri_user == r.uri_user
&& options == r.options
&& description == r.description
;
}
void LIB_TABLE_ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR, boost::interprocess::lock_exception )
{
out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s))\n",
out->Quotew( GetNickName() ).c_str(),
out->Quotew( GetType() ).c_str(),
out->Quotew( GetFullURI() ).c_str(),
out->Quotew( GetOptions() ).c_str(),
out->Quotew( GetDescr() ).c_str()
);
}
void LIB_TABLE_ROW::SetOptions( const wxString& aOptions )
{
options = aOptions;
// set PROPERTIES* from options
setProperties( FP_LIB_TABLE::ParseOptions( TO_UTF8( aOptions ) ) );
}
FP_LIB_TABLE_ROW::FP_LIB_TABLE_ROW( const FP_LIB_TABLE_ROW& aRow ) :
LIB_TABLE_ROW( aRow ),
type( aRow.type )
{
}
FP_LIB_TABLE_ROW& FP_LIB_TABLE_ROW::operator=( const FP_LIB_TABLE_ROW& aRow )
{
LIB_TABLE_ROW::operator = ( aRow );
type = aRow.type;
// Do not copy the PLUGIN, it is lazily created. Delete any existing destination plugin.
setPlugin( NULL ); setPlugin( NULL );
return *this; return *this;
} }
bool FP_LIB_TABLE::ROW::operator==( const ROW& r ) const bool FP_LIB_TABLE_ROW::operator==( const FP_LIB_TABLE_ROW& aRow ) const
{ {
return nickName == r.nickName return LIB_TABLE_ROW::operator == ( aRow ) && type == aRow.type;
&& uri_user == r.uri_user
&& type == r.type
&& options == r.options
&& description == r.description
;
} }
@ -144,7 +184,7 @@ FP_LIB_TABLE::~FP_LIB_TABLE()
wxArrayString FP_LIB_TABLE::FootprintEnumerate( const wxString& aNickname ) wxArrayString FP_LIB_TABLE::FootprintEnumerate( const wxString& aNickname )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
return row->plugin->FootprintEnumerate( row->GetFullURI( true ), row->GetProperties() ); return row->plugin->FootprintEnumerate( row->GetFullURI( true ), row->GetProperties() );
} }
@ -152,10 +192,11 @@ wxArrayString FP_LIB_TABLE::FootprintEnumerate( const wxString& aNickname )
MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& aFootprintName ) MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& aFootprintName )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
MODULE* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName, row->GetProperties() ); MODULE* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName,
row->GetProperties() );
// The library cannot know its own name, because it might have been renamed or moved. // The library cannot know its own name, because it might have been renamed or moved.
// Therefore footprints cannot know their own library nickname when residing in // Therefore footprints cannot know their own library nickname when residing in
@ -183,7 +224,7 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
const MODULE* aFootprint, bool aOverwrite ) const MODULE* aFootprint, bool aOverwrite )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
if( !aOverwrite ) if( !aOverwrite )
@ -208,15 +249,16 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
void FP_LIB_TABLE::FootprintDelete( const wxString& aNickname, const wxString& aFootprintName ) void FP_LIB_TABLE::FootprintDelete( const wxString& aNickname, const wxString& aFootprintName )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
return row->plugin->FootprintDelete( row->GetFullURI( true ), aFootprintName, row->GetProperties() ); return row->plugin->FootprintDelete( row->GetFullURI( true ), aFootprintName,
row->GetProperties() );
} }
bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname ) bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
return row->plugin->IsFootprintLibWritable( row->GetFullURI( true ) ); return row->plugin->IsFootprintLibWritable( row->GetFullURI( true ) );
} }
@ -224,7 +266,7 @@ bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname ) void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
row->plugin->FootprintLibDelete( row->GetFullURI( true ), row->GetProperties() ); row->plugin->FootprintLibDelete( row->GetFullURI( true ), row->GetProperties() );
} }
@ -232,7 +274,7 @@ void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname )
void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname ) void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
{ {
const ROW* row = FindRow( aNickname ); const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
row->plugin->FootprintLibCreate( row->GetFullURI( true ), row->GetProperties() ); row->plugin->FootprintLibCreate( row->GetFullURI( true ), row->GetProperties() );
} }
@ -241,9 +283,10 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
const wxString FP_LIB_TABLE::GetDescription( const wxString& aNickname ) const wxString FP_LIB_TABLE::GetDescription( const wxString& aNickname )
{ {
// use "no exception" form of find row: // use "no exception" form of find row:
const ROW* row = findRow( aNickname ); const FP_LIB_TABLE_ROW* row = dynamic_cast< FP_LIB_TABLE_ROW* >( findRow( aNickname ) );
if( row ) if( row )
return row->description; return row->GetDescr();
else else
return wxEmptyString; return wxEmptyString;
} }
@ -273,7 +316,7 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
while( ( tok = in->NextTok() ) != T_RIGHT ) while( ( tok = in->NextTok() ) != T_RIGHT )
{ {
ROW row; // reconstructed for each row in input stream. FP_LIB_TABLE_ROW row; // reconstructed for each row in input stream.
if( tok == T_EOF ) if( tok == T_EOF )
in->Expecting( T_RIGHT ); in->Expecting( T_RIGHT );
@ -372,7 +415,7 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format(
_( "'%s' is a duplicate footprint library nickName" ), _( "'%s' is a duplicate footprint library nickName" ),
GetChars( row.nickName ) ); GetChars( row.GetNickName() ) );
THROW_PARSE_ERROR( msg, in->CurSource(), in->CurLine(), lineNum, offset ); THROW_PARSE_ERROR( msg, in->CurSource(), in->CurLine(), lineNum, offset );
} }
} }
@ -384,25 +427,13 @@ void FP_LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
{ {
out->Print( nestLevel, "(fp_lib_table\n" ); out->Print( nestLevel, "(fp_lib_table\n" );
for( ROWS_CITER it = rows.begin(); it != rows.end(); ++it ) for( FP_LIB_TABLE_ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
it->Format( out, nestLevel+1 ); it->Format( out, nestLevel+1 );
out->Print( nestLevel, ")\n" ); out->Print( nestLevel, ")\n" );
} }
void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR, boost::interprocess::lock_exception )
{
out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s))\n",
out->Quotew( GetNickName() ).c_str(),
out->Quotew( GetType() ).c_str(),
out->Quotew( GetFullURI() ).c_str(),
out->Quotew( GetOptions() ).c_str(),
out->Quotew( GetDescr() ).c_str()
);
}
#define OPT_SEP '|' ///< options separator character #define OPT_SEP '|' ///< options separator character
PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList ) PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList )
@ -460,6 +491,7 @@ PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList )
if( props.size() ) if( props.size() )
return new PROPERTIES( props ); return new PROPERTIES( props );
} }
return NULL; return NULL;
} }
@ -514,9 +546,9 @@ std::vector<wxString> FP_LIB_TABLE::GetLogicalLibs()
do do
{ {
for( ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it ) for( FP_LIB_TABLE_ROWS_CITER it = cur->rows.begin(); it!=cur->rows.end(); ++it )
{ {
unique.insert( it->nickName ); unique.insert( it->GetNickName() );
} }
} while( ( cur = cur->fallBack ) != 0 ); } while( ( cur = cur->fallBack ) != 0 );
@ -536,7 +568,7 @@ std::vector<wxString> FP_LIB_TABLE::GetLogicalLibs()
} }
FP_LIB_TABLE::ROW* FP_LIB_TABLE::findRow( const wxString& aNickName ) const LIB_TABLE_ROW* FP_LIB_TABLE::findRow( const wxString& aNickName ) const
{ {
FP_LIB_TABLE* cur = (FP_LIB_TABLE*) this; FP_LIB_TABLE* cur = (FP_LIB_TABLE*) this;
@ -558,7 +590,7 @@ FP_LIB_TABLE::ROW* FP_LIB_TABLE::findRow( const wxString& aNickName ) const
} }
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRowByURI( const wxString& aURI ) const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRowByURI( const wxString& aURI )
{ {
FP_LIB_TABLE* cur = this; FP_LIB_TABLE* cur = this;
@ -571,7 +603,7 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRowByURI( const wxString& aURI )
wxString uri = cur->rows[i].GetFullURI( true ); wxString uri = cur->rows[i].GetFullURI( true );
if( wxFileName::GetPathSeparator() == wxChar( '\\' ) && uri.Find( wxChar( '/' ) ) >= 0 ) if( wxFileName::GetPathSeparator() == wxChar( '\\' ) && uri.Find( wxChar( '/' ) ) >= 0 )
uri.Replace( wxT( "/" ), wxT( "\\" ) ); uri.Replace( "/", "\\" );
if( (wxFileName::IsCaseSensitive() && uri == aURI) if( (wxFileName::IsCaseSensitive() && uri == aURI)
|| (!wxFileName::IsCaseSensitive() && uri.Upper() == aURI.Upper() ) ) || (!wxFileName::IsCaseSensitive() && uri.Upper() == aURI.Upper() ) )
@ -587,16 +619,16 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRowByURI( const wxString& aURI )
} }
bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace ) bool FP_LIB_TABLE::InsertRow( const FP_LIB_TABLE_ROW& aRow, bool doReplace )
{ {
ensureIndex(); ensureIndex();
INDEX_CITER it = nickIndex.find( aRow.nickName ); INDEX_CITER it = nickIndex.find( aRow.GetNickName() );
if( it == nickIndex.end() ) if( it == nickIndex.end() )
{ {
rows.push_back( aRow ); rows.push_back( aRow );
nickIndex.insert( INDEX_VALUE( aRow.nickName, rows.size() - 1 ) ); nickIndex.insert( INDEX_VALUE( aRow.GetNickName(), rows.size() - 1 ) );
return true; return true;
} }
@ -610,10 +642,10 @@ bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace )
} }
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname ) const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
throw( IO_ERROR ) throw( IO_ERROR )
{ {
ROW* row = findRow( aNickname ); FP_LIB_TABLE_ROW* row = dynamic_cast< FP_LIB_TABLE_ROW* >( findRow( aNickname ) );
if( !row ) if( !row )
{ {
@ -625,7 +657,7 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
} }
// We've been 'lazy' up until now, but it cannot be deferred any longer, // We've been 'lazy' up until now, but it cannot be deferred any longer,
// instantiate a PLUGIN of the proper kind if it is not already in this ROW. // instantiate a PLUGIN of the proper kind if it is not already in this LIB_TABLE_ROW.
if( !row->plugin ) if( !row->plugin )
row->setPlugin( IO_MGR::PluginFind( row->type ) ); row->setPlugin( IO_MGR::PluginFind( row->type ) );
@ -698,7 +730,7 @@ MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const FPID& aFootprintI
const wxString FP_LIB_TABLE::GlobalPathEnvVariableName() const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
{ {
return wxT( "KISYSMOD" ); return "KISYSMOD";
} }
@ -769,4 +801,3 @@ void FP_LIB_TABLE::Save( const wxString& aFileName )
FILE_OUTPUTFORMATTER sf( aFileName ); FILE_OUTPUTFORMATTER sf( aFileName );
Format( &sf, 0 ); Format( &sf, 0 );
} }

View File

@ -2,8 +2,8 @@
* 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) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2012-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2012-2016 KiCad Developers, see change_log.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
@ -42,6 +42,215 @@ class MODULE;
class FP_LIB_TABLE_LEXER; class FP_LIB_TABLE_LEXER;
class FPID; class FPID;
/**
* Class LIB_TABLE_ROW
*
* holds a record identifying a library accessed by the appropriate #PLUGIN object in the
* #FP_LIB_TABLE.
*/
class LIB_TABLE_ROW
{
public:
LIB_TABLE_ROW() :
properties( 0 )
{
}
virtual ~LIB_TABLE_ROW()
{
delete properties;
}
LIB_TABLE_ROW( const wxString& aNick, const wxString& aURI, const wxString& aOptions,
const wxString& aDescr = wxEmptyString ) :
nickName( aNick ),
description( aDescr ),
properties( 0 )
{
SetOptions( aOptions ),
SetFullURI( aURI );
}
LIB_TABLE_ROW( const LIB_TABLE_ROW& aRow );
LIB_TABLE_ROW& operator=( const LIB_TABLE_ROW& r );
bool operator==( const LIB_TABLE_ROW& r ) const;
bool operator!=( const LIB_TABLE_ROW& r ) const { return !( *this == r ); }
//-----<accessors>------------------------------------------------------
/**
* Function GetNickName
* returns the short name of this library table row.
*/
const wxString& GetNickName() const { return nickName; }
/**
* Function SetNickName
* changes the logical name of this library, useful for an editor.
*/
void SetNickName( const wxString& aNickName ) { nickName = aNickName; }
/**
* Function GetType
* is a pure virtual function that returns the type of LIB represented by this row.
*/
virtual const wxString GetType() const = 0;
/**
* Function SetType
*
* is a pure virtual function changes the type represented by this row that must
* be implemented in the derived object to provide the library table row type.
*/
virtual void SetType( const wxString& aType ) = 0;
/**
* Function GetFullURI
* returns the full location specifying URI for the LIB, either in original
* UI form or in environment variable expanded form.
*
* @param aSubstituted Tells if caller wanted the substituted form, else not.
*/
const wxString GetFullURI( bool aSubstituted = false ) const;
/**
* Function SetFullURI
* changes the full URI for the library.
*/
void SetFullURI( const wxString& aFullURI );
/**
* Function GetOptions
* returns the options string, which may hold a password or anything else needed to
* instantiate the underlying LIB_SOURCE.
*/
const wxString& GetOptions() const { return options; }
/**
* Function SetOptions
*/
void SetOptions( const wxString& aOptions );
/**
* Function GetDescr
* returns the description of the library referenced by this row.
*/
const wxString& GetDescr() const { return description; }
/**
* Function SetDescr
* changes the description of the library referenced by this row.
*/
void SetDescr( const wxString& aDescr ) { description = aDescr; }
/**
* Function GetProperties
* returns the constant PROPERTIES for this library (LIB_TABLE_ROW). These are
* the "options" in a table.
*/
const PROPERTIES* GetProperties() const { return properties; }
//-----</accessors>-----------------------------------------------------
/**
* Function Format
*
* serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
* make it look good using multiple lines and indentation.
*
* @param out is an #OUTPUTFORMATTER
* @param nestLevel is the indentation level to base all lines of the output.
* Actual indentation will be 2 spaces for each nestLevel.
*/
void Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR, boost::interprocess::lock_exception );
private:
/**
* Function setProperties
*
* sets this LIB_TABLE_ROW's PROPERTIES by taking ownership of @a aProperties.
*
* @param aProperties ownership is given over to this LIB_TABLE_ROW.
*/
void setProperties( const PROPERTIES* aProperties )
{
delete properties;
properties = aProperties;
}
wxString nickName;
wxString uri_user; ///< what user entered from UI or loaded from disk
#if !FP_LATE_ENVVAR
wxString uri_expanded; ///< from ExpandSubstitutions()
#endif
wxString options;
wxString description;
const PROPERTIES* properties;
};
class FP_LIB_TABLE_ROW : public LIB_TABLE_ROW
{
friend class FP_LIB_TABLE;
friend class DIALOG_FP_LIB_TABLE;
public:
typedef IO_MGR::PCB_FILE_T LIB_T;
FP_LIB_TABLE_ROW( const wxString& aNick, const wxString& aURI, const wxString& aType,
const wxString& aOptions, const wxString& aDescr = wxEmptyString ) :
LIB_TABLE_ROW( aNick, aURI, aOptions, aDescr )
{
SetType( aType );
}
FP_LIB_TABLE_ROW() :
type( IO_MGR::KICAD )
{
}
FP_LIB_TABLE_ROW( const FP_LIB_TABLE_ROW& aRow );
FP_LIB_TABLE_ROW& operator=( const FP_LIB_TABLE_ROW& aRow );
/// Used in DIALOG_FP_LIB_TABLE for detecting an edit.
bool operator==( const FP_LIB_TABLE_ROW& aRow ) const;
bool operator!=( const FP_LIB_TABLE_ROW& aRow ) const { return !( *this == aRow ); }
/**
* Function GetType
* returns the type of LIB represented by this row.
*/
const wxString GetType() const override { return IO_MGR::ShowType( type ); }
/**
* Function SetType
* changes the type represented by this row.
*/
void SetType( const wxString& aType ) override;
private:
void setPlugin( PLUGIN* aPlugin )
{
plugin.set( aPlugin );
}
PLUGIN::RELEASER plugin;
LIB_T type;
};
/** /**
* Class FP_LIB_TABLE * Class FP_LIB_TABLE
* holds FP_LIB_TABLE::ROW records (rows), and can be searched based on library nickName. * holds FP_LIB_TABLE::ROW records (rows), and can be searched based on library nickName.
@ -85,179 +294,11 @@ class FPID;
*/ */
class FP_LIB_TABLE : public PROJECT::_ELEM class FP_LIB_TABLE : public PROJECT::_ELEM
{ {
friend class FP_LIB_TABLE_ROW;
friend class DIALOG_FP_LIB_TABLE; friend class DIALOG_FP_LIB_TABLE;
public: public:
/**
* Class ROW
* holds a record identifying a footprint library accessed by the appropriate #PLUGIN
* object in the #FP_LIB_TABLE.
*/
class ROW
{
friend class FP_LIB_TABLE;
friend class DIALOG_FP_LIB_TABLE;
public:
typedef IO_MGR::PCB_FILE_T LIB_T;
ROW() :
type( IO_MGR::KICAD ),
properties( 0 )
{
}
ROW( const wxString& aNick, const wxString& aURI, const wxString& aType,
const wxString& aOptions, const wxString& aDescr = wxEmptyString ) :
nickName( aNick ),
description( aDescr ),
properties( 0 )
{
SetOptions( aOptions ),
SetFullURI( aURI );
SetType( aType );
}
ROW( const ROW& a );
~ROW()
{
delete properties;
}
ROW& operator=( const ROW& r );
/// Used in DIALOG_FP_LIB_TABLE for detecting an edit.
bool operator==( const ROW& r ) const;
bool operator!=( const ROW& r ) const { return !( *this == r ); }
//-----<accessors>------------------------------------------------------
/**
* Function GetNickName
* returns the short name of this library table row.
*/
const wxString& GetNickName() const { return nickName; }
/**
* Function SetNickName
* changes the logical name of this library, useful for an editor.
*/
void SetNickName( const wxString& aNickName ) { nickName = aNickName; }
/**
* Function GetType
* returns the type of LIB represented by this row.
*/
const wxString GetType() const { return IO_MGR::ShowType( type ); }
/**
* Function SetType
* changes the type represented by this row.
*/
void SetType( const wxString& aType );
/**
* Function GetFullURI
* returns the full location specifying URI for the LIB, either in original
* UI form or in environment variable expanded form.
*
* @param aSubstituted Tells if caller wanted the substituted form, else not.
*/
const wxString GetFullURI( bool aSubstituted = false ) const;
/**
* Function SetFullURI
* changes the full URI for the library.
*/
void SetFullURI( const wxString& aFullURI );
/**
* Function GetOptions
* returns the options string, which may hold a password or anything else needed to
* instantiate the underlying LIB_SOURCE.
*/
const wxString& GetOptions() const { return options; }
/**
* Function SetOptions
*/
void SetOptions( const wxString& aOptions )
{
options = aOptions;
// set PROPERTIES* from options
setProperties( ParseOptions( TO_UTF8( aOptions ) ) );
}
/**
* Function GetDescr
* returns the description of the library referenced by this row.
*/
const wxString& GetDescr() const { return description; }
/**
* Function SetDescr
* changes the description of the library referenced by this row.
*/
void SetDescr( const wxString& aDescr ) { description = aDescr; }
/**
* Function GetProperties
* returns the constant PROPERTIES for this library (ROW). These are
* the "options" in a table.
*/
const PROPERTIES* GetProperties() const { return properties; }
//-----</accessors>-----------------------------------------------------
/**
* Function Format
* serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
* make it look good using multiple lines and indentation.
* @param out is an #OUTPUTFORMATTER
* @param nestLevel is the indentation level to base all lines of the output.
* Actual indentation will be 2 spaces for each nestLevel.
*/
void Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR, boost::interprocess::lock_exception );
private:
/**
* Function setProperties
* sets this ROW's PROPERTIES by taking ownership of @a aProperties.
* @param aProperties ownership is given over to this ROW.
*/
void setProperties( const PROPERTIES* aProperties )
{
delete properties;
properties = aProperties;
}
void setPlugin( PLUGIN* aPlugin )
{
plugin.set( aPlugin );
}
wxString nickName;
wxString uri_user; ///< what user entered from UI or loaded from disk
#if !FP_LATE_ENVVAR
wxString uri_expanded; ///< from ExpandSubstitutions()
#endif
LIB_T type;
wxString options;
wxString description;
const PROPERTIES* properties;
PLUGIN::RELEASER plugin;
};
/** /**
* Constructor FP_LIB_TABLE * Constructor FP_LIB_TABLE
* builds a library table by pre-pending this table fragment in front of * builds a library table by pre-pending this table fragment in front of
@ -297,7 +338,7 @@ public:
int GetCount() { return rows.size(); } int GetCount() { return rows.size(); }
ROW& At( int aIndex ) { return rows[aIndex]; } LIB_TABLE_ROW& At( int aIndex ) { return rows[aIndex]; }
/** /**
* Function Parse * Function Parse
@ -329,7 +370,7 @@ public:
* which is returned. If the options field is empty, then the returned PROPERTIES * which is returned. If the options field is empty, then the returned PROPERTIES
* will be a NULL pointer. * will be a NULL pointer.
* <p> * <p>
* Typically aOptionsList comes from the "options" field within a ROW and * Typically aOptionsList comes from the "options" field within a LIB_TABLE_ROW and
* the format is simply a comma separated list of name value pairs. e.g.: * the format is simply a comma separated list of name value pairs. e.g.:
* [name1[=value1][|name2[=value2]]] etc. When using the UI to create or edit * [name1[=value1][|name2[=value2]]] etc. When using the UI to create or edit
* a fp lib table, this formatting is handled for you. * a fp lib table, this formatting is handled for you.
@ -375,7 +416,7 @@ public:
* @a aNickname. * @a aNickname.
* *
* @param aNickname is a locator for the "library", it is a "name" * @param aNickname is a locator for the "library", it is a "name"
* in FP_LIB_TABLE::ROW * in FP_LIB_TABLE::LIB_TABLE_ROW
* *
* @return wxArrayString - is the array of available footprint names inside * @return wxArrayString - is the array of available footprint names inside
* a library * a library
@ -389,7 +430,7 @@ public:
* loads a footprint having @a aFootprintName from the library given by @a aNickname. * loads a footprint having @a aFootprintName from the library given by @a aNickname.
* *
* @param aNickname is a locator for the "library", it is a "name" * @param aNickname is a locator for the "library", it is a "name"
* in FP_LIB_TABLE::ROW * in FP_LIB_TABLE::LIB_TABLE_ROW
* *
* @param aFootprintName is the name of the footprint to load. * @param aFootprintName is the name of the footprint to load.
* *
@ -416,7 +457,7 @@ public:
* If a footprint by the same name already exists, it is replaced. * If a footprint by the same name already exists, it is replaced.
* *
* @param aNickname is a locator for the "library", it is a "name" * @param aNickname is a locator for the "library", it is a "name"
* in FP_LIB_TABLE::ROW * in FP_LIB_TABLE::LIB_TABLE_ROW
* *
* @param aFootprint is what to store in the library. The caller continues * @param aFootprint is what to store in the library. The caller continues
* to own the footprint after this call. * to own the footprint after this call.
@ -435,7 +476,7 @@ public:
* deletes the @a aFootprintName from the library given by @a aNickname. * deletes the @a aFootprintName from the library given by @a aNickname.
* *
* @param aNickname is a locator for the "library", it is a "name" * @param aNickname is a locator for the "library", it is a "name"
* in FP_LIB_TABLE::ROW * in FP_LIB_TABLE::LIB_TABLE_ROW
* *
* @param aFootprintName is the name of a footprint to delete from the specified library. * @param aFootprintName is the name of a footprint to delete from the specified library.
* *
@ -490,24 +531,24 @@ public:
* exists. If false, then fail if the key already exists. * exists. If false, then fail if the key already exists.
* @return bool - true if the operation succeeded. * @return bool - true if the operation succeeded.
*/ */
bool InsertRow( const ROW& aRow, bool doReplace = false ); bool InsertRow( const FP_LIB_TABLE_ROW& aRow, bool doReplace = false );
/** /**
* Function FindRow * Function FindRow
* returns a ROW if aNickName is found in this table or in any chained * returns a LIB_TABLE_ROW if aNickName is found in this table or in any chained
* fallBack table fragment. The PLUGIN is loaded and attached * fallBack table fragment. The PLUGIN is loaded and attached
* to the "plugin" field of the ROW if not already loaded. * to the "plugin" field of the LIB_TABLE_ROW if not already loaded.
* *
* @throw IO_ERROR if aNickName cannot be found. * @throw IO_ERROR if aNickName cannot be found.
*/ */
const ROW* FindRow( const wxString& aNickName ) throw( IO_ERROR ); const FP_LIB_TABLE_ROW* FindRow( const wxString& aNickName ) throw( IO_ERROR );
/** /**
* Function FindRowByURI * Function FindRowByURI
* returns a #FP_LIB_TABLE::ROW if aURE is found in this table or in any chained * returns a #FP_LIB_TABLE::LIB_TABLE_ROW if aURE is found in this table or in any chained
* fallBack table fragments, else NULL. * fallBack table fragments, else NULL.
*/ */
const ROW* FindRowByURI( const wxString& aURI ); const FP_LIB_TABLE_ROW* FindRowByURI( const wxString& aURI );
/** /**
* Function IsEmpty * Function IsEmpty
@ -520,7 +561,7 @@ public:
/** /**
* Function ExpandSubstitutions * Function ExpandSubstitutions
* replaces any environment variable references with their values and is * replaces any environment variable references with their values and is
* here to fully embellish the ROW::uri in a platform independent way. * here to fully embellish the LIB_TABLE_ROW::uri in a platform independent way.
* This enables (fp_lib_table)s to have platform dependent environment * This enables (fp_lib_table)s to have platform dependent environment
* variables in them, allowing for a uniform table across platforms. * variables in them, allowing for a uniform table across platforms.
*/ */
@ -590,17 +631,17 @@ protected:
/** /**
* Function findRow * Function findRow
* returns a ROW if aNickname is found in this table or in any chained * returns a LIB_TABLE_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; LIB_TABLE_ROW* findRow( const wxString& aNickname ) const;
void reindex() void reindex()
{ {
nickIndex.clear(); nickIndex.clear();
for( ROWS_CITER it = rows.begin(); it != rows.end(); ++it ) for( FP_LIB_TABLE_ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
nickIndex.insert( INDEX_VALUE( it->nickName, it - rows.begin() ) ); nickIndex.insert( INDEX_VALUE( it->GetNickName(), it - rows.begin() ) );
} }
void ensureIndex() void ensureIndex()
@ -612,13 +653,13 @@ protected:
reindex(); reindex();
} }
typedef std::vector<ROW> ROWS; typedef std::vector<FP_LIB_TABLE_ROW> FP_LIB_TABLE_ROWS;
typedef ROWS::iterator ROWS_ITER; typedef FP_LIB_TABLE_ROWS::iterator FP_LIB_TABLE_ROWS_ITER;
typedef ROWS::const_iterator ROWS_CITER; typedef FP_LIB_TABLE_ROWS::const_iterator FP_LIB_TABLE_ROWS_CITER;
ROWS rows; FP_LIB_TABLE_ROWS rows;
/// this is a non-owning index into the ROWS table /// this is a non-owning index into the LIB_TABLE_ROWS table
typedef std::map<wxString,int> INDEX; // "int" is std::vector array index typedef std::map<wxString,int> INDEX; // "int" is std::vector array index
typedef INDEX::iterator INDEX_ITER; typedef INDEX::iterator INDEX_ITER;
typedef INDEX::const_iterator INDEX_CITER; typedef INDEX::const_iterator INDEX_CITER;

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2012-2016 KiCad Developers, see change_log.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
@ -88,7 +88,7 @@ public:
{ {
if( unsigned( aRow ) < rows.size() ) if( unsigned( aRow ) < rows.size() )
{ {
const ROW& r = rows[aRow]; const FP_LIB_TABLE_ROW& r = rows[aRow];
switch( aCol ) switch( aCol )
{ {
@ -109,7 +109,7 @@ public:
{ {
if( unsigned( aRow ) < rows.size() ) if( unsigned( aRow ) < rows.size() )
{ {
ROW& r = rows[aRow]; FP_LIB_TABLE_ROW& r = rows[aRow];
switch( aCol ) switch( aCol )
{ {
@ -131,7 +131,7 @@ public:
{ {
if( aPos < rows.size() ) if( aPos < rows.size() )
{ {
rows.insert( rows.begin() + aPos, aNumRows, ROW() ); rows.insert( rows.begin() + aPos, aNumRows, FP_LIB_TABLE_ROW() );
// use the (wxGridStringTable) source Luke. // use the (wxGridStringTable) source Luke.
if( GetView() ) if( GetView() )
@ -153,7 +153,7 @@ public:
{ {
// do not modify aNumRows, original value needed for wxGridTableMessage below // do not modify aNumRows, original value needed for wxGridTableMessage below
for( int i = aNumRows; i; --i ) for( int i = aNumRows; i; --i )
rows.push_back( ROW() ); rows.push_back( FP_LIB_TABLE_ROW() );
if( GetView() ) if( GetView() )
{ {
@ -173,7 +173,7 @@ public:
// aPos+aNumRows may wrap here, so both ends of the range are tested. // aPos+aNumRows may wrap here, so both ends of the range are tested.
if( aPos < rows.size() && aPos + aNumRows <= rows.size() ) if( aPos < rows.size() && aPos + aNumRows <= rows.size() )
{ {
ROWS_ITER start = rows.begin() + aPos; FP_LIB_TABLE_ROWS_ITER start = rows.begin() + aPos;
rows.erase( start, start + aNumRows ); rows.erase( start, start + aNumRows );
if( GetView() ) if( GetView() )
@ -232,14 +232,14 @@ protected:
{ {
FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) m_grid->GetTable(); FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) m_grid->GetTable();
size_t ndx = cb_text.find( wxT( "(fp_lib_table" ) ); size_t ndx = cb_text.find( "(fp_lib_table" );
if( ndx != std::string::npos ) if( ndx != std::string::npos )
{ {
// paste the ROWs of s-expression (fp_lib_table), starting // paste the FP_LIB_TABLE_ROWs of s-expression (fp_lib_table), starting
// at column 0 regardless of current cursor column. // at column 0 regardless of current cursor column.
STRING_LINE_READER slr( TO_UTF8( cb_text ), wxT( "Clipboard" ) ); STRING_LINE_READER slr( TO_UTF8( cb_text ), "Clipboard" );
FP_LIB_TABLE_LEXER lexer( &slr ); FP_LIB_TABLE_LEXER lexer( &slr );
FP_LIB_TABLE tmp_tbl; FP_LIB_TABLE tmp_tbl;
bool parsed = true; bool parsed = true;
@ -386,7 +386,7 @@ public:
private: private:
typedef FP_LIB_TABLE::ROW ROW; typedef FP_LIB_TABLE_ROW ROW;
/// If the cursor is not on a valid cell, because there are no rows at all, return -1, /// If the cursor is not on a valid cell, because there are no rows at all, return -1,
/// else return a 0 based column index. /// else return a 0 based column index.
@ -430,7 +430,7 @@ private:
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format(
_( "Illegal character '%s' found in Nickname: '%s' in row %d" ), _( "Illegal character '%s' found in Nickname: '%s' in row %d" ),
wxT( ":" ), GetChars( nick ), r ); ":", GetChars( nick ), r );
// show the tabbed panel holding the grid we have flunked: // show the tabbed panel holding the grid we have flunked:
if( &model != cur_model() ) if( &model != cur_model() )
@ -710,7 +710,7 @@ private:
/// by examining all the full_uri columns. /// by examining all the full_uri columns.
void populateEnvironReadOnlyTable() void populateEnvironReadOnlyTable()
{ {
wxRegEx re( wxT( ".*?\\$\\{(.+?)\\}.*?" ), wxRE_ADVANCED ); wxRegEx re( ".*?\\$\\{(.+?)\\}.*?", wxRE_ADVANCED );
wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required. wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required.
std::set< wxString > unique; std::set< wxString > unique;
@ -875,7 +875,7 @@ int InvokeFootprintWizard( wxTopLevelWindow* aParent, FP_LIB_TABLE* aGlobal, FP_
if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID ) if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
continue; continue;
FP_LIB_TABLE::ROW row( it->GetDescription(), FP_LIB_TABLE_ROW row( it->GetDescription(),
it->GetAutoPath( scope ), it->GetAutoPath( scope ),
it->GetPluginName(), it->GetPluginName(),
wxEmptyString ); // options wxEmptyString ); // options

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2016 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
@ -293,37 +293,37 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
lyrs.Caption( _( "Visibles" ) ); lyrs.Caption( _( "Visibles" ) );
m_auimgr.AddPane( m_mainToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top(). Row( 0 ) );
m_auimgr.AddPane( m_auxiliaryToolBar, m_auimgr.AddPane( m_auxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) ); wxAuiPaneInfo( horiz ).Name( "m_auxiliaryToolBar" ).Top().Row( 1 ) );
// The main right vertical toolbar // The main right vertical toolbar
m_auimgr.AddPane( m_drawToolBar, m_auimgr.AddPane( m_drawToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer(1) ); wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right().Layer(1) );
// Add the layer manager ( most right side of pcbframe ) // Add the layer manager ( most right side of pcbframe )
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) ); m_auimgr.AddPane( m_Layers, lyrs.Name( "m_LayersManagerToolBar" ).Right().Layer( 2 ) );
// Layers manager is visible // Layers manager is visible
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( true ); m_auimgr.GetPane( "m_LayersManagerToolBar" ).Show( true );
// The left vertical toolbar (fast acces to display options) // The left vertical toolbar (fast acces to display options)
m_auimgr.AddPane( m_optionsToolBar, m_auimgr.AddPane( m_optionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ). Left().Layer(1) ); wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ). Left().Layer(1) );
m_auimgr.AddPane( m_canvas, m_auimgr.AddPane( m_canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(), m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() ); wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg_pane ).Name( "MsgPanel" ).Bottom().Layer(10) );
// Create the manager and dispatcher & route draw panel events to the dispatcher // Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools(); setupTools();
UseGalCanvas( parentFrame->IsGalCanvasActive() ); UseGalCanvas( parentFrame->IsGalCanvasActive() );
if( m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).IsShown() ) if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() )
{ {
m_Layers->ReFill(); m_Layers->ReFill();
m_Layers->ReFillRender(); m_Layers->ReFillRender();
@ -363,7 +363,7 @@ const wxString FOOTPRINT_EDIT_FRAME::getLibPath()
{ {
const wxString& nickname = GetCurrentLib(); const wxString& nickname = GetCurrentLib();
const FP_LIB_TABLE::ROW* row = Prj().PcbFootprintLibs()->FindRow( nickname ); const FP_LIB_TABLE_ROW* row = Prj().PcbFootprintLibs()->FindRow( nickname );
return row->GetFullURI( true ); return row->GetFullURI( true );
} }
@ -413,12 +413,12 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
catch( const PARSE_ERROR& ) catch( const PARSE_ERROR& )
{ {
// unlikely to be a problem, since we produced the pretty string. // unlikely to be a problem, since we produced the pretty string.
wxLogError( wxT( "PARSE_ERROR" ) ); wxLogError( "PARSE_ERROR" );
} }
catch( const IO_ERROR& ) catch( const IO_ERROR& )
{ {
// unlikely to be a problem, since we produced the pretty string. // unlikely to be a problem, since we produced the pretty string.
wxLogError( wxT( "IO_ERROR" ) ); wxLogError( "IO_ERROR" );
} }
if( module ) if( module )
@ -583,7 +583,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )
break; break;
default: default:
wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" ) ); wxMessageBox( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" );
break; break;
} }
@ -780,7 +780,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
if( nickname.size() ) if( nickname.size() )
{ {
FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
const FP_LIB_TABLE::ROW* row = libtable->FindRow( nickname ); const FP_LIB_TABLE_ROW* row = libtable->FindRow( nickname );
if( row ) if( row )
path_display = L" \u2014 " + row->GetFullURI( true ); path_display = L" \u2014 " + row->GetFullURI( true );
@ -838,11 +838,11 @@ void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event )
{ {
// Hotkey IDs // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( g_Module_Editor_Hokeys_Descr, wxT( "pcbnew" ) ); ExportHotkeyConfigToFile( g_Module_Editor_Hokeys_Descr, "pcbnew" );
break; break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG: case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( g_Module_Editor_Hokeys_Descr, wxT( "pcbnew" ) ); ImportHotkeyConfigFromFile( g_Module_Editor_Hokeys_Descr, "pcbnew" );
break; break;
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
@ -918,7 +918,7 @@ void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" ) ); DisplayError( this, "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" );
} }
} }

View File

@ -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) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2016 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
@ -115,8 +115,8 @@ END_EVENT_TABLE()
#define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT #define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT
#endif #endif
#define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" ) #define FOOTPRINT_VIEWER_FRAME_NAME "ModViewFrame"
#define FOOTPRINT_VIEWER_FRAME_NAME_MODAL wxT( "ModViewFrameModal" ) #define FOOTPRINT_VIEWER_FRAME_NAME_MODAL "ModViewFrameModal"
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) : FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) :
@ -223,7 +223,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
// most likely due to the fact that the other windows are not dockable and are preventing the // most likely due to the fact that the other windows are not dockable and are preventing the
// tool bar from docking on the right and left. // tool bar from docking on the right and left.
wxAuiPaneInfo toolbarPaneInfo; wxAuiPaneInfo toolbarPaneInfo;
toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false ); toolbarPaneInfo.Name( "m_mainToolBar" ).ToolbarPane().Top().CloseButton( false );
EDA_PANEINFO info; EDA_PANEINFO info;
info.InfoToolbarPane(); info.InfoToolbarPane();
@ -236,23 +236,23 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
// Manage the list of libraries, left pane. // Manage the list of libraries, left pane.
m_auimgr.AddPane( m_libList, m_auimgr.AddPane( m_libList,
wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ) wxAuiPaneInfo( info ).Name( "m_libList" )
.Left().Row( 1 ).MinSize( minsize ) ); .Left().Row( 1 ).MinSize( minsize ) );
// Manage the list of footprints, center pane. // Manage the list of footprints, center pane.
m_auimgr.AddPane( m_footprintList, m_auimgr.AddPane( m_footprintList,
wxAuiPaneInfo( info ).Name( wxT( "m_footprintList" ) ) wxAuiPaneInfo( info ).Name( "m_footprintList" )
.Left().Row( 2 ).MinSize( minsize ) ); .Left().Row( 2 ).MinSize( minsize ) );
// Manage the draw panel, right pane. // Manage the draw panel, right pane.
m_auimgr.AddPane( m_canvas, m_auimgr.AddPane( m_canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(), m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() ); wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
// Manage the message panel, bottom pane. // Manage the message panel, bottom pane.
m_auimgr.AddPane( m_messagePanel, m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom() );
if( !m_perspective.IsEmpty() ) if( !m_perspective.IsEmpty() )
{ {
@ -696,8 +696,8 @@ void FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList( wxCommandEvent& event )
break; break;
default: default:
wxString id = wxString::Format(wxT("%i"),event.GetId()); wxString id = wxString::Format( "%i", event.GetId() );
wxFAIL_MSG( wxT( "FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList error: id = " ) + id ); wxFAIL_MSG( "FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList error: id = " + id );
} }
} }
@ -727,7 +727,7 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
if( getCurNickname().size() ) if( getCurNickname().size() )
{ {
FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
const FP_LIB_TABLE::ROW* row = libtable->FindRow( getCurNickname() ); const FP_LIB_TABLE_ROW* row = libtable->FindRow( getCurNickname() );
if( row ) if( row )
title << L" \u2014 " << row->GetFullURI( true ); title << L" \u2014 " << row->GetFullURI( true );