diff --git a/3d-viewer/3d_cache/3d_cache_wrapper.cpp b/3d-viewer/3d_cache/3d_cache_wrapper.cpp index 0e92b7aea9..223fde2138 100644 --- a/3d-viewer/3d_cache/3d_cache_wrapper.cpp +++ b/3d-viewer/3d_cache/3d_cache_wrapper.cpp @@ -40,6 +40,12 @@ CACHE_WRAPPER::~CACHE_WRAPPER() } +FILENAME_RESOLVER* PROJECT::Get3DFilenameResolver() +{ + return Get3DCacheManager()->GetResolver(); +} + + S3D_CACHE* PROJECT::Get3DCacheManager( bool updateProjDir ) { wxCriticalSectionLocker lock( lock3D_wrapper ); diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 181085cd92..76e1c09a1e 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -344,6 +344,28 @@ TOOL_ACTION ACTIONS::highContrastDec( "common.Control.highContrastDec", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_DEC ), "", "" ); +TOOL_ACTION ACTIONS::show3DViewer( "common.Control.show3DViewer", + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_3D_VIEWER ), + _( "3D Viewer" ), _( "Show 3D viewer window" ), + three_d_xpm ); + +TOOL_ACTION ACTIONS::configurePaths( "common.Control.configurePaths", + AS_GLOBAL, 0, + _( "Configure Paths..." ), _( "Edit path configuration environment variables" ), + path_xpm ); + +TOOL_ACTION ACTIONS::showSymbolLibTable( "common.Control.showSymbolLibTable", + AS_GLOBAL, 0, + _( "Manage Symbol Libraries..." ), + _( "Edit the global and project symbol library lists" ), + library_table_xpm ); + +TOOL_ACTION ACTIONS::showFootprintLibTable( "common.Control.showFootprintLibTable", + AS_GLOBAL, 0, + _( "Manage Footprint Libraries..." ), + _( "Edit the global and project footprint library lists" ), + library_table_xpm ); + TOOL_ACTION ACTIONS::acceleratedGraphics( "common.Control.acceleratedGraphics", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_OPENGL ), _( "Accelerated Graphics" ), _( "Use hardware-accelerated graphics (recommended)" ), @@ -354,11 +376,6 @@ TOOL_ACTION ACTIONS::standardGraphics( "common.Control.standardGraphics", _( "Standard Graphics" ), _( "Use software graphics (fall-back)" ), tools_xpm ); -TOOL_ACTION ACTIONS::show3DViewer( "pcbnew.Control.show3DViewer", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_3D_VIEWER ), - _( "3D Viewer" ), _( "Show 3D viewer window" ), - three_d_xpm ); - // System-wide selection Events diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index bb38f7e948..7af97d94e5 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -34,7 +34,9 @@ #include #include #include - +#include +#include +#include void COMMON_TOOLS::Reset( RESET_REASON aReason ) { @@ -492,6 +494,31 @@ int COMMON_TOOLS::ToggleCursorStyle( const TOOL_EVENT& aEvent ) } +int COMMON_TOOLS::ConfigurePaths( const TOOL_EVENT& aEvent ) +{ + KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB ); + kiface->CreateWindow( m_frame, DIALOG_CONFIGUREPATHS, &m_frame->Kiway() ); + return 0; +} + + +int COMMON_TOOLS::ShowLibraryTable( const TOOL_EVENT& aEvent ) +{ + if( aEvent.IsAction( &ACTIONS::showSymbolLibTable ) ) + { + KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH ); + kiface->CreateWindow( m_frame, DIALOG_SCH_LIBRARY_TABLE, &m_frame->Kiway() ); + } + else if( aEvent.IsAction( &ACTIONS::showFootprintLibTable ) ) + { + KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB ); + kiface->CreateWindow( m_frame, DIALOG_PCB_LIBRARY_TABLE, &m_frame->Kiway() ); + } + + return 0; +} + + int COMMON_TOOLS::SwitchCanvas( const TOOL_EVENT& aEvent ) { if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) ) @@ -553,6 +580,9 @@ void COMMON_TOOLS::setTransitions() Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() ); Go( &COMMON_TOOLS::ToggleCursorStyle, ACTIONS::toggleCursorStyle.MakeEvent() ); + Go( &COMMON_TOOLS::ConfigurePaths, ACTIONS::configurePaths.MakeEvent() ); + Go( &COMMON_TOOLS::ShowLibraryTable, ACTIONS::showSymbolLibTable.MakeEvent() ); + Go( &COMMON_TOOLS::ShowLibraryTable, ACTIONS::showFootprintLibTable.MakeEvent() ); Go( &COMMON_TOOLS::SwitchCanvas, ACTIONS::acceleratedGraphics.MakeEvent() ); Go( &COMMON_TOOLS::SwitchCanvas, ACTIONS::standardGraphics.MakeEvent() ); } diff --git a/cvpcb/tools/cvpcb_selection_tool.cpp b/cvpcb/tools/cvpcb_selection_tool.cpp index 03d8ae07b2..bd72a5390c 100644 --- a/cvpcb/tools/cvpcb_selection_tool.cpp +++ b/cvpcb/tools/cvpcb_selection_tool.cpp @@ -34,6 +34,7 @@ using namespace std::placeholders; #include +// JEY TODO: move all these actions to tool/actions.cpp // Selection tool actions TOOL_ACTION CVPCB_ACTIONS::selectionActivate( "cvpcb.InteractiveSelection", AS_GLOBAL, 0, diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 58f4fb1550..2fb7e045ca 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -703,6 +703,10 @@ size_t PANEL_SYM_LIB_TABLE::m_pageNdx = 0; void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) { + SCH_EDIT_FRAME* schEditor = (SCH_EDIT_FRAME*) aKiway->Player( FRAME_SCH, false ); + LIB_EDIT_FRAME* libEditor = (LIB_EDIT_FRAME*) aKiway->Player( FRAME_SCH_LIB_EDITOR, false ); + LIB_VIEW_FRAME* libViewer = (LIB_VIEW_FRAME*) aKiway->Player( FRAME_SCH_VIEWER, false ); + SYMBOL_LIB_TABLE* globalTable = &SYMBOL_LIB_TABLE::GetGlobalLibTable(); wxString globalTablePath = SYMBOL_LIB_TABLE::GetGlobalTableFileName(); SYMBOL_LIB_TABLE* projectTable = aKiway->Prj().SchSymbolLibTable(); @@ -710,6 +714,10 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) wxFileName projectTableFn( projectPath, SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() ); wxString msg; + // This prevents an ugly crash on OSX (https://bugs.launchpad.net/kicad/+bug/1765286) + if( libEditor ) + libEditor->FreezeSearchTree(); + DIALOG_EDIT_LIBRARY_TABLES dlg( aParent, _( "Symbol Libraries" ) ); dlg.InstallPanel( new PANEL_SYM_LIB_TABLE( &dlg, globalTable, globalTablePath, @@ -750,20 +758,15 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets. - SCH_EDIT_FRAME* schEditor = (SCH_EDIT_FRAME*) aKiway->Player( FRAME_SCH, false ); - if( schEditor ) schEditor->SyncView(); - auto editor = (LIB_EDIT_FRAME*) aKiway->Player( FRAME_SCH_LIB_EDITOR, false ); + if( libEditor ) + { + libEditor->SyncLibraries( true ); + libEditor->ThawSearchTree(); + } - if( editor ) - editor->SyncLibraries( true ); - - LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) aKiway->Player( FRAME_SCH_VIEWER, false ); - - if( viewer ) - viewer->ReCreateListLib(); + if( libViewer ) + libViewer->ReCreateListLib(); } - - diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 9b3d33748b..cf083a9f55 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -72,45 +72,40 @@ static struct IFACE : public KIFACE_I switch( aClassId ) { case FRAME_SCH: - { - SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent ); + { + SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent ); - if( Kiface().IsSingle() ) - { - // only run this under single_top, not under a project manager. - frame->CreateServer( KICAD_SCH_PORT_SERVICE_NUMBER ); - } - return frame; + if( Kiface().IsSingle() ) + { + // only run this under single_top, not under a project manager. + frame->CreateServer( KICAD_SCH_PORT_SERVICE_NUMBER ); } - break; + + return frame; + } case FRAME_SCH_LIB_EDITOR: - { - LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway, aParent ); - return frame; - } - break; + { + LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway, aParent ); + return frame; + } #ifdef KICAD_SPICE case FRAME_SIMULATOR: - { - SIM_PLOT_FRAME* frame = new SIM_PLOT_FRAME( aKiway, aParent ); - return frame; - } - break; -#endif /* KICAD_SPICE */ - + { + SIM_PLOT_FRAME* frame = new SIM_PLOT_FRAME( aKiway, aParent ); + return frame; + } +#endif case FRAME_SCH_VIEWER: case FRAME_SCH_VIEWER_MODAL: - { - LIB_VIEW_FRAME* frame = new LIB_VIEW_FRAME( aKiway, aParent, FRAME_T( aClassId ) ); - return frame; - } - break; + { + LIB_VIEW_FRAME* frame = new LIB_VIEW_FRAME( aKiway, aParent, FRAME_T( aClassId ) ); + return frame; + } case DIALOG_SCH_LIBRARY_TABLE: InvokeSchEditSymbolLibTable( aKiway, aParent ); - // Dialog has completed; nothing to return. return nullptr; diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 1ef6f181c7..a71cd90f24 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -204,12 +204,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : Raise(); Show( true ); - Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnConfigurePaths, this, - ID_PREFERENCES_CONFIGURE_PATHS ); - - Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this, - ID_EDIT_SYM_LIB_TABLE ); - m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); SyncView(); @@ -231,9 +225,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : LIB_EDIT_FRAME::~LIB_EDIT_FRAME() { - Unbind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this, - ID_EDIT_SYM_LIB_TABLE ); - // current screen is destroyed in EDA_DRAW_FRAME SetScreen( m_dummyScreen ); @@ -347,26 +338,21 @@ void LIB_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event ) } -void LIB_EDIT_FRAME::OnEditSymbolLibTable( wxCommandEvent& aEvent ) -{ - m_libMgr->GetAdapter()->Freeze(); - - SCH_BASE_FRAME::OnEditSymbolLibTable( aEvent ); - SyncLibraries( true ); - - m_libMgr->GetAdapter()->Thaw(); -} - - bool LIB_EDIT_FRAME::IsSearchTreeShown() { return m_auimgr.GetPane( m_treePane ).IsShown(); } -void LIB_EDIT_FRAME::ClearSearchTreeSelection() +void LIB_EDIT_FRAME::FreezeSearchTree() { - m_treePane->GetLibTree()->Unselect(); + m_libMgr->GetAdapter()->Freeze(); +} + + +void LIB_EDIT_FRAME::ThawSearchTree() +{ + m_libMgr->GetAdapter()->Thaw(); } diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h index 6381888a94..018aa9ec44 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/libedit/lib_edit_frame.h @@ -162,22 +162,12 @@ public: /** @return The default pin len setting. */ static int GetDefaultPinLength() { return m_defaultPinLength; } - - /** Set the default pin len. - */ static void SetDefaultPinLength( int aLength ) { m_defaultPinLength = aLength; } /** - * @return the increment value of the position of a pin - * for the pin repeat command + * @return the increment value of the position of a pin for the pin repeat command */ int GetRepeatPinStep() const { return m_repeatPinStep; } - - /** - * Sets the repeat step value for pins repeat command - * @param aStep the increment value of the position of an item - * for the repeat command - */ void SetRepeatPinStep( int aStep) { m_repeatPinStep = aStep; } void ReCreateMenuBar() override; @@ -270,10 +260,9 @@ public: void OnToggleSearchTree( wxCommandEvent& event ); - void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override; - bool IsSearchTreeShown(); - void ClearSearchTreeSelection(); + void FreezeSearchTree(); + void ThawSearchTree(); void OnUpdateHavePart( wxUpdateUIEvent& aEvent ); void OnUpdateSyncPinEdit( wxUpdateUIEvent& event ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 06e5229167..a5b7bec588 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -314,14 +314,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; }; - prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "Configure Pa&ths..." ), - _( "Edit path configuration environment variables" ), - path_xpm, EE_CONDITIONS::ShowAlways ); - - prefsMenu->AddItem( ID_EDIT_SYM_LIB_TABLE, _( "Manage Symbol Libraries..." ), - _( "Edit the global and project symbol library lists" ), - library_table_xpm, EE_CONDITIONS::ShowAlways ); - + prefsMenu->AddItem( ACTIONS::configurePaths, EE_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::showSymbolLibTable, EE_CONDITIONS::ShowAlways ); prefsMenu->AddItem( wxID_PREFERENCES, AddHotkeyName( _( "Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 28b664f77d..e013d17893 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -36,14 +36,10 @@ #include #include #include -#include #include #include #include -#include "dialogs/panel_sym_lib_table.h" - - LIB_ALIAS* SchGetLibAlias( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg ) @@ -262,19 +258,6 @@ void SCH_BASE_FRAME::UpdateStatusBar() } -void SCH_BASE_FRAME::OnConfigurePaths( wxCommandEvent& aEvent ) -{ - DIALOG_CONFIGURE_PATHS dlg( this, nullptr ); - dlg.ShowModal(); -} - - -void SCH_BASE_FRAME::OnEditSymbolLibTable( wxCommandEvent& aEvent ) -{ - InvokeSchEditSymbolLibTable( &Kiway(), this ); -} - - LIB_ALIAS* SCH_BASE_FRAME::GetLibAlias( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowError ) { PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL; diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 0f561fedcf..8bf245ddfc 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -244,8 +244,6 @@ public: const LIB_ID* aHighlight = nullptr, bool aAllowFields = true ); - void OnConfigurePaths( wxCommandEvent& aEvent ); - /** * Return a template field names list for read only access. */ @@ -265,8 +263,6 @@ public: return m_templateFieldNames.GetFieldName( aName ); } - virtual void OnEditSymbolLibTable( wxCommandEvent& aEvent ); - /** * Load symbol from symbol library table. * diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 7b532aed43..69b2b0f1c6 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -228,7 +228,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, SCH_EDIT_FRAME::Process_Config ) EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnPreferencesOptions ) - EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, SCH_EDIT_FRAME::OnConfigurePaths ) EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject ) EVT_MENU( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnRemapSymbols ) @@ -317,18 +316,12 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): // Net list generator DefaultExecFlags(); - Bind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this, - ID_EDIT_SYM_LIB_TABLE ); - UpdateTitle(); } SCH_EDIT_FRAME::~SCH_EDIT_FRAME() { - Unbind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this, - ID_EDIT_SYM_LIB_TABLE ); - delete m_item_to_repeat; // we own the cloned object, see this->SaveCopyForRepeatItem() SetScreen( NULL ); diff --git a/include/frame_type.h b/include/frame_type.h index 9aa151678f..c1db001811 100644 --- a/include/frame_type.h +++ b/include/frame_type.h @@ -66,7 +66,8 @@ enum FRAME_T FRAME_T_COUNT, // Library table dialogs are transient and are never returned - DIALOG_SCH_LIBRARY_TABLE = FRAME_T_COUNT, + DIALOG_CONFIGUREPATHS = FRAME_T_COUNT, + DIALOG_SCH_LIBRARY_TABLE, DIALOG_PCB_LIBRARY_TABLE }; diff --git a/include/project.h b/include/project.h index 1035f51965..7327e53750 100644 --- a/include/project.h +++ b/include/project.h @@ -45,6 +45,7 @@ class SEARCH_STACK; class S3D_CACHE; class KIWAY; class SYMBOL_LIB_TABLE; +class FILENAME_RESOLVER; #define VTBL_ENTRY virtual @@ -285,6 +286,9 @@ public: * @return a pointer to an instance of the 3D cache manager or NULL on failure */ S3D_CACHE* Get3DCacheManager( bool updateProjDir = false ); + + /// Accessor for 3D path resolver + FILENAME_RESOLVER* Get3DFilenameResolver(); #endif @@ -297,6 +301,9 @@ public: /// Accessor for project symbol library table. SYMBOL_LIB_TABLE* SchSymbolLibTable(); + + /// Accessor for 3D path resolver + FILENAME_RESOLVER* Get3DFilenameResolver() { return nullptr; } #endif //---------------------------------------------------- diff --git a/include/tool/actions.h b/include/tool/actions.h index cf8df12864..91c65881ab 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -136,9 +136,12 @@ public: static TOOL_ACTION resetLocalCoords; // Misc + static TOOL_ACTION show3DViewer; + static TOOL_ACTION configurePaths; + static TOOL_ACTION showSymbolLibTable; + static TOOL_ACTION showFootprintLibTable; static TOOL_ACTION acceleratedGraphics; static TOOL_ACTION standardGraphics; - static TOOL_ACTION show3DViewer; /** * Function TranslateLegacyId() diff --git a/include/tool/common_tools.h b/include/tool/common_tools.h index 5d863ee366..073e5b1b50 100644 --- a/include/tool/common_tools.h +++ b/include/tool/common_tools.h @@ -79,6 +79,8 @@ public: int ToggleGrid( const TOOL_EVENT& aEvent ); int GridProperties( const TOOL_EVENT& aEvent ); + int ConfigurePaths( const TOOL_EVENT& aEvent ); + int ShowLibraryTable( const TOOL_EVENT& aEvent ); int SwitchCanvas( const TOOL_EVENT& aEvent ); ///> Sets up handlers for various events. diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 0d1bdd3cdb..7a577ac186 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -590,8 +590,8 @@ void KICAD_MANAGER_FRAME::OnShowHotkeys( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnConfigurePaths( wxCommandEvent& aEvent ) { - DIALOG_CONFIGURE_PATHS dlg( this, nullptr ); - dlg.ShowModal(); + KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB ); + kiface->CreateWindow( this, DIALOG_CONFIGUREPATHS, &Kiway() ); } diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 45234a264a..9db13d0ac8 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -62,8 +62,6 @@ #include #include #include -#include - #include #include #include "tools/selection_tool.h" @@ -113,13 +111,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, FOOTPRINT_EDIT_FRAME::OnToggleSearchTree ) // Preferences and option menus - EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, - FOOTPRINT_EDIT_FRAME::ProcessPreferences ) - EVT_MENU( ID_PCB_LIB_TABLE_EDIT, - FOOTPRINT_EDIT_FRAME::ProcessPreferences ) - EVT_MENU( wxID_PREFERENCES, - FOOTPRINT_EDIT_FRAME::ProcessPreferences ) - EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, FOOTPRINT_EDIT_FRAME::OnConfigurePaths ) + EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( wxID_PREFERENCES, FOOTPRINT_EDIT_FRAME::ProcessPreferences ) // popup commands EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, @@ -822,10 +815,6 @@ void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event ) DisplayHotkeyList( this, g_Module_Editor_Hotkeys_Descr ); break; - case ID_PCB_LIB_TABLE_EDIT: - InvokePcbLibTableEditor( &Kiway(), this ); - break; - case wxID_PREFERENCES: ShowPreferences( g_Pcbnew_Editor_Hotkeys_Descr, g_Module_Editor_Hotkeys_Descr, wxT( "pcbnew" ) ); @@ -847,13 +836,6 @@ void FOOTPRINT_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent ) } -void FOOTPRINT_EDIT_FRAME::OnConfigurePaths( wxCommandEvent& aEvent ) -{ - DIALOG_CONFIGURE_PATHS dlg( this, Prj().Get3DCacheManager()->GetResolver() ); - dlg.ShowModal(); -} - - void FOOTPRINT_EDIT_FRAME::setupTools() { PCB_DRAW_PANEL_GAL* drawPanel = static_cast( GetGalCanvas() ); diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 6b526a8783..624b9292e1 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -128,7 +128,6 @@ public: // The Tool Framework initalization, for GAL mode void setupTools(); - void OnConfigurePaths( wxCommandEvent& aEvent ); void OnToggleSearchTree( wxCommandEvent& event ); void OnSaveFootprintAsPng( wxCommandEvent& event ); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 276290ed10..b95e435bf4 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -309,18 +309,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; }; - prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "&Configure Paths..." ), - _( "Edit path configuration environment variables" ), - path_xpm, SELECTION_CONDITIONS::ShowAlways ); - - prefsMenu->AddItem( ID_PCB_LIB_TABLE_EDIT, _( "Manage &Footprint Libraries..." ), - _( "Edit the global and project footprint library tables." ), - library_table_xpm, SELECTION_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways ); prefsMenu->AddItem( wxID_PREFERENCES, AddHotkeyName( _( "Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), - preference_xpm, SELECTION_CONDITIONS::ShowAlways ); + preference_xpm, SELECTION_CONDITIONS::ShowAlways ); prefsMenu->AddSeparator(); Pgm().AddMenuLanguageList( prefsMenu ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 5c4e678edb..38f7939314 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -494,23 +494,18 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; }; - prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "&Configure Paths..." ), - _( "Edit path configuration environment variables" ), - path_xpm, SELECTION_CONDITIONS::ShowAlways ); - - prefsMenu->AddItem( ID_PCB_LIB_TABLE_EDIT, _( "Manage &Footprint Libraries..." ), - _( "Edit the global and project footprint library tables." ), - library_table_xpm, SELECTION_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways ); + prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways ); #ifdef BUILD_GITHUB_PLUGIN prefsMenu->AddItem( ID_PCB_3DSHAPELIB_WIZARD, _( "Add &3D Shapes Libraries Wizard..." ), _( "Download 3D shape libraries from GitHub" ), - import3d_xpm, SELECTION_CONDITIONS::ShowAlways ); + import3d_xpm, SELECTION_CONDITIONS::ShowAlways ); #endif prefsMenu->AddItem( wxID_PREFERENCES, AddHotkeyName( _( "Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), - preference_xpm, SELECTION_CONDITIONS::ShowAlways ); + preference_xpm, SELECTION_CONDITIONS::ShowAlways ); prefsMenu->AddSeparator(); Pgm().AddMenuLanguageList( prefsMenu ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index a7352112bd..8e7deefb2f 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -153,9 +152,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit ) // menu Config - EVT_MENU( ID_PCB_LIB_TABLE_EDIT, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_3DSHAPELIB_WIZARD, PCB_EDIT_FRAME::Process_Config ) - EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, PCB_EDIT_FRAME::OnConfigurePaths ) EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( wxID_PREFERENCES, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_GRID_SETTINGS, PCB_EDIT_FRAME::OnGridSettings ) @@ -1020,13 +1017,6 @@ bool PCB_EDIT_FRAME::SetCurrentNetClass( const wxString& aNetClassName ) } -void PCB_EDIT_FRAME::OnConfigurePaths( wxCommandEvent& aEvent ) -{ - DIALOG_CONFIGURE_PATHS dlg( this, Prj().Get3DCacheManager()->GetResolver() ); - dlg.ShowModal(); -} - - void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event ) { NETLIST netlist; diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 75cf17b29c..3021777729 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -320,7 +320,6 @@ public: void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ); void OnLayerColorChange( wxCommandEvent& aEvent ); - void OnConfigurePaths( wxCommandEvent& aEvent ); void OnUpdatePCBFromSch( wxCommandEvent& event ); void OnRunEeschema( wxCommandEvent& event ); diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index a426152238..d649024b8e 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include "invoke_pcb_dialog.h" #include "dialog_global_fp_lib_table_config.h" @@ -119,9 +120,16 @@ static struct IFACE : public KIFACE_I case FRAME_PCB_FOOTPRINT_PREVIEW: return dynamic_cast< wxWindow* >( FOOTPRINT_PREVIEW_PANEL::New( aKiway, aParent ) ); + case DIALOG_CONFIGUREPATHS: + { + DIALOG_CONFIGURE_PATHS dlg( aParent, aKiway->Prj().Get3DFilenameResolver() ); + dlg.ShowModal(); + // Dialog has completed; nothing to return. + return nullptr; + } + case DIALOG_PCB_LIBRARY_TABLE: InvokePcbLibTableEditor( aKiway, aParent ); - // Dialog has completed; nothing to return. return nullptr; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index b287c6a7f1..3e59486dfc 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -66,10 +66,6 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) switch( id ) { - case ID_PCB_LIB_TABLE_EDIT: - InvokePcbLibTableEditor( &Kiway(), this ); - break; - case ID_PCB_3DSHAPELIB_WIZARD: #ifdef BUILD_GITHUB_PLUGIN Invoke3DShapeLibsDownloaderWizard( this ); diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index ae5a170853..7b0bc77c00 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -151,7 +151,6 @@ enum pcbnew_ids ID_PCB_GEN_CMP_FILE, ID_PCB_GEN_BOM_FILE_FROM_BOARD, ID_PCB_3DSHAPELIB_WIZARD, - ID_PCB_LIB_TABLE_EDIT, ID_BOARD_SETUP_DIALOG, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,