More ACTIONS work. Nearly done now.

This commit is contained in:
Jeff Young 2019-06-04 19:46:52 +01:00
parent eb1faebf1f
commit 1ea5b04e22
23 changed files with 146 additions and 152 deletions

View File

@ -358,6 +358,16 @@ TOOL_ACTION ACTIONS::show3DViewer( "common.Control.show3DViewer",
_( "3D Viewer" ), _( "Show 3D viewer window" ), _( "3D Viewer" ), _( "Show 3D viewer window" ),
three_d_xpm ); three_d_xpm );
TOOL_ACTION ACTIONS::showSymbolBrowser( "common.Control.showSymbolBrowser",
AS_GLOBAL, 0,
_( "Symbol Library Browser" ), _( "Browse symbol libraries" ),
library_browse_xpm );
TOOL_ACTION ACTIONS::showFootprintBrowser( "common.Control.showFootprintBrowser",
AS_GLOBAL, 0,
_( "Footprint Library Browser" ), _( "Browse footprint libraries" ),
modview_icon_xpm );
TOOL_ACTION ACTIONS::updatePcbFromSchematic( "common.Control.updatePcbFromSchematic", TOOL_ACTION ACTIONS::updatePcbFromSchematic( "common.Control.updatePcbFromSchematic",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UPDATE_PCB_FROM_SCH ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UPDATE_PCB_FROM_SCH ),
_( "Update PCB from Schematic..." ), _( "Push changes from schematic to PCB" ), _( "Update PCB from Schematic..." ), _( "Push changes from schematic to PCB" ),

View File

@ -147,7 +147,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
return IsSearchTreeShown(); return IsSearchTreeShown();
}; };
viewMenu->AddItem( EE_ACTIONS::showLibraryBrowser, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::showSymbolBrowser, EE_CONDITIONS::ShowAlways );
viewMenu->AddSeparator(); viewMenu->AddSeparator();
viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways );

View File

@ -188,7 +188,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
return GetShowAllPins(); return GetShowAllPins();
}; };
viewMenu->AddItem( EE_ACTIONS::showLibraryBrowser, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::showSymbolBrowser, EE_CONDITIONS::ShowAlways );
viewMenu->AddItem( EE_ACTIONS::navigateHierarchy, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( EE_ACTIONS::navigateHierarchy, EE_CONDITIONS::ShowAlways );
viewMenu->AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition ); viewMenu->AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition );

View File

@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->Add( EE_ACTIONS::showSymbolEditor ); m_mainToolBar->Add( EE_ACTIONS::showSymbolEditor );
m_mainToolBar->Add( EE_ACTIONS::showLibraryBrowser ); m_mainToolBar->Add( ACTIONS::showSymbolBrowser );
// modedit is with libedit in a "library section" because the user must have footprints before // modedit is with libedit in a "library section" because the user must have footprints before
// they can be assigned. // they can be assigned.

View File

@ -161,9 +161,7 @@ public:
// Suite operations // Suite operations
static TOOL_ACTION showSymbolEditor; static TOOL_ACTION showSymbolEditor;
static TOOL_ACTION editWithLibEdit; static TOOL_ACTION editWithLibEdit;
static TOOL_ACTION showLibraryBrowser;
static TOOL_ACTION showPcbNew; static TOOL_ACTION showPcbNew;
static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION generateBOM; static TOOL_ACTION generateBOM;
static TOOL_ACTION runSimulation; static TOOL_ACTION runSimulation;

View File

@ -179,7 +179,7 @@ void LIB_CONTROL::setTransitions()
Go( &LIB_CONTROL::OnDeMorgan, EE_ACTIONS::showDeMorganStandard.MakeEvent() ); Go( &LIB_CONTROL::OnDeMorgan, EE_ACTIONS::showDeMorganStandard.MakeEvent() );
Go( &LIB_CONTROL::OnDeMorgan, EE_ACTIONS::showDeMorganAlternate.MakeEvent() ); Go( &LIB_CONTROL::OnDeMorgan, EE_ACTIONS::showDeMorganAlternate.MakeEvent() );
Go( &LIB_CONTROL::ShowLibraryBrowser, EE_ACTIONS::showLibraryBrowser.MakeEvent() ); Go( &LIB_CONTROL::ShowLibraryBrowser, ACTIONS::showSymbolBrowser.MakeEvent() );
Go( &LIB_CONTROL::ShowElectricalTypes, EE_ACTIONS::showElectricalTypes.MakeEvent() ); Go( &LIB_CONTROL::ShowElectricalTypes, EE_ACTIONS::showElectricalTypes.MakeEvent() );
Go( &LIB_CONTROL::ShowComponentTree, EE_ACTIONS::showComponentTree.MakeEvent() ); Go( &LIB_CONTROL::ShowComponentTree, EE_ACTIONS::showComponentTree.MakeEvent() );
} }

View File

@ -86,11 +86,6 @@ TOOL_ACTION EE_ACTIONS::editWithLibEdit( "eeschema.EditorControl.editWithSymbolE
_( "Edit with Symbol Editor" ), _( "Open the symbol editor to edit the symbol" ), _( "Edit with Symbol Editor" ), _( "Open the symbol editor to edit the symbol" ),
libedit_xpm ); libedit_xpm );
TOOL_ACTION EE_ACTIONS::showLibraryBrowser( "eeschema.EditorControl.showLibraryBrowser",
AS_GLOBAL, 0,
_( "Symbol Library Browser" ), _( "Browse symbol libraries" ),
library_browse_xpm );
TOOL_ACTION EE_ACTIONS::editSymbolFields( "eeschema.EditorControl.editSymbolFields", TOOL_ACTION EE_ACTIONS::editSymbolFields( "eeschema.EditorControl.editSymbolFields",
AS_GLOBAL, 0, AS_GLOBAL, 0,
_( "Edit Symbol Fields..." ), _( "Bulk-edit fields of all symbols in schematic" ), _( "Edit Symbol Fields..." ), _( "Bulk-edit fields of all symbols in schematic" ),
@ -1265,7 +1260,7 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::EditWithLibEdit, EE_ACTIONS::editWithLibEdit.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::EditWithLibEdit, EE_ACTIONS::editWithLibEdit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSymbolEditor, EE_ACTIONS::showSymbolEditor.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ShowSymbolEditor, EE_ACTIONS::showSymbolEditor.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowLibraryBrowser, EE_ACTIONS::showLibraryBrowser.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ShowLibraryBrowser, ACTIONS::showSymbolBrowser.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Annotate, EE_ACTIONS::annotate.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::Annotate, EE_ACTIONS::annotate.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() );

View File

@ -141,6 +141,8 @@ public:
// Misc // Misc
static TOOL_ACTION show3DViewer; static TOOL_ACTION show3DViewer;
static TOOL_ACTION showSymbolBrowser;
static TOOL_ACTION showFootprintBrowser;
static TOOL_ACTION updatePcbFromSchematic; static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION configurePaths; static TOOL_ACTION configurePaths;
static TOOL_ACTION showSymbolLibTable; static TOOL_ACTION showSymbolLibTable;

View File

@ -111,31 +111,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_OPEN_MODULE_VIEWER:
{
FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
if( !viewer )
{
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
}
else
{
// Needed on Windows, other platforms do not use it,
// but it creates no issue
if( viewer->IsIconized() )
viewer->Iconize( false );
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
}
}
break;
case ID_GET_NETLIST: case ID_GET_NETLIST:
InstallNetlistFrame(); InstallNetlistFrame();
break; break;

View File

@ -85,14 +85,11 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_CHOICE( ID_ON_ZOOM_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectZoom ) EVT_CHOICE( ID_ON_ZOOM_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectZoom )
EVT_CHOICE( ID_ON_GRID_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectGrid ) EVT_CHOICE( ID_ON_GRID_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectGrid )
EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_PNG, FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng ) EVT_TOOL( ID_MODEDIT_SAVE_PNG, FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng )
EVT_TOOL( ID_MODEDIT_CUT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_CUT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_COPY_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_COPY_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PASTE_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_PASTE_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_IMPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_IMPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SHEET_SET, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )

View File

@ -156,32 +156,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_OPEN_MODULE_VIEWER:
{
FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
if( !viewer )
{
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
viewer->Show( true );
viewer->Zoom_Automatique( false );
}
else
{
// On Windows, Raise() does not bring the window on screen, when iconized
if( viewer->IsIconized() )
viewer->Iconize( false );
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
}
}
break;
case ID_MODEDIT_NEW_MODULE: case ID_MODEDIT_NEW_MODULE:
{ {
LIB_ID selected = m_treePane->GetLibTree()->GetSelectedLibId(); LIB_ID selected = m_treePane->GetLibTree()->GetSelectedLibId();

View File

@ -54,9 +54,9 @@ FOOTPRINT_TREE_PANE::FOOTPRINT_TREE_PANE( FOOTPRINT_EDIT_FRAME* aParent )
menuLibrary->Add( ACTIONS::saveAs ); menuLibrary->Add( ACTIONS::saveAs );
menuLibrary->AppendSeparator(); menuLibrary->AppendSeparator();
menuLibrary->Add( _( "New Footprint..." ), ID_MODEDIT_NEW_MODULE, new_footprint_xpm ); menuLibrary->Add( PCB_ACTIONS::newFootprint );
#ifdef KICAD_SCRIPTING #ifdef KICAD_SCRIPTING
menuLibrary->Add( _( "Create Footprint from Wizard..." ), ID_MODEDIT_NEW_MODULE_FROM_WIZARD, module_wizard_xpm ); menuLibrary->Add( PCB_ACTIONS::createFootprint );
#endif #endif
menuLibrary->Add( _( "Import Footprint..." ), ID_MODEDIT_IMPORT_PART, import_module_xpm ); menuLibrary->Add( _( "Import Footprint..." ), ID_MODEDIT_IMPORT_PART, import_module_xpm );
menuLibrary->Add( _( "Paste Footprint" ), ID_MODEDIT_PASTE_PART, paste_xpm ); menuLibrary->Add( _( "Paste Footprint" ), ID_MODEDIT_PASTE_PART, paste_xpm );

View File

@ -64,16 +64,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
fileMenu->AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddItem( ACTIONS::addLibrary, SELECTION_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::addLibrary, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddItem( ID_MODEDIT_NEW_MODULE, fileMenu->AddItem( PCB_ACTIONS::newFootprint, SELECTION_CONDITIONS::ShowAlways );
AddHotkeyName( _( "&New Footprint..." ), m_hotkeysDescrList, HK_NEW ),
_( "Create a new footprint" ),
new_footprint_xpm, SELECTION_CONDITIONS::ShowAlways );
#ifdef KICAD_SCRIPTING #ifdef KICAD_SCRIPTING
fileMenu->AddItem( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, fileMenu->AddItem( PCB_ACTIONS::createFootprint, SELECTION_CONDITIONS::ShowAlways );
_( "&Create Footprint..." ),
_( "Create a new footprint using the footprint wizard" ),
module_wizard_xpm, SELECTION_CONDITIONS::ShowAlways );
#endif #endif
fileMenu->AddSeparator(); fileMenu->AddSeparator();
@ -185,11 +178,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
return IsSearchTreeShown(); return IsSearchTreeShown();
}; };
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER, viewMenu->AddItem( ACTIONS::showFootprintBrowser, SELECTION_CONDITIONS::ShowAlways );
_( "Footprint &Library Browser" ),
_( "Browse footprint libraries" ),
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator(); viewMenu->AddSeparator();

View File

@ -324,10 +324,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS, _( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS,
mw_toolbar_xpm, microwaveToolbarShownCondition ); mw_toolbar_xpm, microwaveToolbarShownCondition );
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER, viewMenu->AddItem( ACTIONS::showFootprintBrowser, SELECTION_CONDITIONS::ShowAlways );
_( "Footprint &Library Browser" ), _( "Browse footprint libraries" ),
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator(); viewMenu->AddSeparator();

View File

@ -120,7 +120,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_MENU_READ_BOARD_BACKUP_FILE, PCB_EDIT_FRAME::Files_io ) EVT_TOOL( ID_MENU_READ_BOARD_BACKUP_FILE, PCB_EDIT_FRAME::Files_io )
EVT_TOOL( ID_MENU_RECOVER_BOARD_AUTOSAVE, PCB_EDIT_FRAME::Files_io ) EVT_TOOL( ID_MENU_RECOVER_BOARD_AUTOSAVE, PCB_EDIT_FRAME::Files_io )
EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_OPEN_MODULE_VIEWER, PCB_EDIT_FRAME::Process_Special_Functions )
// Menu Files: // Menu Files:
EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions )

View File

@ -16,7 +16,6 @@ enum pcbnew_ids
ID_MAIN_MENUBAR = ID_END_LIST, ID_MAIN_MENUBAR = ID_END_LIST,
ID_MICROWAVE_V_TOOLBAR, ID_MICROWAVE_V_TOOLBAR,
ID_OPEN_MODULE_EDITOR, ID_OPEN_MODULE_EDITOR,
ID_OPEN_MODULE_VIEWER,
ID_SET_RELATIVE_OFFSET, ID_SET_RELATIVE_OFFSET,
ID_COPY_BOARD_AS, ID_COPY_BOARD_AS,
ID_IMPORT_NON_KICAD_BOARD, ID_IMPORT_NON_KICAD_BOARD,

View File

@ -49,14 +49,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
wxString msg; wxString msg;
// Set up toolbar // Set up toolbar
m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, m_mainToolBar->Add( PCB_ACTIONS::newFootprint );
KiScaledBitmap( new_footprint_xpm, this ),
_( "New footprint" ) );
#ifdef KICAD_SCRIPTING #ifdef KICAD_SCRIPTING
m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, wxEmptyString, m_mainToolBar->Add( PCB_ACTIONS::createFootprint );
KiScaledBitmap( module_wizard_xpm, this ),
_( "New footprint using footprint wizard" ) );
#endif #endif
if( IsCurrentFPFromBoard() ) if( IsCurrentFPFromBoard() )

View File

@ -268,7 +268,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
ADD_TOOL( ID_OPEN_MODULE_EDITOR, module_editor_xpm, _( "Open footprint editor" ) ); ADD_TOOL( ID_OPEN_MODULE_EDITOR, module_editor_xpm, _( "Open footprint editor" ) );
ADD_TOOL( ID_OPEN_MODULE_VIEWER, modview_icon_xpm, _( "Open footprint viewer" ) ); m_mainToolBar->Add( ACTIONS::showFootprintBrowser );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( ACTIONS::updatePcbFromSchematic ); m_mainToolBar->Add( ACTIONS::updatePcbFromSchematic );

View File

@ -55,6 +55,16 @@ using namespace std::placeholders;
#include <wx/defs.h> #include <wx/defs.h>
TOOL_ACTION PCB_ACTIONS::newFootprint( "pcbnew.ModuleEditor.newFootprint",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_NEW ),
_( "New Footprint..." ), _( "Create a new, empty footprint" ),
new_footprint_xpm );
TOOL_ACTION PCB_ACTIONS::createFootprint( "pcbnew.ModuleEditor.createFootprint",
AS_GLOBAL, 0,
_( "Create Footprint..." ), _( "Create a new footprint using the Footprint Wizard" ),
module_wizard_xpm );
TOOL_ACTION PCB_ACTIONS::saveToBoard( "pcbnew.ModuleEditor.saveToBoard", TOOL_ACTION PCB_ACTIONS::saveToBoard( "pcbnew.ModuleEditor.saveToBoard",
AS_GLOBAL, 0, AS_GLOBAL, 0,
_( "Save to Board" ), _( "Update footprint on board" ), _( "Save to Board" ), _( "Update footprint on board" ),
@ -120,6 +130,22 @@ void MODULE_EDITOR_TOOLS::Reset( RESET_REASON aReason )
} }
int MODULE_EDITOR_TOOLS::NewFootprint( const TOOL_EVENT& aEvent )
{
wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_NEW_MODULE );
getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
return 0;
}
int MODULE_EDITOR_TOOLS::CreateFootprint( const TOOL_EVENT& aEvent )
{
wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_NEW_MODULE_FROM_WIZARD );
getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
return 0;
}
int MODULE_EDITOR_TOOLS::Save( const TOOL_EVENT& aEvent ) int MODULE_EDITOR_TOOLS::Save( const TOOL_EVENT& aEvent )
{ {
wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_SAVE ); wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_SAVE );
@ -623,6 +649,8 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
void MODULE_EDITOR_TOOLS::setTransitions() void MODULE_EDITOR_TOOLS::setTransitions()
{ {
Go( &MODULE_EDITOR_TOOLS::NewFootprint, PCB_ACTIONS::newFootprint.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::CreateFootprint, PCB_ACTIONS::createFootprint.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::Save, ACTIONS::save.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::Save, ACTIONS::save.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::Save, PCB_ACTIONS::saveToBoard.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::Save, PCB_ACTIONS::saveToBoard.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::Save, PCB_ACTIONS::saveToLibrary.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::Save, PCB_ACTIONS::saveToLibrary.MakeEvent() );

View File

@ -49,6 +49,9 @@ public:
/// @copydoc TOOL_INTERACTIVE::Reset() /// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override; void Reset( RESET_REASON aReason ) override;
int NewFootprint( const TOOL_EVENT& aEvent );
int CreateFootprint( const TOOL_EVENT& aEvent );
int Save( const TOOL_EVENT& aEvent ); int Save( const TOOL_EVENT& aEvent );
int SaveAs( const TOOL_EVENT& aEvent ); int SaveAs( const TOOL_EVENT& aEvent );
int Revert( const TOOL_EVENT& aEvent ); int Revert( const TOOL_EVENT& aEvent );

View File

@ -263,20 +263,31 @@ public:
static TOOL_ACTION changeFootprints; static TOOL_ACTION changeFootprints;
static TOOL_ACTION swapLayers; static TOOL_ACTION swapLayers;
static TOOL_ACTION listNets; static TOOL_ACTION listNets;
static TOOL_ACTION runDRC; static TOOL_ACTION runDRC;
static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION editFootprintInFpEditor;
static TOOL_ACTION showPythonConsole; static TOOL_ACTION showPythonConsole;
static TOOL_ACTION showHelp;
// Module editor tools // Module editor tools
// These are distinct so that they can have individual tooltips and icons. // We don't use ACTION::new here because we need to distinguish between New Library
// and New Footprint.
static TOOL_ACTION newFootprint;
// Create a new footprint using the Footprint Wizard
static TOOL_ACTION createFootprint;
// We don't use ACTION::save here because we need to distinguish between saving to
// the library and saving to the board (which have different tooltips and icons).
static TOOL_ACTION saveToBoard; static TOOL_ACTION saveToBoard;
static TOOL_ACTION saveToLibrary; static TOOL_ACTION saveToLibrary;
static TOOL_ACTION deleteFootprint; static TOOL_ACTION deleteFootprint;
static TOOL_ACTION footprintProperties; static TOOL_ACTION footprintProperties;
static TOOL_ACTION defaultPadProperties;
/// Activation of the drawing tool (placing a PAD) /// Activation of the drawing tool (placing a PAD)
static TOOL_ACTION placePad; static TOOL_ACTION placePad;
@ -294,12 +305,11 @@ public:
static TOOL_ACTION moduleEdgeOutlines; static TOOL_ACTION moduleEdgeOutlines;
// Pad tools // Pad tools
static TOOL_ACTION defaultPadProperties;
/// Copy the selected pad's settings to the board design settings /// Copy the selected pad's settings to the board design settings
static TOOL_ACTION copyPadSettings; static TOOL_ACTION copyPadSettings;
/// Copy the pad settings in the board design settings to the selected pad /// Copy the default pad settings to the selected pad
static TOOL_ACTION applyPadSettings; static TOOL_ACTION applyPadSettings;
/// Copy the current pad's settings to other pads in the module or on the board /// Copy the current pad's settings to other pads in the module or on the board
@ -334,7 +344,6 @@ public:
static TOOL_ACTION drillOrigin; static TOOL_ACTION drillOrigin;
static TOOL_ACTION crossProbeSchToPcb; static TOOL_ACTION crossProbeSchToPcb;
static TOOL_ACTION appendBoard; static TOOL_ACTION appendBoard;
static TOOL_ACTION showHelp;
static TOOL_ACTION toBeDone; static TOOL_ACTION toBeDone;
// Ratsnest // Ratsnest
@ -348,8 +357,6 @@ public:
/// Find an item and start moving /// Find an item and start moving
static TOOL_ACTION findMove; static TOOL_ACTION findMove;
static TOOL_ACTION editFootprintInFpEditor;
static TOOL_ACTION autoplaceOffboardComponents; static TOOL_ACTION autoplaceOffboardComponents;
static TOOL_ACTION autoplaceSelectedComponents; static TOOL_ACTION autoplaceSelectedComponents;

View File

@ -31,7 +31,7 @@
#include "pcbnew_picker_tool.h" #include "pcbnew_picker_tool.h"
#include "pcb_editor_control.h" #include "pcb_editor_control.h"
#include "grid_helper.h" #include "grid_helper.h"
#include <kiway.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <class_track.h> #include <class_track.h>
@ -58,6 +58,8 @@
#include <bitmaps.h> #include <bitmaps.h>
#include <functional> #include <functional>
#include <footprint_viewer_frame.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -999,6 +1001,28 @@ int PCBNEW_CONTROL::Show3DViewer( const TOOL_EVENT& aEvent )
} }
int PCBNEW_CONTROL::ShowFootprintBrowser( const TOOL_EVENT& aEvent )
{
auto* viewer = (FOOTPRINT_VIEWER_FRAME*) m_frame->Kiway().Player( FRAME_PCB_MODULE_VIEWER );
viewer->Show( true );
// On Windows, Raise() does not bring the window on screen, when iconized
if( viewer->IsIconized() )
viewer->Iconize( false );
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
return 0;
}
int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent )
{ {
DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) ); DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
@ -1047,64 +1071,65 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
void PCBNEW_CONTROL::setTransitions() void PCBNEW_CONTROL::setTransitions()
{ {
Go( &PCBNEW_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() ); Go( &PCBNEW_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
Go( &PCBNEW_CONTROL::AddLibrary, ACTIONS::addLibrary.MakeEvent() ); Go( &PCBNEW_CONTROL::AddLibrary, ACTIONS::addLibrary.MakeEvent() );
Go( &PCBNEW_CONTROL::Print, ACTIONS::print.MakeEvent() ); Go( &PCBNEW_CONTROL::Print, ACTIONS::print.MakeEvent() );
Go( &PCBNEW_CONTROL::Quit, ACTIONS::quit.MakeEvent() ); Go( &PCBNEW_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
// Display modes // Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() ); Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() ); Go( &PCBNEW_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastInc, ACTIONS::highContrastInc.MakeEvent() ); Go( &PCBNEW_CONTROL::HighContrastInc, ACTIONS::highContrastInc.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastDec, ACTIONS::highContrastDec.MakeEvent() ); Go( &PCBNEW_CONTROL::HighContrastDec, ACTIONS::highContrastDec.MakeEvent() );
// Layer control // Layer control
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
// Grid control // Grid control
Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() ); Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() );
Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() ); Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() );
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() ); Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() ); Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() ); Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() ); Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
// Miscellaneous // Miscellaneous
Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteTool.MakeEvent() ); Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteTool.MakeEvent() );
Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() ); Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() );
Go( &PCBNEW_CONTROL::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() ); Go( &PCBNEW_CONTROL::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() ); Go( &PCBNEW_CONTROL::ShowFootprintBrowser, ACTIONS::showFootprintBrowser.MakeEvent() );
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
// Append control // Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() ); Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
Go( &PCBNEW_CONTROL::Paste, ACTIONS::paste.MakeEvent() ); Go( &PCBNEW_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent ); Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent ); Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::ClearedEvent ); Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::ClearedEvent );
} }

View File

@ -98,6 +98,7 @@ public:
int AppendBoard( PLUGIN& pi, wxString& fileName ); int AppendBoard( PLUGIN& pi, wxString& fileName );
int ShowHelp( const TOOL_EVENT& aEvent ); int ShowHelp( const TOOL_EVENT& aEvent );
int Show3DViewer( const TOOL_EVENT& aEvent ); int Show3DViewer( const TOOL_EVENT& aEvent );
int ShowFootprintBrowser( const TOOL_EVENT& aEvent );
int ToBeDone( const TOOL_EVENT& aEvent ); int ToBeDone( const TOOL_EVENT& aEvent );
int UpdateMessagePanel( const TOOL_EVENT& aEvent ); int UpdateMessagePanel( const TOOL_EVENT& aEvent );