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>
......
......@@ -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 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);
......
......@@ -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 )
break;
( (MIREPCB*) PtStruct )->Draw( this, DC, drawmode );
if( ((1<<item->GetLayer()) & printmasklayer) == 0 )
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