KiCad PCB EDA Suite
Loading...
Searching...
No Matches
toolbars_sch_editor.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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 * Copyright (C) 2019 CERN
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#include <advanced_config.h>
25#include <sch_draw_panel.h>
26#include <sch_edit_frame.h>
28#include <kiface_base.h>
29#include <bitmaps.h>
30#include <eeschema_id.h>
31#include <pgm_base.h>
32#include <tool/action_menu.h>
33#include <tool/tool_manager.h>
35#include <tool/action_toolbar.h>
37#include <widgets/wx_infobar.h>
38#include <tools/sch_actions.h>
45#include <toolbars_sch_editor.h>
46#include <wx/choice.h>
47#include <wx/stattext.h>
48
49
51 _( "Current variant" ),
52 _( "Selects the current schematic variant" ),
53 { FRAME_SCH } );
54
55
56std::optional<TOOLBAR_CONFIGURATION> SCH_EDIT_TOOLBAR_SETTINGS::DefaultToolbarConfig( TOOLBAR_LOC aToolbar )
57{
59
60 // clang-format off
61 switch( aToolbar )
62 {
64 return std::nullopt;
65
67 config.AppendAction( ACTIONS::toggleGrid )
68 .WithContextMenu(
69 []( TOOL_MANAGER* aToolMgr )
70 {
71 SCH_SELECTION_TOOL* selTool = aToolMgr->GetTool<SCH_SELECTION_TOOL>();
72 auto menu = std::make_unique<ACTION_MENU>( false, selTool );
73 menu->Add( ACTIONS::gridProperties );
74 return menu;
75 } )
76 .AppendAction( ACTIONS::toggleGridOverrides )
77 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Units" ) )
78 .AddAction( ACTIONS::inchesUnits )
79 .AddAction( ACTIONS::milsUnits )
80 .AddAction( ACTIONS::millimetersUnits ) )
81 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Crosshair modes" ) )
84 .AddAction( ACTIONS::cursor45Crosshairs ) );
85
86 config.AppendSeparator()
87 .AppendAction( SCH_ACTIONS::toggleHiddenPins );
88
89 config.AppendSeparator()
90 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Line modes" ) )
91 .AddAction( SCH_ACTIONS::lineModeFree )
92 .AddAction( SCH_ACTIONS::lineMode90 )
93 .AddAction( SCH_ACTIONS::lineMode45 ) );
94
95 config.AppendSeparator()
96 .AppendAction( SCH_ACTIONS::toggleAnnotateAuto );
97
98 config.AppendSeparator()
99 .AppendAction( SCH_ACTIONS::showHierarchy )
100 .AppendAction( ACTIONS::showProperties );
101
102 if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
103 config.AppendAction( ACTIONS::toggleBoundingBoxes );
104
105 break;
106
108 config.AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Selection modes" ) )
109 .AddAction( ACTIONS::selectSetRect )
110 .AddAction( ACTIONS::selectSetLasso ) )
111 .AppendAction( SCH_ACTIONS::highlightNetTool );
112
113 config.AppendSeparator()
114 .AppendAction( SCH_ACTIONS::placeSymbol )
115 .AppendAction( SCH_ACTIONS::placePower )
116 .AppendAction( SCH_ACTIONS::drawWire )
117 .AppendAction( SCH_ACTIONS::drawBus )
118 .AppendAction( SCH_ACTIONS::placeBusWireEntry )
119 .AppendAction( SCH_ACTIONS::placeNoConnect )
120 .AppendAction( SCH_ACTIONS::placeJunction )
121 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Labels" ) )
122 .AddAction( SCH_ACTIONS::placeLabel )
123 .AddAction( SCH_ACTIONS::placeClassLabel )
125 .AddAction( SCH_ACTIONS::placeHierLabel ) )
126 .AppendAction( SCH_ACTIONS::drawRuleArea )
127 .AppendAction( SCH_ACTIONS::drawSheet )
128 .AppendAction( SCH_ACTIONS::placeSheetPin )
129 .AppendAction( SCH_ACTIONS::syncAllSheetsPins );
130
131 config.AppendSeparator()
132 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Text objects" ) )
134 .AddAction( SCH_ACTIONS::drawTextBox ) )
135 .AppendAction( SCH_ACTIONS::drawTable )
136 .AppendAction( SCH_ACTIONS::drawRectangle )
137 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Circle" ) )
138 .AddAction( SCH_ACTIONS::drawCircle )
139 .AddAction( SCH_ACTIONS::drawEllipse ) )
140 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Arc" ) )
141 .AddAction( SCH_ACTIONS::drawArcCenter )
144 .AddAction( SCH_ACTIONS::drawArcTangent )
146 .AddAction( SCH_ACTIONS::drawEllipseArc ) )
147 .AppendAction( SCH_ACTIONS::drawBezier )
148 .AppendAction( SCH_ACTIONS::drawPolygon )
149 .AppendAction( SCH_ACTIONS::drawLines )
150 .AppendAction( SCH_ACTIONS::placeImage )
151 .AppendAction( ACTIONS::deleteTool );
152
153 break;
154
156 if( Kiface().IsSingle() ) // not when under a project mgr
157 {
158 config.AppendAction( ACTIONS::doNew );
159 config.AppendAction( ACTIONS::open );
160 }
161
162 config.AppendAction( ACTIONS::save );
163
164 config.AppendSeparator()
165 .AppendAction( SCH_ACTIONS::schematicSetup );
166
167 config.AppendSeparator()
168 .AppendAction( ACTIONS::pageSettings )
169 .AppendAction( ACTIONS::print )
170 .AppendAction( ACTIONS::plot );
171
172 config.AppendSeparator()
173 .AppendAction( ACTIONS::paste );
174
175 config.AppendSeparator()
176 .AppendAction( ACTIONS::undo )
177 .AppendAction( ACTIONS::redo );
178
179 config.AppendSeparator()
180 .AppendAction( ACTIONS::find )
181 .AppendAction( ACTIONS::findAndReplace );
182
183 config.AppendSeparator()
184 .AppendAction( ACTIONS::zoomRedraw )
185 .AppendAction( ACTIONS::zoomInCenter )
186 .AppendAction( ACTIONS::zoomOutCenter )
187 .AppendAction( ACTIONS::zoomFitScreen )
188 .AppendAction( ACTIONS::zoomFitObjects )
189 .AppendAction( ACTIONS::zoomTool );
190
191 config.AppendSeparator()
192 .AppendAction( SCH_ACTIONS::navigateBack )
193 .AppendAction( SCH_ACTIONS::navigateUp )
194 .AppendAction( SCH_ACTIONS::navigateForward );
195
196 config.AppendSeparator()
197 .AppendAction( SCH_ACTIONS::rotateCCW )
198 .AppendAction( SCH_ACTIONS::rotateCW )
199 .AppendAction( SCH_ACTIONS::mirrorV )
200 .AppendAction( SCH_ACTIONS::mirrorH )
201 .AppendAction( ACTIONS::group )
202 .AppendAction( ACTIONS::ungroup );
203
204 config.AppendSeparator()
205 .AppendAction( ACTIONS::showSymbolEditor )
206 .AppendAction( ACTIONS::showSymbolBrowser )
207 .AppendAction( ACTIONS::showFootprintEditor );
208
209 config.AppendSeparator()
210 .AppendAction( SCH_ACTIONS::annotate )
211 .AppendAction( SCH_ACTIONS::runERC )
212 .AppendAction( SCH_ACTIONS::showSimulator )
213 .AppendAction( SCH_ACTIONS::assignFootprints )
214 .AppendAction( SCH_ACTIONS::editSymbolFields )
215 .AppendAction( SCH_ACTIONS::generateBOM );
216
217 config.AppendSeparator()
218 .AppendAction( SCH_ACTIONS::showPcbNew );
219
221
222 // Insert all the IPC plugins here on the toolbar
223 // TODO (ISM): Move this to individual actions for each script
225
227
228 break;
229 }
230
231 // clang-format on
232 return config;
233}
234
235
237{
239
240 // Variant selection drop down control on main tool bar.
241 auto variantSelectionCtrlFactory =
242 [this]( ACTION_TOOLBAR* aToolbar )
243 {
244 std::optional<wxString> currentVariantName = Schematic().GetCurrentVariant();
245 wxString tmp = currentVariantName ? *currentVariantName : GetDefaultVariantName();
246
247 m_currentVariantCtrl = new wxChoice( aToolbar, ID_TOOLBAR_SCH_SELECT_VARAIANT, wxDefaultPosition,
248 wxDefaultSize, Schematic().GetVariantNamesForUI(), 0,
249 wxDefaultValidator, tmp );
250
251 m_currentVariantCtrl->SetToolTip( _( "Select the current variant to display and edit." ) );
252 aToolbar->Add( m_currentVariantCtrl );
253 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
254 };
255
257
258 // IPC/Scripting plugin control
259 // TODO (ISM): Clean this up to make IPC actions just normal tool actions to get rid of this entire
260 // control
261 auto pluginControlFactory =
262 [this]( ACTION_TOOLBAR* aToolbar )
263 {
264
265 bool haveApiPlugins = Pgm().GetCommonSettings()->m_Api.enable_server
267
268 if( haveApiPlugins )
269 {
270 aToolbar->AddScaledSeparator( aToolbar->GetParent() );
271 AddApiPluginTools( aToolbar );
272 }
273 };
274
276}
277
278
280{
282
283 switch( aId )
284 {
286 }
287}
288
289
290void SCH_EDIT_FRAME::UpdateVariantSelectionCtrl( const wxArrayString& aVariantNames )
291{
293 return;
294
295 wxString currentSelection = m_currentVariantCtrl->GetStringSelection();
296
297 // Add all variant names, a separator, and "Add New Variant..." at the end
298 wxArrayString contents = aVariantNames;
299 contents.Add( wxS( "---" ) );
300 contents.Add( _( "Add New Design Variant..." ) );
301
302 m_currentVariantCtrl->Set( contents );
303
304 if( !m_currentVariantCtrl->SetStringSelection( currentSelection ) )
305 m_currentVariantCtrl->SetSelection( 0 ); // default variant
306}
307
308
309void SCH_EDIT_FRAME::onVariantSelected( wxCommandEvent& aEvent )
310{
311 if( aEvent.GetId() != ID_TOOLBAR_SCH_SELECT_VARAIANT )
312 return;
313
314 wxCHECK( m_currentVariantCtrl, /* void */ );
315
316 int selection = m_currentVariantCtrl->GetSelection();
317 int count = m_currentVariantCtrl->GetCount();
318
319 if( selection == wxNOT_FOUND || count == 0 )
320 return;
321
322 // "Add New Variant..." is always the last item, separator is second-to-last
323 if( selection == count - 1 )
324 {
325 // Restore previous selection before showing dialog
326 int previousSelection = m_currentVariantCtrl->FindString(
327 Schematic().GetCurrentVariant().IsEmpty() ? GetDefaultVariantName()
328 : Schematic().GetCurrentVariant() );
329
330 if( previousSelection != wxNOT_FOUND )
331 m_currentVariantCtrl->SetSelection( previousSelection );
332
334 return;
335 }
336
337 // Separator line - ignore selection
338 if( selection == count - 2 )
339 {
340 int previousSelection = m_currentVariantCtrl->FindString(
341 Schematic().GetCurrentVariant().IsEmpty() ? GetDefaultVariantName()
342 : Schematic().GetCurrentVariant() );
343
344 if( previousSelection != wxNOT_FOUND )
345 m_currentVariantCtrl->SetSelection( previousSelection );
346
347 return;
348 }
349
350 wxString selectedString = m_currentVariantCtrl->GetString( selection );
351 wxString selectedVariant;
352
353 if( selectedString != GetDefaultVariantName() )
354 selectedVariant = selectedString;
355
356 Schematic().SetCurrentVariant( selectedVariant );
358 HardRedraw();
359
360 // Refresh message panel for current selection
362
363 if( selTool )
364 {
365 SCH_SELECTION& sub_sel = selTool->GetSelection();
366
367 if( sub_sel.GetSize() == 1 )
368 SetMsgPanel( static_cast<EDA_ITEM*>( sub_sel.Front() ) );
369 }
370}
371
372
374{
375 if( !aParent )
376 aParent = this;
377
378 // Create a dialog with both name and description fields
379 wxDialog dlg( aParent, wxID_ANY, _( "New Design Variant" ), wxDefaultPosition, wxDefaultSize,
380 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
381
382 wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
383
384 // Name field
385 wxStaticText* nameLabel = new wxStaticText( &dlg, wxID_ANY, _( "Variant name:" ) );
386 mainSizer->Add( nameLabel, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
387
388 mainSizer->AddSpacer( 3 );
389
390 wxTextCtrl* nameCtrl = new wxTextCtrl( &dlg, wxID_ANY );
391 mainSizer->Add( nameCtrl, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
392
393 // Description field
394 wxStaticText* descLabel = new wxStaticText( &dlg, wxID_ANY, _( "Description (optional):" ) );
395 mainSizer->Add( descLabel, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
396
397 mainSizer->AddSpacer( 3 );
398
399 wxTextCtrl* descCtrl = new wxTextCtrl( &dlg, wxID_ANY, wxEmptyString, wxDefaultPosition,
400 wxSize( 300, 60 ), wxTE_MULTILINE );
401 mainSizer->Add( descCtrl, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
402
403 // Buttons
404 wxStdDialogButtonSizer* btnSizer = new wxStdDialogButtonSizer();
405 btnSizer->AddButton( new wxButton( &dlg, wxID_OK ) );
406 btnSizer->AddButton( new wxButton( &dlg, wxID_CANCEL ) );
407 btnSizer->Realize();
408 mainSizer->Add( btnSizer, 0, wxALL | wxALIGN_RIGHT, 5 );
409
410 dlg.SetSizer( mainSizer );
411 dlg.Fit();
412 dlg.Centre();
413 nameLabel->SetFocus();
414
415 if( dlg.ShowModal() == wxID_CANCEL )
416 return false;
417
418 wxString variantName = nameCtrl->GetValue().Trim().Trim( false );
419 wxString variantDesc = descCtrl->GetValue().Trim().Trim( false );
420
421 if( !ValidateNewVariantName( variantName, wxEmptyString ) )
422 return false;
423
424 // Add variant to the schematic
425
427 PICKED_ITEMS_LIST* undoCmd = new PICKED_ITEMS_LIST();
428
429 Schematic().AddVariant( variantName );
430
431 if( !variantDesc.IsEmpty() )
432 Schematic().SetVariantDescription( variantName, variantDesc );
433
434 undoCmd->PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
435 undoCmd->SetDescription( _( "Add Variant" ) );
436 PushCommandToUndoList( undoCmd );
437
438 // Update the variant selector and select the new variant
439 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
440 SetCurrentVariant( variantName );
441 OnModify();
442 return true;
443}
444
445
446void SCH_EDIT_FRAME::SetCurrentVariant( const wxString& aVariantName )
447{
448 Schematic().SetCurrentVariant( aVariantName );
449
451 {
452 if( !m_currentVariantCtrl->SetStringSelection( aVariantName ) )
453 m_currentVariantCtrl->SetSelection( 0 ); // default variant
454 }
455
457 HardRedraw();
458}
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION gridProperties
Definition actions.h:196
static TOOL_ACTION toggleGrid
Definition actions.h:194
static TOOL_ACTION paste
Definition actions.h:76
static TOOL_ACTION zoomRedraw
Definition actions.h:128
static TOOL_ACTION millimetersUnits
Definition actions.h:202
static TOOL_ACTION cursorSmallCrosshairs
Definition actions.h:148
static TOOL_ACTION zoomOutCenter
Definition actions.h:132
static TOOL_ACTION selectSetLasso
Definition actions.h:217
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:216
static TOOL_ACTION group
Definition actions.h:235
static TOOL_ACTION showSymbolEditor
Definition actions.h:256
static TOOL_ACTION showSymbolBrowser
Definition actions.h:255
static TOOL_ACTION findAndReplace
Definition actions.h:114
static TOOL_ACTION milsUnits
Definition actions.h:201
static TOOL_ACTION ungroup
Definition actions.h:236
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:153
static TOOL_ACTION plot
Definition actions.h:61
static TOOL_ACTION open
Definition actions.h:53
static TOOL_ACTION pageSettings
Definition actions.h:59
static TOOL_ACTION undo
Definition actions.h:71
static TOOL_ACTION inchesUnits
Definition actions.h:200
static TOOL_ACTION save
Definition actions.h:54
static TOOL_ACTION zoomFitScreen
Definition actions.h:138
static TOOL_ACTION redo
Definition actions.h:72
static TOOL_ACTION deleteTool
Definition actions.h:82
static TOOL_ACTION zoomTool
Definition actions.h:142
static TOOL_ACTION cursor45Crosshairs
Definition actions.h:150
static TOOL_ACTION showFootprintEditor
Definition actions.h:258
static TOOL_ACTION print
Definition actions.h:60
static TOOL_ACTION showProperties
Definition actions.h:262
static TOOL_ACTION doNew
Definition actions.h:50
static TOOL_ACTION zoomFitObjects
Definition actions.h:139
static TOOL_ACTION zoomInCenter
Definition actions.h:131
static TOOL_ACTION toggleGridOverrides
Definition actions.h:195
static TOOL_ACTION cursorFullCrosshairs
Definition actions.h:149
static TOOL_ACTION find
Definition actions.h:113
static ACTION_TOOLBAR_CONTROL overrideLocks
static ACTION_TOOLBAR_CONTROL ipcScripting
Class to hold basic information about controls that can be added to the toolbars.
Define the structure of a toolbar with buttons that invoke ACTIONs.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
std::vector< const PLUGIN_ACTION * > GetActionsForScope(PLUGIN_ACTION_SCOPE aScope)
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Add a command to undo in the undo list.
virtual void ClearToolbarControl(int aId)
void RegisterCustomToolbarControlFactory(const ACTION_TOOLBAR_CONTROL &aControlDesc, const ACTION_TOOLBAR_CONTROL_FACTORY &aControlFactory)
Register a creation factory for toolbar controls that are present in this frame.
virtual void configureToolbars()
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void AddApiPluginTools(ACTION_TOOLBAR *aToolbar)
Append actions from API plugins to the given toolbar.
virtual void UpdateProperties()
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:546
virtual API_PLUGIN_MANAGER & GetPluginManager() const
Definition pgm_base.h:139
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
void SetDescription(const wxString &aDescription)
void SetCurrentVariant(const wxString &aVariantName)
void AddVariant(const wxString &aVariantName)
wxString GetCurrentVariant() const
Return the current variant being edited.
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Set the description for a variant.
static TOOL_ACTION showPcbNew
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
Definition sch_actions.h:85
static TOOL_ACTION placeSheetPin
Definition sch_actions.h:91
static TOOL_ACTION drawArcCenter
static TOOL_ACTION drawArcStartEndCenter
static TOOL_ACTION assignFootprints
static TOOL_ACTION mirrorV
static TOOL_ACTION placeGlobalLabel
Definition sch_actions.h:86
static TOOL_ACTION editSymbolFields
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION drawTextBox
Definition sch_actions.h:99
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION syncAllSheetsPins
Definition sch_actions.h:97
static TOOL_ACTION drawSheet
Definition sch_actions.h:88
static TOOL_ACTION navigateBack
static TOOL_ACTION schematicSetup
static TOOL_ACTION highlightNetTool
static TOOL_ACTION drawRectangle
static TOOL_ACTION drawLines
static TOOL_ACTION placeHierLabel
Definition sch_actions.h:87
static TOOL_ACTION drawEllipse
static TOOL_ACTION placeLabel
Definition sch_actions.h:84
static TOOL_ACTION drawCircle
static TOOL_ACTION placeBusWireEntry
Definition sch_actions.h:83
static TOOL_ACTION drawArcTangent
static TOOL_ACTION drawBezier
static TOOL_ACTION drawWire
Definition sch_actions.h:78
static TOOL_ACTION lineMode45
static TOOL_ACTION rotateCW
static TOOL_ACTION generateBOM
static TOOL_ACTION showHierarchy
static TOOL_ACTION placeJunction
Definition sch_actions.h:82
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeSymbol
Definition sch_actions.h:72
static TOOL_ACTION placeImage
static TOOL_ACTION navigateForward
static TOOL_ACTION drawPolygon
static TOOL_ACTION drawArcStartDirEnd
static TOOL_ACTION mirrorH
static TOOL_ACTION showSimulator
static TOOL_ACTION drawBus
Definition sch_actions.h:79
static TOOL_ACTION runERC
Inspection and Editing.
static TOOL_ACTION drawArcStartEndMid
static TOOL_ACTION drawTable
static TOOL_ACTION lineMode90
static TOOL_ACTION placeSchematicText
Definition sch_actions.h:98
static TOOL_ACTION lineModeFree
static TOOL_ACTION annotate
static TOOL_ACTION placeNoConnect
Definition sch_actions.h:81
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION placePower
Definition sch_actions.h:74
static TOOL_ACTION navigateUp
static ACTION_TOOLBAR_CONTROL currentVariant
bool ValidateNewVariantName(const wxString &aName, const wxString &aExcludeName)
Validate a user-entered variant name for the rename/copy dialogs.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxChoice * m_currentVariantCtrl
void SetCurrentVariant(const wxString &aVariantName)
void UpdateVariantSelectionCtrl(const wxArrayString &aVariantNames)
Update the variant name control on the main toolbar.
void configureToolbars() override
void HardRedraw() override
Rebuild the GAL and redraw the screen.
PLUGIN_ACTION_SCOPE PluginActionScope() const override
SCHEMATIC & Schematic() const
bool ShowAddVariantDialog(wxWindow *aParent=nullptr)
Show a dialog to create a new variant with name and description.
void onVariantSelected(wxCommandEvent &aEvent)
void ClearToolbarControl(int aId) override
std::optional< TOOLBAR_CONFIGURATION > DefaultToolbarConfig(TOOLBAR_LOC aToolbar) override
Get the default tools to show on the specified canvas toolbar.
SCH_SELECTION & GetSelection()
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition selection.h:104
EDA_ITEM * Front() const
Definition selection.h:176
TOOL_MANAGER * m_toolManager
Master controller class:
T * GetTool()
Return the tool of given type or nullptr if there is no such tool registered.
#define _(s)
@ ID_TOOLBAR_SCH_SELECT_VARAIANT
@ FRAME_SCH
Definition frame_type.h:30
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
wxString GetDefaultVariantName()
@ RIGHT
Toolbar on the right side of the canvas.
@ LEFT
Toolbar on the left side of the canvas.
@ TOP_AUX
Toolbar on the top of the canvas.
@ TOP_MAIN
Toolbar on the top of the canvas.