Eeschema: implement s-expression schematic file formatter.
Please note that the symbol cache is not embedded in the schematic file to allow for round robin testing with the existing file format. Once the parser round robin testing is complete, the symbol cache will be embedded in the schematic file.
This commit is contained in:
parent
cee973dc04
commit
7dc64f08b7
|
@ -121,7 +121,8 @@ const std::string SchematicLibraryFileExtension( "lib" );
|
||||||
const std::string VrmlFileExtension( "wrl" );
|
const std::string VrmlFileExtension( "wrl" );
|
||||||
|
|
||||||
const std::string ProjectFileExtension( "pro" );
|
const std::string ProjectFileExtension( "pro" );
|
||||||
const std::string SchematicFileExtension( "sch" );
|
const std::string LegacySchematicFileExtension( "sch" );
|
||||||
|
const std::string KiCadSchematicFileExtension( "kicad_sch" );
|
||||||
const std::string NetlistFileExtension( "net" );
|
const std::string NetlistFileExtension( "net" );
|
||||||
const std::string ComponentFileExtension( "cmp" );
|
const std::string ComponentFileExtension( "cmp" );
|
||||||
const std::string GerberFileExtension( "gbr" );
|
const std::string GerberFileExtension( "gbr" );
|
||||||
|
@ -191,9 +192,15 @@ wxString ProjectFileWildcard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString SchematicFileWildcard()
|
wxString LegacySchematicFileWildcard()
|
||||||
{
|
{
|
||||||
return _( "KiCad schematic files" ) + AddFileExtListToFilter( { "sch" } );
|
return _( "KiCad legacy schematic files" ) + AddFileExtListToFilter( { "sch" } );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString KiCadSchematicFileWildcard()
|
||||||
|
{
|
||||||
|
return _( "KiCad s-expression schematic files" ) + AddFileExtListToFilter( { "kicad_sch" } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -491,9 +491,9 @@ make_lexer(
|
||||||
|
|
||||||
make_lexer(
|
make_lexer(
|
||||||
eeschema_kiface_objects
|
eeschema_kiface_objects
|
||||||
symbol_lib.keywords
|
schematic.keywords
|
||||||
symbol_lib_lexer.h
|
schematic_lexer.h
|
||||||
symbol_lib_keywords.cpp
|
schematic_keywords.cpp
|
||||||
TSYMBOL_LIB_T
|
TSYMBOL_LIB_T
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2014-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2014-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -247,7 +247,7 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
|
||||||
// Relative file names are relative to the path of the current sheet. This allows for
|
// Relative file names are relative to the path of the current sheet. This allows for
|
||||||
// nesting of schematic files in subfolders.
|
// nesting of schematic files in subfolders.
|
||||||
wxFileName fileName( newRelativeNativeFilename );
|
wxFileName fileName( newRelativeNativeFilename );
|
||||||
fileName.SetExt( SchematicFileExtension );
|
fileName.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
if( !fileName.IsAbsolute() )
|
if( !fileName.IsAbsolute() )
|
||||||
{
|
{
|
||||||
|
@ -416,7 +416,7 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName nativeFileName( newRelativeNativeFilename );
|
wxFileName nativeFileName( newRelativeNativeFilename );
|
||||||
nativeFileName.SetExt( SchematicFileExtension );
|
nativeFileName.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
if( useScreen )
|
if( useScreen )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -127,8 +127,8 @@ void FIELDS_GRID_TABLE<T>::initGrid( DIALOG_SHIM* aDialog )
|
||||||
|
|
||||||
m_curdir = m_frame->Prj().GetProjectPath();
|
m_curdir = m_frame->Prj().GetProjectPath();
|
||||||
m_filepathAttr = new wxGridCellAttr;
|
m_filepathAttr = new wxGridCellAttr;
|
||||||
GRID_CELL_PATH_EDITOR* filepathEditor = new GRID_CELL_PATH_EDITOR( aDialog, &m_curdir,
|
GRID_CELL_PATH_EDITOR* filepathEditor =
|
||||||
SchematicFileExtension );
|
new GRID_CELL_PATH_EDITOR( aDialog, &m_curdir, LegacySchematicFileExtension );
|
||||||
filepathEditor->SetValidator( m_filepathValidator );
|
filepathEditor->SetValidator( m_filepathValidator );
|
||||||
m_filepathAttr->SetEditor( filepathEditor );
|
m_filepathAttr->SetEditor( filepathEditor );
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2013 CERN (www.cern.ch)
|
* Copyright (C) 2013 CERN (www.cern.ch)
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -72,8 +72,12 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
|
||||||
|
|
||||||
if( aSaveUnderNewName )
|
if( aSaveUnderNewName )
|
||||||
{
|
{
|
||||||
|
wxString wildcards = LegacySchematicFileWildcard();
|
||||||
|
|
||||||
|
wildcards += "|" + KiCadSchematicFileWildcard();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Schematic Files" ), wxPathOnly( Prj().GetProjectFullName() ),
|
wxFileDialog dlg( this, _( "Schematic Files" ), wxPathOnly( Prj().GetProjectFullName() ),
|
||||||
schematicFileName.GetFullName(), SchematicFileWildcard(),
|
schematicFileName.GetFullName(), wildcards,
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
@ -81,8 +85,12 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
|
||||||
|
|
||||||
schematicFileName = dlg.GetPath();
|
schematicFileName = dlg.GetPath();
|
||||||
|
|
||||||
if( schematicFileName.GetExt() != SchematicFileExtension )
|
if( dlg.GetFilterIndex() == 0
|
||||||
schematicFileName.SetExt( SchematicFileExtension );
|
&& schematicFileName.GetExt() != LegacySchematicFileExtension )
|
||||||
|
schematicFileName.SetExt( LegacySchematicFileExtension );
|
||||||
|
else if( dlg.GetFilterIndex() == 1
|
||||||
|
&& schematicFileName.GetExt() != KiCadSchematicFileExtension )
|
||||||
|
schematicFileName.SetExt( KiCadSchematicFileExtension );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !IsWritable( schematicFileName ) )
|
if( !IsWritable( schematicFileName ) )
|
||||||
|
@ -111,7 +119,9 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
|
||||||
wxLogTrace( traceAutoSave,
|
wxLogTrace( traceAutoSave,
|
||||||
wxT( "Saving file <" ) + schematicFileName.GetFullPath() + wxT( ">" ) );
|
wxT( "Saving file <" ) + schematicFileName.GetFullPath() + wxT( ">" ) );
|
||||||
|
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromSchPath(
|
||||||
|
schematicFileName.GetFullPath() );
|
||||||
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -446,7 +456,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
||||||
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Append Schematic" ), path, wxEmptyString,
|
wxFileDialog dlg( this, _( "Append Schematic" ), path, wxEmptyString,
|
||||||
SchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
LegacySchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return false;
|
return false;
|
||||||
|
@ -652,7 +662,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
projectpath = Kiway().Prj().GetProjectPath();
|
projectpath = Kiway().Prj().GetProjectPath();
|
||||||
newfilename.SetPath( Prj().GetProjectPath() );
|
newfilename.SetPath( Prj().GetProjectPath() );
|
||||||
newfilename.SetName( Prj().GetProjectName() );
|
newfilename.SetName( Prj().GetProjectName() );
|
||||||
newfilename.SetExt( SchematicFileExtension );
|
newfilename.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
g_CurrentSheet->clear();
|
g_CurrentSheet->clear();
|
||||||
g_CurrentSheet->push_back( g_RootSheet );
|
g_CurrentSheet->push_back( g_RootSheet );
|
||||||
|
|
|
@ -751,14 +751,14 @@ void SCH_EDIT_FRAME::NewProject()
|
||||||
{
|
{
|
||||||
wxString pro_dir = m_mruPath;
|
wxString pro_dir = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString, SchematicFileWildcard(),
|
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
|
||||||
wxFD_SAVE );
|
LegacySchematicFileWildcard(), wxFD_SAVE );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_CANCEL )
|
if( dlg.ShowModal() != wxID_CANCEL )
|
||||||
{
|
{
|
||||||
// Enforce the extension, wxFileDialog is inept.
|
// Enforce the extension, wxFileDialog is inept.
|
||||||
wxFileName create_me = dlg.GetPath();
|
wxFileName create_me = dlg.GetPath();
|
||||||
create_me.SetExt( SchematicFileExtension );
|
create_me.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
if( create_me.FileExists() )
|
if( create_me.FileExists() )
|
||||||
{
|
{
|
||||||
|
@ -781,8 +781,8 @@ void SCH_EDIT_FRAME::LoadProject()
|
||||||
{
|
{
|
||||||
wxString pro_dir = m_mruPath;
|
wxString pro_dir = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString, SchematicFileWildcard(),
|
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString,
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
LegacySchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_CANCEL )
|
if( dlg.ShowModal() != wxID_CANCEL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,5 +28,13 @@
|
||||||
* YYYYMMDD format. Comment the changes to the file format for historical purposes.
|
* YYYYMMDD format. Comment the changes to the file format for historical purposes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Symbol library file version.
|
||||||
|
*/
|
||||||
#define SEXPR_SYMBOL_LIB_FILE_VERSION 20200126 // Initial version.
|
#define SEXPR_SYMBOL_LIB_FILE_VERSION 20200126 // Initial version.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Symbol library file version.
|
||||||
|
*/
|
||||||
|
#define SEXPR_SCHEMATIC_FILE_VERSION 20200310 // Initial version.
|
||||||
|
|
|
@ -166,6 +166,24 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::GuessPluginTypeFromLibPath( const wxString& a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::GuessPluginTypeFromSchPath( const wxString& aSchematicPath )
|
||||||
|
{
|
||||||
|
SCH_FILE_T ret = SCH_LEGACY; // default guess, unless detected otherwise.
|
||||||
|
wxFileName fn( aSchematicPath );
|
||||||
|
|
||||||
|
if( fn.GetExt() == LegacySchematicFileExtension )
|
||||||
|
{
|
||||||
|
ret = SCH_LEGACY;
|
||||||
|
}
|
||||||
|
else if( fn.GetExt() == KiCadSchematicFileExtension )
|
||||||
|
{
|
||||||
|
ret = SCH_KICAD;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_IO_MGR::Load( SCH_FILE_T aFileType, const wxString& aFileName, KIWAY* aKiway,
|
SCH_SHEET* SCH_IO_MGR::Load( SCH_FILE_T aFileType, const wxString& aFileName, KIWAY* aKiway,
|
||||||
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
SCH_SHEET* aAppendToMe, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,10 +114,15 @@ public:
|
||||||
static const wxString GetLibraryFileExtension( SCH_FILE_T aFileType );
|
static const wxString GetLibraryFileExtension( SCH_FILE_T aFileType );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a plugin type given a footprint library's libPath.
|
* Return a plugin type given a symbol library using the file extension of \a aLibPath.
|
||||||
*/
|
*/
|
||||||
static SCH_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath );
|
static SCH_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a plugin type given a schematic using the file extension of \a aSchematicPath.
|
||||||
|
*/
|
||||||
|
static SCH_FILE_T GuessPluginTypeFromSchPath( const wxString& aSchematicPath );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the requested #SCH_PLUGIN and if found, calls the SCH_PLUGIN->Load(..) function
|
* Load the requested #SCH_PLUGIN and if found, calls the SCH_PLUGIN->Load(..) function
|
||||||
* on it using the arguments passed to this function. After the SCH_PLUGIN->Load()
|
* on it using the arguments passed to this function. After the SCH_PLUGIN->Load()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -810,3 +810,14 @@ bool SCH_LINE::IsGraphicLine() const
|
||||||
{
|
{
|
||||||
return ( GetLayer() == LAYER_NOTES );
|
return ( GetLayer() == LAYER_NOTES );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_LINE::UsesDefaultStroke() const
|
||||||
|
{
|
||||||
|
if( ( m_size == GetDefaultWidth() || m_size == 0 )
|
||||||
|
&& ( m_style == GetDefaultStyle() || m_style == PLOT_DASH_TYPE::DEFAULT )
|
||||||
|
&& ( m_color == COLOR4D::UNSPECIFIED ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -42,7 +42,7 @@ class SCH_LINE : public SCH_ITEM
|
||||||
wxPoint m_start; ///< Line start point
|
wxPoint m_start; ///< Line start point
|
||||||
wxPoint m_end; ///< Line end point
|
wxPoint m_end; ///< Line end point
|
||||||
int m_size; ///< Line pensize
|
int m_size; ///< Line pensize
|
||||||
PLOT_DASH_TYPE m_style; ///< Line style
|
PLOT_DASH_TYPE m_style; ///< Line style
|
||||||
COLOR4D m_color; ///< Line color
|
COLOR4D m_color; ///< Line color
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -125,6 +125,15 @@ public:
|
||||||
|
|
||||||
void SetLineWidth( const int aSize );
|
void SetLineWidth( const int aSize );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if the #SCH_LINE object uses the default stroke settings.
|
||||||
|
*
|
||||||
|
* The stroke settings include the line width, style, and color.
|
||||||
|
*
|
||||||
|
* @return True if the #SCH_LINE object uses the default stroke settings.
|
||||||
|
*/
|
||||||
|
bool UsesDefaultStroke() const;
|
||||||
|
|
||||||
int GetLineSize() const { return m_size; }
|
int GetLineSize() const { return m_size; }
|
||||||
|
|
||||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
@ -132,7 +141,6 @@ public:
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetLength
|
|
||||||
* @return The length of the line segment.
|
* @return The length of the line segment.
|
||||||
*/
|
*/
|
||||||
double GetLength() const;
|
double GetLength() const;
|
||||||
|
|
|
@ -47,7 +47,7 @@ using namespace TSYMBOL_LIB_T;
|
||||||
|
|
||||||
|
|
||||||
SCH_SEXPR_PARSER::SCH_SEXPR_PARSER( LINE_READER* aLineReader ) :
|
SCH_SEXPR_PARSER::SCH_SEXPR_PARSER( LINE_READER* aLineReader ) :
|
||||||
SYMBOL_LIB_LEXER( aLineReader ),
|
SCHEMATIC_LEXER( aLineReader ),
|
||||||
m_requiredVersion( 0 ),
|
m_requiredVersion( 0 ),
|
||||||
m_unit( 1 ),
|
m_unit( 1 ),
|
||||||
m_convert( 1 )
|
m_convert( 1 )
|
||||||
|
@ -715,9 +715,9 @@ LIB_ARC* SCH_SEXPR_PARSER::parseArc()
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc token." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc token." ) );
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxPoint start;
|
wxPoint startPoint;
|
||||||
wxPoint mid;
|
wxPoint midPoint;
|
||||||
wxPoint end;
|
wxPoint endPoint;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
bool hasMidPoint = false;
|
bool hasMidPoint = false;
|
||||||
std::unique_ptr<LIB_ARC> arc( new LIB_ARC( nullptr ) );
|
std::unique_ptr<LIB_ARC> arc( new LIB_ARC( nullptr ) );
|
||||||
|
@ -735,18 +735,18 @@ LIB_ARC* SCH_SEXPR_PARSER::parseArc()
|
||||||
switch( token )
|
switch( token )
|
||||||
{
|
{
|
||||||
case T_start:
|
case T_start:
|
||||||
start = parseXY();
|
startPoint = parseXY();
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_mid:
|
case T_mid:
|
||||||
mid = parseXY();
|
midPoint = parseXY();
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
hasMidPoint = true;
|
hasMidPoint = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_end:
|
case T_end:
|
||||||
end = parseXY();
|
endPoint = parseXY();
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -812,12 +812,12 @@ LIB_ARC* SCH_SEXPR_PARSER::parseArc()
|
||||||
}
|
}
|
||||||
|
|
||||||
arc->SetPosition( pos );
|
arc->SetPosition( pos );
|
||||||
arc->SetStart( start );
|
arc->SetStart( startPoint );
|
||||||
arc->SetEnd( end );
|
arc->SetEnd( endPoint );
|
||||||
|
|
||||||
if( hasMidPoint )
|
if( hasMidPoint )
|
||||||
{
|
{
|
||||||
VECTOR2I center = GetArcCenter( arc->GetStart(), mid, arc->GetEnd() );
|
VECTOR2I center = GetArcCenter( arc->GetStart(), midPoint, arc->GetEnd() );
|
||||||
|
|
||||||
arc->SetPosition( wxPoint( center.x, center.y ) );
|
arc->SetPosition( wxPoint( center.x, center.y ) );
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <math/util.h> // KiROUND, Clamp
|
#include <math/util.h> // KiROUND, Clamp
|
||||||
|
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <symbol_lib_lexer.h>
|
#include <schematic_lexer.h>
|
||||||
|
|
||||||
|
|
||||||
class LIB_ARC;
|
class LIB_ARC;
|
||||||
|
@ -47,7 +47,7 @@ class LIB_POLYLINE;
|
||||||
class LIB_TEXT;
|
class LIB_TEXT;
|
||||||
|
|
||||||
|
|
||||||
class SCH_SEXPR_PARSER : public SYMBOL_LIB_LEXER
|
class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
|
||||||
{
|
{
|
||||||
int m_requiredVersion; ///< Set to the symbol library file version required.
|
int m_requiredVersion; ///< Set to the symbol library file version required.
|
||||||
int m_fieldId; ///< The current field ID.
|
int m_fieldId; ///< The current field ID.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -140,16 +140,16 @@ private:
|
||||||
SCH_COMPONENT* loadComponent( LINE_READER& aReader );
|
SCH_COMPONENT* loadComponent( LINE_READER& aReader );
|
||||||
std::shared_ptr<BUS_ALIAS> loadBusAlias( LINE_READER& aReader, SCH_SCREEN* aScreen );
|
std::shared_ptr<BUS_ALIAS> loadBusAlias( LINE_READER& aReader, SCH_SCREEN* aScreen );
|
||||||
|
|
||||||
void saveComponent( SCH_COMPONENT* aComponent );
|
void saveSymbol( SCH_COMPONENT* aComponent, int aNestLevel );
|
||||||
void saveField( SCH_FIELD* aField );
|
void saveField( SCH_FIELD* aField, int aNestLevel );
|
||||||
void saveBitmap( SCH_BITMAP* aBitmap );
|
void saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel );
|
||||||
void saveSheet( SCH_SHEET* aSheet );
|
void saveSheet( SCH_SHEET* aSheet, int aNestLevel );
|
||||||
void saveJunction( SCH_JUNCTION* aJunction );
|
void saveJunction( SCH_JUNCTION* aJunction, int aNestLevel );
|
||||||
void saveNoConnect( SCH_NO_CONNECT* aNoConnect );
|
void saveNoConnect( SCH_NO_CONNECT* aNoConnect, int aNestLevel );
|
||||||
void saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry );
|
void saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry, int aNestLevel );
|
||||||
void saveLine( SCH_LINE* aLine );
|
void saveLine( SCH_LINE* aLine, int aNestLevel );
|
||||||
void saveText( SCH_TEXT* aText );
|
void saveText( SCH_TEXT* aText, int aNestLevel );
|
||||||
void saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias );
|
void saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias, int aNestLevel );
|
||||||
|
|
||||||
void cacheLib( const wxString& aLibraryFileName );
|
void cacheLib( const wxString& aLibraryFileName );
|
||||||
bool isBuffering( const PROPERTIES* aProperties );
|
bool isBuffering( const PROPERTIES* aProperties );
|
||||||
|
|
|
@ -190,6 +190,16 @@ SCH_SHEET* SCH_SHEET::GetRootSheet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_SHEET::UsesDefaultStroke() const
|
||||||
|
{
|
||||||
|
if( ( m_borderWidth == GetDefaultLineThickness() || m_borderWidth == 0 )
|
||||||
|
&& ( m_borderColor == COLOR4D::UNSPECIFIED ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHEET::SwapData( SCH_ITEM* aItem )
|
void SCH_SHEET::SwapData( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
|
wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
|
||||||
|
|
|
@ -293,6 +293,18 @@ public:
|
||||||
KIGFX::COLOR4D GetBackgroundColor() const { return m_backgroundColor; }
|
KIGFX::COLOR4D GetBackgroundColor() const { return m_backgroundColor; }
|
||||||
void SetBackgroundColor( KIGFX::COLOR4D aColor ) { m_backgroundColor = aColor; }
|
void SetBackgroundColor( KIGFX::COLOR4D aColor ) { m_backgroundColor = aColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test this sheet to see if the default stroke is used to draw the outline.
|
||||||
|
*
|
||||||
|
* The default stroke is defined as follows:
|
||||||
|
* * The outline width is the default line width or 0.
|
||||||
|
* * The outline style is set to #PLOT_DASH_TYPE::DEFAULT or #PLOT_DASH_TYPE::SOLID.
|
||||||
|
* * The outline color is set to #COLOR4D::UNSPECIFIED.
|
||||||
|
*
|
||||||
|
* @return True if the outline stroke meets the default criteria.
|
||||||
|
*/
|
||||||
|
bool UsesDefaultStroke() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the root sheet of this SCH_SHEET object.
|
* Return the root sheet of this SCH_SHEET object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -32,7 +32,6 @@
|
||||||
#include <sch_connection.h> // for CONNECTION_TYPE
|
#include <sch_connection.h> // for CONNECTION_TYPE
|
||||||
|
|
||||||
|
|
||||||
class LINE_READER;
|
|
||||||
class NETLIST_OBJECT_LIST;
|
class NETLIST_OBJECT_LIST;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -20,7 +20,9 @@ end
|
||||||
extends
|
extends
|
||||||
fill
|
fill
|
||||||
font
|
font
|
||||||
|
global_label
|
||||||
hide
|
hide
|
||||||
|
hierarchical_label
|
||||||
hint_alt_swap
|
hint_alt_swap
|
||||||
hint_pin_swap
|
hint_pin_swap
|
||||||
input
|
input
|
||||||
|
@ -29,7 +31,9 @@ inverted
|
||||||
inverted_clock
|
inverted_clock
|
||||||
italic
|
italic
|
||||||
justify
|
justify
|
||||||
|
kicad_sch
|
||||||
kicad_symbol_lib
|
kicad_symbol_lib
|
||||||
|
label
|
||||||
left
|
left
|
||||||
length
|
length
|
||||||
line
|
line
|
|
@ -115,7 +115,8 @@ extern const std::string SchematicBackupFileExtension;
|
||||||
|
|
||||||
extern const std::string VrmlFileExtension;
|
extern const std::string VrmlFileExtension;
|
||||||
extern const std::string ProjectFileExtension;
|
extern const std::string ProjectFileExtension;
|
||||||
extern const std::string SchematicFileExtension;
|
extern const std::string LegacySchematicFileExtension;
|
||||||
|
extern const std::string KiCadSchematicFileExtension;
|
||||||
extern const std::string NetlistFileExtension;
|
extern const std::string NetlistFileExtension;
|
||||||
extern const std::string GerberFileExtension;
|
extern const std::string GerberFileExtension;
|
||||||
extern const std::string GerberJobFileExtension;
|
extern const std::string GerberJobFileExtension;
|
||||||
|
@ -174,7 +175,8 @@ extern wxString SchematicSymbolFileWildcard();
|
||||||
extern wxString KiCadSymbolLibFileWildcard();
|
extern wxString KiCadSymbolLibFileWildcard();
|
||||||
extern wxString SchematicLibraryFileWildcard();
|
extern wxString SchematicLibraryFileWildcard();
|
||||||
extern wxString ProjectFileWildcard();
|
extern wxString ProjectFileWildcard();
|
||||||
extern wxString SchematicFileWildcard();
|
extern wxString KiCadSchematicFileWildcard();
|
||||||
|
extern wxString LegacySchematicFileWildcard();
|
||||||
extern wxString BoardFileWildcard();
|
extern wxString BoardFileWildcard();
|
||||||
extern wxString NetlistFileWildcard();
|
extern wxString NetlistFileWildcard();
|
||||||
extern wxString GerberFileWildcard();
|
extern wxString GerberFileWildcard();
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
* @author Russell Oliver <roliver8143@gmail.com>
|
* @author Russell Oliver <roliver8143@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -72,7 +73,7 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
||||||
|
|
||||||
wxFileName sch( schdlg.GetPath() );
|
wxFileName sch( schdlg.GetPath() );
|
||||||
|
|
||||||
sch.SetExt( SchematicFileExtension );
|
sch.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
wxFileName pro = sch;
|
wxFileName pro = sch;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 CERN (www.cern.ch)
|
* Copyright (C) 2013 CERN (www.cern.ch)
|
||||||
* Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -217,7 +217,7 @@ const wxString KICAD_MANAGER_FRAME::SchFileName()
|
||||||
{
|
{
|
||||||
wxFileName fn( GetProjectFileName() );
|
wxFileName fn( GetProjectFileName() );
|
||||||
|
|
||||||
fn.SetExt( SchematicFileExtension );
|
fn.SetExt( LegacySchematicFileExtension );
|
||||||
return fn.GetFullPath();
|
return fn.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName )
|
||||||
// It will avoid messages from the schematic editor or the board editor to create a new file
|
// It will avoid messages from the schematic editor or the board editor to create a new file
|
||||||
// And forces the user to create main files under the right name for the project manager
|
// And forces the user to create main files under the right name for the project manager
|
||||||
wxFileName fn( aProjectFileName.GetFullPath() );
|
wxFileName fn( aProjectFileName.GetFullPath() );
|
||||||
fn.SetExt( SchematicFileExtension );
|
fn.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
// If a <project>.sch file does not exist, create a "stub" file ( minimal schematic file )
|
// If a <project>.sch file does not exist, create a "stub" file ( minimal schematic file )
|
||||||
if( !fn.FileExists() )
|
if( !fn.FileExists() )
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -267,7 +267,7 @@ wxString TREE_PROJECT_FRAME::GetFileExt( TreeFileType type )
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case TREE_PROJECT: return ProjectFileExtension;
|
case TREE_PROJECT: return ProjectFileExtension;
|
||||||
case TREE_SCHEMA: return SchematicFileExtension;
|
case TREE_SCHEMA: return LegacySchematicFileExtension;
|
||||||
case TREE_LEGACY_PCB: return LegacyPcbFileExtension;
|
case TREE_LEGACY_PCB: return LegacyPcbFileExtension;
|
||||||
case TREE_SEXP_PCB: return KiCadPcbFileExtension;
|
case TREE_SEXP_PCB: return KiCadPcbFileExtension;
|
||||||
case TREE_GERBER: return GerberFileExtensionWildCard;
|
case TREE_GERBER: return GerberFileExtensionWildCard;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2013-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2013-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -1012,7 +1012,7 @@ bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST
|
||||||
|
|
||||||
if( !frame->IsShown() )
|
if( !frame->IsShown() )
|
||||||
{
|
{
|
||||||
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension );
|
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), LegacySchematicFileExtension );
|
||||||
|
|
||||||
frame->OpenProjectFiles( std::vector<wxString>( 1, schfn.GetFullPath() ) );
|
frame->OpenProjectFiles( std::vector<wxString>( 1, schfn.GetFullPath() ) );
|
||||||
|
|
||||||
|
@ -1064,7 +1064,8 @@ void PCB_EDIT_FRAME::DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimesta
|
||||||
void PCB_EDIT_FRAME::RunEeschema()
|
void PCB_EDIT_FRAME::RunEeschema()
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension );
|
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(),
|
||||||
|
LegacySchematicFileExtension );
|
||||||
|
|
||||||
if( !schfn.FileExists() )
|
if( !schfn.FileExists() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue