Commit 0c443357 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Lots and lots of PCBNew code cleaning and fix build bug introduced in r3108.

* Changed <wx-2.8/xml/xml.h> to "xnode.h" in pcbnew_config.cpp to fix bug
  when building against wxWidgets 2.9 and above.
* Convert broken wxXmlNode code to use XNODE.
* Overloaded XNODE constructor for creating child nodes.
* Translate French naming conventions.
* Translate French comments.
* Remove tabs from several source files.
* Coding style policy and Doxygen comment fixes.
parent c7dee039
This diff is collapsed.
......@@ -136,12 +136,12 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
* but they must exist because they appear in some classes.
* Do nothing in CvPcb.
*/
TRACK* Marque_Une_Piste( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
int* aLenDie,
bool aReorder )
TRACK* MarkTrace( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
int* aLenDie,
bool aReorder )
{
return NULL;
}
......@@ -420,12 +420,12 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
* but they must exist because they appear in some classes, and here, no nothing.
*/
TRACK* Marque_Une_Piste( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
int* aLenDie,
bool aReorder )
TRACK* MarkTrace( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
int* aLenDie,
bool aReorder )
{
return NULL;
}
/*********************************************************************/
/* base_struct.h : Basic classes for most kicad item descriptions */
/*********************************************************************/
/**
* @file base_struct.h
* @brief Basic classes for most kicad items.
*/
#ifndef BASE_STRUCT_H
#define BASE_STRUCT_H
......@@ -41,7 +42,7 @@ enum KICAD_T {
// copper layer)
TYPE_MARKER_PCB, // a marker used to show something
TYPE_DIMENSION, // a dimension (graphic item)
TYPE_MIRE, // a target (graphic item)
PCB_TARGET_T, // a target (graphic item)
TYPE_ZONE_EDGE_CORNER, // in zone outline: a point to define an outline
TYPE_ZONE_CONTAINER, // a zone area
TYPE_BOARD_ITEM_LIST, // a list of board items
......
......@@ -28,7 +28,7 @@ class SEGZONE;
class SEGVIA;
class D_PAD;
class TEXTE_MODULE;
class MIREPCB;
class PCB_TARGET;
class DIMENSION;
class EDGE_MODULE;
class DRC;
......@@ -830,8 +830,8 @@ public:
* the case where DRC would not allow a via.
*/
bool Other_Layer_Route( TRACK* track, wxDC* DC );
void Affiche_PadsNoConnect( wxDC* DC );
void Affiche_Status_Net( wxDC* DC );
void HighlightUnconnectedPads( wxDC* DC );
void DisplayNetStatus( wxDC* DC );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
......@@ -910,7 +910,6 @@ public:
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer );
bool Add_45_degrees_Segment( wxDC* DC );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
/**
* Function EraseRedundantTrack
......@@ -1085,11 +1084,11 @@ public:
void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
// Target handling
MIREPCB* Create_Mire( wxDC* DC );
void Delete_Mire( MIREPCB* MirePcb, wxDC* DC );
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC );
PCB_TARGET* CreateTarget( wxDC* DC );
void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
// Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
......
......@@ -53,6 +53,12 @@ public:
{
}
XNODE( XNODE* aParent, wxXmlNodeType aType, const wxString& aName,
const wxString& aContent = wxEmptyString, wxXmlProperty* aProperties = NULL ) :
wxXmlNode( aParent, aType, aName, aContent, aProperties )
{
}
/**
* Function Format
* writes this object as UTF8 out to an OUTPUTFORMATTER as an S-expression.
......
......@@ -39,8 +39,8 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
return;
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, NULL, true );
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
Track = MarkTrace( GetBoard(), track, &nb_segm, NULL, NULL, true );
DrawTraces( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
{
......@@ -74,6 +74,7 @@ void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
}
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
while( Track ) /* Flag change */
{
if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
......
......@@ -46,24 +46,32 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
{
case ID_TOOLBARH_PCB_MODE_MODULE:
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_MODULE );
if( on_state )
{
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, FALSE );
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, false );
m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_MODULE;
}
else
{
m_HTOOL_current_state = 0;
}
return;
case ID_TOOLBARH_PCB_MODE_TRACKS:
on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_TRACKS );
if( on_state )
{
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, FALSE );
m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, false );
m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_TRACKS;
}
else
{
m_HTOOL_current_state = 0;
}
return;
......@@ -75,11 +83,11 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
return;
case ID_POPUP_PCB_AUTOPLACE_FREE_MODULE:
LockModule( (MODULE*) GetScreen()->GetCurItem(), FALSE );
LockModule( (MODULE*) GetScreen()->GetCurItem(), false );
return;
case ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES:
LockModule( NULL, FALSE );
LockModule( NULL, false );
return;
case ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES:
......@@ -91,6 +99,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
{
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
}
break;
default: // Abort a current command (if any)
......@@ -101,13 +110,13 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
/* Erase ratsnest if needed */
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( &dc );
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
switch( id )
{
case ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE:
AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(),
PLACE_1_MODULE, &dc );
AutoPlaceModule( (MODULE*) GetScreen()->GetCurItem(), PLACE_1_MODULE, &dc );
break;
case ID_POPUP_PCB_AUTOPLACE_ALL_MODULES:
......@@ -123,7 +132,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
break;
case ID_POPUP_PCB_AUTOMOVE_ALL_MODULES:
AutoMoveModulesOnPcb( FALSE );
AutoMoveModulesOnPcb( false );
break;
case ID_POPUP_PCB_AUTOMOVE_NEW_MODULES:
......@@ -194,11 +203,13 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
// Build sorted footprints list (sort by decreasing size )
MODULE* Module = GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
Module->Set_Rectangle_Encadrement();
Module->CalculateBoundingBox();
moduleList.push_back(Module);
}
sort( moduleList.begin(), moduleList.end(), sortModulesbySize );
/* to move modules outside the board, the cursor is placed below
......@@ -216,14 +227,17 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
/* calculate the area needed by footprints */
surface = 0.0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
{
Module = moduleList[ii];
if( PlaceModulesHorsPcb && edgesExists )
{
if( GetBoard()->m_BoundaryBox.Contains( Module->m_Pos ) )
continue;
}
surface += Module->m_Surface;
}
......@@ -235,6 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
{
Module = moduleList[ii];
if( Module->IsLocked() )
continue;
......@@ -253,6 +268,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
GetScreen()->SetCrossHairPosition( current + Module->m_Pos -
Module->m_BoundaryBox.GetPosition() );
Ymax_size = MAX( Ymax_size, Module->m_BoundaryBox.GetHeight() );
Place_Module( Module, NULL, true );
......@@ -264,8 +280,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
}
/* Set or reset (true or FALSE) Lock attribute of aModule
* or all modules if aModule == NULL
/* Set or reset (true or false) Lock attribute of aModule or all modules if aModule == NULL
*/
void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
{
......@@ -279,10 +294,10 @@ void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
else
{
aModule = GetBoard()->m_Modules;
for( ; aModule != NULL; aModule = aModule->Next() )
{
if( WildCompareString( ModulesMaskSelection,
aModule->m_Reference->m_Text ) )
if( WildCompareString( ModulesMaskSelection, aModule->m_Reference->m_Text ) )
{
aModule->SetLocked( aLocked );
OnModify();
......@@ -296,4 +311,3 @@ static bool sortModulesbySize( MODULE* ref, MODULE* compare )
{
return compare->m_Surface < ref->m_Surface;
}
This diff is collapsed.
......@@ -69,7 +69,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; /* FALSE = sketch , true = filled */
m_DisplayPcbTrackFill = true; /* false = sketch , true = filled */
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition
......
......@@ -378,7 +378,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
*/
void PCB_EDIT_FRAME::Block_SelectItems()
{
int masque_layer;
int layerMask;
GetScreen()->m_BlockLocate.Normalize();
......@@ -388,8 +388,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add modules
if( blockIncludeModules )
{
for( MODULE* module = m_Pcb->m_Modules; module != NULL;
module = module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
{
int layer = module->GetLayer();
......@@ -409,8 +408,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add tracks and vias
if( blockIncludeTracks )
{
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL;
pt_segm = pt_segm->Next() )
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
{
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
{
......@@ -425,16 +423,15 @@ void PCB_EDIT_FRAME::Block_SelectItems()
}
// Add graphic items
masque_layer = EDGE_LAYER;
layerMask = EDGE_LAYER;
if( blockIncludeItemsOnTechLayers )
masque_layer = ALL_LAYERS;
layerMask = ALL_LAYERS;
if( !blockIncludeBoardOutlineLayer )
masque_layer &= ~EDGE_LAYER;
layerMask &= ~EDGE_LAYER;
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL;
PtStruct = PtStruct->Next() )
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
continue;
......@@ -442,7 +439,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
switch( PtStruct->Type() )
{
case TYPE_DRAWSEGMENT:
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask) == 0 )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
......@@ -459,21 +456,23 @@ void PCB_EDIT_FRAME::Block_SelectItems()
select_me = true; // This item is in bloc: select it
break;
case TYPE_MIRE:
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
case PCB_TARGET_T:
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask ) == 0 )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
break;
select_me = true; // This item is in bloc: select it
break;
case TYPE_DIMENSION:
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & layerMask ) == 0 )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
break;
select_me = true; // This item is in bloc: select it
break;
......@@ -517,9 +516,11 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
g_Offset_Module = -aOffset;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
switch( item->Type() )
{
case TYPE_MODULE:
......@@ -531,7 +532,7 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
case TYPE_TEXTE:
case TYPE_TRACK:
case TYPE_VIA:
case TYPE_MIRE:
case PCB_TARGET_T:
case TYPE_DIMENSION: // Currently markers are not affected by block commands
case TYPE_MARKER_PCB:
item->Draw( aPanel, aDC, GR_XOR, aOffset );
......@@ -600,6 +601,7 @@ void PCB_EDIT_FRAME::Block_Delete()
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
itemsList->SetPickedItemStatus( UR_DELETED, ii );
switch( item->Type() )
{
case TYPE_MODULE:
......@@ -620,7 +622,7 @@ void PCB_EDIT_FRAME::Block_Delete()
case TYPE_TRACK: // a track segment (segment on a copper layer)
case TYPE_VIA: // a via (like atrack segment on a copper layer)
case TYPE_DIMENSION: // a dimension (graphic item)
case TYPE_MIRE: // a target (graphic item)
case PCB_TARGET_T: // a target (graphic item)
item->UnLink();
break;
......@@ -671,6 +673,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
wxASSERT( item );
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
item->Rotate( centre, rotAngle );
switch( item->Type() )
{
case TYPE_MODULE:
......@@ -687,7 +690,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
case TYPE_ZONE_CONTAINER:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_MIRE:
case PCB_TARGET_T:
case TYPE_DIMENSION:
break;
......@@ -736,6 +739,7 @@ void PCB_EDIT_FRAME::Block_Flip()
wxASSERT( item );
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
item->Flip( center );
switch( item->Type() )
{
case TYPE_MODULE:
......@@ -752,7 +756,7 @@ void PCB_EDIT_FRAME::Block_Flip()
case TYPE_ZONE_CONTAINER:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_MIRE:
case PCB_TARGET_T:
case TYPE_DIMENSION:
break;
......@@ -812,7 +816,7 @@ void PCB_EDIT_FRAME::Block_Move()
case TYPE_ZONE_CONTAINER:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_MIRE:
case PCB_TARGET_T:
case TYPE_DIMENSION:
break;
......@@ -890,8 +894,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
case TYPE_ZONE_CONTAINER:
{
ZONE_CONTAINER* new_zone =
new ZONE_CONTAINER( (BOARD*) item->GetParent() );
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
new_zone->Copy( (ZONE_CONTAINER*) item );
new_zone->m_TimeStamp = GetTimeStamp();
newitem = new_zone;
......@@ -917,12 +920,12 @@ void PCB_EDIT_FRAME::Block_Duplicate()
}
break;
case TYPE_MIRE:
case PCB_TARGET_T:
{
MIREPCB* new_mire = new MIREPCB( m_Pcb );
new_mire->Copy( (MIREPCB*) item );
m_Pcb->Add( new_mire );
newitem = new_mire;
PCB_TARGET* target = new PCB_TARGET( m_Pcb );
target->Copy( (PCB_TARGET*) item );
m_Pcb->Add( target );
newitem = target;
}
break;
......@@ -941,12 +944,12 @@ void PCB_EDIT_FRAME::Block_Duplicate()
}
if( newitem )
{
newitem->Move( MoveVector );
picker.m_PickedItem = newitem;
picker.m_PickedItemType = newitem->Type();
newList.PushItem( picker );
}
{
newitem->Move( MoveVector );
picker.m_PickedItem = newitem;
picker.m_PickedItemType = newitem->Type();
newList.PushItem( picker );
}
}
if( newList.GetCount() )
......
......@@ -114,13 +114,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......@@ -215,7 +215,7 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT );
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector );
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case BLOCK_COPY: /* Copy */
......@@ -366,6 +366,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
{
if( pad->m_Selected == 0 )
continue;
pad->m_Selected = 0;
D_PAD* NewPad = new D_PAD( module );
NewPad->Copy( pad );
......
......@@ -81,16 +81,19 @@ int MATRIX_ROUTING_HEAD::InitBoard()
/* allocate Board & initialize everything to empty */
m_BoardSide[kk] = (MATRIX_CELL*) MyZMalloc( ii * sizeof(MATRIX_CELL) );
if( m_BoardSide[kk] == NULL )
return -1;
/***** allocate Distances *****/
m_DistSide[kk] = (DIST_CELL*) MyZMalloc( ii * sizeof(DIST_CELL) );
if( m_DistSide[kk] == NULL )
return -1;
/***** allocate Dir (chars) *****/
m_DirSide[kk] = (char*) MyZMalloc( ii );
if( m_DirSide[kk] == NULL )
return -1;
}
......@@ -146,7 +149,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
int masque_layer;
int layerMask;
// use the default NETCLASS?
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
......@@ -167,12 +170,14 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{
Place_1_Pad_Board( aPcb, pad, HOLE, marge, WRITE_CELL );
}
Place_1_Pad_Board( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
}
// Place outlines of modules on matrix routing, if they are on a copper layer
// or on the edge layer
TRACK tmpSegm( NULL ); // A dummy track used to create segments.
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
......@@ -184,6 +189,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
EDGE_MODULE* edge = (EDGE_MODULE*) item;
tmpSegm.SetLayer( edge->GetLayer() );
if( tmpSegm.GetLayer() == EDGE_N )
tmpSegm.SetLayer( -1 );
......@@ -195,8 +201,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
tmpSegm.SetNet( -1 );
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge,
WRITE_OR_CELL );
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
}
break;
......@@ -218,6 +223,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
int type_cell = HOLE;
DrawSegm = (DRAWSEGMENT*) item;
tmpSegm.SetLayer( DrawSegm->GetLayer() );
if( DrawSegm->GetLayer() == EDGE_N )
{
tmpSegm.SetLayer( -1 );
......@@ -258,16 +264,16 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
ux0 -= dx;
uy0 -= dy;
masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
layerMask = g_TabOneLayerMask[PtText->GetLayer()];
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
uy1 + marge, (int) (PtText->m_Orient),
masque_layer, HOLE, WRITE_CELL );
layerMask, HOLE, WRITE_CELL );
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
ux1 + via_marge, uy1 + via_marge,
(int) (PtText->m_Orient),
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL );
}
break;
......@@ -299,6 +305,7 @@ int Build_Work( BOARD* Pcb )
InitWork(); /* clear work list */
Ntotal = 0;
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
{
pt_rats = &Pcb->m_FullRatsnest[ii];
......@@ -308,10 +315,13 @@ int Build_Work( BOARD* Pcb )
*/
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
continue;
if( pt_rats->m_Status & CH_UNROUTABLE )
continue;
if( (pt_rats->m_Status & CH_ROUTE_REQ) == 0 )
continue;
pt_pad = pt_rats->m_PadStart;
current_net_code = pt_pad->GetNet();
......@@ -319,6 +329,7 @@ int Build_Work( BOARD* Pcb )
r1 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
+ demi_pas ) / Board.m_GridRouting;
if( r1 < 0 || r1 >= Nrows )
{
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
......@@ -326,8 +337,10 @@ int Build_Work( BOARD* Pcb )
wxMessageBox( msg );
return 0;
}
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
+ demi_pas ) / Board.m_GridRouting;
if( c1 < 0 || c1 >= Ncols )
{
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
......@@ -340,6 +353,7 @@ int Build_Work( BOARD* Pcb )
r2 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
+ demi_pas ) / Board.m_GridRouting;
if( r2 < 0 || r2 >= Nrows )
{
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
......@@ -347,8 +361,10 @@ int Build_Work( BOARD* Pcb )
wxMessageBox( msg );
return 0;
}
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
+ demi_pas ) / Board.m_GridRouting;
if( c2 < 0 || c2 >= Ncols )
{
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
......
......@@ -16,7 +16,8 @@
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
* that store the list of schematic items that are concerned by the command to undo or redo
* and is created for each command to undo (handle also a command to redo).
* each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or modified),
* 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)
*
......@@ -49,9 +50,11 @@
* => the copy of item(s) is moved in Undo list
*
* - add item(s) command
* => The list of item(s) is used to create a deleted list in undo list(same as a delete command)
* => The list of item(s) is used to create a deleted list in undo list(same as a delete
* command)
*
* Some block operations that change items can be undoed without memorise items, just the coordiantes of the transform:
* Some block operations that change items can be undoed without memorise items, just the
* coordiantes of the transform:
* move list of items (undo/redo is made by moving with the opposite move vector)
* mirror (Y) and flip list of items (undo/redo is made by mirror or flip items)
* so they are handled specifically.
......@@ -106,10 +109,6 @@ static bool TestForExistingItem( BOARD* aPcb, BOARD_ITEM* aItem )
}
/**************************************************************/
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
/***************************************************************/
/**
* Function SwapData
* Used in undo / redo command:
......@@ -119,6 +118,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
* @param aItem = the item
* @param aImage = a copy of the item
*/
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
{
if( aItem == NULL || aImage == NULL )
{
......@@ -173,16 +173,22 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
EXCHG( track->m_Width, image->m_Width );
EXCHG( track->m_Shape, image->m_Shape );
int atmp = track->GetDrillValue();
if( track->IsDrillDefault() )
atmp = -1;
int itmp = image->GetDrillValue();
if( image->IsDrillDefault() )
itmp = -1;
EXCHG(itmp, atmp );
if( atmp > 0 )
track->SetDrillValue( atmp );
else
track->SetDrillDefault();
if( itmp > 0 )
image->SetDrillValue( itmp );
else
......@@ -203,11 +209,11 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
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 );
case PCB_TARGET_T:
EXCHG( ( (PCB_TARGET*) aItem )->m_Pos, ( (PCB_TARGET*) aImage )->m_Pos );
EXCHG( ( (PCB_TARGET*) aItem )->m_Width, ( (PCB_TARGET*) aImage )->m_Width );
EXCHG( ( (PCB_TARGET*) aItem )->m_Size, ( (PCB_TARGET*) aImage )->m_Size );
EXCHG( ( (PCB_TARGET*) aItem )->m_Shape, ( (PCB_TARGET*) aImage )->m_Shape );
break;
case TYPE_DIMENSION:
......@@ -217,8 +223,10 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
( (DIMENSION*) aImage )->SetText( txt );
EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness, ( (DIMENSION*) aImage )->m_Text->m_Thickness );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror, ( (DIMENSION*) aImage )->m_Text->m_Mirror );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness,
( (DIMENSION*) aImage )->m_Text->m_Thickness );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror,
( (DIMENSION*) aImage )->m_Text->m_Mirror );
}
break;
......@@ -230,13 +238,10 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
}
/************************************************************/
BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
/************************************************************/
/* Routine to create a new copy of given struct.
* The new object is not put in list (not linked)
*/
BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
{
if( aItem == NULL )
{
......@@ -295,11 +300,11 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
}
break;
case TYPE_MIRE:
case PCB_TARGET_T:
{
MIREPCB* new_mire = new MIREPCB( aItem->GetParent() );
new_mire->Copy( (MIREPCB*) aItem );
return new_mire;
PCB_TARGET* target = new PCB_TARGET( aItem->GetParent() );
target->Copy( (PCB_TARGET*) aItem );
return target;
}
break;
......@@ -413,6 +418,7 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
{
BOARD_ITEM* item = (BOARD_ITEM*) commandToUndo->GetPickedItem( ii );
UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii );
if( command == UR_UNSPECIFIED )
{
command = aTypeCommand;
......@@ -461,7 +467,9 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
}
else // Should not occur
{
delete commandToUndo;
}
}
......@@ -555,9 +563,8 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
default:
{
wxString msg;
msg.Printf( wxT(
"PutDataInPreviousState() error (unknown code %X)" ),
aList->GetPickedItemStatus( ii ) );
msg.Printf( wxT( "PutDataInPreviousState() error (unknown code %X)" ),
aList->GetPickedItemStatus( ii ) );
wxMessageBox( msg );
}
break;
......@@ -573,10 +580,6 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
}
/**********************************************************/
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
/**********************************************************/
/**
* Function GetBoardFromUndoList
* Undo the last edition:
......@@ -584,6 +587,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
* - Get an old version of the board state from Undo list
* @return none
*/
void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
{
if( GetScreen()->GetUndoCommandCount() <= 0 )
return;
......@@ -630,10 +634,6 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& event )
}
/***********************************************************************************/
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
/**********************************************************************************/
/**
* Function ClearUndoORRedoList
* free the undo or redo list from List element
......@@ -645,11 +645,13 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
* items (commands stored in list) are removed from the beginning of the list.
* So this function can be called to remove old commands
*/
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
{
if( aItemCount == 0 )
return;
unsigned icnt = aList.m_CommandsList.size();
if( aItemCount > 0 )
icnt = aItemCount;
......@@ -657,6 +659,7 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
{
if( aList.m_CommandsList.size() == 0 )
break;
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
......
This diff is collapsed.
......@@ -842,6 +842,7 @@ public:
{
if( (unsigned) index < m_ZoneDescriptorList.size() )
return m_ZoneDescriptorList[index];
return NULL;
}
......@@ -879,8 +880,8 @@ public:
/**
* Function AddArea
* Add an empty copper area to board areas list
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands)
* can be NULL
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
* in undo commands) can be NULL
* @param aNetcode = the necode of the copper area (0 = no net)
* @param aLayer = the layer of area
* @param aStartPointPosition = position of the first point of the polygon outline of this area
......@@ -924,8 +925,8 @@ public:
* Function ClipAreaPolygon
* Process an area that has been modified, by clipping its polygon against itself.
* This may change the number and order of copper areas in the net.
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands)
* can be NULL
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
* in undo commands) can be NULL
* @param aCurrArea = the zone to process
* @param bMessageBoxInt == true, shows message when clipping occurs.
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
......@@ -940,7 +941,7 @@ public:
ZONE_CONTAINER* aCurrArea,
bool bMessageBoxArc,
bool bMessageBoxInt,
bool bRetainArcs = TRUE );
bool bRetainArcs = true );
/**
* Process an area that has been modified, by clipping its polygon against
......@@ -949,7 +950,7 @@ public:
* @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas
* (useful in undo commands. Can be NULL
* @param modified_area = area to test
* @param bMessageBoxInt : if TRUE, shows message boxes when clipping occurs.
* @param bMessageBoxInt : if true, shows message boxes when clipping occurs.
* @param bMessageBoxArc if true, shows message when clipping can't be done due to arcs.
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
......
......@@ -108,8 +108,9 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
while( aReader->ReadLine() )
{
Line = aReader->Line();
if( strnicmp( Line, "$EndDIMENSION", 4 ) == 0 )
return TRUE;
return true;
if( Line[0] == 'V' )
{
......@@ -125,6 +126,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
if( layer < FIRST_NO_COPPER_LAYER )
layer = FIRST_NO_COPPER_LAYER;
if( layer > LAST_NO_COPPER_LAYER )
layer = LAST_NO_COPPER_LAYER;
......@@ -221,7 +223,7 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
}
}
return FALSE;
return false;
}
......@@ -275,8 +277,10 @@ void DIMENSION::Rotate(const wxPoint& aRotCentre, int aAngle)
RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle );
m_Text->m_Orient += aAngle;
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) )
m_Text->m_Orient -= 1800;
......@@ -323,8 +327,10 @@ void DIMENSION::Mirror(const wxPoint& axis_pos)
INVERT( m_Pos.y );
INVERT( m_Text->m_Pos.y );
INVERT_ANGLE( m_Text->m_Orient );
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) )
m_Text->m_Orient -= 1800;
......@@ -456,10 +462,13 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
if( TraitG_ox > Barre_ox )
hx = -hx;
if( TraitG_ox == Barre_ox )
hx = 0;
if( TraitG_oy > Barre_oy )
hy = -hy;
if( TraitG_oy == Barre_oy )
hy = 0;
......@@ -503,16 +512,17 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
TraitD_fy = Barre_fy + hy;
/* Calculate the better text position and orientation: */
m_Pos.x = m_Text->m_Pos.x
= (Barre_fx + TraitG_fx) / 2;
m_Pos.y = m_Text->m_Pos.y
= (Barre_fy + TraitG_fy) / 2;
m_Pos.x = m_Text->m_Pos.x = (Barre_fx + TraitG_fx) / 2;
m_Pos.y = m_Text->m_Pos.y = (Barre_fy + TraitG_fy) / 2;
m_Text->m_Orient = -(int) (angle * 1800 / M_PI);
if( m_Text->m_Orient < 0 )
m_Text->m_Orient += 3600;
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
m_Text->m_Orient -= 1800;
......@@ -537,6 +547,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
m_Text->Draw( panel, DC, mode_color, offset );
BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return;
......@@ -734,6 +745,7 @@ bool DIMENSION::HitTest( EDA_RECT& refArea )
{
if( refArea.Contains( m_Pos ) )
return true;
return false;
}
......
......@@ -109,7 +109,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
Line = aReader->Line();
if( strnicmp( Line, "$End", 4 ) == 0 )
return TRUE; /* End of description */
return true; /* End of description */
if( Line[0] == 'P' )
{
......@@ -175,7 +175,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
}
}
return FALSE;
return false;
}
......@@ -227,9 +227,9 @@ MODULE* DRAWSEGMENT::GetParentModule() const
void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& aOffset )
{
int ux0, uy0, dx, dy;
int l_piste;
int l_trace;
int color, mode;
int rayon;
int radius;
BOARD * brd = GetBoard( );
......@@ -239,7 +239,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
color = brd->GetLayerColor( GetLayer() );
GRSetDrawMode( DC, draw_mode );
l_piste = m_Width >> 1; /* half trace width */
l_trace = m_Width >> 1; /* half trace width */
// Line start point or Circle and Arc center
ux0 = m_Start.x + aOffset.x;
......@@ -250,34 +250,37 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
dy = m_End.y + aOffset.y;
mode = DisplayOpt.DisplayDrawItems;
if( m_Flags & FORCE_SKETCH )
mode = SKETCH;
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
if( l_trace < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
mode = FILAIRE;
switch( m_Shape )
{
case S_CIRCLE:
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
if( mode == FILAIRE )
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color );
}
else if( mode == SKETCH )
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon - l_piste, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon + l_piste, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - l_trace, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + l_trace, color );
}
else
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color );
}
break;
case S_ARC:
int StAngle, EndAngle;
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + m_Angle;
......@@ -295,19 +298,19 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
if( mode == FILAIRE )
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, color );
radius, color );
else if( mode == SKETCH )
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon - l_piste, color );
radius - l_trace, color );
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon + l_piste, color );
radius + l_trace, color );
}
else
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, m_Width, color );
radius, m_Width, color );
}
break;
case S_CURVE:
......@@ -329,15 +332,17 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
else
{
GRFillCSegm( &panel->m_ClipBox, DC,
m_BezierPoints[i].x, m_BezierPoints[i].y,
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
m_BezierPoints[i].x, m_BezierPoints[i].y,
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
m_Width, color );
}
}
break;
default:
if( mode == FILAIRE )
{
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color );
}
else if( mode == SKETCH )
{
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
......@@ -348,6 +353,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
m_Width, color );
}
break;
}
}
......@@ -388,6 +394,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
default:
frame->AppendMsgPanel( shape, _( "Segment" ), RED );
}
wxString start;
start << GetStart();
......@@ -396,8 +403,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( start, end, DARKGREEN );
frame->AppendMsgPanel( _( "Layer" ),
board->GetLayerName( m_Layer ), DARKBROWN );
frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN );
valeur_param( (unsigned) m_Width, msg );
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
......@@ -444,6 +450,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
if( ii == 0 )
p_end = pt;
bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x );
bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y );
p_end.x = MAX( p_end.x, pt.x );
......@@ -471,10 +478,10 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
case S_CIRCLE:
case S_ARC:
{
int rayon = GetRadius();
int radius = GetRadius();
int dist = (int) hypot( (double) relPos.x, (double) relPos.y );
if( abs( rayon - dist ) <= ( m_Width / 2 ) )
if( abs( radius - dist ) <= ( m_Width / 2 ) )
{
if( m_Shape == S_CIRCLE )
return true;
......@@ -498,8 +505,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
case S_CURVE:
for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
{
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1],
m_BezierPoints[i-1], m_Width / 2 ) )
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1], m_BezierPoints[i-1], m_Width / 2 ) )
return true;
}
break;
......@@ -527,6 +533,7 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea )
// Text if area intersects the circle:
EDA_RECT area = refArea;
area.Inflate( radius );
if( area.Contains( m_Start ) )
return true;
}
......
......@@ -77,7 +77,7 @@ void EDGE_MODULE::SetDrawCoord()
*/
void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
{
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
int color, type_trace;
int typeaff;
PCB_BASE_FRAME* frame;
......@@ -105,9 +105,11 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge;
if( m_Layer <= LAST_COPPER_LAYER )
{
typeaff = frame->m_DisplayPcbTrackFill;
if( !typeaff )
typeaff = SKETCH;
}
......@@ -125,53 +127,53 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
else
// SKETCH Mode
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, m_Width, color );
break;
case S_CIRCLE:
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
if( typeaff == FILAIRE )
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, color );
}
else
{
if( typeaff == FILLED )
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon,
m_Width, color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius, m_Width, color );
}
else // SKETCH Mode
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
rayon + (m_Width / 2), color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
rayon - (m_Width / 2), color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius + (m_Width / 2), color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, radius - (m_Width / 2), color );
}
}
break;
case S_ARC:
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
radius = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + m_Angle;
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
if( typeaff == FILAIRE )
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, color );
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, color );
}
else if( typeaff == FILLED )
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon,
m_Width, color );
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color );
}
else // SKETCH Mode
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon + (m_Width / 2), color );
radius + (m_Width / 2), color );
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon - (m_Width / 2), color );
radius - (m_Width / 2), color );
}
break;
......@@ -190,8 +192,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
pt += module->m_Pos - offset;
}
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],
TRUE, m_Width, color, color );
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], true, m_Width, color, color );
break;
}
}
......@@ -208,34 +209,27 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
return;
BOARD* board = (BOARD*) module->GetParent();
if( !board )
return;
frame->ClearMsgPanel();
frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text,
DARKCYAN );
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
frame->AppendMsgPanel( _( "Mod Layer" ),
board->GetLayerName( module->GetLayer() ), RED );
frame->AppendMsgPanel( _( "Seg Layer" ),
board->GetLayerName( GetLayer() ), RED );
frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
valeur_param( m_Width, msg );
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
}
/*******************************************/
bool EDGE_MODULE::Save( FILE* aFile ) const
/*******************************************/
{
int ret = -1;
......@@ -271,8 +265,7 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
m_Width, m_Layer );
for( unsigned i = 0; i<m_PolyPoints.size(); ++i )
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x,
m_PolyPoints[i].y );
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x, m_PolyPoints[i].y );
break;
......@@ -361,11 +354,13 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
m_PolyPoints.clear();
m_PolyPoints.reserve( pointCount );
for( ii = 0; ii<pointCount; ii++ )
{
if( aReader->ReadLine() )
{
Buf = aReader->Line();
if( strncmp( Buf, "Dl", 2 ) != 0 )
{
error = 1;
......@@ -398,15 +393,18 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
// Check for a reasonable width:
if( m_Width <= 1 )
m_Width = 1;
if( m_Width > MAX_WIDTH )
m_Width = MAX_WIDTH;
// Check for a reasonable layer:
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
// can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed.
// @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER
// @todo: changes use of EDGE_MODULE these footprints and allows only
// m_Layer >= FIRST_NON_COPPER_LAYER
if( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
m_Layer = SILKSCREEN_N_FRONT;
return error;
}
......
......@@ -16,20 +16,20 @@
#include "richio.h"
MIREPCB::MIREPCB( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_MIRE )
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_TARGET_T )
{
m_Shape = 0;
m_Size = 5000;
}
MIREPCB::~MIREPCB()
PCB_TARGET::~PCB_TARGET()
{
}
void MIREPCB::Copy( MIREPCB* source )
void PCB_TARGET::Copy( PCB_TARGET* source )
{
m_Layer = source->m_Layer;
m_Width = source->m_Width;
......@@ -42,37 +42,41 @@ void MIREPCB::Copy( MIREPCB* source )
/* Read the description from the PCB file.
*/
bool MIREPCB::ReadMirePcbDescr( LINE_READER* aReader )
bool PCB_TARGET::ReadMirePcbDescr( LINE_READER* aReader )
{
char* Line;
while( aReader->ReadLine() )
{
Line = aReader->Line();
if( strnicmp( Line, "$End", 4 ) == 0 )
return TRUE;
return true;
if( Line[0] == 'P' )
{
sscanf( Line + 2, " %X %d %d %d %d %d %lX",
&m_Shape, &m_Layer,
&m_Pos.x, &m_Pos.y,
&m_Size, &m_Width, &m_TimeStamp );
if( m_Layer < FIRST_NO_COPPER_LAYER )
m_Layer = FIRST_NO_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER;
}
}
return FALSE;
return false;
}
bool MIREPCB::Save( FILE* aFile ) const
bool PCB_TARGET::Save( FILE* aFile ) const
{
bool rc = false;
if( fprintf( aFile, "$MIREPCB\n" ) != sizeof("$MIREPCB\n")-1 )
if( fprintf( aFile, "$PCB_TARGET\n" ) != sizeof("$PCB_TARGET\n")-1 )
goto out;
fprintf( aFile, "Po %X %d %d %d %d %d %8.8lX\n",
......@@ -80,7 +84,7 @@ bool MIREPCB::Save( FILE* aFile ) const
m_Pos.x, m_Pos.y,
m_Size, m_Width, m_TimeStamp );
if( fprintf( aFile, "$EndMIREPCB\n" ) != sizeof("$EndMIREPCB\n")-1 )
if( fprintf( aFile, "$EndPCB_TARGET\n" ) != sizeof("$EndPCB_TARGET\n")-1 )
goto out;
rc = true;
......@@ -92,13 +96,13 @@ out:
/* Draw MIREPCB object: 2 segments + 1 circle
/* Draw PCB_TARGET object: 2 segments + 1 circle
* The circle radius is half the radius of the target
* 2 lines have length the diameter of the target
*/
void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoint& offset )
void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoint& offset )
{
int rayon, ox, oy, gcolor, width;
int radius, ox, oy, gcolor, width;
int dx1, dx2, dy1, dy2;
int typeaff;
......@@ -106,10 +110,11 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
oy = m_Pos.y + offset.y;
BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false )
return;
gcolor = brd->GetLayerColor(m_Layer);
gcolor = brd->GetLayerColor( m_Layer );
GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems;
......@@ -118,7 +123,7 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
if( DC->LogicalToDeviceXRel( width ) < 2 )
typeaff = FILAIRE;
rayon = m_Size / 4;
radius = m_Size / 4;
switch( typeaff )
{
......@@ -126,25 +131,25 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
width = 0;
case FILLED:
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon, width, gcolor );
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius, width, gcolor );
break;
case SKETCH:
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon + (width / 2), gcolor );
GRCircle( &panel->m_ClipBox, DC, ox, oy, rayon - (width / 2), gcolor );
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius + (width / 2), gcolor );
GRCircle( &panel->m_ClipBox, DC, ox, oy, radius - (width / 2), gcolor );
break;
}
rayon = m_Size / 2;
dx1 = rayon;
radius = m_Size / 2;
dx1 = radius;
dy1 = 0;
dx2 = 0;
dy2 = rayon;
dy2 = radius;
if( m_Shape ) /* Form X */
{
dx1 = dy1 = ( rayon * 7 ) / 5;
dx1 = dy1 = ( radius * 7 ) / 5;
dx2 = dx1;
dy2 = -dy1;
}
......@@ -153,19 +158,13 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
{
case FILAIRE:
case FILLED:
GRLine( &panel->m_ClipBox, DC, ox - dx1, oy - dy1,
ox + dx1, oy + dy1, width, gcolor );
GRLine( &panel->m_ClipBox, DC, ox - dx2, oy - dy2,
ox + dx2, oy + dy2, width, gcolor );
GRLine( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
GRLine( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
break;
case SKETCH:
GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1,
ox + dx1, oy + dy1,
width, gcolor );
GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2,
ox + dx2, oy + dy2,
width, gcolor );
GRCSegm( &panel->m_ClipBox, DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
GRCSegm( &panel->m_ClipBox, DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
break;
}
}
......@@ -177,12 +176,12 @@ void MIREPCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoi
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool MIREPCB::HitTest( const wxPoint& refPos )
bool PCB_TARGET::HitTest( const wxPoint& refPos )
{
int dX = refPos.x - m_Pos.x;
int dY = refPos.y - m_Pos.y;
int rayon = m_Size / 2;
return abs( dX ) <= rayon && abs( dY ) <= rayon;
int radius = m_Size / 2;
return abs( dX ) <= radius && abs( dY ) <= radius;
}
......@@ -192,10 +191,11 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
* @param refArea : the given EDA_RECT
* @return bool - true if a hit, else false
*/
bool MIREPCB::HitTest( EDA_RECT& refArea )
bool PCB_TARGET::HitTest( EDA_RECT& refArea )
{
if( refArea.Contains( m_Pos ) )
return true;
return false;
}
......@@ -206,7 +206,7 @@ bool MIREPCB::HitTest( EDA_RECT& refArea )
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
void PCB_TARGET::Rotate(const wxPoint& aRotCentre, int aAngle)
{
RotatePoint( &m_Pos, aRotCentre, aAngle );
}
......@@ -217,14 +217,14 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void MIREPCB::Flip(const wxPoint& aCentre )
void PCB_TARGET::Flip(const wxPoint& aCentre )
{
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
SetLayer( ChangeSideNumLayer( GetLayer() ) );
}
EDA_RECT MIREPCB::GetBoundingBox() const
EDA_RECT PCB_TARGET::GetBoundingBox() const
{
EDA_RECT bBox;
bBox.SetX( m_Pos.x - m_Size/2 );
......@@ -236,7 +236,7 @@ EDA_RECT MIREPCB::GetBoundingBox() const
}
wxString MIREPCB::GetSelectMenuText() const
wxString PCB_TARGET::GetSelectMenuText() const
{
wxString text;
wxString msg;
......
/****************************************************/
/* MIREPCB class definition. (targets for photos) */
/* PCB_TARGET class definition. (targets for photos) */
/****************************************************/
#ifndef MIRE_H
......@@ -9,7 +9,7 @@
#include "richio.h"
class MIREPCB : public BOARD_ITEM
class PCB_TARGET : public BOARD_ITEM
{
public:
int m_Width;
......@@ -18,11 +18,11 @@ public:
int m_Size;
public:
MIREPCB( BOARD_ITEM* aParent );
~MIREPCB();
PCB_TARGET( BOARD_ITEM* aParent );
~PCB_TARGET();
MIREPCB* Next() const { return (MIREPCB*) Pnext; }
MIREPCB* Back() const { return (MIREPCB*) Pnext; }
PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; }
PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; }
wxPoint& GetPosition()
{
......@@ -65,7 +65,7 @@ public:
bool ReadMirePcbDescr( LINE_READER* aReader );
void Copy( MIREPCB* source );
void Copy( PCB_TARGET* source );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& offset = ZeroOffset );
......
......@@ -113,16 +113,17 @@ void MODULE::Copy( MODULE* aModule )
/* 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 );
newpad->Copy( pad );
m_Pads.PushBack( newpad );
}
/* Copy auxiliary data: Drawings */
m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
......@@ -152,15 +153,18 @@ void MODULE::Copy( MODULE* aModule )
// Ensure there is one (or more) item in m_3D_Drawings
m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
{
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
continue;
S3D_MASTER* t3d = m_3D_Drawings;
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
// exist, but is empty :
// use it.
{ // exist, but is empty : use it.
t3d->Copy( item );
}
else
{
t3d = new S3D_MASTER( this );
......@@ -297,12 +301,16 @@ bool MODULE::Save( FILE* aFile ) const
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
fprintf( aFile, "AR %s\n", TO_UTF8( m_Path ) );
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
if( m_LocalSolderMaskMargin != 0 )
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
if( m_LocalSolderPasteMargin != 0 )
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
if( m_LocalSolderPasteMarginRatio != 0 )
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
if( m_LocalClearance != 0 )
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
......@@ -310,10 +318,13 @@ bool MODULE::Save( FILE* aFile ) const
if( m_Attributs != MOD_DEFAULT )
{
fprintf( aFile, "At " );
if( m_Attributs & MOD_CMS )
fprintf( aFile, "SMD " );
if( m_Attributs & MOD_VIRTUAL )
fprintf( aFile, "VIRTUAL " );
fprintf( aFile, "\n" );
}
......@@ -334,6 +345,7 @@ bool MODULE::Save( FILE* aFile ) const
case TYPE_EDGE_MODULE:
if( !item->Save( aFile ) )
goto out;
break;
default:
......@@ -422,11 +434,13 @@ int MODULE::Read_3D_Descr( LINE_READER* aReader )
while( aReader->ReadLine() )
{
Line = aReader->Line();
switch( Line[0] )
{
case '$':
if( Line[1] == 'E' )
return 0;
return 1;
case 'N': // Shape File Name
......@@ -484,6 +498,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
{
if( Line[1] == 'E' )
break;
if( Line[1] == 'P' )
{
D_PAD* pad = new D_PAD( this );
......@@ -495,6 +510,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
m_Pads.PushBack( pad );
continue;
}
if( Line[1] == 'S' )
Read_3D_Descr( aReader );
}
......@@ -517,10 +533,13 @@ int MODULE::ReadDescr( LINE_READER* aReader )
&m_LastEdit_Time, &m_TimeStamp, BufCar1 );
m_ModuleStatus = 0;
if( BufCar1[0] == 'F' )
SetLocked( true );
if( BufCar1[1] == 'P' )
m_ModuleStatus |= MODULE_is_PLACED;
break;
case 'L': /* Li = read the library name of the footprint */
......@@ -539,15 +558,20 @@ int MODULE::ReadDescr( LINE_READER* aReader )
sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
m_CntRot180 = itmp2 & 0x0F;
if( m_CntRot180 > 10 )
m_CntRot180 = 10;
m_CntRot90 = itmp1 & 0x0F;
if( m_CntRot90 > 10 )
m_CntRot90 = 0;
itmp1 = (itmp1 >> 4) & 0x0F;
if( itmp1 > 10 )
itmp1 = 0;
m_CntRot90 |= itmp1 << 4;
break;
......@@ -557,21 +581,25 @@ int MODULE::ReadDescr( LINE_READER* aReader )
/* At = (At)tributes of module */
if( strstr( PtLine, "SMD" ) )
m_Attributs |= MOD_CMS;
if( strstr( PtLine, "VIRTUAL" ) )
m_Attributs |= MOD_VIRTUAL;
}
if( Line[1] == 'R' )
{
// alternate reference, e.g. /478C2408/478AD1B6
sscanf( PtLine, " %s", BufLine );
m_Path = FROM_UTF8( BufLine );
}
break;
case 'T': /* Read a footprint text description (ref, value, or
* drawing */
TEXTE_MODULE * textm;
sscanf( Line + 1, "%d", &itmp1 );
if( itmp1 == TEXT_is_REFERENCE )
textm = m_Reference;
else if( itmp1 == TEXT_is_VALUE )
......@@ -609,6 +637,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
m_LocalClearance = atoi( Line + 16 );
break;
default:
......@@ -617,12 +646,12 @@ int MODULE::ReadDescr( LINE_READER* aReader )
}
/* Recalculate the bounding box */
Set_Rectangle_Encadrement();
CalculateBoundingBox();
return 0;
}
void MODULE::Set_Rectangle_Encadrement()
void MODULE::CalculateBoundingBox()
{
m_BoundaryBox = GetFootPrintRect();
m_Surface = ABS( (double) m_BoundaryBox.GetWidth() * m_BoundaryBox.GetHeight() );
......@@ -673,14 +702,14 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
{
int nbpad;
char bufcar[512], Line[512];
bool flag = FALSE;
bool flag = false;
wxString msg;
BOARD* board = GetBoard();
frame->EraseMsgBox();
if( frame->m_Ident != PCB_FRAME )
flag = TRUE;
flag = true;
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN );
......@@ -783,9 +812,6 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
#else
if( buf == aPadName )
#endif
return pad;
}
......@@ -824,10 +850,12 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
case TYPE_TEXTE_MODULE:
result = inspector->Inspect( m_Reference, testData );
if( result == SEARCH_QUIT )
break;
result = inspector->Inspect( m_Value, testData );
if( result == SEARCH_QUIT )
break;
......@@ -908,6 +936,7 @@ void MODULE::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel + 1, os ) << "<mpads>\n";
p = m_Pads;
for( ; p; p = p->Next() )
p->Show( nestLevel + 2, os );
......@@ -915,12 +944,14 @@ void MODULE::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel + 1, os ) << "<mdrawings>\n";
p = m_Drawings;
for( ; p; p = p->Next() )
p->Show( nestLevel + 2, os );
NestedSpace( nestLevel + 1, os ) << "</mdrawings>\n";
p = m_Son;
for( ; p; p = p->Next() )
{
p->Show( nestLevel + 1, os );
......
......@@ -114,10 +114,10 @@ public:
*/
/**
* Function Set_Rectangle_Encadrement
* Function CalculateBoundingBox
* calculates the bounding box in board coordinates.
*/
void Set_Rectangle_Encadrement();
void CalculateBoundingBox();
/**
* Function GetFootPrintRect()
......
......@@ -73,48 +73,54 @@ int ChangeSideNumLayer( int oldlayer )
/* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
*/
int ChangeSideMaskLayer( int masque )
int ChangeSideMaskLayer( int aMask )
{
int newmasque;
int newMask;
newmasque = masque & ~(LAYER_BACK | LAYER_FRONT |
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( masque & LAYER_BACK )
newmasque |= LAYER_FRONT;
if( masque & LAYER_FRONT )
newmasque |= LAYER_BACK;
if( masque & SILKSCREEN_LAYER_BACK )
newmasque |= SILKSCREEN_LAYER_FRONT;
if( masque & SILKSCREEN_LAYER_FRONT )
newmasque |= SILKSCREEN_LAYER_BACK;
if( masque & ADHESIVE_LAYER_BACK )
newmasque |= ADHESIVE_LAYER_FRONT;
if( masque & ADHESIVE_LAYER_FRONT )
newmasque |= ADHESIVE_LAYER_BACK;
if( masque & SOLDERMASK_LAYER_BACK )
newmasque |= SOLDERMASK_LAYER_FRONT;
if( masque & SOLDERMASK_LAYER_FRONT )
newmasque |= SOLDERMASK_LAYER_BACK;
if( masque & SOLDERPASTE_LAYER_BACK )
newmasque |= SOLDERPASTE_LAYER_FRONT;
if( masque & SOLDERPASTE_LAYER_FRONT )
newmasque |= SOLDERPASTE_LAYER_BACK;
if( masque & ADHESIVE_LAYER_BACK )
newmasque |= ADHESIVE_LAYER_FRONT;
if( masque & ADHESIVE_LAYER_FRONT )
newmasque |= ADHESIVE_LAYER_BACK;
return newmasque;
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
}
......@@ -160,7 +166,7 @@ void MODULE::Flip(const wxPoint& aCentre )
// Move module to its final position:
wxPoint finalPos = m_Pos;
finalPos.y = aCentre.y - ( finalPos.y - aCentre.y ); /// Mirror the Y position
SetPosition(finalPos);
SetPosition(finalPos);
/* Flip layer */
SetLayer( ChangeSideNumLayer( GetLayer() ) );
......@@ -171,6 +177,7 @@ void MODULE::Flip(const wxPoint& aCentre )
/* Mirror inversion layers pads. */
pt_pad = m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
pt_pad->m_Pos.y -= m_Pos.y;
......@@ -182,7 +189,7 @@ void MODULE::Flip(const wxPoint& aCentre )
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_pad->m_Orient );
/* flip pads layers*/
pt_pad->m_Masque_Layer = ChangeSideMaskLayer( pt_pad->m_Masque_Layer );
pt_pad->m_layerMask = ChangeSideMaskLayer( pt_pad->m_layerMask );
}
/* Mirror reference. */
......@@ -285,7 +292,7 @@ void MODULE::Flip(const wxPoint& aCentre )
}
}
Set_Rectangle_Encadrement();
CalculateBoundingBox();
}
void MODULE::SetPosition( const wxPoint& newpos )
......@@ -327,7 +334,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
}
}
Set_Rectangle_Encadrement();
CalculateBoundingBox();
}
......@@ -373,5 +380,5 @@ void MODULE::SetOrientation( int newangle )
}
}
Set_Rectangle_Encadrement();
CalculateBoundingBox();
}
This diff is collapsed.
......@@ -73,7 +73,7 @@ public:
*/
};
int m_Masque_Layer; // Bitwise layer :1= copper layer, 15= cmp,
int m_layerMask; // Bitwise layer :1= copper layer, 15= cmp,
// 2..14 = internal layers
// 16 .. 31 = technical layers
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -281,7 +281,7 @@ public:
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = TRUE );
int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = true );
/**
* Function Fill_Zone_Areas_With_Segments
......
This diff is collapsed.
......@@ -36,15 +36,15 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
// there are some restrictions on the order of items in the general case.
// all items in m_Drawings for instance should be contiguous.
// *** all items in a same list (shown here) must be contiguous ****
TYPE_MARKER_PCB, // in m_markers
TYPE_MARKER_PCB, // in m_markers
TYPE_TEXTE, // in m_Drawings
TYPE_DRAWSEGMENT, // in m_Drawings
TYPE_DIMENSION, // in m_Drawings
TYPE_MIRE, // in m_Drawings
TYPE_DIMENSION, // in m_Drawings
PCB_TARGET_T, // in m_Drawings
TYPE_VIA, // in m_Tracks
TYPE_TRACK, // in m_Tracks
TYPE_PAD, // in modules
TYPE_TEXTE_MODULE, // in modules
TYPE_TEXTE_MODULE, // in modules
TYPE_MODULE, // in m_Modules
TYPE_ZONE, // in m_Zones
TYPE_ZONE_CONTAINER, // in m_ZoneDescriptorList
......@@ -70,7 +70,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
TYPE_TEXTE,
TYPE_DRAWSEGMENT,
TYPE_DIMENSION,
TYPE_MIRE,
PCB_TARGET_T,
TYPE_VIA,
TYPE_TRACK,
TYPE_PAD,
......@@ -153,6 +153,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case TYPE_PAD:
{
MODULE* m = (MODULE*) item->GetParent();
if( m->GetReference() == wxT( "Y2" ) )
{
breakhere++;
......@@ -187,6 +188,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case TYPE_TEXTE_MODULE:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
if( tm->m_Text == wxT( "10uH" ) )
{
breakhere++;
......@@ -197,6 +199,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case TYPE_MODULE:
{
MODULE* m = (MODULE*) item;
if( m->GetReference() == wxT( "C98" ) )
{
breakhere++;
......@@ -217,10 +220,12 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case TYPE_PAD:
// there are pad specific visibility controls.
// Criterias to select a pad is:
// for smd pads: the module parent must be seen, and pads on the corresponding board side must be seen
// for smd pads: the module parent must be seen, and pads on the corresponding
// board side must be seen
// if pad is a thru hole, then it can be visible when its parent module is not.
// for through pads: pads on Front or Back board sides must be seen
pad = (D_PAD*) item;
if( (pad->m_Attribut != PAD_SMD) &&
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers
{
......@@ -229,7 +234,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
pad_through = true;
}
else // smd, so use pads test after module test
{
module = (MODULE*) item->GetParent();
}
break;
case TYPE_VIA:
......@@ -253,7 +261,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case TYPE_DIMENSION:
break;
case TYPE_MIRE:
case PCB_TARGET_T:
break;
case TYPE_TEXTE_MODULE:
......@@ -298,10 +306,12 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
{
if( m_Guide->IgnorePads() )
goto exit;
if( ! pad_through )
{
if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(LAYER_N_FRONT ) )
goto exit;
if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(LAYER_N_BACK ) )
goto exit;
}
......
This diff is collapsed.
......@@ -33,7 +33,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
D( g_CurrentTrackList.VerifyListIntegrity(); )
// Delete the current trace
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, FALSE );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
// delete the most recently entered
delete g_CurrentTrackList.PopBack();
......@@ -51,13 +51,11 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
}
}
while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() ==
TYPE_VIA )
while( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() == TYPE_VIA )
{
delete g_CurrentTrackList.PopBack();
if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() !=
TYPE_VIA )
if( g_CurrentTrackSegment && g_CurrentTrackSegment->Type() != TYPE_VIA )
previous_layer = g_CurrentTrackSegment->GetLayer();
}
......@@ -66,8 +64,8 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
setActiveLayer( previous_layer );
UpdateStatusBar();
if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more,
// or 0
if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more, or 0
{
if( g_CurrentTrackList.GetCount() == 1
&& g_CurrentTrackSegment->Type() != TYPE_VIA )
......@@ -89,7 +87,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
else
{
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
return g_CurrentTrackSegment;
}
......@@ -178,8 +176,9 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
if( pt_segm == NULL )
return;
TRACK* trackList = Marque_Une_Piste( GetBoard(), pt_segm,
&segments_to_delete_count, NULL, NULL, true );
TRACK* trackList = MarkTrace( GetBoard(), pt_segm, &segments_to_delete_count,
NULL, NULL, true );
if( segments_to_delete_count == 0 )
return;
......@@ -190,6 +189,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
int ii = 0;
TRACK* tracksegment = trackList;
TRACK* next_track;
for( ; ii < segments_to_delete_count; ii++, tracksegment = next_track )
{
next_track = tracksegment->Next();
......@@ -198,9 +198,9 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
//D( printf( "%s: track %p status=\"%s\"\n", __func__, tracksegment,
// TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) )
// ); )
D( std::cout<<__func__<<": track "<<tracksegment<<" status=" \
<<TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \
<<std::endl;)
D( std::cout << __func__ << ": track " << tracksegment << " status=" \
<< TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \
<< std::endl; )
GetBoard()->m_Track.Remove( tracksegment );
......@@ -212,6 +212,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
}
SaveCopyInUndoList( itemsList, UR_DELETED );
if( net_code > 0 )
test_1_net_connexion( DC, net_code );
}
......@@ -565,7 +565,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_3D_Drawings.PushBack( new S3D_MASTER( m_CurrentModule ) );
m_CurrentModule->Set_Rectangle_Encadrement();
m_CurrentModule->CalculateBoundingBox();
m_Parent->OnModify();
......
......@@ -412,7 +412,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_3D_Drawings.PushBack( new S3D_MASTER( m_CurrentModule ) );
m_CurrentModule->Set_Rectangle_Encadrement();
m_CurrentModule->CalculateBoundingBox();
m_Parent->OnModify();
......
......@@ -94,12 +94,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
int color = 0;
if( m_dummyPad->m_Masque_Layer & LAYER_FRONT )
if( m_dummyPad->m_layerMask & LAYER_FRONT )
{
color = m_Board->GetVisibleElementColor( PAD_FR_VISIBLE );
}
if( m_dummyPad->m_Masque_Layer & LAYER_BACK )
if( m_dummyPad->m_layerMask & LAYER_BACK )
{
color |= m_Board->GetVisibleElementColor( PAD_BK_VISIBLE );
}
......@@ -202,7 +202,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
NEGATE( m_dummyPad->m_Offset.y );
NEGATE( m_dummyPad->m_DeltaSize.y );
/* flip pads layers*/
m_dummyPad->m_Masque_Layer = ChangeSideMaskLayer( m_dummyPad->m_Masque_Layer );
m_dummyPad->m_layerMask = ChangeSideMaskLayer( m_dummyPad->m_layerMask );
}
m_staticTextWarningPadFlipped->Show(m_isFlipped);
......@@ -284,7 +284,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
NORMALIZE_ANGLE_180( m_dummyPad->m_Orient );
// Set layers used by this pad: :
SetPadLayersList( m_dummyPad->m_Masque_Layer );
SetPadLayersList( m_dummyPad->m_layerMask );
msg.Clear();
msg << m_dummyPad->m_Orient;
......@@ -621,13 +621,13 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
m_CurrentPad->m_LengthDie = g_Pad_Master.m_LengthDie;
if( m_CurrentPad->m_Masque_Layer != g_Pad_Master.m_Masque_Layer )
if( m_CurrentPad->m_layerMask != g_Pad_Master.m_layerMask )
{
rastnestIsChanged = true;
m_CurrentPad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
m_CurrentPad->m_layerMask = g_Pad_Master.m_layerMask;
}
if( m_isFlipped )
m_CurrentPad->m_Masque_Layer = ChangeSideMaskLayer( m_CurrentPad->m_Masque_Layer );
m_CurrentPad->m_layerMask = ChangeSideMaskLayer( m_CurrentPad->m_layerMask );
m_CurrentPad->SetPadName( g_Pad_Master.ReturnStringPadName() );
......@@ -660,7 +660,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
m_CurrentPad->ComputeShapeMaxRadius();
Module->Set_Rectangle_Encadrement();
Module->CalculateBoundingBox();
m_CurrentPad->DisplayInfo( m_Parent );
// redraw the area where the pad was
......@@ -862,7 +862,7 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
if( m_PadLayerDraft->GetValue() )
PadLayerMask |= DRAW_LAYER;
aPad->m_Masque_Layer = PadLayerMask;
aPad->m_layerMask = PadLayerMask;
/* Test for incorrect values */
if( aPromptOnError )
......
......@@ -9,10 +9,10 @@
class DRAG_SEGM
{
public:
TRACK* m_Segm; /* pointeur sur le segment a "dragger */
D_PAD* m_Pad_Start; /* pointeur sur le Pad origine si origine segment sur pad */
D_PAD* m_Pad_End; /* pointeur sur le Pad fin si fin segment sur pad */
int m_Flag; /* indicateur divers */
TRACK* m_Segm; /* pointer to the segment a "dragger */
D_PAD* m_Pad_Start; /* pointer to the pad origin if origin segment of pad */
D_PAD* m_Pad_End; /* pointer to the pad end if end segment of pad */
int m_Flag; /* indicator flags */
private:
wxPoint m_StartInitialValue;
......@@ -38,11 +38,11 @@ public:
extern std::vector<DRAG_SEGM> g_DragSegmentList;
/* Functions */
void Dessine_Segments_Dragges( EDA_DRAW_PANEL* panel, wxDC* DC );
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC );
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module );
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad );
void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
wxPoint& point, int MasqueLayer, int net_code );
wxPoint& point, int LayerMask, int net_code );
/**
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -46,6 +46,7 @@ static bool Join( wxPoint* res, wxPoint a0, wxPoint a1, wxPoint b0, wxPoint b1 )
b0 -= a0;
denom = (double) b1.y * a1.x - (double) b1.x * a1.y;
if( !denom )
{
return false; // parallel
......@@ -74,7 +75,7 @@ bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track )
wxPoint vec = track->m_End - track->m_Start;
double t = double( on_grid.x - track->m_Start.x ) * vec.x +
double( on_grid.y - track->m_Start.y ) * vec.y;
double( on_grid.y - track->m_Start.y ) * vec.y;
t /= (double) vec.x * vec.x + (double) vec.y * vec.y;
t = min( max( t, 0.0 ), 1.0 );
......@@ -192,7 +193,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
{
int layer_mask = g_TabOneLayerMask[layer];
TRACK* track = Locate_Pistes( m_Pcb, m_Pcb->m_Track, pos, layer_mask );
TRACK* track = GetTrace( m_Pcb, m_Pcb->m_Track, pos, layer_mask );
if( !track || track->Type() != TYPE_TRACK )
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment