7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 22:51:40 +00:00

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;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[track->m_Layer];
int layer = track->m_Layer;
int layer = track->GetLayer();
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
double ox, oy, fx, fy;
double w;
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];
SetGLColor(color);
@ -268,7 +269,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment(DRAWSEGMENT * segment)
int layer;
double x, y, xf, yf;
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;
@ -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;
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++ )
{
@ -291,7 +292,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->m_Layer];
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);
}
}

View File

@ -5,16 +5,36 @@ Please add newer entries at the top, list the date and your name with
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>
================================================================================
+ 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
but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
* Since so many classes introduced m_Layer, I moved m_Layer into
EDA_BaseStruct so all classes can inherit it and that way we can test
layer using a general, polymorphic test, i.e. don't have to cast a
EDA_BaseStruct* to a class specific pointer to test layer. Could also have
used a virtual function but too many places use m_Layer directly.
* Wedged a new class BOARD_ITEM underneath all PCB drawable classes, this is
a big change and may introduce a bug or two, but it is worth it for the
future, because we can introduce virtual functions there that do not impact
the entire project (since everything is derived from EDA_BaseStruct).
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>

View File

@ -106,7 +106,6 @@ void EDA_BaseStruct::InitVars( void )
m_TimeStamp = 0; // Time stamp used for logical links
m_Status = 0;
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
/**********************************************************************************************/
EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
EDA_BaseStruct( StructFather, idtype )

View File

@ -1,12 +1,13 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sheet.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 08/02/2006 18:37:02
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
@ -32,285 +33,298 @@
/***********************************************************/
DrawSheetStruct::DrawSheetStruct(const wxPoint & pos) :
SCH_SCREEN( SCHEMATIC_FRAME )
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
SCH_SCREEN( SCHEMATIC_FRAME )
/***********************************************************/
{
m_Label = NULL;
m_NbLabel = 0;
m_Layer = LAYER_SHEET;
m_Pos = pos;
m_SheetNameSize = m_FileNameSize = 60;
/* change the struct type: SCREEN_STRUCT_TYPE to DRAW_SHEET_STRUCT_TYPE */
m_StructType = DRAW_SHEET_STRUCT_TYPE;
m_Label = NULL;
m_NbLabel = 0;
m_Layer = LAYER_SHEET;
m_Pos = pos;
m_SheetNameSize = m_FileNameSize = 60;
/* change the struct type: SCREEN_STRUCT_TYPE to 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)
{
next_label = (DrawSheetLabelStruct *)label->Pnext;
delete label;
label = next_label;
}
while( label )
{
next_label = (DrawSheetLabelStruct*) label->Pnext;
delete label;
label = next_label;
}
}
/***********************************************/
DrawSheetStruct * DrawSheetStruct::GenCopy(void)
DrawSheetStruct* DrawSheetStruct::GenCopy( void )
/***********************************************/
/* 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);
DrawSheetLabelStruct * Slabel = NULL, * label = m_Label;
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
newitem->m_Size = m_Size;
newitem->m_Parent = m_Parent;
newitem->m_TimeStamp = GetTimeStamp();
DrawSheetLabelStruct* Slabel = NULL, * label = m_Label;
newitem->m_FileName = m_FileName;
newitem->m_FileNameSize = m_FileNameSize;
newitem->m_SheetName = m_SheetName;
newitem->m_SheetNameSize = m_SheetNameSize;
newitem->m_Size = m_Size;
newitem->m_Parent = m_Parent;
newitem->m_TimeStamp = GetTimeStamp();
if( label )
{
Slabel = newitem->m_Label = label->GenCopy();
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*)label->Pnext;
}
newitem->m_FileName = m_FileName;
newitem->m_FileNameSize = m_FileNameSize;
newitem->m_SheetName = m_SheetName;
newitem->m_SheetNameSize = m_SheetNameSize;
while( label )
{
Slabel->Pnext = label->GenCopy();
Slabel = (DrawSheetLabelStruct*)Slabel->Pnext;
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*)label->Pnext;
}
if( label )
{
Slabel = newitem->m_Label = label->GenCopy();
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*) label->Pnext;
}
/* copy screen data */
newitem->m_DrawOrg = m_DrawOrg;
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;
while( label )
{
Slabel->Pnext = label->GenCopy();
Slabel = (DrawSheetLabelStruct*) Slabel->Pnext;
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*) label->Pnext;
}
newitem->EEDrawList = EEDrawList; /* Object list (main data) for schematic */
newitem->m_UndoList = m_UndoList; /* Object list for the undo command (old data) */
newitem->m_RedoList = m_RedoList; /* Object list for the redo command (old data) */
/* copy screen data */
newitem->m_DrawOrg = m_DrawOrg;
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->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;
newitem->EEDrawList = EEDrawList; /* Object list (main data) for schematic */
newitem->m_UndoList = m_UndoList; /* Object list for the undo command (old data) */
newitem->m_RedoList = m_RedoList; /* Object list for the redo command (old data) */
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:
swap data between this and copyitem
*/
* swap data between this and copyitem
*/
{
EXCHG(m_Pos, copyitem->m_Pos);
EXCHG(m_Size, copyitem->m_Size);
EXCHG(m_SheetName, copyitem->m_SheetName);
EXCHG(m_SheetNameSize, copyitem->m_SheetNameSize);
EXCHG(m_FileNameSize, copyitem->m_FileNameSize);
EXCHG(m_Label, copyitem->m_Label);
EXCHG(m_NbLabel, copyitem->m_NbLabel);
EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_SheetName, copyitem->m_SheetName );
EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
EXCHG( m_Label, copyitem->m_Label );
EXCHG( m_NbLabel, copyitem->m_NbLabel );
}
/**************************************************************************************/
void DrawSheetStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset,
int DrawMode, int Color)
void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/**************************************************************************************/
/* Draw the hierarchical sheet shape */
{
DrawSheetLabelStruct * SheetLabelStruct;
int txtcolor;
wxString Text;
int color;
wxPoint pos = m_Pos + offset;
int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 ) color = Color;
else color = ReturnLayerColor(m_Layer);
GRSetDrawMode(DC, DrawMode);
DrawSheetLabelStruct* SheetLabelStruct;
int txtcolor;
wxString Text;
int color;
wxPoint pos = m_Pos + offset;
int LineWidth = g_DrawMinimunLineWidth;
GRRect(&panel->m_ClipBox, DC, pos.x, pos.y,
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color);
if( Color >= 0 )
color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
/* Draw text : SheetName */
if( Color > 0 ) txtcolor = Color;
else txtcolor = ReturnLayerColor(LAYER_SHEETNAME);
GRRect( &panel->m_ClipBox, DC, pos.x, pos.y,
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
Text = wxT("Sheet: ") + m_SheetName;
DrawGraphicText(panel, DC,
wxPoint(pos.x, pos.y - 8), txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize(m_SheetNameSize,m_SheetNameSize),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth);
/* Draw text : SheetName */
if( Color > 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
/* Draw text : FileName */
if( Color >= 0 ) 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);
Text = wxT( "Sheet: " ) + m_SheetName;
DrawGraphicText( panel, DC,
wxPoint( pos.x, pos.y - 8 ), txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize( m_SheetNameSize, m_SheetNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
/* Draw text : FileName */
if( Color >= 0 )
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 */
SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL )
{
SheetLabelStruct->Draw(panel, DC, offset,DrawMode, Color);
SheetLabelStruct = (DrawSheetLabelStruct*)(SheetLabelStruct->Pnext);
}
/* Draw text : SheetLabel */
SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL )
{
SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
SheetLabelStruct = (DrawSheetLabelStruct*) (SheetLabelStruct->Pnext);
}
}
/************************/
/* DrawSheetLabelStruct */
/************************/
/************************/
/* DrawSheetLabelStruct */
/************************/
/*******************************************************************/
DrawSheetLabelStruct::DrawSheetLabelStruct(DrawSheetStruct * parent,
const wxPoint & pos, const wxString & text) :
EDA_BaseStruct(DRAW_SHEETLABEL_STRUCT_TYPE),
EDA_TextStruct(text)
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ),
EDA_TextStruct( text )
/*******************************************************************/
{
m_Layer = LAYER_SHEETLABEL;
m_Parent = parent;
m_Pos = pos;
m_Edge = 0;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
m_Layer = LAYER_SHEETLABEL;
m_Parent = parent;
m_Pos = pos;
m_Edge = 0;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
}
/***********************************************************/
DrawSheetLabelStruct * DrawSheetLabelStruct::GenCopy(void)
DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy( void )
/***********************************************************/
{
DrawSheetLabelStruct * newitem =
new DrawSheetLabelStruct( (DrawSheetStruct *)m_Parent, m_Pos, m_Text);
DrawSheetLabelStruct* newitem =
new DrawSheetLabelStruct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
return newitem;
return newitem;
}
/********************************************************************************************/
void DrawSheetLabelStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset,
int DrawMode, int Color)
void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/********************************************************************************************/
/* Routine de dessin des Labels type hierarchie */
{
int side, txtcolor;
int posx , tposx, posy, size2;
wxSize size;
int NbSegm, coord[20];
int LineWidth = g_DrawMinimunLineWidth;
int side, txtcolor;
int posx, tposx, posy, size2;
wxSize size;
int NbSegm, coord[20];
int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 ) txtcolor = Color;
else txtcolor = ReturnLayerColor(m_Layer);
GRSetDrawMode(DC, DrawMode);
if( Color >= 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
if( !m_Text.IsEmpty() )
{
if( m_Edge )
{
tposx = posx - size.x;
side = GR_TEXT_HJUSTIFY_RIGHT;
}
else
{
tposx = posx + size.x + (size.x /8) ;
side = GR_TEXT_HJUSTIFY_LEFT;
}
DrawGraphicText(panel, DC, wxPoint(tposx, posy), txtcolor,
m_Text, TEXT_ORIENT_HORIZ,size ,
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth);
}
/* dessin du symbole de connexion */
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
if( !m_Text.IsEmpty() )
{
if( m_Edge )
{
tposx = posx - size.x;
side = GR_TEXT_HJUSTIFY_RIGHT;
}
else
{
tposx = posx + size.x + (size.x / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
m_Text, TEXT_ORIENT_HORIZ, size,
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
/* dessin du symbole de connexion */
if(m_Edge)
{
size.x = -size.x;
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;
if( m_Edge )
{
size.x = -size.x;
size.y = -size.y;
}
case 1: /* output <| */
coord[2] = posx + size2; 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 + size2; coord[9] = posy + size2;
coord[10] = coord[0] ; coord[11] = coord[1];
NbSegm = 6;
break;
coord[0] = posx; coord[1] = posy; size2 = size.x / 2;
NbSegm = 0;
case 2: /* bidi <> */
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;
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;
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 */
case 1: /* output <| */
coord[2] = posx + size2; 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 + size2; coord[9] = posy + size2;
coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6;
break;
case 2: /* bidi <> */
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
, public EDA_TextStruct
class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
{
public:
int m_Layer;
int m_Edge, m_Shape;
bool m_IsDangling; // TRUE si non connecté
@ -141,6 +141,7 @@ public:
int m_FileNameSize;
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */
int m_NbLabel; /* Nombre de points de connexion */

View File

@ -14,236 +14,247 @@
#include "protos.h"
/*******************************************************************/
DrawBusEntryStruct::DrawBusEntryStruct(const wxPoint & pos, int shape, int id) :
EDA_BaseStruct(DRAW_BUSENTRY_STRUCT_TYPE)
DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) :
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;
m_Size.x = 100;
m_Size.y = 100;
m_Layer = LAYER_WIRE;
m_Width = 0;
if( id == BUS_TO_BUS )
{
m_Layer = LAYER_BUS;
m_Width = 1;
}
if(shape == '/' ) m_Size.y = - 100;
if( id == BUS_TO_BUS )
{
m_Layer = LAYER_BUS;
m_Width = 1;
}
if( shape == '/' )
m_Size.y = -100;
}
/*************************************/
wxPoint DrawBusEntryStruct::m_End(void)
wxPoint DrawBusEntryStruct::m_End( void )
/*************************************/
// 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_Width = m_Width;
newitem->m_Size = m_Size;
newitem->m_Flags = m_Flags;
newitem->m_Layer = m_Layer;
newitem->m_Width = m_Width;
newitem->m_Size = m_Size;
newitem->m_Flags = m_Flags;
return newitem;
return newitem;
}
/****************************/
/* class DrawJunctionStruct */
/***************************/
/****************************/
/* class DrawJunctionStruct */
/***************************/
/************************************************************/
DrawJunctionStruct::DrawJunctionStruct(const wxPoint & pos) :
EDA_BaseStruct(DRAW_JUNCTION_STRUCT_TYPE)
DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_JUNCTION_STRUCT_TYPE )
/************************************************************/
{
m_Pos = pos;
m_Layer = LAYER_JUNCTION;
m_Pos = pos;
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_Flags = m_Flags;
newitem->m_Layer = m_Layer;
newitem->m_Flags = m_Flags;
return newitem;
return newitem;
}
/*****************************/
/* class DrawNoConnectStruct */
/*****************************/
/*****************************/
/* class DrawNoConnectStruct */
/*****************************/
DrawNoConnectStruct::DrawNoConnectStruct(const wxPoint & pos) :
EDA_BaseStruct(DRAW_NOCONNECT_STRUCT_TYPE)
DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
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):
EDA_BaseStruct(DRAW_MARKER_STRUCT_TYPE)
DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_MARKER_STRUCT_TYPE )
{
m_Pos = pos; /* XY coordinates of marker. */
m_Type = MARQ_UNSPEC;
m_MarkFlags = 0; // complements d'information
m_Comment = text;
m_Pos = pos; /* XY coordinates of marker. */
m_Type = MARQ_UNSPEC;
m_MarkFlags = 0; // complements d'information
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_BaseLineStruct(NULL, DRAW_SEGMENT_STRUCT_TYPE)
EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
EDA_BaseLineStruct( NULL, DRAW_SEGMENT_STRUCT_TYPE )
{
m_Start = pos;
m_End = pos;
m_StartIsDangling = m_EndIsDangling = FALSE;
m_Start = pos;
m_End = pos;
m_StartIsDangling = m_EndIsDangling = FALSE;
switch(layer)
{
default:
m_Layer = LAYER_NOTES; /* Mettre ds Notes */
m_Width = GR_NORM_WIDTH;
break;
switch( layer )
{
default:
m_Layer = LAYER_NOTES; /* Mettre ds Notes */
m_Width = GR_NORM_WIDTH;
break;
case LAYER_WIRE:
m_Layer = LAYER_WIRE;
m_Width = GR_NORM_WIDTH;
break;
case LAYER_BUS:
m_Layer = LAYER_BUS;
m_Width = GR_THICK_WIDTH;
break;
}
case LAYER_WIRE:
m_Layer = LAYER_WIRE;
m_Width = GR_NORM_WIDTH;
break;
case LAYER_BUS:
m_Layer = LAYER_BUS;
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
*/
*/
{
if ( (pos.x == m_Start.x) && (pos.y == m_Start.y) ) return TRUE;
if ( (pos.x == m_End.x) && (pos.y == m_End.y) ) return TRUE;
return FALSE;
if( (pos.x == m_Start.x) && (pos.y == m_Start.y) )
return TRUE;
if( (pos.x == m_End.x) && (pos.y == m_End.y) )
return TRUE;
return FALSE;
}
/****************************/
/* Class DrawPolylineStruct */
/****************************/
/****************************/
/* Class DrawPolylineStruct */
/****************************/
/***********************************************************/
DrawPolylineStruct::DrawPolylineStruct(int layer):
EDA_BaseStruct(DRAW_POLYLINE_STRUCT_TYPE)
DrawPolylineStruct::DrawPolylineStruct( int layer ) :
EDA_BaseStruct( DRAW_POLYLINE_STRUCT_TYPE )
/***********************************************************/
{
m_NumOfPoints = 0; /* Number of XY pairs in Points array. */
m_Points = NULL; /* XY pairs that forms the polyline. */
m_Width = GR_NORM_WIDTH;
m_NumOfPoints = 0; /* Number of XY pairs in Points array. */
m_Points = NULL; /* XY pairs that forms the polyline. */
m_Width = GR_NORM_WIDTH;
switch ( layer )
{
default:
m_Layer = LAYER_NOTES;
break;
switch( layer )
{
default:
m_Layer = LAYER_NOTES;
break;
case LAYER_WIRE:
case LAYER_NOTES:
m_Layer = layer;
break;
case LAYER_WIRE:
case LAYER_NOTES:
m_Layer = layer;
break;
case LAYER_BUS:
m_Layer = layer;
m_Width = GR_THICK_WIDTH;
break;
}
case LAYER_BUS:
m_Layer = layer;
m_Width = GR_THICK_WIDTH;
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 =
new DrawPolylineStruct( m_Layer );
DrawPolylineStruct* newitem =
new DrawPolylineStruct( m_Layer );
memsize = sizeof(int) * 2 * m_NumOfPoints;
newitem->m_NumOfPoints = m_NumOfPoints;
newitem->m_Points = (int *) MyZMalloc(memsize);
memcpy ( newitem->m_Points, m_Points, memsize);
memsize = sizeof(int) * 2 * m_NumOfPoints;
newitem->m_NumOfPoints = m_NumOfPoints;
newitem->m_Points = (int*) MyZMalloc( 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
{
public:
int m_FieldId;
int m_Layer;
int m_FieldId;
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
and for fields 1 to 8 the name is editable */
@ -54,6 +55,7 @@ public:
void SwapData(PartTextStruct * copyitem);
};
/* the class DrawPartStruct describes a basic virtual component
Not used directly:
used classes are EDA_SchComponentStruct (the "classic" schematic component
@ -62,6 +64,7 @@ public:
class DrawPartStruct: public EDA_BaseStruct
{
public:
int m_Layer;
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */
PartTextStruct m_Field[NUMBER_OF_FIELDS];
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 */
{
public:
int m_Layer;
int m_Width;
wxPoint m_Pos;
wxSize m_Size;
@ -121,6 +122,7 @@ public:
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
{
public:
int m_Layer;
int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */
int *m_Points; /* XY pairs that forms the polyline. */
@ -135,6 +137,7 @@ public:
class DrawJunctionStruct: public EDA_BaseStruct
{
public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */
public:
@ -147,6 +150,7 @@ public:
class DrawTextStruct: public EDA_BaseStruct, public EDA_TextStruct
{
public:
int m_Layer;
int m_Shape;
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);
};
class DrawLabelStruct: public DrawTextStruct
{
public:
@ -170,6 +175,7 @@ public:
~DrawLabelStruct(void) {}
};
class DrawGlobalLabelStruct: public DrawTextStruct
{
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 "gr_basic.h"
@ -13,96 +13,102 @@
/* 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
Entree :
pointeur de la description du texte
*/
* Entree :
* pointeur de la description du texte
*/
{
wxString Line;
wxString Line;
frame->MsgPanel->EraseMsgBox();
frame->MsgPanel->EraseMsgBox();
if( pt_texte->m_StructType == TYPECOTATION )
Affiche_1_Parametre(frame, 1,_("COTATION"),pt_texte->m_Text, DARKGREEN);
if( pt_texte->m_StructType == TYPECOTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else
Affiche_1_Parametre(frame, 1,_("PCB Text"),pt_texte->m_Text, DARKGREEN);
else
Affiche_1_Parametre( frame, 1, _( "PCB Text" ), pt_texte->m_Text, DARKGREEN );
Line = _("Layer "); Line << pt_texte->m_Layer + 1;
Affiche_1_Parametre(frame, 28, _("Layer:"), Line, g_DesignSettings.m_LayerColor[pt_texte->m_Layer] );
Line = _( "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) ;
if( (pt_texte->m_Miroir & 1) )
Affiche_1_Parametre(frame, -1,wxEmptyString, _("No"), DARKGREEN) ;
else Affiche_1_Parametre(frame, -1,wxEmptyString, _("Yes"), DARKGREEN) ;
Affiche_1_Parametre( frame, 36, _( "Mirror" ), wxEmptyString, GREEN );
if( (pt_texte->m_Miroir & 1) )
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) ;
Affiche_1_Parametre(frame, 50,_("Width"), Line,MAGENTA) ;
Line.Printf( wxT( "%.1f" ), (float) pt_texte->m_Orient / 10 );
Affiche_1_Parametre( frame, 43, _( "Orient" ), Line, DARKGREEN );
valeur_param(pt_texte->m_Size.x,Line) ;
Affiche_1_Parametre(frame, 60,_("H Size"), Line,RED) ;
valeur_param( pt_texte->m_Width, Line );
Affiche_1_Parametre( frame, 50, _( "Width" ), Line, MAGENTA );
valeur_param(pt_texte->m_Size.y,Line);
Affiche_1_Parametre(frame, 70,_("V Size"), Line,RED) ;
valeur_param( pt_texte->m_Size.x, Line );
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 */
{
int d_index, ii = -1;
D_CODE * pt_D_code;
int layer = frame->GetScreen()->m_Active_Layer;
wxString msg;
frame->MsgPanel->EraseMsgBox();
int d_index, ii = -1;
D_CODE* pt_D_code;
int layer = frame->GetScreen()->m_Active_Layer;
wxString msg;
d_index = pt_piste->m_NetCode;
pt_D_code = ReturnToolDescr(layer, d_index, &ii);
frame->MsgPanel->EraseMsgBox();
switch(pt_piste->m_StructType)
{
case TYPETRACK:
if ( pt_piste->m_Shape < S_SPOT_CIRCLE ) msg = wxT("LINE");
else msg = wxT("FLASH");
break;
d_index = pt_piste->m_NetCode;
pt_D_code = ReturnToolDescr( layer, d_index, &ii );
case TYPEZONE:
msg = wxT("ZONE"); break;
switch( pt_piste->m_StructType )
{
case TYPETRACK:
if( pt_piste->m_Shape < S_SPOT_CIRCLE )
msg = wxT( "LINE" );
else
msg = wxT( "FLASH" );
break;
default:
msg = wxT("????"); break;
}
Affiche_1_Parametre(frame, 1, _("Type"), msg, DARKCYAN);
case TYPEZONE:
msg = wxT( "ZONE" ); break;
msg.Printf( wxT("%d"), ii+1);
Affiche_1_Parametre(frame, 10, _("Tool"), msg, RED);
default:
msg = wxT( "????" ); break;
}
if ( pt_D_code )
{
msg.Printf( wxT("D%d"), d_index);
Affiche_1_Parametre(frame, 20, _("D CODE"),msg, BLUE);
Affiche_1_Parametre( frame, 1, _( "Type" ), msg, DARKCYAN );
Affiche_1_Parametre(frame, 30, _("D type"),
pt_D_code ? g_GERBER_Tool_Type[pt_D_code->m_Shape] : _("????"),
BLUE);
}
msg.Printf( wxT( "%d" ), ii + 1 );
Affiche_1_Parametre( frame, 10, _( "Tool" ), msg, RED );
msg.Printf( wxT("%d"),pt_piste->m_Layer + 1);
Affiche_1_Parametre(frame, 40, _("Layer"), msg, BROWN) ;
if( pt_D_code )
{
msg.Printf( wxT( "D%d" ), d_index );
Affiche_1_Parametre( frame, 20, _( "D CODE" ), msg, BLUE );
/* Affiche Epaisseur */
valeur_param((unsigned)(pt_piste->m_Width), msg) ;
Affiche_1_Parametre(frame, 50, _("Width"), msg, DARKCYAN) ;
Affiche_1_Parametre( frame, 30, _( "D type" ),
pt_D_code ? g_GERBER_Tool_Type[pt_D_code->m_Shape] : _( "????" ),
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;
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;
if ( // Line Item
@ -359,8 +359,8 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
int width, len;
wxSize size = pt_Dcode->m_Size;
width = min( size.x, size.y );
len = max( size.x, size.y ) - width;
width = MIN( size.x, size.y );
len = MAX( size.x, size.y ) - 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();
if( dcode_value != track->m_NetCode )
continue;
if( layer_number >= 0 && layer_number != track->m_Layer )
if( layer_number >= 0 && layer_number != track->GetLayer() )
continue;
Delete_Segment( DC, track );
}

View File

@ -1,7 +1,8 @@
/* export_to_pcbnew.cpp */
/*
Export des couches vers pcbnew
*/
* Export des couches vers pcbnew
*/
#include "fctsys.h"
@ -11,224 +12,242 @@ Export des couches vers pcbnew
#include "protos.h"
/* Routines Locales : */
static int SavePcbFormatAscii(WinEDA_GerberFrame * frame,
FILE * File, int * LayerLookUpTable);
static int SavePcbFormatAscii( WinEDA_GerberFrame* frame,
FILE* File, int* LayerLookUpTable );
/* Variables Locales */
/************************************************************************/
void WinEDA_GerberFrame::ExportDataInPcbnewFormat(wxCommandEvent& event)
void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event )
/************************************************************************/
/* Export data in pcbnew format
*/
*/
{
wxString FullFileName, msg;
wxString PcbExt(wxT(".brd"));
FILE * dest;
wxString FullFileName, msg;
msg = wxT("*") + PcbExt;
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;
wxString PcbExt( wxT( ".brd" ) );
int * LayerLookUpTable;
if ( ( LayerLookUpTable = InstallDialogLayerPairChoice(this) ) != NULL )
{
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) ;
}
FILE* dest;
msg = wxT( "*" ) + PcbExt;
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;
if( ( LayerLookUpTable = InstallDialogLayerPairChoice( this ) ) != NULL )
{
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");
sprintf(text, "InternalUnit %f INCH\n", 1.0/PCB_INTERNAL_UNIT);
fprintf(File, text);
Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount;
fprintf(File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount);
fprintf( File, "$SETUP\n" );
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( File, text );
fprintf(File,"$EndSETUP\n\n");
return(1);
Pcb->m_BoardSettings->m_CopperLayerCount = g_DesignSettings.m_CopperLayerCount;
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 */
NbLayers = Pcb->m_BoardSettings->m_CopperLayerCount;
fprintf(File,"$GENERAL\n");
fprintf(File,"LayerCount %d\n",NbLayers);
/* generation du masque des couches autorisees */
NbLayers = Pcb->m_BoardSettings->m_CopperLayerCount;
fprintf( File, "$GENERAL\n" );
fprintf( File, "LayerCount %d\n", NbLayers );
/* Generation des coord du rectangle d'encadrement */
Pcb->ComputeBoundaryBox();
fprintf(File,"Di %d %d %d %d\n",
Pcb->m_BoundaryBox.GetX(), Pcb->m_BoundaryBox.GetY(),
Pcb->m_BoundaryBox.GetRight(),
Pcb->m_BoundaryBox.GetBottom());
/* Generation des coord du rectangle d'encadrement */
Pcb->ComputeBoundaryBox();
fprintf( File, "Di %d %d %d %d\n",
Pcb->m_BoundaryBox.GetX(), Pcb->m_BoundaryBox.GetY(),
Pcb->m_BoundaryBox.GetRight(),
Pcb->m_BoundaryBox.GetBottom() );
fprintf(File,"$EndGENERAL\n\n");
return TRUE;
fprintf( File, "$EndGENERAL\n\n" );
return TRUE;
}
/*******************************************************************/
static int SavePcbFormatAscii(WinEDA_GerberFrame * frame,FILE * File,
int * LayerLookUpTable)
static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
int* LayerLookUpTable )
/*******************************************************************/
/* Routine de sauvegarde du PCB courant sous format ASCII
retourne
1 si OK
0 si sauvegarde non faite
*/
* retourne
* 1 si OK
* 0 si sauvegarde non faite
*/
{
char Line[256];
TRACK * track, *next_track;
EDA_BaseStruct * PtStruct, *NextStruct;
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);
}
}
char Line[256];
TRACK* track, * next_track;
BOARD_ITEM* PtStruct;
BOARD_ITEM* NextStruct;
BOARD* GerberPcb = frame->m_Pcb;
BOARD* Pcb;
/* replace spots by vias when possible */
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;
}
}
wxBeginBusyCursor();
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
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);
/* Create an image of gerber data */
Pcb = new BOARD( NULL, frame );
/* Ecriture des donnes utiles du pcb */
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
switch ( PtStruct->m_StructType )
{
case TYPETEXTE:
((TEXTE_PCB*)PtStruct)->WriteTextePcbDescr(File) ;
break;
for( track = GerberPcb->m_Track; track != NULL; track = (TRACK*) track->Pnext )
{
int layer = track->GetLayer();
int pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 )
continue;
if( pcb_layer_number > CMP_N )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( NULL, TYPEDRAWSEGMENT );
case TYPEDRAWSEGMENT:
((DRAWSEGMENT *)PtStruct)->WriteDrawSegmentDescr(File);
break;
drawitem->SetLayer( 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 );
default:
break;
}
}
newtrack->SetLayer( pcb_layer_number );
newtrack->Insert( Pcb, NULL );
}
}
fprintf(File,"$TRACK\n");
for(track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext)
{
track->WriteTrackDescr(File);
}
/* replace spots by vias when possible */
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;
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 */
for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct )
{
NextStruct = PtStruct->Pnext;
delete PtStruct;
}
for(track = Pcb->m_Track; track != NULL; track = next_track)
{
next_track = (TRACK*) track->Pnext;
delete track;
}
delete Pcb;
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
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 );
setlocale(LC_NUMERIC, ""); // revert to the current locale
wxEndBusyCursor();
return 1;
/* Ecriture des donnes utiles du pcb */
PtStruct = Pcb->m_Drawings;
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 */
/******* Fichier INITPCB.C ********************/
/**********************************************/
/**********************************************/
/* GERBVIEW : Routines d'initialisation globale */
/******* Fichier INITPCB.C ********************/
/**********************************************/
#include "fctsys.h"
@ -14,205 +14,201 @@
/* 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
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 (m_Pcb->m_Drawings || m_Pcb->m_Track || m_Pcb->m_Zone )
{
if( ! IsOK(this, _("Current Data will be lost ?")) ) return FALSE;
}
}
if( query )
{
if( m_Pcb->m_Drawings || m_Pcb->m_Track || m_Pcb->m_Zone )
{
if( !IsOK( this, _( "Current Data will be lost ?" ) ) )
return FALSE;
}
}
DeleteStructList(m_Pcb->m_Drawings);
m_Pcb->m_Drawings = NULL;
DeleteStructList( m_Pcb->m_Drawings );
m_Pcb->m_Drawings = NULL;
DeleteStructList(m_Pcb->m_Track);
m_Pcb->m_Track = NULL;
m_Pcb->m_NbSegmTrack = 0;
DeleteStructList( m_Pcb->m_Track );
m_Pcb->m_Track = NULL;
m_Pcb->m_NbSegmTrack = 0;
DeleteStructList(m_Pcb->m_Zone);
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
DeleteStructList( m_Pcb->m_Zone );
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
for ( ; g_UnDeleteStackPtr != 0; )
{
g_UnDeleteStackPtr--;
DeleteStructList(g_UnDeleteStack[ g_UnDeleteStackPtr]);
}
for( ; g_UnDeleteStackPtr != 0; )
{
g_UnDeleteStackPtr--;
DeleteStructList( g_UnDeleteStack[ g_UnDeleteStackPtr] );
}
/* init pointeurs et variables */
for ( layer = 0; layer < 32; layer++ )
{
if ( g_GERBER_Descr_List[layer] )
g_GERBER_Descr_List[layer]->InitToolTable();
}
/* init pointeurs et variables */
for( layer = 0; layer < 32; layer++ )
{
if( g_GERBER_Descr_List[layer] )
g_GERBER_Descr_List[layer]->InitToolTable();
}
/* remise a 0 ou a une valeur initiale des variables de la structure */
m_Pcb->m_BoundaryBox.SetOrigin(0,0);
m_Pcb->m_BoundaryBox.SetSize(0,0);
m_Pcb->m_Status_Pcb = 0;
m_Pcb->m_NbLoclinks = 0;
m_Pcb->m_NbLinks = 0;
m_Pcb->m_NbPads = 0;
m_Pcb->m_NbNets = 0;
m_Pcb->m_NbNodes = 0;
m_Pcb->m_NbNoconnect = 0;
m_Pcb->m_NbSegmTrack = 0;
m_Pcb->m_NbSegmZone = 0;
/* remise a 0 ou a une valeur initiale des variables de la structure */
m_Pcb->m_BoundaryBox.SetOrigin( 0, 0 );
m_Pcb->m_BoundaryBox.SetSize( 0, 0 );
m_Pcb->m_Status_Pcb = 0;
m_Pcb->m_NbLoclinks = 0;
m_Pcb->m_NbLinks = 0;
m_Pcb->m_NbPads = 0;
m_Pcb->m_NbNets = 0;
m_Pcb->m_NbNodes = 0;
m_Pcb->m_NbNoconnect = 0;
m_Pcb->m_NbSegmTrack = 0;
m_Pcb->m_NbSegmZone = 0;
/* Init parametres de gestion des ecrans PAD et PCB */
m_CurrentScreen = ActiveScreen = ScreenPcb;
GetScreen()->Init();
/* Init parametres de gestion des ecrans PAD et PCB */
m_CurrentScreen = ActiveScreen = ScreenPcb;
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 )
{
DeleteStructList(m_Pcb->m_Zone);
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
ScreenPcb->SetModify();
if( m_Pcb->m_Zone )
{
DeleteStructList( m_Pcb->m_Zone );
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
ScreenPcb->SetModify();
}
/*****************************************************/
void WinEDA_GerberFrame::Erase_Segments_Pcb(wxDC * DC,
bool all_layers, bool query)
void WinEDA_GerberFrame::Erase_Segments_Pcb( wxDC* DC,
bool all_layers, bool query )
/*****************************************************/
{
EDA_BaseStruct * PtStruct, *PtNext;
int layer = GetScreen()->m_Active_Layer;
BOARD_ITEM* PtStruct;
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;
for( ; PtStruct != NULL; PtStruct = PtNext)
{
PtNext = PtStruct->Pnext;
switch( PtStruct->m_StructType )
{
case TYPEDRAWSEGMENT:
if( (((DRAWSEGMENT*)PtStruct)->m_Layer == layer)
|| layer < 0)
DeleteStructure(PtStruct);
break;
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtNext )
{
PtNext = PtStruct->Next();
case TYPETEXTE:
if( (((TEXTE_PCB*)PtStruct)->m_Layer == layer)
|| layer < 0)
DeleteStructure(PtStruct);
break;
switch( PtStruct->m_StructType )
{
case TYPEDRAWSEGMENT:
case TYPETEXTE:
case TYPECOTATION:
case TYPEMIRE:
if( PtStruct->GetLayer() == layer || layer < 0 )
DeleteStructure( PtStruct );
break;
case TYPECOTATION:
if( (((COTATION*)PtStruct)->m_Layer == layer)
|| layer < 0)
DeleteStructure(PtStruct);
break;
default:
DisplayError( this, wxT( "Type Draw inconnu/inattendu" ) );
break;
}
}
case TYPEMIRE:
if( (((MIREPCB*)PtStruct)->m_Layer == layer)
|| layer < 0)
DeleteStructure(PtStruct);
break;
default:
DisplayError(this, wxT("Type Draw inconnu/inattendu"));
break;
}
}
ScreenPcb->SetModify();
ScreenPcb->SetModify();
}
/****************************************************************/
void WinEDA_GerberFrame::Erase_Pistes(wxDC * DC, int masque_type,
bool query)
void WinEDA_GerberFrame::Erase_Pistes( wxDC* DC, int masque_type,
bool query )
/****************************************************************/
/* Efface les segments de piste, selon les autorisations affichees
masque_type = masque des options de selection:
SEGM_FIXE, SEGM_AR
Si un des bits est a 1, il n'y a pas effacement du segment de meme bit a 1
*/
* masque_type = masque des options de selection:
* SEGM_FIXE, SEGM_AR
* Si un des bits est a 1, il n'y a pas effacement du segment de meme bit a 1
*/
{
TRACK * pt_segm;
EDA_BaseStruct * PtNext;
TRACK* pt_segm;
BOARD_ITEM* PtNext;
if( query && ! IsOK(this, _("Delete Tracks?")) ) return;
if( query && !IsOK( this, _( "Delete Tracks?" ) ) )
return;
/* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext)
{
PtNext = pt_segm->Pnext;
if( pt_segm->GetState(SEGM_FIXE|SEGM_AR) & masque_type) continue;
DeleteStructure(pt_segm);
}
/* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext )
{
PtNext = pt_segm->Next();
if( pt_segm->GetState( SEGM_FIXE | SEGM_AR ) & masque_type )
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;
for( ; PtStruct != NULL; PtStruct = PtNext)
{
PtNext = PtStruct->Pnext;
if(PtStruct->m_StructType == TYPETEXTE ) DeleteStructure(PtStruct);
}
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtNext )
{
PtNext = PtStruct->Next();
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;
EDA_BaseStruct * PtNext;
int layer = GetScreen()->m_Active_Layer;
wxString msg;
TRACK* pt_segm;
BOARD_ITEM* PtNext;
int layer = GetScreen()->m_Active_Layer;
wxString msg;
msg.Printf( _("Delete Layer %d"), layer+1);
if( query && ! IsOK(this, msg) ) return;
msg.Printf( _( "Delete Layer %d" ), layer + 1 );
if( query && !IsOK( this, msg ) )
return;
/* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext)
{
PtNext = pt_segm->Pnext;
if( pt_segm->m_Layer != layer) continue;
DeleteStructure(pt_segm);
}
/* Marquage des pistes a effacer */
for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext )
{
PtNext = pt_segm->Next();
if( pt_segm->GetLayer() != layer )
continue;
DeleteStructure( pt_segm );
}
ScreenPcb->SetModify();
ScreenPcb->SetRefreshReq();
ScreenPcb->SetModify();
ScreenPcb->SetRefreshReq();
}

View File

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

View File

@ -105,7 +105,7 @@ TRACK * track;
track = new TRACK(frame->m_Pcb);
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_Start = track->m_End = pos;
NEGATE(track->m_Start.y);
@ -129,13 +129,13 @@ static void Append_1_Flash_GERBER(int Dcode_index,
TRACK * track;
int width, len;
width = min( size.x, size.y );
len = max( size.x, size.y ) - width;
width = MIN( size.x, size.y );
len = MAX( size.x, size.y ) - width;
track = new TRACK(frame->m_Pcb);
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_Start = track->m_End = pos;
NEGATE(track->m_Start.y);
@ -176,7 +176,7 @@ TRACK * track;
track = new TRACK( frame->m_Pcb );
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_Start = startpoint;
NEGATE(track->m_Start.y);
@ -213,7 +213,7 @@ wxPoint center, delta;
track->Insert(frame->m_Pcb, NULL);
track->m_Shape = S_ARC;
track->m_Layer = frame->GetScreen()->m_Active_Layer ;
track->SetLayer( frame->GetScreen()->m_Active_Layer );
track->m_Width = largeur ;
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 > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1;
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;
break;
}
@ -643,7 +643,7 @@ wxString msg;
if ( last ) while (last->Pnext ) last = (SEGZONE*)last->Pnext;
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_Start = m_PreviousPos;
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 )
{
int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
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
{
int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
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"
@ -17,342 +17,353 @@
/* 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
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 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 printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/
*/
{
TRACK * Track;
int layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
GERBER_Descr * gerber_layer = g_GERBER_Descr_List[layer];
int dcode_hightlight = 0;
TRACK* Track;
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
GERBER_Descr* gerber_layer = g_GERBER_Descr_List[layer];
int dcode_hightlight = 0;
if ( gerber_layer )
dcode_hightlight = gerber_layer->m_Selected_Tool;
if( gerber_layer )
dcode_hightlight = gerber_layer->m_Selected_Tool;
Track = Pcb->m_Track;
for ( ; Track != NULL ; Track = (TRACK*) Track->Pnext )
{
if ( printmasklayer != -1 )
if ( (Track->ReturnMaskLayer() & printmasklayer) == 0 ) continue;
Track = Pcb->m_Track;
for( ; Track != NULL; Track = (TRACK*) Track->Pnext )
{
if( printmasklayer != -1 )
if( (Track->ReturnMaskLayer() & printmasklayer) == 0 )
continue;
if ( (dcode_hightlight == Track->m_NetCode) &&
(Track->m_Layer == layer) )
Trace_Segment(panel, DC, Track, draw_mode | GR_SURBRILL);
else Trace_Segment(panel, DC, Track, draw_mode );
}
if( (dcode_hightlight == Track->m_NetCode)
&& (Track->GetLayer() == layer) )
Trace_Segment( panel, DC, Track, draw_mode | GR_SURBRILL );
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.
Parametres :
track = adresse de la description de la piste en buflib
draw_mode = mode ( GR_XOR, GR_OR..)
*/
* Parametres :
* track = adresse de la description de la piste en buflib
* draw_mode = mode ( GR_XOR, GR_OR..)
*/
{
int l_piste;
int color;
int zoom;
int rayon;
int fillopt;
static bool show_err;
int l_piste;
int color;
int zoom;
int rayon;
int fillopt;
static bool show_err;
color = g_DesignSettings.m_LayerColor[track->m_Layer];
if(color & ITEM_NOT_SHOW ) return ;
color = g_DesignSettings.m_LayerColor[track->GetLayer()];
if( color & ITEM_NOT_SHOW )
return;
zoom = panel->GetZoom();
zoom = panel->GetZoom();
GRSetDrawMode(DC, draw_mode);
if( draw_mode & GR_SURBRILL)
{
if( draw_mode & GR_AND) color &= ~HIGHT_LIGHT_FLAG;
else color |= HIGHT_LIGHT_FLAG;
}
if ( color & HIGHT_LIGHT_FLAG)
color = ColorRefs[color & MASKCOLOR].m_LightColor;
GRSetDrawMode( DC, draw_mode );
if( draw_mode & GR_SURBRILL )
{
if( draw_mode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
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)
{
case S_CIRCLE:
rayon = (int)hypot((double)(track->m_End.x-track->m_Start.x),
(double)(track->m_End.y-track->m_Start.y) );
if ( (l_piste/zoom) < L_MIN_DESSIN)
{
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon , 0, color) ;
}
switch( track->m_Shape )
{
case S_CIRCLE:
rayon = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
(double) (track->m_End.y - track->m_Start.y) );
if( (l_piste / zoom) < L_MIN_DESSIN )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon, 0, color );
}
if( fillopt == SKETCH)
{
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon-l_piste, 0, color);
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon+l_piste, 0, color);
}
else
{
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon, track->m_Width,color);
}
break;
if( fillopt == SKETCH )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon - l_piste, 0, color );
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon + l_piste, 0, color );
}
else
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon, track->m_Width, color );
}
break;
case S_ARC:
{
if( fillopt == SKETCH)
{
GRArc1(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Param, track->m_Sous_Netcode, 0, color);
}
else
{
GRArc1(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Param,track->m_Sous_Netcode,
track->m_Width, color);
}
}
break;
case S_ARC:
{
if( fillopt == SKETCH )
{
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Param, track->m_Sous_Netcode, 0, color );
}
else
{
GRArc1( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Param, track->m_Sous_Netcode,
track->m_Width, color );
}
}
break;
case S_SPOT_CIRCLE:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if ( (rayon/zoom) < L_MIN_DESSIN)
{
GRCircle(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
rayon , 0, color) ;
}
case S_SPOT_CIRCLE:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if( (rayon / zoom) < L_MIN_DESSIN )
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
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 )
{
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;
case S_SPOT_RECT:
case S_RECT:
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_RECT:
case S_RECT:
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:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
case S_SPOT_OVALE:
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
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);
break;
}
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 );
break;
}
if( fillopt == SKETCH )
{
GRCSegm(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Width, color) ;
}
else
{
GRFillCSegm(&panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Width, color) ;
}
break;
if( fillopt == SKETCH )
{
GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Width, color );
}
else
{
GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y,
track->m_Width, color );
}
break;
default:
if ( ! show_err )
{
DisplayError(panel, wxT("Trace_Segment() type error"));
show_err = TRUE;
}
break;
}
default:
if( !show_err )
{
DisplayError( panel, wxT( "Trace_Segment() type error" ) );
show_err = TRUE;
}
break;
}
}
/**************************************************************************/
void Trace_DrawSegmentPcb(WinEDA_DrawPanel * panel, wxDC * DC,
DRAWSEGMENT * PtDrawSegment, int draw_mode)
void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
DRAWSEGMENT* PtDrawSegment, int draw_mode )
/**************************************************************************/
/* Affichage d'un segment type drawing PCB:
Entree : ox, oy = offset de trace
draw_mode = mode de trace ( GR_OR, GR_XOR, GrAND)
Les contours sont de differents type:
segment
cercle
arc
*/
* Entree : ox, oy = offset de trace
* draw_mode = mode de trace ( GR_OR, GR_XOR, GrAND)
* Les contours sont de differents type:
* segment
* cercle
* arc
*/
{
int ux0, uy0, dx, dy;
int l_piste;
int color, mode;
int zoom = panel->GetZoom();
int rayon;
int ux0, uy0, dx, dy;
int l_piste;
int color, mode;
int zoom = panel->GetZoom();
int rayon;
color = g_DesignSettings.m_LayerColor[PtDrawSegment->m_Layer];
if(color & ITEM_NOT_SHOW ) return ;
color = g_DesignSettings.m_LayerColor[PtDrawSegment->GetLayer()];
if( color & ITEM_NOT_SHOW )
return;
GRSetDrawMode(DC, draw_mode);
l_piste = PtDrawSegment->m_Width >> 1; /* l_piste = demi largeur piste */
GRSetDrawMode( DC, draw_mode );
l_piste = PtDrawSegment->m_Width >> 1; /* l_piste = demi largeur piste */
/* coord de depart */
ux0 = PtDrawSegment->m_Start.x;
uy0 = PtDrawSegment->m_Start.y;
/* coord d'arrivee */
dx = PtDrawSegment->m_End.x;
dy = PtDrawSegment->m_End.y;
/* coord de depart */
ux0 = PtDrawSegment->m_Start.x;
uy0 = PtDrawSegment->m_Start.y;
/* coord d'arrivee */
dx = PtDrawSegment->m_End.x;
dy = PtDrawSegment->m_End.y;
mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
if(PtDrawSegment->m_Flags & FORCE_SKETCH) mode = SKETCH;
if ( l_piste < (L_MIN_DESSIN * zoom) ) mode = FILAIRE;
mode = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
if( PtDrawSegment->m_Flags & FORCE_SKETCH )
mode = SKETCH;
if( l_piste < (L_MIN_DESSIN * zoom) )
mode = FILAIRE;
switch (PtDrawSegment->m_Shape)
{
case S_CIRCLE:
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );
if ( mode == FILAIRE)
{
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, 0, color) ;
}
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);
}
else
{
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, PtDrawSegment->m_Width,color);
}
break;
switch( PtDrawSegment->m_Shape )
{
case S_CIRCLE:
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
if( mode == FILAIRE )
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, 0, color );
}
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 );
}
else
{
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, PtDrawSegment->m_Width, color );
}
break;
case S_ARC:
{
int StAngle, EndAngle;
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );
StAngle = (int) ArcTangente(dy-uy0, dx-ux0);
EndAngle = StAngle + PtDrawSegment->m_Angle;
if ( mode == FILAIRE)
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, 0, color);
else if( mode == SKETCH)
{
GRArc(&panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle,
rayon - l_piste, color);
GRArc(&panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle,
rayon + l_piste, color);
}
else
{
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, PtDrawSegment->m_Width,color);
}
}
break;
case S_ARC:
{
int StAngle, EndAngle;
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + PtDrawSegment->m_Angle;
if( mode == FILAIRE )
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, 0, color );
else if( mode == SKETCH )
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle,
rayon - l_piste, color );
GRArc( &panel->m_ClipBox, DC, ux0, uy0, 0, StAngle, EndAngle,
rayon + l_piste, color );
}
else
{
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, PtDrawSegment->m_Width, color );
}
}
break;
default:
if( mode == FILAIRE)
GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color) ;
else if( mode == SKETCH)
{
GRCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy,
PtDrawSegment->m_Width, color) ;
}
else
{
GRFillCSegm(&panel->m_ClipBox, DC, ux0, uy0, dx, dy,
PtDrawSegment->m_Width, color) ;
}
break;
}
default:
if( mode == FILAIRE )
GRLine( &panel->m_ClipBox, DC, ux0, uy0, dx, dy, 0, color );
else if( mode == SKETCH )
{
GRCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
PtDrawSegment->m_Width, color );
}
else
{
GRFillCSegm( &panel->m_ClipBox, DC, ux0, uy0, dx, dy,
PtDrawSegment->m_Width, color );
}
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;
wxPoint pos;
int width, orient;
wxString Line;
TRACK* track;
wxPoint pos;
int width, orient;
wxString Line;
GRSetDrawMode(DC, drawmode);
track = Pcb->m_Track;
for ( ; track != NULL ; track = (TRACK*) track->Pnext )
{
if ( (track->m_Shape == S_ARC) ||
(track->m_Shape == S_CIRCLE) ||
(track->m_Shape == S_ARC_RECT) )
{
pos.x = track->m_Start.x;
pos.y = track->m_Start.y;
}
GRSetDrawMode( DC, drawmode );
track = Pcb->m_Track;
for( ; track != NULL; track = (TRACK*) track->Pnext )
{
if( (track->m_Shape == S_ARC)
|| (track->m_Shape == S_CIRCLE)
|| (track->m_Shape == S_ARC_RECT) )
{
pos.x = track->m_Start.x;
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
{
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;
}
DrawGraphicText(panel, DC,
pos, g_DCodesColor, Line,
orient, wxSize(width, width),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER);
}
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 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,
* else SCAN_CONTINUE;
*/
@ -154,7 +154,7 @@ public:
unsigned long m_TimeStamp; // Time stamp used for logical links
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:
int m_Status;
@ -298,21 +298,6 @@ public:
**/
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
};
@ -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
{
public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start 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)
#endif
/* violation of C++ standard, cannot use MIN() and MAX()
#ifndef min
#define min(x, y) ((x) > (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#endif
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif
*/
#ifndef MIN
#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:
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_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
EQUIPOT* m_Equipots; // pointeur liste zone equipot
TRACK* m_Track; // pointeur relatif zone piste
@ -339,15 +339,19 @@ public:
/* Description des elements du PCB */
/***********************************/
class DRAWSEGMENT : public EDA_BaseLineStruct
class DRAWSEGMENT : public BOARD_ITEM
{
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_Type; // numero de sous type ( cotation.. )
int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg
public:
DRAWSEGMENT( EDA_BaseStruct* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT );
DRAWSEGMENT( BOARD_ITEM* StructFather, DrawStructureType idtype = TYPEDRAWSEGMENT );
~DRAWSEGMENT( void );
// Read/write data
@ -405,7 +409,7 @@ public:
class EDGE_ZONE : public DRAWSEGMENT
{
public:
EDGE_ZONE( EDA_BaseStruct* StructFather );
EDGE_ZONE( BOARD_ITEM* StructFather );
EDGE_ZONE( const EDGE_ZONE& edgezone );
~EDGE_ZONE( void );
};
@ -415,7 +419,7 @@ public:
/* Gestion des marqueurs sur le PCB */
/************************************/
class MARQUEUR : public EDA_BaseStruct
class MARQUEUR : public BOARD_ITEM
{
/* Description d'un marqueur */
public:
@ -426,7 +430,7 @@ public:
wxString m_Diag; /* Associated text (comment) */
public:
MARQUEUR( EDA_BaseStruct* StructFather );
MARQUEUR( BOARD_ITEM* StructFather );
~MARQUEUR( void );
void UnLink( void );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );

View File

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

View File

@ -448,7 +448,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
PtStruct = m_Pcb->m_Drawings;
TRACK TmpSegm( NULL );
TmpSegm.m_Layer = -1;
TmpSegm.SetLayer( -1 );
TmpSegm.m_NetCode = -1;
TmpSegm.m_Width = g_GridRoutingSize / 2;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
@ -459,7 +459,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
{
case TYPEDRAWSEGMENT:
DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->m_Layer != EDGE_N )
if( DrawSegm->GetLayer() != EDGE_N )
break;
TmpSegm.m_Start = DrawSegm->m_Start;
@ -536,9 +536,9 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module )
fy = m_Pcb->m_BoundaryBox.GetBottom();
masque_layer = 0;
if( Module->m_Layer == CMP_N )
if( Module->GetLayer() == CMP_N )
masque_layer = CMP_LAYER;
if( Module->m_Layer == CUIVRE_N )
if( Module->GetLayer() == CUIVRE_N )
masque_layer = CUIVRE_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;
masque_otherlayer = CUIVRE_LAYER;
if( Module->m_Layer == CUIVRE_N )
if( Module->GetLayer() == CUIVRE_N )
masque_otherlayer = CMP_LAYER;
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;
side = TOP; otherside = BOTTOM;
if( Module->m_Layer == CUIVRE_N )
if( Module->GetLayer() == CUIVRE_N )
{
side = BOTTOM; otherside = TOP;
}
@ -1064,7 +1064,7 @@ static void TracePenaliteRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int u
if( trace & 2 )
{
data = GetDist( row, col, TOP );
data = max( data, LocalPenalite );
data = MAX( data, LocalPenalite );
SetDist( row, col, TOP, data );
}
}
@ -1193,7 +1193,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
{
int rayon, cx, cy, d;
int xmax, ymax;
EDA_BaseStruct* PtStruct;
BOARD_ITEM* PtStruct;
DRAWSEGMENT* ptr;
bool succes = FALSE;
@ -1205,7 +1205,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
/* Analyse des Contours PCB */
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
if( PtStruct->m_StructType != TYPEDRAWSEGMENT )
continue;
@ -1217,21 +1217,21 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
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 += d;
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 );
xmax = max( xmax, cx + rayon );
ymax = max( ymax, cy + 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 );
xmax = MAX( xmax, cx + rayon );
ymax = MAX( ymax, cy + rayon );
}
else
{
cx = min( ptr->m_Start.x, ptr->m_End.x );
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.y = min( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d );
cx = max( ptr->m_Start.x, ptr->m_End.x );
cy = max( ptr->m_Start.y, ptr->m_End.y );
xmax = max( xmax, cx + d );
ymax = max( ymax, cy + d );
cx = MIN( ptr->m_Start.x, ptr->m_End.x );
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.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d );
cx = MAX( ptr->m_Start.x, ptr->m_End.x );
cy = MAX( ptr->m_Start.y, ptr->m_End.y );
xmax = MAX( xmax, cx + 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
*/
{
EDA_BaseStruct* PtStruct, * NextS;
BOARD_ITEM* PtStruct, * NextS;
int masque_layer;
if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) )
@ -448,7 +448,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) NextS )
{
NextS = module->Pnext;
NextS = module->Next();
if( IsModuleInBox( GetScreen()->BlockLocate, module ) == NULL )
continue;
/* le module est ici bon a etre efface */
@ -467,9 +467,10 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
Affiche_Message( _( "Delete tracks" ) );
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 ) )
{ /* la piste est ici bonne a etre efface */
{
/* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR );
DeleteStructure( pt_segm );
}
@ -487,14 +488,14 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = NextS )
{
NextS = PtStruct->Pnext;
NextS = PtStruct->Next();
switch( PtStruct->m_StructType )
{
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -517,7 +518,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -529,7 +530,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -551,7 +552,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
Affiche_Message( _( "Delete zones" ) );
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 ) )
{ /* la piste est ici bonne a etre efface */
pt_segm->Draw( DrawPanel, DC, GR_XOR );
@ -682,7 +683,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -715,7 +716,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -728,7 +729,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -852,7 +853,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
INVERT( track->m_End.y );
if( track->m_StructType != TYPEVIA )
{
track->m_Layer = ChangeSideNumLayer( track->m_Layer );
track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) );
}
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
INVERT( track->m_Start.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 = (TRACK*) track->Pnext;
@ -897,7 +898,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -909,7 +910,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
}
INVERT( STRUCT->m_Start.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 );
break;
@ -925,11 +926,11 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
/* Redessin du Texte */
INVERT( STRUCT->m_Pos.y );
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_Layer = ChangeSideNumLayer( STRUCT->m_Layer );
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
STRUCT->CreateDrawData();
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
break;
@ -937,21 +938,21 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
/* l'element est ici bon a etre modifie */
( (MIREPCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
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 );
break;
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -982,7 +983,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
INVERT( STRUCT->FlecheD2_oy );
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 );
break;
@ -1111,7 +1112,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
case TYPEDRAWSEGMENT:
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -1139,7 +1140,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -1152,7 +1153,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -1315,7 +1316,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
#undef STRUCT
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -1357,7 +1358,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;
@ -1377,7 +1378,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->m_Layer] & masque_layer) == 0 )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( IsStructInBox( GetScreen()->BlockLocate, PtStruct ) == NULL )
break;

View File

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

Some files were not shown because too many files have changed in this diff Show More