Gerbview: fix an issue in legacy mode (locate items was not working)
This commit is contained in:
parent
9bd5522419
commit
cdb577bbbc
|
@ -61,13 +61,13 @@ public:
|
||||||
m_DisplayLinesFill = true;
|
m_DisplayLinesFill = true;
|
||||||
m_DisplayPolygonsFill = true;
|
m_DisplayPolygonsFill = true;
|
||||||
m_DisplayPolarCood = false;
|
m_DisplayPolarCood = false;
|
||||||
m_DisplayDCodes = true;
|
m_DisplayDCodes = false;
|
||||||
m_IsPrinting = false;
|
m_IsPrinting = false;
|
||||||
m_DisplayNegativeObjects = false;
|
m_DisplayNegativeObjects = false;
|
||||||
m_ForceBlackAndWhite = false;
|
m_ForceBlackAndWhite = false;
|
||||||
m_NegativeDrawColor = COLOR4D( DARKGRAY );
|
m_NegativeDrawColor = COLOR4D( DARKGRAY );
|
||||||
m_BgDrawColor = COLOR4D::BLACK;
|
m_BgDrawColor = COLOR4D::BLACK;
|
||||||
m_DiffMode = true;
|
m_DiffMode = false;
|
||||||
m_HighContrastMode = false;
|
m_HighContrastMode = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -685,9 +685,6 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const
|
||||||
// calculate aRefPos in XY gerber axis:
|
// calculate aRefPos in XY gerber axis:
|
||||||
wxPoint ref_pos = GetXYPosition( aRefPos );
|
wxPoint ref_pos = GetXYPosition( aRefPos );
|
||||||
|
|
||||||
// TODO: a better analyze of the shape (perhaps create a D_CODE::HitTest for flashed items)
|
|
||||||
int radius = std::min( m_Size.x, m_Size.y ) >> 1;
|
|
||||||
|
|
||||||
SHAPE_POLY_SET poly;
|
SHAPE_POLY_SET poly;
|
||||||
|
|
||||||
switch( m_Shape )
|
switch( m_Shape )
|
||||||
|
@ -695,17 +692,14 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const
|
||||||
case GBR_POLYGON:
|
case GBR_POLYGON:
|
||||||
poly = m_Polygon;
|
poly = m_Polygon;
|
||||||
return poly.Contains( VECTOR2I( ref_pos ), 0 );
|
return poly.Contains( VECTOR2I( ref_pos ), 0 );
|
||||||
break;
|
|
||||||
|
|
||||||
case GBR_SPOT_POLY:
|
case GBR_SPOT_POLY:
|
||||||
poly = GetDcodeDescr()->m_Polygon;
|
poly = GetDcodeDescr()->m_Polygon;
|
||||||
poly.Move( m_Start );
|
poly.Move( m_Start );
|
||||||
return poly.Contains( VECTOR2I( ref_pos ), 0 );
|
return poly.Contains( VECTOR2I( ref_pos ), 0 );
|
||||||
break;
|
|
||||||
|
|
||||||
case GBR_SPOT_RECT:
|
case GBR_SPOT_RECT:
|
||||||
return GetBoundingBox().Contains( aRefPos );
|
return GetBoundingBox().Contains( aRefPos );
|
||||||
break;
|
|
||||||
|
|
||||||
case GBR_SPOT_MACRO:
|
case GBR_SPOT_MACRO:
|
||||||
// Aperture macro polygons are already in absolute coordinates
|
// Aperture macro polygons are already in absolute coordinates
|
||||||
|
@ -716,9 +710,11 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: a better analyze of the shape (perhaps create a D_CODE::HitTest for flashed items)
|
||||||
|
int radius = std::min( m_Size.x, m_Size.y ) >> 1;
|
||||||
|
|
||||||
if( m_Flashed )
|
if( m_Flashed )
|
||||||
return HitTestPoints( m_Start, ref_pos, radius );
|
return HitTestPoints( m_Start, ref_pos, radius );
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,7 +47,8 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
|
||||||
if( frame )
|
if( frame )
|
||||||
{
|
{
|
||||||
auto displ_opts = (GBR_DISPLAY_OPTIONS*) frame->GetDisplayOptions();
|
auto displ_opts = (GBR_DISPLAY_OPTIONS*) frame->GetDisplayOptions();
|
||||||
static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts );
|
static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )
|
||||||
|
->LoadDisplayOptions( displ_opts );
|
||||||
UseColorScheme( frame->m_colorsSettings );
|
UseColorScheme( frame->m_colorsSettings );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
|
||||||
{
|
{
|
||||||
m_messagePanel->EraseMsgBox();
|
m_messagePanel->EraseMsgBox();
|
||||||
wxPoint ref = aPosition;
|
wxPoint ref = aPosition;
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
if( aTypeloc == CURSEUR_ON_GRILLE )
|
if( aTypeloc == CURSEUR_ON_GRILLE )
|
||||||
ref = GetNearestGridPosition( ref );
|
ref = GetNearestGridPosition( ref );
|
||||||
|
@ -52,55 +51,57 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
|
||||||
int layer = GetActiveLayer();
|
int layer = GetActiveLayer();
|
||||||
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
|
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
|
||||||
|
|
||||||
GERBER_DRAW_ITEM* gerb_item = NULL;
|
GERBER_DRAW_ITEM* gerb_item = nullptr;
|
||||||
|
|
||||||
// Search first on active layer
|
// Search first on active layer
|
||||||
// A not used graphic layer can be selected. So gerber can be NULL
|
// A not used graphic layer can be selected. So gerber can be NULL
|
||||||
if( gerber && IsLayerVisible( layer ) )
|
if( gerber && gerber->m_IsVisible )
|
||||||
{
|
{
|
||||||
for( gerb_item = gerber->GetItemsList(); gerb_item; gerb_item = gerb_item->Next() )
|
for( auto item = gerber->GetItemsList(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( gerb_item->HitTest( ref ) )
|
if( item->HitTest( ref ) )
|
||||||
{
|
{
|
||||||
found = true;
|
gerb_item = item;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !found ) // Search on all layers
|
if( gerb_item == nullptr ) // Search on all layers
|
||||||
{
|
{
|
||||||
for( layer = 0; layer < (int)ImagesMaxCount(); ++layer )
|
for( layer = 0; layer < (int)ImagesMaxCount(); ++layer )
|
||||||
{
|
{
|
||||||
gerber = GetGbrImage( layer );
|
gerber = GetGbrImage( layer );
|
||||||
|
|
||||||
if( gerber == NULL ) // Graphic layer not yet used
|
if( gerber == nullptr ) // Graphic layer not yet used
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !IsLayerVisible( layer ) )
|
if( !gerber->m_IsVisible )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( gerb_item = gerber->GetItemsList(); gerb_item; gerb_item = gerb_item->Next() )
|
if( layer == GetActiveLayer() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for( auto item = gerber->GetItemsList(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( gerb_item->HitTest( ref ) )
|
if( item->HitTest( ref ) )
|
||||||
{
|
{
|
||||||
found = true;
|
gerb_item = item;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( found )
|
if( gerb_item )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( found && gerb_item )
|
if( gerb_item )
|
||||||
{
|
{
|
||||||
MSG_PANEL_ITEMS items;
|
MSG_PANEL_ITEMS items;
|
||||||
gerb_item->GetMsgPanelInfo( items );
|
gerb_item->GetMsgPanelInfo( items );
|
||||||
SetMsgPanel( items );
|
SetMsgPanel( items );
|
||||||
return gerb_item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return gerb_item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue