From b171d381f027a5fa43ede36aa1697ad407bf96cc Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 29 Nov 2020 20:03:05 +0000 Subject: [PATCH] Collapse Redraw3DView and Update3DView into a single routine. Also fixes some errors about what the flag meant (model changed, NOT redraw immediately). Fixes https://gitlab.com/kicad/code/kicad/issues/6478 --- include/pcb_base_frame.h | 9 +-------- pcbnew/board_commit.cpp | 2 +- pcbnew/pcb_base_frame.cpp | 14 +++----------- pcbnew/pcb_edit_frame.cpp | 2 +- pcbnew/tools/edit_tool.cpp | 5 +++-- pcbnew/tools/pcb_inspection_tool.cpp | 4 ++-- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 8b8ff87d40..623e0cf8df 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -109,15 +109,8 @@ public: * Update the 3D view, if the viewer is opened by this frame * @param aTitle = the new title of the 3D frame, or nullptr * to do not change the frame title - * @return false if the 3D view cannot be updated (because the - * owner of the viewer is not this frame) */ - virtual void Update3DView( bool aForceReload, const wxString* aTitle = nullptr ); - - /** - * Request a redraw of 3D-Viewer canvas - */ - void Redraw3Dview(); + virtual void Update3DView( bool aReloadRequest, const wxString* aTitle = nullptr ); /** * Function LoadFootprint diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 834a97768c..2a964eec9a 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -360,7 +360,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( aSetDirtyBit ) frame->OnModify(); else - frame->Update3DView( false ); + frame->Update3DView( true ); frame->UpdateMsgPanel(); diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 809ee313e6..4b5169ffae 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -78,7 +78,7 @@ EDA_3D_VIEWER* PCB_BASE_FRAME::Get3DViewerFrame() } -void PCB_BASE_FRAME::Update3DView( bool aForceReload, const wxString* aTitle ) +void PCB_BASE_FRAME::Update3DView( bool aReloadRequest, const wxString* aTitle ) { EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame(); @@ -87,17 +87,9 @@ void PCB_BASE_FRAME::Update3DView( bool aForceReload, const wxString* aTitle ) if( aTitle ) draw3DFrame->SetTitle( *aTitle ); - draw3DFrame->NewDisplay( aForceReload ); - } -} + if( aReloadRequest ) + draw3DFrame->ReloadRequest(); - -void PCB_BASE_FRAME::Redraw3Dview() -{ - EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame(); - - if( draw3DFrame ) - { draw3DFrame->Redraw(); } } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index e54c22114c..de72bdea05 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1145,7 +1145,7 @@ void PCB_EDIT_FRAME::OnModify( ) { PCB_BASE_FRAME::OnModify(); - Update3DView( false ); + Update3DView( true ); m_ZoneFillsDirty = true; } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 66ff0bed98..9478e437bf 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -467,7 +467,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) } if( requestRedraw3Dview ) - editFrame->Redraw3Dview(); + editFrame->Update3DView( true ); m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved ); } @@ -1471,7 +1471,8 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool ) { EditToolSelectionFilter( aCollector, - EXCLUDE_LOCKED | EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS, sTool ); + EXCLUDE_LOCKED | EXCLUDE_LOCKED_PADS | EXCLUDE_TRANSIENTS, + sTool ); } ); if( selection.Empty() ) diff --git a/pcbnew/tools/pcb_inspection_tool.cpp b/pcbnew/tools/pcb_inspection_tool.cpp index 5883b82695..3cea31587a 100644 --- a/pcbnew/tools/pcb_inspection_tool.cpp +++ b/pcbnew/tools/pcb_inspection_tool.cpp @@ -624,7 +624,7 @@ int PCB_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent ) else m_frame->SendMessageToEESCHEMA( nullptr ); - m_frame->Redraw3Dview(); + m_frame->Update3DView( false ); return 0; } @@ -649,7 +649,7 @@ int PCB_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent ) request3DviewRedraw = false; if( request3DviewRedraw ) - m_frame->Redraw3Dview(); + m_frame->Update3DView( false ); return 0; }