2009-04-19 15:03:48 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_pcbnew_config_libs_and_paths.cpp
|
|
|
|
// Author: jean-pierre Charras
|
|
|
|
// Created: 2009 apr 18
|
|
|
|
// Licence: GPL
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/* Handle the Pcbnew library config (library list, and default lib path)
|
2009-04-19 15:03:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include <wx/tokenzr.h>
|
|
|
|
#include "appl_wxstruct.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "gestfich.h"
|
|
|
|
#include "pcbnew.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "macros.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "pcbcommon.h"
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
#include "dialog_pcbnew_config_libs_and_paths.h"
|
|
|
|
|
|
|
|
|
2011-03-03 19:08:13 +00:00
|
|
|
void PCB_EDIT_FRAME::InstallConfigFrame( )
|
2009-04-19 15:03:48 +00:00
|
|
|
{
|
|
|
|
DIALOG_PCBNEW_CONFIG_LIBS dialog( this );
|
|
|
|
dialog.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
DIALOG_PCBNEW_CONFIG_LIBS::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ):
|
2009-04-19 15:03:48 +00:00
|
|
|
DIALOG_PCBNEW_CONFIG_LIBS_FBP(parent)
|
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
m_Config = wxGetApp().GetCommonSettings();
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
Init( );
|
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
wxString title = _( "from " ) + wxGetApp().GetCurrentOptionFile();
|
2009-04-19 15:03:48 +00:00
|
|
|
SetTitle( title );
|
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
m_sdbSizer1OK->SetDefault();
|
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if( GetSizer() )
|
2009-04-24 07:36:36 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::Init()
|
|
|
|
{
|
|
|
|
SetFocus();
|
|
|
|
|
|
|
|
m_LibListChanged = false;
|
|
|
|
m_LibPathChanged = false;
|
2009-05-01 18:06:03 +00:00
|
|
|
m_UserLibDirBufferImg = g_UserLibDirBuffer; // Save the original lib path
|
2009-04-19 15:03:48 +00:00
|
|
|
|
2011-09-27 20:43:18 +00:00
|
|
|
m_ListLibr->InsertItems( g_LibraryNames, 0 );
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
// Display current modules doc file:
|
|
|
|
m_Config->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
|
|
|
|
m_TextHelpModulesFileName->SetValue( g_DocModulesFileName );
|
|
|
|
|
|
|
|
// Load user libs paths:
|
|
|
|
wxStringTokenizer Token( m_UserLibDirBufferImg, wxT( ";\n\r" ) );
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
while( Token.HasMoreTokens() )
|
|
|
|
{
|
|
|
|
wxString path = Token.GetNextToken();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if( wxFileName::DirExists( path ) )
|
|
|
|
m_listUserPaths->Append(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display actual libraries paths:
|
|
|
|
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
|
|
|
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
m_DefaultLibraryPathslistBox->Append( libpaths[ii]);
|
|
|
|
}
|
|
|
|
|
2009-05-01 18:06:03 +00:00
|
|
|
// select the first path after the current path project
|
2009-04-19 15:03:48 +00:00
|
|
|
if ( libpaths.GetCount() > 1 )
|
|
|
|
m_DefaultLibraryPathslistBox->Select( 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnCancelClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
// Recreate the user lib path
|
|
|
|
if ( m_LibPathChanged )
|
|
|
|
{
|
2011-09-26 20:32:56 +00:00
|
|
|
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
|
|
|
|
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString(ii) );
|
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1);
|
|
|
|
}
|
2009-05-01 18:06:03 +00:00
|
|
|
|
|
|
|
EndModal( wxID_CANCEL );
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnOkClick( wxCommandEvent& event )
|
|
|
|
{
|
2011-09-26 20:32:56 +00:00
|
|
|
m_Config->Write( wxT( "module_doc_file" ), m_TextHelpModulesFileName->GetValue() );
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
// Recreate the user lib path
|
|
|
|
if ( m_LibPathChanged )
|
|
|
|
{
|
|
|
|
g_UserLibDirBuffer.Empty();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
for ( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii ++ )
|
|
|
|
{
|
|
|
|
if ( ii > 0 )
|
|
|
|
g_UserLibDirBuffer << wxT(";");
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
g_UserLibDirBuffer << m_listUserPaths->GetString(ii);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
// Set new active library list if the lib list of if default path list was modified
|
2009-04-19 15:03:48 +00:00
|
|
|
if( m_LibListChanged || m_LibPathChanged )
|
|
|
|
{
|
|
|
|
// Recreate lib list
|
2011-09-27 20:43:18 +00:00
|
|
|
g_LibraryNames.Clear();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ )
|
2011-09-27 20:43:18 +00:00
|
|
|
g_LibraryNames.Add( m_ListLibr->GetString(ii) );
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
2009-05-01 18:06:03 +00:00
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
GetParent()->SaveProjectSettings();
|
2009-05-01 18:06:03 +00:00
|
|
|
EndModal( wxID_OK );
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
|
|
|
|
2009-05-01 18:06:03 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnCloseWindow( wxCloseEvent& event )
|
|
|
|
{
|
2009-05-01 18:06:03 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonUpClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
wxArrayInt selections;
|
|
|
|
|
|
|
|
m_ListLibr->GetSelections(selections);
|
|
|
|
if ( selections.GetCount() <= 0 ) // No selection.
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( selections[0] == 0 ) // The first lib is selected. cannot move up it
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxArrayString libnames = m_ListLibr->GetStrings();
|
|
|
|
|
|
|
|
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
int jj = selections[ii];
|
|
|
|
EXCHG( libnames[jj], libnames[jj-1]);
|
|
|
|
}
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
m_ListLibr->Set(libnames);
|
|
|
|
|
|
|
|
// Reselect previously selected names
|
|
|
|
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
int jj = selections[ii];
|
|
|
|
m_ListLibr->SetSelection(jj-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_LibListChanged = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonDownClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
wxArrayInt selections;
|
|
|
|
|
|
|
|
m_ListLibr->GetSelections(selections);
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
if ( selections.GetCount() <= 0 ) // No selection.
|
|
|
|
return;
|
|
|
|
|
|
|
|
// The last lib is selected. cannot move down it
|
|
|
|
if( selections.Last() == (int)(m_ListLibr->GetCount()-1) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxArrayString libnames = m_ListLibr->GetStrings();
|
|
|
|
|
|
|
|
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
|
|
|
|
{
|
|
|
|
int jj = selections[ii];
|
2011-09-26 20:32:56 +00:00
|
|
|
EXCHG( libnames[jj], libnames[jj+1] );
|
2010-04-02 14:26:27 +00:00
|
|
|
}
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
m_ListLibr->Set(libnames);
|
|
|
|
|
|
|
|
// Reselect previously selected names
|
|
|
|
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
int jj = selections[ii];
|
|
|
|
m_ListLibr->SetSelection(jj+1);
|
|
|
|
}
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
m_LibListChanged = TRUE;
|
|
|
|
}
|
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
/* Remove a library to the library list.
|
2009-05-01 18:06:03 +00:00
|
|
|
* The real list (g_LibName_List) is not changed, so the change can be canceled
|
2009-04-19 15:03:48 +00:00
|
|
|
*/
|
2011-09-26 20:32:56 +00:00
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
|
2009-04-19 15:03:48 +00:00
|
|
|
{
|
2010-04-02 14:26:27 +00:00
|
|
|
wxArrayInt selections;
|
2009-04-19 15:03:48 +00:00
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
m_ListLibr->GetSelections( selections );
|
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
|
|
|
|
{
|
2011-09-26 20:32:56 +00:00
|
|
|
m_ListLibr->Delete( selections[ii] );
|
2010-04-02 14:26:27 +00:00
|
|
|
m_LibListChanged = TRUE;
|
|
|
|
}
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert or add a library to the library list:
|
|
|
|
* The new library is put in list before (insert button) the selection,
|
|
|
|
* or added (add button) to end of list
|
2009-05-01 18:06:03 +00:00
|
|
|
* The real list (g_LibName_List) is not changed, so the change can be canceled
|
2009-04-19 15:03:48 +00:00
|
|
|
*/
|
2011-09-26 20:32:56 +00:00
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
2009-04-19 15:03:48 +00:00
|
|
|
{
|
2010-04-02 14:26:27 +00:00
|
|
|
int ii = 0;
|
2009-04-19 15:03:48 +00:00
|
|
|
wxString libfilename;
|
|
|
|
wxFileName fn;
|
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
wxArrayInt selections;
|
|
|
|
m_ListLibr->GetSelections(selections);
|
|
|
|
|
|
|
|
ii = selections.GetCount();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2010-04-02 14:26:27 +00:00
|
|
|
if( ii > 0 )
|
|
|
|
ii = selections[0];
|
|
|
|
else
|
2009-04-19 15:03:48 +00:00
|
|
|
ii = 0;
|
|
|
|
|
|
|
|
wxString libpath;
|
|
|
|
libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
|
|
|
|
if ( libpath.IsEmpty() )
|
|
|
|
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
|
|
|
|
|
|
|
|
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
|
|
|
|
wxEmptyString, g_FootprintLibFileWildcard,
|
|
|
|
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
|
|
|
|
|
|
|
if( FilesDialog.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxArrayString Filenames;
|
|
|
|
FilesDialog.GetPaths( Filenames );
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
2009-04-19 15:03:48 +00:00
|
|
|
{
|
|
|
|
fn = Filenames[jj];
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if ( jj == 0 )
|
|
|
|
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
|
|
|
|
|
|
|
/* If the library path is already in the library search paths
|
|
|
|
* list, just add the library name to the list. Otherwise, add
|
|
|
|
* the library name with the full or relative path.
|
|
|
|
* the relative path, when possible is preferable,
|
2009-05-01 18:06:03 +00:00
|
|
|
* because it preserve use of default libraries paths, when the
|
|
|
|
* path is a sub path of these default paths
|
|
|
|
*/
|
2009-10-23 14:35:24 +00:00
|
|
|
libfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fn.GetFullPath() );
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-10-23 14:35:24 +00:00
|
|
|
// Remove extension:
|
|
|
|
fn = libfilename;
|
2011-09-26 20:32:56 +00:00
|
|
|
fn.SetExt( wxEmptyString );
|
2009-10-23 14:35:24 +00:00
|
|
|
libfilename = fn.GetFullPath();
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
//Add or insert new library name, if not already in list
|
|
|
|
if( m_ListLibr->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
m_LibListChanged = TRUE;
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if( event.GetId() == ID_ADD_LIB )
|
|
|
|
m_ListLibr->Append( libfilename );
|
|
|
|
else
|
|
|
|
m_ListLibr->Insert( libfilename, ii++ );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxString msg = wxT( "<" ) + libfilename + wxT( "> : " ) +
|
2011-09-26 20:32:56 +00:00
|
|
|
_( "Library already in use" );
|
2009-04-19 15:03:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertPath( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
wxString path = wxGetApp().ReturnLastVisitedLibraryPath();
|
|
|
|
|
2009-05-01 18:06:03 +00:00
|
|
|
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
|
|
|
|
path, wxDD_DEFAULT_STYLE,
|
|
|
|
this, wxDefaultPosition );
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
if( !select )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( ! wxFileName::DirExists( path ) ) // Should not occurs
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Add or insert path if not already in list
|
|
|
|
if( m_listUserPaths->FindString( path ) == wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
int ipos = m_listUserPaths->GetCount();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if ( event.GetId() == wxID_INSERT_PATH )
|
|
|
|
{
|
2011-09-26 20:32:56 +00:00
|
|
|
if ( ipos )
|
|
|
|
ipos--;
|
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
int jj = m_listUserPaths->GetSelection();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if ( jj >= 0 )
|
|
|
|
ipos = jj;
|
|
|
|
}
|
2010-01-20 12:43:05 +00:00
|
|
|
|
|
|
|
// Ask the user if this is a relative path
|
2011-09-26 20:32:56 +00:00
|
|
|
int diag = wxMessageBox( _( "Use a relative path?" ),
|
|
|
|
_( "Path type" ),
|
|
|
|
wxYES_NO | wxICON_QUESTION, this );
|
2010-01-20 12:43:05 +00:00
|
|
|
|
|
|
|
if( diag == wxYES )
|
|
|
|
{ // Make it relative
|
|
|
|
wxFileName fn = path;
|
2011-09-26 20:32:56 +00:00
|
|
|
fn.MakeRelativeTo( wxT( "." ) );
|
2010-01-20 12:43:05 +00:00
|
|
|
path = fn.GetPathWithSep() + fn.GetFullName();
|
|
|
|
}
|
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
m_listUserPaths->Insert(path, ipos);
|
|
|
|
m_LibPathChanged = true;
|
|
|
|
wxGetApp().InsertLibraryPath( path, ipos+1 );
|
|
|
|
|
|
|
|
// Display actual libraries paths:
|
|
|
|
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
|
|
|
m_DefaultLibraryPathslistBox->Clear();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
m_DefaultLibraryPathslistBox->Append( libpaths[ii]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2011-09-26 20:32:56 +00:00
|
|
|
{
|
|
|
|
DisplayError( this, _( "Path already in use" ) );
|
|
|
|
}
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
wxGetApp().SaveLastVisitedLibraryPath( path );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveUserPath( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int ii = m_listUserPaths->GetSelection();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if ( ii < 0 )
|
|
|
|
ii = m_listUserPaths->GetCount()-1;
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
if ( ii >= 0 )
|
|
|
|
{
|
|
|
|
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
|
|
|
|
m_listUserPaths->Delete( ii );
|
|
|
|
m_LibPathChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display actual libraries paths:
|
|
|
|
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
|
|
|
m_DefaultLibraryPathslistBox->Clear();
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
|
|
|
{
|
2011-09-26 20:32:56 +00:00
|
|
|
m_DefaultLibraryPathslistBox->Append( libpaths[ii] );
|
2009-04-19 15:03:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-01 18:06:03 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
void DIALOG_PCBNEW_CONFIG_LIBS::OnBrowseModDocFile( wxCommandEvent& event )
|
|
|
|
{
|
2009-05-01 18:06:03 +00:00
|
|
|
wxString FullFileName;
|
2009-04-19 15:03:48 +00:00
|
|
|
wxString docpath, filename;
|
|
|
|
|
|
|
|
docpath = wxGetApp().ReturnLastVisitedLibraryPath(wxT( "doc" ));
|
|
|
|
|
|
|
|
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
|
2011-09-26 20:32:56 +00:00
|
|
|
wxEmptyString, PdfFileWildcard, wxFD_DEFAULT_STYLE );
|
2009-04-19 15:03:48 +00:00
|
|
|
|
|
|
|
if( FilesDialog.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
FullFileName = FilesDialog.GetPath( );
|
|
|
|
/* If the path is already in the library search paths
|
|
|
|
* list, just add the library name to the list. Otherwise, add
|
|
|
|
* the library name with the full or relative path.
|
|
|
|
* the relative path, when possible is preferable,
|
2009-05-01 18:06:03 +00:00
|
|
|
* because it preserve use of default libraries paths, when the path is
|
|
|
|
* a sub path of these default paths
|
2009-04-19 15:03:48 +00:00
|
|
|
*/
|
|
|
|
wxFileName fn = FullFileName;
|
|
|
|
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
|
|
|
|
|
|
|
filename = wxGetApp().ReturnFilenameWithRelativePathInLibPath(FullFileName);
|
|
|
|
m_TextHelpModulesFileName->SetValue( filename );
|
|
|
|
}
|