more BOARD_ITEM::Draw() support

This commit is contained in:
dickelbeck 2008-04-01 06:32:48 +00:00
parent f1b36209b1
commit a196a324d8
8 changed files with 55 additions and 107 deletions

View File

@ -13,7 +13,10 @@ email address.
+pcbnew +pcbnew
Added virtual BOARD_ITEM::Draw() and forced all BOARD_ITEM derived classes Added virtual BOARD_ITEM::Draw() and forced all BOARD_ITEM derived classes
to implement it so that all these functions are also virtual. 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> 2008-Mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -118,8 +118,6 @@ 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 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_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, 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);

View File

@ -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 ) void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )
/*****************************************************************************************/ /*****************************************************************************************/

View File

@ -509,7 +509,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
break; break;
/* l'element est ici bon a etre efface */ /* l'element est ici bon a etre efface */
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, GR_XOR ); PtStruct->Draw( DrawPanel, DC, GR_XOR );
PtStruct->DeleteStructure(); PtStruct->DeleteStructure();
break; break;
@ -1231,7 +1231,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
m_Pcb->m_Drawings = new_drawsegment; m_Pcb->m_Drawings = new_drawsegment;
new_drawsegment->m_Start += MoveVector; new_drawsegment->m_Start += MoveVector;
new_drawsegment->m_End += MoveVector; new_drawsegment->m_End += MoveVector;
Trace_DrawSegmentPcb( DrawPanel, DC, new_drawsegment, GR_OR ); new_drawsegment->Draw( DrawPanel, DC, GR_OR );
break; break;
} }

View File

@ -30,7 +30,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
{ {
if( drawitem == NULL ) if( drawitem == NULL )
return; return;
Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_XOR ); drawitem->Draw( DrawPanel, DC, GR_XOR );
drawitem->m_Flags |= IS_MOVED; drawitem->m_Flags |= IS_MOVED;
cursor_pos = cursor_pos0 = GetScreen()->m_Curseur; cursor_pos = cursor_pos0 = GetScreen()->m_Curseur;
drawitem->Display_Infos( this ); drawitem->Display_Infos( this );
@ -52,7 +52,7 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
if( drawitem == NULL ) if( drawitem == NULL )
return; return;
Trace_DrawSegmentPcb( DrawPanel, DC, drawitem, GR_OR ); drawitem->Draw( DrawPanel, DC, GR_OR );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
@ -77,7 +77,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* efface ancienne position */ /* efface ancienne position */
if( erase ) if( erase )
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR ); Segment->Draw( panel, DC, GR_XOR );
wxPoint delta; wxPoint delta;
delta.x = panel->GetScreen()->m_Curseur.x - cursor_pos.x; 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; Segment->m_End.y += delta.y;
cursor_pos = panel->GetScreen()->m_Curseur; cursor_pos = panel->GetScreen()->m_Curseur;
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR ); Segment->Draw( panel, DC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill; 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 */ /* effacement du segment en cours de trace */
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
Trace_DrawSegmentPcb( DrawPanel, DC, Segment, GR_XOR ); Segment->Draw( DrawPanel, DC, GR_XOR );
PtStruct = Segment->Pback; PtStruct = Segment->Pback;
Segment ->DeleteStructure(); Segment ->DeleteStructure();
if( PtStruct && (PtStruct->Type() == TYPEDRAWSEGMENT ) ) if( PtStruct && (PtStruct->Type() == TYPEDRAWSEGMENT ) )
@ -117,7 +117,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
} }
else else
{ {
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) Segment, GR_XOR ); Segment->Draw( DrawPanel, DC, GR_XOR );
Segment->m_Flags = 0; Segment->m_Flags = 0;
Segment ->DeleteStructure(); Segment ->DeleteStructure();
SetCurItem( NULL ); SetCurItem( NULL );
@ -136,14 +136,14 @@ void WinEDA_PcbFrame::Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC )
if( DrawSegm == NULL ) if( DrawSegm == NULL )
return; return;
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_XOR ); DrawSegm->Draw( DrawPanel, DC, GR_XOR );
if( DrawSegm->GetLayer() == EDGE_N ) if( DrawSegm->GetLayer() == EDGE_N )
DrawSegm->m_Width = g_DesignSettings.m_EdgeSegmentWidth; DrawSegm->m_Width = g_DesignSettings.m_EdgeSegmentWidth;
else else
DrawSegm->m_Width = g_DesignSettings.m_DrawSegmentWidth; DrawSegm->m_Width = g_DesignSettings.m_DrawSegmentWidth;
Trace_DrawSegmentPcb( DrawPanel, DC, DrawSegm, GR_OR ); DrawSegm->Draw( DrawPanel, DC, GR_OR );
DrawSegm->Display_Infos( this ); DrawSegm->Display_Infos( this );
@ -182,13 +182,6 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
switch( item->Type() ) switch( item->Type() )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if( item->GetLayer() == layer )
{
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) item, GR_XOR );
item->DeleteStructure();
}
break;
case TYPETEXTE: case TYPETEXTE:
case TYPECOTATION: case TYPECOTATION:
if( item->GetLayer() == layer ) if( item->GetLayer() == layer )
@ -228,7 +221,7 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur( Panel, DC, TRUE ); Panel->ManageCurseur( Panel, DC, TRUE );
Panel->GetScreen()->m_Curseur = pos; Panel->GetScreen()->m_Curseur = pos;
Segment->m_Flags = 0; Segment->m_Flags = 0;
Trace_DrawSegmentPcb( Panel, DC, Segment, GR_OR ); Segment->Draw( Panel, DC, GR_OR );
} }
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
@ -285,7 +278,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
GetScreen()->SetModify(); GetScreen()->SetModify();
Segment->m_Flags = 0; Segment->m_Flags = 0;
Trace_DrawSegmentPcb( DrawPanel, DC, Segment, GR_OR ); Segment->Draw( DrawPanel, DC, GR_OR );
DrawItem = Segment; DrawItem = Segment;
@ -317,7 +310,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{ {
if( Segment == NULL ) if( Segment == NULL )
return; return;
Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) Segment, GR_OR ); Segment->Draw( DrawPanel, DC, GR_OR );
/* Effacement si Longueur nulle */ /* Effacement si Longueur nulle */
if( (Segment->m_Start.x == Segment->m_End.x) if( (Segment->m_Start.x == Segment->m_End.x)
@ -358,7 +351,7 @@ static void Montre_Position_NewSegment( WinEDA_DrawPanel* panel,
/* efface ancienne position */ /* efface ancienne position */
if( erase ) if( erase )
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR ); Segment->Draw( panel, DC, GR_XOR );
if( Segments_45_Only && (Segment->m_Shape == S_SEGMENT ) ) 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; Segment->m_End = panel->GetScreen()->m_Curseur;
} }
Trace_DrawSegmentPcb( panel, DC, Segment, GR_XOR ); Segment->Draw( panel, DC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill; DisplayOpt.DisplayDrawItems = t_fill;
} }

View File

@ -29,7 +29,6 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
*/ */
{ {
MODULE* Module; MODULE* Module;
BOARD_ITEM* PtStruct;
int drawmode = GR_COPY; int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
TRACK* pt_piste; TRACK* pt_piste;
@ -55,40 +54,21 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
printmasklayer |= EDGE_LAYER; printmasklayer |= EDGE_LAYER;
/* Draw the pcb graphic items (texts, ...) */ /* Draw the pcb graphic items (texts, ...) */
PtStruct = Pcb->m_Drawings; for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break;
Trace_DrawSegmentPcb( this, DC, (DRAWSEGMENT*) PtStruct, drawmode );
break;
case TYPECOTATION: case TYPECOTATION:
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break;
( (COTATION*) PtStruct )->Draw( this, DC, drawmode );
break;
case TYPETEXTE: case TYPETEXTE:
{
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 )
break;
( (TEXTE_PCB*) PtStruct )->Draw( this, DC, drawmode );
break;
}
case TYPEMIRE: case TYPEMIRE:
if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 ) if( ((1<<item->GetLayer()) & printmasklayer) == 0 )
break; break;
( (MIREPCB*) PtStruct )->Draw( this, DC, drawmode );
item->Draw( this, DC, drawmode );
break; break;
case TYPEMARKER: /* Trace des marqueurs */ case TYPEMARKER: /* Trace des marqueurs */
break;
default: default:
break; break;
} }

View File

@ -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 * 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 : */ /* TRACEMOD.C : */

View File

@ -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 );
}