Fixed crash when placing 45-degree lines in the footprint editor (GAL).
This commit is contained in:
parent
ce68767fce
commit
db8560f055
|
@ -98,7 +98,7 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
|
||||||
line = new EDGE_MODULE( m_board->m_Modules );
|
line = new EDGE_MODULE( m_board->m_Modules );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // !m_editModules case
|
||||||
{
|
{
|
||||||
m_frame->SetToolID( ID_PCB_ADD_LINE_BUTT, wxCURSOR_PENCIL, _( "Add graphic line" ) );
|
m_frame->SetToolID( ID_PCB_ADD_LINE_BUTT, wxCURSOR_PENCIL, _( "Add graphic line" ) );
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
|
||||||
circle = new EDGE_MODULE( m_board->m_Modules );
|
circle = new EDGE_MODULE( m_board->m_Modules );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // !m_editModules case
|
||||||
{
|
{
|
||||||
m_frame->SetToolID( ID_PCB_CIRCLE_BUTT, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
|
m_frame->SetToolID( ID_PCB_CIRCLE_BUTT, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
|
||||||
arc = new EDGE_MODULE( m_board->m_Modules );
|
arc = new EDGE_MODULE( m_board->m_Modules );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // !m_editModules case
|
||||||
{
|
{
|
||||||
m_frame->SetToolID( ID_PCB_ARC_BUTT, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
|
m_frame->SetToolID( ID_PCB_ARC_BUTT, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
|
||||||
|
|
||||||
|
@ -236,6 +236,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
||||||
DIMENSION* dimension = NULL;
|
DIMENSION* dimension = NULL;
|
||||||
int width, maxThickness;
|
int width, maxThickness;
|
||||||
|
|
||||||
|
// if one day it is possible to draw dimensions in the footprint editor,
|
||||||
|
// then hereby I'm letting you know that this tool does not handle UR_MODEDIT undo yet
|
||||||
|
assert( !m_editModules );
|
||||||
|
|
||||||
// Add a VIEW_GROUP that serves as a preview for the new item
|
// Add a VIEW_GROUP that serves as a preview for the new item
|
||||||
KIGFX::VIEW_GROUP preview( m_view );
|
KIGFX::VIEW_GROUP preview( m_view );
|
||||||
m_view->Add( &preview );
|
m_view->Add( &preview );
|
||||||
|
@ -552,7 +556,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // !m_editModules case
|
||||||
{
|
{
|
||||||
PICKED_ITEMS_LIST picklist;
|
PICKED_ITEMS_LIST picklist;
|
||||||
|
|
||||||
|
@ -605,6 +609,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsClick( BUT_LEFT ) )
|
if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
|
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
|
||||||
|
m_board->m_Modules->SetLastEditTime();
|
||||||
|
|
||||||
// set the new relative internal local coordinates of footprint items
|
// set the new relative internal local coordinates of footprint items
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
@ -748,17 +753,40 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
|
||||||
{ // a clear sign that the current drawing is finished
|
{ // a clear sign that the current drawing is finished
|
||||||
if( direction45 )
|
if( direction45 )
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* l = static_cast<DRAWSEGMENT*>( line45.Clone() );
|
// Now we have to add the helper line as well
|
||||||
l->SetEnd( aGraphic->GetStart() );
|
if( m_editModules )
|
||||||
m_board->Add( l );
|
{
|
||||||
|
EDGE_MODULE* l = new EDGE_MODULE( m_board->m_Modules );
|
||||||
|
|
||||||
|
// Copy coordinates, layer, etc.
|
||||||
|
*static_cast<DRAWSEGMENT*>( l ) = line45;
|
||||||
|
l->SetEnd( aGraphic->GetStart() );
|
||||||
|
l->SetLocalCoord();
|
||||||
|
|
||||||
|
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
|
||||||
|
m_board->m_Modules->SetLastEditTime();
|
||||||
|
m_board->m_Modules->GraphicalItems().PushFront( l );
|
||||||
|
|
||||||
|
m_view->Add( l );
|
||||||
|
l->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DRAWSEGMENT* l = static_cast<DRAWSEGMENT*>( line45.Clone() );
|
||||||
|
l->SetEnd( aGraphic->GetStart() );
|
||||||
|
|
||||||
|
m_frame->SaveCopyInUndoList( l, UR_NEW );
|
||||||
|
m_board->Add( l );
|
||||||
|
|
||||||
|
m_view->Add( l );
|
||||||
|
l->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
||||||
|
}
|
||||||
|
|
||||||
m_frame->OnModify();
|
m_frame->OnModify();
|
||||||
m_frame->SaveCopyInUndoList( l, UR_NEW );
|
|
||||||
m_view->Add( l );
|
|
||||||
l->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete aGraphic; // but only if at least one graphic was created
|
delete aGraphic;
|
||||||
aGraphic = NULL; // otherwise - force user to draw more or cancel
|
aGraphic = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1004,6 +1032,10 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
|
||||||
DRAWSEGMENT line45;
|
DRAWSEGMENT line45;
|
||||||
DRAWSEGMENT* helperLine = NULL; // we will need more than one helper line
|
DRAWSEGMENT* helperLine = NULL; // we will need more than one helper line
|
||||||
|
|
||||||
|
// if one day it is possible to draw zones in the footprint editor,
|
||||||
|
// then hereby I'm letting you know that this tool does not handle UR_MODEDIT undo yet
|
||||||
|
assert( !m_editModules );
|
||||||
|
|
||||||
// Add a VIEW_GROUP that serves as a preview for the new item
|
// Add a VIEW_GROUP that serves as a preview for the new item
|
||||||
KIGFX::VIEW_GROUP preview( m_view );
|
KIGFX::VIEW_GROUP preview( m_view );
|
||||||
m_view->Add( &preview );
|
m_view->Add( &preview );
|
||||||
|
@ -1217,6 +1249,8 @@ int DRAWING_TOOL::placeTextModule()
|
||||||
TEXTE_MODULE* text = new TEXTE_MODULE( NULL );
|
TEXTE_MODULE* text = new TEXTE_MODULE( NULL );
|
||||||
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
|
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
|
||||||
|
|
||||||
|
assert( m_editModules );
|
||||||
|
|
||||||
// Add a VIEW_GROUP that serves as a preview for the new item
|
// Add a VIEW_GROUP that serves as a preview for the new item
|
||||||
KIGFX::VIEW_GROUP preview( m_view );
|
KIGFX::VIEW_GROUP preview( m_view );
|
||||||
m_view->Add( &preview );
|
m_view->Add( &preview );
|
||||||
|
@ -1299,6 +1333,7 @@ int DRAWING_TOOL::placeTextModule()
|
||||||
|
|
||||||
// Module has to be saved before any modification is made
|
// Module has to be saved before any modification is made
|
||||||
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
|
m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT );
|
||||||
|
m_board->m_Modules->SetLastEditTime();
|
||||||
m_board->m_Modules->GraphicalItems().PushFront( text );
|
m_board->m_Modules->GraphicalItems().PushFront( text );
|
||||||
|
|
||||||
m_view->Add( text );
|
m_view->Add( text );
|
||||||
|
@ -1341,6 +1376,8 @@ int DRAWING_TOOL::placeTextPcb()
|
||||||
{
|
{
|
||||||
TEXTE_PCB* text = NULL;
|
TEXTE_PCB* text = NULL;
|
||||||
|
|
||||||
|
assert( !m_editModules );
|
||||||
|
|
||||||
// Add a VIEW_GROUP that serves as a preview for the new item
|
// Add a VIEW_GROUP that serves as a preview for the new item
|
||||||
KIGFX::VIEW_GROUP preview( m_view );
|
KIGFX::VIEW_GROUP preview( m_view );
|
||||||
m_view->Add( &preview );
|
m_view->Add( &preview );
|
||||||
|
|
Loading…
Reference in New Issue