diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 385dc88cab..11bb5e6435 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -63,7 +63,9 @@ static DRILL_PRECISION precisionListForMetric( 3, 3 ); */ int PCB_EDITOR_CONTROL::GenerateDrillFiles( const TOOL_EVENT& aEvent ) { - DIALOG_GENDRILL dlg( frame(), frame() ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_GENDRILL dlg( editFrame, editFrame ); + dlg.ShowModal(); return 0; } diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index defaddacb6..a6cfa4a217 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -60,7 +60,9 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) : int GLOBAL_EDIT_TOOL::GlobalDeletions( const TOOL_EVENT& aEvent ) { - DIALOG_GLOBAL_DELETION dlg( frame() ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_GLOBAL_DELETION dlg( editFrame ); + dlg.SetCurrentLayer( frame()->GetActiveLayer() ); dlg.ShowModal(); return 0; diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index 753b9202a7..14a68cdbcd 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -410,9 +410,10 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() int GLOBAL_EDIT_TOOL::EditTextAndGraphics( const TOOL_EVENT& aEvent ) { - DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( frame() ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( editFrame ); + dlg.ShowModal(); - return 0; } diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index c8a2f14b30..d4e5e5c6f6 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -371,9 +371,10 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnSizeNetclassGrid( wxSizeEvent& event int GLOBAL_EDIT_TOOL::EditTracksAndVias( const TOOL_EVENT& aEvent ) { - DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( frame() ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( editFrame ); + dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR - return 0; } diff --git a/pcbnew/dialogs/dialog_swap_layers.cpp b/pcbnew/dialogs/dialog_swap_layers.cpp index 31293de2e1..38352cde1a 100644 --- a/pcbnew/dialogs/dialog_swap_layers.cpp +++ b/pcbnew/dialogs/dialog_swap_layers.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include #include @@ -69,7 +69,7 @@ public: }; -DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ) : +DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_BASE_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ) : DIALOG_SWAP_LAYERS_BASE( aParent ), m_parent( aParent ), m_layerDestinations( aArray ) diff --git a/pcbnew/dialogs/dialog_swap_layers.h b/pcbnew/dialogs/dialog_swap_layers.h index 26175dc57b..c2cf4f8e2d 100644 --- a/pcbnew/dialogs/dialog_swap_layers.h +++ b/pcbnew/dialogs/dialog_swap_layers.h @@ -33,13 +33,13 @@ class LAYER_GRID_TABLE; class DIALOG_SWAP_LAYERS : public DIALOG_SWAP_LAYERS_BASE { private: - PCB_EDIT_FRAME* m_parent; - PCB_LAYER_ID* m_layerDestinations; + PCB_BASE_EDIT_FRAME* m_parent; + PCB_LAYER_ID* m_layerDestinations; - LAYER_GRID_TABLE* m_gridTable; + LAYER_GRID_TABLE* m_gridTable; public: - DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ); + DIALOG_SWAP_LAYERS( PCB_BASE_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ); ~DIALOG_SWAP_LAYERS() override; private: diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp index faacefd14b..b59334c9b9 100644 --- a/pcbnew/exporters/gen_footprints_placefile.cpp +++ b/pcbnew/exporters/gen_footprints_placefile.cpp @@ -407,7 +407,9 @@ static bool HasNonSMDPins( MODULE* aModule ) int PCB_EDITOR_CONTROL::GeneratePosFile( const TOOL_EVENT& aEvent ) { - DIALOG_GEN_FOOTPRINT_POSITION dlg( frame() ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_GEN_FOOTPRINT_POSITION dlg( editFrame ); + dlg.ShowModal(); return 0; } diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index eae6eb9633..c00c5cf362 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -757,10 +757,12 @@ bool ROUTER_TOOL::prepareInteractive() return false; } - frame()->SetActiveLayer( ToLAYER_ID( routingLayer ) ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + + editFrame->SetActiveLayer( ToLAYER_ID( routingLayer ) ); // Force layer visible - frame()->GetLayerManager()->SetLayerVisible( routingLayer, true ); + editFrame->GetLayerManager()->SetLayerVisible( routingLayer, true ); // for some reason I don't understand, GetNetclass() may return null sometimes... if( m_startItem && m_startItem->Net() >= 0 && @@ -768,10 +770,10 @@ bool ROUTER_TOOL::prepareInteractive() { highlightNet( true, m_startItem->Net() ); // Update track width and via size shown in main toolbar comboboxes - frame()->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() ); + editFrame->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() ); } else - frame()->SetCurrentNetClass( NETCLASS::Default ); + editFrame->SetCurrentNetClass( NETCLASS::Default ); controls()->ForceCursorPosition( false ); controls()->SetAutoPan( true ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 40801c8d18..ad3f732ba4 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1549,7 +1549,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) { GRID_HELPER m_gridHelper; - VIA_PLACER( PCB_EDIT_FRAME* aFrame ) : m_gridHelper( aFrame ) + VIA_PLACER( PCB_BASE_EDIT_FRAME* aFrame ) : m_gridHelper( aFrame ) {} TRACK* findTrack( VIA* aVia ) diff --git a/pcbnew/tools/global_edit_tool.cpp b/pcbnew/tools/global_edit_tool.cpp index d3ba4cc4d1..8e1e8a3cfc 100644 --- a/pcbnew/tools/global_edit_tool.cpp +++ b/pcbnew/tools/global_edit_tool.cpp @@ -143,7 +143,8 @@ int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent ) // invoke the exchange dialog process { - DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode, currentMode ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_EXCHANGE_FOOTPRINTS dialog( editFrame, mod, updateMode, currentMode ); dialog.ShowQuasiModal(); } diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index bff00c19f0..3178aee589 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -506,14 +506,14 @@ int PCB_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent ) int PCB_EDITOR_CONTROL::BoardSetup( const TOOL_EVENT& aEvent ) { - frame()->DoShowBoardSetupDialog(); + getEditFrame()->DoShowBoardSetupDialog(); return 0; } int PCB_EDITOR_CONTROL::ImportNetlist( const TOOL_EVENT& aEvent ) { - frame()->InstallNetlistFrame(); + getEditFrame()->InstallNetlistFrame(); return 0; } @@ -532,7 +532,7 @@ int PCB_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent ) wxT( ".ses" ), wxT( "*.ses" ), frame(), wxFD_OPEN, false ); if( !fullFileName.IsEmpty() ) - frame()->ImportSpecctraSession( fullFileName ); + getEditFrame()->ImportSpecctraSession( fullFileName ); return 0; } @@ -550,7 +550,7 @@ int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent ) frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false ); if( !fullFileName.IsEmpty() ) - frame()->ExportSpecctraFile( fullFileName ); + getEditFrame()->ExportSpecctraFile( fullFileName ); return 0; } @@ -596,14 +596,14 @@ int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent ) int PCB_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent ) { - frame()->ToggleLayersManager(); + getEditFrame()->ToggleLayersManager(); return 0; } int PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent ) { - frame()->ToggleMicrowaveToolbar(); + getEditFrame()->ToggleMicrowaveToolbar(); return 0; } diff --git a/pcbnew/tools/pcb_tool_base.h b/pcbnew/tools/pcb_tool_base.h index 4d5a1a6cb6..f3048c89f0 100644 --- a/pcbnew/tools/pcb_tool_base.h +++ b/pcbnew/tools/pcb_tool_base.h @@ -55,7 +55,7 @@ struct INTERACTIVE_PLACER_BASE virtual void SnapItem( BOARD_ITEM *aItem ); virtual bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit ); - PCB_EDIT_FRAME* m_frame; + PCB_BASE_EDIT_FRAME* m_frame; BOARD* m_board; int m_modifiers; }; @@ -134,14 +134,28 @@ protected: virtual void setTransitions() override; - KIGFX::PCB_VIEW* view() const { return static_cast( getView() ); } - KIGFX::VIEW_CONTROLS* controls() const { return getViewControls(); } - PCB_EDIT_FRAME* frame() const { return getEditFrame(); } + KIGFX::PCB_VIEW* view() const + { + return static_cast( getView() ); + } + + KIGFX::VIEW_CONTROLS* controls() const + { + return getViewControls(); + } + + PCB_BASE_EDIT_FRAME* frame() const + { + return getEditFrame(); + } + BOARD* board() const { return getModel(); } - MODULE* module() const + + MODULE* module() const { return board()->GetFirstModule(); } + PCB_DISPLAY_OPTIONS* displayOptions() const; PCB_DRAW_PANEL_GAL* canvas() const; const PCBNEW_SELECTION& selection() const; diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index acc3955cf9..2219a43c08 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -127,7 +127,7 @@ int ZONE_FILLER_TOOL::ZoneFillAll( const TOOL_EVENT& aEvent ) filler.SetProgressReporter( progressReporter.get() ); if( filler.Fill( toFill ) ) - frame()->m_ZoneFillsDirty = false; + getEditFrame()->m_ZoneFillsDirty = false; canvas()->Refresh(); diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index 85979b5cd5..3feb2cd112 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -43,7 +43,9 @@ */ int GLOBAL_EDIT_TOOL::CleanupTracksAndVias( const TOOL_EVENT& aEvent ) { - DIALOG_CLEANUP_TRACKS_AND_VIAS dlg( frame() ); + PCB_EDIT_FRAME* editFrame = getEditFrame(); + DIALOG_CLEANUP_TRACKS_AND_VIAS dlg( editFrame ); + dlg.ShowModal(); return 0; }