Commit acbe6290 authored by Dick Hollenbeck's avatar Dick Hollenbeck

switch back to original sexpr usage of PTREE, add new DSNLEXER constructor,...

switch back to original sexpr usage of PTREE, add new DSNLEXER constructor, enforce accessors in kicad.exe
parent 0304598a
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
//#define STANDALONE 1 // enable this for stand alone testing. //#define STANDALONE 1 // enable this for stand alone testing.
#define FMT_CLIPBOARD _( "clipboard" )
//-----<DSNLEXER>------------------------------------------------------------- //-----<DSNLEXER>-------------------------------------------------------------
...@@ -89,7 +91,7 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, ...@@ -89,7 +91,7 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
keywordCount( aKeywordCount ) keywordCount( aKeywordCount )
{ {
STRING_LINE_READER* stringReader = new STRING_LINE_READER( aClipboardTxt, aSource.IsEmpty() ? STRING_LINE_READER* stringReader = new STRING_LINE_READER( aClipboardTxt, aSource.IsEmpty() ?
wxString( _( "clipboard" ) ) : aSource ); wxString( FMT_CLIPBOARD ) : aSource );
PushReader( stringReader ); PushReader( stringReader );
init(); init();
} }
...@@ -107,6 +109,20 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, ...@@ -107,6 +109,20 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
} }
static const KEYWORD empty_keywords[1] = {};
DSNLEXER::DSNLEXER( const std::string& aSExpression, const wxString& aSource ) :
iOwnReaders( true ),
keywords( empty_keywords ),
keywordCount( 0 )
{
STRING_LINE_READER* stringReader = new STRING_LINE_READER( aSExpression, aSource.IsEmpty() ?
wxString( FMT_CLIPBOARD ) : aSource );
PushReader( stringReader );
init();
}
DSNLEXER::~DSNLEXER() DSNLEXER::~DSNLEXER()
{ {
if( iOwnReaders ) if( iOwnReaders )
......
...@@ -83,11 +83,7 @@ inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer ) ...@@ -83,11 +83,7 @@ inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer )
//D(printf( "%s: '%s'\n", __func__, key );) //D(printf( "%s: '%s'\n", __func__, key );)
#if 0
aTree->push_back( PTREE::value_type( key, PTREE() ) ); aTree->push_back( PTREE::value_type( key, PTREE() ) );
#else
aTree->put_value( key );
#endif
} }
...@@ -194,7 +190,7 @@ static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, ...@@ -194,7 +190,7 @@ static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl,
out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" ); out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" );
if( aTree.data().size() ) if( aTree.data().size() ) // sexpr format does not use data()
{ {
out->Print( 0, " %s%s", out->Print( 0, " %s%s",
out->Quotes( aTree.data() ).c_str(), out->Quotes( aTree.data() ).c_str(),
......
...@@ -56,55 +56,61 @@ void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfRef ...@@ -56,55 +56,61 @@ void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfRef
sheets.GetComponents( refs, false ); sheets.GetComponents( refs, false );
static const KEYWORD empty_keywords[1] = {}; DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) );
DSNLEXER lexer( empty_keywords, 0, aChangedSetOfReferences, FROM_UTF8( __func__ ) );
PTREE doc; PTREE doc;
Scan( &doc, &lexer ); try
{
Scan( &doc, &lexer );
#if defined(DEBUG) && 0 #if defined(DEBUG) && 0
STRING_FORMATTER sf; STRING_FORMATTER sf;
Format( &sf, 0, 0, doc ); Format( &sf, 0, 0, doc );
printf( "%s: '%s'\n", __func__, sf.GetString().c_str() ); printf( "%s: '%s'\n", __func__, sf.GetString().c_str() );
#endif #endif
CPTREE& back_anno = doc.get_child( "back_annotation" ); CPTREE& back_anno = doc.get_child( "back_annotation" );
for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref ) for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
{ {
wxASSERT( ref->first == "ref" ); wxASSERT( ref->first == "ref" );
wxString reference = (UTF8&) ref->second.data(); wxString reference = (UTF8&) ref->second.front().first;
wxString footprint = (UTF8) ref->second.get<std::string>( "fpid" ); wxString footprint = (UTF8&) ref->second.get_child( "fpid" ).front().first;
// DBG( printf( "%s: ref:%s fpid:%s\n", __func__, TO_UTF8( reference ), TO_UTF8( footprint ) ); ) DBG( printf( "%s: ref:%s fpid:%s\n", __func__, TO_UTF8( reference ), TO_UTF8( footprint ) ); )
// Search the component in the flat list // Search the component in the flat list
for( unsigned ii = 0; ii < refs.GetCount(); ++ii ) for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
{
if( Cmp_KEEPCASE( reference, refs[ii].GetRef() ) == 0 )
{ {
// We have found a candidate. if( Cmp_KEEPCASE( reference, refs[ii].GetRef() ) == 0 )
// Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here
SCH_COMPONENT* component = refs[ii].GetComponent();
SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
const wxString& oldfp = fpfield->GetText();
if( !oldfp && fpfield->IsVisible() )
{ {
fpfield->SetVisible( false ); // We have found a candidate.
// Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here
SCH_COMPONENT* component = refs[ii].GetComponent();
SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
const wxString& oldfp = fpfield->GetText();
if( !oldfp && fpfield->IsVisible() )
{
fpfield->SetVisible( false );
}
// DBG( printf("%s: ref:%s fpid:%s\n", __func__, TO_UTF8( refs[ii].GetRef() ), TO_UTF8( footprint ) );)
if( oldfp != footprint )
isChanged = true;
fpfield->SetText( footprint );
} }
// DBG( printf("%s: ref:%s fpid:%s\n", __func__, TO_UTF8( refs[ii].GetRef() ), TO_UTF8( footprint ) );)
if( oldfp != footprint )
isChanged = true;
fpfield->SetText( footprint );
} }
} }
} }
catch( const PTREE_ERROR& ex )
{
// remap the exception to something the caller is likely to understand.
THROW_IO_ERROR( ex.what() );
}
if( isChanged ) if( isChanged )
OnModify(); OnModify();
......
...@@ -174,7 +174,7 @@ public: ...@@ -174,7 +174,7 @@ public:
FILE* aFile, const wxString& aFileName ); FILE* aFile, const wxString& aFileName );
/** /**
* Constructor ( std::string&*, const wxString& ) * Constructor ( const KEYWORD*, unsigned, const std::string&, const wxString& )
* intializes a DSN lexer and prepares to read from @a aSExpression. * intializes a DSN lexer and prepares to read from @a aSExpression.
* *
* @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This * @param aKeywordTable is an array of KEYWORDS holding \a aKeywordCount. This
...@@ -186,6 +186,16 @@ public: ...@@ -186,6 +186,16 @@ public:
DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount, DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
const std::string& aSExpression, const wxString& aSource = wxEmptyString ); const std::string& aSExpression, const wxString& aSource = wxEmptyString );
/**
* Constructor ( const std::string&, const wxString& )
* intializes a DSN lexer and prepares to read from @a aSExpression. Use this
* one without a keyword table with the DOM parser in ptree.h.
*
* @param aSExpression is text to feed through a STRING_LINE_READER
* @param aSource is a description of aSExpression, used for error reporting.
*/
DSNLEXER( const std::string& aSExpression, const wxString& aSource = wxEmptyString );
/** /**
* Constructor ( LINE_READER* ) * Constructor ( LINE_READER* )
* intializes a DSN lexer and prepares to read from @a aLineReader which * intializes a DSN lexer and prepares to read from @a aLineReader which
......
...@@ -52,9 +52,9 @@ makes it easy to extract a subset of a ptree. ...@@ -52,9 +52,9 @@ makes it easy to extract a subset of a ptree.
#include <richio.h> #include <richio.h>
#include <dsnlexer.h> #include <dsnlexer.h>
typedef boost::property_tree::ptree PTREE; typedef boost::property_tree::ptree PTREE;
typedef const PTREE CPTREE; typedef const PTREE CPTREE;
typedef boost::property_tree::ptree_error PTREE_ERROR;
/** /**
* Function Scan * Function Scan
......
...@@ -51,12 +51,11 @@ TREEPROJECT_ITEM::TREEPROJECT_ITEM( enum TreeFileType type, const wxString& data ...@@ -51,12 +51,11 @@ TREEPROJECT_ITEM::TREEPROJECT_ITEM( enum TreeFileType type, const wxString& data
m_Type = type; m_Type = type;
m_parent = parent; m_parent = parent;
m_FileName = data; m_FileName = data;
m_IsRootFile = false; // true only for the root item of the tree (the project name) m_IsRootFile = false; // true only for the root item of the tree (the project name)
m_WasPopulated = false; m_IsPopulated = false;
} }
// Set the state used in the icon list
void TREEPROJECT_ITEM::SetState( int state ) void TREEPROJECT_ITEM::SetState( int state )
{ {
wxImageList* imglist = m_parent->GetImageList(); wxImageList* imglist = m_parent->GetImageList();
...@@ -71,8 +70,7 @@ void TREEPROJECT_ITEM::SetState( int state ) ...@@ -71,8 +70,7 @@ void TREEPROJECT_ITEM::SetState( int state )
} }
/* Get the directory containing the file */ const wxString TREEPROJECT_ITEM::GetDir() const
wxString TREEPROJECT_ITEM::GetDir() const
{ {
if( TREE_DIRECTORY == m_Type ) if( TREE_DIRECTORY == m_Type )
return m_FileName; return m_FileName;
...@@ -84,7 +82,6 @@ wxString TREEPROJECT_ITEM::GetDir() const ...@@ -84,7 +82,6 @@ wxString TREEPROJECT_ITEM::GetDir() const
} }
/* rename the file checking if extension change occurs */
bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check ) bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
{ {
// this is broken & unsafe to use on linux. // this is broken & unsafe to use on linux.
...@@ -145,14 +142,13 @@ type.\n Do you want to continue ?" ...@@ -145,14 +142,13 @@ type.\n Do you want to continue ?"
} }
/*******************************************/
bool TREEPROJECT_ITEM::Delete( bool check ) bool TREEPROJECT_ITEM::Delete( bool check )
/*******************************************/
/* delete a file */
{ {
wxString msg; wxString msg = wxString::Format( _(
"Do you really want to delete '%s'" ),
GetChars( GetFileName() )
);
msg.Printf( _( "Do you really want to delete <%s>" ), GetChars( GetFileName() ) );
wxMessageDialog dialog( m_parent, msg, wxMessageDialog dialog( m_parent, msg,
_( "Delete File" ), wxYES_NO | wxICON_QUESTION ); _( "Delete File" ), wxYES_NO | wxICON_QUESTION );
...@@ -184,16 +180,15 @@ bool TREEPROJECT_ITEM::Delete( bool check ) ...@@ -184,16 +180,15 @@ bool TREEPROJECT_ITEM::Delete( bool check )
} }
// Called under item activation
void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe ) void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
{ {
wxString sep = wxFileName().GetPathSeparator(); wxString sep = wxFileName().GetPathSeparator();
wxString FullFileName = GetFileName(); wxString fullFileName = GetFileName();
wxTreeItemId id = GetId(); wxTreeItemId id = GetId();
KICAD_MANAGER_FRAME* mainFrame = (KICAD_MANAGER_FRAME*) Pgm().App().GetTopWindow(); KICAD_MANAGER_FRAME* mainFrame = (KICAD_MANAGER_FRAME*) Pgm().App().GetTopWindow();
AddDelimiterString( FullFileName ); AddDelimiterString( fullFileName );
switch( GetType() ) switch( GetType() )
{ {
...@@ -205,24 +200,29 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe ) ...@@ -205,24 +200,29 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
break; break;
case TREE_SCHEMA: case TREE_SCHEMA:
mainFrame->Execute( m_parent, EESCHEMA_EXE, FullFileName ); mainFrame->Execute( m_parent, EESCHEMA_EXE, fullFileName );
break; break;
case TREE_LEGACY_PCB: case TREE_LEGACY_PCB:
case TREE_SEXP_PCB: case TREE_SEXP_PCB:
mainFrame->Execute( m_parent, PCBNEW_EXE, FullFileName ); {
DBG( printf( "%s: %s\n", __func__, TO_UTF8( fullFileName ) ); )
mainFrame->Execute( m_parent, PCBNEW_EXE, fullFileName );
}
break; break;
case TREE_GERBER: case TREE_GERBER:
mainFrame->Execute( m_parent, GERBVIEW_EXE, FullFileName ); mainFrame->Execute( m_parent, GERBVIEW_EXE, fullFileName );
break; break;
case TREE_PDF: case TREE_PDF:
OpenPDF( FullFileName ); OpenPDF( fullFileName );
break; break;
case TREE_NET: case TREE_NET:
mainFrame->Execute( m_parent, CVPCB_EXE, FullFileName ); mainFrame->Execute( m_parent, CVPCB_EXE, fullFileName );
break; break;
case TREE_TXT: case TREE_TXT:
...@@ -230,18 +230,16 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe ) ...@@ -230,18 +230,16 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
wxString editorname = Pgm().GetEditorName(); wxString editorname = Pgm().GetEditorName();
if( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
mainFrame->Execute( m_parent, editorname, FullFileName ); mainFrame->Execute( m_parent, editorname, fullFileName );
break;
} }
break;
case TREE_PAGE_LAYOUT_DESCR: case TREE_PAGE_LAYOUT_DESCR:
mainFrame->Execute( m_parent, PL_EDITOR_EXE, FullFileName ); mainFrame->Execute( m_parent, PL_EDITOR_EXE, fullFileName );
break; break;
default: default:
OpenFile( FullFileName ); OpenFile( fullFileName );
break; break;
} }
} }
/* #ifndef TREEPROJECT_ITEM_H_
* class_treeproject_item.h #define TREEPROJECT_ITEM_H_
*/
/** class TREEPROJECT_ITEM /**
* Handle one item (a file or a directory name) for the tree file * Class TREEPROJECT_ITEM
* handles one item (a file or a directory name) for the tree file
*/ */
class TREEPROJECT_ITEM : public wxTreeItemData class TREEPROJECT_ITEM : public wxTreeItemData
{ {
public: friend class KICAD_MANAGER_FRAME;
TreeFileType m_Type; // = TREE_PROJECT, TREE_DIRECTORY ...
wxString m_FileName; // Filename for a file, or directory name
bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project)
bool m_WasPopulated; // True the name is a directory, and its content was read
private:
wxTreeCtrl* m_parent;
int m_state;
public: public:
TREEPROJECT_ITEM( TreeFileType type, const wxString& data, TREEPROJECT_ITEM( TreeFileType type, const wxString& data,
wxTreeCtrl* parent ); wxTreeCtrl* parent );
TREEPROJECT_ITEM() : m_parent( NULL ) { } TREEPROJECT_ITEM() : m_parent( NULL ) { }
TREEPROJECT_ITEM( const TREEPROJECT_ITEM& src ) : TREEPROJECT_ITEM( const TREEPROJECT_ITEM& src ) :
m_Type( src.m_Type ), m_FileName( src.m_FileName ), m_parent( src.m_parent ) m_Type( src.m_Type ), m_FileName( src.m_FileName ), m_parent( src.m_parent )
{ {
SetState( src.m_state ); SetState( src.m_state );
m_WasPopulated = false; m_IsPopulated = false;
} }
TreeFileType GetType() const TreeFileType GetType() const { return m_Type; }
{ void SetType( TreeFileType aType ) { m_Type = aType; }
return m_Type;
}
void SetType( TreeFileType aType ) const wxString& GetFileName() const { return m_FileName; }
{ void SetFileName( const wxString& name ) { m_FileName = name; }
m_Type = aType;
}
wxString GetFileName() const bool IsRootFile() const { return m_IsRootFile; }
{ void SetRootFile( bool aValue ) { m_IsRootFile = aValue; }
return m_FileName;
}
void SetFileName( const wxString& name ) bool IsPopulated() const { return m_IsPopulated; }
{ void SetPopulated( bool aValue ) { m_IsPopulated = aValue; }
m_FileName = name;
}
/** /**
* @return the path of an item. * @return the path of an item.
* if this item is a directory, returns the stored filename * if this item is a directory, returns the stored filename
* if this is a file, returns its path * if this is a file, returns its path
*/ */
wxString GetDir() const; const wxString GetDir() const;
bool Rename( const wxString& name, bool check = true ); bool Rename( const wxString& name, bool check = true );
bool Delete( bool check = true ); bool Delete( bool check = true );
void Activate( TREE_PROJECT_FRAME* prjframe ); void Activate( TREE_PROJECT_FRAME* prjframe );
void SetState( int state ); void SetState( int state );
private:
TreeFileType m_Type; // = TREE_PROJECT, TREE_DIRECTORY ...
wxString m_FileName; // Filename for a file, or directory name
bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project)
bool m_IsPopulated; // True if the name is a directory, and its content was read
wxTreeCtrl* m_parent;
int m_state;
}; };
#endif // TREEPROJECT_ITEM_H_
...@@ -83,8 +83,7 @@ TREEPROJECTFILES::TREEPROJECTFILES( TREE_PROJECT_FRAME* parent ) : ...@@ -83,8 +83,7 @@ TREEPROJECTFILES::TREEPROJECTFILES( TREE_PROJECT_FRAME* parent ) :
TREEPROJECTFILES::~TREEPROJECTFILES() TREEPROJECTFILES::~TREEPROJECTFILES()
{ {
if( m_ImageList ) delete m_ImageList;
delete m_ImageList;
} }
...@@ -93,16 +92,18 @@ int TREEPROJECTFILES::OnCompareItems( const wxTreeItemId& item1, const wxTreeIte ...@@ -93,16 +92,18 @@ int TREEPROJECTFILES::OnCompareItems( const wxTreeItemId& item1, const wxTreeIte
TREEPROJECT_ITEM* myitem1 = (TREEPROJECT_ITEM*) GetItemData( item1 ); TREEPROJECT_ITEM* myitem1 = (TREEPROJECT_ITEM*) GetItemData( item1 );
TREEPROJECT_ITEM* myitem2 = (TREEPROJECT_ITEM*) GetItemData( item2 ); TREEPROJECT_ITEM* myitem2 = (TREEPROJECT_ITEM*) GetItemData( item2 );
if( (myitem1->m_Type == TREE_DIRECTORY) && ( myitem2->m_Type != TREE_DIRECTORY ) ) if( myitem1->GetType() == TREE_DIRECTORY && myitem2->GetType() != TREE_DIRECTORY )
return -1; return -1;
if( (myitem2->m_Type == TREE_DIRECTORY) && ( myitem1->m_Type != TREE_DIRECTORY ) )
if( myitem2->GetType() == TREE_DIRECTORY && myitem1->GetType() != TREE_DIRECTORY )
return 1; return 1;
if( myitem1->m_IsRootFile && !myitem2->m_IsRootFile ) if( myitem1->IsRootFile() && !myitem2->IsRootFile() )
return -1; return -1;
if( myitem2->m_IsRootFile && !myitem1->m_IsRootFile )
if( myitem2->IsRootFile() && !myitem1->IsRootFile() )
return 1; return 1;
return myitem1->m_FileName.CmpNoCase( myitem2->m_FileName ); return myitem1->GetFileName().CmpNoCase( myitem2->GetFileName() );
} }
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
#include <kicad.h> #include <kicad.h>
static const wxString ZipFileExtension( wxT( "zip" ) ); #define ZipFileExtension wxT( "zip" )
static const wxString ZipFileWildcard( wxT( "Zip file (*.zip) | *.zip" ) ); #define ZipFileWildcard wxT( "Zip file (*.zip) | *.zip" )
void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event )
...@@ -53,14 +53,17 @@ void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event ) ...@@ -53,14 +53,17 @@ void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event )
if( fn != wxEmptyString ) if( fn != wxEmptyString )
{ {
wxCommandEvent cmd( 0, wxID_ANY ); wxCommandEvent cmd( 0, wxID_ANY );
m_ProjectFileName = fn;
SetProjectFileName( fn );
OnLoadProject( cmd ); OnLoadProject( cmd );
} }
} }
void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
{ {
wxFileName fn = m_ProjectFileName; wxFileName fn = GetProjectFileName();
fn.SetExt( ZipFileExtension ); fn.SetExt( ZipFileExtension );
wxFileDialog dlg( this, _( "Unzip Project" ), fn.GetPath(), wxFileDialog dlg( this, _( "Unzip Project" ), fn.GetPath(),
...@@ -70,8 +73,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) ...@@ -70,8 +73,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
wxString msg; wxString msg = wxString::Format( _("\nOpen <%s>\n" ), GetChars( dlg.GetPath() ) );
msg.Printf( _("\nOpen <%s>\n" ), GetChars( dlg.GetPath() ) );
PrintMsg( msg ); PrintMsg( msg );
wxDirDialog dirDlg( this, _( "Target Directory" ), fn.GetPath(), wxDirDialog dirDlg( this, _( "Target Directory" ), fn.GetPath(),
...@@ -85,6 +87,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) ...@@ -85,6 +87,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
PrintMsg( msg ); PrintMsg( msg );
wxFileSystem zipfilesys; wxFileSystem zipfilesys;
zipfilesys.AddHandler( new wxZipFSHandler ); zipfilesys.AddHandler( new wxZipFSHandler );
zipfilesys.ChangePathTo( dlg.GetPath() + wxT( "#zip:" ) ); zipfilesys.ChangePathTo( dlg.GetPath() + wxT( "#zip:" ) );
...@@ -94,7 +97,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) ...@@ -94,7 +97,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
while( !localfilename.IsEmpty() ) while( !localfilename.IsEmpty() )
{ {
zipfile = zipfilesys.OpenFile( localfilename ); zipfile = zipfilesys.OpenFile( localfilename );
if( zipfile == NULL ) if( !zipfile )
{ {
DisplayError( this, wxT( "Zip file read error" ) ); DisplayError( this, wxT( "Zip file read error" ) );
break; break;
...@@ -139,7 +142,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event ) ...@@ -139,7 +142,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
}; };
wxString msg; wxString msg;
wxFileName fileName = m_ProjectFileName; wxFileName fileName = GetProjectFileName();
wxString oldPath = wxGetCwd(); wxString oldPath = wxGetCwd();
fileName.SetExt( wxT( "zip" ) ); fileName.SetExt( wxT( "zip" ) );
......
...@@ -158,15 +158,15 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp ) ...@@ -158,15 +158,15 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
bool prjloaded = false; // true when the project is loaded bool prjloaded = false; // true when the project is loaded
if( App().argc > 1 ) if( App().argc > 1 )
frame->m_ProjectFileName = App().argv[1]; frame->SetProjectFileName( App().argv[1] );
else if( GetFileHistory().GetCount() ) else if( GetFileHistory().GetCount() )
{ {
// Try to open the last opened project, // Try to open the last opened project,
// if a project name is not given when starting Kicad // if a project name is not given when starting Kicad
frame->m_ProjectFileName = GetFileHistory().GetHistoryFile( 0 ); frame->SetProjectFileName( GetFileHistory().GetHistoryFile( 0 ) );
if( !frame->m_ProjectFileName.FileExists() ) if( !wxFileExists( frame->GetProjectFileName() ) )
GetFileHistory().RemoveFileFromHistory( 0 ); GetFileHistory().RemoveFileFromHistory( 0 );
else else
{ {
...@@ -177,12 +177,12 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp ) ...@@ -177,12 +177,12 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
} }
} }
if( !frame->m_ProjectFileName.FileExists() ) if( !wxFileExists( frame->GetProjectFileName() ) )
{ {
wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT, wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT,
ProjectFileExtension ); ProjectFileExtension );
frame->m_ProjectFileName = namelessProject; frame->SetProjectFileName( namelessProject.GetFullPath() );
} }
if( !prjloaded ) if( !prjloaded )
...@@ -218,23 +218,24 @@ void PGM_KICAD::MacOpenFile( const wxString& aFileName ) ...@@ -218,23 +218,24 @@ void PGM_KICAD::MacOpenFile( const wxString& aFileName )
KICAD_MANAGER_FRAME* frame = (KICAD_MANAGER_FRAME*) GetTopWindow(); KICAD_MANAGER_FRAME* frame = (KICAD_MANAGER_FRAME*) GetTopWindow();
wxFileName fn = aFileName; frame->SetProjectFile( aFileName );
frame->m_ProjectFileName = fn; wxFileName fn = aFileName;
if( !frame->m_ProjectFileName.FileExists() && m_fileHistory.GetCount() ) if( !fn.FileExists() && m_fileHistory.GetCount() )
{ {
m_fileHistory.RemoveFileFromHistory( 0 ); m_fileHistory.RemoveFileFromHistory( 0 );
return; return;
} }
wxCommandEvent loadEvent; wxCommandEvent loadEvent;
loadEvent.SetId( wxID_ANY ); loadEvent.SetId( wxID_ANY );
frame->OnLoadProject( loadEvent ); frame->OnLoadProject( loadEvent );
wxString title = GetTitle() + wxT( " " ) + GetBuildVersion() + wxString title = GetTitle() + wxT( " " ) + GetBuildVersion() +
wxT( " " ) + frame->m_ProjectFileName.GetFullPath(); wxT( " " ) + frame->GetProjectFileName();
if( !fn.IsDirWritable() ) if( !fn.IsDirWritable() )
title += _( " [Read Only]" ); title += _( " [Read Only]" );
......
...@@ -120,28 +120,6 @@ enum id_kicad_frm { ...@@ -120,28 +120,6 @@ enum id_kicad_frm {
*/ */
class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME
{ {
protected:
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:
TREE_PROJECT_FRAME* m_LeftWin;
LAUNCHER_PANEL* m_Launcher;
wxTextCtrl* m_MessagesBox;
wxAuiToolBar* m_VToolBar; // Vertical toolbar (not used)
wxString m_BoardFileName;
wxString m_SchematicRootFileName;
wxFileName m_ProjectFileName;
private:
int m_leftWinWidth;
void language_change( wxCommandEvent& event );
public: public:
KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title, KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
...@@ -211,7 +189,7 @@ public: ...@@ -211,7 +189,7 @@ public:
void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event ); void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event );
void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event ); void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event );
void CreateNewProject( const wxString aPrjFullFileName, bool aTemplateSelector ); void CreateNewProject( const wxString& aPrjFullFileName, bool aTemplateSelector );
void LoadSettings( wxConfigBase* aCfg ); void LoadSettings( wxConfigBase* aCfg );
...@@ -249,7 +227,32 @@ public: ...@@ -249,7 +227,32 @@ public:
void OnChangeWatchedPaths(wxCommandEvent& aEvent ); void OnChangeWatchedPaths(wxCommandEvent& aEvent );
#endif #endif
void SetProjectFileName( const wxString& aFullProjectProFileName );
const wxString GetProjectFileName();
// read only accessors
const wxString SchFileName();
const wxString PcbFileName();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private:
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
TREE_PROJECT_FRAME* m_LeftWin;
LAUNCHER_PANEL* m_Launcher;
wxTextCtrl* m_MessagesBox;
wxAuiToolBar* m_VToolBar; // Vertical toolbar (not used)
wxFileName m_project_file_name;
int m_leftWinWidth;
void language_change( wxCommandEvent& event );
}; };
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#define USE_KIFACE 1
#define TreeFrameWidthEntry wxT( "LeftWinWidth" ) #define TreeFrameWidthEntry wxT( "LeftWinWidth" )
...@@ -125,6 +124,35 @@ wxConfigBase* KICAD_MANAGER_FRAME::config() ...@@ -125,6 +124,35 @@ wxConfigBase* KICAD_MANAGER_FRAME::config()
return ret; return ret;
} }
void KICAD_MANAGER_FRAME::SetProjectFileName( const wxString& aFullProjectProFileName )
{
m_project_file_name = aFullProjectProFileName;
wxASSERT( m_project_file_name.IsAbsolute() );
}
const wxString KICAD_MANAGER_FRAME::GetProjectFileName()
{
return m_project_file_name.GetFullPath();
}
const wxString KICAD_MANAGER_FRAME::SchFileName()
{
wxFileName fn( GetProjectFileName(), SchematicFileExtension );
return fn.GetFullName();
}
const wxString KICAD_MANAGER_FRAME::PcbFileName()
{
wxFileName fn( GetProjectFileName(), PcbFileExtension );
return fn.GetFullName();
}
const SEARCH_STACK& KICAD_MANAGER_FRAME::sys_search() const SEARCH_STACK& KICAD_MANAGER_FRAME::sys_search()
{ {
...@@ -159,7 +187,7 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -159,7 +187,7 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
int px, py; int px, py;
UpdateFileHistory( m_ProjectFileName.GetFullPath(), &Pgm().GetFileHistory() ); UpdateFileHistory( GetProjectFileName(), &Pgm().GetFileHistory() );
if( !IsIconized() ) // save main frame position and size if( !IsIconized() ) // save main frame position and size
{ {
...@@ -238,16 +266,14 @@ void KICAD_MANAGER_FRAME::OnRunPageLayoutEditor( wxCommandEvent& event ) ...@@ -238,16 +266,14 @@ void KICAD_MANAGER_FRAME::OnRunPageLayoutEditor( wxCommandEvent& event )
void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
{ {
wxFileName legacy_board( m_ProjectFileName ); wxFileName kicad_board( PcbFileName() );
wxFileName kicad_board( m_ProjectFileName );
wxFileName legacy_board( GetProjectFileName() );
legacy_board.SetExt( LegacyPcbFileExtension ); legacy_board.SetExt( LegacyPcbFileExtension );
kicad_board.SetExt( KiCadPcbFileExtension );
wxFileName& board = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ? wxFileName& board = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
kicad_board : legacy_board; kicad_board : legacy_board;
#if USE_KIFACE
KIWAY_PLAYER* frame = Kiway.Player( FRAME_PCB, false ); KIWAY_PLAYER* frame = Kiway.Player( FRAME_PCB, false );
if( !frame ) if( !frame )
{ {
...@@ -256,19 +282,15 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event ) ...@@ -256,19 +282,15 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
frame->Show( true ); frame->Show( true );
} }
frame->Raise(); frame->Raise();
#else
Execute( this, PCBNEW_EXE, QuoteFullPath( board ) );
#endif
} }
void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event )
{ {
wxFileName fn( m_ProjectFileName ); wxFileName fn( m_project_file_name );
fn.SetExt( NetlistFileExtension ); fn.SetExt( NetlistFileExtension );
#if USE_KIFACE
KIWAY_PLAYER* frame = Kiway.Player( FRAME_CVPCB, false ); KIWAY_PLAYER* frame = Kiway.Player( FRAME_CVPCB, false );
if( !frame ) if( !frame )
{ {
...@@ -277,19 +299,15 @@ void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event ) ...@@ -277,19 +299,15 @@ void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event )
frame->Show( true ); frame->Show( true );
} }
frame->Raise(); frame->Raise();
#else
Execute( this, CVPCB_EXE, QuoteFullPath( fn ) );
#endif
} }
void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
{ {
wxFileName fn( m_ProjectFileName ); wxFileName fn( m_project_file_name );
fn.SetExt( SchematicFileExtension ); fn.SetExt( SchematicFileExtension );
#if USE_KIFACE
KIWAY_PLAYER* frame = Kiway.Player( FRAME_SCH, false ); KIWAY_PLAYER* frame = Kiway.Player( FRAME_SCH, false );
if( !frame ) if( !frame )
{ {
...@@ -298,20 +316,14 @@ void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event ) ...@@ -298,20 +316,14 @@ void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
frame->Show( true ); frame->Show( true );
} }
frame->Raise(); frame->Raise();
#else
Execute( this, EESCHEMA_EXE, QuoteFullPath( fn ) );
#endif
} }
void KICAD_MANAGER_FRAME::OnRunGerbview( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnRunGerbview( wxCommandEvent& event )
{ {
// Gerbview is called without any file to open, because we do not know // Gerbview is called without any file to open, because we do not know
// the list and the name of files to open (if any...). // the list and the name of files to open (if any...).
#if USE_KIFACE && 0
#else
Execute( this, GERBVIEW_EXE, wxEmptyString ); Execute( this, GERBVIEW_EXE, wxEmptyString );
#endif
} }
...@@ -392,7 +404,7 @@ void KICAD_MANAGER_FRAME::PrintPrjInfo() ...@@ -392,7 +404,7 @@ void KICAD_MANAGER_FRAME::PrintPrjInfo()
wxString msg = wxString::Format( _( wxString msg = wxString::Format( _(
"Working dir: %s\nProject: %s\n" ), "Working dir: %s\nProject: %s\n" ),
GetChars( wxGetCwd() ), GetChars( wxGetCwd() ),
GetChars( m_ProjectFileName.GetFullPath() ) GetChars( GetProjectFileName() )
); );
PrintMsg( msg ); PrintMsg( msg );
} }
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
PARAM_CFG_ARRAY s_KicadManagerParams; PARAM_CFG_ARRAY s_KicadManagerParams;
void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName,
bool aTemplateSelector = false ) bool aTemplateSelector = false )
{ {
wxString filename; wxString filename;
wxFileName newProjectName = aPrjFullFileName; wxFileName newProjectName = aPrjFullFileName;
...@@ -169,15 +169,8 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, ...@@ -169,15 +169,8 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName,
} }
} }
// Init schematic filename
m_SchematicRootFileName = wxFileName( newProjectName.GetName(),
SchematicFileExtension ).GetFullName();
// Init pcb board filename
m_BoardFileName = wxFileName( newProjectName.GetName(), PcbFileExtension ).GetFullName();
// Init project filename // Init project filename
m_ProjectFileName = newProjectName; SetProjectFileName( newProjectName.GetFullPath() );
// Write settings to project file // Write settings to project file
// was: wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, s_KicadManagerParams ); // was: wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, s_KicadManagerParams );
...@@ -187,15 +180,19 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, ...@@ -187,15 +180,19 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName,
void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
{ {
int style; wxString title;
wxString title;
bool newProject = ( event.GetId() == ID_NEW_PROJECT ) || // this is still a mess, will work on it tomorrow.
( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE );
ClearMsg(); ClearMsg();
if( event.GetId() != wxID_ANY ) if( event.GetId() != wxID_ANY )
{ {
int style;
bool newProject = ( event.GetId() == ID_NEW_PROJECT ) ||
( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE );
if( newProject ) if( newProject )
{ {
title = _( "Create New Project" ); title = _( "Create New Project" );
...@@ -207,21 +204,20 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) ...@@ -207,21 +204,20 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
style = wxFD_OPEN | wxFD_FILE_MUST_EXIST; style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
} }
wxString default_dir = wxGetCwd(); wxString default_dir = wxGetCwd();
wxFileDialog dlg( this, title, default_dir, wxEmptyString, wxFileDialog dlg( this, title, default_dir, wxEmptyString,
ProjectFileWildcard, style ); ProjectFileWildcard, style );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
m_ProjectFileName = dlg.GetPath(); wxFileName pro( dlg.GetPath() );
pro.SetExt( ProjectFileExtension );
if( newProject ) if( newProject )
{ {
m_ProjectFileName.SetExt( ProjectFileExtension );
// Check if the project directory is empty // Check if the project directory is empty
wxDir directory ( m_ProjectFileName.GetPath() ); wxDir directory( pro.GetPath() );
if( directory.HasFiles() ) if( directory.HasFiles() )
{ {
...@@ -233,57 +229,59 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) ...@@ -233,57 +229,59 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
{ {
// Append a new directory with the same name of the project file // Append a new directory with the same name of the project file
// and try to create it // and try to create it
m_ProjectFileName.AppendDir( m_ProjectFileName.GetName() ); pro.AppendDir( pro.GetName() );
if( !wxMkdir( m_ProjectFileName.GetPath() ) ) if( !wxMkdir( pro.GetPath() ) )
// There was a problem, undo // There was a problem, undo
m_ProjectFileName.RemoveLastDir(); pro.RemoveLastDir();
} }
} }
if( event.GetId() == ID_NEW_PROJECT ) if( event.GetId() == ID_NEW_PROJECT )
{ {
CreateNewProject( m_ProjectFileName.GetFullPath() ); CreateNewProject( pro.GetFullPath() );
} }
else if( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE ) else if( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE )
{ {
// Launch the template selector dialog // Launch the template selector dialog
CreateNewProject( m_ProjectFileName.GetFullPath(), true ); CreateNewProject( pro.GetFullPath(), true );
} }
} }
SetProjectFileName( pro.GetFullName() );
} }
wxLogDebug( wxT( "Loading KiCad project file: " ) + m_ProjectFileName.GetFullPath() ); wxLogDebug( wxT( "Loading KiCad project file: " ) + GetProjectFileName() );
/* Check if project file exists and if it is not noname.pro */ // Check if project file exists and if it is not noname.pro
wxString filename = m_ProjectFileName.GetFullName(); wxString filename = GetProjectFileName();
wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" ); wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" );
if( !m_ProjectFileName.FileExists() && !filename.IsSameAs( nameless_prj ) ) if( !wxFileExists( GetProjectFileName() ) && !filename.IsSameAs( nameless_prj ) )
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format(
_( "KiCad project file '%s' not found" ), _( "KiCad project file '%s' not found" ),
GetChars( m_ProjectFileName.GetFullPath() ) ); GetChars( GetProjectFileName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
wxSetWorkingDirectory( m_ProjectFileName.GetPath() ); wxSetWorkingDirectory( wxFileName( GetProjectFileName() ).GetPath() );
// was wxGetApp().ReadProjectConfig( m_ProjectFileName.GetFullPath(), // was wxGetApp().ReadProjectConfig( m_ProjectFileName.GetFullPath(),
// GeneralGroupName, s_KicadManagerParams, false ); // GeneralGroupName, s_KicadManagerParams, false );
Prj().ConfigLoad( Pgm().SysSearch(), m_ProjectFileName.GetFullPath(), Prj().ConfigLoad( Pgm().SysSearch(), GetProjectFileName(),
GeneralGroupName, s_KicadManagerParams, false ); GeneralGroupName, s_KicadManagerParams, false );
title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + m_ProjectFileName.GetFullPath(); title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + GetProjectFileName();
if( !m_ProjectFileName.IsDirWritable() ) if( !wxIsWritable( GetProjectFileName() ) )
title += _( " [Read Only]" ); title += _( " [Read Only]" );
SetTitle( title ); SetTitle( title );
UpdateFileHistory( m_ProjectFileName.GetFullPath(), &Pgm().GetFileHistory() ); UpdateFileHistory( GetProjectFileName(), &Pgm().GetFileHistory() );
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
...@@ -292,7 +290,8 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) ...@@ -292,7 +290,8 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
// however this is possible only when the main loop event handler is running, // however this is possible only when the main loop event handler is running,
// so we use it to run the rebuild function. // so we use it to run the rebuild function.
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
wxPostEvent( this, cmd);
wxPostEvent( this, cmd );
#endif #endif
PrintPrjInfo(); PrintPrjInfo();
...@@ -301,12 +300,11 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) ...@@ -301,12 +300,11 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
void KICAD_MANAGER_FRAME::OnSaveProject( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnSaveProject( wxCommandEvent& event )
{ {
if( !IsWritable( m_ProjectFileName ) ) if( !wxIsWritable( GetProjectFileName() ) )
return; return;
// was: wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(), // was: wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(),
// GeneralGroupName, s_KicadManagerParams ); // GeneralGroupName, s_KicadManagerParams );
Prj().ConfigSave( Pgm().SysSearch(), m_ProjectFileName.GetFullPath(), Prj().ConfigSave( Pgm().SysSearch(), GetProjectFileName(),
GeneralGroupName, s_KicadManagerParams ); GeneralGroupName, s_KicadManagerParams );
} }
This diff is collapsed.
...@@ -58,7 +58,12 @@ private: ...@@ -58,7 +58,12 @@ private:
public: public:
TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ); TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent );
~TREE_PROJECT_FRAME(); ~TREE_PROJECT_FRAME();
/**
* Create or modify the tree showing project file names
*/
void ReCreateTreePrj(); void ReCreateTreePrj();
#ifdef KICAD_USE_FILES_WATCHER #ifdef KICAD_USE_FILES_WATCHER
/** /**
* Reinit the watched paths * Reinit the watched paths
...@@ -162,8 +167,8 @@ private: ...@@ -162,8 +167,8 @@ private:
bool aRecurse = true ); bool aRecurse = true );
/** /**
* function findSubdirTreeItem * Function findSubdirTreeItem
* Search for the item in tree project which is the * searches for the item in tree project which is the
* node of the subdirectory aSubDir * node of the subdirectory aSubDir
* @param aSubDir = the directory to find in tree * @param aSubDir = the directory to find in tree
* @return the opaque reference to the tree item. * @return the opaque reference to the tree item.
......
...@@ -45,6 +45,7 @@ endif() ...@@ -45,6 +45,7 @@ endif()
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/pcbnew ${PROJECT_SOURCE_DIR}/pcbnew
${BOOST_INCLUDE}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
) )
......
...@@ -58,7 +58,7 @@ int main( int argc, char** argv ) ...@@ -58,7 +58,7 @@ int main( int argc, char** argv )
static const KEYWORD empty_keywords[1] = {}; static const KEYWORD empty_keywords[1] = {};
DSNLEXER lexer( empty_keywords, 0, fp, wxString( FROM_UTF8( argv[1] ) ) ); DSNLEXER lexer( empty_keywords, 0, fp, FROM_UTF8( argv[1] ) );
try try
{ {
......
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