formatting
This commit is contained in:
parent
6c9244e8c3
commit
25df2772db
|
@ -78,8 +78,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function InitData
|
* Function InitData
|
||||||
* Init the initial values of a BLOCK_SELECTOR, before starting a block
|
* sets the initial values of a BLOCK_SELECTOR, before starting a block
|
||||||
*command
|
* command
|
||||||
*/
|
*/
|
||||||
void InitData( WinEDA_DrawPanel* Panel, const wxPoint& startpos );
|
void InitData( WinEDA_DrawPanel* Panel, const wxPoint& startpos );
|
||||||
|
|
||||||
|
@ -96,14 +96,14 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PushItem
|
* Function PushItem
|
||||||
* Add aItem to the list of items
|
* adds aItem to the list of items
|
||||||
* @param aItem = an ITEM_PICKER to add to the list
|
* @param aItem = an ITEM_PICKER to add to the list
|
||||||
*/
|
*/
|
||||||
void PushItem( ITEM_PICKER& aItem );
|
void PushItem( ITEM_PICKER& aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ClearListAndDeleteItems
|
* Function ClearListAndDeleteItems
|
||||||
* delete only the list of EDA_BaseStruct * pointers, AND the data printed
|
* deletes only the list of EDA_BaseStruct * pointers, AND the data printed
|
||||||
* by m_Item
|
* by m_Item
|
||||||
*/
|
*/
|
||||||
void ClearListAndDeleteItems();
|
void ClearListAndDeleteItems();
|
||||||
|
|
132
pcbnew/block.cpp
132
pcbnew/block.cpp
|
@ -380,8 +380,10 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||||
Block_SelectItems();
|
Block_SelectItems();
|
||||||
|
|
||||||
// Exit if no items found
|
// Exit if no items found
|
||||||
if( !GetScreen()->m_BlockLocate.GetCount() ) {
|
if( !GetScreen()->m_BlockLocate.GetCount() ) {
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
|
@ -393,6 +395,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DisplayToolMsg( wxEmptyString );
|
DisplayToolMsg( wxEmptyString );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move cursor to the center of the smallest rectangle
|
// Move cursor to the center of the smallest rectangle
|
||||||
// containing the centers of all selected items.
|
// containing the centers of all selected items.
|
||||||
// Also set m_BlockLocate to the size of the rectangle.
|
// Also set m_BlockLocate to the size of the rectangle.
|
||||||
|
@ -401,6 +404,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
int minX, minY, maxX, maxY;
|
int minX, minY, maxX, maxY;
|
||||||
int tempX, tempY;
|
int tempX, tempY;
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( 0 );
|
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( 0 );
|
||||||
|
|
||||||
minX = item->GetPosition().x;
|
minX = item->GetPosition().x;
|
||||||
minY = item->GetPosition().y;
|
minY = item->GetPosition().y;
|
||||||
maxX = minX;
|
maxX = minX;
|
||||||
|
@ -419,6 +423,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
if( tempY < minY )
|
if( tempY < minY )
|
||||||
minY = tempY;
|
minY = tempY;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockCenter.x = ( minX + maxX ) / 2;
|
blockCenter.x = ( minX + maxX ) / 2;
|
||||||
blockCenter.y = ( minY + maxY ) / 2;
|
blockCenter.y = ( minY + maxY ) / 2;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
|
@ -431,6 +436,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
|
{
|
||||||
switch( GetScreen()->m_BlockLocate.m_Command )
|
switch( GetScreen()->m_BlockLocate.m_Command )
|
||||||
{
|
{
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
|
@ -469,7 +475,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
|
||||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
// TODO (if useful) Save_Block( );
|
// @todo (if useful) Save_Block( );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -487,6 +493,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( endcommande == TRUE )
|
if( endcommande == TRUE )
|
||||||
{
|
{
|
||||||
|
@ -641,7 +648,7 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
wxPoint aOffset )
|
wxPoint aOffset )
|
||||||
|
@ -649,6 +656,7 @@ static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.m_ItemsSelection;
|
PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.m_ItemsSelection;
|
||||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
|
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
|
||||||
g_Offset_Module = -aOffset;
|
g_Offset_Module = -aOffset;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||||
|
@ -840,6 +848,7 @@ void WinEDA_PcbFrame::Block_Rotate()
|
||||||
wxASSERT(item);
|
wxASSERT(item);
|
||||||
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
|
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
|
||||||
item->Rotate(centre, rotAngle);
|
item->Rotate(centre, rotAngle);
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
|
@ -881,7 +890,7 @@ void WinEDA_PcbFrame::Block_Rotate()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Block_Flip
|
* Function Block_Flip
|
||||||
* Flip items within the selected block.
|
* flips items within the selected block.
|
||||||
* The flip center is the center of the block
|
* The flip center is the center of the block
|
||||||
* @param none
|
* @param none
|
||||||
*/
|
*/
|
||||||
|
@ -906,6 +915,7 @@ void WinEDA_PcbFrame::Block_Flip()
|
||||||
wxASSERT(item);
|
wxASSERT(item);
|
||||||
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
|
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
|
||||||
item->Flip(center);
|
item->Flip(center);
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
|
@ -1008,7 +1018,7 @@ void WinEDA_PcbFrame::Block_Move()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Block_Duplicate
|
* Function Block_Duplicate
|
||||||
* Duplicate all items within the selected block.
|
* duplicates all items within the selected block.
|
||||||
* New location is determined by the current offset from the selected block's
|
* New location is determined by the current offset from the selected block's
|
||||||
* original location.
|
* original location.
|
||||||
* @param none
|
* @param none
|
||||||
|
@ -1034,85 +1044,85 @@ void WinEDA_PcbFrame::Block_Duplicate()
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
{
|
{
|
||||||
MODULE* module = (MODULE*) item;
|
MODULE* module = (MODULE*) item;
|
||||||
MODULE* new_module;
|
MODULE* new_module;
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
module->m_Flags = 0;
|
module->m_Flags = 0;
|
||||||
newitem = new_module = new MODULE( m_Pcb );
|
newitem = new_module = new MODULE( m_Pcb );
|
||||||
new_module->Copy( module );
|
new_module->Copy( module );
|
||||||
new_module->m_TimeStamp = GetTimeStamp();
|
new_module->m_TimeStamp = GetTimeStamp();
|
||||||
m_Pcb->m_Modules.PushFront( new_module );
|
m_Pcb->m_Modules.PushFront( new_module );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TRACK:
|
case TYPE_TRACK:
|
||||||
case TYPE_VIA:
|
case TYPE_VIA:
|
||||||
{
|
{
|
||||||
TRACK* track = (TRACK*) item;
|
TRACK* track = (TRACK*) item;
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
TRACK* new_track = track->Copy();
|
TRACK* new_track = track->Copy();
|
||||||
newitem = new_track;
|
newitem = new_track;
|
||||||
m_Pcb->m_Track.PushFront( new_track );
|
m_Pcb->m_Track.PushFront( new_track );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ZONE_CONTAINER:
|
case TYPE_ZONE_CONTAINER:
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* new_zone =
|
ZONE_CONTAINER* new_zone =
|
||||||
new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
||||||
new_zone->Copy( (ZONE_CONTAINER*) item );
|
new_zone->Copy( (ZONE_CONTAINER*) item );
|
||||||
new_zone->m_TimeStamp = GetTimeStamp();
|
new_zone->m_TimeStamp = GetTimeStamp();
|
||||||
newitem = new_zone;
|
newitem = new_zone;
|
||||||
m_Pcb->Add( new_zone );
|
m_Pcb->Add( new_zone );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
|
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
|
||||||
new_drawsegment->Copy( (DRAWSEGMENT*) item );
|
new_drawsegment->Copy( (DRAWSEGMENT*) item );
|
||||||
m_Pcb->Add( new_drawsegment );
|
m_Pcb->Add( new_drawsegment );
|
||||||
newitem = new_drawsegment;
|
newitem = new_drawsegment;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE:
|
case TYPE_TEXTE:
|
||||||
{
|
{
|
||||||
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
|
TEXTE_PCB* new_pcbtext = new TEXTE_PCB( m_Pcb );
|
||||||
new_pcbtext->Copy( (TEXTE_PCB*) item );
|
new_pcbtext->Copy( (TEXTE_PCB*) item );
|
||||||
m_Pcb->Add( new_pcbtext );
|
m_Pcb->Add( new_pcbtext );
|
||||||
newitem = new_pcbtext;
|
newitem = new_pcbtext;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MIRE:
|
case TYPE_MIRE:
|
||||||
{
|
{
|
||||||
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
MIREPCB* new_mire = new MIREPCB( m_Pcb );
|
||||||
new_mire->Copy( (MIREPCB*) item );
|
new_mire->Copy( (MIREPCB*) item );
|
||||||
m_Pcb->Add( new_mire );
|
m_Pcb->Add( new_mire );
|
||||||
newitem = new_mire;
|
newitem = new_mire;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
{
|
{
|
||||||
DIMENSION* new_cotation = new DIMENSION( m_Pcb );
|
DIMENSION* new_cotation = new DIMENSION( m_Pcb );
|
||||||
new_cotation->Copy( (DIMENSION*) item );
|
new_cotation->Copy( (DIMENSION*) item );
|
||||||
m_Pcb->Add( new_cotation );
|
m_Pcb->Add( new_cotation );
|
||||||
newitem = new_cotation;
|
newitem = new_cotation;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxMessageBox( wxT( "WinEDA_PcbFrame::Block_Duplicate( ) error: unexpected type" ) );
|
wxMessageBox( wxT( "WinEDA_PcbFrame::Block_Duplicate( ) error: unexpected type" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( newitem )
|
if( newitem )
|
||||||
{
|
{
|
||||||
newitem->Move( MoveVector );
|
newitem->Move( MoveVector );
|
||||||
picker.m_PickedItem = newitem;
|
picker.m_PickedItem = newitem;
|
||||||
|
|
Loading…
Reference in New Issue