fix markers on pads when pads are high-lighted

This commit is contained in:
dickelbeck 2009-02-25 16:35:47 +00:00
parent 6d91cdd694
commit 073d076730
6 changed files with 93 additions and 94 deletions

View File

@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2009-Feb-25 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
Markers were now shown when on top of a high-lighted pad. Moved highlight
drawing function into class BOARD and out of Frame. Call BOARD::DrawHighLight() from
within BOARD::Draw() to fix.
2009-Feb-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew

View File

@ -495,7 +495,6 @@ public:
// Hightlight functions:
int Select_High_Light( wxDC* DC );
void Hight_Light( wxDC* DC );
void DrawHightLight( wxDC* DC, int NetCode );
// Track and via edition:
void DisplayTrackSettings();

View File

@ -263,6 +263,15 @@ public:
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset );
/**
* Function DrawHighLight
* redraws the objects in the board that are associated with the given aNetCode
* and turns on or off the brilliance associated with that net according to the
* current value of global g_HightLigt_Status
* @param aDrawPanel is needed for the clipping support.
* @param aNetCode is the net number to highlight or to dim.
*/
void DrawHighLight( WinEDA_DrawPanel* aDrawPanel, wxDC* DC, int aNetCode );
/**
* Function Visit

View File

@ -60,8 +60,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = oldpos;
g_HightLigt_Status = FALSE;
( (WinEDA_PcbFrame*) Panel->m_Parent )->DrawHightLight( DC, g_HightLigth_NetCode );
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel, DC, g_HightLigth_NetCode );
if( NewTrack )
{
@ -119,7 +118,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
g_HightLigth_NetCode = Old_HightLigth_NetCode;
g_HightLigt_Status = Old_HightLigt_Status;
if( g_HightLigt_Status )
( (WinEDA_PcbFrame*) Panel->m_Parent )->DrawHightLight( DC, g_HightLigth_NetCode );
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel, DC, g_HightLigth_NetCode );
EraseDragListe();
}
@ -688,7 +687,8 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
g_HightLigth_NetCode = track->GetNet();
g_HightLigt_Status = TRUE;
DrawHightLight( DC, g_HightLigth_NetCode );
GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
}
void SortTrackEndPoints(TRACK* track)
@ -844,7 +844,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
g_HightLigth_NetCode = track->GetNet();
g_HightLigt_Status = TRUE;
DrawHightLight( DC, g_HightLigth_NetCode );
GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
if( !InitialiseDragParameters() )
{

View File

@ -15,11 +15,6 @@
#define Pad_fill (Pad_Fill_Item.State == RUN)
static void Pad_Surbrillance( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, int NetCode );
/* variables locales : */
static int draw_mode;
/*********************************************************/
void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
@ -99,16 +94,14 @@ int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
if( g_HightLigt_Status )
Hight_Light( DC );
// use this scheme because of pad is higher priority than tracks in the
// use this scheme because a pad is a higher priority than a track in the
// search, and finding a pad, instead of a track on a pad,
// allows us to fire a message to eeschema.
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
// optionally, modify the "guide" here as needed using its member functions
m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
GetScreen()->RefPos( true ), guide );
@ -158,74 +151,7 @@ void WinEDA_PcbFrame::Hight_Light( wxDC* DC )
*/
{
g_HightLigt_Status = !g_HightLigt_Status;
DrawHightLight( DC, g_HightLigth_NetCode );
GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
}
/****************************************************************/
void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode )
/****************************************************************/
/* Turn On or OFF the HightLight for trcak and pads with the netcode "NetCode'
*/
{
if( g_HightLigt_Status )
draw_mode = GR_SURBRILL | GR_OR;
else
draw_mode = GR_AND | GR_SURBRILL;
#if 0 // does not unhighlight properly
// redraw the zones with the NetCode
for( SEGZONE* zone = GetBoard()->m_Zone; zone; zone = zone->Next() )
{
if( zone->GetNet() == NetCode )
{
zone->Draw( DrawPanel, DC, draw_mode );
}
}
#endif
// Redraw ZONE_CONTAINERS
BOARD::ZONE_CONTAINERS& zones = GetBoard()->m_ZoneDescriptorList;
for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc )
{
if( (*zc)->GetNet() == NetCode )
{
(*zc)->Draw( DrawPanel, DC, draw_mode );
}
}
/* Redraw pads */
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
Pad_Surbrillance( DrawPanel, DC, module, NetCode );
}
/* Redraw track and vias: */
for( TRACK* pts = GetBoard()->m_Track; pts; pts = pts->Next() )
{
if( pts->GetNet() == NetCode )
{
pts->Draw( DrawPanel, DC, draw_mode );
}
}
}
/*******************************************************/
static void Pad_Surbrillance( WinEDA_DrawPanel* panel,
wxDC* DC, MODULE* Module, int NetCode )
/*******************************************************/
/* Mise en Surbrillance des Pads */
{
D_PAD* pt_pad;
/* trace des pastilles */
for( pt_pad = Module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
{
if( pt_pad->GetNet() == NetCode )
{
pt_pad->Draw( panel, DC, draw_mode );
}
}
}

View File

@ -43,7 +43,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->DrawBackGround( DC );
TraceWorkSheet( DC, screen, 0 );
/* Redraw the footprint */
/* Redraw the footprints */
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
module->Draw( DrawPanel, DC, GR_OR );
@ -84,8 +84,6 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, GetScreen(), 0 );
GetBoard()->Draw( DrawPanel, DC, GR_OR );
if( g_HightLigt_Status )
DrawHightLight( DC, g_HightLigth_NetCode );
DrawGeneralRatsnest( DC );
@ -107,6 +105,9 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
/********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */
{
for( MODULE* module = m_Modules; module; module = module->Next() )
{
bool display = true;
@ -135,7 +136,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
}
// Draw the graphic items
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
@ -184,19 +184,76 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
}
}
// draw the BOARD's markers.
for( unsigned i=0; i < m_markers.size(); ++i )
{
m_markers[i]->Draw( aPanel, DC, aDrawMode );
}
// Draw equipots info
for( EQUIPOT* net = m_Equipots; net; net = net->Next() )
{
if ( net->GetNet() != 0 ) // no net if 0
net->Draw( aPanel, DC, aDrawMode );
}
// @todo: this high-light functionality could be built into me.
if( g_HightLigt_Status )
DrawHighLight( aPanel, DC, g_HightLigth_NetCode );
// draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
for( unsigned i=0; i < m_markers.size(); ++i )
{
m_markers[i]->Draw( aPanel, DC, aDrawMode );
}
}
/******************************************************************************/
void BOARD::DrawHighLight( WinEDA_DrawPanel* aDrawPanel, wxDC* DC, int aNetCode )
/******************************************************************************/
{
int draw_mode;
if( g_HightLigt_Status )
draw_mode = GR_SURBRILL | GR_OR;
else
draw_mode = GR_AND | GR_SURBRILL;
#if 0 // does not unhighlight properly
// redraw the zones with the aNetCode
for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() )
{
if( zone->GetNet() == aNetCode )
{
zone->Draw( aDrawPanel, DC, draw_mode );
}
}
#endif
// Redraw ZONE_CONTAINERS
BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList;
for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc )
{
if( (*zc)->GetNet() == aNetCode )
{
(*zc)->Draw( aDrawPanel, DC, draw_mode );
}
}
// Redraw any pads that have aNetCode
for( MODULE* module = m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( pad->GetNet() == aNetCode )
{
pad->Draw( aDrawPanel, DC, draw_mode );
}
}
}
// Redraw track and vias that have aNetCode
for( TRACK* seg = m_Track; seg; seg = seg->Next() )
{
if( seg->GetNet() == aNetCode )
{
seg->Draw( aDrawPanel, DC, draw_mode );
}
}
}