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

View File

@ -146,7 +146,7 @@ DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE( wxTopLevelWindow* aParent,
m_project( aProject )
{
// For user info, shows the table filenames:
m_PrjTableFilename->SetLabel( Prj().FootprintLibTblName() );
m_PrjTableFilename->SetLabel( Prj().SymbolLibTableName() );
m_GblTableFilename->SetLabel( SYMBOL_LIB_TABLE::GetGlobalTableFileName() );
// 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;
/**
* Return the path and file name of this projects symbol library table.
*/
VTBL_ENTRY const wxString SymbolLibTableName() const;
/**
* Function ConfigSave
* saves the current "project" parameters into the wxConfigBase* derivative.
@ -304,6 +309,11 @@ private:
wxConfigBase* configCreate( const SEARCH_STACK& aSList,
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
wxString m_pro_date_and_time;