Skip to content

Commit

Permalink
Mostly formatting cleanup but a few type-casting cleanups too.
Browse files Browse the repository at this point in the history
  • Loading branch information
jey5nd6 committed Nov 24, 2020
1 parent 31a26e7 commit 9c7c05c
Show file tree
Hide file tree
Showing 72 changed files with 226 additions and 205 deletions.
7 changes: 3 additions & 4 deletions 3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
Expand Up @@ -110,7 +110,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_TEXT* aText,
wxStringSplit( aText->GetShownText(), strings_list, '\n' );
std::vector<wxPoint> positions;
positions.reserve( strings_list.Count() );
aText->GetLinePositions( positions, strings_list.Count());
aText->GetLinePositions( positions, strings_list.Count() );

for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
{
Expand Down Expand Up @@ -494,8 +494,7 @@ void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const FOOTPRINT* aFootprint
// shape size and pos is the same as their hole:
if( aSkipNPTHPadsWihNoCopper && ( pad->GetAttribute() == PAD_ATTRIB_NPTH ) )
{
if( (pad->GetDrillSize() == pad->GetSize()) &&
(pad->GetOffset() == wxPoint( 0, 0 )) )
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == wxPoint( 0, 0 ) )
{
switch( pad->GetShape() )
{
Expand Down Expand Up @@ -735,7 +734,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_SHAPE* aShape,

default:
wxFAIL_MSG( "BOARD_ADAPTER::AddShapeWithClearanceToContainer no implementation for "
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape()) );
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape() ) );
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion 3d-viewer/3d_canvas/eda_3d_canvas.cpp
Expand Up @@ -622,7 +622,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent &event )
float delta_move = m_delta_move_step_factor * m_camera.ZoomGet();

if( m_boardAdapter.GetFlag( FL_MOUSEWHEEL_PANNING ) )
delta_move *= (0.01f * event.GetWheelRotation());
delta_move *= 0.01f * event.GetWheelRotation();
else
if( event.GetWheelRotation() < 0 )
delta_move = -delta_move;
Expand Down
Expand Up @@ -1287,7 +1287,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,

if( !fp->Models().empty() )
{
if( m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )
if( m_boardAdapter.ShouldFPBeDisplayed( (FOOTPRINT_ATTR_T) fp->GetAttributes() ) )
{
if( ( aRenderTopOrBot && !fp->IsFlipped() )
|| ( !aRenderTopOrBot && fp->IsFlipped() ) )
Expand Down
Expand Up @@ -829,7 +829,7 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter,
static_cast<const CBVHCONTAINER2D *>(ii->second);

// Only get the Solder mask layers
if( !((layer_id == B_Mask) || (layer_id == F_Mask)) )
if( !( layer_id == B_Mask || layer_id == F_Mask ) )
continue;

SFVEC3F layerColor;
Expand Down Expand Up @@ -1403,7 +1403,7 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() )
{
if( !fp->Models().empty()
&& m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )
&& m_boardAdapter.ShouldFPBeDisplayed( (FOOTPRINT_ATTR_T) fp->GetAttributes() ) )
{
double zpos = m_boardAdapter.GetModulesZcoord3DIU( fp->IsFlipped() );

Expand Down
Expand Up @@ -245,9 +245,9 @@ bool CBBOX::Inside( const SFVEC3F &aPoint ) const
{
wxASSERT( IsInitialized() );

return (( aPoint.x >= m_min.x ) && ( aPoint.x <= m_max.x ) &&
( aPoint.y >= m_min.y ) && ( aPoint.y <= m_max.y ) &&
( aPoint.z >= m_min.z ) && ( aPoint.z <= m_max.z ));
return ( aPoint.x >= m_min.x ) && ( aPoint.x <= m_max.x ) &&
( aPoint.y >= m_min.y ) && ( aPoint.y <= m_max.y ) &&
( aPoint.z >= m_min.z ) && ( aPoint.z <= m_max.z );
}


Expand Down
2 changes: 1 addition & 1 deletion 3d-viewer/common_ogl/ogl_utils.cpp
Expand Up @@ -86,7 +86,7 @@ GLuint OGL_LoadTexture( const CIMAGE &aImage )
unsigned char* dst = rgbaBuffer;
const unsigned char* ori = aImage.GetBuffer();

for( unsigned int i = 0; i < (aImage.GetWidth() * aImage.GetHeight()); ++i )
for( unsigned int i = 0; i < ( aImage.GetWidth() * aImage.GetHeight() ); ++i )
{
unsigned char v = *ori;

Expand Down
2 changes: 1 addition & 1 deletion common/footprint_info.cpp
Expand Up @@ -65,7 +65,7 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetFootprintInfo( const wxString& aFootprintName
wxCHECK_MSG( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) < 0, NULL,
wxString::Format( wxT( "\"%s\" is not a valid LIB_ID." ), aFootprintName ) );

return GetFootprintInfo( fpid.GetLibNickname(), fpid.GetLibItemName());
return GetFootprintInfo( fpid.GetLibNickname(), fpid.GetLibItemName() );
}


Expand Down
2 changes: 1 addition & 1 deletion common/template_fieldnames.cpp
Expand Up @@ -103,7 +103,7 @@ void TEMPLATE_FIELDNAME::Parse( TEMPLATE_FIELDNAMES_LEXER* in )

in->NeedLEFT(); // begin (name ...)

if( (tok = in->NextTok()) != T_name )
if( ( tok = in->NextTok() ) != T_name )
in->Expecting( T_name );

in->NeedSYMBOLorNUMBER();
Expand Down
2 changes: 1 addition & 1 deletion cvpcb/readwrite_dlgs.cpp
Expand Up @@ -218,7 +218,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
if( component->GetAltFPID().empty() )
continue;

if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy())
if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy() )
continue;

m_indexes.push_back( ii );
Expand Down
2 changes: 1 addition & 1 deletion eeschema/connection_graph.cpp
Expand Up @@ -2667,7 +2667,7 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
// For a hier label, check if the parent pin is connected
if( aSubgraph->m_hier_parent &&
( aSubgraph->m_hier_parent->m_strong_driver ||
aSubgraph->m_hier_parent->m_drivers.size() > 1))
aSubgraph->m_hier_parent->m_drivers.size() > 1) )
{
// For now, a simple check: if there is more than one driver, the parent is probably
// connected elsewhere (because at least one driver will be the hier pin itself)
Expand Down
5 changes: 3 additions & 2 deletions eeschema/dialogs/dialog_edit_components_libid.cpp
Expand Up @@ -99,7 +99,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines(wxGrid& grid,
const wxRect& rect,
int row, int col)
{
dc.SetFont(attr.GetFont());
dc.SetFont( attr.GetFont() );
const wxCoord maxWidth = rect.GetWidth();

// Transform logical lines into physical ones, wrapping the longer ones.
Expand Down Expand Up @@ -215,7 +215,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
n = 1;
}

lines.push_back(word.substr(0, n));
lines.push_back( word.substr(0, n) );

// Check if the remainder of the string fits in one line.
//
Expand All @@ -225,6 +225,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
// recompute it.
const wxString rest = word.substr(n);
const wxCoord restWidth = dc.GetTextExtent(rest).x;

if ( restWidth <= maxWidth )
{
line = rest;
Expand Down
2 changes: 1 addition & 1 deletion eeschema/dialogs/dialog_lib_edit_pin_table.cpp
Expand Up @@ -87,7 +87,7 @@ class PIN_TABLE_DATA_MODEL : public wxGridTableBase
{
wxString fieldValue;

if( pins.empty())
if( pins.empty() )
return fieldValue;

for( LIB_PIN* pin : pins )
Expand Down
9 changes: 4 additions & 5 deletions eeschema/dialogs/dialog_netlist.cpp
Expand Up @@ -222,10 +222,9 @@ END_EVENT_TABLE()



NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
const wxString& title,
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
NETLIST_TYPE_ID id_NetType ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
{
m_IdNetType = id_NetType;
m_pageNetFmtName = title;
Expand All @@ -234,7 +233,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_IsCurrentFormat = NULL;
m_AdjustPassiveValues = NULL;

wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_DefaultNetFmtName;
wxString netfmtName = static_cast<NETLIST_DIALOG*>( parent->GetParent() )->m_DefaultNetFmtName;

bool selected = m_pageNetFmtName == netfmtName;

Expand Down Expand Up @@ -262,7 +261,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_IsCurrentFormat->SetValue( selected );

if( selected )
((NETLIST_DIALOG*)parent->GetParent())->m_asFormatSelected = true;
( (NETLIST_DIALOG*)parent->GetParent() )->m_asFormatSelected = true;
}


Expand Down
6 changes: 3 additions & 3 deletions eeschema/lib_pin.cpp
Expand Up @@ -1013,7 +1013,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
wxPoint begin;
wxPoint end;
int nameTextOffset = 0;
bool showName = !m_name.IsEmpty() && (m_name != wxT( "~" ));
bool showName = !m_name.IsEmpty() && ( m_name != wxT( "~" ) );
bool showNum = !m_number.IsEmpty();
int minsizeV = TARGET_PIN_RADIUS;

Expand Down Expand Up @@ -1140,14 +1140,14 @@ wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
m_number,
m_name,
GetElectricalTypeName(),
PinShapeGetText( m_shape ));
PinShapeGetText( m_shape ) );
}
else
{
return wxString::Format( _( "Pin %s [%s, %s]" ),
m_number,
GetElectricalTypeName(),
PinShapeGetText( m_shape ));
PinShapeGetText( m_shape ) );
}
}

Expand Down
12 changes: 6 additions & 6 deletions eeschema/pin_type.cpp
Expand Up @@ -185,7 +185,7 @@ void InitTables()

const wxArrayString& PinTypeNames()
{
if( g_typeNames.empty())
if( g_typeNames.empty() )
InitTables();

return g_typeNames;
Expand All @@ -194,7 +194,7 @@ const wxArrayString& PinTypeNames()

const std::vector<BITMAP_DEF>& PinTypeIcons()
{
if( g_typeIcons.empty())
if( g_typeIcons.empty() )
InitTables();

return g_typeIcons;
Expand All @@ -203,7 +203,7 @@ const std::vector<BITMAP_DEF>& PinTypeIcons()

const wxArrayString& PinShapeNames()
{
if( g_shapeNames.empty())
if( g_shapeNames.empty() )
InitTables();

return g_shapeNames;
Expand All @@ -212,7 +212,7 @@ const wxArrayString& PinShapeNames()

const std::vector<BITMAP_DEF>& PinShapeIcons()
{
if( g_shapeIcons.empty())
if( g_shapeIcons.empty() )
InitTables();

return g_shapeIcons;
Expand All @@ -221,7 +221,7 @@ const std::vector<BITMAP_DEF>& PinShapeIcons()

const wxArrayString& PinOrientationNames()
{
if( g_orientationNames.empty())
if( g_orientationNames.empty() )
InitTables();

return g_orientationNames;
Expand All @@ -230,7 +230,7 @@ const wxArrayString& PinOrientationNames()

const std::vector<BITMAP_DEF>& PinOrientationIcons()
{
if( g_orientationIcons.empty())
if( g_orientationIcons.empty() )
InitTables();

return g_orientationIcons;
Expand Down
2 changes: 1 addition & 1 deletion eeschema/sch_base_frame.cpp
Expand Up @@ -295,7 +295,7 @@ void SCH_BASE_FRAME::createCanvas()
}

SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize,
GetGalDisplayOptions(), m_canvasType ));
GetGalDisplayOptions(), m_canvasType ) );
ActivateGalCanvas();
}

Expand Down
2 changes: 1 addition & 1 deletion eeschema/sch_plugin.cpp
Expand Up @@ -149,7 +149,7 @@ void SCH_PLUGIN::SymbolLibOptions( PROPERTIES* aListToAppendTo ) const

(*aListToAppendTo)["username"] = UTF8( _(
"User name for <b>login</b> to some special library server."
));
) );

(*aListToAppendTo)["password"] = UTF8( _(
"Password for <b>login</b> to some special library server."
Expand Down
4 changes: 2 additions & 2 deletions eeschema/sch_sheet.cpp
Expand Up @@ -1037,10 +1037,10 @@ bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const

auto sheet = static_cast<const SCH_SHEET*>( &aItem );

if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText())
if (m_fields[ SHEETNAME ].GetText() != sheet->m_fields[ SHEETNAME ].GetText() )
return m_fields[ SHEETNAME ].GetText() < sheet->m_fields[ SHEETNAME ].GetText();

if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText())
if (m_fields[ SHEETFILENAME ].GetText() != sheet->m_fields[ SHEETFILENAME ].GetText() )
return m_fields[ SHEETFILENAME ].GetText() < sheet->m_fields[ SHEETFILENAME ].GetText();

return false;
Expand Down
6 changes: 1 addition & 5 deletions eeschema/sim/sim_plot_frame.cpp
Expand Up @@ -956,14 +956,10 @@ bool SIM_PLOT_FRAME::loadWorkbook( const wxString& aPath )

bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
{

wxString savePath = aPath;

if( !savePath.Lower().EndsWith(".wbk"))
{
if( !savePath.Lower().EndsWith(".wbk") )
savePath += ".wbk";
};


wxTextFile file( savePath );

Expand Down
2 changes: 1 addition & 1 deletion eeschema/tools/lib_move_tool.cpp
Expand Up @@ -310,7 +310,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )

void LIB_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta )
{
static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ));
static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ) );
aItem->SetFlags( IS_MOVED );
}

Expand Down
2 changes: 1 addition & 1 deletion eeschema/tools/sch_edit_tool.cpp
Expand Up @@ -1350,7 +1350,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true );

editor->LoadSymbolAndSelectLib( component->GetLibId(), component->GetUnit(),
component->GetConvert());
component->GetConvert() );

editor->Show( true );
editor->Raise();
Expand Down
2 changes: 1 addition & 1 deletion eeschema/tools/sch_editor_control.cpp
Expand Up @@ -229,7 +229,7 @@ static wxFindReplaceData g_markersOnly;

int SCH_EDITOR_CONTROL::FindAndReplace( const TOOL_EVENT& aEvent )
{
m_frame->ShowFindReplaceDialog( aEvent.IsAction( &ACTIONS::findAndReplace ));
m_frame->ShowFindReplaceDialog( aEvent.IsAction( &ACTIONS::findAndReplace ) );
return UpdateFind( aEvent );
}

Expand Down
2 changes: 1 addition & 1 deletion gerbview/readgerb.cpp
Expand Up @@ -70,7 +70,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
if( gerber->GetMessages().size() > 0 )
{
HTML_MESSAGE_BOX dlg( this, _("Errors") );
dlg.ListSet(gerber->GetMessages());
dlg.ListSet( gerber->GetMessages() );
dlg.ShowModal();
}

Expand Down
4 changes: 2 additions & 2 deletions gerbview/widgets/layer_widget.cpp
Expand Up @@ -275,7 +275,7 @@ int LAYER_WIDGET::findLayerRow( LAYER_NUM aLayer ) const
wxWindow* w = getLayerComp( row, 0 );
wxASSERT( w );

if( aLayer == getDecodedId( w->GetId() ))
if( aLayer == getDecodedId( w->GetId() ) )
return row;
}

Expand Down Expand Up @@ -304,7 +304,7 @@ int LAYER_WIDGET::findRenderRow( int aId ) const
wxWindow* w = getRenderComp( row, 0 );
wxASSERT( w );

if( aId == getDecodedId( w->GetId() ))
if( aId == getDecodedId( w->GetId() ) )
return row;
}

Expand Down
4 changes: 2 additions & 2 deletions kicad/dialogs/dialog_template_selector.cpp
Expand Up @@ -80,8 +80,8 @@ void TEMPLATE_WIDGET::Unselect()
void TEMPLATE_WIDGET::SetTemplate(PROJECT_TEMPLATE* aTemplate)
{
m_currTemplate = aTemplate;
m_staticTitle->SetLabel( *(aTemplate->GetTitle()) );
m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon()) );
m_staticTitle->SetLabel( *(aTemplate->GetTitle() ) );
m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon() ) );
}


Expand Down

0 comments on commit 9c7c05c

Please sign in to comment.