mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-18 23:41:27 +00:00
Added a lot of consts and refactored a few lines
This commit is contained in:
parent
c16199c3f9
commit
e2aa7be4b3
3d-viewer/3d_rendering/legacy
common
bitmap_base.cppeda_text.cppfilename_resolver.cpp
gal/opengl
rc_item.cpptool
undo_redo_container.cppwidgets
cvpcb
eeschema
component_references_lister.cpp
dialogs
erc_settings.cpperc_settings.hlib_arc.cpplib_arc.hlib_bezier.cpplib_bezier.hlib_circle.cpplib_circle.hlib_field.cpplib_field.hlib_item.hlib_pin.cpplib_pin.hlib_polyline.cpplib_polyline.hlib_rectangle.cpplib_rectangle.hlib_symbol.cpplib_symbol.hlib_text.cpplib_text.hsch_bitmap.cppsch_bitmap.hsch_bus_entry.cppsch_bus_entry.hsch_edit_frame.cppsch_edit_frame.hsch_field.cppsch_field.hsch_item.cppsch_item.hsch_junction.cppsch_junction.hsch_line.cppsch_line.hsch_marker.hsch_no_connect.cppsch_no_connect.hsch_plugins/legacy
sch_reference_list.hsch_rtree.hsch_screen.cppsch_screen.hsch_sheet.cppsch_sheet.hsch_sheet_path.cppsch_sheet_path.hsch_sheet_pin.cppsch_symbol.cppsch_symbol.hsch_text.cppsch_text.hinclude
bitmap_base.hboard_item.heda_draw_frame.hfilename_resolver.hfootprint_info.hhashtables.hmultivector.hpcb_base_frame.hrc_item.h
tool
widgets
libs/kimath
pcb_calculator
pcbnew
@ -168,7 +168,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
|
||||
const SFVEC2F& rightStart = aSeg->GetRightStar();
|
||||
const SFVEC2F& rightEnd = aSeg->GetRightEnd();
|
||||
const SFVEC2F& rightDir = aSeg->GetRightDir();
|
||||
const float radius = aSeg->GetRadius();
|
||||
const float radius = aSeg->GetRadius();
|
||||
|
||||
const SFVEC2F& start = aSeg->GetStart();
|
||||
const SFVEC2F& end = aSeg->GetEnd();
|
||||
@ -176,7 +176,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
|
||||
const float texture_factor = ( 12.0f / (float) SIZE_OF_CIRCLE_TEXTURE ) + 1.0f;
|
||||
const float texture_factorF = ( 6.0f / (float) SIZE_OF_CIRCLE_TEXTURE ) + 1.0f;
|
||||
|
||||
const float radius_of_the_square = sqrtf( aSeg->GetRadiusSquared() * 2.0f );
|
||||
const float radius_of_the_square = sqrtf( aSeg->GetRadiusSquared() * 2.0f );
|
||||
const float radius_triangle_factor = ( radius_of_the_square - radius ) / radius;
|
||||
|
||||
const SFVEC2F factorS = SFVEC2F( -rightDir.y * radius * radius_triangle_factor,
|
||||
@ -255,11 +255,9 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateHoles( const LIST_OBJECT2D& aListH
|
||||
new TRIANGLE_DISPLAY_LIST( aListHolesObject2d.size() * 2 );
|
||||
|
||||
// Convert the list of objects(filled circles) to triangle layer structure
|
||||
for( LIST_OBJECT2D::const_iterator itemOnLayer = aListHolesObject2d.begin();
|
||||
itemOnLayer != aListHolesObject2d.end();
|
||||
++itemOnLayer )
|
||||
for( const OBJECT_2D* itemOnLayer : aListHolesObject2d )
|
||||
{
|
||||
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
|
||||
const OBJECT_2D* object2d_A = itemOnLayer;
|
||||
|
||||
wxASSERT( ( object2d_A->GetObjectType() == OBJECT_2D_TYPE::FILLED_CIRCLE )
|
||||
|| ( object2d_A->GetObjectType() == OBJECT_2D_TYPE::ROUNDSEG ) );
|
||||
@ -327,37 +325,35 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D*
|
||||
m_triangles.push_back( layerTriangles );
|
||||
|
||||
// Load the 2D (X,Y axis) component of shapes
|
||||
for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin();
|
||||
itemOnLayer != listObject2d.end();
|
||||
++itemOnLayer )
|
||||
for( const OBJECT_2D* itemOnLayer : listObject2d )
|
||||
{
|
||||
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
|
||||
const OBJECT_2D* object2d_A = itemOnLayer;
|
||||
|
||||
switch( object2d_A->GetObjectType() )
|
||||
{
|
||||
case OBJECT_2D_TYPE::FILLED_CIRCLE:
|
||||
addObjectTriangles( (const FILLED_CIRCLE_2D *)object2d_A, layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
addObjectTriangles( static_cast<const FILLED_CIRCLE_2D*>( object2d_A ),
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJECT_2D_TYPE::POLYGON4PT:
|
||||
addObjectTriangles( (const POLYGON_4PT_2D*)object2d_A, layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
addObjectTriangles( static_cast<const POLYGON_4PT_2D*>( object2d_A ),
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJECT_2D_TYPE::RING:
|
||||
addObjectTriangles( (const RING_2D*)object2d_A, layerTriangles, layer_z_top,
|
||||
layer_z_bot );
|
||||
addObjectTriangles( static_cast<const RING_2D*>( object2d_A ),
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJECT_2D_TYPE::TRIANGLE:
|
||||
addObjectTriangles( (const TRIANGLE_2D*)object2d_A, layerTriangles, layer_z_top,
|
||||
layer_z_bot );
|
||||
addObjectTriangles( static_cast<const TRIANGLE_2D*>( object2d_A ),
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
case OBJECT_2D_TYPE::ROUNDSEG:
|
||||
addObjectTriangles( (const ROUND_SEGMENT_2D*) object2d_A, layerTriangles,
|
||||
layer_z_top, layer_z_bot );
|
||||
addObjectTriangles( static_cast<const ROUND_SEGMENT_2D*>( object2d_A ),
|
||||
layerTriangles, layer_z_top, layer_z_bot );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -366,7 +362,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D*
|
||||
}
|
||||
}
|
||||
|
||||
if( aPolyList &&aPolyList->OutlineCount() > 0 )
|
||||
if( aPolyList && aPolyList->OutlineCount() > 0 )
|
||||
{
|
||||
layerTriangles->AddToMiddleContourns( *aPolyList, layer_z_bot, layer_z_top,
|
||||
m_boardAdapter.BiuTo3dUnits(), false, aThroughHoles );
|
||||
@ -401,15 +397,13 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::createBoard( const SHAPE_POLY_SET& aBoardP
|
||||
new TRIANGLE_DISPLAY_LIST( listBoardObject2d.size() );
|
||||
|
||||
// Convert the list of objects(triangles) to triangle layer structure
|
||||
for( LIST_OBJECT2D::const_iterator itemOnLayer = listBoardObject2d.begin();
|
||||
itemOnLayer != listBoardObject2d.end();
|
||||
++itemOnLayer )
|
||||
for( const OBJECT_2D* itemOnLayer : listBoardObject2d )
|
||||
{
|
||||
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
|
||||
const OBJECT_2D* object2d_A = itemOnLayer;
|
||||
|
||||
wxASSERT( object2d_A->GetObjectType() == OBJECT_2D_TYPE::TRIANGLE );
|
||||
|
||||
const TRIANGLE_2D* tri = (const TRIANGLE_2D *)object2d_A;
|
||||
const TRIANGLE_2D* tri = static_cast<const TRIANGLE_2D*>( object2d_A );
|
||||
|
||||
const SFVEC2F& v1 = tri->GetP1();
|
||||
const SFVEC2F& v2 = tri->GetP2();
|
||||
@ -520,10 +514,10 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
float layer_z_bot = 0.0f;
|
||||
float layer_z_top = 0.0f;
|
||||
|
||||
for( MAP_POLY::const_iterator ii = outerMapHoles.begin(); ii != outerMapHoles.end(); ++ii )
|
||||
for( const auto ii : outerMapHoles )
|
||||
{
|
||||
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
|
||||
const SHAPE_POLY_SET* poly = static_cast<const SHAPE_POLY_SET*>( ii->second );
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
const SHAPE_POLY_SET* poly = ii.second;
|
||||
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
|
||||
|
||||
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
|
||||
@ -532,10 +526,10 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
layer_z_top, layer_z_bot, false );
|
||||
}
|
||||
|
||||
for( MAP_POLY::const_iterator ii = innerMapHoles.begin(); ii != innerMapHoles.end(); ++ii )
|
||||
for( const auto ii : innerMapHoles )
|
||||
{
|
||||
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>( ii->first );
|
||||
const SHAPE_POLY_SET* poly = static_cast<const SHAPE_POLY_SET*>( ii->second );
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
const SHAPE_POLY_SET* poly = ii.second;
|
||||
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
|
||||
|
||||
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
|
||||
@ -554,16 +548,14 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
|
||||
|
||||
for( MAP_CONTAINER_2D_BASE::const_iterator ii = m_boardAdapter.GetLayerMap().begin();
|
||||
ii != m_boardAdapter.GetLayerMap().end();
|
||||
++ii )
|
||||
for( const auto ii : m_boardAdapter.GetLayerMap() )
|
||||
{
|
||||
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>( ii->first );
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
|
||||
if( !m_boardAdapter.Is3dLayerEnabled( layer_id ) )
|
||||
continue;
|
||||
|
||||
const BVH_CONTAINER_2D* container2d = static_cast<const BVH_CONTAINER_2D*>( ii->second );
|
||||
const BVH_CONTAINER_2D* container2d = ii.second;
|
||||
|
||||
SHAPE_POLY_SET polyListSubtracted;
|
||||
SHAPE_POLY_SET* aPolyList = nullptr;
|
||||
@ -601,7 +593,6 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,7 +721,7 @@ void RENDER_3D_LEGACY::generateCylinder( const SFVEC2F& aCenter, float aInnerRad
|
||||
|
||||
void RENDER_3D_LEGACY::generateViasAndPads()
|
||||
{
|
||||
if( m_boardAdapter.GetViaCount() )
|
||||
if( m_boardAdapter.GetViaCount() > 0 )
|
||||
{
|
||||
const unsigned int reserve_nr_triangles_estimation =
|
||||
m_boardAdapter.GetCircleSegmentCount(
|
||||
@ -743,11 +734,11 @@ void RENDER_3D_LEGACY::generateViasAndPads()
|
||||
// Insert plated vertical holes inside the board
|
||||
|
||||
// Insert vias holes (vertical cylinders)
|
||||
for( auto track : m_boardAdapter.GetBoard()->Tracks() )
|
||||
for( const TRACK* track : m_boardAdapter.GetBoard()->Tracks() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
const VIA* via = static_cast<const VIA*>(track);
|
||||
const VIA* via = static_cast<const VIA*>( track );
|
||||
|
||||
const float holediameter = via->GetDrillValue() * m_boardAdapter.BiuTo3dUnits();
|
||||
const float thickness = m_boardAdapter.GetCopperThickness();
|
||||
@ -789,7 +780,7 @@ void RENDER_3D_LEGACY::generateViasAndPads()
|
||||
// Insert pads holes (vertical cylinders)
|
||||
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
|
||||
{
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
for( const PAD* pad : footprint->Pads() )
|
||||
{
|
||||
if( pad->GetAttribute() != PAD_ATTRIB_NPTH )
|
||||
{
|
||||
@ -835,15 +826,13 @@ void RENDER_3D_LEGACY::generateViasAndPads()
|
||||
new TRIANGLE_DISPLAY_LIST( listHolesObject2d.size() );
|
||||
|
||||
// Convert the list of objects(triangles) to triangle layer structure
|
||||
for( LIST_OBJECT2D::const_iterator itemOnLayer = listHolesObject2d.begin();
|
||||
itemOnLayer != listHolesObject2d.end();
|
||||
++itemOnLayer )
|
||||
for( const OBJECT_2D* itemOnLayer : listHolesObject2d )
|
||||
{
|
||||
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
|
||||
const OBJECT_2D* object2d_A = itemOnLayer;
|
||||
|
||||
wxASSERT( object2d_A->GetObjectType() == OBJECT_2D_TYPE::TRIANGLE );
|
||||
|
||||
const TRIANGLE_2D* tri = (const TRIANGLE_2D *)object2d_A;
|
||||
const TRIANGLE_2D* tri = static_cast<const TRIANGLE_2D*>( object2d_A );
|
||||
|
||||
const SFVEC2F& v1 = tri->GetP1();
|
||||
const SFVEC2F& v2 = tri->GetP2();
|
||||
@ -880,7 +869,7 @@ void RENDER_3D_LEGACY::load3dModels( REPORTER* aStatusReporter )
|
||||
}
|
||||
|
||||
// Go for all footprints
|
||||
for( FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
|
||||
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
|
||||
{
|
||||
for( const FP_3DMODEL& model : footprint->Models() )
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
|
||||
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
|
||||
const wxPoint& aPos,
|
||||
COLOR4D aDefaultColor,
|
||||
int aDefaultPensize )
|
||||
int aDefaultPensize ) const
|
||||
{
|
||||
if( m_image == NULL )
|
||||
return;
|
||||
|
@ -70,7 +70,7 @@ EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify( int aHorizJustify )
|
||||
if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
|
||||
return GR_TEXT_HJUSTIFY_LEFT;
|
||||
|
||||
return (EDA_TEXT_HJUSTIFY_T) aHorizJustify;
|
||||
return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
|
||||
}
|
||||
|
||||
|
||||
@ -84,13 +84,13 @@ EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
|
||||
if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
|
||||
return GR_TEXT_VJUSTIFY_TOP;
|
||||
|
||||
return (EDA_TEXT_VJUSTIFY_T) aVertJustify;
|
||||
return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
||||
m_text( text ),
|
||||
m_e( 1<<TE_VISIBLE )
|
||||
m_e( 1 << TE_VISIBLE )
|
||||
{
|
||||
int sz = Mils2iu( DEFAULT_SIZE_TEXT );
|
||||
SetTextSize( wxSize( sz, sz ) );
|
||||
@ -510,9 +510,9 @@ bool EDA_TEXT::IsDefaultFormatting() const
|
||||
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
|
||||
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
|
||||
&& GetTextThickness() == 0
|
||||
&& !IsItalic()
|
||||
&& !IsBold()
|
||||
&& !IsMultilineAllowed()
|
||||
&& !IsItalic()
|
||||
&& !IsBold()
|
||||
&& !IsMultilineAllowed()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ bool FILENAME_RESOLVER::SetProject( PROJECT* aProject, bool* flgChanged )
|
||||
}
|
||||
|
||||
|
||||
wxString FILENAME_RESOLVER::GetProjectDir()
|
||||
wxString FILENAME_RESOLVER::GetProjectDir() const
|
||||
{
|
||||
return m_curProjDir;
|
||||
}
|
||||
@ -192,7 +192,7 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
lpath.m_Pathexp = fndummy.GetFullPath();
|
||||
}
|
||||
|
||||
lpath.m_Alias = curr_path;
|
||||
lpath.m_Alias = curr_path;
|
||||
lpath.m_Pathvar = curr_path;
|
||||
|
||||
if( !lpath.m_Pathexp.empty() && psep == *lpath.m_Pathexp.rbegin() )
|
||||
@ -224,17 +224,15 @@ bool FILENAME_RESOLVER::createPathList()
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::UpdatePathList( std::vector< SEARCH_PATH >& aPathList )
|
||||
bool FILENAME_RESOLVER::UpdatePathList( const std::vector< SEARCH_PATH >& aPathList )
|
||||
{
|
||||
wxUniChar envMarker( '$' );
|
||||
|
||||
while( !m_paths.empty() && envMarker != *m_paths.back().m_Alias.rbegin() )
|
||||
m_paths.pop_back();
|
||||
|
||||
size_t nI = aPathList.size();
|
||||
|
||||
for( size_t i = 0; i < nI; ++i )
|
||||
addPath( aPathList[i] );
|
||||
for( const SEARCH_PATH& path : aPathList )
|
||||
addPath( path );
|
||||
|
||||
return writePathList();
|
||||
}
|
||||
@ -471,7 +469,6 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString pname = path.GetPath();
|
||||
std::list< SEARCH_PATH >::iterator sPL = m_paths.begin();
|
||||
std::list< SEARCH_PATH >::iterator ePL = m_paths.end();
|
||||
|
||||
@ -822,14 +819,14 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
||||
|
||||
|
||||
|
||||
const std::list< SEARCH_PATH >* FILENAME_RESOLVER::GetPaths()
|
||||
const std::list< SEARCH_PATH >* FILENAME_RESOLVER::GetPaths() const
|
||||
{
|
||||
return &m_paths;
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
|
||||
wxString& anAlias, wxString& aRelPath )
|
||||
wxString& anAlias, wxString& aRelPath ) const
|
||||
{
|
||||
anAlias.clear();
|
||||
aRelPath.clear();
|
||||
@ -839,7 +836,7 @@ bool FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
|
||||
|
||||
size_t tagpos = aFileName.find( wxT( ":" ), 1 );
|
||||
|
||||
if( wxString::npos == tagpos || 1 == tagpos )
|
||||
if( wxString::npos == tagpos || 1 == tagpos )
|
||||
return false;
|
||||
|
||||
if( tagpos + 1 >= aFileName.length() )
|
||||
@ -947,7 +944,7 @@ static bool getHollerith( const std::string& aString, size_t& aIndex, wxString&
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
||||
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) const
|
||||
{
|
||||
// Rules:
|
||||
// 1. The generic form of an aliased 3D relative path is:
|
||||
@ -1005,7 +1002,7 @@ bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAl
|
||||
}
|
||||
|
||||
|
||||
bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
|
||||
bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths ) const
|
||||
{
|
||||
paths.clear();
|
||||
|
||||
|
@ -111,8 +111,8 @@ private:
|
||||
|
||||
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
|
||||
{
|
||||
for( auto b = m_bitmaps.begin(); b != m_bitmaps.end(); ++b )
|
||||
glDeleteTextures( 1, &b->second.id );
|
||||
for( auto& bitmap : m_bitmaps )
|
||||
glDeleteTextures( 1, &bitmap.second.id );
|
||||
}
|
||||
|
||||
|
||||
|
@ -412,7 +412,7 @@ bool RC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
|
||||
}
|
||||
|
||||
|
||||
void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode )
|
||||
void RC_TREE_MODEL::ValueChanged( const RC_TREE_NODE* aNode )
|
||||
{
|
||||
if( aNode->m_Type == RC_TREE_NODE::MAIN_ITEM || aNode->m_Type == RC_TREE_NODE::AUX_ITEM )
|
||||
{
|
||||
@ -423,7 +423,7 @@ void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode )
|
||||
{
|
||||
wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
|
||||
|
||||
for( RC_TREE_NODE* child : aNode->m_Children )
|
||||
for( const RC_TREE_NODE* child : aNode->m_Children )
|
||||
wxDataViewModel::ValueChanged( ToItem( child ), 0 );
|
||||
}
|
||||
}
|
||||
@ -437,7 +437,7 @@ void RC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
|
||||
|
||||
void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep )
|
||||
{
|
||||
RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
|
||||
RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
|
||||
const std::shared_ptr<RC_ITEM> current_item = current_node ? current_node->m_RcItem : nullptr;
|
||||
|
||||
/// Keep a vector of elements to free after wxWidgets is definitely done accessing them
|
||||
|
@ -293,7 +293,7 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
|
||||
}
|
||||
|
||||
|
||||
VECTOR2D TOOL_MANAGER::GetMousePosition()
|
||||
VECTOR2D TOOL_MANAGER::GetMousePosition() const
|
||||
{
|
||||
if( m_viewControls )
|
||||
return m_viewControls->GetMousePosition();
|
||||
@ -302,7 +302,7 @@ VECTOR2D TOOL_MANAGER::GetMousePosition()
|
||||
}
|
||||
|
||||
|
||||
VECTOR2D TOOL_MANAGER::GetCursorPosition()
|
||||
VECTOR2D TOOL_MANAGER::GetCursorPosition() const
|
||||
{
|
||||
if( m_viewControls )
|
||||
return m_viewControls->GetCursorPosition();
|
||||
@ -361,13 +361,13 @@ void TOOL_MANAGER::PrimeTool( const VECTOR2D& aPosition )
|
||||
}
|
||||
|
||||
|
||||
const std::map<std::string, TOOL_ACTION*>& TOOL_MANAGER::GetActions()
|
||||
const std::map<std::string, TOOL_ACTION*>& TOOL_MANAGER::GetActions() const
|
||||
{
|
||||
return m_actionMgr->GetActions();
|
||||
}
|
||||
|
||||
|
||||
int TOOL_MANAGER::GetHotKey( const TOOL_ACTION& aAction )
|
||||
int TOOL_MANAGER::GetHotKey( const TOOL_ACTION& aAction ) const
|
||||
{
|
||||
return m_actionMgr->GetHotKey( aAction );
|
||||
}
|
||||
@ -475,7 +475,7 @@ void TOOL_MANAGER::ShutdownTool( TOOL_BASE* aTool )
|
||||
|
||||
if( isActive( aTool ) )
|
||||
{
|
||||
auto it = std::find( m_activeTools.begin(), m_activeTools.end(), id );
|
||||
TOOL_MANAGER::ID_LIST::iterator it = std::find( m_activeTools.begin(), m_activeTools.end(), id );
|
||||
|
||||
TOOL_STATE* st = m_toolIdIndex[*it];
|
||||
|
||||
@ -644,7 +644,7 @@ TOOL_EVENT* TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool, const TOOL_EVENT_LIST&
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||
bool TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
|
||||
{
|
||||
bool handled = false;
|
||||
|
||||
@ -676,7 +676,7 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||
if( st && st->cofunc && st->pendingWait && st->waitEvents.Matches( aEvent ) )
|
||||
{
|
||||
if( !aEvent.FirstResponder() )
|
||||
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
|
||||
aEvent.SetFirstResponder( st->theTool );
|
||||
|
||||
// got matching event? clear wait list and wake up the coroutine
|
||||
st->wakeupEvent = aEvent;
|
||||
@ -711,7 +711,7 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||
++it;
|
||||
}
|
||||
|
||||
for( auto& state : m_toolState )
|
||||
for( const auto& state : m_toolState )
|
||||
{
|
||||
TOOL_STATE* st = state.second;
|
||||
bool finished = false;
|
||||
@ -720,14 +720,14 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
||||
// Go() method that match the event.
|
||||
if( !st->transitions.empty() )
|
||||
{
|
||||
for( TRANSITION& tr : st->transitions )
|
||||
for( const TRANSITION& tr : st->transitions )
|
||||
{
|
||||
if( tr.first.Matches( aEvent ) )
|
||||
{
|
||||
auto func_copy = tr.second;
|
||||
|
||||
if( !aEvent.FirstResponder() )
|
||||
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
|
||||
aEvent.SetFirstResponder( st->theTool );
|
||||
|
||||
// if there is already a context, then push it on the stack
|
||||
// and transfer the previous view control settings to the new context
|
||||
@ -1040,7 +1040,7 @@ void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KIGFX::VIEW* aView,
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::isActive( TOOL_BASE* aTool )
|
||||
bool TOOL_MANAGER::isActive( TOOL_BASE* aTool ) const
|
||||
{
|
||||
if( !isRegistered( aTool ) )
|
||||
return false;
|
||||
@ -1090,7 +1090,7 @@ void TOOL_MANAGER::saveViewControls( TOOL_STATE* aState )
|
||||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::applyViewControls( TOOL_STATE* aState )
|
||||
void TOOL_MANAGER::applyViewControls( const TOOL_STATE* aState )
|
||||
{
|
||||
m_viewControls->ApplySettings( aState->vcSettings );
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ ITEM_PICKER PICKED_ITEMS_LIST::PopItem()
|
||||
|
||||
bool PICKED_ITEMS_LIST::ContainsItem( const EDA_ITEM* aItem ) const
|
||||
{
|
||||
for( size_t i = 0; i < m_ItemsList.size(); i++ )
|
||||
for( const ITEM_PICKER& picker : m_ItemsList )
|
||||
{
|
||||
if( m_ItemsList[ i ].GetItem() == aItem )
|
||||
if( picker.GetItem() == aItem )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ mpLayer::mpLayer() : m_type( mpLAYER_UNDEF )
|
||||
}
|
||||
|
||||
|
||||
wxBitmap mpLayer::GetColourSquare( int side )
|
||||
wxBitmap mpLayer::GetColourSquare( int side ) const
|
||||
{
|
||||
wxBitmap square( side, side, -1 );
|
||||
wxColour filler = m_pen.GetColour();
|
||||
@ -193,13 +193,13 @@ void mpInfoLayer::Plot( wxDC& dc, mpWindow& w )
|
||||
}
|
||||
|
||||
|
||||
wxPoint mpInfoLayer::GetPosition()
|
||||
wxPoint mpInfoLayer::GetPosition() const
|
||||
{
|
||||
return m_dim.GetPosition();
|
||||
}
|
||||
|
||||
|
||||
wxSize mpInfoLayer::GetSize()
|
||||
wxSize mpInfoLayer::GetSize() const
|
||||
{
|
||||
return m_dim.GetSize();
|
||||
}
|
||||
@ -963,11 +963,11 @@ mpScaleBase::mpScaleBase()
|
||||
}
|
||||
|
||||
#if 0
|
||||
int mpScaleBase::getLabelDecimalDigits( int maxDigits )
|
||||
int mpScaleBase::getLabelDecimalDigits( int maxDigits ) const
|
||||
{
|
||||
int m = 0;
|
||||
|
||||
for( auto l : m_tickLabels )
|
||||
for( const TickLabel& l : m_tickLabels )
|
||||
{
|
||||
int k = countDecimalDigits( l.pos );
|
||||
m = std::max( k, m );
|
||||
@ -975,9 +975,7 @@ int mpScaleBase::getLabelDecimalDigits( int maxDigits )
|
||||
|
||||
return std::min( m, maxDigits );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif // 0
|
||||
|
||||
void mpScaleBase::computeLabelExtents( wxDC& dc, mpWindow& w )
|
||||
{
|
||||
@ -1069,9 +1067,8 @@ double mpScaleX::getLabelPos( int n )
|
||||
{
|
||||
return 0; // return m_labeledTicks[n];
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
|
||||
#endif
|
||||
void mpScaleY::getVisibleDataRange( mpWindow& w, double& minV, double& maxV )
|
||||
{
|
||||
wxCoord minYpx = m_drawOutsideMargins ? 0 : w.GetMarginTop();
|
||||
@ -2035,7 +2032,7 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
|
||||
yMin -= yExtra;
|
||||
yMax += yExtra;
|
||||
|
||||
if( printSizeX!=NULL && printSizeY!=NULL )
|
||||
if( printSizeX != NULL && printSizeY != NULL )
|
||||
{
|
||||
// Printer:
|
||||
m_scrX = *printSizeX;
|
||||
@ -2052,8 +2049,8 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
|
||||
Ax = xMax - xMin;
|
||||
Ay = yMax - yMin;
|
||||
|
||||
m_scaleX = (Ax!=0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax!=0) ? m_scrX/Ax : 1;
|
||||
m_scaleY = (Ay!=0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay!=0) ? m_scrY/Ay : 1;
|
||||
m_scaleX = (Ax != 0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax != 0) ? m_scrX / Ax : 1;
|
||||
m_scaleY = (Ay != 0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay != 0) ? m_scrY / Ay : 1;
|
||||
|
||||
if( m_lockaspect )
|
||||
{
|
||||
@ -2076,7 +2073,7 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
|
||||
|
||||
// It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!!
|
||||
// Otherwise, the DC dimensions will be those of the window instead of the printer device
|
||||
if( printSizeX==NULL || printSizeY==NULL )
|
||||
if( printSizeX == NULL || printSizeY == NULL )
|
||||
UpdateAll();
|
||||
}
|
||||
|
||||
@ -2495,7 +2492,7 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
|
||||
// J.L.Blanco @ Aug 2007: Added double buffer support
|
||||
if( m_enableDoubleBuffer )
|
||||
{
|
||||
if( m_last_lx!=m_scrX || m_last_ly!=m_scrY )
|
||||
if( m_last_lx != m_scrX || m_last_ly != m_scrY )
|
||||
{
|
||||
if( m_buff_bmp )
|
||||
delete m_buff_bmp;
|
||||
@ -2921,7 +2918,7 @@ void mpWindow::OnScrollBottom( wxScrollWinEvent& event )
|
||||
|
||||
void mpWindow::SetScaleX( double scaleX )
|
||||
{
|
||||
if( scaleX!=0 )
|
||||
if( scaleX != 0 )
|
||||
m_scaleX = scaleX;
|
||||
|
||||
UpdateAll();
|
||||
@ -2930,25 +2927,21 @@ void mpWindow::SetScaleX( double scaleX )
|
||||
|
||||
// New methods implemented by Davide Rondini
|
||||
|
||||
unsigned int mpWindow::CountLayers()
|
||||
unsigned int mpWindow::CountLayers() const
|
||||
{
|
||||
// wxNode *node = m_layers.GetFirst();
|
||||
unsigned int layerNo = 0;
|
||||
|
||||
for( wxLayerList::iterator li = m_layers.begin(); li != m_layers.end(); li++ ) // while(node)
|
||||
for( const mpLayer* layer : m_layers )
|
||||
{
|
||||
if( (*li)->HasBBox() )
|
||||
if( layer->HasBBox() )
|
||||
layerNo++;
|
||||
|
||||
// node = node->GetNext();
|
||||
}
|
||||
|
||||
;
|
||||
return layerNo;
|
||||
}
|
||||
|
||||
|
||||
mpLayer* mpWindow::GetLayer( int position )
|
||||
mpLayer* mpWindow::GetLayer( int position ) const
|
||||
{
|
||||
if( ( position >= (int) m_layers.size() ) || position < 0 )
|
||||
return NULL;
|
||||
@ -2957,18 +2950,17 @@ mpLayer* mpWindow::GetLayer( int position )
|
||||
}
|
||||
|
||||
|
||||
mpLayer* mpWindow::GetLayerByName( const wxString& name )
|
||||
const mpLayer* mpWindow::GetLayerByName( const wxString& name ) const
|
||||
{
|
||||
for( wxLayerList::iterator it = m_layers.begin(); it!=m_layers.end(); it++ )
|
||||
if( !(*it)->GetName().Cmp( name ) )
|
||||
return *it;
|
||||
|
||||
for( const mpLayer* layer : m_layers )
|
||||
if( !layer->GetName().Cmp( name ) )
|
||||
return layer;
|
||||
|
||||
return NULL; // Not found
|
||||
}
|
||||
|
||||
|
||||
void mpWindow::GetBoundingBox( double* bbox )
|
||||
void mpWindow::GetBoundingBox( double* bbox ) const
|
||||
{
|
||||
bbox[0] = m_minX;
|
||||
bbox[1] = m_maxX;
|
||||
@ -3016,10 +3008,8 @@ bool mpWindow::SaveScreenshot( const wxString& filename, wxBitmapType type,
|
||||
}
|
||||
|
||||
// Draw all the layers:
|
||||
wxLayerList::iterator li;
|
||||
|
||||
for( li = m_layers.begin(); li != m_layers.end(); li++ )
|
||||
(*li)->Plot( screenDC, *this );
|
||||
for( mpLayer* layer : m_layers )
|
||||
layer->Plot( screenDC, *this );
|
||||
|
||||
if( imageSize != wxDefaultSize )
|
||||
{
|
||||
@ -3037,22 +3027,20 @@ bool mpWindow::SaveScreenshot( const wxString& filename, wxBitmapType type,
|
||||
|
||||
void mpWindow::SetMargins( int top, int right, int bottom, int left )
|
||||
{
|
||||
m_marginTop = top;
|
||||
m_marginRight = right;
|
||||
m_marginBottom = bottom;
|
||||
m_marginLeft = left;
|
||||
m_marginTop = top;
|
||||
m_marginRight = right;
|
||||
m_marginBottom = bottom;
|
||||
m_marginLeft = left;
|
||||
}
|
||||
|
||||
|
||||
mpInfoLayer* mpWindow::IsInsideInfoLayer( wxPoint& point )
|
||||
{
|
||||
wxLayerList::iterator li;
|
||||
|
||||
for( li = m_layers.begin(); li != m_layers.end(); li++ )
|
||||
for( mpLayer* layer : m_layers )
|
||||
{
|
||||
if( (*li)->IsInfo() )
|
||||
if( layer->IsInfo() )
|
||||
{
|
||||
mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
|
||||
mpInfoLayer* tmpLyr = static_cast<mpInfoLayer*>( layer );
|
||||
|
||||
if( tmpLyr->Inside( point ) )
|
||||
{
|
||||
@ -3077,11 +3065,11 @@ void mpWindow::SetLayerVisible( const wxString& name, bool viewable )
|
||||
}
|
||||
|
||||
|
||||
bool mpWindow::IsLayerVisible( const wxString& name )
|
||||
bool mpWindow::IsLayerVisible( const wxString& name ) const
|
||||
{
|
||||
mpLayer* lx = GetLayerByName( name );
|
||||
const mpLayer* lx = GetLayerByName( name );
|
||||
|
||||
return (lx) ? lx->IsVisible() : false;
|
||||
return lx ? lx->IsVisible() : false;
|
||||
}
|
||||
|
||||
|
||||
@ -3097,7 +3085,7 @@ void mpWindow::SetLayerVisible( const unsigned int position, bool viewable )
|
||||
}
|
||||
|
||||
|
||||
bool mpWindow::IsLayerVisible( const unsigned int position )
|
||||
bool mpWindow::IsLayerVisible( unsigned int position ) const
|
||||
{
|
||||
mpLayer* lx = GetLayer( position );
|
||||
|
||||
@ -3114,23 +3102,22 @@ void mpWindow::SetColourTheme( const wxColour& bgColour,
|
||||
m_bgColour = bgColour;
|
||||
m_fgColour = drawColour;
|
||||
m_axColour = axesColour;
|
||||
// cycle between layers to set colours and properties to them
|
||||
wxLayerList::iterator li;
|
||||
|
||||
for( li = m_layers.begin(); li != m_layers.end(); li++ )
|
||||
// Cycle between layers to set colours and properties to them
|
||||
for( mpLayer* layer : m_layers )
|
||||
{
|
||||
if( (*li)->GetLayerType() == mpLAYER_AXIS )
|
||||
if( layer->GetLayerType() == mpLAYER_AXIS )
|
||||
{
|
||||
wxPen axisPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
|
||||
wxPen axisPen = layer->GetPen(); // Get the old pen to modify only colour, not style or width
|
||||
axisPen.SetColour( axesColour );
|
||||
(*li)->SetPen( axisPen );
|
||||
layer->SetPen( axisPen );
|
||||
}
|
||||
|
||||
if( (*li)->GetLayerType() == mpLAYER_INFO )
|
||||
if( layer->GetLayerType() == mpLAYER_INFO )
|
||||
{
|
||||
wxPen infoPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
|
||||
wxPen infoPen = layer->GetPen(); // Get the old pen to modify only colour, not style or width
|
||||
infoPen.SetColour( drawColour );
|
||||
(*li)->SetPen( infoPen );
|
||||
layer->SetPen( infoPen );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3203,31 +3190,31 @@ mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags
|
||||
}
|
||||
|
||||
|
||||
double mpScaleX::TransformToPlot( double x )
|
||||
double mpScaleX::TransformToPlot( double x ) const
|
||||
{
|
||||
return (x + m_offset) * m_scale;
|
||||
}
|
||||
|
||||
|
||||
double mpScaleX::TransformFromPlot( double xplot )
|
||||
double mpScaleX::TransformFromPlot( double xplot ) const
|
||||
{
|
||||
return xplot / m_scale - m_offset;
|
||||
}
|
||||
|
||||
|
||||
double mpScaleY::TransformToPlot( double x )
|
||||
double mpScaleY::TransformToPlot( double x ) const
|
||||
{
|
||||
return (x + m_offset) * m_scale;
|
||||
}
|
||||
|
||||
|
||||
double mpScaleY::TransformFromPlot( double xplot )
|
||||
double mpScaleY::TransformFromPlot( double xplot ) const
|
||||
{
|
||||
return xplot / m_scale - m_offset;
|
||||
}
|
||||
|
||||
|
||||
double mpScaleXLog::TransformToPlot( double x )
|
||||
double mpScaleXLog::TransformToPlot( double x ) const
|
||||
{
|
||||
double xlogmin = log10( m_minV );
|
||||
double xlogmax = log10( m_maxV );
|
||||
@ -3236,7 +3223,7 @@ double mpScaleXLog::TransformToPlot( double x )
|
||||
}
|
||||
|
||||
|
||||
double mpScaleXLog::TransformFromPlot( double xplot )
|
||||
double mpScaleXLog::TransformFromPlot( double xplot ) const
|
||||
{
|
||||
double xlogmin = log10( m_minV );
|
||||
double xlogmax = log10( m_maxV );
|
||||
@ -3253,14 +3240,14 @@ mpFSemiLogXVector::mpFSemiLogXVector( wxString name, int flags ) :
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( mpFSemiLogXVector, mpFXYVector )
|
||||
#endif
|
||||
#endif // 0
|
||||
|
||||
void mpFXYVector::Rewind()
|
||||
{
|
||||
m_index = 0;
|
||||
}
|
||||
|
||||
size_t mpFXYVector::GetCount()
|
||||
size_t mpFXYVector::GetCount() const
|
||||
{
|
||||
return m_xs.size();
|
||||
}
|
||||
@ -3299,31 +3286,29 @@ void mpFXYVector::SetData( const std::vector<double>& xs, const std::vector<doub
|
||||
m_ys = ys;
|
||||
|
||||
// Update internal variables for the bounding box.
|
||||
if( xs.size()>0 )
|
||||
if( xs.size() > 0 )
|
||||
{
|
||||
m_minX = xs[0];
|
||||
m_maxX = xs[0];
|
||||
m_minY = ys[0];
|
||||
m_maxY = ys[0];
|
||||
|
||||
std::vector<double>::const_iterator it;
|
||||
|
||||
for( it = xs.begin(); it!=xs.end(); it++ )
|
||||
for( const double x : xs )
|
||||
{
|
||||
if( *it<m_minX )
|
||||
m_minX = *it;
|
||||
if( x < m_minX )
|
||||
m_minX = x;
|
||||
|
||||
if( *it>m_maxX )
|
||||
m_maxX = *it;
|
||||
if( x > m_maxX )
|
||||
m_maxX = x;
|
||||
}
|
||||
|
||||
for( it = ys.begin(); it!=ys.end(); it++ )
|
||||
for( const double y : ys )
|
||||
{
|
||||
if( *it<m_minY )
|
||||
m_minY = *it;
|
||||
if( y < m_minY )
|
||||
m_minY = y;
|
||||
|
||||
if( *it>m_maxY )
|
||||
m_maxY = *it;
|
||||
if( y > m_maxY )
|
||||
m_maxY = y;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3490,7 +3475,7 @@ void mpMovableObject::TranslatePoint( double x, double y, double& out_x, double&
|
||||
void mpMovableObject::ShapeUpdated()
|
||||
{
|
||||
// Just in case...
|
||||
if( m_shape_xs.size()!=m_shape_ys.size() )
|
||||
if( m_shape_xs.size() != m_shape_ys.size() )
|
||||
{
|
||||
}
|
||||
else
|
||||
@ -3569,7 +3554,7 @@ void mpMovableObject::Plot( wxDC& dc, mpWindow& w )
|
||||
wxCoord cx0 = 0, cy0 = 0;
|
||||
bool first = true;
|
||||
|
||||
while( itX!=m_trans_shape_xs.end() )
|
||||
while( itX != m_trans_shape_xs.end() )
|
||||
{
|
||||
wxCoord cx = w.x2p( *(itX++) );
|
||||
wxCoord cy = w.y2p( *(itY++) );
|
||||
@ -3644,13 +3629,13 @@ void mpCovarianceEllipse::RecalculateShape()
|
||||
m_shape_ys.clear();
|
||||
|
||||
// Preliminary checks:
|
||||
if( m_quantiles<0 )
|
||||
if( m_quantiles < 0 )
|
||||
return;
|
||||
|
||||
if( m_cov_00<0 )
|
||||
if( m_cov_00 < 0 )
|
||||
return;
|
||||
|
||||
if( m_cov_11<0 )
|
||||
if( m_cov_11 < 0 )
|
||||
return;
|
||||
|
||||
m_shape_xs.resize( m_segments, 0 );
|
||||
@ -3659,11 +3644,11 @@ void mpCovarianceEllipse::RecalculateShape()
|
||||
// Compute the two eigenvalues of the covariance:
|
||||
// -------------------------------------------------
|
||||
double b = -m_cov_00 - m_cov_11;
|
||||
double c = m_cov_00 * m_cov_11 - m_cov_01 * m_cov_01;
|
||||
double c = m_cov_00 * m_cov_11 - m_cov_01 * m_cov_01;
|
||||
|
||||
double D = b * b - 4 * c;
|
||||
|
||||
if( D<0 )
|
||||
if( D < 0 )
|
||||
return;
|
||||
|
||||
double eigenVal0 = 0.5 * ( -b + sqrt( D ) );
|
||||
@ -3674,7 +3659,7 @@ void mpCovarianceEllipse::RecalculateShape()
|
||||
double eigenVec0_x, eigenVec0_y;
|
||||
double eigenVec1_x, eigenVec1_y;
|
||||
|
||||
if( fabs( eigenVal0 - m_cov_00 )>1e-6 )
|
||||
if( fabs( eigenVal0 - m_cov_00 ) > 1e-6 )
|
||||
{
|
||||
double k1x = m_cov_01 / ( eigenVal0 - m_cov_00 );
|
||||
eigenVec0_y = 1;
|
||||
@ -3687,7 +3672,7 @@ void mpCovarianceEllipse::RecalculateShape()
|
||||
eigenVec0_y = eigenVec0_x * k1y;
|
||||
}
|
||||
|
||||
if( fabs( eigenVal1 - m_cov_00 )>1e-6 )
|
||||
if( fabs( eigenVal1 - m_cov_00 ) > 1e-6 )
|
||||
{
|
||||
double k2x = m_cov_01 / ( eigenVal1 - m_cov_00 );
|
||||
eigenVec1_y = 1;
|
||||
@ -3726,7 +3711,7 @@ void mpCovarianceEllipse::RecalculateShape()
|
||||
double Aang = 6.283185308 / (m_segments - 1);
|
||||
int i;
|
||||
|
||||
for( i = 0, ang = 0; i<m_segments; i++, ang += Aang )
|
||||
for( i = 0, ang = 0; i < m_segments; i++, ang += Aang )
|
||||
{
|
||||
double ccos = cos( ang );
|
||||
double csin = sin( ang );
|
||||
@ -3746,12 +3731,12 @@ void mpPolygon::setPoints( const std::vector<double>& points_xs,
|
||||
const std::vector<double>& points_ys,
|
||||
bool closedShape )
|
||||
{
|
||||
if( points_xs.size()==points_ys.size() )
|
||||
if( points_xs.size() == points_ys.size() )
|
||||
{
|
||||
m_shape_xs = points_xs;
|
||||
m_shape_ys = points_ys;
|
||||
|
||||
if( closedShape && points_xs.size() )
|
||||
if( closedShape && !points_xs.empty() )
|
||||
{
|
||||
m_shape_xs.push_back( points_xs[0] );
|
||||
m_shape_ys.push_back( points_ys[0] );
|
||||
@ -3825,16 +3810,16 @@ void mpBitmapLayer::Plot( wxDC& dc, mpWindow& w )
|
||||
// The actual drawn rectangle (dx0,dy0)-(dx1,dy1) is (x0,y0)-(x1,y1) clipped:
|
||||
wxCoord dx0 = x0, dx1 = x1, dy0 = y0, dy1 = y1;
|
||||
|
||||
if( dx0<0 )
|
||||
if( dx0 < 0 )
|
||||
dx0 = -borderMarginX;
|
||||
|
||||
if( dy0<0 )
|
||||
if( dy0 < 0 )
|
||||
dy0 = -borderMarginY;
|
||||
|
||||
if( dx1>w.GetScrX() )
|
||||
if( dx1 > w.GetScrX() )
|
||||
dx1 = w.GetScrX() + borderMarginX;
|
||||
|
||||
if( dy1>w.GetScrY() )
|
||||
if( dy1 > w.GetScrY() )
|
||||
dy1 = w.GetScrY() + borderMarginY;
|
||||
|
||||
// For convenience, compute the width/height of the rectangle to be actually drawn:
|
||||
@ -3861,10 +3846,10 @@ void mpBitmapLayer::Plot( wxDC& dc, mpWindow& w )
|
||||
wxRect r( wxRect( offset_x, offset_y, b_width, b_height ) );
|
||||
|
||||
// Just for the case....
|
||||
if( r.x<0 )
|
||||
if( r.x < 0 )
|
||||
r.x = 0;
|
||||
|
||||
if( r.y<0 )
|
||||
if( r.y < 0 )
|
||||
r.y = 0;
|
||||
|
||||
if( r.width>m_bitmap.GetWidth() )
|
||||
|
@ -1058,7 +1058,7 @@ wxWindow* CVPCB_MAINFRAME::GetToolCanvas() const
|
||||
}
|
||||
|
||||
|
||||
CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl()
|
||||
CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl() const
|
||||
{
|
||||
if( m_libListBox->HasFocus() )
|
||||
return CVPCB_MAINFRAME::CONTROL_LIBRARY;
|
||||
@ -1071,7 +1071,7 @@ CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl()
|
||||
}
|
||||
|
||||
|
||||
wxControl* CVPCB_MAINFRAME::GetFocusedControlObject()
|
||||
wxControl* CVPCB_MAINFRAME::GetFocusedControlObject() const
|
||||
{
|
||||
if( m_libListBox->HasFocus() )
|
||||
return m_libListBox;
|
||||
|
@ -156,14 +156,14 @@ public:
|
||||
*
|
||||
* @return the contorl that currently has focus
|
||||
*/
|
||||
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl();
|
||||
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const;
|
||||
|
||||
/**
|
||||
* Get a pointer to the currently focused control
|
||||
*
|
||||
* @return the control that currently has focus
|
||||
*/
|
||||
wxControl* GetFocusedControlObject();
|
||||
wxControl* GetFocusedControlObject() const;
|
||||
|
||||
/**
|
||||
* Set the focus to a specific control.
|
||||
|
@ -142,11 +142,9 @@ bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
|
||||
}
|
||||
|
||||
|
||||
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit )
|
||||
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit ) const
|
||||
{
|
||||
int NumRef;
|
||||
|
||||
NumRef = flatList[aIndex].m_numRef;
|
||||
int NumRef = flatList[aIndex].m_numRef;
|
||||
|
||||
for( size_t ii = 0; ii < flatList.size(); ii++ )
|
||||
{
|
||||
@ -188,11 +186,11 @@ int SCH_REFERENCE_LIST::FindRef( const wxString& aRef ) const
|
||||
}
|
||||
|
||||
|
||||
void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId )
|
||||
void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId ) const
|
||||
{
|
||||
aIdList.clear();
|
||||
|
||||
for( SCH_REFERENCE& ref : flatList )
|
||||
for( const SCH_REFERENCE& ref : flatList )
|
||||
{
|
||||
if( flatList[aIndex].CompareRef( ref ) == 0 && ref.m_numRef >= aMinRefId )
|
||||
aIdList.push_back( ref.m_numRef );
|
||||
@ -210,11 +208,11 @@ void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList,
|
||||
}
|
||||
|
||||
|
||||
int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue )
|
||||
int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue ) const
|
||||
{
|
||||
int lastNumber = aMinValue;
|
||||
|
||||
for( SCH_REFERENCE& ref : flatList )
|
||||
for( const SCH_REFERENCE& ref : flatList )
|
||||
{
|
||||
// search only for the current reference prefix:
|
||||
if( flatList[aIndex].CompareRef( ref ) != 0 )
|
||||
|
@ -112,12 +112,8 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines(wxGrid& grid,
|
||||
return logicalLines;
|
||||
|
||||
wxArrayString physicalLines;
|
||||
for ( wxArrayString::const_iterator it = logicalLines.begin();
|
||||
it != logicalLines.end();
|
||||
++it )
|
||||
for ( const wxString& line : logicalLines )
|
||||
{
|
||||
const wxString& line = *it;
|
||||
|
||||
if ( dc.GetTextExtent(line).x > maxWidth )
|
||||
{
|
||||
// Line does not fit, break it up.
|
||||
|
@ -266,7 +266,7 @@ void ERC_SETTINGS::ResetPinMap()
|
||||
}
|
||||
|
||||
|
||||
void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER* )> aVisitor )
|
||||
void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER* )> aVisitor ) const
|
||||
{
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
||||
@ -279,16 +279,16 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER*
|
||||
if( firstTime )
|
||||
seenScreens.insert( sheetList[i].LastScreen() );
|
||||
|
||||
for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
|
||||
|
||||
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
|
||||
continue;
|
||||
|
||||
// Don't show non-specific markers more than once
|
||||
if( !firstTime &&
|
||||
!static_cast<ERC_ITEM*>( marker->GetRCItem().get() )->IsSheetSpecific() )
|
||||
!static_cast<const ERC_ITEM*>( marker->GetRCItem().get() )->IsSheetSpecific() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -323,14 +323,14 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::SetSeverities( int aSeverities )
|
||||
}
|
||||
|
||||
|
||||
int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity )
|
||||
int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity ) const
|
||||
{
|
||||
if( aSeverity < 0 )
|
||||
return m_filteredMarkers.size();
|
||||
|
||||
int count = 0;
|
||||
|
||||
ERC_SETTINGS& settings = m_schematic->ErcSettings();
|
||||
const ERC_SETTINGS& settings = m_schematic->ErcSettings();
|
||||
|
||||
visitMarkers(
|
||||
[&]( SCH_MARKER* aMarker )
|
||||
@ -350,7 +350,7 @@ int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity )
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ERC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetERCItem( int aIndex )
|
||||
std::shared_ptr<ERC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetERCItem( int aIndex ) const
|
||||
{
|
||||
SCH_MARKER* marker = m_filteredMarkers[ aIndex ];
|
||||
|
||||
@ -358,7 +358,7 @@ std::shared_ptr<ERC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetERCItem( int aIndex )
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<RC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetItem( int aIndex )
|
||||
std::shared_ptr<RC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetItem( int aIndex ) const
|
||||
{
|
||||
return GetERCItem( aIndex );
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ public:
|
||||
|
||||
void SetSeverities( int aSeverities ) override;
|
||||
|
||||
int GetCount( int aSeverity = -1 ) override;
|
||||
int GetCount( int aSeverity = -1 ) const override;
|
||||
|
||||
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) override;
|
||||
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
|
||||
|
||||
std::shared_ptr<ERC_ITEM> GetERCItem( int aIndex );
|
||||
std::shared_ptr<ERC_ITEM> GetERCItem( int aIndex ) const;
|
||||
|
||||
void DeleteItem( int aIndex, bool aDeep ) override;
|
||||
|
||||
@ -206,8 +206,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void visitMarkers( std::function<void( SCH_MARKER* )> aVisitor );
|
||||
void visitMarkers( std::function<void( SCH_MARKER* )> aVisitor ) const;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _ERC_SETTINGS_H
|
||||
|
@ -251,7 +251,7 @@ void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
||||
|
||||
|
||||
void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform )
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) override;
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
int GetWidth() const override { return m_Width; }
|
||||
void SetWidth( int aWidth ) override { m_Width = aWidth; }
|
||||
|
@ -160,7 +160,7 @@ void LIB_BEZIER::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
||||
|
||||
|
||||
void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform )
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != NULL );
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) override;
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
int GetWidth() const override { return m_Width; }
|
||||
void SetWidth( int aWidth ) override { m_Width = aWidth; }
|
||||
|
@ -163,7 +163,7 @@ void LIB_CIRCLE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
||||
|
||||
|
||||
void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform )
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) override;
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
int GetWidth() const override { return m_Width; }
|
||||
void SetWidth( int aWidth ) override { m_Width = aWidth; }
|
||||
|
@ -256,7 +256,7 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
|
||||
|
||||
|
||||
void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform )
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
if( GetText().IsEmpty() )
|
||||
return;
|
||||
@ -350,7 +350,7 @@ void LIB_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
}
|
||||
|
||||
|
||||
SCH_LAYER_ID LIB_FIELD::GetDefaultLayer()
|
||||
SCH_LAYER_ID LIB_FIELD::GetDefaultLayer() const
|
||||
{
|
||||
switch( m_id )
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
*/
|
||||
wxString GetFullText( int unit = 1 ) const;
|
||||
|
||||
SCH_LAYER_ID GetDefaultLayer();
|
||||
SCH_LAYER_ID GetDefaultLayer() const;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
|
||||
@ -184,7 +184,7 @@ public:
|
||||
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) override;
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
int GetWidth() const override { return GetTextThickness(); }
|
||||
void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
* @param aTransform The plot transform.
|
||||
*/
|
||||
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) = 0;
|
||||
const TRANSFORM& aTransform ) const = 0;
|
||||
|
||||
virtual int GetWidth() const = 0;
|
||||
virtual void SetWidth( int aWidth ) = 0;
|
||||
|
@ -510,7 +510,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo
|
||||
}
|
||||
|
||||
|
||||
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
|
||||
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) const
|
||||
{
|
||||
int MapX1, MapY1, x1, y1;
|
||||
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
|
||||
@ -639,8 +639,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
|
||||
}
|
||||
|
||||
|
||||
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, wxPoint& aPinPos, int aPinOrient, int aTextInside,
|
||||
bool aDrawPinNum, bool aDrawPinName )
|
||||
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinOrient, int aTextInside,
|
||||
bool aDrawPinNum, bool aDrawPinName ) const
|
||||
{
|
||||
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
|
||||
aDrawPinName = false;
|
||||
@ -657,11 +657,11 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, wxPoint& aPinPos, int aPinOrient,
|
||||
|
||||
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
|
||||
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
|
||||
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
|
||||
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
|
||||
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
|
||||
|
||||
/* Get the num and name colors */
|
||||
COLOR4D nameColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
|
||||
@ -978,9 +978,9 @@ void LIB_PIN::Rotate( const wxPoint& aCenter, bool aRotateCCW )
|
||||
|
||||
|
||||
void LIB_PIN::Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill,
|
||||
const TRANSFORM& aTransform )
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
if( ! IsVisible() )
|
||||
if( !IsVisible() )
|
||||
return;
|
||||
|
||||
int orient = PinDrawOrient( aTransform );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user