undo/redo rework: fixed some problems ans crashes (not all) in libedit and modedit
This commit is contained in:
parent
8d5a6531f9
commit
304525db9a
|
@ -219,7 +219,6 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
|
|||
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
|
||||
maxZoomIds = ( (size_t) maxZoomIds < GetScreen()->m_ZoomList.GetCount() ) ?
|
||||
maxZoomIds : GetScreen()->m_ZoomList.GetCount();
|
||||
wxLogDebug( _T( "%d zoom IDs used." ), maxZoomIds );
|
||||
|
||||
/* Populate zoom submenu. */
|
||||
for( i = 0; i < (size_t) maxZoomIds; i++ )
|
||||
|
|
|
@ -229,6 +229,19 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
/** Function SaveCopyInUndoList (overloaded).
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @param aItemsList = the list of items modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) )
|
||||
{
|
||||
// currently: do nothing in cvpcb.
|
||||
}
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
|
|||
CopyItem = CopyLibEntryStruct( this, (EDA_LibComponentStruct*) ItemToCopy );
|
||||
|
||||
lastcmd = new PICKED_ITEMS_LIST();
|
||||
ITEM_PICKER wrapper(CopyItem);
|
||||
ITEM_PICKER wrapper(CopyItem, UR_LIBEDIT);
|
||||
lastcmd->PushItem(wrapper);
|
||||
GetScreen()->PushCommandToUndoList( lastcmd );
|
||||
/* Clear current flags (which can be temporary set by a current edit command) */
|
||||
|
@ -34,17 +34,7 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
|
|||
item->m_Flags = 0;
|
||||
|
||||
/* Clear redo list, because after new save there is no redo to do */
|
||||
while( (lastcmd = GetScreen()->PopCommandFromRedoList( ) ) != NULL )
|
||||
{
|
||||
while ( 1 )
|
||||
{
|
||||
wrapper = lastcmd->PopItem();
|
||||
if ( wrapper.m_PickedItem == NULL )
|
||||
break; // All items are removed
|
||||
delete wrapper.m_PickedItem;
|
||||
}
|
||||
delete lastcmd;
|
||||
}
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +52,7 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList(wxCommandEvent& event)
|
|||
return;
|
||||
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
ITEM_PICKER wrapper(CurrentLibEntry);
|
||||
ITEM_PICKER wrapper(CurrentLibEntry, UR_LIBEDIT);
|
||||
lastcmd->PushItem(wrapper);
|
||||
GetScreen()->PushCommandToUndoList( lastcmd );
|
||||
|
||||
|
@ -95,7 +85,7 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList(wxCommandEvent& event)
|
|||
return;
|
||||
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
ITEM_PICKER wrapper(CurrentLibEntry);
|
||||
ITEM_PICKER wrapper(CurrentLibEntry, UR_LIBEDIT);
|
||||
lastcmd->PushItem(wrapper);
|
||||
GetScreen()->PushCommandToRedoList( lastcmd );
|
||||
|
||||
|
|
|
@ -509,6 +509,10 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
case UR_NEW: // Do nothing, items are in use
|
||||
break;
|
||||
|
||||
case UR_LIBEDIT: // Libedit save always a copy of the current item
|
||||
delete item; // So, the picker is always owner of the picked item
|
||||
break;
|
||||
|
||||
case UR_DELETED:
|
||||
delete item; // Delete the picked item, because it was deleted from schematic
|
||||
break;
|
||||
|
|
|
@ -175,6 +175,18 @@ public:
|
|||
const wxPoint& aTransformPoint = wxPoint(0,0) )
|
||||
{
|
||||
}
|
||||
/** Function SaveCopyInUndoList (overloaded).
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @param aItemsList = the list of items modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) )
|
||||
{
|
||||
// currently: do nothing in gerbview.
|
||||
}
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -60,7 +60,9 @@ enum UndoRedoOpType {
|
|||
UR_MIRRORED_Y, // mirrored item, undo by mirror Y
|
||||
UR_ROTATED, // Rotated item, undo by rotating it
|
||||
UR_FLIPPED, // flipped (board items only), undo by flipping it
|
||||
UR_WIRE_IMAGE // Specific to eeschema: handle wires changes
|
||||
UR_WIRE_IMAGE, // Specific to eeschema: handle wires changes
|
||||
UR_MODEDIT, // Specific to the module editor (modedit creates a full copy of the current module when changed)
|
||||
UR_LIBEDIT // Specific to the component editor (libedit creates a full copy of the current component when changed)
|
||||
};
|
||||
|
||||
class ITEM_PICKER
|
||||
|
|
|
@ -310,6 +310,16 @@ public:
|
|||
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) ) = 0;
|
||||
|
||||
/** Function SaveCopyInUndoList (virtual pure, overloaded).
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @param aItemsList = the list of items modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) ) = 0;
|
||||
|
||||
|
||||
// layerhandling:
|
||||
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UndoRedoOpType aTypeCommand,
|
||||
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) );
|
||||
|
||||
/** Function SaveCopyInUndoList (overloaded).
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
|
||||
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) );
|
||||
|
||||
/** Function PutDataInPreviousState()
|
||||
|
@ -650,9 +650,26 @@ public:
|
|||
|
||||
/* Undo and redo functions */
|
||||
public:
|
||||
virtual void SaveCopyInUndoList( BOARD_ITEM* ItemToCopy,
|
||||
UndoRedoOpType aTypeCommand = UR_UNSPECIFIED,
|
||||
/** Function SaveCopyInUndoList.
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a picker to handle aItemToCopy
|
||||
* @param aItem = the board item modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( BOARD_ITEM* aItem, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) );
|
||||
|
||||
/** Function SaveCopyInUndoList (overloaded).
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @param aItemsList = the list of items modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint(0,0) );
|
||||
|
||||
private:
|
||||
void GetComponentFromUndoList(wxCommandEvent& event);
|
||||
void GetComponentFromRedoList(wxCommandEvent& event);
|
||||
|
|
|
@ -152,7 +152,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_DELETE: /* Delete */
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
DeleteMarkedItems( Currentmodule );
|
||||
break;
|
||||
|
||||
|
@ -163,7 +163,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_ROTATE:
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
|
@ -173,7 +173,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_INVERT: /* mirror */
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
|
@ -240,14 +240,14 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
|||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
MoveMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: /* Copy */
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
break;
|
||||
|
||||
|
@ -258,12 +258,12 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
|||
case BLOCK_MIRROR_X:
|
||||
case BLOCK_MIRROR_Y:
|
||||
case BLOCK_INVERT: /* Mirror by popup menu, from block move */
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
MirrorMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
case BLOCK_ROTATE:
|
||||
SaveCopyInUndoList( Currentmodule );
|
||||
SaveCopyInUndoList( Currentmodule, UR_CHANGED );
|
||||
RotateMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.Centre() );
|
||||
break;
|
||||
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem );
|
||||
|
||||
|
||||
/** function TestForExistingItem
|
||||
* test if aItem exists somewhere in lists of items
|
||||
* This is a function unsed by PutDataInPreviousState to be sure an item was not deleted
|
||||
|
@ -123,61 +126,66 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
|||
}
|
||||
|
||||
int layer, layerimg;
|
||||
layer = aItem->GetLayer();
|
||||
layer = aItem->GetLayer();
|
||||
layerimg = aImage->GetLayer();
|
||||
aItem->SetLayer(layerimg);
|
||||
aImage->SetLayer(layer);
|
||||
aItem->SetLayer( layerimg );
|
||||
aImage->SetLayer( layer );
|
||||
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case TYPE_MODULE:
|
||||
wxMessageBox( wxT( "SwapData(): TYPE_MODULE not handled" ) );
|
||||
break;
|
||||
{
|
||||
MODULE* m_tmp = (MODULE*) DuplicateStruct( aImage );
|
||||
( (MODULE*) aImage )->Copy( (MODULE*) aItem );
|
||||
( (MODULE*) aItem )->Copy( m_tmp );
|
||||
delete m_tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
wxMessageBox( wxT( "SwapData(): TYPE_ZONE_CONTAINER not handled" ) );
|
||||
break;
|
||||
|
||||
case TYPE_DRAWSEGMENT:
|
||||
EXCHG( ((TRACK*)aItem)->m_Start, ((TRACK*)aImage)->m_Start);
|
||||
EXCHG( ((TRACK*)aItem)->m_End, ((TRACK*)aImage)->m_End);
|
||||
EXCHG( ((TRACK*)aItem)->m_Width, ((TRACK*)aImage)->m_Width);
|
||||
EXCHG( ((TRACK*)aItem)->m_Shape, ((TRACK*)aImage)->m_Shape);
|
||||
EXCHG( ( (TRACK*) aItem )->m_Start, ( (TRACK*) aImage )->m_Start );
|
||||
EXCHG( ( (TRACK*) aItem )->m_End, ( (TRACK*) aImage )->m_End );
|
||||
EXCHG( ( (TRACK*) aItem )->m_Width, ( (TRACK*) aImage )->m_Width );
|
||||
EXCHG( ( (TRACK*) aItem )->m_Shape, ( (TRACK*) aImage )->m_Shape );
|
||||
break;
|
||||
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
case TYPE_ZONE:
|
||||
EXCHG( ((TRACK*)aItem)->m_Start, ((TRACK*)aImage)->m_Start);
|
||||
EXCHG( ((TRACK*)aItem)->m_End, ((TRACK*)aImage)->m_End);
|
||||
EXCHG( ((TRACK*)aItem)->m_Width, ((TRACK*)aImage)->m_Width);
|
||||
EXCHG( ((TRACK*)aItem)->m_Shape, ((TRACK*)aImage)->m_Shape);
|
||||
break;
|
||||
EXCHG( ( (TRACK*) aItem )->m_Start, ( (TRACK*) aImage )->m_Start );
|
||||
EXCHG( ( (TRACK*) aItem )->m_End, ( (TRACK*) aImage )->m_End );
|
||||
EXCHG( ( (TRACK*) aItem )->m_Width, ( (TRACK*) aImage )->m_Width );
|
||||
EXCHG( ( (TRACK*) aItem )->m_Shape, ( (TRACK*) aImage )->m_Shape );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Mirror, ((TEXTE_PCB*)aImage)->m_Mirror);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Size, ((TEXTE_PCB*)aImage)->m_Size);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Pos, ((TEXTE_PCB*)aImage)->m_Pos);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Width, ((TEXTE_PCB*)aImage)->m_Width);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Orient, ((TEXTE_PCB*)aImage)->m_Orient);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Text, ((TEXTE_PCB*)aImage)->m_Text);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Italic, ((TEXTE_PCB*)aImage)->m_Italic);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_Bold, ((TEXTE_PCB*)aImage)->m_Bold);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_HJustify, ((TEXTE_PCB*)aImage)->m_HJustify);
|
||||
EXCHG( ((TEXTE_PCB*)aItem)->m_VJustify, ((TEXTE_PCB*)aImage)->m_VJustify);
|
||||
break;
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Mirror, ( (TEXTE_PCB*) aImage )->m_Mirror );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Size, ( (TEXTE_PCB*) aImage )->m_Size );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Pos, ( (TEXTE_PCB*) aImage )->m_Pos );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Width, ( (TEXTE_PCB*) aImage )->m_Width );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Orient, ( (TEXTE_PCB*) aImage )->m_Orient );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Text, ( (TEXTE_PCB*) aImage )->m_Text );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Italic, ( (TEXTE_PCB*) aImage )->m_Italic );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_Bold, ( (TEXTE_PCB*) aImage )->m_Bold );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_HJustify, ( (TEXTE_PCB*) aImage )->m_HJustify );
|
||||
EXCHG( ( (TEXTE_PCB*) aItem )->m_VJustify, ( (TEXTE_PCB*) aImage )->m_VJustify );
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
EXCHG(((MIREPCB*)aItem)->m_Pos,((MIREPCB*)aImage)->m_Pos);
|
||||
EXCHG(((MIREPCB*)aItem)->m_Width, ((MIREPCB*)aImage)->m_Width);
|
||||
EXCHG(((MIREPCB*)aItem)->m_Size, ((MIREPCB*)aImage)->m_Size);
|
||||
EXCHG(((MIREPCB*)aItem)->m_Shape, ((MIREPCB*)aImage)->m_Shape);
|
||||
break;
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Pos, ( (MIREPCB*) aImage )->m_Pos );
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Width, ( (MIREPCB*) aImage )->m_Width );
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Size, ( (MIREPCB*) aImage )->m_Size );
|
||||
EXCHG( ( (MIREPCB*) aItem )->m_Shape, ( (MIREPCB*) aImage )->m_Shape );
|
||||
break;
|
||||
|
||||
case TYPE_COTATION:
|
||||
EXCHG(((COTATION*)aItem)->m_Text->m_Size, ((COTATION*)aImage)->m_Text->m_Size);
|
||||
EXCHG(((COTATION*)aItem)->m_Text->m_Width, ((COTATION*)aImage)->m_Text->m_Width);
|
||||
EXCHG(((COTATION*)aItem)->m_Text->m_Mirror, ((COTATION*)aImage)->m_Text->m_Mirror);
|
||||
EXCHG( ( (COTATION*) aItem )->m_Text->m_Size, ( (COTATION*) aImage )->m_Text->m_Size );
|
||||
EXCHG( ( (COTATION*) aItem )->m_Text->m_Width, ( (COTATION*) aImage )->m_Text->m_Width );
|
||||
EXCHG( ( (COTATION*) aItem )->m_Text->m_Mirror, ( (COTATION*) aImage )->m_Text->m_Mirror );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -206,7 +214,7 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
|||
case TYPE_MODULE:
|
||||
{
|
||||
MODULE* new_module;
|
||||
new_module = new MODULE( (BOARD*)aItem->GetParent() );
|
||||
new_module = new MODULE( (BOARD*) aItem->GetParent() );
|
||||
new_module->Copy( (MODULE*) aItem );
|
||||
return new_module;
|
||||
}
|
||||
|
@ -231,15 +239,15 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
|||
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
{
|
||||
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*)aItem->GetParent() );
|
||||
new_zone->Copy( (ZONE_CONTAINER*)aItem );
|
||||
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) aItem->GetParent() );
|
||||
new_zone->Copy( (ZONE_CONTAINER*) aItem );
|
||||
return new_zone;
|
||||
}
|
||||
|
||||
case TYPE_DRAWSEGMENT:
|
||||
{
|
||||
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( aItem->GetParent() );
|
||||
new_drawsegment->Copy( (DRAWSEGMENT*)aItem );
|
||||
new_drawsegment->Copy( (DRAWSEGMENT*) aItem );
|
||||
return new_drawsegment;
|
||||
}
|
||||
break;
|
||||
|
@ -247,7 +255,7 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
|||
case TYPE_TEXTE:
|
||||
{
|
||||
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( aItem->GetParent() );
|
||||
new_pcbtext->Copy( (TEXTE_PCB*)aItem );
|
||||
new_pcbtext->Copy( (TEXTE_PCB*) aItem );
|
||||
return new_pcbtext;
|
||||
}
|
||||
break;
|
||||
|
@ -255,7 +263,7 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
|
|||
case TYPE_MIRE:
|
||||
{
|
||||
MIREPCB* new_mire = new MIREPCB( aItem->GetParent() );
|
||||
new_mire->Copy( (MIREPCB*)aItem );
|
||||
new_mire->Copy( (MIREPCB*) aItem );
|
||||
return new_mire;
|
||||
}
|
||||
break;
|
||||
|
@ -369,21 +377,19 @@ void WinEDA_PcbFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
|||
|
||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) aItemsList.GetPickedItem( ii );
|
||||
UndoRedoOpType command = aItemsList.GetPickedItemStatus( ii );
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) aItemsList.GetPickedItem( ii );
|
||||
UndoRedoOpType command = aItemsList.GetPickedItemStatus( ii );
|
||||
if( command == UR_UNSPECIFIED )
|
||||
{
|
||||
command = aTypeCommand;
|
||||
}
|
||||
|
||||
wxASSERT( item );
|
||||
itemWrapper.m_PickedItem = item;
|
||||
itemWrapper.m_PickedItemType = item->Type();
|
||||
itemWrapper.m_UndoRedoStatus = command;
|
||||
switch( command )
|
||||
{
|
||||
case UR_CHANGED: /* Create a copy of schematic */
|
||||
case UR_CHANGED: /* Create a copy of item, and put in undo list */
|
||||
CopyOfItem = DuplicateStruct( item );
|
||||
itemWrapper.m_PickedItem = item;
|
||||
itemWrapper.m_Link = CopyOfItem;
|
||||
if( CopyOfItem )
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
|
@ -434,9 +440,9 @@ void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRe
|
|||
|
||||
for( unsigned ii = 0; ii < aList->GetCount(); ii++ )
|
||||
{
|
||||
item = (BOARD_ITEM*) aList->GetPickedItem(ii);
|
||||
item = (BOARD_ITEM*) aList->GetPickedItem( ii );
|
||||
wxASSERT( item );
|
||||
if( aList->GetPickedItemStatus(ii) != UR_DELETED )
|
||||
if( aList->GetPickedItemStatus( ii ) != UR_DELETED )
|
||||
{
|
||||
if( !TestForExistingItem( GetBoard(), item ) )
|
||||
{
|
||||
|
@ -449,48 +455,29 @@ void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRe
|
|||
}
|
||||
}
|
||||
item->m_Flags = 0;
|
||||
|
||||
// see if one must rebuild ratsnets and pointers lists
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_MODULE:
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
reBuild_ratsnest = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case TYPE_MODULE:
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
reBuild_ratsnest = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch( aList->GetPickedItemStatus(ii) )
|
||||
switch( aList->GetPickedItemStatus( ii ) )
|
||||
{
|
||||
case UR_CHANGED: /* Exchange old and new data for each item */
|
||||
{
|
||||
BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink(ii);
|
||||
// Note modules and zones containers have a lot of data
|
||||
// so items and thier copy are swapped, not just edited data
|
||||
// The main drawback is pointers on these items must be rebuilt
|
||||
// but often, this is needed by connectivity change,
|
||||
// so this is not really an important drawback in this function
|
||||
// Could change later
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_MODULE:
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
// Swap the item and its copy
|
||||
GetBoard()->Remove(item);
|
||||
GetBoard()->Add(image);
|
||||
aList->SetPickedItem(image, ii);
|
||||
aList->SetPickedItemLink(item, ii);
|
||||
break;
|
||||
|
||||
default:
|
||||
// For other items: swap editable data only
|
||||
SwapData( item, image );
|
||||
break;
|
||||
}
|
||||
BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
|
||||
SwapData( item, image );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case UR_NEW: /* new items are deleted */
|
||||
aList->SetPickedItemStatus( UR_DELETED, ii );
|
||||
|
@ -503,7 +490,7 @@ void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRe
|
|||
break;
|
||||
|
||||
case UR_MOVED:
|
||||
item->Move( aRedoCommand ? aList->m_TransformPoint : - aList->m_TransformPoint );
|
||||
item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
|
||||
break;
|
||||
|
||||
case UR_ROTATED:
|
||||
|
@ -518,8 +505,8 @@ void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRe
|
|||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT(
|
||||
"PutDataInPreviousState() error (unknown code %X)" ),
|
||||
aList->GetPickedItemStatus(ii) );
|
||||
"PutDataInPreviousState() error (unknown code %X)" ),
|
||||
aList->GetPickedItemStatus( ii ) );
|
||||
wxMessageBox( msg );
|
||||
}
|
||||
break;
|
||||
|
@ -538,6 +525,7 @@ void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRe
|
|||
/**********************************************************/
|
||||
void WinEDA_PcbFrame::GetBoardFromUndoList( wxCommandEvent& event )
|
||||
/**********************************************************/
|
||||
|
||||
/** Function GetBoardFromUndoList
|
||||
* Undo the last edition:
|
||||
* - Save the current board in Redo list
|
||||
|
@ -610,7 +598,7 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
unsigned icnt = aList.m_CommandsList.size();
|
||||
if( aItemCount > 0 )
|
||||
icnt = aItemCount;
|
||||
bool displ_error = true;
|
||||
bool displ_error = true;
|
||||
for( unsigned ii = 0; ii < icnt; ii++ )
|
||||
{
|
||||
if( aList.m_CommandsList.size() == 0 )
|
||||
|
@ -621,16 +609,17 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
// Delete items is they are not flagged UR_NEW, or if this is a block operation
|
||||
while( 1 )
|
||||
{
|
||||
ITEM_PICKER wrapper = curr_cmd->PopItem();
|
||||
ITEM_PICKER wrapper = curr_cmd->PopItem();
|
||||
if( wrapper.m_PickedItem == NULL ) // No more item in list.
|
||||
break;
|
||||
switch( wrapper.m_UndoRedoStatus )
|
||||
{
|
||||
case UR_UNSPECIFIED:
|
||||
if( displ_error )
|
||||
wxMessageBox(wxT("ClearUndoORRedoList() error: unspecified item type"));
|
||||
wxMessageBox( wxT( "ClearUndoORRedoList() error: unspecified item type" ) );
|
||||
displ_error = false;
|
||||
break;
|
||||
|
||||
case UR_MOVED:
|
||||
case UR_FLIPPED:
|
||||
case UR_MIRRORED_X:
|
||||
|
@ -643,7 +632,14 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
|
|||
delete wrapper.m_Link; // the picker is owner of this item
|
||||
break;
|
||||
|
||||
default:
|
||||
case UR_MODEDIT: /* Specific to the module editor
|
||||
* (modedit creates a full copy of the current module when changed),
|
||||
* and the picker is owner of this item
|
||||
*/
|
||||
delete wrapper.m_PickedItem;
|
||||
break;
|
||||
|
||||
default:
|
||||
delete wrapper.m_PickedItem; // the picker is owner of this item
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,8 @@ void MODULE::Copy( MODULE* aModule )
|
|||
m_Reference->Copy( aModule->m_Reference );
|
||||
m_Value->Copy( aModule->m_Value );
|
||||
|
||||
/* Copie des structures auxiliaires: Pads */
|
||||
/* Copy auxiliary data: Pads */
|
||||
m_Pads.DeleteAll();
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
D_PAD* newpad = new D_PAD( this );
|
||||
|
@ -111,7 +112,8 @@ void MODULE::Copy( MODULE* aModule )
|
|||
m_Pads.PushBack( newpad );
|
||||
}
|
||||
|
||||
/* Copy des structures auxiliaires: Drawings */
|
||||
/* Copy auxiliary data: Drawings */
|
||||
m_Drawings.DeleteAll();
|
||||
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
|
@ -131,11 +133,13 @@ void MODULE::Copy( MODULE* aModule )
|
|||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "Internal Err: CopyModule: type indefini" ) );
|
||||
wxMessageBox( wxT( "MODULE::Copy() Internal Err: unknown type" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy auxiliary data: 3D_Drawings info */
|
||||
m_3D_Drawings.DeleteAll();
|
||||
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if ( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
||||
|
|
|
@ -191,8 +191,7 @@ void D_PAD::Copy( D_PAD* source )
|
|||
m_Offset = source->m_Offset; // Offset de la forme
|
||||
m_Size = source->m_Size; // Dimension ( pour orient 0 )
|
||||
m_DeltaSize = source->m_DeltaSize; // delta sur formes rectangle -> trapezes
|
||||
m_Pos0 = source->m_Pos0; // Coord relatives a l'ancre du pad en
|
||||
// orientation 0
|
||||
m_Pos0 = source->m_Pos0; /* Coord relatives a l'ancre du pad en orientation 0 */
|
||||
m_Rayon = source->m_Rayon; // rayon du cercle exinscrit du pad
|
||||
m_PadShape = source->m_PadShape; // forme CERCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID ou libre
|
||||
m_Attribut = source->m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, Bit 7 = STACK
|
||||
|
|
|
@ -60,15 +60,11 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
|
|||
{
|
||||
if( Edge == NULL )
|
||||
return;
|
||||
Edge->m_Start.x -= MoveVector.x;
|
||||
Edge->m_Start.y -= MoveVector.y;
|
||||
Edge->m_End.x -= MoveVector.x;
|
||||
Edge->m_End.y -= MoveVector.y;
|
||||
Edge->m_Start -= MoveVector;
|
||||
Edge->m_End -= MoveVector;
|
||||
|
||||
Edge->m_Start0.x -= MoveVector.x;
|
||||
Edge->m_Start0.y -= MoveVector.y;
|
||||
Edge->m_End0.x -= MoveVector.x;
|
||||
Edge->m_End0.y -= MoveVector.y;
|
||||
Edge->m_Start0 -= MoveVector;
|
||||
Edge->m_End0 -= MoveVector;
|
||||
|
||||
Edge->Draw( DrawPanel, DC, GR_OR );
|
||||
Edge->m_Flags = 0;
|
||||
|
@ -131,10 +127,8 @@ static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
Edge->m_End = screen->m_Curseur;
|
||||
|
||||
/* Mise a jour des coord relatives */
|
||||
Edge->m_End0.x = Edge->m_End.x - Module->m_Pos.x;
|
||||
Edge->m_End0.y = Edge->m_End.y - Module->m_Pos.y;
|
||||
RotatePoint( (int*) &Edge->m_End0.x,
|
||||
(int*) &Edge->m_End0.y, -Module->m_Orient );
|
||||
Edge->m_End0 = Edge->m_End - Module->m_Pos;
|
||||
RotatePoint( &Edge->m_End0, -Module->m_Orient );
|
||||
|
||||
Edge->Draw( panel, DC, GR_XOR );
|
||||
|
||||
|
@ -155,7 +149,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge )
|
|||
{
|
||||
MODULE* Module = GetBoard()->m_Modules;
|
||||
|
||||
SaveCopyInUndoList( Module );
|
||||
SaveCopyInUndoList( Module, UR_MODEDIT );
|
||||
|
||||
if( Edge == NULL )
|
||||
{
|
||||
|
@ -205,7 +199,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
|
|||
return;
|
||||
}
|
||||
|
||||
SaveCopyInUndoList( Module );
|
||||
SaveCopyInUndoList( Module, UR_MODEDIT );
|
||||
|
||||
if( Edge == NULL )
|
||||
{
|
||||
|
@ -341,7 +335,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
|
||||
if( Edge == NULL ) /* Start a new edge item */
|
||||
{
|
||||
SaveCopyInUndoList( module );
|
||||
SaveCopyInUndoList( module, UR_MODEDIT );
|
||||
|
||||
Edge = new EDGE_MODULE( module );
|
||||
MoveVector.x = MoveVector.y = 0;
|
||||
|
@ -372,11 +366,9 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
Edge->m_End = Edge->m_Start;
|
||||
|
||||
/* Initialise the relative coordinates */
|
||||
Edge->m_Start0.x = Edge->m_Start.x - module->m_Pos.x;
|
||||
Edge->m_Start0.y = Edge->m_Start.y - module->m_Pos.y;
|
||||
Edge->m_Start0 = Edge->m_Start - module->m_Pos;
|
||||
|
||||
RotatePoint( (int*) &Edge->m_Start0.x,
|
||||
(int*) &Edge->m_Start0.y, -module->m_Orient );
|
||||
RotatePoint( &Edge->m_Start0, -module->m_Orient );
|
||||
|
||||
Edge->m_End0 = Edge->m_Start0;
|
||||
module->Set_Rectangle_Encadrement();
|
||||
|
@ -401,9 +393,9 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
|
||||
// insert _after_ Edge, which is the same as inserting _before_ Edge->Next()
|
||||
module->m_Drawings.Insert( newedge, Edge->Next() );
|
||||
|
||||
Edge->m_Flags = 0;
|
||||
Edge = newedge;
|
||||
|
||||
Edge = newedge; // point now new item
|
||||
|
||||
Edge->m_Flags = IS_NEW;
|
||||
Edge->m_Width = ModuleSegmentWidth;
|
||||
|
@ -411,11 +403,9 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
Edge->m_End = Edge->m_Start;
|
||||
|
||||
/* Mise a jour des coord relatives */
|
||||
Edge->m_Start0.x = Edge->m_Start.x - module->m_Pos.x;
|
||||
Edge->m_Start0.y = Edge->m_Start.y - module->m_Pos.y;
|
||||
Edge->m_Start0 = Edge->m_Start - module->m_Pos;
|
||||
|
||||
RotatePoint( (int*) &Edge->m_Start0.x,
|
||||
(int*) &Edge->m_Start0.y, -module->m_Orient );
|
||||
RotatePoint( &Edge->m_Start0, -module->m_Orient );
|
||||
|
||||
Edge->m_End0 = Edge->m_Start0;
|
||||
|
||||
|
@ -425,7 +415,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
}
|
||||
}
|
||||
else
|
||||
DisplayError( this, wxT( "Begin_Edge() error" ) );
|
||||
wxMessageBox( wxT( "Begin_Edge() error" ) );
|
||||
}
|
||||
return Edge;
|
||||
}
|
||||
|
@ -439,16 +429,13 @@ void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
|
|||
{
|
||||
MODULE* Module = GetBoard()->m_Modules;
|
||||
|
||||
/* If last segment length is 0: deletion */
|
||||
if( Edge )
|
||||
{
|
||||
if( (Edge->m_Start.x == Edge->m_End.x)
|
||||
&& (Edge->m_Start.y == Edge->m_End.y) )
|
||||
{
|
||||
Edge->m_Flags = 0;
|
||||
/* If last segment length is 0: remove it */
|
||||
if( Edge->m_Start == Edge->m_End )
|
||||
Edge ->DeleteStructure();
|
||||
}
|
||||
}
|
||||
Edge->m_Flags = 0;
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
GetScreen()->SetModify();
|
||||
|
|
|
@ -821,6 +821,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
|
||||
Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
|
||||
break;
|
||||
|
||||
|
@ -835,6 +836,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_DELETE_PAD:
|
||||
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
|
||||
DeletePad( (D_PAD*) GetCurItem() );
|
||||
SetCurItem( NULL );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
|
|
@ -110,7 +110,6 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
|
|||
}
|
||||
|
||||
pt_mod->Set_Rectangle_Encadrement();
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -475,20 +475,20 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_DELETE_PAD:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
DeletePad( (D_PAD*) GetScreen()->GetCurItem() );
|
||||
SetCurItem( NULL );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
@ -526,7 +526,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() );
|
||||
SetCurItem( NULL );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
@ -586,7 +586,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_DELETE_EDGE:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
RemoveStruct( GetScreen()->GetCurItem() );
|
||||
SetCurItem( NULL );
|
||||
|
@ -597,7 +597,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_MODEDIT_MODULE_SCALE:
|
||||
case ID_MODEDIT_MODULE_SCALEX:
|
||||
case ID_MODEDIT_MODULE_SCALEY:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
Transform( (MODULE*) GetScreen()->GetCurItem(), id );
|
||||
redraw = true;
|
||||
break;
|
||||
|
|
|
@ -31,12 +31,12 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( DrawStruct->Type() )
|
||||
{
|
||||
case TYPE_TEXTE_MODULE:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
|
||||
break;
|
||||
|
||||
case TYPE_EDGE_MODULE:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
Place_EdgeMod( (EDGE_MODULE*) DrawStruct, DC );
|
||||
break;
|
||||
|
||||
|
@ -118,7 +118,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
DrawStruct = ModeditLocateAndDisplay();
|
||||
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
RemoveStruct( DrawStruct );
|
||||
SetCurItem( DrawStruct = NULL );
|
||||
}
|
||||
|
@ -126,26 +126,30 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
|
||||
case ID_MODEDIT_PLACE_ANCHOR:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
Place_Ancre( GetBoard()->m_Modules );
|
||||
GetBoard()->m_Modules->m_Flags = 0;
|
||||
{
|
||||
MODULE * module = GetBoard()->m_Modules;
|
||||
module->m_Flags = 0;
|
||||
SaveCopyInUndoList( module, UR_MODEDIT );
|
||||
Place_Ancre( module ); // set the new relatives internal coordinates of items
|
||||
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
||||
Recadre_Trace( TRUE );
|
||||
Place_Module( GetBoard()->m_Modules, DC );
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
// Replace the module in position 0, to recalculate absolutes coordinates of items
|
||||
module->SetPosition( wxPoint(0,0) );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
SetCurItem( NULL );
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_TEXT_COMMENT_BUTT:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
CreateTextModule( GetBoard()->m_Modules, DC );
|
||||
break;
|
||||
|
||||
case ID_MODEDIT_ADD_PAD:
|
||||
if( GetBoard()->m_Modules )
|
||||
{
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules );
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
AddPad( GetBoard()->m_Modules, true );
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -12,23 +12,28 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* ItemToCopy,
|
||||
UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint )
|
||||
/************************************************************************/
|
||||
/** Function SaveCopyInUndoList.
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a picker to handle aItemToCopy
|
||||
* @param aItem = the board item modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* aItem,
|
||||
UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint )
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
MODULE* CopyItem;
|
||||
EDA_BaseStruct* item;
|
||||
MODULE* CopyItem;
|
||||
PICKED_ITEMS_LIST* lastcmd;
|
||||
|
||||
CopyItem = new MODULE( GetBoard() );
|
||||
CopyItem->Copy( (MODULE*) ItemToCopy );
|
||||
CopyItem->Copy( (MODULE*) aItem );
|
||||
CopyItem->SetParent( GetBoard() );
|
||||
|
||||
lastcmd = new PICKED_ITEMS_LIST();
|
||||
ITEM_PICKER wrapper(CopyItem);
|
||||
lastcmd->PushItem(wrapper);
|
||||
ITEM_PICKER wrapper( CopyItem, UR_MODEDIT );
|
||||
lastcmd->PushItem( wrapper );
|
||||
|
||||
GetScreen()->PushCommandToUndoList( lastcmd );
|
||||
/* Clear current flags (which can be temporary set by a current edit command) */
|
||||
|
@ -36,22 +41,28 @@ void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* ItemToCopy,
|
|||
item->m_Flags = 0;
|
||||
|
||||
/* Clear redo list, because after new save there is no redo to do */
|
||||
while( (lastcmd = GetScreen()->PopCommandFromRedoList( ) ) != NULL )
|
||||
{
|
||||
while ( 1 )
|
||||
{
|
||||
wrapper = lastcmd->PopItem();
|
||||
if ( wrapper.m_PickedItem == NULL )
|
||||
break; // All items are removed
|
||||
delete wrapper.m_PickedItem;
|
||||
}
|
||||
delete lastcmd;
|
||||
}
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
||||
}
|
||||
|
||||
|
||||
/** Function SaveCopyInUndoList (overloaded).
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @param aItemsList = the list of items modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
||||
* @param aTransformPoint = the reference point of the transformation, for commands like move
|
||||
*/
|
||||
void WinEDA_ModuleEditFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
||||
UndoRedoOpType aTypeCommand,
|
||||
const wxPoint& aTransformPoint )
|
||||
{
|
||||
// Currently Unused in modedit
|
||||
wxMessageBox( wxT( "SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList..) not yet in use" ) );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void WinEDA_ModuleEditFrame::GetComponentFromRedoList(wxCommandEvent& event)
|
||||
void WinEDA_ModuleEditFrame::GetComponentFromRedoList( wxCommandEvent& event )
|
||||
/*********************************************************/
|
||||
|
||||
/* Redo the last edition:
|
||||
|
@ -59,15 +70,15 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList(wxCommandEvent& event)
|
|||
* - Get old version of the current edited library component
|
||||
*/
|
||||
{
|
||||
if ( GetScreen()->GetRedoCommandCount() <= 0 )
|
||||
if( GetScreen()->GetRedoCommandCount() <= 0 )
|
||||
return;
|
||||
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
ITEM_PICKER wrapper( GetBoard()->m_Modules.PopFront() );
|
||||
lastcmd->PushItem(wrapper);
|
||||
ITEM_PICKER wrapper( GetBoard()->m_Modules.PopFront(), UR_MODEDIT );
|
||||
lastcmd->PushItem( wrapper );
|
||||
GetScreen()->PushCommandToUndoList( lastcmd );
|
||||
|
||||
lastcmd = GetScreen()->PopCommandFromRedoList( );
|
||||
lastcmd = GetScreen()->PopCommandFromRedoList();
|
||||
|
||||
wrapper = lastcmd->PopItem();
|
||||
|
||||
|
@ -82,7 +93,7 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList(wxCommandEvent& event)
|
|||
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_ModuleEditFrame::GetComponentFromUndoList(wxCommandEvent& event)
|
||||
void WinEDA_ModuleEditFrame::GetComponentFromUndoList( wxCommandEvent& event )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Undo the last edition:
|
||||
|
@ -90,15 +101,15 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList(wxCommandEvent& event)
|
|||
* - Get old version of the current edited library component
|
||||
*/
|
||||
{
|
||||
if ( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||
return;
|
||||
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
ITEM_PICKER wrapper(GetBoard()->m_Modules.PopFront());
|
||||
lastcmd->PushItem(wrapper);
|
||||
ITEM_PICKER wrapper( GetBoard()->m_Modules.PopFront(), UR_MODEDIT );
|
||||
lastcmd->PushItem( wrapper );
|
||||
GetScreen()->PushCommandToRedoList( lastcmd );
|
||||
|
||||
lastcmd = GetScreen()->PopCommandFromUndoList( );
|
||||
lastcmd = GetScreen()->PopCommandFromUndoList();
|
||||
|
||||
wrapper = lastcmd->PopItem();
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "confirm.h"
|
||||
#include "pcbnew.h"
|
||||
#include "trigo.h"
|
||||
#include "block_commande.h"
|
||||
|
||||
#include "drag.h"
|
||||
|
||||
|
@ -310,7 +311,6 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
{
|
||||
int dX, dY;
|
||||
TRACK* Track;
|
||||
DRAG_SEGM* pt_drag;
|
||||
MODULE* Module;
|
||||
|
||||
if( Pad == NULL )
|
||||
|
@ -318,13 +318,60 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
|
||||
Module = (MODULE*) Pad->GetParent();
|
||||
|
||||
ITEM_PICKER picker(NULL, UR_CHANGED);
|
||||
PICKED_ITEMS_LIST pickList;
|
||||
|
||||
/* Save dragged track segments in undo list */
|
||||
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
Track = pt_drag->m_Segm;
|
||||
// Set the old state
|
||||
wxPoint t_start = Track->m_Start;
|
||||
wxPoint t_end = Track->m_End;
|
||||
if( pt_drag->m_Pad_Start )
|
||||
Track->m_Start = Pad_OldPos;
|
||||
if( pt_drag->m_Pad_End )
|
||||
Track->m_End = Pad_OldPos;
|
||||
|
||||
picker.m_PickedItem = Track;
|
||||
pickList.PushItem(picker);
|
||||
}
|
||||
|
||||
/* Save old module and old items values */
|
||||
wxPoint pad_curr_position = Pad->m_Pos;
|
||||
|
||||
Pad->m_Pos = Pad_OldPos;
|
||||
if ( g_DragSegmentList == NULL )
|
||||
SaveCopyInUndoList( Module, UR_CHANGED );
|
||||
else
|
||||
{
|
||||
picker.m_PickedItem = Module;
|
||||
pickList.PushItem(picker);
|
||||
}
|
||||
|
||||
|
||||
if ( g_DragSegmentList )
|
||||
SaveCopyInUndoList( pickList, UR_CHANGED );
|
||||
|
||||
/* Placement du pad */
|
||||
Pad->m_Pos = pad_curr_position;
|
||||
|
||||
Pad->Draw( DrawPanel, DC, GR_XOR );
|
||||
|
||||
/* Save old module */
|
||||
Pad->m_Pos = Pad_OldPos;
|
||||
SaveCopyInUndoList( Module, UR_CHANGED );
|
||||
Pad->m_Pos = GetScreen()->m_Curseur;
|
||||
/* Redraw dragged track segments */
|
||||
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
Track = pt_drag->m_Segm;
|
||||
// Set the new state
|
||||
if( pt_drag->m_Pad_Start )
|
||||
Track->m_Start = Pad->m_Pos;
|
||||
if( pt_drag->m_Pad_End )
|
||||
Track->m_End = Pad->m_Pos;
|
||||
|
||||
Track->SetState( EDIT, OFF );
|
||||
if ( DC )
|
||||
Track->Draw( DrawPanel, DC, GR_OR );
|
||||
}
|
||||
|
||||
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0)*/
|
||||
dX = Pad->m_Pos.x - Pad_OldPos.x;
|
||||
|
@ -342,15 +389,6 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
Module->Set_Rectangle_Encadrement();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
/* Tracage des segments dragges */
|
||||
pt_drag = g_DragSegmentList;
|
||||
for( ; pt_drag; pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
Track = pt_drag->m_Segm;
|
||||
Track->SetState( EDIT, OFF );
|
||||
if ( DC )
|
||||
Track->Draw( DrawPanel, DC, GR_OR );
|
||||
}
|
||||
|
||||
EraseDragListe();
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
|
||||
#include "pcbnew.h"
|
||||
#include "wxPcbStruct.h"
|
||||
|
||||
//#include "autorout.h"
|
||||
#include "id.h"
|
||||
#include "hotkeys.h"
|
||||
#include "collectors.h"
|
||||
|
||||
//#include "protos.h"
|
||||
|
||||
|
||||
|
@ -40,7 +42,7 @@ static wxMenu* Append_Track_Width_List()
|
|||
trackwidth_menu = new wxMenu;
|
||||
|
||||
ADD_MENUITEM( trackwidth_menu, ID_PCB_TRACK_SIZE_SETUP,
|
||||
_( "New Width/Size" ), showtrack_xpm );
|
||||
_( "New Width/Size" ), showtrack_xpm );
|
||||
|
||||
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH,
|
||||
_( "Auto Width" ),
|
||||
|
@ -56,8 +58,8 @@ static wxMenu* Append_Track_Width_List()
|
|||
if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
|
||||
break;
|
||||
value = To_User_Unit( g_UnitMetric,
|
||||
g_DesignSettings.m_TrackWidthHistory[ii],
|
||||
PCB_INTERNAL_UNIT );
|
||||
g_DesignSettings.m_TrackWidthHistory[ii],
|
||||
PCB_INTERNAL_UNIT );
|
||||
if( g_UnitMetric == INCHES ) // Affichage en mils
|
||||
msg.Printf( _( "Track %.1f" ), value * 1000 );
|
||||
else
|
||||
|
@ -66,7 +68,7 @@ static wxMenu* Append_Track_Width_List()
|
|||
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE );
|
||||
|
||||
if( (g_DesignSettings.m_TrackWidthHistory[ii] == g_DesignSettings.m_CurrentTrackWidth)
|
||||
&& ! g_DesignSettings.m_UseConnectedTrackWidth )
|
||||
&& !g_DesignSettings.m_UseConnectedTrackWidth )
|
||||
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE );
|
||||
}
|
||||
|
||||
|
@ -76,8 +78,8 @@ static wxMenu* Append_Track_Width_List()
|
|||
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
|
||||
break;
|
||||
value = To_User_Unit( g_UnitMetric,
|
||||
g_DesignSettings.m_ViaSizeHistory[ii],
|
||||
PCB_INTERNAL_UNIT );
|
||||
g_DesignSettings.m_ViaSizeHistory[ii],
|
||||
PCB_INTERNAL_UNIT );
|
||||
if( g_UnitMetric == INCHES )
|
||||
msg.Printf( _( "Via %.1f" ), value * 1000 );
|
||||
else
|
||||
|
@ -124,12 +126,12 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( item && item->m_Flags )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel" ), cancel_xpm );
|
||||
_( "Cancel" ), cancel_xpm );
|
||||
}
|
||||
else
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
|
||||
_( "End Tool" ), cancel_tool_xpm );
|
||||
_( "End Tool" ), cancel_tool_xpm );
|
||||
}
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
|
@ -138,7 +140,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( item && item->m_Flags )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel" ), cancel_xpm );
|
||||
_( "Cancel" ), cancel_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
}
|
||||
|
@ -197,23 +199,23 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( !( (MODULE*) item )->IsLocked() )
|
||||
{
|
||||
msg = AddHotkeyName( _(
|
||||
"Lock Module" ), s_Board_Editor_Hokeys_Descr,
|
||||
HK_LOCK_UNLOCK_FOOTPRINT );
|
||||
"Lock Module" ), s_Board_Editor_Hokeys_Descr,
|
||||
HK_LOCK_UNLOCK_FOOTPRINT );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, msg,
|
||||
locked_xpm );
|
||||
locked_xpm );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = AddHotkeyName( _(
|
||||
"Unlock Module" ), s_Board_Editor_Hokeys_Descr,
|
||||
HK_LOCK_UNLOCK_FOOTPRINT );
|
||||
"Unlock Module" ), s_Board_Editor_Hokeys_Descr,
|
||||
HK_LOCK_UNLOCK_FOOTPRINT );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg,
|
||||
unlocked_xpm );
|
||||
unlocked_xpm );
|
||||
}
|
||||
|
||||
if( !flags )
|
||||
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
|
||||
_( "Auto Place Module" ) );
|
||||
_( "Auto Place Module" ) );
|
||||
}
|
||||
|
||||
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
|
||||
|
@ -235,22 +237,22 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( !flags )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST,
|
||||
_( "Move Drawing" ), move_xpm );
|
||||
_( "Move Drawing" ), move_xpm );
|
||||
}
|
||||
if( flags & IS_NEW )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
|
||||
_( "End Drawing" ), apply_xpm );
|
||||
_( "End Drawing" ), apply_xpm );
|
||||
}
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING,
|
||||
_( "Edit Drawing" ), edit_xpm );
|
||||
_( "Edit Drawing" ), edit_xpm );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING,
|
||||
_( "Delete Drawing" ), delete_xpm );
|
||||
_( "Delete Drawing" ), delete_xpm );
|
||||
break;
|
||||
|
||||
case TYPE_ZONE: // Item used to fill a zone
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
|
||||
_( "Delete Zone Filling" ), delete_xpm );
|
||||
_( "Delete Zone Filling" ), delete_xpm );
|
||||
break;
|
||||
|
||||
case TYPE_ZONE_CONTAINER: // Item used to handle a zone area (outlines, holes ...)
|
||||
|
@ -262,11 +264,11 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
_( "Delete Last Corner" ), delete_xpm );
|
||||
}
|
||||
else
|
||||
createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu );
|
||||
createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
|
||||
createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
|
||||
break;
|
||||
|
||||
case TYPE_TRACK:
|
||||
|
@ -283,22 +285,22 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( !flags )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_COTATION,
|
||||
_( "Edit Dimension" ), edit_xpm );
|
||||
_( "Edit Dimension" ), edit_xpm );
|
||||
}
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_COTATION,
|
||||
_( "Delete Dimension" ), delete_xpm );
|
||||
_( "Delete Dimension" ), delete_xpm );
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
if( !flags )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST,
|
||||
_( "Move Target" ), move_xpm );
|
||||
_( "Move Target" ), move_xpm );
|
||||
}
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE,
|
||||
_( "Edit Target" ), edit_xpm );
|
||||
_( "Edit Target" ), edit_xpm );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE,
|
||||
_( "Delete Target" ), delete_xpm );
|
||||
_( "Delete Target" ), delete_xpm );
|
||||
break;
|
||||
|
||||
case TYPE_EDGE_MODULE:
|
||||
|
@ -330,9 +332,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Get and Move Footprint" ),
|
||||
s_Board_Editor_Hokeys_Descr, HK_GET_AND_MOVE_FOOTPRINT );
|
||||
s_Board_Editor_Hokeys_Descr, HK_GET_AND_MOVE_FOOTPRINT );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
|
||||
msg, move_module_xpm );
|
||||
msg, move_module_xpm );
|
||||
}
|
||||
|
||||
/* Traitement des fonctions specifiques */
|
||||
|
@ -343,25 +345,25 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
{
|
||||
aPopMenu->AppendSeparator();
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
|
||||
_( "Fill or Refill All Zones" ), fill_zone_xpm );
|
||||
_( "Fill or Refill All Zones" ), fill_zone_xpm );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES,
|
||||
_( "Remove Filled Areas in All Zones" ), fill_zone_xpm );
|
||||
_( "Remove Filled Areas in All Zones" ), fill_zone_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case ID_TRACK_BUTT:
|
||||
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(),
|
||||
ID_POPUP_PCB_SELECT_WIDTH,
|
||||
_( "Select Track Width" ), width_track_xpm );
|
||||
ID_POPUP_PCB_SELECT_WIDTH,
|
||||
_( "Select Track Width" ), width_track_xpm );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER,
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR,
|
||||
_( "Select Layer Pair for Vias" ), select_layer_pair_xpm );
|
||||
_( "Select Layer Pair for Vias" ), select_layer_pair_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
|
@ -371,13 +373,13 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
case ID_LINE_COMMENT_BUTT:
|
||||
case ID_PCB_COTATION_BUTT:
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER,
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
|
||||
_( "Footprint Documentation" ), book_xpm );
|
||||
_( "Footprint Documentation" ), book_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
|
@ -386,15 +388,15 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
{
|
||||
wxMenu* commands = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands,
|
||||
ID_POPUP_PCB_AUTOPLACE_COMMANDS, _(
|
||||
"Glob Move and Place" ), move_xpm );
|
||||
ID_POPUP_PCB_AUTOPLACE_COMMANDS, _(
|
||||
"Glob Move and Place" ), move_xpm );
|
||||
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES,
|
||||
_( "Unlock All Modules" ), unlocked_xpm );
|
||||
_( "Unlock All Modules" ), unlocked_xpm );
|
||||
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES,
|
||||
_( "Lock All Modules" ), locked_xpm );
|
||||
_( "Lock All Modules" ), locked_xpm );
|
||||
commands->AppendSeparator();
|
||||
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOMOVE_ALL_MODULES,
|
||||
_( "Move All Modules" ), move_xpm );
|
||||
_( "Move All Modules" ), move_xpm );
|
||||
commands->Append( ID_POPUP_PCB_AUTOMOVE_NEW_MODULES, _( "Move New Modules" ) );
|
||||
commands->AppendSeparator();
|
||||
commands->Append( ID_POPUP_PCB_AUTOPLACE_ALL_MODULES, _( "Autoplace All Modules" ) );
|
||||
|
@ -402,7 +404,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
commands->Append( ID_POPUP_PCB_AUTOPLACE_NEXT_MODULE, _( "Autoplace Next Module" ) );
|
||||
commands->AppendSeparator();
|
||||
ADD_MENUITEM( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES,
|
||||
_( "Orient All Modules" ), rotate_module_pos_xpm );
|
||||
_( "Orient All Modules" ), rotate_module_pos_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
|
@ -411,7 +413,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
wxMenu* commands = new wxMenu;
|
||||
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Global Autoroute" ), commands );
|
||||
ADD_MENUITEM( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR,
|
||||
_( "Select Layer Pair" ), select_layer_pair_xpm );
|
||||
_( "Select Layer Pair" ), select_layer_pair_xpm );
|
||||
commands->AppendSeparator();
|
||||
commands->Append( ID_POPUP_PCB_AUTOROUTE_ALL_MODULES, _( "Autoroute All Modules" ) );
|
||||
commands->AppendSeparator();
|
||||
|
@ -420,19 +422,19 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
{
|
||||
commands->AppendSeparator();
|
||||
commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER,
|
||||
_( "Global AutoRouter" ) );
|
||||
_( "Global AutoRouter" ) );
|
||||
commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA,
|
||||
_( "Read Global AutoRouter Data" ) );
|
||||
_( "Read Global AutoRouter Data" ) );
|
||||
}
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
if( locate_track )
|
||||
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(),
|
||||
ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ),
|
||||
width_track_xpm );
|
||||
ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ),
|
||||
width_track_xpm );
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
_( "Select Working Layer" ), select_w_layer_xpm );
|
||||
aPopMenu->AppendSeparator();
|
||||
break;
|
||||
}
|
||||
|
@ -450,20 +452,20 @@ void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
|
|||
*/
|
||||
{
|
||||
ADD_MENUITEM( menu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel Block" ), cancel_xpm );
|
||||
_( "Cancel Block" ), cancel_xpm );
|
||||
ADD_MENUITEM( menu, ID_POPUP_ZOOM_BLOCK,
|
||||
_( "Zoom Block" ), zoom_selected_xpm );
|
||||
_( "Zoom Block" ), zoom_selected_xpm );
|
||||
menu->AppendSeparator();
|
||||
ADD_MENUITEM( menu, ID_POPUP_PLACE_BLOCK,
|
||||
_( "Place Block" ), apply_xpm );
|
||||
_( "Place Block" ), apply_xpm );
|
||||
ADD_MENUITEM( menu, ID_POPUP_COPY_BLOCK,
|
||||
_( "Copy Block" ), copyblock_xpm );
|
||||
_( "Copy Block" ), copyblock_xpm );
|
||||
ADD_MENUITEM( menu, ID_POPUP_INVERT_BLOCK,
|
||||
_( "Flip Block" ), invert_module_xpm );
|
||||
_( "Flip Block" ), invert_module_xpm );
|
||||
ADD_MENUITEM( menu, ID_POPUP_ROTATE_BLOCK,
|
||||
_( "Rotate Block" ), rotate_pos_xpm );
|
||||
_( "Rotate Block" ), rotate_pos_xpm );
|
||||
ADD_MENUITEM( menu, ID_POPUP_DELETE_BLOCK,
|
||||
_( "Delete Block" ), delete_xpm );
|
||||
_( "Delete Block" ), delete_xpm );
|
||||
}
|
||||
|
||||
|
||||
|
@ -486,24 +488,28 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
wxMenu* via_mnu = new wxMenu();
|
||||
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, via_mnu,
|
||||
ID_POPUP_PCB_VIA_EDITING, _( "Edit Via Drill" ), edit_xpm );
|
||||
ID_POPUP_PCB_VIA_EDITING, _( "Edit Via Drill" ), edit_xpm );
|
||||
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
|
||||
_( "Set Via Hole to Default" ), apply_xpm );
|
||||
msg = _( "Set via hole to a specific value. This specific value is currently" );
|
||||
msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits );
|
||||
msg << wxT( " " ) << ReturnStringFromValue( g_UnitMetric,
|
||||
g_DesignSettings.m_ViaDrillCustomValue,
|
||||
m_InternalUnits );
|
||||
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
|
||||
_( "Set Via Hole to Specific Value" ), msg,
|
||||
options_new_pad_xpm );
|
||||
_( "Set Via Hole to Specific Value" ), msg,
|
||||
options_new_pad_xpm );
|
||||
msg = _( "Set a specific via hole value. This value is currently" );
|
||||
msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits );
|
||||
msg << wxT( " " ) << ReturnStringFromValue( g_UnitMetric,
|
||||
g_DesignSettings.m_ViaDrillCustomValue,
|
||||
m_InternalUnits );
|
||||
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE,
|
||||
_( "Change the Current Specific Drill Value" ), msg, edit_xpm );
|
||||
_( "Change the Current Specific Drill Value" ), msg, edit_xpm );
|
||||
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT, _(
|
||||
"Use this Via Hole as Specific Value" ), export_options_pad_xpm );
|
||||
"Use this Via Hole as Specific Value" ), export_options_pad_xpm );
|
||||
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS,
|
||||
_( "Export this Via Hole to Others id Vias" ), global_options_pad_xpm );
|
||||
_( "Export this Via Hole to Others id Vias" ), global_options_pad_xpm );
|
||||
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT,
|
||||
_( "Set ALL Via Holes to Default" ), apply_xpm );
|
||||
_( "Set ALL Via Holes to Default" ), apply_xpm );
|
||||
if( Track->IsDrillDefault() ) // Can't export the drill value, because this value is 0 (default)
|
||||
{
|
||||
via_mnu->Enable( ID_POPUP_PCB_VIA_HOLE_EXPORT, FALSE );
|
||||
|
@ -516,27 +522,27 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
if( Track->IsPointOnEnds( cursorPosition, -1 ) != 0 )
|
||||
{
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE,
|
||||
_( "Move Node" ), move_xpm );
|
||||
_( "Move Node" ), move_xpm );
|
||||
}
|
||||
else
|
||||
{
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE,
|
||||
_( "Drag Segments, Keep Slope" ), drag_segment_withslope_xpm );
|
||||
_( "Drag Segments, Keep Slope" ), drag_segment_withslope_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT,
|
||||
_( "Drag Segment" ), drag_track_segment_xpm );
|
||||
_( "Drag Segment" ), drag_track_segment_xpm );
|
||||
#if 0
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_SEGMENT,
|
||||
_( "Move Segment" ), move_track_segment_xpm );
|
||||
_( "Move Segment" ), move_track_segment_xpm );
|
||||
#endif
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_BREAK_TRACK,
|
||||
_( "Break Track" ), break_line_xpm );
|
||||
_( "Break Track" ), break_line_xpm );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( flags & IS_DRAGGED ) // Drag via or node in progress
|
||||
{
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE,
|
||||
_( "Place Node" ), apply_xpm );
|
||||
_( "Place Node" ), apply_xpm );
|
||||
return;
|
||||
}
|
||||
else // Edition in progress
|
||||
|
@ -553,8 +559,8 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
if( ( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() )
|
||||
{
|
||||
msg = AddHotkeyName( _(
|
||||
"Place Micro Via" ), s_Board_Editor_Hokeys_Descr,
|
||||
HK_ADD_MICROVIA );
|
||||
"Place Micro Via" ), s_Board_Editor_Hokeys_Descr,
|
||||
HK_ADD_MICROVIA );
|
||||
PopMenu->Append( ID_POPUP_PCB_PLACE_MICROVIA, msg );
|
||||
}
|
||||
}
|
||||
|
@ -565,44 +571,46 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
{
|
||||
track_mnu = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
|
||||
ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm );
|
||||
ID_POPUP_PCB_EDIT_TRACK_MNU, _(
|
||||
"Change Width" ), width_track_xpm );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,
|
||||
Track->Type()==TYPE_VIA ? _( "Change Via Size" ) : _( "Change Segment Width" ), width_segment_xpm );
|
||||
Track->Type()==TYPE_VIA ? _( "Change Via Size" ) : _(
|
||||
"Change Segment Width" ), width_segment_xpm );
|
||||
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,
|
||||
_( "Change Track Width" ), width_track_xpm );
|
||||
_( "Change Track Width" ), width_track_xpm );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET,
|
||||
_( "Change Net" ), width_net_xpm );
|
||||
_( "Change Net" ), width_net_xpm );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
|
||||
_( "Change ALL Tracks and Vias" ), width_track_via_xpm );
|
||||
_( "Change ALL Tracks and Vias" ), width_track_via_xpm );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE,
|
||||
_( "Change ALL Vias (No Track)" ), width_vias_xpm );
|
||||
_( "Change ALL Vias (No Track)" ), width_vias_xpm );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE,
|
||||
_( "Change ALL Tracks (No Via)" ), width_track_xpm );
|
||||
_( "Change ALL Tracks (No Via)" ), width_track_xpm );
|
||||
}
|
||||
|
||||
// Delete control:
|
||||
track_mnu = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
|
||||
ID_POPUP_PCB_DELETE_TRACK_MNU, _( "Delete" ), delete_xpm );
|
||||
ID_POPUP_PCB_DELETE_TRACK_MNU, _( "Delete" ), delete_xpm );
|
||||
|
||||
msg = AddHotkeyName( Track->Type()==TYPE_VIA ? _( "Delete Via" ) : _( "Delete Segment" ),
|
||||
s_Board_Editor_Hokeys_Descr, HK_BACK_SPACE );
|
||||
s_Board_Editor_Hokeys_Descr, HK_BACK_SPACE );
|
||||
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACKSEG,
|
||||
msg, delete_line_xpm );
|
||||
msg, delete_line_xpm );
|
||||
if( !flags )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Delete Track" ), s_Board_Editor_Hokeys_Descr, HK_DELETE );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACK,
|
||||
msg, delete_track_xpm );
|
||||
msg, delete_track_xpm );
|
||||
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACKNET,
|
||||
_( "Delete Net" ), delete_net_xpm );
|
||||
_( "Delete Net" ), delete_net_xpm );
|
||||
}
|
||||
track_mnu = new wxMenu;
|
||||
|
||||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
|
||||
ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), flag_xpm );
|
||||
ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), flag_xpm );
|
||||
track_mnu->Append( ID_POPUP_PCB_LOCK_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, TRUE );
|
||||
track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), wxEmptyString, TRUE );
|
||||
|
||||
|
@ -633,69 +641,69 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
|
|||
if( edge_zone->m_Flags == IS_DRAGGED )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
|
||||
_( "Place Edge Outline" ), apply_xpm );
|
||||
_( "Place Edge Outline" ), apply_xpm );
|
||||
}
|
||||
else if( edge_zone->m_Flags )
|
||||
{
|
||||
if( (edge_zone->m_Flags & IN_EDIT ) )
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
|
||||
_( "Place Corner" ), apply_xpm );
|
||||
_( "Place Corner" ), apply_xpm );
|
||||
else
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_OUTLINES,
|
||||
_( "Place Zone" ), apply_xpm );
|
||||
_( "Place Zone" ), apply_xpm );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMenu* zones_menu = new wxMenu();
|
||||
|
||||
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, zones_menu,
|
||||
-1, _( "Zones" ), add_zone_xpm );
|
||||
-1, _( "Zones" ), add_zone_xpm );
|
||||
int index;
|
||||
if( ( index = edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) ) >= 0 )
|
||||
{
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
|
||||
_( "Move Corner" ), move_xpm );
|
||||
_( "Move Corner" ), move_xpm );
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
|
||||
_( "Delete Corner" ), delete_xpm );
|
||||
_( "Delete Corner" ), delete_xpm );
|
||||
}
|
||||
else if( ( index = edge_zone->HitTestForEdge( GetScreen()->RefPos( true ) ) ) >= 0 )
|
||||
{
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER,
|
||||
_( "Create Corner" ), add_corner_xpm );
|
||||
_( "Create Corner" ), add_corner_xpm );
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT,
|
||||
_( "Drag Outline Segment" ), drag_outline_segment_xpm );
|
||||
_( "Drag Outline Segment" ), drag_outline_segment_xpm );
|
||||
}
|
||||
|
||||
zones_menu->AppendSeparator();
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
|
||||
_( "Add Similar Zone" ), add_zone_xpm );
|
||||
_( "Add Similar Zone" ), add_zone_xpm );
|
||||
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
|
||||
_( "Add Cutout Area" ), add_zone_cutout );
|
||||
_( "Add Cutout Area" ), add_zone_cutout );
|
||||
zones_menu->AppendSeparator();
|
||||
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_FILL_ZONE,
|
||||
_( "Fill Zone" ), fill_zone_xpm );
|
||||
_( "Fill Zone" ), fill_zone_xpm );
|
||||
|
||||
if (edge_zone->m_FilledPolysList.size() > 0 )
|
||||
if( edge_zone->m_FilledPolysList.size() > 0 )
|
||||
{
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
|
||||
_( "Remove Filled Areas in Zone" ), fill_zone_xpm );
|
||||
_( "Remove Filled Areas in Zone" ), fill_zone_xpm );
|
||||
}
|
||||
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES,
|
||||
_( "Move Zone" ), move_xpm );
|
||||
_( "Move Zone" ), move_xpm );
|
||||
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
|
||||
_( "Edit Zone Params" ), edit_xpm );
|
||||
_( "Edit Zone Params" ), edit_xpm );
|
||||
|
||||
zones_menu->AppendSeparator();
|
||||
if( index >= 0 && edge_zone->m_Poly->IsCutoutContour( edge_zone->m_CornerSelection ) )
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CUTOUT,
|
||||
_( "Delete Cutout" ), delete_xpm );
|
||||
_( "Delete Cutout" ), delete_xpm );
|
||||
|
||||
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
|
||||
_( "Delete Zone Outline" ), delete_xpm );
|
||||
_( "Delete Zone Outline" ), delete_xpm );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,27 +727,27 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men
|
|||
{
|
||||
msg = AddHotkeyName( _( "Move" ), s_Board_Editor_Hokeys_Descr, HK_MOVE_FOOTPRINT );
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
|
||||
msg, move_module_xpm );
|
||||
msg, move_module_xpm );
|
||||
msg = AddHotkeyName( _( "Drag" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_FOOTPRINT );
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST,
|
||||
msg, drag_module_xpm );
|
||||
msg, drag_module_xpm );
|
||||
}
|
||||
msg = AddHotkeyName( _( "Rotate +" ), s_Board_Editor_Hokeys_Descr, HK_ROTATE_FOOTPRINT );
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
|
||||
msg, rotate_module_pos_xpm );
|
||||
msg, rotate_module_pos_xpm );
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE,
|
||||
_( "Rotate -" ), rotate_module_neg_xpm );
|
||||
_( "Rotate -" ), rotate_module_neg_xpm );
|
||||
msg = AddHotkeyName( _( "Flip" ), s_Board_Editor_Hokeys_Descr, HK_FLIP_FOOTPRINT );
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE,
|
||||
msg, invert_module_xpm );
|
||||
msg, invert_module_xpm );
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE,
|
||||
_( "Edit" ), edit_module_xpm );
|
||||
_( "Edit" ), edit_module_xpm );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
sub_menu_footprint->AppendSeparator();
|
||||
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE,
|
||||
_( "Delete Module" ), delete_module_xpm );
|
||||
_( "Delete Module" ), delete_module_xpm );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -762,16 +770,16 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
|
|||
|
||||
if( !flags )
|
||||
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST,
|
||||
_( "Move" ), move_field_xpm );
|
||||
_( "Move" ), move_field_xpm );
|
||||
|
||||
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE,
|
||||
_( "Rotate" ), rotate_field_xpm );
|
||||
_( "Rotate" ), rotate_field_xpm );
|
||||
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE,
|
||||
_( "Edit" ), edit_text_xpm );
|
||||
_( "Edit" ), edit_text_xpm );
|
||||
|
||||
if( FpText->m_Type == TEXT_is_DIVERS )
|
||||
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE,
|
||||
_( "Delete" ), delete_xpm );
|
||||
_( "Delete" ), delete_xpm );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
|
@ -790,61 +798,54 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
|
|||
/************************************************************************/
|
||||
/* Create pop menu for pads */
|
||||
{
|
||||
wxMenu* sub_menu_Pad;
|
||||
int flags = Pad->m_Flags;
|
||||
wxMenu* sub_menu_Pad;
|
||||
int flags = Pad->m_Flags;
|
||||
|
||||
if( flags ) // Currently in edit, no others commands possible
|
||||
return;
|
||||
|
||||
wxString msg = Pad->MenuText( GetBoard() );
|
||||
|
||||
sub_menu_Pad = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm );
|
||||
if( !flags )
|
||||
{
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST,
|
||||
_( "Move" ), move_pad_xpm );
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST,
|
||||
_( "Drag" ), drag_pad_xpm );
|
||||
}
|
||||
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST,
|
||||
_( "Move" ), move_pad_xpm );
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST,
|
||||
_( "Drag" ), drag_pad_xpm );
|
||||
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm );
|
||||
sub_menu_Pad->AppendSeparator();
|
||||
|
||||
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
||||
_( "New Pad Settings" ),
|
||||
_( "Copy current pad settings to this pad" ),
|
||||
options_new_pad_xpm );
|
||||
_( "New Pad Settings" ),
|
||||
_( "Copy current pad settings to this pad" ),
|
||||
options_new_pad_xpm );
|
||||
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
||||
_( "Export Pad Settings" ),
|
||||
_( "Copy this pad settings to current pad settings" ),
|
||||
export_options_pad_xpm );
|
||||
_( "Export Pad Settings" ),
|
||||
_( "Copy this pad settings to current pad settings" ),
|
||||
export_options_pad_xpm );
|
||||
|
||||
if( !flags )
|
||||
{
|
||||
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
||||
_( "Global Pad Settings" ),
|
||||
_(
|
||||
"Copy this pad settings to all pads in this footprint (or similar footprints)" ),
|
||||
global_options_pad_xpm );
|
||||
sub_menu_Pad->AppendSeparator();
|
||||
ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
||||
_( "Global Pad Settings" ),
|
||||
_(
|
||||
"Copy this pad settings to all pads in this footprint (or similar footprints)" ),
|
||||
global_options_pad_xpm );
|
||||
sub_menu_Pad->AppendSeparator();
|
||||
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,
|
||||
_( "Delete" ), delete_pad_xpm );
|
||||
}
|
||||
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,
|
||||
_( "Delete" ), delete_pad_xpm );
|
||||
|
||||
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
|
||||
{
|
||||
if( !flags )
|
||||
{
|
||||
menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
|
||||
menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
|
||||
}
|
||||
menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
|
||||
menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
|
||||
}
|
||||
if( !flags )
|
||||
MODULE* module = (MODULE*) Pad->GetParent();
|
||||
if( module )
|
||||
{
|
||||
MODULE* module = (MODULE*) Pad->GetParent();
|
||||
if( module )
|
||||
{
|
||||
menu->AppendSeparator();
|
||||
createPopUpMenuForFootprints( module, menu );
|
||||
}
|
||||
menu->AppendSeparator();
|
||||
createPopUpMenuForFootprints( module, menu );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -866,18 +867,19 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
|
|||
if( !flags )
|
||||
{
|
||||
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
|
||||
_( "Move" ), move_text_xpm );
|
||||
_( "Move" ), move_text_xpm );
|
||||
}
|
||||
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB,
|
||||
_( "Rotate" ), rotate_pos_xpm );
|
||||
_( "Rotate" ), rotate_pos_xpm );
|
||||
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB,
|
||||
_( "Edit" ), edit_text_xpm );
|
||||
_( "Edit" ), edit_text_xpm );
|
||||
|
||||
sub_menu_Text->AppendSeparator();
|
||||
ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB,
|
||||
_( "Delete" ), delete_text_xpm );
|
||||
_( "Delete" ), delete_text_xpm );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_PcbFrame::createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu )
|
||||
/**********************************************************************/
|
||||
|
|
Loading…
Reference in New Issue