see change_log.txt for 2007-Aug-22

This commit is contained in:
dickelbeck 2007-08-23 04:28:46 +00:00
parent 4da2971dcc
commit cc62305777
88 changed files with 9860 additions and 8580 deletions

View File

@ -202,13 +202,14 @@ void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track)
/************************************************/ /************************************************/
{ {
double zpos; double zpos;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[track->m_Layer]; int layer = track->GetLayer();
int layer = track->m_Layer; int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
double ox, oy, fx, fy; double ox, oy, fx, fy;
double w; double w;
if ( color & ITEM_NOT_SHOW ) return; if ( color & ITEM_NOT_SHOW ) return;
if ( track->m_Layer == CMP_N ) layer = g_Parm_3D_Visu.m_Layers -1; if ( layer == CMP_N )
layer = g_Parm_3D_Visu.m_Layers -1;
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
SetGLColor(color); SetGLColor(color);
@ -268,7 +269,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment(DRAWSEGMENT * segment)
int layer; int layer;
double x, y, xf, yf; double x, y, xf, yf;
double zpos, w; double zpos, w;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer]; int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
if ( color & ITEM_NOT_SHOW ) return; if ( color & ITEM_NOT_SHOW ) return;
@ -279,7 +280,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer];
xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale; xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale;
yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale; yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale;
if ( segment->m_Layer == EDGE_N) if ( segment->GetLayer() == EDGE_N)
{ {
for ( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ ) for ( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ )
{ {
@ -291,7 +292,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer];
else else
{ {
zpos = g_Parm_3D_Visu.m_LayerZcoord[segment->m_Layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[segment->GetLayer()];
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos); Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos);
} }
} }

View File

@ -5,16 +5,36 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
@todo add constructor initializers for classes that were derived from
EDA_BaseLineStruct but are now not. Its late, will do tomorrow.
@todo test yesterday's changes, it builds, may not run right yet.
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ eeschema & pcbnew + eeschema & pcbnew
Things are still pretty transient, should be stable a day or two:
* Fixed a filename case sensitivity problem that would show up on Linux * Fixed a filename case sensitivity problem that would show up on Linux
but probably not on Windows: bitmap/Reload.xpm needed uppercase R. but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
* Since so many classes introduced m_Layer, I moved m_Layer into * Wedged a new class BOARD_ITEM underneath all PCB drawable classes, this is
EDA_BaseStruct so all classes can inherit it and that way we can test a big change and may introduce a bug or two, but it is worth it for the
layer using a general, polymorphic test, i.e. don't have to cast a future, because we can introduce virtual functions there that do not impact
EDA_BaseStruct* to a class specific pointer to test layer. Could also have the entire project (since everything is derived from EDA_BaseStruct).
used a virtual function but too many places use m_Layer directly. The corresponding class in EESCHEMA seems to be DrawPartStruct, so we had
nothing in PCBNEW like that.
BOARD_ITEM::GetLayer() and SetLayer() introduced, more functions to come.
Much of this work is geared towards making collectors.cpp's ARROWCOLLECTOR::Inspect()
very very simple, and that can be model for future work.
* Changed min() and max() macros to MIN() and MAX() because min() and max()
are actually reserved according to the C++ standard! (and their usage prevented
the use of #include <vector>).
* Added files class_collector.h, collectors.h, and collectors.cpp.
File collectors.cpp is still unfinished.
* Started using a function and class comment style that will make sense to the
Doxygen source code documenter program.
* Beautified more un-beautified files.
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -106,7 +106,6 @@ void EDA_BaseStruct::InitVars( void )
m_TimeStamp = 0; // Time stamp used for logical links m_TimeStamp = 0; // Time stamp used for logical links
m_Status = 0; m_Status = 0;
m_Selected = 0; /* Used by block commands, and selective editing */ m_Selected = 0; /* Used by block commands, and selective editing */
m_Layer = 0;
} }
@ -283,6 +282,7 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
#endif #endif
/**********************************************************************************************/ /**********************************************************************************************/
EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
EDA_BaseStruct( StructFather, idtype ) EDA_BaseStruct( StructFather, idtype )

View File

@ -1,12 +1,13 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: sheet.cpp // Name: sheet.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
// Created: 08/02/2006 18:37:02 // Created: 08/02/2006 18:37:02
// RCS-ID: // RCS-ID:
// Copyright: License GNU // Copyright: License GNU
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h". // For compilers that support precompilation, includes "wx/wx.h".
@ -32,285 +33,298 @@
/***********************************************************/ /***********************************************************/
DrawSheetStruct::DrawSheetStruct(const wxPoint & pos) : DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
SCH_SCREEN( SCHEMATIC_FRAME ) SCH_SCREEN( SCHEMATIC_FRAME )
/***********************************************************/ /***********************************************************/
{ {
m_Label = NULL; m_Label = NULL;
m_NbLabel = 0; m_NbLabel = 0;
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_Pos = pos; m_Pos = pos;
m_SheetNameSize = m_FileNameSize = 60; m_SheetNameSize = m_FileNameSize = 60;
/* change the struct type: SCREEN_STRUCT_TYPE to DRAW_SHEET_STRUCT_TYPE */ /* change the struct type: SCREEN_STRUCT_TYPE to DRAW_SHEET_STRUCT_TYPE */
m_StructType = DRAW_SHEET_STRUCT_TYPE; m_StructType = DRAW_SHEET_STRUCT_TYPE;
} }
/**************************************/ /**************************************/
DrawSheetStruct::~DrawSheetStruct(void) DrawSheetStruct::~DrawSheetStruct()
/**************************************/ /**************************************/
{ {
DrawSheetLabelStruct * label = m_Label, * next_label; DrawSheetLabelStruct* label = m_Label, * next_label;
while (label) while( label )
{ {
next_label = (DrawSheetLabelStruct *)label->Pnext; next_label = (DrawSheetLabelStruct*) label->Pnext;
delete label; delete label;
label = next_label; label = next_label;
} }
} }
/***********************************************/ /***********************************************/
DrawSheetStruct * DrawSheetStruct::GenCopy(void) DrawSheetStruct* DrawSheetStruct::GenCopy( void )
/***********************************************/ /***********************************************/
/* creates a copy of a sheet /* creates a copy of a sheet
The linked data itself (EEDrawList) is not duplicated * The linked data itself (EEDrawList) is not duplicated
*/ */
{ {
DrawSheetStruct * newitem = new DrawSheetStruct(m_Pos); DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
DrawSheetLabelStruct * Slabel = NULL, * label = m_Label;
newitem->m_Size = m_Size; DrawSheetLabelStruct* Slabel = NULL, * label = m_Label;
newitem->m_Parent = m_Parent;
newitem->m_TimeStamp = GetTimeStamp();
newitem->m_FileName = m_FileName; newitem->m_Size = m_Size;
newitem->m_FileNameSize = m_FileNameSize; newitem->m_Parent = m_Parent;
newitem->m_SheetName = m_SheetName; newitem->m_TimeStamp = GetTimeStamp();
newitem->m_SheetNameSize = m_SheetNameSize;
if( label ) newitem->m_FileName = m_FileName;
{ newitem->m_FileNameSize = m_FileNameSize;
Slabel = newitem->m_Label = label->GenCopy(); newitem->m_SheetName = m_SheetName;
Slabel->m_Parent = newitem; newitem->m_SheetNameSize = m_SheetNameSize;
label = (DrawSheetLabelStruct*)label->Pnext;
}
while( label ) if( label )
{ {
Slabel->Pnext = label->GenCopy(); Slabel = newitem->m_Label = label->GenCopy();
Slabel = (DrawSheetLabelStruct*)Slabel->Pnext; Slabel->m_Parent = newitem;
Slabel->m_Parent = newitem; label = (DrawSheetLabelStruct*) label->Pnext;
label = (DrawSheetLabelStruct*)label->Pnext; }
}
/* copy screen data */ while( label )
newitem->m_DrawOrg = m_DrawOrg; {
newitem->m_Curseur = m_Curseur; Slabel->Pnext = label->GenCopy();
newitem->m_MousePosition = m_MousePosition; Slabel = (DrawSheetLabelStruct*) Slabel->Pnext;
newitem->m_MousePositionInPixels = m_MousePositionInPixels; Slabel->m_Parent = newitem;
newitem->m_O_Curseur = m_O_Curseur; label = (DrawSheetLabelStruct*) label->Pnext;
newitem->m_ScrollbarPos = m_ScrollbarPos; }
newitem->m_ScrollbarNumber = m_ScrollbarNumber;
newitem->m_StartVisu = m_StartVisu;
newitem->m_FirstRedraw = m_FirstRedraw;
newitem->EEDrawList = EEDrawList; /* Object list (main data) for schematic */ /* copy screen data */
newitem->m_UndoList = m_UndoList; /* Object list for the undo command (old data) */ newitem->m_DrawOrg = m_DrawOrg;
newitem->m_RedoList = m_RedoList; /* Object list for the redo command (old data) */ newitem->m_Curseur = m_Curseur;
newitem->m_MousePosition = m_MousePosition;
newitem->m_MousePositionInPixels = m_MousePositionInPixels;
newitem->m_O_Curseur = m_O_Curseur;
newitem->m_ScrollbarPos = m_ScrollbarPos;
newitem->m_ScrollbarNumber = m_ScrollbarNumber;
newitem->m_StartVisu = m_StartVisu;
newitem->m_FirstRedraw = m_FirstRedraw;
newitem->m_CurrentSheet = m_CurrentSheet; newitem->EEDrawList = EEDrawList; /* Object list (main data) for schematic */
newitem->m_SheetNumber = m_SheetNumber; newitem->m_UndoList = m_UndoList; /* Object list for the undo command (old data) */
newitem->m_NumberOfSheet = m_NumberOfSheet; newitem->m_RedoList = m_RedoList; /* Object list for the redo command (old data) */
newitem->m_FileName = m_FileName;
newitem->m_Title = m_Title;
newitem->m_Date = m_Date;
newitem->m_Revision = m_Revision;
newitem->m_Company = m_Company;
newitem->m_Commentaire1 = m_Commentaire1;
newitem->m_Commentaire2 = m_Commentaire2;
newitem->m_Commentaire3 = m_Commentaire3;
newitem->m_Commentaire4 = m_Commentaire4;
return newitem; newitem->m_CurrentSheet = m_CurrentSheet;
newitem->m_SheetNumber = m_SheetNumber;
newitem->m_NumberOfSheet = m_NumberOfSheet;
newitem->m_FileName = m_FileName;
newitem->m_Title = m_Title;
newitem->m_Date = m_Date;
newitem->m_Revision = m_Revision;
newitem->m_Company = m_Company;
newitem->m_Commentaire1 = m_Commentaire1;
newitem->m_Commentaire2 = m_Commentaire2;
newitem->m_Commentaire3 = m_Commentaire3;
newitem->m_Commentaire4 = m_Commentaire4;
return newitem;
} }
/**********************************************************/ /**********************************************************/
void DrawSheetStruct::SwapData(DrawSheetStruct * copyitem) void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/**********************************************************/ /**********************************************************/
/* Used if undo / redo command: /* Used if undo / redo command:
swap data between this and copyitem * swap data between this and copyitem
*/ */
{ {
EXCHG(m_Pos, copyitem->m_Pos); EXCHG( m_Pos, copyitem->m_Pos );
EXCHG(m_Size, copyitem->m_Size); EXCHG( m_Size, copyitem->m_Size );
EXCHG(m_SheetName, copyitem->m_SheetName); EXCHG( m_SheetName, copyitem->m_SheetName );
EXCHG(m_SheetNameSize, copyitem->m_SheetNameSize); EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
EXCHG(m_FileNameSize, copyitem->m_FileNameSize); EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
EXCHG(m_Label, copyitem->m_Label); EXCHG( m_Label, copyitem->m_Label );
EXCHG(m_NbLabel, copyitem->m_NbLabel); EXCHG( m_NbLabel, copyitem->m_NbLabel );
} }
/**************************************************************************************/ /**************************************************************************************/
void DrawSheetStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color) int DrawMode, int Color )
/**************************************************************************************/ /**************************************************************************************/
/* Draw the hierarchical sheet shape */ /* Draw the hierarchical sheet shape */
{ {
DrawSheetLabelStruct * SheetLabelStruct; DrawSheetLabelStruct* SheetLabelStruct;
int txtcolor; int txtcolor;
wxString Text; wxString Text;
int color; int color;
wxPoint pos = m_Pos + offset; wxPoint pos = m_Pos + offset;
int LineWidth = g_DrawMinimunLineWidth; int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 ) color = Color;
else color = ReturnLayerColor(m_Layer);
GRSetDrawMode(DC, DrawMode);
GRRect(&panel->m_ClipBox, DC, pos.x, pos.y, if( Color >= 0 )
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color); color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
/* Draw text : SheetName */ GRRect( &panel->m_ClipBox, DC, pos.x, pos.y,
if( Color > 0 ) txtcolor = Color; pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
else txtcolor = ReturnLayerColor(LAYER_SHEETNAME);
Text = wxT("Sheet: ") + m_SheetName; /* Draw text : SheetName */
DrawGraphicText(panel, DC, if( Color > 0 )
wxPoint(pos.x, pos.y - 8), txtcolor, txtcolor = Color;
Text, TEXT_ORIENT_HORIZ, wxSize(m_SheetNameSize,m_SheetNameSize), else
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth); txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
/* Draw text : FileName */ Text = wxT( "Sheet: " ) + m_SheetName;
if( Color >= 0 ) txtcolor = Color; DrawGraphicText( panel, DC,
else txtcolor = ReturnLayerColor(LAYER_SHEETFILENAME); wxPoint( pos.x, pos.y - 8 ), txtcolor,
Text = wxT("File: ") + m_FileName; Text, TEXT_ORIENT_HORIZ, wxSize( m_SheetNameSize, m_SheetNameSize ),
DrawGraphicText(panel, DC, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
wxPoint(pos.x, pos.y + m_Size.y + 4),
txtcolor, /* Draw text : FileName */
Text, TEXT_ORIENT_HORIZ, wxSize(m_FileNameSize,m_FileNameSize), if( Color >= 0 )
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth); txtcolor = Color;
else
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
Text = wxT( "File: " ) + m_FileName;
DrawGraphicText( panel, DC,
wxPoint( pos.x, pos.y + m_Size.y + 4 ),
txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize( m_FileNameSize, m_FileNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth );
/* Draw text : SheetLabel */ /* Draw text : SheetLabel */
SheetLabelStruct = m_Label; SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL ) while( SheetLabelStruct != NULL )
{ {
SheetLabelStruct->Draw(panel, DC, offset,DrawMode, Color); SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
SheetLabelStruct = (DrawSheetLabelStruct*)(SheetLabelStruct->Pnext); SheetLabelStruct = (DrawSheetLabelStruct*) (SheetLabelStruct->Pnext);
} }
} }
/************************/ /************************/
/* DrawSheetLabelStruct */ /* DrawSheetLabelStruct */
/************************/ /************************/
/*******************************************************************/ /*******************************************************************/
DrawSheetLabelStruct::DrawSheetLabelStruct(DrawSheetStruct * parent, DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
const wxPoint & pos, const wxString & text) : const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct(DRAW_SHEETLABEL_STRUCT_TYPE), EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ),
EDA_TextStruct(text) EDA_TextStruct( text )
/*******************************************************************/ /*******************************************************************/
{ {
m_Layer = LAYER_SHEETLABEL; m_Layer = LAYER_SHEETLABEL;
m_Parent = parent; m_Parent = parent;
m_Pos = pos; m_Pos = pos;
m_Edge = 0; m_Edge = 0;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/***********************************************************/ /***********************************************************/
DrawSheetLabelStruct * DrawSheetLabelStruct::GenCopy(void) DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy( void )
/***********************************************************/ /***********************************************************/
{ {
DrawSheetLabelStruct * newitem = DrawSheetLabelStruct* newitem =
new DrawSheetLabelStruct( (DrawSheetStruct *)m_Parent, m_Pos, m_Text); new DrawSheetLabelStruct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge; newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape; newitem->m_Shape = m_Shape;
return newitem; return newitem;
} }
/********************************************************************************************/ /********************************************************************************************/
void DrawSheetLabelStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color) int DrawMode, int Color )
/********************************************************************************************/ /********************************************************************************************/
/* Routine de dessin des Labels type hierarchie */ /* Routine de dessin des Labels type hierarchie */
{ {
int side, txtcolor; int side, txtcolor;
int posx , tposx, posy, size2; int posx, tposx, posy, size2;
wxSize size; wxSize size;
int NbSegm, coord[20]; int NbSegm, coord[20];
int LineWidth = g_DrawMinimunLineWidth; int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 ) txtcolor = Color; if( Color >= 0 )
else txtcolor = ReturnLayerColor(m_Layer); txtcolor = Color;
GRSetDrawMode(DC, DrawMode); else
txtcolor = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size; posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
if( !m_Text.IsEmpty() ) if( !m_Text.IsEmpty() )
{ {
if( m_Edge ) if( m_Edge )
{ {
tposx = posx - size.x; tposx = posx - size.x;
side = GR_TEXT_HJUSTIFY_RIGHT; side = GR_TEXT_HJUSTIFY_RIGHT;
} }
else else
{ {
tposx = posx + size.x + (size.x /8) ; tposx = posx + size.x + (size.x / 8);
side = GR_TEXT_HJUSTIFY_LEFT; side = GR_TEXT_HJUSTIFY_LEFT;
} }
DrawGraphicText(panel, DC, wxPoint(tposx, posy), txtcolor, DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
m_Text, TEXT_ORIENT_HORIZ,size , m_Text, TEXT_ORIENT_HORIZ, size,
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth); side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
} }
/* dessin du symbole de connexion */ /* dessin du symbole de connexion */
if(m_Edge) if( m_Edge )
{ {
size.x = -size.x; size.x = -size.x;
size.y = -size.y; size.y = -size.y;
} }
coord[0] = posx; coord[1] = posy; size2 = size.x /2;
NbSegm = 0;
switch(m_Shape)
{
case 0: /* input |> */
coord[2] = posx ; coord[3] = posy - size2;
coord[4] = posx + size2; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy;
coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = posx ; coord[11] = posy + size2;
coord[12] = coord[0] ; coord[13] = coord[1];
NbSegm = 7;
break;
case 1: /* output <| */ coord[0] = posx; coord[1] = posy; size2 = size.x / 2;
coord[2] = posx + size2; coord[3] = posy - size2; NbSegm = 0;
coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = coord[0] ; coord[11] = coord[1];
NbSegm = 6;
break;
case 2: /* bidi <> */ switch( m_Shape )
case 3: /* TriSt <> */ {
coord[2] = posx + size2; coord[3] = posy - size2; case 0: /* input |> */
coord[4] = posx + size.x; coord[5] = posy; coord[2] = posx; coord[3] = posy - size2;
coord[6] = posx + size2; coord[7] = posy +size2; coord[4] = posx + size2; coord[5] = posy - size2;
coord[8] = coord[0]; coord[9] = coord[1]; coord[6] = posx + size.x; coord[7] = posy;
NbSegm = 5; coord[8] = posx + size2; coord[9] = posy + size2;
break; coord[10] = posx; coord[11] = posy + size2;
coord[12] = coord[0]; coord[13] = coord[1];
NbSegm = 7;
break;
default: /* unsp []*/ case 1: /* output <| */
coord[2] = posx ; coord[3] = posy - size2; coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy - size2; coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2; coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx ; coord[9] = posy + size2; coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = coord[0] ; coord[11] = coord[1]; coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6; NbSegm = 6;
break; break;
}
int FillShape = FALSE; case 2: /* bidi <> */
GRPoly(&panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor); /* Poly Non rempli */ case 3: /* TriSt <> */
coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy;
coord[6] = posx + size2; coord[7] = posy + size2;
coord[8] = coord[0]; coord[9] = coord[1];
NbSegm = 5;
break;
default: /* unsp []*/
coord[2] = posx; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx; coord[9] = posy + size2;
coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6;
break;
}
int FillShape = FALSE;
GRPoly( &panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
} }

View File

@ -107,10 +107,10 @@ public:
}; };
class DrawSheetLabelStruct : public EDA_BaseStruct class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
, public EDA_TextStruct
{ {
public: public:
int m_Layer;
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE si non connecté bool m_IsDangling; // TRUE si non connecté
@ -141,6 +141,7 @@ public:
int m_FileNameSize; int m_FileNameSize;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */ wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */ DrawSheetLabelStruct* m_Label; /* Points de connection */
int m_NbLabel; /* Nombre de points de connexion */ int m_NbLabel; /* Nombre de points de connexion */

View File

@ -14,236 +14,247 @@
#include "protos.h" #include "protos.h"
/*******************************************************************/ /*******************************************************************/
DrawBusEntryStruct::DrawBusEntryStruct(const wxPoint & pos, int shape, int id) : DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) :
EDA_BaseStruct(DRAW_BUSENTRY_STRUCT_TYPE) EDA_BaseStruct( DRAW_BUSENTRY_STRUCT_TYPE )
/*******************************************************************/ /*******************************************************************/
{ {
m_Pos = pos;
m_Size.x = 100;
m_Size.y = 100;
m_Layer = LAYER_WIRE;
m_Width = 0;
m_Pos = pos; if( id == BUS_TO_BUS )
m_Size.x = 100; {
m_Size.y = 100; m_Layer = LAYER_BUS;
m_Layer = LAYER_WIRE; m_Width = 1;
m_Width = 0; }
if( id == BUS_TO_BUS )
{
m_Layer = LAYER_BUS;
m_Width = 1;
}
if(shape == '/' ) m_Size.y = - 100;
if( shape == '/' )
m_Size.y = -100;
} }
/*************************************/ /*************************************/
wxPoint DrawBusEntryStruct::m_End(void) wxPoint DrawBusEntryStruct::m_End( void )
/*************************************/ /*************************************/
// retourne la coord de fin du raccord // retourne la coord de fin du raccord
{ {
return ( wxPoint(m_Pos.x + m_Size.x, m_Pos.y + m_Size.y) ); return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
} }
/***************************************************/ /***************************************************/
DrawBusEntryStruct * DrawBusEntryStruct::GenCopy(void) DrawBusEntryStruct* DrawBusEntryStruct::GenCopy( void )
/***************************************************/ /***************************************************/
{ {
DrawBusEntryStruct * newitem = new DrawBusEntryStruct(m_Pos,0,0); DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 );
newitem->m_Layer = m_Layer; newitem->m_Layer = m_Layer;
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
newitem->m_Size = m_Size; newitem->m_Size = m_Size;
newitem->m_Flags = m_Flags; newitem->m_Flags = m_Flags;
return newitem; return newitem;
} }
/****************************/ /****************************/
/* class DrawJunctionStruct */ /* class DrawJunctionStruct */
/***************************/ /***************************/
/************************************************************/ /************************************************************/
DrawJunctionStruct::DrawJunctionStruct(const wxPoint & pos) : DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
EDA_BaseStruct(DRAW_JUNCTION_STRUCT_TYPE) EDA_BaseStruct( DRAW_JUNCTION_STRUCT_TYPE )
/************************************************************/ /************************************************************/
{ {
m_Pos = pos; m_Pos = pos;
m_Layer = LAYER_JUNCTION; m_Layer = LAYER_JUNCTION;
} }
DrawJunctionStruct * DrawJunctionStruct::GenCopy(void)
DrawJunctionStruct* DrawJunctionStruct::GenCopy( void )
{ {
DrawJunctionStruct * newitem = new DrawJunctionStruct(m_Pos); DrawJunctionStruct* newitem = new DrawJunctionStruct( m_Pos );
newitem->m_Layer = m_Layer; newitem->m_Layer = m_Layer;
newitem->m_Flags = m_Flags; newitem->m_Flags = m_Flags;
return newitem; return newitem;
} }
/*****************************/ /*****************************/
/* class DrawNoConnectStruct */ /* class DrawNoConnectStruct */
/*****************************/ /*****************************/
DrawNoConnectStruct::DrawNoConnectStruct(const wxPoint & pos) : DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
EDA_BaseStruct(DRAW_NOCONNECT_STRUCT_TYPE) EDA_BaseStruct( DRAW_NOCONNECT_STRUCT_TYPE )
{ {
m_Pos = pos; m_Pos = pos;
} }
DrawNoConnectStruct * DrawNoConnectStruct::GenCopy(void)
DrawNoConnectStruct* DrawNoConnectStruct::GenCopy( void )
{ {
DrawNoConnectStruct * newitem = new DrawNoConnectStruct(m_Pos); DrawNoConnectStruct* newitem = new DrawNoConnectStruct( m_Pos );
newitem->m_Flags = m_Flags; newitem->m_Flags = m_Flags;
return newitem; return newitem;
} }
/**************************/ /**************************/
/* class DrawMarkerStruct */ /* class DrawMarkerStruct */
/**************************/ /**************************/
DrawMarkerStruct::DrawMarkerStruct( const wxPoint & pos, const wxString & text): DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct(DRAW_MARKER_STRUCT_TYPE) EDA_BaseStruct( DRAW_MARKER_STRUCT_TYPE )
{ {
m_Pos = pos; /* XY coordinates of marker. */ m_Pos = pos; /* XY coordinates of marker. */
m_Type = MARQ_UNSPEC; m_Type = MARQ_UNSPEC;
m_MarkFlags = 0; // complements d'information m_MarkFlags = 0; // complements d'information
m_Comment = text; m_Comment = text;
} }
DrawMarkerStruct::~DrawMarkerStruct(void)
DrawMarkerStruct::~DrawMarkerStruct( void )
{ {
} }
DrawMarkerStruct * DrawMarkerStruct::GenCopy(void)
{
DrawMarkerStruct * newitem = new DrawMarkerStruct( m_Pos, m_Comment);
newitem->m_Type = m_Type;
newitem->m_MarkFlags = m_MarkFlags;
return newitem; DrawMarkerStruct* DrawMarkerStruct::GenCopy( void )
{
DrawMarkerStruct* newitem = new DrawMarkerStruct( m_Pos, m_Comment );
newitem->m_Type = m_Type;
newitem->m_MarkFlags = m_MarkFlags;
return newitem;
} }
wxString DrawMarkerStruct::GetComment(void) wxString DrawMarkerStruct::GetComment( void )
{ {
return m_Comment; return m_Comment;
} }
/***************************/ /***************************/
/* Class EDA_DrawLineStruct */ /* Class EDA_DrawLineStruct */
/***************************/ /***************************/
EDA_DrawLineStruct::EDA_DrawLineStruct(const wxPoint & pos, int layer ): EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
EDA_BaseLineStruct(NULL, DRAW_SEGMENT_STRUCT_TYPE) EDA_BaseLineStruct( NULL, DRAW_SEGMENT_STRUCT_TYPE )
{ {
m_Start = pos; m_Start = pos;
m_End = pos; m_End = pos;
m_StartIsDangling = m_EndIsDangling = FALSE; m_StartIsDangling = m_EndIsDangling = FALSE;
switch(layer) switch( layer )
{ {
default: default:
m_Layer = LAYER_NOTES; /* Mettre ds Notes */ m_Layer = LAYER_NOTES; /* Mettre ds Notes */
m_Width = GR_NORM_WIDTH; m_Width = GR_NORM_WIDTH;
break; break;
case LAYER_WIRE: case LAYER_WIRE:
m_Layer = LAYER_WIRE; m_Layer = LAYER_WIRE;
m_Width = GR_NORM_WIDTH; m_Width = GR_NORM_WIDTH;
break; break;
case LAYER_BUS:
m_Layer = LAYER_BUS; case LAYER_BUS:
m_Width = GR_THICK_WIDTH; m_Layer = LAYER_BUS;
break; m_Width = GR_THICK_WIDTH;
} break;
}
} }
/***************************************************/ /***************************************************/
EDA_DrawLineStruct * EDA_DrawLineStruct::GenCopy(void) EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy( void )
/***************************************************/ /***************************************************/
{ {
EDA_DrawLineStruct * newitem = new EDA_DrawLineStruct(m_Start, m_Layer); EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer );
newitem->m_End = m_End; newitem->m_End = m_End;
return newitem; return newitem;
} }
/************************************************************/ /************************************************************/
bool EDA_DrawLineStruct::IsOneEndPointAt(const wxPoint & pos) bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
/************************************************************/ /************************************************************/
/* Return TRUE if the start or the end point is in position pos /* Return TRUE if the start or the end point is in position pos
*/ */
{ {
if ( (pos.x == m_Start.x) && (pos.y == m_Start.y) ) return TRUE; if( (pos.x == m_Start.x) && (pos.y == m_Start.y) )
if ( (pos.x == m_End.x) && (pos.y == m_End.y) ) return TRUE; return TRUE;
return FALSE; if( (pos.x == m_End.x) && (pos.y == m_End.y) )
return TRUE;
return FALSE;
} }
/****************************/
/* Class DrawPolylineStruct */ /****************************/
/****************************/ /* Class DrawPolylineStruct */
/****************************/
/***********************************************************/ /***********************************************************/
DrawPolylineStruct::DrawPolylineStruct(int layer): DrawPolylineStruct::DrawPolylineStruct( int layer ) :
EDA_BaseStruct(DRAW_POLYLINE_STRUCT_TYPE) EDA_BaseStruct( DRAW_POLYLINE_STRUCT_TYPE )
/***********************************************************/ /***********************************************************/
{ {
m_NumOfPoints = 0; /* Number of XY pairs in Points array. */ m_NumOfPoints = 0; /* Number of XY pairs in Points array. */
m_Points = NULL; /* XY pairs that forms the polyline. */ m_Points = NULL; /* XY pairs that forms the polyline. */
m_Width = GR_NORM_WIDTH; m_Width = GR_NORM_WIDTH;
switch ( layer ) switch( layer )
{ {
default: default:
m_Layer = LAYER_NOTES; m_Layer = LAYER_NOTES;
break; break;
case LAYER_WIRE: case LAYER_WIRE:
case LAYER_NOTES: case LAYER_NOTES:
m_Layer = layer; m_Layer = layer;
break; break;
case LAYER_BUS: case LAYER_BUS:
m_Layer = layer; m_Layer = layer;
m_Width = GR_THICK_WIDTH; m_Width = GR_THICK_WIDTH;
break; break;
} }
} }
/********************************************/ /********************************************/
DrawPolylineStruct::~DrawPolylineStruct(void) DrawPolylineStruct::~DrawPolylineStruct( void )
/*********************************************/ /*********************************************/
{ {
if ( m_Points ) free ( m_Points ); if( m_Points )
free( m_Points );
} }
/*****************************************************/ /*****************************************************/
DrawPolylineStruct * DrawPolylineStruct::GenCopy(void) DrawPolylineStruct* DrawPolylineStruct::GenCopy( void )
/*****************************************************/ /*****************************************************/
{ {
int memsize; int memsize;
DrawPolylineStruct * newitem = DrawPolylineStruct* newitem =
new DrawPolylineStruct( m_Layer ); new DrawPolylineStruct( m_Layer );
memsize = sizeof(int) * 2 * m_NumOfPoints; memsize = sizeof(int) * 2 * m_NumOfPoints;
newitem->m_NumOfPoints = m_NumOfPoints; newitem->m_NumOfPoints = m_NumOfPoints;
newitem->m_Points = (int *) MyZMalloc(memsize); newitem->m_Points = (int*) MyZMalloc( memsize );
memcpy ( newitem->m_Points, m_Points, memsize); memcpy( newitem->m_Points, m_Points, memsize );
return newitem; return newitem;
} }

View File

@ -39,7 +39,8 @@ typedef enum
class PartTextStruct: public EDA_BaseStruct, public EDA_TextStruct class PartTextStruct: public EDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
int m_FieldId; int m_Layer;
int m_FieldId;
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1.. wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
and for fields 1 to 8 the name is editable */ and for fields 1 to 8 the name is editable */
@ -54,6 +55,7 @@ public:
void SwapData(PartTextStruct * copyitem); void SwapData(PartTextStruct * copyitem);
}; };
/* the class DrawPartStruct describes a basic virtual component /* the class DrawPartStruct describes a basic virtual component
Not used directly: Not used directly:
used classes are EDA_SchComponentStruct (the "classic" schematic component used classes are EDA_SchComponentStruct (the "classic" schematic component
@ -62,6 +64,7 @@ public:
class DrawPartStruct: public EDA_BaseStruct class DrawPartStruct: public EDA_BaseStruct
{ {
public: public:
int m_Layer;
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */ wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */
PartTextStruct m_Field[NUMBER_OF_FIELDS]; PartTextStruct m_Field[NUMBER_OF_FIELDS];
wxPoint m_Pos; /* Exact position of part. */ wxPoint m_Pos; /* Exact position of part. */

View File

@ -106,6 +106,7 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
a 45 degres de BUS ou WIRE */ a 45 degres de BUS ou WIRE */
{ {
public: public:
int m_Layer;
int m_Width; int m_Width;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; wxSize m_Size;
@ -121,6 +122,7 @@ public:
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */ class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
{ {
public: public:
int m_Layer;
int m_Width; int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */ int m_NumOfPoints; /* Number of XY pairs in Points array. */
int *m_Points; /* XY pairs that forms the polyline. */ int *m_Points; /* XY pairs that forms the polyline. */
@ -135,6 +137,7 @@ public:
class DrawJunctionStruct: public EDA_BaseStruct class DrawJunctionStruct: public EDA_BaseStruct
{ {
public: public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */ wxPoint m_Pos; /* XY coordinates of connection. */
public: public:
@ -147,6 +150,7 @@ public:
class DrawTextStruct: public EDA_BaseStruct, public EDA_TextStruct class DrawTextStruct: public EDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
int m_Layer;
int m_Shape; int m_Shape;
bool m_IsDangling; // TRUE si non connecté bool m_IsDangling; // TRUE si non connecté
@ -163,6 +167,7 @@ private:
void DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color); void DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color);
}; };
class DrawLabelStruct: public DrawTextStruct class DrawLabelStruct: public DrawTextStruct
{ {
public: public:
@ -170,6 +175,7 @@ public:
~DrawLabelStruct(void) {} ~DrawLabelStruct(void) {}
}; };
class DrawGlobalLabelStruct: public DrawTextStruct class DrawGlobalLabelStruct: public DrawTextStruct
{ {
public: public:

View File

@ -1,6 +1,6 @@
/**********************************************************/ /**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */ /* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/ /**********************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -13,96 +13,102 @@
/* Routines locales */ /* Routines locales */
/****************************************************************************/ /****************************************************************************/
void Affiche_Infos_PCB_Texte(WinEDA_BasePcbFrame * frame, TEXTE_PCB* pt_texte) void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte )
/****************************************************************************/ /****************************************************************************/
/* Affiche en bas d'ecran les caract du texte sur PCB /* Affiche en bas d'ecran les caract du texte sur PCB
Entree : * Entree :
pointeur de la description du texte * pointeur de la description du texte
*/ */
{ {
wxString Line; wxString Line;
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
if( pt_texte->m_StructType == TYPECOTATION ) if( pt_texte->m_StructType == TYPECOTATION )
Affiche_1_Parametre(frame, 1,_("COTATION"),pt_texte->m_Text, DARKGREEN); Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else else
Affiche_1_Parametre(frame, 1,_("PCB Text"),pt_texte->m_Text, DARKGREEN); Affiche_1_Parametre( frame, 1, _( "PCB Text" ), pt_texte->m_Text, DARKGREEN );
Line = _("Layer "); Line << pt_texte->m_Layer + 1; Line = _( "Layer " );
Affiche_1_Parametre(frame, 28, _("Layer:"), Line, g_DesignSettings.m_LayerColor[pt_texte->m_Layer] ); Line << pt_texte->GetLayer() + 1;
Affiche_1_Parametre( frame, 28, _( "Layer:" ), Line,
g_DesignSettings.m_LayerColor[pt_texte->GetLayer()] );
Affiche_1_Parametre(frame, 36, _("Mirror"),wxEmptyString,GREEN) ; Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( (pt_texte->m_Miroir & 1) )
Affiche_1_Parametre(frame, -1,wxEmptyString, _("No"), DARKGREEN) ; if( (pt_texte->m_Miroir & 1) )
else Affiche_1_Parametre(frame, -1,wxEmptyString, _("Yes"), DARKGREEN) ; Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
Line.Printf( wxT("%.1f"),(float)pt_texte->m_Orient/10 );
Affiche_1_Parametre(frame, 43,_("Orient"), Line, DARKGREEN) ;
valeur_param(pt_texte->m_Width,Line) ; Line.Printf( wxT( "%.1f" ), (float) pt_texte->m_Orient / 10 );
Affiche_1_Parametre(frame, 50,_("Width"), Line,MAGENTA) ; Affiche_1_Parametre( frame, 43, _( "Orient" ), Line, DARKGREEN );
valeur_param(pt_texte->m_Size.x,Line) ; valeur_param( pt_texte->m_Width, Line );
Affiche_1_Parametre(frame, 60,_("H Size"), Line,RED) ; Affiche_1_Parametre( frame, 50, _( "Width" ), Line, MAGENTA );
valeur_param(pt_texte->m_Size.y,Line); valeur_param( pt_texte->m_Size.x, Line );
Affiche_1_Parametre(frame, 70,_("V Size"), Line,RED) ; Affiche_1_Parametre( frame, 60, _( "H Size" ), Line, RED );
valeur_param( pt_texte->m_Size.y, Line );
Affiche_1_Parametre( frame, 70, _( "V Size" ), Line, RED );
} }
/*********************************************************************/ /*********************************************************************/
void Affiche_Infos_Piste(WinEDA_BasePcbFrame * frame, TRACK * pt_piste) void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste )
/*********************************************************************/ /*********************************************************************/
/* Affiche les caract principales d'un segment de piste en bas d'ecran */ /* Affiche les caract principales d'un segment de piste en bas d'ecran */
{ {
int d_index, ii = -1; int d_index, ii = -1;
D_CODE * pt_D_code; D_CODE* pt_D_code;
int layer = frame->GetScreen()->m_Active_Layer; int layer = frame->GetScreen()->m_Active_Layer;
wxString msg; wxString msg;
frame->MsgPanel->EraseMsgBox();
d_index = pt_piste->m_NetCode; frame->MsgPanel->EraseMsgBox();
pt_D_code = ReturnToolDescr(layer, d_index, &ii);
switch(pt_piste->m_StructType) d_index = pt_piste->m_NetCode;
{ pt_D_code = ReturnToolDescr( layer, d_index, &ii );
case TYPETRACK:
if ( pt_piste->m_Shape < S_SPOT_CIRCLE ) msg = wxT("LINE");
else msg = wxT("FLASH");
break;
case TYPEZONE: switch( pt_piste->m_StructType )
msg = wxT("ZONE"); break; {
case TYPETRACK:
if( pt_piste->m_Shape < S_SPOT_CIRCLE )
msg = wxT( "LINE" );
else
msg = wxT( "FLASH" );
break;
default: case TYPEZONE:
msg = wxT("????"); break; msg = wxT( "ZONE" ); break;
}
Affiche_1_Parametre(frame, 1, _("Type"), msg, DARKCYAN);
msg.Printf( wxT("%d"), ii+1); default:
Affiche_1_Parametre(frame, 10, _("Tool"), msg, RED); msg = wxT( "????" ); break;
}
if ( pt_D_code ) Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN );
{
msg.Printf( wxT("D%d"), d_index);
Affiche_1_Parametre(frame, 20, _("D CODE"),msg, BLUE);
Affiche_1_Parametre(frame, 30, _("D type"), msg.Printf( wxT( "%d" ), ii + 1 );
pt_D_code ? g_GERBER_Tool_Type[pt_D_code->m_Shape] : _("????"), Affiche_1_Parametre( frame, 10, _( "Tool" ), msg, RED );
BLUE);
}
msg.Printf( wxT("%d"),pt_piste->m_Layer + 1); if( pt_D_code )
Affiche_1_Parametre(frame, 40, _("Layer"), msg, BROWN) ; {
msg.Printf( wxT( "D%d" ), d_index );
Affiche_1_Parametre( frame, 20, _( "D CODE" ), msg, BLUE );
/* Affiche Epaisseur */ Affiche_1_Parametre( frame, 30, _( "D type" ),
valeur_param((unsigned)(pt_piste->m_Width), msg) ; pt_D_code ? g_GERBER_Tool_Type[pt_D_code->m_Shape] : _( "????" ),
Affiche_1_Parametre(frame, 50, _("Width"), msg, DARKCYAN) ; BLUE );
}
msg.Printf( wxT( "%d" ), pt_piste->GetLayer() + 1 );
Affiche_1_Parametre( frame, 40, _( "Layer" ), msg, BROWN );
/* Affiche Epaisseur */
valeur_param( (unsigned) (pt_piste->m_Width), msg );
Affiche_1_Parametre( frame, 50, _( "Width" ), msg, DARKCYAN );
} }

View File

@ -340,7 +340,7 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
track = m_Pcb->m_Track; track = m_Pcb->m_Track;
for ( ; track != NULL ; track = (TRACK*) track->Pnext ) for ( ; track != NULL ; track = (TRACK*) track->Pnext )
{ {
pt_Dcode = ReturnToolDescr(track->m_Layer, track->m_NetCode); pt_Dcode = ReturnToolDescr(track->GetLayer(), track->m_NetCode);
pt_Dcode->m_InUse = TRUE; pt_Dcode->m_InUse = TRUE;
if ( // Line Item if ( // Line Item
@ -359,8 +359,8 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
int width, len; int width, len;
wxSize size = pt_Dcode->m_Size; wxSize size = pt_Dcode->m_Size;
width = min( size.x, size.y ); width = MIN( size.x, size.y );
len = max( size.x, size.y ) - width; len = MAX( size.x, size.y ) - width;
track->m_Width = width; track->m_Width = width;

View File

@ -30,7 +30,7 @@ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int laye
next_track = track->Next(); next_track = track->Next();
if( dcode_value != track->m_NetCode ) if( dcode_value != track->m_NetCode )
continue; continue;
if( layer_number >= 0 && layer_number != track->m_Layer ) if( layer_number >= 0 && layer_number != track->GetLayer() )
continue; continue;
Delete_Segment( DC, track ); Delete_Segment( DC, track );
} }

View File

@ -1,7 +1,8 @@
/* export_to_pcbnew.cpp */ /* export_to_pcbnew.cpp */
/* /*
Export des couches vers pcbnew * Export des couches vers pcbnew
*/ */
#include "fctsys.h" #include "fctsys.h"
@ -11,224 +12,242 @@ Export des couches vers pcbnew
#include "protos.h" #include "protos.h"
/* Routines Locales : */ /* Routines Locales : */
static int SavePcbFormatAscii(WinEDA_GerberFrame * frame, static int SavePcbFormatAscii( WinEDA_GerberFrame* frame,
FILE * File, int * LayerLookUpTable); FILE* File, int* LayerLookUpTable );
/* Variables Locales */ /* Variables Locales */
/************************************************************************/ /************************************************************************/
void WinEDA_GerberFrame::ExportDataInPcbnewFormat(wxCommandEvent& event) void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event )
/************************************************************************/ /************************************************************************/
/* Export data in pcbnew format /* Export data in pcbnew format
*/ */
{ {
wxString FullFileName, msg; wxString FullFileName, msg;
wxString PcbExt(wxT(".brd"));
FILE * dest;
msg = wxT("*") + PcbExt; wxString PcbExt( wxT( ".brd" ) );
FullFileName = EDA_FileSelector(_("Board file name:"),
wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
PcbExt, /* extension par defaut */
msg, /* Masque d'affichage */
this,
wxFD_SAVE,
FALSE
);
if ( FullFileName == wxEmptyString ) return;
int * LayerLookUpTable; FILE* dest;
if ( ( LayerLookUpTable = InstallDialogLayerPairChoice(this) ) != NULL )
{ msg = wxT( "*" ) + PcbExt;
if ( wxFileExists(FullFileName) ) FullFileName = EDA_FileSelector( _( "Board file name:" ),
{ wxEmptyString, /* Chemin par defaut */
if ( ! IsOK(this, _("Ok to change the existing file ?")) ) wxEmptyString, /* nom fichier par defaut */
return; PcbExt, /* extension par defaut */
} msg, /* Masque d'affichage */
dest = wxFopen(FullFileName, wxT("wt")); this,
if (dest == 0) wxFD_SAVE,
{ FALSE
msg = _("Unable to create ") + FullFileName; );
DisplayError(this, msg) ; if( FullFileName == wxEmptyString )
return; return;
}
GetScreen()->m_FileName = FullFileName; int* LayerLookUpTable;
SavePcbFormatAscii(this, dest, LayerLookUpTable); if( ( LayerLookUpTable = InstallDialogLayerPairChoice( this ) ) != NULL )
fclose(dest) ; {
} if( wxFileExists( FullFileName ) )
{
if( !IsOK( this, _( "Ok to change the existing file ?" ) ) )
return;
}
dest = wxFopen( FullFileName, wxT( "wt" ) );
if( dest == 0 )
{
msg = _( "Unable to create " ) + FullFileName;
DisplayError( this, msg );
return;
}
GetScreen()->m_FileName = FullFileName;
SavePcbFormatAscii( this, dest, LayerLookUpTable );
fclose( dest );
}
} }
/***************************************************************/ /***************************************************************/
static int WriteSetup(FILE * File, BOARD * Pcb) static int WriteSetup( FILE* File, BOARD* Pcb )
/***************************************************************/ /***************************************************************/
{ {
char text[1024]; char text[1024];
fprintf(File,"$SETUP\n"); fprintf( File, "$SETUP\n" );
sprintf(text, "InternalUnit %f INCH\n", 1.0/PCB_INTERNAL_UNIT); sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf(File, text); fprintf( File, text );
Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount;
fprintf(File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount);
fprintf(File,"$EndSETUP\n\n"); Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount;
return(1); fprintf( File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount );
fprintf( File, "$EndSETUP\n\n" );
return 1;
} }
/******************************************************/ /******************************************************/
static bool WriteGeneralDescrPcb(BOARD * Pcb, FILE * File) static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File )
/******************************************************/ /******************************************************/
{ {
int NbLayers; int NbLayers;
/* generation du masque des couches autorisees */ /* generation du masque des couches autorisees */
NbLayers = Pcb->m_BoardSettings->m_CopperLayerCount; NbLayers = Pcb->m_BoardSettings->m_CopperLayerCount;
fprintf(File,"$GENERAL\n"); fprintf( File, "$GENERAL\n" );
fprintf(File,"LayerCount %d\n",NbLayers); fprintf( File, "LayerCount %d\n", NbLayers );
/* Generation des coord du rectangle d'encadrement */ /* Generation des coord du rectangle d'encadrement */
Pcb->ComputeBoundaryBox(); Pcb->ComputeBoundaryBox();
fprintf(File,"Di %d %d %d %d\n", fprintf( File, "Di %d %d %d %d\n",
Pcb->m_BoundaryBox.GetX(), Pcb->m_BoundaryBox.GetY(), Pcb->m_BoundaryBox.GetX(), Pcb->m_BoundaryBox.GetY(),
Pcb->m_BoundaryBox.GetRight(), Pcb->m_BoundaryBox.GetRight(),
Pcb->m_BoundaryBox.GetBottom()); Pcb->m_BoundaryBox.GetBottom() );
fprintf(File,"$EndGENERAL\n\n"); fprintf( File, "$EndGENERAL\n\n" );
return TRUE; return TRUE;
} }
/*******************************************************************/ /*******************************************************************/
static int SavePcbFormatAscii(WinEDA_GerberFrame * frame,FILE * File, static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
int * LayerLookUpTable) int* LayerLookUpTable )
/*******************************************************************/ /*******************************************************************/
/* Routine de sauvegarde du PCB courant sous format ASCII /* Routine de sauvegarde du PCB courant sous format ASCII
retourne * retourne
1 si OK * 1 si OK
0 si sauvegarde non faite * 0 si sauvegarde non faite
*/ */
{ {
char Line[256]; char Line[256];
TRACK * track, *next_track; TRACK* track, * next_track;
EDA_BaseStruct * PtStruct, *NextStruct; BOARD_ITEM* PtStruct;
BOARD * GerberPcb = frame->m_Pcb; BOARD_ITEM* NextStruct;
BOARD * Pcb; BOARD* GerberPcb = frame->m_Pcb;
BOARD* Pcb;
wxBeginBusyCursor();
/* Create an image of gerber data */
Pcb = new BOARD(NULL, frame);
for(track = GerberPcb->m_Track; track != NULL; track = (TRACK*) track->Pnext)
{
int layer = track->m_Layer;
int pcb_layer_number = LayerLookUpTable[layer];
if ( pcb_layer_number < 0 ) continue;
if ( pcb_layer_number > CMP_N )
{
DRAWSEGMENT * drawitem = new DRAWSEGMENT(NULL, TYPEDRAWSEGMENT);
drawitem->m_Layer = pcb_layer_number;
drawitem->m_Start = track->m_Start;
drawitem->m_End = track->m_End;
drawitem->m_Width = track->m_Width;
drawitem->Pnext = Pcb->m_Drawings;
Pcb->m_Drawings = drawitem;
}
else
{
TRACK * newtrack = new TRACK(*track);
newtrack->m_Layer = pcb_layer_number;
newtrack->Insert(Pcb, NULL);
}
}
/* replace spots by vias when possible */ wxBeginBusyCursor();
for(track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext)
{
if( (track->m_Shape != S_SPOT_CIRCLE) && (track->m_Shape != S_SPOT_RECT) && (track->m_Shape != S_SPOT_OVALE) )
continue;
/* A spot is found, and can be a via: change it for via, and delete others
spots at same location */
track->m_Shape = VIA_NORMALE;
track->m_StructType = TYPEVIA;
track->m_Layer = 0x0F; // Layers are 0 to 15 (Cu/Cmp)
track->m_Drill = -1;
/* Compute the via position from track position ( Via position is the position of the middle of the track segment */
track->m_Start.x = (track->m_Start.x +track->m_End.x)/2;
track->m_Start.y = (track->m_Start.y +track->m_End.y)/2;
track->m_End = track->m_Start;
}
/* delete redundant vias */
for(track = Pcb->m_Track; track != NULL; track = track->Next())
{
if( track->m_Shape != VIA_NORMALE ) continue;
/* Search and delete others vias*/
TRACK * alt_track = track->Next();
for( ; alt_track != NULL; alt_track = next_track)
{
next_track = (TRACK*) alt_track->Pnext;
if( alt_track->m_Shape != VIA_NORMALE ) continue;
if ( alt_track->m_Start != track->m_Start ) continue;
/* delete track */
alt_track->UnLink();
delete alt_track;
}
}
/* Create an image of gerber data */
// Switch the locale to standard C (needed to print floating point numbers like 1.3) Pcb = new BOARD( NULL, frame );
setlocale(LC_NUMERIC, "C");
/* Ecriture de l'entete PCB : */
fprintf(File,"PCBNEW-BOARD Version %d date %s\n\n",g_CurrentVersionPCB,
DateAndTime(Line) );
WriteGeneralDescrPcb(Pcb, File);
WriteSetup(File, Pcb);
/* Ecriture des donnes utiles du pcb */ for( track = GerberPcb->m_Track; track != NULL; track = (TRACK*) track->Pnext )
PtStruct = Pcb->m_Drawings; {
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) int layer = track->GetLayer();
{ int pcb_layer_number = LayerLookUpTable[layer];
switch ( PtStruct->m_StructType ) if( pcb_layer_number < 0 )
{ continue;
case TYPETEXTE: if( pcb_layer_number > CMP_N )
((TEXTE_PCB*)PtStruct)->WriteTextePcbDescr(File) ; {
break; DRAWSEGMENT* drawitem = new DRAWSEGMENT( NULL, TYPEDRAWSEGMENT );
case TYPEDRAWSEGMENT: drawitem->SetLayer( pcb_layer_number );
((DRAWSEGMENT *)PtStruct)->WriteDrawSegmentDescr(File); drawitem->m_Start = track->m_Start;
break; drawitem->m_End = track->m_End;
drawitem->m_Width = track->m_Width;
drawitem->Pnext = Pcb->m_Drawings;
Pcb->m_Drawings = drawitem;
}
else
{
TRACK* newtrack = new TRACK( * track );
default: newtrack->SetLayer( pcb_layer_number );
break; newtrack->Insert( Pcb, NULL );
} }
} }
fprintf(File,"$TRACK\n"); /* replace spots by vias when possible */
for(track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext) for( track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext )
{ {
track->WriteTrackDescr(File); if( (track->m_Shape != S_SPOT_CIRCLE) && (track->m_Shape != S_SPOT_RECT) &&
} (track->m_Shape != S_SPOT_OVALE) )
continue;
fprintf(File,"$EndTRACK\n"); /* A spot is found, and can be a via: change it for via, and delete others
* spots at same location */
track->m_Shape = VIA_NORMALE;
track->m_StructType = TYPEVIA;
track->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp)
track->m_Drill = -1;
/* Compute the via position from track position ( Via position is the position of the middle of the track segment */
track->m_Start.x = (track->m_Start.x + track->m_End.x) / 2;
track->m_Start.y = (track->m_Start.y + track->m_End.y) / 2;
track->m_End = track->m_Start;
}
fprintf(File,"$EndBOARD\n"); /* delete redundant vias */
for( track = Pcb->m_Track; track != NULL; track = track->Next() )
{
if( track->m_Shape != VIA_NORMALE )
continue;
/* Search and delete others vias*/
TRACK* alt_track = track->Next();
for( ; alt_track != NULL; alt_track = next_track )
{
next_track = (TRACK*) alt_track->Pnext;
if( alt_track->m_Shape != VIA_NORMALE )
continue;
if( alt_track->m_Start != track->m_Start )
continue;
/* delete track */
alt_track->UnLink();
delete alt_track;
}
}
/* Delete the copy */ // Switch the locale to standard C (needed to print floating point numbers like 1.3)
for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct ) setlocale( LC_NUMERIC, "C" );
{ /* Ecriture de l'entete PCB : */
NextStruct = PtStruct->Pnext; fprintf( File, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
delete PtStruct; DateAndTime( Line ) );
} WriteGeneralDescrPcb( Pcb, File );
for(track = Pcb->m_Track; track != NULL; track = next_track) WriteSetup( File, Pcb );
{
next_track = (TRACK*) track->Pnext;
delete track;
}
delete Pcb;
setlocale(LC_NUMERIC, ""); // revert to the current locale /* Ecriture des donnes utiles du pcb */
wxEndBusyCursor(); PtStruct = Pcb->m_Drawings;
return 1; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
switch( PtStruct->m_StructType )
{
case TYPETEXTE:
( (TEXTE_PCB*) PtStruct )->WriteTextePcbDescr( File );
break;
case TYPEDRAWSEGMENT:
( (DRAWSEGMENT*) PtStruct )->WriteDrawSegmentDescr( File );
break;
default:
break;
}
}
fprintf( File, "$TRACK\n" );
for( track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext )
{
track->WriteTrackDescr( File );
}
fprintf( File, "$EndTRACK\n" );
fprintf( File, "$EndBOARD\n" );
/* Delete the copy */
for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct )
{
NextStruct = PtStruct->Next();
delete PtStruct;
}
for( track = Pcb->m_Track; track != NULL; track = next_track )
{
next_track = (TRACK*) track->Pnext;
delete track;
}
delete Pcb;
setlocale( LC_NUMERIC, "" ); // revert to the current locale
wxEndBusyCursor();
return 1;
} }

View File

@ -1,7 +1,7 @@
/**********************************************/ /**********************************************/
/* GERBVIEW : Routines d'initialisation globale */ /* GERBVIEW : Routines d'initialisation globale */
/******* Fichier INITPCB.C ********************/ /******* Fichier INITPCB.C ********************/
/**********************************************/ /**********************************************/
#include "fctsys.h" #include "fctsys.h"
@ -14,205 +14,201 @@
/* Routines Locales */ /* Routines Locales */
/********************************************************/
bool WinEDA_GerberFrame::Clear_Pcb( wxDC* DC, bool query )
/********************************************************/
/********************************************************/
bool WinEDA_GerberFrame::Clear_Pcb(wxDC * DC, bool query)
/********************************************************/
/* Realise les init des pointeurs et variables /* Realise les init des pointeurs et variables
Si Item == NULL, il n'y aura pas de confirmation * Si Item == NULL, il n'y aura pas de confirmation
*/ */
{ {
int layer; int layer;
if( m_Pcb == NULL ) return FALSE; if( m_Pcb == NULL )
return FALSE;
if ( query ) if( query )
{ {
if (m_Pcb->m_Drawings || m_Pcb->m_Track || m_Pcb->m_Zone ) if( m_Pcb->m_Drawings || m_Pcb->m_Track || m_Pcb->m_Zone )
{ {
if( ! IsOK(this, _("Current Data will be lost ?")) ) return FALSE; if( !IsOK( this, _( "Current Data will be lost ?" ) ) )
} return FALSE;
} }
}
DeleteStructList(m_Pcb->m_Drawings); DeleteStructList( m_Pcb->m_Drawings );
m_Pcb->m_Drawings = NULL; m_Pcb->m_Drawings = NULL;
DeleteStructList(m_Pcb->m_Track); DeleteStructList( m_Pcb->m_Track );
m_Pcb->m_Track = NULL; m_Pcb->m_Track = NULL;
m_Pcb->m_NbSegmTrack = 0; m_Pcb->m_NbSegmTrack = 0;
DeleteStructList(m_Pcb->m_Zone); DeleteStructList( m_Pcb->m_Zone );
m_Pcb->m_Zone = NULL; m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
for ( ; g_UnDeleteStackPtr != 0; ) for( ; g_UnDeleteStackPtr != 0; )
{ {
g_UnDeleteStackPtr--; g_UnDeleteStackPtr--;
DeleteStructList(g_UnDeleteStack[ g_UnDeleteStackPtr]); DeleteStructList( g_UnDeleteStack[ g_UnDeleteStackPtr] );
} }
/* init pointeurs et variables */ /* init pointeurs et variables */
for ( layer = 0; layer < 32; layer++ ) for( layer = 0; layer < 32; layer++ )
{ {
if ( g_GERBER_Descr_List[layer] ) if( g_GERBER_Descr_List[layer] )
g_GERBER_Descr_List[layer]->InitToolTable(); g_GERBER_Descr_List[layer]->InitToolTable();
} }
/* remise a 0 ou a une valeur initiale des variables de la structure */ /* remise a 0 ou a une valeur initiale des variables de la structure */
m_Pcb->m_BoundaryBox.SetOrigin(0,0); m_Pcb->m_BoundaryBox.SetOrigin( 0, 0 );
m_Pcb->m_BoundaryBox.SetSize(0,0); m_Pcb->m_BoundaryBox.SetSize( 0, 0 );
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
m_Pcb->m_NbLoclinks = 0; m_Pcb->m_NbLoclinks = 0;
m_Pcb->m_NbLinks = 0; m_Pcb->m_NbLinks = 0;
m_Pcb->m_NbPads = 0; m_Pcb->m_NbPads = 0;
m_Pcb->m_NbNets = 0; m_Pcb->m_NbNets = 0;
m_Pcb->m_NbNodes = 0; m_Pcb->m_NbNodes = 0;
m_Pcb->m_NbNoconnect = 0; m_Pcb->m_NbNoconnect = 0;
m_Pcb->m_NbSegmTrack = 0; m_Pcb->m_NbSegmTrack = 0;
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
/* Init parametres de gestion des ecrans PAD et PCB */ /* Init parametres de gestion des ecrans PAD et PCB */
m_CurrentScreen = ActiveScreen = ScreenPcb; m_CurrentScreen = ActiveScreen = ScreenPcb;
GetScreen()->Init(); GetScreen()->Init();
return TRUE; return TRUE;
} }
/*********************************************************/ /*********************************************************/
void WinEDA_GerberFrame::Erase_Zones(wxDC * DC, bool query) void WinEDA_GerberFrame::Erase_Zones( wxDC* DC, bool query )
/*********************************************************/ /*********************************************************/
{ {
if( query && !IsOK( this, _( "Delete zones ?" ) ) )
return;
if( query && !IsOK(this, _("Delete zones ?") ) ) return ; if( m_Pcb->m_Zone )
{
if( m_Pcb->m_Zone ) DeleteStructList( m_Pcb->m_Zone );
{ m_Pcb->m_Zone = NULL;
DeleteStructList(m_Pcb->m_Zone); m_Pcb->m_NbSegmZone = 0;
m_Pcb->m_Zone = NULL; }
m_Pcb->m_NbSegmZone = 0; ScreenPcb->SetModify();
}
ScreenPcb->SetModify();
} }
/*****************************************************/ /*****************************************************/
void WinEDA_GerberFrame::Erase_Segments_Pcb(wxDC * DC, void WinEDA_GerberFrame::Erase_Segments_Pcb( wxDC* DC,
bool all_layers, bool query) bool all_layers, bool query )
/*****************************************************/ /*****************************************************/
{ {
EDA_BaseStruct * PtStruct, *PtNext; BOARD_ITEM* PtStruct;
int layer = GetScreen()->m_Active_Layer; BOARD_ITEM* PtNext;
int layer = GetScreen()->m_Active_Layer;
if ( all_layers ) layer = -1; if( all_layers )
layer = -1;
PtStruct = (EDA_BaseStruct *) m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtNext) for( ; PtStruct != NULL; PtStruct = PtNext )
{ {
PtNext = PtStruct->Pnext; PtNext = PtStruct->Next();
switch( PtStruct->m_StructType )
{
case TYPEDRAWSEGMENT:
if( (((DRAWSEGMENT*)PtStruct)->m_Layer == layer)
|| layer < 0)
DeleteStructure(PtStruct);
break;
case TYPETEXTE: switch( PtStruct->m_StructType )
if( (((TEXTE_PCB*)PtStruct)->m_Layer == layer) {
|| layer < 0) case TYPEDRAWSEGMENT:
DeleteStructure(PtStruct); case TYPETEXTE:
break; case TYPECOTATION:
case TYPEMIRE:
if( PtStruct->GetLayer() == layer || layer < 0 )
DeleteStructure( PtStruct );
break;
case TYPECOTATION: default:
if( (((COTATION*)PtStruct)->m_Layer == layer) DisplayError( this, wxT( "Type Draw inconnu/inattendu" ) );
|| layer < 0) break;
DeleteStructure(PtStruct); }
break; }
case TYPEMIRE: ScreenPcb->SetModify();
if( (((MIREPCB*)PtStruct)->m_Layer == layer)
|| layer < 0)
DeleteStructure(PtStruct);
break;
default:
DisplayError(this, wxT("Type Draw inconnu/inattendu"));
break;
}
}
ScreenPcb->SetModify();
} }
/****************************************************************/ /****************************************************************/
void WinEDA_GerberFrame::Erase_Pistes(wxDC * DC, int masque_type, void WinEDA_GerberFrame::Erase_Pistes( wxDC* DC, int masque_type,
bool query) bool query )
/****************************************************************/ /****************************************************************/
/* Efface les segments de piste, selon les autorisations affichees /* Efface les segments de piste, selon les autorisations affichees
masque_type = masque des options de selection: * masque_type = masque des options de selection:
SEGM_FIXE, SEGM_AR * SEGM_FIXE, SEGM_AR
Si un des bits est a 1, il n'y a pas effacement du segment de meme bit a 1 * Si un des bits est a 1, il n'y a pas effacement du segment de meme bit a 1
*/ */
{ {
TRACK * pt_segm; TRACK* pt_segm;
EDA_BaseStruct * PtNext; BOARD_ITEM* PtNext;
if( query && ! IsOK(this, _("Delete Tracks?")) ) return; if( query && !IsOK( this, _( "Delete Tracks?" ) ) )
return;
/* Marquage des pistes a effacer */ /* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext) for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext )
{ {
PtNext = pt_segm->Pnext; PtNext = pt_segm->Next();
if( pt_segm->GetState(SEGM_FIXE|SEGM_AR) & masque_type) continue; if( pt_segm->GetState( SEGM_FIXE | SEGM_AR ) & masque_type )
DeleteStructure(pt_segm); continue;
} DeleteStructure( pt_segm );
}
ScreenPcb->SetModify(); ScreenPcb->SetModify();
} }
/*****************************************************************/ /*****************************************************************/
void WinEDA_GerberFrame::Erase_Textes_Pcb(wxDC * DC, bool query) void WinEDA_GerberFrame::Erase_Textes_Pcb( wxDC* DC, bool query )
/*****************************************************************/ /*****************************************************************/
{ {
EDA_BaseStruct * PtStruct, *PtNext; BOARD_ITEM* PtStruct;
BOARD_ITEM* PtNext;
if( query && ! IsOK(this, _("Delete Pcb Texts") ) ) return; if( query && !IsOK( this, _( "Delete Pcb Texts" ) ) )
return;
PtStruct = (EDA_BaseStruct*) m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtNext) for( ; PtStruct != NULL; PtStruct = PtNext )
{ {
PtNext = PtStruct->Pnext; PtNext = PtStruct->Next();
if(PtStruct->m_StructType == TYPETEXTE ) DeleteStructure(PtStruct); if( PtStruct->m_StructType == TYPETEXTE )
} DeleteStructure( PtStruct );
}
ScreenPcb->SetModify(); ScreenPcb->SetModify();
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_GerberFrame::Erase_Current_Layer(wxDC * DC, bool query) void WinEDA_GerberFrame::Erase_Current_Layer( wxDC* DC, bool query )
/*******************************************************************/ /*******************************************************************/
{ {
TRACK * pt_segm; TRACK* pt_segm;
EDA_BaseStruct * PtNext; BOARD_ITEM* PtNext;
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
wxString msg; wxString msg;
msg.Printf( _("Delete Layer %d"), layer+1); msg.Printf( _( "Delete Layer %d" ), layer + 1 );
if( query && ! IsOK(this, msg) ) return; if( query && !IsOK( this, msg ) )
return;
/* Marquage des pistes a effacer */ /* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext) for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext )
{ {
PtNext = pt_segm->Pnext; PtNext = pt_segm->Next();
if( pt_segm->m_Layer != layer) continue; if( pt_segm->GetLayer() != layer )
DeleteStructure(pt_segm); continue;
} DeleteStructure( pt_segm );
}
ScreenPcb->SetModify(); ScreenPcb->SetModify();
ScreenPcb->SetRefreshReq(); ScreenPcb->SetRefreshReq();
} }

View File

@ -102,7 +102,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
* NULL si rien trouve * NULL si rien trouve
*/ */
{ {
EDA_BaseStruct* PtStruct; BOARD_ITEM* PtStruct;
DRAWSEGMENT* pts; DRAWSEGMENT* pts;
wxPoint ref; wxPoint ref;
PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen; PCB_SCREEN* screen = (PCB_SCREEN*) ActiveScreen;
@ -110,7 +110,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
SET_REF_POS( ref ); SET_REF_POS( ref );
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue; continue;
@ -121,7 +121,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
/* detection : */ /* detection : */
if( pts->m_Layer != screen->m_Active_Layer ) if( pts->GetLayer() != screen->m_Active_Layer )
continue; continue;
if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) ) if( (pts->m_Shape == S_CIRCLE) || (pts->m_Shape == S_ARC) )
@ -208,7 +208,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer )
} }
if( Layer >= 0 ) if( Layer >= 0 )
if( Track->m_Layer != Layer ) if( Track->GetLayer() != Layer )
continue;/* Segments sur couches differentes */ continue;/* Segments sur couches differentes */
if( distance( l_piste ) ) if( distance( l_piste ) )
return Track; return Track;
@ -260,7 +260,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, wxPoint ref, int layer )
dx -= ux0; dy -= uy0; dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if( (layer != -1) && (Zone->m_Layer != layer) ) if( (layer != -1) && (Zone->GetLayer() != layer) )
continue; continue;
if( distance( l_segm ) ) if( distance( l_segm ) )
return Zone; return Zone;

View File

@ -105,7 +105,7 @@ TRACK * track;
track = new TRACK(frame->m_Pcb); track = new TRACK(frame->m_Pcb);
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Layer = frame->GetScreen()->m_Active_Layer; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = diametre ; track->m_Width = diametre ;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE(track->m_Start.y); NEGATE(track->m_Start.y);
@ -129,13 +129,13 @@ static void Append_1_Flash_GERBER(int Dcode_index,
TRACK * track; TRACK * track;
int width, len; int width, len;
width = min( size.x, size.y ); width = MIN( size.x, size.y );
len = max( size.x, size.y ) - width; len = MAX( size.x, size.y ) - width;
track = new TRACK(frame->m_Pcb); track = new TRACK(frame->m_Pcb);
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Layer = frame->GetScreen()->m_Active_Layer; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = width; track->m_Width = width;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE(track->m_Start.y); NEGATE(track->m_Start.y);
@ -176,7 +176,7 @@ TRACK * track;
track = new TRACK( frame->m_Pcb ); track = new TRACK( frame->m_Pcb );
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Layer = frame->GetScreen()->m_Active_Layer ; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur ; track->m_Width = largeur ;
track->m_Start = startpoint; track->m_Start = startpoint;
NEGATE(track->m_Start.y); NEGATE(track->m_Start.y);
@ -213,7 +213,7 @@ wxPoint center, delta;
track->Insert(frame->m_Pcb, NULL); track->Insert(frame->m_Pcb, NULL);
track->m_Shape = S_ARC; track->m_Shape = S_ARC;
track->m_Layer = frame->GetScreen()->m_Active_Layer ; track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur ; track->m_Width = largeur ;
if ( multiquadrant ) if ( multiquadrant )
@ -555,7 +555,7 @@ bool GERBER_Descr::Execute_G_Command(char * &text, int G_commande)
if ( D_commande < FIRST_DCODE) return FALSE; if ( D_commande < FIRST_DCODE) return FALSE;
if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1; if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1;
m_Current_Tool = D_commande; m_Current_Tool = D_commande;
D_CODE * pt_Dcode = ReturnToolDescr(m_Layer, D_commande); D_CODE * pt_Dcode = ReturnToolDescr( m_Layer, D_commande );
if ( pt_Dcode ) pt_Dcode->m_InUse = TRUE; if ( pt_Dcode ) pt_Dcode->m_InUse = TRUE;
break; break;
} }
@ -643,7 +643,7 @@ wxString msg;
if ( last ) while (last->Pnext ) last = (SEGZONE*)last->Pnext; if ( last ) while (last->Pnext ) last = (SEGZONE*)last->Pnext;
edge_poly->Insert(frame->m_Pcb, last); edge_poly->Insert(frame->m_Pcb, last);
edge_poly->m_Layer = frame->GetScreen()->m_Active_Layer ; edge_poly->SetLayer( frame->GetScreen()->m_Active_Layer );
edge_poly->m_Width = 1; edge_poly->m_Width = 1;
edge_poly->m_Start = m_PreviousPos; edge_poly->m_Start = m_PreviousPos;
NEGATE(edge_poly->m_Start.y); NEGATE(edge_poly->m_Start.y);

View File

@ -116,7 +116,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
{ {
if( nbpoints ) if( nbpoints )
{ {
int Color = g_DesignSettings.m_LayerColor[track->m_Layer]; int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color ); 1, Color, Color );
} }
@ -141,7 +141,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
} }
if( track->Next() == NULL ) // Last point if( track->Next() == NULL ) // Last point
{ {
int Color = g_DesignSettings.m_LayerColor[track->m_Layer]; int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color ); 1, Color, Color );
} }

View File

@ -1,6 +1,6 @@
/*****************************************************************/ /*****************************************************************/
/* Routines de tracage des pistes ( Toutes, 1 piste, 1 segment ) */ /* Routines de tracage des pistes ( Toutes, 1 piste, 1 segment ) */
/*****************************************************************/ /*****************************************************************/
#include "fctsys.h" #include "fctsys.h"
@ -17,342 +17,353 @@
/* variables locales : */ /* variables locales : */
/***************************************************************************************************/ /***************************************************************************************************/
void Draw_Track_Buffer(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int draw_mode, int printmasklayer) void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode,
int printmasklayer )
/***************************************************************************************************/ /***************************************************************************************************/
/* Function to draw the tracks (i.e Sports or lines) in gerbview /* Function to draw the tracks (i.e Sports or lines) in gerbview
Polygons are not handled here (there are in Pcb->m_Zone) * Polygons are not handled here (there are in Pcb->m_Zone)
* @param DC = device context to draw * @param DC = device context to draw
* @param Pcb = Board to draw (only Pcb->m_Track is used) * @param Pcb = Board to draw (only Pcb->m_Track is used)
* @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..)
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers) * @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/ */
{ {
TRACK * Track; TRACK* Track;
int layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer; int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
GERBER_Descr * gerber_layer = g_GERBER_Descr_List[layer]; GERBER_Descr* gerber_layer = g_GERBER_Descr_List[layer];
int dcode_hightlight = 0; int dcode_hightlight = 0;
if ( gerber_layer ) if( gerber_layer )
dcode_hightlight = gerber_layer->m_Selected_Tool; dcode_hightlight = gerber_layer->m_Selected_Tool;
Track = Pcb->m_Track; Track = Pcb->m_Track;
for ( ; Track != NULL ; Track = (TRACK*) Track->Pnext ) for( ; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
if ( printmasklayer != -1 ) if( printmasklayer != -1 )
if ( (Track->ReturnMaskLayer() & printmasklayer) == 0 ) continue; if( (Track->ReturnMaskLayer() & printmasklayer) == 0 )
continue;
if ( (dcode_hightlight == Track->m_NetCode) && if( (dcode_hightlight == Track->m_NetCode)
(Track->m_Layer == layer) ) && (Track->GetLayer() == layer) )
Trace_Segment(panel, DC, Track, draw_mode | GR_SURBRILL); Trace_Segment( panel, DC, Track, draw_mode | GR_SURBRILL );
else Trace_Segment(panel, DC, Track, draw_mode ); else
} Trace_Segment( panel, DC, Track, draw_mode );
}
} }
/***********************************************************************************/ /***********************************************************************************/
void Trace_Segment(WinEDA_DrawPanel * panel, wxDC * DC, TRACK* track, int draw_mode) void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode )
/***********************************************************************************/ /***********************************************************************************/
/* routine de trace de 1 segment de piste. /* routine de trace de 1 segment de piste.
Parametres : * Parametres :
track = adresse de la description de la piste en buflib * track = adresse de la description de la piste en buflib
draw_mode = mode ( GR_XOR, GR_OR..) * draw_mode = mode ( GR_XOR, GR_OR..)
*/ */
{ {
int l_piste; int l_piste;
int color; int color;
int zoom; int zoom;
int rayon; int rayon;
int fillopt; int fillopt;
static bool show_err; static bool show_err;
color = g_DesignSettings.m_LayerColor[track->m_Layer]; color = g_DesignSettings.m_LayerColor[track->GetLayer()];
if(color & ITEM_NOT_SHOW ) return ; if( color & ITEM_NOT_SHOW )
return;
zoom = panel->GetZoom(); zoom = panel->GetZoom();
GRSetDrawMode(DC, draw_mode); GRSetDrawMode( DC, draw_mode );
if( draw_mode & GR_SURBRILL) if( draw_mode & GR_SURBRILL )
{ {
if( draw_mode & GR_AND) color &= ~HIGHT_LIGHT_FLAG; if( draw_mode & GR_AND )
else color |= HIGHT_LIGHT_FLAG; color &= ~HIGHT_LIGHT_FLAG;
} else
if ( color & HIGHT_LIGHT_FLAG) color |= HIGHT_LIGHT_FLAG;
color = ColorRefs[color & MASKCOLOR].m_LightColor; }
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
rayon = l_piste = track->m_Width >> 1; rayon = l_piste = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
switch (track->m_Shape) switch( track->m_Shape )
{ {
case S_CIRCLE: case S_CIRCLE:
rayon = (int)hypot((double)(track->m_End.x-track->m_Start.x), rayon = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
(double)(track->m_End.y-track->m_Start.y) ); (double) (track->m_End.y - track->m_Start.y) );
if ( (l_piste/zoom) < L_MIN_DESSIN) if( (l_piste / zoom) < L_MIN_DESSIN )
{ {
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon , 0, color) ; rayon, 0, color );
} }
if( fillopt == SKETCH) if( fillopt == SKETCH )
{ {
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon-l_piste, 0, color); rayon - l_piste, 0, color );
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon+l_piste, 0, color); rayon + l_piste, 0, color );
} }
else else
{ {
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon, track->m_Width,color); rayon, track->m_Width, color );
} }
break; break;
case S_ARC: case S_ARC:
{ {
if( fillopt == SKETCH) if( fillopt == SKETCH )
{ {
GRArc1(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, track->m_End.x, track->m_End.y,
track->m_Param, track->m_Sous_Netcode, 0, color); track->m_Param, track->m_Sous_Netcode, 0, color );
} }
else else
{ {
GRArc1(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, track->m_End.x, track->m_End.y,
track->m_Param,track->m_Sous_Netcode, track->m_Param, track->m_Sous_Netcode,
track->m_Width, color); track->m_Width, color );
} }
} }
break; break;
case S_SPOT_CIRCLE: case S_SPOT_CIRCLE:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if ( (rayon/zoom) < L_MIN_DESSIN) if( (rayon / zoom) < L_MIN_DESSIN )
{ {
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon , 0, color) ; rayon, 0, color );
} }
else if( fillopt == SKETCH )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon, 0, color );
}
else
{
GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon, 0, color, color );
}
break;
else if( fillopt == SKETCH ) case S_SPOT_RECT:
{ case S_RECT:
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
rayon, 0, color); if( (l_piste / zoom) < L_MIN_DESSIN )
} {
else GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
{ track->m_End.x, track->m_End.y, 0, color );
GRFilledCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, }
rayon, 0, color, color); else if( fillopt == SKETCH )
} {
break; GRRect( &panel->m_ClipBox, DC,
track->m_Start.x - l_piste,
track->m_Start.y - l_piste,
track->m_End.x + l_piste,
track->m_End.y + l_piste,
0, color );
}
else
{
GRFilledRect( &panel->m_ClipBox, DC,
track->m_Start.x - l_piste,
track->m_Start.y - l_piste,
track->m_End.x + l_piste,
track->m_End.y + l_piste,
0, color, color );
}
break;
case S_SPOT_RECT: case S_SPOT_OVALE:
case S_RECT: fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if ( (l_piste/zoom) < L_MIN_DESSIN)
{
GRLine(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color);
}
else if( fillopt == SKETCH )
{
GRRect(&panel->m_ClipBox, DC,
track->m_Start.x - l_piste,
track->m_Start.y - l_piste,
track->m_End.x + l_piste,
track->m_End.y + l_piste,
0, color) ;
}
else
{
GRFilledRect(&panel->m_ClipBox, DC,
track->m_Start.x - l_piste,
track->m_Start.y - l_piste,
track->m_End.x + l_piste,
track->m_End.y + l_piste,
0, color, color) ;
}
break;
case S_SPOT_OVALE: case S_SEGMENT:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; if( (l_piste / zoom) < L_MIN_DESSIN )
case S_SEGMENT: {
if ( (l_piste/zoom) < L_MIN_DESSIN) GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
{ track->m_End.x, track->m_End.y, 0, color );
GRLine(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, break;
track->m_End.x, track->m_End.y, 0, color); }
break;
}
if( fillopt == SKETCH ) if( fillopt == SKETCH )
{ {
GRCSegm(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, track->m_End.x, track->m_End.y,
track->m_Width, color) ; track->m_Width, color );
} }
else else
{ {
GRFillCSegm(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, track->m_End.x, track->m_End.y,
track->m_Width, color) ; track->m_Width, color );
} }
break; break;
default: default:
if ( ! show_err ) if( !show_err )
{ {
DisplayError(panel, wxT("Trace_Segment() type error")); DisplayError( panel, wxT( "Trace_Segment() type error" ) );
show_err = TRUE; show_err = TRUE;
} }
break; break;
} }
} }
/**************************************************************************/ /**************************************************************************/
void Trace_DrawSegmentPcb(WinEDA_DrawPanel * panel, wxDC * DC, void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
DRAWSEGMENT * PtDrawSegment, int draw_mode) DRAWSEGMENT* PtDrawSegment, int draw_mode )
/**************************************************************************/ /**************************************************************************/
/* Affichage d'un segment type drawing PCB: /* Affichage d'un segment type drawing PCB:
Entree : ox, oy = offset de trace * Entree : ox, oy = offset de trace
draw_mode = mode de trace ( GR_OR, GR_XOR, GrAND) * draw_mode = mode de trace ( GR_OR, GR_XOR, GrAND)
Les contours sont de differents type: * Les contours sont de differents type:
segment * segment
cercle * cercle
arc * arc
*/ */
{ {
int ux0, uy0, dx, dy; int ux0, uy0, dx, dy;
int l_piste; int l_piste;
int color, mode; int color, mode;
int zoom = panel->GetZoom(); int zoom = panel->GetZoom();
int rayon; int rayon;
color = g_DesignSettings.m_LayerColor[PtDrawSegment->m_Layer]; color = g_DesignSettings.m_LayerColor[PtDrawSegment->GetLayer()];
if(color & ITEM_NOT_SHOW ) return ; if( color & ITEM_NOT_SHOW )
return;
GRSetDrawMode(DC, draw_mode); GRSetDrawMode( DC, draw_mode );
l_piste = PtDrawSegment->m_Width >> 1; /* l_piste = demi largeur piste */ l_piste = PtDrawSegment->m_Width >> 1; /* l_piste = demi largeur piste */
/* coord de depart */ /* coord de depart */
ux0 = PtDrawSegment->m_Start.x; ux0 = PtDrawSegment->m_Start.x;
uy0 = PtDrawSegment->m_Start.y; uy0 = PtDrawSegment->m_Start.y;
/* coord d'arrivee */ /* coord d'arrivee */
dx = PtDrawSegment->m_End.x; dx = PtDrawSegment->m_End.x;
dy = PtDrawSegment->m_End.y; dy = PtDrawSegment->m_End.y;
mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
if(PtDrawSegment->m_Flags & FORCE_SKETCH) mode = SKETCH; if( PtDrawSegment->m_Flags & FORCE_SKETCH )
if ( l_piste < (L_MIN_DESSIN * zoom) ) mode = FILAIRE; mode = SKETCH;
if( l_piste < (L_MIN_DESSIN * zoom) )
mode = FILAIRE;
switch (PtDrawSegment->m_Shape) switch( PtDrawSegment->m_Shape )
{ {
case S_CIRCLE: case S_CIRCLE:
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) ); rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
if ( mode == FILAIRE) if( mode == FILAIRE )
{ {
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, 0, color) ; GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, 0, color );
} }
else if( mode == SKETCH) else if( mode == SKETCH )
{ {
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon-l_piste, 0, color); GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon - l_piste, 0, color );
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon+l_piste, 0, color); GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon + l_piste, 0, color );
} }
else else
{ {
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, PtDrawSegment->m_Width,color); GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, PtDrawSegment->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) ); rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
StAngle = (int) ArcTangente(dy-uy0, dx-ux0); StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + PtDrawSegment->m_Angle; EndAngle = StAngle + PtDrawSegment->m_Angle;
if ( mode == FILAIRE) if( mode == FILAIRE )
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, 0, color); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, 0, color );
else if( mode == SKETCH) else if( mode == SKETCH )
{ {
GRArc(&panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle, GRArc( &panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle,
rayon - l_piste, color); rayon - l_piste, color );
GRArc(&panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle, GRArc( &panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle,
rayon + l_piste, color); rayon + l_piste, color );
} }
else else
{ {
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, PtDrawSegment->m_Width,color); rayon, PtDrawSegment->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,
PtDrawSegment->m_Width, color) ; PtDrawSegment->m_Width, color );
} }
else else
{ {
GRFillCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
PtDrawSegment->m_Width, color) ; PtDrawSegment->m_Width, color );
} }
break; break;
} }
} }
/*****************************************************************************************/ /*****************************************************************************************/
void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int drawmode) void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )
/*****************************************************************************************/ /*****************************************************************************************/
{ {
TRACK * track; TRACK* track;
wxPoint pos; wxPoint pos;
int width, orient; int width, orient;
wxString Line; wxString Line;
GRSetDrawMode(DC, drawmode); GRSetDrawMode( DC, drawmode );
track = Pcb->m_Track; track = Pcb->m_Track;
for ( ; track != NULL ; track = (TRACK*) track->Pnext ) for( ; track != NULL; track = (TRACK*) track->Pnext )
{ {
if ( (track->m_Shape == S_ARC) || if( (track->m_Shape == S_ARC)
(track->m_Shape == S_CIRCLE) || || (track->m_Shape == S_CIRCLE)
(track->m_Shape == S_ARC_RECT) ) || (track->m_Shape == S_ARC_RECT) )
{ {
pos.x = track->m_Start.x; pos.x = track->m_Start.x;
pos.y = track->m_Start.y; pos.y = track->m_Start.y;
} }
else
{
pos.x = (track->m_Start.x + track->m_End.x) / 2;
pos.y = (track->m_Start.y + track->m_End.y) / 2;
}
Line.Printf( wxT( "D%d" ), track->m_NetCode );
width = track->m_Width;
orient = TEXT_ORIENT_HORIZ;
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
{
width /= 3;
}
else // lines
{
int dx, dy;
dx = track->m_Start.x - track->m_End.x;
dy = track->m_Start.y - track->m_End.y;
if( abs( dx ) < abs( dy ) )
orient = TEXT_ORIENT_VERT;
width /= 2;
}
else DrawGraphicText( panel, DC,
{ pos, g_DCodesColor, Line,
pos.x = (track->m_Start.x + track->m_End.x) / 2; orient, wxSize( width, width ),
pos.y = (track->m_Start.y + track->m_End.y) / 2; GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
} }
Line.Printf( wxT("D%d"), track->m_NetCode);
width = track->m_Width;
orient = TEXT_ORIENT_HORIZ;
if ( track->m_Shape >= S_SPOT_CIRCLE) // forme flash
{
width /= 3;
}
else // lines
{
int dx, dy;
dx = track->m_Start.x - track->m_End.x;
dy = track->m_Start.y - track->m_End.y;
if ( abs(dx) < abs(dy) ) orient = TEXT_ORIENT_VERT;
width /= 2;
}
DrawGraphicText(panel, DC,
pos, g_DCodesColor, Line,
orient, wxSize(width, width),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER);
}
} }

View File

@ -110,7 +110,7 @@ public:
* *
* @param testItem An EDA_BaseStruct to examine. * @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine * @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria. * if the BOARD_ITEM under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE; * else SCAN_CONTINUE;
*/ */
@ -154,7 +154,7 @@ public:
unsigned long m_TimeStamp; // Time stamp used for logical links unsigned long m_TimeStamp; // Time stamp used for logical links
int m_Selected; /* Used by block commands, and selective editing */ int m_Selected; /* Used by block commands, and selective editing */
int m_Layer; ///< used by many derived classes, so make common // int m_Layer; ///< used by many derived classes, so make common
private: private:
int m_Status; int m_Status;
@ -298,21 +298,6 @@ public:
**/ **/
static std::ostream& NestedSpace( int nestLevel, std::ostream& os ); static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
/**
* Function ListHas
* scans the given array and detects if the given type t is present.
* @param list An array of KICAD_T, terminated with EOT.
* @param t A KICAD_T to check for.
* @return bool - true if present, else false.
*/
static bool ListHas( const KICAD_T list[], KICAD_T t )
{
for( const KICAD_T* p = list; *p != EOT; ++p )
if( *p == t )
return true;
return false;
}
#endif #endif
}; };
@ -383,12 +368,59 @@ public:
}; };
/* Basic class for build items like lines, which have 1 start point and 1 end point. /**
* Arc and circles can use this class. * Class BOARD_ITEM
* is an abstract base class for any item which can be embedded within the BOARD
* container class, and therefore instances of derived classes should only be
* found in PCBNEW or other programs that use class BOARD and its contents.
* The corresponding class in EESCHEMA seems to be DrawPartStruct.
*/
class BOARD_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
EDA_BaseStruct( StructFather, idtype ),
m_Layer(0)
{
}
BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.m_StructType ),
m_Layer( src.m_Layer )
{
}
BOARD_ITEM* Next() { return (BOARD_ITEM*) Pnext; }
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
};
/* Base class for building items like lines, which have 1 start point and 1 end point.
* Arc and circles can use this class.
*/ */
class EDA_BaseLineStruct : public EDA_BaseStruct class EDA_BaseLineStruct : public EDA_BaseStruct
{ {
public: public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ... int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point wxPoint m_End; // Line end point

242
include/class_collector.h Normal file
View File

@ -0,0 +1,242 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef COLLECTOR_H
#define COLLECTOR_H
#include <vector>
//#include <cstdlib> // abs()
#include "fctsys.h"
#include "base_struct.h" // SEARCH_RESULT
#include "common.h" // GetTimeStamp()
class EDA_BaseStruct;
class BOARD;
/**
* Class COLLECTOR
* is an abstract class that will find and hold all the objects according to
* an inspection done by the Inspect() function which must be implemented by
* any derived class. When Inspect() finds an object that it wants to collect,
* i.e. one that it "likes", then it only has to do an Append( testItem )
* on it to add it to its collection, but in all cases for the scan to continue,
* Inspect() must return SEARCH_CONTINUE.
*
* Later, after collection, the user can iterate through all the objects
* in the remembered collection using GetCount() and the [int] operator.
*
* Philosophy: this class knows nothing of the context in which as BOARD is used
* and that means it knows nothing about which layers are visible or current,
* but can handle those concerns by the SetPreferredLayer() function.
*/
class COLLECTOR : public INSPECTOR
{
protected:
// int m_Type;
/// Which object types to scan
const KICAD_T* m_ScanTypes;
/// The layer that is desired as a primary search criterion
int m_PreferredLayer;
/// A place to hold collected objects without taking ownership of their memory.
std::vector<EDA_BaseStruct*> list;
/// The point at which the snapshot was taken.
wxPoint m_RefPos;
/// The time at which the collection was made.
int m_TimeAtCollection;
public:
COLLECTOR()
{
m_PreferredLayer = 0;
m_ScanTypes = 0;
}
virtual ~COLLECTOR()
{
// empty the list so that ~list() does not try and delete all
// the objects that it holds. list is not the owner of such objects
// and this prevents a double free()ing.
Empty();
}
/**
* Function Type
* returns the type of the collector.
int Type() const { return m_Type; }
*/
void SetPreferredLayer( int aPreferredLayer )
{
m_PreferredLayer = aPreferredLayer;
}
/**
* Function GetCount
* returns the number of objects in the list
*/
int GetCount() const
{
return list.size();
}
/**
* Function Empty
* sets the list to empty
*/
void Empty()
{
list.clear();
}
/**
* Function Append
* adds an item to the end of the list.
* @param item An EDA_BaseStruct* to add.
*/
void Append( EDA_BaseStruct* item )
{
list.push_back( item );
}
/**
* Function operator[int]
* is used for read only access and returns the object at index ndx.
* @param ndx The index into the list.
* @return EDA_BaseStruct* - or something derived from it, or NULL.
*/
EDA_BaseStruct* operator[]( int ndx ) const
{
if( (unsigned)ndx < (unsigned)GetCount() )
return list[ ndx ];
return NULL;
}
void SetScanTypes( const KICAD_T* scanTypes )
{
m_ScanTypes = scanTypes;
}
wxPoint GetRefPos() const { return m_RefPos; }
void SetRefPos( const wxPoint& arefPos )
{
m_RefPos = arefPos;
}
void SetTimeNow()
{
m_TimeAtCollection = GetTimeStamp();
}
int GetTime()
{
return m_TimeAtCollection;
}
/**
* Function IsSimilarPointAndTime
* returns true if the given reference point is "similar" (defined here)
* to the internal reference point and the current time is within a few
* seconds of the internal m_TimeAtCollection.
*
* @param aRefPos A wxPoint to compare to.
* @return bool - true if the point and time are similar, else false.
*/
bool IsSimilarPointAndTime( const wxPoint& aRefPos )
{
const int distMax = 2; // adjust these here
const int timeMax = 3; // seconds, I think
int dx = abs( aRefPos.x - m_RefPos.x );
int dy = abs( aRefPos.y - m_RefPos.y );
if( dx <= distMax && dy <= distMax
&& GetTimeStamp()-m_TimeAtCollection <= timeMax )
return true;
else
return false;
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*
* implement in derived class:
SEARCH_RESULT virtual Inspect( EDA_BaseStruct* testItem,
const void* testData ) = 0;
*/
/**
* Function Scan
* scans a BOARD using this class's Inspector method, which does the collection.
* @param board A BOARD to scan.
* @param refPos A wxPoint to use in hit-testing.
*
* example implementation, in derived class:
*
virtual void Scan( BOARD* board, const wxPoint& refPos )
{
example implementation:
SetRefPos( refPos ); // remember where the snapshot was taken from
Empty(); // empty the collection
// visit the board with the INSPECTOR (me).
board->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData,
m_ScanTypes);
SetTimeNow(); // when it was taken
}
*/
};
#endif // COLLECTOR_H

View File

@ -11,12 +11,14 @@
#define CONV_FROM_UTF8(utf8string) (utf8string) #define CONV_FROM_UTF8(utf8string) (utf8string)
#endif #endif
/* violation of C++ standard, cannot use MIN() and MAX()
#ifndef min #ifndef min
#define min(x, y) ((x) > (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x))
#endif #endif
#ifndef max #ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif #endif
*/
#ifndef MIN #ifndef MIN
#define MIN(x, y) ((x) > (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x))

View File

@ -187,7 +187,7 @@ enum DisplayViaMode {
}; };
class BOARD : public EDA_BaseStruct class BOARD : public BOARD_ITEM
{ {
public: public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
@ -204,7 +204,7 @@ public:
int m_NbSegmTrack; // nombre d'elements de type segments de piste int m_NbSegmTrack; // nombre d'elements de type segments de piste
int m_NbSegmZone; // nombre d'elements de type segments de zone int m_NbSegmZone; // nombre d'elements de type segments de zone
EDA_BaseStruct* m_Drawings; // pointeur sur liste drawings BOARD_ITEM* m_Drawings; // pointeur sur liste drawings
MODULE* m_Modules; // pointeur sur liste zone modules MODULE* m_Modules; // pointeur sur liste zone modules
EQUIPOT* m_Equipots; // pointeur liste zone equipot EQUIPOT* m_Equipots; // pointeur liste zone equipot
TRACK* m_Track; // pointeur relatif zone piste TRACK* m_Track; // pointeur relatif zone piste
@ -339,15 +339,19 @@ public:
/* Description des elements du PCB */ /* Description des elements du PCB */
/***********************************/ /***********************************/
class DRAWSEGMENT : public EDA_BaseLineStruct class DRAWSEGMENT : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // forme: Segment , Cercle.. int m_Shape; // forme: Segment , Cercle..
int m_Type; // numero de sous type ( cotation.. ) int m_Type; // numero de sous type ( cotation.. )
int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg
public: public:
DRAWSEGMENT( EDA_BaseStruct* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT ); DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT );
~DRAWSEGMENT( void ); ~DRAWSEGMENT( void );
// Read/write data // Read/write data
@ -405,7 +409,7 @@ public:
class EDGE_ZONE : public DRAWSEGMENT class EDGE_ZONE : public DRAWSEGMENT
{ {
public: public:
EDGE_ZONE( EDA_BaseStruct* StructFather ); EDGE_ZONE( BOARD_ITEM* StructFather );
EDGE_ZONE( const EDGE_ZONE& edgezone ); EDGE_ZONE( const EDGE_ZONE& edgezone );
~EDGE_ZONE( void ); ~EDGE_ZONE( void );
}; };
@ -415,7 +419,7 @@ public:
/* Gestion des marqueurs sur le PCB */ /* Gestion des marqueurs sur le PCB */
/************************************/ /************************************/
class MARQUEUR : public EDA_BaseStruct class MARQUEUR : public BOARD_ITEM
{ {
/* Description d'un marqueur */ /* Description d'un marqueur */
public: public:
@ -426,7 +430,7 @@ public:
wxString m_Diag; /* Associated text (comment) */ wxString m_Diag; /* Associated text (comment) */
public: public:
MARQUEUR( EDA_BaseStruct* StructFather ); MARQUEUR( BOARD_ITEM* StructFather );
~MARQUEUR( void ); ~MARQUEUR( void );
void UnLink( void ); void UnLink( void );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );

View File

@ -11,8 +11,6 @@
#define eda_global extern #define eda_global extern
#endif #endif
#include <vector>
#include <wx/socket.h> #include <wx/socket.h>
#include "wx/log.h" #include "wx/log.h"
#include "wx/config.h" #include "wx/config.h"
@ -98,6 +96,7 @@ class WinEDA3D_DrawFrame;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo; class Ki_HotkeyInfo;
class ARROWCOLLECTOR;
enum id_librarytype { enum id_librarytype {
@ -519,9 +518,7 @@ private:
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
#if defined(DEBUG) #if defined(DEBUG)
class COLLECTOR; ARROWCOLLECTOR* m_ArrowCollector; ///< while arrow icon tool
COLLECTOR* m_GeneralCollector; ///< while arrow icon tool
COLLECTOR* m_RatsModuleCollector; ///< while find1rats icon tool
#endif #endif

View File

@ -448,7 +448,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
TRACK TmpSegm( NULL ); TRACK TmpSegm( NULL );
TmpSegm.m_Layer = -1; TmpSegm.SetLayer( -1 );
TmpSegm.m_NetCode = -1; TmpSegm.m_NetCode = -1;
TmpSegm.m_Width = g_GridRoutingSize / 2; TmpSegm.m_Width = g_GridRoutingSize / 2;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
@ -459,7 +459,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
DrawSegm = (DRAWSEGMENT*) PtStruct; DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->m_Layer != EDGE_N ) if( DrawSegm->GetLayer() != EDGE_N )
break; break;
TmpSegm.m_Start = DrawSegm->m_Start; TmpSegm.m_Start = DrawSegm->m_Start;
@ -536,9 +536,9 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module )
fy = m_Pcb->m_BoundaryBox.GetBottom(); fy = m_Pcb->m_BoundaryBox.GetBottom();
masque_layer = 0; masque_layer = 0;
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
masque_layer = CMP_LAYER; masque_layer = CMP_LAYER;
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
masque_layer = CUIVRE_LAYER; masque_layer = CUIVRE_LAYER;
TraceFilledRectangle( m_Pcb, ox, oy, fx, fy, masque_layer, TraceFilledRectangle( m_Pcb, ox, oy, fx, fy, masque_layer,
@ -615,7 +615,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
{ {
D_PAD* Pad; int masque_otherlayer; D_PAD* Pad; int masque_otherlayer;
masque_otherlayer = CUIVRE_LAYER; masque_otherlayer = CUIVRE_LAYER;
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
masque_otherlayer = CMP_LAYER; masque_otherlayer = CMP_LAYER;
for( Pad = Module->m_Pads; Pad != NULL; Pad = (D_PAD*) Pad->Pnext ) for( Pad = Module->m_Pads; Pad != NULL; Pad = (D_PAD*) Pad->Pnext )
@ -823,7 +823,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
int error, Penalite, marge, side, otherside; int error, Penalite, marge, side, otherside;
side = TOP; otherside = BOTTOM; side = TOP; otherside = BOTTOM;
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
{ {
side = BOTTOM; otherside = TOP; side = BOTTOM; otherside = TOP;
} }
@ -1064,7 +1064,7 @@ static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int u
if( trace & 2 ) if( trace & 2 )
{ {
data = GetDist( row, col, TOP ); data = GetDist( row, col, TOP );
data = max( data, LocalPenalite ); data = MAX( data, LocalPenalite );
SetDist( row, col, TOP, data ); SetDist( row, col, TOP, data );
} }
} }
@ -1193,7 +1193,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
{ {
int rayon, cx, cy, d; int rayon, cx, cy, d;
int xmax, ymax; int xmax, ymax;
EDA_BaseStruct* PtStruct; BOARD_ITEM* PtStruct;
DRAWSEGMENT* ptr; DRAWSEGMENT* ptr;
bool succes = FALSE; bool succes = FALSE;
@ -1205,7 +1205,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
/* Analyse des Contours PCB */ /* Analyse des Contours PCB */
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue; continue;
@ -1217,21 +1217,21 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
cx = ptr->m_Start.x; cy = ptr->m_Start.y; cx = ptr->m_Start.x; cy = ptr->m_Start.y;
rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) ); rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) );
rayon += d; rayon += d;
m_Pcb->m_BoundaryBox.m_Pos.x = min( m_Pcb->m_BoundaryBox.m_Pos.x, cx - rayon ); m_Pcb->m_BoundaryBox.m_Pos.x = MIN( m_Pcb->m_BoundaryBox.m_Pos.x, cx - rayon );
m_Pcb->m_BoundaryBox.m_Pos.y = min( m_Pcb->m_BoundaryBox.m_Pos.y, cy - rayon ); m_Pcb->m_BoundaryBox.m_Pos.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
else else
{ {
cx = min( ptr->m_Start.x, ptr->m_End.x ); cx = MIN( ptr->m_Start.x, ptr->m_End.x );
cy = min( ptr->m_Start.y, ptr->m_End.y ); cy = MIN( ptr->m_Start.y, ptr->m_End.y );
m_Pcb->m_BoundaryBox.m_Pos.x = min( m_Pcb->m_BoundaryBox.m_Pos.x, cx - d ); m_Pcb->m_BoundaryBox.m_Pos.x = MIN( m_Pcb->m_BoundaryBox.m_Pos.x, cx - d );
m_Pcb->m_BoundaryBox.m_Pos.y = min( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d ); m_Pcb->m_BoundaryBox.m_Pos.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d );
cx = max( ptr->m_Start.x, ptr->m_End.x ); cx = MAX( ptr->m_Start.x, ptr->m_End.x );
cy = max( ptr->m_Start.y, ptr->m_End.y ); cy = MAX( ptr->m_Start.y, ptr->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
} }
} }

View File

@ -430,7 +430,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
* routine d'effacement du block deja selectionne * routine d'effacement du block deja selectionne
*/ */
{ {
EDA_BaseStruct* PtStruct, * NextS; BOARD_ITEM* PtStruct, * NextS;
int masque_layer; int masque_layer;
if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) ) if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) )
@ -448,7 +448,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
module = m_Pcb->m_Modules; module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) NextS ) for( ; module != NULL; module = (MODULE*) NextS )
{ {
NextS = module->Pnext; NextS = module->Next();
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL ) if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
continue; continue;
/* le module est ici bon a etre efface */ /* le module est ici bon a etre efface */
@ -467,9 +467,10 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
Affiche_Message( _( "Delete tracks" ) ); Affiche_Message( _( "Delete tracks" ) );
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) NextS ) for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) NextS )
{ {
NextS = pt_segm->Pnext; NextS = pt_segm->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
{ /* la piste est ici bonne a etre efface */ {
/* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->Draw( DrawPanel, DC, GR_XOR );
DeleteStructure( pt_segm ); DeleteStructure( pt_segm );
} }
@ -487,14 +488,14 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = NextS ) for( ; PtStruct != NULL; PtStruct = NextS )
{ {
NextS = PtStruct->Pnext; NextS = PtStruct->Next();
switch( PtStruct->m_StructType ) switch( PtStruct->m_StructType )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct ) #define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -517,7 +518,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case TYPEMIRE: case TYPEMIRE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct ) #define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -529,7 +530,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case TYPECOTATION: case TYPECOTATION:
#undef STRUCT #undef STRUCT
#define STRUCT ( (COTATION*) PtStruct ) #define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -551,7 +552,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
Affiche_Message( _( "Delete zones" ) ); Affiche_Message( _( "Delete zones" ) );
for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = (TRACK*) NextS ) for( pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = (TRACK*) NextS )
{ {
NextS = pt_segm->Pnext; NextS = pt_segm->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, pt_segm ) )
{ /* la piste est ici bonne a etre efface */ { /* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR ); pt_segm->Draw( DrawPanel, DC, GR_XOR );
@ -682,7 +683,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct ) #define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -715,7 +716,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
case TYPEMIRE: case TYPEMIRE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct ) #define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -728,7 +729,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
case TYPECOTATION: case TYPECOTATION:
#undef STRUCT #undef STRUCT
#define STRUCT ( (COTATION*) PtStruct ) #define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -852,7 +853,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
INVERT( track->m_End.y ); INVERT( track->m_End.y );
if( track->m_StructType != TYPEVIA ) if( track->m_StructType != TYPEVIA )
{ {
track->m_Layer = ChangeSideNumLayer( track->m_Layer ); track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
} }
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
@ -875,7 +876,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
track->Draw( DrawPanel, DC, GR_XOR ); // effacement track->Draw( DrawPanel, DC, GR_XOR ); // effacement
INVERT( track->m_Start.y ); INVERT( track->m_Start.y );
INVERT( track->m_End.y ); INVERT( track->m_End.y );
track->m_Layer = ChangeSideNumLayer( track->m_Layer ); track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
} }
track = (TRACK*) track->Pnext; track = (TRACK*) track->Pnext;
@ -897,7 +898,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct ) #define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -909,7 +910,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
} }
INVERT( STRUCT->m_Start.y ); INVERT( STRUCT->m_Start.y );
INVERT( STRUCT->m_End.y ); INVERT( STRUCT->m_End.y );
STRUCT->m_Layer = ChangeSideNumLayer( STRUCT->m_Layer ); STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_OR ); Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_OR );
break; break;
@ -925,11 +926,11 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
/* Redessin du Texte */ /* Redessin du Texte */
INVERT( STRUCT->m_Pos.y ); INVERT( STRUCT->m_Pos.y );
INVERT_ANGLE( STRUCT->m_Orient ); INVERT_ANGLE( STRUCT->m_Orient );
if( (STRUCT->m_Layer == CUIVRE_N) || (STRUCT->m_Layer == CMP_N) ) if( (STRUCT->GetLayer() == CUIVRE_N) || (STRUCT->GetLayer() == CMP_N) )
{ {
STRUCT->m_Miroir ^= 1; /* inverse miroir */ STRUCT->m_Miroir ^= 1; /* inverse miroir */
} }
STRUCT->m_Layer = ChangeSideNumLayer( STRUCT->m_Layer ); STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
STRUCT->CreateDrawData(); STRUCT->CreateDrawData();
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); ( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
break; break;
@ -937,21 +938,21 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
case TYPEMIRE: case TYPEMIRE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct ) #define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
/* l'element est ici bon a etre modifie */ /* l'element est ici bon a etre modifie */
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); ( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
INVERT( STRUCT->m_Pos.y ); INVERT( STRUCT->m_Pos.y );
STRUCT->m_Layer = ChangeSideNumLayer( STRUCT->m_Layer ); STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); ( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
break; break;
case TYPECOTATION: case TYPECOTATION:
#undef STRUCT #undef STRUCT
#define STRUCT ( (COTATION*) PtStruct ) #define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -982,7 +983,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
INVERT( STRUCT->FlecheD2_oy ); INVERT( STRUCT->FlecheD2_oy );
INVERT( STRUCT->FlecheD2_fy ); INVERT( STRUCT->FlecheD2_fy );
STRUCT->m_Layer = ChangeSideNumLayer( STRUCT->m_Layer ); STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); ( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
break; break;
@ -1111,7 +1112,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct ) #define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -1139,7 +1140,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
case TYPEMIRE: case TYPEMIRE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct ) #define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -1152,7 +1153,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
case TYPECOTATION: case TYPECOTATION:
#undef STRUCT #undef STRUCT
#define STRUCT ( (COTATION*) PtStruct ) #define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -1315,7 +1316,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct ) #define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -1357,7 +1358,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct ) #define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;
@ -1377,7 +1378,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (COTATION*) PtStruct ) #define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 ) if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break; break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL ) if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break; break;

View File

@ -395,8 +395,8 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
/* Copy marked items, at new position = old position + offset /* Copy marked items, at new position = old position + offset
*/ */
{ {
EDA_BaseStruct* item; BOARD_ITEM* item;
EDA_BaseStruct* NewStruct; BOARD_ITEM* NewStruct;
if( module == NULL ) if( module == NULL )
return; return;

View File

@ -186,7 +186,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
TRACK* pt_segm; TRACK* pt_segm;
TEXTE_PCB* PtText; TEXTE_PCB* PtText;
DRAWSEGMENT* DrawSegm; DRAWSEGMENT* DrawSegm;
EDA_BaseStruct* PtStruct; BOARD_ITEM* PtStruct;
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 masque_layer;
@ -211,19 +211,19 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
// Placement des elements de modules sur PCB // // Placement des elements de modules sur PCB //
/////////////////////////////////////////////// ///////////////////////////////////////////////
PtStruct = Pcb->m_Modules; PtStruct = Pcb->m_Modules;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
EDA_BaseStruct* PtModStruct = ( (MODULE*) PtStruct )->m_Drawings; BOARD_ITEM* PtModStruct = ( (MODULE*) PtStruct )->m_Drawings;
for( ; PtModStruct != NULL; PtModStruct = PtModStruct->Pnext ) for( ; PtModStruct != NULL; PtModStruct = PtModStruct->Next() )
{ {
switch( PtModStruct->m_StructType ) switch( PtModStruct->m_StructType )
{ {
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
{ {
TRACK* TmpSegm = new TRACK( NULL ); TRACK* TmpSegm = new TRACK( NULL );
TmpSegm->m_Layer = ( (EDGE_MODULE*) PtModStruct )->m_Layer; TmpSegm->SetLayer( ( (EDGE_MODULE*) PtModStruct )->GetLayer() );
if( TmpSegm->m_Layer == EDGE_N ) if( TmpSegm->GetLayer() == EDGE_N )
TmpSegm->m_Layer = -1; TmpSegm->SetLayer( -1 );
TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start; TmpSegm->m_Start = ( (EDGE_MODULE*) PtModStruct )->m_Start;
TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End; TmpSegm->m_End = ( (EDGE_MODULE*) PtModStruct )->m_End;
@ -249,7 +249,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
// Placement des contours et segments PCB // // Placement des contours et segments PCB //
//////////////////////////////////////////// ////////////////////////////////////////////
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->m_StructType ) switch( PtStruct->m_StructType )
{ {
@ -258,10 +258,10 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
int type_cell = HOLE; int type_cell = HOLE;
TRACK* TmpSegm = new TRACK( NULL ); TRACK* TmpSegm = new TRACK( NULL );
DrawSegm = (DRAWSEGMENT*) PtStruct; DrawSegm = (DRAWSEGMENT*) PtStruct;
TmpSegm->m_Layer = DrawSegm->m_Layer; TmpSegm->SetLayer( DrawSegm->GetLayer() );
if( DrawSegm->m_Layer == EDGE_N ) if( DrawSegm->GetLayer() == EDGE_N )
{ {
TmpSegm->m_Layer = -1; TmpSegm->SetLayer( -1 );
type_cell |= CELL_is_EDGE; type_cell |= CELL_is_EDGE;
} }
@ -293,7 +293,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag )
ux1 = ux0 + dx; uy1 = uy0 + dy; ux1 = ux0 + dx; uy1 = uy0 + dy;
ux0 -= dx; uy0 -= dy; ux0 -= dx; uy0 -= dy;
masque_layer = g_TabOneLayerMask[PtText->m_Layer]; masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
TraceFilledRectangle( Pcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge, TraceFilledRectangle( Pcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge,
(int) (PtText->m_Orient), (int) (PtText->m_Orient),

View File

@ -15,7 +15,7 @@
/* Constructor */ /* Constructor */
BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
EDA_BaseStruct( parent, TYPEPCB ) BOARD_ITEM( (BOARD_ITEM*) parent, TYPEPCB )
{ {
m_PcbFrame = frame; m_PcbFrame = frame;
m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule
@ -24,7 +24,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_NbPads = 0; // nombre total de pads m_NbPads = 0; // nombre total de pads
m_NbNodes = 0; // nombre de pads connectes m_NbNodes = 0; // nombre de pads connectes
m_NbLinks = 0; // nombre de chevelus (donc aussi nombre m_NbLinks = 0; // nombre de chevelus (donc aussi nombre
// minimal de pistes a tracer // minimal de pistes a tracer
m_NbSegmTrack = 0; // nombre d'elements de type segments de piste m_NbSegmTrack = 0; // nombre d'elements de type segments de piste
m_NbSegmZone = 0; // nombre d'elements de type segments de zone m_NbSegmZone = 0; // nombre d'elements de type segments de zone
m_NbNoconnect = 0; // nombre de chevelus actifs m_NbNoconnect = 0; // nombre de chevelus actifs
@ -39,7 +39,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Ratsnest = NULL; // pointeur liste rats m_Ratsnest = NULL; // pointeur liste rats
m_LocalRatsnest = NULL; // pointeur liste rats local m_LocalRatsnest = NULL; // pointeur liste rats local
m_CurrentLimitZone = NULL; // pointeur liste des EDEGE_ZONES m_CurrentLimitZone = NULL; // pointeur liste des EDEGE_ZONES
// de determination des contours de zone // de determination des contours de zone
} }
@ -160,22 +160,22 @@ bool BOARD::ComputeBoundaryBox( void )
cx = ptr->m_Start.x; cy = ptr->m_Start.y; cx = ptr->m_Start.x; cy = ptr->m_Start.y;
rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) ); rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) );
rayon += d; rayon += d;
xmin = min( xmin, cx - rayon ); xmin = MIN( xmin, cx - rayon );
ymin = min( ymin, cy - rayon ); ymin = MIN( ymin, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
Has_Items = TRUE; Has_Items = TRUE;
} }
else else
{ {
cx = min( ptr->m_Start.x, ptr->m_End.x ); cx = MIN( ptr->m_Start.x, ptr->m_End.x );
cy = min( ptr->m_Start.y, ptr->m_End.y ); cy = MIN( ptr->m_Start.y, ptr->m_End.y );
xmin = min( xmin, cx - d ); xmin = MIN( xmin, cx - d );
ymin = min( ymin, cy - d ); ymin = MIN( ymin, cy - d );
cx = max( ptr->m_Start.x, ptr->m_End.x ); cx = MAX( ptr->m_Start.x, ptr->m_End.x );
cy = max( ptr->m_Start.y, ptr->m_End.y ); cy = MAX( ptr->m_Start.y, ptr->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
Has_Items = TRUE; Has_Items = TRUE;
} }
} }
@ -185,19 +185,19 @@ bool BOARD::ComputeBoundaryBox( void )
for( ; module != NULL; module = (MODULE*) module->Pnext ) for( ; module != NULL; module = (MODULE*) module->Pnext )
{ {
Has_Items = TRUE; Has_Items = TRUE;
xmin = min( xmin, ( module->m_Pos.x + module->m_BoundaryBox.GetX() ) ); xmin = MIN( xmin, ( module->m_Pos.x + module->m_BoundaryBox.GetX() ) );
ymin = min( ymin, ( module->m_Pos.y + module->m_BoundaryBox.GetY() ) ); ymin = MIN( ymin, ( module->m_Pos.y + module->m_BoundaryBox.GetY() ) );
xmax = max( xmax, module->m_Pos.x + module->m_BoundaryBox.GetRight() ); xmax = MAX( xmax, module->m_Pos.x + module->m_BoundaryBox.GetRight() );
ymax = max( ymax, module->m_Pos.y + module->m_BoundaryBox.GetBottom() ); ymax = MAX( ymax, module->m_Pos.y + module->m_BoundaryBox.GetBottom() );
D_PAD* pt_pad = module->m_Pads; D_PAD* pt_pad = module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{ {
d = pt_pad->m_Rayon; d = pt_pad->m_Rayon;
xmin = min( xmin, pt_pad->m_Pos.x - d ); xmin = MIN( xmin, pt_pad->m_Pos.x - d );
ymin = min( ymin, pt_pad->m_Pos.y - d ); ymin = MIN( ymin, pt_pad->m_Pos.y - d );
xmax = max( xmax, pt_pad->m_Pos.x + d ); xmax = MAX( xmax, pt_pad->m_Pos.x + d );
ymax = max( ymax, pt_pad->m_Pos.y + d ); ymax = MAX( ymax, pt_pad->m_Pos.y + d );
} }
} }
@ -205,28 +205,28 @@ bool BOARD::ComputeBoundaryBox( void )
for( Track = m_Track; Track != NULL; Track = (TRACK*) Track->Pnext ) for( Track = m_Track; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
d = (Track->m_Width / 2) + 1; d = (Track->m_Width / 2) + 1;
cx = min( Track->m_Start.x, Track->m_End.x ); cx = MIN( Track->m_Start.x, Track->m_End.x );
cy = min( Track->m_Start.y, Track->m_End.y ); cy = MIN( Track->m_Start.y, Track->m_End.y );
xmin = min( xmin, cx - d ); xmin = MIN( xmin, cx - d );
ymin = min( ymin, cy - d ); ymin = MIN( ymin, cy - d );
cx = max( Track->m_Start.x, Track->m_End.x ); cx = MAX( Track->m_Start.x, Track->m_End.x );
cy = max( Track->m_Start.y, Track->m_End.y ); cy = MAX( Track->m_Start.y, Track->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
Has_Items = TRUE; Has_Items = TRUE;
} }
for( Track = m_Zone; Track != NULL; Track = (TRACK*) Track->Pnext ) for( Track = m_Zone; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
d = (Track->m_Width / 2) + 1; d = (Track->m_Width / 2) + 1;
cx = min( Track->m_Start.x, Track->m_End.x ); cx = MIN( Track->m_Start.x, Track->m_End.x );
cy = min( Track->m_Start.y, Track->m_End.y ); cy = MIN( Track->m_Start.y, Track->m_End.y );
xmin = min( xmin, cx - d ); xmin = MIN( xmin, cx - d );
ymin = min( ymin, cy - d ); ymin = MIN( ymin, cy - d );
cx = max( Track->m_Start.x, Track->m_End.x ); cx = MAX( Track->m_Start.x, Track->m_End.x );
cy = max( Track->m_Start.y, Track->m_End.y ); cy = MAX( Track->m_Start.y, Track->m_End.y );
xmax = max( xmax, cx + d ); xmax = MAX( xmax, cx + d );
ymax = max( ymax, cy + d ); ymax = MAX( ymax, cy + d );
Has_Items = TRUE; Has_Items = TRUE;
} }
@ -378,7 +378,7 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
class PadOrModule : public INSPECTOR class PadOrModule : public INSPECTOR
{ {
public: public:
EDA_BaseStruct* found; BOARD_ITEM* found;
int layer; int layer;
int layer_mask; int layer_mask;
@ -388,46 +388,47 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData ) SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
{ {
const wxPoint& refPos = *(const wxPoint*) testData; BOARD_ITEM* item = (BOARD_ITEM*) testItem;
const wxPoint& refPos = *(const wxPoint*) testData;
if( testItem->m_StructType == TYPEPAD ) if( item->m_StructType == TYPEPAD )
{ {
D_PAD* pad = (D_PAD*) testItem; D_PAD* pad = (D_PAD*) item;
if( pad->HitTest( refPos ) ) if( pad->HitTest( refPos ) )
{ {
if( layer_mask & pad->m_Masque_Layer ) if( layer_mask & pad->m_Masque_Layer )
{ {
found = testItem; found = item;
return SEARCH_QUIT; return SEARCH_QUIT;
} }
else if( !found ) else if( !found )
{ {
MODULE* parent = (MODULE*) pad->m_Parent; MODULE* parent = (MODULE*) pad->m_Parent;
if( IsModuleLayerVisible( parent->m_Layer ) ) if( IsModuleLayerVisible( parent->GetLayer() ) )
found = testItem; found = item;
} }
} }
} }
else if( testItem->m_StructType == TYPEMODULE ) else if( item->m_StructType == TYPEMODULE )
{ {
MODULE* module = (MODULE*) testItem; MODULE* module = (MODULE*) item;
// consider only visible modules // consider only visible modules
if( IsModuleLayerVisible( module->m_Layer ) ) if( IsModuleLayerVisible( module->GetLayer() ) )
{ {
if( module->HitTest( refPos ) ) if( module->HitTest( refPos ) )
{ {
if( layer == module->m_Layer ) if( layer == module->GetLayer() )
{ {
found = testItem; found = item;
return SEARCH_QUIT; return SEARCH_QUIT;
} }
// layer mismatch, save in case we don't find a // layer mismatch, save in case we don't find a
// future layer match hit. // future layer match hit.
if( !found ) if( !found )
found = testItem; found = item;
} }
} }
} }

View File

@ -11,8 +11,8 @@
#include "wxstruct.h" #include "wxstruct.h"
COTATION::COTATION( EDA_BaseStruct* StructFather ) : COTATION::COTATION( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, TYPECOTATION ) BOARD_ITEM( StructFather, TYPECOTATION )
{ {
m_Layer = DRAW_LAYER; m_Layer = DRAW_LAYER;
m_Width = 50; m_Width = 50;
@ -24,7 +24,7 @@ COTATION::COTATION( EDA_BaseStruct* StructFather ) :
/* Effacement memoire de la structure */ /* Effacement memoire de la structure */
COTATION::~COTATION( void ) COTATION::~COTATION()
{ {
delete m_Text; delete m_Text;
} }
@ -44,7 +44,7 @@ void COTATION::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
@ -68,7 +68,7 @@ void COTATION::Copy( COTATION* source )
/*************************************/ /*************************************/
{ {
m_Value = source->m_Value; m_Value = source->m_Value;
m_Layer = source->m_Layer; SetLayer( source->GetLayer() );
m_Width = source->m_Width; m_Width = source->m_Width;
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
@ -112,15 +112,18 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
if( Line[0] == 'G' ) if( Line[0] == 'G' )
{ {
sscanf( Line + 2, " %d %d %lX", &m_Shape, &m_Layer, &m_TimeStamp ); int layer;
sscanf( Line + 2, " %d %d %lX", &m_Shape, &layer, &m_TimeStamp );
/* Mise a jour des param .layer des sous structures */ /* Mise a jour des param .layer des sous structures */
if( m_Layer < FIRST_NO_COPPER_LAYER ) if( layer < FIRST_NO_COPPER_LAYER )
m_Layer = FIRST_NO_COPPER_LAYER; layer = FIRST_NO_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER ) if( layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER; layer = LAST_NO_COPPER_LAYER;
m_Text->m_Layer = m_Layer; SetLayer( layer );
m_Text->SetLayer( layer );
continue; continue;
} }

View File

@ -6,7 +6,7 @@
#include "base_struct.h" #include "base_struct.h"
class COTATION : public EDA_BaseStruct class COTATION : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;
@ -25,8 +25,8 @@ public:
int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy; int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy;
public: public:
COTATION( EDA_BaseStruct* StructFather ); COTATION( BOARD_ITEM* StructFather );
~COTATION( void ); ~COTATION();
bool ReadCotationDescr( FILE* File, int* LineNum ); bool ReadCotationDescr( FILE* File, int* LineNum );
bool WriteCotationDescr( FILE* File ); bool WriteCotationDescr( FILE* File );

View File

@ -29,7 +29,7 @@
/******************************************/ /******************************************/
EDGE_MODULE::EDGE_MODULE( MODULE* parent ) : EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
EDA_BaseLineStruct( parent, TYPEEDGEMODULE ) BOARD_ITEM( parent, TYPEEDGEMODULE )
{ {
m_Shape = S_SEGMENT; m_Shape = S_SEGMENT;
m_Angle = 0; m_Angle = 0;
@ -91,7 +91,7 @@ void EDGE_MODULE::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (MODULE*) Pback )->m_Drawings = Pnext; ( (MODULE*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
@ -287,10 +287,10 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN ); Affiche_1_Parametre( frame, 24, _( "TimeStamp" ), bufcar, BROWN );
Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( module->m_Layer ), RED ); Affiche_1_Parametre( frame, 34, _( "Mod Layer" ), ReturnPcbLayerName( module->GetLayer() ), RED );
Affiche_1_Parametre( frame, 44, _( "Seg Layer" ), Affiche_1_Parametre( frame, 44, _( "Seg Layer" ),
ReturnPcbLayerName( module->m_Layer ), RED ); ReturnPcbLayerName( module->GetLayer() ), RED );
valeur_param( m_Width, bufcar ); valeur_param( m_Width, bufcar );
Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE ); Affiche_1_Parametre( frame, 54, _( "Width" ), bufcar, BLUE );

View File

@ -7,9 +7,13 @@ class Pcb3D_GLCanvas;
/* description des contours (empreintes ) et TYPES des CONTOURS : */ /* description des contours (empreintes ) et TYPES des CONTOURS : */
class EDGE_MODULE : public EDA_BaseLineStruct class EDGE_MODULE : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // voir "enum Track_Shapes" int m_Shape; // voir "enum Track_Shapes"
wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0) wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0)
wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0) wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0)

View File

@ -22,8 +22,8 @@
/*********************************************************/ /*********************************************************/
/* Constructeur de la classe EQUIPOT */ /* Constructeur de la classe EQUIPOT */
EQUIPOT::EQUIPOT( EDA_BaseStruct* StructFather ) : EQUIPOT::EQUIPOT( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, PCB_EQUIPOT_STRUCT_TYPE ) BOARD_ITEM( StructFather, PCB_EQUIPOT_STRUCT_TYPE )
{ {
m_NetCode = 0; m_NetCode = 0;
m_NbNodes = m_NbLink = m_NbNoconn = 0; m_NbNodes = m_NbLink = m_NbNoconn = 0;
@ -39,7 +39,7 @@ EQUIPOT::EQUIPOT( EDA_BaseStruct* StructFather ) :
/* destructeut */ /* destructeut */
EQUIPOT::~EQUIPOT( void ) EQUIPOT::~EQUIPOT()
{ {
} }

View File

@ -5,7 +5,7 @@
/* Representation des descriptions des equipotentielles */ /* Representation des descriptions des equipotentielles */
class EQUIPOT : public EDA_BaseStruct class EQUIPOT : public BOARD_ITEM
{ {
public: public:
wxString m_Netname; // nom du net wxString m_Netname; // nom du net
@ -22,8 +22,8 @@ public:
CHEVELU* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net CHEVELU* m_RatsnestStart; // pointeur sur debut de liste ratsnests du net
CHEVELU* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net CHEVELU* m_RatsnestEnd; // pointeur sur fin de liste ratsnests du net
EQUIPOT( EDA_BaseStruct* StructFather ); EQUIPOT( BOARD_ITEM* StructFather );
~EQUIPOT( void ); ~EQUIPOT();
/* Effacement memoire de la structure */ /* Effacement memoire de la structure */
void UnLink( void ); void UnLink( void );

View File

@ -9,15 +9,15 @@
#include "pcbnew.h" #include "pcbnew.h"
MIREPCB::MIREPCB( EDA_BaseStruct* StructFather ) : MIREPCB::MIREPCB( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, TYPEMIRE ) BOARD_ITEM( StructFather, TYPEMIRE )
{ {
m_Shape = 0; m_Shape = 0;
m_Size = 5000; m_Size = 5000;
} }
MIREPCB::~MIREPCB( void ) MIREPCB::~MIREPCB()
{ {
} }
@ -39,7 +39,7 @@ void MIREPCB::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }

View File

@ -7,7 +7,7 @@
#include "base_struct.h" #include "base_struct.h"
class MIREPCB : public EDA_BaseStruct class MIREPCB : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;
@ -16,8 +16,8 @@ public:
int m_Size; int m_Size;
public: public:
MIREPCB( EDA_BaseStruct* StructFather ); MIREPCB( BOARD_ITEM* StructFather );
~MIREPCB( void ); ~MIREPCB();
bool WriteMirePcbDescr( FILE* File ); bool WriteMirePcbDescr( FILE* File );
bool ReadMirePcbDescr( FILE* File, int* LineNum ); bool ReadMirePcbDescr( FILE* File, int* LineNum );

View File

@ -58,7 +58,8 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
/*************************************************/ /*************************************************/
/* Constructeur de la classe MODULE */ /* Constructeur de la classe MODULE */
MODULE::MODULE( BOARD* parent ) : EDA_BaseStruct( parent, TYPEMODULE ) MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM( parent, TYPEMODULE )
{ {
m_Pads = NULL; m_Pads = NULL;
m_Drawings = NULL; m_Drawings = NULL;
@ -168,9 +169,9 @@ void MODULE::Copy( MODULE* Module )
} }
/* Copy des structures auxiliaires: Drawings */ /* Copy des structures auxiliaires: Drawings */
EDA_BaseStruct* OldStruct = (EDA_BaseStruct*) Module->m_Drawings; BOARD_ITEM* OldStruct = Module->m_Drawings;
EDA_BaseStruct* NewStruct, * LastStruct = NULL; BOARD_ITEM* NewStruct, * LastStruct = NULL;
for( ; OldStruct; OldStruct = OldStruct->Pnext ) for( ; OldStruct; OldStruct = OldStruct->Next() )
{ {
NewStruct = NULL; NewStruct = NULL;
@ -423,7 +424,7 @@ int MODULE::WriteDescr( FILE* File )
m_Reference->m_Size.y, m_Reference->m_Size.x, m_Reference->m_Size.y, m_Reference->m_Size.x,
m_Reference->m_Orient + m_Orient, m_Reference->m_Width, m_Reference->m_Orient + m_Orient, m_Reference->m_Width,
m_Reference->m_Miroir ? 'N' : 'M', m_Reference->m_NoShow ? 'I' : 'V', m_Reference->m_Miroir ? 'N' : 'M', m_Reference->m_NoShow ? 'I' : 'V',
m_Reference->m_Layer, m_Reference->GetLayer(),
CONV_TO_UTF8( m_Reference->m_Text ) ); CONV_TO_UTF8( m_Reference->m_Text ) );
NbLigne++; NbLigne++;
@ -434,7 +435,7 @@ int MODULE::WriteDescr( FILE* File )
m_Value->m_Size.y, m_Value->m_Size.x, m_Value->m_Size.y, m_Value->m_Size.x,
m_Value->m_Orient + m_Orient, m_Value->m_Width, m_Value->m_Orient + m_Orient, m_Value->m_Width,
m_Value->m_Miroir ? 'N' : 'M', m_Value->m_NoShow ? 'I' : 'V', m_Value->m_Miroir ? 'N' : 'M', m_Value->m_NoShow ? 'I' : 'V',
m_Value->m_Layer, m_Value->GetLayer(),
CONV_TO_UTF8( m_Value->m_Text ) ); CONV_TO_UTF8( m_Value->m_Text ) );
NbLigne++; NbLigne++;
@ -453,7 +454,7 @@ int MODULE::WriteDescr( FILE* File )
PtText->m_Orient + m_Orient, PtText->m_Width, PtText->m_Orient + m_Orient, PtText->m_Width,
PtText->m_Miroir ? 'N' : 'M', PtText->m_Miroir ? 'N' : 'M',
PtText->m_NoShow ? 'I' : 'V', PtText->m_NoShow ? 'I' : 'V',
PtText->m_Layer, CONV_TO_UTF8( PtText->m_Text ) ); PtText->GetLayer(), CONV_TO_UTF8( PtText->m_Text ) );
NbLigne++; NbLigne++;
break; break;
@ -720,22 +721,23 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
if( LastModStruct == NULL ) if( LastModStruct == NULL )
{ {
DrawText->Pback = this; DrawText->Pback = this;
m_Drawings = (EDA_BaseStruct*) DrawText; m_Drawings = DrawText;
} }
else else
{ {
DrawText->Pback = LastModStruct; DrawText->Pback = LastModStruct;
LastModStruct->Pnext = DrawText; LastModStruct->Pnext = DrawText;
} }
LastModStruct = (EDA_BaseStruct*) DrawText; LastModStruct = DrawText;
} }
int layer;
sscanf( Line + 1, "%d %d %d %d %d %d %d %s %s %d", sscanf( Line + 1, "%d %d %d %d %d %d %d %s %s %d",
&itmp1, &itmp1,
&DrawText->m_Pos0.x, &DrawText->m_Pos0.y, &DrawText->m_Pos0.x, &DrawText->m_Pos0.y,
&DrawText->m_Size.y, &DrawText->m_Size.x, &DrawText->m_Size.y, &DrawText->m_Size.x,
&DrawText->m_Orient, &DrawText->m_Width, &DrawText->m_Orient, &DrawText->m_Width,
BufCar1, BufCar2, &DrawText->m_Layer ); BufCar1, BufCar2, &layer );
DrawText->m_Type = itmp1; DrawText->m_Type = itmp1;
DrawText->m_Orient -= m_Orient; // m_Orient texte relative au module DrawText->m_Orient -= m_Orient; // m_Orient texte relative au module
@ -748,11 +750,13 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
else else
DrawText->m_NoShow = 0; DrawText->m_NoShow = 0;
if( m_Layer == CUIVRE_N ) if( layer == CUIVRE_N )
DrawText->m_Layer = SILKSCREEN_N_CU; layer = SILKSCREEN_N_CU;
if( m_Layer == CMP_N ) else if( layer == CMP_N )
DrawText->m_Layer = SILKSCREEN_N_CMP; layer = SILKSCREEN_N_CMP;
DrawText->SetLayer( layer );
/* calcul de la position vraie */ /* calcul de la position vraie */
DrawText->SetDrawCoord(); DrawText->SetDrawCoord();
/* Lecture de la chaine "text" */ /* Lecture de la chaine "text" */
@ -961,22 +965,22 @@ void MODULE::Set_Rectangle_Encadrement( void )
uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y; uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y;
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) ); rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
rayon += width; rayon += width;
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, cx - rayon ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, cx - rayon );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, cy - rayon ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
break; break;
} }
default: default:
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_Start0.x - width ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_Start0.x - width );
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_End0.x - width ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, pt_edge_mod->m_End0.x - width );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_Start0.y - width ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_Start0.y - width );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_End0.y - width ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, pt_edge_mod->m_End0.y - width );
xmax = max( xmax, pt_edge_mod->m_Start0.x + width ); xmax = MAX( xmax, pt_edge_mod->m_Start0.x + width );
xmax = max( xmax, pt_edge_mod->m_End0.x + width ); xmax = MAX( xmax, pt_edge_mod->m_End0.x + width );
ymax = max( ymax, pt_edge_mod->m_Start0.y + width ); ymax = MAX( ymax, pt_edge_mod->m_Start0.y + width );
ymax = max( ymax, pt_edge_mod->m_End0.y + width ); ymax = MAX( ymax, pt_edge_mod->m_End0.y + width );
break; break;
} }
} }
@ -986,10 +990,10 @@ void MODULE::Set_Rectangle_Encadrement( void )
{ {
rayon = pad->m_Rayon; rayon = pad->m_Rayon;
cx = pad->m_Pos0.x; cy = pad->m_Pos0.y; cx = pad->m_Pos0.x; cy = pad->m_Pos0.y;
m_BoundaryBox.m_Pos.x = min( m_BoundaryBox.m_Pos.x, cx - rayon ); m_BoundaryBox.m_Pos.x = MIN( m_BoundaryBox.m_Pos.x, cx - rayon );
m_BoundaryBox.m_Pos.y = min( m_BoundaryBox.m_Pos.y, cy - rayon ); m_BoundaryBox.m_Pos.y = MIN( m_BoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
m_BoundaryBox.SetWidth( xmax - m_BoundaryBox.m_Pos.x ); m_BoundaryBox.SetWidth( xmax - m_BoundaryBox.m_Pos.x );
@ -1035,22 +1039,22 @@ void MODULE::SetRectangleExinscrit( void )
uxf = EdgeMod->m_End.x; uyf = EdgeMod->m_End.y; uxf = EdgeMod->m_End.x; uyf = EdgeMod->m_End.y;
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) ); rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
rayon += width; rayon += width;
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, cx - rayon ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, cx - rayon );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, cy - rayon ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
break; break;
} }
default: default:
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_Start.x - width ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_Start.x - width );
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_End.x - width ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, EdgeMod->m_End.x - width );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_Start.y - width ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_Start.y - width );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_End.y - width ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, EdgeMod->m_End.y - width );
xmax = max( xmax, EdgeMod->m_Start.x + width ); xmax = MAX( xmax, EdgeMod->m_Start.x + width );
xmax = max( xmax, EdgeMod->m_End.x + width ); xmax = MAX( xmax, EdgeMod->m_End.x + width );
ymax = max( ymax, EdgeMod->m_Start.y + width ); ymax = MAX( ymax, EdgeMod->m_Start.y + width );
ymax = max( ymax, EdgeMod->m_End.y + width ); ymax = MAX( ymax, EdgeMod->m_End.y + width );
break; break;
} }
} }
@ -1060,10 +1064,10 @@ void MODULE::SetRectangleExinscrit( void )
{ {
rayon = Pad->m_Rayon; rayon = Pad->m_Rayon;
cx = Pad->m_Pos.x; cy = Pad->m_Pos.y; cx = Pad->m_Pos.x; cy = Pad->m_Pos.y;
m_RealBoundaryBox.m_Pos.x = min( m_RealBoundaryBox.m_Pos.x, cx - rayon ); m_RealBoundaryBox.m_Pos.x = MIN( m_RealBoundaryBox.m_Pos.x, cx - rayon );
m_RealBoundaryBox.m_Pos.y = min( m_RealBoundaryBox.m_Pos.y, cy - rayon ); m_RealBoundaryBox.m_Pos.y = MIN( m_RealBoundaryBox.m_Pos.y, cy - rayon );
xmax = max( xmax, cx + rayon ); xmax = MAX( xmax, cx + rayon );
ymax = max( ymax, cy + rayon ); ymax = MAX( ymax, cy + rayon );
} }
m_RealBoundaryBox.SetWidth( xmax - m_RealBoundaryBox.m_Pos.x ); m_RealBoundaryBox.SetWidth( xmax - m_RealBoundaryBox.m_Pos.x );

View File

@ -35,12 +35,12 @@ enum Mod_Attribut /* Attributs d'un module */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ #define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ #define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
class MODULE : public EDA_BaseStruct class MODULE : public BOARD_ITEM
{ {
public: public:
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
D_PAD* m_Pads; /* Pad list (linked list) */ D_PAD* m_Pads; /* Pad list (linked list) */
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */ BOARD_ITEM* m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/ Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..) TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..)
TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..) TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..)
@ -72,9 +72,9 @@ public:
MODULE( MODULE* module ); MODULE( MODULE* module );
~MODULE( void ); ~MODULE( void );
void Copy( MODULE* Module ); // Copy structure void Copy( MODULE* Module ); // Copy structure
MODULE* Next( void ) { return (MODULE*) Pnext; } MODULE* Next() { return (MODULE*) Pnext; }
void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement
* en coord locales (orient 0 et origine = pos module) */ * en coord locales (orient 0 et origine = pos module) */

View File

@ -25,7 +25,8 @@
/* classe D_PAD : constructeur */ /* classe D_PAD : constructeur */
/*******************************/ /*******************************/
D_PAD::D_PAD( MODULE* parent ) : EDA_BaseStruct( parent, TYPEPAD ) D_PAD::D_PAD( MODULE* parent ) :
BOARD_ITEM( parent, TYPEPAD )
{ {
m_NumPadName = 0; m_NumPadName = 0;
m_Masque_Layer = CUIVRE_LAYER; m_Masque_Layer = CUIVRE_LAYER;
@ -520,7 +521,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
/* Trace du symbole "No connect" ( / ou \ ou croix en X) si necessaire : */ /* Trace du symbole "No connect" ( / ou \ ou croix en X) si necessaire : */
if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn ) if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn )
{ {
dx0 = min( dx0, dy0 ); dx0 = MIN( dx0, dy0 );
int nc_color = BLUE; int nc_color = BLUE;
if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */ if( m_Masque_Layer & CMP_LAYER ) /* Trace forme \ */
GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0, GRLine( &panel->m_ClipBox, DC, cx0 - dx0, cy0 - dx0,
@ -535,7 +536,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int
if( !frame->m_DisplayPadNum ) if( !frame->m_DisplayPadNum )
return; return;
dx = min( m_Size.x, m_Size.y ); /* dx = text size */ dx = MIN( m_Size.x, m_Size.y ); /* dx = text size */
if( (dx / zoom) > 12 ) /* size must be enought to draw 2 chars */ if( (dx / zoom) > 12 ) /* size must be enought to draw 2 chars */
{ {
wxString buffer; wxString buffer;

View File

@ -20,7 +20,7 @@ class Pcb3D_GLCanvas;
#define PAD_STACK 0x80 // bit 7 de .attrib (flag) #define PAD_STACK 0x80 // bit 7 de .attrib (flag)
/* Definition type Structure d'un pad */ /* Definition type Structure d'un pad */
class D_PAD : public EDA_BaseStruct class D_PAD : public BOARD_ITEM
{ {
public: public:
union union

View File

@ -15,15 +15,15 @@
/* class TEXTE_PCB */ /* class TEXTE_PCB */
/*******************/ /*******************/
TEXTE_PCB::TEXTE_PCB( EDA_BaseStruct* parent ) : TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
EDA_BaseStruct( parent, TYPETEXTE ), BOARD_ITEM( parent, TYPETEXTE ),
EDA_TextStruct() EDA_TextStruct()
{ {
} }
/* Destructeur */ /* Destructeur */
TEXTE_PCB:: ~TEXTE_PCB( void ) TEXTE_PCB:: ~TEXTE_PCB()
{ {
} }
@ -59,7 +59,7 @@ void TEXTE_PCB::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }

View File

@ -6,25 +6,25 @@
#include "base_struct.h" #include "base_struct.h"
class TEXTE_PCB : public EDA_BaseStruct, public EDA_TextStruct class TEXTE_PCB : public BOARD_ITEM, public EDA_TextStruct
{ {
public: public:
TEXTE_PCB(EDA_BaseStruct * parent); TEXTE_PCB( BOARD_ITEM* parent );
TEXTE_PCB(TEXTE_PCB * textepcb); TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB(void); ~TEXTE_PCB();
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink( void ); void UnLink( void );
/* duplicate structure */ /* duplicate structure */
void Copy(TEXTE_PCB * source); void Copy( TEXTE_PCB* source );
void Draw(WinEDA_DrawPanel * panel, wxDC * DC, void Draw( WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int DrawMode); const wxPoint & offset, int DrawMode );
// File Operations: // File Operations:
int ReadTextePcbDescr(FILE * File, int * LineNum); int ReadTextePcbDescr( FILE* File, int* LineNum );
int WriteTextePcbDescr(FILE * File); int WriteTextePcbDescr( FILE* File );
/** /**

View File

@ -28,7 +28,7 @@
/* Constructeur de TEXTE_MODULE */ /* Constructeur de TEXTE_MODULE */
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
EDA_BaseStruct( parent, TYPETEXTEMODULE ) BOARD_ITEM( parent, TYPETEXTEMODULE )
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* Module = (MODULE*) m_Parent;
@ -41,18 +41,27 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
m_Orient = 0; /* en 1/10 degre */ m_Orient = 0; /* en 1/10 degre */
m_Miroir = 1; // Mode normal (pas de miroir) m_Miroir = 1; // Mode normal (pas de miroir)
m_Unused = 0; m_Unused = 0;
m_Layer = SILKSCREEN_N_CMP;
SetLayer( SILKSCREEN_N_CMP );
if( Module && (Module->m_StructType == TYPEMODULE) ) if( Module && (Module->m_StructType == TYPEMODULE) )
{ {
m_Pos = Module->m_Pos; m_Pos = Module->m_Pos;
m_Layer = Module->m_Layer;
if( Module->m_Layer == CUIVRE_N ) int moduleLayer = Module->GetLayer();
m_Layer = SILKSCREEN_N_CU;
if( Module->m_Layer == CMP_N ) if( moduleLayer == CUIVRE_N )
m_Layer = SILKSCREEN_N_CMP; SetLayer( SILKSCREEN_N_CU );
if( (Module->m_Layer == SILKSCREEN_N_CU) else if( moduleLayer == CMP_N )
|| (Module->m_Layer == ADHESIVE_N_CU) || (Module->m_Layer == CUIVRE_N) ) SetLayer( SILKSCREEN_N_CMP );
else
SetLayer( moduleLayer );
if( moduleLayer == SILKSCREEN_N_CU
|| moduleLayer == ADHESIVE_N_CU
|| moduleLayer == CUIVRE_N )
{
m_Miroir = 0; m_Miroir = 0;
}
} }
} }
@ -68,7 +77,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) // copy structure
return; return;
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Layer = source->m_Layer; SetLayer( source->GetLayer() );
m_Miroir = source->m_Miroir; // vue normale / miroir m_Miroir = source->m_Miroir; // vue normale / miroir
m_NoShow = source->m_NoShow; // 0: visible 1: invisible m_NoShow = source->m_NoShow; // 0: visible 1: invisible
@ -97,7 +106,7 @@ void TEXTE_MODULE::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (MODULE*) Pback )->m_Drawings = Pnext; ( (MODULE*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
@ -245,11 +254,12 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int
pos.x, pos.y + anchor_size, 0, g_AnchorColor ); pos.x, pos.y + anchor_size, 0, g_AnchorColor );
} }
color = g_DesignSettings.m_LayerColor[Module->m_Layer]; color = g_DesignSettings.m_LayerColor[Module->GetLayer()];
if( Module && Module->m_Layer == CUIVRE_N ) if( Module && Module->GetLayer() == CUIVRE_N )
color = g_ModuleTextCUColor; color = g_ModuleTextCUColor;
if( Module && Module->m_Layer == CMP_N )
else if( Module && Module->GetLayer() == CMP_N )
color = g_ModuleTextCMPColor; color = g_ModuleTextCMPColor;
if( (color & ITEM_NOT_SHOW) != 0 ) if( (color & ITEM_NOT_SHOW) != 0 )

View File

@ -13,7 +13,7 @@
#define TEXT_is_DIVERS 2 #define TEXT_is_DIVERS 2
class TEXTE_MODULE : public EDA_BaseStruct class TEXTE_MODULE : public BOARD_ITEM
{ {
public: public:
int m_Width; int m_Width;

View File

@ -22,8 +22,8 @@
/* Constructeur des classes type pistes, vias et zones */ /* Constructeur des classes type pistes, vias et zones */
TRACK::TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : TRACK::TRACK( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
EDA_BaseLineStruct( StructFather, idtype ) BOARD_ITEM( StructFather, idtype )
{ {
m_Shape = S_SEGMENT; m_Shape = S_SEGMENT;
start = end = NULL; start = end = NULL;
@ -35,13 +35,13 @@ TRACK::TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
SEGZONE::SEGZONE( EDA_BaseStruct* StructFather ) : SEGZONE::SEGZONE( BOARD_ITEM* StructFather ) :
TRACK( StructFather, TYPEZONE ) TRACK( StructFather, TYPEZONE )
{ {
} }
SEGVIA::SEGVIA( EDA_BaseStruct* StructFather ) : SEGVIA::SEGVIA( BOARD_ITEM* StructFather ) :
TRACK( StructFather, TYPEVIA ) TRACK( StructFather, TYPEVIA )
{ {
} }
@ -50,7 +50,7 @@ SEGVIA::SEGVIA( EDA_BaseStruct* StructFather ) :
/* Copy constructor */ /* Copy constructor */
TRACK::TRACK( const TRACK& Source ) : TRACK::TRACK( const TRACK& Source ) :
EDA_BaseLineStruct( Source.m_Parent, (DrawStructureType)Source.m_StructType ) BOARD_ITEM( (const BOARD_ITEM&) Source )
{ {
m_StructType = Source.m_StructType; m_StructType = Source.m_StructType;
m_Shape = Source.m_Shape; m_Shape = Source.m_Shape;
@ -235,14 +235,6 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer )
} }
/************************/
TRACK* TRACK::Next( void )
/************************/
{
return (TRACK*) Pnext;
}
/* supprime du chainage la structure Struct /* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement * les structures arrieres et avant sont chainees directement
*/ */

View File

@ -19,12 +19,19 @@
/***/ /***/
class TRACK : public EDA_BaseLineStruct class TRACK : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // vias: shape and type, Track = shape.. int m_Shape; // vias: shape and type, Track = shape..
int m_Drill; // for vias: via drill (- 1 for default value) int m_Drill; // for vias: via drill (- 1 for default value)
EDA_BaseStruct* start, * end; // pointers on a connected item (pad or track)
BOARD_ITEM* start; // pointers on a connected item (pad or track)
BOARD_ITEM* end;
int m_NetCode; // Net number int m_NetCode; // Net number
int m_Sous_Netcode; /* In rastnest routines : for the current net, int m_Sous_Netcode; /* In rastnest routines : for the current net,
* block number (number common to the current connected items found) */ * block number (number common to the current connected items found) */
@ -33,15 +40,12 @@ public:
int m_Param; // Auxiliary variable ( used in some computations ) int m_Param; // Auxiliary variable ( used in some computations )
public: public:
TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype = TYPETRACK ); TRACK( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPETRACK );
TRACK( const TRACK& track ); TRACK( const TRACK& track );
TRACK* Next( void ); // Retourne le chainage avant TRACK* Next() { return (TRACK*) Pnext; }
TRACK* Back( void ) // Retourne le chainage avant TRACK* Back() { return (TRACK*) Pback; }
{
return (TRACK*) Pback;
}
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
@ -122,7 +126,7 @@ public:
class SEGZONE : public TRACK class SEGZONE : public TRACK
{ {
public: public:
SEGZONE( EDA_BaseStruct* StructFather ); SEGZONE( BOARD_ITEM* StructFather );
#if defined(DEBUG) #if defined(DEBUG)
/** /**
@ -141,7 +145,7 @@ public:
class SEGVIA : public TRACK class SEGVIA : public TRACK
{ {
public: public:
SEGVIA( EDA_BaseStruct* StructFather ); SEGVIA( BOARD_ITEM* StructFather );
bool IsViaOnLayer( int layer ); bool IsViaOnLayer( int layer );
void SetLayerPair( int top_layer, int bottom_layer ); void SetLayerPair( int top_layer, int bottom_layer );
void ReturnLayerPair( int* top_layer, int* bottom_layer ); void ReturnLayerPair( int* top_layer, int* bottom_layer );

View File

@ -35,7 +35,7 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**********************/ /**********************/
/* Classe EDGE_ZONE: constructeur */ /* Classe EDGE_ZONE: constructeur */
EDGE_ZONE::EDGE_ZONE( EDA_BaseStruct* parent ) : EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) :
DRAWSEGMENT( parent, TYPEEDGEZONE ) DRAWSEGMENT( parent, TYPEEDGEZONE )
{ {
} }
@ -52,8 +52,8 @@ EDGE_ZONE:: ~EDGE_ZONE( void )
/**********************/ /**********************/
/* Classe DRAWSEGMENT: constructeur */ /* Classe DRAWSEGMENT: constructeur */
DRAWSEGMENT::DRAWSEGMENT( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype ) :
EDA_BaseLineStruct( StructFather, idtype ) BOARD_ITEM( StructFather, idtype )
{ {
m_Flags = m_Shape = m_Type = m_Angle = 0; m_Flags = m_Shape = m_Type = m_Angle = 0;
} }
@ -76,7 +76,7 @@ void DRAWSEGMENT::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }
@ -262,8 +262,8 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
/* Classe MARQUEUR */ /* Classe MARQUEUR */
/*******************/ /*******************/
MARQUEUR::MARQUEUR( EDA_BaseStruct* StructFather ) : MARQUEUR::MARQUEUR( BOARD_ITEM* StructFather ) :
EDA_BaseStruct( StructFather, TYPEMARQUEUR ) BOARD_ITEM( StructFather, TYPEMARQUEUR )
{ {
m_Bitmap = NULL; m_Bitmap = NULL;
m_Type = 0; m_Type = 0;
@ -291,7 +291,7 @@ void MARQUEUR::UnLink( void )
} }
else /* Le chainage arriere pointe sur la structure "Pere" */ else /* Le chainage arriere pointe sur la structure "Pere" */
{ {
( (BOARD*) Pback )->m_Drawings = Pnext; ( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
} }
} }

View File

@ -379,7 +379,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC )
if( PtSegm->m_StructType != pt_aux->m_StructType ) if( PtSegm->m_StructType != pt_aux->m_StructType )
continue; continue;
if( PtSegm->m_Layer != pt_aux->m_Layer ) if( PtSegm->GetLayer() != pt_aux->GetLayer() )
continue; continue;
if( PtSegm->m_NetCode != pt_aux->m_NetCode ) if( PtSegm->m_NetCode != pt_aux->m_NetCode )
break; break;
@ -587,7 +587,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
{ {
/* Ce ne doit pas etre sur un pad */ /* Ce ne doit pas etre sur un pad */
if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_Start, if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_Start,
g_TabOneLayerMask[pt_ref->m_Layer] ) ) g_TabOneLayerMask[pt_ref->GetLayer()] ) )
return NULL; return NULL;
if( (pt_ref->m_Start.x == pt_segm->m_Start.x) if( (pt_ref->m_Start.x == pt_segm->m_Start.x)
@ -605,7 +605,7 @@ static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extre
else /* extremite == END */ else /* extremite == END */
{ {
/* Ce ne doit pas etre sur un pad */ /* Ce ne doit pas etre sur un pad */
if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_End, g_TabOneLayerMask[pt_ref->m_Layer] ) ) if( Fast_Locate_Pad_Connecte( Pcb, pt_ref->m_End, g_TabOneLayerMask[pt_ref->GetLayer()] ) )
return NULL; return NULL;
if( pt_ref->m_End == pt_segm->m_Start ) if( pt_ref->m_End == pt_segm->m_Start )

134
pcbnew/collectors.cpp Normal file
View File

@ -0,0 +1,134 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if defined(DEBUG)
#include "collectors.h"
#include "pcbnew.h" // class BOARD
/* This module contains out of line member functions for classes given in
collectors.h. Those classes augment the functionality of class WinEDA_PcbFrame.
*/
// see collectors.h
const KICAD_T ARROWCOLLECTOR::AllBoardItems[] = {
TYPETEXTE,
TYPEDRAWSEGMENT,
TYPECOTATION,
TYPEVIA,
TYPETRACK,
TYPEPAD,
TYPETEXTEMODULE,
TYPEMODULE,
EOT
};
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. Searches and collects all the objects that the old
* function PcbGeneralLocateAndDisplay() would find, except that it keeps all
* that it finds and does not do any displaying.
*
* @param testItem An EDA_BaseStruct to examine.
* @param notUsed The const void* testData.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT ARROWCOLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed )
{
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
switch( item->m_StructType )
{
case TYPEPAD:
case TYPEVIA:
/*
if( item->IsOnOneOfTheseLayers( m_LayerMask ) )
{
if( item->HitTest( refPos ) )
Append2nd( testItem );
}
*/
break;
case TYPETRACK:
case TYPETEXTE:
case TYPEDRAWSEGMENT:
case TYPECOTATION:
case TYPETEXTEMODULE:
case TYPEMODULE:
if( item->GetLayer() == m_PreferredLayer )
{
if( item->HitTest( m_RefPos ) )
Append( item );
}
/*
else if( item->IsOnOneOfTheseLayers( m_LayerMask ) )
{
if( item->HitTest( m_RefPos ) )
Append2nd( item );
}
*/
break;
default:
; // nothing
}
return SEARCH_CONTINUE;
}
// see collectors.h
void ARROWCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos,
int aPreferredLayer, int aLayerMask )
{
Empty(); // empty the collection, primary criteria list
Empty2nd(); // empty the collection, secondary criteria list
/* remember where the snapshot was taken from and pass refPos to
the Inspect() function.
*/
SetRefPos( refPos );
// visit the board with the INSPECTOR (me).
board->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData, not used here
m_ScanTypes);
SetTimeNow(); // when snapshot was taken
// @todo: append 2nd list onto end of the first "list"
Empty2nd();
}
#endif // DEBUG
//EOF

141
pcbnew/collectors.h Normal file
View File

@ -0,0 +1,141 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef COLLECTORS_H
#define COLLECTORS_H
/* This module contains a number of COLLECTOR implementations which are used
to augment the functionality of class WinEDA_PcbFrame.
*/
#include "class_collector.h"
class RAT1COLLECTOR : public COLLECTOR
{
;
};
/**
* Class ARROWCOLLECTOR
* is intended for use when the right click button is pressed, or when the
* plain "arrow" tool is in effect. This class can be used by window classes
* such as WinEDA_PcbFrame.
*
* Philosophy: this class knows nothing of the context in which as BOARD is used
* and that means it knows nothing about which layers are visible or current,
* but can handle those concerns by the SetPreferredLayer() function and the
* SetLayerMask() fuction.
*/
class ARROWCOLLECTOR : public COLLECTOR
{
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
* "list" at the end of the search.
*/
std::vector<EDA_BaseStruct*> list2nd;
/**
* A bit-mapped layer mask that defines any layers which are acceptable
* on a secondary search criterion basis.
*/
int m_LayerMask;
public:
/// A scan list for all editable board items, like PcbGeneralLocateAndDisplay()
static const KICAD_T AllBoardItems[];
/**
* Constructor ARROWCOLLECTOR
*/
ARROWCOLLECTOR()
{
m_LayerMask = 0;
SetScanTypes( AllBoardItems );
}
void Empty2nd()
{
list2nd.clear();
}
void Append2nd( EDA_BaseStruct* item )
{
list2nd.push_back( item );
}
/**
* Function SetLayerMask
* takes a bit-mapped layer mask and records it. During the scan/search,
* this is used as a secondary criterion. That is, if there is no direct
* layer match with COLLECTOR::m_PreferredLayer (the primary criterion),
* then an object on any layer given in this bit-map is recorded as a
* second choice object if it also HitTest()s true.
*
* @param aLayerMask A layer mask which has bits in it indicating which
* layers are acceptable. Caller must pay attention to which layers are
* visible, selected, etc. All those concerns are handled outside this
* class, as stated in the class Philosophy above.
*/
void SetLayerMask( int aLayerMask )
{
m_LayerMask = aLayerMask;
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is not used in this class.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData );
/**
* Function Scan
* scans a BOARD using this class's Inspector method, which does the collection.
* @param board A BOARD to scan.
* @param refPos A wxPoint to use in hit-testing.
*/
void Scan( BOARD* board, const wxPoint& refPos, int aPreferredLayer, int aLayerMask );
};
#endif // COLLECTORS_H

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) ); m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
} }
m_SelLayerBox->SetSelection( Cotation->m_Layer - (CMP_N + 1) ); m_SelLayerBox->SetSelection( Cotation->GetLayer() - (CMP_N + 1) );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
@ -180,8 +180,9 @@ void WinEDA_CotationPropertiesFrame::CotationPropertiesAccept( wxCommandEvent& e
CurrentCotation->m_Text->m_Width = CurrentCotation->m_Width = CurrentCotation->m_Text->m_Width = CurrentCotation->m_Width =
m_TxtWidthCtrl->GetValue(); m_TxtWidthCtrl->GetValue();
CurrentCotation->m_Text->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentCotation->m_Text->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentCotation->m_Layer = CurrentCotation->m_Text->m_Layer =
m_SelLayerBox->GetChoice() + CMP_N + 1; CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
CurrentCotation->m_Text->CreateDrawData(); CurrentCotation->m_Text->CreateDrawData();
@ -236,7 +237,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC )
Cotation = new COTATION( m_Pcb ); Cotation = new COTATION( m_Pcb );
Cotation->m_Flags = IS_NEW; Cotation->m_Flags = IS_NEW;
Cotation->m_Layer = GetScreen()->m_Active_Layer; Cotation->SetLayer( GetScreen()->m_Active_Layer );
Cotation->m_Width = g_DesignSettings.m_DrawSegmentWidth; Cotation->m_Width = g_DesignSettings.m_DrawSegmentWidth;
Cotation->m_Text->m_Width = Cotation->m_Width; Cotation->m_Text->m_Width = Cotation->m_Width;
@ -317,7 +318,7 @@ static void Montre_Position_New_Cotation( WinEDA_DrawPanel* panel, wxDC* DC, boo
Cotation->Draw( panel, DC, wxPoint( 0, 0 ), GR_XOR ); Cotation->Draw( panel, DC, wxPoint( 0, 0 ), GR_XOR );
} }
Cotation->m_Layer = screen->m_Active_Layer; Cotation->SetLayer( screen->m_Active_Layer );
if( status_cotation == 1 ) if( status_cotation == 1 )
{ {
Cotation->TraitD_ox = pos.x; Cotation->TraitD_ox = pos.x;
@ -399,7 +400,7 @@ static void Ajuste_Details_Cotation( COTATION* Cotation )
wxString msg; wxString msg;
/* Init des couches : */ /* Init des couches : */
Cotation->m_Text->m_Layer = Cotation->m_Layer; Cotation->m_Text->SetLayer( Cotation->GetLayer() );
/* calcul de la hauteur du texte + trait de cotation */ /* calcul de la hauteur du texte + trait de cotation */
ii = Cotation->m_Text->m_Size.y + ii = Cotation->m_Text->m_Size.y +

View File

@ -68,7 +68,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
delete Track; delete Track;
g_TrackSegmentCount--; g_TrackSegmentCount--;
if( g_CurrentTrackSegment && (g_CurrentTrackSegment->m_StructType != TYPEVIA) ) if( g_CurrentTrackSegment && (g_CurrentTrackSegment->m_StructType != TYPEVIA) )
previous_layer = g_CurrentTrackSegment->m_Layer; previous_layer = g_CurrentTrackSegment->GetLayer();
} }
if( g_CurrentTrackSegment ) if( g_CurrentTrackSegment )

View File

@ -236,7 +236,7 @@ void WinEDA_ModulePropertiesFrame::BuildPanelModuleProperties( bool FullOptions
wxString layer_list[2] = { _( "Component" ), _( "Copper" ) }; wxString layer_list[2] = { _( "Component" ), _( "Copper" ) };
m_LayerCtrl = new wxRadioBox( m_PanelProperties, -1, _( "Layer" ), wxDefaultPosition, m_LayerCtrl = new wxRadioBox( m_PanelProperties, -1, _( "Layer" ), wxDefaultPosition,
wxSize( -1, -1 ), 2, layer_list, 1 ); wxSize( -1, -1 ), 2, layer_list, 1 );
m_LayerCtrl->SetSelection( (m_CurrentModule->m_Layer == CUIVRE_N) ? 1 : 0 ); m_LayerCtrl->SetSelection( (m_CurrentModule->GetLayer() == CUIVRE_N) ? 1 : 0 );
PropLeftSizer->Add( m_LayerCtrl, 0, wxGROW | wxALL, 5 ); PropLeftSizer->Add( m_LayerCtrl, 0, wxGROW | wxALL, 5 );
bool select = FALSE; bool select = FALSE;
@ -518,10 +518,10 @@ void WinEDA_ModulePropertiesFrame::ModulePropertiesAccept( wxCommandEvent& event
{ {
if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT
{ {
if( m_CurrentModule->m_Layer == CUIVRE_N ) if( m_CurrentModule->GetLayer() == CUIVRE_N )
change_layer = TRUE; change_layer = TRUE;
} }
else if( m_CurrentModule->m_Layer == CMP_N ) else if( m_CurrentModule->GetLayer() == CMP_N )
change_layer = TRUE; change_layer = TRUE;
} }

View File

@ -200,11 +200,11 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
{ {
if( Edge->m_StructType != TYPEEDGEMODULE ) if( Edge->m_StructType != TYPEEDGEMODULE )
continue; continue;
Edge->m_Layer = new_layer; Edge->SetLayer( new_layer );
} }
} }
else else
Edge->m_Layer = new_layer; Edge->SetLayer( new_layer );
GetScreen()->SetModify(); GetScreen()->SetModify();
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
@ -336,11 +336,11 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
if( Edge->m_Shape == S_ARC ) if( Edge->m_Shape == S_ARC )
Edge->m_Angle = ArcValue; Edge->m_Angle = ArcValue;
Edge->m_Width = ModuleSegmentWidth; Edge->m_Width = ModuleSegmentWidth;
Edge->m_Layer = Module->m_Layer; Edge->SetLayer( Module->GetLayer() );
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
Edge->m_Layer = SILKSCREEN_N_CMP; Edge->SetLayer( SILKSCREEN_N_CMP );
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
Edge->m_Layer = SILKSCREEN_N_CU; Edge->SetLayer( SILKSCREEN_N_CU );
/* Mise a jour du point de depart du segment ou de l'arc */ /* Mise a jour du point de depart du segment ou de l'arc */
Edge->m_Start = GetScreen()->m_Curseur; Edge->m_Start = GetScreen()->m_Curseur;
/* Mise a jour de la fin du segment , rectangle ou de l'arc*/ /* Mise a jour de la fin du segment , rectangle ou de l'arc*/

View File

@ -138,7 +138,7 @@ void WinEDA_PcbFrame::Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC )
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_XOR );
if( DrawSegm->m_Layer == EDGE_N ) if( DrawSegm->GetLayer() == EDGE_N )
DrawSegm->m_Width = g_DesignSettings.m_EdgeSegmentWidth; DrawSegm->m_Width = g_DesignSettings.m_EdgeSegmentWidth;
else else
DrawSegm->m_Width = g_DesignSettings.m_DrawSegmentWidth; DrawSegm->m_Width = g_DesignSettings.m_DrawSegmentWidth;
@ -159,7 +159,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
TEXTE_PCB* pt_txt; TEXTE_PCB* pt_txt;
EDA_BaseStruct* PtStruct, * PtNext; EDA_BaseStruct* PtStruct, * PtNext;
COTATION* Cotation; COTATION* Cotation;
int layer = Segment->m_Layer; int layer = Segment->GetLayer();
if( layer <= CMP_N ) if( layer <= CMP_N )
{ {
@ -187,7 +187,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
pt_segm = (DRAWSEGMENT*) PtStruct; pt_segm = (DRAWSEGMENT*) PtStruct;
if( pt_segm->m_Layer == layer ) if( pt_segm->GetLayer() == layer )
{ {
Trace_DrawSegmentPcb( DrawPanel, DC, pt_segm, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, pt_segm, GR_XOR );
DeleteStructure( PtStruct ); DeleteStructure( PtStruct );
@ -196,7 +196,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
case TYPETEXTE: case TYPETEXTE:
pt_txt = (TEXTE_PCB*) PtStruct; pt_txt = (TEXTE_PCB*) PtStruct;
if( pt_txt->m_Layer == layer ) if( pt_txt->GetLayer() == layer )
{ {
pt_txt->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); pt_txt->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( PtStruct ); DeleteStructure( PtStruct );
@ -206,7 +206,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
case TYPECOTATION: case TYPECOTATION:
Cotation = (COTATION*) PtStruct; Cotation = (COTATION*) PtStruct;
if( Cotation->m_Layer == layer ) if( Cotation->GetLayer() == layer )
{ {
Cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); Cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
DeleteStructure( PtStruct ); DeleteStructure( PtStruct );
@ -276,7 +276,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
{ {
GetScreen()->SetCurItem( Segment = new DRAWSEGMENT( m_Pcb ) ); GetScreen()->SetCurItem( Segment = new DRAWSEGMENT( m_Pcb ) );
Segment->m_Flags = IS_NEW; Segment->m_Flags = IS_NEW;
Segment->m_Layer = GetScreen()->m_Active_Layer; Segment->SetLayer( GetScreen()->m_Active_Layer );
Segment->m_Width = s_large; Segment->m_Width = s_large;
Segment->m_Shape = shape; Segment->m_Shape = shape;
Segment->m_Angle = 900; Segment->m_Angle = 900;
@ -307,7 +307,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
GetScreen()->SetCurItem( Segment = new DRAWSEGMENT( m_Pcb ) ); GetScreen()->SetCurItem( Segment = new DRAWSEGMENT( m_Pcb ) );
Segment->m_Flags = IS_NEW; Segment->m_Flags = IS_NEW;
Segment->m_Layer = DrawItem->m_Layer; Segment->SetLayer( DrawItem->GetLayer() );
Segment->m_Width = s_large; Segment->m_Width = s_large;
Segment->m_Shape = DrawItem->m_Shape; Segment->m_Shape = DrawItem->m_Shape;
Segment->m_Type = DrawItem->m_Type; Segment->m_Type = DrawItem->m_Type;

View File

@ -108,7 +108,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Pnext ) for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Pnext )
{ {
pt_segm->SetState( BUSY, OFF ); pt_segm->SetState( BUSY, OFF );
pt_segm->m_Param = pt_segm->m_Layer; /* pour sauvegarde */ pt_segm->m_Param = pt_segm->GetLayer(); /* pour sauvegarde */
} }
ii = 0; pt_segm = pt_track; ii = 0; pt_segm = pt_track;
@ -118,17 +118,17 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
continue; continue;
/* inversion des couches */ /* inversion des couches */
if( pt_segm->m_Layer == l1 ) if( pt_segm->GetLayer() == l1 )
pt_segm->m_Layer = l2; pt_segm->SetLayer( l2 );
else if( pt_segm->m_Layer == l2 ) else if( pt_segm->GetLayer() == l2 )
pt_segm->m_Layer = l1; pt_segm->SetLayer( l1 );
if( (Drc_On) && ( Drc( this, DC, pt_segm, m_Pcb->m_Track, 1 ) == BAD_DRC ) ) if( (Drc_On) && ( Drc( this, DC, pt_segm, m_Pcb->m_Track, 1 ) == BAD_DRC ) )
{ /* Annulation du changement */ { /* Annulation du changement */
ii = 0; pt_segm = pt_track; ii = 0; pt_segm = pt_track;
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext )
{ {
pt_segm->m_Layer = pt_segm->m_Param; pt_segm->SetLayer( pt_segm->m_Param );
} }
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR ); Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR );
@ -178,7 +178,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
} }
/* Les vias ne doivent pas etre inutilement empilees: */ /* Les vias ne doivent pas etre inutilement empilees: */
if( Locate_Via( m_Pcb, g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->m_Layer ) ) if( Locate_Via( m_Pcb, g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->GetLayer() ) )
return; return;
pt_segm = g_FirstTrackSegment; pt_segm = g_FirstTrackSegment;
for( ii = 0; ii < g_TrackSegmentCount - 1; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) for( ii = 0; ii < g_TrackSegmentCount - 1; ii++, pt_segm = (TRACK*) pt_segm->Pnext )
@ -206,7 +206,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
Via->m_NetCode = g_HightLigth_NetCode; Via->m_NetCode = g_HightLigth_NetCode;
Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End; Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End;
Via->m_Layer = GetScreen()->m_Active_Layer; Via->SetLayer( GetScreen()->m_Active_Layer );
// Provisoirement. indicate the first layer (?) // Provisoirement. indicate the first layer (?)
@ -218,19 +218,19 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
if( (Via->m_Shape & 15) == VIA_ENTERREE ) if( (Via->m_Shape & 15) == VIA_ENTERREE )
{ {
Via->m_Layer |= GetScreen()->m_Active_Layer << 4; Via->SetLayer( Via->GetLayer() | GetScreen()->m_Active_Layer << 4 );
} }
else if( (Via->m_Shape & 15) == VIA_BORGNE ) //blind via else if( (Via->m_Shape & 15) == VIA_BORGNE ) //blind via
{ // A revoir! ( la via devrait deboucher sur 1 cote ) { // A revoir! ( la via devrait deboucher sur 1 cote )
Via->m_Layer |= GetScreen()->m_Active_Layer << 4; Via->SetLayer( Via->GetLayer() | GetScreen()->m_Active_Layer << 4 );
} }
else else
Via->m_Layer = 0x0F; Via->SetLayer( 0x0F );
if( Drc_On &&( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) ) if( Drc_On &&( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) )
{ /* Via impossible a placer ici */ { /* Via impossible a placer ici */
delete Via; delete Via;
GetScreen()->m_Active_Layer = g_CurrentTrackSegment->m_Layer; GetScreen()->m_Active_Layer = g_CurrentTrackSegment->GetLayer();
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
return; return;
} }
@ -240,7 +240,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
g_CurrentTrackSegment->Pnext = Via; g_CurrentTrackSegment->Pnext = Via;
g_TrackSegmentCount++; g_TrackSegmentCount++;
g_CurrentTrackSegment = new TRACK( *g_CurrentTrackSegment ); g_CurrentTrackSegment = new TRACK( *g_CurrentTrackSegment );
g_CurrentTrackSegment->m_Layer = GetScreen()->m_Active_Layer; g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start; g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start;
g_TrackSegmentCount++; g_TrackSegmentCount++;
g_CurrentTrackSegment->Pback = Via; g_CurrentTrackSegment->Pback = Via;

View File

@ -130,7 +130,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
Hight_Light( DC ); Hight_Light( DC );
g_CurrentTrackSegment->m_Flags = IS_NEW; g_CurrentTrackSegment->m_Flags = IS_NEW;
g_CurrentTrackSegment->m_Layer = GetScreen()->m_Active_Layer; g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
g_CurrentTrackSegment->m_Start = pos; g_CurrentTrackSegment->m_Start = pos;
g_CurrentTrackSegment->m_End = g_CurrentTrackSegment->m_Start; g_CurrentTrackSegment->m_End = g_CurrentTrackSegment->m_Start;
@ -211,7 +211,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
g_CurrentTrackSegment->m_Flags = IS_NEW; g_CurrentTrackSegment->m_Flags = IS_NEW;
g_TrackSegmentCount++; g_TrackSegmentCount++;
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End; g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End;
g_CurrentTrackSegment->m_Layer = GetScreen()->m_Active_Layer; g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
/* Show the new position */ /* Show the new position */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
@ -269,9 +269,9 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
dy1 = pt_segm->m_End.y - pt_segm->m_Start.y; dy1 = pt_segm->m_End.y - pt_segm->m_Start.y;
// les segments doivent etre de longueur suffisante: // les segments doivent etre de longueur suffisante:
if( max( abs( dx0 ), abs( dy0 ) ) < (pas_45 * 2) ) if( MAX( abs( dx0 ), abs( dy0 ) ) < (pas_45 * 2) )
return 0; return 0;
if( max( abs( dx1 ), abs( dy1 ) ) < (pas_45 * 2) ) if( MAX( abs( dx1 ), abs( dy1 ) ) < (pas_45 * 2) )
return 0; return 0;
/* creation du nouveau segment, raccordant des 2 segm: */ /* creation du nouveau segment, raccordant des 2 segm: */
@ -502,14 +502,14 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
} }
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */ /* dessin de la nouvelle piste : mise a jour du point d'arrivee */
g_CurrentTrackSegment->m_Layer = screen->m_Active_Layer; g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback; TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback;
if( previous_track && (previous_track->m_StructType == TYPETRACK) ) if( previous_track && (previous_track->m_StructType == TYPETRACK) )
{ {
previous_track->m_Layer = screen->m_Active_Layer; previous_track->SetLayer( screen->m_Active_Layer );
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
} }
} }
@ -584,7 +584,7 @@ void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy )
break; break;
case 45: case 45:
deltax = min( deltax, deltay ); deltay = deltax; deltax = MIN( deltax, deltay ); deltay = deltax;
/* recalcul des signes de deltax et deltay */ /* recalcul des signes de deltax et deltay */
if( (ActiveScreen->m_Curseur.x - ox) < 0 ) if( (ActiveScreen->m_Curseur.x - ox) < 0 )
deltax = -deltax; deltax = -deltax;
@ -666,7 +666,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount )
break; break;
case 45: case 45:
iDx = min( iDx, iDy ); iDx = MIN( iDx, iDy );
iDy = iDx; iDy = iDx;
/* recalcul des signes de deltax et deltay */ /* recalcul des signes de deltax et deltay */
if( (ActiveScreen->m_Curseur.x - track->m_Start.x) < 0 ) if( (ActiveScreen->m_Curseur.x - track->m_Start.x) < 0 )
@ -707,7 +707,7 @@ TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount )
TRACK* firsttrack = track; TRACK* firsttrack = track;
TRACK* oldtrack; TRACK* oldtrack;
int nn = 0; int nn = 0;
EDA_BaseStruct* LockPoint; BOARD_ITEM* LockPoint;
if( track == 0 ) if( track == 0 )
return NULL; return NULL;

File diff suppressed because it is too large Load Diff

View File

@ -1,427 +1,453 @@
/*************************************/ /*************************************/
/* fichier gen_modules_placefile.cpp */ /* fichier gen_modules_placefile.cpp */
/*************************************/ /*************************************/
/* /*
1 - create ascii files for automatic placement of smd components * 1 - create ascii files for automatic placement of smd components
2 - create a module report (pos and module descr) (ascii file) * 2 - create a module report (pos and module descr) (ascii file)
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "trigo.h" #include "trigo.h"
class LIST_MOD /* Permet de lister les elements utiles des modules */ class LIST_MOD /* Permet de lister les elements utiles des modules */
{ {
public: public:
MODULE * m_Module; MODULE* m_Module;
const wxChar * m_Reference; const wxChar* m_Reference;
const wxChar * m_Value; const wxChar* m_Value;
}; };
/* variables locale : */ /* variables locale : */
static wxPoint File_Place_Offset; /* Offset des coord de placement pour le fichier généré */ static wxPoint File_Place_Offset; /* Offset des coord de placement pour le fichier généré */
/* Routines Locales */ /* Routines Locales */
static void WriteDrawSegmentPcb(DRAWSEGMENT * PtDrawSegment, FILE * rptfile); static void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile );
/* Routine de tri utilisee par GenereModulesPosition() */ /* Routine de tri utilisee par GenereModulesPosition() */
static int ListeModCmp(LIST_MOD * Ref, LIST_MOD * Cmp) static int ListeModCmp( LIST_MOD* Ref, LIST_MOD* Cmp )
{ {
return ( StrLenNumCmp(Ref->m_Reference, Cmp->m_Reference, 16) ); return StrLenNumCmp( Ref->m_Reference, Cmp->m_Reference, 16 );
} }
/**************************************************************/
void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
/**************************************************************/
/**************************************************************/
void WinEDA_PcbFrame::GenModulesPosition(wxCommandEvent& event)
/**************************************************************/
/* Routine de generation du fichier de positionnement des modules, /* Routine de generation du fichier de positionnement des modules,
utilisé pour les machines de placement de composants * utilisé pour les machines de placement de composants
*/ */
{ {
float conv_unit; float conv_unit;
int NbMod, ii; int NbMod, ii;
bool GenCu = FALSE; bool GenCu = FALSE;
MODULE * Module; MODULE* Module;
LIST_MOD * Liste; LIST_MOD* Liste;
char Line[1024], Buff[80]; char Line[1024], Buff[80];
wxString NameLayerCu, NameLayerCmp, msg; wxString NameLayerCu, NameLayerCmp, msg;
FILE * LayerCu = NULL, *LayerCmp = NULL; FILE* LayerCu = NULL, * LayerCmp = NULL;
/* Calcul des echelles de conversion */
conv_unit = 0.0001; /* unites = INCHES */
/* Calcul des echelles de conversion */
conv_unit = 0.0001; /* unites = INCHES */
// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */ // if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
File_Place_Offset = m_Auxiliary_Axis_Position; File_Place_Offset = m_Auxiliary_Axis_Position;
/* Calcul du nombre de modules utiles ( Attribut CMS, non VIRTUAL ) ) */ /* Calcul du nombre de modules utiles ( Attribut CMS, non VIRTUAL ) ) */
NbMod = 0; Module = m_Pcb->m_Modules; NbMod = 0; Module = m_Pcb->m_Modules;
for ( ; Module != NULL; Module = (MODULE*) Module->Pnext) for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
{ {
if( Module->m_Attributs & MOD_VIRTUAL ) continue; if( Module->m_Attributs & MOD_VIRTUAL )
if( (Module->m_Attributs & MOD_CMS) == 0 ) continue; continue;
if( Module->m_Layer == CUIVRE_N) GenCu = TRUE; if( (Module->m_Attributs & MOD_CMS) == 0 )
NbMod++; continue;
} if( Module->GetLayer() == CUIVRE_N )
if ( NbMod == 0 ) GenCu = TRUE;
{ NbMod++;
DisplayError(this, _("No Modules for Automated Placement"), 20); return; }
}
if( NbMod == 0 )
{
DisplayError( this, _( "No Modules for Automated Placement" ), 20 ); return;
}
/* Init nom fichier */ /* Init nom fichier */
NameLayerCmp = m_CurrentScreen->m_FileName; NameLayerCmp = m_CurrentScreen->m_FileName;
ChangeFileNameExt(NameLayerCmp, wxT("-cmp.pos")); ChangeFileNameExt( NameLayerCmp, wxT( "-cmp.pos" ) );
LayerCmp = wxFopen(NameLayerCmp, wxT("wt")); LayerCmp = wxFopen( NameLayerCmp, wxT( "wt" ) );
if (LayerCmp == 0) if( LayerCmp == 0 )
{ {
msg = _("Unable to create ") + NameLayerCu; msg = _( "Unable to create " ) + NameLayerCu;
DisplayError(this, msg); return ; DisplayError( this, msg ); return;
} }
if( GenCu ) if( GenCu )
{ {
NameLayerCu = m_CurrentScreen->m_FileName; NameLayerCu = m_CurrentScreen->m_FileName;
ChangeFileNameExt(NameLayerCu, wxT("-copper.pos")); ChangeFileNameExt( NameLayerCu, wxT( "-copper.pos" ) );
LayerCu = wxFopen(NameLayerCu, wxT("wt")); LayerCu = wxFopen( NameLayerCu, wxT( "wt" ) );
if (LayerCu == 0) if( LayerCu == 0 )
{ {
msg = _("Unable to create ") + NameLayerCu; msg = _( "Unable to create " ) + NameLayerCu;
DisplayError(this, msg); DisplayError( this, msg );
fclose(LayerCmp); fclose( LayerCmp );
return ; return;
} }
} }
// Switch the locale to standard C (needed to print floating point numbers like 1.3) // Switch the locale to standard C (needed to print floating point numbers like 1.3)
setlocale(LC_NUMERIC, "C"); setlocale( LC_NUMERIC, "C" );
/* Affichage du bilan : */ /* Affichage du bilan : */
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
Affiche_1_Parametre(this,0,_("Component side place file:"),NameLayerCmp,BLUE); Affiche_1_Parametre( this, 0, _( "Component side place file:" ), NameLayerCmp, BLUE );
if( GenCu ) if( GenCu )
Affiche_1_Parametre(this,32,_("Copper side place file:"),NameLayerCu,BLUE); Affiche_1_Parametre( this, 32, _( "Copper side place file:" ), NameLayerCu, BLUE );
msg.Empty(); msg << NbMod; msg.Empty(); msg << NbMod;
Affiche_1_Parametre(this,65, _("Module count"), msg, RED); Affiche_1_Parametre( this, 65, _( "Module count" ), msg, RED );
/* Etablissement de la liste des modules par ordre alphabetique */ /* Etablissement de la liste des modules par ordre alphabetique */
Liste = (LIST_MOD*) MyZMalloc( NbMod * sizeof(LIST_MOD) ); Liste = (LIST_MOD*) MyZMalloc( NbMod * sizeof(LIST_MOD) );
Module = (MODULE*)m_Pcb->m_Modules; Module = (MODULE*) m_Pcb->m_Modules;
for( ii = 0; Module != NULL; Module = Module->Next() ) for( ii = 0; Module != NULL; Module = Module->Next() )
{ {
if( Module->m_Attributs & MOD_VIRTUAL ) continue; if( Module->m_Attributs & MOD_VIRTUAL )
if( (Module->m_Attributs & MOD_CMS) == 0 ) continue; continue;
if( (Module->m_Attributs & MOD_CMS) == 0 )
continue;
Liste[ii].m_Module = Module; Liste[ii].m_Module = Module;
Liste[ii].m_Reference = Module->m_Reference->m_Text; Liste[ii].m_Reference = Module->m_Reference->m_Text;
Liste[ii].m_Value = Module->m_Value->m_Text; Liste[ii].m_Value = Module->m_Value->m_Text;
ii++; ii++;
} }
qsort(Liste, NbMod , sizeof(LIST_MOD), qsort( Liste, NbMod, sizeof(LIST_MOD),
(int(*)(const void *, const void*))ListeModCmp); ( int( * ) ( const void*, const void* ) )ListeModCmp );
/* Generation entete du fichier 'commentaires) */ /* Generation entete du fichier 'commentaires) */
sprintf(Line,"### Module positions - created on %s ###\n", sprintf( Line, "### Module positions - created on %s ###\n",
DateAndTime(Buff) ); DateAndTime( Buff ) );
fputs(Line,LayerCmp); fputs( Line, LayerCmp );
if( GenCu ) fputs(Line,LayerCu); if( GenCu )
fputs( Line, LayerCu );
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
sprintf(Line,"### Printed by PcbNew version %s\n", CONV_TO_UTF8(Title) ); sprintf( Line, "### Printed by PcbNew version %s\n", CONV_TO_UTF8( Title ) );
fputs(Line,LayerCmp); fputs( Line, LayerCmp );
if( GenCu ) fputs(Line,LayerCu); if( GenCu )
fputs( Line, LayerCu );
sprintf(Line,"## Unit = inches, Angle = deg.\n"); sprintf( Line, "## Unit = inches, Angle = deg.\n" );
fputs(Line,LayerCmp); fputs( Line, LayerCmp );
if( GenCu ) fputs(Line,LayerCu); if( GenCu )
fputs( Line, LayerCu );
sprintf(Line,"## Side : Components\n"); sprintf( Line, "## Side : Components\n" );
fputs(Line,LayerCmp); fputs( Line, LayerCmp );
if( GenCu ) if( GenCu )
{ {
sprintf(Line,"## Side : Copper\n"); sprintf( Line, "## Side : Copper\n" );
fputs(Line,LayerCu); fputs( Line, LayerCu );
} }
sprintf(Line, sprintf( Line,
"# Ref Val PosX PosY Rot Side\n"); "# Ref Val PosX PosY Rot Side\n" );
fputs(Line,LayerCmp); fputs( Line, LayerCmp );
if( GenCu ) fputs(Line,LayerCu); if( GenCu )
fputs( Line, LayerCu );
/* Generation lignes utiles du fichier */ /* Generation lignes utiles du fichier */
for ( ii = 0 ; ii < NbMod; ii++) for( ii = 0; ii < NbMod; ii++ )
{ {
wxPoint module_pos; wxPoint module_pos;
wxString ref = Liste[ii].m_Reference; wxString ref = Liste[ii].m_Reference;
wxString val = Liste[ii].m_Value; wxString val = Liste[ii].m_Value;
sprintf(Line,"%-8.8s %-16.16s ", CONV_TO_UTF8(ref), CONV_TO_UTF8(val) ); sprintf( Line, "%-8.8s %-16.16s ", CONV_TO_UTF8( ref ), CONV_TO_UTF8( val ) );
module_pos = Liste[ii].m_Module->m_Pos; module_pos = Liste[ii].m_Module->m_Pos;
module_pos.x -= File_Place_Offset.x; module_pos.x -= File_Place_Offset.x;
module_pos.y -= File_Place_Offset.y; module_pos.y -= File_Place_Offset.y;
char * text = Line + strlen(Line);
sprintf( text, " %9.4f %9.4f %8.1f ",
(float) module_pos.x * conv_unit,
(float) module_pos.y * conv_unit,
(float) Liste[ii].m_Module->m_Orient / 10);
if (Liste[ii].m_Module->m_Layer == CMP_N) char* text = Line + strlen( Line );
{ sprintf( text, " %9.4f %9.4f %8.1f ",
strcat(Line,"Cmp.\n"); (float) module_pos.x * conv_unit,
fputs(Line, LayerCmp); (float) module_pos.y * conv_unit,
} (float) Liste[ii].m_Module->m_Orient / 10 );
else if (Liste[ii].m_Module->m_Layer == CUIVRE_N) if( Liste[ii].m_Module->GetLayer() == CMP_N )
{ {
strcat(Line,"Cu\n"); strcat( Line, "Cmp.\n" );
fputs(Line, LayerCu); fputs( Line, LayerCmp );
} }
} else if( Liste[ii].m_Module->GetLayer() == CUIVRE_N )
{
strcat( Line, "Cu\n" );
fputs( Line, LayerCu );
}
}
/* Generation fin du fichier */ /* Generation fin du fichier */
fputs("## End\n", LayerCmp); fputs( "## End\n", LayerCmp );
fclose(LayerCmp); fclose( LayerCmp );
if( GenCu ) if( GenCu )
{ {
fputs("## End\n", LayerCu); fputs( "## End\n", LayerCu );
fclose(LayerCu); fclose( LayerCu );
} }
MyFree(Liste); MyFree( Liste );
setlocale(LC_NUMERIC, ""); // revert to the current locale setlocale( LC_NUMERIC, "" ); // revert to the current locale
msg = wxT("Cmp File: ") + NameLayerCmp; msg = wxT( "Cmp File: " ) + NameLayerCmp;
if( GenCu ) msg += wxT("\nCu File: ") + NameLayerCu; if( GenCu )
msg += wxT( "\nCu File: " ) + NameLayerCu;
DisplayInfo(this, msg); DisplayInfo( this, msg );
} }
/**************************************************************/
void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
/**************************************************************/
/**************************************************************/
void WinEDA_PcbFrame::GenModuleReport(wxCommandEvent& event)
/**************************************************************/
/* Print a module report. /* Print a module report.
*/ */
{ {
float conv_unit; float conv_unit;
MODULE * Module; MODULE* Module;
D_PAD * pad; D_PAD* pad;
char Line[1024], Buff[80]; char Line[1024], Buff[80];
wxString FullFileName, NameLayerCmp, msg; wxString FullFileName, NameLayerCmp, msg;
FILE * rptfile; FILE* rptfile;
wxPoint module_pos; wxPoint module_pos;
/* Calcul des echelles de conversion */ /* Calcul des echelles de conversion */
conv_unit = 0.0001; /* unites = INCHES */ conv_unit = 0.0001; /* unites = INCHES */
// if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */ // if(IF_DRILL_METRIC) conv_unit = 0.000254; /* unites = mm */
File_Place_Offset = wxPoint(0,0); File_Place_Offset = wxPoint( 0, 0 );
/* Init nom fichier */ /* Init nom fichier */
FullFileName = m_CurrentScreen->m_FileName; FullFileName = m_CurrentScreen->m_FileName;
ChangeFileNameExt(FullFileName, wxT(".rpt")); ChangeFileNameExt( FullFileName, wxT( ".rpt" ) );
rptfile = wxFopen(FullFileName, wxT("wt")); rptfile = wxFopen( FullFileName, wxT( "wt" ) );
if (rptfile == NULL) if( rptfile == NULL )
{ {
msg = _("Unable to create ") + FullFileName; msg = _( "Unable to create " ) + FullFileName;
DisplayError(this, msg); return ; DisplayError( this, msg ); return;
} }
// Switch the locale to standard C (needed to print floating point numbers like 1.3) // Switch the locale to standard C (needed to print floating point numbers like 1.3)
setlocale(LC_NUMERIC, "C"); setlocale( LC_NUMERIC, "C" );
/* Generation entete du fichier 'commentaires) */ /* Generation entete du fichier 'commentaires) */
sprintf(Line,"## Module report - date %s\n", DateAndTime(Buff) ); sprintf( Line, "## Module report - date %s\n", DateAndTime( Buff ) );
fputs(Line,rptfile); fputs( Line, rptfile );
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
sprintf(Line,"## Created by PcbNew version %s\n", CONV_TO_UTF8(Title) ); sprintf( Line, "## Created by PcbNew version %s\n", CONV_TO_UTF8( Title ) );
fputs(Line,rptfile); fputs( Line, rptfile );
fputs("## Unit = inches, Angle = deg.\n",rptfile); fputs( "## Unit = inches, Angle = deg.\n", rptfile );
/* Generation lignes utiles du fichier */ /* Generation lignes utiles du fichier */
fputs("##\n", rptfile); fputs( "##\n", rptfile );
fputs("\n$BeginDESCRIPTION\n", rptfile); fputs( "\n$BeginDESCRIPTION\n", rptfile );
m_Pcb->ComputeBoundaryBox();
fputs("\n$BOARD\n", rptfile);
fputs("unit INCH\n", rptfile);
sprintf(Line,"upper_left_corner %9.6f %9.6f\n",
(float) m_Pcb->m_BoundaryBox.GetX() * conv_unit,
(float) m_Pcb->m_BoundaryBox.GetY() * conv_unit);
fputs(Line, rptfile);
sprintf(Line,"lower_right_corner %9.6f %9.6f\n",
(float) (m_Pcb->m_BoundaryBox.GetRight() ) * conv_unit,
(float) (m_Pcb->m_BoundaryBox.GetBottom() ) * conv_unit);
fputs(Line, rptfile);
fputs("$EndBOARD\n\n", rptfile);
Module = (MODULE*)m_Pcb->m_Modules; m_Pcb->ComputeBoundaryBox();
for( ; Module != NULL; Module = Module->Next() ) fputs( "\n$BOARD\n", rptfile );
{ fputs( "unit INCH\n", rptfile );
sprintf(Line,"$MODULE \"%s\"\n", CONV_TO_UTF8(Module->m_Reference->m_Text)); sprintf( Line, "upper_left_corner %9.6f %9.6f\n",
fputs(Line, rptfile); (float) m_Pcb->m_BoundaryBox.GetX() * conv_unit,
(float) m_Pcb->m_BoundaryBox.GetY() * conv_unit );
sprintf(Line,"reference \"%s\"\n", CONV_TO_UTF8(Module->m_Reference->m_Text)); fputs( Line, rptfile );
fputs(Line, rptfile);
sprintf(Line,"value \"%s\"\n", CONV_TO_UTF8(Module->m_Value->m_Text));
fputs(Line, rptfile);
sprintf(Line,"footprint \"%s\"\n", CONV_TO_UTF8(Module->m_LibRef));
fputs(Line, rptfile);
msg = wxT("attribut"); sprintf( Line, "lower_right_corner %9.6f %9.6f\n",
if ( Module->m_Attributs & MOD_VIRTUAL ) msg += wxT(" virtual"); (float) ( m_Pcb->m_BoundaryBox.GetRight() ) * conv_unit,
if ( Module->m_Attributs & MOD_CMS ) msg += wxT(" smd"); (float) ( m_Pcb->m_BoundaryBox.GetBottom() ) * conv_unit );
if ( (Module->m_Attributs & (MOD_VIRTUAL|MOD_CMS)) == 0 ) fputs( Line, rptfile );
msg += wxT(" none");
msg += wxT("\n");
fputs(CONV_TO_UTF8(msg), rptfile);
module_pos = Module->m_Pos;
module_pos.x -= File_Place_Offset.x;
module_pos.y -= File_Place_Offset.y;
sprintf( Line, "position %9.6f %9.6f\n",
(float) module_pos.x * conv_unit,
(float) module_pos.y * conv_unit);
fputs(Line, rptfile);
sprintf( Line, "orientation %.2f\n", (float) Module->m_Orient / 10); fputs( "$EndBOARD\n\n", rptfile );
if (Module->m_Layer == CMP_N) strcat(Line,"layer component\n");
else if (Module->m_Layer == CUIVRE_N) strcat(Line,"layer copper\n");
else strcat(Line,"layer other\n");
fputs(Line, rptfile);
Module->Write_3D_Descr( rptfile ); Module = (MODULE*) m_Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
for ( pad = Module->m_Pads; pad != NULL; pad = pad->Next() ) {
{ sprintf( Line, "$MODULE \"%s\"\n", CONV_TO_UTF8( Module->m_Reference->m_Text ) );
fprintf( rptfile,"$PAD \"%.4s\"\n", pad->m_Padname); fputs( Line, rptfile );
sprintf( Line, "position %9.6f %9.6f\n",
(float) pad->m_Pos0.x * conv_unit,
(float) pad->m_Pos0.y * conv_unit);
fputs(Line, rptfile);
sprintf( Line, "size %9.6f %9.6f\n", sprintf( Line, "reference \"%s\"\n", CONV_TO_UTF8( Module->m_Reference->m_Text ) );
(float) pad->m_Size.x * conv_unit, fputs( Line, rptfile );
(float) pad->m_Size.y * conv_unit); sprintf( Line, "value \"%s\"\n", CONV_TO_UTF8( Module->m_Value->m_Text ) );
fputs(Line, rptfile); fputs( Line, rptfile );
sprintf( Line, "drill %9.6f\n", (float) pad->m_Drill.x * conv_unit); sprintf( Line, "footprint \"%s\"\n", CONV_TO_UTF8( Module->m_LibRef ) );
fputs(Line, rptfile); fputs( Line, rptfile );
sprintf( Line, "shape_offset %9.6f %9.6f\n",
(float) pad->m_Offset.x * conv_unit,
(float) pad->m_Offset.y * conv_unit);
fputs(Line, rptfile);
sprintf( Line, "orientation %.2f\n", (float) (pad->m_Orient - Module->m_Orient) / 10); msg = wxT( "attribut" );
fputs(Line, rptfile); if( Module->m_Attributs & MOD_VIRTUAL )
char *shape_name[6] = {"??? ","Circ","Rect","Oval","trap","spec"} ; msg += wxT( " virtual" );
sprintf( Line, "Shape %s\n", shape_name[pad->m_PadShape]); if( Module->m_Attributs & MOD_CMS )
fputs(Line, rptfile); msg += wxT( " smd" );
if( ( Module->m_Attributs & (MOD_VIRTUAL | MOD_CMS) ) == 0 )
msg += wxT( " none" );
msg += wxT( "\n" );
fputs( CONV_TO_UTF8( msg ), rptfile );
int layer = 0; module_pos = Module->m_Pos;
if(pad->m_Masque_Layer & CUIVRE_LAYER) layer = 1; module_pos.x -= File_Place_Offset.x;
if(pad->m_Masque_Layer & CMP_LAYER) layer |= 2; module_pos.y -= File_Place_Offset.y;
char *layer_name[4] = {"??? ","copper","component","all"} ; sprintf( Line, "position %9.6f %9.6f\n",
sprintf( Line, "Layer %s\n", layer_name[layer]); (float) module_pos.x * conv_unit,
fputs(Line, rptfile); (float) module_pos.y * conv_unit );
fprintf( rptfile,"$EndPAD\n"); fputs( Line, rptfile );
}
fprintf( rptfile,"$EndMODULE %s\n\n", (const char*) Module->m_Reference->m_Text.GetData() );
}
/* Write board Edges */ sprintf( Line, "orientation %.2f\n", (float) Module->m_Orient / 10 );
EDA_BaseStruct * PtStruct; if( Module->GetLayer() == CMP_N )
for ( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext) strcat( Line, "layer component\n" );
{ else if( Module->GetLayer() == CUIVRE_N )
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue; strcat( Line, "layer copper\n" );
if( ((DRAWSEGMENT *) PtStruct)->m_Layer != EDGE_N ) continue; else
WriteDrawSegmentPcb( (DRAWSEGMENT *) PtStruct, rptfile); strcat( Line, "layer other\n" );
} fputs( Line, rptfile );
/* Generation fin du fichier */ Module->Write_3D_Descr( rptfile );
fputs("$EndDESCRIPTION\n", rptfile);
fclose(rptfile); for( pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
setlocale(LC_NUMERIC, ""); // revert to the current locale {
fprintf( rptfile, "$PAD \"%.4s\"\n", pad->m_Padname );
sprintf( Line, "position %9.6f %9.6f\n",
(float) pad->m_Pos0.x * conv_unit,
(float) pad->m_Pos0.y * conv_unit );
fputs( Line, rptfile );
sprintf( Line, "size %9.6f %9.6f\n",
(float) pad->m_Size.x * conv_unit,
(float) pad->m_Size.y * conv_unit );
fputs( Line, rptfile );
sprintf( Line, "drill %9.6f\n", (float) pad->m_Drill.x * conv_unit );
fputs( Line, rptfile );
sprintf( Line, "shape_offset %9.6f %9.6f\n",
(float) pad->m_Offset.x * conv_unit,
(float) pad->m_Offset.y * conv_unit );
fputs( Line, rptfile );
sprintf( Line, "orientation %.2f\n", (float) (pad->m_Orient - Module->m_Orient) / 10 );
fputs( Line, rptfile );
char* shape_name[6] = { "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
sprintf( Line, "Shape %s\n", shape_name[pad->m_PadShape] );
fputs( Line, rptfile );
int layer = 0;
if( pad->m_Masque_Layer & CUIVRE_LAYER )
layer = 1;
if( pad->m_Masque_Layer & CMP_LAYER )
layer |= 2;
char* layer_name[4] = { "??? ", "copper", "component", "all" };
sprintf( Line, "Layer %s\n", layer_name[layer] );
fputs( Line, rptfile );
fprintf( rptfile, "$EndPAD\n" );
}
fprintf( rptfile, "$EndMODULE %s\n\n",
(const char*) Module->m_Reference->m_Text.GetData() );
}
/* Write board Edges */
EDA_BaseStruct* PtStruct;
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue;
if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N )
continue;
WriteDrawSegmentPcb( (DRAWSEGMENT*) PtStruct, rptfile );
}
/* Generation fin du fichier */
fputs( "$EndDESCRIPTION\n", rptfile );
fclose( rptfile );
setlocale( LC_NUMERIC, "" ); // revert to the current locale
} }
/*******************************************************************/ /*******************************************************************/
void WriteDrawSegmentPcb(DRAWSEGMENT * PtDrawSegment, FILE * rptfile) void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
/*******************************************************************/ /*******************************************************************/
/* Sortie dsur rptfile d'un segment type drawing PCB: /* Sortie dsur rptfile d'un segment type drawing PCB:
Les contours sont de differents type: * Les contours sont de differents type:
segment * segment
cercle * cercle
arc * arc
*/ */
{ {
double conv_unit, ux0, uy0, dx, dy; double conv_unit, ux0, uy0, dx, dy;
double rayon, width; double rayon, width;
char Line[1024]; char Line[1024];
/* Calcul des echelles de conversion */
conv_unit = 0.0001; /* unites = INCHES */
/* coord de depart */
ux0 = PtDrawSegment->m_Start.x * conv_unit;
uy0 = PtDrawSegment->m_Start.y * conv_unit;
/* coord d'arrivee */
dx = PtDrawSegment->m_End.x * conv_unit;
dy = PtDrawSegment->m_End.y * conv_unit;
width = PtDrawSegment->m_Width * conv_unit; /* Calcul des echelles de conversion */
conv_unit = 0.0001; /* unites = INCHES */
/* coord de depart */
ux0 = PtDrawSegment->m_Start.x * conv_unit;
uy0 = PtDrawSegment->m_Start.y * conv_unit;
/* coord d'arrivee */
dx = PtDrawSegment->m_End.x * conv_unit;
dy = PtDrawSegment->m_End.y * conv_unit;
switch (PtDrawSegment->m_Shape) width = PtDrawSegment->m_Width * conv_unit;
{
case S_CIRCLE:
rayon = hypot(dx-ux0,dy-uy0);
sprintf(Line,"$CIRCLE \n"); fputs(Line, rptfile);
sprintf( Line, "centre %.6lf %.6lf\n", ux0, uy0);
sprintf( Line, "radius %.6lf\n", rayon);
sprintf( Line, "width %.6lf\n", width);
sprintf(Line,"$EndCIRCLE \n");
fputs(Line, rptfile);
break;
case S_ARC: switch( PtDrawSegment->m_Shape )
{ {
int endx = PtDrawSegment->m_End.x, endy = PtDrawSegment->m_End.y; case S_CIRCLE:
rayon = hypot(dx-ux0,dy-uy0); rayon = hypot( dx - ux0, dy - uy0 );
RotatePoint(&endx, &endy, PtDrawSegment->m_Start.x, PtDrawSegment->m_Start.y,PtDrawSegment->m_Angle); sprintf( Line, "$CIRCLE \n" ); fputs( Line, rptfile );
sprintf(Line,"$ARC \n"); fputs(Line, rptfile); sprintf( Line, "centre %.6lf %.6lf\n", ux0, uy0 );
sprintf( Line, "centre %.6lf %.6lf\n", ux0, uy0); sprintf( Line, "radius %.6lf\n", rayon );
sprintf( Line, "start %.6lf %.6lf\n", endx * conv_unit, endy * conv_unit); sprintf( Line, "width %.6lf\n", width );
sprintf( Line, "end %.6lf %.6lf\n", dx, dy); sprintf( Line, "$EndCIRCLE \n" );
sprintf( Line, "width %.6lf\n", width); fputs( Line, rptfile );
sprintf(Line,"$EndARC \n"); break;
fputs(Line, rptfile);
}
break;
default: case S_ARC:
sprintf(Line,"$LINE \n"); {
fputs(Line, rptfile); int endx = PtDrawSegment->m_End.x, endy = PtDrawSegment->m_End.y;
sprintf( Line, "start %.6lf %.6lf\n", ux0, uy0); rayon = hypot( dx - ux0, dy - uy0 );
sprintf( Line, "end %.6lf %.6lf\n", dx, dy); RotatePoint( &endx,
sprintf( Line, "width %.6lf\n", width); &endy,
sprintf(Line,"$EndLINE \n"); PtDrawSegment->m_Start.x,
fputs(Line, rptfile); PtDrawSegment->m_Start.y,
break; PtDrawSegment->m_Angle );
} sprintf( Line, "$ARC \n" ); fputs( Line, rptfile );
sprintf( Line, "centre %.6lf %.6lf\n", ux0, uy0 );
sprintf( Line, "start %.6lf %.6lf\n", endx * conv_unit, endy * conv_unit );
sprintf( Line, "end %.6lf %.6lf\n", dx, dy );
sprintf( Line, "width %.6lf\n", width );
sprintf( Line, "$EndARC \n" );
fputs( Line, rptfile );
}
break;
default:
sprintf( Line, "$LINE \n" );
fputs( Line, rptfile );
sprintf( Line, "start %.6lf %.6lf\n", ux0, uy0 );
sprintf( Line, "end %.6lf %.6lf\n", dx, dy );
sprintf( Line, "width %.6lf\n", width );
sprintf( Line, "$EndLINE \n" );
fputs( Line, rptfile );
break;
}
} }

View File

@ -245,7 +245,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Mself.m_Size.x = Mself.m_Size.y / 2; Mself.m_Size.x = Mself.m_Size.y / 2;
// Choix d'une Valeur de depart raisonnable pour le rayon des arcs de cercle // Choix d'une Valeur de depart raisonnable pour le rayon des arcs de cercle
Mself.rayon = min( Mself.m_Width * 5, Mself.m_Size.x / 4 ); Mself.rayon = MIN( Mself.m_Width * 5, Mself.m_Size.x / 4 );
/* Calcul des parametres */ /* Calcul des parametres */
for( Mself.nbrin = 2; ; Mself.nbrin++ ) for( Mself.nbrin = 2; ; Mself.nbrin++ )
@ -307,7 +307,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtSegm->m_End.x = Mself.m_Start.x; PtSegm->m_End.x = Mself.m_Start.x;
PtSegm->m_End.y = PtSegm->m_Start.y + Mself.delta; PtSegm->m_End.y = PtSegm->m_Start.y + Mself.delta;
PtSegm->m_Width = Mself.m_Width; PtSegm->m_Width = Mself.m_Width;
PtSegm->m_Layer = Module->m_Layer; PtSegm->SetLayer( Module->GetLayer() );
PtSegm->m_Shape = S_SEGMENT; PtSegm->m_Shape = S_SEGMENT;
newedge = new EDGE_MODULE( Module ); newedge = new EDGE_MODULE( Module );
@ -432,7 +432,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtPad->m_Pos0.x = PtPad->m_Pos.x - Module->m_Pos.x; PtPad->m_Pos0.x = PtPad->m_Pos.x - Module->m_Pos.x;
PtPad->m_Pos0.y = PtPad->m_Pos.y - Module->m_Pos.y; PtPad->m_Pos0.y = PtPad->m_Pos.y - Module->m_Pos.y;
PtPad->m_Size.x = PtPad->m_Size.y = LastSegm->m_Width; PtPad->m_Size.x = PtPad->m_Size.y = LastSegm->m_Width;
PtPad->m_Masque_Layer = g_TabOneLayerMask[LastSegm->m_Layer]; PtPad->m_Masque_Layer = g_TabOneLayerMask[LastSegm->GetLayer()];
PtPad->m_Attribut = SMD; PtPad->m_Attribut = SMD;
PtPad->m_PadShape = CIRCLE; PtPad->m_PadShape = CIRCLE;
PtPad->m_Rayon = PtPad->m_Size.x / 2; PtPad->m_Rayon = PtPad->m_Size.x / 2;

View File

@ -915,7 +915,7 @@ wxString msg;
float Xscale = (float) (SheetSize.x - (marge*2)) / dX; float Xscale = (float) (SheetSize.x - (marge*2)) / dX;
float Yscale = (float) (SheetSize.y * 0.6 - (marge*2)) / dY; float Yscale = (float) (SheetSize.y * 0.6 - (marge*2)) / dY;
scale_x = scale_y = min(Xscale, Yscale); scale_x = scale_y = MIN(Xscale, Yscale);
g_PlotOffset.x = - (SheetSize.x/2) + g_PlotOffset.x = - (SheetSize.x/2) +
(int)(BoardCentre.x * scale_x) + marge; (int)(BoardCentre.x * scale_x) + marge;

File diff suppressed because it is too large Load Diff

View File

@ -229,7 +229,8 @@ void WinEDA_PcbFrame::Erase_Zones( wxDC* DC, bool query )
void WinEDA_PcbFrame::Erase_Segments_Pcb( wxDC* DC, bool is_edges, bool query ) void WinEDA_PcbFrame::Erase_Segments_Pcb( wxDC* DC, bool is_edges, bool query )
/*****************************************************************************/ /*****************************************************************************/
{ {
EDA_BaseStruct* PtStruct, * PtNext; BOARD_ITEM* PtStruct;
BOARD_ITEM* PtNext;
int masque_layer = (~EDGE_LAYER) & 0x1FFF0000; int masque_layer = (~EDGE_LAYER) & 0x1FFF0000;
if( is_edges ) if( is_edges )
@ -244,30 +245,18 @@ void WinEDA_PcbFrame::Erase_Segments_Pcb( wxDC* DC, bool is_edges, bool query )
return; return;
} }
PtStruct = (EDA_BaseStruct*) m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtNext ) for( ; PtStruct != NULL; PtStruct = PtNext )
{ {
PtNext = PtStruct->Pnext; PtNext = PtStruct->Next();
switch( PtStruct->m_StructType ) switch( PtStruct->m_StructType )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if( g_TabOneLayerMask[( (DRAWSEGMENT*) PtStruct )->m_Layer] & masque_layer )
DeleteStructure( PtStruct );
break;
case TYPETEXTE: case TYPETEXTE:
if( g_TabOneLayerMask[( (TEXTE_PCB*) PtStruct )->m_Layer] & masque_layer )
DeleteStructure( PtStruct );
break;
case TYPECOTATION: case TYPECOTATION:
if( g_TabOneLayerMask[( (COTATION*) PtStruct )->m_Layer] & masque_layer )
DeleteStructure( PtStruct );
break;
case TYPEMIRE: case TYPEMIRE:
if( g_TabOneLayerMask[( (MIREPCB*) PtStruct )->m_Layer] & masque_layer ) if( g_TabOneLayerMask[ PtStruct->GetLayer()] & masque_layer )
DeleteStructure( PtStruct ); DeleteStructure( PtStruct );
break; break;

View File

@ -154,7 +154,8 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File,
&PtSegm->m_TimeStamp, &flags ); &PtSegm->m_TimeStamp, &flags );
if( type == 1 ) if( type == 1 )
PtSegm->m_StructType = TYPEVIA; PtSegm->m_StructType = TYPEVIA;
PtSegm->m_Layer = layer;
PtSegm->SetLayer( layer );
PtSegm->m_NetCode = net_code; PtSegm->SetState( flags, ON ); PtSegm->m_NetCode = net_code; PtSegm->SetState( flags, ON );
#ifdef PCBNEW #ifdef PCBNEW
PtSegm->Draw( DrawPanel, DC, GR_OR ); PtSegm->Draw( DrawPanel, DC, GR_OR );
@ -249,7 +250,7 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( wxDC* DC, FILE* File, int* LineNum
screensize = DrawPanel->GetClientSize(); screensize = DrawPanel->GetClientSize();
ii = pcbsize.x / screensize.x; ii = pcbsize.x / screensize.x;
jj = pcbsize.y / screensize.y; jj = pcbsize.y / screensize.y;
bestzoom = max( ii, jj ); bestzoom = MAX( ii, jj );
screen->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); screen->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
screen->SetZoom( bestzoom ); screen->SetZoom( bestzoom );
@ -779,7 +780,7 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
char Line[1024]; char Line[1024];
int LineNum = 0; int LineNum = 0;
int nbsegm, nbmod; int nbsegm, nbmod;
EDA_BaseStruct* LastStructPcb = NULL, * StructPcb; BOARD_ITEM* LastStructPcb = NULL, * StructPcb;
MODULE* LastModule = NULL, * Module; MODULE* LastModule = NULL, * Module;
EQUIPOT* LastEquipot = NULL, * Equipot; EQUIPOT* LastEquipot = NULL, * Equipot;
@ -803,7 +804,7 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
} }
LastStructPcb = m_Pcb->m_Drawings; LastStructPcb = m_Pcb->m_Drawings;
for( ; LastStructPcb != NULL; LastStructPcb = LastStructPcb->Pnext ) for( ; LastStructPcb != NULL; LastStructPcb = LastStructPcb->Next() )
{ {
if( LastStructPcb->Pnext == NULL ) if( LastStructPcb->Pnext == NULL )
break; break;
@ -901,7 +902,7 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
if( strnicmp( Line, "$TEXTPCB", 8 ) == 0 ) if( strnicmp( Line, "$TEXTPCB", 8 ) == 0 )
{ {
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_Pcb ); TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_Pcb );
StructPcb = (EDA_BaseStruct*) pcbtxt; StructPcb = pcbtxt;
pcbtxt->ReadTextePcbDescr( File, &LineNum ); pcbtxt->ReadTextePcbDescr( File, &LineNum );
if( LastStructPcb == NULL ) if( LastStructPcb == NULL )
{ {

View File

@ -1,6 +1,6 @@
/**********************************************/ /**********************************************/
/* Routine de selection de couches pour trace */ /* Routine de selection de couches pour trace */
/**********************************************/ /**********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -15,194 +15,211 @@
/* Variables locales : */ /* Variables locales : */
/* Routines Locales */ /* Routines Locales */
static void Plot_Module(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module, static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
int draw_mode, int masklayer); int draw_mode, int masklayer );
/**********************************************************************************/ /**********************************************************************************/
void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmasklayer) void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer )
/**********************************************************************************/ /**********************************************************************************/
/* Used to print the board. /* Used to print the board.
Draw the board, but only layers allowed by printmasklayer * Draw the board, but only layers allowed by printmasklayer
( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed) * ( printmasklayer is a 32 bits mask: bit n = 1 -> layer n is printed)
*/ */
{ {
MODULE * Module; MODULE* Module;
EDA_BaseStruct * PtStruct; BOARD_ITEM* PtStruct;
int drawmode = GR_COPY; int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
TRACK * pt_piste; TRACK* pt_piste;
WinEDA_BasePcbFrame * frame = (WinEDA_BasePcbFrame *) m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent;
BOARD * Pcb = frame->m_Pcb; BOARD* Pcb = frame->m_Pcb;
save_opt = DisplayOpt; save_opt = DisplayOpt;
if( printmasklayer & ALL_CU_LAYERS ) DisplayOpt.DisplayPadFill = FILLED; if( printmasklayer & ALL_CU_LAYERS )
else DisplayOpt.DisplayPadFill = SKETCH; DisplayOpt.DisplayPadFill = FILLED;
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill; else
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = FALSE; DisplayOpt.DisplayPadFill = SKETCH;
DisplayOpt.DisplayPadNoConn = FALSE; frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
DisplayOpt.DisplayPadIsol = FALSE; frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum = FALSE;
DisplayOpt.DisplayModEdge = FILLED; DisplayOpt.DisplayPadNoConn = FALSE;
DisplayOpt.DisplayModText = FILLED; DisplayOpt.DisplayPadIsol = FALSE;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED; DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayTrackIsol = FALSE; DisplayOpt.DisplayModText = FILLED;
DisplayOpt.DisplayDrawItems = FILLED; frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayZones = TRUE; DisplayOpt.DisplayTrackIsol = FALSE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = TRUE;
printmasklayer |= EDGE_LAYER; printmasklayer |= EDGE_LAYER;
/* Draw the pcb graphic items (texts, ...) */ /* Draw the pcb graphic items (texts, ...) */
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch(PtStruct->m_StructType) switch( PtStruct->m_StructType )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if( (g_TabOneLayerMask[((DRAWSEGMENT*)PtStruct)->m_Layer] & printmasklayer) == 0 ) if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break; break;
Trace_DrawSegmentPcb(this, DC, (DRAWSEGMENT*) PtStruct, drawmode); Trace_DrawSegmentPcb( this, DC, (DRAWSEGMENT*) PtStruct, drawmode );
break; break;
case TYPECOTATION: case TYPECOTATION:
if( (g_TabOneLayerMask[((COTATION*)PtStruct)->m_Layer] & printmasklayer) == 0 ) if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break; break;
((COTATION*) PtStruct)->Draw(this, DC, wxPoint(0,0), drawmode); ( (COTATION*) PtStruct )->Draw( this, DC, wxPoint( 0, 0 ), drawmode );
break; break;
case TYPETEXTE: case TYPETEXTE:
{ {
if( (g_TabOneLayerMask[((TEXTE_PCB *)PtStruct)->m_Layer] & printmasklayer) == 0 ) if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break; break;
((TEXTE_PCB *) PtStruct)->Draw(this, DC, wxPoint(0,0), drawmode); ( (TEXTE_PCB*) PtStruct )->Draw( this, DC, wxPoint( 0, 0 ), drawmode );
break; break;
} }
case TYPEMIRE: case TYPEMIRE:
if( (g_TabOneLayerMask[((MIREPCB*)PtStruct)->m_Layer] & printmasklayer) == 0 ) break; if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
((MIREPCB*) PtStruct)->Draw(this, DC, wxPoint(0,0), drawmode); break;
break; ( (MIREPCB*) PtStruct )->Draw( this, DC, wxPoint( 0, 0 ), drawmode );
break;
case TYPEMARQUEUR: /* Trace des marqueurs */ case TYPEMARQUEUR: /* Trace des marqueurs */
break; break;
default: break; default:
} break;
} }
}
/* Draw the tracks */ /* Draw the tracks */
pt_piste = Pcb->m_Track; pt_piste = Pcb->m_Track;
for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
{ {
if( (printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue; if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 )
if ( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */ continue;
{ if( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */
int rayon = pt_piste->m_Width >> 1; {
int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape]; int rayon = pt_piste->m_Width >> 1;
GRSetDrawMode(DC, drawmode); int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape];
GRFilledCircle(&m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y, GRSetDrawMode( DC, drawmode );
rayon, 0, color, color) ; GRFilledCircle( &m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y,
} rayon, 0, color, color );
else pt_piste->Draw(this, DC, drawmode); }
} else
pt_piste->Draw( this, DC, drawmode );
}
pt_piste = Pcb->m_Zone; pt_piste = Pcb->m_Zone;
for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
{ {
if( (printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue ; if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 )
pt_piste->Draw(this, DC, drawmode); continue;
} pt_piste->Draw( this, DC, drawmode );
}
// Draw footprints, this is done at last in order to print the pad holes in while // Draw footprints, this is done at last in order to print the pad holes in while
// after the tracks // after the tracks
Module = (MODULE*) Pcb->m_Modules; Module = (MODULE*) Pcb->m_Modules;
for ( ; Module != NULL; Module = (MODULE *) Module->Pnext ) for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
{ {
Plot_Module(this, DC, Module, drawmode, printmasklayer); Plot_Module( this, DC, Module, drawmode, printmasklayer );
} }
/* draw the via holes */ /* draw the via holes */
pt_piste = Pcb->m_Track; pt_piste = Pcb->m_Track;
int rayon = g_DesignSettings.m_ViaDrill / 2; int rayon = g_DesignSettings.m_ViaDrill / 2;
int color = WHITE; int color = WHITE;
for ( ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
{ {
if( (printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue; if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 )
if ( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */ continue;
{ if( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */
GRSetDrawMode(DC, drawmode); {
GRFilledCircle(&m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y, GRSetDrawMode( DC, drawmode );
rayon, 0, color, color) ; GRFilledCircle( &m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y,
} rayon, 0, color, color );
} }
}
if ( Print_Sheet_Ref ) if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, 0); m_Parent->TraceWorkSheet( DC, ActiveScreen, 0 );
DisplayOpt = save_opt; DisplayOpt = save_opt;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill; frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum; frame->m_DisplayPadNum = DisplayOpt.DisplayPadNum;
} }
/***********************************************************/ /***********************************************************/
static void Plot_Module(WinEDA_DrawPanel * panel, wxDC * DC, static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC,
MODULE * Module, int draw_mode, int masklayer) MODULE* Module, int draw_mode, int masklayer )
/***********************************************************/ /***********************************************************/
{ {
D_PAD * pt_pad ; D_PAD* pt_pad;
EDA_BaseStruct * PtStruct; EDA_BaseStruct* PtStruct;
TEXTE_MODULE * TextMod; TEXTE_MODULE* TextMod;
int mlayer; int mlayer;
/* Draw pads */ /* Draw pads */
pt_pad = Module->m_Pads; pt_pad = Module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext ) for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{ {
if( (pt_pad->m_Masque_Layer & masklayer ) == 0 ) continue; if( (pt_pad->m_Masque_Layer & masklayer ) == 0 )
pt_pad->Draw(panel, DC, wxPoint(0,0), draw_mode); continue;
} pt_pad->Draw( panel, DC, wxPoint( 0, 0 ), draw_mode );
}
/* draw footprint graphic shapes */ /* draw footprint graphic shapes */
PtStruct = Module->m_Drawings; PtStruct = Module->m_Drawings;
mlayer = g_TabOneLayerMask[Module->m_Layer]; mlayer = g_TabOneLayerMask[Module->GetLayer()];
if( Module->m_Layer == CUIVRE_N) mlayer = SILKSCREEN_LAYER_CU; if( Module->GetLayer() == CUIVRE_N )
if( Module->m_Layer == CMP_N) mlayer = SILKSCREEN_LAYER_CMP; mlayer = SILKSCREEN_LAYER_CU;
if( mlayer & masklayer ) else if( Module->GetLayer() == CMP_N )
{ mlayer = SILKSCREEN_LAYER_CMP;
/* Analyse des autorisations de trace pour les textes VALEUR et REF */
bool trace_val, trace_ref; if( mlayer & masklayer )
trace_val = trace_ref = TRUE; // les 2 autorisations de tracer sont donnees {
if(Module->m_Reference->m_NoShow) trace_ref = FALSE; /* Analyse des autorisations de trace pour les textes VALEUR et REF */
if(Module->m_Value->m_NoShow) trace_val = FALSE; bool trace_val, trace_ref;
trace_val = trace_ref = TRUE; // les 2 autorisations de tracer sont donnees
if( Module->m_Reference->m_NoShow )
trace_ref = FALSE;
if( Module->m_Value->m_NoShow )
trace_val = FALSE;
if(trace_ref) if( trace_ref )
Module->m_Reference->Draw(panel, DC, wxPoint(0,0), draw_mode ); Module->m_Reference->Draw( panel, DC, wxPoint( 0, 0 ), draw_mode );
if(trace_val) if( trace_val )
Module->m_Value->Draw(panel, DC, wxPoint(0,0), draw_mode ); Module->m_Value->Draw( panel, DC, wxPoint( 0, 0 ), draw_mode );
} }
for( ;PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->m_StructType ) switch( PtStruct->m_StructType )
{ {
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
if( (mlayer & masklayer ) == 0) break; if( (mlayer & masklayer ) == 0 )
break;
TextMod = (TEXTE_MODULE *) PtStruct; TextMod = (TEXTE_MODULE*) PtStruct;
TextMod->Draw(panel, DC, wxPoint(0,0), draw_mode ); TextMod->Draw( panel, DC, wxPoint( 0, 0 ), draw_mode );
break; break;
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
{ {
EDGE_MODULE * edge = (EDGE_MODULE *) PtStruct; EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
if( (g_TabOneLayerMask[edge->m_Layer] & masklayer ) == 0) break; if( (g_TabOneLayerMask[edge->GetLayer()] & masklayer ) == 0 )
edge->Draw(panel, DC, wxPoint(0,0), draw_mode); break;
break; edge->Draw( panel, DC, wxPoint( 0, 0 ), draw_mode );
} break;
default: break; }
}
} default:
break;
}
}
} }

View File

@ -79,7 +79,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0; m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0;
Place_Module( Module, NULL ); Place_Module( Module, NULL );
if( Module->m_Layer != CMP_N ) if( Module->GetLayer() != CMP_N )
Change_Side_Module( Module, NULL ); Change_Side_Module( Module, NULL );
Rotate_Module( NULL, Module, 0, FALSE ); Rotate_Module( NULL, Module, 0, FALSE );
m_CurrentScreen->ClrModify(); m_CurrentScreen->ClrModify();

View File

@ -169,7 +169,7 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
MODULE* module = m_Pcb->m_Modules; MODULE* module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) module->Pnext ) for( ; module != NULL; module = (MODULE*) module->Pnext )
{ {
if( module->m_Layer != LayerSearch ) if( module->GetLayer() != LayerSearch )
continue; continue;
item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY ); item = LocateTexteModule( m_Pcb, &module, typeloc | VISIBLE_ONLY );
@ -266,7 +266,7 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_piste, int extr )
MODULE* module; MODULE* module;
wxPoint ref_pos; wxPoint ref_pos;
masque_layer = g_TabOneLayerMask[ptr_piste->m_Layer]; masque_layer = g_TabOneLayerMask[ptr_piste->GetLayer()];
if( extr == START ) if( extr == START )
{ {
ref_pos = ptr_piste->m_Start; ref_pos = ptr_piste->m_Start;
@ -374,14 +374,14 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
DRAWSEGMENT* pts = (DRAWSEGMENT*) PtStruct; DRAWSEGMENT* pts = (DRAWSEGMENT*) PtStruct;
if( (pts->m_Layer != LayerSearch) && (LayerSearch != -1) ) if( (pts->GetLayer() != LayerSearch) && (LayerSearch != -1) )
continue; continue;
if( pts->HitTest( ref_pos ) ) if( pts->HitTest( ref_pos ) )
{ {
// return this hit if layer matches, else remember in // return this hit if layer matches, else remember in
// case no layer match is found. // case no layer match is found.
if( pts->m_Layer == screen->m_Active_Layer ) if( pts->GetLayer() == screen->m_Active_Layer )
return pts; return pts;
else if( !locate_segm ) else if( !locate_segm )
@ -394,8 +394,8 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc )
/************************************************* /*************************************************
* D_PAD * Locate_Any_Pad(int typeloc, bool OnlyCurrentLayer) * D_PAD * Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer)
* D_PAD* Locate_Any_Pad(int ref_pos, bool OnlyCurrentLayer) * D_PAD* Locate_Any_Pad( BOARD* Pcb, int ref_pos, bool OnlyCurrentLayer)
*************************************************/ *************************************************/
/* /*
@ -522,7 +522,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
* d'appartenance du module et a la couche cuivre si le module * d'appartenance du module et a la couche cuivre si le module
* est sur couche serigr,adhesive cuivre, a la couche cmp si le module * est sur couche serigr,adhesive cuivre, a la couche cmp si le module
* est sur couche serigr,adhesive composant */ * est sur couche serigr,adhesive composant */
layer = pt_module->m_Layer; layer = pt_module->GetLayer();
if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU ) if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU )
layer = CUIVRE_N; layer = CUIVRE_N;
@ -538,21 +538,21 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
if( ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer == layer ) if( ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer == layer )
{ {
if( min( lx, ly ) <= min_dim ) if( MIN( lx, ly ) <= min_dim )
{ {
/* meilleure empreinte localisee sur couche active */ /* meilleure empreinte localisee sur couche active */
module = pt_module; module = pt_module;
min_dim = min( lx, ly ); min_dim = MIN( lx, ly );
} }
} }
else if( !(typeloc & MATCH_LAYER) else if( !(typeloc & MATCH_LAYER)
&& ( !(typeloc & VISIBLE_ONLY) || IsModuleLayerVisible( layer ) ) ) && ( !(typeloc & VISIBLE_ONLY) || IsModuleLayerVisible( layer ) ) )
{ {
if( min( lx, ly ) <= alt_min_dim ) if( MIN( lx, ly ) <= alt_min_dim )
{ {
/* meilleure empreinte localisee sur autres couches */ /* meilleure empreinte localisee sur autres couches */
Altmodule = pt_module; Altmodule = pt_module;
alt_min_dim = min( lx, ly ); alt_min_dim = MIN( lx, ly );
} }
} }
} }
@ -603,7 +603,7 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
for( ; module != NULL; module = (MODULE*) module->Pnext ) for( ; module != NULL; module = (MODULE*) module->Pnext )
{ {
int layer = module->m_Layer; int layer = module->GetLayer();
if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU ) if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU )
layer = CUIVRE_N; layer = CUIVRE_N;
else if( layer==ADHESIVE_N_CMP || layer==SILKSCREEN_N_CMP ) else if( layer==ADHESIVE_N_CMP || layer==SILKSCREEN_N_CMP )
@ -817,7 +817,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
if( Track->GetState( BUSY | DELETED ) ) if( Track->GetState( BUSY | DELETED ) )
continue; continue;
if( (g_DesignSettings.m_LayerColor[Track->m_Layer] & ITEM_NOT_SHOW) ) if( (g_DesignSettings.m_LayerColor[Track->GetLayer()] & ITEM_NOT_SHOW) )
continue; continue;
if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */ if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */
@ -828,7 +828,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
else else
{ {
if( MasqueLayer != -1 ) if( MasqueLayer != -1 )
if( (g_TabOneLayerMask[Track->m_Layer] & MasqueLayer) == 0 ) if( (g_TabOneLayerMask[Track->GetLayer()] & MasqueLayer) == 0 )
continue; /* Segments sur couches differentes */ continue; /* Segments sur couches differentes */
if( Track->HitTest( ref_pos ) ) if( Track->HitTest( ref_pos ) )
@ -869,7 +869,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
{ {
for( TRACK* Zone = start_adresse; Zone; Zone = (TRACK*) Zone->Pnext ) for( TRACK* Zone = start_adresse; Zone; Zone = (TRACK*) Zone->Pnext )
{ {
if( (layer != -1) && (Zone->m_Layer != layer) ) if( (layer != -1) && (Zone->GetLayer() != layer) )
continue; continue;
if( Zone->HitTest( ref_pos ) ) if( Zone->HitTest( ref_pos ) )
@ -898,7 +898,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
TEXTE_PCB* pt_txt_pcb = (TEXTE_PCB*) PtStruct; TEXTE_PCB* pt_txt_pcb = (TEXTE_PCB*) PtStruct;
if( pt_txt_pcb->m_Layer == LayerSearch ) if( pt_txt_pcb->GetLayer() == LayerSearch )
{ {
if( pt_txt_pcb->HitTest( ref ) ) if( pt_txt_pcb->HitTest( ref ) )
{ {
@ -1048,7 +1048,7 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch,
continue; continue;
item = (MIREPCB*) PtStruct; item = (MIREPCB*) PtStruct;
if( LayerSearch != -1 && item->m_Layer != LayerSearch ) if( LayerSearch != -1 && item->GetLayer() != LayerSearch )
continue; continue;
if( item->HitTest( ref_pos ) ) if( item->HitTest( ref_pos ) )

View File

@ -101,7 +101,8 @@ OBJECTS= $(TARGET).o classpcb.o\
gen_modules_placefile.o\ gen_modules_placefile.o\
modedit.o\ modedit.o\
export_gencad.o\ export_gencad.o\
hotkeys.o hotkeys.o \
collectors.o
setpage.o: ../share/setpage.cpp setpage.o: ../share/setpage.cpp
$(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
@ -289,3 +290,4 @@ dragsegm.o: dragsegm.cpp drag.h $(COMMON)
router.o: router.cpp $(COMMON) router.o: router.cpp $(COMMON)
collectors.o: collectors.cpp collectors.h $(COMMON)

View File

@ -218,7 +218,7 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
m_Pcb->m_Drawings->Pback = MirePcb; m_Pcb->m_Drawings->Pback = MirePcb;
m_Pcb->m_Drawings = MirePcb; m_Pcb->m_Drawings = MirePcb;
MirePcb->m_Layer = EDGE_N; MirePcb->SetLayer( EDGE_N );
MirePcb->m_Width = g_DesignSettings.m_EdgeSegmentWidth; MirePcb->m_Width = g_DesignSettings.m_EdgeSegmentWidth;
MirePcb->m_Size = MireDefaultSize; MirePcb->m_Size = MireDefaultSize;
MirePcb->m_Pos = GetScreen()->m_Curseur; MirePcb->m_Pos = GetScreen()->m_Curseur;

View File

@ -104,7 +104,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK;
module->m_Flags |= IS_MOVED; module->m_Flags |= IS_MOVED;
ModuleInitOrient = module->m_Orient; ModuleInitOrient = module->m_Orient;
ModuleInitLayer = module->m_Layer; ModuleInitLayer = module->GetLayer();
/* Effacement chevelu general si necessaire */ /* Effacement chevelu general si necessaire */
if( g_Show_Ratsnest ) if( g_Show_Ratsnest )
@ -192,7 +192,7 @@ void Exit_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
if( ModuleInitOrient != module->m_Orient ) if( ModuleInitOrient != module->m_Orient )
pcbframe->Rotate_Module( NULL, module, ModuleInitOrient, FALSE ); pcbframe->Rotate_Module( NULL, module, ModuleInitOrient, FALSE );
if( ModuleInitLayer != module->m_Layer ) if( ModuleInitLayer != module->GetLayer() )
pcbframe->Change_Side_Module( module, NULL ); pcbframe->Change_Side_Module( module, NULL );
module->Draw( Panel, DC, wxPoint( 0, 0 ), GR_OR ); module->Draw( Panel, DC, wxPoint( 0, 0 ), GR_OR );
} }
@ -337,7 +337,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
if( Module == NULL ) if( Module == NULL )
return; return;
if( (Module->m_Layer != CMP_N) && (Module->m_Layer != CUIVRE_N) ) if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != CUIVRE_N) )
return; return;
m_CurrentScreen->SetModify(); m_CurrentScreen->SetModify();
@ -367,7 +367,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
} }
/* mise a jour du Flag de l'empreinte et des couches des contours et textes */ /* mise a jour du Flag de l'empreinte et des couches des contours et textes */
Module->m_Layer = ChangeSideNumLayer( Module->m_Layer ); Module->SetLayer( ChangeSideNumLayer( Module->GetLayer() ) );
/* Inversion miroir de l'orientation */ /* Inversion miroir de l'orientation */
Module->m_Orient = -Module->m_Orient; Module->m_Orient = -Module->m_Orient;
@ -397,17 +397,17 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y; pt_texte->m_Pos0.y = pt_texte->m_Pos0.y;
pt_texte->m_Miroir = 1; pt_texte->m_Miroir = 1;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->m_Layer = Module->m_Layer; pt_texte->SetLayer( Module->GetLayer() );
pt_texte->m_Layer = ChangeSideNumLayer( pt_texte->m_Layer ); pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
pt_texte->m_Layer = SILKSCREEN_N_CU; pt_texte->SetLayer( SILKSCREEN_N_CU );
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
pt_texte->m_Layer = SILKSCREEN_N_CMP; pt_texte->SetLayer( SILKSCREEN_N_CMP );
if( (Module->m_Layer == SILKSCREEN_N_CU) if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->m_Layer == ADHESIVE_N_CU) || (Module->m_Layer == CUIVRE_N) ) || (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == CUIVRE_N) )
pt_texte->m_Miroir = 0; pt_texte->m_Miroir = 0;
/* Inversion miroir de la Valeur et mise en miroir : */ /* Inversion miroir de la Valeur et mise en miroir : */
@ -418,17 +418,17 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Pos0.y = pt_texte->m_Pos0.y; pt_texte->m_Pos0.y = pt_texte->m_Pos0.y;
pt_texte->m_Miroir = 1; pt_texte->m_Miroir = 1;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->m_Layer = Module->m_Layer; pt_texte->SetLayer( Module->GetLayer() );
pt_texte->m_Layer = ChangeSideNumLayer( pt_texte->m_Layer ); pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
pt_texte->m_Layer = SILKSCREEN_N_CU; pt_texte->SetLayer( SILKSCREEN_N_CU );
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
pt_texte->m_Layer = SILKSCREEN_N_CMP; pt_texte->SetLayer( SILKSCREEN_N_CMP );
if( (Module->m_Layer == SILKSCREEN_N_CU) if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->m_Layer == ADHESIVE_N_CU) || (Module->m_Layer == CUIVRE_N) ) || (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == CUIVRE_N) )
pt_texte->m_Miroir = 0; pt_texte->m_Miroir = 0;
/* Inversion miroir des dessins de l'empreinte : */ /* Inversion miroir des dessins de l'empreinte : */
@ -453,7 +453,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_edgmod->m_Angle = -pt_edgmod->m_Angle; pt_edgmod->m_Angle = -pt_edgmod->m_Angle;
} }
pt_edgmod->m_Layer = ChangeSideNumLayer( pt_edgmod->m_Layer ); pt_edgmod->SetLayer( ChangeSideNumLayer( pt_edgmod->GetLayer() ) );
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
@ -466,18 +466,21 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->m_Miroir = 1; pt_texte->m_Miroir = 1;
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
pt_texte->m_Layer = Module->m_Layer; pt_texte->SetLayer( Module->GetLayer() );
pt_texte->m_Layer = ChangeSideNumLayer( pt_texte->m_Layer ); pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
pt_texte->m_Layer = SILKSCREEN_N_CU; pt_texte->SetLayer( SILKSCREEN_N_CU );
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
pt_texte->m_Layer = SILKSCREEN_N_CMP; pt_texte->SetLayer( SILKSCREEN_N_CMP );
if( (Module->m_Layer == SILKSCREEN_N_CU) if( Module->GetLayer() == SILKSCREEN_N_CU
|| (Module->m_Layer == ADHESIVE_N_CU) || (Module->m_Layer == CUIVRE_N) ) || Module->GetLayer() == ADHESIVE_N_CU
|| Module->GetLayer() == CUIVRE_N )
{
pt_texte->m_Miroir = 0; pt_texte->m_Miroir = 0;
}
break; break;

View File

@ -815,7 +815,7 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC )
/* Test the connections modified by the move /* Test the connections modified by the move
* (only pad connection must be tested, track connection will be tested by test_1_net_connexion() ) */ * (only pad connection must be tested, track connection will be tested by test_1_net_connexion() ) */
int masque_layer = g_TabOneLayerMask[Track->m_Layer]; int masque_layer = g_TabOneLayerMask[Track->GetLayer()];
Track->start = Fast_Locate_Pad_Connecte( m_Pcb, Track->m_Start, masque_layer ); Track->start = Fast_Locate_Pad_Connecte( m_Pcb, Track->m_Start, masque_layer );
Track->end = Fast_Locate_Pad_Connecte( m_Pcb, Track->m_End, masque_layer ); Track->end = Fast_Locate_Pad_Connecte( m_Pcb, Track->m_End, masque_layer );
} }

View File

@ -243,7 +243,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( wxDC* DC, int shape_type )
Module->m_Drawings = edge; Module->m_Drawings = edge;
edge->Pback = Module; edge->Pback = Module;
edge->m_Shape = S_POLYGON; edge->m_Shape = S_POLYGON;
edge->m_Layer = LAYER_CMP_N; edge->SetLayer( LAYER_CMP_N );
edge->m_PolyCount = ii + 3; edge->m_PolyCount = ii + 3;
edge->m_PolyList = (int*) MyMalloc( edge->m_PolyCount * 2 * sizeof(int) ); edge->m_PolyList = (int*) MyMalloc( edge->m_PolyCount * 2 * sizeof(int) );
ptr = edge->m_PolyList; ptr = edge->m_PolyList;
@ -574,7 +574,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( wxDC* DC )
Module->m_Drawings = edge; Module->m_Drawings = edge;
edge->Pback = Module; edge->Pback = Module;
edge->m_Shape = S_POLYGON; edge->m_Shape = S_POLYGON;
edge->m_Layer = LAYER_CMP_N; edge->SetLayer( LAYER_CMP_N );
npoints = PolyEdgesCount; npoints = PolyEdgesCount;
switch( PolyShapeType ) switch( PolyShapeType )

View File

@ -120,9 +120,7 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH; FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
FullFileName += wxT("module_edit"); FullFileName += wxT("module_edit");
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_module_edit_Hotkey_List, verbose); return frame->ReadHotkeyConfigFile(FullFileName, s_module_edit_Hotkey_List, verbose);
return TRUE;
} }

View File

@ -12,7 +12,7 @@
#include "id.h" #include "id.h"
#if defined(DEBUG) #if defined(DEBUG)
#include "class_collector.h" #include "collectors.h"
#endif #endif
@ -169,77 +169,6 @@ END_EVENT_TABLE()
#if defined(DEBUG)
class RAT1COLLECTOR : public COLLECTOR
{
;
};
class ARROWCOLLECTOR : public COLLECTOR
{
const KICAD_T* m_ScanTypes;
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
* "list" at the end of the search.
*/
std::vector<EDA_BaseStruct*> list2nd;
public:
ARROWCOLLECTOR() :
COLLECTOR(0),
m_ScanTypes(0)
{
}
void Empty2nd()
{
list2nd.clear();
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
{
const wxPoint& refPos = *(const wxPoint*) testData;
switch( testItem->m_StructType )
{
case TYPEMODULE:
if( testItem->HitTest( refPos ) )
Append( testItem );
break;
}
return SEARCH_CONTINUE;
}
void SetScanTypes( const KICAD_T* scanTypes )
{
m_ScanTypes = scanTypes;
}
};
#endif
///////****************************///////////: ///////****************************///////////:
/****************/ /****************/
@ -264,8 +193,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
#if defined(DEBUG) #if defined(DEBUG)
m_GeneralCollector = NULL; m_ArrowCollector = new ARROWCOLLECTOR();
m_RatsModuleCollector = NULL;
#endif #endif
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
@ -313,6 +241,10 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame( void )
{ {
m_Parent->m_PcbFrame = NULL; m_Parent->m_PcbFrame = NULL;
m_CurrentScreen = ScreenPcb; m_CurrentScreen = ScreenPcb;
#if defined(DEBUG)
delete m_ArrowCollector;
#endif
} }

View File

@ -148,7 +148,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) ); m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
} }
m_SelLayerBox->SetSelection( TextPCB->m_Layer ); m_SelLayerBox->SetSelection( TextPCB->GetLayer() );
wxString orient_msg[4] = { wxT( "0" ), wxT( "90" ), wxT( "180" ), wxT( "-90" ) }; wxString orient_msg[4] = { wxT( "0" ), wxT( "90" ), wxT( "180" ), wxT( "-90" ) };
@ -216,7 +216,7 @@ void WinEDA_TextPCBPropertiesFrame::TextPCBPropertiesAccept( wxCommandEvent& eve
CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue();
CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900;
CurrentTextPCB->m_Layer = m_SelLayerBox->GetChoice(); CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() );
CurrentTextPCB->CreateDrawData(); CurrentTextPCB->CreateDrawData();
if( m_DC ) // Affichage nouveau texte if( m_DC ) // Affichage nouveau texte
{ {
@ -349,13 +349,13 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
TextePcb->Pback = (EDA_BaseStruct*) m_Pcb; TextePcb->Pback = (EDA_BaseStruct*) m_Pcb;
if( m_Pcb->m_Drawings ) if( m_Pcb->m_Drawings )
m_Pcb->m_Drawings->Pback = (EDA_BaseStruct*) TextePcb; m_Pcb->m_Drawings->Pback = (EDA_BaseStruct*) TextePcb;
m_Pcb->m_Drawings = (EDA_BaseStruct*) TextePcb; m_Pcb->m_Drawings = TextePcb;
/* Mise a jour des caracteristiques */ /* Mise a jour des caracteristiques */
TextePcb->m_Flags = IS_NEW; TextePcb->m_Flags = IS_NEW;
TextePcb->m_Layer = GetScreen()->m_Active_Layer; TextePcb->SetLayer( GetScreen()->m_Active_Layer );
TextePcb->m_Miroir = 1; TextePcb->m_Miroir = 1;
if( TextePcb->m_Layer == CUIVRE_N ) if( TextePcb->GetLayer() == CUIVRE_N )
TextePcb->m_Miroir = 0; TextePcb->m_Miroir = 0;
TextePcb->m_Size = g_DesignSettings.m_PcbTextSize; TextePcb->m_Size = g_DesignSettings.m_PcbTextSize;

View File

@ -203,12 +203,12 @@ wxString msg;
trace_val = Sel_Texte_Valeur; trace_val = Sel_Texte_Valeur;
trace_ref = Sel_Texte_Reference; // les 2 autorisations de tracer sont donnees trace_ref = Sel_Texte_Reference; // les 2 autorisations de tracer sont donnees
if( (g_TabOneLayerMask[Module->m_Reference->m_Layer] & masque_layer) == 0) if( (g_TabOneLayerMask[Module->m_Reference->GetLayer()] & masque_layer) == 0)
trace_ref = FALSE; trace_ref = FALSE;
if(Module->m_Reference->m_NoShow && !Sel_Texte_Invisible) if(Module->m_Reference->m_NoShow && !Sel_Texte_Invisible)
trace_ref = FALSE; trace_ref = FALSE;
if( (g_TabOneLayerMask[Module->m_Value->m_Layer] & masque_layer) == 0) if( (g_TabOneLayerMask[Module->m_Value->GetLayer()] & masque_layer) == 0)
trace_val = FALSE; trace_val = FALSE;
if(Module->m_Value->m_NoShow && !Sel_Texte_Invisible) if(Module->m_Value->m_NoShow && !Sel_Texte_Invisible)
trace_val = FALSE; trace_val = FALSE;
@ -238,7 +238,7 @@ wxString msg;
if( !Sel_Texte_Divers ) continue; if( !Sel_Texte_Divers ) continue;
if( (pt_texte->m_NoShow) && !Sel_Texte_Invisible ) if( (pt_texte->m_NoShow) && !Sel_Texte_Invisible )
continue; continue;
if( (g_TabOneLayerMask[pt_texte->m_Layer] & masque_layer) == 0) if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0)
continue; continue;
PlotTextModule(pt_texte); PlotTextModule(pt_texte);
nb_items++ ; nb_items++ ;
@ -281,13 +281,13 @@ void PlotCotation( COTATION * Cotation, int format_plot,int masque_layer)
{ {
DRAWSEGMENT *DrawTmp; DRAWSEGMENT *DrawTmp;
if( (g_TabOneLayerMask[Cotation->m_Layer] & masque_layer) == 0) return; if( (g_TabOneLayerMask[Cotation->GetLayer()] & masque_layer) == 0) return;
DrawTmp = new DRAWSEGMENT(NULL); DrawTmp = new DRAWSEGMENT(NULL);
masque_layer |= EDGE_LAYER; masque_layer |= EDGE_LAYER;
DrawTmp->m_Width = Cotation->m_Width; DrawTmp->m_Width = Cotation->m_Width;
DrawTmp->m_Layer = Cotation->m_Layer; DrawTmp->SetLayer( Cotation->GetLayer() );
PlotTextePcb( Cotation->m_Text,format_plot, masque_layer); PlotTextePcb( Cotation->m_Text,format_plot, masque_layer);
@ -330,13 +330,13 @@ void PlotMirePcb( MIREPCB* Mire, int format_plot,int masque_layer)
DRAWSEGMENT *DrawTmp; DRAWSEGMENT *DrawTmp;
int dx1,dx2, dy1, dy2, rayon; int dx1,dx2, dy1, dy2, rayon;
if( (g_TabOneLayerMask[Mire->m_Layer] & masque_layer) == 0) return; if( (g_TabOneLayerMask[Mire->GetLayer()] & masque_layer) == 0) return;
DrawTmp = new DRAWSEGMENT(NULL); DrawTmp = new DRAWSEGMENT(NULL);
masque_layer |= EDGE_LAYER; masque_layer |= EDGE_LAYER;
DrawTmp->m_Width = Mire->m_Width; DrawTmp->m_Width = Mire->m_Width;
DrawTmp->m_Layer = Mire->m_Layer; DrawTmp->SetLayer( Mire->GetLayer() );
DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y; DrawTmp->m_Start.x = Mire->m_Pos.x; DrawTmp->m_Start.y = Mire->m_Pos.y;
DrawTmp->m_End.x = DrawTmp->m_Start.x + (Mire->m_Size / 4); DrawTmp->m_End.x = DrawTmp->m_Start.x + (Mire->m_Size / 4);
@ -384,7 +384,7 @@ wxString msg;
for ( ;PtEdge != NULL; PtEdge = (EDGE_MODULE*)PtEdge->Pnext) for ( ;PtEdge != NULL; PtEdge = (EDGE_MODULE*)PtEdge->Pnext)
{ {
if(PtEdge->m_StructType != TYPEEDGEMODULE) continue; if(PtEdge->m_StructType != TYPEEDGEMODULE) continue;
if( (g_TabOneLayerMask[PtEdge->m_Layer] & masque_layer) == 0) continue; if( (g_TabOneLayerMask[PtEdge->GetLayer()] & masque_layer) == 0) continue;
Plot_1_EdgeModule(format_plot, PtEdge); Plot_1_EdgeModule(format_plot, PtEdge);
} }
/* Affichage du nombre de modules traites */ /* Affichage du nombre de modules traites */
@ -488,7 +488,7 @@ wxPoint pos;
wxSize size; wxSize size;
if( pt_texte->m_Text.IsEmpty() ) return; if( pt_texte->m_Text.IsEmpty() ) return;
if( (g_TabOneLayerMask[pt_texte->m_Layer] & masque_layer) == 0 ) return ; if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 ) return ;
/* calcul des parametres du texte :*/ /* calcul des parametres du texte :*/
size = pt_texte->m_Size; size = pt_texte->m_Size;
@ -615,7 +615,7 @@ wxPoint start, end;
int epaisseur; int epaisseur;
int rayon = 0, StAngle = 0, EndAngle = 0; int rayon = 0, StAngle = 0, EndAngle = 0;
if( (g_TabOneLayerMask[pt_segm->m_Layer] & masque_layer) == 0) return; if( (g_TabOneLayerMask[pt_segm->GetLayer()] & masque_layer) == 0) return;
epaisseur = pt_segm->m_Width; epaisseur = pt_segm->m_Width;
if ( Plot_Mode == FILAIRE) epaisseur = g_PlotLine_Width; if ( Plot_Mode == FILAIRE) epaisseur = g_PlotLine_Width;

View File

@ -194,7 +194,7 @@ wxString msg;
switch( PtStruct->m_StructType ) switch( PtStruct->m_StructType )
{ {
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
if( masque_layer & g_TabOneLayerMask[((EDGE_MODULE*)PtStruct)->m_Layer] ) if( masque_layer & g_TabOneLayerMask[((EDGE_MODULE*)PtStruct)->GetLayer()] )
Plot_1_EdgeModule(PLOT_FORMAT_GERBER, (EDGE_MODULE*) PtStruct); Plot_1_EdgeModule(PLOT_FORMAT_GERBER, (EDGE_MODULE*) PtStruct);
break; break;
@ -289,7 +289,7 @@ wxString msg;
wxPoint end; wxPoint end;
if ( track->m_StructType == TYPEVIA ) continue ; if ( track->m_StructType == TYPEVIA ) continue ;
if( (g_TabOneLayerMask[track->m_Layer] & masque_layer) == 0 ) continue; if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) continue;
size.x = size.y = track->m_Width; size.x = size.y = track->m_Width;
pos = track->m_Start; end = track->m_End; pos = track->m_Start; end = track->m_End;
@ -308,7 +308,7 @@ wxString msg;
{ {
wxPoint end; wxPoint end;
if( (g_TabOneLayerMask[track->m_Layer] & masque_layer) == 0 ) continue; if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) continue;
size.x = size.y = track->m_Width; size.x = size.y = track->m_Width;
pos = track->m_Start; end = track->m_End; pos = track->m_Start; end = track->m_End;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/*******************************/ /*******************************/
/* Dialog frame to swap layers */ /* Dialog frame to swap layers */
/*******************************/ /*******************************/
/* Fichier swap_layers */ /* Fichier swap_layers */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -14,11 +14,11 @@
static int New_Layer[32]; static int New_Layer[32];
enum swap_layer_id { enum swap_layer_id {
ID_SWAP_LAYER_EXECUTE = 1800, ID_SWAP_LAYER_EXECUTE = 1800,
ID_SWAP_LAYER_CANCEL, ID_SWAP_LAYER_CANCEL,
ID_SWAP_LAYER_BUTTON_SELECT, ID_SWAP_LAYER_BUTTON_SELECT,
ID_SWAP_LAYER_DESELECT, ID_SWAP_LAYER_DESELECT,
ID_SWAP_LAYER_SELECT ID_SWAP_LAYER_SELECT
}; };
@ -26,205 +26,220 @@ enum swap_layer_id {
/* classe pour la frame de selection de layers */ /* classe pour la frame de selection de layers */
/***********************************************/ /***********************************************/
class WinEDA_SwapLayerFrame: public wxDialog class WinEDA_SwapLayerFrame : public wxDialog
{ {
private: private:
WinEDA_BasePcbFrame *m_Parent; WinEDA_BasePcbFrame* m_Parent;
wxRadioBox * m_LayerList; wxRadioBox* m_LayerList;
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_SwapLayerFrame(WinEDA_BasePcbFrame *parent); WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame * parent );
~WinEDA_SwapLayerFrame(void) {}; ~WinEDA_SwapLayerFrame( void ) { };
private: private:
void Sel_Layer(wxCommandEvent& event); void Sel_Layer( wxCommandEvent& event );
void Cancel(wxCommandEvent& event); void Cancel( wxCommandEvent& event );
void Execute(wxCommandEvent& event); void Execute( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
}; };
/* Table des evenements pour WinEDA_SwapLayerFrame */ /* Table des evenements pour WinEDA_SwapLayerFrame */
BEGIN_EVENT_TABLE(WinEDA_SwapLayerFrame, wxDialog) BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog )
EVT_BUTTON(ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute) EVT_BUTTON( ID_SWAP_LAYER_EXECUTE, WinEDA_SwapLayerFrame::Execute )
EVT_BUTTON(ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel) EVT_BUTTON( ID_SWAP_LAYER_CANCEL, WinEDA_SwapLayerFrame::Cancel )
EVT_BUTTON(ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_BUTTON( ID_SWAP_LAYER_DESELECT, WinEDA_SwapLayerFrame::Sel_Layer )
EVT_BUTTON(ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_BUTTON( ID_SWAP_LAYER_BUTTON_SELECT, WinEDA_SwapLayerFrame::Sel_Layer )
EVT_RADIOBOX(ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer) EVT_RADIOBOX( ID_SWAP_LAYER_SELECT, WinEDA_SwapLayerFrame::Sel_Layer )
END_EVENT_TABLE() END_EVENT_TABLE()
/*************************************************************************/ /*************************************************************************/
WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame(WinEDA_BasePcbFrame *parent): WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) :
wxDialog(parent, -1, _("Swap Layers:"),wxPoint(-1,-1), wxDialog( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ),
wxSize(470, 450), DIALOG_STYLE ) wxSize( 470, 450 ), DIALOG_STYLE )
/*************************************************************************/ /*************************************************************************/
{ {
#define START_Y 15 #define START_Y 15
wxButton * Button; wxButton* Button;
int ii; int ii;
wxPoint pos; wxPoint pos;
wxString g_Layer_Name_Pair[32]; wxString g_Layer_Name_Pair[32];
wxSize winsize; wxSize winsize;
m_Parent = parent;
SetFont(*g_DialogFont);
for ( ii = 0; ii < NB_LAYERS; ii++ ) m_Parent = parent;
{ SetFont( *g_DialogFont );
g_Layer_Name_Pair[ii] = ReturnPcbLayerName(ii) + wxT(" -> ") + _("No Change");
}
pos.x = 5; pos.y = START_Y;
m_LayerList = new wxRadioBox(this, ID_SWAP_LAYER_SELECT, _("Layers"),
pos, wxSize(-1,-1), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS);
winsize.y = m_LayerList->GetRect().GetBottom();
pos.x = m_LayerList->GetRect().GetRight() + 12; for( ii = 0; ii < NB_LAYERS; ii++ )
Button = new wxButton(this,ID_SWAP_LAYER_CANCEL, {
_("Cancel"), pos); g_Layer_Name_Pair[ii] = ReturnPcbLayerName( ii ) + wxT( " -> " ) + _( "No Change" );
Button->SetForegroundColour(*wxRED); }
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
pos.y += Button->GetSize().y + 5; pos.x = 5; pos.y = START_Y;
Button = new wxButton(this,ID_SWAP_LAYER_EXECUTE, m_LayerList = new wxRadioBox( this, ID_SWAP_LAYER_SELECT, _( "Layers" ),
_("OK"), pos); pos,
Button->SetForegroundColour(*wxBLUE); wxSize( -1, -1 ), 29, g_Layer_Name_Pair, 16, wxRA_SPECIFY_ROWS );
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
pos.y += Button->GetSize().y + 15; winsize.y = m_LayerList->GetRect().GetBottom();
Button = new wxButton(this,ID_SWAP_LAYER_DESELECT,
_("Deselect"), pos);
Button->SetForegroundColour(wxColour(0,100,0));
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
pos.y += Button->GetSize().y + 5; pos.x = m_LayerList->GetRect().GetRight() + 12;
Button = new wxButton(this,ID_SWAP_LAYER_BUTTON_SELECT, Button = new wxButton( this, ID_SWAP_LAYER_CANCEL,
_("Select"), pos); _( "Cancel" ), pos );
Button->SetForegroundColour(wxColour(0,100,100));
winsize.x = MAX(winsize.x,Button->GetRect().GetRight());
winsize.x += 10; winsize.y += 10;
SetClientSize(winsize);
Button->SetForegroundColour( *wxRED );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
pos.y += Button->GetSize().y + 5;
Button = new wxButton( this, ID_SWAP_LAYER_EXECUTE,
_( "OK" ), pos );
Button->SetForegroundColour( *wxBLUE );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
pos.y += Button->GetSize().y + 15;
Button = new wxButton( this, ID_SWAP_LAYER_DESELECT,
_( "Deselect" ), pos );
Button->SetForegroundColour( wxColour( 0, 100, 0 ) );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
pos.y += Button->GetSize().y + 5;
Button = new wxButton( this, ID_SWAP_LAYER_BUTTON_SELECT,
_( "Select" ), pos );
Button->SetForegroundColour( wxColour( 0, 100, 100 ) );
winsize.x = MAX( winsize.x, Button->GetRect().GetRight() );
winsize.x += 10; winsize.y += 10;
SetClientSize( winsize );
} }
/***************************************************************/ /***************************************************************/
void WinEDA_SwapLayerFrame::Sel_Layer(wxCommandEvent& event) void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
/***************************************************************/ /***************************************************************/
{ {
int ii, jj; int ii, jj;
ii = m_LayerList->GetSelection(); ii = m_LayerList->GetSelection();
switch ( event.GetId()) switch( event.GetId() )
{ {
case ID_SWAP_LAYER_DESELECT: case ID_SWAP_LAYER_DESELECT:
if ( New_Layer[ii] != -1 ) if( New_Layer[ii] != -1 )
{ {
New_Layer[ii] = -1; New_Layer[ii] = -1;
m_LayerList->SetString(ii, ReturnPcbLayerName(ii) + m_LayerList->SetString( ii, ReturnPcbLayerName( ii ) +
+ wxT(" -> ") + _("No Change") ); + wxT( " -> " ) + _( "No Change" ) );
} }
break; break;
case ID_SWAP_LAYER_BUTTON_SELECT: case ID_SWAP_LAYER_BUTTON_SELECT:
case ID_SWAP_LAYER_SELECT: case ID_SWAP_LAYER_SELECT:
jj = m_Parent->SelectLayer(ii, -1, -1); jj = m_Parent->SelectLayer( ii, -1, -1 );
if ( (jj < 0) || (jj >= 29) ) return; if( (jj < 0) || (jj >= 29) )
return;
if ( ii != jj ) if( ii != jj )
{ {
New_Layer[ii] = jj; New_Layer[ii] = jj;
m_LayerList->SetString(ii, m_LayerList->SetString( ii,
ReturnPcbLayerName(ii) + wxT(" -> ") + ReturnPcbLayerName(jj) ); ReturnPcbLayerName( ii ) + wxT( " -> " ) +
} ReturnPcbLayerName( jj ) );
break; }
} break;
}
} }
/*********************************************************/
void WinEDA_SwapLayerFrame::Cancel(wxCommandEvent& event)
/*********************************************************/
{
EndModal(-1);
}
/*********************************************************/ /*********************************************************/
void WinEDA_SwapLayerFrame::Execute(wxCommandEvent& event) void WinEDA_SwapLayerFrame::Cancel( wxCommandEvent& event )
/*********************************************************/ /*********************************************************/
{ {
EndModal(1); EndModal( -1 );
}
/*********************************************************/
void WinEDA_SwapLayerFrame::Execute( wxCommandEvent& event )
/*********************************************************/
{
EndModal( 1 );
} }
/********************************************************/ /********************************************************/
void WinEDA_PcbFrame::Swap_Layers(wxCommandEvent & event) void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event )
/********************************************************/ /********************************************************/
/* Swap layers */ /* Swap layers */
{ {
int ii, jj ; int ii, jj;
TRACK * pt_segm ; TRACK* pt_segm;
DRAWSEGMENT * pt_drawsegm; DRAWSEGMENT* pt_drawsegm;
EDA_BaseStruct * PtStruct; EDA_BaseStruct* PtStruct;
/* Init default values */ /* Init default values */
for ( ii = 0 ; ii < 32 ; ii++ ) New_Layer[ii] = -1 ; for( ii = 0; ii < 32; ii++ )
New_Layer[ii] = -1;
WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this); WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this );
ii = frame->ShowModal(); frame->Destroy();
if ( ii != 1 ) return; ii = frame->ShowModal(); frame->Destroy();
/* Modifications des pistes */ if( ii != 1 )
pt_segm = (TRACK*) m_Pcb->m_Track; return;
for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext )
{
m_CurrentScreen->SetModify();
if( pt_segm->m_StructType == TYPEVIA )
{
SEGVIA * Via = (SEGVIA *) pt_segm;
if ( Via->Shape() == VIA_NORMALE ) continue;
int top_layer, bottom_layer;
Via->ReturnLayerPair(&top_layer, &bottom_layer);
if( New_Layer[bottom_layer] >= 0)
bottom_layer = New_Layer[bottom_layer];
if( New_Layer[top_layer] >= 0)
top_layer = New_Layer[top_layer];
Via->SetLayerPair(top_layer, bottom_layer);
}
else
{
jj = pt_segm->m_Layer;
if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj];
}
}
/* Modifications des zones */ /* Modifications des pistes */
pt_segm = (TRACK*) m_Pcb->m_Zone; pt_segm = (TRACK*) m_Pcb->m_Track;
for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext ) for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{ {
m_CurrentScreen->SetModify(); m_CurrentScreen->SetModify();
jj = pt_segm->m_Layer; if( pt_segm->m_StructType == TYPEVIA )
if( New_Layer[jj] >= 0) pt_segm->m_Layer = New_Layer[jj]; {
} SEGVIA* Via = (SEGVIA*) pt_segm;
if( Via->Shape() == VIA_NORMALE )
continue;
int top_layer, bottom_layer;
Via->ReturnLayerPair( &top_layer, &bottom_layer );
if( New_Layer[bottom_layer] >= 0 )
bottom_layer = New_Layer[bottom_layer];
if( New_Layer[top_layer] >= 0 )
top_layer = New_Layer[top_layer];
Via->SetLayerPair( top_layer, bottom_layer );
}
else
{
jj = pt_segm->GetLayer();
if( New_Layer[jj] >= 0 )
pt_segm->SetLayer( New_Layer[jj] );
}
}
/* Modifications des autres segments */ /* Modifications des zones */
PtStruct = m_Pcb->m_Drawings; pt_segm = (TRACK*) m_Pcb->m_Zone;
for ( ; PtStruct != NULL ; PtStruct = PtStruct->Pnext ) for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext )
{ {
if( PtStruct->m_StructType == TYPEDRAWSEGMENT ) m_CurrentScreen->SetModify();
{ jj = pt_segm->GetLayer();
m_CurrentScreen->SetModify(); if( New_Layer[jj] >= 0 )
pt_drawsegm = (DRAWSEGMENT *) PtStruct; pt_segm->SetLayer( New_Layer[jj] );
jj = pt_drawsegm->m_Layer; }
if( New_Layer[jj] >= 0) pt_drawsegm->m_Layer = New_Layer[jj];
} /* Modifications des autres segments */
} PtStruct = m_Pcb->m_Drawings;
DrawPanel->Refresh(TRUE); for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
if( PtStruct->m_StructType == TYPEDRAWSEGMENT )
{
m_CurrentScreen->SetModify();
pt_drawsegm = (DRAWSEGMENT*) PtStruct;
jj = pt_drawsegm->GetLayer();
if( New_Layer[jj] >= 0 )
pt_drawsegm->SetLayer( New_Layer[jj] );
}
}
DrawPanel->Refresh( TRUE );
} }

View File

@ -123,13 +123,13 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
if( !DisplayOpt.Show_Modules_Cmp ) if( !DisplayOpt.Show_Modules_Cmp )
{ {
if( Module->m_Layer == CMP_N ) if( Module->GetLayer() == CMP_N )
display = FALSE; display = FALSE;
MaskLay &= ~CMP_LAYER; MaskLay &= ~CMP_LAYER;
} }
if( !DisplayOpt.Show_Modules_Cu ) if( !DisplayOpt.Show_Modules_Cu )
{ {
if( Module->m_Layer == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
display = FALSE; display = FALSE;
MaskLay &= ~CUIVRE_LAYER; MaskLay &= ~CUIVRE_LAYER;
} }

View File

@ -1,7 +1,7 @@
/*********************************************/ /*********************************************/
/* Edition des pistes: Routines d'effacement */ /* Edition des pistes: Routines d'effacement */
/* Effacement de segment, piste, net et zone */ /* Effacement de segment, piste, net et zone */
/*********************************************/ /*********************************************/
#include "fctsys.h" #include "fctsys.h"
@ -10,392 +10,413 @@
#include "protos.h" #include "protos.h"
class TSTSEGM /* memorisation des segments marques */ class TSTSEGM /* memorisation des segments marques */
{ {
public: public:
TSTSEGM *Pnext, *Pback; TSTSEGM* Pnext, * Pback;
TRACK * RefTrack; TRACK* RefTrack;
public: public:
TSTSEGM(TRACK * Father) TSTSEGM( TRACK * Father ) {
{ Pback = Pnext = NULL;
Pback = Pnext = NULL; RefTrack = Father;
RefTrack = Father; }
}
}; };
/* Routines externes : */ /* Routines externes : */
void Montre_Position_New_Piste(int flag); /* defini dans editrack.cc */ void Montre_Position_New_Piste( int flag );/* defini dans editrack.cc */
/* Routines Locales */ /* Routines Locales */
static void Marque_Chaine_segments(BOARD * Pcb, wxPoint ref_pos, int masklayer); static void Marque_Chaine_segments( BOARD* Pcb, wxPoint ref_pos, int masklayer );
/* Variables locales */ /* Variables locales */
TSTSEGM * ListSegm = NULL; TSTSEGM* ListSegm = NULL;
/****************************************************************************/ /****************************************************************************/
TRACK * Marque_Une_Piste(WinEDA_BasePcbFrame * frame, wxDC * DC, TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC,
TRACK* pt_segm, int * nb_segm, int flagcolor) TRACK* pt_segm, int* nb_segm, int flagcolor )
/****************************************************************************/ /****************************************************************************/
/* Routine de Marquage de 1 piste, a partir du segment pointe par pt_segm. /* Routine de Marquage de 1 piste, a partir du segment pointe par pt_segm.
le segment pointe est marque puis les segments connectes * le segment pointe est marque puis les segments connectes
jusqu'a un pad ou un point de jonction de plus de 2 segments * jusqu'a un pad ou un point de jonction de plus de 2 segments
le marquage est la mise a 1 du bit BUSY * le marquage est la mise a 1 du bit BUSY
Les segments sont ensuite reclasses pour etre contigus en liste chainee * Les segments sont ensuite reclasses pour etre contigus en liste chainee
Retourne: * Retourne:
adresse du 1er segment de la chaine creee * adresse du 1er segment de la chaine creee
nombre de segments * nombre de segments
*/ */
{ {
int NbSegmBusy, masque_layer; int NbSegmBusy, masque_layer;
TRACK *Track, *FirstTrack, *NextTrack; TRACK* Track, * FirstTrack, * NextTrack;
TSTSEGM * Segm, * NextSegm; TSTSEGM* Segm, * NextSegm;
*nb_segm = 0; *nb_segm = 0;
if (pt_segm == NULL ) return(NULL) ; if( pt_segm == NULL )
return NULL;
/* Marquage du segment pointe */ /* Marquage du segment pointe */
if(flagcolor) pt_segm->Draw(frame->DrawPanel, DC, flagcolor); if( flagcolor )
pt_segm->Draw( frame->DrawPanel, DC, flagcolor );
pt_segm->SetState(BUSY,ON); pt_segm->SetState( BUSY, ON );
masque_layer = pt_segm->ReturnMaskLayer(); masque_layer = pt_segm->ReturnMaskLayer();
ListSegm = new TSTSEGM(pt_segm); ListSegm = new TSTSEGM( pt_segm );
/* Traitement du segment pointe : si c'est un segment, le cas est simple. /* Traitement du segment pointe : si c'est un segment, le cas est simple.
Si c'est une via, on doit examiner le nombre de segments connectes. * Si c'est une via, on doit examiner le nombre de segments connectes.
Si <=2, on doit detecter une piste, si > 2 seule la via est marquee * Si <=2, on doit detecter une piste, si > 2 seule la via est marquee
*/ */
if( pt_segm->m_StructType == TYPEVIA) if( pt_segm->m_StructType == TYPEVIA )
{ {
TRACK * Segm1, *Segm2 = NULL, *Segm3 =NULL; TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL;
Segm1 = Fast_Locate_Piste(frame->m_Pcb->m_Track,NULL, Segm1 = Fast_Locate_Piste( frame->m_Pcb->m_Track, NULL,
pt_segm->m_Start, masque_layer); pt_segm->m_Start, masque_layer );
if(Segm1) if( Segm1 )
{ {
Segm2 = Fast_Locate_Piste((TRACK*)Segm1->Pnext,NULL, Segm2 = Fast_Locate_Piste( (TRACK*) Segm1->Pnext, NULL,
pt_segm->m_Start, masque_layer); pt_segm->m_Start, masque_layer );
} }
if( Segm2 ) if( Segm2 )
{ {
Segm3 = Fast_Locate_Piste((TRACK*)Segm2->Pnext,NULL, Segm3 = Fast_Locate_Piste( (TRACK*) Segm2->Pnext, NULL,
pt_segm->m_Start, masque_layer); pt_segm->m_Start, masque_layer );
} }
if(Segm3) if( Segm3 )
{ {
*nb_segm = 1; return (pt_segm); *nb_segm = 1; return pt_segm;
} }
if(Segm1) if( Segm1 )
{ {
masque_layer = Segm1->ReturnMaskLayer(); masque_layer = Segm1->ReturnMaskLayer();
Marque_Chaine_segments(frame->m_Pcb, pt_segm->m_Start, masque_layer); Marque_Chaine_segments( frame->m_Pcb, pt_segm->m_Start, masque_layer );
} }
if(Segm2) if( Segm2 )
{ {
masque_layer = Segm2->ReturnMaskLayer(); masque_layer = Segm2->ReturnMaskLayer();
Marque_Chaine_segments(frame->m_Pcb, pt_segm->m_Start, masque_layer); Marque_Chaine_segments( frame->m_Pcb, pt_segm->m_Start, masque_layer );
} }
} }
else /* Marquage de la chaine connectee aux extremites du segment */ else /* Marquage de la chaine connectee aux extremites du segment */
{ {
Marque_Chaine_segments(frame->m_Pcb, pt_segm->m_Start, masque_layer); Marque_Chaine_segments( frame->m_Pcb, pt_segm->m_Start, masque_layer );
Marque_Chaine_segments(frame->m_Pcb, pt_segm->m_End, masque_layer); Marque_Chaine_segments( frame->m_Pcb, pt_segm->m_End, masque_layer );
} }
/* marquage des vias (vias non connectees ou inutiles */ /* marquage des vias (vias non connectees ou inutiles */
for( Segm = ListSegm; Segm != NULL; Segm = Segm->Pnext ) for( Segm = ListSegm; Segm != NULL; Segm = Segm->Pnext )
{ {
int layer; int layer;
if( Segm->RefTrack->m_StructType != TYPEVIA ) continue; if( Segm->RefTrack->m_StructType != TYPEVIA )
if( Segm->RefTrack == pt_segm ) continue; continue;
Segm->RefTrack->SetState(BUSY,ON); if( Segm->RefTrack == pt_segm )
masque_layer = Segm->RefTrack->ReturnMaskLayer(); continue;
Track = Fast_Locate_Piste(frame->m_Pcb->m_Track,NULL, Segm->RefTrack->SetState( BUSY, ON );
Segm->RefTrack->m_Start, masque_layer = Segm->RefTrack->ReturnMaskLayer();
masque_layer); Track = Fast_Locate_Piste( frame->m_Pcb->m_Track, NULL,
if( Track == NULL ) continue; Segm->RefTrack->m_Start,
/* Test des connexions: si via utile: suppression marquage */ masque_layer );
layer = Track->m_Layer; if( Track == NULL )
while ( (Track = Fast_Locate_Piste((TRACK*)Track->Pnext,NULL, continue;
Segm->RefTrack->m_Start, /* Test des connexions: si via utile: suppression marquage */
masque_layer)) != NULL ) layer = Track->GetLayer();
{ while( ( Track = Fast_Locate_Piste( (TRACK*) Track->Pnext, NULL,
if( layer != Track->m_Layer ) Segm->RefTrack->m_Start,
{ masque_layer ) ) != NULL )
Segm->RefTrack->SetState(BUSY,OFF); {
break; if( layer != Track->GetLayer() )
} {
} Segm->RefTrack->SetState( BUSY, OFF );
} break;
}
}
}
/* liberation memoire */ /* liberation memoire */
for( Segm = ListSegm; Segm != NULL; Segm = NextSegm ) for( Segm = ListSegm; Segm != NULL; Segm = NextSegm )
{ {
NextSegm = Segm->Pnext; delete Segm; NextSegm = Segm->Pnext; delete Segm;
} }
ListSegm = NULL;
/* Reclassement des segments marques en une chaine */ ListSegm = NULL;
FirstTrack = frame->m_Pcb->m_Track; NbSegmBusy = 0;
for ( ; FirstTrack != NULL; FirstTrack = (TRACK*)FirstTrack->Pnext )
{ /* recherche du debut de la liste des segments marques a BUSY */
if ( FirstTrack->GetState(BUSY) )
{
NbSegmBusy = 1; break;
}
}
/* Reclassement de la chaine debutant a FirstTrack et finissant /* Reclassement des segments marques en une chaine */
au dernier segment marque. FirstTrack n'est pas modifie */ FirstTrack = frame->m_Pcb->m_Track; NbSegmBusy = 0;
Track = (TRACK*)FirstTrack->Pnext; for( ; FirstTrack != NULL; FirstTrack = (TRACK*) FirstTrack->Pnext )
for ( ; Track != NULL; Track = NextTrack) { /* recherche du debut de la liste des segments marques a BUSY */
{ if( FirstTrack->GetState( BUSY ) )
NextTrack = (TRACK*) Track->Pnext; {
if ( Track->GetState(BUSY) ) NbSegmBusy = 1; break;
{ }
NbSegmBusy++; }
Track->UnLink();
Track->Insert(frame->m_Pcb, FirstTrack);
}
}
*nb_segm = NbSegmBusy; /* Reclassement de la chaine debutant a FirstTrack et finissant
* au dernier segment marque. FirstTrack n'est pas modifie */
Track = (TRACK*) FirstTrack->Pnext;
for( ; Track != NULL; Track = NextTrack )
{
NextTrack = (TRACK*) Track->Pnext;
if( Track->GetState( BUSY ) )
{
NbSegmBusy++;
Track->UnLink();
Track->Insert( frame->m_Pcb, FirstTrack );
}
}
if(flagcolor) Trace_Une_Piste(frame->DrawPanel, DC, FirstTrack,NbSegmBusy,flagcolor); *nb_segm = NbSegmBusy;
return(FirstTrack); if( flagcolor )
Trace_Une_Piste( frame->DrawPanel, DC, FirstTrack, NbSegmBusy, flagcolor );
return FirstTrack;
} }
/********************************************************************************/ /********************************************************************************/
static void Marque_Chaine_segments(BOARD * Pcb, wxPoint ref_pos, int masque_layer) static void Marque_Chaine_segments( BOARD* Pcb, wxPoint ref_pos, int masque_layer )
/********************************************************************************/ /********************************************************************************/
/* /*
routine utilisee par Supprime_1_Piste() * routine utilisee par Supprime_1_Piste()
Positionne le bit BUSY dans la chaine de segments commencant * Positionne le bit BUSY dans la chaine de segments commencant
au point ox, oy sur la couche layer * au point ox, oy sur la couche layer
*
Les vias sont mises en liste des segments traites mais ne sont pas * Les vias sont mises en liste des segments traites mais ne sont pas
marquees. * marquees.
*/ */
{ {
TRACK *pt_segm, // Pointe le segment courant analyse TRACK* pt_segm, // Pointe le segment courant analyse
* pt_via, // pointe la via reperee, eventuellement a detruire * pt_via, // pointe la via reperee, eventuellement a detruire
* MarqSegm; // pointe le segment a detruire (= NULL ou pt_segm * MarqSegm; // pointe le segment a detruire (= NULL ou pt_segm
int NbSegm; int NbSegm;
TSTSEGM * Segm; TSTSEGM* Segm;
if(Pcb->m_Track == NULL) return; if( Pcb->m_Track == NULL )
return;
/* Marquage de la chaine */ /* Marquage de la chaine */
for( ; ; ) for( ; ; )
{ {
if( Fast_Locate_Pad_Connecte(Pcb, ref_pos,masque_layer) != NULL ) return; if( Fast_Locate_Pad_Connecte( Pcb, ref_pos, masque_layer ) != NULL )
return;
/* Localisation d'une via (car elle connecte plusieurs segments) */ /* Localisation d'une via (car elle connecte plusieurs segments) */
pt_via = Fast_Locate_Via(Pcb->m_Track, NULL, ref_pos, masque_layer); pt_via = Fast_Locate_Via( Pcb->m_Track, NULL, ref_pos, masque_layer );
if(pt_via) if( pt_via )
{ {
if(pt_via->GetState(EDIT)) return; if( pt_via->GetState( EDIT ) )
masque_layer = pt_via->ReturnMaskLayer(); return;
Segm = new TSTSEGM(pt_via); masque_layer = pt_via->ReturnMaskLayer();
Segm->Pnext = ListSegm; Segm = new TSTSEGM( pt_via );
ListSegm->Pback = Segm;
ListSegm = Segm;
}
/* Recherche des segments connectes au point ref_pos Segm->Pnext = ListSegm;
si 1 segment: peut etre marque ListSegm->Pback = Segm;
si > 1 segment: ListSegm = Segm;
le segment ne peut etre marque }
*/
pt_segm =Pcb->m_Track; MarqSegm = NULL;
NbSegm = 0;
while( (pt_segm = Fast_Locate_Piste(pt_segm, NULL,
ref_pos,masque_layer) ) != NULL )
{
if(pt_segm->GetState(EDIT)) /* Fin de piste */
return;
if(pt_segm->GetState(BUSY) ) /* Recherche des segments connectes au point ref_pos
{ * si 1 segment: peut etre marque
pt_segm = (TRACK*)pt_segm->Pnext; * si > 1 segment:
continue; * le segment ne peut etre marque
} */
pt_segm = Pcb->m_Track; MarqSegm = NULL;
NbSegm = 0;
while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL,
ref_pos, masque_layer ) ) != NULL )
{
if( pt_segm->GetState( EDIT ) ) /* Fin de piste */
return;
if( pt_segm == pt_via) /* deja traite */ if( pt_segm->GetState( BUSY ) )
{ {
pt_segm = (TRACK*)pt_segm->Pnext; pt_segm = (TRACK*) pt_segm->Pnext;
continue; continue;
} }
NbSegm++; if( pt_segm == pt_via ) /* deja traite */
if( NbSegm == 1 ) /* 1ere detection de segment de piste */ {
{ pt_segm = (TRACK*) pt_segm->Pnext;
MarqSegm = pt_segm; continue;
pt_segm = (TRACK*)pt_segm->Pnext; }
}
else /* 2eme detection de segment -> fin de piste */
{
return;
}
}
if( MarqSegm ) NbSegm++;
{ if( NbSegm == 1 ) /* 1ere detection de segment de piste */
/* preparation de la nouvelle recherche */ {
masque_layer = MarqSegm->ReturnMaskLayer(); MarqSegm = pt_segm;
if( ref_pos == MarqSegm->m_Start ) pt_segm = (TRACK*) pt_segm->Pnext;
{ }
ref_pos = MarqSegm->m_End; else /* 2eme detection de segment -> fin de piste */
} {
else { return;
ref_pos = MarqSegm->m_Start; }
} }
pt_segm = Pcb->m_Track; /* reinit recherche des segments */ if( MarqSegm )
{
/* preparation de la nouvelle recherche */
masque_layer = MarqSegm->ReturnMaskLayer();
if( ref_pos == MarqSegm->m_Start )
{
ref_pos = MarqSegm->m_End;
}
else
{
ref_pos = MarqSegm->m_Start;
}
/* Marquage et mise en liste du segment */ pt_segm = Pcb->m_Track; /* reinit recherche des segments */
Segm = new TSTSEGM(MarqSegm);
Segm->Pnext = ListSegm; /* Marquage et mise en liste du segment */
ListSegm->Pback = Segm; Segm = new TSTSEGM( MarqSegm );
ListSegm = Segm;
MarqSegm->SetState(BUSY,ON); Segm->Pnext = ListSegm;
} ListSegm->Pback = Segm;
else return; ListSegm = Segm;
} MarqSegm->SetState( BUSY, ON );
}
else
return;
}
} }
/********************************************************/ /********************************************************/
int ReturnEndsTrack(TRACK* RefTrack, int NbSegm, int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
TRACK ** StartTrack, TRACK ** EndTrack) TRACK** StartTrack, TRACK** EndTrack )
/**********************************************************/ /**********************************************************/
/* Calcule les coordonnes des extremites d'une piste /* Calcule les coordonnes des extremites d'une piste
retourne 1 si OK, 0 si piste bouclee * retourne 1 si OK, 0 si piste bouclee
Retourne dans *StartTrack en *EndTrack les segments de debut et fin * Retourne dans *StartTrack en *EndTrack les segments de debut et fin
Les coord StartTrack->m_Start.x, m_Start.y contiennent le debut de la piste * Les coord StartTrack->m_Start.x, m_Start.y contiennent le debut de la piste
Les coord EndTrack->m_End.x, m_End.y contiennent le debut de la piste * Les coord EndTrack->m_End.x, m_End.y contiennent le debut de la piste
Les segments sont supposes chaines de facon consecutive * Les segments sont supposes chaines de facon consecutive
*/ */
{ {
TRACK * Track, *via, *segm, * TrackListEnd; TRACK* Track, * via, * segm, * TrackListEnd;
int NbEnds, masque_layer, ii, ok = 0; int NbEnds, masque_layer, ii, ok = 0;
if( NbSegm <= 1 ) if( NbSegm <= 1 )
{ {
*StartTrack = *EndTrack = RefTrack; *StartTrack = *EndTrack = RefTrack;
return(1); /* cas trivial */ return 1; /* cas trivial */
} }
/* calcul de la limite d'analyse */ /* calcul de la limite d'analyse */
*StartTrack = *EndTrack = NULL; *StartTrack = *EndTrack = NULL;
TrackListEnd = Track = RefTrack; ii = 0; TrackListEnd = Track = RefTrack; ii = 0;
for( ; (Track != NULL) && (ii < NbSegm); ii++, Track = (TRACK*)Track->Pnext) for( ; (Track != NULL) && (ii < NbSegm); ii++, Track = (TRACK*) Track->Pnext )
{ {
TrackListEnd = Track; TrackListEnd = Track;
Track->m_Param = 0; Track->m_Param = 0;
} }
/* Calcul des extremites */ /* Calcul des extremites */
NbEnds = 0; Track = RefTrack; ii = 0; NbEnds = 0; Track = RefTrack; ii = 0;
for( ; (Track != NULL) && (ii < NbSegm); ii++, Track = (TRACK*)Track->Pnext) for( ; (Track != NULL) && (ii < NbSegm); ii++, Track = (TRACK*) Track->Pnext )
{ {
if(Track->m_StructType == TYPEVIA) continue; if( Track->m_StructType == TYPEVIA )
continue;
masque_layer = Track->ReturnMaskLayer(); masque_layer = Track->ReturnMaskLayer();
via = Fast_Locate_Via(RefTrack, TrackListEnd, via = Fast_Locate_Via( RefTrack, TrackListEnd,
Track->m_Start, masque_layer); Track->m_Start, masque_layer );
if( via ) if( via )
{ {
masque_layer |= via->ReturnMaskLayer(); masque_layer |= via->ReturnMaskLayer();
via->SetState(BUSY,ON); via->SetState( BUSY, ON );
} }
Track->SetState(BUSY,ON); Track->SetState( BUSY, ON );
segm = Fast_Locate_Piste(RefTrack, TrackListEnd, segm = Fast_Locate_Piste( RefTrack, TrackListEnd,
Track->m_Start, masque_layer); Track->m_Start, masque_layer );
Track->SetState(BUSY,OFF); Track->SetState( BUSY, OFF );
if(via) via->SetState(BUSY,OFF); if( via )
via->SetState( BUSY, OFF );
if( segm == NULL ) if( segm == NULL )
{ {
switch(NbEnds) switch( NbEnds )
{ {
case 0: case 0:
*StartTrack = Track; NbEnds++; *StartTrack = Track; NbEnds++;
break; break;
case 1: case 1:
int BeginPad, EndPad; int BeginPad, EndPad;
*EndTrack = Track; *EndTrack = Track;
/* permutation de ox,oy avec fx,fy */ /* permutation de ox,oy avec fx,fy */
BeginPad = Track->GetState(BEGIN_ONPAD); BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState(END_ONPAD); EndPad = Track->GetState( END_ONPAD );
Track->SetState(BEGIN_ONPAD|END_ONPAD, OFF); Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
if( BeginPad ) if( BeginPad )
Track->SetState(END_ONPAD, ON); Track->SetState( END_ONPAD, ON );
if( EndPad ) if( EndPad )
Track->SetState(BEGIN_ONPAD, ON); Track->SetState( BEGIN_ONPAD, ON );
EXCHG(Track->m_Start,Track->m_End); EXCHG( Track->m_Start, Track->m_End );
EXCHG(Track->start,Track->end); EXCHG( Track->start, Track->end );
ok = 1; return(ok); ok = 1; return ok;
} }
} }
masque_layer = Track->ReturnMaskLayer(); masque_layer = Track->ReturnMaskLayer();
via = Fast_Locate_Via(RefTrack, TrackListEnd, via = Fast_Locate_Via( RefTrack, TrackListEnd,
Track->m_End, masque_layer); Track->m_End, masque_layer );
if( via ) if( via )
{ {
masque_layer |= via->ReturnMaskLayer(); masque_layer |= via->ReturnMaskLayer();
via->SetState(BUSY,ON); via->SetState( BUSY, ON );
} }
Track->SetState(BUSY,ON); Track->SetState( BUSY, ON );
segm = Fast_Locate_Piste(RefTrack, TrackListEnd, segm = Fast_Locate_Piste( RefTrack, TrackListEnd,
Track->m_End, masque_layer); Track->m_End, masque_layer );
Track->SetState(BUSY,OFF); Track->SetState( BUSY, OFF );
if (via) via->SetState(BUSY,OFF); if( via )
if ( segm == NULL ) via->SetState( BUSY, OFF );
{ if( segm == NULL )
switch(NbEnds) {
{ switch( NbEnds )
case 0: {
int BeginPad, EndPad; case 0:
*StartTrack = Track; NbEnds++; int BeginPad, EndPad;
/* permutation de ox,oy avec fx,fy */ *StartTrack = Track; NbEnds++;
BeginPad = Track->GetState(BEGIN_ONPAD); /* permutation de ox,oy avec fx,fy */
EndPad = Track->GetState(END_ONPAD); BeginPad = Track->GetState( BEGIN_ONPAD );
Track->SetState(BEGIN_ONPAD|END_ONPAD, OFF); EndPad = Track->GetState( END_ONPAD );
if( BeginPad ) Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
Track->SetState(END_ONPAD, ON); if( BeginPad )
if( EndPad ) Track->SetState( END_ONPAD, ON );
Track->SetState(BEGIN_ONPAD, ON); if( EndPad )
EXCHG(Track->m_Start,Track->m_End); Track->SetState( BEGIN_ONPAD, ON );
EXCHG(Track->start,Track->end); EXCHG( Track->m_Start, Track->m_End );
break; EXCHG( Track->start, Track->end );
break;
case 1: case 1:
*EndTrack = Track; *EndTrack = Track;
ok = 1; return(ok); ok = 1; return ok;
} }
} }
} }
return(ok); return ok;
} }
/***************************************************************************/ /***************************************************************************/
void ListSetState(EDA_BaseStruct * Start, int NbItem,int State, int onoff) void ListSetState( EDA_BaseStruct* Start, int NbItem, int State, int onoff )
/***************************************************************************/ /***************************************************************************/
/* Met a jour le membre .state d'une chaine de structures /* Met a jour le membre .state d'une chaine de structures
*/ */
{ {
if(Start == NULL ) return; if( Start == NULL )
for( ; (Start != NULL) && (NbItem > 0); NbItem-- , Start = Start->Pnext ) return;
{ for( ; (Start != NULL) && (NbItem > 0); NbItem--, Start = Start->Pnext )
Start->SetState(State,onoff); {
} Start->SetState( State, onoff );
}
} }

View File

@ -14,148 +14,158 @@
/* variables locales : */ /* variables locales : */
/*********************************************************************************/ /*********************************************************************************/
void Trace_Pistes(WinEDA_DrawPanel * panel, BOARD * Pcb, wxDC * DC, int drawmode) void Trace_Pistes( WinEDA_DrawPanel* panel, BOARD* Pcb, wxDC* DC, int drawmode )
/********************************************************************************/ /********************************************************************************/
/* Draw all tracks and zones. /* Draw all tracks and zones.
*/ */
{ {
TRACK * track; TRACK* track;
track = Pcb->m_Track; track = Pcb->m_Track;
for ( ; track != NULL ; track = track->Next() ) for( ; track != NULL; track = track->Next() )
{ {
track->Draw(panel, DC, drawmode); track->Draw( panel, DC, drawmode );
} }
track = Pcb->m_Zone; track = Pcb->m_Zone;
for ( ; track != NULL ; track = track->Next() ) for( ; track != NULL; track = track->Next() )
{ {
track->Draw(panel, DC, drawmode); track->Draw( panel, DC, drawmode );
} }
} }
/************************************************************************/
void Trace_Une_Piste( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* Track,
int nbsegment, int draw_mode )
/************************************************************************/
/************************************************************************/
void Trace_Une_Piste(WinEDA_DrawPanel * panel, wxDC * DC, TRACK * Track,
int nbsegment, int draw_mode)
/************************************************************************/
/* routine de trace de n segments consecutifs en memoire. /* routine de trace de n segments consecutifs en memoire.
Utile pour monter une piste en cours de trace car les segments de cette * Utile pour monter une piste en cours de trace car les segments de cette
piste sont alors contigus en memoire * piste sont alors contigus en memoire
Parametres : * Parametres :
pt_start_piste = adresse de depart de la liste des segments * pt_start_piste = adresse de depart de la liste des segments
nbsegment = nombre de segments a tracer * nbsegment = nombre de segments a tracer
draw_mode = mode ( GR_XOR, GR_OR..) * draw_mode = mode ( GR_XOR, GR_OR..)
ATTENTION: * ATTENTION:
le point de depart d'une piste suivante DOIT exister: peut etre * le point de depart d'une piste suivante DOIT exister: peut etre
donc mis a 0 avant appel a la routine si la piste a tracer est la derniere * donc mis a 0 avant appel a la routine si la piste a tracer est la derniere
*/ */
{ {
if ( Track == NULL ) return; if( Track == NULL )
for ( ;nbsegment > 0; nbsegment--, Track = (TRACK*)Track->Pnext) return;
{ for( ; nbsegment > 0; nbsegment--, Track = (TRACK*) Track->Pnext )
if ( Track == NULL ) break; {
Track->Draw(panel, DC, draw_mode) ; if( Track == NULL )
} break;
Track->Draw( panel, DC, draw_mode );
}
} }
/*************************************************************/ /*************************************************************/
void Trace_DrawSegmentPcb(WinEDA_DrawPanel * panel, wxDC * DC, void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
DRAWSEGMENT * PtDrawSegment, int draw_mode) DRAWSEGMENT* PtDrawSegment, int draw_mode )
/*************************************************************/ /*************************************************************/
/* Affichage d'un segment type drawing PCB: /* Affichage d'un segment type drawing PCB:
draw_mode = mode de trace ( GR_OR, GR_XOR, GrAND) * draw_mode = mode de trace ( GR_OR, GR_XOR, GrAND)
Les contours sont de differents type: * Les contours sont de differents type:
segment * segment
cercle * cercle
arc * arc
*/ */
{ {
int ux0, uy0, dx, dy; int ux0, uy0, dx, dy;
int l_piste; int l_piste;
int color, mode; int color, mode;
int zoom; int zoom;
int rayon; int rayon;
color = g_DesignSettings.m_LayerColor[PtDrawSegment->m_Layer]; color = g_DesignSettings.m_LayerColor[PtDrawSegment->GetLayer()];
if(color & ITEM_NOT_SHOW ) return ; if( color & ITEM_NOT_SHOW )
return;
if ( panel ) zoom = panel->GetZoom(); if( panel )
else zoom = ActiveScreen->GetZoom(); zoom = panel->GetZoom();
else
zoom = ActiveScreen->GetZoom();
GRSetDrawMode(DC, draw_mode); GRSetDrawMode( DC, draw_mode );
l_piste = PtDrawSegment->m_Width >> 1; /* l_piste = demi largeur piste */ l_piste = PtDrawSegment->m_Width >> 1; /* l_piste = demi largeur piste */
/* coord de depart */ /* coord de depart */
ux0 = PtDrawSegment->m_Start.x; ux0 = PtDrawSegment->m_Start.x;
uy0 = PtDrawSegment->m_Start.y; uy0 = PtDrawSegment->m_Start.y;
/* coord d'arrivee */ /* coord d'arrivee */
dx = PtDrawSegment->m_End.x; dx = PtDrawSegment->m_End.x;
dy = PtDrawSegment->m_End.y; dy = PtDrawSegment->m_End.y;
mode = DisplayOpt.DisplayDrawItems; mode = DisplayOpt.DisplayDrawItems;
if(PtDrawSegment->m_Flags & FORCE_SKETCH) mode = SKETCH; if( PtDrawSegment->m_Flags & FORCE_SKETCH )
if ( l_piste < (L_MIN_DESSIN * zoom) ) mode = FILAIRE; mode = SKETCH;
if( l_piste < (L_MIN_DESSIN * zoom) )
mode = FILAIRE;
switch (PtDrawSegment->m_Shape) switch( PtDrawSegment->m_Shape )
{ {
case S_CIRCLE: case S_CIRCLE:
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) ); rayon = (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, rayon, 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, rayon - l_piste, color );
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon+l_piste, color); GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon + l_piste, color );
} }
else else
{ {
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, PtDrawSegment->m_Width,color); GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, PtDrawSegment->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) ); rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
StAngle = (int) ArcTangente(dy-uy0, dx-ux0); StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + PtDrawSegment->m_Angle; EndAngle = StAngle + PtDrawSegment->m_Angle;
if ( StAngle > EndAngle) EXCHG (StAngle, EndAngle); if( StAngle > EndAngle )
if ( mode == FILAIRE) EXCHG( StAngle, EndAngle );
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color); if( mode == FILAIRE )
else if( mode == SKETCH) GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color );
{ else if( mode == SKETCH )
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, {
rayon - l_piste, color); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon - l_piste, color );
rayon + l_piste, color); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
} rayon + l_piste, color );
else }
{ else
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, {
rayon, PtDrawSegment->m_Width,color); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
} rayon, PtDrawSegment->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,
PtDrawSegment->m_Width, color) ; PtDrawSegment->m_Width, color );
} }
else else
{ {
GRFillCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
PtDrawSegment->m_Width, color) ; PtDrawSegment->m_Width, color );
} }
break; break;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -683,7 +683,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( void )
newedge->Pback = oldedge; newedge->Pback = oldedge;
if( oldedge ) if( oldedge )
oldedge->Pnext = newedge; oldedge->Pnext = newedge;
newedge->m_Layer = GetScreen()->m_Active_Layer; newedge->SetLayer( GetScreen()->m_Active_Layer );
newedge->m_Width = 2; /* Largeur minimum tracable */ newedge->m_Width = 2; /* Largeur minimum tracable */
newedge->m_Start = newedge->m_End = GetScreen()->m_Curseur; newedge->m_Start = newedge->m_End = GetScreen()->m_Curseur;
@ -702,7 +702,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( void )
oldedge->Pnext = newedge; oldedge->Pnext = newedge;
newedge->m_Flags = IS_NEW | IS_MOVED; newedge->m_Flags = IS_NEW | IS_MOVED;
newedge->m_Start = newedge->m_End = oldedge->m_End; newedge->m_Start = newedge->m_End = oldedge->m_End;
newedge->m_Layer = GetScreen()->m_Active_Layer; newedge->SetLayer( GetScreen()->m_Active_Layer );
m_Pcb->m_CurrentLimitZone = newedge; m_Pcb->m_CurrentLimitZone = newedge;
} }
} }
@ -777,7 +777,7 @@ static void Show_Zone_Edge_While_MoveMouse( WinEDA_DrawPanel* panel, wxDC* DC, b
edgezone = PtLim = pcbframe->m_Pcb->m_CurrentLimitZone; edgezone = PtLim = pcbframe->m_Pcb->m_CurrentLimitZone;
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback ) for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
{ {
PtLim->m_Layer = pcbframe->GetScreen()->m_Active_Layer; PtLim->SetLayer( pcbframe->GetScreen()->m_Active_Layer );
} }
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */ /* dessin de la nouvelle piste : mise a jour du point d'arrivee */
@ -849,7 +849,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback ) for( ; PtLim != NULL; PtLim = (EDGE_ZONE*) PtLim->Pback )
{ {
Trace_DrawSegmentPcb( DrawPanel, DC, PtLim, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, PtLim, GR_XOR );
PtLim->m_Layer = GetScreen()->m_Active_Layer; PtLim->SetLayer( GetScreen()->m_Active_Layer );
Trace_DrawSegmentPcb( DrawPanel, DC, PtLim, GR_XOR ); Trace_DrawSegmentPcb( DrawPanel, DC, PtLim, GR_XOR );
} }
@ -922,7 +922,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC )
{ {
if( g_HightLigth_NetCode != pt_segm->m_NetCode ) if( g_HightLigth_NetCode != pt_segm->m_NetCode )
continue; continue;
if( pt_segm->m_Layer != GetScreen()->m_Active_Layer ) if( pt_segm->GetLayer() != GetScreen()->m_Active_Layer )
continue; continue;
if( pt_segm->m_StructType != TYPETRACK ) if( pt_segm->m_StructType != TYPETRACK )
continue; continue;
@ -1086,7 +1086,7 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
{ {
/* un segment avait debute de longueur > 0 */ /* un segment avait debute de longueur > 0 */
pt_track = new SEGZONE( frame->m_Pcb ); pt_track = new SEGZONE( frame->m_Pcb );
pt_track->m_Layer = layer; pt_track->SetLayer( layer );
pt_track->m_NetCode = net_code; pt_track->m_NetCode = net_code;
pt_track->m_Width = g_GridRoutingSize; pt_track->m_Width = g_GridRoutingSize;
pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0; pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0;
@ -1124,7 +1124,7 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
{ {
/* un segment avait debute de longueur > 0 */ /* un segment avait debute de longueur > 0 */
pt_track = new SEGZONE( frame->m_Pcb ); pt_track = new SEGZONE( frame->m_Pcb );
pt_track->m_Layer = layer; pt_track->SetLayer( layer );
pt_track->m_Width = g_GridRoutingSize; pt_track->m_Width = g_GridRoutingSize;
pt_track->m_NetCode = net_code; pt_track->m_NetCode = net_code;
pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0; pt_track->m_Start.x = ux0; pt_track->m_Start.y = uy0;
@ -1363,7 +1363,7 @@ static bool Genere_Pad_Connexion( WinEDA_PcbFrame* frame, wxDC* DC, int layer )
pt_track = new SEGZONE( frame->m_Pcb ); pt_track = new SEGZONE( frame->m_Pcb );
pt_track->m_Layer = layer; pt_track->SetLayer( layer );
pt_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; pt_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
pt_track->m_NetCode = g_HightLigth_NetCode; pt_track->m_NetCode = g_HightLigth_NetCode;
pt_track->start = pt_pad; pt_track->start = pt_pad;