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"
|
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"
|
2010-09-28 14:42:05 +00:00
|
|
|
#include "class_gerber_draw_item.h"
|
2010-10-06 17:28:07 +00:00
|
|
|
#include "class_GERBER.h"
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
// Blit function seems have problems when scale != 1 and/or offsets
|
|
|
|
#define AVOID_BLIT_SCALE_BUG true
|
|
|
|
#else
|
|
|
|
#define AVOID_BLIT_SCALE_BUG false // not needed on Linux
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-11-09 15:55:18 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function PrintPage (virtual)
|
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
|
2010-10-16 14:51:22 +00:00
|
|
|
* @param aPrintMasklayer = a 32 bits mask: bit n = 1 -> layer n is printed
|
2010-01-09 20:25:39 +00:00
|
|
|
* @param aPrintMirrorMode = true to plot mirrored
|
|
|
|
* @param aData = a pointer to an optional data (not used here: can be NULL)
|
|
|
|
*/
|
2011-01-17 18:37:58 +00:00
|
|
|
void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer,
|
2010-10-16 14:51:22 +00:00
|
|
|
bool aPrintMirrorMode, void* aData )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-10-16 14:51:22 +00:00
|
|
|
// Save current draw options, because print mode has specfic options:
|
|
|
|
int DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
|
|
|
|
int visiblemask = GetBoard()->GetVisibleLayers();
|
|
|
|
DISPLAY_OPTIONS save_opt = DisplayOpt;
|
2009-11-09 15:55:18 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
// Set draw options for printing:
|
|
|
|
GetBoard()->SetVisibleLayers( aPrintMasklayer );
|
2009-11-09 15:55:18 +00:00
|
|
|
DisplayOpt.DisplayPcbTrackFill = FILLED;
|
|
|
|
DisplayOpt.DisplayDrawItems = FILLED;
|
2010-10-16 14:51:22 +00:00
|
|
|
DisplayOpt.DisplayZonesMode = 0;
|
|
|
|
g_DisplayPolygonsModeSketch = 0;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
DrawPanel->m_PrintIsMirrored = aPrintMirrorMode;
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2011-01-21 14:19:06 +00:00
|
|
|
GetBoard()->Draw( DrawPanel, aDC, -1, wxPoint( 0, 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
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
// Restore draw options:
|
|
|
|
GetBoard()->SetVisibleLayers( visiblemask );
|
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
|
|
|
/*******************************************************************/
|
2010-10-16 14:51:22 +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
|
|
|
{
|
2010-10-16 14:51:22 +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;
|
2010-12-15 20:15:24 +00:00
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
wxBusyCursor dummy;
|
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
ActiveScreen = screen;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
GRSetDrawMode( DC, GR_COPY );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
int drawMode = -1;
|
|
|
|
switch ( GetDisplayMode() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
drawMode = GR_COPY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
drawMode = GR_OR;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GetBoard()->Draw( DrawPanel, DC,
|
|
|
|
drawMode, // this needs to be GR_COPY or GR_OR, set from a toggle button.
|
|
|
|
wxPoint( 0, 0 ) );
|
|
|
|
|
|
|
|
// Draw the "background" now, i.e. grid and axis after gerber layers
|
|
|
|
// because most of time the actual background is erased by succesive drawings of each gerber layer
|
|
|
|
// mainly in COPY mode
|
|
|
|
DrawPanel->DrawBackGround( DC );
|
2010-10-16 14:51:22 +00:00
|
|
|
|
|
|
|
if( IsElementVisible( DCODES_VISIBLE ) )
|
2010-12-15 20:15:24 +00:00
|
|
|
DrawItemsDCodeID( DC, GR_COPY );
|
2010-09-13 14:45:19 +00:00
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
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 );
|
2010-10-06 17:28:07 +00:00
|
|
|
|
|
|
|
// Display the filename and the layer name (found in the gerber files, if any)
|
|
|
|
// relative to the active layer
|
|
|
|
UpdateTitleAndInfo();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
|
2010-12-18 18:47:58 +00:00
|
|
|
/*
|
|
|
|
* Redraw All gerbview layers, using a buffered mode or not
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
2010-10-16 14:51:22 +00:00
|
|
|
// Because Images can be negative (i.e with background filled in color) items are drawn
|
|
|
|
// graphic layer per graphic layer, after the background is filled
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
wxColour bgColor = MakeColour( g_DrawBgColor );
|
|
|
|
wxBrush bgBrush( bgColor, wxSOLID );
|
|
|
|
|
|
|
|
int bitmapWidth, bitmapHeight;
|
|
|
|
wxDC* plotDC = aDC;
|
|
|
|
|
|
|
|
#if AVOID_BLIT_SCALE_BUG
|
|
|
|
// Blit function used below seems to work OK only with scale = 1 and no offsets
|
|
|
|
// at least under Windows
|
2010-12-12 14:24:27 +00:00
|
|
|
// Store device context scale and origins:
|
2010-12-15 20:15:24 +00:00
|
|
|
double dc_scalex, dc_scaley;
|
|
|
|
wxPoint dev_org;
|
|
|
|
wxPoint logical_org;
|
|
|
|
|
2010-12-12 14:24:27 +00:00
|
|
|
aDC->GetDeviceOrigin( &dev_org.x, &dev_org.y );
|
|
|
|
aDC->GetLogicalOrigin( &logical_org.x, &logical_org.y );
|
2010-12-15 20:15:24 +00:00
|
|
|
aDC->GetUserScale( &dc_scalex, &dc_scaley );
|
2010-12-12 14:24:27 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
if( aDrawMode != -1 )
|
|
|
|
{
|
|
|
|
aDC->SetUserScale( 1.0, 1.0 );
|
|
|
|
aDC->SetDeviceOrigin( 0, 0 );
|
|
|
|
aDC->SetLogicalOrigin( 0, 0 );
|
|
|
|
}
|
|
|
|
#endif
|
2010-12-12 14:24:27 +00:00
|
|
|
|
2010-12-12 02:29:33 +00:00
|
|
|
aPanel->GetClientSize( &bitmapWidth, &bitmapHeight );
|
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
wxBitmap* layerBitmap = NULL;
|
|
|
|
wxBitmap* screenBitmap = NULL;
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
wxMemoryDC layerDC; // used sequentially for each gerber layer
|
|
|
|
wxMemoryDC screenDC;
|
|
|
|
|
|
|
|
if( aDrawMode != -1 )
|
|
|
|
{
|
|
|
|
layerBitmap = new wxBitmap( bitmapWidth, bitmapHeight );
|
|
|
|
screenBitmap = new wxBitmap( bitmapWidth, bitmapHeight );
|
|
|
|
layerDC.SelectObject( *layerBitmap );
|
|
|
|
layerDC.SetBackground( bgBrush );
|
|
|
|
layerDC.Clear();
|
|
|
|
screenDC.SelectObject( *screenBitmap );
|
|
|
|
screenDC.SetBackground( bgBrush );
|
|
|
|
screenDC.Clear();
|
|
|
|
|
|
|
|
aPanel->DoPrepareDC(layerDC);
|
|
|
|
aPanel->DrawBackGround( &layerDC );
|
|
|
|
plotDC = &layerDC;
|
|
|
|
}
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
bool doBlit = false; // this flag requests an image transfert to actual screen when true.
|
2010-10-16 14:51:22 +00:00
|
|
|
for( int layer = 0; layer < 32; layer++ )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-10-16 14:51:22 +00:00
|
|
|
if( !GetBoard()->IsLayerVisible( layer ) )
|
|
|
|
continue;
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
|
|
|
if( gerber == NULL ) // Graphic layer not yet used
|
2009-10-28 11:48:47 +00:00
|
|
|
continue;
|
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
if( aDrawMode != -1 )
|
|
|
|
{
|
|
|
|
// Draw each layer into a bitmap first. Negative Gerber
|
|
|
|
// layers are drawn in background color.
|
|
|
|
if( gerber->HasNegativeItems() )
|
|
|
|
{
|
|
|
|
if( doBlit )
|
|
|
|
{
|
|
|
|
#if AVOID_BLIT_SCALE_BUG
|
|
|
|
layerDC.SetUserScale( 1.0, 1.0 );
|
|
|
|
layerDC.SetDeviceOrigin( 0, 0 );
|
|
|
|
layerDC.SetLogicalOrigin( 0, 0 );
|
|
|
|
#endif
|
|
|
|
if( aDrawMode == GR_COPY )
|
|
|
|
{
|
|
|
|
// Use the layer bitmap itself as a mask when blitting.
|
|
|
|
// The bitmap cannot be referenced by a device context
|
|
|
|
// when setting the mask.
|
|
|
|
layerDC.SelectObject( wxNullBitmap );
|
|
|
|
layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) );
|
|
|
|
layerDC.SelectObject( *layerBitmap );
|
|
|
|
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
else if( aDrawMode == GR_OR )
|
|
|
|
{
|
|
|
|
// On Linux with a large screen, this version is much faster and without flicker,
|
|
|
|
// but gives a PCBNEW look where layer colors blend together. Plus it works
|
|
|
|
// only because the background color is black. But it may be more useable for some.
|
|
|
|
// The difference is due in part because of the cpu cycles needed to create the
|
|
|
|
// monochromatic bitmap above, and the extra time needed to do bit indexing
|
|
|
|
// into the monochromatic bitmap on the blit above.
|
|
|
|
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
doBlit = false;
|
|
|
|
layerDC.Clear();
|
|
|
|
}
|
|
|
|
}
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
#if AVOID_BLIT_SCALE_BUG
|
|
|
|
layerDC.SetUserScale( dc_scalex, dc_scaley );
|
|
|
|
layerDC.SetDeviceOrigin( dev_org.x, dev_org.y );
|
|
|
|
layerDC.SetLogicalOrigin( logical_org.x, logical_org.y );
|
|
|
|
#endif
|
2010-10-16 14:51:22 +00:00
|
|
|
if( gerber->m_ImageNegative )
|
|
|
|
{
|
2010-12-12 02:29:33 +00:00
|
|
|
// Draw background negative (i.e. in graphic layer color) for negative images.
|
|
|
|
int color = GetBoard()->GetLayerColor( layer );
|
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
GRSetDrawMode( &layerDC, GR_COPY );
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
EDA_Rect* cbox = &aPanel->m_ClipBox;
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
GRSFilledRect( cbox, plotDC, cbox->GetX(), cbox->GetY(),
|
2010-10-16 14:51:22 +00:00
|
|
|
cbox->GetRight(), cbox->GetBottom(),
|
|
|
|
0, color, color );
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
GRSetDrawMode( plotDC, GR_COPY );
|
|
|
|
doBlit = true;
|
2010-10-16 14:51:22 +00:00
|
|
|
}
|
2010-09-13 15:45:57 +00:00
|
|
|
|
2010-12-12 02:29:33 +00:00
|
|
|
int dcode_highlight = 0;
|
2010-10-16 14:51:22 +00:00
|
|
|
if( layer == m_PcbFrame->GetScreen()->m_Active_Layer )
|
2010-12-12 02:29:33 +00:00
|
|
|
dcode_highlight = gerber->m_Selected_Tool;
|
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
int layerdrawMode = GR_COPY;
|
|
|
|
if( aDrawMode == GR_OR && !gerber->HasNegativeItems() )
|
|
|
|
layerdrawMode = GR_OR;
|
|
|
|
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = item->Next() )
|
2010-10-16 14:51:22 +00:00
|
|
|
{
|
|
|
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
2010-12-12 02:29:33 +00:00
|
|
|
if( gerb_item->GetLayer() != layer )
|
2010-10-16 14:51:22 +00:00
|
|
|
continue;
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
int drawMode = layerdrawMode;
|
|
|
|
if( dcode_highlight && dcode_highlight == gerb_item->m_DCode )
|
2010-10-16 14:51:22 +00:00
|
|
|
drawMode |= GR_SURBRILL;
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
gerb_item->Draw( aPanel, plotDC, drawMode );
|
|
|
|
doBlit = true;
|
2010-10-16 14:51:22 +00:00
|
|
|
}
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
}
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
if( doBlit && aDrawMode != -1 ) // Blit is used only if aDrawMode >= 0
|
|
|
|
{
|
|
|
|
// this is the last transfert to screenDC
|
|
|
|
// If there are no negative items, this is the only one
|
|
|
|
#if AVOID_BLIT_SCALE_BUG
|
|
|
|
if( aDrawMode != -1 )
|
|
|
|
{
|
|
|
|
layerDC.SetUserScale( 1.0, 1.0 );
|
|
|
|
layerDC.SetDeviceOrigin( 0, 0 );
|
|
|
|
layerDC.SetLogicalOrigin( 0, 0 );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if( aDrawMode == GR_COPY )
|
|
|
|
{
|
|
|
|
layerDC.SelectObject( wxNullBitmap );
|
|
|
|
layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) );
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
layerDC.SelectObject( *layerBitmap );
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
|
|
|
|
}
|
2010-12-12 14:24:27 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
else if( aDrawMode == GR_OR )
|
|
|
|
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR, false );
|
|
|
|
}
|
2010-12-12 02:29:33 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
if( aDrawMode != -1 )
|
|
|
|
{
|
|
|
|
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY );
|
|
|
|
#if AVOID_BLIT_SCALE_BUG
|
|
|
|
// Restore scale and offsets values:
|
|
|
|
aDC->SetUserScale( dc_scalex, dc_scaley );
|
|
|
|
aDC->SetDeviceOrigin( dev_org.x, dev_org.y );
|
|
|
|
aDC->SetLogicalOrigin( logical_org.x, logical_org.y );
|
2010-12-12 02:29:33 +00:00
|
|
|
#endif
|
2010-12-15 20:15:24 +00:00
|
|
|
delete layerBitmap;
|
|
|
|
delete screenBitmap;
|
2010-10-16 14:51:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_PcbFrame->GetScreen()->ClrRefreshReq();
|
2010-09-13 15:45:57 +00:00
|
|
|
}
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
/* Function DrawItemsDCodeID
|
|
|
|
* Draw the DCode value (if exists) corresponding to gerber item
|
|
|
|
* Polygons do not have a DCode
|
|
|
|
*/
|
|
|
|
void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-10-16 14:51:22 +00:00
|
|
|
wxPoint pos;
|
|
|
|
int width, orient;
|
|
|
|
wxString Line;
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
GRSetDrawMode( aDC, aDrawMode );
|
2010-12-15 20:15:24 +00:00
|
|
|
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
2010-09-28 14:42:05 +00:00
|
|
|
for( ; item != NULL; item = item->Next() )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
2010-12-15 20:15:24 +00:00
|
|
|
if( GetBoard()->IsLayerVisible( gerb_item->GetLayer() ) == false )
|
2010-09-28 14:42:05 +00:00
|
|
|
continue;
|
|
|
|
if( gerb_item->m_DCode <= 0 )
|
2009-11-09 15:55:18 +00:00
|
|
|
continue;
|
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
if( gerb_item->m_Flashed || gerb_item->m_Shape == GBR_ARC )
|
2010-09-28 14:42:05 +00:00
|
|
|
pos = gerb_item->m_Start;
|
2009-10-28 11:48:47 +00:00
|
|
|
else
|
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
pos.x = (gerb_item->m_Start.x + gerb_item->m_End.x) / 2;
|
|
|
|
pos.y = (gerb_item->m_Start.y + gerb_item->m_End.y) / 2;
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
2010-10-09 20:05:03 +00:00
|
|
|
pos = gerb_item->GetABPosition( pos );
|
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
Line.Printf( wxT( "D%d" ), gerb_item->m_DCode );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-10-23 18:12:11 +00:00
|
|
|
if( gerb_item->GetDcodeDescr() )
|
|
|
|
width = gerb_item->GetDcodeDescr()->GetShapeDim( gerb_item );
|
|
|
|
else
|
|
|
|
width = MIN( gerb_item->m_Size.x, gerb_item->m_Size.y );
|
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
orient = TEXT_ORIENT_HORIZ;
|
2010-09-28 14:42:05 +00:00
|
|
|
if( gerb_item->m_Flashed )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-12-15 20:15:24 +00:00
|
|
|
// A reasonnable size for text is width/3 because most of time this text has 3 chars.
|
2009-10-28 11:48:47 +00:00
|
|
|
width /= 3;
|
|
|
|
}
|
2010-10-23 18:12:11 +00:00
|
|
|
else // this item is a line
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-10-23 18:12:11 +00:00
|
|
|
wxPoint delta = gerb_item->m_Start - gerb_item->m_End;
|
|
|
|
if( abs( delta.x ) < abs( delta.y ) )
|
2009-10-28 11:48:47 +00:00
|
|
|
orient = TEXT_ORIENT_VERT;
|
2010-10-23 18:12:11 +00:00
|
|
|
// A reasonnable size for text is width/2 because text needs margin below and above it.
|
|
|
|
// a margin = width/4 seems good
|
2009-10-28 11:48:47 +00:00
|
|
|
width /= 2;
|
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-12-15 20:15:24 +00:00
|
|
|
DrawGraphicText( DrawPanel, aDC,
|
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,
|
2010-11-20 19:53:00 +00:00
|
|
|
0, 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
|
2010-10-16 14:51:22 +00:00
|
|
|
* 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
|
|
|
{
|
|
|
|
}
|