More search path, compiler warning, and bug fixes.
Added template subdirectory to library search path list. Removed PARAM_CFG_BASE empty destructor to prevent GCC warning. Set timeout to 0 on DisplayInfo call to prevent debug assertion in eeschema/files-io.cpp. Declare PARAM_CFG_ARRAY for future project file object implementation. Removed unnecessary COMMON_GLOBL definition in gr_basic.h and param_config.h.
This commit is contained in:
parent
0706234d8d
commit
5b3c5861bd
|
@ -105,7 +105,8 @@ void DisplayInfo( wxWindow* parent, const wxString& text, int displaytime )
|
|||
dialog = new WinEDA_MessageDialog( parent, text, _( "Info:" ),
|
||||
wxOK | wxICON_INFORMATION, displaytime );
|
||||
|
||||
dialog->ShowModal(); dialog->Destroy();
|
||||
dialog->ShowModal();
|
||||
dialog->Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -528,21 +528,30 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Build schematic, PCB, and 3D module library file search path
|
||||
* list based on the known existing default search paths. */
|
||||
/* Add schematic library file path to search path list. */
|
||||
fn.Clear();
|
||||
fn.SetPath( m_searchPaths[i] );
|
||||
fn.AppendDir( wxT( "library") );
|
||||
|
||||
wxLogDebug( wxT( "Checking if search path <%s> exists." ),
|
||||
fn.GetPath().c_str() );
|
||||
|
||||
if( fn.IsDirReadable() )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
||||
fn.GetPath().c_str() );
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
}
|
||||
|
||||
/* Add kicad template file path to search path list. */
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir( wxT( "template" ) );
|
||||
|
||||
if( fn.IsDirReadable() )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
||||
fn.GetPath().c_str() );
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
}
|
||||
|
||||
/* Add PCB library file path to search path list. */
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir( wxT( "modules" ) );
|
||||
|
||||
|
@ -552,6 +561,8 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
fn.GetPath().c_str() );
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
}
|
||||
|
||||
/* Add 3D module library file path to search path list. */
|
||||
fn.AppendDir( wxT( "packages3d" ) );
|
||||
|
||||
if( fn.IsDirReadable() )
|
||||
|
|
|
@ -447,48 +447,6 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
|||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
void SetRealLibraryPath( const wxString& shortlibname )
|
||||
/****************************************************/
|
||||
|
||||
/* met a jour le chemin des librairies g_RealLibDirBuffer (global)
|
||||
* a partir de UserLibDirBuffer (global):
|
||||
* Si UserLibDirBuffer non vide g_RealLibDirBuffer = g_UserLibDirBuffer.
|
||||
* Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
|
||||
* g_UserLibDirBuffer = <KICAD>/shortlibname;
|
||||
* Sinon g_UserLibDirBuffer = <Chemin des binaires>../shortlibname/
|
||||
* Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
|
||||
*
|
||||
* Remarque:
|
||||
* Les \ sont remplaces par / (a la mode Unix)
|
||||
*/
|
||||
{
|
||||
bool PathFound = FALSE;
|
||||
|
||||
if( !g_UserLibDirBuffer.IsEmpty() ) // Chemin impose par la configuration
|
||||
{
|
||||
g_RealLibDirBuffer = g_UserLibDirBuffer;
|
||||
PathFound = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_RealLibDirBuffer = ReturnKicadDatasPath();
|
||||
if( wxGetApp().m_Env_Defined ) // Chemin impose par la variable d'environnement
|
||||
{
|
||||
PathFound = TRUE;
|
||||
}
|
||||
g_RealLibDirBuffer += shortlibname;
|
||||
if( wxDirExists( g_RealLibDirBuffer ) )
|
||||
PathFound = TRUE;
|
||||
}
|
||||
|
||||
|
||||
g_RealLibDirBuffer.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
if( g_RealLibDirBuffer.Last() != '/' )
|
||||
g_RealLibDirBuffer += UNIX_STRING_DIR_SEP;
|
||||
}
|
||||
|
||||
|
||||
/***********************************/
|
||||
wxString ReturnKicadDatasPath()
|
||||
/***********************************/
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "gestfich.h"
|
||||
#include "wxstruct.h"
|
||||
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
|
||||
wxString g_CommonSectionTag( wxT( "[common]" ) );
|
||||
wxString g_SchematicSectionTag( wxT( "[eeschema]" ) );
|
||||
|
@ -597,14 +600,21 @@ wxString ReturnHotkeyConfigFilePath( int choice )
|
|||
*/
|
||||
{
|
||||
wxString path;
|
||||
wxAppTraits* traits = wxGetApp().GetTraits();
|
||||
|
||||
switch( choice )
|
||||
{
|
||||
case 0:
|
||||
path = wxGetHomeDir() + wxT( "/" );
|
||||
break;
|
||||
path = traits->GetStandardPaths().GetUserConfigDir() +
|
||||
wxFileName::GetPathSeparator();
|
||||
|
||||
case 1:
|
||||
/* TODO: This is broken under a normal Poxis system. Users
|
||||
* generally do no have write permissions to this path
|
||||
* and there is no provision for prompting for the root
|
||||
* password. Suggest we remove this unless someone has
|
||||
* a workable solution (Wayne).
|
||||
*/
|
||||
path = ReturnKicadDatasPath() + wxT( "template/" );
|
||||
break;
|
||||
|
||||
|
|
|
@ -11,12 +11,19 @@
|
|||
#include "wxstruct.h"
|
||||
#include "param_config.h"
|
||||
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
|
||||
#define CONFIG_VERSION 1
|
||||
|
||||
#define FORCE_LOCAL_CONFIG true
|
||||
|
||||
|
||||
#include <wx/arrimpl.cpp>
|
||||
WX_DEFINE_OBJARRAY( PARAM_CFG_ARRAY );
|
||||
|
||||
|
||||
/**
|
||||
* Cree ou recree la configuration locale de kicad (filename.pro)
|
||||
* initialise:
|
||||
|
@ -93,13 +100,22 @@ bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName,
|
|||
}
|
||||
}
|
||||
|
||||
defaultFileName = m_libSearchPaths.FindValidPath( wxT( "kicad.pro" ) );
|
||||
|
||||
defaultFileName = ReturnKicadDatasPath() + wxT( "template/kicad" ) +
|
||||
wxT( "." ) + ProjectFileExtension;
|
||||
if( !defaultFileName )
|
||||
{
|
||||
wxLogDebug( wxT( "Template file <kicad.pro> not found." ) );
|
||||
fn = wxFileName( GetTraits()->GetStandardPaths().GetDocumentsDir(),
|
||||
wxT( "kicad" ), ProjectFileExtension );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn = defaultFileName;
|
||||
}
|
||||
|
||||
// Create new project file using the default name.
|
||||
m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString,
|
||||
wxEmptyString, defaultFileName );
|
||||
wxEmptyString, fn.GetFullPath() );
|
||||
m_ProjectConfig->DontCreateOnDemand();
|
||||
|
||||
return false;
|
||||
|
|
|
@ -75,7 +75,6 @@ bool WinEDA_App::OnInit()
|
|||
GetSettings(); // read current setup
|
||||
|
||||
wxSetWorkingDirectory( currCWD ); // mofifie par GetSetting
|
||||
SetRealLibraryPath( wxT( "modules" ) );
|
||||
|
||||
if( argc > 1 )
|
||||
{
|
||||
|
|
|
@ -124,7 +124,6 @@ void KiConfigCvpcbFrame::Update()
|
|||
if( msg != g_UserLibDirBuffer )
|
||||
{
|
||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||
SetRealLibraryPath( wxT( "modules" ) );
|
||||
listlib();
|
||||
m_Parent->BuildFootprintListBox();
|
||||
}
|
||||
|
|
|
@ -146,7 +146,6 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
// Set new default path lib
|
||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||
SetRealLibraryPath( wxT( "library" ) ); // set real path lib
|
||||
|
||||
// Set new active lib list
|
||||
if( m_LibListChanged )
|
||||
|
@ -155,7 +154,7 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
|
|||
g_LibName_List.Clear();
|
||||
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ )
|
||||
g_LibName_List.Add(m_ListLibr->GetString(ii) );
|
||||
|
||||
|
||||
// take new list in account
|
||||
LoadLibraries( m_Parent );
|
||||
if( m_Parent->m_ViewlibFrame )
|
||||
|
|
|
@ -80,19 +80,16 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
|||
FullFileName = FileName;
|
||||
if( ( FullFileName.IsEmpty() ) && !IsNew )
|
||||
{
|
||||
wxString mask = wxT( "*." ) + SchematicFileExtension;
|
||||
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
SchematicFileExtension, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_OPEN,
|
||||
TRUE
|
||||
);
|
||||
if( FullFileName.IsEmpty() )
|
||||
wxFileDialog dlg( this, _( "Open Schematic" ), wxEmptyString,
|
||||
wxEmptyString, SchematicFileWildcard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return 0;
|
||||
|
||||
FullFileName = dlg.GetPath();
|
||||
}
|
||||
|
||||
if( g_RootSheet )
|
||||
{
|
||||
SAFE_DELETE( g_RootSheet );
|
||||
|
@ -175,12 +172,13 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
|||
LibCacheExist = TRUE;
|
||||
}
|
||||
|
||||
if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
|
||||
if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName )
|
||||
&& !LibCacheExist )
|
||||
{
|
||||
Zoom_Automatique( FALSE );
|
||||
msg.Printf( _( "File <%s> not found." ),
|
||||
g_RootSheet->m_AssociatedScreen->m_FileName.GetData() );
|
||||
DisplayInfo( this, msg, 20 );
|
||||
DisplayInfo( this, msg, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,14 +80,6 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
|||
const wxString& param = wxEmptyString );
|
||||
void AddDelimiterString( wxString& string );
|
||||
|
||||
void SetRealLibraryPath( const wxString& shortlibname ); /* met a jour
|
||||
* le chemin des librairies RealLibDirBuffer (global)
|
||||
* a partir de UserLibDirBuffer (global):
|
||||
* Si UserLibDirBuffer non vide RealLibDirBuffer = UserLibDirBuffer.
|
||||
* Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
|
||||
* UserLibDirBuffer = <KICAD>/shortlibname;
|
||||
* Sinon UserLibDirBuffer = <Chemin des binaires>../shortlibname/
|
||||
*/
|
||||
wxString FindKicadHelpPath();
|
||||
|
||||
/* Find absolute path for kicad/help (or kicad/help/<language>) */
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#ifndef GR_BASIC
|
||||
#define GR_BASIC
|
||||
|
||||
#ifndef COMMON_GLOBL
|
||||
#define COMMON_GLOBL extern
|
||||
#endif
|
||||
|
||||
#include "colors.h"
|
||||
|
||||
|
||||
|
|
|
@ -8,10 +8,7 @@
|
|||
|
||||
#include "wx/confbase.h"
|
||||
#include "wx/fileconf.h"
|
||||
|
||||
#ifndef COMMON_GLOBL
|
||||
# define COMMON_GLOBL extern
|
||||
#endif
|
||||
#include <wx/dynarray.h>
|
||||
|
||||
|
||||
/* definifition des types de parametre des files de configuration */
|
||||
|
@ -40,7 +37,6 @@ public:
|
|||
|
||||
public:
|
||||
PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
|
||||
~PARAM_CFG_BASE() { };
|
||||
|
||||
/** ReadParam
|
||||
* read the value of parameter thi stored in aConfig
|
||||
|
@ -209,5 +205,6 @@ public:
|
|||
virtual void SaveParam( wxConfigBase* aConfig );
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY( PARAM_CFG_BASE, PARAM_CFG_ARRAY );
|
||||
|
||||
#endif /* __PARAM_CONFIG_H__ */
|
||||
|
|
|
@ -25,23 +25,20 @@ static const wxString BoardFileNameEntry( wxT( "BoardNm" ) );
|
|||
|
||||
void WinEDA_MainFrame::CreateNewProject( const wxString PrjFullFileName )
|
||||
{
|
||||
wxFileName fn;
|
||||
wxString tmp;
|
||||
wxFileName newProjectName = PrjFullFileName;
|
||||
|
||||
// Init default config filename
|
||||
fn.SetPath( ReturnKicadDatasPath() );
|
||||
fn.AppendDir( wxT( "template" ) );
|
||||
fn.SetName( wxT( "kicad" ) );
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( wxT( "kicad.pro" ) );
|
||||
|
||||
if( !fn.FileExists() )
|
||||
if( !wxFileName::FileExists( tmp ) )
|
||||
{
|
||||
DisplayInfo( NULL, _( "Template file not found " ) + fn.GetFullPath() );
|
||||
DisplayInfo( NULL, _( "Project template file <kicad.pro> not found " ) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxCopyFile( fn.GetFullPath(), PrjFullFileName );
|
||||
wxCopyFile( tmp, PrjFullFileName );
|
||||
}
|
||||
|
||||
m_SchematicRootFileName = wxFileName( newProjectName.GetName(),
|
||||
|
|
Loading…
Reference in New Issue