diff --git a/gerbview/class_gbr_display_options.h b/gerbview/class_gbr_display_options.h index 43834594ab..ebd392df2b 100644 --- a/gerbview/class_gbr_display_options.h +++ b/gerbview/class_gbr_display_options.h @@ -61,13 +61,13 @@ public: m_DisplayLinesFill = true; m_DisplayPolygonsFill = true; m_DisplayPolarCood = false; - m_DisplayDCodes = true; + m_DisplayDCodes = false; m_IsPrinting = false; m_DisplayNegativeObjects = false; m_ForceBlackAndWhite = false; m_NegativeDrawColor = COLOR4D( DARKGRAY ); m_BgDrawColor = COLOR4D::BLACK; - m_DiffMode = true; + m_DiffMode = false; m_HighContrastMode = false; } }; diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 25d8477aa4..4cc29f20b3 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -685,9 +685,6 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const // calculate aRefPos in XY gerber axis: 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; switch( m_Shape ) @@ -695,17 +692,14 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const case GBR_POLYGON: poly = m_Polygon; return poly.Contains( VECTOR2I( ref_pos ), 0 ); - break; case GBR_SPOT_POLY: poly = GetDcodeDescr()->m_Polygon; poly.Move( m_Start ); return poly.Contains( VECTOR2I( ref_pos ), 0 ); - break; case GBR_SPOT_RECT: return GetBoundingBox().Contains( aRefPos ); - break; case GBR_SPOT_MACRO: // Aperture macro polygons are already in absolute coordinates @@ -716,9 +710,11 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const return true; } 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 ) return HitTestPoints( m_Start, ref_pos, radius ); else diff --git a/gerbview/gerbview_draw_panel_gal.cpp b/gerbview/gerbview_draw_panel_gal.cpp index 1249ec005e..256aad4f2b 100644 --- a/gerbview/gerbview_draw_panel_gal.cpp +++ b/gerbview/gerbview_draw_panel_gal.cpp @@ -47,7 +47,8 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy if( frame ) { auto displ_opts = (GBR_DISPLAY_OPTIONS*) frame->GetDisplayOptions(); - static_cast( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts ); + static_cast( m_view->GetPainter()->GetSettings() ) + ->LoadDisplayOptions( displ_opts ); UseColorScheme( frame->m_colorsSettings ); } } diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index d3ff27ca5e..a4953f8b94 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -44,7 +44,6 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc { m_messagePanel->EraseMsgBox(); wxPoint ref = aPosition; - bool found = false; if( aTypeloc == CURSEUR_ON_GRILLE ) ref = GetNearestGridPosition( ref ); @@ -52,55 +51,57 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc int layer = GetActiveLayer(); GERBER_FILE_IMAGE* gerber = GetGbrImage( layer ); - GERBER_DRAW_ITEM* gerb_item = NULL; + GERBER_DRAW_ITEM* gerb_item = nullptr; // Search first on active layer // 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; } } } - if( !found ) // Search on all layers + if( gerb_item == nullptr ) // Search on all layers { for( layer = 0; layer < (int)ImagesMaxCount(); ++layer ) { gerber = GetGbrImage( layer ); - if( gerber == NULL ) // Graphic layer not yet used + if( gerber == nullptr ) // Graphic layer not yet used continue; - if( !IsLayerVisible( layer ) ) + if( !gerber->m_IsVisible ) 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; } } - if( found ) + if( gerb_item ) break; } } - if( found && gerb_item ) + if( gerb_item ) { MSG_PANEL_ITEMS items; gerb_item->GetMsgPanelInfo( items ); SetMsgPanel( items ); - return gerb_item; } - return NULL; + return gerb_item; }