50#include <wx/stattext.h>
54 _(
"Current variant" ),
55 _(
"Selects the current schematic variant" ),
75 auto menu = std::make_unique<ACTION_MENU>(
false, selTool );
234 auto variantSelectionCtrlFactory =
241 wxDefaultSize,
Schematic().GetVariantNamesForUI(), 0,
242 wxDefaultValidator, tmp );
254 auto pluginControlFactory =
262 bool haveApiPlugins =
false;
267 aToolbar->AddScaledSeparator( aToolbar->GetParent() );
296 if( selectionIndex != wxNOT_FOUND )
300 wxArrayString contents = aVariantNames;
301 contents.Add( wxS(
"---" ) );
302 contents.Add(
_(
"Add New Design Variant..." ) );
325 if( selection == wxNOT_FOUND || count == 0 )
329 if( selection == count - 1 )
336 if( previousSelection != wxNOT_FOUND )
344 if( selection == count - 2 )
350 if( previousSelection != wxNOT_FOUND )
357 wxString selectedVariant;
360 selectedVariant = selectedString;
382 wxDialog dlg(
this, wxID_ANY,
_(
"New Design Variant" ), wxDefaultPosition, wxDefaultSize,
383 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
385 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
388 wxStaticText* nameLabel =
new wxStaticText( &dlg, wxID_ANY,
_(
"Variant name:" ) );
389 mainSizer->Add( nameLabel, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
391 mainSizer->AddSpacer( 3 );
393 wxTextCtrl* nameCtrl =
new wxTextCtrl( &dlg, wxID_ANY );
394 mainSizer->Add( nameCtrl, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
397 wxStaticText* descLabel =
new wxStaticText( &dlg, wxID_ANY,
_(
"Description (optional):" ) );
398 mainSizer->Add( descLabel, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
400 mainSizer->AddSpacer( 3 );
402 wxTextCtrl* descCtrl =
new wxTextCtrl( &dlg, wxID_ANY, wxEmptyString, wxDefaultPosition,
403 wxSize( 300, 60 ), wxTE_MULTILINE );
404 mainSizer->Add( descCtrl, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
407 wxStdDialogButtonSizer* btnSizer =
new wxStdDialogButtonSizer();
408 btnSizer->AddButton(
new wxButton( &dlg, wxID_OK ) );
409 btnSizer->AddButton(
new wxButton( &dlg, wxID_CANCEL ) );
411 mainSizer->Add( btnSizer, 0, wxALL | wxALIGN_RIGHT, 5 );
413 dlg.SetSizer( mainSizer );
416 nameLabel->SetFocus();
418 if( dlg.ShowModal() == wxID_CANCEL )
421 wxString variantName = nameCtrl->GetValue().Trim().Trim(
false );
422 wxString variantDesc = descCtrl->GetValue().Trim().Trim(
false );
425 if( variantName.IsEmpty() )
436 10000, wxICON_ERROR );
441 for(
const wxString& existingName :
Schematic().GetVariantNames() )
443 if( existingName.CmpNoCase( variantName ) == 0 )
447 10000, wxICON_ERROR );
455 if( !variantDesc.IsEmpty() )
475 if( newSelection == wxNOT_FOUND )
480 wxString selectedString;
482 if( currentSelection != wxNOT_FOUND )
485 if( selectedString !=
name )
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION gridProperties
static TOOL_ACTION toggleGrid
static TOOL_ACTION zoomRedraw
static TOOL_ACTION millimetersUnits
static TOOL_ACTION cursorSmallCrosshairs
static TOOL_ACTION zoomOutCenter
static TOOL_ACTION selectSetLasso
static TOOL_ACTION selectSetRect
Set lasso selection mode.
static TOOL_ACTION showSymbolEditor
static TOOL_ACTION showSymbolBrowser
static TOOL_ACTION findAndReplace
static TOOL_ACTION milsUnits
static TOOL_ACTION ungroup
static TOOL_ACTION toggleBoundingBoxes
static TOOL_ACTION pageSettings
static TOOL_ACTION inchesUnits
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION deleteTool
static TOOL_ACTION zoomTool
static TOOL_ACTION cursor45Crosshairs
static TOOL_ACTION showFootprintEditor
static TOOL_ACTION showProperties
static TOOL_ACTION zoomFitObjects
static TOOL_ACTION zoomInCenter
static TOOL_ACTION toggleGridOverrides
static TOOL_ACTION cursorFullCrosshairs
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
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()
WX_INFOBAR * GetInfoBar()
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.
virtual COMMON_SETTINGS * GetCommonSettings() const
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
static TOOL_ACTION placeSheetPin
static TOOL_ACTION assignFootprints
static TOOL_ACTION mirrorV
static TOOL_ACTION placeGlobalLabel
static TOOL_ACTION editSymbolFields
static TOOL_ACTION drawTextBox
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION syncAllSheetsPins
static TOOL_ACTION drawArc
static TOOL_ACTION drawSheet
static TOOL_ACTION navigateBack
static TOOL_ACTION schematicSetup
static TOOL_ACTION highlightNetTool
static TOOL_ACTION drawRectangle
static TOOL_ACTION drawLines
static TOOL_ACTION placeHierLabel
static TOOL_ACTION placeLabel
static TOOL_ACTION drawCircle
static TOOL_ACTION placeBusWireEntry
static TOOL_ACTION drawBezier
static TOOL_ACTION drawWire
static TOOL_ACTION lineMode45
static TOOL_ACTION rotateCW
static TOOL_ACTION generateBOM
static TOOL_ACTION showHierarchy
static TOOL_ACTION placeJunction
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeSymbol
static TOOL_ACTION placeImage
static TOOL_ACTION navigateForward
static TOOL_ACTION mirrorH
static TOOL_ACTION showSimulator
static TOOL_ACTION drawBus
static TOOL_ACTION runERC
Inspection and Editing.
static TOOL_ACTION drawTable
static TOOL_ACTION lineMode90
static TOOL_ACTION placeSchematicText
static TOOL_ACTION lineModeFree
static TOOL_ACTION annotate
static TOOL_ACTION placeNoConnect
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION placePower
static TOOL_ACTION navigateUp
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
wxChoice * m_currentVariantCtrl
void SetCurrentVariant(const wxString &aVariantName)
void UpdateVariantSelectionCtrl(const wxArrayString &aVariantNames)
Update the variant name control on the main toolbar.
bool ShowAddVariantDialog()
Show a dialog to create a new variant with name and description.
void configureToolbars() override
void HardRedraw() override
Rebuild the GAL and redraw the screen.
PLUGIN_ACTION_SCOPE PluginActionScope() const override
SCHEMATIC & Schematic() const
void onVariantSelected(wxCommandEvent &aEvent)
void ClearToolbarControl(int aId) override
virtual unsigned int GetSize() const override
Return the number of stored items.
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
@ ID_TOOLBAR_SCH_SELECT_VARAIANT
PGM_BASE & Pgm()
The global program "get" accessor.
wxString GetDefaultVariantName()