Don't assume GetFlags() != 0 means it's being edited.

It could just mean it's selected, highlighted or brightened.

Fixes: lp:1794624
* https://bugs.launchpad.net/kicad/+bug/1794624
This commit is contained in:
Jeff Young 2018-09-27 21:09:00 +01:00
parent 317ca8e64d
commit 19b1ae35ce
5 changed files with 18 additions and 15 deletions

View File

@ -208,9 +208,12 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
// save old image in undo list if not already in edit
// or the image to be edited is part of a block
if( aItem->GetFlags() == 0 ||
GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aItem->GetFlags() & mask ) == 0
|| GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
SaveCopyInUndoList( aItem, UR_CHANGED );
}
dlg.TransfertToImage( aItem->GetImage() );
OnModify();

View File

@ -54,7 +54,8 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
wxT( "Invalid schematic field parent item." ) );
// Save old component in undo list if not already in edit, or moving.
if( aField->GetFlags() == 0 )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( component, UR_CHANGED );
// Don't use GetText() here. If the field is the reference designator and it's parent
@ -100,7 +101,8 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField )
SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
// Save old component in undo list if not already in edit, or moving.
if( aField->GetFlags() == 0 )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 )
SaveCopyInUndoList( component, UR_CHANGED );
if( aField->GetTextAngle() == TEXT_ANGLE_HORIZ )

View File

@ -701,7 +701,8 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
m_footprint->CalculateBoundingBox();
// This is a simple edit, we must create an undo entry
if( m_footprint->GetFlags() == 0 )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( m_footprint->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
commit.Push( _( "Modify module properties" ) );
SetReturnCode( PRM_EDITOR_EDIT_OK );

View File

@ -248,7 +248,8 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( m_canvas, DC, GR_XOR );
SetMsgPanel( TextePcb );
if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( TextePcb->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetTextPos() );
else // set flag edit, to show it was a complex command
TextePcb->SetFlags( IN_EDIT );
@ -272,7 +273,8 @@ void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC )
aTextePcb->Draw( m_canvas, aDC, GR_XOR );
SetMsgPanel( aTextePcb );
if( aTextePcb->GetFlags() == 0 ) // i.e. not edited, or moved
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aTextePcb->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetTextPos() );
else // set edit flag, for the current command
aTextePcb->SetFlags( IN_EDIT );

View File

@ -111,28 +111,23 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{
EDA_ITEM* PtStruct;
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
bool tmp = displ_opts->m_DisplayDrawItemsFill;
if( Segment == NULL )
return;
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( Segment->IsNew() ) // Trace in progress.
{
// Delete current segment.
displ_opts->m_DisplayDrawItemsFill = SKETCH;
Segment->Draw( m_canvas, DC, GR_XOR );
PtStruct = Segment->Back();
Segment ->DeleteStructure();
if( PtStruct && (PtStruct->Type() == PCB_LINE_T ) )
Segment = (DRAWSEGMENT*) PtStruct;
Segment->DeleteStructure();
displ_opts->m_DisplayDrawItemsFill = tmp;
SetCurItem( NULL );
}
else if( Segment->GetFlags() == 0 )
else if( ( Segment->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
{
Segment->Draw( m_canvas, DC, GR_XOR );
Segment->ClearFlags();