Commit 2e82a3f9 authored by jean-pierre charras's avatar jean-pierre charras

Due to (minor) problems in block rotate/mirror (refesh display and undo/redo)...

Due to (minor) problems  in block rotate/mirror (refesh display and undo/redo) go back to old behavior (command immediately executed , and do not entering a move block after a block mirror/rotate)
parents b0923f78 363548f2
...@@ -346,16 +346,26 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -346,16 +346,26 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
/* Manage end block command from context menu. /* Manage end block command from context menu.
* Called after HandleBlockEnd. * Can be called only :
* From the command block move can execute a command other than block move. * after HandleBlockEnd
* and if 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 immediatly executed and multible block commands
* are not allowed (multiple commands are tricky to undo/redo in one time)
*/ */
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
int ii = 0; 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; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
// can convert only a block move command to an other command
if( block->m_Command != BLOCK_MOVE ) if( block->m_Command != BLOCK_MOVE )
return; return;
// Useless if the new command is block move because we are already in block move.
if( Command == BLOCK_MOVE ) if( Command == BLOCK_MOVE )
return; return;
...@@ -366,17 +376,13 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -366,17 +376,13 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
case BLOCK_COPY: /* move to copy */ case BLOCK_COPY: /* move to copy */
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
ii = 1; blockCmdFinished = false;
break; break;
case BLOCK_DRAG: /* move to Drag */ case BLOCK_DRAG: /* move to Drag */
/* ???
* Effacement de la liste des structures de pointage,
* qui est devenue erronnee
*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
// Clear list of items to move, and rebuild it with items to drag:
block->ClearItemsList(); block->ClearItemsList();
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( GetScreen() );
...@@ -384,7 +390,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -384,7 +390,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() ); PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() );
if( block->GetCount() ) if( block->GetCount() )
{ {
ii = 1; blockCmdFinished = false;
CollectStructsToDrag( (SCH_SCREEN*) GetScreen() ); CollectStructsToDrag( (SCH_SCREEN*) GetScreen() );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
...@@ -397,16 +403,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -397,16 +403,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->GetCount() ) if( block->GetCount() )
{ {
ii = -1;
DeleteItemsInList( DrawPanel, block->m_ItemsSelection ); DeleteItemsInList( DrawPanel, block->m_ItemsSelection );
OnModify(); OnModify();
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
DrawPanel->Refresh();
break; break;
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save list in paste buffer*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->GetCount() ) if( block->GetCount() )
...@@ -415,7 +419,6 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -415,7 +419,6 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
-GetScreen()->m_BlockLocate.m_BlockLastCursorPosition; -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition;
SaveStructListForPaste( block->m_ItemsSelection ); SaveStructListForPaste( block->m_ItemsSelection );
MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector ); MoveItemsInList( g_BlockSaveDataList.m_ItemsSelection, move_vector );
ii = -1;
} }
break; break;
...@@ -432,7 +435,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -432,7 +435,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->GetCount() ) if( block->GetCount() )
{ {
ii = 1; // blockCmdFinished = true;
/* Compute the rotation center and put it on grid */ /* Compute the rotation center and put it on grid */
wxPoint rotationPoint = block->Centre(); wxPoint rotationPoint = block->Centre();
PutOnGrid( &rotationPoint ); PutOnGrid( &rotationPoint );
...@@ -444,8 +447,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -444,8 +447,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
block->m_State = STATE_BLOCK_MOVE; // block->m_State = STATE_BLOCK_MOVE;
block->m_Command = BLOCK_MOVE; //allows multiple rotate // block->m_Command = BLOCK_MOVE; //allows multiple rotate
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
...@@ -453,7 +456,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -453,7 +456,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->GetCount() ) if( block->GetCount() )
{ {
ii = 1; // blockCmdFinished = true;
/* 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();
PutOnGrid( &mirrorPoint ); PutOnGrid( &mirrorPoint );
...@@ -462,8 +465,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -462,8 +465,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
mirrorPoint ); mirrorPoint );
Mirror_X_ListOfItems( block->m_ItemsSelection, mirrorPoint ); Mirror_X_ListOfItems( block->m_ItemsSelection, mirrorPoint );
OnModify(); OnModify();
block->m_State = STATE_BLOCK_MOVE; // block->m_State = STATE_BLOCK_MOVE;
block->m_Command = BLOCK_MOVE; //allows multiple mirrors // block->m_Command = BLOCK_MOVE; //allows multiple mirrors
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
...@@ -474,7 +477,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -474,7 +477,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->GetCount() ) if( block->GetCount() )
{ {
ii = 1; // blockCmdFinished = true;
/* 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();
PutOnGrid( &mirrorPoint ); PutOnGrid( &mirrorPoint );
...@@ -483,8 +486,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -483,8 +486,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
mirrorPoint ); mirrorPoint );
MirrorListOfItems( block->m_ItemsSelection, mirrorPoint ); MirrorListOfItems( block->m_ItemsSelection, mirrorPoint );
OnModify(); OnModify();
block->m_State = STATE_BLOCK_MOVE; // block->m_State = STATE_BLOCK_MOVE;
block->m_Command = BLOCK_MOVE; //allows multiple mirrors // block->m_Command = BLOCK_MOVE; //allows multiple mirrors
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
...@@ -494,7 +497,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -494,7 +497,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
break; break;
} }
if( ii <= 0 ) if( blockCmdFinished )
{ {
block->ClearItemsList(); block->ClearItemsList();
block->m_Flags = 0; block->m_Flags = 0;
......
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