|
|
|
@ -17,45 +17,36 @@ |
|
|
|
#include "protos.h"
|
|
|
|
#include "class_board_design_settings.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
BOARD* Pcb, |
|
|
|
int drawmode, |
|
|
|
int printmasklayer ); |
|
|
|
static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
|
BOARD* Pcb, int drawmode ); |
|
|
|
|
|
|
|
/************************************************************************************************************/ |
|
|
|
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer, bool aPrintMirrorMode ) |
|
|
|
/*************************************************************************************************************/ |
|
|
|
/* Draw gerbview layers, for printing
|
|
|
|
*/ |
|
|
|
void WinEDA_DrawPanel::PrintPage( wxDC* DC, |
|
|
|
bool Print_Sheet_Ref, |
|
|
|
int printmasklayer, |
|
|
|
bool aPrintMirrorMode ) |
|
|
|
*/ |
|
|
|
{ |
|
|
|
DISPLAY_OPTIONS save_opt; |
|
|
|
int DisplayPolygonsModeImg; |
|
|
|
int DisplayPolygonsModeImg; |
|
|
|
|
|
|
|
save_opt = DisplayOpt; |
|
|
|
if( printmasklayer & ALL_CU_LAYERS ) |
|
|
|
{ |
|
|
|
DisplayOpt.DisplayPadFill = true; |
|
|
|
DisplayOpt.DisplayViaFill = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
DisplayOpt.DisplayPadFill = false; |
|
|
|
DisplayOpt.DisplayViaFill = false; |
|
|
|
} |
|
|
|
DisplayOpt.DisplayPadNum = 0; |
|
|
|
DisplayOpt.DisplayPadNoConn = 0; |
|
|
|
DisplayOpt.DisplayPadIsol = 0; |
|
|
|
DisplayOpt.DisplayModEdge = FILLED; |
|
|
|
DisplayOpt.DisplayModText = FILLED; |
|
|
|
DisplayOpt.DisplayPcbTrackFill = FILLED; |
|
|
|
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = FILLED; |
|
|
|
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; |
|
|
|
DisplayOpt.DisplayDrawItems = FILLED; |
|
|
|
DisplayOpt.DisplayZonesMode = 0; |
|
|
|
DisplayOpt.DisplayDrawItems = FILLED; |
|
|
|
DisplayOpt.DisplayZonesMode = 0; |
|
|
|
|
|
|
|
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch; |
|
|
|
g_DisplayPolygonsModeSketch = 0; |
|
|
|
|
|
|
|
m_PrintIsMirrored = aPrintMirrorMode; |
|
|
|
|
|
|
|
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, |
|
|
|
GR_COPY, |
|
|
|
printmasklayer ); |
|
|
|
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer ); |
|
|
|
|
|
|
|
if( Print_Sheet_Ref ) |
|
|
|
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 ); |
|
|
|
@ -67,11 +58,14 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Trace the PCB, and additional elements (axis, grid ..)
|
|
|
|
*/ |
|
|
|
/*******************************************************************/ |
|
|
|
void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) |
|
|
|
/*******************************************************************/ |
|
|
|
|
|
|
|
/* Trace le PCB, et les elements complementaires ( axes, grille .. )
|
|
|
|
*/ |
|
|
|
{ |
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen(); |
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); |
|
|
|
|
|
|
|
if( !GetBoard() ) |
|
|
|
return; |
|
|
|
@ -92,67 +86,63 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) |
|
|
|
DrawPanel->Trace_Curseur( DC ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Redraw the BOARD items but not cursors, axis or grid */ |
|
|
|
|
|
|
|
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
|
|
|
|
/********************************************************************/ |
|
|
|
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC, |
|
|
|
int aDrawMode, const wxPoint& offset ) |
|
|
|
/********************************************************************/ |
|
|
|
/* Redraw the BOARD items but not cursors, axis or grid */ |
|
|
|
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
|
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Trace all elements of PCBs on the active screen. |
|
|
|
* |
|
|
|
* @param DC = device context to draw |
|
|
|
* @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) |
|
|
|
*/ |
|
|
|
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, |
|
|
|
int draw_mode, |
|
|
|
int printmasklayer ) |
|
|
|
/***********************************************************************************/ |
|
|
|
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ) |
|
|
|
/***********************************************************************************/ |
|
|
|
/* Draws the gerber items on screen
|
|
|
|
* @param DC = current device context |
|
|
|
* @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) |
|
|
|
*/ |
|
|
|
{ |
|
|
|
if( !GetBoard() ) |
|
|
|
return; |
|
|
|
|
|
|
|
bool erase = false; |
|
|
|
int Color; |
|
|
|
bool filled; |
|
|
|
bool erase = false; |
|
|
|
int Color; |
|
|
|
bool filled; |
|
|
|
|
|
|
|
// Draw filled polygons
|
|
|
|
std::vector<wxPoint> points; |
|
|
|
std::vector<wxPoint> points; |
|
|
|
|
|
|
|
// minimize reallocations of the vector's internal array by starting with a
|
|
|
|
// good sized one.
|
|
|
|
points.reserve( 10000 ); |
|
|
|
// minimize reallocations of the vector's internal array by starting with a good sized one.
|
|
|
|
points.reserve(10000); |
|
|
|
|
|
|
|
for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) |
|
|
|
for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) |
|
|
|
{ |
|
|
|
if( !(track->ReturnMaskLayer() & printmasklayer) ) |
|
|
|
continue; |
|
|
|
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) |
|
|
|
continue; |
|
|
|
|
|
|
|
D( printf( "D:%p\n", track ); ) |
|
|
|
// D(printf("D:%p\n", track );)
|
|
|
|
|
|
|
|
if( track->GetNet() == 0 ) // StartPoint
|
|
|
|
{ |
|
|
|
if( points.size() ) // we have found a new polygon: Draw the
|
|
|
|
// old polygon
|
|
|
|
if( points.size() ) // we have found a new polygon: Draw the old polygon
|
|
|
|
{ |
|
|
|
if( erase ) |
|
|
|
{ |
|
|
|
Color = g_DrawBgColor; |
|
|
|
Color = g_DrawBgColor; |
|
|
|
filled = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; |
|
|
|
Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; |
|
|
|
filled = (g_DisplayPolygonsModeSketch == 0); |
|
|
|
} |
|
|
|
|
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, |
|
|
|
points.size(), &points[0], |
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0], |
|
|
|
filled, Color, Color ); |
|
|
|
} |
|
|
|
|
|
|
|
@ -171,13 +161,13 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, |
|
|
|
{ |
|
|
|
if( erase ) |
|
|
|
{ |
|
|
|
Color = g_DrawBgColor; |
|
|
|
Color = g_DrawBgColor; |
|
|
|
filled = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; |
|
|
|
filled = ( g_DisplayPolygonsModeSketch == 0 ); |
|
|
|
Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; |
|
|
|
filled = (g_DisplayPolygonsModeSketch == 0); |
|
|
|
} |
|
|
|
|
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0], |
|
|
|
@ -185,8 +175,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Draw tracks and flashes down here. This will probably not be a final
|
|
|
|
// solution to drawing order issues
|
|
|
|
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
|
|
|
|
Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer ); |
|
|
|
|
|
|
|
if( DisplayOpt.DisplayPadNum ) |
|
|
|
@ -195,34 +184,32 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, |
|
|
|
GetScreen()->ClrRefreshReq(); |
|
|
|
} |
|
|
|
|
|
|
|
/***************************************************************************************************/ |
|
|
|
void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode, |
|
|
|
int printmasklayer ) |
|
|
|
/***************************************************************************************************/ |
|
|
|
|
|
|
|
/* Function to draw the tracks (i.e Spots or lines) in gerbview
|
|
|
|
* 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 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) |
|
|
|
*/ |
|
|
|
void Draw_Track_Buffer( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
BOARD* Pcb, |
|
|
|
int draw_mode, |
|
|
|
int printmasklayer ) |
|
|
|
{ |
|
|
|
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; |
|
|
|
GERBER* gerber = g_GERBER_List[layer]; |
|
|
|
int dcode_hightlight = 0; |
|
|
|
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; |
|
|
|
GERBER* gerber = g_GERBER_List[layer]; |
|
|
|
int dcode_hightlight = 0; |
|
|
|
|
|
|
|
if( gerber ) |
|
|
|
dcode_hightlight = gerber->m_Selected_Tool; |
|
|
|
|
|
|
|
for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) |
|
|
|
for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) |
|
|
|
{ |
|
|
|
if( !(track->ReturnMaskLayer() & printmasklayer) ) |
|
|
|
continue; |
|
|
|
|
|
|
|
D( printf( "D:%p\n", track ); ) |
|
|
|
// D(printf("D:%p\n", track );)
|
|
|
|
|
|
|
|
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) |
|
|
|
Trace_Segment( panel, DC, track, draw_mode | GR_SURBRILL ); |
|
|
|
@ -234,16 +221,15 @@ void Draw_Track_Buffer( WinEDA_DrawPanel* panel, |
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
|
|
|
/***********************************************************************************/ |
|
|
|
void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode ) |
|
|
|
/***********************************************************************************/ |
|
|
|
|
|
|
|
/* Trace 1 segment of track.
|
|
|
|
* Parameters: |
|
|
|
* Track = address of the description of the track buflib |
|
|
|
* Draw_mode = mode (GR_XOR, GR_OR ..) |
|
|
|
/* 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..) |
|
|
|
*/ |
|
|
|
void Trace_Segment( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
TRACK* track, |
|
|
|
int draw_mode ) |
|
|
|
{ |
|
|
|
int l_piste; |
|
|
|
int color; |
|
|
|
@ -252,8 +238,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, |
|
|
|
int halfPenWidth; |
|
|
|
static bool show_err; |
|
|
|
|
|
|
|
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by
|
|
|
|
// class TRACK in gerbview
|
|
|
|
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
|
|
|
|
{ |
|
|
|
color = g_DrawBgColor; |
|
|
|
} |
|
|
|
@ -277,6 +262,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, |
|
|
|
|
|
|
|
GRSetDrawMode( DC, draw_mode ); |
|
|
|
|
|
|
|
|
|
|
|
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; |
|
|
|
|
|
|
|
switch( track->m_Shape ) |
|
|
|
@ -294,32 +280,16 @@ void Trace_Segment( WinEDA_DrawPanel* panel, |
|
|
|
|
|
|
|
if( fillopt == SKETCH ) |
|
|
|
{ |
|
|
|
// draw the border of the pen's path using two circles, each as
|
|
|
|
// narrow as possible
|
|
|
|
GRCircle( &panel->m_ClipBox, |
|
|
|
DC, |
|
|
|
track->m_Start.x, |
|
|
|
track->m_Start.y, |
|
|
|
radius - halfPenWidth, |
|
|
|
0, |
|
|
|
color ); |
|
|
|
GRCircle( &panel->m_ClipBox, |
|
|
|
DC, |
|
|
|
track->m_Start.x, |
|
|
|
track->m_Start.y, |
|
|
|
radius + halfPenWidth, |
|
|
|
0, |
|
|
|
color ); |
|
|
|
// draw the border of the pen's path using two circles, each as narrow as possible
|
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, |
|
|
|
radius - halfPenWidth, 0, color ); |
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, |
|
|
|
radius + halfPenWidth, 0, color ); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
GRCircle( &panel->m_ClipBox, |
|
|
|
DC, |
|
|
|
track->m_Start.x, |
|
|
|
track->m_Start.y, |
|
|
|
radius, |
|
|
|
track->m_Width, |
|
|
|
color ); |
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, |
|
|
|
radius, track->m_Width, color ); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
@ -427,14 +397,12 @@ void Trace_Segment( WinEDA_DrawPanel* panel, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
@ -445,24 +413,27 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, |
|
|
|
track = Pcb->m_Track; |
|
|
|
for( ; track != NULL; track = track->Next() ) |
|
|
|
{ |
|
|
|
if( ( track->m_Shape == S_ARC ) |
|
|
|
|| ( track->m_Shape == S_CIRCLE ) |
|
|
|
|| ( track->m_Shape == S_ARC_RECT ) ) |
|
|
|
if( g_DesignSettings.IsLayerVisible( track->GetLayer() ) == false ) |
|
|
|
continue; |
|
|
|
|
|
|
|
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; |
|
|
|
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->GetNet() ); |
|
|
|
|
|
|
|
width = track->m_Width; |
|
|
|
orient = TEXT_ORIENT_HORIZ; |
|
|
|
if( track->m_Shape >= S_SPOT_CIRCLE ) // form flash
|
|
|
|
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
|
|
|
|
{ |
|
|
|
width /= 3; |
|
|
|
} |
|
|
|
@ -476,19 +447,20 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, |
|
|
|
width /= 2; |
|
|
|
} |
|
|
|
|
|
|
|
DrawGraphicText( panel, DC, pos, (EDA_Colors) g_DCodesColor, Line, |
|
|
|
DrawGraphicText( panel, DC, |
|
|
|
pos, (EDA_Colors) g_DCodesColor, Line, |
|
|
|
orient, wxSize( width, width ), |
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, |
|
|
|
0, false, false, false ); |
|
|
|
0, false, false, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN
|
|
|
|
* this is a virtual pure function in BASE_SCREEN |
|
|
|
* do nothing in gerbview |
|
|
|
* could be removed later |
|
|
|
*/ |
|
|
|
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int ) |
|
|
|
/* Virtual fonction needed by the PCB_SCREEN class derived from BASE_SCREEN
|
|
|
|
* this is a virtual pure function in BASE_SCREEN |
|
|
|
* do nothing in gerbview |
|
|
|
* could be removed later |
|
|
|
*/ |
|
|
|
void PCB_SCREEN::ClearUndoORRedoList(UNDO_REDO_CONTAINER&, int ) |
|
|
|
{ |
|
|
|
} |