Eeschema copy/cut/paste to ctrl+c/x/v cut is now undoable Highlight net is now at ctrl+b by default

This commit is contained in:
Kristoffer Ödmark 2017-07-03 13:46:59 +02:00 committed by Maciej Suminski
parent 65fea1b92b
commit 4fb2f80dd4
6 changed files with 42 additions and 11 deletions

View File

@ -867,6 +867,8 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
DisplayError( this, wxT( "No block to paste" ), 20 );
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
m_canvas->SetMouseCaptureCallback( NULL );
block->SetState( STATE_NO_BLOCK );
block->SetMessageBlock( this );
return true;
}
@ -875,6 +877,8 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
block->ClearItemsList();
DisplayError( this,
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
block->SetState( STATE_NO_BLOCK );
block->SetMessageBlock( this );
return true;
}

View File

@ -299,11 +299,29 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
copyBlockItems( block->GetItems() );
MoveItemsInList( m_blockItems.GetItems(), move_vector );
}
}
block->ClearItemsList();
break;
case BLOCK_CUT:
GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
if( block->GetCount() )
{
wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
copyBlockItems( block->GetItems() );
MoveItemsInList( m_blockItems.GetItems(), move_vector );
DeleteItemsInList( m_canvas, block->GetItems() );
OnModify();
}
block->ClearItemsList();
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
break;
case BLOCK_PASTE:
block->SetState( STATE_BLOCK_MOVE );
break;

View File

@ -194,6 +194,8 @@ static EDA_HOTKEY HkCopyComponentOrText( _HKI( "Copy Component or Label" ),
static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
static EDA_HOTKEY HkSaveBlock( _HKI( "Save Block" ), HK_SAVE_BLOCK, 'C' + GR_KB_CTRL, wxID_COPY );
static EDA_HOTKEY HkPasteBlock( _HKI( "Paste Block" ), HK_PASTE_BLOCK, 'V' + GR_KB_CTRL, wxID_PASTE );
static EDA_HOTKEY HkCutBlock( _HKI( "Cut Block" ), HK_CUT_BLOCK, 'X' + GR_KB_CTRL, wxID_CUT );
static EDA_HOTKEY HkMove2Drag( _HKI( "Move Block -> Drag Block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t', ID_POPUP_DRAG_BLOCK );
static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
@ -230,7 +232,7 @@ static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UP
// Higtlight connection
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
'X' + GR_KB_CTRL );
'B' + GR_KB_CTRL );
// List of common hotkey descriptors
static EDA_HOTKEY* common_Hotkey_List[] =
@ -281,6 +283,8 @@ static EDA_HOTKEY* schematic_Hotkey_List[] =
&HkInsert,
&HkMove2Drag,
&HkSaveBlock,
&HkPasteBlock,
&HkCutBlock,
&HkMove,
&HkCopyComponentOrText,
&HkAddComponent,
@ -471,7 +475,9 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_ZOOM_AUTO:
case HK_ZOOM_SELECTION:
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
case HK_PASTE_BLOCK:
case HK_SAVE_BLOCK: // Copy block to paste buffer.
case HK_CUT_BLOCK:
cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
break;

View File

@ -43,6 +43,8 @@ enum hotkey_id_commnand {
HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_SAVE_BLOCK,
HK_PASTE_BLOCK,
HK_CUT_BLOCK,
HK_LIBEDIT_LOAD_PART,
HK_LIBEDIT_CREATE_PIN,
HK_DELETE_PIN,

View File

@ -123,17 +123,23 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetRepeatItem( NULL );
break;
case wxID_CUT:
case wxID_CUT: // save and delete block
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
break;
screen->m_BlockLocate.SetCommand( BLOCK_DELETE );
screen->m_BlockLocate.SetCommand( BLOCK_CUT );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
SetRepeatItem( NULL );
SetSheetNumberAndCount();
break;
case wxID_COPY: // really this is a Save block for paste
screen->m_BlockLocate.SetCommand( BLOCK_SAVE );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
break;
case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, GetCrossHairPosition() );
break;
@ -329,12 +335,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case wxID_COPY: // really this is a Save block for paste
screen->m_BlockLocate.SetCommand( BLOCK_SAVE );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
break;
case ID_POPUP_PLACE_BLOCK:
m_canvas->SetAutoPanRequest( false );
m_canvas->MoveCursorToCrossHair();

View File

@ -56,6 +56,7 @@ typedef enum {
BLOCK_SAVE,
BLOCK_DELETE,
BLOCK_PASTE,
BLOCK_CUT,
BLOCK_DRAG,
BLOCK_DRAG_ITEM, // like BLOCK_DRAG, when used to drag a selected component
// and not using an area defined by a mouse drag