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
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
email address.
|
||||||
|
|
||||||
|
2009-july-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||||
|
================================================================================
|
||||||
|
++all
|
||||||
|
Rework on undo/redo and block functions
|
||||||
|
Better and simpler coding of block and undo/redo functions
|
||||||
|
The goal is to have the same functions in eeschema and pcbnew.
|
||||||
|
and have a full undo/redo in pcbnew.
|
||||||
|
|
||||||
2009-july-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
2009-july-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
++pcbnew
|
++pcbnew
|
||||||
|
|
|
@ -19,31 +19,30 @@
|
||||||
|
|
||||||
|
|
||||||
/*******************/
|
/*******************/
|
||||||
/* DrawBlockStruct */
|
/* BLOCK_SELECTOR */
|
||||||
/*******************/
|
/*******************/
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
DrawBlockStruct::DrawBlockStruct() :
|
BLOCK_SELECTOR::BLOCK_SELECTOR() :
|
||||||
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE )
|
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ),
|
||||||
, EDA_Rect()
|
EDA_Rect()
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
{
|
{
|
||||||
m_State = STATE_NO_BLOCK; /* Etat (enum BlockState) du block */
|
m_State = STATE_NO_BLOCK; /* Etat (enum BlockState) du block */
|
||||||
m_Command = BLOCK_IDLE; /* Type (enum CmdBlockType) d'operation */
|
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,21 +111,69 @@ 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 w = aPanel->GetScreen()->Scale( GetWidth() );
|
||||||
int h = panel->GetScreen()->Scale( GetHeight() );
|
int h = aPanel->GetScreen()->Scale( GetHeight() );
|
||||||
|
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
if( w == 0 || h == 0 )
|
if( w == 0 || h == 0 )
|
||||||
GRLine( &panel->m_ClipBox, DC, GetX(), GetY(),
|
GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
|
||||||
GetRight(), GetBottom(), 0, m_Color );
|
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
|
||||||
else
|
else
|
||||||
GRRect( &panel->m_ClipBox, DC, GetX(), GetY(),
|
GRRect( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
|
||||||
GetRight(), GetBottom(), 0, m_Color );
|
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,
|
bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
||||||
const wxPoint& startpos )
|
const wxPoint& startpos )
|
||||||
|
@ -136,7 +183,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
||||||
* Init the Block infos: command type, initial position, and other variables..
|
* 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 )
|
if( ( Block->m_Command != BLOCK_IDLE )
|
||||||
|| ( Block->m_State != STATE_NO_BLOCK ) )
|
|| ( Block->m_State != STATE_NO_BLOCK ) )
|
||||||
|
@ -163,24 +210,24 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y: /* mirror */
|
case BLOCK_MIRROR_Y: /* mirror */
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
InitBlockLocateDatas( DrawPanel, startpos );
|
Block->InitData( DrawPanel, startpos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE:
|
case BLOCK_PASTE:
|
||||||
InitBlockLocateDatas( DrawPanel, startpos );
|
Block->InitData( DrawPanel, startpos );
|
||||||
Block->m_BlockLastCursorPosition.x = 0;
|
Block->m_BlockLastCursorPosition.x = 0;
|
||||||
Block->m_BlockLastCursorPosition.y = 0;
|
Block->m_BlockLastCursorPosition.y = 0;
|
||||||
InitBlockPasteInfos();
|
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 );
|
DisplayError( this, wxT( "No Block to paste" ), 20 );
|
||||||
GetBaseScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetBaseScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if( DrawPanel->ManageCurseur == NULL )
|
if( DrawPanel->ManageCurseur == NULL )
|
||||||
{
|
{
|
||||||
Block->m_BlockDrawStruct = NULL;
|
Block->m_ItemsSelection.ClearItemsList();
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
|
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -203,6 +250,39 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
|
||||||
return TRUE;
|
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 )
|
void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
|
@ -222,81 +302,17 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
|
|
||||||
/* Delete the picked wrapper if this is a picked list. */
|
/* Delete the picked wrapper if this is a picked list. */
|
||||||
if( (screen->BlockLocate.m_Command != BLOCK_PASTE)
|
if( screen->m_BlockLocate.m_Command != BLOCK_PASTE )
|
||||||
&& screen->BlockLocate.m_BlockDrawStruct )
|
screen->m_BlockLocate.ClearItemsList();
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->BlockLocate.m_Flags = 0;
|
screen->m_BlockLocate.m_Flags = 0;
|
||||||
screen->BlockLocate.m_State = STATE_NO_BLOCK;
|
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 );
|
Panel->m_Parent->HandleBlockEnd( DC );
|
||||||
|
|
||||||
screen->BlockLocate.m_Command = BLOCK_IDLE;
|
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
Panel->m_Parent->DisplayToolMsg( wxEmptyString );
|
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();
|
m_ItemsList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
|
||||||
|
{
|
||||||
|
for(unsigned ii = 0; ii < m_ItemsList.size(); ii++ )
|
||||||
|
delete m_ItemsList[ii].m_Item;
|
||||||
|
m_ItemsList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
|
ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
|
||||||
{
|
{
|
||||||
ITEM_PICKER picker;
|
ITEM_PICKER picker;
|
||||||
|
@ -160,6 +168,20 @@ bool PICKED_ITEMS_LIST::RemoveItem( unsigned aIdx )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Function CopyList
|
||||||
|
* copy all data from aSource
|
||||||
|
* Items picked are not copied. just pointer on them are copied
|
||||||
|
*/
|
||||||
|
void PICKED_ITEMS_LIST::CopyList(const PICKED_ITEMS_LIST & aSource)
|
||||||
|
{
|
||||||
|
ITEM_PICKER picker;
|
||||||
|
for(unsigned ii = 0; ii < aSource.GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
picker = aSource.m_ItemsList[ii];
|
||||||
|
PushItem(picker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
/********** UNDO_REDO_CONTAINER ***************/
|
/********** UNDO_REDO_CONTAINER ***************/
|
||||||
|
|
|
@ -35,7 +35,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
|
||||||
|
|
||||||
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
|
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
|
||||||
{
|
{
|
||||||
if( GetBaseScreen()->BlockLocate.m_Command != BLOCK_IDLE )
|
if( GetBaseScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
|
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
|
||||||
DrawPanel->m_PanelDefaultCursor ) );
|
DrawPanel->m_PanelDefaultCursor ) );
|
||||||
|
|
||||||
|
@ -74,13 +74,13 @@ bool DrawPage( WinEDA_DrawPanel* panel )
|
||||||
/* scale is the ratio resolution/internal units */
|
/* scale is the ratio resolution/internal units */
|
||||||
float scale = 82.0 / panel->m_Parent->m_InternalUnits;
|
float scale = 82.0 / panel->m_Parent->m_InternalUnits;
|
||||||
|
|
||||||
if( ActiveScreen->BlockLocate.m_Command != BLOCK_IDLE )
|
if( ActiveScreen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
DrawBlock = TRUE;
|
DrawBlock = TRUE;
|
||||||
DrawArea.SetX( (int) ( ActiveScreen->BlockLocate.GetX() ) );
|
DrawArea.SetX( ActiveScreen->m_BlockLocate.GetX() );
|
||||||
DrawArea.SetY( (int) ( ActiveScreen->BlockLocate.GetY() ) );
|
DrawArea.SetY( ActiveScreen->m_BlockLocate.GetY() );
|
||||||
DrawArea.SetWidth( (int) ( ActiveScreen->BlockLocate.GetWidth() ) );
|
DrawArea.SetWidth( ActiveScreen->m_BlockLocate.GetWidth() );
|
||||||
DrawArea.SetHeight( (int) ( ActiveScreen->BlockLocate.GetHeight() ) );
|
DrawArea.SetHeight( ActiveScreen->m_BlockLocate.GetHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* modification des cadrages et reglages locaux */
|
/* modification des cadrages et reglages locaux */
|
||||||
|
|
|
@ -488,7 +488,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key )
|
||||||
|
|
||||||
void WinEDA_DrawFrame::InitBlockPasteInfos()
|
void WinEDA_DrawFrame::InitBlockPasteInfos()
|
||||||
{
|
{
|
||||||
GetBaseScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetBaseScreen()->m_BlockLocate.ClearItemsList();
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +652,31 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* used in UpdateStatusBar() when coordinates are in mm
|
||||||
|
* try to approximate a coordinate (in 0.001 mm) to an easy to read number
|
||||||
|
* ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
|
||||||
|
*/
|
||||||
|
double Round_To_0(double x)
|
||||||
|
{
|
||||||
|
long long ix = wxRound(x * 1000); // ix is in 0.001 mm
|
||||||
|
if ( x < 0 ) NEGATE(ix);
|
||||||
|
|
||||||
|
int remainder = ix%10; // remainder is in 0.001 mm
|
||||||
|
if ( remainder <= 2 )
|
||||||
|
ix -= remainder; // truncate to the near number
|
||||||
|
else if (remainder >= 8 )
|
||||||
|
ix += 10 - remainder; // round to near number
|
||||||
|
|
||||||
|
if ( x < 0 ) NEGATE(ix);
|
||||||
|
return (double)ix/1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Function UpdateStatusBar()
|
||||||
|
* Displays in the bottom of the main window a stust:
|
||||||
|
* - Absolute Cursor coordinates
|
||||||
|
* - Relative Cursor coordinates (relative to the last coordinate stored when actiavte the space bar)
|
||||||
|
* ( in this status is also displayed the zoom level, but this is not made by this function)
|
||||||
|
*/
|
||||||
void WinEDA_DrawFrame::UpdateStatusBar()
|
void WinEDA_DrawFrame::UpdateStatusBar()
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
@ -670,20 +694,30 @@ void WinEDA_DrawFrame::UpdateStatusBar()
|
||||||
SetStatusText( Line, 1 );
|
SetStatusText( Line, 1 );
|
||||||
|
|
||||||
/* Display absolute coordinates: */
|
/* Display absolute coordinates: */
|
||||||
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ),
|
double dXpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.x, m_InternalUnits );
|
||||||
To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
|
double dYpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.y, m_InternalUnits );
|
||||||
m_InternalUnits ),
|
/* When using mm the conversion from 1/10000 inch to mm can give some non easy to read numbers,
|
||||||
To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
|
* like 1.999 or 2.001 that be better if displayed 2.000, so small diffs are filtered here.
|
||||||
m_InternalUnits ) );
|
*/
|
||||||
|
if ( g_UnitMetric )
|
||||||
|
{
|
||||||
|
dXpos = Round_To_0(dXpos);
|
||||||
|
dYpos = Round_To_0(dYpos);
|
||||||
|
}
|
||||||
|
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ), dXpos, dYpos );
|
||||||
SetStatusText( Line, 2 );
|
SetStatusText( Line, 2 );
|
||||||
|
|
||||||
/* Display relative coordinates: */
|
/* Display relative coordinates: */
|
||||||
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
|
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
|
||||||
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
|
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
|
||||||
|
dXpos = To_User_Unit( g_UnitMetric, dx, m_InternalUnits );
|
||||||
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ),
|
dYpos = To_User_Unit( g_UnitMetric, dy, m_InternalUnits );
|
||||||
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ),
|
if ( g_UnitMetric )
|
||||||
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) );
|
{
|
||||||
|
dXpos = Round_To_0(dXpos);
|
||||||
|
dYpos = Round_To_0(dYpos);
|
||||||
|
}
|
||||||
|
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ), dXpos, dYpos );
|
||||||
|
|
||||||
SetStatusText( Line, 3 );
|
SetStatusText( Line, 3 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
else if( event.LeftUp() )
|
else if( event.LeftUp() )
|
||||||
{
|
{
|
||||||
if( screen->BlockLocate.m_State==STATE_NO_BLOCK // A block command is in progress: a left up is the end of block
|
if( screen->m_BlockLocate.m_State==STATE_NO_BLOCK // A block command is in progress: a left up is the end of block
|
||||||
&& !s_IgnoreNextLeftButtonRelease ) // This is the end of a double click, already seen
|
&& !s_IgnoreNextLeftButtonRelease ) // This is the end of a double click, already seen
|
||||||
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
|
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
|
||||||
|
|
||||||
|
@ -1111,7 +1111,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
s_IgnoreNextLeftButtonRelease = false;
|
s_IgnoreNextLeftButtonRelease = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
if( event.ButtonUp( 2 ) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||||
{
|
{
|
||||||
// The middle button has been released, with no block command:
|
// The middle button has been released, with no block command:
|
||||||
// We use it for a zoom center at cursor position command
|
// We use it for a zoom center at cursor position command
|
||||||
|
@ -1158,14 +1158,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
|
|
||||||
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
|
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
|
||||||
{
|
{
|
||||||
if( (screen->BlockLocate.m_Command == BLOCK_IDLE)
|
if( (screen->m_BlockLocate.m_Command == BLOCK_IDLE)
|
||||||
|| (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
|| (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.SetOrigin( m_CursorStartPos );
|
screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
|
||||||
}
|
}
|
||||||
if( event.LeftDown() || event.MiddleDown() )
|
if( event.LeftDown() || event.MiddleDown() )
|
||||||
{
|
{
|
||||||
if( screen->BlockLocate.m_State == STATE_BLOCK_MOVE )
|
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
m_AutoPAN_Request = FALSE;
|
m_AutoPAN_Request = FALSE;
|
||||||
m_Parent->HandleBlockPlace( &DC );
|
m_Parent->HandleBlockPlace( &DC );
|
||||||
|
@ -1177,7 +1177,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
&& ManageCurseur == NULL
|
&& ManageCurseur == NULL
|
||||||
&& ForceCloseManageCurseur == NULL )
|
&& ForceCloseManageCurseur == NULL )
|
||||||
{ // Mouse is dragging: if no block in progress: start a block command
|
{ // Mouse is dragging: if no block in progress: start a block command
|
||||||
if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
|
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
||||||
{ // Start a block command
|
{ // Start a block command
|
||||||
int cmd_type = kbstat;
|
int cmd_type = kbstat;
|
||||||
|
|
||||||
|
@ -1217,10 +1217,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
*/
|
*/
|
||||||
#define BLOCK_MINSIZE_LIMIT 1
|
#define BLOCK_MINSIZE_LIMIT 1
|
||||||
bool BlockIsSmall =
|
bool BlockIsSmall =
|
||||||
( ABS( screen->Scale( screen->BlockLocate.GetWidth() ) ) < BLOCK_MINSIZE_LIMIT)
|
( ABS( screen->Scale( screen->m_BlockLocate.GetWidth() ) ) < BLOCK_MINSIZE_LIMIT)
|
||||||
&& ( ABS( screen->Scale( screen->BlockLocate.GetHeight() ) ) < BLOCK_MINSIZE_LIMIT);
|
&& ( ABS( screen->Scale( screen->m_BlockLocate.GetHeight() ) ) < BLOCK_MINSIZE_LIMIT);
|
||||||
|
|
||||||
if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
|
if( (screen->m_BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
|
||||||
{
|
{
|
||||||
if( ForceCloseManageCurseur )
|
if( ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
|
@ -1229,12 +1229,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
||||||
}
|
}
|
||||||
else if( screen->BlockLocate.m_State == STATE_BLOCK_END )
|
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
|
||||||
{
|
{
|
||||||
m_AutoPAN_Request = FALSE;
|
m_AutoPAN_Request = FALSE;
|
||||||
m_Parent->HandleBlockEnd( &DC );
|
m_Parent->HandleBlockEnd( &DC );
|
||||||
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
|
||||||
if( screen->BlockLocate.m_State == STATE_BLOCK_MOVE )
|
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
m_AutoPAN_Request = TRUE;
|
m_AutoPAN_Request = TRUE;
|
||||||
SetCursor( m_PanelCursor = wxCURSOR_HAND );
|
SetCursor( m_PanelCursor = wxCURSOR_HAND );
|
||||||
|
@ -1244,10 +1244,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of block command on a double click
|
// End of block command on a double click
|
||||||
// To avoid an unwanted block move command if the move is moved while double click
|
// To avoid an unwanted block move command if the mouse is moved while double clicking
|
||||||
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
|
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
|
||||||
{
|
{
|
||||||
if( screen->BlockLocate.m_Command != BLOCK_IDLE )
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
if( ForceCloseManageCurseur )
|
if( ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
|
@ -1261,7 +1261,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
#if 0
|
#if 0
|
||||||
wxString msg_debug;
|
wxString msg_debug;
|
||||||
msg_debug.Printf( " block state %d, cmd %d",
|
msg_debug.Printf( " block state %d, cmd %d",
|
||||||
screen->BlockLocate.m_State, screen->BlockLocate.m_Command );
|
screen->m_BlockLocate.m_State, screen->m_BlockLocate.m_Command );
|
||||||
m_Parent->PrintMsg( msg_debug );
|
m_Parent->PrintMsg( msg_debug );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
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;
|
int ItemsCount = 0, MustDoPlace = 0;
|
||||||
|
|
||||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
BlockState state = GetScreen()->BlockLocate.m_State;
|
BlockState state = GetScreen()->m_BlockLocate.m_State;
|
||||||
CmdBlockType command = GetScreen()->BlockLocate.m_Command;
|
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
|
||||||
GetScreen()->BlockLocate.m_State = state;
|
GetScreen()->m_BlockLocate.m_State = state;
|
||||||
GetScreen()->BlockLocate.m_Command = command;
|
GetScreen()->m_BlockLocate.m_Command = command;
|
||||||
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
||||||
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
||||||
GetScreen()->m_Curseur.x = GetScreen()->BlockLocate.GetRight();
|
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
|
||||||
GetScreen()->m_Curseur.y = GetScreen()->BlockLocate.GetBottom();
|
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( GetScreen()->BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||||
|
@ -278,7 +278,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
{
|
{
|
||||||
MustDoPlace = 1;
|
MustDoPlace = 1;
|
||||||
|
@ -288,7 +288,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
}
|
}
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -296,11 +296,11 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
MustDoPlace = 1;
|
MustDoPlace = 1;
|
||||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: /* Delete */
|
||||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
DeleteMarkedItems( CurrentLibEntry );
|
DeleteMarkedItems( CurrentLibEntry );
|
||||||
|
@ -315,14 +315,14 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
case BLOCK_INVERT:
|
case BLOCK_INVERT:
|
||||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.Centre() );
|
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: /* Window Zoom */
|
||||||
Window_Zoom( GetScreen()->BlockLocate );
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ABORT:
|
case BLOCK_ABORT:
|
||||||
|
@ -334,13 +334,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
if( MustDoPlace <= 0 )
|
if( MustDoPlace <= 0 )
|
||||||
{
|
{
|
||||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
||||||
{
|
{
|
||||||
ClearMarkItems( CurrentLibEntry );
|
ClearMarkItems( CurrentLibEntry );
|
||||||
}
|
}
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
|
@ -371,9 +371,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
|
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
|
|
||||||
switch( GetScreen()->BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
err = TRUE;
|
err = TRUE;
|
||||||
|
@ -382,25 +382,25 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
MoveMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.m_MoveVector );
|
MoveMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
CopyMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.m_MoveVector );
|
CopyMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_INVERT: /* Invert by popup menu, from block move */
|
case BLOCK_INVERT: /* Invert by popup menu, from block move */
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->BlockLocate.Centre() );
|
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
||||||
|
@ -417,9 +417,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
|
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
|
|
||||||
|
@ -436,20 +436,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
* L'ensemble du block suit le curseur
|
* L'ensemble du block suit le curseur
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DrawBlockStruct* PtBlock;
|
BLOCK_SELECTOR* PtBlock;
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
LibEDA_BaseStruct* item;
|
LibEDA_BaseStruct* item;
|
||||||
wxPoint move_offset;
|
wxPoint move_offset;
|
||||||
|
|
||||||
PtBlock = &panel->GetScreen()->BlockLocate;
|
PtBlock = &screen->m_BlockLocate;
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
|
||||||
|
|
||||||
/* Effacement ancien cadre */
|
/* Effacement ancien cadre */
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||||
PtBlock->Draw( panel, DC );
|
|
||||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
{
|
{
|
||||||
|
@ -474,9 +471,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
|
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
|
||||||
|
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
GRSetDrawMode( DC, g_XorMode );
|
||||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||||
PtBlock->Draw( panel, DC );
|
|
||||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
|
||||||
|
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
|
|
|
@ -40,7 +40,7 @@ bool g_LastSearchIsMarker; /* True if last seach is a marker serach
|
||||||
* Used for hotkey next search */
|
* Used for hotkey next search */
|
||||||
|
|
||||||
/* Block operation (copy, paste) */
|
/* Block operation (copy, paste) */
|
||||||
SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
||||||
|
|
||||||
// Gestion d'options
|
// Gestion d'options
|
||||||
bool g_HVLines = true; // Bool: force H or V directions (Wires, Bus ..)
|
bool g_HVLines = true; // Bool: force H or V directions (Wires, Bus ..)
|
||||||
|
|
|
@ -112,7 +112,7 @@ extern bool g_LastSearchIsMarker; // True if last seach is a marker se
|
||||||
// Used for hotkey next search
|
// Used for hotkey next search
|
||||||
|
|
||||||
/* Block operation (copy, paste) */
|
/* Block operation (copy, paste) */
|
||||||
extern SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
extern BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
||||||
|
|
||||||
// Gestion d'options
|
// Gestion d'options
|
||||||
extern bool g_HVLines;
|
extern bool g_HVLines;
|
||||||
|
|
|
@ -252,7 +252,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_DELETE:
|
case HK_DELETE:
|
||||||
if( !ItemInEdit && screen->BlockLocate.m_State == STATE_NO_BLOCK )
|
if( !ItemInEdit && screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
RefreshToolBar = LocateAndDeleteItem( this, DC );
|
RefreshToolBar = LocateAndDeleteItem( this, DC );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
case HK_BEGIN_WIRE:
|
case HK_BEGIN_WIRE:
|
||||||
/* An item is selected. If edited and not a wire, a new command is not
|
/* An item is selected. If edited and not a wire, a new command is not
|
||||||
* possible */
|
* possible */
|
||||||
if( !ItemInEdit && screen->BlockLocate.m_State == STATE_NO_BLOCK )
|
if( !ItemInEdit && screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
|
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
|
||||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
if ( CurrentLibEntry == NULL ) return true;
|
if ( CurrentLibEntry == NULL ) return true;
|
||||||
|
|
||||||
|
@ -232,14 +232,14 @@ void AddMenusForBlock(wxMenu * PopMenu, WinEDA_LibeditFrame * frame)
|
||||||
{
|
{
|
||||||
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _("Cancel Block"), cancel_xpm);
|
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _("Cancel Block"), cancel_xpm);
|
||||||
|
|
||||||
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
ADD_MENUITEM(PopMenu, ID_POPUP_ZOOM_BLOCK, _("Zoom Block (drag middle mouse)"), zoom_selected_xpm);
|
ADD_MENUITEM(PopMenu, ID_POPUP_ZOOM_BLOCK, _("Zoom Block (drag middle mouse)"), zoom_selected_xpm);
|
||||||
|
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
|
|
||||||
ADD_MENUITEM(PopMenu, ID_POPUP_PLACE_BLOCK, _("Place Block"), apply_xpm );
|
ADD_MENUITEM(PopMenu, ID_POPUP_PLACE_BLOCK, _("Place Block"), apply_xpm );
|
||||||
|
|
||||||
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM(PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _("Select Items"), green_xpm);
|
ADD_MENUITEM(PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _("Select Items"), green_xpm);
|
||||||
ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK,
|
ADD_MENUITEM(PopMenu, ID_POPUP_COPY_BLOCK,
|
||||||
|
|
|
@ -730,34 +730,34 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_BLOCK:
|
case ID_POPUP_ZOOM_BLOCK:
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_DELETE_BLOCK:
|
case ID_POPUP_DELETE_BLOCK:
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_COPY_BLOCK:
|
case ID_POPUP_COPY_BLOCK:
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
HandleBlockPlace( &dc );
|
HandleBlockPlace( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SELECT_ITEMS_BLOCK:
|
case ID_POPUP_SELECT_ITEMS_BLOCK:
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_INVERT_BLOCK:
|
case ID_POPUP_INVERT_BLOCK:
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
HandleBlockPlace( &dc );
|
HandleBlockPlace( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,11 +18,10 @@
|
||||||
|
|
||||||
/* Routines Locales */
|
/* Routines Locales */
|
||||||
static SCH_ITEM* LastSnappedStruct = NULL;
|
static SCH_ITEM* LastSnappedStruct = NULL;
|
||||||
static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY;
|
|
||||||
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
||||||
int StartX2, int StartY2, int EndX2, int EndY2 );
|
int StartX2, int StartY2, int EndX2, int EndY2 );
|
||||||
static bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
static bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
SCH_ITEM* DrawList, DrawPickedStruct* DontSnapList, double aScaleFactor );
|
SCH_ITEM* DrawList, double aScaleFactor );
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
@ -43,10 +42,10 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
|
||||||
while( DrawList )
|
while( DrawList )
|
||||||
{
|
{
|
||||||
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
|
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
|
||||||
DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
|
DrawList, Screen->GetZoom() ) ) == FALSE )
|
||||||
{
|
{
|
||||||
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
|
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
|
||||||
DrawList, NULL, Screen->GetScalingFactor() ) ) == FALSE )
|
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
component = (SCH_COMPONENT*) LastSnappedStruct;
|
component = (SCH_COMPONENT*) LastSnappedStruct;
|
||||||
|
@ -111,7 +110,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( ( Snapped = SnapPoint2( refpos, SearchMask,
|
if( ( Snapped = SnapPoint2( refpos, SearchMask,
|
||||||
screen->EEDrawList, NULL, screen->GetScalingFactor() ) ) != FALSE )
|
screen->EEDrawList, screen->GetScalingFactor() ) ) != FALSE )
|
||||||
{
|
{
|
||||||
return LastSnappedStruct;
|
return LastSnappedStruct;
|
||||||
}
|
}
|
||||||
|
@ -120,62 +119,45 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
|
int PickStruct( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
/* Search items in block
|
/** Function PickStruct
|
||||||
* Return:
|
* Search items in a block
|
||||||
* pointeur sur liste de pointeurs de structures si Plusieurs
|
* @return items count
|
||||||
* structures selectionnees.
|
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary
|
||||||
* pointeur sur la structure si 1 seule
|
* list of items is stored in aBlock
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int x, y, OrigX, OrigY;
|
int x, y, OrigX, OrigY;
|
||||||
DrawPickedStruct* PickedList = NULL, * PickedItem;
|
int itemcount = 0;
|
||||||
SCH_ITEM* DrawStruct;
|
|
||||||
|
|
||||||
OrigX = block.GetX();
|
if( aScreen == NULL )
|
||||||
OrigY = block.GetY();
|
return itemcount;
|
||||||
x = block.GetRight();
|
|
||||||
y = block.GetBottom();
|
OrigX = aBlock.GetX();
|
||||||
|
OrigY = aBlock.GetY();
|
||||||
|
x = aBlock.GetRight();
|
||||||
|
y = aBlock.GetBottom();
|
||||||
|
|
||||||
if( x < OrigX )
|
if( x < OrigX )
|
||||||
EXCHG( x, OrigX );
|
EXCHG( x, OrigX );
|
||||||
if( y < OrigY )
|
if( y < OrigY )
|
||||||
EXCHG( y, OrigY );
|
EXCHG( y, OrigY );
|
||||||
|
|
||||||
SCH_ITEM* DrawList = screen->EEDrawList;
|
ITEM_PICKER picker;
|
||||||
if( screen==NULL || DrawList == NULL )
|
SCH_ITEM* DrawStruct = aScreen->EEDrawList;
|
||||||
return NULL;
|
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||||
|
|
||||||
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
|
||||||
{
|
{
|
||||||
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
|
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
|
||||||
{
|
{
|
||||||
/* Put this structure in the picked list: */
|
/* Put this structure in the picked list: */
|
||||||
PickedItem = new DrawPickedStruct( DrawStruct );
|
picker.m_Item = DrawStruct;
|
||||||
|
aBlock.PushItem(picker);
|
||||||
PickedItem->SetNext( PickedList );
|
itemcount++;
|
||||||
PickedList = PickedItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,26 +167,13 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
|
||||||
* Note we use L1 norm as distance measure, as it is the fastest. *
|
* Note we use L1 norm as distance measure, as it is the fastest. *
|
||||||
* This routine updates LastSnappedStruct to the last object used in to snap *
|
* This routine updates LastSnappedStruct to the last object used in to snap *
|
||||||
* a point. This variable is global to this module only (see above). *
|
* a point. This variable is global to this module only (see above). *
|
||||||
* If DontSnapList is not NULL, structes in this list are skipped. *
|
|
||||||
* The routine returns TRUE if point was snapped. *
|
* The routine returns TRUE if point was snapped. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
SCH_ITEM* DrawList, DrawPickedStruct* DontSnapList, double aScaleFactor )
|
SCH_ITEM* DrawList, double aScaleFactor )
|
||||||
{
|
{
|
||||||
DrawPickedStruct* DontSnap;
|
|
||||||
|
|
||||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
/* Make sure this structure is NOT in the dont snap list: */
|
|
||||||
DontSnap = DontSnapList;
|
|
||||||
for( ; DontSnap != NULL; DontSnap = DontSnap->Next() )
|
|
||||||
if( DontSnap->m_PickedStruct == DrawList )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if( DontSnap )
|
|
||||||
if( DontSnap->m_PickedStruct == DrawList )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ) ;
|
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ) ;
|
||||||
switch( DrawList->Type() )
|
switch( DrawList->Type() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
||||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
|
|
||||||
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
||||||
|
@ -608,13 +608,13 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
||||||
|
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
|
|
||||||
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
||||||
_( "Window Zoom" ), zoom_selected_xpm );
|
_( "Window Zoom" ), zoom_selected_xpm );
|
||||||
|
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
|
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
|
||||||
|
|
||||||
if( frame->GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
{ // After a block move (that is also a block selection) one can reselect a block function:
|
{ // After a block move (that is also a block selection) one can reselect a block function:
|
||||||
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
|
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
|
||||||
|
|
|
@ -96,22 +96,20 @@ SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct);
|
||||||
void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & move_vector);
|
void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & move_vector);
|
||||||
/* Given a structure move it by move_vector. */
|
/* Given a structure move it by move_vector. */
|
||||||
|
|
||||||
bool PlaceStruct(BASE_SCREEN * screen, SCH_ITEM *DrawStruct);
|
|
||||||
bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
|
|
||||||
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
|
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
|
||||||
bool DrawStructInBox(int x1, int y1, int x2, int y2,
|
|
||||||
SCH_ITEM *DrawStruct);
|
|
||||||
|
|
||||||
/*************/
|
/*************/
|
||||||
/* LOCATE.CPP */
|
/* LOCATE.CPP */
|
||||||
/*************/
|
/*************/
|
||||||
|
bool DrawStructInBox(int x1, int y1, int x2, int y2,
|
||||||
|
SCH_ITEM *DrawStruct);
|
||||||
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
|
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
|
||||||
SCH_COMPONENT* eComponent );
|
SCH_COMPONENT* eComponent );
|
||||||
|
|
||||||
SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
|
SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
|
||||||
/* Recherche du plus petit (en surface) composant pointe par la souris */
|
/* Recherche du plus petit (en surface) composant pointe par la souris */
|
||||||
|
|
||||||
SCH_ITEM * PickStruct(EDA_Rect & block, BASE_SCREEN* screen, int SearchMask );
|
int PickStruct(BLOCK_SELECTOR& aBlock, BASE_SCREEN* screen );
|
||||||
SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMask);
|
SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMask);
|
||||||
/* 2 functions PickStruct:
|
/* 2 functions PickStruct:
|
||||||
Search in block, or Search at location pos
|
Search in block, or Search at location pos
|
||||||
|
|
|
@ -127,7 +127,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||||
if( screen->BlockLocate.m_Command != BLOCK_IDLE )
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
|
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
|
||||||
DrawPanel->
|
DrawPanel->
|
||||||
m_PanelDefaultCursor ) );
|
m_PanelDefaultCursor ) );
|
||||||
|
@ -137,11 +137,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
/* ne devrait pas etre execute, sauf bug: */
|
/* ne devrait pas etre execute, sauf bug: */
|
||||||
if( screen->BlockLocate.m_Command != BLOCK_IDLE )
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.m_Command = BLOCK_IDLE;
|
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
screen->BlockLocate.m_State = STATE_NO_BLOCK;
|
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
screen->BlockLocate.m_BlockDrawStruct = NULL;
|
screen->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxID_CUT:
|
case wxID_CUT:
|
||||||
if( screen->BlockLocate.m_Command != BLOCK_MOVE )
|
if( screen->m_BlockLocate.m_Command != BLOCK_MOVE )
|
||||||
break;
|
break;
|
||||||
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
|
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
|
||||||
g_ItemToRepeat = NULL;
|
g_ItemToRepeat = NULL;
|
||||||
|
@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// The easiest way to handle a drag component is simulate a
|
// The easiest way to handle a drag component is simulate a
|
||||||
// block drag command
|
// block drag command
|
||||||
if( screen->BlockLocate.m_State == STATE_NO_BLOCK )
|
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
|
||||||
screen->m_Curseur ) )
|
screen->m_Curseur ) )
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
/********************************************/
|
/*************************************************************/
|
||||||
/* library editor: undo and redo functions */
|
/* eeschema: undo and redo functions for schemùatic editor */
|
||||||
/********************************************/
|
/*************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "class_drawpickedstruct.h"
|
#include "class_drawpickedstruct.h"
|
||||||
|
@ -11,18 +10,20 @@
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "id.h"
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "class_marker_sch.h"
|
#include "class_marker_sch.h"
|
||||||
|
|
||||||
/* Functions to undo and redo edit commands.
|
/* Functions to undo and redo edit commands.
|
||||||
* commmands to undo are in CurrentScreen->m_UndoList
|
* commmands to undo are stored in CurrentScreen->m_UndoList
|
||||||
* commmands to redo are in CurrentScreen->m_RedoList
|
* commmands to redo are stored in CurrentScreen->m_RedoList
|
||||||
*
|
*
|
||||||
* m_UndoList and m_RedoList are a linked list of DrawPickedStruct.
|
* m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
|
||||||
* each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo,
|
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
|
||||||
* or to a list of DrawPickedStruct which points (.m_PickedStruct membre)
|
* that store the list of schematic items that are concerned by the command to undo or redo
|
||||||
* the items 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:
|
* there are 3 cases:
|
||||||
* - delete item(s) command
|
* - delete item(s) command
|
||||||
|
@ -31,45 +32,45 @@
|
||||||
*
|
*
|
||||||
* Undo command
|
* Undo command
|
||||||
* - delete item(s) command:
|
* - delete item(s) command:
|
||||||
* deleted items are moved in undo list
|
* => deleted items are moved in undo list
|
||||||
*
|
*
|
||||||
* - change item(s) command
|
* - change item(s) command
|
||||||
* A copy of item(s) is made (a DrawPickedStruct list of wrappers)
|
* => A copy of item(s) is made (a DrawPickedStruct list of wrappers)
|
||||||
* the .m_Image member of each wrapper points the modified item.
|
* 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
|
* - add item(s) command
|
||||||
* A list of item(s) is made
|
* =>A list of item(s) is made. The .m_Item member of each wrapper points the new item.
|
||||||
* the .m_Image member of each wrapper points the new item.
|
|
||||||
*
|
*
|
||||||
* Redo command
|
* Redo command
|
||||||
* - delete item(s) old 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
|
* - 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
|
* - add item(s) command
|
||||||
* The list of item(s) is used to create a deleted list in undo list
|
* => The list of item(s) is used to create a deleted list in undo list(same as a delete command)
|
||||||
* (same as a delete command)
|
|
||||||
*
|
*
|
||||||
* A problem is the hierarchical sheet handling.
|
* A problem is the hierarchical sheet handling.
|
||||||
* the data associated (subhierarchy, uno/redo list) is deleted only
|
* 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)
|
* 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 )
|
void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
/************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
* swap data between Item and its copy, pointed by its .m_Image member
|
* 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 )
|
if( aItem == NULL || aImage == NULL )
|
||||||
{
|
{
|
||||||
wxMessageBox(wxT("SwapData error: NULL pointer"));
|
wxMessageBox( wxT( "SwapData error: NULL pointer" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,19 +177,15 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
||||||
int flag_type_command )
|
int flag_type_command )
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
/* Create a copy of the current schematic draw list, and put it in the undo list.
|
/** function SaveCopyInUndoList
|
||||||
* A DrawPickedStruct wrapper is created to handle the draw list.
|
* Create a copy of the current schematic item, and put it in the undo list.
|
||||||
* the .m_Son of this wrapper points the list of items
|
|
||||||
*
|
*
|
||||||
* flag_type_command =
|
* flag_type_command =
|
||||||
* 0 (unspecified)
|
|
||||||
* IS_CHANGED
|
* IS_CHANGED
|
||||||
* IS_NEW
|
* IS_NEW
|
||||||
* IS_DELETED
|
* IS_DELETED
|
||||||
* IS_WIRE_IMAGE
|
* 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.
|
* 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.
|
* 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.
|
* If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted.
|
||||||
|
@ -211,16 +208,13 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
||||||
{
|
{
|
||||||
switch( flag_type_command )
|
switch( flag_type_command )
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IS_CHANGED: /* Create a copy of schematic */
|
case IS_CHANGED: /* Create a copy of schematic */
|
||||||
if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
|
if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy;
|
DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy;
|
||||||
while( PickedList )
|
while( PickedList )
|
||||||
{
|
{
|
||||||
CopyOfItem = DuplicateStruct( (SCH_ITEM*) PickedList->m_PickedStruct);
|
CopyOfItem = DuplicateStruct( (SCH_ITEM*) PickedList->m_PickedStruct );
|
||||||
CopyOfItem->m_Flags = flag_type_command;
|
CopyOfItem->m_Flags = flag_type_command;
|
||||||
itemWrapper.m_Item = CopyOfItem;
|
itemWrapper.m_Item = CopyOfItem;
|
||||||
itemWrapper.m_Link = (SCH_ITEM*) PickedList->m_PickedStruct;
|
itemWrapper.m_Link = (SCH_ITEM*) PickedList->m_PickedStruct;
|
||||||
|
@ -230,7 +224,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyOfItem = DuplicateStruct(ItemToCopy);
|
CopyOfItem = DuplicateStruct( ItemToCopy );
|
||||||
itemWrapper.m_Item = CopyOfItem;
|
itemWrapper.m_Item = CopyOfItem;
|
||||||
itemWrapper.m_Link = ItemToCopy;
|
itemWrapper.m_Link = ItemToCopy;
|
||||||
commandToUndo->PushItem( itemWrapper );
|
commandToUndo->PushItem( itemWrapper );
|
||||||
|
@ -305,8 +299,8 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(wxT( "SaveCopyInUndoList() error (unknown code %X)" ), flag_type_command);
|
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), flag_type_command );
|
||||||
DisplayError( this, msg);
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -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()
|
bool WinEDA_SchematicFrame::GetSchematicFromRedoList()
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
@ -365,7 +418,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
||||||
{
|
{
|
||||||
ITEM_PICKER itemWrapper = aList->GetItemWrapper( ii );
|
ITEM_PICKER itemWrapper = aList->GetItemWrapper( ii );
|
||||||
item = (SCH_ITEM*) itemWrapper.m_Item;
|
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 )
|
switch( itemWrapper.m_UndoRedoStatus )
|
||||||
{
|
{
|
||||||
case IS_CHANGED: /* Exchange old and new data for each item */
|
case IS_CHANGED: /* Exchange old and new data for each item */
|
||||||
|
@ -399,13 +453,16 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
||||||
item->m_Flags = 0;
|
item->m_Flags = 0;
|
||||||
item = nextitem;
|
item = nextitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(wxT( "PutDataInPreviousState() error (unknown code %X)" ), itemWrapper.m_UndoRedoStatus);
|
msg.Printf( wxT(
|
||||||
DisplayError( this, msg);
|
"PutDataInPreviousState() error (unknown code %X)" ),
|
||||||
|
itemWrapper.m_UndoRedoStatus );
|
||||||
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -468,14 +525,14 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
||||||
icnt = aItemCount;
|
icnt = aItemCount;
|
||||||
for( unsigned ii = 0; ii < icnt; ii++ )
|
for( unsigned ii = 0; ii < icnt; ii++ )
|
||||||
{
|
{
|
||||||
if ( aList.m_CommandsList.size() == 0 )
|
if( aList.m_CommandsList.size() == 0 )
|
||||||
break;
|
break;
|
||||||
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
|
||||||
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
|
||||||
CmdType = curr_cmd->m_UndoRedoType;
|
CmdType = curr_cmd->m_UndoRedoType;
|
||||||
|
|
||||||
// Delete items is they are not flagged IS_NEW
|
// Delete items is they are not flagged IS_NEW
|
||||||
while(1)
|
while( 1 )
|
||||||
{
|
{
|
||||||
ITEM_PICKER wrapper = curr_cmd->PopItem();
|
ITEM_PICKER wrapper = curr_cmd->PopItem();
|
||||||
EDA_BaseStruct* item = wrapper.m_Item;
|
EDA_BaseStruct* item = wrapper.m_Item;
|
||||||
|
@ -498,6 +555,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete curr_cmd; // Delete command
|
delete curr_cmd; // Delete command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
|
||||||
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
bool enable = ( GetScreen() &&
|
bool enable = ( GetScreen() &&
|
||||||
GetScreen()->BlockLocate.m_Command == BLOCK_MOVE );
|
GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
|
||||||
event.Enable(enable);
|
event.Enable(enable);
|
||||||
m_HToolBar->EnableTool( wxID_CUT, enable );
|
m_HToolBar->EnableTool( wxID_CUT, enable );
|
||||||
m_HToolBar->EnableTool( wxID_COPY, enable );
|
m_HToolBar->EnableTool( wxID_COPY, enable );
|
||||||
|
@ -424,8 +424,8 @@ void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
event.Enable( g_BlockSaveDataList != NULL );
|
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
|
||||||
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList != NULL );
|
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
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 :*/
|
/* Variables locales :*/
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
||||||
err = TRUE;
|
err = TRUE;
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) );
|
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:
|
case BLOCK_IDLE:
|
||||||
err = TRUE;
|
err = TRUE;
|
||||||
|
@ -93,14 +93,14 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
Block_Move( DC );
|
Block_Move( DC );
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
Block_Duplicate( DC );
|
Block_Duplicate( DC );
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE:
|
case BLOCK_PASTE:
|
||||||
|
@ -122,13 +122,13 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
||||||
|
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace DrawStruct != NULL" ) );
|
DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) );
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayToolMsg( wxEmptyString );
|
DisplayToolMsg( wxEmptyString );
|
||||||
|
@ -151,7 +151,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
|
|
||||||
switch( GetScreen()->BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||||
|
@ -161,7 +161,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
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;
|
endcommande = FALSE;
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||||
|
@ -169,13 +169,13 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: /* Delete */
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
Block_Delete( DC );
|
Block_Delete( DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_MIRROR_X: /* Mirror*/
|
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 );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
Block_Mirror_X( DC );
|
Block_Mirror_X( DC );
|
||||||
break;
|
break;
|
||||||
|
@ -204,17 +204,17 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
if( endcommande == TRUE )
|
if( endcommande == TRUE )
|
||||||
{
|
{
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
DisplayToolMsg( wxEmptyString );
|
DisplayToolMsg( wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( zoom_command )
|
if( zoom_command )
|
||||||
Window_Zoom( GetScreen()->BlockLocate );
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||||
|
|
||||||
return endcommande;
|
return endcommande;
|
||||||
}
|
}
|
||||||
|
@ -230,34 +230,28 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
||||||
int Color;
|
int Color;
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
Color = YELLOW; GRSetDrawMode( DC, g_XorMode );
|
Color = YELLOW;
|
||||||
|
|
||||||
/* Effacement ancien cadre */
|
/* Effacement ancien cadre */
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0),g_XorMode, Color );
|
||||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color );
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
|
||||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
|
||||||
-screen->BlockLocate.m_MoveVector.y );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight();
|
||||||
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();
|
screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0),g_XorMode, Color );
|
||||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector,g_XorMode, Color );
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
|
||||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
|
||||||
-screen->BlockLocate.m_MoveVector.y );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +268,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
|
|
||||||
/* Effacement des Pistes */
|
/* 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 )
|
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = NextS )
|
||||||
{
|
{
|
||||||
NextS = pt_segm->Next();
|
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 */
|
/* la piste est ici bonne a etre efface */
|
||||||
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
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 )
|
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextS )
|
||||||
{
|
{
|
||||||
NextS = pt_segm->Next();
|
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 */
|
/* la piste est ici bonne a etre efface */
|
||||||
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
pt_segm->Draw( DrawPanel, DC, GR_XOR );
|
||||||
|
@ -324,16 +318,16 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
/* 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 */
|
/* Move the Track segments in block */
|
||||||
TRACK* track = m_Pcb->m_Track;
|
TRACK* track = m_Pcb->m_Track;
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
if( IsSegmentInBox( GetScreen()->m_BlockLocate, track ) )
|
||||||
{
|
{
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
track->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
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;
|
SEGZONE * zsegment= m_Pcb->m_Zone;
|
||||||
while( zsegment )
|
while( zsegment )
|
||||||
{
|
{
|
||||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) )
|
||||||
{
|
{
|
||||||
zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||||
zsegment->m_Start += delta;
|
zsegment->m_Start += delta;
|
||||||
|
@ -388,16 +382,16 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
/* Calculate offset to mirror track points from block edges */
|
/* Calculate offset to mirror track points from block edges */
|
||||||
xoffset = GetScreen()->BlockLocate.m_Pos.x + GetScreen()->BlockLocate.m_Pos.x
|
xoffset = GetScreen()->m_BlockLocate.m_Pos.x + GetScreen()->m_BlockLocate.m_Pos.x
|
||||||
+ GetScreen()->BlockLocate.m_Size.x;
|
+ GetScreen()->m_BlockLocate.m_Size.x;
|
||||||
|
|
||||||
/* Move the Track segments in block */
|
/* Move the Track segments in block */
|
||||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
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;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
track->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
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 */
|
/* Move the Zone segments in block */
|
||||||
for( SEGZONE* zsegment = m_Pcb->m_Zone; zsegment; zsegment = zsegment->Next() )
|
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->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||||
zsegment->m_Start.x = xoffset - zsegment->m_Start.x;
|
zsegment->m_Start.x = xoffset - zsegment->m_Start.x;
|
||||||
|
@ -448,18 +442,18 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
|
|
||||||
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
/* 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 */
|
/* Copy selected track segments and move the new track its new location */
|
||||||
TRACK* track = m_Pcb->m_Track;
|
TRACK* track = m_Pcb->m_Track;
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
TRACK* next_track = track->Next();
|
TRACK* next_track = track->Next();
|
||||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
if( IsSegmentInBox( GetScreen()->m_BlockLocate, track ) )
|
||||||
{
|
{
|
||||||
/* this track segment must be duplicated */
|
/* this track segment must be duplicated */
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
@ -480,7 +474,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
while( zsegment )
|
while( zsegment )
|
||||||
{
|
{
|
||||||
SEGZONE * next_zsegment = zsegment->Next();
|
SEGZONE * next_zsegment = zsegment->Next();
|
||||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
if( IsSegmentInBox( GetScreen()->m_BlockLocate, zsegment ) )
|
||||||
{
|
{
|
||||||
/* this zone segment must be duplicated */
|
/* this zone segment must be duplicated */
|
||||||
SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy();
|
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
|
/* 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 );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
/* ne devrait pas etre execute, sauf bug */
|
/* ne devrait pas etre execute, sauf bug */
|
||||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
|
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
if( m_ID_current_state == 0 )
|
if( m_ID_current_state == 0 )
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
|
@ -250,34 +250,34 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PLACE_BLOCK:
|
case ID_POPUP_PLACE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
HandleBlockPlace( &dc );
|
HandleBlockPlace( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_COPY_BLOCK:
|
case ID_POPUP_COPY_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_BLOCK:
|
case ID_POPUP_ZOOM_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_DELETE_BLOCK:
|
case ID_POPUP_DELETE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_MIRROR_X_BLOCK:
|
case ID_POPUP_MIRROR_X_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_MIRROR_X;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ void WinEDA_GerberFrame::SetToolbars()
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
if( GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
m_HToolBar->EnableTool( wxID_CUT, TRUE );
|
m_HToolBar->EnableTool( wxID_CUT, TRUE );
|
||||||
m_HToolBar->EnableTool( wxID_COPY, TRUE );
|
m_HToolBar->EnableTool( wxID_COPY, TRUE );
|
||||||
|
|
|
@ -22,7 +22,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,108 @@
|
||||||
#define __INCLUDE__BLOCK_COMMANDE_H__ 1
|
#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 );
|
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
|
/* Redraw the outlines of the block which shows the search area for block commands
|
||||||
* The first point of the rectangle showing the area is initialised
|
* The first point of the rectangle showing the area is initialised
|
||||||
* by InitBlockLocateDatas().
|
* by InitBlockLocateDatas().
|
||||||
* The other point of the rectangle is the mouse cursor */
|
* The other point of the rectangle is the mouse cursor
|
||||||
|
*/
|
||||||
|
void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
|
|
||||||
#endif /* __INCLUDE__BLOCK_COMMANDE_H__ */
|
#endif /* __INCLUDE__BLOCK_COMMANDE_H__ */
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
/* define :
|
/* define :
|
||||||
* class DrawBlockStruct used to handle block commands
|
|
||||||
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
|
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
|
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
#include "class_undoredo_container.h"
|
#include "class_undoredo_container.h"
|
||||||
|
#include "block_commande.h"
|
||||||
|
|
||||||
|
|
||||||
// Forward declarations:
|
// Forward declarations:
|
||||||
|
@ -19,60 +19,6 @@ class SCH_ITEM;
|
||||||
class Ki_PageDescr;
|
class Ki_PageDescr;
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
|
||||||
/* class DrawBlockStruct */
|
|
||||||
/**************************/
|
|
||||||
/* Definition d'un block pour les fonctions sur block (block move, ..) */
|
|
||||||
typedef enum {
|
|
||||||
/* definition de l'etat du block */
|
|
||||||
STATE_NO_BLOCK, /* Block non initialise */
|
|
||||||
STATE_BLOCK_INIT, /* Block initialise: 1er point defini */
|
|
||||||
STATE_BLOCK_END, /* Block initialise: 2eme point defini */
|
|
||||||
STATE_BLOCK_MOVE, /* Block en deplacement */
|
|
||||||
STATE_BLOCK_STOP /* Block fixe (fin de deplacement) */
|
|
||||||
} BlockState;
|
|
||||||
|
|
||||||
/* codes des differentes commandes sur block: */
|
|
||||||
typedef enum {
|
|
||||||
BLOCK_IDLE,
|
|
||||||
BLOCK_MOVE,
|
|
||||||
BLOCK_COPY,
|
|
||||||
BLOCK_SAVE,
|
|
||||||
BLOCK_DELETE,
|
|
||||||
BLOCK_PASTE,
|
|
||||||
BLOCK_DRAG,
|
|
||||||
BLOCK_ROTATE,
|
|
||||||
BLOCK_INVERT,
|
|
||||||
BLOCK_ZOOM,
|
|
||||||
BLOCK_ABORT,
|
|
||||||
BLOCK_PRESELECT_MOVE,
|
|
||||||
BLOCK_SELECT_ITEMS_ONLY,
|
|
||||||
BLOCK_MIRROR_X,
|
|
||||||
BLOCK_MIRROR_Y
|
|
||||||
} CmdBlockType;
|
|
||||||
|
|
||||||
|
|
||||||
class DrawBlockStruct : public EDA_BaseStruct, public EDA_Rect
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BlockState m_State; /* Etat (enum BlockState) du block */
|
|
||||||
CmdBlockType m_Command; /* Type (enum CmdBlockType) d'operation */
|
|
||||||
EDA_BaseStruct* m_BlockDrawStruct; /* pointeur sur la structure
|
|
||||||
* selectionnee dans le bloc */
|
|
||||||
int m_Color; /* Block Color */
|
|
||||||
wxPoint m_MoveVector; /* Move distance in move, drag, copy ... command */
|
|
||||||
wxPoint m_BlockLastCursorPosition; /* Last Mouse position in block command
|
|
||||||
* = last cursor position in move commands
|
|
||||||
* = 0,0 in block paste */
|
|
||||||
|
|
||||||
public:
|
|
||||||
DrawBlockStruct();
|
|
||||||
~DrawBlockStruct();
|
|
||||||
void SetMessageBlock( WinEDA_DrawFrame* frame );
|
|
||||||
void Draw( WinEDA_DrawPanel* panel, wxDC* DC );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Simple class for handling grid arrays. */
|
/* Simple class for handling grid arrays. */
|
||||||
class GRID_TYPE
|
class GRID_TYPE
|
||||||
{
|
{
|
||||||
|
@ -120,12 +66,12 @@ public:
|
||||||
SCH_ITEM* EEDrawList; /* Object list (main data) for schematic */
|
SCH_ITEM* EEDrawList; /* Object list (main data) for schematic */
|
||||||
|
|
||||||
// Undo/redo list of commands
|
// Undo/redo list of commands
|
||||||
UNDO_REDO_CONTAINER m_UndoList; /* Object list for the undo command (old data) */
|
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
|
||||||
UNDO_REDO_CONTAINER m_RedoList; /* Object list for the redo command (old data) */
|
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
|
||||||
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
|
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
|
||||||
|
|
||||||
/* block control */
|
/* block control */
|
||||||
DrawBlockStruct BlockLocate; /* Bock description for block commands */
|
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
|
||||||
|
|
||||||
/* Page description */
|
/* Page description */
|
||||||
Ki_PageDescr* m_CurrentSheetDesc;
|
Ki_PageDescr* m_CurrentSheetDesc;
|
||||||
|
@ -193,15 +139,19 @@ public:
|
||||||
virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
|
virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
|
||||||
virtual PICKED_ITEMS_LIST* PopCommandFromUndoList();
|
virtual PICKED_ITEMS_LIST* PopCommandFromUndoList();
|
||||||
virtual PICKED_ITEMS_LIST* PopCommandFromRedoList();
|
virtual PICKED_ITEMS_LIST* PopCommandFromRedoList();
|
||||||
int GetUndoCommandCount( )
|
|
||||||
|
int GetUndoCommandCount()
|
||||||
{
|
{
|
||||||
return m_UndoList.m_CommandsList.size();
|
return m_UndoList.m_CommandsList.size();
|
||||||
}
|
}
|
||||||
int GetRedoCommandCount( )
|
|
||||||
|
|
||||||
|
int GetRedoCommandCount()
|
||||||
{
|
{
|
||||||
return m_RedoList.m_CommandsList.size();
|
return m_RedoList.m_CommandsList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Manipulation des flags */
|
/* Manipulation des flags */
|
||||||
void SetRefreshReq() { m_FlagRefreshReq = 1; }
|
void SetRefreshReq() { m_FlagRefreshReq = 1; }
|
||||||
void ClrRefreshReq() { m_FlagRefreshReq = 0; }
|
void ClrRefreshReq() { m_FlagRefreshReq = 0; }
|
||||||
|
|
|
@ -88,9 +88,18 @@ public:
|
||||||
~PICKED_ITEMS_LIST();
|
~PICKED_ITEMS_LIST();
|
||||||
void PushItem( ITEM_PICKER& aItem );
|
void PushItem( ITEM_PICKER& aItem );
|
||||||
ITEM_PICKER PopItem();
|
ITEM_PICKER PopItem();
|
||||||
|
|
||||||
|
/** Function ClearItemsList
|
||||||
|
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
|
||||||
|
*/
|
||||||
void ClearItemsList();
|
void ClearItemsList();
|
||||||
|
|
||||||
unsigned GetCount()
|
/** Function ClearListAndDeleteItems
|
||||||
|
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
|
||||||
|
*/
|
||||||
|
void ClearListAndDeleteItems();
|
||||||
|
|
||||||
|
unsigned GetCount() const
|
||||||
{
|
{
|
||||||
return m_ItemsList.size();
|
return m_ItemsList.size();
|
||||||
}
|
}
|
||||||
|
@ -105,6 +114,12 @@ public:
|
||||||
bool SetLink( EDA_BaseStruct* aItem, unsigned aIdx );
|
bool SetLink( EDA_BaseStruct* aItem, unsigned aIdx );
|
||||||
bool SetItemStatus( int aStatus, unsigned aIdx );
|
bool SetItemStatus( int aStatus, unsigned aIdx );
|
||||||
bool RemoveItem( unsigned aIdx );
|
bool RemoveItem( unsigned aIdx );
|
||||||
|
|
||||||
|
/** Function CopyList
|
||||||
|
* copy all data from aSource
|
||||||
|
* Items picked are not copied. just pointer on them are copied
|
||||||
|
*/
|
||||||
|
void CopyList(const PICKED_ITEMS_LIST & aSource);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -364,12 +364,12 @@ private:
|
||||||
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
||||||
|
|
||||||
/* Operations sur bloc */
|
/* Operations sur bloc */
|
||||||
void PasteStruct( wxDC* DC );
|
void PasteListOfItems( wxDC* DC );
|
||||||
|
|
||||||
/* Undo - redo */
|
/* Undo - redo */
|
||||||
public:
|
public:
|
||||||
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy, int aTypeCommand );
|
||||||
int flag_type_command = 0 );
|
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, int aTypeCommand );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
|
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
|
||||||
|
|
169
pcbnew/block.cpp
169
pcbnew/block.cpp
|
@ -247,9 +247,9 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
||||||
err = TRUE;
|
err = TRUE;
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) );
|
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:
|
case BLOCK_IDLE:
|
||||||
err = TRUE;
|
err = TRUE;
|
||||||
|
@ -261,14 +261,14 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
Block_Move( DC );
|
Block_Move( DC );
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
Block_Duplicate( DC );
|
Block_Duplicate( DC );
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE:
|
case BLOCK_PASTE:
|
||||||
|
@ -283,13 +283,13 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
||||||
|
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace DrawStruct != NULL" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) );
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayToolMsg( wxEmptyString );
|
DisplayToolMsg( wxEmptyString );
|
||||||
|
@ -310,7 +310,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
int endcommande = TRUE;
|
int endcommande = TRUE;
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
switch( GetScreen()->BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||||
|
@ -320,7 +320,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
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;
|
endcommande = FALSE;
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||||
|
@ -331,7 +331,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
// Turn off the block rectangle now so it is not redisplayed
|
// Turn off the block rectangle now so it is not redisplayed
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
Block_Delete( DC );
|
Block_Delete( DC );
|
||||||
break;
|
break;
|
||||||
|
@ -340,7 +340,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
// Turn off the block rectangle now so it is not redisplayed
|
// Turn off the block rectangle now so it is not redisplayed
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
Block_Rotate( DC );
|
Block_Rotate( DC );
|
||||||
break;
|
break;
|
||||||
|
@ -349,18 +349,18 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
// Turn off the block rectangle now so it is not redisplayed
|
// Turn off the block rectangle now so it is not redisplayed
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
Block_Invert( DC );
|
Block_Invert( DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/
|
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct != NULL )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
|
|
||||||
// SaveStruct(GetScreen()->BlockLocate.m_BlockDrawStruct);
|
// SaveStruct(GetScreen()->m_BlockLocate.m_BlockDrawStruct);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
//Turn off the redraw block routine now so it is not displayed
|
//Turn off the redraw block routine now so it is not displayed
|
||||||
// with one corner at the new center of the screen
|
// with one corner at the new center of the screen
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
Window_Zoom( GetScreen()->BlockLocate );
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -381,10 +381,10 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
if( endcommande == TRUE )
|
if( endcommande == TRUE )
|
||||||
{
|
{
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
DisplayToolMsg( wxEmptyString );
|
DisplayToolMsg( wxEmptyString );
|
||||||
|
@ -405,34 +405,27 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
Color = YELLOW;
|
Color = YELLOW;
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
|
||||||
|
|
||||||
/* Effacement ancien cadre */
|
/* Effacement ancien cadre */
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0), g_XorMode, Color );
|
||||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color );
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
|
||||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
|
||||||
-screen->BlockLocate.m_MoveVector.y );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.GetRight();
|
||||||
screen->BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->BlockLocate.GetBottom();
|
screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.GetBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
screen->m_BlockLocate.Draw( panel, DC, wxPoint(0,0), g_XorMode, Color );
|
||||||
if( screen->BlockLocate.m_MoveVector.x || screen->BlockLocate.m_MoveVector.y )
|
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||||
{
|
{
|
||||||
screen->BlockLocate.Offset( screen->BlockLocate.m_MoveVector );
|
screen->m_BlockLocate.Draw( panel, DC, screen->m_BlockLocate.m_MoveVector, g_XorMode, Color );
|
||||||
screen->BlockLocate.Draw( panel, DC );
|
|
||||||
screen->BlockLocate.Offset( -screen->BlockLocate.m_MoveVector.x,
|
|
||||||
-screen->BlockLocate.m_MoveVector.y );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +445,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
|
||||||
/* Effacement des modules */
|
/* Effacement des modules */
|
||||||
|
@ -463,7 +456,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
for( ; module != NULL; module = (MODULE*) NextS )
|
for( ; module != NULL; module = (MODULE*) NextS )
|
||||||
{
|
{
|
||||||
NextS = module->Next();
|
NextS = module->Next();
|
||||||
if( module->HitTest( GetScreen()->BlockLocate ) )
|
if( module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{
|
{
|
||||||
module->m_Flags = 0;
|
module->m_Flags = 0;
|
||||||
module->DeleteStructure();
|
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 )
|
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) NextS )
|
||||||
{
|
{
|
||||||
NextS = pt_segm->Next();
|
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 */
|
/* la piste est ici bonne a etre efface */
|
||||||
pt_segm->DeleteStructure();
|
pt_segm->DeleteStructure();
|
||||||
|
@ -506,7 +499,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* l'element est ici bon a etre efface */
|
/* l'element est ici bon a etre efface */
|
||||||
|
@ -517,7 +510,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
if( !Block_Include_PcbTextes )
|
if( !Block_Include_PcbTextes )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* le texte est ici bon a etre efface */
|
/* le texte est ici bon a etre efface */
|
||||||
PtStruct->Draw( DrawPanel, DC, GR_XOR );
|
PtStruct->Draw( DrawPanel, DC, GR_XOR );
|
||||||
|
@ -528,7 +521,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
case TYPE_MIRE:
|
case TYPE_MIRE:
|
||||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre efface */
|
/* l'element est ici bon a etre efface */
|
||||||
PtStruct->DeleteStructure();
|
PtStruct->DeleteStructure();
|
||||||
|
@ -537,7 +530,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
case TYPE_COTATION:
|
case TYPE_COTATION:
|
||||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
PtStruct->DeleteStructure();
|
PtStruct->DeleteStructure();
|
||||||
break;
|
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 )
|
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = NextSegZ )
|
||||||
{
|
{
|
||||||
NextSegZ = pt_segm->Next();
|
NextSegZ = pt_segm->Next();
|
||||||
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
|
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{
|
{
|
||||||
pt_segm->DeleteStructure();
|
pt_segm->DeleteStructure();
|
||||||
}
|
}
|
||||||
|
@ -564,7 +557,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
|
||||||
|
|
||||||
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
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));
|
m_Pcb->Delete(m_Pcb->GetArea(ii));
|
||||||
ii--; // because the current data was removed, ii points actually the next data
|
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;
|
return;
|
||||||
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
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();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
|
@ -611,7 +604,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
module = m_Pcb->m_Modules;
|
module = m_Pcb->m_Modules;
|
||||||
for( ; module != NULL; module = module->Next() )
|
for( ; module != NULL; module = module->Next() )
|
||||||
{
|
{
|
||||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
continue;
|
continue;
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
module->m_Flags = 0;
|
module->m_Flags = 0;
|
||||||
|
@ -635,7 +628,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
track = m_Pcb->m_Track;
|
track = m_Pcb->m_Track;
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{ /* la piste est ici bonne a etre deplacee */
|
{ /* la piste est ici bonne a etre deplacee */
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
RotatePoint( &track->m_Start, centre, 900 );
|
RotatePoint( &track->m_Start, centre, 900 );
|
||||||
|
@ -654,7 +647,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
track = (TRACK*) m_Pcb->m_Zone;
|
track = (TRACK*) m_Pcb->m_Zone;
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{
|
{
|
||||||
RotatePoint( &track->m_Start, centre, 900 );
|
RotatePoint( &track->m_Start, centre, 900 );
|
||||||
RotatePoint( &track->m_End, 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++ )
|
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);
|
m_Pcb->GetArea(ii)->Rotate(centre, 900);
|
||||||
}
|
}
|
||||||
|
@ -687,7 +680,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
RotatePoint( &STRUCT->m_Start, centre, 900 );
|
RotatePoint( &STRUCT->m_Start, centre, 900 );
|
||||||
RotatePoint( &STRUCT->m_End, centre, 900 );
|
RotatePoint( &STRUCT->m_End, centre, 900 );
|
||||||
|
@ -698,7 +691,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
||||||
if( !Block_Include_PcbTextes )
|
if( !Block_Include_PcbTextes )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
RotatePoint( &STRUCT->m_Pos, centre, 900 );
|
RotatePoint( &STRUCT->m_Pos, centre, 900 );
|
||||||
STRUCT->m_Orient += 900;
|
STRUCT->m_Orient += 900;
|
||||||
|
@ -711,7 +704,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
#define STRUCT ( (MIREPCB*) PtStruct )
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre modifie */
|
/* l'element est ici bon a etre modifie */
|
||||||
RotatePoint( &STRUCT->m_Pos, centre, 900 );
|
RotatePoint( &STRUCT->m_Pos, centre, 900 );
|
||||||
|
@ -722,7 +715,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
|
||||||
#define STRUCT ( (COTATION*) PtStruct )
|
#define STRUCT ( (COTATION*) PtStruct )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
STRUCT->Rotate(centre, 900);
|
STRUCT->Rotate(centre, 900);
|
||||||
break;
|
break;
|
||||||
|
@ -759,10 +752,10 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memo = GetScreen()->m_Curseur;
|
memo = GetScreen()->m_Curseur;
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
/* calcul du centre d'inversion */
|
/* calcul du centre d'inversion */
|
||||||
centerY = GetScreen()->BlockLocate.Centre().y;
|
centerY = GetScreen()->m_BlockLocate.Centre().y;
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
|
@ -773,7 +766,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
module = m_Pcb->m_Modules;
|
module = m_Pcb->m_Modules;
|
||||||
for( ; module != NULL; module = module->Next() )
|
for( ; module != NULL; module = module->Next() )
|
||||||
{
|
{
|
||||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
continue;
|
continue;
|
||||||
/* le module est ici bon a etre efface */
|
/* le module est ici bon a etre efface */
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
@ -804,7 +797,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
track = m_Pcb->m_Track;
|
track = m_Pcb->m_Track;
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{ /* la piste est ici bonne a etre deplacee */
|
{ /* la piste est ici bonne a etre deplacee */
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
INVERT( track->m_Start.y );
|
INVERT( track->m_Start.y );
|
||||||
|
@ -826,7 +819,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
track = (TRACK*) m_Pcb->m_Zone;
|
track = (TRACK*) m_Pcb->m_Zone;
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{ /* la piste est ici bonne a etre deplacee */
|
{ /* la piste est ici bonne a etre deplacee */
|
||||||
INVERT( track->m_Start.y );
|
INVERT( track->m_Start.y );
|
||||||
INVERT( track->m_End.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++ )
|
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)->Mirror( wxPoint(0, centerY) );
|
||||||
m_Pcb->GetArea(ii)->SetLayer( ChangeSideNumLayer( m_Pcb->GetArea(ii)->GetLayer() ) );
|
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 )
|
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre selectionne */
|
/* l'element est ici bon a etre selectionne */
|
||||||
if( STRUCT->m_Shape == S_ARC )
|
if( STRUCT->m_Shape == S_ARC )
|
||||||
|
@ -877,7 +870,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
#define STRUCT ( (TEXTE_PCB*) PtStruct )
|
||||||
if( !Block_Include_PcbTextes )
|
if( !Block_Include_PcbTextes )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* le texte est ici bon a etre selectionne*/
|
/* le texte est ici bon a etre selectionne*/
|
||||||
INVERT( STRUCT->m_Pos.y );
|
INVERT( STRUCT->m_Pos.y );
|
||||||
|
@ -894,7 +887,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
#define STRUCT ( (MIREPCB*) PtStruct )
|
#define STRUCT ( (MIREPCB*) PtStruct )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre modifie */
|
/* l'element est ici bon a etre modifie */
|
||||||
INVERT( STRUCT->m_Pos.y );
|
INVERT( STRUCT->m_Pos.y );
|
||||||
|
@ -906,7 +899,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
|
||||||
#define STRUCT ( (COTATION*) PtStruct )
|
#define STRUCT ( (COTATION*) PtStruct )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
|
if( ! PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre modifie */
|
/* l'element est ici bon a etre modifie */
|
||||||
|
|
||||||
|
@ -934,7 +927,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
{
|
{
|
||||||
int masque_layer;
|
int masque_layer;
|
||||||
wxPoint oldpos;
|
wxPoint oldpos;
|
||||||
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
|
wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector;
|
||||||
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
|
@ -945,7 +938,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
/* Deplacement des modules */
|
/* Deplacement des modules */
|
||||||
if( Block_Include_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() )
|
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* le module est ici bon a etre deplace */
|
/* 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() )
|
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 */
|
{ /* la piste est ici bonne a etre deplacee */
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
track->m_Start += MoveVector;
|
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() )
|
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 */
|
{ /* la piste est ici bonne a etre deplacee */
|
||||||
track->m_Start += MoveVector;
|
track->m_Start += MoveVector;
|
||||||
track->m_End += 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++ )
|
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 );
|
m_Pcb->GetArea(ii)->Move( MoveVector );
|
||||||
}
|
}
|
||||||
|
@ -1018,7 +1011,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
#define STRUCT ( (DRAWSEGMENT*) item )
|
#define STRUCT ( (DRAWSEGMENT*) item )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre efface */
|
/* l'element est ici bon a etre efface */
|
||||||
STRUCT->m_Start += MoveVector;
|
STRUCT->m_Start += MoveVector;
|
||||||
|
@ -1030,7 +1023,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
#define STRUCT ( (TEXTE_PCB*) item )
|
#define STRUCT ( (TEXTE_PCB*) item )
|
||||||
if( !Block_Include_PcbTextes )
|
if( !Block_Include_PcbTextes )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* le texte est ici bon a etre deplace */
|
/* le texte est ici bon a etre deplace */
|
||||||
/* Redessin du Texte */
|
/* Redessin du Texte */
|
||||||
|
@ -1042,7 +1035,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
#define STRUCT ( (MIREPCB*) item )
|
#define STRUCT ( (MIREPCB*) item )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre efface */
|
/* l'element est ici bon a etre efface */
|
||||||
STRUCT->m_Pos += MoveVector;
|
STRUCT->m_Pos += MoveVector;
|
||||||
|
@ -1053,7 +1046,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
||||||
#define STRUCT ( (COTATION*) item )
|
#define STRUCT ( (COTATION*) item )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre efface */
|
/* l'element est ici bon a etre efface */
|
||||||
( (COTATION*) item )->Move( wxPoint(MoveVector) );
|
( (COTATION*) item )->Move( wxPoint(MoveVector) );
|
||||||
|
@ -1079,7 +1072,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
{
|
{
|
||||||
int masque_layer;
|
int masque_layer;
|
||||||
wxPoint oldpos;
|
wxPoint oldpos;
|
||||||
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
|
wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector;
|
||||||
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
|
@ -1090,7 +1083,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
||||||
/* Module copy */
|
/* Module copy */
|
||||||
if( Block_Include_Modules )
|
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() )
|
for( MODULE* module= m_Pcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
MODULE* new_module;
|
MODULE* new_module;
|
||||||
if( ! module->HitTest( GetScreen()->BlockLocate ) )
|
if( ! module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* le module est ici bon a etre deplace */
|
/* le module est ici bon a etre deplace */
|
||||||
|
@ -1130,7 +1123,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
while( track )
|
while( track )
|
||||||
{
|
{
|
||||||
next_track = track->Next();
|
next_track = track->Next();
|
||||||
if( track->HitTest( GetScreen()->BlockLocate ) )
|
if( track->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
{
|
{
|
||||||
/* la piste est ici bonne a etre deplacee */
|
/* la piste est ici bonne a etre deplacee */
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
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() )
|
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();
|
SEGZONE* new_segzone = (SEGZONE*) segzone->Copy();
|
||||||
|
|
||||||
|
@ -1164,7 +1157,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
unsigned imax = m_Pcb->GetAreaCount();
|
unsigned imax = m_Pcb->GetAreaCount();
|
||||||
for ( unsigned ii = 0; ii < imax; ii++ )
|
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);
|
ZONE_CONTAINER * new_zone = new ZONE_CONTAINER(m_Pcb);
|
||||||
new_zone->Copy( m_Pcb->GetArea(ii) );
|
new_zone->Copy( m_Pcb->GetArea(ii) );
|
||||||
|
@ -1191,7 +1184,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
#define STRUCT ( (DRAWSEGMENT*) item )
|
#define STRUCT ( (DRAWSEGMENT*) item )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* l'element est ici bon a etre copie */
|
/* l'element est ici bon a etre copie */
|
||||||
|
@ -1211,7 +1204,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
#define STRUCT ( (TEXTE_PCB*) item )
|
#define STRUCT ( (TEXTE_PCB*) item )
|
||||||
if( !Block_Include_PcbTextes )
|
if( !Block_Include_PcbTextes )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* le texte est ici bon a etre deplace */
|
/* le texte est ici bon a etre deplace */
|
||||||
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
|
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
|
||||||
|
@ -1230,7 +1223,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
#define STRUCT ( (MIREPCB*) item )
|
#define STRUCT ( (MIREPCB*) item )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre efface */
|
/* l'element est ici bon a etre efface */
|
||||||
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
||||||
|
@ -1248,7 +1241,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
||||||
#define STRUCT ( (COTATION*) item )
|
#define STRUCT ( (COTATION*) item )
|
||||||
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
|
||||||
break;
|
break;
|
||||||
if( ! item->HitTest( GetScreen()->BlockLocate ) )
|
if( ! item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
break;
|
break;
|
||||||
/* l'element est ici bon a etre copie */
|
/* l'element est ici bon a etre copie */
|
||||||
COTATION* new_cotation = new COTATION( m_Pcb );
|
COTATION* new_cotation = new COTATION( m_Pcb );
|
||||||
|
|
|
@ -104,21 +104,21 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
int ItemsCount = 0, MustDoPlace = 0;
|
int ItemsCount = 0, MustDoPlace = 0;
|
||||||
MODULE* Currentmodule = GetBoard()->m_Modules;
|
MODULE* Currentmodule = GetBoard()->m_Modules;
|
||||||
|
|
||||||
if( GetScreen()->BlockLocate.m_BlockDrawStruct )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
BlockState state = GetScreen()->BlockLocate.m_State;
|
BlockState state = GetScreen()->m_BlockLocate.m_State;
|
||||||
CmdBlockType command = GetScreen()->BlockLocate.m_Command;
|
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
|
||||||
GetScreen()->BlockLocate.m_State = state;
|
GetScreen()->m_BlockLocate.m_State = state;
|
||||||
GetScreen()->BlockLocate.m_Command = command;
|
GetScreen()->m_BlockLocate.m_Command = command;
|
||||||
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
|
||||||
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
|
||||||
GetScreen()->m_Curseur.x = GetScreen()->BlockLocate.GetRight();
|
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
|
||||||
GetScreen()->m_Curseur.y = GetScreen()->BlockLocate.GetBottom();
|
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( GetScreen()->BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||||
|
@ -127,7 +127,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
{
|
{
|
||||||
MustDoPlace = 1;
|
MustDoPlace = 1;
|
||||||
|
@ -137,7 +137,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
}
|
}
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -145,11 +145,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
MustDoPlace = 1;
|
MustDoPlace = 1;
|
||||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: /* Delete */
|
||||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
DeleteMarkedItems( Currentmodule );
|
DeleteMarkedItems( Currentmodule );
|
||||||
|
@ -160,24 +160,24 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ROTATE:
|
case BLOCK_ROTATE:
|
||||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
RotateMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y:
|
case BLOCK_MIRROR_Y:
|
||||||
case BLOCK_INVERT: /* mirror */
|
case BLOCK_INVERT: /* mirror */
|
||||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->BlockLocate );
|
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
MirrorMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: /* Window Zoom */
|
||||||
Window_Zoom( GetScreen()->BlockLocate );
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ABORT:
|
case BLOCK_ABORT:
|
||||||
|
@ -189,19 +189,17 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
if( MustDoPlace <= 0 )
|
if( MustDoPlace <= 0 )
|
||||||
{
|
{
|
||||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
|
||||||
{
|
{
|
||||||
ClearMarkItems( Currentmodule );
|
ClearMarkItems( Currentmodule );
|
||||||
}
|
}
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
SetToolID( m_ID_current_state,
|
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
||||||
DrawPanel->m_PanelDefaultCursor,
|
|
||||||
wxEmptyString );
|
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,9 +227,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
|
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
|
|
||||||
switch( GetScreen()->BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
err = TRUE;
|
err = TRUE;
|
||||||
|
@ -240,32 +238,32 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
MoveMarkedItems( Currentmodule, GetScreen()->BlockLocate.m_MoveVector );
|
MoveMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
CopyMarkedItems( Currentmodule, GetScreen()->BlockLocate.m_MoveVector );
|
CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y:
|
case BLOCK_MIRROR_Y:
|
||||||
case BLOCK_INVERT: /* Mirror by popup menu, from block move */
|
case BLOCK_INVERT: /* Mirror by popup menu, from block move */
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
MirrorMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ROTATE:
|
case BLOCK_ROTATE:
|
||||||
SaveCopyInUndoList( Currentmodule );
|
SaveCopyInUndoList( Currentmodule );
|
||||||
RotateMarkedItems( Currentmodule, GetScreen()->BlockLocate.Centre() );
|
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
||||||
|
@ -280,9 +278,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
|
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
GetScreen()->BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
|
|
||||||
|
@ -301,22 +299,20 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
* L'ensemble du block suit le curseur
|
* L'ensemble du block suit le curseur
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DrawBlockStruct* PtBlock;
|
BLOCK_SELECTOR* PtBlock;
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
BOARD_ITEM* item;
|
BOARD_ITEM* item;
|
||||||
wxPoint move_offset;
|
wxPoint move_offset;
|
||||||
MODULE* Currentmodule =
|
MODULE* Currentmodule =
|
||||||
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
|
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
|
||||||
|
|
||||||
PtBlock = &screen->BlockLocate;
|
PtBlock = &screen->m_BlockLocate;
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
GRSetDrawMode( DC, g_XorMode );
|
||||||
|
|
||||||
/* Effacement ancien cadre */
|
/* Effacement ancien cadre */
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||||
PtBlock->Draw( panel, DC );
|
|
||||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
|
||||||
|
|
||||||
if( Currentmodule )
|
if( Currentmodule )
|
||||||
{
|
{
|
||||||
|
@ -356,10 +352,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
|
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
|
||||||
PtBlock->m_BlockLastCursorPosition.y;
|
PtBlock->m_BlockLastCursorPosition.y;
|
||||||
|
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||||
PtBlock->Offset( PtBlock->m_MoveVector );
|
|
||||||
PtBlock->Draw( panel, DC );
|
|
||||||
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
|
|
||||||
|
|
||||||
|
|
||||||
if( Currentmodule )
|
if( Currentmodule )
|
||||||
|
|
|
@ -500,10 +500,10 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
if( (CurrentTime - g_SaveTime) > g_TimeOut )
|
if( (CurrentTime - g_SaveTime) > g_TimeOut )
|
||||||
{
|
{
|
||||||
wxString tmpFileName = GetScreen()->m_FileName;
|
wxString tmpFileName = GetScreen()->m_FileName;
|
||||||
wxString filename = g_SaveFileName + PcbExtBuffer;
|
wxFileName fn = wxFileName( wxEmptyString, g_SaveFileName, PcbExtBuffer );
|
||||||
bool flgmodify = GetScreen()->IsModify();
|
bool flgmodify = GetScreen()->IsModify();
|
||||||
|
|
||||||
( (WinEDA_PcbFrame*) this )->SavePcbFile( filename );
|
SavePcbFile( fn.GetFullPath() );
|
||||||
|
|
||||||
if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile()
|
if( flgmodify ) // Set the flags m_Modify cleared by SavePcbFile()
|
||||||
{
|
{
|
||||||
|
@ -569,7 +569,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
keep_on_grid = FALSE;
|
keep_on_grid = FALSE;
|
||||||
|
|
||||||
/* Cursor is left off grid if no block in progress and no moving object */
|
/* Cursor is left off grid if no block in progress and no moving object */
|
||||||
if( GetScreen()->BlockLocate.m_State != STATE_NO_BLOCK )
|
if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK )
|
||||||
keep_on_grid = TRUE;
|
keep_on_grid = TRUE;
|
||||||
|
|
||||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||||
|
|
173
pcbnew/edit.cpp
173
pcbnew/edit.cpp
|
@ -151,26 +151,29 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
/* Should not be executed, just in case */
|
/* 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()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
if( m_ID_current_state == 0 )
|
if( m_ID_current_state == 0 )
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
else
|
else
|
||||||
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TOGGLE_PRESENT_COMMAND:
|
case ID_TOGGLE_PRESENT_COMMAND:
|
||||||
|
|
||||||
/* if( DrawPanel->ManageCurseur
|
/* if( DrawPanel->ManageCurseur
|
||||||
&& DrawPanel->ForceCloseManageCurseur )
|
* && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
* {
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
* DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Finish (abort ) the command
|
default: // Finish (abort ) the command
|
||||||
if( DrawPanel->ManageCurseur
|
if( DrawPanel->ManageCurseur
|
||||||
&& DrawPanel->ForceCloseManageCurseur )
|
&& DrawPanel->ForceCloseManageCurseur )
|
||||||
|
@ -178,8 +181,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_ID_current_state != id ){
|
if( m_ID_current_state != id )
|
||||||
if (m_ID_last_state != m_ID_current_state)
|
{
|
||||||
|
if( m_ID_last_state != m_ID_current_state )
|
||||||
m_ID_last_state = m_ID_current_state;
|
m_ID_last_state = m_ID_current_state;
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
}
|
}
|
||||||
|
@ -188,90 +192,20 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
switch( id ) // Execute command
|
switch( id ) // Execute command
|
||||||
{
|
{
|
||||||
case 0: break;
|
case 0:
|
||||||
|
break;
|
||||||
|
|
||||||
case ID_EXIT:
|
case ID_EXIT:
|
||||||
Close( true );
|
Close( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TOGGLE_PRESENT_COMMAND:
|
case ID_TOGGLE_PRESENT_COMMAND:
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/* if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
||||||
{
|
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
SendMessageToEESCHEMA( DrawStruct );
|
|
||||||
|
|
||||||
// An item is found
|
|
||||||
SetCurItem( DrawStruct );
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
|
||||||
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
|
||||||
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;
|
toggle = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TRACK_BUTT:
|
case ID_TRACK_BUTT:
|
||||||
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
||||||
{
|
{
|
||||||
|
@ -283,7 +217,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_ZONES_BUTT:
|
case ID_PCB_ZONES_BUTT:
|
||||||
if ( End_Zone( &dc ) )
|
if( End_Zone( &dc ) )
|
||||||
{
|
{
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
@ -296,12 +230,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_PCB_ARC_BUTT:
|
case ID_PCB_ARC_BUTT:
|
||||||
case ID_PCB_CIRCLE_BUTT:
|
case ID_PCB_CIRCLE_BUTT:
|
||||||
if( DrawStruct == NULL )
|
if( DrawStruct == NULL )
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
else if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
|
else if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
DisplayError( this, wxT( "DrawStruct Type error" ) );
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( (DrawStruct->m_Flags & IS_NEW) )
|
else if( (DrawStruct->m_Flags & IS_NEW) )
|
||||||
{
|
{
|
||||||
|
@ -312,12 +246,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
toggle = 1;
|
toggle = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
toggle = 1;
|
toggle = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (toggle){
|
|
||||||
|
if( toggle )
|
||||||
|
{
|
||||||
int swap = m_ID_last_state;
|
int swap = m_ID_last_state;
|
||||||
m_ID_last_state = m_ID_current_state;
|
m_ID_last_state = m_ID_current_state;
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
|
@ -327,11 +264,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||||
|
|
||||||
event.SetId(m_ID_current_state);
|
event.SetId( m_ID_current_state );
|
||||||
Process_Special_Functions(event);
|
Process_Special_Functions( event );
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OPEN_MODULE_EDITOR:
|
case ID_OPEN_MODULE_EDITOR:
|
||||||
if( m_ModuleEditFrame == NULL )
|
if( m_ModuleEditFrame == NULL )
|
||||||
{
|
{
|
||||||
|
@ -357,40 +295,40 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PLACE_BLOCK:
|
case ID_POPUP_PLACE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
HandleBlockPlace( &dc );
|
HandleBlockPlace( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_COPY_BLOCK:
|
case ID_POPUP_COPY_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
HandleBlockPlace( &dc );
|
HandleBlockPlace( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_BLOCK:
|
case ID_POPUP_ZOOM_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_DELETE_BLOCK:
|
case ID_POPUP_DELETE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ROTATE_BLOCK:
|
case ID_POPUP_ROTATE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_INVERT_BLOCK:
|
case ID_POPUP_INVERT_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -623,7 +561,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
test_1_net_connexion( NULL, netcode );
|
test_1_net_connexion( NULL, netcode );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -648,11 +586,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
|
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
{
|
{
|
||||||
int netcode = ((ZONE_CONTAINER*) GetCurItem())->GetNet();
|
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet();
|
||||||
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
test_1_net_connexion( NULL, netcode );
|
test_1_net_connexion( NULL, netcode );
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -730,7 +668,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
Fill_All_Zones();
|
Fill_All_Zones();
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
||||||
|
@ -740,7 +678,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
Delete_Zone_Fill( &dc, NULL, zone_container->m_TimeStamp );
|
Delete_Zone_Fill( &dc, NULL, zone_container->m_TimeStamp );
|
||||||
test_1_net_connexion( NULL, zone_container->GetNet() );
|
test_1_net_connexion( NULL, zone_container->GetNet() );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
@ -749,15 +687,17 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
|
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++ )
|
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* zone_container = GetBoard()->GetArea( ii );
|
||||||
zone_container->m_FilledPolysList.clear();;
|
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 );
|
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();
|
GetScreen()->SetModify();
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -765,7 +705,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
Fill_Zone( NULL, (ZONE_CONTAINER*) GetCurItem() );
|
Fill_Zone( NULL, (ZONE_CONTAINER*) GetCurItem() );
|
||||||
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
|
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1022,7 +962,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_PCB_GETINFO_MARKER:
|
case ID_POPUP_PCB_GETINFO_MARKER:
|
||||||
if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER )
|
if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER )
|
||||||
((MARKER*)GetCurItem())->DisplayMarkerInfo( this );
|
( (MARKER*) GetCurItem() )->DisplayMarkerInfo( this );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1033,7 +973,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_EDIT_DRAWING:
|
case ID_POPUP_PCB_EDIT_DRAWING:
|
||||||
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*)GetCurItem(), &dc);
|
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1084,6 +1024,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
g_DesignSettings.m_UseConnectedTrackWidth = false;
|
g_DesignSettings.m_UseConnectedTrackWidth = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
|
case ID_AUX_TOOLBAR_PCB_CLR_WIDTH:
|
||||||
{
|
{
|
||||||
int ii = m_SelClrWidthBox->GetChoice();
|
int ii = m_SelClrWidthBox->GetChoice();
|
||||||
|
@ -1316,10 +1257,10 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
{
|
{
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
int netcode = ((ZONE_CONTAINER*) Item)->GetNet();
|
int netcode = ( (ZONE_CONTAINER*) Item )->GetNet();
|
||||||
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
|
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
|
||||||
test_1_net_connexion( NULL, netcode );
|
test_1_net_connexion( NULL, netcode );
|
||||||
GetBoard()->DisplayInfo(this );
|
GetBoard()->DisplayInfo( this );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
/* modedit.cpp */
|
/* modedit.cpp */
|
||||||
/****************/
|
/****************/
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma implementation
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
|
@ -637,7 +633,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PLACE_BLOCK:
|
case ID_POPUP_PLACE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
{
|
{
|
||||||
SET_DC;
|
SET_DC;
|
||||||
|
@ -646,8 +642,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_COPY_BLOCK:
|
case ID_POPUP_COPY_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
{
|
{
|
||||||
SET_DC;
|
SET_DC;
|
||||||
|
@ -656,8 +652,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_BLOCK:
|
case ID_POPUP_ZOOM_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
{
|
{
|
||||||
SET_DC;
|
SET_DC;
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
|
@ -665,8 +661,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_DELETE_BLOCK:
|
case ID_POPUP_DELETE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
{
|
{
|
||||||
SET_DC;
|
SET_DC;
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
|
@ -674,8 +670,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ROTATE_BLOCK:
|
case ID_POPUP_ROTATE_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
{
|
{
|
||||||
SET_DC;
|
SET_DC;
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
|
@ -685,8 +681,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_MIRROR_X_BLOCK:
|
case ID_POPUP_MIRROR_X_BLOCK:
|
||||||
case ID_POPUP_MIRROR_Y_BLOCK:
|
case ID_POPUP_MIRROR_Y_BLOCK:
|
||||||
case ID_POPUP_INVERT_BLOCK:
|
case ID_POPUP_INVERT_BLOCK:
|
||||||
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_INVERT;
|
||||||
GetScreen()->BlockLocate.SetMessageBlock( this );
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||||
{
|
{
|
||||||
SET_DC;
|
SET_DC;
|
||||||
HandleBlockEnd( &dc );
|
HandleBlockEnd( &dc );
|
||||||
|
|
|
@ -177,7 +177,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool append_set_width = FALSE;
|
bool append_set_width = FALSE;
|
||||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
// Simple localisation des elements si possible
|
// Simple localisation des elements si possible
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
|
|
|
@ -97,7 +97,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
bool locate_track = FALSE;
|
bool locate_track = FALSE;
|
||||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
wxClientDC dc( DrawPanel );
|
wxClientDC dc( DrawPanel );
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ void WinEDA_PcbFrame::SetToolbars()
|
||||||
|
|
||||||
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
|
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
|
||||||
|
|
||||||
if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
if( GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
m_HToolBar->EnableTool( wxID_CUT, TRUE );
|
m_HToolBar->EnableTool( wxID_CUT, TRUE );
|
||||||
m_HToolBar->EnableTool( wxID_COPY, TRUE );
|
m_HToolBar->EnableTool( wxID_COPY, TRUE );
|
||||||
|
|
Loading…
Reference in New Issue