KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew_action_plugins.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
25#include <pgm_base.h>
27#include <pcbnew_settings.h>
28#include <bitmaps.h>
29#include <board.h>
30#include <board_commit.h>
32#include <footprint.h>
34#include <pcb_track.h>
35#include <zone.h>
36#include <pcbnew_settings.h>
37#include <tool/action_menu.h>
38#include <tool/action_toolbar.h>
39#include <tool/tool_manager.h>
40#include <tools/pcb_actions.h>
42#include <pcb_painter.h>
43#include <wx/msgdlg.h>
44#include <wx/app.h>
45#include <kiplatform/app.h>
46#include "../../scripting/python_scripting.h"
47
49{
50 PyLOCK lock;
51
52 m_PyAction = aAction;
53 Py_XINCREF( aAction );
54}
55
56
58{
59 PyLOCK lock;
60
61 Py_XDECREF( m_PyAction );
62}
63
64
65PyObject* PYTHON_ACTION_PLUGIN::CallMethod( const char* aMethod, PyObject* aArglist )
66{
67 PyLOCK lock;
68
69 PyErr_Clear();
70
71 // pFunc is a new reference to the desired method
72 PyObject* pFunc = PyObject_GetAttrString( m_PyAction, aMethod );
73
74 if( pFunc && PyCallable_Check( pFunc ) )
75 {
76 PyObject* result = PyObject_CallObject( pFunc, aArglist );
77
78 if( !wxTheApp )
80
81 if( PyErr_Occurred() )
82 {
83 wxString message = _HKI( "Exception on python action plugin code" );
84 wxString traceback = PyErrStringWithTraceback();
85
86 std::cerr << message << std::endl << std::endl;
87 std::cerr << traceback << std::endl;
88
89 if( wxTheApp )
90 wxSafeShowMessage( wxGetTranslation( message ), traceback );
91 }
92
93 if( !wxTheApp )
94 {
95 wxArrayString messages;
96 messages.Add( "Fatal error");
97 messages.Add( wxString::Format(
98 "The application handle was destroyed after running Python plugin '%s'.",
99 m_cachedName ) );
100
101 // Poor man's ASCII message box
102 {
103 int maxLen = 0;
104
105 for( const wxString& msg : messages )
106 if( (int)msg.length() > maxLen )
107 maxLen = msg.length();
108
109 wxChar ch = '*';
110 wxString border( ch, 3 );
111
112 std::cerr << wxString( ch, maxLen + 2 + border.length() * 2 ) << std::endl;
113 std::cerr << border << ' ' << wxString( ' ', maxLen ) << ' ' << border << std::endl;
114
115 for( wxString msg : messages )
116 std::cerr << border << ' ' << msg.Pad( maxLen - msg.length() ) << ' ' << border
117 << std::endl;
118
119 std::cerr << border << ' ' << wxString( ' ', maxLen ) << ' ' << border << std::endl;
120 std::cerr << wxString( ch, maxLen + 2 + border.length() * 2 ) << std::endl;
121 }
122
123#ifdef _WIN32
124 std::cerr << std::endl << "Press any key to abort..." << std::endl;
125 (void) std::getchar();
126#endif
127
128 abort();
129 }
130
131 if( result )
132 {
133 Py_XDECREF( pFunc );
134 return result;
135 }
136 }
137 else
138 {
139 wxString msg = wxString::Format( _( "Method '%s' not found, or not callable" ), aMethod );
140 wxMessageBox( msg, _( "Unknown Method" ), wxICON_ERROR | wxOK );
141 }
142
143 if( pFunc )
144 {
145 Py_XDECREF( pFunc );
146 }
147
148 return nullptr;
149}
150
151
152wxString PYTHON_ACTION_PLUGIN::CallRetStrMethod( const char* aMethod, PyObject* aArglist )
153{
154 wxString ret;
155 PyLOCK lock;
156
157 PyObject* result = CallMethod( aMethod, aArglist );
158
159 ret = PyStringToWx( result );
160 Py_XDECREF( result );
161
162 return ret;
163}
164
165
167{
168 PyLOCK lock;
169
170 return CallRetStrMethod( "GetCategoryName" );
171}
172
173
175{
176 PyLOCK lock;
177
178 return CallRetStrMethod( "GetClassName" );
179}
180
181
183{
184 PyLOCK lock;
185
186 wxString name = CallRetStrMethod( "GetName" );
188
189 return name;
190}
191
192
194{
195 PyLOCK lock;
196
197 return CallRetStrMethod( "GetDescription" );
198}
199
200
202{
203 PyLOCK lock;
204
205 PyObject* result = CallMethod( "GetShowToolbarButton");
206
207 return PyObject_IsTrue(result);
208}
209
210
212{
213 PyLOCK lock;
214
215 PyObject* arglist = Py_BuildValue( "(i)", static_cast<int>( aDark ) );
216
217 wxString result = CallRetStrMethod( "GetIconFileName", arglist );
218
219 Py_DECREF( arglist );
220
221 return result;
222}
223
224
226{
227 PyLOCK lock;
228
229 return CallRetStrMethod( "GetPluginPath" );
230}
231
232
234{
235 PyLOCK lock;
236
237 CallMethod( "Run" );
238}
239
240
242{
243 return (void*) m_PyAction;
244}
245
246
247void PYTHON_ACTION_PLUGINS::register_action( PyObject* aPyAction )
248{
249 PYTHON_ACTION_PLUGIN* fw = new PYTHON_ACTION_PLUGIN( aPyAction );
250
251 fw->register_action();
252}
253
254
256{
257 // deregister also destroys the previously created "PYTHON_ACTION_PLUGIN object"
258 ACTION_PLUGINS::deregister_object( (void*) aPyAction );
259}
260
261
262void PCB_EDIT_FRAME::OnActionPluginMenu( wxCommandEvent& aEvent )
263{
264 ACTION_PLUGIN* actionPlugin = ACTION_PLUGINS::GetActionByMenu( aEvent.GetId() );
265
266 if( actionPlugin )
267 RunActionPlugin( actionPlugin );
268}
269
270
271void PCB_EDIT_FRAME::OnActionPluginButton( wxCommandEvent& aEvent )
272{
273 ACTION_PLUGIN* actionPlugin = ACTION_PLUGINS::GetActionByButton( aEvent.GetId() );
274
275 if( actionPlugin )
276 RunActionPlugin( actionPlugin );
277}
278
280{
281
282 PICKED_ITEMS_LIST itemsList;
283 BOARD* currentPcb = GetBoard();
284 bool fromEmpty = false;
285
286 // Append tracks:
287 for( PCB_TRACK* item : currentPcb->Tracks() )
288 {
289 ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
290 itemsList.PushItem( picker );
291 }
292
293 // Append footprints:
294 for( FOOTPRINT* item : currentPcb->Footprints() )
295 {
296 ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
297 itemsList.PushItem( picker );
298 }
299
300 // Append drawings
301 for( BOARD_ITEM* item : currentPcb->Drawings() )
302 {
303 ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
304 itemsList.PushItem( picker );
305 }
306
307 // Append zones outlines
308 for( ZONE* zone : currentPcb->Zones() )
309 {
310 ITEM_PICKER picker( nullptr, zone, UNDO_REDO::CHANGED );
311 itemsList.PushItem( picker );
312 }
313
314 if( itemsList.GetCount() > 0 )
315 SaveCopyInUndoList( itemsList, UNDO_REDO::CHANGED );
316 else
317 fromEmpty = true;
318
319 itemsList.ClearItemsList();
320
321 BOARD_COMMIT commit( this );
322
323 // Execute plugin itself...
325 aActionPlugin->Run();
327
328 // Get back the undo buffer to fix some modifications
329 PICKED_ITEMS_LIST* oldBuffer = nullptr;
330
331 if( fromEmpty )
332 {
333 oldBuffer = new PICKED_ITEMS_LIST();
334 }
335 else
336 {
337 oldBuffer = PopCommandFromUndoList();
338 wxASSERT( oldBuffer );
339 }
340
341 // Try do discover what was modified
342 PICKED_ITEMS_LIST deletedItemsList;
343
344 // The list of existing items after running the action script
345 const auto currItemList = currentPcb->GetItemSet();
346
347 // Found deleted items
348 for( unsigned int i = 0; i < oldBuffer->GetCount(); i++ )
349 {
350 BOARD_ITEM* item = (BOARD_ITEM*) oldBuffer->GetPickedItem( i );
351 ITEM_PICKER picker( nullptr, item, UNDO_REDO::DELETED );
352
353 wxASSERT( item );
354
355 if( currItemList.find( item ) == currItemList.end() )
356 {
357 deletedItemsList.PushItem( picker );
358 commit.Removed( item );
359 }
360 }
361
362 // Mark deleted elements in undolist
363
364 for( unsigned int i = 0; i < deletedItemsList.GetCount(); i++ )
365 {
366 oldBuffer->PushItem( deletedItemsList.GetItemWrapper( i ) );
367 }
368
369 // Find new footprints
370 for( FOOTPRINT* item : currentPcb->Footprints() )
371 {
372 if( !oldBuffer->ContainsItem( item ) )
373 {
374 ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
375 oldBuffer->PushItem( picker );
376 commit.Added( item );
377 }
378 }
379
380 for( PCB_TRACK* item : currentPcb->Tracks() )
381 {
382 if( !oldBuffer->ContainsItem( item ) )
383 {
384 ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
385 oldBuffer->PushItem( picker );
386 commit.Added( item );
387 }
388 }
389
390 for( BOARD_ITEM* item : currentPcb->Drawings() )
391 {
392 if( !oldBuffer->ContainsItem( item ) )
393 {
394 ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
395 oldBuffer->PushItem( picker );
396 commit.Added( item );
397 }
398 }
399
400 for( ZONE* zone : currentPcb->Zones() )
401 {
402 if( !oldBuffer->ContainsItem( zone ) )
403 {
404 ITEM_PICKER picker( nullptr, zone, UNDO_REDO::NEWITEM );
405 oldBuffer->PushItem( picker );
406 commit.Added( zone );
407 }
408 }
409
410 if( oldBuffer->GetCount() )
411 {
412 OnModify();
413 PushCommandToUndoList( oldBuffer );
414 }
415 else
416 {
417 delete oldBuffer;
418 }
419
420 // Apply changes, UndoList already handled
421 commit.Push( _( "Apply Action Script" ), SKIP_UNDO | SKIP_SET_DIRTY );
422
424}
425
426
428{
429 // The list of existing items after running the action script
430 const BOARD_ITEM_SET items = GetBoard()->GetItemSet();
431
432 // Sync selection with items selection state
433 SELECTION& selection = GetCurrentSelection();
435 EDA_ITEMS to_add;
436 EDA_ITEMS to_remove;
437
438 for( BOARD_ITEM* item : items )
439 {
440 if( item->IsSelected() && !selection.Contains( item ) )
441 {
442 item->ClearSelected(); // temporarily
443 to_add.push_back( item );
444 }
445 }
446
447 for( EDA_ITEM* item : selection.GetItems() )
448 {
449 if( !item->IsSelected() )
450 to_remove.push_back( static_cast<BOARD_ITEM*>( item ) );
451 }
452
453 if( !to_add.empty() )
454 selTool->AddItemsToSel( &to_add );
455
456 if( !to_remove.empty() )
457 selTool->RemoveItemsFromSel( &to_remove );
458
460
461 PCB_DRAW_PANEL_GAL* canvas = GetCanvas();
462
463 canvas->GetView()->Clear();
464 canvas->GetView()->InitPreview();
466 canvas->DisplayBoard( m_pcb );
467
468 // allow tools to re-add their view items (selection previews, grids, etc.)
469 if( m_toolManager )
471
472 // reload the drawing-sheet
474
475 canvas->SyncLayersVisibility( m_pcb );
476
477 canvas->Refresh();
478}
479
480
482{
483 if( !actionMenu ) // Should not occur.
484 return;
485
486 for( int ii = 0; ii < ACTION_PLUGINS::GetActionsCount(); ii++ )
487 {
488 wxMenuItem* item;
490 const wxBitmap& bitmap = ap->iconBitmap.IsOk() ? ap->iconBitmap :
491 KiBitmap( BITMAPS::puzzle_piece );
492
493 item = KIUI::AddMenuItem( actionMenu, wxID_ANY, ap->GetName(), ap->GetDescription(),
494 bitmap );
495
496 Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
497 wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginMenu ) );
498
499 ACTION_PLUGINS::SetActionMenu( ii, item->GetId() );
500 }
501}
502
503
505{
506 bool need_separator = true;
507 const std::vector<LEGACY_OR_API_PLUGIN>& orderedPlugins = GetOrderedActionPlugins();
508
509 for( const auto& entry : orderedPlugins )
510 {
511 // API plugins are handled by EDA_BASE_FRAME
512 if( !std::holds_alternative<ACTION_PLUGIN*>( entry ) )
513 continue;
514
515 ACTION_PLUGIN* ap = std::get<ACTION_PLUGIN*>( entry );
516
518 {
519 if( need_separator )
520 {
522 need_separator = false;
523 }
524
525 // Add button
526 wxBitmap bitmap;
527
528 if ( ap->iconBitmap.IsOk() )
529 bitmap = KiScaledBitmap( ap->iconBitmap, this );
530 else
531 bitmap = KiScaledBitmap( BITMAPS::puzzle_piece, this );
532
533 wxAuiToolBarItem* button = m_mainToolBar->AddTool( wxID_ANY, wxEmptyString,
534 bitmap, ap->GetName() );
535
536 Connect( button->GetId(), wxEVT_COMMAND_MENU_SELECTED,
537 wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginButton ) );
538
539 // Link action plugin to button
540 ACTION_PLUGINS::SetActionButton( ap, button->GetId() );
541 }
542 }
543}
544
545
546std::vector<LEGACY_OR_API_PLUGIN> PCB_EDIT_FRAME::GetOrderedActionPlugins()
547{
549 PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
550
551 std::vector<ACTION_PLUGIN*> plugins;
552 std::vector<LEGACY_OR_API_PLUGIN> orderedPlugins;
553
554 for( int i = 0; i < ACTION_PLUGINS::GetActionsCount(); i++ )
555 plugins.push_back( ACTION_PLUGINS::GetAction( i ) );
556
557 // First add plugins that have entries in settings
558 for( const auto& pair : cfg->m_VisibleActionPlugins )
559 {
560 auto loc = std::find_if( plugins.begin(), plugins.end(),
561 [pair] ( ACTION_PLUGIN* plugin )
562 {
563 return plugin->GetPluginPath() == pair.first;
564 } );
565
566 if( loc != plugins.end() )
567 {
568 orderedPlugins.push_back( *loc );
569 plugins.erase( loc );
570 }
571 }
572
573 // Now append new plugins that have not been configured yet
574 for( auto remaining_plugin : plugins )
575 orderedPlugins.push_back( remaining_plugin );
576
577 // Finally append API plugins
578 for( const PLUGIN_ACTION* action : GetOrderedPluginActions( PLUGIN_ACTION_SCOPE::PCB, cfg ) )
579 orderedPlugins.push_back( action );
580
581 return orderedPlugins;
582}
583
584
585bool PCB_EDIT_FRAME::GetActionPluginButtonVisible( const wxString& aPluginPath,
586 bool aPluginDefault )
587{
589 PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
590
591 for( const auto& [path, visible] : cfg->m_VisibleActionPlugins )
592 {
593 if( path == aPluginPath )
594 return visible;
595 }
596
597 for( const auto& [identifier, visible] : cfg->m_Plugins.actions )
598 {
599 if( identifier == aPluginPath )
600 return visible;
601 }
602
603 // Plugin is not in settings, return default.
604 return aPluginDefault;
605}
const char * name
Definition: DXF_plotter.cpp:57
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:147
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition: board.h:274
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
static bool deregister_object(void *aObject)
Deregister an object which builds a action.
static ACTION_PLUGIN * GetActionByMenu(int aMenu)
Find action plugin associated to a menu ID.
static int GetActionsCount()
static ACTION_PLUGIN * GetAction(const wxString &aName)
static void SetActionButton(ACTION_PLUGIN *aAction, int idButton)
Associate a button id to an action plugin.
static void SetActionMenu(int aIndex, int idMenu)
Associate a menu id to an action plugin.
static void SetActionRunning(bool aRunning)
static ACTION_PLUGIN * GetActionByButton(int aButton)
Find action plugin associated to a button ID.
This is the parent class from where any action plugin class must derive.
Definition: action_plugin.h:39
wxBitmap iconBitmap
void register_action()
It's the standard method of a "ACTION_PLUGIN" to register itself into the ACTION_PLUGINS singleton ma...
virtual wxString GetDescription()=0
virtual wxString GetPluginPath()=0
virtual wxString GetName()=0
virtual void Run()=0
This method the the action.
virtual bool GetShowToolbarButton()=0
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
const VECTOR2I & GetGridOrigin()
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
const PAGE_INFO & GetPageSettings() const
Definition: board.h:689
const ZONES & Zones() const
Definition: board.h:335
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition: board.cpp:187
const FOOTPRINTS & Footprints() const
Definition: board.h:331
const BOARD_ITEM_SET GetItemSet()
Definition: board.cpp:3026
const TRACKS & Tracks() const
Definition: board.h:329
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:895
const DRAWINGS & Drawings() const
Definition: board.h:333
COMMIT & Added(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
Definition: commit.h:86
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Modify a given item in the model.
Definition: commit.h:98
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Add a command to undo in the undo list.
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
static std::vector< const PLUGIN_ACTION * > GetOrderedPluginActions(PLUGIN_ACTION_SCOPE aScope, APP_SETTINGS_BASE *aCfg)
Return ordered list of plugin actions for display in the toolbar Must be static at the moment because...
ACTION_TOOLBAR * m_mainToolBar
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
void Clear()
Remove all items from the view.
Definition: view.cpp:1127
void InitPreview()
Definition: view.cpp:1706
ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
Definition: undo_redo.cpp:163
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
BOARD * GetBoard() const
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
void OnModify() override
Must be called after a board change to set the modified flag.
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.
void SetPageSettings(const PAGE_INFO &aPageSettings) override
void OnActionPluginButton(wxCommandEvent &aEvent)
Launched by the button when an action is called.
void RunActionPlugin(ACTION_PLUGIN *aActionPlugin)
Execute action plugin's Run() method and updates undo buffer.
void buildActionPluginMenus(ACTION_MENU *aActionMenu)
Fill action menu with all registered action plugins.
void RebuildAndRefresh()
Rebuilds board connectivity, refreshes canvas.
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...
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void OnActionPluginMenu(wxCommandEvent &aEvent)
Launched by the menu when an action is called.
void AddActionPluginTools()
Append action plugin buttons to main toolbar.
The selection tool: currently supports:
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
ITEM_PICKER GetItemWrapper(unsigned int aIdx) const
bool ContainsItem(const EDA_ITEM *aItem) const
unsigned GetCount() const
void ClearItemsList()
Delete only the list of pickers NOT the picked data itself.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
static void deregister_action(PyObject *aPyAction)
static void register_action(PyObject *aPyAction)
bool GetShowToolbarButton() override
wxString CallRetStrMethod(const char *aMethod, PyObject *aArglist=nullptr)
PyObject * CallMethod(const char *aMethod, PyObject *aArglist=nullptr)
wxString GetCategoryName() override
wxString GetName() override
wxString GetDescription() override
wxString GetPluginPath() override
PYTHON_ACTION_PLUGIN(PyObject *action)
void Run() override
This method the the action.
wxString GetIconFileName(bool aDark) override
wxString GetClassName() override
void * GetObject() override
This method gets the pointer to the object from where this action constructs.
int AddItemsToSel(const TOOL_EVENT &aEvent)
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
const std::deque< EDA_ITEM * > GetItems() const
Definition: selection.h:121
bool Contains(EDA_ITEM *aItem) const
Definition: selection.cpp:84
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
@ REDRAW
Full drawing refresh.
Definition: tool_base.h:83
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
Handle a list of polygons defining a copper zone.
Definition: zone.h:73
#define _HKI(x)
#define _(s)
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:536
bool AttachConsole(bool aTryAlloc)
Tries to attach a console window with stdout, stderr and stdin.
Definition: unix/app.cpp:51
KICOMMON_API wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmapBundle &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
Definition: ui_common.cpp:372
Class PCBNEW_ACTION_PLUGINS.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
#define SKIP_SET_DIRTY
Definition: sch_commit.h:43
#define SKIP_UNDO
Definition: sch_commit.h:41
std::vector< std::pair< wxString, bool > > actions
Ordered list of plugin actions mapped to whether or not they are shown in the toolbar.
Definition: app_settings.h:164
An action performed by a plugin via the IPC API (not to be confused with ACTION_PLUGIN,...
Definition: api_plugin.h:81
VECTOR2< double > VECTOR2D
Definition: vector2d.h:690