Minor symbol library table edit dialog fix.

A copy and paste error was causing to footprint library table file name
and path to be shown in the symbol library table edit dialog.  Factor
out code in PROJECT::FootprintLibTblName() to PROJECT::libTableName()
to handle both symbol and footprint library table names and create a
new PROJECT::SymbolLibTableName() method to fix the path and file name
in the symbol library table edit dialog.
This commit is contained in:
Wayne Stambaugh 2017-11-11 10:33:06 -05:00
parent 4af85239ba
commit 5181c0ac75
3 changed files with 30 additions and 9 deletions

View File

@ -111,7 +111,19 @@ const wxString PROJECT::GetProjectName() const
} }
const wxString PROJECT::SymbolLibTableName() const
{
return libTableName( "sym-lib-table" );
}
const wxString PROJECT::FootprintLibTblName() const const wxString PROJECT::FootprintLibTblName() const
{
return libTableName( "fp-lib-table" );
}
const wxString PROJECT::libTableName( const wxString& aLibTableName ) const
{ {
wxFileName fn = GetProjectFullName(); wxFileName fn = GetProjectFullName();
wxString path = fn.GetPath(); wxString path = fn.GetPath();
@ -140,17 +152,16 @@ const wxString PROJECT::FootprintLibTblName() const
#endif #endif
/* /*
The footprint library table name used when no project file is passed * The library table name used when no project file is passed to the appropriate
to Pcbnew or CvPcb. This is used temporarily to store the project * code. This is used temporarily to store the project specific library table
specific library table until the project file being edited is saved. * until the project file being edited is saved. It is then moved to the correct
It is then moved to the file fp-lib-table in the folder where the * file in the folder where the project file is saved.
project file is saved. */
*/ fn.SetName( "prj-" + aLibTableName );
fn.SetName( wxT( "prj-fp-lib-table" ) );
} }
else // normal path. else // normal path.
{ {
fn.SetName( wxT( "fp-lib-table" ) ); fn.SetName( aLibTableName );
} }
fn.ClearExt(); fn.ClearExt();

View File

@ -146,7 +146,7 @@ DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE( wxTopLevelWindow* aParent,
m_project( aProject ) m_project( aProject )
{ {
// For user info, shows the table filenames: // For user info, shows the table filenames:
m_PrjTableFilename->SetLabel( Prj().FootprintLibTblName() ); m_PrjTableFilename->SetLabel( Prj().SymbolLibTableName() );
m_GblTableFilename->SetLabel( SYMBOL_LIB_TABLE::GetGlobalTableFileName() ); m_GblTableFilename->SetLabel( SYMBOL_LIB_TABLE::GetGlobalTableFileName() );
// wxGrid only supports user owned tables if they exist past end of ~wxGrid(), // wxGrid only supports user owned tables if they exist past end of ~wxGrid(),

View File

@ -114,6 +114,11 @@ public:
*/ */
VTBL_ENTRY const wxString FootprintLibTblName() const; VTBL_ENTRY const wxString FootprintLibTblName() const;
/**
* Return the path and file name of this projects symbol library table.
*/
VTBL_ENTRY const wxString SymbolLibTableName() const;
/** /**
* Function ConfigSave * Function ConfigSave
* saves the current "project" parameters into the wxConfigBase* derivative. * saves the current "project" parameters into the wxConfigBase* derivative.
@ -304,6 +309,11 @@ private:
wxConfigBase* configCreate( const SEARCH_STACK& aSList, wxConfigBase* configCreate( const SEARCH_STACK& aSList,
const wxString& aGroupName, const wxString& aProjectFileName = wxEmptyString ); const wxString& aGroupName, const wxString& aProjectFileName = wxEmptyString );
/**
* Return the full path and file name of the project specific library table \a aLibTableName..
*/
const wxString libTableName( const wxString& aLibTableName ) const;
wxFileName m_project_name; ///< \<fullpath\>/\<basename\>.pro wxFileName m_project_name; ///< \<fullpath\>/\<basename\>.pro
wxString m_pro_date_and_time; wxString m_pro_date_and_time;