Commit efb96bcc authored by Wayne Stambaugh's avatar Wayne Stambaugh

Eeschema block end handler code improvements.

* Merge HandleBlockEnd() and HandleBlockEndByPopUp() into as single block
  end function HandleBlockEnd().
* Replace all instances of HandleBlockEndByPopUp() with HandleBlockEnd().
* Change block hot keys to send command events instead of directly calling
  end block handler.
parent bec78be1
...@@ -186,31 +186,22 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -186,31 +186,22 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
m_canvas->Refresh(); m_canvas->Refresh();
} }
/*
* HandleBlockEnd is called when: bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
* a block is defined
* or a schematic iten should be dragged
* When the block is defined, all items inside the block should be collected
* When a schematic iten should be dragged, only this item should be collected
*
* In all cases, connected items are collected when a drag command is activated
*/
bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
bool nextcmd = false; bool nextcmd = false;
bool zoom_command = false; bool zoom_command = false;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
bool currItemOnly = false;
if ( block->GetCommand() == BLOCK_DRAG && GetScreen()->GetCurItem() != NULL ) wxLogDebug( wxT( "Block end command %d, state %d, count %d" ),
currItemOnly = true; block->GetCommand(), block->GetState(), block->GetCount() );
if( block->GetCount() ) if( block->GetCount() )
{ {
BLOCK_STATE_T state = block->GetState(); BLOCK_STATE_T state = block->GetState();
BLOCK_COMMAND_T command = block->GetCommand(); BLOCK_COMMAND_T command = block->GetCommand();
m_canvas->CallEndMouseCapture( DC ); m_canvas->CallEndMouseCapture( aDC );
block->SetState( state ); block->SetState( state );
block->SetCommand( command ); block->SetCommand( command );
...@@ -231,7 +222,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -231,7 +222,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_ROTATE: case BLOCK_ROTATE:
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -243,25 +234,28 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -243,25 +234,28 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
RotateListOfItems( block->GetItems(), rotationPoint ); RotateListOfItems( block->GetItems(), rotationPoint );
OnModify(); OnModify();
} }
block->ClearItemsList(); block->ClearItemsList();
GetScreen()->TestDanglingEnds( m_canvas, DC ); GetScreen()->TestDanglingEnds( m_canvas, aDC );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG:
GetScreen()->BreakSegmentsOnJunctions(); GetScreen()->BreakSegmentsOnJunctions();
// fall through // fall through
case BLOCK_MOVE: case BLOCK_MOVE:
case BLOCK_COPY: case BLOCK_COPY:
if( currItemOnly ) if( GetScreen()->GetCurItem() != NULL )
{ {
ITEM_PICKER picker; ITEM_PICKER picker;
picker.SetItem( GetScreen()->GetCurItem() ); picker.SetItem( GetScreen()->GetCurItem() );
block->PushItem( picker ); block->PushItem( picker );
} }
else else
{
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
}
// fall through // fall through
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
...@@ -269,21 +263,21 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -269,21 +263,21 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
nextcmd = true; nextcmd = true;
GetScreen()->SelectBlockItems(); GetScreen()->SelectBlockItems();
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
block->SetState( STATE_BLOCK_MOVE ); block->SetState( STATE_BLOCK_MOVE );
} }
else else
{ {
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->SetMouseCapture( NULL, NULL ); m_canvas->SetMouseCapture( NULL, NULL );
} }
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE:
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -291,13 +285,13 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -291,13 +285,13 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
OnModify(); OnModify();
} }
block->ClearItemsList(); block->ClearItemsList();
GetScreen()->TestDanglingEnds( m_canvas, DC ); GetScreen()->TestDanglingEnds( m_canvas, aDC );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE:
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false ); DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -313,144 +307,17 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -313,144 +307,17 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
block->SetState( STATE_BLOCK_MOVE ); block->SetState( STATE_BLOCK_MOVE );
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM:
zoom_command = true; zoom_command = true;
break; break;
default:
break;
}
}
if( block->GetCommand() == BLOCK_ABORT )
{
GetScreen()->ClearDrawingState();
m_canvas->Refresh();
}
if( ! nextcmd )
{
block->SetState( STATE_NO_BLOCK );
block->SetCommand( BLOCK_IDLE );
GetScreen()->SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
false );
}
if( zoom_command )
Window_Zoom( GetScreen()->m_BlockLocate );
return nextcmd;
}
void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
bool blockCmdFinished = true; /* set to false for block command which
* have a next step
* and true if the block command is finished here
*/
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
// can convert only a block move command to an other command
if( block->GetCommand() != BLOCK_MOVE )
return;
// Useless if the new command is block move because we are already in block move.
if( Command == BLOCK_MOVE )
return;
block->SetCommand( (BLOCK_COMMAND_T) Command );
block->SetMessageBlock( this );
switch( block->GetCommand() )
{
case BLOCK_COPY: /* move to copy */
block->SetState( STATE_BLOCK_MOVE );
blockCmdFinished = false;
break;
case BLOCK_DRAG: /* move to Drag */
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
// Clear list of items to move, and rebuild it with items to drag:
block->ClearItemsList();
GetScreen()->BreakSegmentsOnJunctions();
GetScreen()->UpdatePickList();
if( block->GetCount() )
{
blockCmdFinished = false;
GetScreen()->SelectBlockItems();
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
block->SetState( STATE_BLOCK_MOVE );
}
break;
case BLOCK_DELETE: /* move to Delete */
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
DeleteItemsInList( m_canvas, block->GetItems() );
OnModify();
}
GetScreen()->TestDanglingEnds( m_canvas, DC );
m_canvas->Refresh();
break;
case BLOCK_SAVE: /* Save list in paste buffer*/
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
copyBlockItems( block->GetItems() );
MoveItemsInList( m_blockItems.GetItems(), move_vector );
}
break;
case BLOCK_ZOOM: /* Window Zoom */
m_canvas->CallEndMouseCapture( DC );
m_canvas->SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
Window_Zoom( GetScreen()->m_BlockLocate );
break;
case BLOCK_ROTATE:
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
/* Compute the rotation center and put it on grid */
wxPoint rotationPoint = block->Centre();
rotationPoint = GetNearestGridPosition( rotationPoint );
SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->GetItems(), rotationPoint );
OnModify();
}
GetScreen()->TestDanglingEnds( m_canvas, DC );
m_canvas->Refresh();
break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
if( m_canvas->IsMouseCaptured() ) GetScreen()->UpdatePickList();
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
/* Compute the mirror center and put it on grid */ // Compute the mirror center and put it on grid.
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetNearestGridPosition( mirrorPoint );
SetCrossHairPosition( mirrorPoint ); SetCrossHairPosition( mirrorPoint );
...@@ -459,17 +326,17 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -459,17 +326,17 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
OnModify(); OnModify();
} }
GetScreen()->TestDanglingEnds( m_canvas, DC ); GetScreen()->TestDanglingEnds( m_canvas, aDC );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
if( m_canvas->IsMouseCaptured() ) GetScreen()->UpdatePickList();
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); DrawAndSizingBlockOutlines( m_canvas, aDC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
/* Compute the mirror center and put it on grid */ // Compute the mirror center and put it on grid.
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetNearestGridPosition( mirrorPoint );
SetCrossHairPosition( mirrorPoint ); SetCrossHairPosition( mirrorPoint );
...@@ -478,21 +345,34 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -478,21 +345,34 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
OnModify(); OnModify();
} }
GetScreen()->TestDanglingEnds( m_canvas, DC ); GetScreen()->TestDanglingEnds( m_canvas, aDC );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
default: default:
break; break;
} }
}
if( blockCmdFinished ) if( block->GetCommand() == BLOCK_ABORT )
{ {
block->Clear(); GetScreen()->ClearDrawingState();
m_canvas->Refresh();
}
if( ! nextcmd )
{
block->SetState( STATE_NO_BLOCK );
block->SetCommand( BLOCK_IDLE );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
false ); false );
} }
if( zoom_command )
Window_Zoom( GetScreen()->m_BlockLocate );
return nextcmd;
} }
......
...@@ -183,9 +183,9 @@ static EDA_HOTKEY HkCopyComponentOrText( wxT( "Copy Component or Label" ), ...@@ -183,9 +183,9 @@ static EDA_HOTKEY HkCopyComponentOrText( wxT( "Copy Component or Label" ),
ID_POPUP_SCH_COPY_ITEM ); ID_POPUP_SCH_COPY_ITEM );
static EDA_HOTKEY HkDrag( wxT( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM ); static EDA_HOTKEY HkDrag( wxT( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
static EDA_HOTKEY HkSaveBlock( wxT( "Save Block" ), HK_SAVE_BLOCK, 'C' + GR_KB_CTRL ); static EDA_HOTKEY HkSaveBlock( wxT( "Save Block" ), HK_SAVE_BLOCK, 'C' + GR_KB_CTRL, wxID_COPY );
static EDA_HOTKEY HkMove2Drag( wxT( "Move Block -> Drag Block" ), static EDA_HOTKEY HkMove2Drag( wxT( "Move Block -> Drag Block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' ); HK_MOVEBLOCK_TO_DRAGBLOCK, '\t', ID_POPUP_DRAG_BLOCK );
static EDA_HOTKEY HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT ); static EDA_HOTKEY HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
static EDA_HOTKEY HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE ); static EDA_HOTKEY HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
...@@ -367,18 +367,12 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -367,18 +367,12 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
case HK_ZOOM_AUTO: case HK_ZOOM_AUTO:
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
case HK_SAVE_BLOCK: // Copy block to clip board.
cmd.SetId( hotKey->m_IdMenuEvent ); cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
HandleBlockEndByPopUp( BLOCK_DRAG, aDC );
break;
case HK_SAVE_BLOCK:
HandleBlockEndByPopUp( BLOCK_SAVE, aDC );
break;
case HK_DELETE: case HK_DELETE:
if( notBusy ) if( notBusy )
DeleteItemAtCrossHair( aDC ); DeleteItemAtCrossHair( aDC );
......
...@@ -127,7 +127,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -127,7 +127,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE ) if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
break; break;
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_DELETE );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
SetRepeatItem( NULL ); SetRepeatItem( NULL );
SetSheetNumberAndCount(); SetSheetNumberAndCount();
break; break;
...@@ -314,7 +316,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -314,7 +316,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_COPY: // really this is a Save block for paste case wxID_COPY: // really this is a Save block for paste
HandleBlockEndByPopUp( BLOCK_SAVE, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_SAVE );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
...@@ -324,23 +328,31 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -324,23 +328,31 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
HandleBlockEndByPopUp( BLOCK_ZOOM, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_ZOOM );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_DELETE );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
SetSheetNumberAndCount(); SetSheetNumberAndCount();
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_COPY, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_COPY );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DRAG_BLOCK: case ID_POPUP_DRAG_BLOCK:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_DRAG, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_DRAG );
screen->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc );
break; break;
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
...@@ -736,7 +748,8 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) ...@@ -736,7 +748,8 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
// Allows block rotate operation on hot key. // Allows block rotate operation on hot key.
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{ {
HandleBlockEndByPopUp( BLOCK_ROTATE, &dc ); screen->m_BlockLocate.SetCommand( BLOCK_ROTATE );
HandleBlockEnd( &dc );
return; return;
} }
...@@ -818,6 +831,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) ...@@ -818,6 +831,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
// Set the locat filter, according to the edit command // Set the locat filter, according to the edit command
const KICAD_T* filterList = SCH_COLLECTOR::EditableItems; const KICAD_T* filterList = SCH_COLLECTOR::EditableItems;
const KICAD_T* filterListAux = NULL; const KICAD_T* filterListAux = NULL;
switch( aEvent.GetId() ) switch( aEvent.GetId() )
{ {
case ID_SCH_EDIT_COMPONENT_REFERENCE: case ID_SCH_EDIT_COMPONENT_REFERENCE:
...@@ -838,13 +852,12 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) ...@@ -838,13 +852,12 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
default: default:
break; break;
} }
item = LocateAndShowItem( data->GetPosition(), filterList,
aEvent.GetInt() ); item = LocateAndShowItem( data->GetPosition(), filterList, aEvent.GetInt() );
// If no item found, and if an auxiliary filter exists, try to use it // If no item found, and if an auxiliary filter exists, try to use it
if( !item && filterListAux ) if( !item && filterListAux )
item = LocateAndShowItem( data->GetPosition(), filterListAux, item = LocateAndShowItem( data->GetPosition(), filterListAux, aEvent.GetInt() );
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited. // Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) ) if( (item == NULL) || (item->GetFlags() != 0) )
...@@ -988,11 +1001,23 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent ) ...@@ -988,11 +1001,23 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{ {
if( aEvent.GetId() == ID_SCH_MIRROR_X ) if( aEvent.GetId() == ID_SCH_MIRROR_X )
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc ); {
m_canvas->MoveCursorToCrossHair();
screen->m_BlockLocate.SetMessageBlock( this );
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
HandleBlockEnd( &dc );
}
else if( aEvent.GetId() == ID_SCH_MIRROR_Y ) else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc ); {
m_canvas->MoveCursorToCrossHair();
screen->m_BlockLocate.SetMessageBlock( this );
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_Y );
HandleBlockEnd( &dc );
}
else else
{
wxFAIL_MSG( wxT( "Unknown block oriention command ID." ) ); wxFAIL_MSG( wxT( "Unknown block oriention command ID." ) );
}
return; return;
} }
......
...@@ -1135,17 +1135,6 @@ public: ...@@ -1135,17 +1135,6 @@ public:
*/ */
void InitBlockPasteInfos(); void InitBlockPasteInfos();
/* Function HandleBlockEndByPopUp
* performs an end block command from context menu.
*
* This can be called only after HandleBlockEnd and the current command is block
* move. Execute a command other than block move from the current block move
* selected items list. Due to (minor) problems in undo/redo or/and display block,
* a mirror/rotate command is immediately executed and multiple block commands are
* not allowed (multiple commands are tricky to undo/redo in one time)
*/
void HandleBlockEndByPopUp( int Command, wxDC* DC );
/** /**
* Function ReturnBlockCommand * Function ReturnBlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...) * Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
...@@ -1172,10 +1161,12 @@ public: ...@@ -1172,10 +1161,12 @@ public:
* depending on the current block command, this command is executed * depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace * or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate * in GetScreen()->m_BlockLocate
*
* @param aDC is a device context to draw on.
* @return false if no item selected, or command finished, * @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later * true if some items found and HandleBlockPlace must be called later
*/ */
virtual bool HandleBlockEnd( wxDC* DC ); virtual bool HandleBlockEnd( wxDC* aDC );
/** /**
* Function RepeatDrawItem * Function RepeatDrawItem
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment