Eeschema: fix a bug I created in commit 3018
This commit is contained in:
parent
a0e0ad6fea
commit
3ea0c1065c
|
@ -73,7 +73,9 @@ static void abortMoveText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last text item." ) );
|
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last text item." ) );
|
||||||
|
|
||||||
screen->AddToDrawList( item );
|
screen->AddToDrawList( item );
|
||||||
|
// the owner of item is no more parent, this is the draw list of screen:
|
||||||
parent->SetUndoItem( NULL );
|
parent->SetUndoItem( NULL );
|
||||||
|
|
||||||
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||||
item->ClearFlags();
|
item->ClearFlags();
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,7 +337,9 @@ void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
|
||||||
|
|
||||||
undoItem->ClearFlags();
|
undoItem->ClearFlags();
|
||||||
picker.SetLink( undoItem );
|
picker.SetLink( undoItem );
|
||||||
|
// the owner of undoItem is no more frame, this is picker:
|
||||||
frame->SetUndoItem( NULL );
|
frame->SetUndoItem( NULL );
|
||||||
|
|
||||||
pickList.PushItem( picker );
|
pickList.PushItem( picker );
|
||||||
frame->SaveCopyInUndoList( pickList, UR_EXCHANGE_T );
|
frame->SaveCopyInUndoList( pickList, UR_EXCHANGE_T );
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,15 +352,20 @@ void SCH_EDIT_FRAME::CreateScreens()
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SetUndoItem( const SCH_ITEM* aItem )
|
void SCH_EDIT_FRAME::SetUndoItem( const SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( m_undoItem != NULL )
|
// if aItem != NULL, delete a previous m_undoItem, if exists
|
||||||
|
// if aItme = NULL, just clear m_undoItem,
|
||||||
|
// because when calling SetUndoItem( NULL ), we only clear m_undoItem,
|
||||||
|
// because the owner of m_undoItem is no more me.
|
||||||
|
if( aItem && m_undoItem )
|
||||||
{
|
{
|
||||||
delete m_undoItem;
|
delete m_undoItem;
|
||||||
m_undoItem = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_undoItem = NULL;
|
||||||
|
|
||||||
if( aItem )
|
if( aItem )
|
||||||
m_undoItem = aItem->Clone();
|
m_undoItem = aItem->Clone();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,9 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
|
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
|
||||||
|
|
||||||
screen->AddToDrawList( item );
|
screen->AddToDrawList( item );
|
||||||
|
// the owner of item is no more parent, this is the draw list of screen:
|
||||||
parent->SetUndoItem( NULL );
|
parent->SetUndoItem( NULL );
|
||||||
|
|
||||||
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||||
item->ClearFlags();
|
item->ClearFlags();
|
||||||
SCH_SHEET* sheet = ( SCH_SHEET* ) item;
|
SCH_SHEET* sheet = ( SCH_SHEET* ) item;
|
||||||
|
|
|
@ -310,9 +310,9 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pas_45 = wxRound( GetScreen()->GetGridSize().x / 2 );
|
int segm_step_45 = wxRound( GetScreen()->GetGridSize().x / 2 );
|
||||||
if( pas_45 < curTrack->m_Width )
|
if( segm_step_45 < ( curTrack->m_Width * 2 ) )
|
||||||
pas_45 = curTrack->m_Width;
|
segm_step_45 = curTrack->m_Width * 2;
|
||||||
|
|
||||||
// Test if the segments are horizontal or vertical.
|
// Test if the segments are horizontal or vertical.
|
||||||
dx0 = prevTrack->m_End.x - prevTrack->m_Start.x;
|
dx0 = prevTrack->m_End.x - prevTrack->m_Start.x;
|
||||||
|
@ -322,10 +322,10 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
dy1 = curTrack->m_End.y - curTrack->m_Start.y;
|
dy1 = curTrack->m_End.y - curTrack->m_Start.y;
|
||||||
|
|
||||||
// Segments must be of sufficient length.
|
// Segments must be of sufficient length.
|
||||||
if( MAX( abs( dx0 ), abs( dy0 ) ) < ( pas_45 * 2 ) )
|
if( MAX( abs( dx0 ), abs( dy0 ) ) < ( segm_step_45 * 2 ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( MAX( abs( dx1 ), abs( dy1 ) ) < ( pas_45 * 2 ) )
|
if( MAX( abs( dx1 ), abs( dy1 ) ) < ( segm_step_45 * 2 ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Create a new segment and connect it with the previous 2 segments. */
|
/* Create a new segment and connect it with the previous 2 segments. */
|
||||||
|
@ -347,14 +347,14 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
* horizontal segment.
|
* horizontal segment.
|
||||||
*/
|
*/
|
||||||
if( dy0 > 0 )
|
if( dy0 > 0 )
|
||||||
newTrack->m_Start.y -= pas_45;
|
newTrack->m_Start.y -= segm_step_45;
|
||||||
else
|
else
|
||||||
newTrack->m_Start.y += pas_45;
|
newTrack->m_Start.y += segm_step_45;
|
||||||
|
|
||||||
if( dx1 > 0 )
|
if( dx1 > 0 )
|
||||||
newTrack->m_End.x += pas_45;
|
newTrack->m_End.x += segm_step_45;
|
||||||
else
|
else
|
||||||
newTrack->m_End.x -= pas_45;
|
newTrack->m_End.x -= segm_step_45;
|
||||||
|
|
||||||
if( Drc_On && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) )
|
if( Drc_On && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) )
|
||||||
{
|
{
|
||||||
|
@ -382,14 +382,14 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
* (horizontal) and segment 2 (vertical)
|
* (horizontal) and segment 2 (vertical)
|
||||||
*/
|
*/
|
||||||
if( dx0 > 0 )
|
if( dx0 > 0 )
|
||||||
newTrack->m_Start.x -= pas_45;
|
newTrack->m_Start.x -= segm_step_45;
|
||||||
else
|
else
|
||||||
newTrack->m_Start.x += pas_45;
|
newTrack->m_Start.x += segm_step_45;
|
||||||
|
|
||||||
if( dy1 > 0 )
|
if( dy1 > 0 )
|
||||||
newTrack->m_End.y += pas_45;
|
newTrack->m_End.y += segm_step_45;
|
||||||
else
|
else
|
||||||
newTrack->m_End.y -= pas_45;
|
newTrack->m_End.y -= segm_step_45;
|
||||||
|
|
||||||
if( Drc_On && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) )
|
if( Drc_On && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue