Loading pcbnew/class_module.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -921,6 +921,63 @@ void MODULE::SetPosition( const wxPoint& newpos ) CalculateBoundingBox(); } void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) { /* Move the reference point of the footprint * the footprints elements (pads, outlines, edges .. ) are moved * but: * - the footprint position is not modified. * - the relative (local) coordinates of these items are modified */ wxPoint footprintPos = GetPosition(); /* Update the relative coordinates: * The coordinates are relative to the anchor point. * Calculate deltaX and deltaY from the anchor. */ wxPoint moveVector = aMoveVector; RotatePoint( &moveVector, -GetOrientation() ); // Update of the reference and value. m_Reference->SetPos0( m_Reference->GetPos0() + moveVector ); m_Reference->SetDrawCoord(); m_Value->SetPos0( m_Value->GetPos0() + moveVector ); m_Value->SetDrawCoord(); // Update the pad local coordinates. for( D_PAD* pad = Pads(); pad; pad = pad->Next() ) { pad->SetPos0( pad->GetPos0() + moveVector ); pad->SetPosition( pad->GetPos0() + footprintPos ); } // Update the draw element coordinates. for( EDA_ITEM* item = GraphicalItems(); item; item = item->Next() ) { switch( item->Type() ) { case PCB_MODULE_EDGE_T: #undef STRUCT #define STRUCT ( (EDGE_MODULE*) item ) STRUCT->m_Start0 += moveVector; STRUCT->m_End0 += moveVector; STRUCT->SetDrawCoord(); break; case PCB_MODULE_TEXT_T: #undef STRUCT #define STRUCT ( (TEXTE_MODULE*) item ) STRUCT->SetPos0( STRUCT->GetPos0() + moveVector ); STRUCT->SetDrawCoord(); break; default: break; } } CalculateBoundingBox(); } void MODULE::SetOrientation( double newangle ) { Loading pcbnew/class_module.h +13 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,19 @@ public: void Flip( const wxPoint& aCentre ); /** * Function MoveAnchorPosition * Move the reference point of the footprint * It looks like a move footprint: * the footprints elements (pads, outlines, edges .. ) are moved * However: * - the footprint position is not modified. * - the relative (local) coordinates of these items are modified * (a move footprint does not change these local coordinates, * but changes the footprint position) */ void MoveAnchorPosition( const wxPoint& aMoveVector ); /** * function IsFlipped * @return true if the module is flipped, i.e. on the back side of the board Loading pcbnew/editmod.cpp +6 −59 Original line number Diff line number Diff line Loading @@ -4,12 +4,11 @@ /************************************************/ #include <fctsys.h> #include <class_drawpanel.h> #include <confirm.h> #include <class_drawpanel.h> #include <pcbnew.h> #include <wxPcbStruct.h> #include <module_editor_frame.h> #include <trigo.h> #include <3d_viewer.h> #include <class_module.h> Loading Loading @@ -65,58 +64,6 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) } /* * Move the footprint anchor position to the current cursor position. */ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* aModule ) { wxPoint moveVector; if( aModule == NULL ) return; moveVector = aModule->GetPosition() - GetScreen()->GetCrossHairPosition(); aModule->SetPosition( GetScreen()->GetCrossHairPosition() ); /* Update the relative coordinates: * The coordinates are relative to the anchor point. * Calculate deltaX and deltaY from the anchor. */ RotatePoint( &moveVector, -aModule->GetOrientation() ); // Update the pad coordinates. for( D_PAD* pad = (D_PAD*) aModule->Pads(); pad; pad = pad->Next() ) { pad->SetPos0( pad->GetPos0() + moveVector ); } // Update the draw element coordinates. for( EDA_ITEM* item = aModule->GraphicalItems(); item; item = item->Next() ) { switch( item->Type() ) { case PCB_MODULE_EDGE_T: #undef STRUCT #define STRUCT ( (EDGE_MODULE*) item ) STRUCT->m_Start0 += moveVector; STRUCT->m_End0 += moveVector; break; case PCB_MODULE_TEXT_T: #undef STRUCT #define STRUCT ( (TEXTE_MODULE*) item ) STRUCT->SetPos0( STRUCT->GetPos0() + moveVector ); break; default: break; } } aModule->CalculateBoundingBox(); } void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) { if( Item == NULL ) Loading @@ -134,13 +81,13 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) if( text->GetType() == TEXT_is_REFERENCE ) { DisplayError( this, _( "Text is REFERENCE!" ) ); DisplayError( this, _( "Cannot delete REFERENCE!" ) ); break; } if( text->GetType() == TEXT_is_VALUE ) { DisplayError( this, _( "Text is VALUE!" ) ); DisplayError( this, _( "Cannot delete VALUE!" ) ); break; } Loading @@ -159,8 +106,8 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) default: { wxString Line; Line.Printf( wxT( " Remove: draw item type %d unknown." ), Item->Type() ); DisplayError( this, Line ); Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() ); wxMessageBox( Line ); } break; } Loading pcbnew/modedit_onclick.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ #include <class_edge_mod.h> #include <pcbnew.h> //#include <protos.h> #include <pcbnew_id.h> #include <hotkeys.h> #include <module_editor_frame.h> Loading Loading @@ -112,7 +111,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) } else { DisplayError( this, wxT( "ProcessCommand error: item flags error" ) ); wxMessageBox( wxT( "ProcessCommand error: unknown shape" ) ); } } break; Loading Loading @@ -140,13 +139,15 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) || (module->GetFlags() != 0) ) break; module->ClearFlags(); SaveCopyInUndoList( module, UR_MODEDIT ); Place_Ancre( module ); // set the new relatives internal coordinates of items RedrawScreen( wxPoint( 0, 0 ), true ); // Replace the module in position 0, to recalculate absolutes coordinates of items module->SetPosition( wxPoint( 0, 0 ) ); // set the new relative internal local coordinates of footprint items wxPoint moveVector = module->GetPosition() - GetScreen()->GetCrossHairPosition(); module->MoveAnchorPosition( moveVector ); // Usually, we do not need to change twice the anchor position, // so deselect the active tool SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); SetCurItem( NULL ); m_canvas->Refresh(); Loading pcbnew/module_editor_frame.h +0 −1 Original line number Diff line number Diff line Loading @@ -225,7 +225,6 @@ public: // Footprint edition void Place_Ancre( MODULE* module ); void RemoveStruct( EDA_ITEM* Item ); /** Loading Loading
pcbnew/class_module.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -921,6 +921,63 @@ void MODULE::SetPosition( const wxPoint& newpos ) CalculateBoundingBox(); } void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) { /* Move the reference point of the footprint * the footprints elements (pads, outlines, edges .. ) are moved * but: * - the footprint position is not modified. * - the relative (local) coordinates of these items are modified */ wxPoint footprintPos = GetPosition(); /* Update the relative coordinates: * The coordinates are relative to the anchor point. * Calculate deltaX and deltaY from the anchor. */ wxPoint moveVector = aMoveVector; RotatePoint( &moveVector, -GetOrientation() ); // Update of the reference and value. m_Reference->SetPos0( m_Reference->GetPos0() + moveVector ); m_Reference->SetDrawCoord(); m_Value->SetPos0( m_Value->GetPos0() + moveVector ); m_Value->SetDrawCoord(); // Update the pad local coordinates. for( D_PAD* pad = Pads(); pad; pad = pad->Next() ) { pad->SetPos0( pad->GetPos0() + moveVector ); pad->SetPosition( pad->GetPos0() + footprintPos ); } // Update the draw element coordinates. for( EDA_ITEM* item = GraphicalItems(); item; item = item->Next() ) { switch( item->Type() ) { case PCB_MODULE_EDGE_T: #undef STRUCT #define STRUCT ( (EDGE_MODULE*) item ) STRUCT->m_Start0 += moveVector; STRUCT->m_End0 += moveVector; STRUCT->SetDrawCoord(); break; case PCB_MODULE_TEXT_T: #undef STRUCT #define STRUCT ( (TEXTE_MODULE*) item ) STRUCT->SetPos0( STRUCT->GetPos0() + moveVector ); STRUCT->SetDrawCoord(); break; default: break; } } CalculateBoundingBox(); } void MODULE::SetOrientation( double newangle ) { Loading
pcbnew/class_module.h +13 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,19 @@ public: void Flip( const wxPoint& aCentre ); /** * Function MoveAnchorPosition * Move the reference point of the footprint * It looks like a move footprint: * the footprints elements (pads, outlines, edges .. ) are moved * However: * - the footprint position is not modified. * - the relative (local) coordinates of these items are modified * (a move footprint does not change these local coordinates, * but changes the footprint position) */ void MoveAnchorPosition( const wxPoint& aMoveVector ); /** * function IsFlipped * @return true if the module is flipped, i.e. on the back side of the board Loading
pcbnew/editmod.cpp +6 −59 Original line number Diff line number Diff line Loading @@ -4,12 +4,11 @@ /************************************************/ #include <fctsys.h> #include <class_drawpanel.h> #include <confirm.h> #include <class_drawpanel.h> #include <pcbnew.h> #include <wxPcbStruct.h> #include <module_editor_frame.h> #include <trigo.h> #include <3d_viewer.h> #include <class_module.h> Loading Loading @@ -65,58 +64,6 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) } /* * Move the footprint anchor position to the current cursor position. */ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* aModule ) { wxPoint moveVector; if( aModule == NULL ) return; moveVector = aModule->GetPosition() - GetScreen()->GetCrossHairPosition(); aModule->SetPosition( GetScreen()->GetCrossHairPosition() ); /* Update the relative coordinates: * The coordinates are relative to the anchor point. * Calculate deltaX and deltaY from the anchor. */ RotatePoint( &moveVector, -aModule->GetOrientation() ); // Update the pad coordinates. for( D_PAD* pad = (D_PAD*) aModule->Pads(); pad; pad = pad->Next() ) { pad->SetPos0( pad->GetPos0() + moveVector ); } // Update the draw element coordinates. for( EDA_ITEM* item = aModule->GraphicalItems(); item; item = item->Next() ) { switch( item->Type() ) { case PCB_MODULE_EDGE_T: #undef STRUCT #define STRUCT ( (EDGE_MODULE*) item ) STRUCT->m_Start0 += moveVector; STRUCT->m_End0 += moveVector; break; case PCB_MODULE_TEXT_T: #undef STRUCT #define STRUCT ( (TEXTE_MODULE*) item ) STRUCT->SetPos0( STRUCT->GetPos0() + moveVector ); break; default: break; } } aModule->CalculateBoundingBox(); } void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) { if( Item == NULL ) Loading @@ -134,13 +81,13 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) if( text->GetType() == TEXT_is_REFERENCE ) { DisplayError( this, _( "Text is REFERENCE!" ) ); DisplayError( this, _( "Cannot delete REFERENCE!" ) ); break; } if( text->GetType() == TEXT_is_VALUE ) { DisplayError( this, _( "Text is VALUE!" ) ); DisplayError( this, _( "Cannot delete VALUE!" ) ); break; } Loading @@ -159,8 +106,8 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) default: { wxString Line; Line.Printf( wxT( " Remove: draw item type %d unknown." ), Item->Type() ); DisplayError( this, Line ); Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() ); wxMessageBox( Line ); } break; } Loading
pcbnew/modedit_onclick.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ #include <class_edge_mod.h> #include <pcbnew.h> //#include <protos.h> #include <pcbnew_id.h> #include <hotkeys.h> #include <module_editor_frame.h> Loading Loading @@ -112,7 +111,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) } else { DisplayError( this, wxT( "ProcessCommand error: item flags error" ) ); wxMessageBox( wxT( "ProcessCommand error: unknown shape" ) ); } } break; Loading Loading @@ -140,13 +139,15 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) || (module->GetFlags() != 0) ) break; module->ClearFlags(); SaveCopyInUndoList( module, UR_MODEDIT ); Place_Ancre( module ); // set the new relatives internal coordinates of items RedrawScreen( wxPoint( 0, 0 ), true ); // Replace the module in position 0, to recalculate absolutes coordinates of items module->SetPosition( wxPoint( 0, 0 ) ); // set the new relative internal local coordinates of footprint items wxPoint moveVector = module->GetPosition() - GetScreen()->GetCrossHairPosition(); module->MoveAnchorPosition( moveVector ); // Usually, we do not need to change twice the anchor position, // so deselect the active tool SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); SetCurItem( NULL ); m_canvas->Refresh(); Loading
pcbnew/module_editor_frame.h +0 −1 Original line number Diff line number Diff line Loading @@ -225,7 +225,6 @@ public: // Footprint edition void Place_Ancre( MODULE* module ); void RemoveStruct( EDA_ITEM* Item ); /** Loading