From 88cab885af8f181cdd52493c1ac0547795e7aa42 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 20 Sep 2017 10:30:48 +0200 Subject: [PATCH] Code formatting --- gerbview/draw_gerber_screen.cpp | 4 +++- gerbview/events_called_functions.cpp | 1 - gerbview/excellon_read_drill_file.cpp | 2 ++ gerbview/gerbview_draw_panel_gal.cpp | 2 +- gerbview/gerbview_frame.cpp | 1 + gerbview/gerbview_frame.h | 2 ++ gerbview/gerbview_painter.cpp | 7 +++---- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index f1a7ea6bcf..a876265b79 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -139,11 +139,13 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) // On macOS, the call to create overlaydc fails for some reason due to // the DC having zero size initially. wxCoord w = 0, h = 0; - ( (wxWindowDC*)DC )->GetSize( &w, &h ); + static_cast( DC )->GetSize( &w, &h ); + if( w == 0 || h == 0) { w = h = 1; } + wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)DC, 0, 0, 1, 1 ); overlaydc.Clear(); } diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 61c1bf3b89..d8c4ffaee0 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -302,7 +302,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) } -// Handles the changing of the highlighted component/net/attribute void GERBVIEW_FRAME::OnSelectHighlightChoice( wxCommandEvent& event ) { if( IsGalCanvasActive() ) diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index b916f36776..6f949b6e21 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -199,9 +199,11 @@ bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName ) if( success ) { EDA_DRAW_PANEL_GAL* canvas = GetGalCanvas(); + if( canvas ) { KIGFX::VIEW* view = canvas->GetView(); + for( GERBER_DRAW_ITEM* item = drill_Layer->GetItemsList(); item; item = item->Next() ) { view->Add( (KIGFX::VIEW_ITEM*) item ); diff --git a/gerbview/gerbview_draw_panel_gal.cpp b/gerbview/gerbview_draw_panel_gal.cpp index 69e930019d..1249ec005e 100644 --- a/gerbview/gerbview_draw_panel_gal.cpp +++ b/gerbview/gerbview_draw_panel_gal.cpp @@ -128,7 +128,7 @@ void GERBVIEW_DRAW_PANEL_GAL::setDefaultLayerDeps() m_view->SetLayerDisplayOnly( LAYER_GERBVIEW_AXES ); m_view->SetLayerDisplayOnly( LAYER_GERBVIEW_BACKGROUND ); - m_view->SetLayerTarget( LAYER_GP_OVERLAY , KIGFX::TARGET_OVERLAY ); + m_view->SetLayerTarget( LAYER_GP_OVERLAY, KIGFX::TARGET_OVERLAY ); m_view->SetLayerDisplayOnly( LAYER_GP_OVERLAY ); } diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index a4123a433a..d3b86032f3 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -217,6 +217,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): { if( GetGalCanvas()->SwitchBackend( canvasType ) ) UseGalCanvas( true ); + wxUpdateUIEvent e; OnUpdateSwitchCanvas( e ); } diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 8bbc8202f6..34394c57a6 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -496,6 +496,8 @@ public: void Process_Special_Functions( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event ); + + /// Handles the changing of the highlighted component/net/attribute void OnSelectHighlightChoice( wxCommandEvent& event ); /** diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index 0e3dea3dde..025886df5b 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -178,7 +178,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) bool isFilled = true; COLOR4D color; // TODO(JE) This doesn't actually work properly for ImageNegative - bool isNegative = (aItem->GetLayerPolarity() ^ aItem->m_GerberImageFile->m_ImageNegative); + bool isNegative = ( aItem->GetLayerPolarity() ^ aItem->m_GerberImageFile->m_ImageNegative ); // Draw DCODEs if enabled if( IsDCodeLayer( aLayer ) ) @@ -206,9 +206,8 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) } else { - - textPosition.x = (start.x + end.x) / 2; - textPosition.y = (start.y + end.y) / 2; + textPosition.x = ( start.x + end.x ) / 2; + textPosition.y = ( start.y + end.y ) / 2; } color = m_gerbviewSettings.GetColor( aItem, aLayer );