Loading CHANGELOG.txt +17 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,23 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. 2009-apr-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++eeschema: Default libraries path are now differents for pcbnew and eeschema (as it do) Fixed: bad library search path for schematic component docs (docs were not found) Added: display actual lib paths in eeschema lib config dialog. These next fix give the same behavior than "old" version Use relative paths in libraries and doc filenames when possible i.e when a file is found in a sub path in a default path (very important for Windows/linux/mac compatibility of projects and their configs) TODO: allows user to add paths in list. Currently the user path for lib is broken (but the new code could allow the user to add more than one user path) TODO: do the same for pcbnew and cvpcb 2009-apr-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++eeschema: Loading common/eda_doc.cpp +11 −9 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ bool GetAssociatedDocument( wxFrame* aFrame, const wxPathList* aPaths) { wxString fullfilename, file_ext; wxString docname, fullfilename, file_ext; wxString msg; wxString command; bool success = FALSE; Loading @@ -101,6 +101,14 @@ bool GetAssociatedDocument( wxFrame* aFrame, } } docname = aDocName; #ifdef __WINDOWS__ docname.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP ); #else docname.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); #endif /* Compute the full file name */ if( wxIsAbsolutePath( aDocName ) || aPaths == NULL) fullfilename = aDocName; Loading @@ -109,12 +117,6 @@ bool GetAssociatedDocument( wxFrame* aFrame, fullfilename = aPaths->FindValidPath( aDocName ); } #ifdef __WINDOWS__ fullfilename.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP ); #else fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); #endif wxString mask( wxT( "*" ) ), extension; #ifdef __WINDOWS__ Loading common/edaappl.cpp +60 −46 Original line number Diff line number Diff line Loading @@ -258,14 +258,20 @@ WinEDA_App::~WinEDA_App() } /** * TODO brief /** Function InitEDA_Appl * initialise some general parameters * - Default paths (help, libs, bin)and configuration flies names * - Language and locale * - fonts * @param aName : used as paths in configuration files * @param aId = flag : APP_TYPE_EESCHEMA, APP_TYPE_PCBNEW.. * used to choose what default library path must be used */ void WinEDA_App::InitEDA_Appl( const wxString& name ) void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId ) { wxString EnvLang; m_Checker = new wxSingleInstanceChecker( name.Lower() + wxT( "-" ) + m_Id = aId; m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() ); /* Init kicad environment Loading @@ -283,17 +289,17 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) /* Prepare On Line Help. Use only lower case for help filenames, in order to * avoid problems with upper/lower case filenames under windows and unix */ #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML m_HelpFileName = name.Lower() + wxT( ".html" ); m_HelpFileName = aName.Lower() + wxT( ".html" ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF m_HelpFileName = name.Lower() + wxT( ".pdf" ); m_HelpFileName = aName.Lower() + wxT( ".pdf" ); #else #error Help files format not defined #endif /* Init parameters for configuration */ SetVendorName( wxT( "kicad" ) ); SetAppName( name.Lower() ); SetTitle( name ); SetAppName( aName.Lower() ); SetTitle( aName ); m_EDA_Config = new wxConfig( ); wxASSERT( m_EDA_Config != NULL ); m_EDA_CommonConfig = new wxConfig( CommonConfigPath ); Loading @@ -320,7 +326,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL ); /* TODO installation des gestionnaires de visu d'images (pour help) TODO*/ /* Install some image handlers, mainly for help */ wxImage::AddHandler( new wxPNGHandler ); wxImage::AddHandler( new wxGIFHandler ); wxImage::AddHandler( new wxJPEGHandler ); Loading Loading @@ -478,6 +484,8 @@ void WinEDA_App::SetDefaultSearchPaths( void ) size_t i; wxString path = m_BinDir; m_searchPaths.Clear(); #ifdef __WINDOWS__ /* m_BinDir path is in unix notation. * But wxFileName expect (to work fine) native notation Loading Loading @@ -528,11 +536,14 @@ void WinEDA_App::SetDefaultSearchPaths( void ) } else { /* Add schematic library file path to search path list. */ fn.Clear(); fn.SetPath( m_searchPaths[i] ); /* Add schematic library file path to search path list. * we must add <kicad path>/library and <kicad path>/library/doc */ if ( m_Id == APP_TYPE_EESCHEMA ) { fn.AppendDir( wxT( "library") ); if( fn.IsDirReadable() ) { wxLogDebug( wxT( "Adding <%s> to library search path list" ), Loading @@ -541,18 +552,18 @@ void WinEDA_App::SetDefaultSearchPaths( void ) } /* Add schematic doc file path (library/doc)to search path list. */ fn.RemoveLastDir(); fn.AppendDir( wxT( "doc") ); if( fn.IsDirReadable() ) { wxLogDebug( wxT( "Adding <%s> to library search path list" ), fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); fn.RemoveLastDir(); // point to <kicad path> } /* Add kicad template file path to search path list. */ fn.RemoveLastDir(); fn.AppendDir( wxT( "template" ) ); if( fn.IsDirReadable() ) Loading @@ -561,9 +572,11 @@ void WinEDA_App::SetDefaultSearchPaths( void ) fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); /* Add PCB library file path to search path list. */ fn.RemoveLastDir(); if ( (m_Id == APP_TYPE_PCBNEW) || (m_Id == APP_TYPE_CVPCB) ) { fn.AppendDir( wxT( "modules" ) ); if( fn.IsDirReadable() ) Loading @@ -585,6 +598,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) } } } } /** Loading cvpcb/cvpcb.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "wxstruct.h" #include "common.h" #include "confirm.h" #include "gestfich.h" Loading Loading @@ -64,7 +65,7 @@ bool WinEDA_App::OnInit() wxString currCWD = wxGetCwd(); WinEDA_CvpcbFrame* frame = NULL; InitEDA_Appl( wxT( "CVpcb" ) ); InitEDA_Appl( wxT( "CVpcb" ), APP_TYPE_CVPCB ); if( m_Checker && m_Checker->IsAnotherRunning() ) { Loading eeschema/dialog_eeschema_config.cpp +34 −12 Original line number Diff line number Diff line Loading @@ -54,9 +54,9 @@ public: void WinEDA_SchematicFrame::InstallConfigFrame( const wxPoint& pos ) /******************************************************************/ { DIALOG_EESCHEMA_CONFIG* CfgFrame = new DIALOG_EESCHEMA_CONFIG( this ); DIALOG_EESCHEMA_CONFIG CfgFrame( this ); CfgFrame->ShowModal(); CfgFrame->Destroy(); CfgFrame.ShowModal(); } Loading Loading @@ -126,6 +126,13 @@ void DIALOG_EESCHEMA_CONFIG::Init() m_ListLibr->InsertItems( g_LibName_List, 0 ); m_LibDirCtrl->SetValue( g_UserLibDirBuffer ); // Display actual libraries paths: wxPathList libpaths = wxGetApp().GetLibraryPathList(); for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ ) { m_DefaultLibraryPathslistBox->Append( libpaths[ii]); } } Loading @@ -148,6 +155,7 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event ) if ( g_UserLibDirBuffer != m_LibDirCtrl->GetValue() ) { g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); wxGetApp().SetDefaultSearchPaths( ); m_LibListChanged = true; } Loading Loading @@ -206,7 +214,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) */ { int ii; wxString tmp; wxString libfilename; wxFileName fn; ii = m_ListLibr->GetSelection(); Loading @@ -233,24 +241,38 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) /* 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 path. */ if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND ) tmp = fn.GetPathWithSep() + fn.GetName(); else tmp = fn.GetName(); * the library name with the full or relative path. * the relative path, when possible is preferable, * because it preserve use of default libraries paths, when the path is a sub path of these default paths * */ if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case libfilename = fn.GetName(); else // not in the default, : see if this file is in a subpath: { libfilename = fn.GetPathWithSep() + fn.GetName(); for ( unsigned kk = 0; kk < wxGetApp().GetLibraryPathList().GetCount(); kk ++ ) { if( fn.MakeRelativeTo(wxGetApp().GetLibraryPathList()[kk] ) ) { libfilename = fn.GetPathWithSep() + fn.GetName(); break; } } } //Add or insert new library name, if not already in list if( m_ListLibr->FindString( tmp, fn.IsCaseSensitive() ) == wxNOT_FOUND ) if( m_ListLibr->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND ) { m_LibListChanged = TRUE; if( event.GetId() == ID_ADD_LIB ) m_ListLibr->Append( tmp ); m_ListLibr->Append( libfilename ); else m_ListLibr->Insert( tmp, ii++ ); m_ListLibr->Insert( libfilename, ii++ ); } else { wxString msg = wxT( "<" ) + tmp + wxT( "> : " ) + wxString msg = wxT( "<" ) + libfilename + wxT( "> : " ) + _( "Library already in use" ); DisplayError( this, msg ); } Loading Loading
CHANGELOG.txt +17 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,23 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. 2009-apr-12 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++eeschema: Default libraries path are now differents for pcbnew and eeschema (as it do) Fixed: bad library search path for schematic component docs (docs were not found) Added: display actual lib paths in eeschema lib config dialog. These next fix give the same behavior than "old" version Use relative paths in libraries and doc filenames when possible i.e when a file is found in a sub path in a default path (very important for Windows/linux/mac compatibility of projects and their configs) TODO: allows user to add paths in list. Currently the user path for lib is broken (but the new code could allow the user to add more than one user path) TODO: do the same for pcbnew and cvpcb 2009-apr-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++eeschema: Loading
common/eda_doc.cpp +11 −9 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ bool GetAssociatedDocument( wxFrame* aFrame, const wxPathList* aPaths) { wxString fullfilename, file_ext; wxString docname, fullfilename, file_ext; wxString msg; wxString command; bool success = FALSE; Loading @@ -101,6 +101,14 @@ bool GetAssociatedDocument( wxFrame* aFrame, } } docname = aDocName; #ifdef __WINDOWS__ docname.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP ); #else docname.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); #endif /* Compute the full file name */ if( wxIsAbsolutePath( aDocName ) || aPaths == NULL) fullfilename = aDocName; Loading @@ -109,12 +117,6 @@ bool GetAssociatedDocument( wxFrame* aFrame, fullfilename = aPaths->FindValidPath( aDocName ); } #ifdef __WINDOWS__ fullfilename.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP ); #else fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); #endif wxString mask( wxT( "*" ) ), extension; #ifdef __WINDOWS__ Loading
common/edaappl.cpp +60 −46 Original line number Diff line number Diff line Loading @@ -258,14 +258,20 @@ WinEDA_App::~WinEDA_App() } /** * TODO brief /** Function InitEDA_Appl * initialise some general parameters * - Default paths (help, libs, bin)and configuration flies names * - Language and locale * - fonts * @param aName : used as paths in configuration files * @param aId = flag : APP_TYPE_EESCHEMA, APP_TYPE_PCBNEW.. * used to choose what default library path must be used */ void WinEDA_App::InitEDA_Appl( const wxString& name ) void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId ) { wxString EnvLang; m_Checker = new wxSingleInstanceChecker( name.Lower() + wxT( "-" ) + m_Id = aId; m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() ); /* Init kicad environment Loading @@ -283,17 +289,17 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) /* Prepare On Line Help. Use only lower case for help filenames, in order to * avoid problems with upper/lower case filenames under windows and unix */ #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML m_HelpFileName = name.Lower() + wxT( ".html" ); m_HelpFileName = aName.Lower() + wxT( ".html" ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF m_HelpFileName = name.Lower() + wxT( ".pdf" ); m_HelpFileName = aName.Lower() + wxT( ".pdf" ); #else #error Help files format not defined #endif /* Init parameters for configuration */ SetVendorName( wxT( "kicad" ) ); SetAppName( name.Lower() ); SetTitle( name ); SetAppName( aName.Lower() ); SetTitle( aName ); m_EDA_Config = new wxConfig( ); wxASSERT( m_EDA_Config != NULL ); m_EDA_CommonConfig = new wxConfig( CommonConfigPath ); Loading @@ -320,7 +326,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL ); /* TODO installation des gestionnaires de visu d'images (pour help) TODO*/ /* Install some image handlers, mainly for help */ wxImage::AddHandler( new wxPNGHandler ); wxImage::AddHandler( new wxGIFHandler ); wxImage::AddHandler( new wxJPEGHandler ); Loading Loading @@ -478,6 +484,8 @@ void WinEDA_App::SetDefaultSearchPaths( void ) size_t i; wxString path = m_BinDir; m_searchPaths.Clear(); #ifdef __WINDOWS__ /* m_BinDir path is in unix notation. * But wxFileName expect (to work fine) native notation Loading Loading @@ -528,11 +536,14 @@ void WinEDA_App::SetDefaultSearchPaths( void ) } else { /* Add schematic library file path to search path list. */ fn.Clear(); fn.SetPath( m_searchPaths[i] ); /* Add schematic library file path to search path list. * we must add <kicad path>/library and <kicad path>/library/doc */ if ( m_Id == APP_TYPE_EESCHEMA ) { fn.AppendDir( wxT( "library") ); if( fn.IsDirReadable() ) { wxLogDebug( wxT( "Adding <%s> to library search path list" ), Loading @@ -541,18 +552,18 @@ void WinEDA_App::SetDefaultSearchPaths( void ) } /* Add schematic doc file path (library/doc)to search path list. */ fn.RemoveLastDir(); fn.AppendDir( wxT( "doc") ); if( fn.IsDirReadable() ) { wxLogDebug( wxT( "Adding <%s> to library search path list" ), fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); fn.RemoveLastDir(); // point to <kicad path> } /* Add kicad template file path to search path list. */ fn.RemoveLastDir(); fn.AppendDir( wxT( "template" ) ); if( fn.IsDirReadable() ) Loading @@ -561,9 +572,11 @@ void WinEDA_App::SetDefaultSearchPaths( void ) fn.GetPath().c_str() ); m_libSearchPaths.Add( fn.GetPath() ); } fn.RemoveLastDir(); /* Add PCB library file path to search path list. */ fn.RemoveLastDir(); if ( (m_Id == APP_TYPE_PCBNEW) || (m_Id == APP_TYPE_CVPCB) ) { fn.AppendDir( wxT( "modules" ) ); if( fn.IsDirReadable() ) Loading @@ -585,6 +598,7 @@ void WinEDA_App::SetDefaultSearchPaths( void ) } } } } /** Loading
cvpcb/cvpcb.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "wxstruct.h" #include "common.h" #include "confirm.h" #include "gestfich.h" Loading Loading @@ -64,7 +65,7 @@ bool WinEDA_App::OnInit() wxString currCWD = wxGetCwd(); WinEDA_CvpcbFrame* frame = NULL; InitEDA_Appl( wxT( "CVpcb" ) ); InitEDA_Appl( wxT( "CVpcb" ), APP_TYPE_CVPCB ); if( m_Checker && m_Checker->IsAnotherRunning() ) { Loading
eeschema/dialog_eeschema_config.cpp +34 −12 Original line number Diff line number Diff line Loading @@ -54,9 +54,9 @@ public: void WinEDA_SchematicFrame::InstallConfigFrame( const wxPoint& pos ) /******************************************************************/ { DIALOG_EESCHEMA_CONFIG* CfgFrame = new DIALOG_EESCHEMA_CONFIG( this ); DIALOG_EESCHEMA_CONFIG CfgFrame( this ); CfgFrame->ShowModal(); CfgFrame->Destroy(); CfgFrame.ShowModal(); } Loading Loading @@ -126,6 +126,13 @@ void DIALOG_EESCHEMA_CONFIG::Init() m_ListLibr->InsertItems( g_LibName_List, 0 ); m_LibDirCtrl->SetValue( g_UserLibDirBuffer ); // Display actual libraries paths: wxPathList libpaths = wxGetApp().GetLibraryPathList(); for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ ) { m_DefaultLibraryPathslistBox->Append( libpaths[ii]); } } Loading @@ -148,6 +155,7 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event ) if ( g_UserLibDirBuffer != m_LibDirCtrl->GetValue() ) { g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); wxGetApp().SetDefaultSearchPaths( ); m_LibListChanged = true; } Loading Loading @@ -206,7 +214,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) */ { int ii; wxString tmp; wxString libfilename; wxFileName fn; ii = m_ListLibr->GetSelection(); Loading @@ -233,24 +241,38 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) /* 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 path. */ if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND ) tmp = fn.GetPathWithSep() + fn.GetName(); else tmp = fn.GetName(); * the library name with the full or relative path. * the relative path, when possible is preferable, * because it preserve use of default libraries paths, when the path is a sub path of these default paths * */ if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case libfilename = fn.GetName(); else // not in the default, : see if this file is in a subpath: { libfilename = fn.GetPathWithSep() + fn.GetName(); for ( unsigned kk = 0; kk < wxGetApp().GetLibraryPathList().GetCount(); kk ++ ) { if( fn.MakeRelativeTo(wxGetApp().GetLibraryPathList()[kk] ) ) { libfilename = fn.GetPathWithSep() + fn.GetName(); break; } } } //Add or insert new library name, if not already in list if( m_ListLibr->FindString( tmp, fn.IsCaseSensitive() ) == wxNOT_FOUND ) if( m_ListLibr->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND ) { m_LibListChanged = TRUE; if( event.GetId() == ID_ADD_LIB ) m_ListLibr->Append( tmp ); m_ListLibr->Append( libfilename ); else m_ListLibr->Insert( tmp, ii++ ); m_ListLibr->Insert( libfilename, ii++ ); } else { wxString msg = wxT( "<" ) + tmp + wxT( "> : " ) + wxString msg = wxT( "<" ) + libfilename + wxT( "> : " ) + _( "Library already in use" ); DisplayError( this, msg ); } Loading