2008-11-02 14:54:53 +00:00
|
|
|
/**
|
2010-12-14 15:56:30 +00:00
|
|
|
* @file tree_project_frame.cpp
|
2012-08-29 12:40:09 +00:00
|
|
|
* @brief Function to build the tree of files in the current project directory
|
2008-11-02 14:54:53 +00:00
|
|
|
*/
|
|
|
|
|
2012-08-29 12:40:09 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2015-02-28 19:00:48 +00:00
|
|
|
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
|
2012-08-29 12:40:09 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <gestfich.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <pgm_base.h>
|
2012-04-16 12:56:01 +00:00
|
|
|
#include <macros.h>
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <tree_project_frame.h>
|
|
|
|
#include <class_treeprojectfiles.h>
|
|
|
|
#include <class_treeproject_item.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wx/regex.h>
|
|
|
|
#include <wx/dir.h>
|
|
|
|
#include <wx/imaglist.h>
|
2015-09-25 19:38:09 +00:00
|
|
|
#include <wx/stdpaths.h>
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2012-12-31 08:12:29 +00:00
|
|
|
#include <stack>
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
/* Note about the tree project build process:
|
2010-02-17 17:47:12 +00:00
|
|
|
* Building the tree project can be *very* long if there are a lot of subdirectories
|
|
|
|
* in the working directory.
|
2010-05-29 18:34:18 +00:00
|
|
|
* Unfortunately, this happens easily if the project file *.pro is in the home directory
|
2010-02-20 13:20:55 +00:00
|
|
|
* So the tree project is built "on demand":
|
|
|
|
* First the tree is built from the current directory and shows files and subdirs.
|
|
|
|
* > First level subdirs trees are built (i.e subdirs contents are not read)
|
|
|
|
* > When expanding a subdir, each subdir contains is read,
|
|
|
|
* and the corresponding sub tree is populated on the fly.
|
2010-02-17 17:47:12 +00:00
|
|
|
*/
|
|
|
|
|
2008-05-30 18:06:21 +00:00
|
|
|
// list of files extensions listed in the tree project window
|
2009-02-04 15:25:03 +00:00
|
|
|
// *.sch files are always allowed, do not add here
|
2008-05-30 18:06:21 +00:00
|
|
|
// Add extensions in a compatible regex format to see others files types
|
2012-08-29 12:40:09 +00:00
|
|
|
static const wxChar* s_allowedExtensionsToList[] =
|
2008-05-30 18:06:21 +00:00
|
|
|
{
|
|
|
|
wxT( "^.*\\.pro$" ),
|
|
|
|
wxT( "^.*\\.pdf$" ),
|
2012-04-16 12:56:01 +00:00
|
|
|
wxT( "^[^$].*\\.brd$" ), // Legacy Pcbnew files
|
2014-10-21 16:34:51 +00:00
|
|
|
wxT( "^[^$].*\\.kicad_pcb$" ), // S format Pcbnew board files
|
2013-07-19 18:27:22 +00:00
|
|
|
wxT( "^[^$].*\\.kicad_wks$" ), // S format kicad page layout descr files
|
2014-10-21 16:34:51 +00:00
|
|
|
wxT( "^[^$].*\\.kicad_mod$" ), // S format kicad footprint files, currently not listed
|
2008-05-30 18:06:21 +00:00
|
|
|
wxT( "^.*\\.net$" ),
|
2014-10-21 16:34:51 +00:00
|
|
|
wxT( "^.*\\.lib$" ), // Schematic library file
|
2008-05-30 18:06:21 +00:00
|
|
|
wxT( "^.*\\.txt$" ),
|
2014-06-30 10:00:21 +00:00
|
|
|
wxT( "^.*\\.pho$" ), // Gerber file (Old Kicad extension)
|
2011-08-19 13:08:24 +00:00
|
|
|
wxT( "^.*\\.gbr$" ), // Gerber file
|
|
|
|
wxT( "^.*\\.gb[alops]$" ), // Gerber back (or bottom) layer file
|
|
|
|
wxT( "^.*\\.gt[alops]$" ), // Gerber front (or top) layer file
|
|
|
|
wxT( "^.*\\.g[0-9]{1,2}$" ), // Gerber inner layer file
|
2008-05-30 18:06:21 +00:00
|
|
|
wxT( "^.*\\.odt$" ),
|
|
|
|
wxT( "^.*\\.htm$" ),
|
|
|
|
wxT( "^.*\\.html$" ),
|
2015-02-28 19:00:48 +00:00
|
|
|
wxT( "^.*\\.rpt$" ), // Report files
|
|
|
|
wxT( "^.*\\.csv$" ), // Report files in comma separated format
|
|
|
|
wxT( "^.*\\.pos$" ), // Footprint position files
|
|
|
|
wxT( "^.*\\.cmp$" ), // Cvpcb cmp/footprint link files
|
|
|
|
wxT( "^.*\\.drl$" ), // Excellon drill files
|
|
|
|
wxT( "^.*\\.svg$" ), // SVG print/plot files
|
|
|
|
NULL // end of list
|
2008-05-30 18:06:21 +00:00
|
|
|
};
|
|
|
|
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/* TODO: Check if these file extension and wildcard definitions are used
|
2011-09-30 18:15:37 +00:00
|
|
|
* in any of the other KiCad programs and move them into the common
|
2012-08-29 12:40:09 +00:00
|
|
|
* library as required.
|
|
|
|
*/
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
// File extension definitions.
|
2014-04-14 18:49:52 +00:00
|
|
|
const wxChar TextFileExtension[] = wxT( "txt" );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
// File wildcard definitions.
|
2014-04-14 18:49:52 +00:00
|
|
|
const wxChar TextFileWildcard[] = wxT( "Text files (*.txt)|*.txt" );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
2008-11-02 14:54:53 +00:00
|
|
|
/**
|
2010-02-20 13:20:55 +00:00
|
|
|
* @brief class TREE_PROJECT_FRAME is the frame that shows the tree list
|
|
|
|
* of files and subdirs inside the working directory
|
2012-08-29 12:40:09 +00:00
|
|
|
* Files are filtered (see s_allowedExtensionsToList) so
|
2010-02-20 13:20:55 +00:00
|
|
|
* only useful files are shown.
|
2008-11-02 14:54:53 +00:00
|
|
|
*/
|
2010-02-20 13:20:55 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
BEGIN_EVENT_TABLE( TREE_PROJECT_FRAME, wxSashLayoutWindow )
|
2015-02-28 19:00:48 +00:00
|
|
|
EVT_TREE_ITEM_ACTIVATED( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnSelect )
|
|
|
|
EVT_TREE_ITEM_EXPANDED( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnExpand )
|
|
|
|
EVT_TREE_ITEM_RIGHT_CLICK( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnRight )
|
|
|
|
EVT_MENU( ID_PROJECT_TXTEDIT, TREE_PROJECT_FRAME::OnOpenSelectedFileWithTextEditor )
|
|
|
|
EVT_MENU( ID_PROJECT_NEWDIR, TREE_PROJECT_FRAME::OnCreateNewDirectory )
|
|
|
|
EVT_MENU( ID_PROJECT_DELETE, TREE_PROJECT_FRAME::OnDeleteFile )
|
|
|
|
EVT_MENU( ID_PROJECT_RENAME, TREE_PROJECT_FRAME::OnRenameFile )
|
2010-02-20 13:20:55 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2011-04-17 13:54:17 +00:00
|
|
|
TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
|
2009-02-04 15:25:03 +00:00
|
|
|
wxSashLayoutWindow( parent,
|
|
|
|
ID_LEFT_FRAME,
|
2009-11-18 20:12:11 +00:00
|
|
|
wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
2015-02-28 19:00:48 +00:00
|
|
|
wxNO_BORDER | wxSW_3D | wxTAB_TRAVERSAL )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2009-02-04 15:25:03 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
m_TreeProject = NULL;
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
m_watcher = NULL;
|
2012-12-31 08:12:29 +00:00
|
|
|
Connect( wxEVT_FSWATCHER,
|
|
|
|
wxFileSystemWatcherEventHandler( TREE_PROJECT_FRAME::OnFileSystemEvent ) );
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
/*
|
|
|
|
* Filtering is now inverted: the filters are actually used to _enable_ support
|
|
|
|
* for a given file type.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// NOTE: sch filter must be first because of a test in AddFile() below
|
2012-12-31 08:12:29 +00:00
|
|
|
m_filters.push_back( wxT( "^.*\\.sch$" ) );
|
|
|
|
|
2012-08-29 12:40:09 +00:00
|
|
|
for( int ii = 0; s_allowedExtensionsToList[ii] != NULL; ii++ )
|
2012-12-31 08:12:29 +00:00
|
|
|
m_filters.push_back( s_allowedExtensionsToList[ii] );
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
m_filters.push_back( wxT( "^no KiCad files found" ) );
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
ReCreateTreePrj();
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2011-09-08 05:58:45 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
TREE_PROJECT_FRAME::~TREE_PROJECT_FRAME()
|
2009-05-21 17:42:42 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
delete m_watcher;
|
2009-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
void TREE_PROJECT_FRAME::RemoveFilter( const wxString& filter )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
for( unsigned int i = 0; i < m_filters.size(); i++ )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
if( filter == m_filters[i] )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
m_filters.erase( m_filters.begin() + i );
|
2007-05-28 18:09:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2012-04-16 12:56:01 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnCreateNewDirectory( wxCommandEvent& event )
|
2007-09-13 11:55:46 +00:00
|
|
|
{
|
2012-04-16 12:56:01 +00:00
|
|
|
// Get the root directory name:
|
|
|
|
TREEPROJECT_ITEM* treeData = GetSelectedData();
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( !treeData )
|
|
|
|
return;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
TreeFileType rootType = treeData->GetType();
|
|
|
|
wxTreeItemId root;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( TREE_DIRECTORY == rootType )
|
|
|
|
{
|
|
|
|
root = m_TreeProject->GetSelection();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
root = m_TreeProject->GetItemParent( m_TreeProject->GetSelection() );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( !root.IsOk() )
|
|
|
|
root = m_TreeProject->GetSelection();
|
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString prj_dir = wxPathOnly( m_Parent->GetProjectFileName() );
|
|
|
|
|
2012-04-16 12:56:01 +00:00
|
|
|
// Ask for the new sub directory name
|
|
|
|
wxString curr_dir = treeData->GetDir();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
if( !curr_dir.IsEmpty() ) // A subdir is selected
|
2009-02-04 15:25:03 +00:00
|
|
|
{
|
2014-10-21 16:34:51 +00:00
|
|
|
// Make this subdir name relative to the current path.
|
|
|
|
// It will be more easy to read by the user, in the next dialog
|
|
|
|
wxFileName fn;
|
|
|
|
fn.AssignDir( curr_dir );
|
|
|
|
fn.MakeRelativeTo( prj_dir );
|
|
|
|
curr_dir = fn.GetPath();
|
|
|
|
|
|
|
|
if( !curr_dir.IsEmpty() )
|
|
|
|
curr_dir += wxFileName::GetPathSeparator();
|
2009-02-04 15:25:03 +00:00
|
|
|
}
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString msg = wxString::Format( _( "Current project directory:\n%s" ), GetChars( prj_dir ) );
|
2012-12-31 08:12:29 +00:00
|
|
|
wxString subdir = wxGetTextFromUser( msg, _( "Create New Directory" ), curr_dir );
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2012-04-16 12:56:01 +00:00
|
|
|
if( subdir.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString full_dirname = prj_dir + wxFileName::GetPathSeparator() + subdir;
|
|
|
|
|
|
|
|
if( wxMkdir( full_dirname ) )
|
2013-01-03 19:25:12 +00:00
|
|
|
{
|
2015-07-29 18:06:45 +00:00
|
|
|
// the new itel will be added by the file watcher
|
|
|
|
// AddItemToTreeProject( subdir, root );
|
2013-01-03 19:25:12 +00:00
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
wxString TREE_PROJECT_FRAME::GetFileExt( TreeFileType type )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2007-09-13 11:55:46 +00:00
|
|
|
wxString ext;
|
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
case TREE_PROJECT:
|
|
|
|
ext = ProjectFileExtension;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_SCHEMA:
|
|
|
|
ext = SchematicFileExtension;
|
|
|
|
break;
|
|
|
|
|
2012-04-16 12:56:01 +00:00
|
|
|
case TREE_LEGACY_PCB:
|
2012-12-14 16:54:54 +00:00
|
|
|
ext = LegacyPcbFileExtension;
|
2009-04-05 20:49:15 +00:00
|
|
|
break;
|
|
|
|
|
2012-04-16 12:56:01 +00:00
|
|
|
case TREE_SEXP_PCB:
|
2012-12-14 16:54:54 +00:00
|
|
|
ext = KiCadPcbFileExtension;
|
2012-04-16 12:56:01 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
case TREE_GERBER:
|
|
|
|
ext = GerberFileExtension;
|
|
|
|
break;
|
|
|
|
|
2015-06-24 19:30:35 +00:00
|
|
|
case TREE_HTML:
|
|
|
|
ext = HtmlFileExtension;
|
|
|
|
break;
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
case TREE_PDF:
|
|
|
|
ext = PdfFileExtension;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_TXT:
|
|
|
|
ext = TextFileExtension;
|
2008-11-02 14:54:53 +00:00
|
|
|
break;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
case TREE_NET:
|
|
|
|
ext = NetlistFileExtension;
|
|
|
|
break;
|
2012-02-16 20:03:33 +00:00
|
|
|
|
|
|
|
case TREE_CMP_LINK:
|
|
|
|
ext = ComponentFileExtension;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_REPORT:
|
|
|
|
ext = ReportFileExtension;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_FP_PLACE:
|
|
|
|
ext = FootprintPlaceFileExtension;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_DRILL:
|
|
|
|
ext = DrillFileExtension;
|
|
|
|
break;
|
|
|
|
|
2012-08-29 12:40:09 +00:00
|
|
|
case TREE_SVG:
|
|
|
|
ext = SVGFileExtension;
|
|
|
|
break;
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
case TREE_PAGE_LAYOUT_DESCR:
|
|
|
|
ext = PageLayoutDescrFileExtension;
|
|
|
|
break;
|
|
|
|
|
2014-10-21 16:34:51 +00:00
|
|
|
case TREE_FOOTPRINT_FILE:
|
|
|
|
ext = KiCadFootprintFileExtension;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_SCHEMATIC_LIBFILE:
|
|
|
|
ext = SchematicLibraryFileExtension;
|
|
|
|
break;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
default: // Eliminates unnecessary GCC warning.
|
2009-04-05 20:49:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ext;
|
|
|
|
}
|
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/*
|
|
|
|
* Return the wxFileDialog wildcard string for the selected file type.
|
|
|
|
*/
|
2010-02-19 15:01:32 +00:00
|
|
|
wxString TREE_PROJECT_FRAME::GetFileWildcard( TreeFileType type )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
|
|
|
wxString ext;
|
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
2007-09-13 11:55:46 +00:00
|
|
|
case TREE_PROJECT:
|
2009-04-05 20:49:15 +00:00
|
|
|
ext = ProjectFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_SCHEMA:
|
2009-04-05 20:49:15 +00:00
|
|
|
ext = SchematicFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
|
2012-04-16 12:56:01 +00:00
|
|
|
case TREE_LEGACY_PCB:
|
|
|
|
case TREE_SEXP_PCB:
|
2010-05-17 20:35:46 +00:00
|
|
|
ext = PcbFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_GERBER:
|
2009-04-05 20:49:15 +00:00
|
|
|
ext = GerberFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
|
2015-06-24 19:30:35 +00:00
|
|
|
case TREE_HTML:
|
|
|
|
ext = HtmlFileWildcard;
|
|
|
|
break;
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
case TREE_PDF:
|
2009-04-05 20:49:15 +00:00
|
|
|
ext = PdfFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_TXT:
|
2009-04-05 20:49:15 +00:00
|
|
|
ext = TextFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_NET:
|
2009-04-05 20:49:15 +00:00
|
|
|
ext = NetlistFileWildcard;
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
2012-02-16 20:03:33 +00:00
|
|
|
|
|
|
|
case TREE_CMP_LINK:
|
|
|
|
ext = ComponentFileWildcard;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_REPORT:
|
|
|
|
ext = ReportFileWildcard;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_FP_PLACE:
|
|
|
|
ext = FootprintPlaceFileWildcard;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_DRILL:
|
|
|
|
ext = DrillFileWildcard;
|
|
|
|
break;
|
|
|
|
|
2012-08-29 12:40:09 +00:00
|
|
|
case TREE_SVG:
|
|
|
|
ext = SVGFileWildcard;
|
|
|
|
break;
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
case TREE_PAGE_LAYOUT_DESCR:
|
|
|
|
ext = PageLayoutDescrFileWildcard;
|
|
|
|
break;
|
|
|
|
|
2014-10-21 16:34:51 +00:00
|
|
|
case TREE_FOOTPRINT_FILE:
|
|
|
|
ext = KiCadFootprintLibFileWildcard;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_SCHEMATIC_LIBFILE:
|
|
|
|
ext = SchematicLibraryFileWildcard;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // Eliminates unnecessary GCC warning.
|
2007-09-13 11:55:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ext;
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
bool TREE_PROJECT_FRAME::AddItemToTreeProject( const wxString& aName,
|
|
|
|
wxTreeItemId& aRoot, bool aRecurse )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
wxTreeItemId cellule;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
// Check the file type
|
2012-12-31 08:12:29 +00:00
|
|
|
TreeFileType type = TREE_UNKNOWN;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2010-02-17 17:47:12 +00:00
|
|
|
// Skip not visible files and dirs
|
2012-12-31 08:12:29 +00:00
|
|
|
wxFileName fn( aName );
|
|
|
|
|
2010-02-17 17:47:12 +00:00
|
|
|
// Files/dirs names starting by "." are not visible files under unices.
|
|
|
|
// Skip them also under Windows
|
2012-12-31 08:12:29 +00:00
|
|
|
if( fn.GetName().StartsWith( wxT( "." ) ) )
|
2010-02-17 17:47:12 +00:00
|
|
|
return false;
|
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
if( wxDirExists( aName ) )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2009-02-04 15:25:03 +00:00
|
|
|
type = TREE_DIRECTORY;
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-09-13 11:55:46 +00:00
|
|
|
// Filter
|
2009-02-04 15:25:03 +00:00
|
|
|
wxRegEx reg;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
bool isSchematic = false;
|
|
|
|
bool addFile = false;
|
2012-12-31 08:12:29 +00:00
|
|
|
|
|
|
|
for( unsigned i = 0; i < m_filters.size(); i++ )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
wxCHECK2_MSG( reg.Compile( m_filters[i], wxRE_ICASE ), continue,
|
|
|
|
wxT( "Regular expression " ) + m_filters[i] +
|
2012-06-09 17:00:13 +00:00
|
|
|
wxT( " failed to compile." ) );
|
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
if( reg.Matches( aName ) )
|
2007-09-13 11:55:46 +00:00
|
|
|
{
|
2009-02-04 15:25:03 +00:00
|
|
|
addFile = true;
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( i==0 )
|
|
|
|
isSchematic = true;
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-10-26 21:25:23 +00:00
|
|
|
break;
|
2007-09-13 11:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( !addFile )
|
modified the treeprj so that, instead of recursively scanning and adding
*all* the nested files and directories within the current working directory, it scans the first
level of files and directories. When a user double-clicks on a folder, *then*
the childeren of that directory are added to the wxTreeCtrl. This means that the little
triangle does not appear until the user opens a directory .. but, i think this is
a worthwile price to pay given below.
This prevents (or at least mitigates) memory overflow in the case that kicad starts in root, or,
in my case, it starts in my home directory, where thanks to wine & other sw,
there are far too many directories.
also modified the TreePrjItemData so that it stores the full pathnames in m_FileName,
not paths relative to the CWD. I'm not sure if this is the correct thing to do,
especially with the python interface, so change it back if it is more complicated.
the move and rename commands threw a segfault on my system
(Debian etch, wxWidgets 2.8.7),
and since there are better ways to rename and move files, this functionality
was disabled until somebody can fix it (alas, I don't have time for this now)
2007-12-16 18:44:12 +00:00
|
|
|
return false;
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// only show the schematic if it is a top level schematic. Eeschema
|
2007-09-13 11:55:46 +00:00
|
|
|
// cannot open a schematic and display it properly unless it starts
|
|
|
|
// at the top of the hierarchy. The schematic is top level only if
|
|
|
|
// there is a line in the header saying:
|
|
|
|
// "Sheet 1 "
|
2013-01-03 19:25:12 +00:00
|
|
|
// However if the file has the same name as the project, it is always
|
|
|
|
// shown, because it is expected the root sheet.
|
|
|
|
// (and to fix an issue (under XP but could exist under other OS),
|
|
|
|
// when a .sch file is created, the file
|
|
|
|
// create is sent to the wxFileSystemWatcher, but the file still has 0 byte
|
|
|
|
// so it cannot detected as root sheet
|
|
|
|
// This is an ugly fix.
|
2007-09-13 11:55:46 +00:00
|
|
|
if( isSchematic )
|
|
|
|
{
|
2013-01-03 19:25:12 +00:00
|
|
|
wxString fullFileName = aName.BeforeLast( '.' );
|
|
|
|
wxString rootName;
|
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( m_root );
|
|
|
|
if( itemData )
|
2014-07-07 19:49:14 +00:00
|
|
|
rootName = itemData->GetFileName().BeforeLast( '.' );
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
if( fullFileName != rootName )
|
2007-09-13 11:55:46 +00:00
|
|
|
{
|
2013-01-03 19:25:12 +00:00
|
|
|
char line[128]; // small because we just need a few bytes from the start of a line
|
|
|
|
FILE* fp;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
fullFileName = aName;
|
|
|
|
fp = wxFopen( fullFileName, wxT( "rt" ) );
|
2009-10-26 21:25:23 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
if( fp == NULL )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
addFile = false;
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
// check the first 100 lines for the "Sheet 1" string
|
|
|
|
for( int i = 0; i<100; ++i )
|
2007-09-13 11:55:46 +00:00
|
|
|
{
|
2013-01-03 19:25:12 +00:00
|
|
|
if( !fgets( line, sizeof(line), fp ) )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if( !strncmp( line, "Sheet 1 ", 8 ) )
|
|
|
|
{
|
|
|
|
addFile = true;
|
|
|
|
break;
|
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
}
|
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
fclose( fp );
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
if( !addFile )
|
|
|
|
return false; // it is a non-top-level schematic
|
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
}
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
for( int i = TREE_PROJECT; i < TREE_MAX; i++ )
|
|
|
|
{
|
|
|
|
wxString ext = GetFileExt( (TreeFileType) i );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( ext == wxT( "" ) )
|
|
|
|
continue;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
reg.Compile( wxString::FromAscii( "^.*\\" ) + ext +
|
|
|
|
wxString::FromAscii( "$" ), wxRE_ICASE );
|
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
if( reg.Matches( aName ) )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2007-09-13 11:55:46 +00:00
|
|
|
type = (TreeFileType) i;
|
2007-05-28 18:09:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
// also check to see if it is already there.
|
|
|
|
wxTreeItemIdValue cookie;
|
|
|
|
wxTreeItemId kid = m_TreeProject->GetFirstChild( aRoot, cookie );
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
while( kid.IsOk() )
|
|
|
|
{
|
2010-02-20 13:20:55 +00:00
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( itemData )
|
|
|
|
{
|
2014-07-07 19:49:14 +00:00
|
|
|
if( itemData->GetFileName() == aName )
|
2009-02-04 15:25:03 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
return true; // well, we would have added it, but it is already here!
|
2009-02-04 15:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
kid = m_TreeProject->GetNextChild( aRoot, cookie );
|
2009-02-04 15:25:03 +00:00
|
|
|
}
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2008-11-02 14:54:53 +00:00
|
|
|
// Append the item (only appending the filename not the full path):
|
2012-12-31 08:12:29 +00:00
|
|
|
wxString file = wxFileNameFromPath( aName );
|
2010-02-20 13:20:55 +00:00
|
|
|
cellule = m_TreeProject->AppendItem( aRoot, file );
|
2012-12-31 08:12:29 +00:00
|
|
|
TREEPROJECT_ITEM* data = new TREEPROJECT_ITEM( type, aName, m_TreeProject );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
m_TreeProject->SetItemData( cellule, data );
|
|
|
|
data->SetState( 0 );
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
// Mark root files (files which have the same aName as the project)
|
2014-07-07 19:49:14 +00:00
|
|
|
wxFileName project( m_Parent->GetProjectFileName() );
|
2012-12-31 08:12:29 +00:00
|
|
|
wxFileName currfile( file );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
if( currfile.GetName().CmpNoCase( project.GetName() ) == 0 )
|
2014-07-07 19:49:14 +00:00
|
|
|
data->SetRootFile( true );
|
2007-09-13 11:55:46 +00:00
|
|
|
else
|
2014-07-07 19:49:14 +00:00
|
|
|
data->SetRootFile( false );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
// This section adds dirs and files found in the subdirs
|
|
|
|
// in this case AddFile is recursive, but for the first level only.
|
|
|
|
if( TREE_DIRECTORY == type && aRecurse )
|
2009-02-04 15:25:03 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxDir dir( aName );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( dir.IsOpened() ) // protected dirs will not open properly.
|
2008-05-16 11:38:35 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString dir_filename;
|
|
|
|
|
|
|
|
data->SetPopulated( true );
|
|
|
|
|
|
|
|
if( dir.GetFirst( &dir_filename ) )
|
2009-02-04 15:25:03 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
do // Add name in tree, but do not recurse
|
|
|
|
{
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString path = aName + wxFileName::GetPathSeparator() + dir_filename;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
AddItemToTreeProject( path, cellule, false );
|
|
|
|
} while( dir.GetNext( &dir_filename ) );
|
|
|
|
}
|
2008-05-16 11:38:35 +00:00
|
|
|
}
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
// Sort filenames by alphabetic order
|
2008-05-16 11:38:35 +00:00
|
|
|
m_TreeProject->SortChildren( cellule );
|
2009-02-04 15:25:03 +00:00
|
|
|
}
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
return true;
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
void TREE_PROJECT_FRAME::ReCreateTreePrj()
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
wxTreeItemId rootcellule;
|
|
|
|
bool prjOpened = false;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString pro_dir = m_Parent->GetProjectFileName();
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( !m_TreeProject )
|
2010-02-19 15:01:32 +00:00
|
|
|
m_TreeProject = new TREEPROJECTFILES( this );
|
2007-09-13 11:55:46 +00:00
|
|
|
else
|
|
|
|
m_TreeProject->DeleteAllItems();
|
2007-05-28 18:09:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( !pro_dir ) // This is empty from TREE_PROJECT_FRAME constructor
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxFileName fn = pro_dir;
|
2014-07-07 19:49:14 +00:00
|
|
|
|
|
|
|
if( !fn.IsOk() )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
|
|
|
fn.Clear();
|
2015-09-25 19:38:09 +00:00
|
|
|
fn.SetPath( wxStandardPaths::Get().GetDocumentsDir() );
|
2010-02-24 15:33:03 +00:00
|
|
|
fn.SetName( NAMELESS_PROJECT );
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( ProjectFileExtension );
|
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
prjOpened = fn.FileExists();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
// root tree:
|
2009-04-05 20:49:15 +00:00
|
|
|
m_root = rootcellule = m_TreeProject->AddRoot( fn.GetFullName(),
|
2009-02-04 15:25:03 +00:00
|
|
|
TREE_PROJECT - 1,
|
|
|
|
TREE_PROJECT - 1 );
|
|
|
|
|
2012-01-22 17:20:22 +00:00
|
|
|
m_TreeProject->SetItemBold( rootcellule, true );
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
m_TreeProject->SetItemData( rootcellule,
|
2010-02-20 13:20:55 +00:00
|
|
|
new TREEPROJECT_ITEM( TREE_PROJECT,
|
2013-01-03 19:25:12 +00:00
|
|
|
fn.GetFullPath(),
|
2012-12-31 08:12:29 +00:00
|
|
|
m_TreeProject ) );
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
// Now adding all current files if available
|
|
|
|
if( prjOpened )
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString pro_dir = wxPathOnly( m_Parent->GetProjectFileName() );
|
|
|
|
wxDir dir( pro_dir );
|
2009-02-04 15:25:03 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( dir.IsOpened() ) // protected dirs will not open, see "man opendir()"
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString filename;
|
|
|
|
bool cont = dir.GetFirst( &filename );
|
|
|
|
|
|
|
|
while( cont )
|
|
|
|
{
|
|
|
|
if( filename != fn.GetFullName() )
|
|
|
|
{
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString name = dir.GetName() + wxFileName::GetPathSeparator() + filename;
|
|
|
|
AddItemToTreeProject( name, m_root );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
}
|
2009-10-26 21:25:23 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
cont = dir.GetNext( &filename );
|
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
2012-12-31 08:12:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_TreeProject->AppendItem( m_root, wxT( "Empty project" ) );
|
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
m_TreeProject->Expand( rootcellule );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
// Sort filenames by alphabetic order
|
2007-09-13 11:55:46 +00:00
|
|
|
m_TreeProject->SortChildren( m_root );
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnRight( wxTreeEvent& Event )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
int tree_id;
|
|
|
|
TREEPROJECT_ITEM* tree_data;
|
2014-07-09 00:52:46 +00:00
|
|
|
wxString fullFileName;
|
2012-12-31 08:12:29 +00:00
|
|
|
wxTreeItemId curr_item = Event.GetItem();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
// Ensure item is selected (Under Windows right click does not select the item)
|
2007-09-13 11:55:46 +00:00
|
|
|
m_TreeProject->SelectItem( curr_item );
|
|
|
|
|
|
|
|
tree_data = GetSelectedData();
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( !tree_data )
|
|
|
|
return;
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
tree_id = tree_data->GetType();
|
2014-07-09 00:52:46 +00:00
|
|
|
fullFileName = tree_data->GetFileName();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
wxMenu popupMenu;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
switch( tree_id )
|
2007-09-13 11:55:46 +00:00
|
|
|
{
|
2013-01-03 19:25:12 +00:00
|
|
|
case TREE_PROJECT:
|
|
|
|
AddMenuItem( &popupMenu, ID_PROJECT_NEWDIR,
|
|
|
|
_( "New D&irectory" ),
|
|
|
|
_( "Create a New Directory" ),
|
|
|
|
KiBitmap( directory_xpm ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TREE_DIRECTORY:
|
|
|
|
AddMenuItem( &popupMenu, ID_PROJECT_NEWDIR,
|
|
|
|
_( "New D&irectory" ),
|
|
|
|
_( "Create a New Directory" ),
|
|
|
|
KiBitmap( directory_xpm ) );
|
|
|
|
AddMenuItem( &popupMenu, ID_PROJECT_DELETE,
|
|
|
|
_( "&Delete Directory" ),
|
|
|
|
_( "Delete the Directory and its content" ),
|
|
|
|
KiBitmap( delete_xpm ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
AddMenuItem( &popupMenu, ID_PROJECT_TXTEDIT,
|
|
|
|
_( "&Edit in a text editor" ),
|
|
|
|
_( "Open the file in a Text Editor" ),
|
|
|
|
KiBitmap( icon_txt_xpm ) );
|
|
|
|
AddMenuItem( &popupMenu, ID_PROJECT_RENAME,
|
|
|
|
_( "&Rename file" ),
|
|
|
|
_( "Rename file" ),
|
|
|
|
KiBitmap( right_xpm ) );
|
|
|
|
AddMenuItem( &popupMenu, ID_PROJECT_DELETE,
|
|
|
|
_( "&Delete File" ),
|
|
|
|
_( "Delete the Directory and its content" ),
|
|
|
|
KiBitmap( delete_xpm ) );
|
|
|
|
break;
|
2007-09-13 11:55:46 +00:00
|
|
|
}
|
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
PopupMenu( &popupMenu );
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnOpenSelectedFileWithTextEditor( wxCommandEvent& event )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2010-02-20 13:20:55 +00:00
|
|
|
TREEPROJECT_ITEM* tree_data = GetSelectedData();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
if( !tree_data )
|
|
|
|
return;
|
|
|
|
|
2013-01-03 19:25:12 +00:00
|
|
|
if( tree_data->GetType() == TREE_DIRECTORY )
|
|
|
|
return;
|
|
|
|
|
2014-07-09 00:52:46 +00:00
|
|
|
wxString fullFileName = tree_data->GetFileName();
|
|
|
|
AddDelimiterString( fullFileName );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
wxString editorname = Pgm().GetEditorName();
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( !editorname.IsEmpty() )
|
2014-07-09 00:52:46 +00:00
|
|
|
ExecuteFile( this, editorname, fullFileName );
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnDeleteFile( wxCommandEvent& )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2010-02-20 13:20:55 +00:00
|
|
|
TREEPROJECT_ITEM* tree_data = GetSelectedData();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( !tree_data )
|
|
|
|
return;
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
tree_data->Delete();
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnRenameFile( wxCommandEvent& )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
wxTreeItemId curr_item = m_TreeProject->GetSelection();
|
|
|
|
TREEPROJECT_ITEM* tree_data = GetSelectedData();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( !tree_data )
|
|
|
|
return;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
wxString buffer = m_TreeProject->GetItemText( curr_item );
|
|
|
|
wxString msg = wxString::Format(
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
_( "Change filename: '%s'" ),
|
2014-07-07 19:49:14 +00:00
|
|
|
GetChars( tree_data->GetFileName() ) );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
|
|
|
wxTextEntryDialog dlg( this, msg, _( "Change filename" ), buffer );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
2015-02-28 19:00:48 +00:00
|
|
|
return; // canceled by user
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
buffer = dlg.GetValue();
|
2010-07-21 08:15:54 +00:00
|
|
|
buffer.Trim( true );
|
|
|
|
buffer.Trim( false );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( buffer.IsEmpty() )
|
2012-12-31 08:12:29 +00:00
|
|
|
return; // empty file name not allowed
|
2008-11-02 14:54:53 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( tree_data->Rename( buffer, true ) )
|
|
|
|
m_TreeProject->SetItemText( curr_item, buffer );
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-19 15:01:32 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnSelect( wxTreeEvent& Event )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
TREEPROJECT_ITEM* tree_data = GetSelectedData();
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
if( !tree_data )
|
|
|
|
return;
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
tree_data->Activate( this );
|
2007-09-13 11:55:46 +00:00
|
|
|
}
|
2010-02-20 13:20:55 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
void TREE_PROJECT_FRAME::OnExpand( wxTreeEvent& Event )
|
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
wxTreeItemId itemId = Event.GetItem();
|
|
|
|
TREEPROJECT_ITEM* tree_data = GetItemIdData( itemId );
|
2010-02-20 13:20:55 +00:00
|
|
|
|
|
|
|
if( !tree_data )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( tree_data->GetType() != TREE_DIRECTORY )
|
|
|
|
return;
|
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
// explore list of non populated subdirs, and populate them
|
|
|
|
wxTreeItemIdValue cookie;
|
|
|
|
wxTreeItemId kid = m_TreeProject->GetFirstChild( itemId, cookie );
|
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
bool subdir_populated = false;
|
2015-02-28 19:00:48 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
for( ; kid.IsOk(); kid = m_TreeProject->GetNextChild( itemId, cookie ) )
|
|
|
|
{
|
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
if( !itemData || itemData->GetType() != TREE_DIRECTORY )
|
|
|
|
continue;
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
if( itemData->IsPopulated() )
|
2010-02-20 13:20:55 +00:00
|
|
|
continue;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString fileName = itemData->GetFileName();
|
|
|
|
wxDir dir( fileName );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( dir.IsOpened() )
|
2010-02-20 13:20:55 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString dir_filename;
|
|
|
|
|
|
|
|
if( dir.GetFirst( &dir_filename ) )
|
2010-02-20 13:20:55 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
do // Add name to tree item, but do not recurse in subdirs:
|
|
|
|
{
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString name = fileName + wxFileName::GetPathSeparator() + dir_filename;
|
|
|
|
AddItemToTreeProject( name, kid, false );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
} while( dir.GetNext( &dir_filename ) );
|
|
|
|
}
|
2012-12-31 08:12:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
itemData->SetPopulated( true ); // set state to populated
|
|
|
|
subdir_populated = true;
|
|
|
|
}
|
2010-02-20 13:20:55 +00:00
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
// Sort filenames by alphabetic order
|
2010-02-20 13:20:55 +00:00
|
|
|
m_TreeProject->SortChildren( kid );
|
|
|
|
}
|
2013-01-01 14:06:49 +00:00
|
|
|
|
|
|
|
if( subdir_populated )
|
|
|
|
{
|
|
|
|
#ifndef __WINDOWS__
|
2013-01-02 21:49:56 +00:00
|
|
|
FileWatcherReset();
|
2013-01-01 14:06:49 +00:00
|
|
|
#endif
|
|
|
|
}
|
2010-02-20 13:20:55 +00:00
|
|
|
}
|
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2010-02-20 13:20:55 +00:00
|
|
|
TREEPROJECT_ITEM* TREE_PROJECT_FRAME::GetSelectedData()
|
|
|
|
{
|
2012-12-31 08:12:29 +00:00
|
|
|
return dynamic_cast<TREEPROJECT_ITEM*>( m_TreeProject->GetItemData
|
|
|
|
( m_TreeProject->GetSelection() ) );
|
2010-02-20 13:20:55 +00:00
|
|
|
}
|
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
|
|
|
|
TREEPROJECT_ITEM* TREE_PROJECT_FRAME::GetItemIdData( wxTreeItemId aId )
|
2010-02-20 13:20:55 +00:00
|
|
|
{
|
|
|
|
return dynamic_cast<TREEPROJECT_ITEM*>( m_TreeProject->GetItemData( aId ) );
|
|
|
|
}
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
wxTreeItemId TREE_PROJECT_FRAME::findSubdirTreeItem( const wxString& aSubDir )
|
|
|
|
{
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString prj_dir = wxPathOnly( m_Parent->GetProjectFileName() );
|
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
// If the subdir is the current working directory, return m_root
|
|
|
|
// in main list:
|
2014-10-21 16:34:51 +00:00
|
|
|
if( prj_dir == aSubDir )
|
2012-12-31 08:12:29 +00:00
|
|
|
return m_root;
|
|
|
|
|
|
|
|
// The subdir is in the main tree or in a subdir: Locate it
|
|
|
|
wxTreeItemIdValue cookie;
|
|
|
|
wxTreeItemId root_id = m_root;
|
|
|
|
std::stack < wxTreeItemId > subdirs_id;
|
|
|
|
|
|
|
|
wxTreeItemId kid = m_TreeProject->GetFirstChild( root_id, cookie );
|
2015-02-28 19:00:48 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
while( 1 )
|
|
|
|
{
|
|
|
|
if( ! kid.IsOk() )
|
|
|
|
{
|
|
|
|
if( subdirs_id.empty() ) // all items were explored
|
|
|
|
{
|
|
|
|
root_id = kid; // Not found: return an invalid wxTreeItemId
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
root_id = subdirs_id.top();
|
|
|
|
subdirs_id.pop();
|
|
|
|
kid = m_TreeProject->GetFirstChild( root_id, cookie );
|
|
|
|
if( ! kid.IsOk() )
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
|
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
if( itemData && ( itemData->GetType() == TREE_DIRECTORY ) )
|
2012-12-31 08:12:29 +00:00
|
|
|
{
|
2014-07-07 19:49:14 +00:00
|
|
|
if( itemData->GetFileName() == aSubDir ) // Found!
|
2012-12-31 08:12:29 +00:00
|
|
|
{
|
|
|
|
root_id = kid;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
// kid is a subdir, push in list to explore it later
|
2014-07-07 19:49:14 +00:00
|
|
|
if( itemData->IsPopulated() )
|
2012-12-31 08:12:29 +00:00
|
|
|
subdirs_id.push( kid );
|
|
|
|
}
|
|
|
|
kid = m_TreeProject->GetNextChild( root_id, cookie );
|
|
|
|
}
|
|
|
|
|
|
|
|
return root_id;
|
|
|
|
}
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
|
|
|
|
void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
|
2012-12-31 08:12:29 +00:00
|
|
|
{
|
2013-01-02 21:49:56 +00:00
|
|
|
wxFileName pathModified = event.GetPath();
|
|
|
|
wxString subdir = pathModified.GetPath();
|
|
|
|
wxString fn = pathModified.GetFullPath();
|
2012-12-31 08:12:29 +00:00
|
|
|
|
|
|
|
switch( event.GetChangeType() )
|
|
|
|
{
|
|
|
|
case wxFSW_EVENT_DELETE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxFSW_EVENT_CREATE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxFSW_EVENT_RENAME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxFSW_EVENT_MODIFY:
|
|
|
|
case wxFSW_EVENT_ACCESS:
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxTreeItemId root_id = findSubdirTreeItem( subdir );
|
2014-10-21 16:34:51 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
if( !root_id.IsOk() )
|
|
|
|
return;
|
2010-02-20 13:20:55 +00:00
|
|
|
|
2013-01-02 21:49:56 +00:00
|
|
|
wxTreeItemIdValue cookie; // dummy variable needed by GetFirstChild()
|
|
|
|
wxTreeItemId kid = m_TreeProject->GetFirstChild( root_id, cookie );
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2013-01-02 21:49:56 +00:00
|
|
|
switch( event.GetChangeType() )
|
2012-12-31 08:12:29 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
case wxFSW_EVENT_CREATE:
|
|
|
|
AddItemToTreeProject( pathModified.GetFullPath(), root_id, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxFSW_EVENT_DELETE:
|
|
|
|
while( kid.IsOk() )
|
|
|
|
{
|
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
|
|
|
|
|
|
|
|
if( itemData && itemData->GetFileName() == fn )
|
|
|
|
{
|
|
|
|
m_TreeProject->Delete( kid );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
kid = m_TreeProject->GetNextChild( root_id, cookie );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxFSW_EVENT_RENAME :
|
|
|
|
{
|
|
|
|
wxFileName newpath = event.GetNewPath();
|
|
|
|
wxString newfn = newpath.GetFullPath();
|
2012-12-31 08:12:29 +00:00
|
|
|
|
2013-01-02 21:49:56 +00:00
|
|
|
while( kid.IsOk() )
|
2012-12-31 08:12:29 +00:00
|
|
|
{
|
2013-01-02 21:49:56 +00:00
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
if( itemData && itemData->GetFileName() == fn )
|
2012-12-31 08:12:29 +00:00
|
|
|
{
|
2013-01-02 21:49:56 +00:00
|
|
|
m_TreeProject->Delete( kid );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
break;
|
2012-12-31 08:12:29 +00:00
|
|
|
}
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2013-01-02 21:49:56 +00:00
|
|
|
kid = m_TreeProject->GetNextChild( root_id, cookie );
|
2012-12-31 08:12:29 +00:00
|
|
|
}
|
2013-01-02 21:49:56 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
AddItemToTreeProject( newfn, root_id, false );
|
|
|
|
}
|
|
|
|
break;
|
2012-12-31 08:12:29 +00:00
|
|
|
}
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
// Sort filenames by alphabetic order
|
2012-12-31 08:12:29 +00:00
|
|
|
m_TreeProject->SortChildren( root_id );
|
|
|
|
}
|
|
|
|
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
void TREE_PROJECT_FRAME::FileWatcherReset()
|
|
|
|
{
|
|
|
|
// Prepare file watcher:
|
|
|
|
delete m_watcher;
|
|
|
|
m_watcher = new wxFileSystemWatcher();
|
|
|
|
m_watcher->SetOwner( this );
|
|
|
|
|
|
|
|
// Add directories which should be monitored.
|
2013-01-01 14:06:49 +00:00
|
|
|
// under windows, we add the curr dir and all subdirs
|
|
|
|
// under unix, we add only the curr dir and the populated subdirs
|
2012-12-31 08:12:29 +00:00
|
|
|
// see http://docs.wxwidgets.org/trunk/classwx_file_system_watcher.htm
|
|
|
|
// under unix, the file watcher needs more work to be efficient
|
2013-01-01 14:06:49 +00:00
|
|
|
// moreover, under wxWidgets 2.9.4, AddTree does not work properly.
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
// We can see wxString under a debugger, not a wxFileName
|
2014-10-21 16:34:51 +00:00
|
|
|
wxString prj_dir = wxPathOnly( m_Parent->GetProjectFileName() );
|
|
|
|
wxFileName fn;
|
|
|
|
fn.AssignDir( prj_dir );
|
|
|
|
fn.DontFollowLink();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2012-12-31 08:12:29 +00:00
|
|
|
#ifdef __WINDOWS__
|
2014-10-21 16:34:51 +00:00
|
|
|
m_watcher->AddTree( fn );
|
2012-12-31 08:12:29 +00:00
|
|
|
#else
|
2014-10-21 16:34:51 +00:00
|
|
|
m_watcher->Add( fn );
|
2013-01-01 14:06:49 +00:00
|
|
|
|
|
|
|
// Add subdirs
|
|
|
|
wxTreeItemIdValue cookie;
|
|
|
|
wxTreeItemId root_id = m_root;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
std::stack < wxTreeItemId > subdirs_id;
|
|
|
|
|
|
|
|
wxTreeItemId kid = m_TreeProject->GetFirstChild( root_id, cookie );
|
2015-02-28 19:00:48 +00:00
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
while( 1 )
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( !kid.IsOk() )
|
2013-01-01 14:06:49 +00:00
|
|
|
{
|
|
|
|
if( subdirs_id.empty() ) // all items were explored
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
root_id = subdirs_id.top();
|
|
|
|
subdirs_id.pop();
|
|
|
|
kid = m_TreeProject->GetFirstChild( root_id, cookie );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( !kid.IsOk() )
|
2013-01-01 14:06:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( itemData && itemData->GetType() == TREE_DIRECTORY )
|
2013-01-01 14:06:49 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
// we can see wxString under a debugger, not a wxFileName
|
|
|
|
wxString path = itemData->GetFileName();
|
2013-01-01 14:06:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
DBG(printf( "%s: add '%s'\n", __func__, TO_UTF8( path ) );)
|
|
|
|
|
|
|
|
if( wxFileName::IsDirReadable( path ) ) // linux whines about watching protected dir
|
|
|
|
{
|
2014-10-21 16:34:51 +00:00
|
|
|
fn.AssignDir( path );
|
|
|
|
m_watcher->Add( fn );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
// if kid is a subdir, push in list to explore it later
|
|
|
|
if( itemData->IsPopulated() && m_TreeProject->GetChildrenCount( kid ) )
|
|
|
|
subdirs_id.push( kid );
|
|
|
|
}
|
2013-01-01 14:06:49 +00:00
|
|
|
}
|
2014-07-07 19:49:14 +00:00
|
|
|
|
2013-01-01 14:06:49 +00:00
|
|
|
kid = m_TreeProject->GetNextChild( root_id, cookie );
|
|
|
|
}
|
2012-12-31 08:12:29 +00:00
|
|
|
#endif
|
2013-01-01 14:06:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
#if defined(DEBUG) && 1
|
2013-01-01 14:06:49 +00:00
|
|
|
wxArrayString paths;
|
|
|
|
m_watcher->GetWatchedPaths( &paths );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
printf( "%s: watched paths:\n", __func__ );
|
2013-01-01 14:06:49 +00:00
|
|
|
for( unsigned ii = 0; ii < paths.GetCount(); ii++ )
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
printf( " %s\n", TO_UTF8( paths[ii] ) );
|
2013-01-01 14:06:49 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void KICAD_MANAGER_FRAME::OnChangeWatchedPaths(wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
m_LeftWin->FileWatcherReset();
|
2012-12-31 08:12:29 +00:00
|
|
|
}
|