Cleanup, commenting, etc.
This commit is contained in:
parent
c29a0b1966
commit
10abc6097f
|
@ -35,15 +35,13 @@
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
#include <dialogs/dialog_global_sym_lib_table_config.h>
|
#include <dialogs/dialog_global_sym_lib_table_config.h>
|
||||||
#include <dialogs/panel_sym_lib_table.h>
|
#include <dialogs/panel_sym_lib_table.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
#include <sim/sim_plot_frame.h>
|
#include <sim/sim_plot_frame.h>
|
||||||
#include <kiface_ids.h>
|
#include <sexpr/sexpr.h>
|
||||||
#include <../libs/sexpr/include/sexpr/sexpr.h>
|
#include <sexpr/sexpr_parser.h>
|
||||||
#include <../libs/sexpr/include/sexpr/sexpr_parser.h>
|
|
||||||
|
|
||||||
// The main sheet of the project
|
// The main sheet of the project
|
||||||
SCH_SHEET* g_RootSheet = NULL;
|
SCH_SHEET* g_RootSheet = NULL;
|
||||||
|
@ -115,13 +113,10 @@ static struct IFACE : public KIFACE_I
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IfaceOrAddress
|
* Function IfaceOrAddress
|
||||||
* return a pointer to the requested object. The safest way to use this
|
* return a pointer to the requested object. The safest way to use this is to retrieve
|
||||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
* a pointer to a static instance of an interface, similar to how the KIFACE interface
|
||||||
* how the KIFACE interface is exported. But if you know what you are doing
|
* is exported. But if you know what you are doing use it to retrieve anything you want.
|
||||||
* use it to retrieve anything you want.
|
|
||||||
*
|
|
||||||
* @param aDataId identifies which object you want the address of.
|
* @param aDataId identifies which object you want the address of.
|
||||||
*
|
|
||||||
* @return void* - and must be cast into the know type.
|
* @return void* - and must be cast into the know type.
|
||||||
*/
|
*/
|
||||||
void* IfaceOrAddress( int aDataId ) override
|
void* IfaceOrAddress( int aDataId ) override
|
||||||
|
@ -179,8 +174,7 @@ COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
|
||||||
void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer )
|
void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer )
|
||||||
{
|
{
|
||||||
// Do not allow non-background layers to be completely white.
|
// Do not allow non-background layers to be completely white.
|
||||||
// This ensures the BW printing recognizes that the colors should be
|
// This ensures the BW printing recognizes that the colors should be printed black.
|
||||||
// printed black.
|
|
||||||
if( aColor == COLOR4D::WHITE && aLayer != LAYER_SCHEMATIC_BACKGROUND )
|
if( aColor == COLOR4D::WHITE && aLayer != LAYER_SCHEMATIC_BACKGROUND )
|
||||||
aColor.Darken( 0.01 );
|
aColor.Darken( 0.01 );
|
||||||
|
|
||||||
|
@ -246,14 +240,12 @@ static PARAM_CFG_ARRAY& cfg_params()
|
||||||
|
|
||||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||||
{
|
{
|
||||||
// This is process level, not project level, initialization of the DSO.
|
// This is process-level-initialization, not project-level-initialization of the DSO.
|
||||||
|
|
||||||
// Do nothing in here pertinent to a project!
|
// Do nothing in here pertinent to a project!
|
||||||
|
|
||||||
start_common( aCtlBits );
|
start_common( aCtlBits );
|
||||||
|
|
||||||
// Give a default colour for all layers
|
// Give a default colour for all layers (actual color will be initialized by config)
|
||||||
// (actual color will be initialized by config)
|
|
||||||
for( SCH_LAYER_ID ii = SCH_LAYER_ID_START; ii < SCH_LAYER_ID_END; ++ii )
|
for( SCH_LAYER_ID ii = SCH_LAYER_ID_START; ii < SCH_LAYER_ID_END; ++ii )
|
||||||
SetLayerColor( COLOR4D( DARKGRAY ), ii );
|
SetLayerColor( COLOR4D( DARKGRAY ), ii );
|
||||||
|
|
||||||
|
@ -336,14 +328,21 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
||||||
if( destFile.GetName() == aProjectName )
|
if( destFile.GetName() == aProjectName )
|
||||||
destFile.SetName( aNewProjectName );
|
destFile.SetName( aNewProjectName );
|
||||||
|
|
||||||
// JEY TODO: need to update at least sheet-paths...
|
// Sheet paths when auto-generated are relative to the root, so those will stay
|
||||||
|
// pointing to whatever they were pointing at.
|
||||||
|
// The author can create their own absolute and relative sheet paths. Absolute
|
||||||
|
// sheet paths aren't an issue, and relative ones will continue to work as long
|
||||||
|
// as the author didn't include any '..'s. If they did, it's still not clear
|
||||||
|
// whether they should be adjusted or not (as the author may be duplicating an
|
||||||
|
// entire tree with several projects within it), so we leave this as an exercise
|
||||||
|
// to the author.
|
||||||
|
|
||||||
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||||
}
|
}
|
||||||
else if( ext == "sym" )
|
else if( ext == "sym" )
|
||||||
{
|
{
|
||||||
// Symbols are not project-specific. Keep their source names.
|
// Symbols are not project-specific. Keep their source names.
|
||||||
wxCopyFile( aSrcFilePath, destFile.GetFullPath() );
|
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||||
}
|
}
|
||||||
else if( ext == "lib" )
|
else if( ext == "lib" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,13 +80,10 @@ static struct IFACE : public KIFACE_I
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IfaceOrAddress
|
* Function IfaceOrAddress
|
||||||
* return a pointer to the requested object. The safest way to use this
|
* return a pointer to the requested object. The safest way to use this is to retrieve
|
||||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
* a pointer to a static instance of an interface, similar to how the KIFACE interface
|
||||||
* how the KIFACE interface is exported. But if you know what you are doing
|
* is exported. But if you know what you are doing use it to retrieve anything you want.
|
||||||
* use it to retrieve anything you want.
|
|
||||||
*
|
|
||||||
* @param aDataId identifies which object you want the address of.
|
* @param aDataId identifies which object you want the address of.
|
||||||
*
|
|
||||||
* @return void* - and must be cast into the know type.
|
* @return void* - and must be cast into the know type.
|
||||||
*/
|
*/
|
||||||
void* IfaceOrAddress( int aDataId ) override
|
void* IfaceOrAddress( int aDataId ) override
|
||||||
|
@ -144,7 +141,7 @@ void IFACE::OnKifaceEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBV::IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
|
void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
|
||||||
const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
|
const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
|
||||||
const wxString& aSrcFilePath, wxString& aErrors )
|
const wxString& aSrcFilePath, wxString& aErrors )
|
||||||
{
|
{
|
||||||
|
@ -168,7 +165,7 @@ void GERBV::IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString&
|
||||||
destFile.SetName( destFileName );
|
destFile.SetName( destFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCopyFile( aSrcFilePath, destFile.GetFullPath() );
|
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||||
}
|
}
|
||||||
else if( ext == "gbrjob" )
|
else if( ext == "gbrjob" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,13 +131,10 @@ static struct IFACE : public KIFACE_I
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IfaceOrAddress
|
* Function IfaceOrAddress
|
||||||
* return a pointer to the requested object. The safest way to use this
|
* return a pointer to the requested object. The safest way to use this is to retrieve
|
||||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
* a pointer to a static instance of an interface, similar to how the KIFACE interface
|
||||||
* how the KIFACE interface is exported. But if you know what you are doing
|
* is exported. But if you know what you are doing use it to retrieve anything you want.
|
||||||
* use it to retrieve anything you want.
|
|
||||||
*
|
|
||||||
* @param aDataId identifies which object you want the address of.
|
* @param aDataId identifies which object you want the address of.
|
||||||
*
|
|
||||||
* @return void* - and must be cast into the know type.
|
* @return void* - and must be cast into the know type.
|
||||||
*/
|
*/
|
||||||
void* IfaceOrAddress( int aDataId ) override
|
void* IfaceOrAddress( int aDataId ) override
|
||||||
|
@ -199,8 +196,7 @@ PGM_BASE& Pgm()
|
||||||
return *process;
|
return *process;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face
|
// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
|
||||||
// is run from a python script, mot from a Kicad application
|
|
||||||
PGM_BASE* PgmOrNull()
|
PGM_BASE* PgmOrNull()
|
||||||
{
|
{
|
||||||
return process;
|
return process;
|
||||||
|
@ -292,17 +288,15 @@ static bool scriptingSetup()
|
||||||
void PythonPluginsReloadBase()
|
void PythonPluginsReloadBase()
|
||||||
{
|
{
|
||||||
#if defined( KICAD_SCRIPTING )
|
#if defined( KICAD_SCRIPTING )
|
||||||
// Reload plugin list: reload Python plugins if they are newer than
|
// Reload plugin list: reload Python plugins if they are newer than the already loaded,
|
||||||
// the already loaded, and load new plugins
|
// and load new plugins
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
|
|
||||||
snprintf( cmd, sizeof( cmd ),
|
snprintf( cmd, sizeof( cmd ), "pcbnew.LoadPlugins(\"%s\")", TO_UTF8( PyScriptingPath() ) );
|
||||||
"pcbnew.LoadPlugins(\"%s\")", TO_UTF8( PyScriptingPath() ) );
|
|
||||||
|
|
||||||
PyLOCK lock;
|
PyLOCK lock;
|
||||||
|
|
||||||
// ReRun the Python method pcbnew.LoadPlugins
|
// ReRun the Python method pcbnew.LoadPlugins (already called when starting Pcbnew)
|
||||||
// (already called when starting Pcbnew)
|
|
||||||
int retv = PyRun_SimpleString( cmd );
|
int retv = PyRun_SimpleString( cmd );
|
||||||
|
|
||||||
if( retv != 0 )
|
if( retv != 0 )
|
||||||
|
@ -325,8 +319,7 @@ FOOTPRINT_LIST_IMPL GFootprintList;
|
||||||
|
|
||||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||||
{
|
{
|
||||||
// This is process level, not project level, initialization of the DSO.
|
// This is process-level-initialization, not project-level-initialization of the DSO.
|
||||||
|
|
||||||
// Do nothing in here pertinent to a project!
|
// Do nothing in here pertinent to a project!
|
||||||
|
|
||||||
start_common( aCtlBits );
|
start_common( aCtlBits );
|
||||||
|
@ -405,8 +398,6 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
|
||||||
if( destFile.GetName() == aSrcProjectName )
|
if( destFile.GetName() == aSrcProjectName )
|
||||||
destFile.SetName( aNewProjectName );
|
destFile.SetName( aNewProjectName );
|
||||||
|
|
||||||
// JEY TODO: are there filepaths in a PCB file that need updating?
|
|
||||||
|
|
||||||
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||||
}
|
}
|
||||||
else if( ext == "brd" )
|
else if( ext == "brd" )
|
||||||
|
@ -414,8 +405,6 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
|
||||||
if( destFile.GetName() == aSrcProjectName )
|
if( destFile.GetName() == aSrcProjectName )
|
||||||
destFile.SetName( aNewProjectName );
|
destFile.SetName( aNewProjectName );
|
||||||
|
|
||||||
// JEY TODO: are there filepaths in a legacy PCB file that need updating?
|
|
||||||
|
|
||||||
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||||
}
|
}
|
||||||
else if( ext == "mod" || ext == "kicad_mod" )
|
else if( ext == "mod" || ext == "kicad_mod" )
|
||||||
|
|
Loading…
Reference in New Issue