2007-08-15 02:43:03 +00:00
|
|
|
/*****************************************/
|
|
|
|
/* Routines generales d'affichage du PCB */
|
|
|
|
/*****************************************/
|
|
|
|
|
|
|
|
/* fichier tracepcb.cpp */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*
|
2007-08-15 02:43:03 +00:00
|
|
|
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-30 03:30:34 +00:00
|
|
|
#include <vector>
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "autorout.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
2007-08-15 02:43:03 +00:00
|
|
|
void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2007-10-30 20:40:08 +00:00
|
|
|
/* Draw the footprint editor BOARD, and others elements : axis, grid ..
|
2007-08-15 02:43:03 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
{
|
2007-08-15 02:43:03 +00:00
|
|
|
MODULE* Module;
|
2008-04-01 05:21:50 +00:00
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
if( !m_Pcb || !screen )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
ActiveScreen = screen;
|
|
|
|
GRSetDrawMode( DC, GR_COPY );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
if( EraseBg )
|
|
|
|
DrawPanel->EraseScreen( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
DrawPanel->DrawBackGround( DC );
|
|
|
|
TraceWorkSheet( DC, screen, 0 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
/* Redraw the footprint */
|
2007-08-15 02:43:03 +00:00
|
|
|
Module = (MODULE*) m_Pcb->m_Modules;
|
|
|
|
for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
Module->Draw( DrawPanel, DC, GR_OR );
|
2007-08-15 02:43:03 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
Affiche_Status_Box();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-30 20:40:08 +00:00
|
|
|
/* Redraw the cursor */
|
2007-08-15 02:43:03 +00:00
|
|
|
DrawPanel->Trace_Curseur( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
screen->ClrRefreshReq();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************/
|
2007-08-15 02:43:03 +00:00
|
|
|
void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************/
|
2007-08-15 02:43:03 +00:00
|
|
|
|
2007-10-30 20:40:08 +00:00
|
|
|
/* Draw the BOARD, and others elements : axis, grid ..
|
2007-08-15 02:43:03 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-05-01 06:21:07 +00:00
|
|
|
PCB_SCREEN* screen = GetScreen();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-05-01 06:21:07 +00:00
|
|
|
if( !m_Pcb || !screen )
|
2007-08-15 02:43:03 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-05-01 06:21:07 +00:00
|
|
|
ActiveScreen = screen;
|
2007-08-15 02:43:03 +00:00
|
|
|
GRSetDrawMode( DC, GR_COPY );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
if( EraseBg )
|
|
|
|
DrawPanel->EraseScreen( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
DrawPanel->DrawBackGround( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
TraceWorkSheet( DC, GetScreen(), 0 );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
m_Pcb->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
if( g_HightLigt_Status )
|
|
|
|
DrawHightLight( DC, g_HightLigth_NetCode );
|
|
|
|
|
|
|
|
DrawGeneralRatsnest( DC );
|
|
|
|
|
|
|
|
GetScreen()->ClrRefreshReq();
|
2008-05-01 06:21:07 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
Affiche_Status_Box();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
|
|
|
// Redraw the cursor
|
|
|
|
DrawPanel->Trace_Curseur( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/********************************************************************/
|
|
|
|
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|
|
|
int aDrawMode, const wxPoint& offset )
|
|
|
|
/********************************************************************/
|
2007-10-30 20:40:08 +00:00
|
|
|
/* Redraw the BOARD items but not cursors, axis or grid */
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-09-27 19:26:29 +00:00
|
|
|
for( MODULE* module = m_Modules; module; module = module->Next() )
|
2007-08-15 02:43:03 +00:00
|
|
|
{
|
|
|
|
bool display = true;
|
2008-04-01 05:21:50 +00:00
|
|
|
int layerMask = ALL_CU_LAYERS;
|
|
|
|
|
|
|
|
if( module->m_Flags & IS_MOVED )
|
2007-08-15 02:43:03 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !DisplayOpt.Show_Modules_Cmp )
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
if( module->GetLayer() == CMP_N )
|
2007-08-15 02:43:03 +00:00
|
|
|
display = FALSE;
|
2008-04-01 05:21:50 +00:00
|
|
|
layerMask &= ~CMP_LAYER;
|
2007-08-15 02:43:03 +00:00
|
|
|
}
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
if( !DisplayOpt.Show_Modules_Cu )
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
if( module->GetLayer() == COPPER_LAYER_N )
|
2007-08-15 02:43:03 +00:00
|
|
|
display = FALSE;
|
2008-04-01 05:21:50 +00:00
|
|
|
layerMask &= ~CUIVRE_LAYER;
|
2007-08-15 02:43:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( display )
|
2008-09-27 19:26:29 +00:00
|
|
|
module->Draw( aPanel, DC, aDrawMode );
|
2007-08-15 02:43:03 +00:00
|
|
|
else
|
2008-09-27 19:26:29 +00:00
|
|
|
Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
|
2007-08-15 02:43:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
// Draw the graphic items
|
2008-09-27 19:26:29 +00:00
|
|
|
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
|
2007-08-15 02:43:03 +00:00
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
if( item->m_Flags & IS_MOVED )
|
2007-08-15 02:43:03 +00:00
|
|
|
continue;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
switch( item->Type() )
|
2007-08-15 02:43:03 +00:00
|
|
|
{
|
|
|
|
case TYPECOTATION:
|
|
|
|
case TYPETEXTE:
|
|
|
|
case TYPEMIRE:
|
2008-04-01 06:07:00 +00:00
|
|
|
case TYPEDRAWSEGMENT:
|
2008-09-27 19:26:29 +00:00
|
|
|
item->Draw( aPanel, DC, aDrawMode );
|
2007-08-15 02:43:03 +00:00
|
|
|
break;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
default:
|
2007-08-15 02:43:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
/* Draw all tracks and zones. As long as dark colors are used for the tracks,
|
|
|
|
* Then the OR draw mode should show tracks underneath other tracks. But a white
|
|
|
|
* track will cover any other color since it has more bits to OR in.
|
|
|
|
*/
|
|
|
|
for( TRACK* track = m_Track; track; track = track->Next() )
|
|
|
|
{
|
|
|
|
track->Draw( aPanel, DC, aDrawMode );
|
|
|
|
}
|
|
|
|
|
|
|
|
for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() )
|
|
|
|
{
|
|
|
|
zone->Draw( aPanel, DC, aDrawMode );
|
|
|
|
}
|
|
|
|
|
2008-10-08 12:36:27 +00:00
|
|
|
/* Draw areas (i.e. zones) */
|
|
|
|
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* zone = GetArea(ii);
|
|
|
|
|
|
|
|
// Areas must be drawn here only if not moved or dragged,
|
|
|
|
// because these areas are drawn by ManageCursor() in a specific manner
|
|
|
|
if ( (zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
|
|
|
|
{
|
|
|
|
zone->Draw( aPanel, DC, aDrawMode );
|
|
|
|
zone->DrawFilledArea( aPanel, DC, aDrawMode );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:03 +00:00
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
// draw the BOARD's markers.
|
2008-09-27 19:26:29 +00:00
|
|
|
for( unsigned i=0; i < m_markers.size(); ++i )
|
2008-04-01 05:21:50 +00:00
|
|
|
{
|
2008-09-27 19:26:29 +00:00
|
|
|
m_markers[i]->Draw( aPanel, DC, aDrawMode );
|
2008-04-01 05:21:50 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
|