2007-08-15 02:43:57 +00:00
|
|
|
/*****************************************/
|
|
|
|
/* Routines generales d'affichage du PCB */
|
|
|
|
/*****************************************/
|
|
|
|
|
|
|
|
/* fichier TRACEPCB.CPP */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*
|
2007-08-15 02:43:57 +00:00
|
|
|
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
|
|
|
*/
|
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"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "gerbview.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Externes */
|
|
|
|
|
|
|
|
/* Variables Locales */
|
|
|
|
|
|
|
|
|
2008-11-02 19:52:57 +00:00
|
|
|
/************************************************************************************************************/
|
|
|
|
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer, bool aPrintMirrorMode )
|
|
|
|
/*************************************************************************************************************/
|
2008-12-12 21:30:07 +00:00
|
|
|
/* Draw gerbview layers, for printing
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-29 20:05:47 +00:00
|
|
|
DISPLAY_OPTIONS save_opt;
|
|
|
|
int DisplayPolygonsModeImg;
|
|
|
|
|
|
|
|
save_opt = DisplayOpt;
|
|
|
|
if( printmasklayer & ALL_CU_LAYERS )
|
2009-09-29 04:44:35 +00:00
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
DisplayOpt.DisplayPadFill = true;
|
2009-09-29 04:44:35 +00:00
|
|
|
DisplayOpt.DisplayViaFill = true;
|
|
|
|
}
|
2008-12-29 20:05:47 +00:00
|
|
|
else
|
2009-09-29 04:44:35 +00:00
|
|
|
{
|
2009-05-21 17:42:42 +00:00
|
|
|
DisplayOpt.DisplayPadFill = false;
|
2009-09-29 04:44:35 +00:00
|
|
|
DisplayOpt.DisplayViaFill = false;
|
|
|
|
}
|
2008-12-29 20:05:47 +00:00
|
|
|
DisplayOpt.DisplayPadNum = 0;
|
|
|
|
DisplayOpt.DisplayPadNoConn = 0;
|
|
|
|
DisplayOpt.DisplayPadIsol = 0;
|
|
|
|
DisplayOpt.DisplayModEdge = FILLED;
|
|
|
|
DisplayOpt.DisplayModText = FILLED;
|
|
|
|
DisplayOpt.DisplayPcbTrackFill = FILLED;
|
2009-06-18 20:51:01 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
|
2008-12-29 20:05:47 +00:00
|
|
|
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 );
|
|
|
|
|
|
|
|
if( Print_Sheet_Ref )
|
|
|
|
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
|
|
|
|
|
|
|
|
m_PrintIsMirrored = false;
|
|
|
|
|
|
|
|
DisplayOpt = save_opt;
|
|
|
|
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Trace le PCB, et les elements complementaires ( axes, grille .. )
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-29 20:05:47 +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
|
|
|
if( EraseBg )
|
|
|
|
DrawPanel->EraseScreen( DC );
|
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
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
DrawPanel->Trace_Curseur( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/********************************************************************/
|
|
|
|
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
2008-12-29 20:05:47 +00:00
|
|
|
int aDrawMode, const wxPoint& offset )
|
2008-09-27 19:26:29 +00:00
|
|
|
/********************************************************************/
|
|
|
|
/* Redraw the BOARD items but not cursors, axis or grid */
|
|
|
|
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
|
|
|
|
{
|
|
|
|
}
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-08-21 19:37:31 +00:00
|
|
|
/***********************************************************************************/
|
|
|
|
void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer )
|
|
|
|
/***********************************************************************************/
|
2008-09-27 19:26:29 +00:00
|
|
|
/*
|
2007-08-21 19:37:31 +00:00
|
|
|
* Trace l'ensemble des elements du PCB sur l'ecran actif
|
|
|
|
* @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)
|
|
|
|
*/
|
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-01-09 19:09:13 +00:00
|
|
|
bool erase = false;
|
2008-12-29 20:05:47 +00:00
|
|
|
int Color;
|
|
|
|
bool filled;
|
|
|
|
|
|
|
|
// Draw filled polygons
|
|
|
|
std::vector<wxPoint> points;
|
2008-12-29 18:02:54 +00:00
|
|
|
|
|
|
|
// minimize reallocations of the vector's internal array by starting with a good sized one.
|
2008-12-29 20:05:47 +00:00
|
|
|
points.reserve(10000);
|
|
|
|
|
2009-01-05 05:21:35 +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;
|
|
|
|
|
2008-12-29 22:34:55 +00:00
|
|
|
D(printf("D:%p\n", track );)
|
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
if( track->GetNet() == 0 ) // StartPoint
|
|
|
|
{
|
2008-12-29 22:34:55 +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 )
|
|
|
|
{
|
|
|
|
Color = g_DrawBgColor;
|
|
|
|
filled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
2008-12-29 20:05:47 +00:00
|
|
|
filled = (g_DisplayPolygonsModeSketch == 0);
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
|
|
|
|
2008-12-29 20:05:47 +00:00
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0],
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
Color = g_DrawBgColor;
|
|
|
|
filled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
|
|
|
|
filled = (g_DisplayPolygonsModeSketch == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0],
|
|
|
|
filled, Color, Color );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 );
|
2008-12-29 20:05:47 +00:00
|
|
|
|
|
|
|
if( DisplayOpt.DisplayPadNum )
|
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
|
|
|
|
|
|
|
|
|
|
|
/* Virtual fonction needed by the PCB_SCREEN class derived from BASE_SCREEN
|
|
|
|
* this is a virtaul pure function in BASE_SCREEN
|
|
|
|
* do nothing in gerbview
|
|
|
|
* could be removed later
|
|
|
|
*/
|
|
|
|
void PCB_SCREEN::ClearUndoORRedoList(UNDO_REDO_CONTAINER&, int )
|
|
|
|
{
|
|
|
|
}
|