2009-11-09 14:00:22 +00:00
|
|
|
/************************************************/
|
|
|
|
/* Locate items at the current cursor position. */
|
|
|
|
/************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "gerbview.h"
|
2010-10-10 17:57:54 +00:00
|
|
|
#include "class_gerber_draw_item.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-10 17:57:54 +00:00
|
|
|
/* localize a gerber item and return a pointer to it.
|
|
|
|
* Display info about this item
|
2007-08-20 19:33:15 +00:00
|
|
|
*/
|
2010-10-10 17:57:54 +00:00
|
|
|
GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 19:33:15 +00:00
|
|
|
MsgPanel->EraseMsgBox();
|
2010-10-10 17:57:54 +00:00
|
|
|
wxPoint ref;
|
|
|
|
bool found = false;
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2010-10-10 17:57:54 +00:00
|
|
|
if( aTypeloc == CURSEUR_ON_GRILLE )
|
2011-02-11 20:48:13 +00:00
|
|
|
ref = GetScreen()->GetCrossHairPosition();
|
2010-10-10 17:57:54 +00:00
|
|
|
else
|
|
|
|
ref = GetScreen()->m_MousePosition;
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
int layer = GetScreen()->m_Active_Layer;
|
2010-10-10 17:57:54 +00:00
|
|
|
|
|
|
|
// Search first on active layer
|
|
|
|
BOARD_ITEM* item = GetBoard()->m_Drawings;
|
|
|
|
GERBER_DRAW_ITEM* gerb_item = NULL;
|
|
|
|
for( ; item; item = item->Next() )
|
|
|
|
{
|
|
|
|
gerb_item = (GERBER_DRAW_ITEM*) item;
|
|
|
|
if( gerb_item->GetLayer()!= layer )
|
|
|
|
continue;
|
|
|
|
if( gerb_item->HitTest( ref ) )
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !found ) // Search on all layers
|
|
|
|
{
|
|
|
|
item = GetBoard()->m_Drawings;
|
|
|
|
for( ; item; item = item->Next() )
|
|
|
|
{
|
|
|
|
gerb_item = (GERBER_DRAW_ITEM*) item;
|
|
|
|
if( gerb_item->HitTest( ref ) )
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( found )
|
|
|
|
{
|
|
|
|
gerb_item->DisplayInfo( this );
|
|
|
|
return gerb_item;
|
|
|
|
}
|
2007-08-20 19:33:15 +00:00
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|