highlight tool HitTest()ing prefers pads over tracks
This commit is contained in:
parent
0760976fcd
commit
69c5bdea30
|
@ -5,6 +5,17 @@ Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
email address.
|
||||||
|
|
||||||
|
|
||||||
|
2007-Dec-13 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
================================================================================
|
||||||
|
+pcbnew
|
||||||
|
* surbrill.cpp's int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
|
||||||
|
was re-written to use the GENERAL_COLLECTOR, and the scanList is set to
|
||||||
|
give pads a higher search priority than tracks, vias or pads.
|
||||||
|
The objective was to use the pad if possible, rather than a track on a pad,
|
||||||
|
so the pad can be sent to eeschema. Finding the track only (even though
|
||||||
|
on a pad) would not send anything to eeschema.
|
||||||
|
|
||||||
|
|
||||||
2007-Dec-12 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2007-Dec-12 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+pcbnew
|
+pcbnew
|
||||||
|
|
|
@ -92,6 +92,16 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = {
|
||||||
|
TYPEPAD,
|
||||||
|
TYPEVIA,
|
||||||
|
TYPETRACK,
|
||||||
|
TYPEZONE,
|
||||||
|
EOT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
|
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
|
||||||
TYPETEXTEMODULE,
|
TYPETEXTEMODULE,
|
||||||
TYPEEDGEMODULE,
|
TYPEEDGEMODULE,
|
||||||
|
|
|
@ -226,6 +226,12 @@ public:
|
||||||
*/
|
*/
|
||||||
static const KICAD_T PadsOrModules[];
|
static const KICAD_T PadsOrModules[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A scan list for PADs, TRACKs, VIAs, or ZONEs
|
||||||
|
*/
|
||||||
|
static const KICAD_T PadsOrTracks[];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for MODULEs and their items (for Modedit)
|
* A scan list for MODULEs and their items (for Modedit)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "pcbnew.h"
|
#include "pcbnew.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
#include "collectors.h"
|
||||||
|
|
||||||
|
|
||||||
#define Pad_fill (Pad_Fill_Item.State == RUN)
|
#define Pad_fill (Pad_Fill_Item.State == RUN)
|
||||||
|
|
||||||
|
@ -88,32 +90,40 @@ int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
|
||||||
/* Localise track ou pad et met en surbrillance le net correspondant
|
/* Localise track ou pad et met en surbrillance le net correspondant
|
||||||
* Retourne le netcode, ou -1 si pas de net localis<EFBFBD>*/
|
* Retourne le netcode, ou -1 si pas de net localis<EFBFBD>*/
|
||||||
{
|
{
|
||||||
TRACK* pt_piste;
|
|
||||||
D_PAD* pt_pad;
|
|
||||||
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
|
|
||||||
int code = -1;
|
|
||||||
|
|
||||||
if( g_HightLigt_Status )
|
if( g_HightLigt_Status )
|
||||||
Hight_Light( DC );
|
Hight_Light( DC );
|
||||||
|
|
||||||
pt_piste = Locate_Pistes( m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE );
|
// use this scheme because of pad is higher priority than tracks in the
|
||||||
if( pt_piste )
|
// search, and finding a pad, instead of a track on a pad,
|
||||||
|
// allows us to fire a message to eescema.
|
||||||
|
|
||||||
|
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
|
||||||
|
|
||||||
|
// tweak the collector
|
||||||
|
|
||||||
|
m_Collector->Collect( m_Pcb, GENERAL_COLLECTOR::PadsOrTracks,
|
||||||
|
GetScreen()->RefPos( true ), guide );
|
||||||
|
|
||||||
|
BOARD_ITEM* item = (*m_Collector)[0];
|
||||||
|
|
||||||
|
if( item )
|
||||||
{
|
{
|
||||||
code = g_HightLigth_NetCode = pt_piste->GetNet();
|
switch( item->Type() )
|
||||||
|
{
|
||||||
|
case TYPEPAD:
|
||||||
|
g_HightLigth_NetCode = ((D_PAD*)item)->GetNet();
|
||||||
Hight_Light( DC );
|
Hight_Light( DC );
|
||||||
}
|
SendMessageToEESCHEMA( item );
|
||||||
else
|
return g_HightLigth_NetCode;
|
||||||
{
|
|
||||||
pt_pad = Locate_Any_Pad( m_Pcb, CURSEUR_OFF_GRILLE );
|
default:
|
||||||
if( pt_pad != NULL )
|
g_HightLigth_NetCode = ((TRACK*)item)->GetNet();
|
||||||
{
|
|
||||||
code = g_HightLigth_NetCode = pt_pad->GetNet();
|
|
||||||
Hight_Light( DC );
|
Hight_Light( DC );
|
||||||
SendMessageToEESCHEMA( pt_pad );
|
return g_HightLigth_NetCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return -1; // HitTest() failed.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue