Commit a196a324 authored by dickelbeck's avatar dickelbeck

more BOARD_ITEM::Draw() support

parent f1b36209
......@@ -13,7 +13,10 @@ email address.
+pcbnew
Added virtual BOARD_ITEM::Draw() and forced all BOARD_ITEM derived classes
to implement it so that all these functions are also virtual.
Made the offset argument default to the new wxPoint BOARD_ITEM::ZeroOffset
Made the offset argument default to the new wxPoint BOARD_ITEM::ZeroOffset.
Coded DRAWSEGMENT::Draw() from Trace_DrawSegmentPcb() and removed the latter.
Coded EQUIPOT::Draw(), and BOARD::Draw(). Both are dummies for now, but
both can be reasonably implemented in the future.
2008-Mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
......
......@@ -43,15 +43,15 @@ void ComputePlotFileName( char * FullFileName, char * Ext );
void calcule_coord_plot(int * dx, int * dy ) ;
void calcule_dim_plot(int * dx, int * dy ) ;
void Trace_Un_TextePcb( TEXTE_PCB * pt_texte,int format_plot,int masque_layer);
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
prepare les parametres de trace de Plot_1_texte */
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
prepare les parametres de trace de Plot_1_texte */
void trace_1_arc(int format_plot,int cx,int cy,int start,int end,
int rayon,int epaisseur);
int rayon,int epaisseur);
void trace_1_cercle(int format_plot,int epaisseur,int cx, int cy, int rayon);
void Plot_1_texte( int format_plot,
char * ptr,int t_nbcodes, int t_orient,
int epaisseur, int ox,int oy,int size_h,int size_v);
/* Routine de base de trace de 1 chaine de caracteres */
char * ptr,int t_nbcodes, int t_orient,
int epaisseur, int ox,int oy,int size_h,int size_v);
/* Routine de base de trace de 1 chaine de caracteres */
void Trace_Un_DrawSegment( DRAWSEGMENT* PtSegm, int format_plot,int masque_layer );
......@@ -59,56 +59,56 @@ void Trace_Une_MirePcb( MIREPCB* PtMire, int format_plot,int masque_layer );
/* PLOTGERB.CC */
void trace_1_segment_GERBER(int pos_X0,int pos_Y0,int pos_X1,int pos_Y1,
int hauteur);
int hauteur);
void trace_1_cercle_GERBER( int cx, int cy, int rayon, int epaisseur);
void trace_1_contour_GERBER(int cX,int cY, int dimX,int dimY,
int deltaX, int deltaY,
int dim_trait, int orient);
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
donne par son centre cX, cY, ses dimensions dimX et dimY,
ses variations deltaX et deltaY et son orientation orient */
int deltaX, int deltaY,
int dim_trait, int orient);
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
donne par son centre cX, cY, ses dimensions dimX et dimY,
ses variations deltaX et deltaY et son orientation orient */
/* PLOTHPGL.CC */
void Init_Trace_HPGL();
void Fin_Trace_HPGL();
void trace_1_segment_HPGL(int pos_X0,int pos_Y0,int pos_X1,int pos_Y1,
int hauteur);
int hauteur);
void trace_1_pad_TRAPEZE_HPGL(int cX,int cY,
int dimX,int dimY,int deltaX, int deltaY,
int orient,int modetrace);
int dimX,int dimY,int deltaX, int deltaY,
int orient,int modetrace);
void trace_1_pastille_RONDE_HPGL(int pos_X,int pos_Y,int diametre,int modetrace) ;
void trace_1_pastille_OVALE_HPGL(int pos_X,int pos_Y,int dx,int dy,
int orient,int modetrace) ;
int orient,int modetrace) ;
void trace_1_pad_rectangulaire_HPGL(int cX,int cY,int dimX,int dimY,
int orient,int modetrace) ;
int orient,int modetrace) ;
void Move_Plume_HPGL( int x,int y,int plume);
/* deplace la plume levee (plume = 'U') ou baissee (plume = 'D')
en position x,y */
/* deplace la plume levee (plume = 'U') ou baissee (plume = 'D')
en position x,y */
void Plume_HPGL( int plume );
/* leve (plume = 'U') ou baisse (plume = 'D') la plume */
/* leve (plume = 'U') ou baisse (plume = 'D') la plume */
/**************/
/* PRINTPS.CC */
/**************/
void trace_1_pastille_OVALE_POST(int pos_X,int pos_Y,
int dx, int dy, int orient, int modetrace);
int dx, int dy, int orient, int modetrace);
void trace_1_pastille_RONDE_POST(int pos_X,int pos_Y,int diametre,
int modetrace);
int modetrace);
void trace_1_pad_rectangulaire_POST(int cX,int cY,
int dimX,int dimY,int orient,
int modetrace);
int dimX,int dimY,int orient,
int modetrace);
void trace_1_contour_POST(int cX,int cY, int dimX,int dimY,
int deltaX, int deltaY,
int dim_trait, int orient);
int deltaX, int deltaY,
int dim_trait, int orient);
void trace_1_pad_TRAPEZE_POST(int cX,int cY,
int dimX,int dimY,int deltaX, int deltaY,
int orient,int modetrace);
int dimX,int dimY,int deltaX, int deltaY,
int orient,int modetrace);
void trace_1_segment_POST(int pos_X0,int pos_Y0,int pos_X1,int pos_Y1,
int large);
int large);
void trace_1_Cercle_POST(int pos_X,int pos_Y,int diametre, int width);
void PlotArcPS(int x, int y, int StAngle, int EndAngle, int rayon, int width);
......@@ -118,13 +118,11 @@ void PlotArcPS(int x, int y, int StAngle, int EndAngle, int rayon, int width);
/***************/
void Draw_Track_Buffer(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb, int drawmode, int printmasklayer);
void Trace_Segment(WinEDA_DrawPanel * panel, wxDC * DC, TRACK* pt_piste, int draw_mode);
void Trace_DrawSegmentPcb(WinEDA_DrawPanel * panel, wxDC * DC,
DRAWSEGMENT * PtDrawSegment, int draw_mode);
void Trace_1_texte_pcb(WinEDA_DrawPanel * panel, wxDC * DC,
TEXTE_PCB * pt_texte,int ox,int oy, int DrawMode);
TEXTE_PCB * pt_texte,int ox,int oy, int DrawMode);
void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC,
BOARD * Pcb, int drawmode);
BOARD * Pcb, int drawmode);
/*************/
/* dcode.cpp */
......
......@@ -217,17 +217,6 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
}
/**************************************************************************/
void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
DRAWSEGMENT* PtDrawSegment, int draw_mode )
/**************************************************************************/
{
// @todo Replace all calls to Trace_DrawSegmentPcb() with this call:
PtDrawSegment->Draw( panel, DC, draw_mode );
}
/*****************************************************************************************/
void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )
/*****************************************************************************************/
......
......@@ -509,7 +509,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
break;
/* l'element est ici bon a etre efface */
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_XOR );
PtStruct->Draw( DrawPanel, DC, GR_XOR );
PtStruct->DeleteStructure();
break;
......@@ -1231,7 +1231,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
m_Pcb->m_Drawings = new_drawsegment;
new_drawsegment->m_Start += MoveVector;
new_drawsegment->m_End += MoveVector;
Trace_DrawSegmentPcb( DrawPanel, DC, new_drawsegment, GR_OR );
new_drawsegment->Draw( DrawPanel, DC, GR_OR );
break;
}
......
......@@ -30,7 +30,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
{
if( drawitem == NULL )
return;
Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_XOR );
drawitem->Draw( DrawPanel, DC, GR_XOR );
drawitem->m_Flags |= IS_MOVED;
cursor_pos = cursor_pos0 = GetScreen()->m_Curseur;
drawitem->Display_Infos( this );
......@@ -52,7 +52,7 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
if( drawitem == NULL )
return;
Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_OR );
drawitem->Draw( DrawPanel, DC, GR_OR );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL );
......@@ -77,7 +77,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* efface ancienne position */
if( erase )
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR );
Segment->Draw( panel, DC, GR_XOR );
wxPoint delta;
delta.x = panel->GetScreen()->m_Curseur.x - cursor_pos.x;
......@@ -88,7 +88,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
Segment->m_End.y += delta.y;
cursor_pos = panel->GetScreen()->m_Curseur;
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR );
Segment->Draw( panel, DC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill;
}
......@@ -107,7 +107,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{
/* effacement du segment en cours de trace */
DisplayOpt.DisplayDrawItems = SKETCH;
Trace_DrawSegmentPcb( DrawPanel, DC, Segment, GR_XOR );
Segment->Draw( DrawPanel, DC, GR_XOR );
PtStruct = Segment->Pback;
Segment ->DeleteStructure();
if( PtStruct && (PtStruct->Type() == TYPEDRAWSEGMENT ) )
......@@ -117,7 +117,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
}
else
{
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) Segment, GR_XOR );
Segment->Draw( DrawPanel, DC, GR_XOR );
Segment->m_Flags = 0;
Segment ->DeleteStructure();
SetCurItem( NULL );
......@@ -136,14 +136,14 @@ void WinEDA_PcbFrame::Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC )
if( DrawSegm == NULL )
return;
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_XOR );
DrawSegm->Draw( DrawPanel, DC, GR_XOR );
if( DrawSegm->GetLayer() == EDGE_N )
DrawSegm->m_Width = g_DesignSettings.m_EdgeSegmentWidth;
else
DrawSegm->m_Width = g_DesignSettings.m_DrawSegmentWidth;
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_OR );
DrawSegm->Draw( DrawPanel, DC, GR_OR );
DrawSegm->Display_Infos( this );
......@@ -182,13 +182,6 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
switch( item->Type() )
{
case TYPEDRAWSEGMENT:
if( item->GetLayer() == layer )
{
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) item, GR_XOR );
item->DeleteStructure();
}
break;
case TYPETEXTE:
case TYPECOTATION:
if( item->GetLayer() == layer )
......@@ -228,7 +221,7 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur( Panel, DC, TRUE );
Panel->GetScreen()->m_Curseur = pos;
Segment->m_Flags = 0;
Trace_DrawSegmentPcb( Panel, DC, Segment, GR_OR );
Segment->Draw( Panel, DC, GR_OR );
}
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
......@@ -285,7 +278,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
GetScreen()->SetModify();
Segment->m_Flags = 0;
Trace_DrawSegmentPcb( DrawPanel, DC, Segment, GR_OR );
Segment->Draw( DrawPanel, DC, GR_OR );
DrawItem = Segment;
......@@ -317,7 +310,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{
if( Segment == NULL )
return;
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) Segment, GR_OR );
Segment->Draw( DrawPanel, DC, GR_OR );
/* Effacement si Longueur nulle */
if( (Segment->m_Start.x == Segment->m_End.x)
......@@ -358,7 +351,7 @@ static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel,
/* efface ancienne position */
if( erase )
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR );
Segment->Draw( panel, DC, GR_XOR );
if( Segments_45_Only && (Segment->m_Shape == S_SEGMENT ) )
{
......@@ -370,6 +363,6 @@ static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel,
Segment->m_End = panel->GetScreen()->m_Curseur;
}
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR );
Segment->Draw( panel, DC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill;
}
......@@ -29,7 +29,6 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
*/
{
MODULE* Module;
BOARD_ITEM* PtStruct;
int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt;
TRACK* pt_piste;
......@@ -55,40 +54,21 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
printmasklayer |= EDGE_LAYER;
/* Draw the pcb graphic items (texts, ...) */
PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPEDRAWSEGMENT:
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break;
Trace_DrawSegmentPcb( this, DC, (DRAWSEGMENT*) PtStruct, drawmode );
break;
case TYPECOTATION:
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break;
( (COTATION*) PtStruct )->Draw( this, DC, drawmode );
break;
case TYPETEXTE:
{
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break;
( (TEXTE_PCB*) PtStruct )->Draw( this, DC, drawmode );
break;
}
case TYPEMIRE:
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
if( ((1<<item->GetLayer()) & printmasklayer) == 0 )
break;
( (MIREPCB*) PtStruct )->Draw( this, DC, drawmode );
break;
case TYPEMARKER: /* Trace des marqueurs */
item->Draw( this, DC, drawmode );
break;
case TYPEMARKER: /* Trace des marqueurs */
default:
break;
}
......
......@@ -65,11 +65,6 @@ void Trace_Une_Piste( WinEDA_DrawPanel* panel,
* donc mis a 0 avant appel a la routine si la piste a tracer est la derniere
*/
void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel,
wxDC* DC,
DRAWSEGMENT* PtDrawSegment,
int mode_color );
/****************/
/* TRACEMOD.C : */
......
......@@ -58,13 +58,3 @@ void Trace_Une_Piste( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* Track,
}
/*************************************************************/
void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
DRAWSEGMENT* PtDrawSegment, int draw_mode )
/*************************************************************/
{
// @todo Replace all calls to Trace_DrawSegmentPcb() with this call:
PtDrawSegment->Draw( panel, DC, draw_mode );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment