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