Rework on undo/redo and block functions
This commit is contained in:
parent
6d14766eb3
commit
8ec8cf3f43
|
@ -4,6 +4,14 @@ KiCad ChangeLog 2009
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
++pcbnew
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************/
|
||||
/* Routines de gestion des commandes sur blocks */
|
||||
/* (section commune eeschema/pcbnew... */
|
||||
/* (section commune eeschema/pcbnew... */
|
||||
/****************************************************/
|
||||
|
||||
/* Fichier common.cpp */
|
||||
|
@ -19,31 +19,30 @@
|
|||
|
||||
|
||||
/*******************/
|
||||
/* DrawBlockStruct */
|
||||
/* BLOCK_SELECTOR */
|
||||
/*******************/
|
||||
|
||||
/****************************************************************************/
|
||||
DrawBlockStruct::DrawBlockStruct() :
|
||||
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE )
|
||||
, EDA_Rect()
|
||||
BLOCK_SELECTOR::BLOCK_SELECTOR() :
|
||||
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ),
|
||||
EDA_Rect()
|
||||
/****************************************************************************/
|
||||
{
|
||||
m_State = STATE_NO_BLOCK; /* Etat (enum BlockState) du block */
|
||||
m_Command = BLOCK_IDLE; /* Type (enum CmdBlockType) d'operation */
|
||||
m_BlockDrawStruct = NULL; /* pointeur sur la structure */
|
||||
m_Color = BROWN;
|
||||
m_Color = BROWN;
|
||||
}
|
||||
|
||||
|
||||
/****************************************/
|
||||
DrawBlockStruct::~DrawBlockStruct()
|
||||
BLOCK_SELECTOR::~BLOCK_SELECTOR()
|
||||
/****************************************/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void DrawBlockStruct::SetMessageBlock( WinEDA_DrawFrame* frame )
|
||||
void BLOCK_SELECTOR::SetMessageBlock( WinEDA_DrawFrame* frame )
|
||||
/***************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -112,34 +111,82 @@ void DrawBlockStruct::SetMessageBlock( WinEDA_DrawFrame* frame )
|
|||
|
||||
|
||||
/**************************************************************/
|
||||
void DrawBlockStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC )
|
||||
void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||
const wxPoint& aOffset,
|
||||
int aDrawMode,
|
||||
int aColor )
|
||||
/**************************************************************/
|
||||
{
|
||||
int w = panel->GetScreen()->Scale( GetWidth() );
|
||||
int h = panel->GetScreen()->Scale( GetHeight() );
|
||||
int w = aPanel->GetScreen()->Scale( GetWidth() );
|
||||
int h = aPanel->GetScreen()->Scale( GetHeight() );
|
||||
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
if( w == 0 || h == 0 )
|
||||
GRLine( &panel->m_ClipBox, DC, GetX(), GetY(),
|
||||
GetRight(), GetBottom(), 0, m_Color );
|
||||
GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
|
||||
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
|
||||
else
|
||||
GRRect( &panel->m_ClipBox, DC, GetX(), GetY(),
|
||||
GetRight(), GetBottom(), 0, m_Color );
|
||||
GRRect( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
|
||||
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel, const wxPoint& startpos )
|
||||
/*************************************************************************/
|
||||
|
||||
/** function InitData
|
||||
* Init the initial values of a BLOCK_SELECTOR, before starting a block command
|
||||
*/
|
||||
{
|
||||
m_State = STATE_BLOCK_INIT;
|
||||
SetOrigin( startpos );
|
||||
SetSize( wxSize( 0, 0 ) );
|
||||
m_ItemsSelection.ClearItemsList();
|
||||
aPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
||||
aPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
||||
}
|
||||
|
||||
|
||||
/** Function ClearItemsList
|
||||
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
|
||||
*/
|
||||
void BLOCK_SELECTOR::ClearItemsList()
|
||||
{
|
||||
m_ItemsSelection.ClearItemsList();
|
||||
}
|
||||
|
||||
/** Function ClearListAndDeleteItems
|
||||
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
|
||||
*/
|
||||
void BLOCK_SELECTOR::ClearListAndDeleteItems()
|
||||
{
|
||||
m_ItemsSelection.ClearListAndDeleteItems();
|
||||
}
|
||||
|
||||
/** Function PushItem
|
||||
* Add aItem to the list of items
|
||||
* @param aItem = an ITEM_PICKER to add to the list
|
||||
*/
|
||||
void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem )
|
||||
{
|
||||
m_ItemsSelection.PushItem( aItem );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
||||
const wxPoint& startpos )
|
||||
/*************************************************************************/
|
||||
|
||||
/* First command block function:
|
||||
/* First command block function:
|
||||
* Init the Block infos: command type, initial position, and other variables..
|
||||
*/
|
||||
{
|
||||
DrawBlockStruct* Block = & GetBaseScreen()->BlockLocate;
|
||||
BLOCK_SELECTOR* Block = &GetBaseScreen()->m_BlockLocate;
|
||||
|
||||
if( ( Block->m_Command != BLOCK_IDLE )
|
||||
|| ( Block->m_State != STATE_NO_BLOCK ) )
|
||||
|| ( Block->m_State != STATE_NO_BLOCK ) )
|
||||
return FALSE;
|
||||
|
||||
Block->m_Flags = 0;
|
||||
|
@ -163,26 +210,26 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
|||
case BLOCK_MIRROR_X:
|
||||
case BLOCK_MIRROR_Y: /* mirror */
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
InitBlockLocateDatas( DrawPanel, startpos );
|
||||
Block->InitData( DrawPanel, startpos );
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE:
|
||||
InitBlockLocateDatas( DrawPanel, startpos );
|
||||
Block->InitData( DrawPanel, startpos );
|
||||
Block->m_BlockLastCursorPosition.x = 0;
|
||||
Block->m_BlockLastCursorPosition.y = 0;
|
||||
InitBlockPasteInfos();
|
||||
if( Block->m_BlockDrawStruct == NULL ) /* No data to paste */
|
||||
if( Block->m_ItemsSelection.GetCount() == 0 ) /* No data to paste */
|
||||
{
|
||||
DisplayError( this, wxT( "No Block to paste" ), 20 );
|
||||
GetBaseScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetBaseScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
if( DrawPanel->ManageCurseur == NULL )
|
||||
{
|
||||
Block->m_BlockDrawStruct = NULL;
|
||||
Block->m_ItemsSelection.ClearItemsList();
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
|
||||
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
|
||||
return TRUE;
|
||||
}
|
||||
Block->m_State = STATE_BLOCK_MOVE;
|
||||
|
@ -196,13 +243,46 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
|||
Block->m_Command;
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
Block->SetMessageBlock( this );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/********************************************************************************/
|
||||
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/********************************************************************************/
|
||||
|
||||
/* 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
|
||||
* by Initm_BlockLocateDatas().
|
||||
* The other point of the rectangle is the mouse cursor
|
||||
*/
|
||||
{
|
||||
BLOCK_SELECTOR* PtBlock;
|
||||
|
||||
PtBlock = &panel->GetScreen()->m_BlockLocate;
|
||||
|
||||
PtBlock->m_MoveVector = wxPoint( 0, 0 );
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
|
||||
|
||||
PtBlock->m_BlockLastCursorPosition = panel->GetScreen()->m_Curseur;
|
||||
PtBlock->SetEnd( panel->GetScreen()->m_Curseur );
|
||||
|
||||
PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
|
||||
|
||||
if( PtBlock->m_State == STATE_BLOCK_INIT )
|
||||
{
|
||||
if( PtBlock->GetWidth() || PtBlock->GetHeight() )
|
||||
/* 2ieme point existant: le rectangle n'est pas de surface nulle */
|
||||
PtBlock->m_State = STATE_BLOCK_END;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
|
@ -222,81 +302,17 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
screen->SetCurItem( NULL );
|
||||
|
||||
/* Delete the picked wrapper if this is a picked list. */
|
||||
if( (screen->BlockLocate.m_Command != BLOCK_PASTE)
|
||||
&& screen->BlockLocate.m_BlockDrawStruct )
|
||||
{
|
||||
if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
DrawPickedStruct* PickedList;
|
||||
PickedList = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
||||
PickedList->DeleteWrapperList();
|
||||
}
|
||||
screen->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
}
|
||||
if( screen->m_BlockLocate.m_Command != BLOCK_PASTE )
|
||||
screen->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
|
||||
screen->BlockLocate.m_Flags = 0;
|
||||
screen->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
screen->m_BlockLocate.m_Flags = 0;
|
||||
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
|
||||
screen->BlockLocate.m_Command = BLOCK_ABORT;
|
||||
screen->m_BlockLocate.m_Command = BLOCK_ABORT;
|
||||
Panel->m_Parent->HandleBlockEnd( DC );
|
||||
|
||||
screen->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
Panel->m_Parent->DisplayToolMsg( wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
void InitBlockLocateDatas( WinEDA_DrawPanel* Panel, const wxPoint& startpos )
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Init the initial values of a BlockLocate, before starting a block command
|
||||
*/
|
||||
{
|
||||
BASE_SCREEN* screen = Panel->GetScreen();
|
||||
|
||||
screen->BlockLocate.m_State = STATE_BLOCK_INIT;
|
||||
screen->BlockLocate.SetOrigin( startpos );
|
||||
screen->BlockLocate.SetSize( wxSize( 0, 0 ) );
|
||||
screen->BlockLocate.SetNext( NULL );
|
||||
screen->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
Panel->ManageCurseur = DrawAndSizingBlockOutlines;
|
||||
Panel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/********************************************************************************/
|
||||
|
||||
/* 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
|
||||
* by InitBlockLocateDatas().
|
||||
* The other point of the rectangle is the mouse cursor
|
||||
*/
|
||||
{
|
||||
DrawBlockStruct* PtBlock;
|
||||
|
||||
PtBlock = &panel->GetScreen()->BlockLocate;
|
||||
|
||||
PtBlock->m_MoveVector = wxPoint( 0, 0 );
|
||||
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
PtBlock->Draw( panel, DC );
|
||||
|
||||
PtBlock->m_BlockLastCursorPosition = panel->GetScreen()->m_Curseur;
|
||||
PtBlock->SetEnd( panel->GetScreen()->m_Curseur );
|
||||
|
||||
PtBlock->Draw( panel, DC );
|
||||
|
||||
if( PtBlock->m_State == STATE_BLOCK_INIT )
|
||||
{
|
||||
if( PtBlock->GetWidth() || PtBlock->GetHeight() )
|
||||
/* 2ieme point existant: le rectangle n'est pas de surface nulle */
|
||||
PtBlock->m_State = STATE_BLOCK_END;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,14 @@ void PICKED_ITEMS_LIST::PICKED_ITEMS_LIST::ClearItemsList()
|
|||
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 picker;
|
||||
|
@ -160,6 +168,20 @@ bool PICKED_ITEMS_LIST::RemoveItem( unsigned aIdx )
|
|||
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 ***************/
|
||||
|
|
|
@ -35,7 +35,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
|
|||
|
||||
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->m_PanelDefaultCursor ) );
|
||||
|
||||
|
@ -74,13 +74,13 @@ bool DrawPage( WinEDA_DrawPanel* panel )
|
|||
/* scale is the ratio resolution/internal units */
|
||||
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;
|
||||
DrawArea.SetX( (int) ( ActiveScreen->BlockLocate.GetX() ) );
|
||||
DrawArea.SetY( (int) ( ActiveScreen->BlockLocate.GetY() ) );
|
||||
DrawArea.SetWidth( (int) ( ActiveScreen->BlockLocate.GetWidth() ) );
|
||||
DrawArea.SetHeight( (int) ( ActiveScreen->BlockLocate.GetHeight() ) );
|
||||
DrawArea.SetX( ActiveScreen->m_BlockLocate.GetX() );
|
||||
DrawArea.SetY( ActiveScreen->m_BlockLocate.GetY() );
|
||||
DrawArea.SetWidth( ActiveScreen->m_BlockLocate.GetWidth() );
|
||||
DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() );
|
||||
}
|
||||
|
||||
/* modification des cadrages et reglages locaux */
|
||||
|
|
|
@ -488,7 +488,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key )
|
|||
|
||||
void WinEDA_DrawFrame::InitBlockPasteInfos()
|
||||
{
|
||||
GetBaseScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetBaseScreen()->m_BlockLocate.ClearItemsList();
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
wxString Line;
|
||||
|
@ -670,20 +694,30 @@ void WinEDA_DrawFrame::UpdateStatusBar()
|
|||
SetStatusText( Line, 1 );
|
||||
|
||||
/* Display absolute coordinates: */
|
||||
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ),
|
||||
To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
|
||||
m_InternalUnits ),
|
||||
To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
|
||||
m_InternalUnits ) );
|
||||
double dXpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.x, m_InternalUnits );
|
||||
double dYpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.y, m_InternalUnits );
|
||||
/* When using mm the conversion from 1/10000 inch to mm can give some non easy to read numbers,
|
||||
* like 1.999 or 2.001 that be better if displayed 2.000, so small diffs are filtered here.
|
||||
*/
|
||||
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 );
|
||||
|
||||
/* Display relative coordinates: */
|
||||
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
|
||||
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
|
||||
|
||||
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ),
|
||||
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ),
|
||||
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) );
|
||||
dXpos = To_User_Unit( g_UnitMetric, dx, m_InternalUnits );
|
||||
dYpos = To_User_Unit( g_UnitMetric, dy, 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, 3 );
|
||||
}
|
||||
|
|
|
@ -1095,7 +1095,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
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
|
||||
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
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:
|
||||
// We use it for a zoom center at cursor position command
|
||||
|
@ -1158,14 +1158,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
|
||||
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
|
||||
{
|
||||
if( (screen->BlockLocate.m_Command == BLOCK_IDLE)
|
||||
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||
if( (screen->m_BlockLocate.m_Command == BLOCK_IDLE)
|
||||
|| (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( screen->BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||
{
|
||||
m_AutoPAN_Request = FALSE;
|
||||
m_Parent->HandleBlockPlace( &DC );
|
||||
|
@ -1177,7 +1177,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
&& ManageCurseur == NULL
|
||||
&& ForceCloseManageCurseur == NULL )
|
||||
{ // 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
|
||||
int cmd_type = kbstat;
|
||||
|
||||
|
@ -1217,10 +1217,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
*/
|
||||
#define BLOCK_MINSIZE_LIMIT 1
|
||||
bool BlockIsSmall =
|
||||
( ABS( screen->Scale( screen->BlockLocate.GetWidth() ) ) < BLOCK_MINSIZE_LIMIT)
|
||||
&& ( ABS( screen->Scale( screen->BlockLocate.GetHeight() ) ) < BLOCK_MINSIZE_LIMIT);
|
||||
( ABS( screen->Scale( screen->m_BlockLocate.GetWidth() ) ) < 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 )
|
||||
{
|
||||
|
@ -1229,12 +1229,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
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_Parent->HandleBlockEnd( &DC );
|
||||
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;
|
||||
SetCursor( m_PanelCursor = wxCURSOR_HAND );
|
||||
|
@ -1244,10 +1244,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
|
||||
// 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( screen->BlockLocate.m_Command != BLOCK_IDLE )
|
||||
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||
{
|
||||
if( ForceCloseManageCurseur )
|
||||
{
|
||||
|
@ -1261,7 +1261,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
#if 0
|
||||
wxString msg_debug;
|
||||
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 );
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -255,21 +255,21 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
|||
{
|
||||
int ItemsCount = 0, MustDoPlace = 0;
|
||||
|
||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
BlockState state = GetScreen()->BlockLocate.m_State;
|
||||
CmdBlockType command = GetScreen()->BlockLocate.m_Command;
|
||||
BlockState state = GetScreen()->m_BlockLocate.m_State;
|
||||
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
|
||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
|
||||
GetScreen()->BlockLocate.m_State = state;
|
||||
GetScreen()->BlockLocate.m_Command = command;
|
||||
GetScreen()->m_BlockLocate.m_State = state;
|
||||
GetScreen()->m_BlockLocate.m_Command = command;
|
||||
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
||||
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
||||
GetScreen()->m_Curseur.x = GetScreen()->BlockLocate.GetRight();
|
||||
GetScreen()->m_Curseur.y = GetScreen()->BlockLocate.GetBottom();
|
||||
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
|
||||
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
||||
switch( GetScreen()->BlockLocate.m_Command )
|
||||
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||
{
|
||||
case BLOCK_IDLE:
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||
|
@ -278,7 +278,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_DRAG: /* Drag */
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
{
|
||||
MustDoPlace = 1;
|
||||
|
@ -288,7 +288,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
|||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
}
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
DrawPanel->Refresh( TRUE );
|
||||
}
|
||||
break;
|
||||
|
@ -296,11 +296,11 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
MustDoPlace = 1;
|
||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
break;
|
||||
|
||||
case BLOCK_DELETE: /* Delete */
|
||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( CurrentLibEntry );
|
||||
DeleteMarkedItems( CurrentLibEntry );
|
||||
|
@ -315,14 +315,14 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
|
||||
case BLOCK_INVERT:
|
||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( CurrentLibEntry );
|
||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.Centre() );
|
||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: /* Window Zoom */
|
||||
Window_Zoom( GetScreen()->BlockLocate );
|
||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||
break;
|
||||
|
||||
case BLOCK_ABORT:
|
||||
|
@ -334,13 +334,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
if( MustDoPlace <= 0 )
|
||||
{
|
||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
||||
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
||||
{
|
||||
ClearMarkItems( CurrentLibEntry );
|
||||
}
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
|
@ -371,9 +371,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
|||
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:
|
||||
err = TRUE;
|
||||
|
@ -382,25 +382,25 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
|||
case BLOCK_DRAG: /* Drag */
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( CurrentLibEntry );
|
||||
MoveMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.m_MoveVector );
|
||||
MoveMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: /* Copy */
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( CurrentLibEntry );
|
||||
CopyMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.m_MoveVector );
|
||||
CopyMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_INVERT: /* Invert by popup menu, from block move */
|
||||
SaveCopyInUndoList( CurrentLibEntry );
|
||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.Centre() );
|
||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
||||
|
@ -417,9 +417,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
|||
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
|
||||
|
@ -436,20 +436,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
* L'ensemble du block suit le curseur
|
||||
*/
|
||||
{
|
||||
DrawBlockStruct* PtBlock;
|
||||
BLOCK_SELECTOR* PtBlock;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
LibEDA_BaseStruct* item;
|
||||
wxPoint move_offset;
|
||||
|
||||
PtBlock = &panel->GetScreen()->BlockLocate;
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
PtBlock = &screen->m_BlockLocate;
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
{
|
||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
||||
PtBlock->Draw( panel, DC );
|
||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
|
@ -474,9 +471,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
|
||||
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
||||
PtBlock->Draw( panel, DC );
|
||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||
|
||||
|
||||
if( CurrentLibEntry )
|
||||
|
|
|
@ -40,7 +40,7 @@ bool g_LastSearchIsMarker; /* True if last seach is a marker serach
|
|||
* Used for hotkey next search */
|
||||
|
||||
/* 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
|
||||
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
|
|||
// Used for hotkey next search
|
||||
|
||||
/* 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
|
||||
extern bool g_HVLines;
|
||||
|
|
|
@ -252,7 +252,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
break;
|
||||
|
||||
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 );
|
||||
GetScreen()->SetModify();
|
||||
|
@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
case HK_BEGIN_WIRE:
|
||||
/* An item is selected. If edited and not a wire, a new command is not
|
||||
* 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 )
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
|
|||
/********************************************************************************/
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -232,14 +232,14 @@ void AddMenusForBlock(wxMenu * PopMenu, WinEDA_LibeditFrame * frame)
|
|||
{
|
||||
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);
|
||||
|
||||
PopMenu->AppendSeparator();
|
||||
|
||||
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_COPY_BLOCK,
|
||||
|
|
|
@ -730,34 +730,34 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SELECT_ITEMS_BLOCK:
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_INVERT_BLOCK:
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
|
||||
/* Routines Locales */
|
||||
static SCH_ITEM* LastSnappedStruct = NULL;
|
||||
static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY;
|
||||
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
||||
int StartX2, int StartY2, int EndX2, int EndY2 );
|
||||
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 )
|
|||
while( DrawList )
|
||||
{
|
||||
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
|
||||
DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
|
||||
DrawList, Screen->GetZoom() ) ) == FALSE )
|
||||
{
|
||||
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
|
||||
DrawList, NULL, Screen->GetScalingFactor() ) ) == FALSE )
|
||||
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
|
||||
break;
|
||||
}
|
||||
component = (SCH_COMPONENT*) LastSnappedStruct;
|
||||
|
@ -111,7 +110,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
|
|||
return NULL;
|
||||
|
||||
if( ( Snapped = SnapPoint2( refpos, SearchMask,
|
||||
screen->EEDrawList, NULL, screen->GetScalingFactor() ) ) != FALSE )
|
||||
screen->EEDrawList, screen->GetScalingFactor() ) ) != FALSE )
|
||||
{
|
||||
return LastSnappedStruct;
|
||||
}
|
||||
|
@ -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
|
||||
* Return:
|
||||
* pointeur sur liste de pointeurs de structures si Plusieurs
|
||||
* structures selectionnees.
|
||||
* pointeur sur la structure si 1 seule
|
||||
*
|
||||
/** Function PickStruct
|
||||
* Search items in a block
|
||||
* @return items count
|
||||
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary
|
||||
* list of items is stored in aBlock
|
||||
*/
|
||||
{
|
||||
int x, y, OrigX, OrigY;
|
||||
DrawPickedStruct* PickedList = NULL, * PickedItem;
|
||||
SCH_ITEM* DrawStruct;
|
||||
int itemcount = 0;
|
||||
|
||||
OrigX = block.GetX();
|
||||
OrigY = block.GetY();
|
||||
x = block.GetRight();
|
||||
y = block.GetBottom();
|
||||
if( aScreen == NULL )
|
||||
return itemcount;
|
||||
|
||||
OrigX = aBlock.GetX();
|
||||
OrigY = aBlock.GetY();
|
||||
x = aBlock.GetRight();
|
||||
y = aBlock.GetBottom();
|
||||
|
||||
if( x < OrigX )
|
||||
EXCHG( x, OrigX );
|
||||
if( y < OrigY )
|
||||
EXCHG( y, OrigY );
|
||||
|
||||
SCH_ITEM* DrawList = screen->EEDrawList;
|
||||
if( screen==NULL || DrawList == NULL )
|
||||
return NULL;
|
||||
|
||||
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||
ITEM_PICKER picker;
|
||||
SCH_ITEM* DrawStruct = aScreen->EEDrawList;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||
{
|
||||
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
|
||||
{
|
||||
/* Put this structure in the picked list: */
|
||||
PickedItem = new DrawPickedStruct( DrawStruct );
|
||||
|
||||
PickedItem->SetNext( PickedList );
|
||||
PickedList = PickedItem;
|
||||
picker.m_Item = DrawStruct;
|
||||
aBlock.PushItem(picker);
|
||||
itemcount++;
|
||||
}
|
||||
}
|
||||
|
||||
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 (SCH_ITEM*) PickedList;
|
||||
return itemcount;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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. *
|
||||
* This routine updates LastSnappedStruct to the last object used in to snap *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
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() )
|
||||
{
|
||||
/* 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 ) ;
|
||||
switch( DrawList->Type() )
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
|||
*/
|
||||
{
|
||||
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
|
||||
|
@ -608,13 +608,13 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
|||
|
||||
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,
|
||||
_( "Window Zoom" ), zoom_selected_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:
|
||||
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
|
||||
|
|
|
@ -96,22 +96,20 @@ SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct);
|
|||
void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & 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);
|
||||
bool DrawStructInBox(int x1, int y1, int x2, int y2,
|
||||
SCH_ITEM *DrawStruct);
|
||||
|
||||
/*************/
|
||||
/* LOCATE.CPP */
|
||||
/*************/
|
||||
bool DrawStructInBox(int x1, int y1, int x2, int y2,
|
||||
SCH_ITEM *DrawStruct);
|
||||
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
|
||||
SCH_COMPONENT* eComponent );
|
||||
|
||||
SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
|
||||
/* 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);
|
||||
/* 2 functions PickStruct:
|
||||
Search in block, or Search at location pos
|
||||
|
|
|
@ -127,7 +127,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
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->
|
||||
m_PanelDefaultCursor ) );
|
||||
|
@ -137,11 +137,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
/* 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->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
screen->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
screen->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -174,7 +174,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case wxID_CUT:
|
||||
if( screen->BlockLocate.m_Command != BLOCK_MOVE )
|
||||
if( screen->m_BlockLocate.m_Command != BLOCK_MOVE )
|
||||
break;
|
||||
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
|
||||
g_ItemToRepeat = NULL;
|
||||
|
@ -389,7 +389,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_EDIT_SHEET:
|
||||
EditSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
|
||||
case ID_POPUP_IMPORT_GLABEL:
|
||||
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( Import_PinSheet( (DrawSheetStruct*)screen->GetCurItem(), &dc ) );
|
||||
|
@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
// The easiest way to handle a drag component is simulate a
|
||||
// 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,
|
||||
screen->m_Curseur ) )
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/********************************************/
|
||||
/* library editor: undo and redo functions */
|
||||
/********************************************/
|
||||
/*************************************************************/
|
||||
/* eeschema: undo and redo functions for schemùatic editor */
|
||||
/*************************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "common.h"
|
||||
#include "confirm.h"
|
||||
#include "class_drawpickedstruct.h"
|
||||
|
@ -11,18 +10,20 @@
|
|||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
#include "id.h"
|
||||
#include "protos.h"
|
||||
#include "class_marker_sch.h"
|
||||
|
||||
/* Functions to undo and redo edit commands.
|
||||
* commmands to undo are in CurrentScreen->m_UndoList
|
||||
* commmands to redo are in CurrentScreen->m_RedoList
|
||||
* commmands to undo are stored in CurrentScreen->m_UndoList
|
||||
* commmands to redo are stored in CurrentScreen->m_RedoList
|
||||
*
|
||||
* m_UndoList and m_RedoList are a linked list of DrawPickedStruct.
|
||||
* each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo,
|
||||
* or to a list of DrawPickedStruct which points (.m_PickedStruct membre)
|
||||
* the items to undo or redo
|
||||
* m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
|
||||
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
|
||||
* that store the list of schematic items that are concerned by the command to undo or redo
|
||||
* and is created for each command to undo (handle also a command to redo).
|
||||
* each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or modified),
|
||||
* and has a pointer to a copy of this item, when this item has been modified
|
||||
* (the old values of parameters are therefore saved)
|
||||
*
|
||||
* there are 3 cases:
|
||||
* - delete item(s) command
|
||||
|
@ -31,45 +32,45 @@
|
|||
*
|
||||
* Undo command
|
||||
* - delete item(s) command:
|
||||
* deleted items are moved in undo list
|
||||
* => deleted items are moved in undo list
|
||||
*
|
||||
* - change item(s) command
|
||||
* A copy of item(s) is made (a DrawPickedStruct list of wrappers)
|
||||
* the .m_Image member of each wrapper points the modified item.
|
||||
* => A copy of item(s) is made (a DrawPickedStruct list of wrappers)
|
||||
* the .m_Link member of each wrapper points the modified item.
|
||||
* the .m_Item member of each wrapper points the old copy of this item.
|
||||
*
|
||||
* - add item(s) command
|
||||
* A list of item(s) is made
|
||||
* the .m_Image member of each wrapper points the new item.
|
||||
* =>A list of item(s) is made. The .m_Item member of each wrapper points the new item.
|
||||
*
|
||||
* Redo command
|
||||
* - delete item(s) old command:
|
||||
* deleted items are moved in EEDrawList list
|
||||
* => deleted items are moved in EEDrawList list, and in
|
||||
*
|
||||
* - change item(s) command
|
||||
* the copy of item(s) is moved in Undo list
|
||||
* => the copy of item(s) is moved in Undo list
|
||||
*
|
||||
* - add item(s) command
|
||||
* The list of item(s) is used to create a deleted list in undo list
|
||||
* (same as a delete command)
|
||||
* => The list of item(s) is used to create a deleted list in undo list(same as a delete command)
|
||||
*
|
||||
* A problem is the hierarchical sheet handling.
|
||||
* the data associated (subhierarchy, uno/redo list) is deleted only
|
||||
* when the sheet is really deleted (i.e. when deleted from undo or redo list)
|
||||
* and not when it is a copy.
|
||||
* This is handled by its destructor.
|
||||
*/
|
||||
|
||||
|
||||
/************************************/
|
||||
/**************************************************************/
|
||||
void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||
/************************************/
|
||||
/***************************************************************/
|
||||
|
||||
/* Used if undo / redo command:
|
||||
* swap data between Item and its copy, pointed by its .m_Image member
|
||||
* swapped data is data modified by edition, so not all values are swapped
|
||||
*/
|
||||
{
|
||||
if( aItem == NULL || aImage == NULL )
|
||||
{
|
||||
wxMessageBox(wxT("SwapData error: NULL pointer"));
|
||||
wxMessageBox( wxT( "SwapData error: NULL pointer" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,19 +177,15 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
|||
int flag_type_command )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Create a copy of the current schematic draw list, and put it in the undo list.
|
||||
* A DrawPickedStruct wrapper is created to handle the draw list.
|
||||
* the .m_Son of this wrapper points the list of items
|
||||
/** function SaveCopyInUndoList
|
||||
* Create a copy of the current schematic item, and put it in the undo list.
|
||||
*
|
||||
* flag_type_command =
|
||||
* 0 (unspecified)
|
||||
* IS_CHANGED
|
||||
* IS_NEW
|
||||
* IS_DELETED
|
||||
* IS_WIRE_IMAGE
|
||||
*
|
||||
* for 0: only a wrapper is created. The used must init the .Flags member of the
|
||||
* wrapper, and add the item list to the wrapper
|
||||
* If it is a delete command, items are put on list with the .Flags member set to IS_DELETED.
|
||||
* When it will be really deleted, the EEDrawList and the subhierarchy will be deleted.
|
||||
* If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted.
|
||||
|
@ -205,33 +202,30 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
|||
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
|
||||
|
||||
commandToUndo->m_UndoRedoType = flag_type_command;
|
||||
ITEM_PICKER itemWrapper( ItemToCopy, flag_type_command );
|
||||
ITEM_PICKER itemWrapper( ItemToCopy, flag_type_command );
|
||||
|
||||
if( ItemToCopy )
|
||||
{
|
||||
switch( flag_type_command )
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case IS_CHANGED: /* Create a copy of schematic */
|
||||
if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy;
|
||||
while( PickedList )
|
||||
{
|
||||
CopyOfItem = DuplicateStruct( (SCH_ITEM*) PickedList->m_PickedStruct);
|
||||
CopyOfItem = DuplicateStruct( (SCH_ITEM*) PickedList->m_PickedStruct );
|
||||
CopyOfItem->m_Flags = flag_type_command;
|
||||
itemWrapper.m_Item = CopyOfItem;
|
||||
itemWrapper.m_Link = (SCH_ITEM*) PickedList->m_PickedStruct;
|
||||
itemWrapper.m_Link = (SCH_ITEM*) PickedList->m_PickedStruct;
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
PickedList = PickedList->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyOfItem = DuplicateStruct(ItemToCopy);
|
||||
itemWrapper.m_Item = CopyOfItem;
|
||||
CopyOfItem = DuplicateStruct( ItemToCopy );
|
||||
itemWrapper.m_Item = CopyOfItem;
|
||||
itemWrapper.m_Link = ItemToCopy;
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
}
|
||||
|
@ -305,10 +299,10 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
|||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(wxT( "SaveCopyInUndoList() error (unknown code %X)" ), flag_type_command);
|
||||
DisplayError( this, msg);
|
||||
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), flag_type_command );
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Save the copy in undo list */
|
||||
|
@ -319,6 +313,65 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
|||
}
|
||||
|
||||
|
||||
/** function SaveCopyInUndoList
|
||||
* @param aItemsList = a PICKED_ITEMS_LIST of items to save
|
||||
* @param aTypeCommand = type of comand ( IS_CHANGED, IS_NEW, IS_DELETED ...
|
||||
*/
|
||||
void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, int aTypeCommand )
|
||||
{
|
||||
SCH_ITEM* CopyOfItem;
|
||||
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
|
||||
|
||||
commandToUndo->m_UndoRedoType = aTypeCommand;
|
||||
ITEM_PICKER itemWrapper;
|
||||
|
||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||
{
|
||||
SCH_ITEM* ItemToCopy = (SCH_ITEM*) aItemsList.GetItemData( ii );
|
||||
int command = aItemsList.GetItemStatus( ii );
|
||||
if( command == 0 )
|
||||
{
|
||||
command = aTypeCommand;
|
||||
}
|
||||
itemWrapper.m_Item = ItemToCopy;
|
||||
itemWrapper.m_UndoRedoStatus = command;
|
||||
switch( command )
|
||||
{
|
||||
case IS_CHANGED: /* Create a copy of schematic */
|
||||
CopyOfItem = DuplicateStruct( ItemToCopy );
|
||||
itemWrapper.m_Item = CopyOfItem;
|
||||
itemWrapper.m_Link = ItemToCopy;
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
break;
|
||||
|
||||
case IS_NEW:
|
||||
case IS_NEW | IS_CHANGED: // when more than one item, some are new, some are changed
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
break;
|
||||
|
||||
case IS_DELETED:
|
||||
ItemToCopy->m_Flags = IS_DELETED;
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command );
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Save the copy in undo list */
|
||||
GetScreen()->PushCommandToUndoList( commandToUndo );
|
||||
|
||||
/* Clear redo list, because after new save there is no redo to do */
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
bool WinEDA_SchematicFrame::GetSchematicFromRedoList()
|
||||
/**********************************************************/
|
||||
|
@ -358,14 +411,15 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||
* Put data pointed by List in the previous state, i.e. the state memorised by List
|
||||
*/
|
||||
{
|
||||
SCH_ITEM* item;
|
||||
SCH_ITEM* alt_item;
|
||||
SCH_ITEM* item;
|
||||
SCH_ITEM* alt_item;
|
||||
|
||||
for( unsigned ii = 0; ii < aList->GetCount(); ii++ )
|
||||
{
|
||||
ITEM_PICKER itemWrapper = aList->GetItemWrapper( ii );
|
||||
item = (SCH_ITEM*) itemWrapper.m_Item;
|
||||
SCH_ITEM * image = (SCH_ITEM*) itemWrapper.m_Link;
|
||||
wxASSERT ( item );
|
||||
SCH_ITEM* image = (SCH_ITEM*) itemWrapper.m_Link;
|
||||
switch( itemWrapper.m_UndoRedoStatus )
|
||||
{
|
||||
case IS_CHANGED: /* Exchange old and new data for each item */
|
||||
|
@ -399,15 +453,18 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||
item->m_Flags = 0;
|
||||
item = nextitem;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(wxT( "PutDataInPreviousState() error (unknown code %X)" ), itemWrapper.m_UndoRedoStatus);
|
||||
DisplayError( this, msg);
|
||||
msg.Printf( wxT(
|
||||
"PutDataInPreviousState() error (unknown code %X)" ),
|
||||
itemWrapper.m_UndoRedoStatus );
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +515,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
* So this function can be called to remove old commands
|
||||
*/
|
||||
{
|
||||
int CmdType;
|
||||
int CmdType;
|
||||
|
||||
if( aItemCount == 0 )
|
||||
return;
|
||||
|
@ -468,17 +525,17 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
icnt = aItemCount;
|
||||
for( unsigned ii = 0; ii < icnt; ii++ )
|
||||
{
|
||||
if ( aList.m_CommandsList.size() == 0 )
|
||||
if( aList.m_CommandsList.size() == 0 )
|
||||
break;
|
||||
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
||||
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
||||
CmdType = curr_cmd->m_UndoRedoType;
|
||||
|
||||
// Delete items is they are not flagged IS_NEW
|
||||
while(1)
|
||||
while( 1 )
|
||||
{
|
||||
ITEM_PICKER wrapper = curr_cmd->PopItem();
|
||||
EDA_BaseStruct* item = wrapper.m_Item;
|
||||
ITEM_PICKER wrapper = curr_cmd->PopItem();
|
||||
EDA_BaseStruct* item = wrapper.m_Item;
|
||||
if( item == NULL ) // No more item in list.
|
||||
break;
|
||||
if( wrapper.m_UndoRedoStatus == IS_WIRE_IMAGE )
|
||||
|
@ -498,6 +555,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete curr_cmd; // Delete command
|
||||
}
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
|
|||
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
||||
{
|
||||
bool enable = ( GetScreen() &&
|
||||
GetScreen()->BlockLocate.m_Command == BLOCK_MOVE );
|
||||
GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
|
||||
event.Enable(enable);
|
||||
m_HToolBar->EnableTool( wxID_CUT, enable );
|
||||
m_HToolBar->EnableTool( wxID_COPY, enable );
|
||||
|
@ -424,8 +424,8 @@ void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
|||
|
||||
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( g_BlockSaveDataList != NULL );
|
||||
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList != NULL );
|
||||
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
|
||||
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
|
||||
}
|
||||
|
||||
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
|
||||
static TRACK* IsSegmentInBox( DrawBlockStruct& blocklocate, TRACK* PtSegm );
|
||||
static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm );
|
||||
|
||||
/* Variables locales :*/
|
||||
|
||||
|
@ -79,9 +79,9 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
|||
err = TRUE;
|
||||
DisplayError( this, wxT( "Error in 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:
|
||||
err = TRUE;
|
||||
|
@ -93,14 +93,14 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
|||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
Block_Move( DC );
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: /* Copy */
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
Block_Duplicate( DC );
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE:
|
||||
|
@ -122,13 +122,13 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
|||
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace DrawStruct != NULL" ) );
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) );
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
|
@ -151,7 +151,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
|
||||
switch( GetScreen()->BlockLocate.m_Command )
|
||||
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||
{
|
||||
case BLOCK_IDLE:
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||
|
@ -161,7 +161,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
endcommande = FALSE;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
|
@ -169,13 +169,13 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
|||
break;
|
||||
|
||||
case BLOCK_DELETE: /* Delete */
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
Block_Delete( DC );
|
||||
break;
|
||||
|
||||
case BLOCK_MIRROR_X: /* Mirror*/
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
Block_Mirror_X( DC );
|
||||
break;
|
||||
|
@ -204,17 +204,17 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
if( endcommande == TRUE )
|
||||
{
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
}
|
||||
|
||||
if( zoom_command )
|
||||
Window_Zoom( GetScreen()->BlockLocate );
|
||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||
|
||||
return endcommande;
|
||||
}
|
||||
|
@ -230,34 +230,28 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
|||
int Color;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
|
||||
Color = YELLOW; GRSetDrawMode( DC, g_XorMode );
|
||||
Color = YELLOW;
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
{
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0),g_XorMode, Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||
{
|
||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
||||
-screen->BlockLocate.m_MoveVector.y );
|
||||
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color );
|
||||
}
|
||||
}
|
||||
|
||||
if( panel->GetScreen()->BlockLocate.m_State != STATE_BLOCK_STOP )
|
||||
if( panel->GetScreen()->m_BlockLocate.m_State != STATE_BLOCK_STOP )
|
||||
{
|
||||
screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight();
|
||||
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();
|
||||
screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight();
|
||||
screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom();
|
||||
}
|
||||
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0),g_XorMode, Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||
{
|
||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
||||
-screen->BlockLocate.m_MoveVector.y );
|
||||
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,7 +268,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
return;
|
||||
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
|
||||
/* Effacement des Pistes */
|
||||
|
@ -282,7 +276,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = NextS )
|
||||
{
|
||||
NextS = pt_segm->Next();
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, pt_segm ) )
|
||||
{
|
||||
/* la piste est ici bonne a etre efface */
|
||||
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
||||
|
@ -294,7 +288,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextS )
|
||||
{
|
||||
NextS = pt_segm->Next();
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, pt_segm ) )
|
||||
{
|
||||
/* la piste est ici bonne a etre efface */
|
||||
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
||||
|
@ -324,16 +318,16 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
GetScreen()->m_Curseur = oldpos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
||||
delta = GetScreen()->BlockLocate.m_MoveVector;
|
||||
delta = GetScreen()->m_BlockLocate.m_MoveVector;
|
||||
|
||||
/* Move the Track segments in block */
|
||||
TRACK* track = m_Pcb->m_Track;
|
||||
while( track )
|
||||
{
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, track ) )
|
||||
{
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
track->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||
|
@ -353,7 +347,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
SEGZONE * zsegment= m_Pcb->m_Zone;
|
||||
while( zsegment )
|
||||
{
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) )
|
||||
{
|
||||
zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||
zsegment->m_Start += delta;
|
||||
|
@ -388,16 +382,16 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
|
|||
GetScreen()->m_Curseur = oldpos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
/* Calculate offset to mirror track points from block edges */
|
||||
xoffset = GetScreen()->BlockLocate.m_Pos.x + GetScreen()->BlockLocate.m_Pos.x
|
||||
+ GetScreen()->BlockLocate.m_Size.x;
|
||||
xoffset = GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Pos.x
|
||||
+ GetScreen()->m_BlockLocate.m_Size.x;
|
||||
|
||||
/* Move the Track segments in block */
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, track ) )
|
||||
{
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
track->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||
|
@ -414,7 +408,7 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
|
|||
/* Move the Zone segments in block */
|
||||
for( SEGZONE* zsegment = m_Pcb->m_Zone; zsegment; zsegment = zsegment->Next() )
|
||||
{
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) )
|
||||
{
|
||||
zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||
zsegment->m_Start.x = xoffset - zsegment->m_Start.x;
|
||||
|
@ -426,7 +420,7 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
|
|||
zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DrawPanel->Refresh( TRUE );
|
||||
}
|
||||
|
||||
|
@ -448,18 +442,18 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
GetScreen()->m_Curseur = oldpos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
|
||||
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
||||
delta = GetScreen()->BlockLocate.m_MoveVector;
|
||||
delta = GetScreen()->m_BlockLocate.m_MoveVector;
|
||||
|
||||
/* Copy selected track segments and move the new track its new location */
|
||||
TRACK* track = m_Pcb->m_Track;
|
||||
while( track )
|
||||
{
|
||||
TRACK* next_track = track->Next();
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, track ) )
|
||||
{
|
||||
/* this track segment must be duplicated */
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
|
@ -480,7 +474,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
while( zsegment )
|
||||
{
|
||||
SEGZONE * next_zsegment = zsegment->Next();
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
||||
if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) )
|
||||
{
|
||||
/* this zone segment must be duplicated */
|
||||
SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy();
|
||||
|
@ -498,7 +492,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
|
||||
|
||||
/**************************************************************************/
|
||||
static TRACK* IsSegmentInBox( DrawBlockStruct& blocklocate, TRACK* PtSegm )
|
||||
static TRACK* IsSegmentInBox( BLOCK_SELECTOR& blocklocate, TRACK* PtSegm )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Teste si la structure PtStruct est inscrite dans le block selectionne
|
||||
|
|
|
@ -108,11 +108,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
/* 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()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
if( m_ID_current_state == 0 )
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
|
@ -250,34 +250,34 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_MIRROR_X_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_MIRROR_X;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ void WinEDA_GerberFrame::SetToolbars()
|
|||
if( m_HToolBar == NULL )
|
||||
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_COPY, TRUE );
|
||||
|
|
|
@ -22,7 +22,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
|
|||
{
|
||||
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
||||
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
|
||||
|
||||
|
|
|
@ -8,18 +8,108 @@
|
|||
#define __INCLUDE__BLOCK_COMMANDE_H__ 1
|
||||
|
||||
|
||||
#include "base_struct.h"
|
||||
#include "class_undoredo_container.h"
|
||||
|
||||
|
||||
// Forward declarations:
|
||||
|
||||
|
||||
/**************************/
|
||||
/* 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 );
|
||||
|
||||
/* Cancel Current block operation. */
|
||||
void InitBlockLocateDatas( WinEDA_DrawPanel* Panel, const wxPoint& startpos );
|
||||
|
||||
/* Init the initial values of a BlockLocate, before starting a block command */
|
||||
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
|
||||
/* 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
|
||||
* 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__ */
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
**********************/
|
||||
|
||||
/* define :
|
||||
* class DrawBlockStruct used to handle block commands
|
||||
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
|
||||
*/
|
||||
|
||||
|
@ -12,6 +11,7 @@
|
|||
|
||||
#include "base_struct.h"
|
||||
#include "class_undoredo_container.h"
|
||||
#include "block_commande.h"
|
||||
|
||||
|
||||
// Forward declarations:
|
||||
|
@ -19,65 +19,11 @@ class SCH_ITEM;
|
|||
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. */
|
||||
class GRID_TYPE
|
||||
{
|
||||
public:
|
||||
int m_Id;
|
||||
int m_Id;
|
||||
wxRealPoint m_Size;
|
||||
};
|
||||
|
||||
|
@ -93,9 +39,9 @@ WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray );
|
|||
class BASE_SCREEN : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
wxPoint m_DrawOrg; /* offsets pour tracer le circuit sur l'ecran */
|
||||
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
|
||||
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
|
||||
wxPoint m_DrawOrg; /* offsets pour tracer le circuit sur l'ecran */
|
||||
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
|
||||
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
|
||||
wxPoint m_MousePositionInPixels;
|
||||
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid) in user units.
|
||||
* (coordinates from last reset position)*/
|
||||
|
@ -115,32 +61,32 @@ public:
|
|||
* > 0 all but schematic
|
||||
* FALSE: when coordinates can be only >= 0
|
||||
* Schematic */
|
||||
bool m_FirstRedraw;
|
||||
bool m_FirstRedraw;
|
||||
|
||||
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_CONTAINER m_UndoList; /* Object list for the undo command (old data) */
|
||||
UNDO_REDO_CONTAINER m_RedoList; /* Object list for the redo command (old data) */
|
||||
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
|
||||
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
|
||||
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
|
||||
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
|
||||
|
||||
/* block control */
|
||||
DrawBlockStruct BlockLocate; /* Bock description for block commands */
|
||||
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
|
||||
|
||||
/* Page description */
|
||||
Ki_PageDescr* m_CurrentSheetDesc;
|
||||
int m_ScreenNumber;
|
||||
int m_NumberOfScreen;
|
||||
Ki_PageDescr* m_CurrentSheetDesc;
|
||||
int m_ScreenNumber;
|
||||
int m_NumberOfScreen;
|
||||
|
||||
wxString m_FileName;
|
||||
wxString m_Title; /* titre de la feuille */
|
||||
wxString m_Date; /* date de mise a jour */
|
||||
wxString m_Revision; /* code de revision */
|
||||
wxString m_Company; /* nom du proprietaire */
|
||||
wxString m_Commentaire1;
|
||||
wxString m_Commentaire2;
|
||||
wxString m_Commentaire3;
|
||||
wxString m_Commentaire4;
|
||||
wxString m_FileName;
|
||||
wxString m_Title; /* titre de la feuille */
|
||||
wxString m_Date; /* date de mise a jour */
|
||||
wxString m_Revision; /* code de revision */
|
||||
wxString m_Company; /* nom du proprietaire */
|
||||
wxString m_Commentaire1;
|
||||
wxString m_Commentaire2;
|
||||
wxString m_Commentaire3;
|
||||
wxString m_Commentaire4;
|
||||
|
||||
private:
|
||||
/* indicateurs divers */
|
||||
|
@ -151,14 +97,14 @@ private:
|
|||
|
||||
/* Valeurs du pas de grille et du zoom */
|
||||
public:
|
||||
wxRealPoint m_Grid; /* Current grid. */
|
||||
GridArray m_GridList;
|
||||
bool m_UserGridIsON;
|
||||
wxRealPoint m_Grid; /* Current grid. */
|
||||
GridArray m_GridList;
|
||||
bool m_UserGridIsON;
|
||||
|
||||
wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */
|
||||
int m_Zoom; /* Current zoom coefficient. */
|
||||
int m_ZoomScalar; /* Allow zooming to non-integer increments. */
|
||||
bool m_IsPrinting;
|
||||
wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */
|
||||
int m_Zoom; /* Current zoom coefficient. */
|
||||
int m_ZoomScalar; /* Allow zooming to non-integer increments. */
|
||||
bool m_IsPrinting;
|
||||
|
||||
public:
|
||||
BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
|
||||
|
@ -176,32 +122,36 @@ public:
|
|||
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
|
||||
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
|
||||
|
||||
void InitDatas(); /* Inits completes des variables */
|
||||
void InitDatas(); /* Inits completes des variables */
|
||||
|
||||
wxSize ReturnPageSize( void );
|
||||
virtual int GetInternalUnits( void );
|
||||
wxSize ReturnPageSize( void );
|
||||
virtual int GetInternalUnits( void );
|
||||
|
||||
/** Function CursorRealPosition
|
||||
* @return the position in user units of location ScreenPos
|
||||
* @param ScreenPos = the screen (in pixel) position co convert
|
||||
*/
|
||||
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
|
||||
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
|
||||
|
||||
/* general Undo/Redo command control */
|
||||
virtual void ClearUndoRedoList();
|
||||
virtual void PushCommandToUndoList( PICKED_ITEMS_LIST* aItem );
|
||||
virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
|
||||
virtual void ClearUndoRedoList();
|
||||
virtual void PushCommandToUndoList( PICKED_ITEMS_LIST* aItem );
|
||||
virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
|
||||
virtual PICKED_ITEMS_LIST* PopCommandFromUndoList();
|
||||
virtual PICKED_ITEMS_LIST* PopCommandFromRedoList();
|
||||
int GetUndoCommandCount( )
|
||||
|
||||
int GetUndoCommandCount()
|
||||
{
|
||||
return m_UndoList.m_CommandsList.size();
|
||||
}
|
||||
int GetRedoCommandCount( )
|
||||
|
||||
|
||||
int GetRedoCommandCount()
|
||||
{
|
||||
return m_RedoList.m_CommandsList.size();
|
||||
}
|
||||
|
||||
|
||||
/* Manipulation des flags */
|
||||
void SetRefreshReq() { m_FlagRefreshReq = 1; }
|
||||
void ClrRefreshReq() { m_FlagRefreshReq = 0; }
|
||||
|
@ -230,51 +180,51 @@ public:
|
|||
* @param the the current scale used to draw items on screen
|
||||
* draw coordinates are user coordinates * GetScalingFactor( )
|
||||
*/
|
||||
void SetScalingFactor( double aScale );
|
||||
void SetScalingFactor( double aScale );
|
||||
|
||||
/** Function GetZoom
|
||||
* @return the current zoom factor
|
||||
* Note: the zoom factor is NOT the scaling factor
|
||||
* the scaling factor is m_ZoomScalar * GetZoom()
|
||||
*/
|
||||
int GetZoom() const;
|
||||
int GetZoom() const;
|
||||
|
||||
/**
|
||||
* Function SetZoom
|
||||
* adjusts the current zoom factor
|
||||
*/
|
||||
bool SetZoom( int coeff );
|
||||
bool SetZoom( int coeff );
|
||||
|
||||
/**
|
||||
* Function SetZoomList
|
||||
* sets the list of zoom factors.
|
||||
* @param aZoomList An array of zoom factors in ascending order, zero terminated
|
||||
*/
|
||||
void SetZoomList( const wxArrayInt& zoomlist );
|
||||
void SetZoomList( const wxArrayInt& zoomlist );
|
||||
|
||||
int Scale( int coord );
|
||||
double Scale( double coord );
|
||||
void Scale( wxPoint& pt );
|
||||
void Scale( wxSize& sz );
|
||||
void Scale( wxRealPoint& sz );
|
||||
int Scale( int coord );
|
||||
double Scale( double coord );
|
||||
void Scale( wxPoint& pt );
|
||||
void Scale( wxSize& sz );
|
||||
void Scale( wxRealPoint& sz );
|
||||
|
||||
int Unscale( int coord );
|
||||
void Unscale( wxPoint& pt );
|
||||
void Unscale( wxSize& sz );
|
||||
int Unscale( int coord );
|
||||
void Unscale( wxPoint& pt );
|
||||
void Unscale( wxSize& sz );
|
||||
|
||||
bool SetNextZoom(); /* ajuste le prochain coeff de zoom */
|
||||
bool SetPreviousZoom(); /* ajuste le precedent coeff de zoom */
|
||||
bool SetFirstZoom(); /* ajuste le coeff de zoom a 1*/
|
||||
bool SetLastZoom(); /* ajuste le coeff de zoom au max */
|
||||
bool SetNextZoom(); /* ajuste le prochain coeff de zoom */
|
||||
bool SetPreviousZoom(); /* ajuste le precedent coeff de zoom */
|
||||
bool SetFirstZoom(); /* ajuste le coeff de zoom a 1*/
|
||||
bool SetLastZoom(); /* ajuste le coeff de zoom au max */
|
||||
|
||||
//----<grid stuff>----------------------------------------------------------
|
||||
wxRealPoint GetGrid(); /* retourne la grille */
|
||||
void SetGrid( const wxRealPoint& size );
|
||||
void SetGrid( int );
|
||||
void SetGridList( GridArray& sizelist );
|
||||
void AddGrid( const GRID_TYPE& grid );
|
||||
void AddGrid( const wxRealPoint& size, int id );
|
||||
void AddGrid( const wxRealPoint& size, int units, int id );
|
||||
void SetGrid( const wxRealPoint& size );
|
||||
void SetGrid( int );
|
||||
void SetGridList( GridArray& sizelist );
|
||||
void AddGrid( const GRID_TYPE& grid );
|
||||
void AddGrid( const wxRealPoint& size, int id );
|
||||
void AddGrid( const wxRealPoint& size, int units, int id );
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,9 +88,18 @@ public:
|
|||
~PICKED_ITEMS_LIST();
|
||||
void PushItem( ITEM_PICKER& aItem );
|
||||
ITEM_PICKER PopItem();
|
||||
|
||||
/** Function ClearItemsList
|
||||
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
@ -105,6 +114,12 @@ public:
|
|||
bool SetLink( EDA_BaseStruct* aItem, unsigned aIdx );
|
||||
bool SetItemStatus( int aStatus, 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:
|
|||
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
||||
|
||||
/* Operations sur bloc */
|
||||
void PasteStruct( wxDC* DC );
|
||||
void PasteListOfItems( wxDC* DC );
|
||||
|
||||
/* Undo - redo */
|
||||
public:
|
||||
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
||||
int flag_type_command = 0 );
|
||||
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy, int aTypeCommand );
|
||||
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, int aTypeCommand );
|
||||
|
||||
private:
|
||||
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
|
||||
|
|
169
pcbnew/block.cpp
169
pcbnew/block.cpp
|
@ -247,9 +247,9 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
|||
err = TRUE;
|
||||
DisplayError( this, wxT( "Error in 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:
|
||||
err = TRUE;
|
||||
|
@ -261,14 +261,14 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
|||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
Block_Move( DC );
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: /* Copy */
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
Block_Duplicate( DC );
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE:
|
||||
|
@ -283,13 +283,13 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
|||
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace DrawStruct != NULL" ) );
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) );
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
|
@ -310,7 +310,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
int endcommande = TRUE;
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
switch( GetScreen()->BlockLocate.m_Command )
|
||||
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||
{
|
||||
case BLOCK_IDLE:
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||
|
@ -320,7 +320,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
endcommande = FALSE;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
|
@ -331,7 +331,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
// Turn off the block rectangle now so it is not redisplayed
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
Block_Delete( DC );
|
||||
break;
|
||||
|
@ -340,7 +340,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
// Turn off the block rectangle now so it is not redisplayed
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
Block_Rotate( DC );
|
||||
break;
|
||||
|
@ -349,18 +349,18 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
// Turn off the block rectangle now so it is not redisplayed
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
Block_Invert( DC );
|
||||
break;
|
||||
|
||||
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct != NULL )
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
|
||||
// SaveStruct(GetScreen()->BlockLocate.m_BlockDrawStruct);
|
||||
// SaveStruct(GetScreen()->m_BlockLocate.m_BlockDrawStruct);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -372,7 +372,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
//Turn off the redraw block routine now so it is not displayed
|
||||
// with one corner at the new center of the screen
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
Window_Zoom( GetScreen()->BlockLocate );
|
||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -381,10 +381,10 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
if( endcommande == TRUE )
|
||||
{
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
|
@ -405,34 +405,27 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
|||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
|
||||
Color = YELLOW;
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
{
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0), g_XorMode, Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||
{
|
||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
||||
-screen->BlockLocate.m_MoveVector.y );
|
||||
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color );
|
||||
}
|
||||
}
|
||||
|
||||
if( screen->BlockLocate.m_State != STATE_BLOCK_STOP )
|
||||
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
|
||||
{
|
||||
screen->BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->BlockLocate.GetRight();
|
||||
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();
|
||||
screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight();
|
||||
screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom();
|
||||
}
|
||||
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0), g_XorMode, Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||
{
|
||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
||||
screen->BlockLocate.Draw( panel, DC );
|
||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
||||
-screen->BlockLocate.m_MoveVector.y );
|
||||
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,7 +445,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
return;
|
||||
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
SetCurItem( NULL );
|
||||
|
||||
/* Effacement des modules */
|
||||
|
@ -463,7 +456,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
for( ; module != NULL; module = (MODULE*) NextS )
|
||||
{
|
||||
NextS = module->Next();
|
||||
if( module->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
module->m_Flags = 0;
|
||||
module->DeleteStructure();
|
||||
|
@ -480,7 +473,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) NextS )
|
||||
{
|
||||
NextS = pt_segm->Next();
|
||||
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
/* la piste est ici bonne a etre efface */
|
||||
pt_segm->DeleteStructure();
|
||||
|
@ -506,7 +499,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
case TYPE_DRAWSEGMENT:
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
|
||||
/* l'element est ici bon a etre efface */
|
||||
|
@ -517,7 +510,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
case TYPE_TEXTE:
|
||||
if( !Block_Include_PcbTextes )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* le texte est ici bon a etre efface */
|
||||
PtStruct->Draw( DrawPanel, DC, GR_XOR );
|
||||
|
@ -528,7 +521,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
case TYPE_MIRE:
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre efface */
|
||||
PtStruct->DeleteStructure();
|
||||
|
@ -537,7 +530,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
case TYPE_COTATION:
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
PtStruct->DeleteStructure();
|
||||
break;
|
||||
|
@ -556,7 +549,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextSegZ )
|
||||
{
|
||||
NextSegZ = pt_segm->Next();
|
||||
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
pt_segm->DeleteStructure();
|
||||
}
|
||||
|
@ -564,7 +557,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
|||
|
||||
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
m_Pcb->Delete(m_Pcb->GetArea(ii));
|
||||
ii--; // because the current data was removed, ii points actually the next data
|
||||
|
@ -597,9 +590,9 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
return;
|
||||
|
||||
oldpos = GetScreen()->m_Curseur;
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
centre = GetScreen()->BlockLocate.Centre(); // This is the rotation centre
|
||||
centre = GetScreen()->m_BlockLocate.Centre(); // This is the rotation centre
|
||||
|
||||
GetScreen()->SetModify();
|
||||
|
||||
|
@ -611,7 +604,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
module = m_Pcb->m_Modules;
|
||||
for( ; module != NULL; module = module->Next() )
|
||||
{
|
||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
continue;
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
module->m_Flags = 0;
|
||||
|
@ -635,7 +628,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
track = m_Pcb->m_Track;
|
||||
while( track )
|
||||
{
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{ /* la piste est ici bonne a etre deplacee */
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
RotatePoint( &track->m_Start, centre, 900 );
|
||||
|
@ -654,7 +647,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
track = (TRACK*) m_Pcb->m_Zone;
|
||||
while( track )
|
||||
{
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
RotatePoint( &track->m_Start, centre, 900 );
|
||||
RotatePoint( &track->m_End, centre, 900 );
|
||||
|
@ -663,7 +656,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
}
|
||||
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
m_Pcb->GetArea(ii)->Rotate(centre, 900);
|
||||
}
|
||||
|
@ -687,7 +680,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
RotatePoint( &STRUCT->m_Start, centre, 900 );
|
||||
RotatePoint( &STRUCT->m_End, centre, 900 );
|
||||
|
@ -698,7 +691,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
||||
if( !Block_Include_PcbTextes )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
RotatePoint( &STRUCT->m_Pos, centre, 900 );
|
||||
STRUCT->m_Orient += 900;
|
||||
|
@ -711,7 +704,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
#define STRUCT ( (MIREPCB*) PtStruct )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre modifie */
|
||||
RotatePoint( &STRUCT->m_Pos, centre, 900 );
|
||||
|
@ -722,7 +715,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
|||
#define STRUCT ( (COTATION*) PtStruct )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
STRUCT->Rotate(centre, 900);
|
||||
break;
|
||||
|
@ -759,10 +752,10 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
return;
|
||||
|
||||
memo = GetScreen()->m_Curseur;
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
/* calcul du centre d'inversion */
|
||||
centerY = GetScreen()->BlockLocate.Centre().y;
|
||||
centerY = GetScreen()->m_BlockLocate.Centre().y;
|
||||
|
||||
GetScreen()->SetModify();
|
||||
|
||||
|
@ -773,7 +766,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
module = m_Pcb->m_Modules;
|
||||
for( ; module != NULL; module = module->Next() )
|
||||
{
|
||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
continue;
|
||||
/* le module est ici bon a etre efface */
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
|
@ -804,7 +797,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
track = m_Pcb->m_Track;
|
||||
while( track )
|
||||
{
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{ /* la piste est ici bonne a etre deplacee */
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
INVERT( track->m_Start.y );
|
||||
|
@ -826,7 +819,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
track = (TRACK*) m_Pcb->m_Zone;
|
||||
while( track )
|
||||
{
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{ /* la piste est ici bonne a etre deplacee */
|
||||
INVERT( track->m_Start.y );
|
||||
INVERT( track->m_End.y );
|
||||
|
@ -836,7 +829,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
}
|
||||
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
m_Pcb->GetArea(ii)->Mirror( wxPoint(0, centerY) );
|
||||
m_Pcb->GetArea(ii)->SetLayer( ChangeSideNumLayer( m_Pcb->GetArea(ii)->GetLayer() ) );
|
||||
|
@ -860,7 +853,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre selectionne */
|
||||
if( STRUCT->m_Shape == S_ARC )
|
||||
|
@ -877,7 +870,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
||||
if( !Block_Include_PcbTextes )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* le texte est ici bon a etre selectionne*/
|
||||
INVERT( STRUCT->m_Pos.y );
|
||||
|
@ -894,7 +887,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
#define STRUCT ( (MIREPCB*) PtStruct )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre modifie */
|
||||
INVERT( STRUCT->m_Pos.y );
|
||||
|
@ -906,7 +899,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
|||
#define STRUCT ( (COTATION*) PtStruct )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre modifie */
|
||||
|
||||
|
@ -934,7 +927,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
{
|
||||
int masque_layer;
|
||||
wxPoint oldpos;
|
||||
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
|
||||
wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector;
|
||||
|
||||
oldpos = GetScreen()->m_Curseur;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
|
@ -945,7 +938,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
GetScreen()->m_Curseur = oldpos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
/* Deplacement des modules */
|
||||
if( Block_Include_Modules )
|
||||
|
@ -955,7 +948,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
|
||||
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
continue;
|
||||
|
||||
/* le module est ici bon a etre deplace */
|
||||
|
@ -974,7 +967,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
{
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{ /* la piste est ici bonne a etre deplacee */
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
track->m_Start += MoveVector;
|
||||
|
@ -988,7 +981,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
{
|
||||
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
|
||||
{
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{ /* la piste est ici bonne a etre deplacee */
|
||||
track->m_Start += MoveVector;
|
||||
track->m_End += MoveVector;
|
||||
|
@ -996,7 +989,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
}
|
||||
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
m_Pcb->GetArea(ii)->Move( MoveVector );
|
||||
}
|
||||
|
@ -1018,7 +1011,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
#define STRUCT ( (DRAWSEGMENT*) item )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre efface */
|
||||
STRUCT->m_Start += MoveVector;
|
||||
|
@ -1030,7 +1023,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
#define STRUCT ( (TEXTE_PCB*) item )
|
||||
if( !Block_Include_PcbTextes )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* le texte est ici bon a etre deplace */
|
||||
/* Redessin du Texte */
|
||||
|
@ -1042,7 +1035,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
#define STRUCT ( (MIREPCB*) item )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre efface */
|
||||
STRUCT->m_Pos += MoveVector;
|
||||
|
@ -1053,7 +1046,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
#define STRUCT ( (COTATION*) item )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre efface */
|
||||
( (COTATION*) item )->Move( wxPoint(MoveVector) );
|
||||
|
@ -1079,7 +1072,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
{
|
||||
int masque_layer;
|
||||
wxPoint oldpos;
|
||||
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
|
||||
wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector;
|
||||
|
||||
oldpos = GetScreen()->m_Curseur;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
|
@ -1090,7 +1083,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
GetScreen()->m_Curseur = oldpos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->BlockLocate.Normalize();
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
/* Module copy */
|
||||
if( Block_Include_Modules )
|
||||
|
@ -1102,7 +1095,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
for( MODULE* module= m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
MODULE* new_module;
|
||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
continue;
|
||||
|
||||
/* le module est ici bon a etre deplace */
|
||||
|
@ -1130,7 +1123,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
while( track )
|
||||
{
|
||||
next_track = track->Next();
|
||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
/* la piste est ici bonne a etre deplacee */
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
|
@ -1150,7 +1143,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
{
|
||||
for( SEGZONE* segzone = m_Pcb->m_Zone; segzone; segzone = segzone->Next() )
|
||||
{
|
||||
if( segzone->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( segzone->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
SEGZONE* new_segzone = (SEGZONE*) segzone->Copy();
|
||||
|
||||
|
@ -1164,7 +1157,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
unsigned imax = m_Pcb->GetAreaCount();
|
||||
for ( unsigned ii = 0; ii < imax; ii++ )
|
||||
{
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
ZONE_CONTAINER * new_zone = new ZONE_CONTAINER(m_Pcb);
|
||||
new_zone->Copy( m_Pcb->GetArea(ii) );
|
||||
|
@ -1191,7 +1184,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
#define STRUCT ( (DRAWSEGMENT*) item )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
|
||||
/* l'element est ici bon a etre copie */
|
||||
|
@ -1211,7 +1204,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
#define STRUCT ( (TEXTE_PCB*) item )
|
||||
if( !Block_Include_PcbTextes )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* le texte est ici bon a etre deplace */
|
||||
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
|
||||
|
@ -1230,7 +1223,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
#define STRUCT ( (MIREPCB*) item )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre efface */
|
||||
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
||||
|
@ -1248,7 +1241,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
#define STRUCT ( (COTATION*) item )
|
||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||
break;
|
||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
||||
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
/* l'element est ici bon a etre copie */
|
||||
COTATION* new_cotation = new COTATION( m_Pcb );
|
||||
|
|
|
@ -104,21 +104,21 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
int ItemsCount = 0, MustDoPlace = 0;
|
||||
MODULE* Currentmodule = GetBoard()->m_Modules;
|
||||
|
||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
BlockState state = GetScreen()->BlockLocate.m_State;
|
||||
CmdBlockType command = GetScreen()->BlockLocate.m_Command;
|
||||
BlockState state = GetScreen()->m_BlockLocate.m_State;
|
||||
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
|
||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
|
||||
GetScreen()->BlockLocate.m_State = state;
|
||||
GetScreen()->BlockLocate.m_Command = command;
|
||||
GetScreen()->m_BlockLocate.m_State = state;
|
||||
GetScreen()->m_BlockLocate.m_Command = command;
|
||||
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
||||
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
||||
GetScreen()->m_Curseur.x = GetScreen()->BlockLocate.GetRight();
|
||||
GetScreen()->m_Curseur.y = GetScreen()->BlockLocate.GetBottom();
|
||||
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
|
||||
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
||||
switch( GetScreen()->BlockLocate.m_Command )
|
||||
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||
{
|
||||
case BLOCK_IDLE:
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||
|
@ -127,7 +127,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_DRAG: /* Drag */
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
{
|
||||
MustDoPlace = 1;
|
||||
|
@ -137,7 +137,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
}
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
DrawPanel->Refresh( TRUE );
|
||||
}
|
||||
break;
|
||||
|
@ -145,11 +145,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
MustDoPlace = 1;
|
||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||
break;
|
||||
|
||||
case BLOCK_DELETE: /* Delete */
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
DeleteMarkedItems( Currentmodule );
|
||||
|
@ -160,24 +160,24 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
break;
|
||||
|
||||
case BLOCK_ROTATE:
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
RotateMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
||||
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
|
||||
case BLOCK_MIRROR_X:
|
||||
case BLOCK_MIRROR_Y:
|
||||
case BLOCK_INVERT: /* mirror */
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
MirrorMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
||||
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: /* Window Zoom */
|
||||
Window_Zoom( GetScreen()->BlockLocate );
|
||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||
break;
|
||||
|
||||
case BLOCK_ABORT:
|
||||
|
@ -189,19 +189,17 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
|
||||
if( MustDoPlace <= 0 )
|
||||
{
|
||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
||||
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
||||
{
|
||||
ClearMarkItems( Currentmodule );
|
||||
}
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
SetCurItem( NULL );
|
||||
SetToolID( m_ID_current_state,
|
||||
DrawPanel->m_PanelDefaultCursor,
|
||||
wxEmptyString );
|
||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
}
|
||||
|
||||
|
@ -229,9 +227,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
|||
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:
|
||||
err = TRUE;
|
||||
|
@ -240,32 +238,32 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
|||
case BLOCK_DRAG: /* Drag */
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
MoveMarkedItems( Currentmodule, GetScreen()->BlockLocate.m_MoveVector );
|
||||
MoveMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: /* Copy */
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
CopyMarkedItems( Currentmodule, GetScreen()->BlockLocate.m_MoveVector );
|
||||
CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_MIRROR_X:
|
||||
case BLOCK_MIRROR_Y:
|
||||
case BLOCK_INVERT: /* Mirror by popup menu, from block move */
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
MirrorMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
||||
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
case BLOCK_ROTATE:
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
RotateMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
||||
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
||||
|
@ -280,9 +278,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
|||
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
GetScreen()->BlockLocate.m_Flags = 0;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
SetCurItem( NULL );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
|
||||
|
@ -301,22 +299,20 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
* L'ensemble du block suit le curseur
|
||||
*/
|
||||
{
|
||||
DrawBlockStruct* PtBlock;
|
||||
BLOCK_SELECTOR* PtBlock;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
BOARD_ITEM* item;
|
||||
wxPoint move_offset;
|
||||
MODULE* Currentmodule =
|
||||
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
|
||||
|
||||
PtBlock = &screen->BlockLocate;
|
||||
PtBlock = &screen->m_BlockLocate;
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
{
|
||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
||||
PtBlock->Draw( panel, DC );
|
||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||
|
||||
if( Currentmodule )
|
||||
{
|
||||
|
@ -356,10 +352,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
|
||||
PtBlock->m_BlockLastCursorPosition.y;
|
||||
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
||||
PtBlock->Draw( panel, DC );
|
||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||
|
||||
|
||||
if( Currentmodule )
|
||||
|
|
|
@ -500,10 +500,10 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
if( (CurrentTime - g_SaveTime) > g_TimeOut )
|
||||
{
|
||||
wxString tmpFileName = GetScreen()->m_FileName;
|
||||
wxString filename = g_SaveFileName + PcbExtBuffer;
|
||||
wxFileName fn = wxFileName( wxEmptyString, g_SaveFileName, PcbExtBuffer );
|
||||
bool flgmodify = GetScreen()->IsModify();
|
||||
|
||||
( (WinEDA_PcbFrame*) this )->SavePcbFile( filename );
|
||||
SavePcbFile( fn.GetFullPath() );
|
||||
|
||||
if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile()
|
||||
{
|
||||
|
@ -569,7 +569,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
keep_on_grid = FALSE;
|
||||
|
||||
/* 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;
|
||||
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||
|
|
333
pcbnew/edit.cpp
333
pcbnew/edit.cpp
|
@ -28,14 +28,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
/* Traite les selections d'outils et les commandes appelees du menu POPUP
|
||||
*/
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
|
||||
int itmp;
|
||||
wxClientDC dc( DrawPanel );
|
||||
int itmp;
|
||||
wxClientDC dc( DrawPanel );
|
||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||
|
||||
int toggle = 0;
|
||||
int toggle = 0;
|
||||
|
||||
DrawPanel->CursorOff( &dc );
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
@ -151,26 +151,29 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
/* Should not be executed, just in case */
|
||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
|
||||
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||
{
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
if( m_ID_current_state == 0 )
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
else
|
||||
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||
break;
|
||||
|
||||
case ID_TOGGLE_PRESENT_COMMAND:
|
||||
/* if( DrawPanel->ManageCurseur
|
||||
&& DrawPanel->ForceCloseManageCurseur )
|
||||
{
|
||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
*/
|
||||
|
||||
/* if( DrawPanel->ManageCurseur
|
||||
* && DrawPanel->ForceCloseManageCurseur )
|
||||
* {
|
||||
* DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
* }
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
default: // Finish (abort ) the command
|
||||
if( DrawPanel->ManageCurseur
|
||||
&& DrawPanel->ForceCloseManageCurseur )
|
||||
|
@ -178,168 +181,103 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
|
||||
if( m_ID_current_state != id ){
|
||||
if (m_ID_last_state != m_ID_current_state)
|
||||
m_ID_last_state = m_ID_current_state;
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
if( m_ID_current_state != id )
|
||||
{
|
||||
if( m_ID_last_state != m_ID_current_state )
|
||||
m_ID_last_state = m_ID_current_state;
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch( id ) // Execute command
|
||||
{
|
||||
case 0: break;
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case ID_EXIT:
|
||||
Close( true );
|
||||
break;
|
||||
|
||||
case ID_TOGGLE_PRESENT_COMMAND:
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
case 0:
|
||||
/* if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||
}
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
case 0:
|
||||
toggle = 1;
|
||||
break;
|
||||
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
||||
break;
|
||||
case ID_TRACK_BUTT:
|
||||
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||
{
|
||||
End_Route( (TRACK*) DrawStruct, &dc );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
}
|
||||
else
|
||||
toggle = 1;
|
||||
break;
|
||||
|
||||
SendMessageToEESCHEMA( DrawStruct );
|
||||
case ID_PCB_ZONES_BUTT:
|
||||
if( End_Zone( &dc ) )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
else
|
||||
toggle = 1;
|
||||
break;
|
||||
|
||||
// An item is found
|
||||
SetCurItem( DrawStruct );
|
||||
case ID_LINE_COMMENT_BUTT:
|
||||
case ID_PCB_ARC_BUTT:
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
if( DrawStruct == NULL )
|
||||
{
|
||||
}
|
||||
else if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
|
||||
{
|
||||
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
}
|
||||
else if( (DrawStruct->m_Flags & IS_NEW) )
|
||||
{
|
||||
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
else
|
||||
toggle = 1;
|
||||
break;
|
||||
|
||||
switch( DrawStruct->Type() )
|
||||
{
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
if( DrawStruct->m_Flags & IS_NEW )
|
||||
{
|
||||
End_Route( (TRACK*) DrawStruct, DC );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
}
|
||||
else if( DrawStruct->m_Flags == 0 )
|
||||
{
|
||||
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
case TYPE_TEXTE:
|
||||
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
toggle = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_PAD:
|
||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case TYPE_MODULE:
|
||||
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case TYPE_COTATION:
|
||||
Install_Edit_Cotation( (COTATION*) DrawStruct, &dc, pos );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc, pos );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case TYPE_DRAWSEGMENT:
|
||||
InstallGraphicItemPropertiesDialog((DRAWSEGMENT*)DrawStruct, &dc);
|
||||
break;
|
||||
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
if( DrawStruct->m_Flags )
|
||||
break;
|
||||
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) DrawStruct );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break; // end case 0
|
||||
*/
|
||||
toggle = 1;
|
||||
break;
|
||||
case ID_TRACK_BUTT:
|
||||
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||
{
|
||||
End_Route( (TRACK*) DrawStruct, &dc );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
}
|
||||
else
|
||||
toggle = 1;
|
||||
break;
|
||||
|
||||
case ID_PCB_ZONES_BUTT:
|
||||
if ( End_Zone( &dc ) )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
else
|
||||
toggle = 1;
|
||||
break;
|
||||
|
||||
case ID_LINE_COMMENT_BUTT:
|
||||
case ID_PCB_ARC_BUTT:
|
||||
case ID_PCB_CIRCLE_BUTT:
|
||||
if( DrawStruct == NULL )
|
||||
{}
|
||||
else if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
|
||||
{
|
||||
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
|
||||
}
|
||||
else if( (DrawStruct->m_Flags & IS_NEW) )
|
||||
{
|
||||
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
else
|
||||
toggle = 1;
|
||||
break;
|
||||
default:
|
||||
|
||||
toggle = 1;
|
||||
break;
|
||||
}
|
||||
if (toggle){
|
||||
int swap = m_ID_last_state;
|
||||
m_ID_last_state = m_ID_current_state;
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
m_ID_current_state = swap;
|
||||
}
|
||||
if( toggle )
|
||||
{
|
||||
int swap = m_ID_last_state;
|
||||
m_ID_last_state = m_ID_current_state;
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
m_ID_current_state = swap;
|
||||
}
|
||||
|
||||
|
||||
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||
|
||||
event.SetId(m_ID_current_state);
|
||||
Process_Special_Functions(event);
|
||||
event.SetId( m_ID_current_state );
|
||||
Process_Special_Functions( event );
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ID_OPEN_MODULE_EDITOR:
|
||||
if( m_ModuleEditFrame == NULL )
|
||||
{
|
||||
m_ModuleEditFrame =
|
||||
new WinEDA_ModuleEditFrame( this,
|
||||
_( "Module Editor" ),
|
||||
wxPoint( -1, -1 ),
|
||||
wxSize( 600, 400 ) );
|
||||
_( "Module Editor" ),
|
||||
wxPoint( -1, -1 ),
|
||||
wxSize( 600, 400 ) );
|
||||
m_ModuleEditFrame->Show( true );
|
||||
m_ModuleEditFrame->Zoom_Automatique( true );
|
||||
}
|
||||
|
@ -357,40 +295,40 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ROTATE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_INVERT_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
|
@ -617,13 +555,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
if( GetCurItem() == NULL )
|
||||
break;
|
||||
{
|
||||
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
|
||||
int netcode = zsegm->GetNet();
|
||||
Delete_Zone_Fill( &dc, zsegm );
|
||||
SetCurItem( NULL );
|
||||
test_1_net_connexion( NULL, netcode );
|
||||
GetScreen()->SetModify();
|
||||
GetBoard()->DisplayInfo(this );
|
||||
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
|
||||
int netcode = zsegm->GetNet();
|
||||
Delete_Zone_Fill( &dc, zsegm );
|
||||
SetCurItem( NULL );
|
||||
test_1_net_connexion( NULL, netcode );
|
||||
GetScreen()->SetModify();
|
||||
GetBoard()->DisplayInfo( this );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -648,11 +586,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
{
|
||||
int netcode = ((ZONE_CONTAINER*) GetCurItem())->GetNet();
|
||||
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
||||
SetCurItem( NULL );
|
||||
test_1_net_connexion( NULL, netcode );
|
||||
GetBoard()->DisplayInfo(this );
|
||||
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet();
|
||||
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
||||
SetCurItem( NULL );
|
||||
test_1_net_connexion( NULL, netcode );
|
||||
GetBoard()->DisplayInfo( this );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -730,7 +668,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
Fill_All_Zones();
|
||||
GetBoard()->DisplayInfo(this );
|
||||
GetBoard()->DisplayInfo( this );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
||||
|
@ -740,24 +678,26 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
Delete_Zone_Fill( &dc, NULL, zone_container->m_TimeStamp );
|
||||
test_1_net_connexion( NULL, zone_container->GetNet() );
|
||||
GetScreen()->SetModify();
|
||||
GetBoard()->DisplayInfo(this );
|
||||
GetBoard()->DisplayInfo( this );
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
SetCurItem( NULL );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
|
||||
GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones.
|
||||
GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones.
|
||||
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
|
||||
{ // Remove filled aresa in zone
|
||||
{
|
||||
// Remove filled aresa in zone
|
||||
ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
|
||||
zone_container->m_FilledPolysList.clear();;
|
||||
}
|
||||
SetCurItem(NULL); // CurItem might be deleted by this command, clear the pointer
|
||||
|
||||
SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
|
||||
test_connexions( NULL );
|
||||
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links */
|
||||
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links */
|
||||
GetScreen()->SetModify();
|
||||
GetBoard()->DisplayInfo(this );
|
||||
GetBoard()->DisplayInfo( this );
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
|
@ -765,7 +705,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->MouseToCursorSchema();
|
||||
Fill_Zone( NULL, (ZONE_CONTAINER*) GetCurItem() );
|
||||
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
|
||||
GetBoard()->DisplayInfo(this );
|
||||
GetBoard()->DisplayInfo( this );
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
|
@ -927,19 +867,19 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_SELECT_LAYER:
|
||||
itmp = SelectLayer(
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1, -1 );
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1, -1 );
|
||||
if( itmp >= 0 )
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
||||
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
||||
SelectLayerPair();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
|
||||
itmp = SelectLayer(
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer,
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer,
|
||||
FIRST_NO_COPPER_LAYER,
|
||||
-1 );
|
||||
if( itmp >= 0 )
|
||||
|
@ -949,7 +889,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
||||
itmp = SelectLayer(
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1,
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1,
|
||||
LAST_COPPER_LAYER );
|
||||
if( itmp >= 0 )
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
|
||||
|
@ -1022,7 +962,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_GETINFO_MARKER:
|
||||
if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER )
|
||||
((MARKER*)GetCurItem())->DisplayMarkerInfo( this );
|
||||
( (MARKER*) GetCurItem() )->DisplayMarkerInfo( this );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
|
@ -1033,7 +973,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_EDIT_DRAWING:
|
||||
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*)GetCurItem(), &dc);
|
||||
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
|
@ -1084,6 +1024,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
g_DesignSettings.m_UseConnectedTrackWidth = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
|
||||
{
|
||||
int ii = m_SelClrWidthBox->GetChoice();
|
||||
|
@ -1091,7 +1032,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
g_DesignSettings.m_TrackClearenceHistory[ii];
|
||||
DisplayTrackSettings();
|
||||
m_SelTrackWidthBox_Changed = false;
|
||||
m_SelClrWidthBox_Changed = false;
|
||||
m_SelClrWidthBox_Changed = false;
|
||||
m_SelViaSizeBox_Changed = false;
|
||||
g_DesignSettings.m_UseConnectedTrackWidth = false;
|
||||
}
|
||||
|
@ -1225,7 +1166,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
default:
|
||||
wxString msg;
|
||||
wxString msg;
|
||||
msg.Printf(
|
||||
wxT( "WinEDA_PcbFrame::Process_Special_Functions() id %d error" ),
|
||||
DrawStruct->Type() );
|
||||
|
@ -1252,7 +1193,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
|
|||
|
||||
switch( DrawStruct->Type() )
|
||||
{
|
||||
case TYPE_TEXTE:
|
||||
case TYPE_TEXTE:
|
||||
frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC );
|
||||
break;
|
||||
|
||||
|
@ -1314,14 +1255,14 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
|
|||
break;
|
||||
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
{
|
||||
{
|
||||
SetCurItem( NULL );
|
||||
int netcode = ((ZONE_CONTAINER*) Item)->GetNet();
|
||||
int netcode = ( (ZONE_CONTAINER*) Item )->GetNet();
|
||||
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
|
||||
test_1_net_connexion( NULL, netcode );
|
||||
GetBoard()->DisplayInfo(this );
|
||||
}
|
||||
break;
|
||||
GetBoard()->DisplayInfo( this );
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_MARKER:
|
||||
if( Item == GetCurItem() )
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
/* modedit.cpp */
|
||||
/****************/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
#include "class_drawpanel.h"
|
||||
|
@ -637,7 +633,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
{
|
||||
SET_DC;
|
||||
|
@ -646,8 +642,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
{
|
||||
SET_DC;
|
||||
|
@ -656,8 +652,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
|
@ -665,8 +661,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
|
@ -674,8 +670,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_ROTATE_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
|
@ -685,8 +681,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_MIRROR_X_BLOCK:
|
||||
case ID_POPUP_MIRROR_Y_BLOCK:
|
||||
case ID_POPUP_INVERT_BLOCK:
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
|
|
|
@ -177,7 +177,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
|||
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||
wxString msg;
|
||||
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
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
|
|
|
@ -97,7 +97,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
wxString msg;
|
||||
int flags = 0;
|
||||
bool locate_track = FALSE;
|
||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
||||
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||
|
||||
wxClientDC dc( DrawPanel );
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ void WinEDA_PcbFrame::SetToolbars()
|
|||
|
||||
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_COPY, TRUE );
|
||||
|
|
Loading…
Reference in New Issue