mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 22:43:44 +00:00
Cleanup & performance enhancements.
This commit is contained in:
parent
d1ff8f4781
commit
6f49b57f9b
3d-viewer
3d_canvas
3d_rendering
common
bitmap_base.cppdialog_shim.cpp
dialogs
drawing_sheet
eda_draw_frame.cppenv_paths.cppenv_vars.cppgrid_tricks.cpporigin_viewitem.cppproject.cppsettings
tool
cvpcb/tools
eeschema
connection_graph.cppcross-probing.cpp
dialogs
files-io.cppnetlist_exporters
project_rescue.cppsch_plugins
sch_screen.cppsch_sheet.cppsch_sheet_path.cppsch_view.cpppcbnew/tools
@ -58,7 +58,7 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
{
|
||||
if( !m_layers_poly.empty() )
|
||||
{
|
||||
for( auto& poly : m_layers_poly )
|
||||
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& poly : m_layers_poly )
|
||||
delete poly.second;
|
||||
|
||||
m_layers_poly.clear();
|
||||
@ -72,7 +72,7 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
if( !m_layerHoleIdPolys.empty() )
|
||||
{
|
||||
for( auto& poly : m_layerHoleIdPolys )
|
||||
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& poly : m_layerHoleIdPolys )
|
||||
delete poly.second;
|
||||
|
||||
m_layerHoleIdPolys.clear();
|
||||
@ -80,7 +80,7 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
if( !m_layerHoleOdPolys.empty() )
|
||||
{
|
||||
for( auto& poly : m_layerHoleOdPolys )
|
||||
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& poly : m_layerHoleOdPolys )
|
||||
delete poly.second;
|
||||
|
||||
m_layerHoleOdPolys.clear();
|
||||
@ -88,7 +88,7 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
if( !m_layerMap.empty() )
|
||||
{
|
||||
for( auto& poly : m_layerMap )
|
||||
for( std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& poly : m_layerMap )
|
||||
delete poly.second;
|
||||
|
||||
m_layerMap.clear();
|
||||
@ -102,7 +102,7 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
if( !m_layerHoleMap.empty() )
|
||||
{
|
||||
for( auto& poly : m_layerHoleMap )
|
||||
for( std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& poly : m_layerHoleMap )
|
||||
delete poly.second;
|
||||
|
||||
m_layerHoleMap.clear();
|
||||
@ -726,9 +726,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
auto layerPolyContainer = m_layers_poly.find( layer );
|
||||
|
||||
if( layerContainer != m_layerMap.end() )
|
||||
{
|
||||
addSolidAreasShapes( zone, layerContainer->second, layer );
|
||||
}
|
||||
|
||||
if( m_Cfg->m_Render.opengl_copper_thickness
|
||||
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL
|
||||
@ -1087,7 +1085,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( !m_layerHoleMap.empty() )
|
||||
{
|
||||
for( auto& hole : m_layerHoleMap )
|
||||
for( std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& hole : m_layerHoleMap )
|
||||
hole.second->BuildBVH();
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,11 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
|
||||
wxASSERT( m_3d_render_raytracing != nullptr );
|
||||
wxASSERT( m_3d_render_opengl != nullptr );
|
||||
|
||||
auto busy_indicator_factory = []() { return std::make_unique<WX_BUSY_INDICATOR>(); };
|
||||
auto busy_indicator_factory =
|
||||
[]()
|
||||
{
|
||||
return std::make_unique<WX_BUSY_INDICATOR>();
|
||||
};
|
||||
|
||||
m_3d_render_raytracing->SetBusyIndicatorFactory( busy_indicator_factory );
|
||||
m_3d_render_opengl->SetBusyIndicatorFactory( busy_indicator_factory );
|
||||
|
@ -149,24 +149,25 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
|
||||
|
||||
for( unsigned int mesh_i = 0; mesh_i < a3DModel.m_MeshesSize; ++mesh_i )
|
||||
{
|
||||
const auto& mesh = a3DModel.m_Meshes[mesh_i];
|
||||
const SMESH& mesh = a3DModel.m_Meshes[mesh_i];
|
||||
|
||||
// silently ignore meshes that have invalid material references or invalid geometry.
|
||||
if( mesh.m_MaterialIdx >= m_materials.size()
|
||||
|| mesh.m_Positions == nullptr
|
||||
|| mesh.m_FaceIdx == nullptr
|
||||
|| mesh.m_Normals == nullptr
|
||||
|| mesh.m_FaceIdxSize == 0
|
||||
|| mesh.m_VertexSize == 0 )
|
||||
continue;
|
||||
|| mesh.m_Positions == nullptr
|
||||
|| mesh.m_FaceIdx == nullptr
|
||||
|| mesh.m_Normals == nullptr
|
||||
|| mesh.m_FaceIdxSize == 0
|
||||
|| mesh.m_VertexSize == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
auto& mesh_group = mesh_groups[mesh.m_MaterialIdx];
|
||||
auto& material = m_materials[mesh.m_MaterialIdx];
|
||||
MESH_GROUP& mesh_group = mesh_groups[mesh.m_MaterialIdx];
|
||||
MATERIAL& material = m_materials[mesh.m_MaterialIdx];
|
||||
|
||||
if( material.IsTransparent()
|
||||
&& m_materialMode != MATERIAL_MODE::DIFFUSE_ONLY )
|
||||
if( material.IsTransparent() && m_materialMode != MATERIAL_MODE::DIFFUSE_ONLY )
|
||||
m_have_transparent_meshes = true;
|
||||
else
|
||||
else
|
||||
m_have_opaque_meshes = true;
|
||||
|
||||
const unsigned int vtx_offset = mesh_group.m_vertices.size();
|
||||
@ -180,15 +181,14 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
|
||||
{
|
||||
m_meshes_bbox[mesh_i].Union( mesh.m_Positions[vtx_i] );
|
||||
|
||||
auto& vtx_out = mesh_group.m_vertices[vtx_offset + vtx_i];
|
||||
VERTEX& vtx_out = mesh_group.m_vertices[vtx_offset + vtx_i];
|
||||
|
||||
vtx_out.m_pos = mesh.m_Positions[vtx_i];
|
||||
vtx_out.m_nrm = glm::clamp( glm::vec4( mesh.m_Normals[vtx_i], 1.0f ) * 127.0f,
|
||||
-127.0f, 127.0f );
|
||||
|
||||
vtx_out.m_tex_uv = mesh.m_Texcoords != nullptr
|
||||
? mesh.m_Texcoords[vtx_i]
|
||||
: glm::vec2 (0);
|
||||
vtx_out.m_tex_uv = mesh.m_Texcoords != nullptr ? mesh.m_Texcoords[vtx_i]
|
||||
: glm::vec2 (0);
|
||||
|
||||
if( mesh.m_Color != nullptr )
|
||||
{
|
||||
@ -299,7 +299,7 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
|
||||
unsigned int total_vertex_count = 0;
|
||||
unsigned int total_index_count = 0;
|
||||
|
||||
for( auto& mg : mesh_groups )
|
||||
for( const MESH_GROUP& mg : mesh_groups )
|
||||
{
|
||||
total_vertex_count += mg.m_vertices.size();
|
||||
total_index_count += mg.m_indices.size();
|
||||
@ -327,8 +327,7 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
|
||||
|
||||
// temporary index buffer which will contain either GLushort or GLuint
|
||||
// type indices. allocate with a bit of meadow at the end.
|
||||
auto tmp_idx = std::make_unique<GLuint[]>(
|
||||
( idx_size * total_index_count + 8 ) / sizeof( GLuint ) );
|
||||
auto tmp_idx = std::make_unique<GLuint[]>( ( idx_size * total_index_count + 8 ) / sizeof( GLuint ) );
|
||||
|
||||
unsigned int prev_vtx_count = 0;
|
||||
unsigned int idx_offset = 0;
|
||||
@ -336,23 +335,22 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode )
|
||||
|
||||
for( unsigned int mg_i = 0; mg_i < mesh_groups.size (); ++mg_i )
|
||||
{
|
||||
auto& mg = mesh_groups[mg_i];
|
||||
auto& mat = m_materials[mg_i];
|
||||
MESH_GROUP& mg = mesh_groups[mg_i];
|
||||
MATERIAL& mat = m_materials[mg_i];
|
||||
uintptr_t tmp_idx_ptr = reinterpret_cast<uintptr_t>( tmp_idx.get() );
|
||||
|
||||
if( m_index_buffer_type == GL_UNSIGNED_SHORT )
|
||||
{
|
||||
auto idx_out = reinterpret_cast<GLushort*>(
|
||||
reinterpret_cast<uintptr_t>( tmp_idx.get() ) + idx_offset );
|
||||
GLushort* idx_out = reinterpret_cast<GLushort*>( tmp_idx_ptr + idx_offset );
|
||||
|
||||
for( auto idx : mg.m_indices )
|
||||
for( GLuint idx : mg.m_indices )
|
||||
*idx_out++ = static_cast<GLushort>( idx + prev_vtx_count );
|
||||
}
|
||||
else if( m_index_buffer_type == GL_UNSIGNED_INT )
|
||||
{
|
||||
auto idx_out = reinterpret_cast<GLuint*>(
|
||||
reinterpret_cast<uintptr_t>( tmp_idx.get() ) + idx_offset );
|
||||
GLuint* idx_out = reinterpret_cast<GLuint*>( tmp_idx_ptr + idx_offset );
|
||||
|
||||
for( auto idx : mg.m_indices )
|
||||
for( GLuint idx : mg.m_indices )
|
||||
*idx_out++ = static_cast<GLuint>( idx + prev_vtx_count );
|
||||
}
|
||||
|
||||
|
@ -531,7 +531,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
float layer_z_bot = 0.0f;
|
||||
float layer_z_top = 0.0f;
|
||||
|
||||
for( const auto ii : outerMapHoles )
|
||||
for( const std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& ii : outerMapHoles )
|
||||
{
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
const SHAPE_POLY_SET* poly = ii.second;
|
||||
@ -543,7 +543,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
layer_z_top, layer_z_bot, false );
|
||||
}
|
||||
|
||||
for( const auto ii : innerMapHoles )
|
||||
for( const std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& ii : innerMapHoles )
|
||||
{
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
const SHAPE_POLY_SET* poly = ii.second;
|
||||
@ -565,7 +565,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
|
||||
|
||||
for( const auto ii : m_boardAdapter.GetLayerMap() )
|
||||
for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& ii : m_boardAdapter.GetLayerMap() )
|
||||
{
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
|
||||
|
@ -556,9 +556,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
aStatusReporter->Report( _( "Load Raytracing: layers" ) );
|
||||
|
||||
// Add layers maps (except B_Mask and F_Mask)
|
||||
for( auto entry : m_boardAdapter.GetLayerMap() )
|
||||
for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& entry : m_boardAdapter.GetLayerMap() )
|
||||
{
|
||||
PCB_LAYER_ID layer_id = entry.first;
|
||||
const PCB_LAYER_ID layer_id = entry.first;
|
||||
const BVH_CONTAINER_2D* container2d = entry.second;
|
||||
|
||||
// Only process layers that exist
|
||||
@ -677,9 +677,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
{
|
||||
const MATERIAL* materialLayer = &m_materials.m_SolderMask;
|
||||
|
||||
for( auto entry : m_boardAdapter.GetLayerMap() )
|
||||
for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& entry : m_boardAdapter.GetLayerMap() )
|
||||
{
|
||||
PCB_LAYER_ID layer_id = entry.first;
|
||||
const PCB_LAYER_ID layer_id = entry.first;
|
||||
const BVH_CONTAINER_2D* container2d = entry.second;
|
||||
|
||||
// Only process layers that exist
|
||||
|
@ -130,7 +130,7 @@ void ConvertPolygonToTriangles( const SHAPE_POLY_SET& aPolyList, CONTAINER_2D_BA
|
||||
|
||||
for( unsigned int j = 0; j < aPolyList.TriangulatedPolyCount(); j++ )
|
||||
{
|
||||
auto triPoly = aPolyList.TriangulatedPolygon( j );
|
||||
const SHAPE_POLY_SET::TRIANGULATED_POLYGON* triPoly = aPolyList.TriangulatedPolygon( j );
|
||||
|
||||
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
|
||||
{
|
||||
|
@ -77,12 +77,10 @@ void BITMAP_BASE::ImportData( BITMAP_BASE* aItem )
|
||||
|
||||
bool BITMAP_BASE::ReadImageFile( wxInputStream& aInStream )
|
||||
{
|
||||
auto new_image = std::make_unique<wxImage>();
|
||||
std::unique_ptr<wxImage> new_image = std::make_unique<wxImage>();
|
||||
|
||||
if( !new_image->LoadFile( aInStream ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
delete m_image;
|
||||
m_image = new_image.release();
|
||||
|
@ -595,12 +595,13 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
|
||||
int currentIdx = -1;
|
||||
int delta = aEvt.ShiftDown() ? -1 : 1;
|
||||
|
||||
auto advance = [&]( int& idx )
|
||||
{
|
||||
// Wrap-around modulus
|
||||
int size = m_tabOrder.size();
|
||||
idx = ( ( idx + delta ) % size + size ) % size;
|
||||
};
|
||||
auto advance =
|
||||
[&]( int& idx )
|
||||
{
|
||||
// Wrap-around modulus
|
||||
int size = m_tabOrder.size();
|
||||
idx = ( ( idx + delta ) % size + size ) % size;
|
||||
};
|
||||
|
||||
for( size_t i = 0; i < m_tabOrder.size(); ++i )
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
|
||||
newSettings->SetName( themeName );
|
||||
newSettings->SetReadOnly( false );
|
||||
|
||||
for( auto layer : m_validLayers )
|
||||
for( int layer : m_validLayers )
|
||||
newSettings->SetColor( layer, m_currentSettings->GetColor( layer ) );
|
||||
|
||||
newSettings->SaveToFile( settingsMgr.GetPathForSettingsFile( newSettings ) );
|
||||
@ -367,7 +367,7 @@ bool PANEL_COLOR_SETTINGS::saveCurrentTheme( bool aValidate )
|
||||
|
||||
selected->SetOverrideSchItemColors( m_optOverrideColors->GetValue() );
|
||||
|
||||
for( auto layer : m_validLayers )
|
||||
for( int layer : m_validLayers )
|
||||
selected->SetColor( layer, m_currentSettings->GetColor( layer ) );
|
||||
|
||||
settingsMgr.SaveColorSettings( selected, m_colorNamespace );
|
||||
|
@ -538,7 +538,7 @@ void DS_DRAW_ITEM_LIST::Print( const RENDER_SETTINGS* aSettings )
|
||||
second_items.push_back( item );
|
||||
}
|
||||
|
||||
for( auto item : second_items )
|
||||
for( DS_DRAW_ITEM_BASE* item : second_items )
|
||||
item->PrintWsItem( aSettings );
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
|
||||
{
|
||||
delete m_socketServer;
|
||||
|
||||
for( auto socket : m_sockets )
|
||||
for( wxSocketBase* socket : m_sockets )
|
||||
{
|
||||
socket->Shutdown();
|
||||
socket->Destroy();
|
||||
|
@ -79,12 +79,14 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
|
||||
|
||||
if( aEnvVars )
|
||||
{
|
||||
for( auto& entry : *aEnvVars )
|
||||
for( const std::pair<const wxString, ENV_VAR_ITEM>& entry : *aEnvVars )
|
||||
{
|
||||
// Don't bother normalizing paths that don't exist or the user cannot read.
|
||||
if( !wxFileName::DirExists( entry.second.GetValue() )
|
||||
|| !wxFileName::IsDirReadable( entry.second.GetValue() ) )
|
||||
|| !wxFileName::IsDirReadable( entry.second.GetValue() ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
envPath.SetPath( entry.second.GetValue() );
|
||||
|
||||
@ -177,7 +179,7 @@ wxString ResolveFile( const wxString& aFileName, const ENV_VAR_MAP* aEnvVars,
|
||||
|
||||
if( aEnvVars )
|
||||
{
|
||||
for( auto& entry : *aEnvVars )
|
||||
for( const std::pair<const wxString, ENV_VAR_ITEM>& entry : *aEnvVars )
|
||||
{
|
||||
wxFileName fn( createFilePath( entry.second.GetValue(), aFileName ) );
|
||||
|
||||
|
@ -47,7 +47,7 @@ static const ENV_VAR::ENV_VAR_LIST predefinedEnvVars = {
|
||||
|
||||
bool ENV_VAR::IsEnvVarImmutable( const wxString& aEnvVar )
|
||||
{
|
||||
for( const auto& s : predefinedEnvVars )
|
||||
for( const wxString& s : predefinedEnvVars )
|
||||
{
|
||||
if( s == aEnvVar )
|
||||
return true;
|
||||
|
@ -70,8 +70,8 @@ GRID_TRICKS::GRID_TRICKS( WX_GRID* aGrid ):
|
||||
|
||||
bool GRID_TRICKS::toggleCell( int aRow, int aCol, bool aPreserveSelection )
|
||||
{
|
||||
auto renderer = m_grid->GetCellRenderer( aRow, aCol );
|
||||
bool isCheckbox = ( dynamic_cast<wxGridCellBoolRenderer*>( renderer ) != nullptr );
|
||||
wxGridCellRenderer* renderer = m_grid->GetCellRenderer( aRow, aCol );
|
||||
bool isCheckbox = ( dynamic_cast<wxGridCellBoolRenderer*>( renderer ) );
|
||||
renderer->DecRef();
|
||||
|
||||
if( isCheckbox )
|
||||
|
@ -69,7 +69,7 @@ const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
|
||||
|
||||
void ORIGIN_VIEWITEM::ViewDraw( int, VIEW* aView ) const
|
||||
{
|
||||
auto gal = aView->GetGAL();
|
||||
GAL* gal = aView->GetGAL();
|
||||
|
||||
// Nothing to do if the target shouldn't be drawn at 0,0 and that's where the target is.
|
||||
if( !m_drawAtZero && ( m_position.x == 0 ) && ( m_position.y == 0 ) )
|
||||
|
@ -198,7 +198,7 @@ const wxString PROJECT::GetSheetName( const KIID& aSheetID )
|
||||
{
|
||||
if( m_sheetNames.empty() )
|
||||
{
|
||||
for( auto pair : GetProjectFile().GetSheets() )
|
||||
for( const std::pair<KIID, wxString>& pair : GetProjectFile().GetSheets() )
|
||||
m_sheetNames[pair.first] = pair.second;
|
||||
}
|
||||
|
||||
@ -214,13 +214,9 @@ void PROJECT::SetRString( RSTRING_T aIndex, const wxString& aString )
|
||||
unsigned ndx = unsigned( aIndex );
|
||||
|
||||
if( ndx < arrayDim( m_rstrings ) )
|
||||
{
|
||||
m_rstrings[ndx] = aString;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT( 0 ); // bad index
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -247,9 +243,7 @@ PROJECT::_ELEM* PROJECT::GetElem( ELEM_T aIndex )
|
||||
{
|
||||
// This is virtual, so implement it out of line
|
||||
if( unsigned( aIndex ) < arrayDim( m_elems ) )
|
||||
{
|
||||
return m_elems[aIndex];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector<wxString>* aPaths )
|
||||
|
||||
std::set<wxString> checkedPaths;
|
||||
|
||||
for( auto base_path : base_paths )
|
||||
for( const wxFileName& base_path : base_paths )
|
||||
{
|
||||
if( checkedPaths.count( base_path.GetFullPath() ) )
|
||||
continue;
|
||||
|
@ -202,7 +202,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
|
||||
}
|
||||
else if( !global.empty() )
|
||||
{
|
||||
for( auto act : global )
|
||||
for( const TOOL_ACTION* act : global )
|
||||
{
|
||||
bool runAction = true;
|
||||
|
||||
|
@ -60,7 +60,7 @@ ACTION_MENU::ACTION_MENU( bool isContextMenu, TOOL_INTERACTIVE* aTool ) :
|
||||
ACTION_MENU::~ACTION_MENU()
|
||||
{
|
||||
// Set parent to NULL to prevent submenus from unregistering from a nonexistent object
|
||||
for( auto menu : m_submenus )
|
||||
for( ACTION_MENU* menu : m_submenus )
|
||||
menu->SetParent( nullptr );
|
||||
|
||||
ACTION_MENU* parent = dynamic_cast<ACTION_MENU*>( GetParent() );
|
||||
|
@ -122,7 +122,7 @@ EDA_RECT SELECTION::GetBoundingBox() const
|
||||
|
||||
bool SELECTION::HasType( KICAD_T aType ) const
|
||||
{
|
||||
for( auto item : m_items )
|
||||
for( const EDA_ITEM* item : m_items )
|
||||
{
|
||||
if( item->Type() == aType )
|
||||
return true;
|
||||
@ -136,7 +136,7 @@ size_t SELECTION::CountType( KICAD_T aType ) const
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
for( EDA_ITEM* item : m_items )
|
||||
for( const EDA_ITEM* item : m_items )
|
||||
{
|
||||
if( item->Type() == aType )
|
||||
count++;
|
||||
@ -150,7 +150,7 @@ const std::vector<KIGFX::VIEW_ITEM*> SELECTION::updateDrawList() const
|
||||
{
|
||||
std::vector<VIEW_ITEM*> items;
|
||||
|
||||
for( auto item : m_items )
|
||||
for( EDA_ITEM* item : m_items )
|
||||
items.push_back( item );
|
||||
|
||||
return items;
|
||||
|
@ -871,7 +871,7 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
|
||||
m_menuCursor = m_viewControls->GetCursorPosition();
|
||||
|
||||
// Save all tools cursor settings, as they will be overridden
|
||||
for( auto idState : m_toolIdIndex )
|
||||
for( const std::pair<const TOOL_ID, TOOL_STATE*>& idState : m_toolIdIndex )
|
||||
{
|
||||
TOOL_STATE* s = idState.second;
|
||||
const auto& vc = s->vcSettings;
|
||||
@ -916,7 +916,7 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
|
||||
m_menuOwner = -1;
|
||||
|
||||
// Restore cursor settings
|
||||
for( auto const& cursorSetting : m_cursorSettings )
|
||||
for( const std::pair<const TOOL_ID, OPT<VECTOR2D>>& cursorSetting : m_cursorSettings )
|
||||
{
|
||||
auto it = m_toolIdIndex.find( cursorSetting.first );
|
||||
wxASSERT( it != m_toolIdIndex.end() );
|
||||
|
@ -158,7 +158,8 @@ int CVPCB_ASSOCIATION_TOOL::PasteAssoc( const TOOL_EVENT& aEvent )
|
||||
|
||||
// Assign the fpid to the selections
|
||||
bool firstAssoc = true;
|
||||
for( auto i : idx )
|
||||
|
||||
for( unsigned int i : idx )
|
||||
{
|
||||
m_frame->AssociateFootprint( CVPCB_ASSOCIATION( i, fpid ), firstAssoc );
|
||||
firstAssoc = false;
|
||||
@ -210,10 +211,9 @@ int CVPCB_ASSOCIATION_TOOL::Associate( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
// Get all the components that are selected and associate them with the current footprint
|
||||
std::vector<unsigned int> sel = m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS );
|
||||
|
||||
bool firstAssoc = true;
|
||||
for( auto i : sel )
|
||||
|
||||
for( unsigned int i : m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS ) )
|
||||
{
|
||||
CVPCB_ASSOCIATION newfp( i, fpid );
|
||||
m_frame->AssociateFootprint( newfp, firstAssoc );
|
||||
@ -237,12 +237,10 @@ int CVPCB_ASSOCIATION_TOOL::AutoAssociate( const TOOL_EVENT& aEvent )
|
||||
|
||||
int CVPCB_ASSOCIATION_TOOL::DeleteAssoc( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Get all the components that are selected
|
||||
std::vector<unsigned int> sel = m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS );
|
||||
|
||||
// Delete the association
|
||||
// Delete all the selected components' associations
|
||||
bool firstAssoc = true;
|
||||
for( auto i : sel )
|
||||
|
||||
for( unsigned int i : m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS ) )
|
||||
{
|
||||
m_frame->AssociateFootprint( CVPCB_ASSOCIATION( i, LIB_ID() ), firstAssoc );
|
||||
firstAssoc = false;
|
||||
@ -258,11 +256,10 @@ int CVPCB_ASSOCIATION_TOOL::DeleteAll( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Remove all selections to avoid issues when setting the fpids
|
||||
m_frame->SetSelectedComponent( -1, true );
|
||||
std::vector<unsigned int> idx =
|
||||
m_frame->GetComponentIndices( CVPCB_MAINFRAME::ALL_COMPONENTS );
|
||||
|
||||
bool firstAssoc = true;
|
||||
for( auto i : idx )
|
||||
|
||||
for( unsigned int i : m_frame->GetComponentIndices( CVPCB_MAINFRAME::ALL_COMPONENTS ) )
|
||||
{
|
||||
m_frame->AssociateFootprint( CVPCB_ASSOCIATION( i, LIB_ID() ), firstAssoc );
|
||||
firstAssoc = false;
|
||||
|
@ -832,7 +832,7 @@ void CONNECTION_GRAPH::resolveAllDrivers()
|
||||
return 0;
|
||||
|
||||
// Special processing for some items
|
||||
for( auto item : subgraph->m_items )
|
||||
for( SCH_ITEM* item : subgraph->m_items )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
@ -1237,7 +1237,7 @@ void CONNECTION_GRAPH::processSubGraphs()
|
||||
|
||||
wxString test_name = member->Name( true );
|
||||
|
||||
for( auto candidate : candidate_subgraphs )
|
||||
for( CONNECTION_SUBGRAPH* candidate : candidate_subgraphs )
|
||||
{
|
||||
if( candidate->m_absorbed )
|
||||
continue;
|
||||
@ -2425,7 +2425,7 @@ bool CONNECTION_GRAPH::ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSu
|
||||
SCH_ITEM* label = nullptr;
|
||||
SCH_ITEM* port = nullptr;
|
||||
|
||||
for( auto item : aSubgraph->m_items )
|
||||
for( SCH_ITEM* item : aSubgraph->m_items )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
|
||||
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
|
||||
for( EDA_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* candidate = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
|
@ -251,7 +251,7 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
|
||||
|
||||
for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
||||
{
|
||||
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
|
||||
for( EDA_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
symbol = dynamic_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user