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 ); 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. // SCH_SHEET_PATH.
m_schematic->CurrentSheet().LastScreen()->TestDanglingEnds( &m_schematic->CurrentSheet(), m_schematic->CurrentSheet().LastScreen()->TestDanglingEnds( &m_schematic->CurrentSheet(),
aChangedItemHandler ); aChangedItemHandler );
@ -877,9 +877,11 @@ std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> CONNECTION_GRAPH::ExtractAffected
if( !item_sg ) 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; return;
} }
if( !item_sg->ResolveDrivers( true ) ) if( !item_sg->ResolveDrivers( true ) )
{ {
wxLogTrace( ConnTrace, wxT( "Item %s in subgraph %ld (%p) has no driver" ), 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() ); sg_to_scan.size() );
for( CONNECTION_SUBGRAPH* sg : sg_to_scan ) for( CONNECTION_SUBGRAPH* sg : sg_to_scan )
{ {
traverse_subgraph( sg ); 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 ); it = m_net_code_to_subgraphs_map.erase( it );
} }
else else
{
++it; ++it;
} }
}
for( auto it = m_net_name_to_subgraphs_map.begin(); for( auto it = m_net_name_to_subgraphs_map.begin();
it != m_net_name_to_subgraphs_map.end(); ) it != m_net_name_to_subgraphs_map.end(); )
@ -1446,6 +1449,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
} }
void CONNECTION_GRAPH::resolveAllDrivers() void CONNECTION_GRAPH::resolveAllDrivers()
{ {
// Resolve drivers for subgraphs and propagate connectivity info // Resolve drivers for subgraphs and propagate connectivity info
@ -1642,6 +1646,7 @@ void CONNECTION_GRAPH::generateBusAliasMembers()
std::back_inserter( m_driver_subgraphs ) ); std::back_inserter( m_driver_subgraphs ) );
} }
void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs() void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs()
{ {
// Generate subgraphs for global power pins. These will be merged with other subgraphs // 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_SHEET_PATH sheet = it.first;
SCH_PIN* pin = it.second; 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 // ERC will warn about this: user has wired up an invisible pin
continue; continue;
@ -1845,7 +1851,8 @@ void CONNECTION_GRAPH::processSubGraphs()
wxS( "%ld (%s) weakly driven by unique sheet pin %s, " wxS( "%ld (%s) weakly driven by unique sheet pin %s, "
"promoting" ), "promoting" ),
subgraph->m_code, name, subgraph->m_code, name,
subgraph->m_driver->GetItemDescription( &unitsProvider, true ) ); subgraph->m_driver->GetItemDescription( &unitsProvider,
true ) );
subgraph->m_strong_driver = true; subgraph->m_strong_driver = true;
} }
@ -2026,7 +2033,8 @@ void CONNECTION_GRAPH::processSubGraphs()
subgraph->m_bus_neighbors[member].insert( candidate ); subgraph->m_bus_neighbors[member].insert( candidate );
candidate->m_bus_parents[member].insert( subgraph ); 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)" ), wxLogTrace( ConnTrace, wxS( "%lu (%s) absorbs neighbor %lu (%s)" ),
subgraph->m_code, connection->Name(), subgraph->m_code, connection->Name(),
@ -2076,7 +2084,8 @@ void CONNECTION_GRAPH::processSubGraphs()
// on some portion of the items. // 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 // Recache all bus aliases for later use
wxCHECK_RET( m_schematic, wxT( "Connection graph cannot be built without schematic pointer" ) ); 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 ) ) if( wxLog::IsAllowedTraceMask( DanglingProfileMask ) )
sub_graph.Show(); sub_graph.Show();
/** /**
* TODO(JE): Net codes are non-deterministic. Fortunately, they are also not really used for * 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. * 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 ) for( int ii = a; ii < b; ++ii )
m_driver_subgraphs[ii]->UpdateItemConnections(); m_driver_subgraphs[ii]->UpdateItemConnections();
}); });
tp.wait_for_tasks(); tp.wait_for_tasks();
// Next time through the subgraphs, we do some post-processing to handle things like // 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 ) 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; different = true;
break; break;
@ -3660,7 +3670,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
SCH_PIN* test_pin = static_cast<SCH_PIN*>( item ); SCH_PIN* test_pin = static_cast<SCH_PIN*>( item );
// Stacked pins do not count as other connections but non-stacked pins do // 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 ) for( SCH_PIN* other_pin : pins )
{ {
@ -3692,8 +3703,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
for( SCH_PIN* test_pin : pins ) for( SCH_PIN* test_pin : pins )
{ {
// Prefer the pin is part of a real component rather than some stray power symbol // 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 // Or else we may fail walking connected components to a power symbol pin since we
// starting at a power symbol // reject starting at a power symbol
if( test_pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN if( test_pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
&& !test_pin->IsGlobalPower() ) && !test_pin->IsGlobalPower() )
{ {
@ -3788,7 +3799,8 @@ bool CONNECTION_GRAPH::ercCheckDanglingWireEndpoints( const CONNECTION_SUBGRAPH*
auto report_error = [&]( VECTOR2I& location ) 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->SetItems( line );
ercItem->SetSheetSpecificPath( sheet ); ercItem->SetSheetSpecificPath( sheet );
@ -3812,7 +3824,8 @@ bool CONNECTION_GRAPH::ercCheckDanglingWireEndpoints( const CONNECTION_SUBGRAPH*
auto report_error = [&]( VECTOR2I& location ) 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->SetItems( entry );
ercItem->SetSheetSpecificPath( sheet ); ercItem->SetSheetSpecificPath( sheet );

View File

@ -538,7 +538,8 @@ private:
* and re-created. Otherwise, we will preserve existing net classes that do not * and re-created. Otherwise, we will preserve existing net classes that do not
* conflict with the new net classes. * 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. * Generate individual item subgraphs on a per-sheet basis.
@ -741,7 +742,7 @@ private:
int ercCheckHierSheets(); 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(); int ercCheckSingleGlobalLabel();

View File

@ -851,13 +851,15 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
// Try to select specified items. // Try to select specified items.
// $SELECT: 1,<spec1>,<spec2>,<spec3> // $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 prefix = "$SELECT: ";
std::string paramStr = payload.substr( prefix.size() ); 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; break;
std::string syncStr = paramStr.substr( 2 ); std::string syncStr = paramStr.substr( 2 );
@ -945,7 +947,8 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
case MAIL_IMPORT_FILE: 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 ); std::stringstream ss( payload );
char delim = '\n'; char delim = '\n';

View File

@ -26,7 +26,7 @@
#define DEFAULT_VALUES_H #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 #define DANGLING_SYMBOL_SIZE 12
///< The size of the rectangle indicating a connected, unselected wire end ///< 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 ); SaveSheetAsDesignBlock( aLibraryName, curPath );
} }
else else
{
DisplayErrorMessage( this, _( "Design blocks with nested sheets are not supported." ) ); DisplayErrorMessage( this, _( "Design blocks with nested sheets are not supported." ) );
}
return; 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 // Save a temporary copy of the schematic file, as the plugin is just going to move it
wxString tempFile = wxFileName::CreateTempFileName( "design_block" ); wxString tempFile = wxFileName::CreateTempFileName( "design_block" );
if( !saveSchematicFile( tempSheet, tempFile ) ) 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 ); wxRemoveFile( tempFile );
return; return;
} }
@ -449,6 +453,7 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
// Clean up the temporaries // Clean up the temporaries
wxRemoveFile( tempFile ); wxRemoveFile( tempFile );
// This will also delete the screen // This will also delete the screen
delete tempSheet; delete tempSheet;
@ -582,8 +587,10 @@ bool SCH_EDIT_FRAME::EditDesignBlockProperties( const LIB_ID& aLibId )
Prj().DesignBlockLibs()->DesignBlockDelete( libname, originalName ); Prj().DesignBlockLibs()->DesignBlockDelete( libname, originalName );
} }
else else
{
Prj().DesignBlockLibs()->DesignBlockSave( libname, designBlock ); Prj().DesignBlockLibs()->DesignBlockSave( libname, designBlock );
} }
}
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
DisplayError( this, ioe.What() ); DisplayError( this, ioe.What() );
@ -612,7 +619,8 @@ DESIGN_BLOCK* SchGetDesignBlock( const LIB_ID& aLibId, DESIGN_BLOCK_LIB_TABLE* a
{ {
if( aShowErrorMsg ) 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.GetLibItemName().wx_str(),
aLibId.GetLibNickname().wx_str() ); aLibId.GetLibNickname().wx_str() );
DisplayErrorMessage( aParent, msg, ioe.What() ); 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; 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() ) for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
newAliases.push_back( alias ); 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(); cfg->m_AuiPanels.float_net_nav_panel = netNavigatorPane.IsFloating();
if( netNavigatorPane.IsDocked() ) if( netNavigatorPane.IsDocked() )
{
cfg->m_AuiPanels.net_nav_panel_docked_size = m_netNavigator->GetSize(); cfg->m_AuiPanels.net_nav_panel_docked_size = m_netNavigator->GetSize();
}
else else
{ {
cfg->m_AuiPanels.net_nav_panel_float_pos = netNavigatorPane.floating_pos; 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, SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName, bool aSetActive,
bool aSetActive, bool aForceDefaultProject, PROJECT* aProject )
bool aForceDefaultProject,
PROJECT* aProject )
{ {
if( aFileName.EndsWith( FILEEXT::KiCadSchematicFileExtension ) ) 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 ) ) 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 // as fall back for any other kind use the legacy format
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY, aSetActive, aForceDefaultProject, aProject ); 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 aSetActive,
bool aForceDefaultProject, bool aForceDefaultProject,
PROJECT* aProject ) PROJECT* aProject )
@ -150,7 +151,6 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( const wxString& aFileName, SCH_IO_MG
const_cast<KIID&>( rootSheet->m_Uuid ) = rootScreen->GetUuid(); const_cast<KIID&>( rootSheet->m_Uuid ) = rootScreen->GetUuid();
schematic->Root().SetScreen( rootScreen ); schematic->Root().SetScreen( rootScreen );
schematic->RootScreen()->SetFileName( wxEmptyString ); schematic->RootScreen()->SetFileName( wxEmptyString );
// Don't leave root page number empty // 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 * 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 * for these types of "hacky" solutions
*/ */
class EESCHEMA_HELPERS class EESCHEMA_HELPERS
@ -44,10 +44,13 @@ public:
static SETTINGS_MANAGER* GetSettingsManager(); static SETTINGS_MANAGER* GetSettingsManager();
static void SetSchEditFrame( SCH_EDIT_FRAME* aSchEditFrame ); static void SetSchEditFrame( SCH_EDIT_FRAME* aSchEditFrame );
static PROJECT* GetDefaultProject( bool aSetActive ); 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 ); PROJECT* aProject = nullptr );
static SCHEMATIC* LoadSchematic( const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aFormat,
bool aSetActive, bool aForceDefaultProject, PROJECT* aProject = nullptr );
private: private:
static SCH_EDIT_FRAME* s_SchEditFrame; 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 ); std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
PLOT_FORMAT format = PLOT_FORMAT::PDF; PLOT_FORMAT format = PLOT_FORMAT::PDF;
switch( aPlotJob->m_plotFormat ) switch( aPlotJob->m_plotFormat )
{ {
case SCH_PLOT_FORMAT::DXF: format = PLOT_FORMAT::DXF; break; 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; HPGL_PAGE_SIZE hpglPageSize = HPGL_PAGE_SIZE::DEFAULT;
switch( aPlotJob->m_HPGLPaperSizeSelect ) switch( aPlotJob->m_HPGLPaperSizeSelect )
{ {
case JOB_HPGL_PAGE_SIZE::DEFAULT: hpglPageSize = HPGL_PAGE_SIZE::DEFAULT; break; 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; HPGL_PLOT_ORIGIN_AND_UNITS hpglOrigin = HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE;
switch( aPlotJob->m_HPGLPlotOrigin ) switch( aPlotJob->m_HPGLPlotOrigin )
{ {
case JOB_HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT: 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() ); wxString outPath = aPlotJob->GetFullOutputPath( &sch->Prj() );
if( !PATHS::EnsurePathExists( outPath, if( !PATHS::EnsurePathExists( outPath,
!aPlotJob->GetOutputPathIsDirectory() ) ) !aPlotJob->GetOutputPathIsDirectory() ) )
{ {
@ -336,6 +340,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
plotOpts.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups; plotOpts.m_PDFPropertyPopups = aPlotJob->m_PDFPropertyPopups;
plotOpts.m_PDFHierarchicalLinks = aPlotJob->m_PDFHierarchicalLinks; plotOpts.m_PDFHierarchicalLinks = aPlotJob->m_PDFHierarchicalLinks;
plotOpts.m_PDFMetadata = aPlotJob->m_PDFMetadata; plotOpts.m_PDFMetadata = aPlotJob->m_PDFMetadata;
if( aPlotJob->GetOutputPathIsDirectory() ) if( aPlotJob->GetOutputPathIsDirectory() )
{ {
plotOpts.m_outputDirectory = outPath; plotOpts.m_outputDirectory = outPath;
@ -346,6 +351,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
plotOpts.m_outputDirectory = wxEmptyString; plotOpts.m_outputDirectory = wxEmptyString;
plotOpts.m_outputFile = outPath; plotOpts.m_outputFile = outPath;
} }
plotOpts.m_pageSizeSelect = pageSizeSelect; plotOpts.m_pageSizeSelect = pageSizeSelect;
plotOpts.m_plotAll = aPlotJob->m_plotAll; plotOpts.m_plotAll = aPlotJob->m_plotAll;
plotOpts.m_plotDrawingSheet = aPlotJob->m_plotDrawingSheet; 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 // 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 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; wxString filename;
wxFileName fn; wxFileName fn;
@ -883,7 +890,8 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
RPT_SEVERITY_ACTION ); RPT_SEVERITY_ACTION );
// Get the symbol bounding box to fit the plot page to it // 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 ); PAGE_INFO pageInfo( PAGE_INFO::Custom );
pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) ); pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) ); pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
@ -1087,7 +1095,8 @@ int EESCHEMA_JOBS_HANDLER::JobSymUpgrade( JOB* aJob )
} }
else 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 ); m_reporter->Report( ( "Unable to convert library\n" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_UNKNOWN; 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. * 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 * 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 aRenderSettings The object to populate with working settings.
* @param aTheme The theme to take color data from to stick into render settings, can be * @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 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; const int eeschemaSchemaVersion = 3;
/// Default value for bom.plugins /// Default value for bom.plugins
const nlohmann::json defaultBomPlugins = 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_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
&m_lastSymbolLibDir, "" ) ); &m_lastSymbolLibDir, "" ) );
// Migrations // Migrations
registerMigration( 0, 1, registerMigration( 0, 1,
[&]() -> bool [&]() -> 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 ) ); SCH_FIELD& valueField = static_cast<SCH_FIELD&>( this->at( VALUE_FIELD ) );
valueField.OnScintillaCharAdded( aScintillaTricks, aEvent ); valueField.OnScintillaCharAdded( aScintillaTricks, aEvent );
} ); } );
m_valueAttr->SetEditor( valueEditor ); 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 ) if( value == DEFAULT_FONT_NAME )
field.SetFont( nullptr ); field.SetFont( nullptr );
else if( value == KICAD_FONT_NAME ) 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 else
field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) ); field.SetFont( KIFONT::FONT::GetFont( aValue, field.IsBold(), field.IsItalic() ) );

View File

@ -34,7 +34,8 @@ static const wxString DescriptionFormat = wxS(
"__FIELDS__" "__FIELDS__"
"</table>" ); "</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 DescFormat = wxS( "<br>%s" );
static const wxString KeywordsFormat = wxS( "<br>" ) + _( "Keywords" ) + wxS( ": %s" ); static const wxString KeywordsFormat = wxS( "<br>" ) + _( "Keywords" ) + wxS( ": %s" );
static const wxString FieldFormat = wxS( static const wxString FieldFormat = wxS(
@ -129,7 +130,8 @@ protected:
root_desc = parent->GetDesc(); 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( UnescapeString( root_name ) ),
EscapeHTML( root_desc ) ) ); EscapeHTML( root_desc ) ) );
} }
@ -157,7 +159,8 @@ protected:
if( keywords.empty() ) if( keywords.empty() )
m_html.Replace( wxS( "__KEY__" ), wxEmptyString ); m_html.Replace( wxS( "__KEY__" ), wxEmptyString );
else 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 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; bool isJunction;
///< True if there is already junction dot at the point
/// True if there is already junction dot at the point
bool hasExplicitJunctionDot; 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; 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; bool hasBusEntryToMultipleWires;
}; };

View File

@ -265,6 +265,8 @@ unsigned LIB_SYMBOL::GetInheritanceDepth() const
return depth; return depth;
} }
LIB_SYMBOL_SPTR LIB_SYMBOL::GetRootSymbol() const LIB_SYMBOL_SPTR LIB_SYMBOL::GetRootSymbol() const
{ {
const LIB_SYMBOL_SPTR sp = m_parent.lock(); 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 ); prms.SetColor( color );
shape.SetStroke( prms ); shape.SetStroke( prms );
} }
shape.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed ); shape.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
prms.SetColor( init_color ); prms.SetColor( init_color );
shape.SetStroke( prms ); shape.SetStroke( prms );

View File

@ -91,7 +91,7 @@ public:
virtual ~LIB_SYMBOL() 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; } LIB_SYMBOL_SPTR SharedPtr() const { return m_me; }
/** /**
@ -120,7 +120,7 @@ public:
/** /**
* Get the number of parents for this symbol. * 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; unsigned GetInheritanceDepth() const;
@ -252,7 +252,7 @@ public:
* If aUnit == 0, unit is not used * If aUnit == 0, unit is not used
* if aBodyStyle == 0 Convert is non used * if aBodyStyle == 0 Convert is non used
* Fields are not taken in account * Fields are not taken in account
**/ */
const BOX2I GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins, const BOX2I GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins,
bool aIncludePrivateItems ) const; bool aIncludePrivateItems ) const;
@ -549,7 +549,7 @@ public:
* greater that count are removed from the symbol. * greater that count are removed from the symbol.
* *
* @param aCount - Number of units per package. * @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 ); void SetUnitCount( int aCount, bool aDuplicateDrawItems = true );
int GetUnitCount() const override; int GetUnitCount() const override;
@ -637,7 +637,7 @@ public:
* @note #SCH_FIELD objects are not included. * @note #SCH_FIELD objects are not included.
* *
* @param aUnit is the unit number of the item, -1 includes all units. * @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. * @return a list of unit items.
*/ */

View File

@ -42,6 +42,7 @@
void SCH_EDIT_FRAME::doReCreateMenuBar() void SCH_EDIT_FRAME::doReCreateMenuBar()
{ {
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means // wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar. // we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar(); wxMenuBar* oldMenuBar = GetMenuBar();
@ -205,7 +206,8 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
showHidePanels->Add( EE_ACTIONS::showNetNavigator, ACTION_MENU::CHECK ); showHidePanels->Add( EE_ACTIONS::showNetNavigator, ACTION_MENU::CHECK );
if( ADVANCED_CFG::GetCfg().m_EnableDesignBlocks ) 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 ); 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(); wxTreeItemId selection = m_netNavigator->GetSelection();
if( selection.IsOk() ) 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(); m_netNavigator->DeleteAllItems();
nodeCnt++; nodeCnt++;
@ -401,7 +402,8 @@ void SCH_EDIT_FRAME::SelectNetNavigatorItem( const NET_NAVIGATOR_ITEM_DATA* aSel
while( itemId.IsOk() ) 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 ); wxCHECK2( itemData, continue );
@ -533,7 +535,8 @@ void SCH_EDIT_FRAME::ToggleNetNavigator()
wxTreeItemId selection = m_netNavigator->GetSelection(); wxTreeItemId selection = m_netNavigator->GetSelection();
if( selection.IsOk() ) 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 ); RefreshNetNavigator( itemData );
@ -559,7 +562,7 @@ void SCH_EDIT_FRAME::onResizeNetNavigator( wxSizeEvent& aEvent )
// Store the current pane size // Store the current pane size
// It allows to retrieve the last defined pane size when switching between // It allows to retrieve the last defined pane size when switching between
// docked and floating pane state // 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() ); 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 targetUnitName = symbol->GetUnitDisplayName( aUnit );
const wxString currUnitName = symbol->GetUnitDisplayName( currentUnit ); const wxString currUnitName = symbol->GetUnitDisplayName( currentUnit );
wxString otherSheetName = otherSymbolRef->GetSheetPath().PathHumanReadable( true, true ); wxString otherSheetName = otherSymbolRef->GetSheetPath().PathHumanReadable( true, true );
if( otherSheetName.IsEmpty() ) if( otherSheetName.IsEmpty() )
otherSheetName = _( "Root" ); otherSheetName = _( "Root" );

View File

@ -425,6 +425,7 @@ OPT_BOX2I PIN_LAYOUT_CACHE::getUntransformedPinNameBox() const
OPT_BOX2I PIN_LAYOUT_CACHE::getUntransformedPinNumberBox() const OPT_BOX2I PIN_LAYOUT_CACHE::getUntransformedPinNumberBox() const
{ {
int pinNameOffset = 0; int pinNameOffset = 0;
if( const SYMBOL* parentSymbol = m_pin.GetParentSymbol() ) if( const SYMBOL* parentSymbol = m_pin.GetParentSymbol() )
{ {
if( parentSymbol->GetShowPinNames() ) 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 // But it's not hugely expensive to recompute, and that's what's always been
// done to now // 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. // cache might make more sense than a per-pin cache.
if( name.IsEmpty() || !m_pin.GetParentSymbol()->GetShowPinNames() ) 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 = const bool numAbove =
m_pin.GetParentSymbol()->GetPinNameOffset() > 0 m_pin.GetParentSymbol()->GetPinNameOffset() > 0
|| ( m_pin.GetShownName().empty() || !m_pin.GetParentSymbol()->GetShowPinNames() ); || ( m_pin.GetShownName().empty() || !m_pin.GetParentSymbol()->GetShowPinNames() );
if( numAbove ) if( numAbove )
{ {
info->m_TextPosition.y -= getPinTextOffset() + info->m_Thickness / 2; 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; return info;
} }
std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> std::optional<PIN_LAYOUT_CACHE::TEXT_INFO>
PIN_LAYOUT_CACHE::GetPinElectricalTypeInfo( int aShadowWidth ) PIN_LAYOUT_CACHE::GetPinElectricalTypeInfo( int aShadowWidth )
{ {

View File

@ -174,7 +174,7 @@ private:
OPT_BOX2I getUntransformedPinTypeBox() const; OPT_BOX2I getUntransformedPinTypeBox() const;
OPT_BOX2I getUntransformedAltIconBox() const; OPT_BOX2I getUntransformedAltIconBox() const;
///< Pin type decoration if any /// Pin type decoration if any
OPT_BOX2I getUntransformedDecorationBox() const; OPT_BOX2I getUntransformedDecorationBox() const;
/// The pin in question /// 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]; wxChar c = str[cursor];
// Need to check that there is a digit in the string before we parse it as a numeric // 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 // number, possibly with sign
while( ++cursor < str.size() ) while( ++cursor < str.size() )
@ -72,6 +73,7 @@ wxString PIN_NUMBERS::GetSummary() const
wxString ret; wxString ret;
const_iterator i = begin(); const_iterator i = begin();
if( i == end() ) if( i == end() )
return ret; return ret;
@ -92,13 +94,16 @@ wxString PIN_NUMBERS::GetSummary() const
continue; continue;
ret += *begin_of_range; ret += *begin_of_range;
if( begin_of_range != last ) if( begin_of_range != last )
{ {
ret += '-'; ret += '-';
ret += *last; ret += *last;
} }
if( i == end() ) if( i == end() )
break; break;
begin_of_range = i; begin_of_range = i;
ret += ','; ret += ',';
} }
@ -188,8 +193,10 @@ int PIN_NUMBERS::Compare( const wxString& lhs, const wxString& rhs )
} }
} }
else else
{
return -2; return -2;
} }
}
else else
{ {
if( sym2_isnumeric ) if( sym2_isnumeric )

View File

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

View File

@ -37,8 +37,10 @@ enum class ELECTRICAL_PINTYPE
PT_INPUT, ///< usual pin input: must be connected PT_INPUT, ///< usual pin input: must be connected
PT_OUTPUT, ///< usual output PT_OUTPUT, ///< usual output
PT_BIDI, ///< input or output (like port for a microprocessor) PT_BIDI, ///< input or output (like port for a microprocessor)
PT_TRISTATE, ///< tris state bus pin PT_TRISTATE, ///< tri state bus pin
PT_PASSIVE, ///< pin for passive symbols: must be connected, and can be connected to any 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_NIC, ///< not internally connected (may be connected to anything)
PT_UNSPECIFIED, ///< unknown electrical properties: creates always a warning when connected 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. 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---| * x---|
*/ */
PIN_RIGHT, PIN_RIGHT,
/** /**
* The pin extends leftwards from the connection point: * The pin extends leftwards from the connection point:
* Probably on the right side of the symbol. * Probably on the right side of the symbol.
* |---x * |---x
*/ */
PIN_LEFT, PIN_LEFT,
/** /**
* The pin extends upwards from the connection point: * The pin extends upwards from the connection point:
* Probably on the bottom side of the symbol. * Probably on the bottom side of the symbol.
@ -96,6 +100,7 @@ enum class PIN_ORIENTATION
* x * x
*/ */
PIN_UP, PIN_UP,
/** /**
* The pin extends downwards from the connection: * The pin extends downwards from the connection:
* Probably on the top side of the symbol. * 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). // A new symbol name is found (a new group starts here).
// Search the symbol names candidates only once for this group: // Search the symbol names candidates only once for this group:
old_symbol_name = symbol_name; 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 ); lib_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), false );
// At some point during V5 development, the LIB_ID delimiter character ':' was // 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( "_" ) + symbolName = symbol_id.GetLibNickname().wx_str() + wxT( "_" ) +
symbol_id.GetLibItemName().wx_str(); 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. // 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 ) if( !cache_match && !lib_match )
continue; continue;
@ -465,7 +468,8 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
// library. // library.
wxString libNickname = GetRescueLibraryFileName( aRescuer.Schematic() ).GetName(); 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, RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( symbol_id, new_id, cache_match, lib_match,
eachSymbol->GetUnit(), eachSymbol->GetUnit(),
@ -682,8 +686,8 @@ void LEGACY_RESCUER::OpenRescueLibrary()
{ {
wxFileName fn = GetRescueLibraryFileName( m_schematic ); wxFileName fn = GetRescueLibraryFileName( m_schematic );
std::unique_ptr<SYMBOL_LIB> rescue_lib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, std::unique_ptr<SYMBOL_LIB> rescue_lib =
fn.GetFullPath() ); std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() );
m_rescue_lib = std::move( rescue_lib ); m_rescue_lib = std::move( rescue_lib );
m_rescue_lib->EnableBuffering(); m_rescue_lib->EnableBuffering();

View File

@ -31,7 +31,7 @@ class SYMBOL_LIBS;
class PROJECT_SCH class PROJECT_SCH
{ {
public: public:
// These are all prefaced with "Sch" /// These are all prefaced with "Sch".
static SYMBOL_LIBS* SchLibs( PROJECT* aProject ); static SYMBOL_LIBS* SchLibs( PROJECT* aProject );
/// Accessor for Eeschema search stack. /// 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 ); GetCanvas()->GetView()->Update( aItem );
// Some children are drawn from their parents. Mark them for re-paint. // 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 ); GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
} }
/** /*
* Be careful when calling this. Update will invalidate RTree iterators, so you cannot * 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() )` * 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 // Thus, as it currently stands, all zoom-dependent items can be found in the list of selected
// items. // items.
if( m_toolManager ) if( m_toolManager )
{ {
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>(); 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 ) ) 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 ) if( !symCfg->m_UseEeschemaColorSettings )
colorTheme = symCfg->m_ColorTheme; colorTheme = symCfg->m_ColorTheme;
@ -738,6 +739,7 @@ void SCH_BASE_FRAME::OnSymChange( wxFileSystemWatcherEvent& aEvent )
void SCH_BASE_FRAME::OnSymChangeDebounceTimer( wxTimerEvent& aEvent ) void SCH_BASE_FRAME::OnSymChangeDebounceTimer( wxTimerEvent& aEvent )
{ {
wxLogTrace( "KICAD_LIB_WATCH", "OnSymChangeDebounceTimer" ); wxLogTrace( "KICAD_LIB_WATCH", "OnSymChangeDebounceTimer" );
// Disable logging to avoid spurious messages and check if the file has changed // Disable logging to avoid spurious messages and check if the file has changed
wxLog::EnableLogging( false ); wxLog::EnableLogging( false );
wxDateTime lastModified = m_watcherFileName.GetModificationTime(); wxDateTime lastModified = m_watcherFileName.GetModificationTime();
@ -748,7 +750,8 @@ void SCH_BASE_FRAME::OnSymChangeDebounceTimer( wxTimerEvent& aEvent )
m_watcherLastModified = lastModified; 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?" ) ) ) "Do you want to reload the library?" ) ) )
{ {
wxLogTrace( "KICAD_LIB_WATCH", "Sending refresh symbol mail" ); 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 ) ) if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), m_pos ) )
m_isStartDangling = false; m_isStartDangling = false;
if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) ) if( IsPointOnSegment( item.GetPosition(), nextItem.GetPosition(), GetEnd() ) )
m_isEndDangling = false; 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, bool SCH_BUS_ENTRY_BASE::HasConnectivityChanges( const SCH_ITEM* aItem,
const SCH_SHEET_PATH* aInstance ) const const SCH_SHEET_PATH* aInstance ) const
{ {
// Do not compare to ourself. // Do not compare to ourselves.
if( aItem == this ) if( aItem == this )
return false; return false;
@ -664,14 +665,17 @@ static struct SCH_BUS_ENTRY_DESC
.Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) ); .Map( WIRE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
} }
propMgr.AddProperty( new PROPERTY_ENUM<SCH_BUS_ENTRY_BASE, WIRE_STYLE>( _HKI( "Line Style" ), propMgr.AddProperty( new PROPERTY_ENUM<SCH_BUS_ENTRY_BASE,
&SCH_BUS_ENTRY_BASE::SetWireStyle, &SCH_BUS_ENTRY_BASE::GetWireStyle ) ); 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" ), propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, int>( _HKI( "Line Width" ),
&SCH_BUS_ENTRY_BASE::SetPenWidth, &SCH_BUS_ENTRY_BASE::GetPenWidth, &SCH_BUS_ENTRY_BASE::SetPenWidth, &SCH_BUS_ENTRY_BASE::GetPenWidth,
PROPERTY_DISPLAY::PT_SIZE ) ); PROPERTY_DISPLAY::PT_SIZE ) );
propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, COLOR4D>( _HKI( "Color" ), propMgr.AddProperty( new PROPERTY<SCH_BUS_ENTRY_BASE, COLOR4D>(
&SCH_BUS_ENTRY_BASE::SetBusEntryColor, &SCH_BUS_ENTRY_BASE::GetBusEntryColor ) ); _HKI( "Color" ), &SCH_BUS_ENTRY_BASE::SetBusEntryColor,
&SCH_BUS_ENTRY_BASE::GetBusEntryColor ) );
} }
} _SCH_BUS_ENTRY_DESC; } _SCH_BUS_ENTRY_DESC;

View File

@ -233,7 +233,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
if( connectivityCleanUp == NO_CLEANUP ) if( connectivityCleanUp == NO_CLEANUP )
connectivityCleanUp = LOCAL_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 ) if( schItem->Type() == SCH_SHEET_T )
connectivityCleanUp = GLOBAL_CLEANUP; connectivityCleanUp = GLOBAL_CLEANUP;
} }
@ -402,7 +402,8 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
{ {
wxLogTrace( wxS( "CONN_PROFILE" ), wxLogTrace( wxS( "CONN_PROFILE" ),
wxS( "SCH_COMMIT::pushSchEdit() %s clean up connectivity rebuild." ), 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 ); frame->RecalculateConnections( this, connectivityCleanUp );
} }
} }

View File

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

View File

@ -278,7 +278,7 @@ private:
/// Local prefix for group bus members (used with m_local_name) /// Local prefix for group bus members (used with m_local_name)
wxString m_local_prefix; 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_bus_prefix;
wxString m_suffix; ///< Name suffix (used only for disambiguation) wxString m_suffix; ///< Name suffix (used only for disambiguation)
@ -295,7 +295,7 @@ private:
long m_vector_end; ///< Lowest member of a vector bus 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; 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_painter->GetSettings()->LoadColors( cs );
m_view->SetPainter( m_painter.get() ); m_view->SetPainter( m_painter.get() );
// This fixes the zoom in and zoom out limits: // This fixes the zoom in and zoom out limits:
m_view->SetScaleLimits( ZOOM_MAX_LIMIT_EESCHEMA, ZOOM_MIN_LIMIT_EESCHEMA ); m_view->SetScaleLimits( ZOOM_MAX_LIMIT_EESCHEMA, ZOOM_MIN_LIMIT_EESCHEMA );
m_view->SetMirror( false, false ); m_view->SetMirror( false, false );

View File

@ -51,7 +51,6 @@ public:
protected: protected:
virtual void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override; virtual void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override;
///< @copydoc EDA_DRAW_PANEL_GAL::OnShow()
void OnShow() override; void OnShow() override;
void setDefaultLayerOrder(); ///< Reassign layer order to the initial settings. 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::cut, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) ); mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) ); mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) ); mgr->SetConditions( ACTIONS::paste,
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) ); 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::doDelete, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) ); mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::selectAll, 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( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
mgr->SetConditions( EE_ACTIONS::saveSheetAsDesignBlock, ENABLE( hasElements ) ); 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 ) ) ) #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" ) ); m_schematic->RootScreen()->SetPageNumber( wxT( "1" ) );
rootSheetPath.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(); m_schematic->RefreshHierarchy();
if( GetScreen() == nullptr ) if( GetScreen() == nullptr )
@ -1102,6 +1105,7 @@ void SCH_EDIT_FRAME::doCloseWindow()
if( m_toolManager ) if( m_toolManager )
{ {
m_toolManager->ShutdownAllTools(); m_toolManager->ShutdownAllTools();
// prevent the canvas from trying to dispatch events during close // prevent the canvas from trying to dispatch events during close
GetCanvas()->SetEventDispatcher( nullptr ); GetCanvas()->SetEventDispatcher( nullptr );
delete m_toolManager; delete m_toolManager;
@ -1238,7 +1242,7 @@ void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator )
void SCH_EDIT_FRAME::UpdateLabelsHierarchyNavigator() void SCH_EDIT_FRAME::UpdateLabelsHierarchyNavigator()
{ {
// Update only the hierarchy navigation tree labels. // 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(); m_hierarchy->UpdateLabelsHierarchyTree();
} }
@ -1295,10 +1299,9 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
if( m_findReplaceDialog ) if( m_findReplaceDialog )
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
m_findReplaceDialog = new DIALOG_SCH_FIND( this, m_findReplaceDialog = new DIALOG_SCH_FIND(
static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ), this, static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ), wxDefaultPosition,
wxDefaultPosition, wxDefaultSize, wxDefaultSize, aReplace ? wxFR_REPLACEDIALOG : 0 );
aReplace ? wxFR_REPLACEDIALOG : 0 );
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString ); m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString );
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList ); m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
@ -1517,7 +1520,8 @@ void SCH_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
cfg->GetPrintDC()->SetLogicalFunction( wxCOPY ); cfg->GetPrintDC()->SetLogicalFunction( wxCOPY );
GetScreen()->Print( cfg ); 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 ); GetCanvas()->GetView()->Update( line );
line->SetOperatingPoint( wxEmptyString ); line->SetOperatingPoint( wxEmptyString );
// update value from netlist, below // update value from netlist, below
} }
else if( item->Type() == SCH_SYMBOL_T ) 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 \$NET: \c "netname" Highlight a specified net
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear symbols highlight * \li \c \$CLEAR: \c "HIGHLIGHTED" Clear symbols highlight
* <p> * <p>
*
* They are a keyword followed by a quoted string. * They are a keyword followed by a quoted string.
*
* @param cmdline is the command received from Pcbnew. * @param cmdline is the command received from Pcbnew.
*/ */
void ExecuteRemoteCommand( const char* cmdline ) override; void ExecuteRemoteCommand( const char* cmdline ) override;
@ -225,12 +227,12 @@ public:
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override; 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(); 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 ); void AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
@ -246,6 +248,7 @@ public:
/** /**
* Update the hierarchy navigation tree labels. * Update the hierarchy navigation tree labels.
*
* No change for the tree, only the labels are updated, after editing a sheet * No change for the tree, only the labels are updated, after editing a sheet
* name or a sheet number. * name or a sheet number.
*/ */
@ -272,6 +275,7 @@ public:
/** /**
* Break a single segment into two at the specified point. * Break a single segment into two at the specified point.
*
* @param aCommit Transaction container used to record changes for undo/redo * @param aCommit Transaction container used to record changes for undo/redo
* @param aSegment Line segment to break * @param aSegment Line segment to break
* @param aPoint Point at which to break the segment * @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 * Check every wire and bus for a intersection at \a aPoint and break into two segments
* at \a aPoint if an intersection is found. * at \a aPoint if an intersection is found.
*
* @param aCommit Transaction container used to record changes for undo/redo * @param aCommit Transaction container used to record changes for undo/redo
* @param aPoint Test this point for an intersection. * @param aPoint Test this point for an intersection.
* @param aScreen is the screen to examine. * @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 * Test all junctions and bus entries in the schematic for intersections with wires and
* buses and breaks any intersections into multiple segments. * buses and breaks any intersections into multiple segments.
*
* @param aCommit Transaction container used to record changes for undo/redo * @param aCommit Transaction container used to record changes for undo/redo
* @param aScreen is the screen to examine. * @param aScreen is the screen to examine.
* @return True if any wires or buses were broken. * @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. * Test all of the connectable objects in the schematic for unused connection points.
*
* @return True if any connection state changes were made. * @return True if any connection state changes were made.
*/ */
void TestDanglingEnds(); void TestDanglingEnds();
@ -309,10 +316,10 @@ public:
/** /**
* Send items to board editor for selection. * 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 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 * chosen
*/ */
void SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems, bool aForce ); 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 ); void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER& aReporter );
/** /**
* Annotate the symbols in the schematic that are not currently annotated. Multi-unit symbols * Annotate the symbols in the schematic that are not currently annotated.
* 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. * 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 aCommit Transaction container used to record changes for undo/redo
* @param aAnnotateScope See #ANNOTATE_SCOPE_T * @param aAnnotateScope See #ANNOTATE_SCOPE_T
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T. * @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
@ -445,7 +454,9 @@ public:
bool aUpdateRtree = false ) override; 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; void HardRedraw() override;
@ -506,6 +517,7 @@ public:
/** /**
* Perform routine schematic cleaning including breaking wire and buses and deleting * Perform routine schematic cleaning including breaking wire and buses and deleting
* identical objects superimposed on top of each other. * identical objects superimposed on top of each other.
*
* @param aCommit Transaction container used to record changes for undo/redo * @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 * @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, * If any single wire passes through _both points_, remove the portion between the two points,
* potentially splitting the wire into two. * potentially splitting the wire into two.
*
* @param aCommit Transaction container used to record changes for undo/redo * @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 * @param aEnd The ending point for trimming
* @return True if any wires were changed by this operation * @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. * @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. * @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. * Edit an existing sheet or add a new sheet to the schematic.
@ -631,9 +645,11 @@ public:
* path. * path.
* @param aSkipRecursionCheck is true to skip the recursion check. This is used when loading * @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 * 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. * sheet contents instead of a sheet, then we do not need to check for
* @param aSkipLibCheck is true to skip the new/duplicate lib check. This is always triggered when * recursion.
* placing design blocks so it is not necessary to check for new/duplicate libs. * @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. * @return True if the schematic was imported properly.
*/ */
bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet, bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet,
@ -641,7 +657,7 @@ public:
bool aSkipLibCheck = false ); 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 * @param aItem The junction to delete
*/ */
@ -712,8 +728,9 @@ public:
void AddCopyForRepeatItem( const SCH_ITEM* aItem ); void AddCopyForRepeatItem( const SCH_ITEM* aItem );
/** /**
* Return the items which are to be repeated with the insert key. Such objects are owned by * Return the items which are to be repeated with the insert key.
* this container, and must be cloned. *
* Such objects are owned by this container and must be cloned.
*/ */
const std::vector<std::unique_ptr<SCH_ITEM>>& GetRepeatItems() const 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. * Clear the list of items which are to be repeated with the insert key.
*
* These objects are owned by this container. * These objects are owned by this container.
*/ */
void ClearRepeatItemsList() void ClearRepeatItemsList()
@ -732,8 +750,9 @@ public:
EDA_ITEM* GetItem( const KIID& aId ) const override; EDA_ITEM* GetItem( const KIID& aId ) const override;
/** /**
* Perform an undo of the last edit WITHOUT logging a corresponding redo. Used to cancel * Perform an undo of the last edit **without** logging a corresponding redo.
* an in-progress operation. *
* Used to cancel an in-progress operation.
*/ */
void RollbackSchematicFromUndo(); void RollbackSchematicFromUndo();
@ -747,10 +766,11 @@ public:
/** /**
* If a library name is given, creates a new design block library in the project folder * 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, * with the given name.
* then creates a new design block library at that location. *
* If library exists, user is warned about that, and is given a chance * If no library name is given it prompts user for a library path, then creates a new design
* to abort the new creation, and in that case existing library is first deleted. * 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. * @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 * @return The newly created library path if library was successfully created, else
@ -898,7 +918,7 @@ public:
const SCH_ITEM* GetSelectedNetNavigatorItem() const; 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() 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" ); } static const wxString SearchPaneName() { return wxT( "Search" ); }
/** /**
* Add \a aListener to post #EDA_EVT_SCHEMATIC_CHANGED command events to. * 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 * @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 * projects in the project manager closes the schematic editor when a new project is
@ -982,9 +1002,9 @@ protected:
#endif #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 ); 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 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; searchHiddenFields = schSearchData.searchAllFields;
searchAndReplace = schSearchData.searchAndReplace; searchAndReplace = schSearchData.searchAndReplace;
replaceReferences = schSearchData.replaceReferences; 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_CENTER:
case GR_TEXT_H_ALIGN_INDETERMINATE: break; case GR_TEXT_H_ALIGN_INDETERMINATE: break;
} }
SetTextAngle( ANGLE_HORIZONTAL ); SetTextAngle( ANGLE_HORIZONTAL );
} }
else if( GetTextAngle().IsHorizontal() ) 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_CENTER:
case GR_TEXT_H_ALIGN_INDETERMINATE: break; case GR_TEXT_H_ALIGN_INDETERMINATE: break;
} }
SetTextAngle( ANGLE_VERTICAL ); SetTextAngle( ANGLE_VERTICAL );
} }
else else
@ -1751,15 +1754,19 @@ static struct SCH_FIELD_DESC
const wxString textProps = _HKI( "Text Properties" ); const wxString textProps = _HKI( "Text Properties" );
auto horiz = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_H_ALIGN_T>( _HKI( "Horizontal Justification" ), auto horiz = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_H_ALIGN_T>(
&SCH_FIELD::SetEffectiveHorizJustify, &SCH_FIELD::GetEffectiveHorizJustify ); _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" ), auto vert = new PROPERTY_ENUM<SCH_FIELD, GR_TEXT_V_ALIGN_T>(
&SCH_FIELD::SetEffectiveVertJustify, &SCH_FIELD::GetEffectiveVertJustify ); _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" ), propMgr.AddProperty( new PROPERTY<SCH_FIELD, bool>( _HKI( "Show Field Name" ),
&SCH_FIELD::SetNameShown, &SCH_FIELD::IsNameShown ) ); &SCH_FIELD::SetNameShown, &SCH_FIELD::IsNameShown ) );
@ -1802,8 +1809,8 @@ static struct SCH_FIELD_DESC
return false; return false;
}; };
propMgr.OverrideAvailability( TYPE_HASH( SCH_FIELD ), TYPE_HASH( SCH_ITEM ), _HKI( "Private" ), propMgr.OverrideAvailability( TYPE_HASH( SCH_FIELD ), TYPE_HASH( SCH_ITEM ),
isNonMandatoryField ); _HKI( "Private" ), isNonMandatoryField );
} }
} _SCH_FIELD_DESC; } _SCH_FIELD_DESC;

View File

@ -126,6 +126,7 @@ public:
/** /**
* Get the initial name of the field set at creation (or set by SetName()). * 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. * This is the raw field name with no translation and no change.
*/ */
const wxString& GetInternalName() { return m_name; } const wxString& GetInternalName() { return m_name; }
@ -135,9 +136,11 @@ public:
void SetId( int aId ); void SetId( int aId );
/** /**
* Gets the fields name as displayed on the schematic or * Get the fields name as displayed on the schematic or
* in the symbol fields table. This is either the same as GetName() or * in the symbol fields table.
* if the field has a variable for name, the variable namer with the ${} stripped. *
* 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 GetShownName() const;
wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText, wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
@ -157,8 +160,9 @@ public:
wxString GetFullText( int unit = 1 ) const; wxString GetFullText( int unit = 1 ) const;
/** /**
* Return true if both the name and value of the field are empty. Whitespace * Return true if both the name and value of the field are empty.
* does not count as non-empty *
* Whitespace does not count as non-empty.
*/ */
bool IsEmpty() bool IsEmpty()
{ {
@ -249,7 +253,8 @@ public:
void BeginEdit( const VECTOR2I& aStartPoint ) override; void BeginEdit( const VECTOR2I& aStartPoint ) override;
void CalcEdit( const VECTOR2I& aPosition ) 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; bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
@ -283,14 +288,16 @@ public:
/** /**
* Copy parameters from a SCH_FIELD source. * 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. * @param aSource is the SCH_FIELD to read.
*/ */
void ImportValues( const SCH_FIELD& aSource ); 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. * @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 ) 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 ); SCH_CONNECTION* connection = Connection( aSheet );
if( connection ) 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. // WIRE_END pairs must be kept together. Hence stable sort.
std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType ); std::stable_sort( aItemListByType.begin(), aItemListByType.end(), lessType );
// Sort by y first, pins are more likely to share x than y. // Sort by y first, pins are more likely to share x than y.
std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX ); std::sort( aItemListByPos.begin(), aItemListByPos.end(), lessYX );
} }

View File

@ -132,10 +132,10 @@ public:
DANGLING_END_T GetType() const { return m_type; } DANGLING_END_T GetType() const { return m_type; }
private: private:
EDA_ITEM* m_item; /// A pointer to the connectable object. EDA_ITEM* m_item; ///< A pointer to the connectable object.
VECTOR2I m_pos; /// The position of the connection point. VECTOR2I m_pos; ///< The position of the connection point.
DANGLING_END_T m_type; /// The type of connection of #m_item. 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) 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. * Swap the internal data structures \a aItem with the schematic item.
*
* Obviously, aItem must have the same type than me. * Obviously, aItem must have the same type than me.
*
* @param aItem The item to swap the data structures with. * @param aItem The item to swap the data structures with.
*/ */
virtual void SwapData( SCH_ITEM* aItem ); virtual void SwapData( SCH_ITEM* aItem );
@ -216,6 +218,7 @@ public:
/** /**
* Routine to create a new copy of given item. * Routine to create a new copy of given item.
*
* The new object is not put in draw list (not linked). * The new object is not put in draw list (not linked).
* *
* @param doClone (default = false) indicates unique values (such as timestamp and * @param doClone (default = false) indicates unique values (such as timestamp and
@ -239,10 +242,13 @@ public:
virtual bool GetExcludedFromSim() const { return false; } virtual bool GetExcludedFromSim() const { return false; }
/** /**
* @return true for items which are moved with the anchor point at mouse cursor * Check if object is movable from the anchor point.
* and false for items moved with no reference to anchor *
* Usually return true for small items (labels, junctions) and false for * 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; } virtual bool IsMovableFromAnchorPoint() const { return true; }
@ -250,12 +256,12 @@ public:
void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; } 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 * 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). * 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! * @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 * 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 virtual double Similarity( const SCH_ITEM& aItem ) const
{ {
@ -343,7 +351,8 @@ public:
*/ */
virtual void MirrorHorizontally( int aCenter ) 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; 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 ); void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
virtual bool HasCachedDriverName() const { return false; } 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(); } 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 ); } 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 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 ); AddConnectionTo( *aPath, sch_item );
sch_item->AddConnectionTo( *aPath, this ); sch_item->AddConnectionTo( *aPath, this );
} }
break; break;
} }
@ -1122,6 +1123,7 @@ bool SCH_LABEL_BASE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemL
AddConnectionTo( *aPath, sch_item ); AddConnectionTo( *aPath, sch_item );
sch_item->AddConnectionTo( *aPath, this ); sch_item->AddConnectionTo( *aPath, this );
} }
break; 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 // Make sheet pins and hierarchical labels clickable hyperlinks
bool linkAlreadyPlotted = false; bool linkAlreadyPlotted = false;
if( aPlotOpts.m_PDFHierarchicalLinks ) if( aPlotOpts.m_PDFHierarchicalLinks )
{ {
if( Type() == SCH_HIER_LABEL_T ) if( Type() == SCH_HIER_LABEL_T )
@ -1330,8 +1333,8 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
_( "Net" ), _( "Net" ),
connection->Name() ) ); connection->Name() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), properties.emplace_back(
_( "Resolved netclass" ), wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
GetEffectiveNetClass()->GetHumanReadableName() ) ); GetEffectiveNetClass()->GetHumanReadableName() ) );
} }
@ -1580,6 +1583,7 @@ void SCH_DIRECTIVE_LABEL::MirrorSpinStyle( bool aLeftRight )
void SCH_DIRECTIVE_LABEL::MirrorHorizontally( int aCenter ) void SCH_DIRECTIVE_LABEL::MirrorHorizontally( int aCenter )
{ {
VECTOR2I old_pos = GetPosition(); VECTOR2I old_pos = GetPosition();
// The "text" is in fact a graphic shape. For a horizontal "text", it looks like a // 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). // vertical shape (like a text reduced to only "I" letter).
// So the mirroring is not exactly similar to a SCH_TEXT item // 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.InheritsAfter( TYPE_HASH( SCH_DIRECTIVE_LABEL ), TYPE_HASH( SCH_LABEL_BASE ) );
propMgr.AddProperty( new PROPERTY_ENUM<SCH_DIRECTIVE_LABEL, FLAG_SHAPE>( _HKI( "Shape" ), propMgr.AddProperty( new PROPERTY_ENUM<SCH_DIRECTIVE_LABEL, FLAG_SHAPE>(
&SCH_DIRECTIVE_LABEL::SetFlagShape, &SCH_DIRECTIVE_LABEL::GetFlagShape ) ); _HKI( "Shape" ), &SCH_DIRECTIVE_LABEL::SetFlagShape,
&SCH_DIRECTIVE_LABEL::GetFlagShape ) );
propMgr.AddProperty( new PROPERTY<SCH_DIRECTIVE_LABEL, int>( _HKI( "Pin length" ), propMgr.AddProperty( new PROPERTY<SCH_DIRECTIVE_LABEL, int>( _HKI( "Pin length" ),
&SCH_DIRECTIVE_LABEL::SetPinLength, &SCH_DIRECTIVE_LABEL::GetPinLength, &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 * Spin style for labels of all kinds on schematics.
* Basically a higher level abstraction of rotation and justification of text *
* Basically a higher level abstraction of rotation and justification of text.
*/ */
class SPIN_STYLE class SPIN_STYLE
{ {
@ -134,7 +135,7 @@ enum GLOBALLABEL_FIELD_T
{ {
INTERSHEET_REFS = 0, 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 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. * @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; 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. * @param pages [out] Array of { pageNumber, pageName } pairs.
*/ */
void GetIntersheetRefs( const SCH_SHEET_PATH* aPath, void GetIntersheetRefs( const SCH_SHEET_PATH* aPath,
@ -350,21 +352,19 @@ public:
/** /**
* @brief autoRotateOnPlacement * @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; bool AutoRotateOnPlacement() const;
/** /**
* @brief setAutoRotateOnPlacement
* @param autoRotate If set to true when the label is placed in the connection to a * @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 ); void SetAutoRotateOnPlacement( bool autoRotate = true );
/** /**
* @brief AutoRotateOnPlacementSupported
* @return true if the automated rotation of the label is supported after the placement * @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; virtual bool AutoRotateOnPlacementSupported() const = 0;
@ -512,7 +512,7 @@ private:
int m_pinLength; int m_pinLength;
int m_symbolSize; 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; std::unordered_set<SCH_RULE_AREA*> m_connected_rule_areas;
}; };

View File

@ -96,7 +96,7 @@ public:
int GetReverseAngleFrom( const VECTOR2I& aPoint ) const; 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. * @return Line angle in radians.
*/ */
@ -106,8 +106,10 @@ public:
} }
/** /**
* Saves the current line angle. Useful when dragging a line and its important to * Save the current line angle.
* be able to restart the line from length 0 in the correct direction. *
* 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() inline void StoreAngle()
{ {
@ -118,14 +120,14 @@ public:
inline void StoreAngle( const EDA_ANGLE& aAngle ) { m_storedAngle = aAngle; } 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. * @return Stored angle in radians.
*/ */
inline EDA_ANGLE GetStoredAngle() const { return m_storedAngle; } 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. * @return True if orthogonal, false if not or the line is zero length.
*/ */
@ -164,12 +166,13 @@ public:
void SetLineStyle( const LINE_STYLE aStyle ); void SetLineStyle( const LINE_STYLE aStyle );
LINE_STYLE GetLineStyle() const; LINE_STYLE GetLineStyle() const;
/// @return the style that the line should be drawn in /// @return the style that the line should be drawn in
/// this might be set on the line or inherited from the line's netclass /// this might be set on the line or inherited from the line's netclass
LINE_STYLE GetEffectiveLineStyle() const; LINE_STYLE GetEffectiveLineStyle() const;
// Special Getter/Setters for properties panel. Required because it uses WIRE_STYLE instead // 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 // 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.) // property while we don't with the LINE_STYLE property.)
void SetWireStyle( const WIRE_STYLE aStyle ) { SetLineStyle( (LINE_STYLE) aStyle ); } void SetWireStyle( const WIRE_STYLE aStyle ) { SetLineStyle( (LINE_STYLE) aStyle ); }
WIRE_STYLE GetWireStyle() const { return (WIRE_STYLE) GetLineStyle(); } 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 ); 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; COLOR4D GetLineColor() const;
void SetLineWidth( const int aSize ); void SetLineWidth( const int aSize );

View File

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

View File

@ -54,7 +54,8 @@ public:
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
wxString SerializeToString() const; 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; std::vector<int> ViewGetLayers() const override;
@ -111,13 +112,15 @@ public:
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
/** /**
* Sets this marker as a legacy artifact. Legacy markers are those deserialized from a file * Set this marker as a legacy artifact.
* version < 20230121 *
* Legacy markers are those deserialized from a file version < 20230121.
*/ */
void SetIsLegacyMarker( bool isLegacyMarker = true ) { m_isLegacyMarker = isLegacyMarker; } 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 * @return True if marker deserialized from a file version < 20230121
*/ */
bool IsLegacyMarker() const { return m_isLegacyMarker; } bool IsLegacyMarker() const { return m_isLegacyMarker; }
@ -139,7 +142,7 @@ public:
protected: protected:
KIGFX::COLOR4D getColor() const override; 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_ #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 ) SCH_ITEM( nullptr, SCH_NO_CONNECT_T )
{ {
m_pos = pos; 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 ); SetLayer( LAYER_NOCONNECT );
} }

View File

@ -115,6 +115,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
return false; return false;
} }
void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed ) 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 bool aDimmed ) const
{ {
COLOR4D color = m_schSettings.GetLayerColor( aLayer ); COLOR4D color = m_schSettings.GetLayerColor( aLayer );
// Graphic items of a SYMBOL frequently use the LAYER_DEVICE layer color // Graphic items of a SYMBOL frequently use the LAYER_DEVICE layer color
// (i.e. when no specific color is set) // (i.e. when no specific color is set)
bool isSymbolChild = aItem->GetParentSymbol() != nullptr; bool isSymbolChild = aItem->GetParentSymbol() != nullptr;
@ -766,6 +768,7 @@ static void drawAltPinModesIcon( GAL& aGal, const VECTOR2D& aPos, double aSize,
aGal.Save(); aGal.Save();
aGal.Translate( aPos ); aGal.Translate( aPos );
if( aRotate ) if( aRotate )
{ {
aGal.Rotate( ANGLE_270.AsRadians() ); 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 }, aGal.DrawLine( topLineREnd - VECTOR2D{ aSize, 0 },
topLineREnd - VECTOR2D{ aSize * 0.7, 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 } );
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 }, aGal.DrawArc( topLineREnd - VECTOR2D{ aSize, -lineYOffset },
lineYOffset, ANGLE_0, -ANGLE_90 ); lineYOffset, ANGLE_0, -ANGLE_90 );
} }
aGal.DrawArc( topLineREnd - VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset }, aGal.DrawArc( topLineREnd - VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset },
lineYOffset, ANGLE_180, -ANGLE_90 ); 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 ); 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 ) ) 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 ) void SCH_PAINTER::drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows )
{ {
if( m_schSettings.IsPrinting() ) 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, void SCH_PAINTER::drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDangling, bool aDrawingShadows, bool aBrightened ) 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( aTable->StrokeHeader() )
{ {
if( !first->GetTextAngle().IsHorizontal() ) 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 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() ) if( aTable->StrokeExternal() )
@ -2257,7 +2261,8 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
BOX2I bbox = aSymbol->GetBodyBoundingBox(); BOX2I bbox = aSymbol->GetBodyBoundingBox();
BOX2I pins = aSymbol->GetBodyAndPinsBoundingBox(); BOX2I pins = aSymbol->GetBodyAndPinsBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ), 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 ); int strokeWidth = 3 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 ); 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 bbox = aSheet->GetBodyBoundingBox();
BOX2I pins = aSheet->GetBoundingBox(); BOX2I pins = aSheet->GetBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ), 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 ); int strokeWidth = 3 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 ); 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() ) if( aEntry->IsSelected() )
{ {
line.SetSelected(); line.SetSelected();
// Never show unselected endpoints on bus entries // Never show unselected endpoints on bus entries
line.SetFlags( STARTPOINT | ENDPOINT ); line.SetFlags( STARTPOINT | ENDPOINT );
} }
else if( aEntry->IsBrightened() ) else if( aEntry->IsBrightened() )
{
line.SetBrightened(); line.SetBrightened();
}
line.SetStartPoint( aEntry->GetPosition() ); line.SetStartPoint( aEntry->GetPosition() );
line.SetEndPoint( aEntry->GetEnd() ); line.SetEndPoint( aEntry->GetEnd() );
@ -2889,6 +2898,7 @@ void SCH_PAINTER::draw( const SCH_BITMAP* aBitmap, int aLayer )
// Draws a bounding box. // Draws a bounding box.
VECTOR2D bm_size( refImage.GetSize() ); VECTOR2D bm_size( refImage.GetSize() );
// bm_size is the actual image size in UI. // bm_size is the actual image size in UI.
// but m_gal scale was previously set to img_scale // but m_gal scale was previously set to img_scale
// so recalculate size relative to this image size. // 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, void drawPinDanglingIndicator( const SCH_PIN& aPin, const COLOR4D& aColor, bool aDrawingShadows,
bool aBrightened ); 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, void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDangling, bool aDrawingShadows, bool aBrightened ); 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 ); void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
int internalPinDecoSize( const SCH_PIN &aPin ); int internalPinDecoSize( const SCH_PIN &aPin );
int externalPinDecoSize( 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 nonCached( const EDA_ITEM* aItem );
bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const; 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) /// 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 /// i.e. the clock symbols (falling clock is actually external but is of
// the same kind) /// the same kind)
static int internalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin ) static int internalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin )
{ {
const SCH_RENDER_SETTINGS* settings = static_cast<const SCH_RENDER_SETTINGS*>( aSettings ); 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; return aPin.GetNameTextSize() != 0 ? aPin.GetNameTextSize() / 2 : aPin.GetNumberTextSize() / 2;
} }
/// Utility for getting the size of the 'external' pin decorators (as a radius) /// Utility for getting the size of the 'external' pin decorators (as a radius)
// i.e. the negation circle, the polarity 'slopes' and the nonlogic /// i.e. the negation circle, the polarity 'slopes' and the nonlogic
// marker /// marker
static int externalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin ) static int externalPinDecoSize( const RENDER_SETTINGS* aSettings, const SCH_PIN &aPin )
{ {
const SCH_RENDER_SETTINGS* settings = static_cast<const SCH_RENDER_SETTINGS*>( aSettings ); 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, SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt,
const KIID& aUuid ) : const KIID& aUuid ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T ), SCH_ITEM( aParentSymbol, SCH_PIN_T ),
@ -409,6 +405,7 @@ void SCH_PIN::SetName( const wxString& aName )
return; return;
m_name = aName; m_name = aName;
// pin name string does not support spaces // pin name string does not support spaces
m_name.Replace( wxT( " " ), wxT( "_" ) ); 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_Valign = vJustify;
attrs.m_Multiline = false; 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 = auto plotNum =
@ -1259,14 +1257,15 @@ void SCH_PIN::PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIE
attrs.m_Valign = vJustify; attrs.m_Valign = vJustify;
attrs.m_Multiline = false; 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( aTextInside )
{ {
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT ) 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 ) 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 ); 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 ) 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 ) if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) ) || ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
{ {
/* Its an horizontal line. */ // It's an horizontal line.
if( aDrawPinName && aDrawPinNum ) if( aDrawPinName && aDrawPinNum )
{ {
plotName( ( x1 + aPinPos.x) / 2, y1 - name_offset, ANGLE_HORIZONTAL, 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 else
{ {
/* Its a vertical line. */ // Its a vertical line.
if( aDrawPinName && aDrawPinNum ) if( aDrawPinName && aDrawPinNum )
{ {
plotName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL, 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 int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
{ {
// Ignore the UUID here. // Ignore the UUID here.
@ -1901,69 +1898,6 @@ int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
wxCHECK( tmp, -1 ); 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 ) if( m_number != tmp->m_number )
return m_number.Cmp( 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() NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " num=\"" << m_number.mb_str() << " num=\"" << m_number.mb_str()
<< '"' << "/>\n"; << '"' << "/>\n";
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
#endif #endif
void SCH_PIN::CalcEdit( const VECTOR2I& aPosition ) void SCH_PIN::CalcEdit( const VECTOR2I& aPosition )
{ {
if( IsMoving() ) if( IsMoving() )

View File

@ -54,6 +54,13 @@ public:
SCH_PIN( SCH_SYMBOL* aParentSymbol, SCH_PIN* aLibPin ); 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, SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt,
const KIID& aUuid ); const KIID& aUuid );
@ -206,14 +213,14 @@ public:
VECTOR2I GetPinRoot() const; 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 MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) 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 MirrorHorizontallyPin( int aCenter );
void MirrorVerticallyPin( int aCenter ); void MirrorVerticallyPin( int aCenter );
@ -221,6 +228,7 @@ public:
/** /**
* Plot the pin name and number. * Plot the pin name and number.
*
* @param aTextInside - draw the names & numbers inside the symbol body (ie: in the opposite * @param aTextInside - draw the names & numbers inside the symbol body (ie: in the opposite
* direction of \a aPinOrient). * direction of \a aPinOrient).
*/ */
@ -311,6 +319,7 @@ protected:
/** /**
* Print the pin symbol without text. * Print the pin symbol without text.
*
* If \a aColor != 0, draw with \a aColor, else with the normal pin color. * If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/ */
void printPinSymbol( const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, 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. * Put the pin number and pin text info, given the pin line coordinates.
*
* The line must be vertical or horizontal. * The line must be vertical or horizontal.
* If aDrawPinName == false the pin name is not printed. * If aDrawPinName == false the pin name is not printed.
* If aDrawPinNum = false the pin number is not printed. * If aDrawPinNum = false the pin number is not printed.
@ -329,7 +339,7 @@ protected:
bool aDrawPinName, bool aDimmed ); 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, void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPosition,
PIN_ORIENTATION aOrientation, bool aDimmed ); PIN_ORIENTATION aOrientation, bool aDimmed );
@ -379,7 +389,8 @@ protected:
/** /**
* The layout cache for this pin. * 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; 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 else
{ {
// in eeschema, this prints the current page // in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() ); sheetList.push_back( m_schematic->CurrentSheet() );
} }
@ -515,7 +515,7 @@ void SCH_PLOTTER::createSVGFiles( const SCH_PLOT_OPTS& aPlotOpts,
} }
else else
{ {
// in eeschema, this prints the current page // in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() ); 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 ) const SCH_PLOT_OPTS& aPlotOpts )
{ {
PAGE_INFO plotPage; PAGE_INFO plotPage;
// Adjust page size and scaling requests // Adjust page size and scaling requests
const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic 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(), PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(),
aScreen->GetTitleBlock(), aScreen->GetTitleBlock(),
actualPage, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(), actualPage, aScreen->Schematic()->GetProperties(),
aScreen->GetPageNumber(),
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(), aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
plotter->GetColorMode() ? color : COLOR4D::BLACK, plotter->GetColorMode() ? color : COLOR4D::BLACK,
aScreen->GetVirtualPageNumber() == 1 ); aScreen->GetVirtualPageNumber() == 1 );
@ -699,7 +701,7 @@ void SCH_PLOTTER::createHPGLFiles( const SCH_PLOT_OPTS& aPlotOpts,
} }
else else
{ {
// in eeschema, this prints the current page // in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() ); sheetList.push_back( m_schematic->CurrentSheet() );
} }
@ -882,7 +884,7 @@ void SCH_PLOTTER::createDXFFiles( const SCH_PLOT_OPTS& aPlotOpts,
} }
else else
{ {
// in eeschema, this prints the current page // in Eeschema, this prints the current page
sheetList.push_back( m_schematic->CurrentSheet() ); sheetList.push_back( m_schematic->CurrentSheet() );
} }
@ -1048,6 +1050,7 @@ wxFileName SCH_PLOTTER::createPlotFileName( const SCH_PLOT_OPTS& aPlotOpts,
tmp.GetPath() ); tmp.GetPath() );
aReporter->Report( msg, RPT_SEVERITY_ERROR ); aReporter->Report( msg, RPT_SEVERITY_ERROR );
} }
retv.Clear(); retv.Clear();
SCHEMATIC_SETTINGS& settings = m_schematic->Settings(); 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 class SCH_PLOTTER
{ {
public: 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 ); 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 ); 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 aPlotFormat The resulting output plot format (PDF, SVG, DXF, etc)
* @param aPlotSettings The configuration for the plotting operation * @param aPlotSettings The configuration for the plotting operation
@ -147,13 +147,14 @@ public:
SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter = nullptr ); 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; } wxString GetLastOutputFilePath() const { return m_lastOutputFilePath; }
protected: 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, wxFileName getOutputFilenameSingle( const SCH_PLOT_OPTS& aPlotOpts, REPORTER* aReporter,
const wxString& ext ); const wxString& ext );

View File

@ -876,7 +876,9 @@ void SCH_REFERENCE::Split()
while( ll >= 0 ) while( ll >= 0 )
{ {
if( (refText[ll] <= ' ' ) || isdigit( refText[ll] ) ) if( (refText[ll] <= ' ' ) || isdigit( refText[ll] ) )
{
ll--; ll--;
}
else else
{ {
if( isdigit( refText[ll + 1] ) ) if( isdigit( refText[ll + 1] ) )
@ -969,6 +971,7 @@ wxString SCH_REFERENCE::formatRefStr( int aNumber ) const
return wxString::Format( "%d", aNumber ); return wxString::Format( "%d", aNumber );
} }
#if defined( DEBUG ) #if defined( DEBUG )
void SCH_REFERENCE_LIST::Show( const char* aPrefix ) 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 const wxString GetFullPath() const
{ {
return m_sheetPath.PathAsString() + m_symbolUuid.AsString(); 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(); } bool operator<( const SCH_REFERENCE& aRef ) const { return GetFullPath() < aRef.GetFullPath(); }
@ -153,9 +153,9 @@ public:
void Split(); 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(); bool IsSplitNeeded();
@ -165,7 +165,7 @@ public:
void SetRefStr( const std::string& aReference ) { m_ref = aReference; } void SetRefStr( const std::string& aReference ) { m_ref = aReference; }
const char* GetRefStr() const { return m_ref.c_str(); } 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 GetFullRef() const
{ {
wxString refNum = m_numRefStr; wxString refNum = m_numRefStr;
@ -244,7 +244,8 @@ private:
int m_sheetNum; ///< The sheet number for the reference. int m_sheetNum; ///< The sheet number for the reference.
KIID m_symbolUuid; ///< UUID of the symbol. KIID m_symbolUuid; ///< UUID of the symbol.
int m_numRef; ///< The numeric part of the reference designator. 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; int m_flag;
}; };
@ -300,9 +301,10 @@ public:
void RemoveItem( unsigned int aIndex ); void RemoveItem( unsigned int aIndex );
/** /**
* 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 * @param aItem Reference to check.
* @return true if aItem exists in this list.
*/ */
bool Contains( const SCH_REFERENCE& aItem ) const; 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 * Treat all symbols in this list as non-annotated. Does not update annotation state of the
* symbols. * symbols.
* @see SCH_REFERENCE_LIST::UpdateAnnotation *
* @see SCH_REFERENCE_LIST::UpdateAnnotation()
*/ */
void RemoveAnnotation() 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. * associated multi-unit symbols.
* *
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T. * @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
@ -376,8 +379,9 @@ public:
SCH_SHEET_LIST* aHierarchy ); SCH_SHEET_LIST* aHierarchy );
/** /**
* Convenience function for the Paste Unique functionality. Do not use as a general * Convenience function for the Paste Unique functionality.
* reannotation method. *
* @note Do not use as a general reannotation method.
* *
* Replaces any duplicate reference designators with the next available number after the * Replaces any duplicate reference designators with the next available number after the
* present number regardless of configured annotation options. * present number regardless of configured annotation options.

View File

@ -33,7 +33,7 @@
#include <geometry/rtree.h> #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. * Non-owning.
*/ */
class EE_RTREE class EE_RTREE
@ -72,8 +72,9 @@ public:
} }
/** /**
* Remove an item from the tree. Removal is done by comparing pointers, attempting * Remove an item from the tree.
* to remove a copy of the item will fail. *
* Removal is done by comparing pointers, attempting to remove a copy of the item will fail.
*/ */
bool remove( SCH_ITEM* aItem ) 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 * Determine if a given item exists in the tree.
* so if the item has been moved, this will return false when it should be true. *
* @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 aItem Item that may potentially exist in the tree.
* @param aRobust If true, search the whole tree, not just the bounding box. * @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 * Return a read/write iterator that points to the first.
* element in the %EE_RTREE * element in the #EE_RTREE.
* N.B. The iteration order of the RTree is not readily apparent and will change *
* @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 * 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 * RTree contents to the user MUST be sorted before being presented. See
* or SCH_EDITOR_CONTROL::nextMatch for examples. * 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.
*/ */
iterator begin() iterator begin()
{ {
@ -279,8 +284,7 @@ public:
} }
/** /**
* Returns a read/write iterator that points to one past the last * Return a read/write iterator that points to one past the last element in the #EE_RTREE.
* element in the %EE_RTREE
*/ */
iterator end() iterator end()
{ {

View File

@ -69,61 +69,63 @@ public:
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; 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 ); 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( void RefreshContainedItemsAndDirectives(
SCH_SCREEN* screen, KIGFX::SCH_VIEW* view, SCH_SCREEN* screen, KIGFX::SCH_VIEW* view,
std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>& forceUpdateRuleAreas ); 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; std::unordered_set<SCH_ITEM*> GetPastAndPresentContainedItems() const;
/// @brief Updates all rule area connectvity / caches in the given sheet paths /// Update all rule area connectvity / caches in the given sheet paths.
/// @returns A map of all updated rule areas and their owning screen ///
/// @return A map of all updated rule areas and their owning screen.
static std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>> static std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>
UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screens, KIGFX::SCH_VIEW* view ); 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; 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; const std::unordered_set<SCH_DIRECTIVE_LABEL*>& GetDirectives() const;
/// @brief Resolves the netclass of this rule area from connected directive labels /// Resolve the netclass of this rule area from connected directive labels.
/// @returns The resolved netclass (if any), and the SCH_ITEM providing the declaration ///
/// @return The resolved netclass (if any), and the SCH_ITEM providing the declaration.
const std::vector<std::pair<wxString, SCH_ITEM*>> GetResolvedNetclasses() const; 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 ); 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; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected: 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 ); 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 ); 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 ); 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(); 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; 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; 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; 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; std::unordered_set<SCH_DIRECTIVE_LABEL*> m_prev_directives;
}; };

View File

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

View File

@ -97,13 +97,14 @@ public:
SCHEMATIC* Schematic() const; SCHEMATIC* Schematic() const;
/** /**
* Gets the full RTree, usually for iterating. * Get the full RTree, usually for iterating.
* N.B. The iteration order of the RTree is not readily apparent and will change *
* @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 * 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 * RTree contents to the user MUST be sorted before being presented. See
* SCH_IO_KICAD_SEXPR::Format() or SCH_EDITOR_CONTROL::nextMatch() for examples. * 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; } EE_RTREE& Items() { return m_rtree; }
const EE_RTREE& Items() const { return m_rtree; } const EE_RTREE& Items() const { return m_rtree; }
@ -276,7 +277,7 @@ public:
void Update( SCH_ITEM* aItem, bool aUpdateLibSymbol = true ); 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 * 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. * 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 * 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: * A junction is required at \a aPosition if one of the following criteria is satisfied:
* - One wire midpoint and one or more wire endpoints. * - One wire midpoint and one or more wire endpoints.
@ -328,14 +329,16 @@ public:
bool IsJunction( const VECTOR2I& aPosition ) const; bool IsJunction( const VECTOR2I& aPosition ) const;
/** /**
* Indicates that a junction dot is necessary at the given location. See IsJunctionNeeded * Indicate that a junction dot is necessary at the given location.
* for more info. *
* See IsJunctionNeeded() for more info.
*/ */
bool IsExplicitJunction( const VECTOR2I& aPosition ) const; bool IsExplicitJunction( const VECTOR2I& aPosition ) const;
/** /**
* Indicates that a junction dot is necessary at the given location, and does not yet exist. * Indicate that a junction dot is necessary at the given location, and does not yet exist.
* See IsJunctionNeeded for more info. *
* See IsJunctionNeeded() for more info.
*/ */
bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const; bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const;
@ -343,8 +346,9 @@ public:
SPIN_STYLE aDefaultOrientation, SPIN_STYLE aDefaultOrientation,
const SCH_SHEET_PATH* aSheet ) const; const SCH_SHEET_PATH* aSheet ) const;
/** /**
* Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded * Indicate that a junction dot may be placed at the given location.
* for more info. *
* See IsJunctionNeeded() for more info.
*/ */
bool IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const; 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 auto& GetBusAliases() const
{ {
@ -663,7 +667,7 @@ private:
bool m_isReadOnly; ///< Read only status of the screen file. 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; bool m_fileExists;
/// List of bus aliases stored in this screen. /// List of bus aliases stored in this screen.
@ -704,9 +708,9 @@ private:
* *
* Individual #SCH_SCREEN objects are unique and correspond to .sch files. * Individual #SCH_SCREEN objects are unique and correspond to .sch files.
* *
* NOTE: It may be desirable to fold the functionality of SCH_SCREENS into * @note It may be desirable to fold the functionality of #SCH_SCREENS into the new #SCHEMATIC
* the new SCHEMATIC class at some point, since SCHEMATIC can also be thought * class at some point, since SCHEMATIC can also be thought of as owning the collection
* of as owning the collection of all the SCH_SCREEN objects. * of all the #SCH_SCREEN objects.
*/ */
class SCH_SCREENS class SCH_SCREENS
{ {
@ -816,7 +820,7 @@ public:
bool HasSchematic( const wxString& aSchematicFileName ); 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(); void BuildClientSheetPathList();

View File

@ -33,7 +33,8 @@ class SCH_SHAPE : public SCH_ITEM, public EDA_SHAPE
{ {
public: public:
SCH_SHAPE( SHAPE_T aShape = SHAPE_T::UNDEFINED, SCH_LAYER_ID aLayer = LAYER_NOTES, 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. // 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().SetVisible( true );
m_fields.back().SetLayer( LAYER_SHEETNAME ); 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().SetVisible( true );
m_fields.back().SetLayer( LAYER_SHEETNAME ); 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(); BOX2I pins = GetBoundingBox();
COLOR4D dnp_color = aSettings->GetLayerColor( LAYER_DNP_MARKER ); COLOR4D dnp_color = aSettings->GetLayerColor( LAYER_DNP_MARKER );
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ), 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.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 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> instances = GetInstances();
std::vector<SCH_SHEET_INSTANCE> otherInstances = aOther.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 // 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 // probably use a std::map instead of a std::vector to store the sheet
// instance data. // instance data.
@ -1730,8 +1732,10 @@ static struct SCH_SHEET_DESC
propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Simulation" ), propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Simulation" ),
&SCH_SHEET::SetExcludedFromSim, &SCH_SHEET::GetExcludedFromSim ), &SCH_SHEET::SetExcludedFromSim, &SCH_SHEET::GetExcludedFromSim ),
groupAttributes ); groupAttributes );
propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Bill of Materials" ), propMgr.AddProperty(
&SCH_SHEET::SetExcludedFromBOM, &SCH_SHEET::GetExcludedFromBOM ), new PROPERTY<SCH_SHEET, bool>( _HKI( "Exclude From Bill of Materials" ),
&SCH_SHEET::SetExcludedFromBOM,
&SCH_SHEET::GetExcludedFromBOM ),
groupAttributes ); groupAttributes );
propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Do not Populate" ), propMgr.AddProperty( new PROPERTY<SCH_SHEET, bool>( _HKI( "Do not Populate" ),
&SCH_SHEET::SetDNP, &SCH_SHEET::GetDNP ), &SCH_SHEET::SetDNP, &SCH_SHEET::GetDNP ),

View File

@ -63,8 +63,10 @@ public:
schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ) ); schIUScale.MilsToIU( MIN_SHEET_HEIGHT ) ) );
/** /**
* Copy \a aSheet into a new object. All sheet pins are copied as is except and * Copy \a aSheet into a new object.
* the SCH_SHEET_PIN's #m_Parent pointers are set to the new copied parent 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 ); SCH_SHEET( const SCH_SHEET& aSheet );
@ -207,7 +209,7 @@ public:
SCH_SHEET_PIN* GetPin( const VECTOR2I& aPosition ); 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. * @param aName Name of the sheet pin to search for.
* @return True if sheet pin with \a aName is found, otherwise false. * @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 * 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 * filename is longer than the edge it's on.
* the center of the sheet itself. *
* Use this instead, which always returns the center of the sheet itself.
*/ */
VECTOR2I GetRotationCenter() const; VECTOR2I GetRotationCenter() const;
@ -383,7 +386,7 @@ public:
bool GetExcludedFromBoard() const { return m_excludedFromBoard; } 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; } bool GetDNP() const { return m_DNP; }
void SetDNP( bool aDNP ) { m_DNP = aDNP; } void SetDNP( bool aDNP ) { m_DNP = aDNP; }
@ -454,7 +457,7 @@ public:
bool HasPageNumberChanges( const SCH_SHEET& aOther ) const; 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 * @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. * 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. * Its sole purpose is to flag the item as having been deleted.
*/ */
class DELETED_SHEET_ITEM : public SCH_ITEM class DELETED_SHEET_ITEM : public SCH_ITEM
@ -95,6 +96,7 @@ public:
#endif #endif
}; };
namespace std namespace std
{ {
size_t hash<SCH_SHEET_PATH>::operator()( const SCH_SHEET_PATH& path ) const 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_current_hash = aOther.m_current_hash;
m_cached_page_number = aOther.m_cached_page_number; 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 // Note: don't copy m_recursion_test_cache as it is slow and we want
// very fast to construct for use in the connectivity algorithm. // 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, void SCH_SHEET_PATH::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
bool aForceIncludeOrphanSymbols ) const bool aForceIncludeOrphanSymbols ) const
{ {
@ -621,8 +623,8 @@ void SCH_SHEET_PATH::AddNewSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPa
if( symbol->GetInstance( newSymbolInstance, Path(), true ) ) if( symbol->GetInstance( newSymbolInstance, Path(), true ) )
{ {
newSymbolInstance.m_ProjectName = aProjectName; 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(); newSymbolInstance.m_Path = newSheetPath.Path();
symbol->AddHierarchicalReference( newSymbolInstance ); symbol->AddHierarchicalReference( newSymbolInstance );
} }
@ -687,7 +689,7 @@ void SCH_SHEET_PATH::CheckForMissingSymbolInstances( const wxString& aProjectNam
symbol->m_Uuid.AsString(), PathHumanReadable( false ) ); symbol->m_Uuid.AsString(), PathHumanReadable( false ) );
// Legacy schematics that are not shared do not contain separate instance data. // 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 ) && if( ( LastScreen()->GetRefCount() <= 1 ) &&
( LastScreen()->GetFileFormatVersionAtLoad() <= 20200310 ) ) ( LastScreen()->GetFileFormatVersionAtLoad() <= 20200310 ) )
{ {
@ -835,7 +837,7 @@ void SCH_SHEET_LIST::SortByPageNumbers( bool aUpdateVirtualPageNums )
else if( a.GetVirtualPageNumber() > b.GetVirtualPageNumber() ) else if( a.GetVirtualPageNumber() > b.GetVirtualPageNumber() )
return false; 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(); 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. * KiCad supports nesting schematics hierarchically to simplify the creation of complex
* Each sheet corresponds to a schematic drawing handled by a SCH_SCREEN structure. A * schematics designs. A hierarchical schematic uses hierarchical sheets (#SCH_SHEET objects)
* SCH_SCREEN structure contains drawings, and have a filename to write its data. Also a * to reference a given schematic file (#SCH_SCREEN objects). Each #SCH_SHEET corresponds to
* SCH_SCREEN displays a sheet number and the name of the sheet. * 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 * In simple hierarchies one #SCH_SHEET object is linked to one #SCH_SCREEN object.
* used by the single hierarchical sheet.
* *
* In complex hierarchies the same SCH_SCREEN (and its data) is shared by more than one sheet. * In complex hierarchies the a #SCH_SCREEN object shared by more than one #SCH_SHEET object.
* Therefore subsheets (like subsheets in a SCH_SCREEN shared by many sheets) can also be * Therefore all sub-sheets can also be shared. So the same #SCH_SCREEN must handle different
* shared. So the same SCH_SCREEN must handle different symbol references and unit selections * symbol references and unit selections depending on which sheet is currently selected, and
* depending on which sheet is currently selected, and how a given subsheet is selected. Two * how a given subsheet is selected. #SCH_SHEET objects share the same #SCH_SCREEN object if
* sheets share the same SCH_SCREEN (the same drawings) if they have the same filename. * they have the same schematic file.
* *
* In KiCad each symbol and sheet receives (when created) a uuid. So each sheet has 2 id: its * In KiCad each #SCH_SYMBOL and #SCH_SHEET receives a UUID when created. These UUIDs are
* uuid (which cannot change) and its name (that can be edited and therefore is not reliable * chained together to form #SCH_SHEET_PATH objects that allow access of instance data in the
* for strong identification). * hierarchy. The sheet paths have the form /ROOT_SHEET_UUID/SHEET_UUID/SUB_SHEET_UUID/...
* 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/
* *
* So to know for a given SCH_SCREEN (a given schematic drawings) we must: * For a given #SCH_SCREEN #SCH_SHEET_PATH objects must:
* 1) Handle all references possibilities. * 1) Handle all #SCH_SYMBOL references and unit instance data.
* 2) When acceded by a given selected sheet, display (update) the * 2) Handle all #SCH_SHEET page number instance data.
* corresponding references and sheet path * 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 * 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 * useful to clear or save data, but is not suitable to handle the full complex hierarchy
* possibilities (usable in flat and simple hierarchies). * possibilities (usable in flat and simple hierarchies).
*/ */
@ -426,7 +422,7 @@ protected:
size_t m_current_hash; size_t m_current_hash;
mutable wxString m_cached_page_number; 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; std::map<std::pair<wxString, wxString>, bool> m_recursion_test_cache;
}; };
@ -487,7 +483,9 @@ public:
void ClearModifyStatus(); 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; 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. * 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 * The list will be ordered as per #SCH_SCREEN::BuildSheetList which results in sheets
* in the legacy way of using the X and Y positions of the sheets. * being ordered in the legacy way of using the X and Y positions of the sheets.
* *
* @see #SortByPageNumbers to sort by page numbers * @see #SortByPageNumbers to sort by page numbers
* *
@ -632,7 +630,9 @@ public:
/** /**
* Update all of the symbol instance information using \a aSymbolInstances. * 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. * @param aSymbolInstances is the symbol path information loaded from the root schematic.
*/ */
void UpdateSymbolInstanceData( const std::vector<SCH_SYMBOL_INSTANCE>& aSymbolInstances ); void UpdateSymbolInstanceData( const std::vector<SCH_SYMBOL_INSTANCE>& aSymbolInstances );
@ -649,7 +649,7 @@ public:
std::vector<KIID_PATH> GetPaths() const; 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. * @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(); BOX2I pins = GetBodyAndPinsBoundingBox();
COLOR4D dnp_color = localRenderSettings.GetLayerColor( LAYER_DNP_MARKER ); COLOR4D dnp_color = localRenderSettings.GetLayerColor( LAYER_DNP_MARKER );
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ), 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.x = std::max( margins.x * 0.6, margins.y * 0.3 );
margins.y = std::max( margins.y * 0.6, margins.x * 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; 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. // in sync in multi-unit parts.
if( GetUnitCount() > 1 && IsAnnotated( &aSourceSheet ) ) 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 // Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Power symbol" ), aList.emplace_back( _( "Power symbol" ),
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) ); KIUI::EllipsizeStatusText( aFrame,
GetField( VALUE_FIELD )->GetText() ) );
} }
else 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 // Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Value" ), aList.emplace_back( _( "Value" ),
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) ); KIUI::EllipsizeStatusText( aFrame,
GetField( VALUE_FIELD )->GetText() ) );
addExcludes(); addExcludes();
aList.emplace_back( _( "Name" ), aList.emplace_back( _( "Name" ),
KIUI::EllipsizeStatusText( aFrame, GetLibId().GetLibItemName() ) ); KIUI::EllipsizeStatusText( aFrame,
GetLibId().GetLibItemName() ) );
} }
#if 0 // Display symbol flags, for debug only #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 else
{ {
aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) ); aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
// Don't use GetShownText(); we want to see the variable references here // Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Value" ), aList.emplace_back( _( "Value" ),
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) ); KIUI::EllipsizeStatusText( aFrame,
GetField( VALUE_FIELD )->GetText() ) );
addExcludes(); addExcludes();
aList.emplace_back( _( "Name" ), aList.emplace_back( _( "Name" ),
KIUI::EllipsizeStatusText( aFrame, GetLibId().GetLibItemName() ) ); 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++ ) for( auto it = lower; it < aItemListByPos.end() && it->GetPosition() == pos; it++ )
{ {
DANGLING_END_ITEM& each_item = *it; DANGLING_END_ITEM& each_item = *it;
// Some people like to stack pins on top of each other in a symbol to indicate // 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 // 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 // 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(); return m_part && m_part->GetShowPinNames();
} }
void SCH_SYMBOL::SetShowPinNames( bool aShow ) void SCH_SYMBOL::SetShowPinNames( bool aShow )
{ {
if( m_part ) if( m_part )
m_part->SetShowPinNames( aShow ); m_part->SetShowPinNames( aShow );
} }
bool SCH_SYMBOL::GetShowPinNumbers() const bool SCH_SYMBOL::GetShowPinNumbers() const
{ {
return m_part && m_part->GetShowPinNumbers(); return m_part && m_part->GetShowPinNumbers();
} }
void SCH_SYMBOL::SetShowPinNumbers( bool aShow ) void SCH_SYMBOL::SetShowPinNumbers( bool aShow )
{ {
if( m_part ) if( m_part )

View File

@ -510,19 +510,23 @@ public:
{ {
return GetRef( &Schematic()->CurrentSheet() ); return GetRef( &Schematic()->CurrentSheet() );
} }
void SetRefProp( const wxString& aRef ); void SetRefProp( const wxString& aRef );
wxString GetValueProp() const wxString GetValueProp() const
{ {
return GetValue( false, &Schematic()->CurrentSheet(), false ); return GetValue( false, &Schematic()->CurrentSheet(), false );
} }
void SetValueProp( const wxString& aRef ) void SetValueProp( const wxString& aRef )
{ {
SetValueFieldText( aRef ); SetValueFieldText( aRef );
} }
int GetUnitProp() const int GetUnitProp() const
{ {
return GetUnitSelection( &Schematic()->CurrentSheet() ); return GetUnitSelection( &Schematic()->CurrentSheet() );
} }
void SetUnitProp( int aUnit ) void SetUnitProp( int aUnit )
{ {
if( aUnit < 1 ) if( aUnit < 1 )
@ -534,10 +538,12 @@ public:
SetUnitSelection( &Schematic()->CurrentSheet(), aUnit ); SetUnitSelection( &Schematic()->CurrentSheet(), aUnit );
SetUnit( aUnit ); SetUnit( aUnit );
} }
int GetBodyStyleProp() const int GetBodyStyleProp() const
{ {
return GetBodyStyle(); return GetBodyStyle();
} }
void SetBodyStyleProp( int aBodyStyle ) void SetBodyStyleProp( int aBodyStyle )
{ {
SetBodyStyle( aBodyStyle ); SetBodyStyle( aBodyStyle );
@ -557,7 +563,7 @@ public:
bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields ); 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. * in sync in multi-unit parts.
* *
* @param aSourceSheet the sheet instance of the unit to sync to * @param aSourceSheet the sheet instance of the unit to sync to
@ -855,7 +861,7 @@ public:
double Similarity( const SCH_ITEM& aOther ) const override; 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; std::unordered_set<wxString> GetComponentClassNames( const SCH_SHEET_PATH* aPath ) const;
bool operator==( const SCH_ITEM& aOther ) const override; 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::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 std::unique_ptr<LIB_SYMBOL> m_part; ///< A flattened copy of the #LIB_SYMBOL from the
///< PROJECT's libraries. ///< #PROJECT object's libraries.
bool m_isInNetlist; ///< True if the symbol should appear in netlist 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::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's index 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; std::vector<SCH_SYMBOL_INSTANCE> m_instanceReferences;
/// @see SCH_SYMBOL::GetOrientation /// @see SCH_SYMBOL::GetOrientation

View File

@ -80,7 +80,11 @@ public:
void SetSeparatorsWidth( int aWidth ) { m_separatorsStroke.SetWidth( aWidth ); } void SetSeparatorsWidth( int aWidth ) { m_separatorsStroke.SetWidth( aWidth ); }
int GetSeparatorsWidth() const { return m_separatorsStroke.GetWidth(); } 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 LINE_STYLE GetSeparatorsStyle() const
{ {
if( m_separatorsStroke.GetLineStyle() == LINE_STYLE::DEFAULT ) 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 ); && SCH_TEXTBOX::operator==( aOtherItem );
} }
static struct SCH_TABLECELL_DESC static struct SCH_TABLECELL_DESC
{ {
SCH_TABLECELL_DESC() SCH_TABLECELL_DESC()

View File

@ -55,7 +55,7 @@ public:
int GetRow() const; int GetRow() const;
int GetColumn() 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; wxString GetAddr() const;
int GetColSpan() const { return m_colSpan; } 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 bool SCH_TEXT::operator==( const SCH_ITEM& aOther ) const
{ {
if( Type() != aOther.Type() ) if( Type() != aOther.Type() )

View File

@ -139,7 +139,10 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); } 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 VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const BOX2I& aRect, bool aContained, 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(); 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 OnSchItemsAdded( SCHEMATIC& aSch, std::vector<SCH_ITEM*>& aSchItem ) {}
virtual void OnSchItemsRemoved( 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 ) {} 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. // This is called when the user changes to a new sheet, not when a sheet is altered.
// Sheet alteration events will call OnSchItems* // Sheet alteration events will call OnSchItems*
virtual void OnSchSheetChanged( SCHEMATIC& aSch ) {} virtual void OnSchSheetChanged( SCHEMATIC& aSch ) {}
@ -189,15 +190,17 @@ public:
std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel ) const; std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aLabel ) const;
/** /**
* Return the set of netname candidates for netclass assignment. The list will include both * Return the set of netname candidates for netclass assignment.
* composite names (buses) and atomic net names. Names are fetched from available labels, *
* power pins, etc. * 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(); std::set<wxString> GetNetClassAssignmentCandidates();
/** /**
* Resolves text vars that refer to other items. * 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. * just does the look-up and delegation.
*/ */
bool ResolveCrossReference( wxString* token, int aDepth ) const; bool ResolveCrossReference( wxString* token, int aDepth ) const;
@ -220,11 +223,15 @@ public:
void SetLegacySymbolInstanceData(); 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 * @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 * and sheet path.
* 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
*/ */
wxString GetUniqueFilenameForCurrentSheet(); 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 ) void SetOperatingPoint( const wxString& aSignal, double aValue )
{ {
@ -260,8 +269,10 @@ public:
wxString GetOperatingPoint( const wxString& aNetName, int aPrecision, const wxString& aRange ); wxString GetOperatingPoint( const wxString& aNetName, int aPrecision, const wxString& aRange );
/** /**
* Add junctions to this schematic where required. This function is needed for some plugins * Add junctions to this schematic where required.
* (e.g. Legacy and Cadstar) in order to retain connectivity after loading. *
* This function is needed for some plugins (e.g. Legacy and Cadstar) in order to retain
* connectivity after loading.
*/ */
void FixupJunctions(); void FixupJunctions();
@ -295,6 +306,7 @@ public:
/** /**
* Notify the schematic and its listeners that the current sheet has been changed. * 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 * This is called when the user navigates to a different sheet, not when the sheet is
* altered. * altered.
*/ */
@ -302,32 +314,34 @@ public:
/** /**
* Add a listener to the schematic to receive calls whenever something on the * 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 * schematic has been modified.
* listener object. Make sure to call RemoveListener before deleting the *
* listener object. The order of listener invocations is not guaranteed. * The schematic does not take ownership of the listener object. Make sure to call
* If the specified listener object has been added before, it will not be * RemoveListener before deleting the listener object. The order of listener invocations
* added again. * is not guaranteed. If the specified listener object has been added before, it will
* not be added again.
*/ */
void AddListener( SCHEMATIC_LISTENER* aListener ); void AddListener( SCHEMATIC_LISTENER* aListener );
/** /**
* Remove the specified listener. If it has not been added before, it * Remove the specified listener.
* will do nothing. *
* If it has not been added before, it will do nothing.
*/ */
void RemoveListener( SCHEMATIC_LISTENER* aListener ); void RemoveListener( SCHEMATIC_LISTENER* aListener );
/** /**
* Remove all listeners * Remove all listeners.
*/ */
void RemoveAllListeners(); void RemoveAllListeners();
/** /**
* Embed fonts in the schematic * Embed fonts in the schematic.
*/ */
void EmbedFonts() override; 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; std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
@ -372,18 +386,20 @@ private:
/** /**
* The sheet path of the sheet currently being edited or displayed. * 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 * 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; 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; CONNECTION_GRAPH* m_connectionGraph;
/** /**
* Holds a map of labels to the page sequence (virtual page number) that they appear on. It is * Holds a map of labels to the page sequence (virtual page number) that they appear on.
* used for updating global label intersheet references. *
* It is used for updating global label intersheet references.
*/ */
std::map<wxString, std::set<int>> m_labelToPageRefsMap; std::map<wxString, std::set<int>> m_labelToPageRefsMap;
@ -403,7 +419,7 @@ private:
SCH_SHEET_LIST m_hierarchy; SCH_SHEET_LIST m_hierarchy;
/** /**
* Currently installed listeners * Currently installed listeners.
*/ */
std::vector<SCHEMATIC_LISTENER*> m_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(); SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ); 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 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 defaultPinSymbolSize = cfg ? cfg->m_Drawing.pin_symbol_size : DEFAULT_TEXT_SIZE / 2;
int defaultJunctionSizeChoice = cfg ? cfg->m_Drawing.junction_size_choice : 3; 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 // Read global fieldname templates
SETTINGS_MANAGER& curr_mgr = Pgm().GetSettingsManager(); 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() ) if( curr_cfg && !curr_cfg->m_Drawing.field_names.IsEmpty() )
m_TemplateFieldNames.AddTemplateFieldNames( curr_cfg->m_Drawing.field_names ); 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 " "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. " "default instance setting or fall back to the library symbol settings. "
"Loading the project that uses this schematic file and saving to the " "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?" ); "Do you wish to continue?" );
wxMessageDialog msgDlg7( this, msg, _( "Continue Load Schematic" ), wxMessageDialog msgDlg7( this, msg, _( "Continue Load Schematic" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT | wxCENTER | wxICON_QUESTION ); 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() ); 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->GetFileFormatVersionAtLoad() < 20221002 )
{ {
if( !newScreen->GetSymbolInstances().empty() ) if( !newScreen->GetSymbolInstances().empty() )
@ -684,7 +684,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
dc.SetUserScale( 1.0, 1.0 ); dc.SetUserScale( 1.0, 1.0 );
SCH_PRINTOUT printout( this, wxEmptyString, true ); SCH_PRINTOUT printout( this, wxEmptyString, true );
// Ensure title block will be when printed on clipboard, regardless // Ensure title block will be when printed on clipboard, regardless
// the current cairo print option // the current Cairo print option
EESCHEMA_SETTINGS* eecfg = eeconfig(); EESCHEMA_SETTINGS* eecfg = eeconfig();
bool print_tb_opt = eecfg->m_Printing.title_block; bool print_tb_opt = eecfg->m_Printing.title_block;
eecfg->m_Printing.title_block = true; 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; wxString msg;
SCH_SHEET_LIST sheets = Schematic().Hierarchy(); 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 ) void RotateAndMirrorPin( SCH_PIN& aPin, int aOrientMirror )
{ {
ORIENT_MIRROR o = symbols_orientations_list[ 0 ]; ORIENT_MIRROR o = symbols_orientations_list[ 0 ];
@ -108,6 +104,7 @@ void RotateAndMirrorPin( SCH_PIN& aPin, int aOrientMirror )
aPin.MirrorHorizontallyPin( 0 ); aPin.MirrorHorizontallyPin( 0 );
} }
SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol ) SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
{ {
SPIN_STYLE ret = SPIN_STYLE::UP; 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 ) else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT; ret = SPIN_STYLE::LEFT;
} }
break; break;
case SYM_ROTATE_COUNTERCLOCKWISE: case SYM_ROTATE_COUNTERCLOCKWISE:
case SYM_ORIENT_270: case SYM_ORIENT_270:
if( ret == SPIN_STYLE::UP ) 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 ) else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT; ret = SPIN_STYLE::LEFT;
} }
break; break;
case SYM_ORIENT_180: case SYM_ORIENT_180:
if( ret == SPIN_STYLE::UP ) if( ret == SPIN_STYLE::UP )
ret = SPIN_STYLE::BOTTOM; 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 ) else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT; ret = SPIN_STYLE::LEFT;
} }
break; break;
case SYM_ORIENT_0: case SYM_ORIENT_0:
case SYM_NORMAL: case SYM_NORMAL:
default: default:
@ -222,6 +225,7 @@ SPIN_STYLE GetPinSpinStyle( const SCH_PIN& aPin, const SCH_SYMBOL& aSymbol )
else if( ret == SPIN_STYLE::RIGHT ) else if( ret == SPIN_STYLE::RIGHT )
ret = SPIN_STYLE::LEFT; ret = SPIN_STYLE::LEFT;
} }
break; 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 class SYMBOL : public SCH_ITEM
{ {
@ -165,7 +165,11 @@ public:
/** /**
* Set or clear the exclude from simulation flag. * 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; } bool GetExcludedFromSim() const override { return m_excludedFromSim; }
/** /**

View File

@ -38,12 +38,13 @@ class SYMBOL_ASYNC_LOADER
{ {
public: public:
/** /**
* Constructs a loader for symbol libraries * 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 aNicknames is a list of library nicknames to load.
* @param aOnlyPowerSymbols, if true, will only return power symbols in the output map * @param aTable is a pointer to the symbol library table to load libraries for.
* @param aOutput will be filled with the loaded parts * @param aOnlyPowerSymbols, if true, will only return power symbols in the output map.
* @param aReporter will be used to repord progress, of not null * @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_ASYNC_LOADER( const std::vector<wxString>& aNicknames,
SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols = false, SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols = false,
@ -53,41 +54,41 @@ public:
~SYMBOL_ASYNC_LOADER(); ~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(); 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(); bool Join();
///< Return true if loading is done /// @return true if loading is done
bool 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; } 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; typedef std::pair<wxString, std::vector<LIB_SYMBOL*>> LOADED_PAIR;
private: 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(); std::vector<LOADED_PAIR> worker();
///< list of libraries to load /// List of libraries to load.
std::vector<wxString> m_nicknames; 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; SYMBOL_LIB_TABLE* m_table;
///< True if we are loading only power symbols /// True if we are loading only power symbols.
bool m_onlyPowerSymbols; 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; std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* m_output;
///< Progress reporter (may be null) /// Progress reporter (may be null).
PROGRESS_REPORTER* m_reporter; PROGRESS_REPORTER* m_reporter;
size_t m_threadCount; size_t m_threadCount;

View File

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

View File

@ -141,7 +141,7 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
wxString errMsg; // to collect error messages wxString errMsg; // to collect error messages
// This table may be nested within a larger s-expression, or not. // 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 ) if( in->CurTok() != T_sym_lib_table )
{ {
in->NeedLEFT(); 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 // 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 // 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 wxString nickname = row->GetNickName(); // store it to be able to used it
// after row deletion if an error occurs // after row deletion if an error occurs
bool doReplace = false; bool doReplace = false;
@ -602,7 +602,8 @@ public:
m_lib_table.InsertRow( m_lib_table.InsertRow(
new SYMBOL_LIB_TABLE_ROW( nickname, libPath, wxT( "KiCad" ), wxEmptyString, 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 ) 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 = 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 ) if( curr != curr_other )
return false; 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 // Remember lib_names[i] can contain a '.' in name, so using a wxFileName
// before adding the extension can create incorrect full filename // before adding the extension can create incorrect full filename
wxString fullname = lib_names[i] + "." + FILEEXT::LegacySymbolLibFileExtension; wxString fullname = lib_names[i] + "." + FILEEXT::LegacySymbolLibFileExtension;
// Now the full name is set, we can use a wxFileName. // Now the full name is set, we can use a wxFileName.
wxFileName fn( fullname ); 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( aSymbol, false, wxString::Format( "Null symbol in library: %s", aLibrary ) );
wxCHECK_MSG( LibraryExists( aLibrary ), false, 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() ) ); aSymbol->GetName() ) );
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary ); 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 class LIB_BUFFER
{ {
public: public:
@ -102,13 +102,13 @@ public:
int GetHash() const { return m_hash; } 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; 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 ); 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 ); bool UpdateBuffer( SYMBOL_BUFFER& aSymbolBuf, const LIB_SYMBOL& aCopy );
/** /**
@ -118,15 +118,15 @@ public:
void ClearDeletedBuffer() { m_deleted.clear(); } void ClearDeletedBuffer() { m_deleted.clear(); }
///< Save stored modifications using a plugin. aBuffer decides whether the changes /// 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). /// 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 SaveBuffer( SYMBOL_BUFFER& aSymbolBuf, const wxString& aFileName, SCH_IO* aPlugin,
bool aBuffer ); 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; 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; } const std::deque<std::shared_ptr<SYMBOL_BUFFER>>& GetBuffers() const { return m_symbols; }
/** /**
@ -185,8 +185,10 @@ public:
virtual ~SYMBOL_LIBRARY_MANAGER(); 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. * Call before the first call to Sync() to get better performance.
*
* @param aReporter is used to report progress of the load * @param aReporter is used to report progress of the load
*/ */
void Preload( PROGRESS_REPORTER& aReporter ); void Preload( PROGRESS_REPORTER& aReporter );
@ -217,7 +219,9 @@ public:
std::list<LIB_SYMBOL*> GetAliases( const wxString& aLibrary ) const; 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 ) 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 ) 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. * Update the symbol buffer with a new version of the symbol.
*
* The library buffer creates a copy 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. * It is required to save the library to use the updated symbol in the schematic editor.
*/ */
bool UpdateSymbol( LIB_SYMBOL* aSymbol, const wxString& aLibrary ); bool UpdateSymbol( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
/** /**
* Update the symbol buffer with a new version of the symbol when the name has changed. * 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. * The old library buffer will be deleted and a new one created with the new name.
*/ */
bool UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias, bool UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias,
@ -253,6 +262,7 @@ public:
/** /**
* Remove the symbol from the symbol buffer. * Remove the symbol from the symbol buffer.
*
* It is required to save the library to have the symbol removed in the schematic editor. * It is required to save the library to have the symbol removed in the schematic editor.
*/ */
bool RemoveSymbol( const wxString& aName, const wxString& aLibrary ); bool RemoveSymbol( const wxString& aName, const wxString& aLibrary );
@ -264,8 +274,10 @@ public:
LIB_SYMBOL* GetAlias( const wxString& aAlias, const wxString& aLibrary ) const; 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. * Return the symbol copy from the buffer.
* #SYMBOL_LIBRARY_MANAGER retains the ownership. *
* 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 ); LIB_SYMBOL* GetBufferedSymbol( const wxString& aAlias, const wxString& aLibrary );
@ -282,8 +294,9 @@ public:
bool SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const; bool SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const;
/** /**
* Return true if library exists. If \a aCheckEnabled is set, then the library must * Return true if library exists.
* also be enabled in the library table. *
* 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; 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 ); 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 * @return The LIB_ID of the reverted symbol (which may be different in the case
* of a rename) * of a rename)
@ -340,7 +353,7 @@ public:
LIB_ID RevertSymbol( const wxString& aAlias, const wxString& aLibrary ); 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. * @return True on success, false otherwise.
*/ */
@ -355,6 +368,7 @@ public:
/** /**
* Return a library name that is not currently in use. * Return a library name that is not currently in use.
*
* Used for generating names for new libraries. * Used for generating names for new libraries.
*/ */
wxString GetUniqueLibraryName() const; wxString GetUniqueLibraryName() const;
@ -375,24 +389,23 @@ public:
protected: protected:
virtual void OnDataChanged() const {} 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 ); 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 ); 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; 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. * Return a set of #LIB_SYMBOL objects belonging to the original library.
*/ */
std::set<LIB_SYMBOL*> getOriginalSymbols( const wxString& aLibrary ); 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. * the original data.
*/ */
LIB_BUFFER& getLibraryBuffer( const wxString& aLibrary ); LIB_BUFFER& getLibraryBuffer( const wxString& aLibrary );

View File

@ -32,7 +32,9 @@ class SYMBOL_TREE_MODEL_ADAPTER : public LIB_TREE_MODEL_ADAPTER
{ {
public: 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(); ~SYMBOL_TREE_MODEL_ADAPTER();
@ -46,11 +48,12 @@ public:
/** /**
* Add all the libraries in a SYMBOL_LIB_TABLE to the model. * 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. * Displays a progress dialog attached to the parent frame the first time it is run.
* *
* @param aNicknames is the list of library nicknames * @param aNicknames is the list of library nicknames
* @param aParent is the parent window to display the progress dialog * @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 ); bool AddLibraries( const std::vector<wxString>& aNicknames, SCH_BASE_FRAME* aFrame );
@ -68,6 +71,7 @@ protected:
private: private:
friend class SYMBOL_ASYNC_LOADER; friend class SYMBOL_ASYNC_LOADER;
/** /**
* Flag to only show the symbol library table load progress dialog the first time. * 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(); int i = 0, max = GetLibrariesCount();
// Process already stored libraries // 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; 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. // being removed from the tree control.
if( !m_libMgr->LibraryExists( name, true ) if( !m_libMgr->LibraryExists( name, true )
|| !PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->HasLibrary( 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, true )
PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->FindRow( name, false ) != PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() )->FindRow( name, false )
|| name == aForceRefresh ) || name == aForceRefresh )
{ {
it = deleteLibrary( it ); it = deleteLibrary( it );
@ -345,6 +345,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
// proxy for "is canvas item" // proxy for "is canvas item"
} }
} }
break; break;
case LIB_TREE_NODE::TYPE::ITEM: 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 aAttr.SetStrikethrough( true ); // LIB_TREE_RENDERER uses strikethrough as a
// proxy for "is canvas item" // proxy for "is canvas item"
} }
break; break;
default: default:

View File

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

View File

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

View File

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