2009-10-28 11:48:47 +00:00
|
|
|
/****************/
|
|
|
|
/* tracepcb.cpp */
|
|
|
|
/****************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*
|
2009-10-28 11:48:47 +00:00
|
|
|
* Redraw the screen.
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-01-29 14:26:20 +00:00
|
|
|
#include "gr_basic.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "drawtxt.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "gerbview.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "protos.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2010-01-29 20:36:12 +00:00
|
|
|
#include "colors_selection.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
/***************/
|
|
|
|
/* tracepcb.cpp */
|
|
|
|
/***************/
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
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 );
|
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
/** virtual Function PrintPage
|
2010-01-09 20:25:39 +00:00
|
|
|
* Used to print the board (on printer, or when creating SVF files).
|
|
|
|
* Print the board, but only layers allowed by aPrintMaskLayer
|
|
|
|
* @param aDC = the print device context
|
|
|
|
* @param aPrint_Sheet_Ref = true to print frame references
|
|
|
|
* @param aPrint_Sheet_Ref = a 32 bits mask: bit n = 1 -> layer n is printed
|
|
|
|
* @param aPrintMirrorMode = true to plot mirrored
|
|
|
|
* @param aData = a pointer to an optional data (not used here: can be NULL)
|
|
|
|
*/
|
2010-03-18 20:35:29 +00:00
|
|
|
void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintmasklayer,
|
2010-01-09 20:25:39 +00:00
|
|
|
bool aPrintMirrorMode, void * aData )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-29 20:05:47 +00:00
|
|
|
DISPLAY_OPTIONS save_opt;
|
2009-11-09 15:55:18 +00:00
|
|
|
int DisplayPolygonsModeImg;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
|
|
|
save_opt = DisplayOpt;
|
2009-11-09 15:55:18 +00:00
|
|
|
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = FILLED;
|
2009-06-18 20:51:01 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
|
2009-11-09 15:55:18 +00:00
|
|
|
DisplayOpt.DisplayDrawItems = FILLED;
|
|
|
|
DisplayOpt.DisplayZonesMode = 0;
|
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
|
|
|
|
g_DisplayPolygonsModeSketch = 0;
|
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
Trace_Gerber( aDC, GR_COPY, aPrintmasklayer );
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2010-01-09 20:25:39 +00:00
|
|
|
if( aPrint_Sheet_Ref )
|
2010-03-18 20:35:29 +00:00
|
|
|
TraceWorkSheet( aDC, GetScreen(), 0 );
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
DrawPanel->m_PrintIsMirrored = false;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
|
|
|
DisplayOpt = save_opt;
|
|
|
|
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/*******************************************************************/
|
2009-11-09 14:00:22 +00:00
|
|
|
void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
2009-11-09 15:55:18 +00:00
|
|
|
/*******************************************************************/
|
2009-11-09 16:07:29 +00:00
|
|
|
/* Redraws the full screen, including axis and grid
|
2009-11-09 15:55:18 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( !GetBoard() )
|
2008-12-29 20:05:47 +00:00
|
|
|
return;
|
|
|
|
ActiveScreen = screen;
|
|
|
|
GRSetDrawMode( DC, GR_COPY );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
DrawPanel->DrawBackGround( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
Trace_Gerber( DC, GR_COPY, -1 );
|
|
|
|
TraceWorkSheet( DC, screen, 0 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2010-01-22 18:13:43 +00:00
|
|
|
DrawPanel->DrawCursor( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/********************************************************************/
|
2009-11-09 14:00:22 +00:00
|
|
|
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|
|
|
int aDrawMode, const wxPoint& offset )
|
2009-11-09 15:55:18 +00:00
|
|
|
/********************************************************************/
|
|
|
|
/* Redraw the BOARD items but not cursors, axis or grid */
|
|
|
|
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
|
|
|
}
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/***********************************************************************************/
|
|
|
|
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer )
|
|
|
|
/***********************************************************************************/
|
2009-11-09 16:07:29 +00:00
|
|
|
/* Trace all elements of PCBs (i.e Spots, filled polygons or lines) on the active screen
|
2009-11-09 15:55:18 +00:00
|
|
|
* @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)
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
if( !GetBoard() )
|
2008-12-29 20:05:47 +00:00
|
|
|
return;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
bool erase = false;
|
|
|
|
int Color;
|
|
|
|
bool filled;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
|
|
|
// Draw filled polygons
|
2009-11-09 15:55:18 +00:00
|
|
|
std::vector<wxPoint> points;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
// minimize reallocations of the vector's internal array by starting with a good sized one.
|
|
|
|
points.reserve(10000);
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2010-02-22 19:56:32 +00:00
|
|
|
for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() )
|
2008-12-29 20:05:47 +00:00
|
|
|
{
|
|
|
|
if( !(track->ReturnMaskLayer() & printmasklayer) )
|
|
|
|
continue;
|
2010-01-31 20:01:46 +00:00
|
|
|
if( GetBoard()->IsLayerVisible( track->GetLayer() ) == false )
|
2009-11-09 15:55:18 +00:00
|
|
|
continue;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
// D(printf("D:%p\n", track );)
|
2008-12-29 22:34:55 +00:00
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
if( track->GetNet() == 0 ) // StartPoint
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
if( points.size() ) // we have found a new polygon: Draw the old polygon
|
2008-12-29 20:05:47 +00:00
|
|
|
{
|
2008-12-29 18:02:54 +00:00
|
|
|
if( erase )
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
Color = g_DrawBgColor;
|
2008-12-29 18:02:54 +00:00
|
|
|
filled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-29 20:36:12 +00:00
|
|
|
Color = g_ColorsSettings.GetLayerColor( track->GetLayer() );
|
2008-12-29 20:05:47 +00:00
|
|
|
filled = (g_DisplayPolygonsModeSketch == 0);
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0],
|
2008-12-29 20:05:47 +00:00
|
|
|
filled, Color, Color );
|
|
|
|
}
|
|
|
|
|
|
|
|
erase = ( track->m_Flags & DRAW_ERASED );
|
|
|
|
|
|
|
|
points.clear();
|
|
|
|
points.push_back( track->m_Start );
|
|
|
|
points.push_back( track->m_End );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
points.push_back( track->m_End );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( track->Next() == NULL ) // Last point
|
|
|
|
{
|
|
|
|
if( erase )
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
Color = g_DrawBgColor;
|
2008-12-29 20:05:47 +00:00
|
|
|
filled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-29 20:36:12 +00:00
|
|
|
Color = g_ColorsSettings.GetLayerColor( track->GetLayer() );
|
2009-11-09 15:55:18 +00:00
|
|
|
filled = (g_DisplayPolygonsModeSketch == 0);
|
2008-12-29 20:05:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0],
|
|
|
|
filled, Color, Color );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
|
2009-01-05 05:21:35 +00:00
|
|
|
Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer );
|
2010-01-09 20:25:39 +00:00
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
if( IsElementVisible( DCODES_VISIBLE) )
|
2009-01-05 05:21:35 +00:00
|
|
|
Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY );
|
2008-12-29 20:05:47 +00:00
|
|
|
|
|
|
|
GetScreen()->ClrRefreshReq();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/***************************************************************************************************/
|
|
|
|
void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode,
|
|
|
|
int printmasklayer )
|
|
|
|
/***************************************************************************************************/
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/* 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)
|
2009-11-09 15:55:18 +00:00
|
|
|
* @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..)
|
2009-10-28 11:48:47 +00:00
|
|
|
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
|
|
|
|
*/
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
|
|
|
|
GERBER* gerber = g_GERBER_List[layer];
|
|
|
|
int dcode_hightlight = 0;
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
if( gerber )
|
|
|
|
dcode_hightlight = gerber->m_Selected_Tool;
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
for( TRACK* track = Pcb->m_Track; track; track = track->Next() )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
if( !(track->ReturnMaskLayer() & printmasklayer) )
|
|
|
|
continue;
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
// D(printf("D:%p\n", track );)
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer )
|
2010-01-31 20:01:46 +00:00
|
|
|
Trace_Segment( Pcb, panel, DC, track, draw_mode | GR_SURBRILL );
|
2009-10-28 11:48:47 +00:00
|
|
|
else
|
2010-01-31 20:01:46 +00:00
|
|
|
Trace_Segment( Pcb, panel, DC, track, draw_mode );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/***********************************************************************************/
|
2010-01-31 20:01:46 +00:00
|
|
|
void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mode )
|
2009-11-09 15:55:18 +00:00
|
|
|
/***********************************************************************************/
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2009-11-09 16:07:29 +00:00
|
|
|
/* Trace 1 segment of track (segment, spot...).
|
|
|
|
* Parameters :
|
|
|
|
* Track = a pointer on of the description of the track
|
2009-11-09 15:55:18 +00:00
|
|
|
* draw_mode = mode ( GR_XOR, GR_OR..)
|
2009-10-28 11:48:47 +00:00
|
|
|
*/
|
|
|
|
{
|
|
|
|
int l_piste;
|
|
|
|
int color;
|
|
|
|
int fillopt;
|
|
|
|
int radius;
|
|
|
|
int halfPenWidth;
|
|
|
|
static bool show_err;
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
color = g_DrawBgColor;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
if( aBrd->IsLayerVisible( track->GetLayer() ) == false )
|
2009-10-28 11:48:47 +00:00
|
|
|
return;
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
color = aBrd->GetLayerColor( track->GetLayer() );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
|
|
|
|
|
|
|
|
switch( track->m_Shape )
|
|
|
|
{
|
|
|
|
case S_CIRCLE:
|
|
|
|
radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
|
|
|
|
(double) (track->m_End.y - track->m_Start.y) );
|
|
|
|
|
|
|
|
halfPenWidth = track->m_Width >> 1;
|
2010-02-08 18:15:42 +00:00
|
|
|
|
|
|
|
#ifdef USE_WX_ZOOM
|
|
|
|
if( DC->LogicalToDeviceXRel( halfPenWidth ) < L_MIN_DESSIN )
|
|
|
|
#else
|
2009-10-28 11:48:47 +00:00
|
|
|
if( panel->GetScreen()->Scale( halfPenWidth ) < L_MIN_DESSIN )
|
2010-02-08 18:15:42 +00:00
|
|
|
#endif
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
|
|
|
|
track->m_Start.y, radius, 0, color );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( fillopt == SKETCH )
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
// 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 );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
|
|
|
|
radius, track->m_Width, color );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
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->GetSubNet(), 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->GetSubNet(),
|
|
|
|
track->m_Width, color );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case S_SPOT_CIRCLE:
|
|
|
|
radius = track->m_Width >> 1;
|
|
|
|
|
|
|
|
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
2010-02-08 18:15:42 +00:00
|
|
|
|
|
|
|
#ifdef USE_WX_ZOOM
|
|
|
|
if( DC->LogicalToDeviceXRel( radius ) < L_MIN_DESSIN )
|
|
|
|
#else
|
2009-10-28 11:48:47 +00:00
|
|
|
if( panel->GetScreen()->Scale( radius ) < L_MIN_DESSIN )
|
2010-02-08 18:15:42 +00:00
|
|
|
#endif
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
|
|
|
|
track->m_Start.y, radius, 0, color );
|
|
|
|
}
|
|
|
|
else if( fillopt == SKETCH )
|
|
|
|
{
|
|
|
|
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
|
|
|
|
track->m_Start.y, radius, 0, color );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x,
|
|
|
|
track->m_Start.y, radius, 0, color, color );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case S_SPOT_RECT:
|
|
|
|
case S_RECT:
|
|
|
|
|
|
|
|
l_piste = track->m_Width >> 1;
|
|
|
|
|
|
|
|
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
|
2010-02-08 18:15:42 +00:00
|
|
|
|
|
|
|
#ifdef USE_WX_ZOOM
|
|
|
|
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
|
|
|
#else
|
2009-10-28 11:48:47 +00:00
|
|
|
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
|
2010-02-08 18:15:42 +00:00
|
|
|
#endif
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
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_SEGMENT:
|
|
|
|
l_piste = track->m_Width >> 1;
|
|
|
|
|
2010-02-08 18:15:42 +00:00
|
|
|
#ifdef USE_WX_ZOOM
|
|
|
|
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
|
|
|
#else
|
2009-10-28 11:48:47 +00:00
|
|
|
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
|
2010-02-08 18:15:42 +00:00
|
|
|
#endif
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if( !show_err )
|
|
|
|
{
|
|
|
|
wxMessageBox( wxT( "Trace_Segment() type error" ) );
|
|
|
|
show_err = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/*****************************************************************************************/
|
|
|
|
void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode )
|
|
|
|
/*****************************************************************************************/
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
TRACK* track;
|
|
|
|
wxPoint pos;
|
|
|
|
int width, orient;
|
|
|
|
wxString Line;
|
|
|
|
|
|
|
|
GRSetDrawMode( DC, drawmode );
|
|
|
|
track = Pcb->m_Track;
|
|
|
|
for( ; track != NULL; track = track->Next() )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
if( Pcb->IsLayerVisible( track->GetLayer() ) == false )
|
2009-11-09 15:55:18 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if( (track->m_Shape == S_ARC)
|
|
|
|
|| (track->m_Shape == S_CIRCLE)
|
|
|
|
|| (track->m_Shape == S_ARC_RECT) )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
pos.x = track->m_Start.x;
|
|
|
|
pos.y = track->m_Start.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-09 15:55:18 +00:00
|
|
|
pos.x = (track->m_Start.x + track->m_End.x) / 2;
|
|
|
|
pos.y = (track->m_Start.y + track->m_End.y) / 2;
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Line.Printf( wxT( "D%d" ), track->GetNet() );
|
|
|
|
|
|
|
|
width = track->m_Width;
|
|
|
|
orient = TEXT_ORIENT_HORIZ;
|
2009-11-09 15:55:18 +00:00
|
|
|
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2010-01-29 20:36:12 +00:00
|
|
|
int color = g_ColorsSettings.GetItemColor(DCODES_VISIBLE);
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
DrawGraphicText( panel, DC,
|
2010-01-29 20:36:12 +00:00
|
|
|
pos, (EDA_Colors) color, Line,
|
2009-10-28 11:48:47 +00:00
|
|
|
orient, wxSize( width, width ),
|
|
|
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
2009-11-09 15:55:18 +00:00
|
|
|
0, false, false, false);
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
/* 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 )
|
2009-07-29 13:10:36 +00:00
|
|
|
{
|
|
|
|
}
|