Fix minor coding policy violations.

This commit is contained in:
Wayne Stambaugh 2019-12-12 14:55:21 -05:00
parent 0e1a274f0c
commit 20836261d7
3 changed files with 27 additions and 26 deletions

View File

@ -679,23 +679,23 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
{
case PIN_UP:
p0 = VECTOR2I( pos.x, pos.y - len );
dir = VECTOR2I(0, 1);
dir = VECTOR2I( 0, 1 );
break;
case PIN_DOWN:
p0 = VECTOR2I( pos.x, pos.y + len );
dir = VECTOR2I(0, -1);
dir = VECTOR2I( 0, -1 );
break;
case PIN_LEFT:
p0 = VECTOR2I( pos.x - len, pos.y );
dir = VECTOR2I(1, 0);
dir = VECTOR2I( 1, 0 );
break;
default:
case PIN_RIGHT:
p0 = VECTOR2I( pos.x + len, pos.y );
dir = VECTOR2I(-1, 0);
dir = VECTOR2I( -1, 0 );
break;
}
@ -755,7 +755,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
pc,
p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
if(!dir.y)
if( !dir.y )
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
p0 + VECTOR2D(dir.x, -1) * diam,
@ -774,7 +774,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
case PINSHAPE_CLOCK:
m_gal->DrawLine( p0, pos );
if (!dir.y)
if( !dir.y )
{
triLine( p0 + VECTOR2D( 0, clock_size ),
p0 + VECTOR2D( -dir.x * clock_size, 0 ),
@ -791,7 +791,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
case PINSHAPE_INPUT_LOW:
m_gal->DrawLine( p0, pos );
if(!dir.y)
if( !dir.y )
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
p0 + VECTOR2D(dir.x, -1) * diam,
@ -984,14 +984,14 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText ( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2);
strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2 );
}
if( size[OUTSIDE] )
{
SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText ( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2);
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2 );
}
if( size[ABOVE] )
{
@ -1015,14 +1015,14 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText ( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2);
strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2 );
}
if( size[OUTSIDE] )
{
SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
strokeText ( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2);
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2 );
}
if( size[ABOVE] )
{
@ -1074,7 +1074,7 @@ void SCH_PAINTER::drawDanglingSymbol( const wxPoint& aPos, bool aDrawingShadows
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
m_gal->SetLineWidth ( aDrawingShadows ? getShadowWidth() : 1.0F );
m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth() : 1.0F );
m_gal->DrawRectangle( aPos - radius, aPos + radius );
}
@ -1321,12 +1321,12 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
tempPart.SetFlags( aComp->GetFlags() );
orientPart( &tempPart, aComp->GetOrientation());
orientPart( &tempPart, aComp->GetOrientation() );
for( auto& tempItem : tempPart.GetDrawItems() )
{
tempItem.SetFlags( aComp->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aComp->GetPosition()));
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aComp->GetPosition() ) );
}
// Copy the pin info from the component to the temp pins

View File

@ -53,7 +53,7 @@ public:
/**
* Constructor
*
* Creates a tool with given name. The name must be unique.
* Creates a tool with given name. The name must be unique.
*/
EE_TOOL_BASE( const std::string& aName ) :
TOOL_INTERACTIVE ( aName ),
@ -128,7 +128,8 @@ protected:
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED, aAppend );
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED,
aAppend );
else
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
}

View File

@ -42,7 +42,7 @@ bool LIB_CONTROL::Init()
m_frame = getEditFrame<SCH_BASE_FRAME>();
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
m_isLibEdit = m_frame->IsType( FRAME_SCH_LIB_EDITOR );
if( m_isLibEdit )
{
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
@ -56,34 +56,34 @@ bool LIB_CONTROL::Init()
LIB_ID sel = editFrame->GetTreeLIBID();
return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
};
ctxMenu.AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( ACTIONS::addLibrary, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::newSymbol, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EE_ACTIONS::editSymbol, symbolSelectedCondition );
ctxMenu.AddSeparator();
ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition );
ctxMenu.AddItem( ACTIONS::saveCopyAs, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::importSymbol, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
}
return true;
}
@ -106,7 +106,7 @@ int LIB_CONTROL::EditSymbol( const TOOL_EVENT& aEvent )
LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
int unit = 0;
LIB_ID partId = editFrame->GetTreeLIBID( &unit );
editFrame->LoadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit );
}
@ -171,10 +171,10 @@ int LIB_CONTROL::CutCopyDelete( const TOOL_EVENT& aEvt )
if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) )
{
LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::copySymbol ) )
editFrame->CopyPartToClipboard();
if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::deleteSymbol ) )
editFrame->DeletePartFromLibrary();
}