Finish up remaining block operation inconsistencies.
In particular, don't move block back to start when duplicating, and don't move crosshair back to start when doing a cut, copy, or paste. Also fixes undo for libEdit block duplicate. Fixes: lp:1740138 * https://bugs.launchpad.net/kicad/+bug/1740138
This commit is contained in:
parent
350a6052c0
commit
d65bb73d4e
|
@ -209,11 +209,17 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
block->SetState( state );
|
block->SetState( state );
|
||||||
block->SetCommand( command );
|
block->SetCommand( command );
|
||||||
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
||||||
SetCrossHairPosition( block->GetEnd() );
|
|
||||||
|
|
||||||
if( block->GetCommand() != BLOCK_ABORT )
|
if( block->GetCommand() != BLOCK_ABORT
|
||||||
|
&& block->GetCommand() != BLOCK_DUPLICATE
|
||||||
|
&& block->GetCommand() != BLOCK_COPY
|
||||||
|
&& block->GetCommand() != BLOCK_CUT
|
||||||
|
&& block->GetCommand() != BLOCK_DELETE )
|
||||||
|
{
|
||||||
|
SetCrossHairPosition( block->GetEnd() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
{
|
{
|
||||||
|
@ -250,6 +256,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
if( block->GetCommand() == BLOCK_DUPLICATE )
|
if( block->GetCommand() == BLOCK_DUPLICATE )
|
||||||
{
|
{
|
||||||
DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
|
DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
|
||||||
|
block->SetLastCursorPosition( GetCrossHairPosition() );
|
||||||
SaveCopyInUndoList( block->GetItems(), UR_NEW );
|
SaveCopyInUndoList( block->GetItems(), UR_NEW );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
settings->m_ShowHiddenText = false;
|
settings->m_ShowHiddenText = false;
|
||||||
settings->m_ShowHiddenPins = m_showAllPins;
|
settings->m_ShowHiddenPins = m_showAllPins;
|
||||||
settings->SetShowPageLimits( m_showPageLimits );
|
settings->SetShowPageLimits( m_showPageLimits );
|
||||||
|
settings->m_ShowUmbilicals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -554,6 +555,7 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
// Hidden elements must be editable
|
// Hidden elements must be editable
|
||||||
settings->m_ShowHiddenText = true;
|
settings->m_ShowHiddenText = true;
|
||||||
settings->m_ShowHiddenPins = true;
|
settings->m_ShowHiddenPins = true;
|
||||||
|
settings->m_ShowUmbilicals = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,8 @@ void LIB_EDIT_FRAME::BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* a
|
||||||
newItem->SetFlags( SELECTED );
|
newItem->SetFlags( SELECTED );
|
||||||
oldItem->ClearFlags( SELECTED );
|
oldItem->ClearFlags( SELECTED );
|
||||||
|
|
||||||
|
newItem->SetOffset( aBlock->GetMoveVector() );
|
||||||
|
|
||||||
aItemsList.SetPickedItem( newItem, ii );
|
aItemsList.SetPickedItem( newItem, ii );
|
||||||
aItemsList.SetPickedItemStatus( UR_NEW, ii );
|
aItemsList.SetPickedItemStatus( UR_NEW, ii );
|
||||||
|
|
||||||
|
@ -162,45 +164,6 @@ void LIB_EDIT_FRAME::BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::BlockMirrorSelectedItemsH( const wxPoint& aCenter, LIB_PART* aPart, BLOCK_SELECTOR* aBlock )
|
|
||||||
{
|
|
||||||
for( LIB_ITEM& item : aPart->GetDrawItems() )
|
|
||||||
{
|
|
||||||
if( !item.IsSelected() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
item.MirrorHorizontal( aCenter );
|
|
||||||
item.ClearFlags();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::BlockMirrorSelectedItemsV( const wxPoint& aCenter, LIB_PART* aPart, BLOCK_SELECTOR* aBlock )
|
|
||||||
{
|
|
||||||
for( LIB_ITEM& item : aPart->GetDrawItems() )
|
|
||||||
{
|
|
||||||
if( !item.IsSelected() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
item.MirrorVertical( aCenter );
|
|
||||||
item.ClearFlags();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::BlockRotateSelectedItems( const wxPoint& aCenter, LIB_PART* aPart, BLOCK_SELECTOR* aBlock )
|
|
||||||
{
|
|
||||||
for( LIB_ITEM& item : aPart->GetDrawItems() )
|
|
||||||
{
|
|
||||||
if( !item.IsSelected() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
item.Rotate( aCenter );
|
|
||||||
item.ClearFlags();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
|
int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
|
||||||
{
|
{
|
||||||
int cmd = BLOCK_IDLE;
|
int cmd = BLOCK_IDLE;
|
||||||
|
@ -281,11 +244,17 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
block->SetState( state );
|
block->SetState( state );
|
||||||
block->SetCommand( command );
|
block->SetCommand( command );
|
||||||
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
||||||
SetCrossHairPosition( wxPoint( block->GetRight(), block->GetBottom() ) );
|
|
||||||
|
|
||||||
if( block->GetCommand() != BLOCK_ABORT )
|
if( block->GetCommand() != BLOCK_ABORT
|
||||||
|
&& block->GetCommand() != BLOCK_DUPLICATE
|
||||||
|
&& block->GetCommand() != BLOCK_COPY
|
||||||
|
&& block->GetCommand() != BLOCK_CUT
|
||||||
|
&& block->GetCommand() != BLOCK_DELETE )
|
||||||
|
{
|
||||||
|
SetCrossHairPosition( block->GetEnd() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
{
|
{
|
||||||
|
@ -308,7 +277,18 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
block->SetState( STATE_BLOCK_MOVE );
|
block->SetState( STATE_BLOCK_MOVE );
|
||||||
|
|
||||||
if( block->GetCommand() == BLOCK_DUPLICATE )
|
if( block->GetCommand() == BLOCK_DUPLICATE )
|
||||||
|
{
|
||||||
|
if( block->AppendUndo() )
|
||||||
|
; // UR_LIBEDIT saves entire state, so no need to append anything more
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SaveCopyInUndoList( GetCurPart(), UR_LIBEDIT );
|
||||||
|
block->SetAppendUndo();
|
||||||
|
}
|
||||||
|
|
||||||
BlockCopySelectedItems( pt, GetCurPart(), block );
|
BlockCopySelectedItems( pt, GetCurPart(), block );
|
||||||
|
block->SetLastCursorPosition( GetCrossHairPosition( true ) );
|
||||||
|
}
|
||||||
|
|
||||||
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
||||||
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||||
|
|
|
@ -749,9 +749,6 @@ public:
|
||||||
void BlockMoveSelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
void BlockMoveSelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
||||||
void BlockDeleteSelectedItems( LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
void BlockDeleteSelectedItems( LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
||||||
void BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
void BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
||||||
void BlockMirrorSelectedItemsH( const wxPoint& aCenter, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
|
||||||
void BlockMirrorSelectedItemsV( const wxPoint& aCenter, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
|
||||||
void BlockRotateSelectedItems( const wxPoint& aCenter, LIB_PART* aPart, BLOCK_SELECTOR* aBlock );
|
|
||||||
|
|
||||||
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ void SCH_EDIT_FRAME::DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST
|
||||||
if( aItemsList.GetCount() == 0 )
|
if( aItemsList.GetCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Keep trace of existing sheet paths. Duplicate block can modify this list
|
// Keep track of existing sheet paths. Duplicate block can modify this list
|
||||||
bool hasSheetCopied = false;
|
bool hasSheetCopied = false;
|
||||||
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
|
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
|
||||||
|
|
||||||
|
@ -238,6 +238,7 @@ void SCH_EDIT_FRAME::DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST
|
||||||
{
|
{
|
||||||
olditem = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
olditem = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
||||||
newitem = DuplicateStruct( olditem );
|
newitem = DuplicateStruct( olditem );
|
||||||
|
newitem->Move( aMoveVector );
|
||||||
|
|
||||||
aItemsList.SetPickedItem( newitem, ii );
|
aItemsList.SetPickedItem( newitem, ii );
|
||||||
aItemsList.SetPickedItemStatus( UR_NEW, ii );
|
aItemsList.SetPickedItemStatus( UR_NEW, ii );
|
||||||
|
|
|
@ -406,7 +406,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
|
||||||
m_gal->StrokeText( aField->GetText(), pos, orient );
|
m_gal->StrokeText( aField->GetText(), pos, orient );
|
||||||
|
|
||||||
// Draw the umbilical line
|
// Draw the umbilical line
|
||||||
if( aField->IsMoving() )
|
if( aField->IsMoving() && m_schSettings->m_ShowUmbilicals )
|
||||||
{
|
{
|
||||||
m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
|
m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
|
||||||
m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
|
m_gal->SetStrokeColor( COLOR4D( 0.0, 0.0, 1.0, 1.0 ) );
|
||||||
|
|
|
@ -100,6 +100,8 @@ public:
|
||||||
bool m_ShowHiddenText;
|
bool m_ShowHiddenText;
|
||||||
bool m_ShowHiddenPins;
|
bool m_ShowHiddenPins;
|
||||||
bool m_ShowPinsElectricalType;
|
bool m_ShowPinsElectricalType;
|
||||||
|
|
||||||
|
bool m_ShowUmbilicals;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue