mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-14 12:49:34 +00:00
Fix a bunch of un-caught boost::bad_pointer exceptions.
This also removes vector cover types which do nothing except obfuscate the underlying implementation. Mainly changes SCH_SHEET_PINS and CONFIG_PARAM_ARRAY (which will soon be replaced by Jon's new stuff).
This commit is contained in:
parent
cc573eed31
commit
836c1ea56e
common
cvpcb
eeschema
class_library.cppconnection_graph.cppconnection_graph.h
dialogs
eeschema.cppeeschema_config.cppsch_edit_frame.hsch_item.cppsch_legacy_plugin.cppsch_painter.cppsch_sheet.cppsch_sheet.htools
gerbview
include
kicad
pagelayout_editor
pcbnew
board_design_settings.cppclass_pad.cppclass_pad.h
dialogs
footprint_edit_frame.hfootprint_editor_options.cpppcb_edit_frame.hpcbnew_config.cppqa/eeschema
@ -95,7 +95,7 @@ static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" );
|
||||
* This isn't exhaustive, but it covers most common types that might be
|
||||
* used in the advance config
|
||||
*/
|
||||
wxString dumpParamCfg( const PARAM_CFG_BASE& aParam )
|
||||
wxString dumpParamCfg( const PARAM_CFG& aParam )
|
||||
{
|
||||
wxString s = aParam.m_Ident + ": ";
|
||||
|
||||
@ -132,15 +132,15 @@ wxString dumpParamCfg( const PARAM_CFG_BASE& aParam )
|
||||
/**
|
||||
* Dump the configs in the given array to trace.
|
||||
*/
|
||||
static void dumpCfg( const PARAM_CFG_ARRAY& aArray )
|
||||
static void dumpCfg( const std::vector<PARAM_CFG*>& aArray )
|
||||
{
|
||||
// only dump if we need to
|
||||
if( !wxLog::IsAllowedTraceMask( AdvancedConfigMask ) )
|
||||
return;
|
||||
|
||||
for( const auto& param : aArray )
|
||||
for( const PARAM_CFG* param : aArray )
|
||||
{
|
||||
wxLogTrace( AdvancedConfigMask, dumpParamCfg( param ) );
|
||||
wxLogTrace( AdvancedConfigMask, dumpParamCfg( *param ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,27 +198,20 @@ void ADVANCED_CFG::loadFromConfigFile()
|
||||
|
||||
void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
{
|
||||
PARAM_CFG_ARRAY configParams;
|
||||
std::vector<PARAM_CFG*> configParams;
|
||||
|
||||
try
|
||||
{
|
||||
configParams.push_back(
|
||||
new PARAM_CFG_BOOL( true, AC_KEYS::UsePadProperty, &m_EnableUsePadProperty, false ) );
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UsePadProperty,
|
||||
&m_EnableUsePadProperty, false ) );
|
||||
|
||||
configParams.push_back(
|
||||
new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction, &m_EnableUsePinFunction, false ) );
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UsePinFunction,
|
||||
&m_EnableUsePinFunction, false ) );
|
||||
|
||||
configParams.push_back(
|
||||
new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity, &m_realTimeConnectivity, false ) );
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
|
||||
&m_realTimeConnectivity, false ) );
|
||||
|
||||
configParams.push_back(
|
||||
new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize, &m_coroutineStackSize,
|
||||
AC_STACK::default_stack, AC_STACK::min_stack, AC_STACK::max_stack ) );
|
||||
}
|
||||
catch( boost::bad_pointer& )
|
||||
{
|
||||
// Out of memory? Ship's going down anyway....
|
||||
}
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
|
||||
&m_coroutineStackSize, AC_STACK::default_stack,
|
||||
AC_STACK::min_stack, AC_STACK::max_stack ) );
|
||||
|
||||
wxConfigLoadSetups( &aCfg, configParams );
|
||||
|
||||
|
@ -34,85 +34,85 @@
|
||||
#include <wx/wx.h> // for wxString, operator!=, operator==
|
||||
|
||||
|
||||
void wxConfigLoadParams( wxConfigBase* aCfg,
|
||||
const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
|
||||
void wxConfigLoadParams( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList,
|
||||
const wxString& aGroup )
|
||||
{
|
||||
wxASSERT( aCfg );
|
||||
|
||||
for( const PARAM_CFG_BASE& param : aList )
|
||||
for( PARAM_CFG* param : aList )
|
||||
{
|
||||
if( !!param.m_Group )
|
||||
aCfg->SetPath( param.m_Group );
|
||||
if( !!param->m_Group )
|
||||
aCfg->SetPath( param->m_Group );
|
||||
else
|
||||
aCfg->SetPath( aGroup );
|
||||
|
||||
if( param.m_Setup )
|
||||
if( param->m_Setup )
|
||||
continue;
|
||||
|
||||
param.ReadParam( aCfg );
|
||||
param->ReadParam( aCfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
|
||||
void wxConfigLoadSetups( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList )
|
||||
{
|
||||
wxASSERT( aCfg );
|
||||
|
||||
for( const PARAM_CFG_BASE& param : aList )
|
||||
for( PARAM_CFG* param : aList )
|
||||
{
|
||||
if( !param.m_Setup )
|
||||
if( !param->m_Setup )
|
||||
continue;
|
||||
|
||||
param.ReadParam( aCfg );
|
||||
param->ReadParam( aCfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxConfigSaveParams( wxConfigBase* aCfg,
|
||||
const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
|
||||
void wxConfigSaveParams( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList,
|
||||
const wxString& aGroup )
|
||||
{
|
||||
wxASSERT( aCfg );
|
||||
|
||||
for( const PARAM_CFG_BASE& param : aList )
|
||||
for( PARAM_CFG* param : aList )
|
||||
{
|
||||
if( !!param.m_Group )
|
||||
aCfg->SetPath( param.m_Group );
|
||||
if( !!param->m_Group )
|
||||
aCfg->SetPath( param->m_Group );
|
||||
else
|
||||
aCfg->SetPath( aGroup );
|
||||
|
||||
if( param.m_Setup )
|
||||
if( param->m_Setup )
|
||||
continue;
|
||||
|
||||
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||
if( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||
{
|
||||
if( !!param.m_Ident )
|
||||
aCfg->DeleteGroup( param.m_Ident );
|
||||
if( !!param->m_Ident )
|
||||
aCfg->DeleteGroup( param->m_Ident );
|
||||
}
|
||||
else
|
||||
{
|
||||
param.SaveParam( aCfg );
|
||||
param->SaveParam( aCfg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
|
||||
void wxConfigSaveSetups( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList )
|
||||
{
|
||||
wxASSERT( aCfg );
|
||||
|
||||
for( const PARAM_CFG_BASE& param : aList )
|
||||
for( PARAM_CFG* param : aList )
|
||||
{
|
||||
if( !param.m_Setup )
|
||||
if( !param->m_Setup )
|
||||
continue;
|
||||
|
||||
if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||
if( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||
{
|
||||
if( !!param.m_Ident )
|
||||
aCfg->DeleteGroup( param.m_Ident );
|
||||
if( !!param->m_Ident )
|
||||
aCfg->DeleteGroup( param->m_Ident );
|
||||
}
|
||||
else
|
||||
{
|
||||
param.SaveParam( aCfg );
|
||||
param->SaveParam( aCfg );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,8 +130,8 @@ void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double
|
||||
}
|
||||
|
||||
|
||||
PARAM_CFG_BASE::PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
|
||||
const wxChar* group, const wxString& legacy )
|
||||
PARAM_CFG::PARAM_CFG( const wxString& ident, const paramcfg_id type,
|
||||
const wxChar* group, const wxString& legacy )
|
||||
{
|
||||
m_Ident = ident;
|
||||
m_Type = type;
|
||||
@ -144,7 +144,7 @@ PARAM_CFG_BASE::PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
|
||||
|
||||
PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val,
|
||||
int min, int max, const wxChar* group, const wxString& legacy ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
|
||||
PARAM_CFG( ident, PARAM_INT, group, legacy )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val;
|
||||
@ -155,7 +155,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_v
|
||||
|
||||
PARAM_CFG_INT::PARAM_CFG_INT( bool setup, const wxString& ident, int* ptparam, int default_val,
|
||||
int min, int max, const wxChar* group, const wxString& legacy ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
|
||||
PARAM_CFG( ident, PARAM_INT, group, legacy )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val;
|
||||
@ -247,7 +247,7 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
|
||||
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, COLOR4D* ptparam,
|
||||
COLOR4D default_val,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
|
||||
PARAM_CFG( ident, PARAM_SETCOLOR, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val;
|
||||
@ -259,7 +259,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
|
||||
COLOR4D* ptparam,
|
||||
COLOR4D default_val,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
|
||||
PARAM_CFG( ident, PARAM_SETCOLOR, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val;
|
||||
@ -314,7 +314,7 @@ void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
|
||||
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam,
|
||||
double default_val, double min, double max,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
|
||||
PARAM_CFG( ident, PARAM_DOUBLE, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val;
|
||||
@ -330,7 +330,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
|
||||
double min,
|
||||
double max,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
|
||||
PARAM_CFG( ident, PARAM_DOUBLE, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val;
|
||||
@ -370,7 +370,7 @@ void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
|
||||
|
||||
PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxString& ident, bool* ptparam, int default_val,
|
||||
const wxChar* group, const wxString& legacy ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_BOOL, group, legacy )
|
||||
PARAM_CFG( ident, PARAM_BOOL, group, legacy )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val ? true : false;
|
||||
@ -379,7 +379,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxString& ident, bool* ptparam, int defaul
|
||||
|
||||
PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, const wxString& ident, bool* ptparam,
|
||||
int default_val, const wxChar* group, const wxString& legacy ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_BOOL, group, legacy )
|
||||
PARAM_CFG( ident, PARAM_BOOL, group, legacy )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val ? true : false;
|
||||
@ -412,7 +412,7 @@ void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
|
||||
|
||||
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxString& ident, wxString* ptparam,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
|
||||
PARAM_CFG( ident, PARAM_WXSTRING, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
}
|
||||
@ -420,7 +420,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxString& ident, wxString* ptparam
|
||||
|
||||
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxString& ident, wxString* ptparam,
|
||||
const wxString& default_val, const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
|
||||
PARAM_CFG( ident, PARAM_WXSTRING, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Setup = Insetup;
|
||||
@ -449,7 +449,7 @@ void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
|
||||
PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxString& ident,
|
||||
wxString* ptparam,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_FILENAME, group )
|
||||
PARAM_CFG( ident, PARAM_FILENAME, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
}
|
||||
@ -486,7 +486,7 @@ void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
|
||||
PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
|
||||
wxArrayString* ptparam,
|
||||
const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_LIBNAME_LIST, group )
|
||||
PARAM_CFG( ident, PARAM_LIBNAME_LIST, group )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList,
|
||||
|
||||
|
||||
void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName,
|
||||
const PARAM_CFG_ARRAY& aParams, const wxString& aFileName )
|
||||
const std::vector<PARAM_CFG*>& aParams, const wxString& aFileName )
|
||||
{
|
||||
std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName, aFileName ) );
|
||||
|
||||
@ -356,7 +356,8 @@ void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName
|
||||
|
||||
|
||||
bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aGroupName,
|
||||
const PARAM_CFG_ARRAY& aParams, const wxString& aForeignProjectFileName )
|
||||
const std::vector<PARAM_CFG*>& aParams,
|
||||
const wxString& aForeignProjectFileName )
|
||||
{
|
||||
std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName,
|
||||
aForeignProjectFileName ) );
|
||||
|
@ -25,26 +25,26 @@
|
||||
|
||||
void SETTINGS::Load( wxConfigBase *aConfig )
|
||||
{
|
||||
for( const PARAM_CFG_BASE& param : m_params )
|
||||
for( PARAM_CFG* param : m_params )
|
||||
{
|
||||
if( !!param.m_Group )
|
||||
aConfig->SetPath( param.m_Group );
|
||||
if( !!param->m_Group )
|
||||
aConfig->SetPath( param->m_Group );
|
||||
else
|
||||
aConfig->SetPath( wxT("") );
|
||||
|
||||
param.ReadParam( aConfig );
|
||||
param->ReadParam( aConfig );
|
||||
}
|
||||
}
|
||||
|
||||
void SETTINGS::Save( wxConfigBase *aConfig )
|
||||
{
|
||||
for( PARAM_CFG_BASE& param : m_params )
|
||||
for( PARAM_CFG* param : m_params )
|
||||
{
|
||||
if( !!param.m_Group )
|
||||
aConfig->SetPath( param.m_Group );
|
||||
if( !!param->m_Group )
|
||||
aConfig->SetPath( param->m_Group );
|
||||
else
|
||||
aConfig->SetPath( wxT("") );
|
||||
|
||||
param.SaveParam( aConfig );
|
||||
param->SaveParam( aConfig );
|
||||
}
|
||||
}
|
||||
|
@ -33,12 +33,12 @@
|
||||
#include <cvpcb_mainframe.h>
|
||||
|
||||
|
||||
PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
|
||||
std::vector<PARAM_CFG*>& CVPCB_MAINFRAME::GetProjectFileParameters()
|
||||
{
|
||||
if( !m_projectFileParams.empty() )
|
||||
return m_projectFileParams;
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
|
||||
wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
|
||||
|
@ -81,12 +81,13 @@ public:
|
||||
FOOTPRINT_LIST* m_FootprintsList;
|
||||
|
||||
protected:
|
||||
bool m_modified;
|
||||
bool m_skipComponentSelect; // true to skip OnSelectComponent event
|
||||
// (in automatic selection/deletion of associations)
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
bool m_modified;
|
||||
bool m_skipComponentSelect; // skip component selection event during
|
||||
// automatic selection/deletion of
|
||||
// associations
|
||||
std::vector<PARAM_CFG*> m_projectFileParams;
|
||||
|
||||
bool m_initialized;
|
||||
bool m_initialized;
|
||||
|
||||
CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
@ -334,9 +335,9 @@ public:
|
||||
* at compile time requiring global variable definitions.
|
||||
* </p>
|
||||
*
|
||||
* @return A reference to a PARAM_CFG_ARRAY contain the project settings for CvPcb.
|
||||
* @return reference to a std::vector<PARAM_CFG*> contain the project settings for CvPcb.
|
||||
*/
|
||||
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
|
||||
std::vector<PARAM_CFG*>& GetProjectFileParameters( void );
|
||||
|
||||
/**
|
||||
* Function SendMessageToEESCHEMA
|
||||
|
@ -428,7 +428,7 @@ void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
|
||||
{
|
||||
wxString pro = aProject->GetProjectFullName();
|
||||
|
||||
PARAM_CFG_ARRAY ca;
|
||||
std::vector<PARAM_CFG*> ca;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ void CONNECTION_GRAPH::Reset()
|
||||
}
|
||||
|
||||
|
||||
void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUnconditional )
|
||||
void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnconditional )
|
||||
{
|
||||
PROF_COUNTER recalc_time;
|
||||
PROF_COUNTER update_items;
|
||||
@ -385,7 +385,7 @@ void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUncondition
|
||||
if( aUnconditional )
|
||||
Reset();
|
||||
|
||||
for( const auto& sheet : aSheetList )
|
||||
for( const SCH_SHEET_PATH& sheet : aSheetList )
|
||||
{
|
||||
std::vector<SCH_ITEM*> items;
|
||||
|
||||
@ -434,7 +434,7 @@ void CONNECTION_GRAPH::Recalculate( SCH_SHEET_LIST aSheetList, bool aUncondition
|
||||
|
||||
|
||||
void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
||||
std::vector<SCH_ITEM*> aItemList )
|
||||
const std::vector<SCH_ITEM*>& aItemList )
|
||||
{
|
||||
std::unordered_map< wxPoint, std::vector<SCH_ITEM*> > connection_map;
|
||||
|
||||
@ -446,18 +446,18 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
||||
|
||||
if( item->Type() == SCH_SHEET_T )
|
||||
{
|
||||
for( auto& pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
{
|
||||
if( !pin.Connection( aSheet ) )
|
||||
if( !pin->Connection( aSheet ) )
|
||||
{
|
||||
pin.InitializeConnection( aSheet );
|
||||
pin->InitializeConnection( aSheet );
|
||||
}
|
||||
|
||||
pin.ConnectedItems().clear();
|
||||
pin.Connection( aSheet )->Reset();
|
||||
pin->ConnectedItems().clear();
|
||||
pin->Connection( aSheet )->Reset();
|
||||
|
||||
connection_map[ pin.GetTextPos() ].push_back( &pin );
|
||||
m_items.insert( &pin );
|
||||
connection_map[ pin->GetTextPos() ].push_back( pin );
|
||||
m_items.insert( pin );
|
||||
}
|
||||
}
|
||||
else if( item->Type() == SCH_COMPONENT_T )
|
||||
|
@ -225,7 +225,7 @@ public:
|
||||
* @param aSheetList is the list of possibly modified sheets
|
||||
* @param aUnconditional is true if an unconditional full recalculation should be done
|
||||
*/
|
||||
void Recalculate( SCH_SHEET_LIST aSheetList, bool aUnconditional = false );
|
||||
void Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnconditional = false );
|
||||
|
||||
/**
|
||||
* Returns a bus alias pointer for the given name if it exists (from cache)
|
||||
@ -330,7 +330,7 @@ private:
|
||||
* @param aItemList is a list of items to consider
|
||||
*/
|
||||
void updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
||||
std::vector<SCH_ITEM*> aItemList );
|
||||
const std::vector<SCH_ITEM*>& aItemList );
|
||||
|
||||
/**
|
||||
* Generates the connection graph (after all item connectivity has been updated)
|
||||
|
@ -68,7 +68,7 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
|
||||
m_frame->SetUserUnits(
|
||||
m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES );
|
||||
|
||||
int textSize = ValueFromString( EDA_UNITS::INCHES, m_textSizeCtrl->GetValue(), true );
|
||||
int textSize = (int) ValueFromString( EDA_UNITS::INCHES, m_textSizeCtrl->GetValue(), true );
|
||||
|
||||
if( textSize != GetDefaultTextSize() )
|
||||
{
|
||||
@ -77,8 +77,8 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
|
||||
}
|
||||
|
||||
m_frame->SetRepeatStep(
|
||||
wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
|
||||
ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
|
||||
wxPoint( (int) ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
|
||||
(int) ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
|
||||
m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() );
|
||||
|
||||
m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() );
|
||||
|
@ -184,9 +184,9 @@ void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer )
|
||||
}
|
||||
|
||||
|
||||
static PARAM_CFG_ARRAY& cfg_params()
|
||||
static std::vector<PARAM_CFG*>& cfg_params()
|
||||
{
|
||||
static PARAM_CFG_ARRAY ca;
|
||||
static std::vector<PARAM_CFG*> ca;
|
||||
|
||||
if( !ca.size() )
|
||||
{
|
||||
|
@ -181,60 +181,55 @@ void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
}
|
||||
|
||||
|
||||
PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
|
||||
std::vector<PARAM_CFG*>& SCH_EDIT_FRAME::GetProjectFileParameters()
|
||||
|
||||
{
|
||||
if( !m_projectFileParams.empty() )
|
||||
return m_projectFileParams;
|
||||
|
||||
try
|
||||
{
|
||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
|
||||
&BASE_SCREEN::m_PageLayoutDescrFileName ) );
|
||||
std::vector<PARAM_CFG*>& params = m_projectFileParams;
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ),
|
||||
&m_plotDirectoryName ) );
|
||||
params.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
|
||||
&BASE_SCREEN::m_PageLayoutDescrFileName ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
|
||||
LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ),
|
||||
LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
|
||||
params.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ),
|
||||
&m_plotDirectoryName ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
|
||||
&m_netListFormat) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "SpiceAjustPassiveValues" ),
|
||||
&m_spiceAjustPassiveValues, false ) );
|
||||
params.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
|
||||
LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
|
||||
params.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ),
|
||||
LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ),
|
||||
&s_defaultTextSize, DEFAULT_SIZE_TEXT, 5, 1000 ) );
|
||||
params.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
|
||||
&m_netListFormat) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "SpiceAjustPassiveValues" ),
|
||||
&m_spiceAjustPassiveValues, false ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_WriteFile" ),
|
||||
&m_ercSettings.write_erc_file, false ) );
|
||||
params.push_back( new PARAM_CFG_INT( wxT( "LabSize" ),
|
||||
&s_defaultTextSize, DEFAULT_SIZE_TEXT, 5, 1000 ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_TestSimilarLabels" ),
|
||||
&m_ercSettings.check_similar_labels, true ) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_WriteFile" ),
|
||||
&m_ercSettings.write_erc_file, false ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckUniqueGlobalLabels" ),
|
||||
&m_ercSettings.check_unique_global_labels, true ) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_TestSimilarLabels" ),
|
||||
&m_ercSettings.check_similar_labels, true ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusDriverConflicts" ),
|
||||
&m_ercSettings.check_bus_driver_conflicts, true ) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckUniqueGlobalLabels" ),
|
||||
&m_ercSettings.check_unique_global_labels, true ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusEntryConflicts" ),
|
||||
&m_ercSettings.check_bus_entry_conflicts, true ) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusDriverConflicts" ),
|
||||
&m_ercSettings.check_bus_driver_conflicts, true ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToBusConflicts" ),
|
||||
&m_ercSettings.check_bus_to_bus_conflicts, true ) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusEntryConflicts" ),
|
||||
&m_ercSettings.check_bus_entry_conflicts, true ) );
|
||||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToNetConflicts" ),
|
||||
&m_ercSettings.check_bus_to_net_conflicts, true ) );
|
||||
}
|
||||
catch( boost::bad_pointer& )
|
||||
{
|
||||
// Out of memory? Ship's going down anyway....
|
||||
}
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToBusConflicts" ),
|
||||
&m_ercSettings.check_bus_to_bus_conflicts, true ) );
|
||||
|
||||
return m_projectFileParams;
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "ERC_CheckBusToNetConflicts" ),
|
||||
&m_ercSettings.check_bus_to_net_conflicts, true ) );
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
@ -345,36 +340,30 @@ static const wxChar selectionThickness[] = wxT( "SelectionThickness" );
|
||||
|
||||
///@}
|
||||
|
||||
PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings()
|
||||
std::vector<PARAM_CFG*>& SCH_EDIT_FRAME::GetConfigurationSettings()
|
||||
{
|
||||
if( !m_configSettings.empty() )
|
||||
return m_configSettings;
|
||||
|
||||
try
|
||||
{
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry,
|
||||
&m_showPageLimits, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_INT(
|
||||
true, UnitsEntry, (int*) &m_userUnits, (int) EDA_UNITS::MILLIMETRES ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry,
|
||||
&m_showPageLimits, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, UnitsEntry,
|
||||
(int*) &m_userUnits,
|
||||
(int) EDA_UNITS::MILLIMETRES ) );
|
||||
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry,
|
||||
&m_printMonochrome, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintSheetRefEntry,
|
||||
&m_printSheetReference, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry,
|
||||
&m_printMonochrome, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintSheetRefEntry,
|
||||
&m_printSheetReference, true ) );
|
||||
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry,
|
||||
&m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC,
|
||||
-10, +10 ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowIllegalSymboLibDialog,
|
||||
&m_showIllegalSymbolLibDialog, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, showSheetFileNameCaseSensitivityDlg,
|
||||
&m_showSheetFileNameCaseSensitivityDlg,
|
||||
true ) );
|
||||
}
|
||||
catch( boost::bad_pointer& )
|
||||
{
|
||||
// Out of memory? Ship's going down anyway....
|
||||
}
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry,
|
||||
&m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC,
|
||||
-10, +10 ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowIllegalSymboLibDialog,
|
||||
&m_showIllegalSymbolLibDialog, true ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true, showSheetFileNameCaseSensitivityDlg,
|
||||
&m_showSheetFileNameCaseSensitivityDlg,
|
||||
true ) );
|
||||
|
||||
return m_configSettings;
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ class SCH_EDIT_FRAME : public SCH_BASE_FRAME
|
||||
private:
|
||||
wxString m_SelectedNetName;
|
||||
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
PARAM_CFG_ARRAY m_configSettings;
|
||||
std::vector<PARAM_CFG*> m_projectFileParams;
|
||||
std::vector<PARAM_CFG*> m_configSettings;
|
||||
ERC_SETTINGS m_ercSettings;
|
||||
wxPageSetupDialogData m_pageSetupData;
|
||||
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
|
||||
@ -149,29 +149,23 @@ private:
|
||||
DIALOG_SCH_FIND* m_findReplaceDialog;
|
||||
STATUS_TEXT_POPUP* m_findReplaceStatusPopup;
|
||||
|
||||
/// Flag to indicate show hidden pins.
|
||||
bool m_showAllPins;
|
||||
bool m_showAllPins; // show hidden pins
|
||||
bool m_selectPinSelectSymbol; // select parent when clicking on pin
|
||||
|
||||
/// Flag to indicate the pin selection (on a left click) select the paren symbol.
|
||||
bool m_selectPinSelectSymbol;
|
||||
|
||||
/// The name of the destination directory to use when generating plot files.
|
||||
wxString m_plotDirectoryName;
|
||||
|
||||
/// The name of the format to use when generating a net list.
|
||||
wxString m_netListFormat;
|
||||
wxString m_plotDirectoryName;
|
||||
wxString m_netListFormat;
|
||||
|
||||
/// Use netcodes (net number) as net names when generating spice net lists.
|
||||
bool m_spiceAjustPassiveValues;
|
||||
bool m_spiceAjustPassiveValues;
|
||||
|
||||
/* these are PROJECT specific, not schematic editor specific
|
||||
wxString m_userLibraryPath;
|
||||
wxArrayString m_componentLibFiles;
|
||||
wxString m_userLibraryPath;
|
||||
wxArrayString m_componentLibFiles;
|
||||
*/
|
||||
|
||||
static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type.
|
||||
static wxSize m_lastSheetPinTextSize; ///< Last sheet pin text size.
|
||||
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
|
||||
static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type.
|
||||
static wxSize m_lastSheetPinTextSize; ///< Last sheet pin text size.
|
||||
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -258,7 +252,7 @@ public:
|
||||
* Populate the project file parameter array specific to Eeschema if it hasn't
|
||||
* already been populated and return a reference to the array to the caller.
|
||||
*/
|
||||
PARAM_CFG_ARRAY& GetProjectFileParameters();
|
||||
std::vector<PARAM_CFG*>& GetProjectFileParameters();
|
||||
|
||||
/**
|
||||
* Save changes to the project settings to the project (.pro) file.
|
||||
@ -313,7 +307,7 @@ public:
|
||||
* setting that need to be loaded at run time, this is the place to define it.
|
||||
* </p>
|
||||
*/
|
||||
PARAM_CFG_ARRAY& GetConfigurationSettings();
|
||||
std::vector<PARAM_CFG*>& GetConfigurationSettings();
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||
void SaveSettings( wxConfigBase* aCfg ) override;
|
||||
|
@ -99,8 +99,8 @@ SCH_ITEM* SCH_ITEM::Duplicate( bool doClone )
|
||||
{
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) newItem;
|
||||
|
||||
for( SCH_SHEET_PIN& pin : sheet->GetPins() )
|
||||
pin.ClearFlags( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
pin->ClearFlags( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
||||
}
|
||||
|
||||
return newItem;
|
||||
|
@ -1011,6 +1011,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||
}
|
||||
else // Sheet pin.
|
||||
{
|
||||
// Use a unique_ptr so that we clean up in the case of a throw
|
||||
std::unique_ptr< SCH_SHEET_PIN > sheetPin( new SCH_SHEET_PIN( sheet.get() ) );
|
||||
|
||||
sheetPin->SetNumber( fieldId );
|
||||
@ -2162,14 +2163,14 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
||||
m_out->Print( 0, "F1 %s %d\n", EscapedUTF8( aSheet->GetFileName() ).c_str(),
|
||||
Iu2Mils( aSheet->GetFileNameSize() ) );
|
||||
|
||||
for( const SCH_SHEET_PIN& pin : aSheet->GetPins() )
|
||||
for( const SCH_SHEET_PIN* pin : aSheet->GetPins() )
|
||||
{
|
||||
int type, side;
|
||||
|
||||
if( pin.GetText().IsEmpty() )
|
||||
if( pin->GetText().IsEmpty() )
|
||||
break;
|
||||
|
||||
switch( pin.GetEdge() )
|
||||
switch( pin->GetEdge() )
|
||||
{
|
||||
default:
|
||||
case SHEET_LEFT_SIDE: side = 'L'; break;
|
||||
@ -2178,7 +2179,7 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
||||
case SHEET_BOTTOM_SIDE: side = 'B'; break;
|
||||
}
|
||||
|
||||
switch( pin.GetShape() )
|
||||
switch( pin->GetShape() )
|
||||
{
|
||||
case PINSHEETLABEL_SHAPE::PS_INPUT:
|
||||
type = 'I';
|
||||
@ -2198,11 +2199,11 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
|
||||
break;
|
||||
}
|
||||
|
||||
m_out->Print( 0, "F%d %s %c %c %-3d %-3d %-3d\n", pin.GetNumber(),
|
||||
EscapedUTF8( pin.GetText() ).c_str(), // supplies wrapping quotes
|
||||
type, side, Iu2Mils( pin.GetPosition().x ),
|
||||
Iu2Mils( pin.GetPosition().y ),
|
||||
Iu2Mils( pin.GetTextWidth() ) );
|
||||
m_out->Print( 0, "F%d %s %c %c %-3d %-3d %-3d\n", pin->GetNumber(),
|
||||
EscapedUTF8( pin->GetText() ).c_str(), // supplies wrapping quotes
|
||||
type, side, Iu2Mils( pin->GetPosition().x ),
|
||||
Iu2Mils( pin->GetPosition().y ),
|
||||
Iu2Mils( pin->GetTextWidth() ) );
|
||||
}
|
||||
|
||||
m_out->Print( 0, "$EndSheet\n" );
|
||||
|
@ -1522,20 +1522,20 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
|
||||
|
||||
if( aLayer == LAYER_HIERLABEL || drawingShadows )
|
||||
{
|
||||
for( auto& sheetPin : aSheet->GetPins() )
|
||||
for( SCH_SHEET_PIN* sheetPin : aSheet->GetPins() )
|
||||
{
|
||||
if( drawingShadows && !aSheet->IsSelected() && !sheetPin.IsSelected() )
|
||||
if( drawingShadows && !aSheet->IsSelected() && !sheetPin->IsSelected() )
|
||||
continue;
|
||||
|
||||
if( drawingShadows && !GetSelectionDrawChildItems() && aSheet->IsSelected() )
|
||||
break;
|
||||
|
||||
int width = aSheet->GetPenSize();
|
||||
wxPoint initial_pos = sheetPin.GetTextPos();
|
||||
wxPoint initial_pos = sheetPin->GetTextPos();
|
||||
wxPoint offset_pos = initial_pos;
|
||||
|
||||
// For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
|
||||
switch( sheetPin.GetEdge() )
|
||||
switch( sheetPin->GetEdge() )
|
||||
{
|
||||
case SHEET_TOP_SIDE: offset_pos.y += KiROUND( width / 2.0 ); break;
|
||||
case SHEET_BOTTOM_SIDE: offset_pos.y -= KiROUND( width / 2.0 ); break;
|
||||
@ -1544,10 +1544,10 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
|
||||
default: break;
|
||||
}
|
||||
|
||||
sheetPin.SetTextPos( offset_pos );
|
||||
draw( static_cast<SCH_HIERLABEL*>( &sheetPin ), aLayer );
|
||||
sheetPin->SetTextPos( offset_pos );
|
||||
draw( static_cast<SCH_HIERLABEL*>( sheetPin ), aLayer );
|
||||
m_gal->DrawLine( offset_pos, initial_pos );
|
||||
sheetPin.SetTextPos( initial_pos );
|
||||
sheetPin->SetTextPos( initial_pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,10 +72,12 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
|
||||
m_screen = aSheet.m_screen;
|
||||
m_name = aSheet.m_name;
|
||||
m_fileName = aSheet.m_fileName;
|
||||
m_pins = aSheet.m_pins;
|
||||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
m_pins[i].SetParent( this );
|
||||
for( SCH_SHEET_PIN* pin : aSheet.m_pins )
|
||||
{
|
||||
m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
|
||||
m_pins.back()->SetParent( this );
|
||||
}
|
||||
|
||||
if( m_screen )
|
||||
m_screen->IncRefCount();
|
||||
@ -93,6 +95,10 @@ SCH_SHEET::~SCH_SHEET()
|
||||
if( m_screen->GetRefCount() == 0 )
|
||||
delete m_screen;
|
||||
}
|
||||
|
||||
// We own our pins; delete them
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
delete pin;
|
||||
}
|
||||
|
||||
|
||||
@ -161,17 +167,12 @@ void SCH_SHEET::SwapData( SCH_ITEM* aItem )
|
||||
std::swap( m_fileNameSize, sheet->m_fileNameSize );
|
||||
m_pins.swap( sheet->m_pins );
|
||||
|
||||
// Ensure sheet labels have their .m_Parent member pointing really on their
|
||||
// parent, after swapping.
|
||||
for( SCH_SHEET_PIN& sheetPin : m_pins )
|
||||
{
|
||||
sheetPin.SetParent( this );
|
||||
}
|
||||
// Update parent pointers after swapping.
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->SetParent( this );
|
||||
|
||||
for( SCH_SHEET_PIN& sheetPin : sheet->m_pins )
|
||||
{
|
||||
sheetPin.SetParent( sheet );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : sheet->m_pins )
|
||||
sheetPin->SetParent( sheet );
|
||||
}
|
||||
|
||||
|
||||
@ -190,9 +191,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
|
||||
wxASSERT( aSheetPin != NULL );
|
||||
wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
|
||||
|
||||
SCH_SHEET_PINS::iterator i;
|
||||
|
||||
for( i = m_pins.begin(); i < m_pins.end(); ++i )
|
||||
for( auto i = m_pins.begin(); i < m_pins.end(); ++i )
|
||||
{
|
||||
if( *i == aSheetPin )
|
||||
{
|
||||
@ -209,9 +208,9 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
|
||||
|
||||
bool SCH_SHEET::HasPin( const wxString& aName )
|
||||
{
|
||||
for( const SCH_SHEET_PIN& pin : m_pins )
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
{
|
||||
if( pin.GetText().CmpNoCase( aName ) == 0 )
|
||||
if( pin->GetText().CmpNoCase( aName ) == 0 )
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -224,9 +223,9 @@ bool SCH_SHEET::IsVerticalOrientation() const
|
||||
int leftRight = 0;
|
||||
int topBottom = 0;
|
||||
|
||||
for( const SCH_SHEET_PIN& pin : m_pins )
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
{
|
||||
switch( pin.GetEdge() )
|
||||
switch( pin->GetEdge() )
|
||||
{
|
||||
case SHEET_LEFT_SIDE: leftRight++; break;
|
||||
case SHEET_RIGHT_SIDE: leftRight++; break;
|
||||
@ -242,13 +241,13 @@ bool SCH_SHEET::IsVerticalOrientation() const
|
||||
|
||||
bool SCH_SHEET::HasUndefinedPins()
|
||||
{
|
||||
for( const SCH_SHEET_PIN& pin : m_pins )
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
{
|
||||
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
|
||||
const SCH_HIERLABEL* HLabel = nullptr;
|
||||
for( auto aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
||||
{
|
||||
if( !pin.GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
|
||||
if( !pin->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
|
||||
{
|
||||
HLabel = static_cast<SCH_HIERLABEL*>( aItem );
|
||||
break;
|
||||
@ -269,8 +268,8 @@ int SCH_SHEET::GetMinWidth() const
|
||||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
{
|
||||
int edge = m_pins[i].GetEdge();
|
||||
EDA_RECT pinRect = m_pins[i].GetBoundingBox();
|
||||
int edge = m_pins[i]->GetEdge();
|
||||
EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
|
||||
|
||||
wxASSERT( edge != SHEET_UNDEFINED_SIDE );
|
||||
|
||||
@ -287,12 +286,12 @@ int SCH_SHEET::GetMinWidth() const
|
||||
for( size_t j = 0; j < m_pins.size(); j++ )
|
||||
{
|
||||
// Check for pin directly across from the current pin.
|
||||
if( (i == j) || (m_pins[i].GetPosition().y != m_pins[j].GetPosition().y) )
|
||||
if( (i == j) || (m_pins[i]->GetPosition().y != m_pins[j]->GetPosition().y) )
|
||||
continue;
|
||||
|
||||
if( width < pinRect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth() )
|
||||
if( width < pinRect.GetWidth() + m_pins[j]->GetBoundingBox().GetWidth() )
|
||||
{
|
||||
width = pinRect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth();
|
||||
width = pinRect.GetWidth() + m_pins[j]->GetBoundingBox().GetWidth();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -309,8 +308,8 @@ int SCH_SHEET::GetMinHeight() const
|
||||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
{
|
||||
int edge = m_pins[i].GetEdge();
|
||||
EDA_RECT pinRect = m_pins[i].GetBoundingBox();
|
||||
int edge = m_pins[i]->GetEdge();
|
||||
EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
|
||||
|
||||
// Make sure pin is on top or bottom side of sheet.
|
||||
if( edge == SHEET_RIGHT_SIDE || edge == SHEET_LEFT_SIDE )
|
||||
@ -326,12 +325,12 @@ int SCH_SHEET::GetMinHeight() const
|
||||
for( size_t j = 0; j < m_pins.size(); j++ )
|
||||
{
|
||||
// Check for pin directly above or below the current pin.
|
||||
if( (i == j) || (m_pins[i].GetPosition().x != m_pins[j].GetPosition().x) )
|
||||
if( (i == j) || (m_pins[i]->GetPosition().x != m_pins[j]->GetPosition().x) )
|
||||
continue;
|
||||
|
||||
if( height < pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight() )
|
||||
if( height < pinRect.GetHeight() + m_pins[j]->GetBoundingBox().GetHeight() )
|
||||
{
|
||||
height = pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight();
|
||||
height = pinRect.GetHeight() + m_pins[j]->GetBoundingBox().GetHeight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -344,16 +343,16 @@ int SCH_SHEET::GetMinHeight() const
|
||||
|
||||
void SCH_SHEET::CleanupSheet()
|
||||
{
|
||||
SCH_SHEET_PINS::iterator i = m_pins.begin();
|
||||
auto i = m_pins.begin();
|
||||
|
||||
while( i != m_pins.end() )
|
||||
{
|
||||
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
|
||||
const SCH_HIERLABEL* HLabel = NULL;
|
||||
|
||||
for( auto aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
||||
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_HIER_LABEL_T ) )
|
||||
{
|
||||
if( !i->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) )
|
||||
if( (*i)->GetText().CmpNoCase( static_cast<SCH_HIERLABEL*>( aItem )->GetText() ) == 0 )
|
||||
{
|
||||
HLabel = static_cast<SCH_HIERLABEL*>( aItem );
|
||||
break;
|
||||
@ -370,10 +369,10 @@ void SCH_SHEET::CleanupSheet()
|
||||
|
||||
SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
|
||||
{
|
||||
for( SCH_SHEET_PIN& pin : m_pins )
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
{
|
||||
if( pin.HitTest( aPosition ) )
|
||||
return &pin;
|
||||
if( pin->HitTest( aPosition ) )
|
||||
return pin;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -470,8 +469,8 @@ void SCH_SHEET::Print( wxDC* aDC, const wxPoint& aOffset )
|
||||
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, textWidth, false, false );
|
||||
|
||||
/* Draw text : SheetLabel */
|
||||
for( SCH_SHEET_PIN& sheetPin : m_pins )
|
||||
sheetPin.Print( aDC, aOffset );
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Print( aDC, aOffset );
|
||||
}
|
||||
|
||||
|
||||
@ -650,10 +649,8 @@ void SCH_SHEET::Rotate(wxPoint aPosition)
|
||||
m_size.y = -m_size.y;
|
||||
}
|
||||
|
||||
for( SCH_SHEET_PIN& sheetPin : m_pins )
|
||||
{
|
||||
sheetPin.Rotate( aPosition );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Rotate( aPosition );
|
||||
}
|
||||
|
||||
|
||||
@ -662,10 +659,8 @@ void SCH_SHEET::MirrorX( int aXaxis_position )
|
||||
MIRROR( m_pos.y, aXaxis_position );
|
||||
m_pos.y -= m_size.y;
|
||||
|
||||
for( SCH_SHEET_PIN& sheetPin : m_pins )
|
||||
{
|
||||
sheetPin.MirrorX( aXaxis_position );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->MirrorX( aXaxis_position );
|
||||
}
|
||||
|
||||
|
||||
@ -674,10 +669,8 @@ void SCH_SHEET::MirrorY( int aYaxis_position )
|
||||
MIRROR( m_pos.x, aYaxis_position );
|
||||
m_pos.x -= m_size.x;
|
||||
|
||||
for( SCH_SHEET_PIN& label : m_pins )
|
||||
{
|
||||
label.MirrorY( aYaxis_position );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->MirrorY( aYaxis_position );
|
||||
}
|
||||
|
||||
void SCH_SHEET::SetPosition( const wxPoint& aPosition )
|
||||
@ -697,10 +690,8 @@ void SCH_SHEET::Resize( const wxSize& aSize )
|
||||
m_size = aSize;
|
||||
|
||||
/* Move the sheet labels according to the new sheet size. */
|
||||
for( SCH_SHEET_PIN& label : m_pins )
|
||||
{
|
||||
label.ConstrainOnEdge( label.GetPosition() );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->ConstrainOnEdge( sheetPin->GetPosition() );
|
||||
}
|
||||
|
||||
|
||||
@ -734,9 +725,9 @@ void SCH_SHEET::renumberPins()
|
||||
{
|
||||
int id = 2;
|
||||
|
||||
for( SCH_SHEET_PIN& pin : m_pins )
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
{
|
||||
pin.SetNumber( id );
|
||||
pin->SetNumber( id );
|
||||
id++;
|
||||
}
|
||||
}
|
||||
@ -744,14 +735,12 @@ void SCH_SHEET::renumberPins()
|
||||
|
||||
void SCH_SHEET::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
for( unsigned ii = 0; ii < GetPins().size(); ii++ )
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
{
|
||||
SCH_SHEET_PIN &pinsheet = GetPins()[ii];
|
||||
|
||||
wxCHECK2_MSG( pinsheet.Type() == SCH_SHEET_PIN_T, continue,
|
||||
wxCHECK2_MSG( sheetPin->Type() == SCH_SHEET_PIN_T, continue,
|
||||
wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
|
||||
|
||||
pinsheet.GetEndPoints( aItemList );
|
||||
sheetPin->GetEndPoints( aItemList );
|
||||
}
|
||||
}
|
||||
|
||||
@ -760,8 +749,8 @@ bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
for( SCH_SHEET_PIN& pinsheet : GetPins() )
|
||||
changed |= pinsheet.UpdateDanglingState( aItemList );
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
changed |= sheetPin->UpdateDanglingState( aItemList );
|
||||
|
||||
return changed;
|
||||
}
|
||||
@ -769,8 +758,8 @@ bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
|
||||
void SCH_SHEET::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
for( size_t i = 0; i < GetPins().size(); i++ )
|
||||
aPoints.push_back( GetPins()[i].GetPosition() );
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
aPoints.push_back( sheetPin->GetPosition() );
|
||||
}
|
||||
|
||||
|
||||
@ -790,9 +779,9 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
|
||||
if( stype == SCH_LOCATE_ANY_T || stype == SCH_SHEET_PIN_T )
|
||||
{
|
||||
// Test the sheet labels.
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
{
|
||||
if( SEARCH_RESULT::QUIT == aInspector( &m_pins[i], this ) )
|
||||
if( SEARCH_RESULT::QUIT == aInspector( sheetPin, this ) )
|
||||
return SEARCH_RESULT::QUIT;
|
||||
}
|
||||
}
|
||||
@ -843,20 +832,20 @@ void SCH_SHEET::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
||||
SCH_SHEET_PATH sheetPath = *aSheetPath;
|
||||
sheetPath.push_back( this );
|
||||
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
{
|
||||
NETLIST_OBJECT* item = new NETLIST_OBJECT();
|
||||
item->m_SheetPathInclude = sheetPath;
|
||||
item->m_SheetPath = *aSheetPath;
|
||||
item->m_Comp = &m_pins[i];
|
||||
item->m_Comp = sheetPin;
|
||||
item->m_Link = this;
|
||||
item->m_Type = NET_SHEETLABEL;
|
||||
item->m_Label = m_pins[i].GetText();
|
||||
item->m_Start = item->m_End = m_pins[i].GetPosition();
|
||||
item->m_Label = sheetPin->GetText();
|
||||
item->m_Start = item->m_End = sheetPin->GetPosition();
|
||||
aNetListItems.push_back( item );
|
||||
|
||||
SCH_CONNECTION conn;
|
||||
if( conn.IsBusLabel( m_pins[i].GetText() ) )
|
||||
if( conn.IsBusLabel( sheetPin->GetText() ) )
|
||||
item->ConvertBusToNetListItems( aNetListItems );
|
||||
}
|
||||
}
|
||||
@ -933,14 +922,12 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
|
||||
aPlotter->SetColor( GetLayerColor( GetLayer() ) );
|
||||
|
||||
/* Draw texts : SheetLabel */
|
||||
for( size_t i = 0; i < m_pins.size(); i++ )
|
||||
{
|
||||
m_pins[i].Plot( aPlotter );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Plot( aPlotter );
|
||||
}
|
||||
|
||||
|
||||
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
|
||||
SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem )
|
||||
{
|
||||
wxLogDebug( wxT( "Sheet assignment operator." ) );
|
||||
|
||||
@ -959,13 +946,11 @@ SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
|
||||
m_name = sheet->m_name;
|
||||
m_sheetNameSize = sheet->m_sheetNameSize;
|
||||
m_fileNameSize = sheet->m_fileNameSize;
|
||||
m_pins = sheet->m_pins;
|
||||
|
||||
// Ensure sheet labels have their #m_Parent member pointing really on their
|
||||
// parent, after assigning.
|
||||
for( SCH_SHEET_PIN& sheetPin : m_pins )
|
||||
for( SCH_SHEET_PIN* pin : sheet->m_pins )
|
||||
{
|
||||
sheetPin.SetParent( this );
|
||||
m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
|
||||
m_pins.back()->SetParent( this );
|
||||
}
|
||||
}
|
||||
|
||||
@ -984,10 +969,8 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
|
||||
<< TO_UTF8( m_name ) << '"' << ">\n";
|
||||
|
||||
// show all the pins, and check the linked list integrity
|
||||
for( const SCH_SHEET_PIN& label : m_pins )
|
||||
{
|
||||
label.Show( nestLevel + 1, os );
|
||||
}
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Show( nestLevel + 1, os );
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n" << std::flush;
|
||||
}
|
||||
|
@ -200,9 +200,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PINS;
|
||||
|
||||
|
||||
/**
|
||||
* Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
|
||||
*/
|
||||
@ -215,7 +212,7 @@ class SCH_SHEET : public SCH_ITEM
|
||||
SCH_SCREEN* m_screen;
|
||||
|
||||
/// The list of sheet connection points.
|
||||
SCH_SHEET_PINS m_pins;
|
||||
std::vector<SCH_SHEET_PIN*> m_pins;
|
||||
|
||||
/// The file name is also in the #SCH_SCREEN object associated with the sheet. It is
|
||||
/// also needed here for loading after reading the sheet description from file.
|
||||
@ -332,11 +329,11 @@ public:
|
||||
*/
|
||||
void AddPin( SCH_SHEET_PIN* aSheetPin );
|
||||
|
||||
SCH_SHEET_PINS& GetPins() { return m_pins; }
|
||||
std::vector<SCH_SHEET_PIN*>& GetPins() { return m_pins; }
|
||||
|
||||
SCH_SHEET_PINS& GetPins() const
|
||||
std::vector<SCH_SHEET_PIN*>& GetPins() const
|
||||
{
|
||||
return const_cast< SCH_SHEET_PINS& >( m_pins );
|
||||
return const_cast< std::vector<SCH_SHEET_PIN*>& >( m_pins );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -479,10 +476,8 @@ public:
|
||||
{
|
||||
m_pos += aMoveVector;
|
||||
|
||||
for( SCH_SHEET_PIN& pin : m_pins )
|
||||
{
|
||||
pin.Move( aMoveVector );
|
||||
}
|
||||
for( SCH_SHEET_PIN* pin : m_pins )
|
||||
pin->Move( aMoveVector );
|
||||
}
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
@ -536,7 +531,7 @@ public:
|
||||
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
||||
SCH_SHEET_PATH* aSheetPath ) override;
|
||||
|
||||
SCH_ITEM& operator=( const SCH_ITEM& aSheet );
|
||||
SCH_SHEET& operator=( const SCH_ITEM& aSheet );
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
|
@ -532,11 +532,11 @@ void EE_POINT_EDITOR::updateItem() const
|
||||
sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) );
|
||||
|
||||
// Keep sheet pins attached to edges:
|
||||
for( SCH_SHEET_PIN& pin : sheet->GetPins() )
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
{
|
||||
wxPoint pos = pin.GetPosition();
|
||||
wxPoint pos = pin->GetPosition();
|
||||
|
||||
switch( pin.GetEdge() )
|
||||
switch( pin->GetEdge() )
|
||||
{
|
||||
case SHEET_LEFT_SIDE: pos.x = topLeft.x; break;
|
||||
case SHEET_RIGHT_SIDE: pos.x = topRight.x; break;
|
||||
@ -545,7 +545,7 @@ void EE_POINT_EDITOR::updateItem() const
|
||||
case SHEET_UNDEFINED_SIDE: break;
|
||||
}
|
||||
|
||||
pin.SetPosition( pos );
|
||||
pin->SetPosition( pos );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -718,8 +718,8 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||
{
|
||||
int layer = pair.second;
|
||||
|
||||
for( SCH_SHEET_PIN& pin : sheet->GetPins() )
|
||||
sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( &pin, layer ) );
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( pin, layer ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1223,14 +1223,14 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, EE_SELECTION* aGr
|
||||
}
|
||||
else if( itemType == SCH_SHEET_T )
|
||||
{
|
||||
SCH_SHEET_PINS& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
|
||||
std::vector<SCH_SHEET_PIN*>& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
|
||||
|
||||
for( SCH_SHEET_PIN& pin : pins )
|
||||
for( SCH_SHEET_PIN* pin : pins )
|
||||
{
|
||||
if( aMode == SELECTED )
|
||||
pin.SetSelected();
|
||||
pin->SetSelected();
|
||||
else if( aMode == BRIGHTENED )
|
||||
pin.SetBrightened();
|
||||
pin->SetBrightened();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1280,14 +1280,14 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, EE_SELECTION* a
|
||||
}
|
||||
else if( itemType == SCH_SHEET_T )
|
||||
{
|
||||
SCH_SHEET_PINS& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
|
||||
std::vector<SCH_SHEET_PIN*>& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
|
||||
|
||||
for( SCH_SHEET_PIN& pin : pins )
|
||||
for( SCH_SHEET_PIN* pin : pins )
|
||||
{
|
||||
if( aMode == SELECTED )
|
||||
pin.ClearSelected();
|
||||
pin->ClearSelected();
|
||||
else if( aMode == BRIGHTENED )
|
||||
pin.ClearBrightened();
|
||||
pin->ClearBrightened();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,20 +738,20 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else if( item->Type() == SCH_SHEET_T )
|
||||
{
|
||||
for( SCH_SHEET_PIN& pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
{
|
||||
auto pin_conn = pin.Connection( *g_CurrentSheet );
|
||||
bool redrawPin = pin.IsBrightened();
|
||||
auto pin_conn = pin->Connection( *g_CurrentSheet );
|
||||
bool redrawPin = pin->IsBrightened();
|
||||
|
||||
if( pin_conn && pin_conn->Name() == selectedNetName )
|
||||
pin.SetBrightened();
|
||||
pin->SetBrightened();
|
||||
else
|
||||
pin.ClearBrightened();
|
||||
pin->ClearBrightened();
|
||||
|
||||
redrawPin |= pin.IsBrightened();
|
||||
redrawPin |= pin->IsBrightened();
|
||||
|
||||
if( redrawPin )
|
||||
itemsToRedraw.push_back( &pin );
|
||||
itemsToRedraw.push_back( pin );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,12 +387,10 @@ const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const wxPoint& aPositi
|
||||
{
|
||||
auto sheet = static_cast<SCH_SHEET*>( item );
|
||||
|
||||
for( const SCH_SHEET_PIN& pin : sheet->GetPins() )
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
{
|
||||
if( pin.GetPosition() == aPosition )
|
||||
{
|
||||
return &pin;
|
||||
}
|
||||
if( pin->GetPosition() == aPosition )
|
||||
return pin;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,38 +47,32 @@ void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
}
|
||||
|
||||
|
||||
PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
|
||||
std::vector<PARAM_CFG*>& GERBVIEW_FRAME::GetConfigurationSettings()
|
||||
{
|
||||
if( !m_configSettings.empty() )
|
||||
return m_configSettings;
|
||||
|
||||
try
|
||||
{
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
|
||||
&m_displayMode, 2, 0, 2 ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "DCodeColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_DCODES], WHITE ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "NegativeObjectsColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_NEGATIVE_OBJECTS], DARKGRAY ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "GridColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_GERBVIEW_GRID], DARKGRAY ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "WorksheetColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[ LAYER_WORKSHEET], DARKRED ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "BackgroundColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_PCB_BACKGROUND], BLACK ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL(
|
||||
true, wxT( "DisplayPolarCoordinates" ),
|
||||
&m_PolarCoords, false ) );
|
||||
}
|
||||
catch( boost::bad_pointer& )
|
||||
{
|
||||
// Out of memory? Ship's going down anyway....
|
||||
}
|
||||
m_configSettings.push_back( new PARAM_CFG_INT(
|
||||
true, wxT( "DrawModeOption" ),
|
||||
&m_displayMode, 2, 0, 2 ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "DCodeColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_DCODES], WHITE ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "NegativeObjectsColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_NEGATIVE_OBJECTS], DARKGRAY ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "GridColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_GERBVIEW_GRID], DARKGRAY ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "WorksheetColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[ LAYER_WORKSHEET], DARKRED ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||
true, wxT( "BackgroundColorEx" ),
|
||||
&g_ColorsSettings.m_LayersColors[LAYER_PCB_BACKGROUND], BLACK ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_BOOL(
|
||||
true, wxT( "DisplayPolarCoordinates" ),
|
||||
&m_PolarCoords, false ) );
|
||||
|
||||
// Default colors for layers 0 to 31
|
||||
static const COLOR4D color_default[] = {
|
||||
|
@ -170,10 +170,9 @@ public:
|
||||
COLORS_DESIGN_SETTINGS* m_colorsSettings;
|
||||
|
||||
private:
|
||||
// list of PARAM_CFG_xxx to read/write parameters saved in config
|
||||
PARAM_CFG_ARRAY m_configSettings;
|
||||
std::vector<PARAM_CFG*> m_configSettings;
|
||||
|
||||
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
|
||||
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
|
||||
// - in fast mode (write mode) but if there are negative
|
||||
// items only the last image is correctly drawn (no
|
||||
// problem to see only one image or when no negative items)
|
||||
@ -420,7 +419,7 @@ public:
|
||||
* GerbView source code (mainly in dialogs). If you need to define a configuration
|
||||
* setting that need to be loaded at run time, this is the place to define it.
|
||||
*/
|
||||
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
|
||||
std::vector<PARAM_CFG*>& GetConfigurationSettings( void );
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||
void SaveSettings( wxConfigBase* aCfg ) override;
|
||||
|
@ -828,7 +828,7 @@ public:
|
||||
* allow reading or writing of configuration file information directly into
|
||||
* this object.
|
||||
*/
|
||||
void AppendConfigs( BOARD* aBoard, PARAM_CFG_ARRAY* aResult );
|
||||
void AppendConfigs( BOARD* aBoard, std::vector<PARAM_CFG*>* aResult );
|
||||
|
||||
inline int GetBoardThickness() const { return m_boardThickness; }
|
||||
inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user