Code cleaning.

This commit is contained in:
Wayne Stambaugh 2018-11-28 09:58:41 -05:00
parent 3392162d49
commit 59b0f553e0
4 changed files with 45 additions and 31 deletions

View File

@ -2,6 +2,8 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -55,6 +57,7 @@ const BOX2I RATSNEST_VIEWITEM::ViewBBox() const
return bbox;
}
void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
{
if( !m_data->TryLock() )
@ -78,9 +81,13 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
{
if ( l.a == l.b )
{
gal->DrawLine( VECTOR2I( l.a.x - CROSS_SIZE, l.a.y - CROSS_SIZE ), VECTOR2I( l.b.x + CROSS_SIZE, l.b.y + CROSS_SIZE ) );
gal->DrawLine( VECTOR2I( l.a.x - CROSS_SIZE, l.a.y + CROSS_SIZE ), VECTOR2I( l.b.x + CROSS_SIZE, l.b.y - CROSS_SIZE ) );
} else {
gal->DrawLine( VECTOR2I( l.a.x - CROSS_SIZE, l.a.y - CROSS_SIZE ),
VECTOR2I( l.b.x + CROSS_SIZE, l.b.y + CROSS_SIZE ) );
gal->DrawLine( VECTOR2I( l.a.x - CROSS_SIZE, l.a.y + CROSS_SIZE ),
VECTOR2I( l.b.x + CROSS_SIZE, l.b.y - CROSS_SIZE ) );
}
else
{
gal->DrawLine( l.a, l.b );
}
}
@ -129,8 +136,10 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
{
if ( source == target )
{
gal->DrawLine( VECTOR2I( source.x - CROSS_SIZE, source.y - CROSS_SIZE ), VECTOR2I( source.x + CROSS_SIZE, source.y + CROSS_SIZE ) );
gal->DrawLine( VECTOR2I( source.x - CROSS_SIZE, source.y + CROSS_SIZE ), VECTOR2I( source.x + CROSS_SIZE, source.y - CROSS_SIZE ) );
gal->DrawLine( VECTOR2I( source.x - CROSS_SIZE, source.y - CROSS_SIZE ),
VECTOR2I( source.x + CROSS_SIZE, source.y + CROSS_SIZE ) );
gal->DrawLine( VECTOR2I( source.x - CROSS_SIZE, source.y + CROSS_SIZE ),
VECTOR2I( source.x + CROSS_SIZE, source.y - CROSS_SIZE ) );
}
else
{

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012=2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -584,17 +584,17 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
// Creates box to display and choose tracks widths:
m_SelTrackWidthBox = new wxChoice( m_auxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxDefaultPosition, wxDefaultSize,
0, NULL );
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxDefaultPosition, wxDefaultSize,
0, NULL );
UpdateTrackWidthSelectBox( m_SelTrackWidthBox );
m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox );
// Creates box to display and choose vias diameters:
m_SelViaSizeBox = new wxChoice( m_auxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxDefaultPosition, wxDefaultSize,
0, NULL );
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxDefaultPosition, wxDefaultSize,
0, NULL );
UpdateViaSizeSelectBox( m_SelViaSizeBox );
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
KiScaledSeparator( m_auxiliaryToolBar, this );
@ -610,18 +610,19 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
// Add the box to display and select the current grid size:
KiScaledSeparator( m_auxiliaryToolBar, this );
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar,
ID_ON_GRID_SELECT,
wxDefaultPosition, wxDefaultSize,
0, NULL );
ID_ON_GRID_SELECT,
wxDefaultPosition, wxDefaultSize,
0, NULL );
UpdateGridSelectBox();
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
// Add the box to display and select the current Zoom
KiScaledSeparator( m_auxiliaryToolBar, this );
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize,
0, NULL );
ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize,
0, NULL );
updateZoomSelectBox();
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -667,6 +667,7 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
return 0;
}
static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aOriginZones,
std::vector<ZONE_CONTAINER *>& aMergedZones )
{
@ -684,7 +685,7 @@ static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aO
// but we should never have more than 2 polys
if( aOriginZones[0]->Outline()->OutlineCount() > 1 )
{
wxLogMessage( wxT( "BOARD::CombineAreas error: more than 2 polys after merging" ) );
wxLogMessage( "BOARD::CombineAreas error: more than 2 polys after merging" );
return false;
}
@ -889,17 +890,19 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
assert( picker );
m_frame->SetToolID( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxCURSOR_HAND, _( "Adjust zero" ) );
picker->SetClickHandler( std::bind( SetDrillOrigin, getView(), m_frame, m_placeOrigin.get(), _1 ) );
picker->SetClickHandler( std::bind( SetDrillOrigin, getView(), m_frame,
m_placeOrigin.get(), _1 ) );
picker->Activate();
Wait();
return 0;
}
/**
* Function highlightNet()
* Looks for a BOARD_CONNECTED_ITEM in a given spot, and if one is found - it enables
* Look for a BOARD_CONNECTED_ITEM in a given spot and if one is found - it enables
* highlight for its net.
*
* @param aToolMgr is the TOOL_MANAGER currently in use.
* @param aPosition is the point where an item is expected (world coordinates).
* @param aUseSelection is true if we should use the current selection to pick the netcode
@ -1119,7 +1122,8 @@ int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
wxASSERT( picker );
wxASSERT( board );
m_frame->SetToolID( ID_PCB_SHOW_1_RATSNEST_BUTT, wxCURSOR_PENCIL, _( "Pick Components for Local Ratsnest" ) );
m_frame->SetToolID( ID_PCB_SHOW_1_RATSNEST_BUTT, wxCURSOR_PENCIL,
_( "Pick Components for Local Ratsnest" ) );
picker->SetClickHandler( std::bind( showLocalRatsnest, m_toolMgr, board, _1 ) );
picker->SetFinalizeHandler( [ board ]( int aCondition ){
auto vis = board->IsElementVisible( LAYER_RATSNEST );