Cleanup and naming conventions.

This commit is contained in:
Jeff Young 2020-11-07 17:50:22 +00:00
parent 7c60c2e404
commit 0ebea4be53
12 changed files with 137 additions and 139 deletions

View File

@ -41,7 +41,7 @@ using namespace std::placeholders;
BOARD_COMMIT::BOARD_COMMIT( PCB_TOOL_BASE* aTool ) BOARD_COMMIT::BOARD_COMMIT( PCB_TOOL_BASE* aTool )
{ {
m_toolMgr = aTool->GetManager(); m_toolMgr = aTool->GetManager();
m_editModules = aTool->EditingModules(); m_editModules = aTool->IsFootprintEditor();
} }

View File

@ -446,7 +446,7 @@ int PCBNEW_CONTROL::Print( const TOOL_EVENT& aEvent )
PCBNEW_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() ); PCBNEW_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() );
DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings ); DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings );
if( m_editModules ) if( m_isFootprintEditor )
dlg.ForcePrintBorder( false ); dlg.ForcePrintBorder( false );
dlg.ShowModal(); dlg.ShowModal();

View File

@ -889,15 +889,15 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new GROUP_TOOL ); m_toolManager->RegisterTool( new GROUP_TOOL );
m_toolManager->RegisterTool( new CONVERT_TOOL ); m_toolManager->RegisterTool( new CONVERT_TOOL );
m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<SELECTION_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<EDIT_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PAD_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<PAD_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<DRAWING_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<DRAWING_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<POINT_EDITOR>()->SetEditModules( true ); m_toolManager->GetTool<POINT_EDITOR>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCBNEW_CONTROL>()->SetEditModules( true ); m_toolManager->GetTool<PCBNEW_CONTROL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCBNEW_PICKER_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<PCBNEW_PICKER_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<POSITION_RELATIVE_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<POSITION_RELATIVE_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<GROUP_TOOL>()->SetEditModules( true ); m_toolManager->GetTool<GROUP_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true ); m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
m_toolManager->InitTools(); m_toolManager->InitTools();

View File

@ -232,11 +232,11 @@ DRAWING_TOOL::MODE DRAWING_TOOL::GetDrawingMode() const
int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
MODULE* module = dynamic_cast<MODULE*>( m_frame->GetModel() ); MODULE* parentFootprint = dynamic_cast<MODULE*>( m_frame->GetModel() );
PCB_SHAPE* line = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; PCB_SHAPE* line = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::LINE ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::LINE );
OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) ); OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) );
@ -255,7 +255,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
{ {
if( line ) if( line )
{ {
if( m_editModules ) if( m_isFootprintEditor )
static_cast<FP_SHAPE*>( line )->SetLocalCoord(); static_cast<FP_SHAPE*>( line )->SetLocalCoord();
commit.Add( line ); commit.Add( line );
@ -267,7 +267,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
startingPoint = NULLOPT; startingPoint = NULLOPT;
} }
line = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; line = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
line->SetShape( S_SEGMENT ); line->SetShape( S_SEGMENT );
line->SetFlags( IS_NEW ); line->SetFlags( IS_NEW );
} }
@ -278,11 +278,11 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
MODULE* module = dynamic_cast<MODULE*>( m_frame->GetModel() ); MODULE* parentFootprint = dynamic_cast<MODULE*>( m_frame->GetModel() );
PCB_SHAPE* rect = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; PCB_SHAPE* rect = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::RECTANGLE ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::RECTANGLE );
OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) ); OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) );
@ -301,7 +301,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
{ {
if( rect ) if( rect )
{ {
if( m_editModules ) if( m_isFootprintEditor )
static_cast<FP_SHAPE*>( rect )->SetLocalCoord(); static_cast<FP_SHAPE*>( rect )->SetLocalCoord();
commit.Add( rect ); commit.Add( rect );
@ -310,7 +310,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, rect ); m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, rect );
} }
rect = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; rect = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
rect->SetShape( S_RECT ); rect->SetShape( S_RECT );
rect->SetFlags(IS_NEW ); rect->SetFlags(IS_NEW );
startingPoint = NULLOPT; startingPoint = NULLOPT;
@ -322,11 +322,11 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
MODULE* module = dynamic_cast<MODULE*>( m_frame->GetModel() ); MODULE* parentFootprint = dynamic_cast<MODULE*>( m_frame->GetModel() );
PCB_SHAPE* circle = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; PCB_SHAPE* circle = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::CIRCLE ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::CIRCLE );
OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) ); OPT<VECTOR2D> startingPoint = boost::make_optional<VECTOR2D>( false, VECTOR2D( 0, 0 ) );
@ -345,7 +345,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
{ {
if( circle ) if( circle )
{ {
if( m_editModules ) if( m_isFootprintEditor )
static_cast<FP_SHAPE*>( circle )->SetLocalCoord(); static_cast<FP_SHAPE*>( circle )->SetLocalCoord();
commit.Add( circle ); commit.Add( circle );
@ -354,7 +354,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, circle ); m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, circle );
} }
circle = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; circle = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
circle->SetShape( S_CIRCLE ); circle->SetShape( S_CIRCLE );
circle->SetFlags( IS_NEW ); circle->SetFlags( IS_NEW );
startingPoint = NULLOPT; startingPoint = NULLOPT;
@ -366,11 +366,11 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
MODULE* module = dynamic_cast<MODULE*>( m_frame->GetModel() ); MODULE* parentFootprint = dynamic_cast<MODULE*>( m_frame->GetModel() );
PCB_SHAPE* arc = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; PCB_SHAPE* arc = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ARC ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ARC );
bool immediateMode = aEvent.HasPosition(); bool immediateMode = aEvent.HasPosition();
@ -386,7 +386,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
{ {
if( arc ) if( arc )
{ {
if( m_editModules ) if( m_isFootprintEditor )
static_cast<FP_SHAPE*>( arc )->SetLocalCoord(); static_cast<FP_SHAPE*>( arc )->SetLocalCoord();
commit.Add( arc ); commit.Add( arc );
@ -395,7 +395,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, arc ); m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, arc );
} }
arc = m_editModules ? new FP_SHAPE( module ) : new PCB_SHAPE; arc = m_isFootprintEditor ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
arc->SetShape( S_ARC ); arc->SetShape( S_ARC );
arc->SetFlags( IS_NEW ); arc->SetFlags( IS_NEW );
immediateMode = false; immediateMode = false;
@ -407,7 +407,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
BOARD_ITEM* text = NULL; BOARD_ITEM* text = NULL;
@ -497,7 +497,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
PCB_LAYER_ID layer = m_frame->GetActiveLayer(); PCB_LAYER_ID layer = m_frame->GetActiveLayer();
// Init the new item attributes // Init the new item attributes
if( m_editModules ) if( m_isFootprintEditor )
{ {
FP_TEXT* fpText = new FP_TEXT( (MODULE*) m_frame->GetModel() ); FP_TEXT* fpText = new FP_TEXT( (MODULE*) m_frame->GetModel() );
@ -628,7 +628,7 @@ void DRAWING_TOOL::constrainDimension( DIMENSION* aDim )
int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
TOOL_EVENT originalEvent = aEvent; TOOL_EVENT originalEvent = aEvent;
@ -988,7 +988,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
// Note: PlaceImportedGraphics() will convert PCB_SHAPE_T and PCB_TEXT_T to footprint // Note: PlaceImportedGraphics() will convert PCB_SHAPE_T and PCB_TEXT_T to footprint
// items if needed // items if needed
DIALOG_IMPORT_GFX dlg( m_frame, m_editModules ); DIALOG_IMPORT_GFX dlg( m_frame, m_isFootprintEditor );
int dlgResult = dlg.ShowModal(); int dlgResult = dlg.ShowModal();
std::list<std::unique_ptr<EDA_ITEM>>& list = dlg.GetImportedItems(); std::list<std::unique_ptr<EDA_ITEM>>& list = dlg.GetImportedItems();
@ -1012,7 +1012,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
if( dlg.ShouldGroupItems() ) if( dlg.ShouldGroupItems() )
{ {
if( m_editModules ) if( m_isFootprintEditor )
grp = new PCB_GROUP( m_frame->GetBoard()->GetFirstModule() ); grp = new PCB_GROUP( m_frame->GetBoard()->GetFirstModule() );
else else
grp = new PCB_GROUP( m_frame->GetBoard() ); grp = new PCB_GROUP( m_frame->GetBoard() );
@ -1023,7 +1023,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
{ {
EDA_ITEM* item = ptr.get(); EDA_ITEM* item = ptr.get();
if( m_editModules ) if( m_isFootprintEditor )
wxASSERT( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_FP_TEXT_T ); wxASSERT( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_FP_TEXT_T );
else else
wxASSERT( item->Type() == PCB_SHAPE_T || item->Type() == PCB_TEXT_T ); wxASSERT( item->Type() == PCB_SHAPE_T || item->Type() == PCB_TEXT_T );
@ -1157,7 +1157,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
{ {
wxASSERT( m_editModules ); wxASSERT( m_isFootprintEditor );
if( !m_frame->GetModel() ) if( !m_frame->GetModel() )
return 0; return 0;
@ -1798,7 +1798,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER** aZo
int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetModel() ) if( m_isFootprintEditor && !m_frame->GetModel() )
return 0; return 0;
ZONE_MODE zoneMode = aEvent.Parameter<ZONE_MODE>(); ZONE_MODE zoneMode = aEvent.Parameter<ZONE_MODE>();

View File

@ -158,13 +158,13 @@ bool EDIT_TOOL::Init()
m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) ); m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
wxASSERT_MSG( m_selectionTool, "pcbnew.InteractiveSelection tool is not available" ); wxASSERT_MSG( m_selectionTool, "pcbnew.InteractiveSelection tool is not available" );
auto editingModuleCondition = auto inFootprintEditor =
[ this ] ( const SELECTION& aSelection ) [ this ] ( const SELECTION& aSelection )
{ {
return m_editModules; return m_isFootprintEditor;
}; };
auto singleModuleCondition = SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T ) auto singleFootprintCondition = SELECTION_CONDITIONS::OnlyType( PCB_MODULE_T )
&& SELECTION_CONDITIONS::Count( 1 ); && SELECTION_CONDITIONS::Count( 1 );
auto noActiveToolCondition = auto noActiveToolCondition =
@ -198,7 +198,7 @@ bool EDIT_TOOL::Init()
menu.AddItem( PCB_ACTIONS::rotateCcw, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::rotateCcw, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::rotateCw, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::rotateCw, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::flip, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::flip, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::mirror, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::mirror, inFootprintEditor && SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ) menu.AddItem( PCB_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 )
@ -222,9 +222,9 @@ bool EDIT_TOOL::Init()
// Footprint actions // Footprint actions
menu.AddSeparator( 150 ); menu.AddSeparator( 150 );
menu.AddItem( PCB_ACTIONS::editFpInFpEditor, singleModuleCondition, 150 ); menu.AddItem( PCB_ACTIONS::editFpInFpEditor, singleFootprintCondition, 150 );
menu.AddItem( PCB_ACTIONS::updateFootprint, singleModuleCondition, 150 ); menu.AddItem( PCB_ACTIONS::updateFootprint, singleFootprintCondition, 150 );
menu.AddItem( PCB_ACTIONS::changeFootprint, singleModuleCondition, 150 ); menu.AddItem( PCB_ACTIONS::changeFootprint, singleFootprintCondition, 150 );
return true; return true;
} }
@ -490,7 +490,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
m_dragging = true; m_dragging = true;
// When editing footprints, all items have the same parent // When editing footprints, all items have the same parent
if( EditingModules() ) if( IsFootprintEditor() )
{ {
m_commit->Modify( selection.Front() ); m_commit->Modify( selection.Front() );
} }
@ -960,12 +960,12 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent ); const int rotateAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *editFrame, aEvent );
// When editing footprints, all items have the same parent // When editing footprints, all items have the same parent
if( EditingModules() ) if( IsFootprintEditor() )
m_commit->Modify( selection.Front() ); m_commit->Modify( selection.Front() );
for( auto item : selection ) for( auto item : selection )
{ {
if( !item->IsNew() && !EditingModules() ) if( !item->IsNew() && !IsFootprintEditor() )
{ {
m_commit->Modify( item ); m_commit->Modify( item );
@ -1060,7 +1060,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
wxPoint mirrorPoint( refPoint.x, refPoint.y ); wxPoint mirrorPoint( refPoint.x, refPoint.y );
// When editing footprints, all items have the same parent // When editing footprints, all items have the same parent
if( EditingModules() ) if( IsFootprintEditor() )
m_commit->Modify( selection.Front() ); m_commit->Modify( selection.Front() );
for( EDA_ITEM* item : selection ) for( EDA_ITEM* item : selection )
@ -1073,7 +1073,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
case PCB_FP_ZONE_AREA_T: case PCB_FP_ZONE_AREA_T:
case PCB_PAD_T: case PCB_PAD_T:
// Only create undo entry for items on the board // Only create undo entry for items on the board
if( !item->IsNew() && !EditingModules() ) if( !item->IsNew() && !IsFootprintEditor() )
m_commit->Modify( item ); m_commit->Modify( item );
break; break;
@ -1156,7 +1156,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
updateModificationPoint( selection ); updateModificationPoint( selection );
// Flip around the anchor for footprints, and the bounding box center for board items // Flip around the anchor for footprints, and the bounding box center for board items
VECTOR2I modPoint = EditingModules() ? VECTOR2I( 0, 0 ) : selection.GetCenter(); VECTOR2I modPoint = IsFootprintEditor() ? VECTOR2I( 0, 0 ) : selection.GetCenter();
// If only one item selected, flip around the selection or item anchor point (instead // If only one item selected, flip around the selection or item anchor point (instead
// of the bounding box center) to avoid moving the item anchor // of the bounding box center) to avoid moving the item anchor
@ -1171,12 +1171,12 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
bool leftRight = frame()->Settings().m_FlipLeftRight; bool leftRight = frame()->Settings().m_FlipLeftRight;
// When editing footprints, all items have the same parent // When editing footprints, all items have the same parent
if( EditingModules() ) if( IsFootprintEditor() )
m_commit->Modify( selection.Front() ); m_commit->Modify( selection.Front() );
for( EDA_ITEM* item : selection ) for( EDA_ITEM* item : selection )
{ {
if( !item->IsNew() && !EditingModules() ) if( !item->IsNew() && !IsFootprintEditor() )
m_commit->Modify( item ); m_commit->Modify( item );
if( item->Type() == PCB_GROUP_T ) if( item->Type() == PCB_GROUP_T )
@ -1467,14 +1467,14 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
selCenter += translation; selCenter += translation;
// When editing footprints, all items have the same parent // When editing footprints, all items have the same parent
if( EditingModules() ) if( IsFootprintEditor() )
m_commit->Modify( selection.Front() ); m_commit->Modify( selection.Front() );
for( EDA_ITEM* selItem : selection ) for( EDA_ITEM* selItem : selection )
{ {
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selItem ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selItem );
if( !item->IsNew() && !EditingModules() ) if( !item->IsNew() && !IsFootprintEditor() )
{ {
m_commit->Modify( item ); m_commit->Modify( item );
@ -1563,7 +1563,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
BOARD_ITEM* dupe_item = nullptr; BOARD_ITEM* dupe_item = nullptr;
BOARD_ITEM* orig_item = static_cast<BOARD_ITEM*>( item ); BOARD_ITEM* orig_item = static_cast<BOARD_ITEM*>( item );
if( m_editModules ) if( m_isFootprintEditor )
{ {
MODULE* editModule = editFrame->GetBoard()->GetFirstModule(); MODULE* editModule = editFrame->GetBoard()->GetFirstModule();
dupe_item = editModule->DuplicateItem( orig_item ); dupe_item = editModule->DuplicateItem( orig_item );
@ -1679,7 +1679,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
// we have a selection to work on now, so start the tool process // we have a selection to work on now, so start the tool process
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>(); PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
ARRAY_CREATOR array_creator( *editFrame, m_editModules, selection ); ARRAY_CREATOR array_creator( *editFrame, m_isFootprintEditor, selection );
array_creator.Invoke(); array_creator.Invoke();
return 0; return 0;
@ -1852,7 +1852,7 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
selection.SetReferencePoint( refPoint ); selection.SetReferencePoint( refPoint );
io.SetBoard( board() ); io.SetBoard( board() );
io.SaveSelection( selection, m_editModules ); io.SaveSelection( selection, m_isFootprintEditor );
frame()->SetStatusText( _( "Selection copied" ) ); frame()->SetStatusText( _( "Selection copied" ) );
} }

View File

@ -353,7 +353,7 @@ int GROUP_TOOL::Group( const TOOL_EVENT& aEvent )
if( selection.Empty() ) if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
if( m_editModules ) if( m_isFootprintEditor )
{ {
MODULE* module = board->GetFirstModule(); MODULE* module = board->GetFirstModule();
@ -411,7 +411,7 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
if( group ) if( group )
{ {
if( m_editModules ) if( m_isFootprintEditor )
{ {
MODULE* module = board->GetFirstModule(); MODULE* module = board->GetFirstModule();

View File

@ -89,7 +89,7 @@ bool PAD_TOOL::Init()
menu.AddSeparator( 400 ); menu.AddSeparator( 400 );
if( m_editModules ) if( m_isFootprintEditor )
{ {
menu.AddItem( PCB_ACTIONS::enumeratePads, SELECTION_CONDITIONS::ShowAlways, 400 ); menu.AddItem( PCB_ACTIONS::enumeratePads, SELECTION_CONDITIONS::ShowAlways, 400 );
menu.AddItem( PCB_ACTIONS::recombinePad, recombineCondition, 400 ); menu.AddItem( PCB_ACTIONS::recombinePad, recombineCondition, 400 );

View File

@ -24,7 +24,6 @@
#include "pcb_tool_base.h" #include "pcb_tool_base.h"
#include <view/view_controls.h> #include <view/view_controls.h>
#include <view/view.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <board_commit.h> #include <board_commit.h>
#include <class_module.h> #include <class_module.h>
@ -59,25 +58,26 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
aPlacer->m_frame = frame(); aPlacer->m_frame = frame();
aPlacer->m_modifiers = 0; aPlacer->m_modifiers = 0;
auto makeNewItem = [&] ( VECTOR2I aPosition ) auto makeNewItem =
{ [&]( VECTOR2I aPosition )
if( frame()->GetModel() )
newItem = aPlacer->CreateItem();
if( newItem )
{
newItem->SetPosition( (wxPoint) aPosition );
preview.Add( newItem.get() );
if( newItem->Type() == PCB_MODULE_T )
{ {
auto module = dyn_cast<MODULE*>( newItem.get() ); if( frame()->GetModel() )
newItem = aPlacer->CreateItem();
// footprints have more drawable parts if( newItem )
module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) ); {
} newItem->SetPosition( (wxPoint) aPosition );
} preview.Add( newItem.get() );
};
if( newItem->Type() == PCB_MODULE_T )
{
auto module = dyn_cast<MODULE*>( newItem.get() );
// footprints have more drawable parts
module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
}
}
};
if( aOptions & IPO_SINGLE_CLICK ) if( aOptions & IPO_SINGLE_CLICK )
makeNewItem( controls()->GetCursorPosition() ); makeNewItem( controls()->GetCursorPosition() );
@ -102,15 +102,16 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
VECTOR2I cursorPos = controls()->GetCursorPosition(); VECTOR2I cursorPos = controls()->GetCursorPosition();
aPlacer->m_modifiers = evt->Modifier(); aPlacer->m_modifiers = evt->Modifier();
auto cleanup = [&] () auto cleanup =
{ [&] ()
newItem = nullptr; {
preview.Clear(); newItem = nullptr;
view()->Update( &preview ); preview.Clear();
controls()->SetAutoPan( false ); view()->Update( &preview );
controls()->CaptureCursor( false ); controls()->SetAutoPan( false );
controls()->ShowCursor( true ); controls()->CaptureCursor( false );
}; controls()->ShowCursor( true );
};
if( evt->IsCancelInteractive() ) if( evt->IsCancelInteractive() )
{ {
@ -230,7 +231,6 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
view()->Update( &preview ); view()->Update( &preview );
} }
} }
else if( newItem && evt->IsMotion() ) else if( newItem && evt->IsMotion() )
{ {
// track the cursor // track the cursor
@ -240,9 +240,10 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
// Show a preview of the item // Show a preview of the item
view()->Update( &preview ); view()->Update( &preview );
} }
else else
{
evt->SetPassEvent(); evt->SetPassEvent();
}
} }
view()->Remove( &preview ); view()->Remove( &preview );
@ -252,8 +253,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
bool PCB_TOOL_BASE::Init() bool PCB_TOOL_BASE::Init()
{ {
// A basic context manu. Many (but not all) tools will choose to override this. // A basic context manu. Many (but not all) tools will choose to override this.
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
auto& ctxMenu = m_menu.GetMenu();
// cancel current tool goes in main context menu at the top if present // cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 ); ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
@ -289,17 +289,17 @@ PCB_DRAW_PANEL_GAL* PCB_TOOL_BASE::canvas() const
const PCBNEW_SELECTION& PCB_TOOL_BASE::selection() const const PCBNEW_SELECTION& PCB_TOOL_BASE::selection() const
{ {
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>(); SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool->GetSelection();
return selection; return selTool->GetSelection();
} }
PCBNEW_SELECTION& PCB_TOOL_BASE::selection() PCBNEW_SELECTION& PCB_TOOL_BASE::selection()
{ {
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>(); SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
auto& selection = selTool->GetSelection();
return selection; return selTool->GetSelection();
} }

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 CERN * Copyright (C) 2016 CERN
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -56,12 +57,14 @@ struct INTERACTIVE_PLACER_BASE
} }
virtual std::unique_ptr<BOARD_ITEM> CreateItem() = 0; virtual std::unique_ptr<BOARD_ITEM> CreateItem() = 0;
virtual void SnapItem( BOARD_ITEM *aItem ); virtual void SnapItem( BOARD_ITEM *aItem );
virtual bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit ); virtual bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit );
PCB_BASE_EDIT_FRAME* m_frame; PCB_BASE_EDIT_FRAME* m_frame;
BOARD* m_board; BOARD* m_board;
int m_modifiers; int m_modifiers;
}; };
@ -73,8 +76,8 @@ public:
* *
* Creates a tool with given id & name. The name must be unique. */ * Creates a tool with given id & name. The name must be unique. */
PCB_TOOL_BASE( TOOL_ID aId, const std::string& aName ) : PCB_TOOL_BASE( TOOL_ID aId, const std::string& aName ) :
TOOL_INTERACTIVE ( aId, aName ), TOOL_INTERACTIVE ( aId, aName ),
m_editModules( false ) m_isFootprintEditor( false )
{}; {};
/** /**
@ -82,8 +85,8 @@ public:
* *
* Creates a tool with given name. The name must be unique. */ * Creates a tool with given name. The name must be unique. */
PCB_TOOL_BASE( const std::string& aName ) : PCB_TOOL_BASE( const std::string& aName ) :
TOOL_INTERACTIVE ( aName ), TOOL_INTERACTIVE ( aName ),
m_editModules( false ) m_isFootprintEditor( false )
{}; {};
virtual ~PCB_TOOL_BASE() {}; virtual ~PCB_TOOL_BASE() {};
@ -92,24 +95,16 @@ public:
virtual void Reset( RESET_REASON aReason ) override; virtual void Reset( RESET_REASON aReason ) override;
/** /**
* Function SetEditModules() * Function SetIsFootprintEditor()
* *
* Toggles edit module mode. When enabled, one may select parts of footprints individually * Toggles edit module mode. When enabled, one may select parts of footprints individually
* (graphics, pads, etc.), so they can be modified. * (graphics, pads, etc.), so they can be modified.
* @param aEnabled decides if the mode should be enabled. * @param aEnabled decides if the mode should be enabled.
*/ */
void SetEditModules( bool aEnabled ) void SetIsFootprintEditor( bool aEnabled ) { m_isFootprintEditor = aEnabled; }
{ bool IsFootprintEditor() const { return m_isFootprintEditor; }
m_editModules = aEnabled;
}
bool EditingModules() const
{
return m_editModules;
}
protected: protected:
/** /**
* Options for placing items interactively. * Options for placing items interactively.
*/ */
@ -128,7 +123,6 @@ protected:
IPO_REPEAT = 0x08 IPO_REPEAT = 0x08
}; };
/** /**
* Helper function for performing a common interactive idiom: * Helper function for performing a common interactive idiom:
* wait for a left click, place an item there (perhaps with a * wait for a left click, place an item there (perhaps with a
@ -171,11 +165,15 @@ protected:
} }
const PCB_DISPLAY_OPTIONS& displayOptions() const; const PCB_DISPLAY_OPTIONS& displayOptions() const;
PCB_DRAW_PANEL_GAL* canvas() const; PCB_DRAW_PANEL_GAL* canvas() const;
const PCBNEW_SELECTION& selection() const; const PCBNEW_SELECTION& selection() const;
PCBNEW_SELECTION& selection(); PCBNEW_SELECTION& selection();
bool m_editModules; protected:
bool m_isFootprintEditor;
}; };
#endif #endif

View File

@ -409,7 +409,7 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
} }
else else
{ {
if( m_editModules && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() ) if( m_isFootprintEditor && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
return 0; return 0;
std::string tool = aEvent.GetCommandStr().get(); std::string tool = aEvent.GetCommandStr().get();
@ -446,7 +446,7 @@ int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{ {
if( m_editModules && !m_frame->GetBoard()->GetFirstModule() ) if( m_isFootprintEditor && !m_frame->GetBoard()->GetFirstModule() )
return 0; return 0;
std::string tool = aEvent.GetCommandStr().get(); std::string tool = aEvent.GetCommandStr().get();
@ -493,7 +493,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
GENERAL_COLLECTOR collector; GENERAL_COLLECTOR collector;
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
if( m_editModules ) if( m_isFootprintEditor )
collector.Collect( board, GENERAL_COLLECTOR::ModuleItems, (wxPoint) aPos, guide ); collector.Collect( board, GENERAL_COLLECTOR::ModuleItems, (wxPoint) aPos, guide );
else else
collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, (wxPoint) aPos, guide ); collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, (wxPoint) aPos, guide );
@ -635,7 +635,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
if( !frame()->IsType( FRAME_FOOTPRINT_EDITOR ) && !frame()->IsType( FRAME_PCB_EDITOR ) ) if( !frame()->IsType( FRAME_FOOTPRINT_EDITOR ) && !frame()->IsType( FRAME_PCB_EDITOR ) )
return 0; return 0;
bool editModules = m_editModules || frame()->IsType( FRAME_FOOTPRINT_EDITOR ); bool editModules = m_isFootprintEditor || frame()->IsType( FRAME_FOOTPRINT_EDITOR );
if( clipItem->Type() == PCB_T ) if( clipItem->Type() == PCB_T )
{ {

View File

@ -534,8 +534,8 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
ExitGroup(); ExitGroup();
} }
collector.Collect( board(), m_editModules ? GENERAL_COLLECTOR::ModuleItems collector.Collect( board(), m_isFootprintEditor ? GENERAL_COLLECTOR::ModuleItems
: GENERAL_COLLECTOR::AllBoardItems, : GENERAL_COLLECTOR::AllBoardItems,
(wxPoint) aWhere, guide ); (wxPoint) aWhere, guide );
// Remove unselectable items // Remove unselectable items
@ -769,7 +769,7 @@ bool SELECTION_TOOL::selectMultiple()
SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock() SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
{ {
if( !m_locked || m_editModules ) if( !m_locked || m_isFootprintEditor )
return SELECTION_UNLOCKED; return SELECTION_UNLOCKED;
bool containsLocked = false; bool containsLocked = false;
@ -1632,8 +1632,8 @@ void SELECTION_TOOL::RebuildSelection()
return SEARCH_RESULT::CONTINUE; return SEARCH_RESULT::CONTINUE;
}; };
board()->Visit( inspector, nullptr, m_editModules ? GENERAL_COLLECTOR::ModuleItems board()->Visit( inspector, nullptr, m_isFootprintEditor ? GENERAL_COLLECTOR::ModuleItems
: GENERAL_COLLECTOR::AllBoardItems ); : GENERAL_COLLECTOR::AllBoardItems );
} }
@ -1860,7 +1860,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
// If it is, and we are not editing the footprint, it should not be selectable // If it is, and we are not editing the footprint, it should not be selectable
bool zoneInFootprint = zone->GetParent() && zone->GetParent()->Type() == PCB_MODULE_T; bool zoneInFootprint = zone->GetParent() && zone->GetParent()->Type() == PCB_MODULE_T;
if( zoneInFootprint && !m_editModules && !checkVisibilityOnly ) if( zoneInFootprint && !m_isFootprintEditor && !checkVisibilityOnly )
return false; return false;
// zones can exist on multiple layers! // zones can exist on multiple layers!
@ -1888,7 +1888,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
case PCB_MODULE_T: case PCB_MODULE_T:
{ {
// In modedit, we do not want to select the module itself. // In modedit, we do not want to select the module itself.
if( m_editModules ) if( m_isFootprintEditor )
return false; return false;
// Allow selection of footprints if some part of the footprint is visible. // Allow selection of footprints if some part of the footprint is visible.
@ -1920,20 +1920,20 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
// Multiple selection is only allowed in modedit mode. In pcbnew, you have to select // Multiple selection is only allowed in modedit mode. In pcbnew, you have to select
// module subparts one by one, rather than with a drag selection. This is so you can // module subparts one by one, rather than with a drag selection. This is so you can
// pick up items under an (unlocked) module without also moving the module's sub-parts. // pick up items under an (unlocked) module without also moving the module's sub-parts.
if( !m_editModules && !checkVisibilityOnly ) if( !m_isFootprintEditor && !checkVisibilityOnly )
{ {
if( m_multiple && !settings->GetHighContrast() ) if( m_multiple && !settings->GetHighContrast() )
return false; return false;
} }
if( !m_editModules && !view()->IsVisible( aItem ) ) if( !m_isFootprintEditor && !view()->IsVisible( aItem ) )
return false; return false;
break; break;
case PCB_FP_SHAPE_T: case PCB_FP_SHAPE_T:
// Module edge selections are only allowed in modedit mode. // Module edge selections are only allowed in modedit mode.
if( !m_editModules && !checkVisibilityOnly ) if( !m_isFootprintEditor && !checkVisibilityOnly )
return false; return false;
break; break;
@ -1943,7 +1943,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
// Multiple selection is only allowed in modedit mode. In pcbnew, you have to select // Multiple selection is only allowed in modedit mode. In pcbnew, you have to select
// module subparts one by one, rather than with a drag selection. This is so you can // module subparts one by one, rather than with a drag selection. This is so you can
// pick up items under an (unlocked) module without also moving the module's sub-parts. // pick up items under an (unlocked) module without also moving the module's sub-parts.
if( !m_editModules && !checkVisibilityOnly ) if( !m_isFootprintEditor && !checkVisibilityOnly )
{ {
if( m_multiple ) if( m_multiple )
return false; return false;

View File

@ -102,9 +102,9 @@ std::unique_ptr<ZONE_CONTAINER> ZONE_CREATE_HELPER::createNewZone( bool aKeepout
// The new zone is a ZONE_CONTAINER if created in the board editor // The new zone is a ZONE_CONTAINER if created in the board editor
// and a MODULE_ZONE_CONTAINER if created in the footprint editor // and a MODULE_ZONE_CONTAINER if created in the footprint editor
wxASSERT( !m_tool.m_editModules || ( parent->Type() == PCB_MODULE_T ) ); wxASSERT( !m_tool.m_isFootprintEditor || ( parent->Type() == PCB_MODULE_T ) );
std::unique_ptr<ZONE_CONTAINER> newZone = m_tool.m_editModules ? std::unique_ptr<ZONE_CONTAINER> newZone = m_tool.m_isFootprintEditor ?
std::make_unique<MODULE_ZONE_CONTAINER>( parent ) : std::make_unique<MODULE_ZONE_CONTAINER>( parent ) :
std::make_unique<ZONE_CONTAINER>( parent ); std::make_unique<ZONE_CONTAINER>( parent );
@ -235,8 +235,8 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE_CONTAINER> aZone )
if( graphicPolygonsLayers.Contains( m_params.m_layer ) ) if( graphicPolygonsLayers.Contains( m_params.m_layer ) )
{ {
auto poly = m_tool.m_editModules ? new FP_SHAPE((MODULE *) parent ) auto poly = m_tool.m_isFootprintEditor ? new FP_SHAPE((MODULE *) parent )
: new PCB_SHAPE(); : new PCB_SHAPE();
poly->SetShape ( S_POLYGON ); poly->SetShape ( S_POLYGON );
poly->SetLayer( m_params.m_layer ); poly->SetLayer( m_params.m_layer );
poly->SetPolyShape ( *aZone->Outline() ); poly->SetPolyShape ( *aZone->Outline() );
@ -249,8 +249,8 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE_CONTAINER> aZone )
for( auto seg = outline->CIterateSegments( 0 ); seg; seg++ ) for( auto seg = outline->CIterateSegments( 0 ); seg; seg++ )
{ {
PCB_SHAPE* new_seg = m_tool.m_editModules ? new FP_SHAPE( (MODULE *) parent ) auto* new_seg = m_tool.m_isFootprintEditor ? new FP_SHAPE((MODULE *) parent )
: new PCB_SHAPE(); : new PCB_SHAPE();
new_seg->SetShape( S_SEGMENT ); new_seg->SetShape( S_SEGMENT );
new_seg->SetLayer( m_params.m_layer ); new_seg->SetLayer( m_params.m_layer );
new_seg->SetStart( wxPoint( seg.Get().A.x, seg.Get().A.y ) ); new_seg->SetStart( wxPoint( seg.Get().A.x, seg.Get().A.y ) );