Eeschema folder housekeeping.

This commit is contained in:
Wayne Stambaugh 2025-02-06 09:47:00 -05:00
parent 69c6412b43
commit f45915ba93
88 changed files with 949 additions and 704 deletions

View File

@ -820,7 +820,7 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
symbol->SetUnit( originalUnit );
}
// Restore the danlging states of items in the current SCH_SCREEN to match the current
// Restore the dangling states of items in the current SCH_SCREEN to match the current
// SCH_SHEET_PATH.
m_schematic->CurrentSheet().LastScreen()->TestDanglingEnds( &m_schematic->CurrentSheet(),
aChangedItemHandler );
@ -877,9 +877,11 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
if( !item_sg )
{
wxLogTrace( ConnTrace, wxT( "Item %s not found in connection graph" ), aItem->GetTypeDesc() );
wxLogTrace( ConnTrace, wxT( "Item %s not found in connection graph" ),
aItem->GetTypeDesc() );
return;
}
if( !item_sg->ResolveDrivers( true ) )
{
wxLogTrace( ConnTrace, wxT( "Item %s in subgraph %ld (%p) has no driver" ),
@ -902,7 +904,6 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
sg_to_scan.size() );
for( CONNECTION_SUBGRAPH* sg : sg_to_scan )
{
traverse_subgraph( sg );
@ -1081,8 +1082,10 @@ void CONNECTION_GRAPH::removeSubgraphs( std::set<CONNECTION_SUBGRAPH*>& aSubgrap
it = m_net_code_to_subgraphs_map.erase( it );
}
else
{
++it;
}
}
for( auto it = m_net_name_to_subgraphs_map.begin();
it != m_net_name_to_subgraphs_map.end(); )
@ -1446,6 +1449,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
}
void CONNECTION_GRAPH::resolveAllDrivers()
{
// Resolve drivers for subgraphs and propagate connectivity info
@ -1642,6 +1646,7 @@ void CONNECTION_GRAPH::generateBusAliasMembers()
std::back_inserter( m_driver_subgraphs ) );
}
void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs()
{
// Generate subgraphs for global power pins. These will be merged with other subgraphs
@ -1656,7 +1661,8 @@ void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs()
SCH_SHEET_PATH sheet = it.first;
SCH_PIN* pin = it.second;
if( !pin->ConnectedItems( sheet ).empty() && !pin->GetLibPin()->GetParentSymbol()->IsPower() )
if( !pin->ConnectedItems( sheet ).empty()
&& !pin->GetLibPin()->GetParentSymbol()->IsPower() )
{
// ERC will warn about this: user has wired up an invisible pin
continue;
@ -1845,7 +1851,8 @@ void CONNECTION_GRAPH::processSubGraphs()
wxS( "%ld (%s) weakly driven by unique sheet pin %s, "
"promoting" ),
subgraph->m_code, name,
subgraph->m_driver->GetItemDescription( &unitsProvider, true ) );
subgraph->m_driver->GetItemDescription( &unitsProvider,
true ) );
subgraph->m_strong_driver = true;
}
@ -2026,7 +2033,8 @@ void CONNECTION_GRAPH::processSubGraphs()
subgraph->m_bus_neighbors[member].insert( candidate );
candidate->m_bus_parents[member].insert( subgraph );
}
else if( !connection->IsBus() || connection->Type() == candidate->m_driver_connection->Type() )
else if( !connection->IsBus()
|| connection->Type() == candidate->m_driver_connection->Type() )
{
wxLogTrace( ConnTrace, wxS( "%lu (%s) absorbs neighbor %lu (%s)" ),
subgraph->m_code, connection->Name(),
@ -2076,7 +2084,8 @@ void CONNECTION_GRAPH::processSubGraphs()
// on some portion of the items.
void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler, bool aUnconditional )
void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler,
bool aUnconditional )
{
// Recache all bus aliases for later use
wxCHECK_RET( m_schematic, wxT( "Connection graph cannot be built without schematic pointer" ) );
@ -2095,7 +2104,6 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
if( wxLog::IsAllowedTraceMask( DanglingProfileMask ) )
sub_graph.Show();
/**
* TODO(JE): Net codes are non-deterministic. Fortunately, they are also not really used for
* anything. We should consider removing them entirely and just using net names everywhere.
@ -2144,6 +2152,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
for( int ii = a; ii < b; ++ii )
m_driver_subgraphs[ii]->UpdateItemConnections();
});
tp.wait_for_tasks();
// Next time through the subgraphs, we do some post-processing to handle things like
@ -3018,7 +3027,8 @@ std::vector<const CONNECTION_SUBGRAPH*> CONNECTION_GRAPH::GetBusesNeedingMigrati
for( unsigned i = 1; i < labels.size(); ++i )
{
if( static_cast<SCH_TEXT*>( labels.at( i ) )->GetShownText( sheet, false ) != first )
if( static_cast<SCH_TEXT*>( labels.at( i ) )->GetShownText( sheet,
false ) != first )
{
different = true;
break;
@ -3660,7 +3670,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
SCH_PIN* test_pin = static_cast<SCH_PIN*>( item );
// Stacked pins do not count as other connections but non-stacked pins do
if( !has_other_connections && !pins.empty() && !test_pin->GetParentSymbol()->IsPower() )
if( !has_other_connections && !pins.empty()
&& !test_pin->GetParentSymbol()->IsPower() )
{
for( SCH_PIN* other_pin : pins )
{
@ -3692,8 +3703,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
for( SCH_PIN* test_pin : pins )
{
// Prefer the pin is part of a real component rather than some stray power symbol
// Or else we may fail walking connected components to a power symbol pin since we reject
// starting at a power symbol
// Or else we may fail walking connected components to a power symbol pin since we
// reject starting at a power symbol
if( test_pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
&& !test_pin->IsGlobalPower() )
{
@ -3788,7 +3799,8 @@ bool CONNECTION_GRAPH::ercCheckDanglingWireEndpoints( const CONNECTION_SUBGRAPH*
auto report_error = [&]( VECTOR2I& location )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNCONNECTED_WIRE_ENDPOINT );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNCONNECTED_WIRE_ENDPOINT );
ercItem->SetItems( line );
ercItem->SetSheetSpecificPath( sheet );
@ -3812,7 +3824,8 @@ bool CONNECTION_GRAPH::ercCheckDanglingWireEndpoints( const CONNECTION_SUBGRAPH*
auto report_error = [&]( VECTOR2I& location )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNCONNECTED_WIRE_ENDPOINT );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNCONNECTED_WIRE_ENDPOINT );
ercItem->SetItems( entry );
ercItem->SetSheetSpecificPath( sheet );

View File

@ -538,7 +538,8 @@ private:
* and re-created. Otherwise, we will preserve existing net classes that do not
* conflict with the new net classes.
*/
void buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler, bool aUnconditional );
void buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler,
bool aUnconditional );
/**
* Generate individual item subgraphs on a per-sheet basis.
@ -741,7 +742,7 @@ private:
int ercCheckHierSheets();
/**
* Check that a global label is instantiated more that once across the schematic heirarchy
* Check that a global label is instantiated more that once across the schematic hierarchy
*/
int ercCheckSingleGlobalLabel();

View File

@ -851,13 +851,15 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
// Try to select specified items.
// $SELECT: 1,<spec1>,<spec2>,<spec3>
// Select and focus on <spec1> item, select other specified items that are on the same sheet.
// Select and focus on <spec1> item, select other specified items that are on the
// same sheet.
std::string prefix = "$SELECT: ";
std::string paramStr = payload.substr( prefix.size() );
if( paramStr.size() < 2 ) // Empty/broken command: we need at least 2 chars for sync string.
// Empty/broken command: we need at least 2 chars for sync string.
if( paramStr.size() < 2 )
break;
std::string syncStr = paramStr.substr( 2 );
@ -945,7 +947,8 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
case MAIL_IMPORT_FILE:
{
// Extract file format type and path (plugin type, path and properties keys, values separated with \n)
// Extract file format type and path (plugin type, path and properties keys, values
// separated with \n)
std::stringstream ss( payload );
char delim = '\n';

View File

@ -26,7 +26,7 @@
#define DEFAULT_VALUES_H
///< The size of the rectangle indicating an unconnected wire or label
/// The size of the rectangle indicating an unconnected wire or label
#define DANGLING_SYMBOL_SIZE 12
///< The size of the rectangle indicating a connected, unselected wire end

View File

@ -391,7 +391,9 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
SaveSheetAsDesignBlock( aLibraryName, curPath );
}
else
{
DisplayErrorMessage( this, _( "Design blocks with nested sheets are not supported." ) );
}
return;
}
@ -422,9 +424,11 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
// Save a temporary copy of the schematic file, as the plugin is just going to move it
wxString tempFile = wxFileName::CreateTempFileName( "design_block" );
if( !saveSchematicFile( tempSheet, tempFile ) )
{
DisplayErrorMessage( this, _( "Error saving temporary schematic file to create design block." ) );
DisplayErrorMessage( this,
_( "Error saving temporary schematic file to create design block." ) );
wxRemoveFile( tempFile );
return;
}
@ -449,6 +453,7 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
// Clean up the temporaries
wxRemoveFile( tempFile );
// This will also delete the screen
delete tempSheet;
@ -582,8 +587,10 @@ bool SCH_EDIT_FRAME::EditDesignBlockProperties( const LIB_ID& aLibId )
Prj().DesignBlockLibs()->DesignBlockDelete( libname, originalName );
}
else
{
Prj().DesignBlockLibs()->DesignBlockSave( libname, designBlock );
}
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.What() );
@ -612,7 +619,8 @@ DESIGN_BLOCK* SchGetDesignBlock( const LIB_ID& aLibId, DESIGN_BLOCK_LIB_TABLE* a
{
if( aShowErrorMsg )
{
wxString msg = wxString::Format( _( "Error loading design block %s from library '%s'." ),
wxString msg = wxString::Format( _( "Error loading design block %s from "
"library '%s'." ),
aLibId.GetLibItemName().wx_str(),
aLibId.GetLibNickname().wx_str() );
DisplayErrorMessage( aParent, msg, ioe.What() );

View File

@ -160,7 +160,8 @@ void SCH_EDIT_FRAME::ShowSchematicSetupDialog( const wxString& aInitialPage )
std::vector<std::shared_ptr<BUS_ALIAS>> newAliases;
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr;
screen = screens.GetNext() )
{
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
newAliases.push_back( alias );
@ -321,7 +322,9 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_AuiPanels.float_net_nav_panel = netNavigatorPane.IsFloating();
if( netNavigatorPane.IsDocked() )
{
cfg->m_AuiPanels.net_nav_panel_docked_size = m_netNavigator->GetSize();
}
else
{
cfg->m_AuiPanels.net_nav_panel_float_pos = netNavigatorPane.floating_pos;

View File

@ -82,22 +82,23 @@ PROJECT* EESCHEMA_HELPERS::GetDefaultProject( bool aSetActive )
}
SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName,
bool aSetActive,
bool aForceDefaultProject,
PROJECT* aProject )
SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName, bool aSetActive,
bool aForceDefaultProject, PROJECT* aProject )
{
if( aFileName.EndsWith( FILEEXT::KiCadSchematicFileExtension ) )
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_KICAD, aSetActive, aForceDefaultProject, aProject );
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_KICAD, aSetActive, aForceDefaultProject,
aProject );
else if( aFileName.EndsWith( FILEEXT::LegacySchematicFileExtension ) )
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY, aSetActive, aForceDefaultProject, aProject );
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY, aSetActive, aForceDefaultProject,
aProject );
// as fall back for any other kind use the legacy format
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY, aSetActive, aForceDefaultProject, aProject );
}
SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aFormat,
SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName,
SCH_IO_MGR::SCH_FILE_T aFormat,
bool aSetActive,
bool aForceDefaultProject,
PROJECT* aProject )
@ -150,7 +151,6 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName, SCH_IO_MG
const_cast<KIID&>( rootSheet->m_Uuid ) = rootScreen->GetUuid();
schematic->Root().SetScreen( rootScreen );
schematic->RootScreen()->SetFileName( wxEmptyString );
// Don't leave root page number empty

View File

@ -35,7 +35,7 @@ class PROJECT;
/**
* Helper functions to do things like load schematics behind the scenes for special functions
*
* Similar to the pcbnew scripting helpers, this is just to have one spot
* Similar to the Pcbnew scripting helpers, this is just to have one spot
* for these types of "hacky" solutions
*/
class EESCHEMA_HELPERS
@ -44,10 +44,13 @@ public:
static SETTINGS_MANAGER* GetSettingsManager();
static void SetSchEditFrame( SCH_EDIT_FRAME* aSchEditFrame );
static PROJECT* GetDefaultProject( bool aSetActive );
static SCHEMATIC* LoadSchematic( const wxString& aFileName, bool aSetActive, bool aForceDefaultProject,
static SCHEMATIC* LoadSchematic( const wxString& aFileName, bool aSetActive,
bool aForceDefaultProject,
PROJECT* aProject = nullptr );
static SCHEMATIC* LoadSchematic( const wxString& aFileName,
SCH_IO_MGR::SCH_FILE_T aFormat,
bool aSetActive, bool aForceDefaultProject,
PROJECT* aProject = nullptr );
static SCHEMATIC* LoadSchematic( const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aFormat,
bool aSetActive, bool aForceDefaultProject, PROJECT* aProject = nullptr );
private:
static SCH_EDIT_FRAME* s_SchEditFrame;

View File

@ -268,6 +268,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
PLOT_FORMAT format = PLOT_FORMAT::PDF;
switch( aPlotJob->m_plotFormat )
{
case SCH_PLOT_FORMAT::DXF: format = PLOT_FORMAT::DXF; break;
@ -278,6 +279,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
}
HPGL_PAGE_SIZE hpglPageSize = HPGL_PAGE_SIZE::DEFAULT;
switch( aPlotJob->m_HPGLPaperSizeSelect )
{
case JOB_HPGL_PAGE_SIZE::DEFAULT: hpglPageSize = HPGL_PAGE_SIZE::DEFAULT; break;
@ -295,6 +297,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
}
HPGL_PLOT_ORIGIN_AND_UNITS hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
switch( aPlotJob->m_HPGLPlotOrigin )
{
case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
@ -321,6 +324,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
}
wxString outPath = aPlotJob->GetFullOutputPath( &sch->Prj() );
if( !PATHS::EnsurePathExists( outPath,
!aPlotJob->GetOutputPathIsDirectory() ) )
{
@ -336,6 +340,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
plotOpts.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups;
plotOpts.m_PDFHierarchicalLinks = aPlotJob->m_PDFHierarchicalLinks;
plotOpts.m_PDFMetadata = aPlotJob->m_PDFMetadata;
if( aPlotJob->GetOutputPathIsDirectory() )
{
plotOpts.m_outputDirectory = outPath;
@ -346,6 +351,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
plotOpts.m_outputDirectory = wxEmptyString;
plotOpts.m_outputFile = outPath;
}
plotOpts.m_pageSizeSelect = pageSizeSelect;
plotOpts.m_plotAll = aPlotJob->m_plotAll;
plotOpts.m_plotDrawingSheet = aPlotJob->m_plotDrawingSheet;
@ -851,7 +857,8 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
// iterate from unit 1, unit 0 would be "all units" which we don't want
for( int unit = 1; unit < symbol->GetUnitCount() + 1; unit++ )
{
for( int bodyStyle = 1; bodyStyle < ( symbol->HasAlternateBodyStyle() ? 2 : 1 ) + 1; ++bodyStyle )
for( int bodyStyle = 1; bodyStyle < ( symbol->HasAlternateBodyStyle() ? 2 : 1 ) + 1;
++bodyStyle )
{
wxString filename;
wxFileName fn;
@ -883,7 +890,8 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
RPT_SEVERITY_ACTION );
// Get the symbol bounding box to fit the plot page to it
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, bodyStyle, !aSvgJob->m_includeHiddenFields );
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox(
unit, bodyStyle, !aSvgJob->m_includeHiddenFields );
PAGE_INFO pageInfo( PAGE_INFO::Custom );
pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
@ -1087,7 +1095,8 @@ int EESCHEMA_JOBS_HANDLER::JobSymUpgrade( JOB* aJob )
}
else
{
if( !SCH_IO_MGR::ConvertLibrary( nullptr, fn.GetAbsolutePath(), upgradeJob->m_outputLibraryPath ) )
if( !SCH_IO_MGR::ConvertLibrary( nullptr, fn.GetAbsolutePath(),
upgradeJob->m_outputLibraryPath ) )
{
m_reporter->Report( ( "Unable to convert library\n" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_UNKNOWN;

View File

@ -50,7 +50,7 @@ public:
* Configure the SCH_RENDER_SETTINGS object with the correct data to be used with plotting.
*
* It's sort of a kludge due to the plotter depending on this object normally managed by
*the frame and canvas
* the frame and canvas.
*
* @param aRenderSettings The object to populate with working settings.
* @param aTheme The theme to take color data from to stick into render settings, can be

View File

@ -41,9 +41,10 @@
using namespace T_BOMCFG_T; // for the BOM_CFG_PARSER parser and its keywords
///! Update the schema version whenever a migration is required
/// Update the schema version whenever a migration is required.
const int eeschemaSchemaVersion = 3;
/// Default value for bom.plugins
const nlohmann::json defaultBomPlugins =
{
@ -763,9 +764,7 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
&m_lastSymbolLibDir, "" ) );
// Migrations
registerMigration( 0, 1,
[&]() -> bool
{

View File

@ -252,6 +252,7 @@ void FIELDS_GRID_TABLE::initGrid( WX_GRID* aGrid )
SCH_FIELD& valueField = static_cast<SCH_FIELD&>( this->at( VALUE_FIELD ) );
valueField.OnScintillaCharAdded( aScintillaTricks, aEvent );
} );
m_valueAttr->SetEditor( valueEditor );
}
@ -940,7 +941,8 @@ void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
if( value == DEFAULT_FONT_NAME )
field.SetFont( nullptr );
else if( value == KICAD_FONT_NAME )
field.SetFont( KIFONT::FONT::GetFont( wxEmptyString, field.IsBold(), field.IsItalic() ) );
field.SetFont( KIFONT::FONT::GetFont( wxEmptyString, field.IsBold(),
field.IsItalic() ) );
else
field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) );

View File

@ -34,7 +34,8 @@ static const wxString DescriptionFormat = wxS(
"__FIELDS__"
"</table>" );
static const wxString AliasOfFormat = wxS( "<br><i>" ) + _( "Derived from" ) + wxS( " %s (%s)</i>" );
static const wxString AliasOfFormat = wxS( "<br><i>" ) + _( "Derived from" ) +
wxS( " %s (%s)</i>" );
static const wxString DescFormat = wxS( "<br>%s" );
static const wxString KeywordsFormat = wxS( "<br>" ) + _( "Keywords" ) + wxS( ": %s" );
static const wxString FieldFormat = wxS(
@ -129,7 +130,8 @@ protected:
root_desc = parent->GetDesc();
}
m_html.Replace( wxS( "__ALIASOF__" ), wxString::Format( AliasOfFormat,
m_html.Replace( wxS( "__ALIASOF__" ),
wxString::Format( AliasOfFormat,
EscapeHTML( UnescapeString( root_name ) ),
EscapeHTML( root_desc ) ) );
}
@ -157,7 +159,8 @@ protected:
if( keywords.empty() )
m_html.Replace( wxS( "__KEY__" ), wxEmptyString );
else
m_html.Replace( wxS( "__KEY__" ), wxString::Format( KeywordsFormat, EscapeHTML( keywords ) ) );
m_html.Replace( wxS( "__KEY__" ),
wxString::Format( KeywordsFormat, EscapeHTML( keywords ) ) );
}

View File

@ -29,13 +29,16 @@ namespace JUNCTION_HELPERS
*/
struct POINT_INFO
{
///< True if the point has 3+ wires and/or 3+ buses meeting there
/// True if the point has 3+ wires and/or 3+ buses meeting there
bool isJunction;
///< True if there is already junction dot at the point
/// True if there is already junction dot at the point
bool hasExplicitJunctionDot;
///< True if there is a bus entry at the point (either end)
/// True if there is a bus entry at the point (either end)
bool hasBusEntry;
///< True if there is a bus entry at the point and it connects to more than one wire
/// True if there is a bus entry at the point and it connects to more than one wire
bool hasBusEntryToMultipleWires;
};

View File

@ -265,6 +265,8 @@ unsigned LIB_SYMBOL::GetInheritanceDepth() const
return depth;
}
LIB_SYMBOL_SPTR LIB_SYMBOL::GetRootSymbol() const
{
const LIB_SYMBOL_SPTR sp = m_parent.lock();
@ -643,6 +645,7 @@ void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBo
prms.SetColor( color );
shape.SetStroke( prms );
}
shape.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
prms.SetColor( init_color );
shape.SetStroke( prms );

View File

@ -91,7 +91,7 @@ public:
virtual ~LIB_SYMBOL()
{}
///< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
/// http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared.
LIB_SYMBOL_SPTR SharedPtr() const { return m_me; }
/**
@ -120,7 +120,7 @@ public:
/**
* Get the number of parents for this symbol.
*
* @return the inhertance depth for this symbol.
* @return the inheritance depth for this symbol.
*/
unsigned GetInheritanceDepth() const;
@ -252,7 +252,7 @@ public:
* If aUnit == 0, unit is not used
* if aBodyStyle == 0 Convert is non used
* Fields are not taken in account
**/
*/
const BOX2I GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins,
bool aIncludePrivateItems ) const;
@ -549,7 +549,7 @@ public:
* greater that count are removed from the symbol.
*
* @param aCount - Number of units per package.
* @param aDuplicateDrawItems Create duplicate draw items of unit 1 for each additionl unit.
* @param aDuplicateDrawItems Create duplicate draw items of unit 1 for each additional unit.
*/
void SetUnitCount( int aCount, bool aDuplicateDrawItems = true );
int GetUnitCount() const override;
@ -637,7 +637,7 @@ public:
* @note #SCH_FIELD objects are not included.
*
* @param aUnit is the unit number of the item, -1 includes all units.
* @param aBodyStyle is the alternate body styple of the item, -1 includes all body styles.
* @param aBodyStyle is the alternate body style of the item, -1 includes all body styles.
*
* @return a list of unit items.
*/

View File

@ -42,6 +42,7 @@
void SCH_EDIT_FRAME::doReCreateMenuBar()
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
@ -205,7 +206,8 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
showHidePanels->Add( EE_ACTIONS::showNetNavigator, ACTION_MENU::CHECK );
if( ADVANCED_CFG::GetCfg().m_EnableDesignBlocks )
showHidePanels->Add( EE_ACTIONS::showDesignBlockPanel, ACTION_MENU::CHECK, _( "Design Blocks" ) );
showHidePanels->Add( EE_ACTIONS::showDesignBlockPanel, ACTION_MENU::CHECK,
_( "Design Blocks" ) );
viewMenu->Add( showHidePanels );

View File

@ -350,7 +350,8 @@ void SCH_EDIT_FRAME::RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelect
wxTreeItemId selection = m_netNavigator->GetSelection();
if( selection.IsOk() )
itemData = dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
itemData = dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>(
m_netNavigator->GetItemData( selection ) );
m_netNavigator->DeleteAllItems();
nodeCnt++;
@ -401,7 +402,8 @@ void SCH_EDIT_FRAME::SelectNetNavigatorItem( const NET_NAVIGATOR_ITEM_DATA* aSel
while( itemId.IsOk() )
{
itemData = dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( itemId ) );
itemData = dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>(
m_netNavigator->GetItemData( itemId ) );
wxCHECK2( itemData, continue );
@ -533,7 +535,8 @@ void SCH_EDIT_FRAME::ToggleNetNavigator()
wxTreeItemId selection = m_netNavigator->GetSelection();
if( selection.IsOk() )
itemData = dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
itemData = dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>(
m_netNavigator->GetItemData( selection ) );
RefreshNetNavigator( itemData );
@ -559,7 +562,7 @@ void SCH_EDIT_FRAME::onResizeNetNavigator( wxSizeEvent& aEvent )
// Store the current pane size
// It allows to retrieve the last defined pane size when switching between
// docked and floating pane state
// Note: *DO NOT* call m_auimgr.Update() here: it crashes Kicad at least on Windows
// Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );

View File

@ -119,6 +119,7 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
const wxString targetUnitName = symbol->GetUnitDisplayName( aUnit );
const wxString currUnitName = symbol->GetUnitDisplayName( currentUnit );
wxString otherSheetName = otherSymbolRef->GetSheetPath().PathHumanReadable( true, true );
if( otherSheetName.IsEmpty() )
otherSheetName = _( "Root" );

View File

@ -425,6 +425,7 @@ OPT_BOX2I PIN_LAYOUT_CACHE::getUntransformedPinNameBox() const
OPT_BOX2I PIN_LAYOUT_CACHE::getUntransformedPinNumberBox() const
{
int pinNameOffset = 0;
if( const SYMBOL* parentSymbol = m_pin.GetParentSymbol() )
{
if( parentSymbol->GetShowPinNames() )
@ -613,7 +614,7 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNameInfo( int
// But it's not hugely expensive to recompute, and that's what's always been
// done to now
//
// Becasue pins are very likely to share a lot of characteristics, a global
// Because pins are very likely to share a lot of characteristics, a global
// cache might make more sense than a per-pin cache.
if( name.IsEmpty() || !m_pin.GetParentSymbol()->GetShowPinNames() )
@ -673,6 +674,7 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNumberInfo( i
const bool numAbove =
m_pin.GetParentSymbol()->GetPinNameOffset() > 0
|| ( m_pin.GetShownName().empty() || !m_pin.GetParentSymbol()->GetShowPinNames() );
if( numAbove )
{
info->m_TextPosition.y -= getPinTextOffset() + info->m_Thickness / 2;
@ -688,6 +690,7 @@ std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> PIN_LAYOUT_CACHE::GetPinNumberInfo( i
return info;
}
std::optional<PIN_LAYOUT_CACHE::TEXT_INFO>
PIN_LAYOUT_CACHE::GetPinElectricalTypeInfo( int aShadowWidth )
{

View File

@ -174,7 +174,7 @@ private:
OPT_BOX2I getUntransformedPinTypeBox() const;
OPT_BOX2I getUntransformedAltIconBox() const;
///< Pin type decoration if any
/// Pin type decoration if any
OPT_BOX2I getUntransformedDecorationBox() const;
/// The pin in question

View File

@ -37,7 +37,8 @@ wxString PIN_NUMBERS::getNextSymbol( const wxString& str, wxString::size_type& c
wxChar c = str[cursor];
// Need to check that there is a digit in the string before we parse it as a numeric
if( ( wxIsdigit( c ) || ( ( c == '+' || c == '-' ) && ( cursor < str.size() - 1 ) && wxIsdigit( str[cursor + 1] ) ) ) )
if( ( wxIsdigit( c ) || ( ( c == '+' || c == '-' ) && ( cursor < str.size() - 1 )
&& wxIsdigit( str[cursor + 1] ) ) ) )
{
// number, possibly with sign
while( ++cursor < str.size() )
@ -72,6 +73,7 @@ wxString PIN_NUMBERS::GetSummary() const
wxString ret;
const_iterator i = begin();
if( i == end() )
return ret;
@ -92,13 +94,16 @@ wxString PIN_NUMBERS::GetSummary() const
continue;
ret += *begin_of_range;
if( begin_of_range != last )
{
ret += '-';
ret += *last;
}
if( i == end() )
break;
begin_of_range = i;
ret += ',';
}
@ -188,8 +193,10 @@ int PIN_NUMBERS::Compare( const wxString& lhs, const wxString& rhs )
}
}
else
{
return -2;
}
}
else
{
if( sym2_isnumeric )

View File

@ -91,7 +91,8 @@ void InitTables()
{ ELECTRICAL_PINTYPE::PT_UNSPECIFIED, { _( "Unspecified" ), BITMAPS::pintype_notspecif } },
{ ELECTRICAL_PINTYPE::PT_POWER_IN, { _( "Power input" ), BITMAPS::pintype_powerinput } },
{ ELECTRICAL_PINTYPE::PT_POWER_OUT, { _( "Power output" ), BITMAPS::pintype_poweroutput } },
{ ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR, { _( "Open collector" ), BITMAPS::pintype_opencoll } },
{ ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR, { _( "Open collector" ),
BITMAPS::pintype_opencoll } },
{ ELECTRICAL_PINTYPE::PT_OPENEMITTER, { _( "Open emitter" ), BITMAPS::pintype_openemit } },
{ ELECTRICAL_PINTYPE::PT_NC, { _( "Unconnected" ), BITMAPS::pintype_noconnect } },
};
@ -100,12 +101,16 @@ void InitTables()
{ GRAPHIC_PINSHAPE::LINE, { _( "Line" ), BITMAPS::pinshape_normal } },
{ GRAPHIC_PINSHAPE::INVERTED, { _( "Inverted" ), BITMAPS::pinshape_invert } },
{ GRAPHIC_PINSHAPE::CLOCK, { _( "Clock" ), BITMAPS::pinshape_clock_normal } },
{ GRAPHIC_PINSHAPE::INVERTED_CLOCK, { _( "Inverted clock" ), BITMAPS::pinshape_clock_invert } },
{ GRAPHIC_PINSHAPE::INVERTED_CLOCK, { _( "Inverted clock" ),
BITMAPS::pinshape_clock_invert } },
{ GRAPHIC_PINSHAPE::INPUT_LOW, { _( "Input low" ), BITMAPS::pinshape_active_low_input } },
{ GRAPHIC_PINSHAPE::CLOCK_LOW, { _( "Clock low" ), BITMAPS::pinshape_clock_active_low } },
{ GRAPHIC_PINSHAPE::OUTPUT_LOW, { _( "Output low" ), BITMAPS::pinshape_active_low_output } },
{ GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK, { _( "Falling edge clock" ), BITMAPS::pinshape_clock_fall } },
{ GRAPHIC_PINSHAPE::NONLOGIC, { _( "NonLogic" ), BITMAPS::pinshape_nonlogic } },
{ GRAPHIC_PINSHAPE::OUTPUT_LOW, { _( "Output low" ),
BITMAPS::pinshape_active_low_output } },
{ GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK, { _( "Falling edge clock" ),
BITMAPS::pinshape_clock_fall } },
{ GRAPHIC_PINSHAPE::NONLOGIC, { _( "NonLogic" ),
BITMAPS::pinshape_nonlogic } },
};
g_pinOrientations = {

View File

@ -37,8 +37,10 @@ enum class ELECTRICAL_PINTYPE
PT_INPUT, ///< usual pin input: must be connected
PT_OUTPUT, ///< usual output
PT_BIDI, ///< input or output (like port for a microprocessor)
PT_TRISTATE, ///< tris state bus pin
PT_PASSIVE, ///< pin for passive symbols: must be connected, and can be connected to any pin
PT_TRISTATE, ///< tri state bus pin
/// pin for passive symbols: must be connected, and can be connected to any pin.
PT_PASSIVE,
PT_NIC, ///< not internally connected (may be connected to anything)
PT_UNSPECIFIED, ///< unknown electrical properties: creates always a warning when connected
PT_POWER_IN, ///< power input (GND, VCC for ICs). Must be connected to a power output.
@ -82,12 +84,14 @@ enum class PIN_ORIENTATION
* x---|
*/
PIN_RIGHT,
/**
* The pin extends leftwards from the connection point:
* Probably on the right side of the symbol.
* |---x
*/
PIN_LEFT,
/**
* The pin extends upwards from the connection point:
* Probably on the bottom side of the symbol.
@ -96,6 +100,7 @@ enum class PIN_ORIENTATION
* x
*/
PIN_UP,
/**
* The pin extends downwards from the connection:
* Probably on the top side of the symbol.

View File

@ -271,7 +271,8 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
// A new symbol name is found (a new group starts here).
// Search the symbol names candidates only once for this group:
old_symbol_name = symbol_name;
cache_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true );
cache_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ),
true );
lib_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), false );
// At some point during V5 development, the LIB_ID delimiter character ':' was
@ -422,11 +423,13 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
{
symbolName = symbol_id.GetLibNickname().wx_str() + wxT( "_" ) +
symbol_id.GetLibItemName().wx_str();
cache_match = findSymbol( symbolName, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true );
cache_match = findSymbol( symbolName, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ),
true );
}
// Get the library symbol from the symbol library table.
lib_match = SchGetLibSymbol( symbol_id, PROJECT_SCH::SchSymbolLibTable( aRescuer.GetPrj() ) );
lib_match = SchGetLibSymbol( symbol_id,
PROJECT_SCH::SchSymbolLibTable( aRescuer.GetPrj() ) );
if( !cache_match && !lib_match )
continue;
@ -465,7 +468,8 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
// library.
wxString libNickname = GetRescueLibraryFileName( aRescuer.Schematic() ).GetName();
LIB_ID new_id( libNickname, new_name + wxS( "-" ) + symbol_id.GetLibNickname().wx_str() );
LIB_ID new_id( libNickname, new_name + wxS( "-" ) +
symbol_id.GetLibNickname().wx_str() );
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( symbol_id, new_id, cache_match, lib_match,
eachSymbol->GetUnit(),
@ -682,8 +686,8 @@ void LEGACY_RESCUER::OpenRescueLibrary()
{
wxFileName fn = GetRescueLibraryFileName( m_schematic );
std::unique_ptr<SYMBOL_LIB> rescue_lib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
fn.GetFullPath() );
std::unique_ptr<SYMBOL_LIB> rescue_lib =
std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() );
m_rescue_lib = std::move( rescue_lib );
m_rescue_lib->EnableBuffering();

View File

@ -31,7 +31,7 @@ class SYMBOL_LIBS;
class PROJECT_SCH
{
public:
// These are all prefaced with "Sch"
/// These are all prefaced with "Sch".
static SYMBOL_LIBS* SchLibs( PROJECT* aProject );
/// Accessor for Eeschema search stack.

View File

@ -402,11 +402,12 @@ void SCH_BASE_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpda
GetCanvas()->GetView()->Update( aItem );
// Some children are drawn from their parents. Mark them for re-paint.
if( parent && parent->IsType( { SCH_SYMBOL_T, SCH_SHEET_T, SCH_LABEL_LOCATE_ANY_T, SCH_TABLE_T } ) )
if( parent
&& parent->IsType( { SCH_SYMBOL_T, SCH_SHEET_T, SCH_LABEL_LOCATE_ANY_T, SCH_TABLE_T } ) )
GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
}
/**
/*
* Be careful when calling this. Update will invalidate RTree iterators, so you cannot
* call this while doing things like `for( SCH_ITEM* item : screen->Items() )`
*/
@ -431,7 +432,6 @@ void SCH_BASE_FRAME::RefreshZoomDependentItems()
//
// Thus, as it currently stands, all zoom-dependent items can be found in the list of selected
// items.
if( m_toolManager )
{
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
@ -538,7 +538,8 @@ COLOR_SETTINGS* SCH_BASE_FRAME::GetColorSettings( bool aForceRefresh ) const
if( IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{
SYMBOL_EDITOR_SETTINGS* symCfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
SYMBOL_EDITOR_SETTINGS* symCfg =
mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( !symCfg->m_UseEeschemaColorSettings )
colorTheme = symCfg->m_ColorTheme;
@ -738,6 +739,7 @@ void SCH_BASE_FRAME::OnSymChange( wxFileSystemWatcherEvent& aEvent )
void SCH_BASE_FRAME::OnSymChangeDebounceTimer( wxTimerEvent& aEvent )
{
wxLogTrace( "KICAD_LIB_WATCH", "OnSymChangeDebounceTimer" );
// Disable logging to avoid spurious messages and check if the file has changed
wxLog::EnableLogging( false );
wxDateTime lastModified = m_watcherFileName.GetModificationTime();
@ -748,7 +750,8 @@ void SCH_BASE_FRAME::OnSymChangeDebounceTimer( wxTimerEvent& aEvent )
m_watcherLastModified = lastModified;
if( !GetScreen()->IsContentModified() || IsOK( this, _( "The library containing the current symbol has changed.\n"
if( !GetScreen()->IsContentModified()
|| IsOK( this, _( "The library containing the current symbol has changed.\n"
"Do you want to reload the library?" ) ) )
{
wxLogTrace( "KICAD_LIB_WATCH", "Sending refresh symbol mail" );

View File

@ -398,6 +398,7 @@ bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aIt
if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
m_isStartDangling = false;
if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
m_isEndDangling = false;
}
@ -427,7 +428,7 @@ std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
bool SCH_BUS_ENTRY_BASE::HasConnectivityChanges( const SCH_ITEM* aItem,
const SCH_SHEET_PATH* aInstance ) const
{
// Do not compare to ourself.
// Do not compare to ourselves.
if( aItem == this )
return false;
@ -664,14 +665,17 @@ static struct SCH_BUS_ENTRY_DESC
.Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
}
propMgr.AddProperty( new PROPERTY_ENUM<SCH_BUS_ENTRY_BASE, WIRE_STYLE>( _HKI( "Line Style" ),
&SCH_BUS_ENTRY_BASE::SetWireStyle, &SCH_BUS_ENTRY_BASE::GetWireStyle ) );
propMgr.AddProperty( new PROPERTY_ENUM<SCH_BUS_ENTRY_BASE,
WIRE_STYLE>( _HKI( "Line Style" ),
&SCH_BUS_ENTRY_BASE::SetWireStyle,
&SCH_BUS_ENTRY_BASE::GetWireStyle ) );
propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, int>( _HKI( "Line Width" ),
&SCH_BUS_ENTRY_BASE::SetPenWidth, &SCH_BUS_ENTRY_BASE::GetPenWidth,
PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, COLOR4D>( _HKI( "Color" ),
&SCH_BUS_ENTRY_BASE::SetBusEntryColor, &SCH_BUS_ENTRY_BASE::GetBusEntryColor ) );
propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, COLOR4D>(
_HKI( "Color" ), &SCH_BUS_ENTRY_BASE::SetBusEntryColor,
&SCH_BUS_ENTRY_BASE::GetBusEntryColor ) );
}
} _SCH_BUS_ENTRY_DESC;

View File

@ -233,7 +233,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
if( connectivityCleanUp == NO_CLEANUP )
connectivityCleanUp = LOCAL_CLEANUP;
// Do a full rebauild of the connectivity if there is a sheet in the commit.
// Do a full rebuild of the connectivity if there is a sheet in the commit.
if( schItem->Type() == SCH_SHEET_T )
connectivityCleanUp = GLOBAL_CLEANUP;
}
@ -402,7 +402,8 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
{
wxLogTrace( wxS( "CONN_PROFILE" ),
wxS( "SCH_COMMIT::pushSchEdit() %s clean up connectivity rebuild." ),
( connectivityCleanUp == LOCAL_CLEANUP ) ? wxS( "local" ) : wxS( "global" ) );
( connectivityCleanUp == LOCAL_CLEANUP ) ? wxS( "local" )
: wxS( "global" ) );
frame->RecalculateConnections( this, connectivityCleanUp );
}
}

View File

@ -240,12 +240,15 @@ void SCH_CONNECTION::Reset()
void SCH_CONNECTION::Clone( const SCH_CONNECTION& aOther )
{
m_graph = aOther.m_graph;
// Note: m_lastDriver is not cloned as it needs to be the last driver of *this* connection
m_driver = aOther.Driver();
m_sheet = aOther.Sheet();
// Note: m_local_sheet is not cloned
m_name = aOther.m_name;
m_type = aOther.m_type;
// Note: m_local_name is not cloned if not set yet
if( m_local_name.IsEmpty() )
{
@ -254,12 +257,14 @@ void SCH_CONNECTION::Clone( const SCH_CONNECTION& aOther )
}
m_prefix = aOther.Prefix();
// m_bus_prefix is not cloned; only used for local names
m_suffix = aOther.Suffix();
m_net_code = aOther.NetCode();
m_bus_code = aOther.BusCode();
m_vector_start = aOther.VectorStart();
m_vector_end = aOther.VectorEnd();
// Note: m_vector_index is not cloned
m_vector_prefix = aOther.VectorPrefix();

View File

@ -278,7 +278,7 @@ private:
/// Local prefix for group bus members (used with m_local_name)
wxString m_local_prefix;
/// Optional prefix of a bux group (always empty for nets and vector buses)
/// Optional prefix of a bus group (always empty for nets and vector buses)
wxString m_bus_prefix;
wxString m_suffix; ///< Name suffix (used only for disambiguation)
@ -295,7 +295,7 @@ private:
long m_vector_end; ///< Lowest member of a vector bus
///< Prefix name of the vector, if m_type == CONNECTION_BUS (or "" if not)
/// Prefix name of the vector, if m_type == CONNECTION_BUS (or "" if not).
wxString m_vector_prefix;
/**

View File

@ -74,6 +74,7 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
m_painter->GetSettings()->LoadColors( cs );
m_view->SetPainter( m_painter.get() );
// This fixes the zoom in and zoom out limits:
m_view->SetScaleLimits( ZOOM_MAX_LIMIT_EESCHEMA, ZOOM_MIN_LIMIT_EESCHEMA );
m_view->SetMirror( false, false );

View File

@ -51,7 +51,6 @@ public:
protected:
virtual void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override;
///< @copydoc EDA_DRAW_PANEL_GAL::OnShow()
void OnShow() override;
void setDefaultLayerOrder(); ///< Reassign layer order to the initial settings.

View File

@ -642,8 +642,10 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::paste,
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::pasteSpecial,
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
@ -776,7 +778,8 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
mgr->SetConditions( EE_ACTIONS::saveSheetAsDesignBlock, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::saveSelectionAsDesignBlock, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
mgr->SetConditions( EE_ACTIONS::saveSelectionAsDesignBlock,
ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
@ -909,7 +912,7 @@ void SCH_EDIT_FRAME::CreateScreens()
m_schematic->RootScreen()->SetPageNumber( wxT( "1" ) );
rootSheetPath.SetPageNumber( wxT( "1" ) );
// Rehash sheetpaths in heirarchy since we changed the uuid.
// Rehash sheetpaths in hierarchy since we changed the uuid.
m_schematic->RefreshHierarchy();
if( GetScreen() == nullptr )
@ -1102,6 +1105,7 @@ void SCH_EDIT_FRAME::doCloseWindow()
if( m_toolManager )
{
m_toolManager->ShutdownAllTools();
// prevent the canvas from trying to dispatch events during close
GetCanvas()->SetEventDispatcher( nullptr );
delete m_toolManager;
@ -1238,7 +1242,7 @@ void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator )
void SCH_EDIT_FRAME::UpdateLabelsHierarchyNavigator()
{
// Update only the hierarchy navigation tree labels.
// The tree list is expectyed to be up to date
// The tree list is expected to be up to date
m_hierarchy->UpdateLabelsHierarchyTree();
}
@ -1295,10 +1299,9 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
if( m_findReplaceDialog )
m_findReplaceDialog->Destroy();
m_findReplaceDialog = new DIALOG_SCH_FIND( this,
static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ),
wxDefaultPosition, wxDefaultSize,
aReplace ? wxFR_REPLACEDIALOG : 0 );
m_findReplaceDialog = new DIALOG_SCH_FIND(
this, static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ), wxDefaultPosition,
wxDefaultSize, aReplace ? wxFR_REPLACEDIALOG : 0 );
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString );
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
@ -1517,7 +1520,8 @@ void SCH_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
cfg->GetPrintDC()->SetLogicalFunction( wxCOPY );
GetScreen()->Print( cfg );
PrintDrawingSheet( cfg, GetScreen(), Schematic().GetProperties(), schIUScale.IU_PER_MILS, fileName );
PrintDrawingSheet( cfg, GetScreen(), Schematic().GetProperties(), schIUScale.IU_PER_MILS,
fileName );
}
@ -1580,6 +1584,7 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
GetCanvas()->GetView()->Update( line );
line->SetOperatingPoint( wxEmptyString );
// update value from netlist, below
}
else if( item->Type() == SCH_SYMBOL_T )

View File

@ -217,7 +217,9 @@ public:
* \li \c \$NET: \c "netname" Highlight a specified net
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear symbols highlight
* <p>
*
* They are a keyword followed by a quoted string.
*
* @param cmdline is the command received from Pcbnew.
*/
void ExecuteRemoteCommand( const char* cmdline ) override;
@ -225,12 +227,12 @@ public:
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
/**
* Refresh the display of any operaintg points. Called after a .op simulation completes.
* Refresh the display of any operating points. Called after a .op simulation completes.
*/
void RefreshOperatingPointDisplay();
/**
* Automatically set the rotation of an item (if the item supports it)
* Automatically set the rotation of an item (if the item supports it).
*/
void AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
@ -246,6 +248,7 @@ public:
/**
* Update the hierarchy navigation tree labels.
*
* No change for the tree, only the labels are updated, after editing a sheet
* name or a sheet number.
*/
@ -272,6 +275,7 @@ public:
/**
* Break a single segment into two at the specified point.
*
* @param aCommit Transaction container used to record changes for undo/redo
* @param aSegment Line segment to break
* @param aPoint Point at which to break the segment
@ -284,6 +288,7 @@ public:
/**
* Check every wire and bus for a intersection at \a aPoint and break into two segments
* at \a aPoint if an intersection is found.
*
* @param aCommit Transaction container used to record changes for undo/redo
* @param aPoint Test this point for an intersection.
* @param aScreen is the screen to examine.
@ -294,6 +299,7 @@ public:
/**
* Test all junctions and bus entries in the schematic for intersections with wires and
* buses and breaks any intersections into multiple segments.
*
* @param aCommit Transaction container used to record changes for undo/redo
* @param aScreen is the screen to examine.
* @return True if any wires or buses were broken.
@ -302,6 +308,7 @@ public:
/**
* Test all of the connectable objects in the schematic for unused connection points.
*
* @return True if any connection state changes were made.
*/
void TestDanglingEnds();
@ -309,10 +316,10 @@ public:
/**
* Send items to board editor for selection.
*
* This is used for when the eeschema user is using the cross-probe tool.
* This is used for when the Eeschema user is using the cross-probe tool.
*
* @param aItems are the items to select
* @param aForce select the element in pcbnew whether or not the user has the select option
* @param aForce select the element in Pcbnew whether or not the user has the select option
* chosen
*/
void SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems, bool aForce );
@ -382,9 +389,11 @@ public:
void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER& aReporter );
/**
* Annotate the symbols in the schematic that are not currently annotated. Multi-unit symbols
* are annotated together. E.g. if two symbols were R8A and R8B, they may become R3A and
* R3B, but not R3A and R3C or R3C and R4D.
* Annotate the symbols in the schematic that are not currently annotated.
*
* Multi-unit symbols are annotated together. E.g. if two symbols were R8A and R8B, they may
* become R3A and R3B, but not R3A and R3C or R3C and R4D.
*
* @param aCommit Transaction container used to record changes for undo/redo
* @param aAnnotateScope See #ANNOTATE_SCOPE_T
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
@ -445,7 +454,9 @@ public:
bool aUpdateRtree = false ) override;
/**
* Rebuild the GAL and redraw the screen. Call when something went wrong.
* Rebuild the GAL and redraw the screen.
*
* Call when something went wrong.
*/
void HardRedraw() override;
@ -506,6 +517,7 @@ public:
/**
* Perform routine schematic cleaning including breaking wire and buses and deleting
* identical objects superimposed on top of each other.
*
* @param aCommit Transaction container used to record changes for undo/redo
* @param aScreen is the screen to examine, or nullptr to examine the current screen
*/
@ -514,8 +526,9 @@ public:
/**
* If any single wire passes through _both points_, remove the portion between the two points,
* potentially splitting the wire into two.
*
* @param aCommit Transaction container used to record changes for undo/redo
* @param aStart The starting point for trimmming
* @param aStart The starting point for trimming
* @param aEnd The ending point for trimming
* @return True if any wires were changed by this operation
*/
@ -546,7 +559,8 @@ public:
* @param aSchematicFileName is the absolute path and file name of the file to test.
* @return true if the user accepts the potential file name clash risk.
*/
bool AllowCaseSensitiveFileNameClashes( const wxString& aOldName, const wxString& aSchematicFileName );
bool AllowCaseSensitiveFileNameClashes( const wxString& aOldName,
const wxString& aSchematicFileName );
/**
* Edit an existing sheet or add a new sheet to the schematic.
@ -631,9 +645,11 @@ public:
* path.
* @param aSkipRecursionCheck is true to skip the recursion check. This is used when loading
* a schematic sheet that is not part of the current project. If we are placing
* sheet contents instead of a sheet, then we do not need to check for recursion.
* @param aSkipLibCheck is true to skip the new/duplicate lib check. This is always triggered when
* placing design blocks so it is not necessary to check for new/duplicate libs.
* sheet contents instead of a sheet, then we do not need to check for
* recursion.
* @param aSkipLibCheck is true to skip the new/duplicate lib check. This is always triggered
* when placing design blocks so it is not necessary to check for
* new/duplicate libs.
* @return True if the schematic was imported properly.
*/
bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet,
@ -641,7 +657,7 @@ public:
bool aSkipLibCheck = false );
/**
* Removes a given junction and heals any wire segments under the junction
* Remove a given junction and heals any wire segments under the junction.
*
* @param aItem The junction to delete
*/
@ -712,8 +728,9 @@ public:
void AddCopyForRepeatItem( const SCH_ITEM* aItem );
/**
* Return the items which are to be repeated with the insert key. Such objects are owned by
* this container, and must be cloned.
* Return the items which are to be repeated with the insert key.
*
* Such objects are owned by this container and must be cloned.
*/
const std::vector<std::unique_ptr<SCH_ITEM>>& GetRepeatItems() const
{
@ -722,6 +739,7 @@ public:
/**
* Clear the list of items which are to be repeated with the insert key.
*
* These objects are owned by this container.
*/
void ClearRepeatItemsList()
@ -732,8 +750,9 @@ public:
EDA_ITEM* GetItem( const KIID& aId ) const override;
/**
* Perform an undo of the last edit WITHOUT logging a corresponding redo. Used to cancel
* an in-progress operation.
* Perform an undo of the last edit **without** logging a corresponding redo.
*
* Used to cancel an in-progress operation.
*/
void RollbackSchematicFromUndo();
@ -747,10 +766,11 @@ public:
/**
* If a library name is given, creates a new design block library in the project folder
* with the given name. If no library name is given it prompts user for a library path,
* then creates a new design block library at that location.
* If library exists, user is warned about that, and is given a chance
* to abort the new creation, and in that case existing library is first deleted.
* with the given name.
*
* If no library name is given it prompts user for a library path, then creates a new design
* block library at that location. If library exists, user is warned about that, and is given
* a chance to abort the new creation, and in that case existing library is first deleted.
*
* @param aProposedName is the initial path and filename shown in the file chooser dialog.
* @return The newly created library path if library was successfully created, else
@ -898,7 +918,7 @@ public:
const SCH_ITEM* GetSelectedNetNavigatorItem() const;
/**
* @return the name of the wxAuiPaneInfo managing the Hierarchy Navigator panel
* @return the name of the wxAuiPaneInfo managing the Hierarchy Navigator panel.
*/
static const wxString SchematicHierarchyPaneName()
{
@ -906,14 +926,14 @@ public:
}
/**
* @return the name of the wxAuiPaneInfo managing the Search panel
* @return the name of the wxAuiPaneInfo managing the Search panel.
*/
static const wxString SearchPaneName() { return wxT( "Search" ); }
/**
* Add \a aListener to post #EDA_EVT_SCHEMATIC_CHANGED command events to.
*
* @warning The caller is reponsible for removing any listeners that are no long valid.
* @warning The caller is responsible for removing any listeners that are no long valid.
*
* @note This only gets called when the schematic editor is in stand alone mode. Changing
* projects in the project manager closes the schematic editor when a new project is
@ -982,9 +1002,9 @@ protected:
#endif
/**
* Prompts a user to select global or project library tables
* Prompt user to select global or project library tables.
*
* @return Pointer to library table selected or nullptr if none selected/canceled
* @return Pointer to library table selected or nullptr if none selected/canceled.
*/
DESIGN_BLOCK_LIB_TABLE* selectDesignBlockLibTable( bool aOptional = false );

View File

@ -766,7 +766,8 @@ bool SCH_FIELD::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) co
try
{
const SCH_SEARCH_DATA& schSearchData = dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData ); // downcast
// downcast
const SCH_SEARCH_DATA& schSearchData = dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData );
searchHiddenFields = schSearchData.searchAllFields;
searchAndReplace = schSearchData.searchAndReplace;
replaceReferences = schSearchData.replaceReferences;
@ -1045,6 +1046,7 @@ void SCH_FIELD::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
case GR_TEXT_H_ALIGN_CENTER:
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
SetTextAngle( ANGLE_HORIZONTAL );
}
else if( GetTextAngle().IsHorizontal() )
@ -1062,6 +1064,7 @@ void SCH_FIELD::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
case GR_TEXT_H_ALIGN_CENTER:
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
SetTextAngle( ANGLE_VERTICAL );
}
else
@ -1751,15 +1754,19 @@ static struct SCH_FIELD_DESC
const wxString textProps = _HKI( "Text Properties" );
auto horiz = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_H_ALIGN_T>( _HKI( "Horizontal Justification" ),
&SCH_FIELD::SetEffectiveHorizJustify, &SCH_FIELD::GetEffectiveHorizJustify );
auto horiz = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_H_ALIGN_T>(
_HKI( "Horizontal Justification" ), &SCH_FIELD::SetEffectiveHorizJustify,
&SCH_FIELD::GetEffectiveHorizJustify );
propMgr.ReplaceProperty( TYPE_HASH( EDA_TEXT ), _HKI( "Horizontal Justification" ), horiz, textProps );
propMgr.ReplaceProperty( TYPE_HASH( EDA_TEXT ), _HKI( "Horizontal Justification" ), horiz,
textProps );
auto vert = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_V_ALIGN_T>( _HKI( "Vertical Justification" ),
&SCH_FIELD::SetEffectiveVertJustify, &SCH_FIELD::GetEffectiveVertJustify );
auto vert = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_V_ALIGN_T>(
_HKI( "Vertical Justification" ), &SCH_FIELD::SetEffectiveVertJustify,
&SCH_FIELD::GetEffectiveVertJustify );
propMgr.ReplaceProperty( TYPE_HASH( EDA_TEXT ), _HKI( "Vertical Justification" ), vert, textProps );
propMgr.ReplaceProperty( TYPE_HASH( EDA_TEXT ), _HKI( "Vertical Justification" ), vert,
textProps );
propMgr.AddProperty( new PROPERTY<SCH_FIELD, bool>( _HKI( "Show Field Name" ),
&SCH_FIELD::SetNameShown, &SCH_FIELD::IsNameShown ) );
@ -1802,8 +1809,8 @@ static struct SCH_FIELD_DESC
return false;
};
propMgr.OverrideAvailability( TYPE_HASH( SCH_FIELD ), TYPE_HASH( SCH_ITEM ), _HKI( "Private" ),
isNonMandatoryField );
propMgr.OverrideAvailability( TYPE_HASH( SCH_FIELD ), TYPE_HASH( SCH_ITEM ),
_HKI( "Private" ), isNonMandatoryField );
}
} _SCH_FIELD_DESC;

View File

@ -126,6 +126,7 @@ public:
/**
* Get the initial name of the field set at creation (or set by SetName()).
*
* This is the raw field name with no translation and no change.
*/
const wxString& GetInternalName() { return m_name; }
@ -135,9 +136,11 @@ public:
void SetId( int aId );
/**
* Gets the fields name as displayed on the schematic or
* in the symbol fields table. This is either the same as GetName() or
* if the field has a variable for name, the variable namer with the ${} stripped.
* Get the fields name as displayed on the schematic or
* in the symbol fields table.
*
* This is either the same as GetName() or if the field has a variable for name, the
* variable name with the ${} stripped.
*/
wxString GetShownName() const;
wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
@ -157,8 +160,9 @@ public:
wxString GetFullText( int unit = 1 ) const;
/**
* Return true if both the name and value of the field are empty. Whitespace
* does not count as non-empty
* Return true if both the name and value of the field are empty.
*
* Whitespace does not count as non-empty.
*/
bool IsEmpty()
{
@ -249,7 +253,8 @@ public:
void BeginEdit( const VECTOR2I& aStartPoint ) override;
void CalcEdit( const VECTOR2I& aPosition ) override;
void OnScintillaCharAdded( SCINTILLA_TRICKS* aScintillaTricks, wxStyledTextEvent &aEvent ) const;
void OnScintillaCharAdded( SCINTILLA_TRICKS* aScintillaTricks,
wxStyledTextEvent &aEvent ) const;
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
@ -283,14 +288,16 @@ public:
/**
* Copy parameters from a SCH_FIELD source.
*
* Pointers and specific values (position) are not copied.
* @note Pointers and specific values (position) are not copied.
*
* @param aSource is the SCH_FIELD to read.
*/
void ImportValues( const SCH_FIELD& aSource );
/**
* Copy parameters of this field to another field. Pointers are not copied.
* Copy parameters of this field to another field.
*
* @note Pointers are not copied.
*
* @param aTarget Target field to copy values to.
*/

View File

@ -252,7 +252,8 @@ std::shared_ptr<NETCLASS> SCH_ITEM::GetEffectiveNetClass( const SCH_SHEET_PATH*
if( schematic )
{
std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
std::shared_ptr<NET_SETTINGS>& netSettings =
schematic->Prj().GetProjectFile().m_NetSettings;
SCH_CONNECTION* connection = Connection( aSheet );
if( connection )
@ -616,6 +617,7 @@ void DANGLING_END_ITEM_HELPER::sort_dangling_end_items(
{
// WIRE_END pairs must be kept together. Hence stable sort.
std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType );
// Sort by y first, pins are more likely to share x than y.
std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX );
}

View File

@ -132,10 +132,10 @@ public:
DANGLING_END_T GetType() const { return m_type; }
private:
EDA_ITEM* m_item; /// A pointer to the connectable object.
VECTOR2I m_pos; /// The position of the connection point.
DANGLING_END_T m_type; /// The type of connection of #m_item.
const EDA_ITEM* m_parent; /// A pointer to the parent object (in the case of pins)
EDA_ITEM* m_item; ///< A pointer to the connectable object.
VECTOR2I m_pos; ///< The position of the connection point.
DANGLING_END_T m_type; ///< The type of connection of #m_item.
const EDA_ITEM* m_parent; ///< A pointer to the parent object (in the case of pins).
};
@ -204,7 +204,9 @@ public:
/**
* Swap the internal data structures \a aItem with the schematic item.
*
* Obviously, aItem must have the same type than me.
*
* @param aItem The item to swap the data structures with.
*/
virtual void SwapData( SCH_ITEM* aItem );
@ -216,6 +218,7 @@ public:
/**
* Routine to create a new copy of given item.
*
* The new object is not put in draw list (not linked).
*
* @param doClone (default = false) indicates unique values (such as timestamp and
@ -239,10 +242,13 @@ public:
virtual bool GetExcludedFromSim() const { return false; }
/**
* @return true for items which are moved with the anchor point at mouse cursor
* and false for items moved with no reference to anchor
* Check if object is movable from the anchor point.
*
* Usually return true for small items (labels, junctions) and false for
* items which can be large (hierarchical sheets, symbols)
* items which can be large (hierarchical sheets, symbols).
*
* @retval true for items which are moved with the anchor point at mouse cursor.
* @retval false for items moved with no reference to anchor.
*/
virtual bool IsMovableFromAnchorPoint() const { return true; }
@ -250,12 +256,12 @@ public:
void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
/**
* Searches the item hierarchy to find a SCHEMATIC.
* Search the item hierarchy to find a #SCHEMATIC.
*
* Every SCH_ITEM that lives on a SCH_SCREEN should be parented to either that screen
* or another SCH_ITEM on the same screen (for example, pins to their symbols).
* Every #SCH_ITEM that lives on a #SCH_SCREEN should be parented to either that screen
* or another #SCH_ITEM on the same screen (for example, pins to their symbols).
*
* Every SCH_SCREEN should be parented to the SCHEMATIC.
* Every #SCH_SCREEN should be parented to the #SCHEMATIC.
*
* @note This hierarchy is not the same as the sheet hierarchy!
*
@ -302,7 +308,9 @@ public:
/**
* Return a measure of how likely the other object is to represent the same
* object. The scale runs from 0.0 (definitely different objects) to 1.0 (same)
* object.
*
* The scale runs from 0.0 (definitely different objects) to 1.0 (same)
*/
virtual double Similarity( const SCH_ITEM& aItem ) const
{
@ -343,7 +351,8 @@ public:
*/
virtual void MirrorHorizontally( int aCenter )
{
wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
wxCHECK_MSG( false, /*void*/,
wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
}
/**
@ -533,7 +542,7 @@ public:
return false;
}
/// Updates the connection graph for all connections in this item
/// Update the connection graph for all connections in this item.
void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
virtual bool HasCachedDriverName() const { return false; }
@ -609,17 +618,17 @@ public:
}
/**
* Reset the cache of rule areas (called prior to schematic connectivity recomputation)
* Reset the cache of rule areas (called prior to schematic connectivity computation)
*/
void ClearRuleAreasCache() { m_rule_areas_cache.clear(); }
/**
* Adds a rule area to the item's cache
* Add a rule area to the item's cache.
*/
void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
/**
* Gets the cache of rule areas enclosing this item
* Get the cache of rule areas enclosing this item.
*/
const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
{

View File

@ -1093,6 +1093,7 @@ bool SCH_LABEL_BASE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemL
AddConnectionTo( *aPath, sch_item );
sch_item->AddConnectionTo( *aPath, this );
}
break;
}
@ -1122,6 +1123,7 @@ bool SCH_LABEL_BASE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemL
AddConnectionTo( *aPath, sch_item );
sch_item->AddConnectionTo( *aPath, this );
}
break;
}
}
@ -1295,6 +1297,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
// Make sheet pins and hierarchical labels clickable hyperlinks
bool linkAlreadyPlotted = false;
if( aPlotOpts.m_PDFHierarchicalLinks )
{
if( Type() == SCH_HIER_LABEL_T )
@ -1330,8 +1333,8 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
_( "Net" ),
connection->Name() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Resolved netclass" ),
properties.emplace_back(
wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
GetEffectiveNetClass()->GetHumanReadableName() ) );
}
@ -1580,6 +1583,7 @@ void SCH_DIRECTIVE_LABEL::MirrorSpinStyle( bool aLeftRight )
void SCH_DIRECTIVE_LABEL::MirrorHorizontally( int aCenter )
{
VECTOR2I old_pos = GetPosition();
// The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
// vertical shape (like a text reduced to only "I" letter).
// So the mirroring is not exactly similar to a SCH_TEXT item
@ -2257,8 +2261,9 @@ static struct SCH_DIRECTIVE_LABEL_DESC
propMgr.InheritsAfter( TYPE_HASH( SCH_DIRECTIVE_LABEL ), TYPE_HASH( SCH_LABEL_BASE ) );
propMgr.AddProperty( new PROPERTY_ENUM<SCH_DIRECTIVE_LABEL, FLAG_SHAPE>( _HKI( "Shape" ),
&SCH_DIRECTIVE_LABEL::SetFlagShape, &SCH_DIRECTIVE_LABEL::GetFlagShape ) );
propMgr.AddProperty( new PROPERTY_ENUM<SCH_DIRECTIVE_LABEL, FLAG_SHAPE>(
_HKI( "Shape" ), &SCH_DIRECTIVE_LABEL::SetFlagShape,
&SCH_DIRECTIVE_LABEL::GetFlagShape ) );
propMgr.AddProperty( new PROPERTY<SCH_DIRECTIVE_LABEL, int>( _HKI( "Pin length" ),
&SCH_DIRECTIVE_LABEL::SetPinLength, &SCH_DIRECTIVE_LABEL::GetPinLength,

View File

@ -34,8 +34,9 @@ class SCH_RULE_AREA;
/*
* Spin style for labels of all kinds on schematics
* Basically a higher level abstraction of rotation and justification of text
* Spin style for labels of all kinds on schematics.
*
* Basically a higher level abstraction of rotation and justification of text.
*/
class SPIN_STYLE
{
@ -134,7 +135,7 @@ enum GLOBALLABEL_FIELD_T
{
INTERSHEET_REFS = 0,
/// The first 2 are mandatory, and must be instantiated in SCH_SHEET
/// The first 2 are mandatory, and must be instantiated in #SCH_SHEET.
GLOBALLABEL_MANDATORY_FIELD_COUNT
};
@ -233,7 +234,7 @@ public:
}
/**
* Increment the label text, if it ends with a number.
* Increment the label text if it ends with a number.
*
* @param aIncrement = the increment value to add to the number ending the text.
*/
@ -253,7 +254,8 @@ public:
void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
/**
* Builds an array of { pageNumber, pageName } pairs.
* Build an array of { pageNumber, pageName } pairs.
*
* @param pages [out] Array of { pageNumber, pageName } pairs.
*/
void GetIntersheetRefs( const SCH_SHEET_PATH* aPath,
@ -350,21 +352,19 @@ public:
/**
* @brief autoRotateOnPlacement
* @return Returns true if the label rotation will be automatically set on the placement
* @return true if the label rotation will be automatically set on the placement.
*/
bool AutoRotateOnPlacement() const;
/**
* @brief setAutoRotateOnPlacement
* @param autoRotate If set to true when the label is placed in the connection to a
* pin/net the direction will be automatically set according to the positioning of the net/pin
* pin/net the direction will be automatically set according to the positioning of the net/pin.
*/
void SetAutoRotateOnPlacement( bool autoRotate = true );
/**
* @brief AutoRotateOnPlacementSupported
* @return true if the automated rotation of the label is supported after the placement
* At the moment it is supported for global and hierarchial labels
* At the moment it is supported for global and hierarchical labels
*/
virtual bool AutoRotateOnPlacementSupported() const = 0;
@ -512,7 +512,7 @@ private:
int m_pinLength;
int m_symbolSize;
/// Cache of any rule areas with borders which this label connects to
/// Cache of any rule areas with borders which this label connects to.
std::unordered_set<SCH_RULE_AREA*> m_connected_rule_areas;
};

View File

@ -96,7 +96,7 @@ public:
int GetReverseAngleFrom( const VECTOR2I& aPoint ) const;
/**
* Gets the angle between the start and end lines.
* Get the angle between the start and end lines.
*
* @return Line angle in radians.
*/
@ -106,8 +106,10 @@ public:
}
/**
* Saves the current line angle. Useful when dragging a line and its important to
* be able to restart the line from length 0 in the correct direction.
* Save the current line angle.
*
* Useful when dragging a line and its important to be able to restart the line from length
* 0 in the correct direction.
*/
inline void StoreAngle()
{
@ -118,14 +120,14 @@ public:
inline void StoreAngle( const EDA_ANGLE& aAngle ) { m_storedAngle = aAngle; }
/**
* Returns the angle stored by StoreAngle()
* Return the angle stored by StoreAngle().
*
* @return Stored angle in radians.
*/
inline EDA_ANGLE GetStoredAngle() const { return m_storedAngle; }
/**
* Checks if line is orthogonal (to the grid).
* Check if line is orthogonal (to the grid).
*
* @return True if orthogonal, false if not or the line is zero length.
*/
@ -164,12 +166,13 @@ public:
void SetLineStyle( const LINE_STYLE aStyle );
LINE_STYLE GetLineStyle() const;
/// @return the style that the line should be drawn in
/// this might be set on the line or inherited from the line's netclass
LINE_STYLE GetEffectiveLineStyle() const;
// Special Getter/Setters for properties panel. Required because it uses WIRE_STYLE instead
// of LINE_STYLE. (The two enums are identical, but we expose "default" in the WIRE_STYLE
// Special Getter/Setters for properties panel. Required because it uses #WIRE_STYLE instead
// of #LINE_STYLE. (The two enums are identical, but we expose "default" in the #WIRE_STYLE
// property while we don't with the LINE_STYLE property.)
void SetWireStyle( const WIRE_STYLE aStyle ) { SetLineStyle( (LINE_STYLE) aStyle ); }
WIRE_STYLE GetWireStyle() const { return (WIRE_STYLE) GetLineStyle(); }
@ -179,7 +182,7 @@ public:
void SetLineColor( const double r, const double g, const double b, const double a );
/// Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line
/// Return #COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
COLOR4D GetLineColor() const;
void SetLineWidth( const int aSize );

View File

@ -211,10 +211,10 @@ SCH_MARKER* SCH_MARKER::DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
bool isLegacyMarker = true;
// Deserialize sheet / item specific paths - we are not able to use the file version to determine
// if markers are legacy as there could be a file opened with a prior version but which has
// new markers - this code is called not just during schematic load, but also to match new
// ERC exceptions to exclusions.
// Deserialize sheet / item specific paths - we are not able to use the file version to
// determine if markers are legacy as there could be a file opened with a prior version
// but which has new markers - this code is called not just during schematic load, but
// also to match new ERC exceptions to exclusions.
if( props.size() == 8 )
{
isLegacyMarker = false;
@ -224,6 +224,7 @@ SCH_MARKER* SCH_MARKER::DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
KIID_PATH sheetSpecificKiidPath( props[5] );
std::optional<SCH_SHEET_PATH> sheetSpecificPath =
aSheetList.GetSheetPathByKIIDPath( sheetSpecificKiidPath, true );
if( sheetSpecificPath.has_value() )
ercItem->SetSheetSpecificPath( sheetSpecificPath.value() );
}
@ -233,6 +234,7 @@ SCH_MARKER* SCH_MARKER::DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
KIID_PATH mainItemKiidPath( props[6] );
std::optional<SCH_SHEET_PATH> mainItemPath =
aSheetList.GetSheetPathByKIIDPath( mainItemKiidPath, true );
if( mainItemPath.has_value() )
{
if( props[7].IsEmpty() )

View File

@ -54,7 +54,8 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
wxString SerializeToString() const;
static SCH_MARKER* DeserializeFromString( const SCH_SHEET_LIST& aSheetList, const wxString& data );
static SCH_MARKER* DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
const wxString& data );
std::vector<int> ViewGetLayers() const override;
@ -111,13 +112,15 @@ public:
EDA_ITEM* Clone() const override;
/**
* Sets this marker as a legacy artifact. Legacy markers are those deserialized from a file
* version < 20230121
* Set this marker as a legacy artifact.
*
* Legacy markers are those deserialized from a file version < 20230121.
*/
void SetIsLegacyMarker( bool isLegacyMarker = true ) { m_isLegacyMarker = isLegacyMarker; }
/**
* Determines if this marker is legacy (i.e. does not store sheet paths for specific errors)
* Determine if this marker is legacy (i.e. does not store sheet paths for specific errors).
*
* @return True if marker deserialized from a file version < 20230121
*/
bool IsLegacyMarker() const { return m_isLegacyMarker; }
@ -139,7 +142,7 @@ public:
protected:
KIGFX::COLOR4D getColor() const override;
bool m_isLegacyMarker; /// True if marker was deserialized from a file version < 20230121
bool m_isLegacyMarker; ///< True if marker was deserialized from a file version < 20230121.
};
#endif // TYPE_SCH_MARKER_H_

View File

@ -43,7 +43,7 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const VECTOR2I& pos ) :
SCH_ITEM( nullptr, SCH_NO_CONNECT_T )
{
m_pos = pos;
m_size = schIUScale.MilsToIU( DEFAULT_NOCONNECT_SIZE ); ///< No-connect symbol size.
m_size = schIUScale.MilsToIU( DEFAULT_NOCONNECT_SIZE ); // Default no-connect symbol size.
SetLayer( LAYER_NOCONNECT );
}

View File

@ -115,6 +115,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
return false;
}
void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
{
@ -296,6 +297,7 @@ COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDr
bool aDimmed ) const
{
COLOR4D color = m_schSettings.GetLayerColor( aLayer );
// Graphic items of a SYMBOL frequently use the LAYER_DEVICE layer color
// (i.e. when no specific color is set)
bool isSymbolChild = aItem->GetParentSymbol() != nullptr;
@ -766,6 +768,7 @@ static void drawAltPinModesIcon( GAL& aGal, const VECTOR2D& aPos, double aSize,
aGal.Save();
aGal.Translate( aPos );
if( aRotate )
{
aGal.Rotate( ANGLE_270.AsRadians() );
@ -807,6 +810,7 @@ static void drawAltPinModesIcon( GAL& aGal, const VECTOR2D& aPos, double aSize,
aGal.DrawLine( topLineREnd - VECTOR2D{ aSize, 0 },
topLineREnd - VECTOR2D{ aSize * 0.7, 0 } );
}
aGal.DrawLine( topLineREnd, topLineREnd - VECTOR2D{ arrowHead * 1.2, arrowHead } );
aGal.DrawLine( topLineREnd, topLineREnd - VECTOR2D{ arrowHead * 1.2, -arrowHead } );
@ -821,6 +825,7 @@ static void drawAltPinModesIcon( GAL& aGal, const VECTOR2D& aPos, double aSize,
aGal.DrawArc( topLineREnd - VECTOR2D{ aSize, -lineYOffset },
lineYOffset, ANGLE_0, -ANGLE_90 );
}
aGal.DrawArc( topLineREnd - VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset },
lineYOffset, ANGLE_180, -ANGLE_90 );
@ -1138,7 +1143,7 @@ void SCH_PAINTER::draw( const SCH_PIN* aPin, int aLayer, bool aDimmed )
return getRenderColor( aPin, aDrawnLayer, drawingShadows, aDimmed );
};
// Request text layout infor and draw it
// Request text layout info and draw it
if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> numInfo = cache.GetPinNumberInfo( shadowWidth ) )
{
@ -1167,7 +1172,6 @@ void SCH_PAINTER::draw( const SCH_PIN* aPin, int aLayer, bool aDimmed )
}
// Draw anchor indicating the anchor position of text objects, local labels, or fields.
void SCH_PAINTER::drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows )
{
if( m_schSettings.IsPrinting() )
@ -1192,8 +1196,6 @@ void SCH_PAINTER::drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows )
}
// Draw the target (an open square) for a wire or label which has no connection or is
// being moved.
void SCH_PAINTER::drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDangling, bool aDrawingShadows, bool aBrightened )
{
@ -2118,9 +2120,11 @@ void SCH_PAINTER::draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed )
if( aTable->StrokeHeader() )
{
if( !first->GetTextAngle().IsHorizontal() )
strokeLine( VECTOR2I( first->GetEndX(), pos.y ), VECTOR2I( first->GetEndX(), first->GetEndY() ) );
strokeLine( VECTOR2I( first->GetEndX(), pos.y ),
VECTOR2I( first->GetEndX(), first->GetEndY() ) );
else
strokeLine( VECTOR2I( pos.x, first->GetEndY() ), VECTOR2I( end.x, first->GetEndY() ) );
strokeLine( VECTOR2I( pos.x, first->GetEndY() ),
VECTOR2I( end.x, first->GetEndY() ) );
}
if( aTable->StrokeExternal() )
@ -2257,7 +2261,8 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
BOX2I bbox = aSymbol->GetBodyBoundingBox();
BOX2I pins = aSymbol->GetBodyAndPinsBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
std::max( bbox.GetY() - pins.GetY(),
pins.GetEnd().y - bbox.GetEnd().y ) );
int strokeWidth = 3 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
@ -2713,7 +2718,8 @@ void SCH_PAINTER::draw( const SCH_SHEET* aSheet, int aLayer )
BOX2I bbox = aSheet->GetBodyBoundingBox();
BOX2I pins = aSheet->GetBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
std::max( bbox.GetY() - pins.GetY(),
pins.GetEnd().y - bbox.GetEnd().y ) );
int strokeWidth = 3 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
@ -2792,11 +2798,14 @@ void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
if( aEntry->IsSelected() )
{
line.SetSelected();
// Never show unselected endpoints on bus entries
line.SetFlags( STARTPOINT | ENDPOINT );
}
else if( aEntry->IsBrightened() )
{
line.SetBrightened();
}
line.SetStartPoint( aEntry->GetPosition() );
line.SetEndPoint( aEntry->GetEnd() );
@ -2889,6 +2898,7 @@ void SCH_PAINTER::draw( const SCH_BITMAP* aBitmap, int aLayer )
// Draws a bounding box.
VECTOR2D bm_size( refImage.GetSize() );
// bm_size is the actual image size in UI.
// but m_gal scale was previously set to img_scale
// so recalculate size relative to this image size.

View File

@ -103,14 +103,21 @@ private:
void drawPinDanglingIndicator( const SCH_PIN& aPin, const COLOR4D& aColor, bool aDrawingShadows,
bool aBrightened );
/**
* Draw the target (an open square) for a wire or label which has no connection or is
* being moved.
*/
void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDangling, bool aDrawingShadows, bool aBrightened );
/// Draw anchor indicating the anchor position of text objects, local labels, or fields.
void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
int internalPinDecoSize( const SCH_PIN &aPin );
int externalPinDecoSize( const SCH_PIN &aPin );
// Indicates the item is drawn on a non-cached layer in OpenGL
/// Indicates the item is drawn on a non-cached layer in OpenGL.
bool nonCached( const EDA_ITEM* aItem );
bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;

View File

@ -70,9 +70,8 @@ wxString SCH_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType )
/// Utility for getting the size of the 'internal' pin decorators (as a radius)
// i.e. the clock symbols (falling clock is actually external but is of
// the same kind)
/// i.e. the clock symbols (falling clock is actually external but is of
/// the same kind)
static int internalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin )
{
const SCH_RENDER_SETTINGS* settings = static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
@ -83,9 +82,10 @@ static int internalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN
return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
}
/// Utility for getting the size of the 'external' pin decorators (as a radius)
// i.e. the negation circle, the polarity 'slopes' and the nonlogic
// marker
/// i.e. the negation circle, the polarity 'slopes' and the nonlogic
/// marker
static int externalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin )
{
const SCH_RENDER_SETTINGS* settings = static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
@ -175,10 +175,6 @@ SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, SCH_PIN* aLibPin ) :
}
/**
* Create a proxy pin from an alternate pin designation.
* The SCH_PIN data will be filled in when the pin is resolved (see SCH_SYMBOL::UpdatePins).
*/
SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt,
const KIID& aUuid ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T ),
@ -409,6 +405,7 @@ void SCH_PIN::SetName( const wxString& aName )
return;
m_name = aName;
// pin name string does not support spaces
m_name.Replace( wxT( " " ), wxT( "_" ) );
@ -1244,7 +1241,8 @@ void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
attrs.m_Valign = vJustify;
attrs.m_Multiline = false;
aPlotter->PlotText( VECTOR2I( x, y ), nameColor, name, attrs, font, GetFontMetrics() );
aPlotter->PlotText( VECTOR2I( x, y ), nameColor, name, attrs, font,
GetFontMetrics() );
};
auto plotNum =
@ -1259,14 +1257,15 @@ void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
attrs.m_Valign = vJustify;
attrs.m_Multiline = false;
aPlotter->PlotText( VECTOR2I( x, y ), numColor, number, attrs, font, GetFontMetrics() );
aPlotter->PlotText( VECTOR2I( x, y ), numColor, number, attrs, font,
GetFontMetrics() );
};
/* Draw the text inside, but the pin numbers outside. */
// Draw the text inside, but the pin numbers outside.
if( aTextInside )
{
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) ) /* Its an horizontal line. */
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) ) // It's a horizontal line.
{
if( aDrawPinName )
{
@ -1288,7 +1287,7 @@ void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
}
}
else /* Its a vertical line. */
else // It's a vertical line.
{
if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
{
@ -1320,12 +1319,12 @@ void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
}
}
}
else /* Draw num & text pin outside */
else // Draw num & text pin outside.
{
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
{
/* Its an horizontal line. */
// It's an horizontal line.
if( aDrawPinName && aDrawPinNum )
{
plotName( ( x1 + aPinPos.x) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
@ -1347,7 +1346,7 @@ void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
}
else
{
/* Its a vertical line. */
// Its a vertical line.
if( aDrawPinName && aDrawPinNum )
{
plotName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
@ -1887,8 +1886,6 @@ wxString SCH_PIN::getItemDescription( ALT* aAlt ) const
}
int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
{
// Ignore the UUID here.
@ -1901,69 +1898,6 @@ int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
wxCHECK( tmp, -1 );
// When comparing units, we do not compare the part numbers. If everything else is
// identical, then we can just renumber the parts for the inherited symbol.
// if( !( aCompareFlags & SCH_ITEM::COMPARE_FLAGS::UNIT ) && m_number != tmp->m_number )
// return m_number.Cmp( tmp->m_number );
// int result = m_name.Cmp( tmp->m_name );
// if( result )
// return result;
// if( m_position.x != tmp->m_position.x )
// return m_position.x - tmp->m_position.x;
// if( m_position.y != tmp->m_position.y )
// return m_position.y - tmp->m_position.y;
// if( m_length != tmp->m_length )
// return m_length.value_or( 0 ) - tmp->m_length.value_or( 0 );
// if( m_orientation != tmp->m_orientation )
// return static_cast<int>( m_orientation ) - static_cast<int>( tmp->m_orientation );
// if( m_shape != tmp->m_shape )
// return static_cast<int>( m_shape ) - static_cast<int>( tmp->m_shape );
// if( m_type != tmp->m_type )
// return static_cast<int>( m_type ) - static_cast<int>( tmp->m_type );
// if( m_hidden != tmp->m_hidden )
// return m_hidden.value_or( false ) - tmp->m_hidden.value_or( false );
// if( m_numTextSize != tmp->m_numTextSize )
// return m_numTextSize.value_or( 0 ) - tmp->m_numTextSize.value_or( 0 );
// if( m_nameTextSize != tmp->m_nameTextSize )
// return m_nameTextSize.value_or( 0 ) - tmp->m_nameTextSize.value_or( 0 );
// if( m_alternates.size() != tmp->m_alternates.size() )
// return static_cast<int>( m_alternates.size() - tmp->m_alternates.size() );
// auto lhsItem = m_alternates.begin();
// auto rhsItem = tmp->m_alternates.begin();
// while( lhsItem != m_alternates.end() )
// {
// const ALT& lhsAlt = lhsItem->second;
// const ALT& rhsAlt = rhsItem->second;
// int retv = lhsAlt.m_Name.Cmp( rhsAlt.m_Name );
// if( retv )
// return retv;
// if( lhsAlt.m_Type != rhsAlt.m_Type )
// return static_cast<int>( lhsAlt.m_Type ) - static_cast<int>( rhsAlt.m_Type );
// if( lhsAlt.m_Shape != rhsAlt.m_Shape )
// return static_cast<int>( lhsAlt.m_Shape ) - static_cast<int>( rhsAlt.m_Shape );
// ++lhsItem;
// ++rhsItem;
// }
if( m_number != tmp->m_number )
return m_number.Cmp( tmp->m_number );
@ -2127,12 +2061,11 @@ void SCH_PIN::Show( int nestLevel, std::ostream& os ) const
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " num=\"" << m_number.mb_str()
<< '"' << "/>\n";
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
void SCH_PIN::CalcEdit( const VECTOR2I& aPosition )
{
if( IsMoving() )

View File

@ -54,6 +54,13 @@ public:
SCH_PIN( SCH_SYMBOL* aParentSymbol, SCH_PIN* aLibPin );
/**
* Create a proxy pin from an alternate pin designation.
*
* The #SCH_PIN data will be filled in when the pin is resolved.
*
* @see SCH_SYMBOL::UpdatePins().
*/
SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt,
const KIID& aUuid );
@ -206,14 +213,14 @@ public:
VECTOR2I GetPinRoot() const;
/**
* these transforms have effect only if the pin has a LIB_SYMBOL as parent
* These transforms have effect only if the pin has a #LIB_SYMBOL as parent.
*/
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
/**
* these transforms have always effects
* These transforms have always effects.
*/
void MirrorHorizontallyPin( int aCenter );
void MirrorVerticallyPin( int aCenter );
@ -221,6 +228,7 @@ public:
/**
* Plot the pin name and number.
*
* @param aTextInside - draw the names & numbers inside the symbol body (ie: in the opposite
* direction of \a aPinOrient).
*/
@ -311,6 +319,7 @@ protected:
/**
* Print the pin symbol without text.
*
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/
void printPinSymbol( const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aPos,
@ -318,6 +327,7 @@ protected:
/**
* Put the pin number and pin text info, given the pin line coordinates.
*
* The line must be vertical or horizontal.
* If aDrawPinName == false the pin name is not printed.
* If aDrawPinNum = false the pin number is not printed.
@ -329,7 +339,7 @@ protected:
bool aDrawPinName, bool aDimmed );
/**
* Draw the electrical type text of the pin (only for the footprint editor)
* Draw the electrical type text of the pin (only for the footprint editor).
*/
void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPosition,
PIN_ORIENTATION aOrientation, bool aDimmed );
@ -379,7 +389,8 @@ protected:
/**
* The layout cache for this pin.
* SCH_PIN doesn't *have* to own this, it could be part a central cache.
*
* #SCH_PIN doesn't *have* to own this, it could be part a central cache.
*/
mutable std::unique_ptr<PIN_LAYOUT_CACHE> m_layoutCache;

View File

@ -130,7 +130,7 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_OPTS& aPlotOpts,
}
else
{
// in eeschema, this prints the current page
// in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() );
}
@ -515,7 +515,7 @@ void SCH_PLOTTER::createSVGFiles( const SCH_PLOT_OPTS& aPlotOpts,
}
else
{
// in eeschema, this prints the current page
// in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() );
}
@ -592,6 +592,7 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree
const SCH_PLOT_OPTS& aPlotOpts )
{
PAGE_INFO plotPage;
// Adjust page size and scaling requests
const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
@ -658,7 +659,8 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
aScreen->GetTitleBlock(),
actualPage, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
actualPage, aScreen->Schematic()->GetProperties(),
aScreen->GetPageNumber(),
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
plotter->GetColorMode() ? color : COLOR4D::BLACK,
aScreen->GetVirtualPageNumber() == 1 );
@ -699,7 +701,7 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_OPTS& aPlotOpts,
}
else
{
// in eeschema, this prints the current page
// in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() );
}
@ -882,7 +884,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_OPTS& aPlotOpts,
}
else
{
// in eeschema, this prints the current page
// in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() );
}
@ -1048,6 +1050,7 @@ wxFileName SCH_PLOTTER::createPlotFileName( const SCH_PLOT_OPTS& aPlotOpts,
tmp.GetPath() );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}
retv.Clear();
SCHEMATIC_SETTINGS& settings = m_schematic->Settings();

View File

@ -120,23 +120,23 @@ struct SCH_PLOT_OPTS
/**
* Schematic plotting class
* Schematic plotting class.
*/
class SCH_PLOTTER
{
public:
/**
* Constructor for usage with a frame having the schematic we want to print loaded
* Constructor for usage with a frame having the schematic we want to print loaded.
*/
SCH_PLOTTER( SCH_EDIT_FRAME* aFrame );
/**
* Constructor for usage with a schematic that can be headless
* Constructor for usage with a schematic that can be headless.
*/
SCH_PLOTTER( SCHEMATIC* aSch );
/**
* Perform the plotting of the schematic using the given aPlotFormat and aPlotSettings
* Perform the plotting of the schematic using the given \a aPlotFormat and a\ aPlotSettings.
*
* @param aPlotFormat The resulting output plot format (PDF, SVG, DXF, etc)
* @param aPlotSettings The configuration for the plotting operation
@ -147,13 +147,14 @@ public:
SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr );
/**
* Get the last output file path, this is mainly intended for PDFs with the open after plot GUI option
* Get the last output file path, this is mainly intended for PDFs with the open after
* plot GUI option.
*/
wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
protected:
/**
* Returns the output filename for formats where the output is a single file
* Return the output filename for formats where the output is a single file.
*/
wxFileName getOutputFilenameSingle( const SCH_PLOT_OPTS& aPlotOpts, REPORTER* aReporter,
const wxString& ext );

View File

@ -876,7 +876,9 @@ void SCH_REFERENCE::Split()
while( ll >= 0 )
{
if( (refText[ll] <= ' ' ) || isdigit( refText[ll] ) )
{
ll--;
}
else
{
if( isdigit( refText[ll + 1] ) )
@ -969,6 +971,7 @@ wxString SCH_REFERENCE::formatRefStr( int aNumber ) const
return wxString::Format( "%d", aNumber );
}
#if defined( DEBUG )
void SCH_REFERENCE_LIST::Show( const char* aPrefix )
{

View File

@ -118,15 +118,15 @@ public:
}
/**
* @return the full patb of the symbol item
* @return the full path of the symbol item
*/
const wxString GetFullPath() const
{
return m_sheetPath.PathAsString() + m_symbolUuid.AsString();
}
/*
* Compares by full path to make std::set work
/**
* Compare by full path to make std::set work.
*/
bool operator<( const SCH_REFERENCE& aRef ) const { return GetFullPath() < aRef.GetFullPath(); }
@ -153,9 +153,9 @@ public:
void Split();
/**
* Determine if this reference needs to be split or if it likely already has been
* Determine if this reference needs to be split or if it likely already has been.
*
* @return true if this reference hasn't been split yet
* @return true if this reference hasn't been split yet.
*/
bool IsSplitNeeded();
@ -165,7 +165,7 @@ public:
void SetRefStr( const std::string& aReference ) { m_ref = aReference; }
const char* GetRefStr() const { return m_ref.c_str(); }
///< Return reference name with unit altogether
/// Return reference name with unit altogether.
wxString GetFullRef() const
{
wxString refNum = m_numRefStr;
@ -244,7 +244,8 @@ private:
int m_sheetNum; ///< The sheet number for the reference.
KIID m_symbolUuid; ///< UUID of the symbol.
int m_numRef; ///< The numeric part of the reference designator.
wxString m_numRefStr; ///< The numeric part in original string form (may have leading zeroes)
wxString m_numRefStr; ///< The numeric part in original string form (may have
///< leading zeroes).
int m_flag;
};
@ -300,9 +301,10 @@ public:
void RemoveItem( unsigned int aIndex );
/**
* Return true if aItem exists in this list
* @param aItem Reference to check
* @return true if aItem exists in this list
* Return true if aItem exists in this list.
*
* @param aItem Reference to check.
* @return true if aItem exists in this list.
*/
bool Contains( const SCH_REFERENCE& aItem ) const;
@ -331,7 +333,8 @@ public:
/**
* Treat all symbols in this list as non-annotated. Does not update annotation state of the
* symbols.
* @see SCH_REFERENCE_LIST::UpdateAnnotation
*
* @see SCH_REFERENCE_LIST::UpdateAnnotation()
*/
void RemoveAnnotation()
{
@ -355,7 +358,7 @@ public:
}
/**
* @brief Forces reannotation of the provided references. Will also reannotate
* Forces reannotation of the provided references. Will also reannotate
* associated multi-unit symbols.
*
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
@ -376,8 +379,9 @@ public:
SCH_SHEET_LIST* aHierarchy );
/**
* Convenience function for the Paste Unique functionality. Do not use as a general
* reannotation method.
* Convenience function for the Paste Unique functionality.
*
* @note Do not use as a general reannotation method.
*
* Replaces any duplicate reference designators with the next available number after the
* present number regardless of configured annotation options.

View File

@ -33,7 +33,7 @@
#include <geometry/rtree.h>
/**
* Implements an R-tree for fast spatial and type indexing of schematic items.
* Implement an R-tree for fast spatial and type indexing of schematic items.
* Non-owning.
*/
class EE_RTREE
@ -72,8 +72,9 @@ public:
}
/**
* Remove an item from the tree. Removal is done by comparing pointers, attempting
* to remove a copy of the item will fail.
* Remove an item from the tree.
*
* Removal is done by comparing pointers, attempting to remove a copy of the item will fail.
*/
bool remove( SCH_ITEM* aItem )
{
@ -115,8 +116,10 @@ public:
}
/**
* Determine if a given item exists in the tree. Note that this does not search the full tree
* so if the item has been moved, this will return false when it should be true.
* Determine if a given item exists in the tree.
*
* @note This does not search the full tree so if the item has been moved, this will return
* false when it should be true.
*
* @param aItem Item that may potentially exist in the tree.
* @param aRobust If true, search the whole tree, not just the bounding box.
@ -265,13 +268,15 @@ public:
}
/**
* Returns a read/write iterator that points to the first
* element in the %EE_RTREE
* N.B. The iteration order of the RTree is not readily apparent and will change
* Return a read/write iterator that points to the first.
* element in the #EE_RTREE.
*
* @note The iteration order of the RTree is not readily apparent and will change
* if/when you add or move items and the RTree is re-balanced. Any exposure of the
* RTree contents to the user MUST be sorted before being presented. See SCH_IO_KICAD_SEXPR::Format
* or SCH_EDITOR_CONTROL::nextMatch for examples.
* @return Complete RTree of the screen's items
* RTree contents to the user MUST be sorted before being presented. See
* SCH_IO_KICAD_SEXPR::Format() or SCH_EDITOR_CONTROL::nextMatch() for examples.
*
* @return Complete RTree of the screen's items.
*/
iterator begin()
{
@ -279,8 +284,7 @@ public:
}
/**
* Returns a read/write iterator that points to one past the last
* element in the %EE_RTREE
* Return a read/write iterator that points to one past the last element in the #EE_RTREE.
*/
iterator end()
{

View File

@ -69,61 +69,63 @@ public:
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
/// @brief Resets all item and directive caches, saving the current state first
/// Reset all item and directive caches, saving the current state first.
void ResetCaches( KIGFX::SCH_VIEW* view );
/// @brief Refreshes the list of items which this rule area affects
/// Refresh the list of items which this rule area affects.
void RefreshContainedItemsAndDirectives(
SCH_SCREEN* screen, KIGFX::SCH_VIEW* view,
std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>& forceUpdateRuleAreas );
/// @brief Fetches all items which were, or are, within the rule area
/// Fetch all items which were, or are, within the rule area.
std::unordered_set<SCH_ITEM*> GetPastAndPresentContainedItems() const;
/// @brief Updates all rule area connectvity / caches in the given sheet paths
/// @returns A map of all updated rule areas and their owning screen
/// Update all rule area connectvity / caches in the given sheet paths.
///
/// @return A map of all updated rule areas and their owning screen.
static std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>
UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screens, KIGFX::SCH_VIEW* view );
/// @brief Returns a set of all items contained within the rule area
/// Return a set of all items contained within the rule area.
const std::unordered_set<SCH_ITEM*>& GetContainedItems() const;
/// @brief Returns the set of all directive labels attached to the rule area border
/// Return the set of all directive labels attached to the rule area border.
const std::unordered_set<SCH_DIRECTIVE_LABEL*>& GetDirectives() const;
/// @brief Resolves the netclass of this rule area from connected directive labels
/// @returns The resolved netclass (if any), and the SCH_ITEM providing the declaration
/// Resolve the netclass of this rule area from connected directive labels.
///
/// @return The resolved netclass (if any), and the SCH_ITEM providing the declaration.
const std::vector<std::pair<wxString, SCH_ITEM*>> GetResolvedNetclasses() const;
/// @brief Clears and resets items and directives attached to this rule area
/// Clear and resets items and directives attached to this rule area.
void ResetDirectivesAndItems( KIGFX::SCH_VIEW* view );
/// @brief Gets the message panel info for the rule area
/// Get the message panel info for the rule area.
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected:
/// @brief Adds a directive label which applies to items within ths rule area
/// Add a directive label which applies to items within ths rule area.
void addDirective( SCH_DIRECTIVE_LABEL* label, KIGFX::SCH_VIEW* view );
/// @brief Clears the list of directives
/// Clear the list of directives.
void clearDirectives( KIGFX::SCH_VIEW* view );
/// @briefs Adds an item to the list of items which this rule area affects
/// Add an item to the list of items which this rule area affects.
void addContainedItem( SCH_ITEM* item );
/// @brief Clears the list of items which this rule area affects
/// Clear the list of items which this rule area affects.
void clearContainedItems();
/// All SCH_ITEMs currently contained or intersecting the rule area
/// All #SCH_ITEM objects currently contained or intersecting the rule area.
std::unordered_set<SCH_ITEM*> m_items;
/// All SCH_DIRECTIVE_LABELs attached to the rule area border
/// All #SCH_DIRECTIVE_LABEL objectss attached to the rule area border.
std::unordered_set<SCH_DIRECTIVE_LABEL*> m_directives;
/// All SCH_ITEMs contained or intersecting the rule area in the previous update
/// All #SCH_ITEM objectss contained or intersecting the rule area in the previous update.
std::unordered_set<SCH_ITEM*> m_prev_items;
/// All SCH_DIRECTIVE_LABELs attached to the rule area border in the previous update
/// All SCH_DIRECTIVE_LABEL objects attached to the rule area border in the previous update.
std::unordered_set<SCH_DIRECTIVE_LABEL*> m_prev_directives;
};

View File

@ -65,12 +65,14 @@
#include <core/profile.h>
#include "sch_bus_entry.h"
/*
/**
* Flag to enable profiling of the TestDanglingEnds() function.
*
* @ingroup trace_env_vars
*/
static const wxChar DanglingProfileMask[] = wxT( "DANGLING_PROFILE" );
SCH_SCREEN::SCH_SCREEN( EDA_ITEM* aParent ) :
BASE_SCREEN( aParent, SCH_SCREEN_T ),
m_fileFormatVersionAtLoad( 0 ),
@ -517,6 +519,7 @@ SPIN_STYLE SCH_SCREEN::GetLabelOrientationForPoint( const VECTOR2I& aPosit
const SCH_SHEET_PATH* aSheet ) const
{
auto ret = aDefaultOrientation;
for( SCH_ITEM* item : Items().Overlapping( aPosition ) )
{
if( item->GetEditFlags() & STRUCT_DELETED )
@ -529,7 +532,7 @@ SPIN_STYLE SCH_SCREEN::GetLabelOrientationForPoint( const VECTOR2I& aPosit
auto busEntry = static_cast<const SCH_BUS_WIRE_ENTRY*>( item );
if( busEntry->m_connected_bus_item )
{
// bus connected, take the bus direction into consideration ony if it is
// bus connected, take the bus direction into consideration only if it is
// vertical or horizontal
auto bus = static_cast<const SCH_LINE*>( busEntry->m_connected_bus_item );
if( bus->Angle().AsDegrees() == 90.0 )
@ -591,9 +594,11 @@ SPIN_STYLE SCH_SCREEN::GetLabelOrientationForPoint( const VECTOR2I& aPosit
}
}
break;
default: break;
}
}
return ret;
}
@ -871,7 +876,7 @@ void SCH_SCREEN::Print( const SCH_RENDER_SETTINGS* aSettings )
other.push_back( item );
}
/// Sort to ensure plot-order consistency with screen drawing
// Sort to ensure plot-order consistency with screen drawing.
std::stable_sort( other.begin(), other.end(),
[]( const SCH_ITEM* a, const SCH_ITEM* b )
{
@ -1279,6 +1284,7 @@ std::vector<VECTOR2I> SCH_SCREEN::GetConnections() const
{
return a.x < b.x || ( a.x == b.x && a.y < b.y );
} );
retval.erase( std::unique( retval.begin(), retval.end() ), retval.end() );
return retval;
@ -1785,8 +1791,8 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
const_cast<KIID&>( item->m_Uuid ) = KIID();
count++;
// @todo If the item is a sheet, we need to decend the heirarchy from the sheet
// and repace all instances of the changed UUID in sheet paths. Otherwise,
// @todo If the item is a sheet, we need to descend the hierarchy from the sheet
// and replace all instances of the changed UUID in sheet paths. Otherwise,
// all instance paths with the sheet's UUID will get clobbered.
}
}

View File

@ -97,13 +97,14 @@ public:
SCHEMATIC* Schematic() const;
/**
* Gets the full RTree, usually for iterating.
* N.B. The iteration order of the RTree is not readily apparent and will change
* Get the full RTree, usually for iterating.
*
* @note The iteration order of the RTree is not readily apparent and will change
* if/when you add or move items and the RTree is re-balanced. Any exposure of the
* RTree contents to the user MUST be sorted before being presented. See
* SCH_IO_KICAD_SEXPR::Format() or SCH_EDITOR_CONTROL::nextMatch() for examples.
*
* @return Complete RTree of the screen's items
* @return Complete RTree of the screen's items.
*/
EE_RTREE& Items() { return m_rtree; }
const EE_RTREE& Items() const { return m_rtree; }
@ -276,7 +277,7 @@ public:
void Update( SCH_ITEM* aItem, bool aUpdateLibSymbol = true );
/**
* Removes \a aItem from the linked list and deletes the object.
* Remove \a aItem from the linked list and deletes the object.
*
* If \a aItem is a schematic sheet label, it is removed from the screen associated with
* the sheet that contains the label to be deleted.
@ -313,7 +314,7 @@ public:
/**
* Test if a junction is required for the items at \a aPosition on the screen. Note that
* this coule be either an implied junction (bus entry) or an explicit junction (dot).
* this could be either an implied junction (bus entry) or an explicit junction (dot).
*
* A junction is required at \a aPosition if one of the following criteria is satisfied:
* - One wire midpoint and one or more wire endpoints.
@ -328,14 +329,16 @@ public:
bool IsJunction( const VECTOR2I& aPosition ) const;
/**
* Indicates that a junction dot is necessary at the given location. See IsJunctionNeeded
* for more info.
* Indicate that a junction dot is necessary at the given location.
*
* See IsJunctionNeeded() for more info.
*/
bool IsExplicitJunction( const VECTOR2I& aPosition ) const;
/**
* Indicates that a junction dot is necessary at the given location, and does not yet exist.
* See IsJunctionNeeded for more info.
* Indicate that a junction dot is necessary at the given location, and does not yet exist.
*
* See IsJunctionNeeded() for more info.
*/
bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const;
@ -343,8 +346,9 @@ public:
SPIN_STYLE aDefaultOrientation,
const SCH_SHEET_PATH* aSheet ) const;
/**
* Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded
* for more info.
* Indicate that a junction dot may be placed at the given location.
*
* See IsJunctionNeeded() for more info.
*/
bool IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const;
@ -511,7 +515,7 @@ public:
}
/**
* Return a set of bus aliases defined in this screen
* Return a set of bus aliases defined in this screen.
*/
auto& GetBusAliases() const
{
@ -663,7 +667,7 @@ private:
bool m_isReadOnly; ///< Read only status of the screen file.
///< Flag to indicate the file associated with this screen has been created.
/// Flag to indicate the file associated with this screen has been created.
bool m_fileExists;
/// List of bus aliases stored in this screen.
@ -704,9 +708,9 @@ private:
*
* Individual #SCH_SCREEN objects are unique and correspond to .sch files.
*
* NOTE: It may be desirable to fold the functionality of SCH_SCREENS into
* the new SCHEMATIC class at some point, since SCHEMATIC can also be thought
* of as owning the collection of all the SCH_SCREEN objects.
* @note It may be desirable to fold the functionality of #SCH_SCREENS into the new #SCHEMATIC
* class at some point, since SCHEMATIC can also be thought of as owning the collection
* of all the #SCH_SCREEN objects.
*/
class SCH_SCREENS
{
@ -816,7 +820,7 @@ public:
bool HasSchematic( const wxString& aSchematicFileName );
/**
* built the list of sheet paths sharing a screen for each screen in use
* Build the list of sheet paths sharing a screen for each screen in use.
*/
void BuildClientSheetPathList();

View File

@ -33,7 +33,8 @@ class SCH_SHAPE : public SCH_ITEM, public EDA_SHAPE
{
public:
SCH_SHAPE( SHAPE_T aShape = SHAPE_T::UNDEFINED, SCH_LAYER_ID aLayer = LAYER_NOTES,
int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL, KICAD_T aType = SCH_SHAPE_T );
int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL,
KICAD_T aType = SCH_SHAPE_T );
// Do not create a copy constructor. The one generated by the compiler is adequate.

View File

@ -100,7 +100,8 @@ SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, VECTOR2I aSize )
m_fields.back().SetVisible( true );
m_fields.back().SetLayer( LAYER_SHEETNAME );
m_fields.emplace_back( aPos, SHEETFILENAME, this, GetDefaultFieldName( SHEETFILENAME, DO_TRANSLATE ) );
m_fields.emplace_back( aPos, SHEETFILENAME, this,
GetDefaultFieldName( SHEETFILENAME, DO_TRANSLATE ) );
m_fields.back().SetVisible( true );
m_fields.back().SetLayer( LAYER_SHEETNAME );
@ -1329,7 +1330,8 @@ void SCH_SHEET::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBod
BOX2I pins = GetBoundingBox();
COLOR4D dnp_color = aSettings->GetLayerColor( LAYER_DNP_MARKER );
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
std::max( bbox.GetY() - pins.GetY(),
pins.GetEnd().y - bbox.GetEnd().y ) );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
@ -1545,7 +1547,7 @@ bool SCH_SHEET::HasPageNumberChanges( const SCH_SHEET& aOther ) const
std::vector<SCH_SHEET_INSTANCE> instances = GetInstances();
std::vector<SCH_SHEET_INSTANCE> otherInstances = aOther.GetInstances();
// Sorting may not be necessary but there is no guaratee that sheet
// Sorting may not be necessary but there is no guarantee that sheet
// instance data will be in the correct KIID_PATH order. We should
// probably use a std::map instead of a std::vector to store the sheet
// instance data.
@ -1730,8 +1732,10 @@ static struct SCH_SHEET_DESC
propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Simulation" ),
&SCH_SHEET::SetExcludedFromSim, &SCH_SHEET::GetExcludedFromSim ),
groupAttributes );
propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Bill of Materials" ),
&SCH_SHEET::SetExcludedFromBOM, &SCH_SHEET::GetExcludedFromBOM ),
propMgr.AddProperty(
new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Bill of Materials" ),
&SCH_SHEET::SetExcludedFromBOM,
&SCH_SHEET::GetExcludedFromBOM ),
groupAttributes );
propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Do not Populate" ),
&SCH_SHEET::SetDNP, &SCH_SHEET::GetDNP ),

View File

@ -63,8 +63,10 @@ public:
schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ) );
/**
* Copy \a aSheet into a new object. All sheet pins are copied as is except and
* the SCH_SHEET_PIN's #m_Parent pointers are set to the new copied parent object.
* Copy \a aSheet into a new object.
*
* All sheet pins are copied as is except and the #SCH_SHEET_PIN object's #m_Parent pointers
* are set to the new copied parent object.
*/
SCH_SHEET( const SCH_SHEET& aSheet );
@ -207,7 +209,7 @@ public:
SCH_SHEET_PIN* GetPin( const VECTOR2I& aPosition );
/**
* Checks if the sheet already has a sheet pin named \a aName.
* Check if the sheet already has a sheet pin named \a aName.
*
* @param aName Name of the sheet pin to search for.
* @return True if sheet pin with \a aName is found, otherwise false.
@ -259,8 +261,9 @@ public:
/**
* Rotating around the boundingBox's center can cause walking when the sheetname or
* filename is longer than the edge it's on. Use this instead, which always returns
* the center of the sheet itself.
* filename is longer than the edge it's on.
*
* Use this instead, which always returns the center of the sheet itself.
*/
VECTOR2I GetRotationCenter() const;
@ -383,7 +386,7 @@ public:
bool GetExcludedFromBoard() const { return m_excludedFromBoard; }
/**
* Set or clear the 'Do Not Populate' flaga
* Set or clear the 'Do Not Populate' flags
*/
bool GetDNP() const { return m_DNP; }
void SetDNP( bool aDNP ) { m_DNP = aDNP; }
@ -454,7 +457,7 @@ public:
bool HasPageNumberChanges( const SCH_SHEET& aOther ) const;
/**
* Compares page numbers of schematic sheets.
* Compare page numbers of schematic sheets.
*
* @return 0 if the page numbers are equal, -1 if aPageNumberA < aPageNumberB, 1 otherwise
*/

View File

@ -44,6 +44,7 @@
/**
* A singleton item of this class is returned for a weak reference that no longer exists.
*
* Its sole purpose is to flag the item as having been deleted.
*/
class DELETED_SHEET_ITEM : public SCH_ITEM
@ -95,6 +96,7 @@ public:
#endif
};
namespace std
{
size_t hash<SCH_SHEET_PATH>::operator()( const SCH_SHEET_PATH& path ) const
@ -144,8 +146,9 @@ void SCH_SHEET_PATH::initFromOther( const SCH_SHEET_PATH& aOther )
m_current_hash = aOther.m_current_hash;
m_cached_page_number = aOther.m_cached_page_number;
// Note: don't copy m_recursion_test_cache as it is slow and we want std::vector<SCH_SHEET_PATH> to be
// very fast to construct for use in the connectivity algorithm.
// Note: don't copy m_recursion_test_cache as it is slow and we want
// std::vector<SCH_SHEET_PATH> to be very fast to construct for use in
// the connectivity algorithm.
}
@ -417,7 +420,6 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() const
}
void SCH_SHEET_PATH::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
bool aForceIncludeOrphanSymbols ) const
{
@ -621,8 +623,8 @@ void SCH_SHEET_PATH::AddNewSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPa
if( symbol->GetInstance( newSymbolInstance, Path(), true ) )
{
newSymbolInstance.m_ProjectName = aProjectName;
// Use an existing symbol instance for this path if it exists.
// Use an existing symbol instance for this path if it exists.
newSymbolInstance.m_Path = newSheetPath.Path();
symbol->AddHierarchicalReference( newSymbolInstance );
}
@ -687,7 +689,7 @@ void SCH_SHEET_PATH::CheckForMissingSymbolInstances( const wxString& aProjectNam
symbol->m_Uuid.AsString(), PathHumanReadable( false ) );
// Legacy schematics that are not shared do not contain separate instance data.
// The symbol refrence and unit are saved in the reference field and unit entries.
// The symbol reference and unit are saved in the reference field and unit entries.
if( ( LastScreen()->GetRefCount() <= 1 ) &&
( LastScreen()->GetFileFormatVersionAtLoad() <= 20200310 ) )
{
@ -835,7 +837,7 @@ void SCH_SHEET_LIST::SortByPageNumbers( bool aUpdateVirtualPageNums )
else if( a.GetVirtualPageNumber() > b.GetVirtualPageNumber() )
return false;
/// Enforce strict ordering. If the page numbers are the same, use UUIDs
// Enforce strict ordering. If the page numbers are the same, use UUIDs
return a.GetCurrentHash() < b.GetCurrentHash();
} );

View File

@ -73,38 +73,34 @@ struct SCH_SHEET_INSTANCE
/**
* Complex hierarchies
* @defgroup hierarchical_schematics Hierarchical Schematics
*
* A hierarchical schematic uses sheets (hierarchical sheets) included in a given sheet.
* Each sheet corresponds to a schematic drawing handled by a SCH_SCREEN structure. A
* SCH_SCREEN structure contains drawings, and have a filename to write its data. Also a
* SCH_SCREEN displays a sheet number and the name of the sheet.
* KiCad supports nesting schematics hierarchically to simplify the creation of complex
* schematics designs. A hierarchical schematic uses hierarchical sheets (#SCH_SHEET objects)
* to reference a given schematic file (#SCH_SCREEN objects). Each #SCH_SHEET corresponds to
* a schematic file handled by a #SCH_SCREEN object. A #SCH_SCREEN object contains schematic
* drawings and has a filename to read/write its data.
*
* In simple (and flat) hierarchies a sheet is linked to a SCH_SCREEN, and a SCH_SCREEN is
* used by the single hierarchical sheet.
* In simple hierarchies one #SCH_SHEET object is linked to one #SCH_SCREEN object.
*
* In complex hierarchies the same SCH_SCREEN (and its data) is shared by more than one sheet.
* Therefore subsheets (like subsheets in a SCH_SCREEN shared by many sheets) can also be
* shared. So the same SCH_SCREEN must handle different symbol references and unit selections
* depending on which sheet is currently selected, and how a given subsheet is selected. Two
* sheets share the same SCH_SCREEN (the same drawings) if they have the same filename.
* In complex hierarchies the a #SCH_SCREEN object shared by more than one #SCH_SHEET object.
* Therefore all sub-sheets can also be shared. So the same #SCH_SCREEN must handle different
* symbol references and unit selections depending on which sheet is currently selected, and
* how a given subsheet is selected. #SCH_SHEET objects share the same #SCH_SCREEN object if
* they have the same schematic file.
*
* In KiCad each symbol and sheet receives (when created) a uuid. So each sheet has 2 id: its
* uuid (which cannot change) and its name (that can be edited and therefore is not reliable
* for strong identification).
* A given sheet in a hierarchy is fully labeled by its path (or sheet path) that is the list
* of uuids found to access it through the hierarchy. The root sheet is /. All other sheets
* have a path like /1234ABCD or /4567FEDC/AA2233DD/. This path can be displayed as human
* readable sheet name like: / or /sheet1/include_sheet/ or /sheet2/include_sheet/
* In KiCad each #SCH_SYMBOL and #SCH_SHEET receives a UUID when created. These UUIDs are
* chained together to form #SCH_SHEET_PATH objects that allow access of instance data in the
* hierarchy. The sheet paths have the form /ROOT_SHEET_UUID/SHEET_UUID/SUB_SHEET_UUID/...
*
* So to know for a given SCH_SCREEN (a given schematic drawings) we must:
* 1) Handle all references possibilities.
* 2) When acceded by a given selected sheet, display (update) the
* corresponding references and sheet path
* For a given #SCH_SCREEN #SCH_SHEET_PATH objects must:
* 1) Handle all #SCH_SYMBOL references and unit instance data.
* 2) Handle all #SCH_SHEET page number instance data.
* 2) Update the currently displayed sheet #SCH_SYMBOL references and #SCH_SHEET page numbers.
*
* The class SCH_SHEET_PATH handles paths used to access a sheet. The class SCH_SHEET_LIST
* The class #SCH_SHEET_PATH handles paths used to access a sheet. The class #SCH_SHEET_LIST
* allows one to handle the full (or partial) list of sheets and their paths in a complex
* hierarchy. The class EDA_ScreenList allows one to handle the list of SCH_SCREEN. It is
* hierarchy. The class #SCH_SCREENS allows one to handle a list of #SCH_SCREEN objects. It is
* useful to clear or save data, but is not suitable to handle the full complex hierarchy
* possibilities (usable in flat and simple hierarchies).
*/
@ -426,7 +422,7 @@ protected:
size_t m_current_hash;
mutable wxString m_cached_page_number;
int m_virtualPageNumber; /// Page numbers are maintained by the sheet load order.
int m_virtualPageNumber; ///< Page numbers are maintained by the sheet load order.
std::map<std::pair<wxString, wxString>, bool> m_recursion_test_cache;
};
@ -487,7 +483,9 @@ public:
void ClearModifyStatus();
/**
* Fetch a SCH_ITEM by ID. Also returns the sheet the item was found on in \a aPathOut.
* Fetch a SCH_ITEM by ID.
*
* Also returns the sheet the item was found on in \a aPathOut.
*/
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr ) const;
@ -597,8 +595,8 @@ public:
*
* If \a aSheet is the root sheet, the full sheet path and sheet list are built.
*
* The list will be ordered as per #SCH_SCREEN::BuildSheetList which results in sheets being ordered
* in the legacy way of using the X and Y positions of the sheets.
* The list will be ordered as per #SCH_SCREEN::BuildSheetList which results in sheets
* being ordered in the legacy way of using the X and Y positions of the sheets.
*
* @see #SortByPageNumbers to sort by page numbers
*
@ -632,7 +630,9 @@ public:
/**
* Update all of the symbol instance information using \a aSymbolInstances.
* WARNING: Do not call this on anything other than the full hierarchy.
*
* @warning Do not call this on anything other than the full hierarchy.
*
* @param aSymbolInstances is the symbol path information loaded from the root schematic.
*/
void UpdateSymbolInstanceData( const std::vector<SCH_SYMBOL_INSTANCE>& aSymbolInstances );
@ -649,7 +649,7 @@ public:
std::vector<KIID_PATH> GetPaths() const;
/**
* Fetch the instance information for all of the sheets in the hiearchy.
* Fetch the instance information for all of the sheets in the hierarchy.
*
* @return all of the sheet instance data for the hierarchy.
*/

View File

@ -531,7 +531,8 @@ void SCH_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBo
BOX2I pins = GetBodyAndPinsBoundingBox();
COLOR4D dnp_color = localRenderSettings.GetLayerColor( LAYER_DNP_MARKER );
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
std::max( bbox.GetY() - pins.GetY(),
pins.GetEnd().y - bbox.GetEnd().y ) );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
@ -1113,7 +1114,7 @@ void SCH_SYMBOL::SyncOtherUnits( const SCH_SHEET_PATH& aSourceSheet, SCH_COMMIT&
return;
}
// Keep fields other than the reference, include/exclude flags, and alternate pin assignements
// Keep fields other than the reference, include/exclude flags, and alternate pin assignments
// in sync in multi-unit parts.
if( GetUnitCount() > 1 && IsAnnotated( &aSourceSheet ) )
{
@ -2051,7 +2052,8 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
{
// Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Power symbol" ),
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) );
KIUI::EllipsizeStatusText( aFrame,
GetField( VALUE_FIELD )->GetText() ) );
}
else
{
@ -2060,10 +2062,12 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
// Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Value" ),
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) );
KIUI::EllipsizeStatusText( aFrame,
GetField( VALUE_FIELD )->GetText() ) );
addExcludes();
aList.emplace_back( _( "Name" ),
KIUI::EllipsizeStatusText( aFrame, GetLibId().GetLibItemName() ) );
KIUI::EllipsizeStatusText( aFrame,
GetLibId().GetLibItemName() ) );
}
#if 0 // Display symbol flags, for debug only
@ -2108,9 +2112,11 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
else
{
aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
// Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Value" ),
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) );
KIUI::EllipsizeStatusText( aFrame,
GetField( VALUE_FIELD )->GetText() ) );
addExcludes();
aList.emplace_back( _( "Name" ),
KIUI::EllipsizeStatusText( aFrame, GetLibId().GetLibItemName() ) );
@ -2235,6 +2241,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListB
for( auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
{
DANGLING_END_ITEM& each_item = *it;
// Some people like to stack pins on top of each other in a symbol to indicate
// internal connection. While technically connected, it is not particularly useful
// to display them that way, so skip any pins that are in the same symbol as this
@ -2777,17 +2784,20 @@ bool SCH_SYMBOL::GetShowPinNames() const
return m_part && m_part->GetShowPinNames();
}
void SCH_SYMBOL::SetShowPinNames( bool aShow )
{
if( m_part )
m_part->SetShowPinNames( aShow );
}
bool SCH_SYMBOL::GetShowPinNumbers() const
{
return m_part && m_part->GetShowPinNumbers();
}
void SCH_SYMBOL::SetShowPinNumbers( bool aShow )
{
if( m_part )

View File

@ -510,19 +510,23 @@ public:
{
return GetRef( &Schematic()->CurrentSheet() );
}
void SetRefProp( const wxString& aRef );
wxString GetValueProp() const
{
return GetValue( false, &Schematic()->CurrentSheet(), false );
}
void SetValueProp( const wxString& aRef )
{
SetValueFieldText( aRef );
}
int GetUnitProp() const
{
return GetUnitSelection( &Schematic()->CurrentSheet() );
}
void SetUnitProp( int aUnit )
{
if( aUnit < 1 )
@ -534,10 +538,12 @@ public:
SetUnitSelection( &Schematic()->CurrentSheet(), aUnit );
SetUnit( aUnit );
}
int GetBodyStyleProp() const
{
return GetBodyStyle();
}
void SetBodyStyleProp( int aBodyStyle )
{
SetBodyStyle( aBodyStyle );
@ -557,7 +563,7 @@ public:
bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields );
/**
* Keep fields other than the reference, include/exclude flags, and alternate pin assignements
* Keep fields other than the reference, include/exclude flags, and alternate pin assignments
* in sync in multi-unit parts.
*
* @param aSourceSheet the sheet instance of the unit to sync to
@ -855,7 +861,7 @@ public:
double Similarity( const SCH_ITEM& aOther ) const override;
/// Returns the component classes this symbol belongs in
/// Return the component classes this symbol belongs in.
std::unordered_set<wxString> GetComponentClassNames( const SCH_SHEET_PATH* aPath ) const;
bool operator==( const SCH_ITEM& aOther ) const override;
@ -886,15 +892,18 @@ private:
std::vector<SCH_FIELD> m_fields; ///< Variable length list of fields.
std::unique_ptr<LIB_SYMBOL> m_part; ///< A flattened copy of the LIB_SYMBOL from the
///< PROJECT's libraries.
std::unique_ptr<LIB_SYMBOL> m_part; ///< A flattened copy of the #LIB_SYMBOL from the
///< #PROJECT object's libraries.
bool m_isInNetlist; ///< True if the symbol should appear in netlist
std::vector<std::unique_ptr<SCH_PIN>> m_pins; ///< a SCH_PIN for every SCH_PIN (all units)
std::unordered_map<SCH_PIN*, SCH_PIN*> m_pinMap; ///< library pin pointer : SCH_PIN's index
std::vector<std::unique_ptr<SCH_PIN>> m_pins; ///< A #SCH_PIN for every #LIB_PIN.
std::unordered_map<SCH_PIN*, SCH_PIN*> m_pinMap; ///< Library pin pointer : #SCH_PIN indices.
// Defines the hierarchical path and reference of the symbol. This allows support for multiple
// references to a single sub-sheet.
/**
* Define the hierarchical path and reference of the symbol.
*
* This allows support for multiple references to a single sub-sheet.
*/
std::vector<SCH_SYMBOL_INSTANCE> m_instanceReferences;
/// @see SCH_SYMBOL::GetOrientation

View File

@ -80,7 +80,11 @@ public:
void SetSeparatorsWidth( int aWidth ) { m_separatorsStroke.SetWidth( aWidth ); }
int GetSeparatorsWidth() const { return m_separatorsStroke.GetWidth(); }
void SetSeparatorsStyle( const LINE_STYLE aStyle ) { m_separatorsStroke.SetLineStyle( aStyle ); }
void SetSeparatorsStyle( const LINE_STYLE aStyle )
{
m_separatorsStroke.SetLineStyle( aStyle );
}
LINE_STYLE GetSeparatorsStyle() const
{
if( m_separatorsStroke.GetLineStyle() == LINE_STYLE::DEFAULT )

View File

@ -171,6 +171,7 @@ bool SCH_TABLECELL::operator==( const SCH_TABLECELL& aOtherItem ) const
&& SCH_TEXTBOX::operator==( aOtherItem );
}
static struct SCH_TABLECELL_DESC
{
SCH_TABLECELL_DESC()

View File

@ -55,7 +55,7 @@ public:
int GetRow() const;
int GetColumn() const;
// @return the spreadsheet nomenclature for the cell (ie: B3 for 2nd column, 3rd row)
/// @return the spreadsheet nomenclature for the cell (ie: B3 for 2nd column, 3rd row)
wxString GetAddr() const;
int GetColSpan() const { return m_colSpan; }

View File

@ -668,6 +668,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
}
}
bool SCH_TEXT::operator==( const SCH_ITEM& aOther ) const
{
if( Type() != aOther.Type() )

View File

@ -139,7 +139,10 @@ public:
BITMAPS GetMenuImage() const override;
VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); }
void SetPosition( const VECTOR2I& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); }
void SetPosition( const VECTOR2I& aPosition ) override
{
EDA_TEXT::SetTextPos( aPosition );
}
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;

View File

@ -688,7 +688,8 @@ void SCHEMATIC::SetSheetNumberAndCount()
}
void SCHEMATIC::RecomputeIntersheetRefs( const std::function<void( SCH_GLOBALLABEL* )>& aItemCallback )
void SCHEMATIC::RecomputeIntersheetRefs(
const std::function<void( SCH_GLOBALLABEL* )>& aItemCallback )
{
std::map<wxString, std::set<int>>& pageRefsMap = GetPageRefsMap();

View File

@ -66,6 +66,7 @@ public:
virtual void OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
virtual void OnSchItemsRemoved( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
virtual void OnSchItemsChanged( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
// This is called when the user changes to a new sheet, not when a sheet is altered.
// Sheet alteration events will call OnSchItems*
virtual void OnSchSheetChanged( SCHEMATIC& aSch ) {}
@ -189,15 +190,17 @@ public:
std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel ) const;
/**
* Return the set of netname candidates for netclass assignment. The list will include both
* composite names (buses) and atomic net names. Names are fetched from available labels,
* power pins, etc.
* Return the set of netname candidates for netclass assignment.
*
* The list will include both composite names (buses) and atomic net names. Names are
* fetched from available labels, power pins, etc.
*/
std::set<wxString> GetNetClassAssignmentCandidates();
/**
* Resolves text vars that refer to other items.
* Note that the actual resolve is delegated to the symbol/sheet in question. This routine
*
* @note The actual resolve is delegated to the symbol/sheet in question. This routine
* just does the look-up and delegation.
*/
bool ResolveCrossReference( wxString* token, int aDepth ) const;
@ -220,11 +223,15 @@ public:
void SetLegacySymbolInstanceData();
/**
* Get the unique file name for the current sheet.
*
* This file name is unique and must be used instead of the screen file name when one must
* create files for each sheet in the hierarchy. The name is
* &ltroot sheet filename&gt-&ltsheet path&gt and has no extension.
* If filename is too long name is &ltsheet filename&gt-&ltsheet number&gt
*
* @return a filename that can be used in plot and print functions for the current screen
* and sheet path. This filename is unique and must be used instead of the screen filename
* when one must create files for each sheet in the hierarchy.
* Name is &ltroot sheet filename&gt-&ltsheet path&gt and has no extension.
* However if filename is too long name is &ltsheet filename&gt-&ltsheet number&gt
* and sheet path.
*/
wxString GetUniqueFilenameForCurrentSheet();
@ -250,7 +257,9 @@ public:
}
/**
* Set operating points from a .op simulation. Called after the simulation completes.
* Set operating points from a .op simulation.
*
* Called after the simulation completes.
*/
void SetOperatingPoint( const wxString& aSignal, double aValue )
{
@ -260,8 +269,10 @@ public:
wxString GetOperatingPoint( const wxString& aNetName, int aPrecision, const wxString& aRange );
/**
* Add junctions to this schematic where required. This function is needed for some plugins
* (e.g. Legacy and Cadstar) in order to retain connectivity after loading.
* Add junctions to this schematic where required.
*
* This function is needed for some plugins (e.g. Legacy and Cadstar) in order to retain
* connectivity after loading.
*/
void FixupJunctions();
@ -295,6 +306,7 @@ public:
/**
* Notify the schematic and its listeners that the current sheet has been changed.
*
* This is called when the user navigates to a different sheet, not when the sheet is
* altered.
*/
@ -302,32 +314,34 @@ public:
/**
* Add a listener to the schematic to receive calls whenever something on the
* schematic has been modified. The schematic does not take ownership of the
* listener object. Make sure to call RemoveListener before deleting the
* listener object. The order of listener invocations is not guaranteed.
* If the specified listener object has been added before, it will not be
* added again.
* schematic has been modified.
*
* The schematic does not take ownership of the listener object. Make sure to call
* RemoveListener before deleting the listener object. The order of listener invocations
* is not guaranteed. If the specified listener object has been added before, it will
* not be added again.
*/
void AddListener( SCHEMATIC_LISTENER* aListener );
/**
* Remove the specified listener. If it has not been added before, it
* will do nothing.
* Remove the specified listener.
*
* If it has not been added before, it will do nothing.
*/
void RemoveListener( SCHEMATIC_LISTENER* aListener );
/**
* Remove all listeners
* Remove all listeners.
*/
void RemoveAllListeners();
/**
* Embed fonts in the schematic
* Embed fonts in the schematic.
*/
void EmbedFonts() override;
/**
* Get a set of fonts used in the schematic
* Get a set of fonts used in the schematic.
*/
std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
@ -372,18 +386,20 @@ private:
/**
* The sheet path of the sheet currently being edited or displayed.
* Note that this was moved here from SCH_EDIT_FRAME because currently many places in the code
*
* @note This was moved here from #SCH_EDIT_FRAME because currently many places in the code
* want to know the current sheet. Potentially this can be moved back to the UI code once
* the only places that want to know it are UI-related
* the only places that want to know it are UI-related.
*/
SCH_SHEET_PATH* m_currentSheet;
/// Holds and calculates connectivity information of this schematic
/// Hold and calculate connectivity information of this schematic.
CONNECTION_GRAPH* m_connectionGraph;
/**
* Holds a map of labels to the page sequence (virtual page number) that they appear on. It is
* used for updating global label intersheet references.
* Holds a map of labels to the page sequence (virtual page number) that they appear on.
*
* It is used for updating global label intersheet references.
*/
std::map<wxString, std::set<int>> m_labelToPageRefsMap;
@ -403,7 +419,7 @@ private:
SCH_SHEET_LIST m_hierarchy;
/**
* Currently installed listeners
* Currently installed listeners.
*/
std::vector<SCHEMATIC_LISTENER*> m_listeners;
};

View File

@ -69,7 +69,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
int defaultLineThickness = cfg ? cfg->m_Drawing.default_line_thickness : DEFAULT_LINE_WIDTH_MILS;
int defaultLineThickness =
cfg ? cfg->m_Drawing.default_line_thickness : DEFAULT_LINE_WIDTH_MILS;
int defaultTextSize = cfg ? cfg->m_Drawing.default_text_size : DEFAULT_TEXT_SIZE;
int defaultPinSymbolSize = cfg ? cfg->m_Drawing.pin_symbol_size : DEFAULT_TEXT_SIZE / 2;
int defaultJunctionSizeChoice = cfg ? cfg->m_Drawing.junction_size_choice : 3;
@ -186,7 +187,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
// Read global fieldname templates
SETTINGS_MANAGER& curr_mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* curr_cfg = curr_mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
EESCHEMA_SETTINGS* curr_cfg =
curr_mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( curr_cfg && !curr_cfg->m_Drawing.field_names.IsEmpty() )
m_TemplateFieldNames.AddTemplateFieldNames( curr_cfg->m_Drawing.field_names );

View File

@ -319,7 +319,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurr
"result in all of the symbols in the loaded schematic to use either the "
"default instance setting or fall back to the library symbol settings. "
"Loading the project that uses this schematic file and saving to the "
"lastest file version will resolve this issue.\n\n"
"latest file version will resolve this issue.\n\n"
"Do you wish to continue?" );
wxMessageDialog msgDlg7( this, msg, _( "Continue Load Schematic" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT | wxCENTER | wxICON_QUESTION );
@ -568,7 +568,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurr
SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
}
// Make the best attempt to set the symbol instance data for the loaded scheamtic.
// Make the best attempt to set the symbol instance data for the loaded schematic.
if( newScreen->GetFileFormatVersionAtLoad() < 20221002 )
{
if( !newScreen->GetSymbolInstances().empty() )
@ -684,7 +684,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
dc.SetUserScale( 1.0, 1.0 );
SCH_PRINTOUT printout( this, wxEmptyString, true );
// Ensure title block will be when printed on clipboard, regardless
// the current cairo print option
// the current Cairo print option
EESCHEMA_SETTINGS* eecfg = eeconfig();
bool print_tb_opt = eecfg->m_Printing.title_block;
eecfg->m_Printing.title_block = true;
@ -725,7 +725,8 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
}
bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aOldName, const wxString& aSchematicFileName )
bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aOldName,
const wxString& aSchematicFileName )
{
wxString msg;
SCH_SHEET_LIST sheets = Schematic().Hierarchy();

View File

@ -81,10 +81,6 @@ void OrientAndMirrorSymbolItems( LIB_SYMBOL* aSymbol, int aOrientation )
// Rotate and/or mirror a SCH_PIN according to aOrientMirror.
// aOrientMirror is the orientation/mirror of the parent symbol.
// The modified pin orientation is the actual pin orientation/mirror
// when the parent symbol is drawn.
void RotateAndMirrorPin( SCH_PIN& aPin, int aOrientMirror )
{
ORIENT_MIRROR o = symbols_orientations_list[ 0 ];
@ -108,6 +104,7 @@ void RotateAndMirrorPin( SCH_PIN& aPin, int aOrientMirror )
aPin.MirrorHorizontallyPin( 0 );
}
SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
{
SPIN_STYLE ret = SPIN_STYLE::UP;
@ -150,7 +147,9 @@ SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT;
}
break;
case SYM_ROTATE_COUNTERCLOCKWISE:
case SYM_ORIENT_270:
if( ret == SPIN_STYLE::UP )
@ -177,7 +176,9 @@ SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT;
}
break;
case SYM_ORIENT_180:
if( ret == SPIN_STYLE::UP )
ret = SPIN_STYLE::BOTTOM;
@ -203,7 +204,9 @@ SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT;
}
break;
case SYM_ORIENT_0:
case SYM_NORMAL:
default:
@ -222,6 +225,7 @@ SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT;
}
break;
}

View File

@ -57,7 +57,7 @@ enum SYMBOL_ORIENTATION_PROP
/**
* A base class for LIB_SYMBOL and SCH_SYMBOL.
* A base class for #LIB_SYMBOL and #SCH_SYMBOL.
*/
class SYMBOL : public SCH_ITEM
{
@ -165,7 +165,11 @@ public:
/**
* Set or clear the exclude from simulation flag.
*/
void SetExcludedFromSim( bool aExcludeFromSim ) override { m_excludedFromSim = aExcludeFromSim; }
void SetExcludedFromSim( bool aExcludeFromSim ) override
{
m_excludedFromSim = aExcludeFromSim;
}
bool GetExcludedFromSim() const override { return m_excludedFromSim; }
/**

View File

@ -38,12 +38,13 @@ class SYMBOL_ASYNC_LOADER
{
public:
/**
* Constructs a loader for symbol libraries
* @param aNicknames is a list of library nicknames to load
* @param aTable is a pointer to the symbol library table to load libraries for
* @param aOnlyPowerSymbols, if true, will only return power symbols in the output map
* @param aOutput will be filled with the loaded parts
* @param aReporter will be used to repord progress, of not null
* Construct a loader for symbol libraries.
*
* @param aNicknames is a list of library nicknames to load.
* @param aTable is a pointer to the symbol library table to load libraries for.
* @param aOnlyPowerSymbols, if true, will only return power symbols in the output map.
* @param aOutput will be filled with the loaded parts.
* @param aReporter will be used to report progress, of not null.
*/
SYMBOL_ASYNC_LOADER( const std::vector<wxString>& aNicknames,
SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols = false,
@ -53,41 +54,41 @@ public:
~SYMBOL_ASYNC_LOADER();
/**
* Spins up threads to load all the libraries in m_nicknames
* Spin up threads to load all the libraries in m_nicknames.
*/
void Start();
/**
* Finalizes the threads and combines the output into the target output map
* Finalize the threads and combines the output into the target output map.
*/
bool Join();
///< Return true if loading is done
/// @return true if loading is done
bool Done();
///< Returns a string containing any errors generated during the load
/// @return a string containing any errors generated during the load.
const wxString& GetErrors() const { return m_errors; }
///< Represents a pair of <nickname, loaded parts list>
/// Represent a pair of <nickname, loaded parts list>.
typedef std::pair<wxString, std::vector<LIB_SYMBOL*>> LOADED_PAIR;
private:
///< Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>
/// Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>.
std::vector<LOADED_PAIR> worker();
///< list of libraries to load
/// List of libraries to load.
std::vector<wxString> m_nicknames;
///< Handle to the symbol library table being loaded into
/// Handle to the symbol library table being loaded into.
SYMBOL_LIB_TABLE* m_table;
///< True if we are loading only power symbols
/// True if we are loading only power symbols.
bool m_onlyPowerSymbols;
///< Handle to map that will be filled with the loaded parts per library
/// Handle to map that will be filled with the loaded parts per library.
std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* m_output;
///< Progress reporter (may be null)
/// Progress reporter (may be null).
PROGRESS_REPORTER* m_reporter;
size_t m_threadCount;

View File

@ -30,9 +30,11 @@
// helper function to sort pins by pin num
static bool sort_by_pin_number( const SCH_PIN* ref, const SCH_PIN* tst );
static void CheckLibSymbolGraphics( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
UNITS_PROVIDER* aUnitsProvider );
void CheckDuplicatePins( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
UNITS_PROVIDER* aUnitsProvider )
{
@ -53,7 +55,7 @@ void CheckDuplicatePins( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
continue;
// Pins are not duplicated only if they are in different body styles
// (but GetBodyStyle() == 0 means commun to all body styles)
// (but GetBodyStyle() == 0 means common to all body styles)
if( pin->GetBodyStyle() != 0 && next->GetBodyStyle() != 0 )
{
if( pin->GetBodyStyle() != next->GetBodyStyle() )
@ -144,17 +146,19 @@ void CheckDuplicatePins( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
/**
* Check a lib symbol to find incorrect settings
* Pins not on a valid grid
* Pins duplicated
* Conflict with pins at same location
* Incorrect Power Symbols
* illegal reference prefix (cannot ends by a digit or a '?')
* @param aSymbol is the library symbol to check
* @param aMessages is a room to store error messages
* Check a library symbol to find incorrect settings.
*
* - Pins not on a valid grid
* - Pins duplicated
* - Conflict with pins at same location
* - Incorrect Power Symbols
* - illegal reference prefix (cannot ends by a digit or a '?')
*
* @param aSymbol is the library symbol to check.
* @param aMessages is a room to store error messages.
* @param aGridForPins (in IU) is the grid to test pin positions ( >= 25 mils )
* should be 25, 50 or 100 mils (convered to IUs)
* @param aUnitsProvider a frame to format coordinates in messages
* should be 25, 50 or 100 mils (converted to IUs).
* @param aUnitsProvider a frame to format coordinates in messages.
*/
void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
int aGridForPins, UNITS_PROVIDER* aUnitsProvider )
@ -166,7 +170,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
// Test reference prefix validity:
// if the symbol is saved in a library, the prefix should not ends by a digit or a '?'
// but it is acceptable if the symbol is saved to aschematic
// but it is acceptable if the symbol is saved to a schematic.
wxString reference_base = aSymbol->GetReferenceField().GetText();
wxString illegal_end( wxT( "0123456789?" ) );
wxUniChar last_char = reference_base.Last();
@ -278,7 +282,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
{
if( aSymbol->GetUnitCount() <= 1 )
{
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>." ),
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>"
"(%s, %s)</b>." ),
pin->GetNumber(),
pinName,
aUnitsProvider->MessageTextFromValue( pin->GetPosition().x ),
@ -386,7 +391,8 @@ void CheckLibSymbolGraphics( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessag
case SHAPE_T::CIRCLE:
if( shape->GetRadius() <= 0 )
{
msg.Printf( _( "<b>Graphic circle has radius = 0</b> at location <b>(%s, %s)</b>." ),
msg.Printf( _( "<b>Graphic circle has radius = 0</b> at location "
"<b>(%s, %s)</b>." ),
aUnitsProvider->MessageTextFromValue(shape->GetPosition().x ),
aUnitsProvider->MessageTextFromValue( -shape->GetPosition().y ) );
msg += wxT( "<br>" );

View File

@ -141,7 +141,7 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
wxString errMsg; // to collect error messages
// This table may be nested within a larger s-expression, or not.
// Allow for parser of that optional containing s-epression to have looked ahead.
// Allow for parser of that optional containing s-expression to have looked ahead.
if( in->CurTok() != T_sym_lib_table )
{
in->NeedLEFT();
@ -270,7 +270,7 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
// All nickNames within this table fragment must be unique, so we do not use doReplace
// in doInsertRow(). (However a fallBack table can have a conflicting nickName and ours
// will supercede that one since in FindLib() we search this table before any fall back.)
// will supersede that one since in FindLib() we search this table before any fall back.)
wxString nickname = row->GetNickName(); // store it to be able to used it
// after row deletion if an error occurs
bool doReplace = false;
@ -602,7 +602,8 @@ public:
m_lib_table.InsertRow(
new SYMBOL_LIB_TABLE_ROW( nickname, libPath, wxT( "KiCad" ), wxEmptyString,
_( "Added by Plugin and Content Manager" ) ), false );
_( "Added by Plugin and Content Manager" ) ),
false );
}
}
@ -724,7 +725,8 @@ bool SYMBOL_LIB_TABLE::operator==( const SYMBOL_LIB_TABLE& aOther ) const
for( i = 0; i < m_rows.size(); ++i )
{
const SYMBOL_LIB_TABLE_ROW& curr = static_cast<const SYMBOL_LIB_TABLE_ROW&>( m_rows[i] );
const SYMBOL_LIB_TABLE_ROW& curr_other = static_cast<const SYMBOL_LIB_TABLE_ROW&>( aOther.m_rows[i] );
const SYMBOL_LIB_TABLE_ROW& curr_other =
static_cast<const SYMBOL_LIB_TABLE_ROW&>( aOther.m_rows[i] );
if( curr != curr_other )
return false;

View File

@ -536,6 +536,7 @@ void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
// Remember lib_names[i] can contain a '.' in name, so using a wxFileName
// before adding the extension can create incorrect full filename
wxString fullname = lib_names[i] + "." + FILEEXT::LegacySymbolLibFileExtension;
// Now the full name is set, we can use a wxFileName.
wxFileName fn( fullname );

View File

@ -485,7 +485,7 @@ bool SYMBOL_LIBRARY_MANAGER::UpdateSymbol( LIB_SYMBOL* aSymbol, const wxString&
{
wxCHECK_MSG( aSymbol, false, wxString::Format( "Null symbol in library: %s", aLibrary ) );
wxCHECK_MSG( LibraryExists( aLibrary ), false,
wxString::Format( "Library missing: %s, for smybol %s", aLibrary,
wxString::Format( "Library missing: %s, for symbol %s", aLibrary,
aSymbol->GetName() ) );
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );

View File

@ -77,7 +77,7 @@ private:
};
///< Store a working copy of a library.
/// Store a working copy of a library.
class LIB_BUFFER
{
public:
@ -102,13 +102,13 @@ public:
int GetHash() const { return m_hash; }
///< Return the working copy of a LIB_SYMBOL root object with specified alias.
/// Return the working copy of a #LIB_SYMBOL root object with specified alias.
LIB_SYMBOL* GetSymbol( const wxString& aAlias ) const;
///< Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.
/// Create a new buffer to store a symbol. #LIB_BUFFER takes ownership of \a aCopy.
bool CreateBuffer( std::unique_ptr<LIB_SYMBOL> aCopy, std::unique_ptr<SCH_SCREEN> aScreen );
///< Update the buffered symbol with the contents of \a aCopy.
/// Update the buffered symbol with the contents of \a aCopy.
bool UpdateBuffer( SYMBOL_BUFFER& aSymbolBuf, const LIB_SYMBOL& aCopy );
/**
@ -118,15 +118,15 @@ public:
void ClearDeletedBuffer() { m_deleted.clear(); }
///< Save stored modifications using a plugin. aBuffer decides whether the changes
///< should be cached or stored directly to the disk (for SCH_IO_KICAD_LEGACY).
/// Save stored modifications using a plugin. aBuffer decides whether the changes
/// should be cached or stored directly to the disk (for #SCH_IO_KICAD_LEGACY).
bool SaveBuffer( SYMBOL_BUFFER& aSymbolBuf, const wxString& aFileName, SCH_IO* aPlugin,
bool aBuffer );
///< Return a symbol buffer with LIB_SYMBOL holding a symbolicular alias
/// Return a symbol buffer with #LIB_SYMBOL holding a symbolic alias.
std::shared_ptr<SYMBOL_BUFFER> GetBuffer( const wxString& aAlias ) const;
///< Return all buffered symbols
/// Return all buffered symbols.
const std::deque<std::shared_ptr<SYMBOL_BUFFER>>& GetBuffers() const { return m_symbols; }
/**
@ -185,8 +185,10 @@ public:
virtual ~SYMBOL_LIBRARY_MANAGER();
/**
* Preloads all symbol libraries in the symbol library table using SYMBOL_ASYNC_LOADER.
* Preload all symbol libraries in the symbol library table using #SYMBOL_ASYNC_LOADER.
*
* Call before the first call to Sync() to get better performance.
*
* @param aReporter is used to report progress of the load
*/
void Preload( PROGRESS_REPORTER& aReporter );
@ -217,7 +219,9 @@ public:
std::list<LIB_SYMBOL*> GetAliases( const wxString& aLibrary ) const;
/**
* Create an empty library and adds it to the library table. The library file is created.
* Create an empty library and adds it to the library table.
*
* The library file is created.
*/
bool CreateLibrary( const wxString& aFilePath, SYMBOL_LIB_TABLE& aTable )
{
@ -225,7 +229,9 @@ public:
}
/**
* Add an existing library. The library is added to the library table as well.
* Add an existing library.
*
* The library is added to the library table as well.
*/
bool AddLibrary( const wxString& aFilePath, SYMBOL_LIB_TABLE& aTable )
{
@ -234,13 +240,16 @@ public:
/**
* Update the symbol buffer with a new version of the symbol.
*
* The library buffer creates a copy of the symbol.
*
* It is required to save the library to use the updated symbol in the schematic editor.
*/
bool UpdateSymbol( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
/**
* Update the symbol buffer with a new version of the symbol when the name has changed.
*
* The old library buffer will be deleted and a new one created with the new name.
*/
bool UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias,
@ -253,6 +262,7 @@ public:
/**
* Remove the symbol from the symbol buffer.
*
* It is required to save the library to have the symbol removed in the schematic editor.
*/
bool RemoveSymbol( const wxString& aName, const wxString& aLibrary );
@ -264,8 +274,10 @@ public:
LIB_SYMBOL* GetAlias( const wxString& aAlias, const wxString& aLibrary ) const;
/**
* Return the symbol copy from the buffer. In case it does not exist yet, the copy is created.
* #SYMBOL_LIBRARY_MANAGER retains the ownership.
* Return the symbol copy from the buffer.
*
* In case it does not exist yet, the copy is created. #SYMBOL_LIBRARY_MANAGER retains
* the ownership.
*/
LIB_SYMBOL* GetBufferedSymbol( const wxString& aAlias, const wxString& aLibrary );
@ -282,8 +294,9 @@ public:
bool SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const;
/**
* Return true if library exists. If \a aCheckEnabled is set, then the library must
* also be enabled in the library table.
* Return true if library exists.
*
* If \a aCheckEnabled is set, then the library must also be enabled in the library table.
*/
bool LibraryExists( const wxString& aLibrary, bool aCheckEnabled = false ) const;
@ -332,7 +345,7 @@ public:
SCH_IO_MGR::SCH_FILE_T aFileType = SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY );
/**
* Revert unsaved changes for a symbolicular symbol.
* Revert unsaved changes for a symbol.
*
* @return The LIB_ID of the reverted symbol (which may be different in the case
* of a rename)
@ -340,7 +353,7 @@ public:
LIB_ID RevertSymbol( const wxString& aAlias, const wxString& aLibrary );
/**
* Revert unsaved changes for a symbolicular library.
* Revert unsaved changes for a symbol library.
*
* @return True on success, false otherwise.
*/
@ -355,6 +368,7 @@ public:
/**
* Return a library name that is not currently in use.
*
* Used for generating names for new libraries.
*/
wxString GetUniqueLibraryName() const;
@ -375,24 +389,23 @@ public:
protected:
virtual void OnDataChanged() const {}
///< Extract library name basing on the file name.
/// Extract library name basing on the file name.
static wxString getLibraryName( const wxString& aFilePath );
///< Helper function to add either existing or create new library
/// Helper function to add either existing or create new library.
bool addLibrary( const wxString& aFilePath, bool aCreate, SYMBOL_LIB_TABLE& aTable );
///< Return the current Symbol Library Table.
/// Return the current symbol library table.
SYMBOL_LIB_TABLE* symTable() const;
///< Class to store a working copy of a LIB_SYMBOL object and editor context.
/**
* Return a set of #LIB_SYMBOL objects belonging to the original library.
*/
std::set<LIB_SYMBOL*> getOriginalSymbols( const wxString& aLibrary );
/**
* Return an existing library buffer or creates one to using Symbol Library Table to get
* Return an existing library buffer or creates one to using symbol library table to get
* the original data.
*/
LIB_BUFFER& getLibraryBuffer( const wxString& aLibrary );

View File

@ -32,7 +32,9 @@ class SYMBOL_TREE_MODEL_ADAPTER : public LIB_TREE_MODEL_ADAPTER
{
public:
/**
* Destructor. Do NOT delete this class manually; it is reference-counted by wxObject.
* Destructor.
*
* @warning Do **not** delete this class manually. It is reference-counted by wxObject.
*/
~SYMBOL_TREE_MODEL_ADAPTER();
@ -46,11 +48,12 @@ public:
/**
* Add all the libraries in a SYMBOL_LIB_TABLE to the model.
*
* Displays a progress dialog attached to the parent frame the first time it is run.
*
* @param aNicknames is the list of library nicknames
* @param aParent is the parent window to display the progress dialog
* @return false if loading was cancelled by the user
* @return false if loading was canceled by the user
*/
bool AddLibraries( const std::vector<wxString>& aNicknames, SCH_BASE_FRAME* aFrame );
@ -68,6 +71,7 @@ protected:
private:
friend class SYMBOL_ASYNC_LOADER;
/**
* Flag to only show the symbol library table load progress dialog the first time.
*/

View File

@ -79,7 +79,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync( const wxString& aForceRefresh,
int i = 0, max = GetLibrariesCount();
// Process already stored libraries
for( auto it = m_tree.m_Children.begin(); it != m_tree.m_Children.end(); /* iteration inside */ )
for( auto it = m_tree.m_Children.begin(); it != m_tree.m_Children.end(); )
{
const wxString& name = it->get()->m_Name;
@ -94,8 +94,8 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync( const wxString& aForceRefresh,
// being removed from the tree control.
if( !m_libMgr->LibraryExists( name, true )
|| !PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->HasLibrary( name, true )
|| PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->FindRow( name, true ) !=
PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->FindRow( name, false )
|| PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->FindRow( name, true )
!= PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->FindRow( name, false )
|| name == aForceRefresh )
{
it = deleteLibrary( it );
@ -345,6 +345,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
// proxy for "is canvas item"
}
}
break;
case LIB_TREE_NODE::TYPE::ITEM:
@ -360,6 +361,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
aAttr.SetStrikethrough( true ); // LIB_TREE_RENDERER uses strikethrough as a
// proxy for "is canvas item"
}
break;
default:

View File

@ -72,10 +72,10 @@ protected:
SYMBOL_EDIT_FRAME* m_frame;
SYMBOL_LIBRARY_MANAGER* m_libMgr;
///< Hashes to decide whether a library needs an update.
/// Hashes to decide whether a library needs an update.
std::map<wxString, int> m_libHashes;
///< SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization.
/// #SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization.
int m_lastSyncHash;
};

View File

@ -180,8 +180,8 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_symbolFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
#endif
m_symbolList = new WX_LISTBOX( symbolPanel, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
m_symbolList = new WX_LISTBOX( symbolPanel, ID_LIBVIEW_SYM_LIST, wxDefaultPosition,
wxDefaultSize, 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
symbolSizer->Add( m_symbolList, 1, wxEXPAND, 5 );
symbolPanel->SetSizer( symbolSizer );
@ -281,8 +281,8 @@ void SYMBOL_VIEWER_FRAME::loadAllLibraries()
std::unordered_map<wxString, std::vector<LIB_SYMBOL*>> loadedSymbols;
SYMBOL_ASYNC_LOADER loader( libraryNames, PROJECT_SCH::SchSymbolLibTable( &Prj() ), false, nullptr,
progressReporter.get() );
SYMBOL_ASYNC_LOADER loader( libraryNames, PROJECT_SCH::SchSymbolLibTable( &Prj() ), false,
nullptr, progressReporter.get() );
LOCALE_IO toggle;
@ -562,7 +562,9 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
{
wxArrayString aliasNames;
PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( aLib, aliasNames, true );
PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( aLib,
aliasNames,
true );
if( aliasNames.IsEmpty() )
return;
@ -627,7 +629,8 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
m_libList->Append( UnescapeString( name ) );
// Search for a previous selection:
int index = m_libList->FindString( UnescapeString( m_currentSymbol.GetUniStringLibNickname() ) );
int index =
m_libList->FindString( UnescapeString( m_currentSymbol.GetUniStringLibNickname() ) );
if( index != wxNOT_FOUND )
{
@ -670,7 +673,8 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
try
{
if( row )
PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbolLib( symbols, libName, m_listPowerOnly );
PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbolLib( symbols, libName,
m_listPowerOnly );
}
catch( const IO_ERROR& ) {} // ignore, it is handled below
@ -721,7 +725,8 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
return true;
}
int index = m_symbolList->FindString( UnescapeString( m_currentSymbol.GetUniStringLibItemName() ) );
int index =
m_symbolList->FindString( UnescapeString( m_currentSymbol.GetUniStringLibItemName() ) );
bool changed = false;
if( index == wxNOT_FOUND )

View File

@ -55,7 +55,8 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
{
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT |
wxAUI_TB_HORIZONTAL );
m_mainToolBar->SetAuiManager( &m_auimgr );
}
@ -124,6 +125,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
// Add scripting console and API plugins
bool scriptingAvailable = SCRIPTING::IsWxAvailable();
#ifdef KICAD_IPC_API
bool haveApiPlugins = Pgm().GetCommonSettings()->m_Api.enable_server &&
!Pgm().GetPluginManager().GetActionsForScope( PLUGIN_ACTION_SCOPE::SCHEMATIC ).empty();
@ -144,8 +146,6 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
}
/* Create Vertical Right Toolbar
*/
void SCH_EDIT_FRAME::ReCreateVToolbar()
{
if( m_drawToolBar )

View File

@ -42,7 +42,8 @@ void SYMBOL_VIEWER_FRAME::ReCreateHToolbar()
else
{
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT |
wxAUI_TB_HORIZONTAL );
m_mainToolBar->SetAuiManager( &m_auimgr );
}