41#define GRID_CELL_MARGIN 4
56 void showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
override;
65 wxString
id =
m_grid->GetCellValue(
m_grid->GetGridCursorRow(),
68 if( std::optional<const PLUGIN_ACTION*> action = mgr.
GetAction(
id ) )
70 menu.Append(
MYID_RECREATE_ENV,
_(
"Recreate Plugin Environment" ),
_(
"Recreate Plugin Environment" ) );
71 menu.AppendSeparator();
85 wxString
id =
m_grid->GetCellValue(
m_grid->GetGridCursorRow(),
88 if( std::optional<const PLUGIN_ACTION*> action = mgr.
GetAction(
id ) )
104 m_grid->SetUseNativeColLabels();
116 m_grid->PopEventHandler(
true );
129 m_grid->SelectRow( aRow );
178 wxASSERT( settings );
188 for(
int ii = 0; ii <
m_grid->GetNumberRows(); ii++ )
192 if( mgr.
GetAction(
id ) != std::nullopt )
209 for(
int ii = 0; ii <
m_grid->GetNumberRows(); ii++ )
230 m_grid->AppendRows( orderedPlugins.size() );
233 wxSize iconSize( size, size );
235 for(
size_t row = 0; row < orderedPlugins.size(); row++ )
237 if( std::holds_alternative<ACTION_PLUGIN*>( orderedPlugins[row] ) )
239 auto ap = std::get<ACTION_PLUGIN*>( orderedPlugins[row] );
254 ap->GetShowToolbarButton() );
264 auto action = std::get<const PLUGIN_ACTION*>( orderedPlugins[row] );
267 : action->icon_light;
289 for(
int col = 0; col <
m_grid->GetNumberCols(); col++ )
291 const wxString& heading =
m_grid->GetColLabelValue( col );
295 m_grid->SetColMinimalWidth( col, headingWidth );
301 m_grid->AutoSizeColumns();
Class PCBNEW_ACTION_PLUGINS.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
static int GetActionsCount()
Responsible for loading plugin definitions for API-based plugins (ones that do not run inside KiCad i...
void RecreatePluginEnvironment(const wxString &aIdentifier)
std::optional< const PLUGIN_ACTION * > GetAction(const wxString &aIdentifier)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
virtual void doPopupSelection(wxCommandEvent &event)
virtual void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent)
WX_GRID * m_grid
I don't own the grid, but he owns me.
APP_SETTINGS_BASE * KifaceSettings() const
Class PANEL_PCBNEW_ACTION_PLUGINS_BASE.
STD_BITMAP_BUTTON * m_openDirectoryButton
STD_BITMAP_BUTTON * m_moveUpButton
STD_BITMAP_BUTTON * m_moveDownButton
STD_BITMAP_BUTTON * m_showErrorsButton
STD_BITMAP_BUTTON * m_reloadButton
bool TransferDataToWindow() override
void OnShowErrorsButtonClick(wxCommandEvent &event) override
Shows plugin import errors.
friend class PLUGINS_GRID_TRICKS
void OnMoveUpButtonClick(wxCommandEvent &event) override
Moves plugin up in the grid.
void OnGridCellClick(wxGridEvent &event) override
Selects a whole row.
wxBitmapBundle m_genericIcon
bool TransferDataFromWindow() override
void OnMoveDownButtonClick(wxCommandEvent &event) override
Moves plugin down in the grid.
PANEL_PCBNEW_ACTION_PLUGINS(wxWindow *aParent)
@ COLUMN_SETTINGS_IDENTIFIER
void OnOpenDirectoryButtonClick(wxCommandEvent &event) override
Opens user's action plugin directory.
void SwapRows(int aRowA, int aRowB)
~PANEL_PCBNEW_ACTION_PLUGINS() override
void OnReloadButtonClick(wxCommandEvent &event) override
Reloads plugins and updates grid.
ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins
static std::vector< std::variant< ACTION_PLUGIN *, const PLUGIN_ACTION * > > GetOrderedActionPlugins()
Return ordered list of plugins in sequence in which they should appear on toolbar or in settings.
static bool GetActionPluginButtonVisible(const wxString &aPluginPath, bool aPluginDefault)
Return true if button visibility action plugin setting was set to true or it is unset and plugin defa...
virtual COMMON_SETTINGS * GetCommonSettings() const
PLUGINS_GRID_TRICKS(WX_GRID *aGrid)
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
void doPopupSelection(wxCommandEvent &event) override
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculate the specified column based on the actual size of the text on screen.
void OnMoveRowUp(const std::function< void(int row)> &aMover)
void SwapRows(int aRowA, int aRowB)
These aren't that tricky, but might as well share code.
void OnMoveRowDown(const std::function< void(int row)> &aMover)
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
@ GRIDTRICKS_FIRST_CLIENT_ID
void pcbnewGetWizardsBackTrace(wxString &aTrace)
Return the backtrace of errors (if any) when wizard python scripts are loaded.
PGM_BASE & Pgm()
The global program "get" accessor.
std::vector< std::pair< wxString, bool > > actions
Ordered list of plugin actions mapped to whether or not they are shown in the toolbar.