Remove class RETAINED_PATH, put is main member function into SEARCH_STACK.
Change class PROJECT to use a generalized wxString in place of the RETAINED_PATH items, so that new session and project specific strings of any purpose can be saved there, for the life of a session.
This commit is contained in:
parent
53cd19a69b
commit
8cb3423262
6
TODO.txt
6
TODO.txt
|
@ -69,5 +69,9 @@ Dick's Final TODO List:
|
||||||
https://blueprints.launchpad.net/kicad/+spec/modular-kicad
|
https://blueprints.launchpad.net/kicad/+spec/modular-kicad
|
||||||
|
|
||||||
Issues as a result of minimal testing:
|
Issues as a result of minimal testing:
|
||||||
If eeschema launched from C++ project manager and does not find all libraries,
|
* If eeschema launched from C++ project manager and does not find all libraries,
|
||||||
then the dialog showing the names of missing libraries is shown twice.
|
then the dialog showing the names of missing libraries is shown twice.
|
||||||
|
|
||||||
|
* Clear all/some? retained strings on project change.
|
||||||
|
* Clear the FP_LIB_TABLE when the last KIWAY_PLAYER using it is closed.
|
||||||
|
|
||||||
|
|
|
@ -133,17 +133,32 @@ const wxString PROJECT::FootprintLibTblName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RETAINED_PATH& PROJECT::RPath( RETPATH_T aIndex )
|
void PROJECT::SetRString( RSTRING_T aIndex, const wxString& aString )
|
||||||
{
|
{
|
||||||
unsigned ndx = unsigned( aIndex );
|
unsigned ndx = unsigned( aIndex );
|
||||||
|
|
||||||
if( ndx < DIM( m_rpaths ) )
|
if( ndx < DIM( m_rstrings ) )
|
||||||
{
|
{
|
||||||
return m_rpaths[ndx];
|
m_rstrings[ndx] = aString;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static RETAINED_PATH no_cookie_for_you;
|
wxASSERT( 0 ); // bad index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString& PROJECT::GetRString( RSTRING_T aIndex )
|
||||||
|
{
|
||||||
|
unsigned ndx = unsigned( aIndex );
|
||||||
|
|
||||||
|
if( ndx < DIM( m_rstrings ) )
|
||||||
|
{
|
||||||
|
return m_rstrings[ndx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static wxString no_cookie_for_you;
|
||||||
|
|
||||||
wxASSERT( 0 ); // bad index
|
wxASSERT( 0 ); // bad index
|
||||||
|
|
||||||
|
|
|
@ -104,42 +104,33 @@ void SEARCH_STACK::AddPaths( const wxString& aPaths, int aIndex )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RETAINED_PATH::Clear()
|
const wxString SEARCH_STACK::LastVisitedPath( const wxString& aSubPathToSearch )
|
||||||
{
|
{
|
||||||
m_retained_path.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString RETAINED_PATH::LastVisitedPath( const SEARCH_STACK& aSStack, const wxString& aSubPathToSearch )
|
|
||||||
{
|
|
||||||
if( !!m_retained_path )
|
|
||||||
return m_retained_path;
|
|
||||||
|
|
||||||
wxString path;
|
wxString path;
|
||||||
|
|
||||||
// Initialize default path to the main default lib path
|
// Initialize default path to the main default lib path
|
||||||
// this is the second path in list (the first is the project path)
|
// this is the second path in list (the first is the project path).
|
||||||
unsigned pcount = aSStack.GetCount();
|
unsigned pcount = GetCount();
|
||||||
|
|
||||||
if( pcount )
|
if( pcount )
|
||||||
{
|
{
|
||||||
unsigned ipath = 0;
|
unsigned ipath = 0;
|
||||||
|
|
||||||
if( aSStack[0] == wxGetCwd() )
|
if( (*this)[0] == wxGetCwd() )
|
||||||
ipath = 1;
|
ipath = 1;
|
||||||
|
|
||||||
// First choice of path:
|
// First choice of path:
|
||||||
if( ipath < pcount )
|
if( ipath < pcount )
|
||||||
path = aSStack[ipath];
|
path = (*this)[ipath];
|
||||||
|
|
||||||
// Search a sub path matching aSubPathToSearch
|
// Search a sub path matching this SEARCH_PATH
|
||||||
if( !aSubPathToSearch.IsEmpty() )
|
if( !IsEmpty() )
|
||||||
{
|
{
|
||||||
for( ; ipath < pcount; ipath++ )
|
for( ; ipath < pcount; ipath++ )
|
||||||
{
|
{
|
||||||
if( aSStack[ipath].Contains( aSubPathToSearch ) )
|
if( (*this)[ipath].Contains( aSubPathToSearch ) )
|
||||||
{
|
{
|
||||||
path = aSStack[ipath];
|
path = (*this)[ipath];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,12 +144,6 @@ wxString RETAINED_PATH::LastVisitedPath( const SEARCH_STACK& aSStack, const wxSt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RETAINED_PATH::SaveLastVisitedPath( const wxString& aPath )
|
|
||||||
{
|
|
||||||
m_retained_path = aPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void SEARCH_STACK::Show( const char* aPrefix ) const
|
void SEARCH_STACK::Show( const char* aPrefix ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -439,8 +439,11 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
SEARCH_STACK& search = prj.SchSearchS();
|
SEARCH_STACK& search = prj.SchSearchS();
|
||||||
|
|
||||||
wxString docpath = prj.RPath(PROJECT::DOC).LastVisitedPath( search, wxT( "doc" ) );
|
|
||||||
wxString mask = wxT( "*" );
|
wxString mask = wxT( "*" );
|
||||||
|
wxString docpath = prj.GetRString( PROJECT::DOC_PATH );
|
||||||
|
|
||||||
|
if( !docpath )
|
||||||
|
docpath = search.LastVisitedPath( wxT( "doc" ) );
|
||||||
|
|
||||||
wxString fullFileName = EDA_FileSelector( _( "Doc Files" ),
|
wxString fullFileName = EDA_FileSelector( _( "Doc Files" ),
|
||||||
docpath,
|
docpath,
|
||||||
|
@ -463,7 +466,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
|
||||||
*/
|
*/
|
||||||
wxFileName fn = fullFileName;
|
wxFileName fn = fullFileName;
|
||||||
|
|
||||||
prj.RPath(PROJECT::DOC).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::DOC_PATH, fn.GetPath() );
|
||||||
|
|
||||||
wxString filename = search.FilenameWithRelativePathInSearchList( fullFileName );
|
wxString filename = search.FilenameWithRelativePathInSearchList( fullFileName );
|
||||||
|
|
||||||
|
|
|
@ -321,8 +321,12 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
|
|
||||||
wxString libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
|
wxString libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
|
||||||
|
|
||||||
if( libpath.IsEmpty() )
|
if( !libpath )
|
||||||
libpath = prj.RPath(PROJECT::SCH_LIB).LastVisitedPath( search );
|
{
|
||||||
|
libpath = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
||||||
|
if( !libpath )
|
||||||
|
libpath = search.LastVisitedPath();
|
||||||
|
}
|
||||||
|
|
||||||
wxFileDialog filesDialog( this, _( "Library files:" ), libpath,
|
wxFileDialog filesDialog( this, _( "Library files:" ), libpath,
|
||||||
wxEmptyString, SchematicLibraryFileWildcard,
|
wxEmptyString, SchematicLibraryFileWildcard,
|
||||||
|
@ -340,7 +344,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
fn = filenames[jj];
|
fn = filenames[jj];
|
||||||
|
|
||||||
if( jj == 0 )
|
if( jj == 0 )
|
||||||
prj.RPath(PROJECT::SCH_LIB).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
|
||||||
|
|
||||||
/* If the library path is already in the library search paths
|
/* If the library path is already in the library search paths
|
||||||
* list, just add the library name to the list. Otherwise, add
|
* list, just add the library name to the list. Otherwise, add
|
||||||
|
@ -376,12 +380,14 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
SEARCH_STACK& search = Prj().SchSearchS();
|
SEARCH_STACK& search = Prj().SchSearchS();
|
||||||
wxString path = prj.RPath(PROJECT::SCH_LIB).LastVisitedPath( search );
|
wxString path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
||||||
|
|
||||||
|
if( !path )
|
||||||
|
path = search.LastVisitedPath();
|
||||||
|
|
||||||
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
|
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
|
||||||
path, wxDD_DEFAULT_STYLE,
|
path, wxDD_DEFAULT_STYLE,
|
||||||
|
@ -439,7 +445,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||||
DisplayError( this, _("Path already in use") );
|
DisplayError( this, _("Path already in use") );
|
||||||
}
|
}
|
||||||
|
|
||||||
prj.RPath(PROJECT::SCH_LIB).SaveLastVisitedPath( path );
|
prj.SetRString( PROJECT::SCH_LIB_PATH, path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
|
||||||
|
|
||||||
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
||||||
|
|
||||||
if( m_library == NULL )
|
if( !m_library )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "No library specified." ) );
|
DisplayError( this, _( "No library specified." ) );
|
||||||
return false;
|
return false;
|
||||||
|
@ -326,7 +326,9 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
|
||||||
SEARCH_STACK& search = prj.SchSearchS();
|
SEARCH_STACK& search = prj.SchSearchS();
|
||||||
|
|
||||||
// Get a new name for the library
|
// Get a new name for the library
|
||||||
wxString default_path = prj.RPath(PROJECT::SCH_LIB).LastVisitedPath( search );
|
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
||||||
|
if( !default_path )
|
||||||
|
default_path = search.LastVisitedPath();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Component Library Name:" ), default_path,
|
wxFileDialog dlg( this, _( "Component Library Name:" ), default_path,
|
||||||
wxEmptyString, SchematicLibraryFileExtension,
|
wxEmptyString, SchematicLibraryFileExtension,
|
||||||
|
@ -342,7 +344,7 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
|
||||||
if( fn.GetExt().IsEmpty() )
|
if( fn.GetExt().IsEmpty() )
|
||||||
fn.SetExt( SchematicLibraryFileExtension );
|
fn.SetExt( SchematicLibraryFileExtension );
|
||||||
|
|
||||||
prj.RPath(PROJECT::SCH_LIB).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,9 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
|
||||||
|
|
||||||
m_canvas->SetIgnoreMouseEvents( true );
|
m_canvas->SetIgnoreMouseEvents( true );
|
||||||
|
|
||||||
wxString default_path = prj.RPath(PROJECT::SCH_LIB).LastVisitedPath( search );
|
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
||||||
|
if( !default_path )
|
||||||
|
default_path = search.LastVisitedPath();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
|
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
|
||||||
wxEmptyString, SchematicSymbolFileWildcard,
|
wxEmptyString, SchematicSymbolFileWildcard,
|
||||||
|
@ -75,7 +77,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
|
||||||
|
|
||||||
wxFileName fn = dlg.GetPath();
|
wxFileName fn = dlg.GetPath();
|
||||||
|
|
||||||
prj.RPath(PROJECT::SCH_LIB).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
|
||||||
|
|
||||||
Lib = new CMP_LIBRARY( LIBRARY_TYPE_SYMBOL, fn );
|
Lib = new CMP_LIBRARY( LIBRARY_TYPE_SYMBOL, fn );
|
||||||
|
|
||||||
|
@ -143,7 +145,9 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
|
||||||
if( m_component->GetDrawItemList().empty() )
|
if( m_component->GetDrawItemList().empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString default_path = prj.RPath(PROJECT::SCH_LIB).LastVisitedPath( search );
|
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
||||||
|
if( !default_path )
|
||||||
|
default_path = search.LastVisitedPath();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
|
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
|
||||||
m_component->GetName(), SchematicSymbolFileWildcard,
|
m_component->GetName(), SchematicSymbolFileWildcard,
|
||||||
|
@ -159,7 +163,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
|
||||||
if( fn.GetExt().IsEmpty() )
|
if( fn.GetExt().IsEmpty() )
|
||||||
fn.SetExt( SchematicSymbolFileExtension );
|
fn.SetExt( SchematicSymbolFileExtension );
|
||||||
|
|
||||||
prj.RPath(PROJECT::SCH_LIB).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
|
||||||
|
|
||||||
msg.Printf( _( "Saving symbol in '%s'" ), GetChars( fn.GetPath() ) );
|
msg.Printf( _( "Saving symbol in '%s'" ), GetChars( fn.GetPath() ) );
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
|
|
|
@ -137,19 +137,32 @@ public:
|
||||||
VTBL_ENTRY wxString GetModuleLibraryNickname() { return m_module_library_nickname; }
|
VTBL_ENTRY wxString GetModuleLibraryNickname() { return m_module_library_nickname; }
|
||||||
VTBL_ENTRY void SetModuleLibraryNickname( const wxString& aNickName ) { m_module_library_nickname = aNickName; }
|
VTBL_ENTRY void SetModuleLibraryNickname( const wxString& aNickName ) { m_module_library_nickname = aNickName; }
|
||||||
|
|
||||||
/// Retain a number of paths for user convienience, enumerated here:
|
/// Retain a number of project specific wxStrings, enumerated here:
|
||||||
enum RETPATH_T
|
enum RSTRING_T
|
||||||
{
|
{
|
||||||
DOC,
|
DOC_PATH,
|
||||||
SCH_LIB,
|
SCH_LIB_PATH,
|
||||||
PCB_LIB,
|
PCB_LIB_NICKNAME,
|
||||||
VIEWER_3D,
|
VIEWER_3D_PATH,
|
||||||
|
|
||||||
RPATH_COUNT
|
RSTRING_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Give acess to a RETAINED_PATH using enum RETPATH_T
|
/**
|
||||||
VTBL_ENTRY RETAINED_PATH& RPath( RETPATH_T aPath );
|
* Function GetRString
|
||||||
|
* returns a "retained string", which is any session and project specific string
|
||||||
|
* identified in enum RSTRING_T. Retained strings are not written to disk, and
|
||||||
|
* are therefore good only for the current session.
|
||||||
|
*/
|
||||||
|
VTBL_ENTRY const wxString& GetRString( RSTRING_T aStringId );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetRString
|
||||||
|
* stores a "retained string", which is any session and project specific string
|
||||||
|
* identified in enum RSTRING_T. Retained strings are not written to disk, and
|
||||||
|
* are therefore good only for the current session.
|
||||||
|
*/
|
||||||
|
VTBL_ENTRY void SetRString( RSTRING_T aStringId, const wxString& aString );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum ELEM_T
|
* Enum ELEM_T
|
||||||
|
@ -241,8 +254,8 @@ private:
|
||||||
|
|
||||||
wxString m_module_library_nickname; ///< @todo move this into m_rpaths[]
|
wxString m_module_library_nickname; ///< @todo move this into m_rpaths[]
|
||||||
|
|
||||||
/// @see this::RPath() and enum RETPATH_T.
|
/// @see this::SetRString(), GetRString(), and enum RSTRING_T.
|
||||||
RETAINED_PATH m_rpaths[RPATH_COUNT];
|
wxString m_rstrings[RSTRING_COUNT];
|
||||||
|
|
||||||
/// @see this::Elem() and enum ELEM_T.
|
/// @see this::Elem() and enum ELEM_T.
|
||||||
_ELEM* m_elems[ELEM_COUNT];
|
_ELEM* m_elems[ELEM_COUNT];
|
||||||
|
|
|
@ -57,38 +57,19 @@ public:
|
||||||
* ";" on windows, or ":" | ";" on unix.
|
* ";" on windows, or ":" | ";" on unix.
|
||||||
*/
|
*/
|
||||||
void RemovePaths( const wxString& aPaths );
|
void RemovePaths( const wxString& aPaths );
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class RETAINED_PATH
|
|
||||||
* is a glamorous way to save a path you might need in the future.
|
|
||||||
* It is simply a container for the two functions, if you can figure them out.
|
|
||||||
* This whole concept is awkward, and the two function might have better been
|
|
||||||
* non-member functions, simply globals.
|
|
||||||
*/
|
|
||||||
class RETAINED_PATH
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function LastVisitedPath
|
* Function LastVisitedPath
|
||||||
* returns the last visited directory, or aSubPathToSearch is empty, the first
|
* is a quirky function inherited from old code that seems to serve particular
|
||||||
* path in lib path list ( but not the CWD ).
|
* needs in the UI. It returns what is called the last visited directory, or
|
||||||
|
* if aSubPathToSearch is empty, the first path in this SEARCH_STACK
|
||||||
|
* ( but not the CWD ).
|
||||||
|
*
|
||||||
* @todo add more here if you can figure it out.
|
* @todo add more here if you can figure it out.
|
||||||
*
|
*
|
||||||
* @param aSearchStack gives the set of directories to consider.
|
* @param aSubPathToSearch is the preferred sub path to search in path list
|
||||||
* @param aSubPathToSearch is the preferred sub path to search in path list
|
|
||||||
*/
|
*/
|
||||||
wxString LastVisitedPath( const SEARCH_STACK& aSStack,
|
const wxString LastVisitedPath( const wxString& aSubPathToSearch = wxEmptyString );
|
||||||
const wxString& aSubPathToSearch = wxEmptyString );
|
|
||||||
|
|
||||||
void SaveLastVisitedPath( const wxString& aPath );
|
|
||||||
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxString m_retained_path;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SEARCH_STACK_H_
|
#endif // SEARCH_STACK_H_
|
||||||
|
|
|
@ -440,7 +440,11 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !fullpath )
|
if( !fullpath )
|
||||||
fullpath = prj.RPath(PROJECT::VIEWER_3D).LastVisitedPath( search, LIB3D_PATH );
|
{
|
||||||
|
fullpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
|
||||||
|
if( !fullpath )
|
||||||
|
fullpath = search.LastVisitedPath( LIB3D_PATH );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
|
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||||
|
@ -469,7 +473,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
|
||||||
|
|
||||||
wxFileName fn = fullfilename;
|
wxFileName fn = fullfilename;
|
||||||
|
|
||||||
prj.RPath(PROJECT::VIEWER_3D).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::VIEWER_3D_PATH, fn.GetPath() );
|
||||||
|
|
||||||
/* If the file path is already in the library search paths
|
/* If the file path is already in the library search paths
|
||||||
* list, just add the library name to the list. Otherwise, add
|
* list, just add the library name to the list. Otherwise, add
|
||||||
|
|
|
@ -303,7 +303,11 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !fullpath )
|
if( !fullpath )
|
||||||
fullpath = prj.RPath(PROJECT::VIEWER_3D).LastVisitedPath( search, LIB3D_PATH );
|
{
|
||||||
|
fullpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
|
||||||
|
if( !fullpath )
|
||||||
|
fullpath = search.LastVisitedPath( LIB3D_PATH );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
|
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||||
|
@ -330,7 +334,7 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
|
||||||
|
|
||||||
wxFileName fn = fullfilename;
|
wxFileName fn = fullfilename;
|
||||||
|
|
||||||
prj.RPath(PROJECT::VIEWER_3D).SaveLastVisitedPath( fn.GetPath() );
|
prj.SetRString( PROJECT::VIEWER_3D_PATH, fn.GetPath() );
|
||||||
|
|
||||||
/* If the file path is already in the library search paths
|
/* If the file path is already in the library search paths
|
||||||
* list, just add the library name to the list. Otherwise, add
|
* list, just add the library name to the list. Otherwise, add
|
||||||
|
|
|
@ -522,16 +522,15 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
|
||||||
}
|
}
|
||||||
|
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
SEARCH_STACK& search = Kiface().KifaceSearch();
|
|
||||||
|
|
||||||
wxString last_nickname = prj.RPath(PROJECT::PCB_LIB).LastVisitedPath( search );
|
wxString last_nickname = prj.GetRString( PROJECT::PCB_LIB_NICKNAME );
|
||||||
|
|
||||||
wxString nickname = SelectLibrary( last_nickname );
|
wxString nickname = SelectLibrary( last_nickname );
|
||||||
|
|
||||||
if( !nickname )
|
if( !nickname )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
prj.RPath(PROJECT::PCB_LIB).SaveLastVisitedPath( nickname );
|
prj.SetRString( PROJECT::PCB_LIB_NICKNAME, nickname );
|
||||||
|
|
||||||
if( !aNewModulesOnly )
|
if( !aNewModulesOnly )
|
||||||
{
|
{
|
||||||
|
@ -545,7 +544,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs();
|
FP_LIB_TABLE* tbl = prj.PcbFootprintLibs();
|
||||||
|
|
||||||
// Delete old library if we're replacing it entirely.
|
// Delete old library if we're replacing it entirely.
|
||||||
if( !aNewModulesOnly )
|
if( !aNewModulesOnly )
|
||||||
|
|
Loading…
Reference in New Issue