Commit e7ea0480 authored by Maciej Suminski's avatar Maciej Suminski

Upstream merge.

parents bff37e50 8e6713ca
...@@ -364,13 +364,13 @@ check_find_package_result( OPENGL_FOUND "OpenGL" ) ...@@ -364,13 +364,13 @@ check_find_package_result( OPENGL_FOUND "OpenGL" )
# https://www.mail-archive.com/cmake@cmake.org/msg47501.html # https://www.mail-archive.com/cmake@cmake.org/msg47501.html
# Handle target used to specify if a target needs wx-widgets or other libraries # Handle target used to specify if a target needs wx-widgets or other libraries
# Always defined, empty if no libraries are to be build # Always defined, empty if no libraries are to be built
add_custom_target( lib-dependencies ) add_custom_target( lib-dependencies )
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
# This should be build in all cases, if swig exec is not avaiable # This should be built in all cases, if swig exec is not avaiable
# will be impossible also enable SCRIPTING being for PCBNEW required immediatly # will be impossible also enable SCRIPTING being for PCBNEW required immediately
include( download_pcre ) include( download_pcre )
include( download_swig ) include( download_swig )
......
...@@ -172,6 +172,7 @@ set( COMMON_SRCS ...@@ -172,6 +172,7 @@ set( COMMON_SRCS
eda_dde.cpp eda_dde.cpp
eda_doc.cpp eda_doc.cpp
filter_reader.cpp filter_reader.cpp
# findkicadhelppath.cpp.notused deprecated, use searchhelpfilefullpath.cpp
gestfich.cpp gestfich.cpp
getrunningmicrosecs.cpp getrunningmicrosecs.cpp
grid_tricks.cpp grid_tricks.cpp
...@@ -189,6 +190,7 @@ set( COMMON_SRCS ...@@ -189,6 +190,7 @@ set( COMMON_SRCS
ptree.cpp ptree.cpp
reporter.cpp reporter.cpp
richio.cpp richio.cpp
searchhelpfilefullpath.cpp
search_stack.cpp search_stack.cpp
selcolor.cpp selcolor.cpp
systemdirsappend.cpp systemdirsappend.cpp
......
...@@ -271,6 +271,18 @@ wxConfigBase* EDA_BASE_FRAME::config() ...@@ -271,6 +271,18 @@ wxConfigBase* EDA_BASE_FRAME::config()
} }
const SEARCH_STACK& EDA_BASE_FRAME::sys_search()
{
return Kiface().KifaceSearch();
}
wxString EDA_BASE_FRAME::help_name()
{
return Kiface().GetHelpFileName();
}
void EDA_BASE_FRAME::PrintMsg( const wxString& text ) void EDA_BASE_FRAME::PrintMsg( const wxString& text )
{ {
SetStatusText( text ); SetStatusText( text );
...@@ -327,33 +339,28 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type, ...@@ -327,33 +339,28 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{ {
wxString msg; const SEARCH_STACK& search = sys_search();
/* We have to get document for beginners, /* We have to get document for beginners,
* or the the full specific doc * or the full specific doc
* if event id is wxID_INDEX, we want the document for beginners. * if event id is wxID_INDEX, we want the document for beginners.
* else the specific doc file (its name is in Kiface().GetHelpFileName()) * else the specific doc file (its name is in Kiface().GetHelpFileName())
* The document for beginners is the same for all KiCad utilities * The document for beginners is the same for all KiCad utilities
*/ */
if( event.GetId() == wxID_INDEX ) if( event.GetId() == wxID_INDEX )
{ {
// Temporarily change the help filename
wxString tmp = Kiface().GetHelpFileName();
// Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf" // Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
Kiface().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) ); wxString helpFile = SearchHelpFileFullPath( search, wxT( "getting_started_in_kicad.pdf" ) );
wxString helpFile = Kiface().GetHelpFile();
if( !helpFile ) if( !helpFile )
{ // Try to find "Getting_Started_in_KiCad.pdf" helpFile = SearchHelpFileFullPath( search, wxT( "Getting_Started_in_KiCad.pdf" ) );
Kiface().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
helpFile = Kiface().GetHelpFile();
}
if( !helpFile ) if( !helpFile )
{ {
msg.Printf( _( "Help file %s could not be found." ), wxString msg = wxString::Format( _(
GetChars( Kiface().GetHelpFileName() ) ); "Help file '%s' could not be found." ),
wxT( "getting_started_in_kicad.pdf" )
);
wxMessageBox( msg ); wxMessageBox( msg );
} }
else else
...@@ -361,36 +368,36 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -361,36 +368,36 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
GetAssociatedDocument( this, helpFile ); GetAssociatedDocument( this, helpFile );
} }
Kiface().SetHelpFileName( tmp );
return; return;
} }
wxString base_name = help_name();
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( Kiface().GetHtmlHelpController() == NULL ) wxHtmlHelpController* hc = Pgm().GetHtmlHelpController();
{
Kiface().InitOnLineHelp();
}
wxString helpFile = SearchHelpFileFullPath( search, );
if( Kiface().GetHtmlHelpController() ) if( !!helpFile )
{ {
Kiface().GetHtmlHelpController()->DisplayContents(); hc->UseConfig( Pgm().CommonSettings() );
Kiface().GetHtmlHelpController()->Display( Kiface().GetHelpFileName() ); hc->SetTitleFormat( wxT( "KiCad Help" ) );
} hc->AddBook( helpFile );
else
{
msg.Printf( _( "Help file %s could not be found." ), GetChars( Kiface().GetHelpFileName() ) );
wxMessageBox( msg );
} }
hc->DisplayContents();
hc->Display( helpFile );
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
wxString helpFile = Kiface().GetHelpFile(); wxString helpFile = SearchHelpFileFullPath( search, base_name );
if( !helpFile ) if( !helpFile )
{ {
msg.Printf( _( "Help file %s could not be found." ), wxString msg = wxString::Format( _(
GetChars( Kiface().GetHelpFileName() ) ); "Help file '%s' could not be found." ),
GetChars( base_name )
);
wxMessageBox( msg ); wxMessageBox( msg );
} }
else else
......
...@@ -64,15 +64,19 @@ bool GetAssociatedDocument( wxFrame* aFrame, ...@@ -64,15 +64,19 @@ bool GetAssociatedDocument( wxFrame* aFrame,
const wxPathList* aPaths) const wxPathList* aPaths)
{ {
wxString docname, fullfilename, file_ext; wxString docname, fullfilename;
wxString msg; wxString msg;
wxString command; wxString command;
bool success = false; bool success = false;
// Is an internet url // Is an internet url
static const wxString url_header[3] = { wxT( "http:" ), wxT( "ftp:" ), wxT( "www." ) }; static const wxChar* url_header[3] = {
wxT( "http:" ),
wxT( "ftp:" ),
wxT( "www." )
};
for( int ii = 0; ii < 3; ii++ ) for( unsigned ii = 0; ii < DIM(url_header); ii++ )
{ {
if( aDocName.First( url_header[ii] ) == 0 ) //. seems an internet url if( aDocName.First( url_header[ii] ) == 0 ) //. seems an internet url
{ {
...@@ -133,8 +137,9 @@ bool GetAssociatedDocument( wxFrame* aFrame, ...@@ -133,8 +137,9 @@ bool GetAssociatedDocument( wxFrame* aFrame,
return false; return false;
} }
wxFileName CurrentFileName( fullfilename ); wxFileName currentFileName( fullfilename );
file_ext = CurrentFileName.GetExt();
wxString file_ext = currentFileName.GetExt();
if( file_ext == wxT( "pdf" ) ) if( file_ext == wxT( "pdf" ) )
{ {
......
#include <fctsys.h>
#include <pgm_base.h>
#include <macros.h>
#include <gestfich.h>
/**
* Function FindKicadHelpPath
* finds the absolute path for KiCad "help" (or "help/&ltlanguage&gt")
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
* from BinDir
* else from environment variable KICAD
* else from one of s_HelpPathList
* typically c:/kicad/doc/help or /usr/share/kicad/help
* or /usr/local/share/kicad/help
* (must have kicad in path name)
*
* xx = iso639-1 language id (2 letters (generic) or 4 letters):
* fr = french (or fr_FR)
* en = English (or en_GB or en_US ...)
* de = deutch
* es = spanish
* pt = portuguese (or pt_BR ...)
*
* default = en (if not found = fr)
*/
wxString FindKicadHelpPath()
{
bool found = false;
wxString bin_dir = Pgm().GetExecutablePath();
if( bin_dir.Last() == '/' )
bin_dir.RemoveLast();
wxString fullPath = bin_dir.BeforeLast( '/' ); // cd ..
fullPath += wxT( "/doc/help/" );
wxString localeString = Pgm().GetLocale()->GetCanonicalName();
wxString path_tmp = fullPath;
#ifdef __WINDOWS__
path_tmp.MakeLower();
#endif
if( path_tmp.Contains( wxT( "kicad" ) ) )
{
if( wxDirExists( fullPath ) )
found = true;
}
// find kicad/help/ from environment variable KICAD
if( !found && Pgm().IsKicadEnvVariableDefined() )
{
fullPath = Pgm().GetKicadEnvVariable() + wxT( "/doc/help/" );
if( wxDirExists( fullPath ) )
found = true;
}
if( !found )
{
// Possibilities online help
const static wxChar* possibilities[] = {
#ifdef __WINDOWS__
wxT( "c:/kicad/doc/help/" ),
wxT( "d:/kicad/doc/help/" ),
wxT( "c:/Program Files/kicad/doc/help/" ),
wxT( "d:/Program Files/kicad/doc/help/" ),
#else
wxT( "/usr/share/doc/kicad/help/" ),
wxT( "/usr/local/share/doc/kicad/help/" ),
wxT( "/usr/local/kicad/doc/help/" ), // default install for "universal
// tarballs" and build for a server
// (new)
wxT( "/usr/local/kicad/help/" ), // default install for "universal
// tarballs" and build for a server
// (old)
#endif
};
for( unsigned i=0; i<DIM(possibilities); ++i )
{
fullPath = possibilities[i];
if( wxDirExists( fullPath ) )
{
found = true;
break;
}
}
}
if( found )
{
wxString langFullPath = fullPath + localeString + UNIX_STRING_DIR_SEP;
if( wxDirExists( langFullPath ) )
return langFullPath;
langFullPath = fullPath + localeString.Left( 2 ) + UNIX_STRING_DIR_SEP;
if( wxDirExists( langFullPath ) )
return langFullPath;
langFullPath = fullPath + wxT( "en/" );
if( wxDirExists( langFullPath ) )
{
return langFullPath;
}
else
{
langFullPath = fullPath + wxT( "fr/" );
if( wxDirExists( langFullPath ) )
return langFullPath;
}
return fullPath;
}
return wxEmptyString;
}
...@@ -622,8 +622,6 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname ) ...@@ -622,8 +622,6 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
// wxGetenv( wchar_t* ) is not re-entrant on linux. // wxGetenv( wchar_t* ) is not re-entrant on linux.
// Put a lock on multithreaded use of wxGetenv( wchar_t* ), called from wxEpandEnvVars(), // Put a lock on multithreaded use of wxGetenv( wchar_t* ), called from wxEpandEnvVars(),
// needed by bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = NULL ); // needed by bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = NULL );
#if 1
#include <ki_mutex.h> #include <ki_mutex.h>
const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString ) const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
...@@ -637,177 +635,44 @@ const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString ) ...@@ -637,177 +635,44 @@ const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
return wxExpandEnvVars( aString ); return wxExpandEnvVars( aString );
} }
#else
const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
{
// We reserve the right to do this another way, by providing our own member
// function.
return wxExpandEnvVars( aString );
}
#endif
bool FP_LIB_TABLE::IsEmpty( bool aIncludeFallback ) bool FP_LIB_TABLE::IsEmpty( bool aIncludeFallback )
{ {
if( !aIncludeFallback || (fallBack == NULL) ) if( !aIncludeFallback || !fallBack )
return rows.empty(); return rows.empty();
return fallBack->IsEmpty() && rows.empty(); return rows.empty() && fallBack->IsEmpty( true );
} }
bool FP_LIB_TABLE::ConvertFromLegacy( SEARCH_STACK& aSStack, NETLIST& aNetList, MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const FPID& aFootprintId )
const wxArrayString& aLibNames, REPORTER* aReporter ) throw( IO_ERROR ) throw( IO_ERROR, PARSE_ERROR )
{ {
wxString msg; wxString nickname = aFootprintId.GetLibNickname();
FPID lastFPID; wxString fpname = aFootprintId.GetFootprintName();
COMPONENT* component;
MODULE* module = 0;
bool retv = true;
if( aNetList.IsEmpty() )
return true;
aNetList.SortByFPID();
wxString libPath;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned ii = 0; ii < aNetList.GetCount(); ii++ )
{
component = aNetList.GetComponent( ii );
// The footprint hasn't been assigned yet so ignore it.
if( component->GetFPID().empty() )
continue;
if( component->GetFPID() != lastFPID )
{
module = NULL;
for( unsigned ii = 0; ii < aLibNames.GetCount(); ii++ )
{
wxFileName fn( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
libPath = aSStack.FindValidPath( fn );
if( !libPath )
{
if( aReporter )
{
msg.Printf( _( "Cannot find footprint library file '%s' in any of the "
"KiCad legacy library search paths.\n" ),
GetChars( fn.GetFullPath() ) );
aReporter->Report( msg );
}
retv = false;
continue;
}
module = pi->FootprintLoad( libPath, component->GetFPID().GetFootprintName() );
if( module )
{
lastFPID = component->GetFPID();
break;
}
}
}
if( !module )
{
if( aReporter )
{
msg.Printf( _( "Component `%s` footprint '%s' was not found in any legacy "
"library.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().Format() ) );
aReporter->Report( msg );
}
// Clear the footprint assignment since the old library lookup method is no
// longer valid.
FPID emptyFPID;
component->SetFPID( emptyFPID );
retv = false;
continue;
}
else
{
wxString libNickname;
FP_LIB_TABLE* cur = this;
do
{
cur->ensureIndex();
for( unsigned i = 0; i < cur->rows.size(); i++ )
{
wxString uri = cur->rows[i].GetFullURI( true );
if( wxFileName::GetPathSeparator() == wxChar( '\\' ) if( nickname.size() )
&& uri.Find( wxChar( '/' ) ) >= 0 )
{ {
uri.Replace( wxT( "/"), wxT( "\\" ) ); return FootprintLoad( nickname, fpname );
}
#ifdef __WINDOWS__
if( uri.CmpNoCase( libPath ) )
#else
if( uri == libPath )
#endif
{
libNickname = cur->rows[i].GetNickName();
break;
}
}
} while( ( cur = cur->fallBack ) != 0 && libNickname.IsEmpty() );
if( libNickname.IsEmpty() )
{
if( aReporter )
{
msg.Printf( _( "Component '%s' footprint '%s' legacy library path '%s' "
"was not found in the footprint library table.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().Format() ) );
aReporter->Report( msg );
} }
retv = false; // nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
}
else else
{ {
FPID newFPID = lastFPID; std::vector<wxString> nicks = GetLogicalLibs();
newFPID.SetLibNickname( libNickname );
if( !newFPID.IsValid() ) // Search each library going through libraries alphabetically.
{ for( unsigned i = 0; i<nicks.size(); ++i )
if( aReporter )
{ {
msg.Printf( _( "Component '%s' FPID '%s' is not valid.\n" ), // FootprintLoad() returns NULL on not found, does not throw exception
GetChars( component->GetReference() ), // unless there's an IO_ERROR.
GetChars( newFPID.Format() ) ); MODULE* ret = FootprintLoad( nicks[i], fpname );
aReporter->Report( msg ); if( ret )
return ret;
} }
retv = false; return NULL;
}
else
{
// The footprint name should already be set.
component->SetFPID( newFPID );
}
}
}
} }
return retv;
} }
...@@ -840,16 +705,13 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS ...@@ -840,16 +705,13 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) ) if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
{ {
FP_LIB_TABLE emptyTable; FP_LIB_TABLE emptyTable;
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
emptyTable.Format( &sf, 0 ); emptyTable.Save( fn.GetFullPath() );
} }
} }
FILE_LINE_READER reader( fn.GetFullPath() ); aTable.Load( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
aTable.Parse( &lexer );
return tableExists; return tableExists;
} }
......
This diff is collapsed.
...@@ -55,10 +55,11 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId ) ...@@ -55,10 +55,11 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
// we must add <kicad path>/library and <kicad path>/library/doc // we must add <kicad path>/library and <kicad path>/library/doc
if( aId == KIWAY::FACE_SCH ) if( aId == KIWAY::FACE_SCH )
{ {
// Add schematic doc file path (library/doc) to search path list.
fn.AppendDir( wxT( "library" ) ); fn.AppendDir( wxT( "library" ) );
aDst->AddPaths( fn.GetPath() ); aDst->AddPaths( fn.GetPath() );
// Add schematic doc file path (library/doc)to search path list.
fn.AppendDir( wxT( "doc" ) ); fn.AppendDir( wxT( "doc" ) );
aDst->AddPaths( fn.GetPath() ); aDst->AddPaths( fn.GetPath() );
...@@ -85,8 +86,10 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId ) ...@@ -85,8 +86,10 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
aDst->AddPaths( fn.GetPath() ); aDst->AddPaths( fn.GetPath() );
} }
aDst->AddPaths( wxT( "/usr/local/share" ) );
#if 1 && defined(DEBUG) #if 1 && defined(DEBUG)
aDst->Show( "kiway" ); aDst->Show( "kiface" );
#endif #endif
} }
...@@ -121,86 +124,3 @@ void KIFACE_I::end_common() ...@@ -121,86 +124,3 @@ void KIFACE_I::end_common()
m_bm.End(); m_bm.End();
} }
wxString KIFACE_I::GetHelpFile()
{
wxString fn;
wxArrayString subdirs;
wxArrayString altsubdirs;
// FIXME: This is not the ideal way to handle this. Unfortunately, the
// CMake install paths seem to be a moving target so this crude
// hack solves the problem of install path differences between
// Windows and non-Windows platforms.
// Partially fixed, but must be enhanced
// Create subdir tree for "standard" linux distributions, when KiCad comes
// from a distribution files are in /usr/share/doc/kicad/help and binaries
// in /usr/bin or /usr/local/bin
subdirs.Add( wxT( "share" ) );
subdirs.Add( wxT( "doc" ) );
subdirs.Add( wxT( "kicad" ) );
subdirs.Add( wxT( "help" ) );
// Create subdir tree for linux and Windows KiCad pack.
// Note the pack form under linux is also useful if a user wants to
// install KiCad to a server because there is only one path to mount
// or export (something like /usr/local/kicad).
// files are in <install dir>/kicad/doc/help
// (often /usr/local/kicad/kicad/doc/help)
// <install dir>/kicad/ is retrieved from m_BinDir
altsubdirs.Add( wxT( "doc" ) );
altsubdirs.Add( wxT( "help" ) );
/* Search for a help file.
* we *must* find a help file.
* so help is searched in directories in this order:
* help/<canonical name> like help/en_GB
* help/<short name> like help/en
* help/en
*/
wxLocale* i18n = Pgm().GetLocale();
// Step 1 : Try to find help file in help/<canonical name>
subdirs.Add( i18n->GetCanonicalName() );
altsubdirs.Add( i18n->GetCanonicalName() );
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
if( !fn )
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
// Step 2 : if not found Try to find help file in help/<short name>
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
// wxLocale::GetName() does not return always the short name
subdirs.Add( i18n->GetName().BeforeLast( '_' ) );
altsubdirs.Add( i18n->GetName().BeforeLast( '_' ) );
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
if( !fn )
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
}
// Step 3 : if not found Try to find help file in help/en
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
subdirs.Add( wxT( "en" ) );
altsubdirs.Add( wxT( "en" ) );
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
if( !fn )
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
}
return fn;
}
...@@ -744,7 +744,7 @@ void WORKSHEET_LAYOUT::SetDefaultLayout() ...@@ -744,7 +744,7 @@ void WORKSHEET_LAYOUT::SetDefaultLayout()
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogMessage( ioe.errorText ); wxLogMessage( ioe.errorText );
} }
...@@ -765,7 +765,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append ) ...@@ -765,7 +765,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const char* aPageLayout, bool Append )
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogMessage( ioe.errorText ); wxLogMessage( ioe.errorText );
} }
...@@ -828,7 +828,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append ...@@ -828,7 +828,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
{ {
lp_parser.Parse( this ); lp_parser.Parse( this );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogMessage( ioe.errorText ); wxLogMessage( ioe.errorText );
} }
......
...@@ -297,6 +297,13 @@ void PGM_BASE::destroy() ...@@ -297,6 +297,13 @@ void PGM_BASE::destroy()
delete m_locale; delete m_locale;
m_locale = 0; m_locale = 0;
/*
// Close the help frame
if( m_html_ctrl && m_html_ctrl->GetFrame() ) // returns NULL if no help frame active
m_html_ctrl->GetFrame()->Close( true );
}
*/
delete m_html_ctrl; delete m_html_ctrl;
m_html_ctrl = 0; m_html_ctrl = 0;
} }
...@@ -415,30 +422,18 @@ bool PGM_BASE::initPgm() ...@@ -415,30 +422,18 @@ bool PGM_BASE::initPgm()
} }
void PGM_BASE::SetHtmlHelpController( wxHtmlHelpController* aController ) void PGM_BASE::initHtmlHelpController()
{
delete m_html_ctrl;
m_html_ctrl = aController;
}
void PGM_BASE::InitOnLineHelp()
{ {
wxString fullfilename = FindKicadHelpPath();
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = fullfilename + wxT( ".html" );
fullfilename += wxT( "kicad.hhp" );
if( wxFileExists( fullfilename ) ) if( !m_html_ctrl )
{ m_html_ctrl = new wxHtmlHelpController(
m_html_ctrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_PRINT | wxHF_OPEN_FILES wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ ); // | wxHF_SEARCH
m_html_ctrl->UseConfig( m_common_settings ); );
m_html_ctrl->SetTitleFormat( wxT( "KiCad Help" ) );
m_html_ctrl->AddBook( fullfilename ); wxASSERT( m_html_ctrl ); // may not leave here as NULL
}
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
m_html_ctrl = NULL; m_html_ctrl = NULL;
...@@ -449,10 +444,22 @@ void PGM_BASE::InitOnLineHelp() ...@@ -449,10 +444,22 @@ void PGM_BASE::InitOnLineHelp()
} }
wxHtmlHelpController* PGM_BASE::HtmlHelpController()
{
if( !m_html_ctrl )
initHtmlHelpController();
// there should not be calls to this unless ONLINE_HELP_FILES_FORMAT_IS_HTML is defined
wxASSERT( m_html_ctrl );
return m_html_ctrl;
}
bool PGM_BASE::setExecutablePath() bool PGM_BASE::setExecutablePath()
{ {
// Apple MacOSx #ifdef __APPLE__ // Apple MacOSx
#ifdef __APPLE__
// Derive path from location of the app bundle // Derive path from location of the app bundle
CFBundleRef mainBundle = CFBundleGetMainBundle(); CFBundleRef mainBundle = CFBundleGetMainBundle();
......
...@@ -23,18 +23,19 @@ ...@@ -23,18 +23,19 @@
*/ */
#include <wx/stdpaths.h>
#include <fctsys.h> #include <fctsys.h>
#include <macros.h> #include <macros.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project.h> #include <project.h>
#include <wx/stdpaths.h> #include <confirm.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <config_params.h> #include <config_params.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
PROJECT::PROJECT() PROJECT::PROJECT()
{ {
memset( m_elems, 0, sizeof(m_elems) ); memset( m_elems, 0, sizeof(m_elems) );
...@@ -198,18 +199,18 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString& ...@@ -198,18 +199,18 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString&
const wxString& aGroupName, bool aForceUseLocalConfig ) const wxString& aGroupName, bool aForceUseLocalConfig )
{ {
wxConfigBase* cfg = 0; wxConfigBase* cfg = 0;
wxFileName fn = aFileName;
wxFileName fn = aFileName;
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
wxString cur_pro_fn = fn.GetFullPath();
// is there an edge transition, a change in m_project_filename? // is there an edge transition, a change in m_project_filename?
if( m_project_name != fn ) if( m_project_name != cur_pro_fn )
{ {
m_sch_search.Clear(); m_sch_search.Clear();
SetProjectFullName( fn.GetFullPath() ); // to the empty lists, add project dir as first
// to the empty list, add project dir as first
m_sch_search.AddPaths( fn.GetPath() ); m_sch_search.AddPaths( fn.GetPath() );
// append all paths from aSList // append all paths from aSList
...@@ -228,8 +229,6 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString& ...@@ -228,8 +229,6 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString&
// Init local config filename // Init local config filename
if( aForceUseLocalConfig || fn.FileExists() ) if( aForceUseLocalConfig || fn.FileExists() )
{ {
wxString cur_pro_fn = fn.GetFullPath();
cfg = new wxFileConfig( wxEmptyString, wxEmptyString, cur_pro_fn, wxEmptyString ); cfg = new wxFileConfig( wxEmptyString, wxEmptyString, cur_pro_fn, wxEmptyString );
cfg->DontCreateOnDemand(); cfg->DontCreateOnDemand();
...@@ -262,31 +261,43 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString& ...@@ -262,31 +261,43 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString&
} }
else // Version incorrect else // Version incorrect
{ {
wxLogDebug( wxT( "Project file version is zero, not using this old project file, going with template." ) );
delete cfg; delete cfg;
cfg = 0; cfg = 0;
} }
} }
// Search for the template kicad.pro file by using caller's SEARCH_STACK. // No suitable pro file was found, either does not exist, or is too old.
// Use the template kicad.pro file. Find it by using caller's SEARCH_STACK.
wxString kicad_pro_template = aSList.FindValidPath( wxT( "kicad.pro" ) ); wxString kicad_pro_template = aSList.FindValidPath( wxT( "kicad.pro" ) );
if( !kicad_pro_template ) if( !kicad_pro_template )
{ {
wxLogDebug( wxT( "Template file <kicad.pro> not found." ) ); wxLogDebug( wxT( "Template file <kicad.pro> not found using search paths." ) );
fn = wxFileName( wxStandardPaths::Get().GetDocumentsDir(), wxFileName templ( wxStandardPaths::Get().GetDocumentsDir(),
wxT( "kicad" ), ProjectFileExtension ); wxT( "kicad" ), ProjectFileExtension );
}
else if( !templ.IsFileReadable() )
{ {
fn = kicad_pro_template; wxString msg = wxString::Format( _( "Unable to find kicad.pro template file." ) );
DisplayError( NULL, msg );
return NULL;
}
kicad_pro_template = templ.GetFullPath();
} }
cfg = new wxFileConfig( wxEmptyString, wxEmptyString, wxEmptyString, fn.GetFullPath() ); // copy the template to cur_pro_fn, and open it at that destination.
wxCopyFile( kicad_pro_template, cur_pro_fn );
cfg = new wxFileConfig( wxEmptyString, wxEmptyString, cur_pro_fn, wxEmptyString );
cfg->DontCreateOnDemand(); cfg->DontCreateOnDemand();
SetProjectFullName( fn.GetFullPath() ); SetProjectFullName( cur_pro_fn );
return cfg; return cfg;
} }
...@@ -296,6 +307,12 @@ void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aFileName ...@@ -296,6 +307,12 @@ void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aFileName
{ {
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, FORCE_LOCAL_CONFIG ) ); std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, FORCE_LOCAL_CONFIG ) );
if( !cfg.get() )
{
// could not find template
return;
}
cfg->SetPath( wxCONFIG_PATH_SEPARATOR ); cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
cfg->Write( wxT( "update" ), DateAndTime() ); cfg->Write( wxT( "update" ), DateAndTime() );
...@@ -326,6 +343,12 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName, ...@@ -326,6 +343,12 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName,
{ {
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, false ) ); std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, false ) );
if( !cfg.get() )
{
// could not find template
return false;
}
cfg->SetPath( wxCONFIG_PATH_SEPARATOR ); cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
wxString timestamp = cfg->Read( wxT( "update" ) ); wxString timestamp = cfg->Read( wxT( "update" ) );
......
...@@ -104,31 +104,6 @@ void SEARCH_STACK::AddPaths( const wxString& aPaths, int aIndex ) ...@@ -104,31 +104,6 @@ void SEARCH_STACK::AddPaths( const wxString& aPaths, int aIndex )
} }
wxString SEARCH_STACK::FindFileInSearchPaths(
const wxString& aFilename, const wxArrayString* aSubdirs )
{
wxPathList paths;
for( unsigned i = 0; i < GetCount(); ++i )
{
wxFileName fn( (*this)[i] );
if( aSubdirs )
{
for( unsigned j = 0; j < aSubdirs->GetCount(); j++ )
fn.AppendDir( (*aSubdirs)[j] );
}
if( fn.DirExists() )
{
paths.Add( fn.GetPath() );
}
}
return paths.FindValidPath( aFilename );
}
void RETAINED_PATH::Clear() void RETAINED_PATH::Clear()
{ {
m_retained_path.Clear(); m_retained_path.Clear();
......
#include <pgm_base.h>
#include <common.h>
/**
* Function FindFileInSearchPaths
* looks in "this" for \a aFilename, but first modifies every search
* path by appending a list of path fragments from aSubdirs. That modification
* is not rentative.
*/
wxString FindFileInSearchPaths( const SEARCH_STACK& aStack,
const wxString& aFilename, const wxArrayString* aSubdirs )
{
wxPathList paths;
for( unsigned i = 0; i < aStack.GetCount(); ++i )
{
wxFileName fn( aStack[i], wxEmptyString );
if( aSubdirs )
{
for( unsigned j = 0; j < aSubdirs->GetCount(); j++ )
fn.AppendDir( (*aSubdirs)[j] );
}
if( fn.DirExists() )
{
paths.Add( fn.GetPath() );
}
}
return paths.FindValidPath( aFilename );
}
// See also FindKicadHelpPath.cpp.notused.
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aBaseName )
{
wxArrayString subdirs;
wxArrayString altsubdirs;
SEARCH_STACK ss = aSStack;
// It might already be in aSStack, but why depend on other code
// far away when it's so easy to add it again (to our copy) as the first place to look.
// This is CMAKE_INSTALL_PREFIX:
ss.AddPaths( wxT( DEFAULT_INSTALL_PATH ), 0 );
// If there's a KICAD environment variable set, use that guy's path also
ss.AddPaths( Pgm().GetKicadEnvVariable(), 0 );
#if 1 // && defined(__linux__)
// Based on kicad-doc.bzr/CMakeLists.txt, line 20, the help files are
// installed into "<CMAKE_INSTALL_PREFIX>/share/doc/kicad/help" for linux.
// This is ${KICAD_HELP} var in that CMakeLists.txt file.
// Below we account for an international subdirectory.
subdirs.Add( wxT( "share" ) );
subdirs.Add( wxT( "doc" ) );
subdirs.Add( wxT( "kicad" ) );
subdirs.Add( wxT( "help" ) );
#endif
#if 1 // && defined(__WINDOWS__)
// Based on kicad-doc.bzr/CMakeLists.txt, line 35, the help files are
// installed into "<CMAKE_INSTALL_PREFIX>/doc/help" for Windows.
// This is ${KICAD_HELP} var in that CMakeLists.txt file.
// Below we account for an international subdirectory.
altsubdirs.Add( wxT( "doc" ) );
altsubdirs.Add( wxT( "help" ) );
#endif
/* Search for a help file.
* we *must* find a help file.
* so help is searched in directories in this order:
* help/<canonical name> like help/en_GB
* help/<short name> like help/en
* help/en
*/
wxLocale* i18n = Pgm().GetLocale();
// Step 1 : Try to find help file in help/<canonical name>
subdirs.Add( i18n->GetCanonicalName() );
altsubdirs.Add( i18n->GetCanonicalName() );
#if defined(DEBUG) && 0
ss.Show( __func__ );
printf( "%s: m_help_file:'%s'\n", __func__, TO_UTF8( aBaseName ) );
#endif
wxString fn = FindFileInSearchPaths( ss, aBaseName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( ss, aBaseName, &subdirs );
// Step 2 : if not found Try to find help file in help/<short name>
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
// wxLocale::GetName() does not return always the short name
subdirs.Add( i18n->GetName().BeforeLast( '_' ) );
altsubdirs.Add( i18n->GetName().BeforeLast( '_' ) );
fn = FindFileInSearchPaths( ss, aBaseName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( ss, aBaseName, &subdirs );
}
// Step 3 : if not found Try to find help file in help/en
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
subdirs.Add( wxT( "en" ) );
altsubdirs.Add( wxT( "en" ) );
fn = FindFileInSearchPaths( ss, aBaseName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( ss, aBaseName, &subdirs );
}
return fn;
}
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
*/ */
#include <typeinfo>
#include <macros.h> #include <macros.h>
#include <fctsys.h> #include <fctsys.h>
#include <wx/dynlib.h> #include <wx/dynlib.h>
...@@ -182,10 +183,6 @@ static const wxString dso_full_path( const wxString& aAbsoluteArgv0 ) ...@@ -182,10 +183,6 @@ static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
return fn.GetFullPath(); return fn.GetFullPath();
} }
// Use of this is arbitrary, remember single_top only knows about a single DSO.
// Could have used one from the KIWAY also.
static wxDynamicLibrary dso;
// Only a single KIWAY is supported in this single_top top level component, // Only a single KIWAY is supported in this single_top top level component,
// which is dedicated to loading only a single DSO. // which is dedicated to loading only a single DSO.
...@@ -230,6 +227,32 @@ struct APP_SINGLE_TOP : public wxApp ...@@ -230,6 +227,32 @@ struct APP_SINGLE_TOP : public wxApp
return wxApp::OnExit(); return wxApp::OnExit();
} }
int OnRun() // overload wxApp virtual
{
try
{
return wxApp::OnRun();
}
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );;
}
catch( const IO_ERROR& ioe )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid( ioe ).name() ) ),
GetChars( ioe.errorText ) );
}
catch(...)
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
}
return -1;
}
/** /**
* Function MacOpenFile * Function MacOpenFile
* is specific to MacOSX (not used under Linux or Windows). * is specific to MacOSX (not used under Linux or Windows).
...@@ -261,6 +284,15 @@ IMPLEMENT_APP( APP_SINGLE_TOP ); ...@@ -261,6 +284,15 @@ IMPLEMENT_APP( APP_SINGLE_TOP );
static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName ) static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
{ {
#if defined(BUILD_KIWAY_DLL) #if defined(BUILD_KIWAY_DLL)
// Remember single_top only knows about a single DSO. Using an automatic
// with a defeated destructor, see Detach() below, so that the DSO program
// image stays in RAM until process termination, and specifically
// beyond the point in time at which static destructors are run. Otherwise
// a static wxDynamicLibrary's destructor might create an out of sequence
// problem. This was never detected, so it's only a preventative strategy.
wxDynamicLibrary dso;
void* addr = NULL; void* addr = NULL;
if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) ) if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) )
...@@ -275,6 +307,9 @@ static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName ) ...@@ -275,6 +307,9 @@ static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
// No further reporting required here. // No further reporting required here.
} }
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
(void) dso.Detach();
return (KIFACE_GETTER_FUNC*) addr; return (KIFACE_GETTER_FUNC*) addr;
#else #else
......
...@@ -107,7 +107,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event ) ...@@ -107,7 +107,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
{ {
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension ); fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
} }
tmp = search.FindValidPath( fn ); tmp = search.FindValidPath( fn.GetFullPath() );
if( !tmp ) if( !tmp )
{ {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <kiface_i.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <id.h> #include <id.h>
#include <common.h> #include <common.h>
...@@ -42,29 +42,24 @@ ...@@ -42,29 +42,24 @@
#include <class_DisplayFootprintsFrame.h> #include <class_DisplayFootprintsFrame.h>
#define GROUP wxT("/cvpcb")
#define GROUPLIB wxT("/pcbnew/libraries")
#define GROUPEQU wxT("/cvpcb/libraries")
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters() PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
{ {
if( !m_projectFileParams.empty() ) if( !m_projectFileParams.empty() )
return m_projectFileParams; return m_projectFileParams;
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUPLIB, PARAM_COMMAND_ERASE ) ); m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
wxT( "LibName" ), &m_ModuleLibNames, GROUPLIB ) ); wxT( "LibName" ), &m_ModuleLibNames, GROUP_PCB_LIBS ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
wxT( "EquName" ), &m_AliasLibNames, GROUPEQU ) ); wxT( "EquName" ), &m_AliasLibNames, GROUP_CVP_EQU ) );
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
wxT( "NetIExt" ), &m_NetlistFileExtension ) ); wxT( "NetIExt" ), &m_NetlistFileExtension ) );
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( m_projectFileParams.push_back( new PARAM_CFG_FILENAME(
wxT( "LibDir" ), &m_UserLibraryPath, GROUPLIB ) ); wxT( "LibDir" ), &m_UserLibraryPath, GROUP_PCB_LIBS ) );
return m_projectFileParams; return m_projectFileParams;
} }
...@@ -81,7 +76,7 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName ) ...@@ -81,7 +76,7 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
// was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
prj.ConfigLoad( prj.PcbSearchS(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); prj.ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_CVP, GetProjectFileParameters(), false );
if( m_NetlistFileExtension.IsEmpty() ) if( m_NetlistFileExtension.IsEmpty() )
m_NetlistFileExtension = wxT( "net" ); m_NetlistFileExtension = wxT( "net" );
...@@ -133,7 +128,7 @@ void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent ) ...@@ -133,7 +128,7 @@ void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
// Pgm().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); // Pgm().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
PROJECT& prj = Prj(); PROJECT& prj = Prj();
SEARCH_STACK& search = prj.SchSearchS();
prj.ConfigSave( search, fn.GetFullPath(), GROUP, GetProjectFileParameters() ); prj.ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_CVP, GetProjectFileParameters() );
} }
...@@ -490,7 +490,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName ) ...@@ -490,7 +490,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
footprint = FootprintLibs()->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) ); footprint = FootprintLibs()->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return NULL; return NULL;
......
...@@ -301,13 +301,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -301,13 +301,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
} }
} }
// Close the help frame
if( Pgm().GetHtmlHelpController() )
{
if( Pgm().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
Pgm().GetHtmlHelpController()->GetFrame()->Close( true );
}
if( m_NetlistFileName.IsOk() ) if( m_NetlistFileName.IsOk() )
{ {
UpdateFileHistory( m_NetlistFileName.GetFullPath() ); UpdateFileHistory( m_NetlistFileName.GetFullPath() );
...@@ -846,7 +839,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist() ...@@ -846,7 +839,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
else else
wxMessageBox( _( "Unknown netlist format." ), wxEmptyString, wxOK | wxICON_ERROR ); wxMessageBox( _( "Unknown netlist format." ), wxEmptyString, wxOK | wxICON_ERROR );
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.errorText.GetData() ); msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.errorText.GetData() );
wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR ); wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
......
This diff is collapsed.
...@@ -136,7 +136,7 @@ bool LIB_ALIAS::SaveDoc( OUTPUTFORMATTER& aFormatter ) ...@@ -136,7 +136,7 @@ bool LIB_ALIAS::SaveDoc( OUTPUTFORMATTER& aFormatter )
aFormatter.Print( 0, "$ENDCMP\n" ); aFormatter.Print( 0, "$ENDCMP\n" );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
return false; return false;
} }
......
...@@ -731,7 +731,7 @@ bool CMP_LIBRARY::Save( OUTPUTFORMATTER& aFormatter ) ...@@ -731,7 +731,7 @@ bool CMP_LIBRARY::Save( OUTPUTFORMATTER& aFormatter )
aFormatter.Print( 0, "#\n#End Library\n" ); aFormatter.Print( 0, "#\n#End Library\n" );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
success = false; success = false;
} }
...@@ -756,7 +756,7 @@ bool CMP_LIBRARY::SaveDocs( OUTPUTFORMATTER& aFormatter ) ...@@ -756,7 +756,7 @@ bool CMP_LIBRARY::SaveDocs( OUTPUTFORMATTER& aFormatter )
aFormatter.Print( 0, "#\n#End Doc Library\n" ); aFormatter.Print( 0, "#\n#End Doc Library\n" );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
success = false; success = false;
} }
......
...@@ -249,7 +249,7 @@ void DIALOG_BOM::installPluginsList() ...@@ -249,7 +249,7 @@ void DIALOG_BOM::installPluginsList()
{ {
cfg_parser.Parse(); cfg_parser.Parse();
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
// wxLogMessage( ioe.errorText ); // wxLogMessage( ioe.errorText );
} }
......
...@@ -62,7 +62,7 @@ void SCH_EDIT_FRAME::LoadLibraries() ...@@ -62,7 +62,7 @@ void SCH_EDIT_FRAME::LoadLibraries()
if( !fn.FileExists() ) if( !fn.FileExists() )
{ {
tmp = lib_search.FindValidPath( fn ); tmp = lib_search.FindValidPath( fn.GetFullPath() );
if( !tmp ) if( !tmp )
{ {
......
...@@ -368,7 +368,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList() ...@@ -368,7 +368,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList()
&m_userLibraryPath ) ); &m_userLibraryPath ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&m_componentLibFiles, &m_componentLibFiles,
GROUPLIB ) ); GROUP_SCH_LIBS ) );
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
&m_netListFormat) ); &m_netListFormat) );
...@@ -408,7 +408,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere ...@@ -408,7 +408,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
// extension (.pro). // extension (.pro).
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
if( !prj.ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP, if( !prj.ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_SCH,
GetProjectFileParametersList(), !aForceReread ) ) GetProjectFileParametersList(), !aForceReread ) )
{ {
m_componentLibFiles = liblist_tmp; m_componentLibFiles = liblist_tmp;
...@@ -427,7 +427,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere ...@@ -427,7 +427,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
pglayout.SetPageLayout(BASE_SCREEN::m_PageLayoutDescrFileName); pglayout.SetPageLayout(BASE_SCREEN::m_PageLayoutDescrFileName);
// libraries in the *.pro file take precedence over standard library search paths, // libraries in the *.pro file take precedence over standard library search paths,
// but not over the director of the project, which is at index 0. // but not over the directory of the project, which is at index 0.
prj.SchSearchS().AddPaths( m_userLibraryPath, 1 ); prj.SchSearchS().AddPaths( m_userLibraryPath, 1 );
// If the list is empty, force loading the standard power symbol library. // If the list is empty, force loading the standard power symbol library.
...@@ -464,7 +464,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave ) ...@@ -464,7 +464,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
} }
prj.ConfigSave( Kiface().KifaceSearch(), prj.ConfigSave( Kiface().KifaceSearch(),
fn.GetFullPath(), GROUP, GetProjectFileParametersList() ); fn.GetFullPath(), GROUP_SCH, GetProjectFileParametersList() );
} }
...@@ -666,7 +666,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -666,7 +666,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
m_TemplateFieldNames.Parse( &lexer ); m_TemplateFieldNames.Parse( &lexer );
} }
catch( IO_ERROR& e ) catch( const IO_ERROR& e )
{ {
// @todo show error msg // @todo show error msg
DBG( printf( "templatefieldnames parsing error: '%s'\n", DBG( printf( "templatefieldnames parsing error: '%s'\n",
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
#include <config_params.h> #include <config_params.h>
#define GROUP wxT( "/eeschema" )
#define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" )
/* saving parameters option : */ /* saving parameters option : */
#define INSETUP true /* used when the parameter is saved in general config #define INSETUP true /* used when the parameter is saved in general config
......
...@@ -1049,7 +1049,7 @@ bool NETLIST_EXPORT_TOOL::WriteKiCadNetList( const wxString& aOutFileName ) ...@@ -1049,7 +1049,7 @@ bool NETLIST_EXPORT_TOOL::WriteKiCadNetList( const wxString& aOutFileName )
xroot->Format( &formatter, 0 ); xroot->Format( &formatter, 0 );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( NULL, ioe.errorText ); DisplayError( NULL, ioe.errorText );
return false; return false;
......
...@@ -868,7 +868,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event ) ...@@ -868,7 +868,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
// was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() ); // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParametersList() );
Prj().ConfigSave( Kiface().KifaceSearch(), Prj().ConfigSave( Kiface().KifaceSearch(),
fn.GetFullPath(), GROUP, GetProjectFileParametersList() ); fn.GetFullPath(), GROUP_SCH, GetProjectFileParametersList() );
} }
} }
......
...@@ -225,14 +225,14 @@ void LIB_EDIT_FRAME::SaveOneSymbol() ...@@ -225,14 +225,14 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
formatter.Print( 0, "ENDDRAW\n" ); formatter.Print( 0, "ENDDRAW\n" );
formatter.Print( 0, "ENDDEF\n" ); formatter.Print( 0, "ENDDEF\n" );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
msg.Printf( _( "An error occurred attempting to save symbol file '%s'" ), msg.Printf( _( "An error occurred attempting to save symbol file '%s'" ),
GetChars( fn.GetFullPath() ) ); GetChars( fn.GetFullPath() ) );
DisplayError( this, msg ); DisplayError( this, msg );
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return; return;
......
...@@ -59,6 +59,8 @@ struct BIN_MOD ...@@ -59,6 +59,8 @@ struct BIN_MOD
wxString m_help_file; wxString m_help_file;
SEARCH_STACK m_search; SEARCH_STACK m_search;
}; };
#endif // BIN_MOD_H_ #endif // BIN_MOD_H_
...@@ -589,4 +589,25 @@ wxString FormatDateLong( const wxDateTime &aDate ); ...@@ -589,4 +589,25 @@ wxString FormatDateLong( const wxDateTime &aDate );
*/ */
void SystemDirsAppend( SEARCH_STACK* aSearchStack ); void SystemDirsAppend( SEARCH_STACK* aSearchStack );
/**
* Function SearchHelpFileFullPath
* returns the help file's full path.
* <p>
* Return the KiCad help file with path.
* If the help file for the current locale is not found, an attempt to find
* the English version of the help file is made.
* Help file is searched in directories in this order:
* help/\<canonical name\> like help/en_GB
* help/\<short name\> like help/en
* help/en
* </p>
* @param aSearchStack contains some possible base dirs that may be above the
* the one actually holding @a aBaseName. These are starting points for nested searches.
* @param aBaseName is the name of the help file to search for.
* @return wxEmptyString is returned if aBaseName is not found, else the full path & filename.
*/
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName );
#endif // INCLUDE__COMMON_H_ #endif // INCLUDE__COMMON_H_
...@@ -37,6 +37,17 @@ ...@@ -37,6 +37,17 @@
#include <limits> #include <limits>
#define GROUP_PCB wxT( "/pcbnew" )
#define GROUP_SCH wxT( "/eeschema" )
#define GROUP_PCB_LIBS wxT( "/pcbnew/libraries" )
#define GROUP_SCH_LIBS wxT( "/eeschema/libraries" )
#define GROUP_COMMON wxT( "/common" )
#define GROUP_CVP wxT("/cvpcb")
//#define GROUP_CVP_LIBS wxT("/pcbnew/libraries")
#define GROUP_CVP_EQU wxT("/cvpcb/libraries")
#define CONFIG_VERSION 1 #define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG true #define FORCE_LOCAL_CONFIG true
......
...@@ -38,6 +38,7 @@ class wxFileName; ...@@ -38,6 +38,7 @@ class wxFileName;
class OUTPUTFORMATTER; class OUTPUTFORMATTER;
class MODULE; class MODULE;
class FP_LIB_TABLE_LEXER; class FP_LIB_TABLE_LEXER;
class FPID;
class NETLIST; class NETLIST;
class REPORTER; class REPORTER;
class SEARCH_STACK; class SEARCH_STACK;
...@@ -455,6 +456,21 @@ public: ...@@ -455,6 +456,21 @@ public:
//-----</PLUGIN API SUBSET, REBASED ON aNickname>--------------------------- //-----</PLUGIN API SUBSET, REBASED ON aNickname>---------------------------
/**
* Function FootprintLoadWithOptionalNickname
* loads a footprint having @a aFootprintId with possibly an empty nickname.
*
* @param aFootprintId the [nickname] & fooprint name of the footprint to load.
*
* @return MODULE* - if found caller owns it, else NULL if not found.
*
* @throw IO_ERROR if the library cannot be found or read. No exception
* is thrown in the case where aFootprintName cannot be found.
* @throw PARSE_ERROR if @a aFootprintId is not parsed OK.
*/
MODULE* FootprintLoadWithOptionalNickname( const FPID& aFootprintId )
throw( IO_ERROR, PARSE_ERROR );
/** /**
* Function GetDescription * Function GetDescription
* returns the library desicription from @a aNickname, or an empty string * returns the library desicription from @a aNickname, or an empty string
...@@ -499,19 +515,6 @@ public: ...@@ -499,19 +515,6 @@ public:
*/ */
bool IsEmpty( bool aIncludeFallback = true ); bool IsEmpty( bool aIncludeFallback = true );
/**
* Function ConvertFromLegacy
* converts the footprint names in \a aNetList from the legacy format to the #FPID format.
*
* @param aNetList is the #NETLIST object to convert.
* @param aLibNames is the list of legacy footprint library names from the currently loaded
* project.
* @param aReporter is the #REPORTER object to dump messages into.
* @return true if all footprint names were successfully converted to a valid FPID.
*/
bool ConvertFromLegacy( SEARCH_STACK& aSStack, NETLIST& aNetList,
const wxArrayString& aLibNames, REPORTER* aReporter = NULL ) throw( IO_ERROR );
/** /**
* Function ExpandSubstitutions * Function ExpandSubstitutions
* replaces any environment variable references with their values and is * replaces any environment variable references with their values and is
......
...@@ -153,7 +153,6 @@ public: ...@@ -153,7 +153,6 @@ public:
*/ */
bool IsValid() const { return !nickname.empty() && !footprint.empty(); } bool IsValid() const { return !nickname.empty() && !footprint.empty(); }
/** /**
* Function IsLegacy * Function IsLegacy
* @return true if the #FPID only has the #footprint name defined. * @return true if the #FPID only has the #footprint name defined.
......
...@@ -89,28 +89,6 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, ...@@ -89,28 +89,6 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
*/ */
void AddDelimiterString( wxString& string ); void AddDelimiterString( wxString& string );
/**
* Function FindKicadHelpPath
* finds the absolute path for KiCad "help" (or "help/&ltlanguage&gt")
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
* from BinDir
* else from environment variable KICAD
* else from one of s_HelpPathList
* typically c:/kicad/doc/help or /usr/share/kicad/help
* or /usr/local/share/kicad/help
* (must have kicad in path name)
*
* xx = iso639-1 language id (2 letters (generic) or 4 letters):
* fr = french (or fr_FR)
* en = English (or en_GB or en_US ...)
* de = deutch
* es = spanish
* pt = portuguese (or pt_BR ...)
*
* default = en (if not found = fr)
*/
wxString FindKicadHelpPath();
/** /**
* Function KicadDatasPath * Function KicadDatasPath
* returns the data path common to KiCad. * returns the data path common to KiCad.
......
...@@ -100,27 +100,11 @@ public: ...@@ -100,27 +100,11 @@ public:
wxConfigBase* KifaceSettings() const { return m_bm.m_config; } wxConfigBase* KifaceSettings() const { return m_bm.m_config; }
const wxString& GetHelpFileName() const { return m_bm.m_help_file; }
void SetHelpFileName( const wxString& aFileName ) { m_bm.m_help_file = aFileName; }
/** /**
* Function GetHelpFile * Function GetHelpFileName
* gets the help file path. * returns just the basename portion of the current help file.
* <p>
* Return the KiCad help file with path. The base paths defined in
* m_searchPaths are tested for a valid file. The path returned can
* be relative depending on the paths added to m_searchPaths. See the
* documentation for wxPathList for more information. If the help file
* for the current locale is not found, an attempt to find the English
* version of the help file is made.
* wxEmptyString is returned if help file not found.
* Help file is searched in directories in this order:
* help/\<canonical name\> like help/en_GB
* help/\<short name\> like help/en
* help/en
* </p>
*/ */
wxString GetHelpFile(); const wxString& GetHelpFileName() const { return m_bm.m_help_file; }
wxFileHistory& GetFileHistory() { return m_bm.m_history; } wxFileHistory& GetFileHistory() { return m_bm.m_history; }
......
...@@ -86,9 +86,7 @@ public: ...@@ -86,9 +86,7 @@ public:
//----<Cross Module API>----------------------------------------------------- //----<Cross Module API>-----------------------------------------------------
VTBL_ENTRY wxHtmlHelpController* GetHtmlHelpController() { return m_html_ctrl; } VTBL_ENTRY wxHtmlHelpController* HtmlHelpController();
VTBL_ENTRY void SetHtmlHelpController( wxHtmlHelpController* aController );
VTBL_ENTRY wxConfigBase* CommonSettings() const { return m_common_settings; } VTBL_ENTRY wxConfigBase* CommonSettings() const { return m_common_settings; }
...@@ -161,12 +159,6 @@ public: ...@@ -161,12 +159,6 @@ public:
VTBL_ENTRY void SetLanguagePath(); VTBL_ENTRY void SetLanguagePath();
/**
* Function InitOnLineHelp
* initializes KiCad's online help.
*/
VTBL_ENTRY void InitOnLineHelp();
/** /**
* Function ReadPdfBrowserInfos * Function ReadPdfBrowserInfos
* reads the PDF browser choice from the common configuration. * reads the PDF browser choice from the common configuration.
...@@ -217,6 +209,8 @@ protected: ...@@ -217,6 +209,8 @@ protected:
*/ */
bool initPgm(); bool initPgm();
void initHtmlHelpController();
/** /**
* Function loadCommonSettings * Function loadCommonSettings
* loads the program (process) settings subset which are stored in .kicad_common * loads the program (process) settings subset which are stored in .kicad_common
......
...@@ -131,15 +131,6 @@ public: ...@@ -131,15 +131,6 @@ public:
/// Accessor for Eeschema search stack. /// Accessor for Eeschema search stack.
VTBL_ENTRY SEARCH_STACK& SchSearchS() { return m_sch_search; } VTBL_ENTRY SEARCH_STACK& SchSearchS() { return m_sch_search; }
/**
* Function PcbSearchS
* returns the obsolete footprint library search stack.
* Projects created before the FP_LIB_TABLE support will have footprint
* search paths in the *.pro files. Projects created after the FP_LIB_TABLE
* support will not. This stack is used for conversion from old to new only.
*/
VTBL_ENTRY SEARCH_STACK& PcbSearchS() { return m_pcb_search; }
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; }
......
...@@ -78,7 +78,7 @@ typedef const PTREE CPTREE; ...@@ -78,7 +78,7 @@ typedef const PTREE CPTREE;
* PTREE doc; * PTREE doc;
* Scan( &doc, &lexer ); * Scan( &doc, &lexer );
* } * }
* catch( IO_ERROR ioe ) * catch( const IO_ERROR& ioe )
* { * {
* fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) ); * fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) );
* } * }
......
...@@ -39,21 +39,6 @@ public: ...@@ -39,21 +39,6 @@ public:
return wxPathList::FindValidPath( aFileName ); return wxPathList::FindValidPath( aFileName );
} }
/**
* Function FindValidPath
* KiCad saves user defined library files that are not in the standard
* library search path list with the full file path. Calling the library
* search path list with a user library file will fail. This helper method
* solves that problem.
* @param fileName
* @return a wxEmptyString if library file is not found.
*/
wxString FindValidPath( const wxFileName& aFileName ) const
{
// call wxPathList::FindValidPath( const wxString& );
return wxPathList::FindValidPath( aFileName.GetFullPath() );
}
/** /**
* Function AddPaths * Function AddPaths
* insert or append path(s) * insert or append path(s)
...@@ -72,15 +57,6 @@ public: ...@@ -72,15 +57,6 @@ public:
* ";" on windows, or ":" | ";" on unix. * ";" on windows, or ":" | ";" on unix.
*/ */
void RemovePaths( const wxString& aPaths ); void RemovePaths( const wxString& aPaths );
/**
* Function FindFileInSearchPaths
* looks in "this" for \a aFilename, but first modifies every search
* path by appending a list of path fragments from aSubdirs. That modification
* is not rentative.
*/
wxString FindFileInSearchPaths( const wxString& aFilename,
const wxArrayString* aSubdirs = NULL );
}; };
......
...@@ -186,6 +186,15 @@ protected: ...@@ -186,6 +186,15 @@ protected:
*/ */
virtual wxConfigBase* config(); virtual wxConfigBase* config();
/**
* Function sys_search
* returns a SEARCH_STACK pertaining to entire program, and is overloaded in
* KICAD_MANAGER_FRAME
*/
virtual const SEARCH_STACK& sys_search();
virtual wxString help_name();
public: public:
EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType, EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
......
...@@ -123,6 +123,11 @@ class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME ...@@ -123,6 +123,11 @@ class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME
protected: protected:
wxConfigBase* config(); // override EDA_BASE_FRAME virtual wxConfigBase* config(); // override EDA_BASE_FRAME virtual
const SEARCH_STACK& sys_search(); // override EDA_BASE_FRAME virtual
wxString help_name(); // override EDA_BASE_FRAME virtual
public: public:
TREE_PROJECT_FRAME* m_LeftWin; TREE_PROJECT_FRAME* m_LeftWin;
LAUNCHER_PANEL* m_Launcher; LAUNCHER_PANEL* m_Launcher;
......
...@@ -123,6 +123,18 @@ wxConfigBase* KICAD_MANAGER_FRAME::config() ...@@ -123,6 +123,18 @@ wxConfigBase* KICAD_MANAGER_FRAME::config()
} }
const SEARCH_STACK& KICAD_MANAGER_FRAME::sys_search()
{
return Pgm().SysSearch();
}
wxString KICAD_MANAGER_FRAME::help_name()
{
return Pgm().GetHelpFileName();
}
void KICAD_MANAGER_FRAME::PrintMsg( const wxString& aText ) void KICAD_MANAGER_FRAME::PrintMsg( const wxString& aText )
{ {
m_MessagesBox->AppendText( aText ); m_MessagesBox->AppendText( aText );
...@@ -157,15 +169,6 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -157,15 +169,6 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
Event.SetCanVeto( true ); Event.SetCanVeto( true );
// Close the help frame
if( Pgm().GetHtmlHelpController() )
{
if( Pgm().GetHtmlHelpController()->GetFrame() ) // returns NULL if no help frame active
Pgm().GetHtmlHelpController()->GetFrame()->Close( true );
Pgm().SetHtmlHelpController( NULL );
}
m_LeftWin->Show( false ); m_LeftWin->Show( false );
Destroy(); Destroy();
......
...@@ -58,6 +58,8 @@ public: ...@@ -58,6 +58,8 @@ public:
SEARCH_STACK& SysSearch() { return m_bm.m_search; } SEARCH_STACK& SysSearch() { return m_bm.m_search; }
wxString GetHelpFileName() { return m_bm.m_help_file; }
protected: protected:
// The PGM_* classes can have difficulties at termination if they // The PGM_* classes can have difficulties at termination if they
......
...@@ -94,10 +94,10 @@ static const wxChar* s_allowedExtensionsToList[] = ...@@ -94,10 +94,10 @@ static const wxChar* s_allowedExtensionsToList[] =
*/ */
/* File extension definitions. */ /* File extension definitions. */
const wxString TextFileExtension( wxT( "txt" ) ); const wxChar TextFileExtension[] = wxT( "txt" );
/* File wildcard definitions. */ /* File wildcard definitions. */
const wxString TextFileWildcard( wxT( "Text files (*.txt)|*.txt" ) ); const wxChar TextFileWildcard[] = wxT( "Text files (*.txt)|*.txt" );
/** /**
...@@ -177,7 +177,6 @@ void TREE_PROJECT_FRAME::RemoveFilter( const wxString& filter ) ...@@ -177,7 +177,6 @@ void TREE_PROJECT_FRAME::RemoveFilter( const wxString& filter )
} }
/** /**
* Called by the popup menu in the tree frame * Called by the popup menu in the tree frame
* Creates a new subdirectory inside the current kicad project directory * Creates a new subdirectory inside the current kicad project directory
......
...@@ -716,7 +716,7 @@ void DIR_LIB_SOURCE::Test( int argc, char** argv ) ...@@ -716,7 +716,7 @@ void DIR_LIB_SOURCE::Test( int argc, char** argv )
printf( "std::exception\n" ); printf( "std::exception\n" );
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
printf( "exception: %s\n", (const char*) ioe.errorText.ToUTF8() ) ); printf( "exception: %s\n", (const char*) ioe.errorText.ToUTF8() ) );
} }
......
...@@ -118,7 +118,7 @@ int main( int argc, char** argv ) ...@@ -118,7 +118,7 @@ int main( int argc, char** argv )
printf( "%*s^\n", ioe.byteIndex>=1 ? ioe.byteIndex-1 : 0, "" ); printf( "%*s^\n", ioe.byteIndex>=1 ? ioe.byteIndex-1 : 0, "" );
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
printf( "%s\n", (const char*) ioe.errorText.ToUTF8() ); printf( "%s\n", (const char*) ioe.errorText.ToUTF8() );
} }
......
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
m_fileout = new FILE_OUTPUTFORMATTER( aFilename ); m_fileout = new FILE_OUTPUTFORMATTER( aFilename );
m_out = m_fileout; m_out = m_fileout;
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) ); wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) );
} }
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
m_writer = new STRING_FORMATTER(); m_writer = new STRING_FORMATTER();
m_out = m_writer; m_out = m_writer;
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) ); wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) );
} }
......
...@@ -66,13 +66,16 @@ bool PCB_CALCULATOR_FRAME::ReadDataFile() ...@@ -66,13 +66,16 @@ bool PCB_CALCULATOR_FRAME::ReadDataFile()
{ {
datafile_parser.Parse( datafile ); datafile_parser.Parse( datafile );
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
delete datafile; delete datafile;
ioe.errorText += '\n';
ioe.errorText += _("Data file error.");
wxMessageBox( ioe.errorText ); wxString msg = ioe.errorText;
msg += wxChar('\n');
msg += _("Data file error.");
wxMessageBox( msg );
return false; return false;
} }
...@@ -99,7 +102,7 @@ bool PCB_CALCULATOR_FRAME::WriteDataFile() ...@@ -99,7 +102,7 @@ bool PCB_CALCULATOR_FRAME::WriteDataFile()
while( nestlevel-- ) while( nestlevel-- )
formatter.Print( nestlevel, ")\n" ); formatter.Print( nestlevel, ")\n" );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
return false; return false;
} }
......
...@@ -350,9 +350,6 @@ if( KICAD_SCRIPTING ) ...@@ -350,9 +350,6 @@ if( KICAD_SCRIPTING )
endif() endif()
###
# _pcbnew DLL/DSO file creation
###
if( BUILD_GITHUB_PLUGIN ) if( BUILD_GITHUB_PLUGIN )
set( GITHUB_PLUGIN_LIBRARIES github_plugin ) set( GITHUB_PLUGIN_LIBRARIES github_plugin )
...@@ -401,9 +398,14 @@ if( KICAD_SCRIPTING_MODULES ) ...@@ -401,9 +398,14 @@ if( KICAD_SCRIPTING_MODULES )
if( MAKE_LINK_MAPS ) if( MAKE_LINK_MAPS )
set_target_properties( _pcbnew PROPERTIES set_target_properties( _pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.so.map" ) LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.so.map"
)
endif() endif()
if( ${OPENMP_FOUND} )
set_property( TARGET _pcbnew APPEND_STRING
PROPERTY LINK_FLAGS " ${OpenMP_CXX_FLAGS}" )
endif()
endif() endif()
...@@ -429,7 +431,6 @@ if( DOXYGEN_FOUND ) ...@@ -429,7 +431,6 @@ if( DOXYGEN_FOUND )
COMMAND ${CMAKE_COMMAND} -E remove_directory docstrings COMMAND ${CMAKE_COMMAND} -E remove_directory docstrings
COMMAND ${CMAKE_COMMAND} -E make_directory docstrings COMMAND ${CMAKE_COMMAND} -E make_directory docstrings
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/extract_docstrings.py pcbnew.py doxygen-xml/xml docstrings COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/extract_docstrings.py pcbnew.py doxygen-xml/xml docstrings
COMMAND ${CMAKE_COMMAND} -E remove pcbnew.py # force removal so it will be recreated later with the new docstrings COMMAND ${CMAKE_COMMAND} -E remove pcbnew.py # force removal so it will be recreated later with the new docstrings
COMMENT "building docstring files" COMMENT "building docstring files"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
...@@ -445,7 +446,6 @@ if( DOXYGEN_FOUND ) ...@@ -445,7 +446,6 @@ if( DOXYGEN_FOUND )
DEPENDS Doxyfile_python DEPENDS Doxyfile_python
DEPENDS xml-to-docstrings DEPENDS xml-to-docstrings
DEPENDS pcbnew.py DEPENDS pcbnew.py
COMMENT "building doxygen docs into directory doxygen-python/html" COMMENT "building doxygen docs into directory doxygen-python/html"
) )
endif() endif()
...@@ -454,7 +454,6 @@ else() ...@@ -454,7 +454,6 @@ else()
endif() endif()
if( MINGW ) if( MINGW )
# PCBNEW_RESOURCES variable is set by the macro. # PCBNEW_RESOURCES variable is set by the macro.
mingw_resource_compiler( pcbnew ) mingw_resource_compiler( pcbnew )
...@@ -485,8 +484,7 @@ add_custom_command( ...@@ -485,8 +484,7 @@ add_custom_command(
from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html" from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help.html"
) )
set_source_files_properties( dialogs/dialog_freeroute_exchange.cpp set_source_files_properties( dialogs/dialog_freeroute_exchange.cpp PROPERTIES
PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h
) )
...@@ -511,14 +509,14 @@ endif() ...@@ -511,14 +509,14 @@ endif()
if( USE_KIWAY_DLLS ) if( USE_KIWAY_DLLS )
#if( false )
# a very small program launcher for pcbnew_kiface # a very small program launcher for pcbnew_kiface
add_executable( pcbnew WIN32 MACOSX_BUNDLE add_executable( pcbnew WIN32 MACOSX_BUNDLE
../common/single_top.cpp ../common/single_top.cpp
../common/pgm_base.cpp
${PCBNEW_RESOURCES} ${PCBNEW_RESOURCES}
) )
set_source_files_properties( ../common/single_top.cpp PROPERTIES set_source_files_properties( ../common/single_top.cpp pcbnew.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL" COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL"
) )
target_link_libraries( pcbnew target_link_libraries( pcbnew
...@@ -539,9 +537,7 @@ if( USE_KIWAY_DLLS ) ...@@ -539,9 +537,7 @@ if( USE_KIWAY_DLLS )
${PCBNEW_SRCS} ${PCBNEW_SRCS}
${PCBNEW_COMMON_SRCS} ${PCBNEW_COMMON_SRCS}
${PCBNEW_SCRIPTING_SRCS} ${PCBNEW_SCRIPTING_SRCS}
# ${PCBNEW_RESOURCES}
) )
set_target_properties( pcbnew_kiface PROPERTIES set_target_properties( pcbnew_kiface PROPERTIES
# Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
# _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface # _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface
...@@ -583,7 +579,11 @@ if( USE_KIWAY_DLLS ) ...@@ -583,7 +579,11 @@ if( USE_KIWAY_DLLS )
) )
if( MAKE_LINK_MAPS ) if( MAKE_LINK_MAPS )
set_target_properties( pcbnew_kiface PROPERTIES set_target_properties( pcbnew_kiface PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_pcbnew.kiface.map" ) LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=_pcbnew.kiface.map"
)
set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.map"
)
endif() endif()
# if building pcbnew, then also build pcbnew_kiface if out of date. # if building pcbnew, then also build pcbnew_kiface if out of date.
...@@ -611,12 +611,16 @@ if( USE_KIWAY_DLLS ) ...@@ -611,12 +611,16 @@ if( USE_KIWAY_DLLS )
else() # milestone A) kills this off: else() # milestone A) kills this off:
add_executable( pcbnew WIN32 MACOSX_BUNDLE add_executable( pcbnew WIN32 MACOSX_BUNDLE
../common/single_top.cpp
pcbnew.cpp pcbnew.cpp
${PCBNEW_SRCS} ${PCBNEW_SRCS}
${PCBNEW_COMMON_SRCS} ${PCBNEW_COMMON_SRCS}
${PCBNEW_SCRIPTING_SRCS} ${PCBNEW_SCRIPTING_SRCS}
${PCBNEW_RESOURCES} ${PCBNEW_RESOURCES}
) )
set_source_files_properties( ../common/single_top.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=PCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"kicad_pcb\""
)
target_link_libraries( pcbnew target_link_libraries( pcbnew
3d-viewer 3d-viewer
pcbcommon pcbcommon
...@@ -651,28 +655,25 @@ else() # milestone A) kills this off: ...@@ -651,28 +655,25 @@ else() # milestone A) kills this off:
) )
endif() endif()
if( MAKE_LINK_MAPS )
# generate a link map with cross reference
set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.map"
)
endif()
install( TARGETS pcbnew install( TARGETS pcbnew
DESTINATION ${KICAD_BIN} DESTINATION ${KICAD_BIN}
COMPONENT binary COMPONENT binary
) )
endif() endif()
add_dependencies( pcbnew lib-dependencies ) add_dependencies( pcbnew lib-dependencies )
###
# Set properties for APPLE on pcbnew target
###
if( APPLE ) if( APPLE )
set_target_properties( pcbnew PROPERTIES set_target_properties( pcbnew PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
endif() )
if( MAKE_LINK_MAPS )
# generate a link map with cross reference
set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=pcbnew.map" )
endif() endif()
...@@ -755,14 +756,15 @@ if( KICAD_SCRIPTING_MODULES ) ...@@ -755,14 +756,15 @@ if( KICAD_SCRIPTING_MODULES )
endif() endif()
# This one gets made only when testing. if( false ) # haven't been used in years.
add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp ) # This one gets made only when testing.
target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} ) add_executable( specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp )
target_link_libraries( specctra_test common ${wxWidgets_LIBRARIES} )
# This one gets made only when testing. # This one gets made only when testing.
add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL add_executable( layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_widget.cpp layer_widget.cpp
) )
target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} ) target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} )
endif()
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
// This will get mapped to "kicad_default" in the specctra_export. // This will get mapped to "kicad_default" in the specctra_export.
const wxString NETCLASS::Default = wxT("Default"); const wxChar NETCLASS::Default[] = wxT( "Default" );
// Initial values for netclass initialization // Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance
......
...@@ -80,7 +80,7 @@ protected: ...@@ -80,7 +80,7 @@ protected:
public: public:
static const wxString Default; ///< the name of the default NETCLASS static const wxChar Default[]; ///< the name of the default NETCLASS
/** /**
* Constructor * Constructor
......
...@@ -41,37 +41,20 @@ ...@@ -41,37 +41,20 @@
#include <ratsnest_data.h> #include <ratsnest_data.h>
// Helper class used to clean tracks and vias // Helper class used to clean tracks and vias
class TRACKS_CLEANER : CONNECTIONS class TRACKS_CLEANER: CONNECTIONS
{ {
private: private:
BOARD* m_Brd; BOARD * m_Brd;
bool m_deleteUnconnectedTracks;
bool m_mergeSegments;
bool m_cleanVias;
public: public:
TRACKS_CLEANER( BOARD* aPcb ); TRACKS_CLEANER( BOARD * aPcb );
/** /**
* the cleanup function. * the cleanup function.
* return true if some item was modified * return true if some item was modified
*/ */
bool CleanupBoard(); bool CleanupBoard(PCB_EDIT_FRAME *aFrame, bool aCleanVias,
bool aMergeSegments, bool aDeleteUnconnected);
void SetdeleteUnconnectedTracksOpt( bool aDelete )
{
m_deleteUnconnectedTracks = aDelete;
}
void SetMergeSegmentsOpt( bool aMerge )
{
m_mergeSegments = aMerge;
}
void SetCleanViasOpt( bool aClean )
{
m_cleanVias = aClean;
}
private: private:
...@@ -103,7 +86,8 @@ private: ...@@ -103,7 +86,8 @@ private:
* merge aTrackRef and aCandidate, when possible, * merge aTrackRef and aCandidate, when possible,
* i.e. when they are colinear, same width, and obviously same layer * i.e. when they are colinear, same width, and obviously same layer
*/ */
TRACK* mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK* aCandidate, int aEndType ); TRACK* mergeCollinearSegmentIfPossible( TRACK* aTrackRef,
TRACK* aCandidate, int aEndType );
}; };
/* Install the cleanup dialog frame to know what should be cleaned /* Install the cleanup dialog frame to know what should be cleaned
...@@ -117,19 +101,9 @@ void PCB_EDIT_FRAME::Clean_Pcb() ...@@ -117,19 +101,9 @@ void PCB_EDIT_FRAME::Clean_Pcb()
wxBusyCursor( dummy ); wxBusyCursor( dummy );
TRACKS_CLEANER cleaner( GetBoard() ); TRACKS_CLEANER cleaner( GetBoard() );
cleaner.SetdeleteUnconnectedTracksOpt( dlg.m_deleteUnconnectedSegm );
cleaner.SetMergeSegmentsOpt( dlg.m_mergeSegments );
cleaner.SetCleanViasOpt( dlg.m_cleanVias );
if( cleaner.CleanupBoard() )
{
// Clear undo and redo lists to avoid inconsistencies between lists
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
Compile_Ratsnest( NULL, true );
OnModify();
}
cleaner.CleanupBoard( this, dlg.m_cleanVias, dlg.m_mergeSegments,
dlg.m_deleteUnconnectedSegm );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
} }
...@@ -142,30 +116,38 @@ void PCB_EDIT_FRAME::Clean_Pcb() ...@@ -142,30 +116,38 @@ void PCB_EDIT_FRAME::Clean_Pcb()
* Create segments when track ends are incorrectly connected: * Create segments when track ends are incorrectly connected:
* i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center * i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
*/ */
bool TRACKS_CLEANER::CleanupBoard() bool TRACKS_CLEANER::CleanupBoard( PCB_EDIT_FRAME *aFrame,
bool aCleanVias,
bool aMergeSegments,
bool aDeleteUnconnected )
{ {
bool modified = false; bool modified = false;
// delete redundant vias // delete redundant vias
if( m_cleanVias && clean_vias() ) modified |= (aCleanVias && clean_vias());
modified = true;
// Remove null segments and intermediate points on aligned segments // Remove null segments and intermediate points on aligned segments
if( m_mergeSegments && clean_segments() ) modified |= (aMergeSegments && clean_segments());
modified = true;
// Delete dangling tracks // Delete dangling tracks
if( m_deleteUnconnectedTracks && deleteUnconnectedTracks() ) modified |= (aDeleteUnconnected && deleteUnconnectedTracks());
modified = true;
if( modified )
{
// Clear undo and redo lists to avoid inconsistencies between lists
// XXX This is very involved... maybe a member in PCB_EDIT_FRAME
// would be better?
aFrame->GetScreen()->ClearUndoRedoList();
aFrame->SetCurItem( NULL );
aFrame->Compile_Ratsnest( NULL, true );
aFrame->OnModify();
}
return modified; return modified;
} }
TRACKS_CLEANER::TRACKS_CLEANER( BOARD* aPcb ) : CONNECTIONS( aPcb ) TRACKS_CLEANER::TRACKS_CLEANER( BOARD * aPcb ): CONNECTIONS( aPcb )
{ {
m_Brd = aPcb; m_Brd = aPcb;
m_deleteUnconnectedTracks = false;
m_mergeSegments = false;
// Build connections info // Build connections info
BuildPadsList(); BuildPadsList();
...@@ -177,22 +159,22 @@ void TRACKS_CLEANER::buildTrackConnectionInfo() ...@@ -177,22 +159,22 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
BuildTracksCandidatesList( m_Brd->m_Track, NULL); BuildTracksCandidatesList( m_Brd->m_Track, NULL);
// clear flags and variables used in cleanup // clear flags and variables used in cleanup
for( TRACK* track = m_Brd->m_Track; track; track = track->Next() ) for( TRACK * track = m_Brd->m_Track; track; track = track->Next() )
{ {
track->start = NULL; track->start = NULL;
track->end = NULL; track->end = NULL;
track->m_PadsConnected.clear(); track->m_PadsConnected.clear();
track->SetState( START_ON_PAD | END_ON_PAD | BUSY, false ); track->SetState( START_ON_PAD|END_ON_PAD|BUSY, false );
} }
// Build connections info tracks to pads // Build connections info tracks to pads
SearchTracksConnectedToPads(); SearchTracksConnectedToPads();
for( TRACK* track = m_Brd->m_Track; track; track = track->Next() ) for( TRACK * track = m_Brd->m_Track; track; track = track->Next() )
{ {
// Mark track if connected to pads // Mark track if connected to pads
for( unsigned jj = 0; jj < track->m_PadsConnected.size(); jj++ ) for( unsigned jj = 0; jj < track->m_PadsConnected.size(); jj++ )
{ {
D_PAD* pad = track->m_PadsConnected[jj]; D_PAD * pad = track->m_PadsConnected[jj];
if( pad->HitTest( track->GetStart() ) ) if( pad->HitTest( track->GetStart() ) )
{ {
...@@ -211,7 +193,6 @@ void TRACKS_CLEANER::buildTrackConnectionInfo() ...@@ -211,7 +193,6 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
bool TRACKS_CLEANER::clean_vias() bool TRACKS_CLEANER::clean_vias()
{ {
TRACK* next_track;
bool modified = false; bool modified = false;
for( TRACK* track = m_Brd->m_Track; track; track = track->Next() ) for( TRACK* track = m_Brd->m_Track; track; track = track->Next() )
...@@ -229,6 +210,7 @@ bool TRACKS_CLEANER::clean_vias() ...@@ -229,6 +210,7 @@ bool TRACKS_CLEANER::clean_vias()
// Search and delete others vias at same location // Search and delete others vias at same location
TRACK* alt_track = track->Next(); TRACK* alt_track = track->Next();
TRACK* next_track;
for( ; alt_track != NULL; alt_track = next_track ) for( ; alt_track != NULL; alt_track = next_track )
{ {
next_track = alt_track->Next(); next_track = alt_track->Next();
...@@ -249,6 +231,7 @@ bool TRACKS_CLEANER::clean_vias() ...@@ -249,6 +231,7 @@ bool TRACKS_CLEANER::clean_vias()
} }
// Delete Via on pads at same location // Delete Via on pads at same location
TRACK* next_track;
for( TRACK* track = m_Brd->m_Track; track != NULL; track = next_track ) for( TRACK* track = m_Brd->m_Track; track != NULL; track = next_track )
{ {
next_track = track->Next(); next_track = track->Next();
...@@ -260,9 +243,9 @@ bool TRACKS_CLEANER::clean_vias() ...@@ -260,9 +243,9 @@ bool TRACKS_CLEANER::clean_vias()
// if one pad through is found, the via can be removed // if one pad through is found, the via can be removed
for( unsigned ii = 0; ii < track->m_PadsConnected.size(); ii++ ) for( unsigned ii = 0; ii < track->m_PadsConnected.size(); ii++ )
{ {
D_PAD* pad = track->m_PadsConnected[ii]; D_PAD * pad = track->m_PadsConnected[ii];
if( ( pad->GetLayerMask() & ALL_CU_LAYERS ) == ALL_CU_LAYERS ) if( (pad->GetLayerMask() & ALL_CU_LAYERS) == ALL_CU_LAYERS )
{ {
// redundant: via delete it // redundant: via delete it
m_Brd->GetRatsnest()->Remove( track ); m_Brd->GetRatsnest()->Remove( track );
...@@ -295,8 +278,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -295,8 +278,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{ {
item_erased = false; item_erased = false;
TRACK* next_track; TRACK* next_track;
for( TRACK * track = m_Brd->m_Track; track ; track = next_track )
for( TRACK* track = m_Brd->m_Track; track ; track = next_track )
{ {
next_track = track->Next(); next_track = track->Next();
...@@ -317,7 +299,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -317,7 +299,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
LAYER_NUM top_layer, bottom_layer; LAYER_NUM top_layer, bottom_layer;
ZONE_CONTAINER* zone; ZONE_CONTAINER* zone;
if( ( type_end & START_ON_PAD ) == 0 ) if( (type_end & START_ON_PAD ) == 0 )
{ {
TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_START ); TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_START );
...@@ -339,7 +321,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -339,7 +321,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
} }
} }
if( ( other == NULL ) && ( zone == NULL ) ) if( (other == NULL) && (zone == NULL) )
{ {
flag_erase |= 1; flag_erase |= 1;
} }
...@@ -427,7 +409,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -427,7 +409,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
via->GetNetCode() ); via->GetNetCode() );
} }
if( ( other == NULL ) && ( zone == NULL ) ) if( (other == NULL) && (zone == NULL) )
flag_erase |= 0x20; flag_erase |= 0x20;
track->SetState( BUSY, false ); track->SetState( BUSY, false );
...@@ -459,8 +441,6 @@ bool TRACKS_CLEANER::clean_segments() ...@@ -459,8 +441,6 @@ bool TRACKS_CLEANER::clean_segments()
bool modified = false; bool modified = false;
TRACK* segment, * nextsegment; TRACK* segment, * nextsegment;
TRACK* other; TRACK* other;
int flag, no_inc;
// Delete null segments // Delete null segments
for( segment = m_Brd->m_Track; segment; segment = nextsegment ) for( segment = m_Brd->m_Track; segment; segment = nextsegment )
...@@ -472,6 +452,7 @@ bool TRACKS_CLEANER::clean_segments() ...@@ -472,6 +452,7 @@ bool TRACKS_CLEANER::clean_segments()
m_Brd->GetRatsnest()->Remove( segment ); m_Brd->GetRatsnest()->Remove( segment );
segment->ViewRelease(); segment->ViewRelease();
segment->DeleteStructure(); segment->DeleteStructure();
modified = true;
} }
} }
...@@ -524,7 +505,8 @@ bool TRACKS_CLEANER::clean_segments() ...@@ -524,7 +505,8 @@ bool TRACKS_CLEANER::clean_segments()
if( segment->Type() != PCB_TRACE_T ) if( segment->Type() != PCB_TRACE_T )
continue; continue;
flag = no_inc = 0; unsigned flag = 0;
bool no_inc = false;
// search for a possible point connected to the START point of the current segment // search for a possible point connected to the START point of the current segment
for( segStart = segment->Next(); ; ) for( segStart = segment->Next(); ; )
...@@ -603,7 +585,7 @@ bool TRACKS_CLEANER::clean_segments() ...@@ -603,7 +585,7 @@ bool TRACKS_CLEANER::clean_segments()
if( segDelete ) if( segDelete )
{ {
no_inc = 1; no_inc = true;
m_Brd->GetRatsnest()->Remove( segDelete ); m_Brd->GetRatsnest()->Remove( segDelete );
segDelete->ViewRelease(); segDelete->ViewRelease();
segDelete->DeleteStructure(); segDelete->DeleteStructure();
......
...@@ -91,7 +91,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) ...@@ -91,7 +91,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
// was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); // was: wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
Prj().ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(), Prj().ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(),
GROUP, GetProjectFileParameters() ); GROUP_PCB, GetProjectFileParameters() );
} }
} }
...@@ -426,7 +426,7 @@ bool DIALOG_NETLIST::verifyFootprints( const wxString& aNetlistFilename, ...@@ -426,7 +426,7 @@ bool DIALOG_NETLIST::verifyFootprints( const wxString& aNetlistFilename,
std::auto_ptr< NETLIST_READER > nlr( netlistReader ); std::auto_ptr< NETLIST_READER > nlr( netlistReader );
netlistReader->LoadNetlist(); netlistReader->LoadNetlist();
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
msg.Printf( _( "Error loading netlist file:\n%s" ), ioe.errorText.GetData() ); msg.Printf( _( "Error loading netlist file:\n%s" ), ioe.errorText.GetData() );
wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR ); wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
......
...@@ -403,7 +403,7 @@ bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName, double aUseThou ) ...@@ -403,7 +403,7 @@ bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName, double aUseThou )
idfBoard.Finish(); idfBoard.Finish();
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping export to IDFv3.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping export to IDFv3.\n\nError: %s" ),
GetChars( ioe.errorText ) ); GetChars( ioe.errorText ) );
......
...@@ -713,7 +713,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool ...@@ -713,7 +713,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
fprintf( rptfile, "$EndMODULE %s\n\n", TO_UTF8 (Module->GetReference() ) ); fprintf( rptfile, "$EndMODULE %s\n\n", TO_UTF8 (Module->GetReference() ) );
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( NULL, ioe.errorText ); DisplayError( NULL, ioe.errorText );
} }
......
...@@ -404,7 +404,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in ...@@ -404,7 +404,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SetBoard( loadedBoard ); SetBoard( loadedBoard );
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxString msg = wxString::Format( _( "Error loading board.\n%s" ), wxString msg = wxString::Format( _( "Error loading board.\n%s" ),
ioe.errorText.GetData() ); ioe.errorText.GetData() );
...@@ -692,7 +692,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -692,7 +692,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
pi->Save( pcbFileName.GetFullPath(), GetBoard(), NULL ); pi->Save( pcbFileName.GetFullPath(), GetBoard(), NULL );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxString msg = wxString::Format( _( "Error saving board.\n%s" ), wxString msg = wxString::Format( _( "Error saving board.\n%s" ),
ioe.errorText.GetData() ); ioe.errorText.GetData() );
......
...@@ -570,7 +570,7 @@ int main( int argc, char** argv ) ...@@ -570,7 +570,7 @@ int main( int argc, char** argv )
printf("[%d]:%s\n", i, TO_UTF8( fps[i] ) ); printf("[%d]:%s\n", i, TO_UTF8( fps[i] ) );
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
printf( "%s\n", TO_UTF8(ioe.errorText) ); printf( "%s\n", TO_UTF8(ioe.errorText) );
} }
......
...@@ -204,7 +204,7 @@ public: ...@@ -204,7 +204,7 @@ public:
* or * or
* IO_MGR::Save(...); * IO_MGR::Save(...);
* } * }
* catch( IO_ERROR ioe ) * catch( const IO_ERROR& ioe )
* { * {
* // grab text from ioe, show in error window. * // grab text from ioe, show in error window.
* } * }
......
This diff is collapsed.
This diff is collapsed.
...@@ -199,7 +199,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() ...@@ -199,7 +199,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
return NULL; return NULL;
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return NULL; return NULL;
...@@ -222,7 +222,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() ...@@ -222,7 +222,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
return NULL; return NULL;
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return NULL; return NULL;
...@@ -259,7 +259,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() ...@@ -259,7 +259,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
return NULL; return NULL;
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return NULL; return NULL;
...@@ -334,7 +334,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule ) ...@@ -334,7 +334,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
fprintf( fp, "%s", pcb_io.GetStringOutput( false ).c_str() ); fprintf( fp, "%s", pcb_io.GetStringOutput( false ).c_str() );
fclose( fp ); fclose( fp );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return; return;
...@@ -357,7 +357,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveCurrentModule( const wxString* aLibPath ) ...@@ -357,7 +357,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveCurrentModule( const wxString* aLibPath )
pi->FootprintSave( libPath, GetBoard()->m_Modules ); pi->FootprintSave( libPath, GetBoard()->m_Modules );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return false; return false;
...@@ -429,7 +429,7 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary() ...@@ -429,7 +429,7 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary()
writable = pi->IsFootprintLibWritable( libPath ); writable = pi->IsFootprintLibWritable( libPath );
exists = true; // no exception was thrown, lib must exist. exists = true; // no exception was thrown, lib must exist.
} }
catch( IO_ERROR ) catch( const IO_ERROR& )
{ {
// ignore, original values of 'writable' and 'exists' are accurate. // ignore, original values of 'writable' and 'exists' are accurate.
} }
...@@ -455,7 +455,7 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary() ...@@ -455,7 +455,7 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary()
pi->FootprintLibCreate( libPath ); pi->FootprintLibCreate( libPath );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return wxEmptyString; return wxEmptyString;
...@@ -499,7 +499,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary() ...@@ -499,7 +499,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
{ {
FootprintLibs()->FootprintDelete( nickname, fpname ); FootprintLibs()->FootprintDelete( nickname, fpname );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return false; return false;
...@@ -568,7 +568,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly ) ...@@ -568,7 +568,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
} }
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
} }
...@@ -655,7 +655,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary, ...@@ -655,7 +655,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
// own if the library or footprint is not writable. // own if the library or footprint is not writable.
FootprintLibs()->FootprintSave( aLibrary, aModule ); FootprintLibs()->FootprintSave( aLibrary, aModule );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return false; return false;
......
...@@ -220,7 +220,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, ...@@ -220,7 +220,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
{ {
module = loadFootprint( fpid ); module = loadFootprint( fpid );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(), GetChars( ioe.errorText ) ); fpid.Format().c_str(), GetChars( ioe.errorText ) );
...@@ -252,7 +252,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, ...@@ -252,7 +252,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
{ {
module = loadFootprint( fpid ); module = loadFootprint( fpid );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(), GetChars( ioe.errorText ) ); fpid.Format().c_str(), GetChars( ioe.errorText ) );
...@@ -304,7 +304,7 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const FPID& aFootprintId ) ...@@ -304,7 +304,7 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const FPID& aFootprintId )
{ {
module = loadFootprint( aFootprintId ); module = loadFootprint( aFootprintId );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
aFootprintId.Format().c_str(), GetChars( ioe.errorText ) ); aFootprintId.Format().c_str(), GetChars( ioe.errorText ) );
...@@ -321,31 +321,7 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId ) ...@@ -321,31 +321,7 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId )
wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) ); wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) );
wxString nickname = aFootprintId.GetLibNickname(); return fptbl->FootprintLoadWithOptionalNickname( aFootprintId );
wxString fpname = aFootprintId.GetFootprintName();
if( nickname.size() )
{
return fptbl->FootprintLoad( nickname, fpname );
}
// user did not enter a nickname, just a footprint name, help him out a little:
else
{
std::vector<wxString> nicks = fptbl->GetLogicalLibs();
// Search each library going through libraries alphabetically.
for( unsigned i = 0; i<nicks.size(); ++i )
{
// FootprintLoad() returns NULL on not found, does not throw exception
// unless there's an IO_ERROR.
MODULE* ret = fptbl->FootprintLoad( nicks[i], fpname );
if( ret )
return ret;
}
return NULL;
}
} }
...@@ -557,7 +533,7 @@ void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent ) ...@@ -557,7 +533,7 @@ void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent )
// m is deleted here by auto_ptr. // m is deleted here by auto_ptr.
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
return; return;
......
...@@ -279,7 +279,7 @@ wxString FOOTPRINT_EDIT_FRAME::getLibPath() ...@@ -279,7 +279,7 @@ wxString FOOTPRINT_EDIT_FRAME::getLibPath()
return row->GetFullURI( true ); return row->GetFullURI( true );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
return wxEmptyString; return wxEmptyString;
} }
...@@ -639,7 +639,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle() ...@@ -639,7 +639,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
if( !writable ) if( !writable )
title += _( " [Read Only]" ); title += _( " [Read Only]" );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
// user may be bewildered as to why after selecting a library it is not showing up // user may be bewildered as to why after selecting a library it is not showing up
// in the title, we could show an error message, but that should have been done at time // in the title, we could show an error message, but that should have been done at time
......
...@@ -85,7 +85,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName, ...@@ -85,7 +85,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
netlistReader->LoadNetlist(); netlistReader->LoadNetlist();
loadFootprints( netlist, aReporter ); loadFootprints( netlist, aReporter );
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
msg.Printf( _( "Error loading netlist.\n%s" ), ioe.errorText.GetData() ); msg.Printf( _( "Error loading netlist.\n%s" ), ioe.errorText.GetData() );
wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR ); wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
......
...@@ -208,13 +208,13 @@ MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BA ...@@ -208,13 +208,13 @@ MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BA
return &kiface; return &kiface;
} }
#if defined(BUILD_KIWAY_DLL)
PGM_BASE& Pgm() PGM_BASE& Pgm()
{ {
wxASSERT( process ); // KIFACE_GETTER has already been called. wxASSERT( process ); // KIFACE_GETTER has already been called.
return *process; return *process;
} }
#endif
/** /**
* Function set3DShapesPath * Function set3DShapesPath
...@@ -484,6 +484,5 @@ void IFACE::OnKifaceEnd() ...@@ -484,6 +484,5 @@ void IFACE::OnKifaceEnd()
// This should only be called if python was setup correctly. // This should only be called if python was setup correctly.
pcbnewFinishPythonScripting(); pcbnewFinishPythonScripting();
#endif #endif
} }
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <project.h> #include <project.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
...@@ -239,7 +238,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) ...@@ -239,7 +238,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
// was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_PCB, GetProjectFileParameters(), false );
// Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate // Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
// what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings // what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings
...@@ -302,9 +301,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave ) ...@@ -302,9 +301,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
fn = dlg.GetPath(); fn = dlg.GetPath();
} }
SEARCH_STACK& search = Kiface().KifaceSearch(); Prj().ConfigSave( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_PCB, GetProjectFileParameters() );
Prj().ConfigSave( search, fn.GetFullPath(), GROUP, GetProjectFileParameters() );
} }
...@@ -315,7 +312,7 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() ...@@ -315,7 +312,7 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), pca.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
&BASE_SCREEN::m_PageLayoutDescrFileName ) ); &BASE_SCREEN::m_PageLayoutDescrFileName ) );
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), &g_UserLibDirBuffer, GROUPLIB ) ); pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), &g_UserLibDirBuffer, GROUP_PCB_LIBS ) );
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) );
......
/** /**
* @file pcbnew_config.h * @file pcbnew_config.h
* @brief Cconfiguration parameters for Pcbnew. * @brief Configuration parameters for Pcbnew.
*/ */
#ifndef _PCBNEW_CONFIG_H_ #ifndef _PCBNEW_CONFIG_H_
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
#include <config_params.h> #include <config_params.h>
#include <colors_selection.h> #include <colors_selection.h>
#define GROUP wxT( "/pcbnew" )
#define GROUPLIB wxT( "/pcbnew/libraries" )
#define GROUPCOMMON wxT( "/common" )
/* Useful macro : */ /* Useful macro : */
#define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer] #define LOC_COLOR(layer) &g_ColorsSettings.m_LayersColors[layer]
#define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible] #define ITEM_COLOR(item_visible) &g_ColorsSettings.m_ItemsColors[item_visible]
......
...@@ -162,7 +162,7 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename ) ...@@ -162,7 +162,7 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename )
// if an exception is thrown by FromBOARD or ExportPCB(), then // if an exception is thrown by FromBOARD or ExportPCB(), then
// ~SPECCTRA_DB() will close the file. // ~SPECCTRA_DB() will close the file.
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
ok = false; ok = false;
...@@ -1322,7 +1322,7 @@ bool SPECCTRA_DB::GetBoardPolygonOutlines( BOARD* aBoard, ...@@ -1322,7 +1322,7 @@ bool SPECCTRA_DB::GetBoardPolygonOutlines( BOARD* aBoard,
aHoles.CloseLastContour(); aHoles.CloseLastContour();
} }
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
// Creates a valid polygon outline is not possible. // Creates a valid polygon outline is not possible.
// So uses the board edge cuts bounding box to create a // So uses the board edge cuts bounding box to create a
......
...@@ -102,14 +102,15 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event ) ...@@ -102,14 +102,15 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
db.LoadSESSION( fullFileName ); db.LoadSESSION( fullFileName );
db.FromSESSION( GetBoard() ); db.FromSESSION( GetBoard() );
} }
catch( IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
ioe.errorText += '\n'; wxString msg = ioe.errorText;
ioe.errorText += _("BOARD may be corrupted, do not save it."); msg += '\n';
ioe.errorText += '\n'; msg += _("BOARD may be corrupted, do not save it.");
ioe.errorText += _("Fix problem and try again."); msg += '\n';
msg += _("Fix problem and try again.");
DisplayError( this, ioe.errorText ); DisplayError( this, msg );
return; return;
} }
......
...@@ -63,7 +63,7 @@ int main( int argc, char** argv ) ...@@ -63,7 +63,7 @@ int main( int argc, char** argv )
// db.LoadPCB( filename ); // db.LoadPCB( filename );
db.LoadSESSION( filename ); db.LoadSESSION( filename );
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
fprintf( stderr, "%s\n", TO_UTF8(ioe.errorText) ); fprintf( stderr, "%s\n", TO_UTF8(ioe.errorText) );
failed = true; failed = true;
......
...@@ -125,7 +125,10 @@ install_prerequisites() ...@@ -125,7 +125,10 @@ install_prerequisites()
fi fi
# ensure bzr name and email are set. No message since bzr prints an excellent diagnostic. # ensure bzr name and email are set. No message since bzr prints an excellent diagnostic.
bzr whoami || exit 2 bzr whoami || {
echo "WARNING: You have not set bzr whoami, so I will set a dummy."
export BZR_EMAIL="Kicad Build <nobody@foo>"
}
} }
...@@ -270,10 +273,12 @@ install_or_update() ...@@ -270,10 +273,12 @@ install_or_update()
echo " kicad-lib.bzr installed." echo " kicad-lib.bzr installed."
echo "step 9) as non-root, install user configuration files..." echo "step 9) as non-root, install global fp-lib-table if none already installed..."
# install ~/fp-lib-table # install ~/fp-lib-table
if [ ! -e ~/fp-lib-table ]; then
make install_github_fp-lib-table make install_github_fp-lib-table
echo " kicad user-configuration files installed." echo " global fp-lib-table installed."
fi
echo "step 10) installing documentation..." echo "step 10) installing documentation..."
......
...@@ -83,7 +83,7 @@ int main( int argc, char** argv ) ...@@ -83,7 +83,7 @@ int main( int argc, char** argv )
#endif #endif
} }
catch( IO_ERROR ioe ) catch( const IO_ERROR& ioe )
{ {
fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) ); fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment