Commit 8ec8cf3f authored by charras's avatar charras

Rework on undo/redo and block functions

parent 6d14766e
...@@ -4,6 +4,14 @@ KiCad ChangeLog 2009 ...@@ -4,6 +4,14 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-july-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++all
Rework on undo/redo and block functions
Better and simpler coding of block and undo/redo functions
The goal is to have the same functions in eeschema and pcbnew.
and have a full undo/redo in pcbnew.
2009-july-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-july-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++pcbnew ++pcbnew
......
This diff is collapsed.
...@@ -67,6 +67,14 @@ void PICKED_ITEMS_LIST::PICKED_ITEMS_LIST::ClearItemsList() ...@@ -67,6 +67,14 @@ void PICKED_ITEMS_LIST::PICKED_ITEMS_LIST::ClearItemsList()
m_ItemsList.clear(); m_ItemsList.clear();
} }
void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{
for(unsigned ii = 0; ii < m_ItemsList.size(); ii++ )
delete m_ItemsList[ii].m_Item;
m_ItemsList.clear();
}
ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx ) ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
{ {
ITEM_PICKER picker; ITEM_PICKER picker;
...@@ -160,6 +168,20 @@ bool PICKED_ITEMS_LIST::RemoveItem( unsigned aIdx ) ...@@ -160,6 +168,20 @@ bool PICKED_ITEMS_LIST::RemoveItem( unsigned aIdx )
return true; return true;
} }
/** Function CopyList
* copy all data from aSource
* Items picked are not copied. just pointer on them are copied
*/
void PICKED_ITEMS_LIST::CopyList(const PICKED_ITEMS_LIST & aSource)
{
ITEM_PICKER picker;
for(unsigned ii = 0; ii < aSource.GetCount(); ii++ )
{
picker = aSource.m_ItemsList[ii];
PushItem(picker);
}
}
/**********************************************/ /**********************************************/
/********** UNDO_REDO_CONTAINER ***************/ /********** UNDO_REDO_CONTAINER ***************/
......
...@@ -35,7 +35,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event ) ...@@ -35,7 +35,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
if( GetBaseScreen()->BlockLocate.m_Command != BLOCK_IDLE ) if( GetBaseScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
DrawPanel->m_PanelDefaultCursor ) ); DrawPanel->m_PanelDefaultCursor ) );
...@@ -74,13 +74,13 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -74,13 +74,13 @@ bool DrawPage( WinEDA_DrawPanel* panel )
/* scale is the ratio resolution/internal units */ /* scale is the ratio resolution/internal units */
float scale = 82.0 / panel->m_Parent->m_InternalUnits; float scale = 82.0 / panel->m_Parent->m_InternalUnits;
if( ActiveScreen->BlockLocate.m_Command != BLOCK_IDLE ) if( ActiveScreen->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
DrawBlock = TRUE; DrawBlock = TRUE;
DrawArea.SetX( (int) ( ActiveScreen->BlockLocate.GetX() ) ); DrawArea.SetX( ActiveScreen->m_BlockLocate.GetX() );
DrawArea.SetY( (int) ( ActiveScreen->BlockLocate.GetY() ) ); DrawArea.SetY( ActiveScreen->m_BlockLocate.GetY() );
DrawArea.SetWidth( (int) ( ActiveScreen->BlockLocate.GetWidth() ) ); DrawArea.SetWidth( ActiveScreen->m_BlockLocate.GetWidth() );
DrawArea.SetHeight( (int) ( ActiveScreen->BlockLocate.GetHeight() ) ); DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() );
} }
/* modification des cadrages et reglages locaux */ /* modification des cadrages et reglages locaux */
......
...@@ -488,7 +488,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key ) ...@@ -488,7 +488,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key )
void WinEDA_DrawFrame::InitBlockPasteInfos() void WinEDA_DrawFrame::InitBlockPasteInfos()
{ {
GetBaseScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetBaseScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
} }
...@@ -652,7 +652,31 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event ) ...@@ -652,7 +652,31 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
} }
} }
/* used in UpdateStatusBar() when coordinates are in mm
* try to approximate a coordinate (in 0.001 mm) to an easy to read number
* ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
*/
double Round_To_0(double x)
{
long long ix = wxRound(x * 1000); // ix is in 0.001 mm
if ( x < 0 ) NEGATE(ix);
int remainder = ix%10; // remainder is in 0.001 mm
if ( remainder <= 2 )
ix -= remainder; // truncate to the near number
else if (remainder >= 8 )
ix += 10 - remainder; // round to near number
if ( x < 0 ) NEGATE(ix);
return (double)ix/1000.0;
}
/** Function UpdateStatusBar()
* Displays in the bottom of the main window a stust:
* - Absolute Cursor coordinates
* - Relative Cursor coordinates (relative to the last coordinate stored when actiavte the space bar)
* ( in this status is also displayed the zoom level, but this is not made by this function)
*/
void WinEDA_DrawFrame::UpdateStatusBar() void WinEDA_DrawFrame::UpdateStatusBar()
{ {
wxString Line; wxString Line;
...@@ -670,20 +694,30 @@ void WinEDA_DrawFrame::UpdateStatusBar() ...@@ -670,20 +694,30 @@ void WinEDA_DrawFrame::UpdateStatusBar()
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
/* Display absolute coordinates: */ /* Display absolute coordinates: */
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ), double dXpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.x, m_InternalUnits );
To_User_Unit( g_UnitMetric, screen->m_Curseur.x, double dYpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.y, m_InternalUnits );
m_InternalUnits ), /* When using mm the conversion from 1/10000 inch to mm can give some non easy to read numbers,
To_User_Unit( g_UnitMetric, screen->m_Curseur.y, * like 1.999 or 2.001 that be better if displayed 2.000, so small diffs are filtered here.
m_InternalUnits ) ); */
if ( g_UnitMetric )
{
dXpos = Round_To_0(dXpos);
dYpos = Round_To_0(dYpos);
}
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ), dXpos, dYpos );
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
/* Display relative coordinates: */ /* Display relative coordinates: */
dx = screen->m_Curseur.x - screen->m_O_Curseur.x; dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
dy = screen->m_Curseur.y - screen->m_O_Curseur.y; dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UnitMetric, dx, m_InternalUnits );
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ), dYpos = To_User_Unit( g_UnitMetric, dy, m_InternalUnits );
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ), if ( g_UnitMetric )
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) ); {
dXpos = Round_To_0(dXpos);
dYpos = Round_To_0(dYpos);
}
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ), dXpos, dYpos );
SetStatusText( Line, 3 ); SetStatusText( Line, 3 );
} }
......
...@@ -1095,7 +1095,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1095,7 +1095,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
} }
else if( event.LeftUp() ) else if( event.LeftUp() )
{ {
if( screen->BlockLocate.m_State==STATE_NO_BLOCK // A block command is in progress: a left up is the end of block if( screen->m_BlockLocate.m_State==STATE_NO_BLOCK // A block command is in progress: a left up is the end of block
&& !s_IgnoreNextLeftButtonRelease ) // This is the end of a double click, already seen && !s_IgnoreNextLeftButtonRelease ) // This is the end of a double click, already seen
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels ); m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
...@@ -1111,7 +1111,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1111,7 +1111,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
s_IgnoreNextLeftButtonRelease = false; s_IgnoreNextLeftButtonRelease = false;
} }
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) if( event.ButtonUp( 2 ) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
{ {
// The middle button has been released, with no block command: // The middle button has been released, with no block command:
// We use it for a zoom center at cursor position command // We use it for a zoom center at cursor position command
...@@ -1158,14 +1158,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1158,14 +1158,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) ) if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
{ {
if( (screen->BlockLocate.m_Command == BLOCK_IDLE) if( (screen->m_BlockLocate.m_Command == BLOCK_IDLE)
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) || (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
{ {
screen->BlockLocate.SetOrigin( m_CursorStartPos ); screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
} }
if( event.LeftDown() || event.MiddleDown() ) if( event.LeftDown() || event.MiddleDown() )
{ {
if( screen->BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{ {
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE;
m_Parent->HandleBlockPlace( &DC ); m_Parent->HandleBlockPlace( &DC );
...@@ -1177,7 +1177,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1177,7 +1177,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
&& ManageCurseur == NULL && ManageCurseur == NULL
&& ForceCloseManageCurseur == NULL ) && ForceCloseManageCurseur == NULL )
{ // Mouse is dragging: if no block in progress: start a block command { // Mouse is dragging: if no block in progress: start a block command
if( screen->BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ // Start a block command { // Start a block command
int cmd_type = kbstat; int cmd_type = kbstat;
...@@ -1217,10 +1217,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1217,10 +1217,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
*/ */
#define BLOCK_MINSIZE_LIMIT 1 #define BLOCK_MINSIZE_LIMIT 1
bool BlockIsSmall = bool BlockIsSmall =
( ABS( screen->Scale( screen->BlockLocate.GetWidth() ) ) < BLOCK_MINSIZE_LIMIT) ( ABS( screen->Scale( screen->m_BlockLocate.GetWidth() ) ) < BLOCK_MINSIZE_LIMIT)
&& ( ABS( screen->Scale( screen->BlockLocate.GetHeight() ) ) < BLOCK_MINSIZE_LIMIT); && ( ABS( screen->Scale( screen->m_BlockLocate.GetHeight() ) ) < BLOCK_MINSIZE_LIMIT);
if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall ) if( (screen->m_BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
{ {
if( ForceCloseManageCurseur ) if( ForceCloseManageCurseur )
{ {
...@@ -1229,12 +1229,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1229,12 +1229,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
} }
SetCursor( m_PanelCursor = m_PanelDefaultCursor ); SetCursor( m_PanelCursor = m_PanelDefaultCursor );
} }
else if( screen->BlockLocate.m_State == STATE_BLOCK_END ) else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
{ {
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE;
m_Parent->HandleBlockEnd( &DC ); m_Parent->HandleBlockEnd( &DC );
SetCursor( m_PanelCursor = m_PanelDefaultCursor ); SetCursor( m_PanelCursor = m_PanelDefaultCursor );
if( screen->BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{ {
m_AutoPAN_Request = TRUE; m_AutoPAN_Request = TRUE;
SetCursor( m_PanelCursor = wxCURSOR_HAND ); SetCursor( m_PanelCursor = wxCURSOR_HAND );
...@@ -1244,10 +1244,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1244,10 +1244,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
} }
// End of block command on a double click // End of block command on a double click
// To avoid an unwanted block move command if the move is moved while double click // To avoid an unwanted block move command if the mouse is moved while double clicking
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
{ {
if( screen->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
if( ForceCloseManageCurseur ) if( ForceCloseManageCurseur )
{ {
...@@ -1261,7 +1261,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1261,7 +1261,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
#if 0 #if 0
wxString msg_debug; wxString msg_debug;
msg_debug.Printf( " block state %d, cmd %d", msg_debug.Printf( " block state %d, cmd %d",
screen->BlockLocate.m_State, screen->BlockLocate.m_Command ); screen->m_BlockLocate.m_State, screen->m_BlockLocate.m_Command );
m_Parent->PrintMsg( msg_debug ); m_Parent->PrintMsg( msg_debug );
#endif #endif
......
This diff is collapsed.
...@@ -255,21 +255,21 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -255,21 +255,21 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
{ {
int ItemsCount = 0, MustDoPlace = 0; int ItemsCount = 0, MustDoPlace = 0;
if( GetScreen()->BlockLocate.m_BlockDrawStruct ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
BlockState state = GetScreen()->BlockLocate.m_State; BlockState state = GetScreen()->m_BlockLocate.m_State;
CmdBlockType command = GetScreen()->BlockLocate.m_Command; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
GetScreen()->BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_State = state;
GetScreen()->BlockLocate.m_Command = command; GetScreen()->m_BlockLocate.m_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines; DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand; DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
GetScreen()->m_Curseur.x = GetScreen()->BlockLocate.GetRight(); GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
GetScreen()->m_Curseur.y = GetScreen()->BlockLocate.GetBottom(); GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
switch( GetScreen()->BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
...@@ -278,7 +278,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -278,7 +278,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
{ {
MustDoPlace = 1; MustDoPlace = 1;
...@@ -288,7 +288,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -288,7 +288,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
} }
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -296,11 +296,11 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -296,11 +296,11 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
MustDoPlace = 1; MustDoPlace = 1;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
DeleteMarkedItems( CurrentLibEntry ); DeleteMarkedItems( CurrentLibEntry );
...@@ -315,14 +315,14 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -315,14 +315,14 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_INVERT: case BLOCK_INVERT:
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
MirrorMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.Centre() ); MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
Window_Zoom( GetScreen()->BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
case BLOCK_ABORT: case BLOCK_ABORT:
...@@ -334,13 +334,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -334,13 +334,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
if( MustDoPlace <= 0 ) if( MustDoPlace <= 0 )
{ {
if( GetScreen()->BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
{ {
ClearMarkItems( CurrentLibEntry ); ClearMarkItems( CurrentLibEntry );
} }
GetScreen()->BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
...@@ -371,9 +371,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -371,9 +371,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
} }
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
switch( GetScreen()->BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
err = TRUE; err = TRUE;
...@@ -382,25 +382,25 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -382,25 +382,25 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
MoveMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.m_MoveVector ); MoveMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
CopyMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.m_MoveVector ); CopyMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
break; break;
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */ case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_INVERT: /* Invert by popup menu, from block move */ case BLOCK_INVERT: /* Invert by popup menu, from block move */
SaveCopyInUndoList( CurrentLibEntry ); SaveCopyInUndoList( CurrentLibEntry );
MirrorMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.Centre() ); MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ZOOM: // Handled by HandleBlockEnd case BLOCK_ZOOM: // Handled by HandleBlockEnd
...@@ -417,9 +417,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -417,9 +417,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
...@@ -436,20 +436,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -436,20 +436,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* L'ensemble du block suit le curseur * L'ensemble du block suit le curseur
*/ */
{ {
DrawBlockStruct* PtBlock; BLOCK_SELECTOR* PtBlock;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
LibEDA_BaseStruct* item; LibEDA_BaseStruct* item;
wxPoint move_offset; wxPoint move_offset;
PtBlock = &panel->GetScreen()->BlockLocate; PtBlock = &screen->m_BlockLocate;
GRSetDrawMode( DC, g_XorMode );
/* Effacement ancien cadre */ /* Effacement ancien cadre */
if( erase ) if( erase )
{ {
PtBlock->Offset( PtBlock->m_MoveVector ); PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
PtBlock->Draw( panel, DC );
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
if( CurrentLibEntry ) if( CurrentLibEntry )
{ {
...@@ -474,9 +471,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -474,9 +471,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y; PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
PtBlock->Offset( PtBlock->m_MoveVector ); PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
PtBlock->Draw( panel, DC );
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
if( CurrentLibEntry ) if( CurrentLibEntry )
......
...@@ -40,7 +40,7 @@ bool g_LastSearchIsMarker; /* True if last seach is a marker serach ...@@ -40,7 +40,7 @@ bool g_LastSearchIsMarker; /* True if last seach is a marker serach
* Used for hotkey next search */ * Used for hotkey next search */
/* Block operation (copy, paste) */ /* Block operation (copy, paste) */
SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save) BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste (Created by Block Save)
// Gestion d'options // Gestion d'options
bool g_HVLines = true; // Bool: force H or V directions (Wires, Bus ..) bool g_HVLines = true; // Bool: force H or V directions (Wires, Bus ..)
......
...@@ -112,7 +112,7 @@ extern bool g_LastSearchIsMarker; // True if last seach is a marker se ...@@ -112,7 +112,7 @@ extern bool g_LastSearchIsMarker; // True if last seach is a marker se
// Used for hotkey next search // Used for hotkey next search
/* Block operation (copy, paste) */ /* Block operation (copy, paste) */
extern SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save) extern BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste (Created by Block Save)
// Gestion d'options // Gestion d'options
extern bool g_HVLines; extern bool g_HVLines;
......
...@@ -252,7 +252,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -252,7 +252,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_DELETE: case HK_DELETE:
if( !ItemInEdit && screen->BlockLocate.m_State == STATE_NO_BLOCK ) if( !ItemInEdit && screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
RefreshToolBar = LocateAndDeleteItem( this, DC ); RefreshToolBar = LocateAndDeleteItem( this, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_BEGIN_WIRE: case HK_BEGIN_WIRE:
/* An item is selected. If edited and not a wire, a new command is not /* An item is selected. If edited and not a wire, a new command is not
* possible */ * possible */
if( !ItemInEdit && screen->BlockLocate.m_State == STATE_NO_BLOCK ) if( !ItemInEdit && screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
{ {
......
...@@ -29,7 +29,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu ...@@ -29,7 +29,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
/********************************************************************************/ /********************************************************************************/
{ {
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
if ( CurrentLibEntry == NULL ) return true; if ( CurrentLibEntry == NULL ) return true;
...@@ -232,14 +232,14 @@ void AddMenusForBlock(wxMenu * PopMenu, WinEDA_LibeditFrame * frame) ...@@ -232,14 +232,14 @@ void AddMenusForBlock(wxMenu * PopMenu, WinEDA_LibeditFrame * frame)
{ {
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _("Cancel Block"), cancel_xpm); ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _("Cancel Block"), cancel_xpm);
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
ADD_MENUITEM(PopMenu, ID_POPUP_ZOOM_BLOCK, _("Zoom Block (drag middle mouse)"), zoom_selected_xpm); ADD_MENUITEM(PopMenu, ID_POPUP_ZOOM_BLOCK, _("Zoom Block (drag middle mouse)"), zoom_selected_xpm);
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM(PopMenu, ID_POPUP_PLACE_BLOCK, _("Place Block"), apply_xpm ); ADD_MENUITEM(PopMenu, ID_POPUP_PLACE_BLOCK, _("Place Block"), apply_xpm );
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{ {
ADD_MENUITEM(PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _("Select Items"), green_xpm); ADD_MENUITEM(PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _("Select Items"), green_xpm);
ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK, ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK,
......
...@@ -730,34 +730,34 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -730,34 +730,34 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_SELECT_ITEMS_BLOCK: case ID_POPUP_SELECT_ITEMS_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
......
...@@ -18,11 +18,10 @@ ...@@ -18,11 +18,10 @@
/* Routines Locales */ /* Routines Locales */
static SCH_ITEM* LastSnappedStruct = NULL; static SCH_ITEM* LastSnappedStruct = NULL;
static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY;
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int StartX2, int StartY2, int EndX2, int EndY2 ); int StartX2, int StartY2, int EndX2, int EndY2 );
static bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, static bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
SCH_ITEM* DrawList, DrawPickedStruct* DontSnapList, double aScaleFactor ); SCH_ITEM* DrawList, double aScaleFactor );
/*********************************************************************/ /*********************************************************************/
...@@ -43,10 +42,10 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) ...@@ -43,10 +42,10 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
while( DrawList ) while( DrawList )
{ {
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM, if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
DrawList, NULL, Screen->GetZoom() ) ) == FALSE ) DrawList, Screen->GetZoom() ) ) == FALSE )
{ {
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM, if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
DrawList, NULL, Screen->GetScalingFactor() ) ) == FALSE ) DrawList, Screen->GetScalingFactor() ) ) == FALSE )
break; break;
} }
component = (SCH_COMPONENT*) LastSnappedStruct; component = (SCH_COMPONENT*) LastSnappedStruct;
...@@ -111,7 +110,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask ...@@ -111,7 +110,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
return NULL; return NULL;
if( ( Snapped = SnapPoint2( refpos, SearchMask, if( ( Snapped = SnapPoint2( refpos, SearchMask,
screen->EEDrawList, NULL, screen->GetScalingFactor() ) ) != FALSE ) screen->EEDrawList, screen->GetScalingFactor() ) ) != FALSE )
{ {
return LastSnappedStruct; return LastSnappedStruct;
} }
...@@ -120,62 +119,45 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask ...@@ -120,62 +119,45 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
/***********************************************************************/ /***********************************************************************/
SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask ) int PickStruct( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
/************************************************************************/ /************************************************************************/
/* Search items in block /** Function PickStruct
* Return: * Search items in a block
* pointeur sur liste de pointeurs de structures si Plusieurs * @return items count
* structures selectionnees. * @param aBlock a BLOCK_SELECTOR that gives the search area boundary
* pointeur sur la structure si 1 seule * list of items is stored in aBlock
*
*/ */
{ {
int x, y, OrigX, OrigY; int x, y, OrigX, OrigY;
DrawPickedStruct* PickedList = NULL, * PickedItem; int itemcount = 0;
SCH_ITEM* DrawStruct;
OrigX = block.GetX(); if( aScreen == NULL )
OrigY = block.GetY(); return itemcount;
x = block.GetRight();
y = block.GetBottom(); OrigX = aBlock.GetX();
OrigY = aBlock.GetY();
x = aBlock.GetRight();
y = aBlock.GetBottom();
if( x < OrigX ) if( x < OrigX )
EXCHG( x, OrigX ); EXCHG( x, OrigX );
if( y < OrigY ) if( y < OrigY )
EXCHG( y, OrigY ); EXCHG( y, OrigY );
SCH_ITEM* DrawList = screen->EEDrawList; ITEM_PICKER picker;
if( screen==NULL || DrawList == NULL ) SCH_ITEM* DrawStruct = aScreen->EEDrawList;
return NULL; for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) ) if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
{ {
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct( DrawStruct ); picker.m_Item = DrawStruct;
aBlock.PushItem(picker);
PickedItem->SetNext( PickedList ); itemcount++;
PickedList = PickedItem;
}
}
if( PickedList && PickedList->Next() == NULL )
{
/* Only one item was picked - convert to scalar form (no list): */
PickedItem = PickedList;
PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct;
SAFE_DELETE( PickedItem );
} }
if( PickedList != NULL )
{
PickedBoxMinX = OrigX; PickedBoxMinY = OrigY;
PickedBoxMaxX = x; PickedBoxMaxY = y;
} }
return itemcount;
return (SCH_ITEM*) PickedList;
} }
...@@ -185,26 +167,13 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask ) ...@@ -185,26 +167,13 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
* Note we use L1 norm as distance measure, as it is the fastest. * * Note we use L1 norm as distance measure, as it is the fastest. *
* This routine updates LastSnappedStruct to the last object used in to snap * * This routine updates LastSnappedStruct to the last object used in to snap *
* a point. This variable is global to this module only (see above). * * a point. This variable is global to this module only (see above). *
* If DontSnapList is not NULL, structes in this list are skipped. *
* The routine returns TRUE if point was snapped. * * The routine returns TRUE if point was snapped. *
*****************************************************************************/ *****************************************************************************/
bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
SCH_ITEM* DrawList, DrawPickedStruct* DontSnapList, double aScaleFactor ) SCH_ITEM* DrawList, double aScaleFactor )
{ {
DrawPickedStruct* DontSnap;
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
/* Make sure this structure is NOT in the dont snap list: */
DontSnap = DontSnapList;
for( ; DontSnap != NULL; DontSnap = DontSnap->Next() )
if( DontSnap->m_PickedStruct == DrawList )
break;
if( DontSnap )
if( DontSnap->m_PickedStruct == DrawList )
continue;
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ) ; int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ) ;
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
......
...@@ -54,7 +54,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -54,7 +54,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
*/ */
{ {
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem(); SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
...@@ -608,13 +608,13 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame ) ...@@ -608,13 +608,13 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
_( "Window Zoom" ), zoom_selected_xpm ); _( "Window Zoom" ), zoom_selected_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{ // After a block move (that is also a block selection) one can reselect a block function: { // After a block move (that is also a block selection) one can reselect a block function:
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button ); ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
......
...@@ -96,22 +96,20 @@ SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct); ...@@ -96,22 +96,20 @@ SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct);
void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & move_vector); void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & move_vector);
/* Given a structure move it by move_vector. */ /* Given a structure move it by move_vector. */
bool PlaceStruct(BASE_SCREEN * screen, SCH_ITEM *DrawStruct);
bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct); void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
bool DrawStructInBox(int x1, int y1, int x2, int y2,
SCH_ITEM *DrawStruct);
/*************/ /*************/
/* LOCATE.CPP */ /* LOCATE.CPP */
/*************/ /*************/
bool DrawStructInBox(int x1, int y1, int x2, int y2,
SCH_ITEM *DrawStruct);
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
SCH_COMPONENT* eComponent ); SCH_COMPONENT* eComponent );
SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen ); SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
/* Recherche du plus petit (en surface) composant pointe par la souris */ /* Recherche du plus petit (en surface) composant pointe par la souris */
SCH_ITEM * PickStruct(EDA_Rect & block, BASE_SCREEN* screen, int SearchMask ); int PickStruct(BLOCK_SELECTOR& aBlock, BASE_SCREEN* screen );
SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMask); SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMask);
/* 2 functions PickStruct: /* 2 functions PickStruct:
Search in block, or Search at location pos Search in block, or Search at location pos
......
...@@ -127,7 +127,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -127,7 +127,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( screen->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
DrawPanel-> DrawPanel->
m_PanelDefaultCursor ) ); m_PanelDefaultCursor ) );
...@@ -137,11 +137,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -137,11 +137,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* ne devrait pas etre execute, sauf bug: */ /* ne devrait pas etre execute, sauf bug: */
if( screen->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
screen->BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.m_Command = BLOCK_IDLE;
screen->BlockLocate.m_State = STATE_NO_BLOCK; screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->BlockLocate.m_BlockDrawStruct = NULL; screen->m_BlockLocate.ClearItemsList();
} }
break; break;
...@@ -174,7 +174,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -174,7 +174,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_CUT: case wxID_CUT:
if( screen->BlockLocate.m_Command != BLOCK_MOVE ) if( screen->m_BlockLocate.m_Command != BLOCK_MOVE )
break; break;
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
...@@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
// The easiest way to handle a drag component is simulate a // The easiest way to handle a drag component is simulate a
// block drag command // block drag command
if( screen->BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, if( !HandleBlockBegin( &dc, BLOCK_DRAG,
screen->m_Curseur ) ) screen->m_Curseur ) )
......
This diff is collapsed.
...@@ -416,7 +416,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( ) ...@@ -416,7 +416,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event ) void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
{ {
bool enable = ( GetScreen() && bool enable = ( GetScreen() &&
GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ); GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
event.Enable(enable); event.Enable(enable);
m_HToolBar->EnableTool( wxID_CUT, enable ); m_HToolBar->EnableTool( wxID_CUT, enable );
m_HToolBar->EnableTool( wxID_COPY, enable ); m_HToolBar->EnableTool( wxID_COPY, enable );
...@@ -424,8 +424,8 @@ void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event ) ...@@ -424,8 +424,8 @@ void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event ) void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
{ {
event.Enable( g_BlockSaveDataList != NULL ); event.Enable( g_BlockSaveDataList.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList != NULL ); m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
} }
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event ) void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
......
This diff is collapsed.
...@@ -108,11 +108,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -108,11 +108,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* ne devrait pas etre execute, sauf bug */ /* ne devrait pas etre execute, sauf bug */
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
} }
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
...@@ -250,34 +250,34 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -250,34 +250,34 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MIRROR_X; GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
......
...@@ -214,7 +214,7 @@ void WinEDA_GerberFrame::SetToolbars() ...@@ -214,7 +214,7 @@ void WinEDA_GerberFrame::SetToolbars()
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{ {
m_HToolBar->EnableTool( wxID_CUT, TRUE ); m_HToolBar->EnableTool( wxID_CUT, TRUE );
m_HToolBar->EnableTool( wxID_COPY, TRUE ); m_HToolBar->EnableTool( wxID_COPY, TRUE );
......
...@@ -22,7 +22,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ...@@ -22,7 +22,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
......
...@@ -8,18 +8,108 @@ ...@@ -8,18 +8,108 @@
#define __INCLUDE__BLOCK_COMMANDE_H__ 1 #define __INCLUDE__BLOCK_COMMANDE_H__ 1
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC ); #include "base_struct.h"
#include "class_undoredo_container.h"
/* Cancel Current block operation. */
void InitBlockLocateDatas( WinEDA_DrawPanel* Panel, const wxPoint& startpos );
/* Init the initial values of a BlockLocate, before starting a block command */ // Forward declarations:
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/**************************/
/* class BLOCK_SELECTOR */
/**************************/
/**
* class BLOCK_SELECTOR is used to handle block selection and commands
*/
typedef enum {
/* definition de l'etat du block */
STATE_NO_BLOCK, /* Block non initialise */
STATE_BLOCK_INIT, /* Block initialise: 1er point defini */
STATE_BLOCK_END, /* Block initialise: 2eme point defini */
STATE_BLOCK_MOVE, /* Block en deplacement */
STATE_BLOCK_STOP /* Block fixe (fin de deplacement) */
} BlockState;
/* codes des differentes commandes sur block: */
typedef enum {
BLOCK_IDLE,
BLOCK_MOVE,
BLOCK_COPY,
BLOCK_SAVE,
BLOCK_DELETE,
BLOCK_PASTE,
BLOCK_DRAG,
BLOCK_ROTATE,
BLOCK_INVERT,
BLOCK_ZOOM,
BLOCK_ABORT,
BLOCK_PRESELECT_MOVE,
BLOCK_SELECT_ITEMS_ONLY,
BLOCK_MIRROR_X,
BLOCK_MIRROR_Y
} CmdBlockType;
class BLOCK_SELECTOR : public EDA_BaseStruct, public EDA_Rect
{
public:
BlockState m_State; /* Stae (enum BlockState) of the block */
CmdBlockType m_Command; /* Type (enum CmdBlockType) d'operation */
PICKED_ITEMS_LIST m_ItemsSelection; /* list of items selected in this block */
int m_Color; /* Block Color (for drawings) */
wxPoint m_MoveVector; /* Move distance in move, drag, copy ... command */
wxPoint m_BlockLastCursorPosition; /* Last Mouse position in block command
* = last cursor position in move commands
* = 0,0 in block paste */
public:
BLOCK_SELECTOR();
~BLOCK_SELECTOR();
/** function InitData
* Init the initial values of a BLOCK_SELECTOR, before starting a block command
*/
void InitData( WinEDA_DrawPanel* Panel, const wxPoint& startpos );
/** Function SetMessageBlock
* Displays the type of block command in the status bar of the window
*/
void SetMessageBlock( WinEDA_DrawFrame* frame );
void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC, const wxPoint& aOffset,
int aDrawMode,
int aColor );
/** Function PushItem
* Add aItem to the list of items
* @param aItem = an ITEM_PICKER to add to the list
*/
void PushItem( ITEM_PICKER& aItem );
/** Function ClearListAndDeleteItems
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
*/
void ClearListAndDeleteItems();
void ClearItemsList();
unsigned GetCount()
{
return m_ItemsSelection.GetCount();
}
};
/* Cancel Current block operation.
*/
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC );
/* Redraw the outlines of the block which shows the search area for block commands /* Redraw the outlines of the block which shows the search area for block commands
* The first point of the rectangle showing the area is initialised * The first point of the rectangle showing the area is initialised
* by InitBlockLocateDatas(). * by InitBlockLocateDatas().
* The other point of the rectangle is the mouse cursor */ * The other point of the rectangle is the mouse cursor
*/
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
#endif /* __INCLUDE__BLOCK_COMMANDE_H__ */ #endif /* __INCLUDE__BLOCK_COMMANDE_H__ */
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
**********************/ **********************/
/* define : /* define :
* class DrawBlockStruct used to handle block commands
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...) * class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
*/ */
...@@ -12,6 +11,7 @@ ...@@ -12,6 +11,7 @@
#include "base_struct.h" #include "base_struct.h"
#include "class_undoredo_container.h" #include "class_undoredo_container.h"
#include "block_commande.h"
// Forward declarations: // Forward declarations:
...@@ -19,60 +19,6 @@ class SCH_ITEM; ...@@ -19,60 +19,6 @@ class SCH_ITEM;
class Ki_PageDescr; class Ki_PageDescr;
/**************************/
/* class DrawBlockStruct */
/**************************/
/* Definition d'un block pour les fonctions sur block (block move, ..) */
typedef enum {
/* definition de l'etat du block */
STATE_NO_BLOCK, /* Block non initialise */
STATE_BLOCK_INIT, /* Block initialise: 1er point defini */
STATE_BLOCK_END, /* Block initialise: 2eme point defini */
STATE_BLOCK_MOVE, /* Block en deplacement */
STATE_BLOCK_STOP /* Block fixe (fin de deplacement) */
} BlockState;
/* codes des differentes commandes sur block: */
typedef enum {
BLOCK_IDLE,
BLOCK_MOVE,
BLOCK_COPY,
BLOCK_SAVE,
BLOCK_DELETE,
BLOCK_PASTE,
BLOCK_DRAG,
BLOCK_ROTATE,
BLOCK_INVERT,
BLOCK_ZOOM,
BLOCK_ABORT,
BLOCK_PRESELECT_MOVE,
BLOCK_SELECT_ITEMS_ONLY,
BLOCK_MIRROR_X,
BLOCK_MIRROR_Y
} CmdBlockType;
class DrawBlockStruct : public EDA_BaseStruct, public EDA_Rect
{
public:
BlockState m_State; /* Etat (enum BlockState) du block */
CmdBlockType m_Command; /* Type (enum CmdBlockType) d'operation */
EDA_BaseStruct* m_BlockDrawStruct; /* pointeur sur la structure
* selectionnee dans le bloc */
int m_Color; /* Block Color */
wxPoint m_MoveVector; /* Move distance in move, drag, copy ... command */
wxPoint m_BlockLastCursorPosition; /* Last Mouse position in block command
* = last cursor position in move commands
* = 0,0 in block paste */
public:
DrawBlockStruct();
~DrawBlockStruct();
void SetMessageBlock( WinEDA_DrawFrame* frame );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC );
};
/* Simple class for handling grid arrays. */ /* Simple class for handling grid arrays. */
class GRID_TYPE class GRID_TYPE
{ {
...@@ -120,12 +66,12 @@ public: ...@@ -120,12 +66,12 @@ public:
SCH_ITEM* EEDrawList; /* Object list (main data) for schematic */ SCH_ITEM* EEDrawList; /* Object list (main data) for schematic */
// Undo/redo list of commands // Undo/redo list of commands
UNDO_REDO_CONTAINER m_UndoList; /* Object list for the undo command (old data) */ UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
UNDO_REDO_CONTAINER m_RedoList; /* Object list for the redo command (old data) */ UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
/* block control */ /* block control */
DrawBlockStruct BlockLocate; /* Bock description for block commands */ BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
/* Page description */ /* Page description */
Ki_PageDescr* m_CurrentSheetDesc; Ki_PageDescr* m_CurrentSheetDesc;
...@@ -193,15 +139,19 @@ public: ...@@ -193,15 +139,19 @@ public:
virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem ); virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
virtual PICKED_ITEMS_LIST* PopCommandFromUndoList(); virtual PICKED_ITEMS_LIST* PopCommandFromUndoList();
virtual PICKED_ITEMS_LIST* PopCommandFromRedoList(); virtual PICKED_ITEMS_LIST* PopCommandFromRedoList();
int GetUndoCommandCount( )
int GetUndoCommandCount()
{ {
return m_UndoList.m_CommandsList.size(); return m_UndoList.m_CommandsList.size();
} }
int GetRedoCommandCount( )
int GetRedoCommandCount()
{ {
return m_RedoList.m_CommandsList.size(); return m_RedoList.m_CommandsList.size();
} }
/* Manipulation des flags */ /* Manipulation des flags */
void SetRefreshReq() { m_FlagRefreshReq = 1; } void SetRefreshReq() { m_FlagRefreshReq = 1; }
void ClrRefreshReq() { m_FlagRefreshReq = 0; } void ClrRefreshReq() { m_FlagRefreshReq = 0; }
......
...@@ -88,9 +88,18 @@ public: ...@@ -88,9 +88,18 @@ public:
~PICKED_ITEMS_LIST(); ~PICKED_ITEMS_LIST();
void PushItem( ITEM_PICKER& aItem ); void PushItem( ITEM_PICKER& aItem );
ITEM_PICKER PopItem(); ITEM_PICKER PopItem();
/** Function ClearItemsList
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
*/
void ClearItemsList(); void ClearItemsList();
unsigned GetCount() /** Function ClearListAndDeleteItems
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
*/
void ClearListAndDeleteItems();
unsigned GetCount() const
{ {
return m_ItemsList.size(); return m_ItemsList.size();
} }
...@@ -105,6 +114,12 @@ public: ...@@ -105,6 +114,12 @@ public:
bool SetLink( EDA_BaseStruct* aItem, unsigned aIdx ); bool SetLink( EDA_BaseStruct* aItem, unsigned aIdx );
bool SetItemStatus( int aStatus, unsigned aIdx ); bool SetItemStatus( int aStatus, unsigned aIdx );
bool RemoveItem( unsigned aIdx ); bool RemoveItem( unsigned aIdx );
/** Function CopyList
* copy all data from aSource
* Items picked are not copied. just pointer on them are copied
*/
void CopyList(const PICKED_ITEMS_LIST & aSource);
}; };
/** /**
......
...@@ -364,12 +364,12 @@ private: ...@@ -364,12 +364,12 @@ private:
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC ); void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
/* Operations sur bloc */ /* Operations sur bloc */
void PasteStruct( wxDC* DC ); void PasteListOfItems( wxDC* DC );
/* Undo - redo */ /* Undo - redo */
public: public:
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy, void SaveCopyInUndoList( SCH_ITEM* ItemToCopy, int aTypeCommand );
int flag_type_command = 0 ); void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, int aTypeCommand );
private: private:
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList ); void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
......
This diff is collapsed.
...@@ -104,21 +104,21 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -104,21 +104,21 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
int ItemsCount = 0, MustDoPlace = 0; int ItemsCount = 0, MustDoPlace = 0;
MODULE* Currentmodule = GetBoard()->m_Modules; MODULE* Currentmodule = GetBoard()->m_Modules;
if( GetScreen()->BlockLocate.m_BlockDrawStruct ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
BlockState state = GetScreen()->BlockLocate.m_State; BlockState state = GetScreen()->m_BlockLocate.m_State;
CmdBlockType command = GetScreen()->BlockLocate.m_Command; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
GetScreen()->BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_State = state;
GetScreen()->BlockLocate.m_Command = command; GetScreen()->m_BlockLocate.m_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines; DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand; DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
GetScreen()->m_Curseur.x = GetScreen()->BlockLocate.GetRight(); GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
GetScreen()->m_Curseur.y = GetScreen()->BlockLocate.GetBottom(); GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
switch( GetScreen()->BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
...@@ -127,7 +127,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -127,7 +127,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
{ {
MustDoPlace = 1; MustDoPlace = 1;
...@@ -137,7 +137,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -137,7 +137,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
} }
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
...@@ -145,11 +145,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -145,11 +145,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
MustDoPlace = 1; MustDoPlace = 1;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
DeleteMarkedItems( Currentmodule ); DeleteMarkedItems( Currentmodule );
...@@ -160,24 +160,24 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -160,24 +160,24 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_ROTATE: case BLOCK_ROTATE:
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
RotateMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() ); RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_INVERT: /* mirror */ case BLOCK_INVERT: /* mirror */
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
MirrorMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() ); MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
Window_Zoom( GetScreen()->BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
case BLOCK_ABORT: case BLOCK_ABORT:
...@@ -189,19 +189,17 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -189,19 +189,17 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
if( MustDoPlace <= 0 ) if( MustDoPlace <= 0 )
{ {
if( GetScreen()->BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
{ {
ClearMarkItems( Currentmodule ); ClearMarkItems( Currentmodule );
} }
GetScreen()->BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
SetToolID( m_ID_current_state, SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
...@@ -229,9 +227,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -229,9 +227,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
} }
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
switch( GetScreen()->BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
err = TRUE; err = TRUE;
...@@ -240,32 +238,32 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -240,32 +238,32 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
MoveMarkedItems( Currentmodule, GetScreen()->BlockLocate.m_MoveVector ); MoveMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
CopyMarkedItems( Currentmodule, GetScreen()->BlockLocate.m_MoveVector ); CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
break; break;
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */ case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_INVERT: /* Mirror by popup menu, from block move */ case BLOCK_INVERT: /* Mirror by popup menu, from block move */
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
MirrorMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() ); MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ROTATE: case BLOCK_ROTATE:
SaveCopyInUndoList( Currentmodule ); SaveCopyInUndoList( Currentmodule );
RotateMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() ); RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ZOOM: // Handled by HandleBlockEnd case BLOCK_ZOOM: // Handled by HandleBlockEnd
...@@ -280,9 +278,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -280,9 +278,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
...@@ -301,22 +299,20 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -301,22 +299,20 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* L'ensemble du block suit le curseur * L'ensemble du block suit le curseur
*/ */
{ {
DrawBlockStruct* PtBlock; BLOCK_SELECTOR* PtBlock;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
BOARD_ITEM* item; BOARD_ITEM* item;
wxPoint move_offset; wxPoint move_offset;
MODULE* Currentmodule = MODULE* Currentmodule =
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules; ( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
PtBlock = &screen->BlockLocate; PtBlock = &screen->m_BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
/* Effacement ancien cadre */ /* Effacement ancien cadre */
if( erase ) if( erase )
{ {
PtBlock->Offset( PtBlock->m_MoveVector ); PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
PtBlock->Draw( panel, DC );
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
if( Currentmodule ) if( Currentmodule )
{ {
...@@ -356,10 +352,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -356,10 +352,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_MoveVector.y = screen->m_Curseur.y -
PtBlock->m_BlockLastCursorPosition.y; PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode ); PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
PtBlock->Offset( PtBlock->m_MoveVector );
PtBlock->Draw( panel, DC );
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
if( Currentmodule ) if( Currentmodule )
......
...@@ -500,10 +500,10 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -500,10 +500,10 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( (CurrentTime - g_SaveTime) > g_TimeOut ) if( (CurrentTime - g_SaveTime) > g_TimeOut )
{ {
wxString tmpFileName = GetScreen()->m_FileName; wxString tmpFileName = GetScreen()->m_FileName;
wxString filename = g_SaveFileName + PcbExtBuffer; wxFileName fn = wxFileName( wxEmptyString, g_SaveFileName, PcbExtBuffer );
bool flgmodify = GetScreen()->IsModify(); bool flgmodify = GetScreen()->IsModify();
( (WinEDA_PcbFrame*) this )->SavePcbFile( filename ); SavePcbFile( fn.GetFullPath() );
if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile() if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile()
{ {
...@@ -569,7 +569,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -569,7 +569,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
keep_on_grid = FALSE; keep_on_grid = FALSE;
/* Cursor is left off grid if no block in progress and no moving object */ /* Cursor is left off grid if no block in progress and no moving object */
if( GetScreen()->BlockLocate.m_State != STATE_NO_BLOCK ) if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK )
keep_on_grid = TRUE; keep_on_grid = TRUE;
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
......
This diff is collapsed.
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
/* modedit.cpp */ /* modedit.cpp */
/****************/ /****************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
...@@ -637,7 +633,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -637,7 +633,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
{ {
SET_DC; SET_DC;
...@@ -646,8 +642,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -646,8 +642,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
{ {
SET_DC; SET_DC;
...@@ -656,8 +652,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -656,8 +652,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{ {
SET_DC; SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
...@@ -665,8 +661,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -665,8 +661,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{ {
SET_DC; SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
...@@ -674,8 +670,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -674,8 +670,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{ {
SET_DC; SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
...@@ -685,8 +681,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -685,8 +681,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{ {
SET_DC; SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
......
...@@ -177,7 +177,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -177,7 +177,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
wxString msg; wxString msg;
bool append_set_width = FALSE; bool append_set_width = FALSE;
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
// Simple localisation des elements si possible // Simple localisation des elements si possible
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
......
...@@ -97,7 +97,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -97,7 +97,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
wxString msg; wxString msg;
int flags = 0; int flags = 0;
bool locate_track = FALSE; bool locate_track = FALSE;
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
......
...@@ -384,7 +384,7 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -384,7 +384,7 @@ void WinEDA_PcbFrame::SetToolbars()
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() ); m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE ) if( GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
{ {
m_HToolBar->EnableTool( wxID_CUT, TRUE ); m_HToolBar->EnableTool( wxID_CUT, TRUE );
m_HToolBar->EnableTool( wxID_COPY, TRUE ); m_HToolBar->EnableTool( wxID_COPY, TRUE );
......
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