KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_PROPERTIES_PANEL Class Reference

#include <sch_properties_panel.h>

Inheritance diagram for SCH_PROPERTIES_PANEL:
PROPERTIES_PANEL

Public Member Functions

 SCH_PROPERTIES_PANEL (wxWindow *aParent, SCH_BASE_FRAME *aFrame)
 
virtual ~SCH_PROPERTIES_PANEL ()
 
void UpdateData () override
 
void AfterCommit () override
 
wxPropertyGrid * GetPropertyGrid ()
 
int PropertiesCount () const
 
const std::vector< PROPERTY_BASE * > & Properties () const
 
void RecalculateSplitterPos ()
 
void SetSplitterProportion (float aProportion)
 
float SplitterProportion () const
 

Public Attributes

int m_SuppressGridChangeEvents
 

Protected Member Functions

void rebuildProperties (const SELECTION &aSelection) override
 Generates the property grid for a given selection of items.
 
wxPGProperty * createPGProperty (const PROPERTY_BASE *aProperty) const override
 
bool getItemValue (EDA_ITEM *aItem, PROPERTY_BASE *aProperty, wxVariant &aValue) override
 Utility to fetch a property value and convert to wxVariant Precondition: aItem is known to have property aProperty.
 
PROPERTY_BASEgetPropertyFromEvent (const wxPropertyGridEvent &aEvent) const
 
void valueChanging (wxPropertyGridEvent &aEvent) override
 
void valueChanged (wxPropertyGridEvent &aEvent) override
 
bool isKeyEditable (const wxPGProperty *aPGProp) const override
 
bool isKeyNameInUse (const wxString &aName) const override
 
void onKeyRenamed (const wxString &aOldName, const wxString &aNewName) override
 
bool buildContextMenu (wxMenu &aMenu, wxPGProperty *aPGProp) override
 
void onNewItemLeftBlank (const wxString &aKey) override
 
void addBlankField ()
 
void addBlankCustomProperty ()
 
void removeField (const wxString &aName)
 
void removeCustomProperty (const wxString &aName)
 
void onContextMenu (wxCommandEvent &aEvent)
 
bool handleSheetFilenameChange (SCH_EDIT_FRAME *aFrame, SCH_SHEET *aSheet, SCH_COMMIT &aChanges, const wxString &aNewFilename)
 
void OnLanguageChanged (wxCommandEvent &aEvent) override
 
const SELECTIONgetSelection (SELECTION &aFallbackSelection)
 Get the current selection from the selection tool.
 
EDA_ITEMgetFrontItem ()
 Get the front item of the current selection.
 
void onEditPinMap ()
 Open the symbol properties dialog on its Pin Map page for the single selected symbol (issue #2282).
 
SCH_SYMBOLgetSinglePinMappedSymbol ()
 
void onCharHook (wxKeyEvent &aEvent)
 
void onShow (wxShowEvent &aEvent)
 
virtual void onLabelEditBegin (wxPropertyGridEvent &aEvent)
 
virtual void onLabelEditEnding (wxPropertyGridEvent &aEvent)
 
void onRightClick (wxPropertyGridEvent &aEvent)
 
void beginLabelEdit (const wxString &aKey, bool aStartBlank=false)
 
void settlePendingLabelEdit ()
 Synchronously ends any in-progress label edit; potentially canceling a newly added row.
 
bool extractValueAndWritability (const SELECTION &aSelection, const wxString &aPropName, wxVariant &aValue, bool &aWritable, wxPGChoices &aChoices)
 Processes a selection and determines whether the given property should be available or not and what the common value should be for the items in the selection.
 
void addCategoryButton (const wxString &aGroupKey, const wxString &aTooltip, BITMAPS aBitmap, std::function< void()> aAction, std::function< bool()> aEnableFunc=nullptr, bool aForceCategory=false)
 Registers an overlay button on a category caption row.
 
void updateCategoryButtons ()
 Updates overlay button visibility/positions; called after rebuilds and on scroll.
 
void hideCategoryButtons ()
 Hides all overlay buttons (used when no selection or a rebuild is deferred).
 
void positionCategoryButtons ()
 Find the caption row for the given untranslated group name, if present.
 
wxPGProperty * categoryForGroup (const wxString &aGroupKey) const
 

Protected Attributes

SCH_BASE_FRAMEm_frame
 
PROPERTY_MANAGERm_propMgr
 
PG_UNIT_EDITORm_unitEditorInstance
 
PG_CHECKBOX_EDITORm_checkboxEditorInstance
 
PG_COLOR_EDITORm_colorEditorInstance
 
PG_FPID_EDITORm_fpEditorInstance
 
PG_URL_EDITORm_urlEditorInstance
 
wxPGChoices m_nets
 
wxStaticText * m_caption
 
std::vector< PROPERTY_BASE * > m_displayed
 
wxPropertyGrid * m_grid
 
float m_splitter_key_proportion
 Proportion of the grid column splitter that is used for the key column (0.0 - 1.0)
 
wxString m_editingOriginalLabel
 
wxString m_contextMenuPropertyName
 
std::vector< CATEGORY_BUTTONm_categoryButtons
 
bool m_resolvingPendingKey = false
 True while settling a pending label edit synchronously (see settlePendingLabelEdit).
 
wxString m_pendingNewKey
 Key of a freshly-added blank field/custom property awaiting a name from the user.
 

Static Protected Attributes

static bool m_selContainsJunctions
 
static bool m_selContainsWiresOrBuses
 

Detailed Description

Definition at line 42 of file sch_properties_panel.h.

Constructor & Destructor Documentation

◆ SCH_PROPERTIES_PANEL()

◆ ~SCH_PROPERTIES_PANEL()

SCH_PROPERTIES_PANEL::~SCH_PROPERTIES_PANEL ( )
virtual

Member Function Documentation

◆ addBlankCustomProperty()

◆ addBlankField()

◆ addCategoryButton()

void PROPERTIES_PANEL::addCategoryButton ( const wxString & aGroupKey,
const wxString & aTooltip,
BITMAPS aBitmap,
std::function< void()> aAction,
std::function< bool()> aEnableFunc = nullptr,
bool aForceCategory = false )
protectedinherited

Registers an overlay button on a category caption row.

The button is shown when its category row is on-screen and selection-appropriate (the optional enable predicate is consulted; it is re-evaluated on every rebuild).

TODO it would be nice to remove this hack by getting upstream wxWidgets to support customizing/subclassing the property group widgets

Parameters
aGroupKeyis the untranslated group name (e.g. _HKI( "Fields" )).
aTooltipis the tooltip text (translated by the caller).
aBitmapis the icon shown on the button.
aActionis invoked when the button is clicked.
aEnableFuncoptionally controls visibility (evaluated on each rebuild).
aForceCategoryoptionally forces the category caption row to be emitted during rebuilds (only when aEnableFunc, if set, returns true).

Definition at line 932 of file properties_panel.cpp.

References KiBitmapBundle(), m_categoryButtons, m_grid, and BITMAP_BUTTON::SetBitmap().

Referenced by PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL(), and SCH_PROPERTIES_PANEL::SCH_PROPERTIES_PANEL().

◆ AfterCommit()

void SCH_PROPERTIES_PANEL::AfterCommit ( )
overridevirtual

◆ beginLabelEdit()

void PROPERTIES_PANEL::beginLabelEdit ( const wxString & aKey,
bool aStartBlank = false )
protectedinherited

◆ buildContextMenu()

bool SCH_PROPERTIES_PANEL::buildContextMenu ( wxMenu & aMenu,
wxPGProperty * aPGProp )
overrideprotectedvirtual

◆ categoryForGroup()

wxPGProperty * PROPERTIES_PANEL::categoryForGroup ( const wxString & aGroupKey) const
protectedinherited

Definition at line 962 of file properties_panel.cpp.

References m_grid.

Referenced by positionCategoryButtons().

◆ createPGProperty()

wxPGProperty * SCH_PROPERTIES_PANEL::createPGProperty ( const PROPERTY_BASE * aProperty) const
overrideprotectedvirtual

◆ extractValueAndWritability()

bool PROPERTIES_PANEL::extractValueAndWritability ( const SELECTION & aSelection,
const wxString & aPropName,
wxVariant & aValue,
bool & aWritable,
wxPGChoices & aChoices )
protectedinherited

Processes a selection and determines whether the given property should be available or not and what the common value should be for the items in the selection.

Parameters
aSelectionis a set of EDA_ITEMs to process
aPropertyis the property to look up
aValuewill be filled with the value common to the selection, or null if different
aWritablewill be set to whether or not the property can be written for the selection
Returns
true if the property is available for all the items in the selection

Definition at line 557 of file properties_panel.cpp.

References PROPERTY_BASE::GetChoices(), getItemValue(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_MANAGER::IsAvailableFor(), PROPERTY_MANAGER::IsWriteableFor(), and TYPE_HASH.

Referenced by rebuildProperties().

◆ getFrontItem()

EDA_ITEM * SCH_PROPERTIES_PANEL::getFrontItem ( )
protected

Get the front item of the current selection.

If the selection is empty and we're in the symbol editor, returns the current symbol instead.

Returns
EDA_ITEM* pointer to the front item, or nullptr if no selection

Definition at line 244 of file sch_properties_panel.cpp.

References SELECTION::Empty(), SELECTION::Front(), and getSelection().

Referenced by getPropertyFromEvent(), isKeyEditable(), isKeyNameInUse(), onNewItemLeftBlank(), and valueChanging().

◆ getItemValue()

bool SCH_PROPERTIES_PANEL::getItemValue ( EDA_ITEM * aItem,
PROPERTY_BASE * aProperty,
wxVariant & aValue )
overrideprotectedvirtual

Utility to fetch a property value and convert to wxVariant Precondition: aItem is known to have property aProperty.

Returns
true if conversion succeeded

Reimplemented from PROPERTIES_PANEL.

Definition at line 941 of file sch_properties_panel.cpp.

References SCHEMATIC::CurrentSheet(), FRAME_SCH, SCHEMATIC::GetCurrentVariant(), PROPERTIES_PANEL::getItemValue(), SCH_ITEM::GetParentSymbol(), SCH_FIELD::GetText(), m_frame, PROPERTY_BASE::Name(), SCH_FIELD_T, SCH_ITEM::Schematic(), text, and EDA_ITEM::Type().

◆ getPropertyFromEvent()

PROPERTY_BASE * SCH_PROPERTIES_PANEL::getPropertyFromEvent ( const wxPropertyGridEvent & aEvent) const
protected

◆ GetPropertyGrid()

wxPropertyGrid * PROPERTIES_PANEL::GetPropertyGrid ( )
inlineinherited

Definition at line 59 of file properties_panel.h.

References m_grid.

◆ getSelection()

const SELECTION & SCH_PROPERTIES_PANEL::getSelection ( SELECTION & aFallbackSelection)
protected

Get the current selection from the selection tool.

If the selection is empty and we're in the symbol editor, returns the current symbol instead.

Parameters
aFallbackSelection[out] local SELECTION object for fallback symbol selection
Returns
const SELECTION& reference to the selection (either real selection or fallback)

Definition at line 223 of file sch_properties_panel.cpp.

References SELECTION::Add(), SELECTION::Clear(), FRAME_SCH_SYMBOL_EDITOR, SYMBOL_EDIT_FRAME::GetCurSymbol(), SCH_SELECTION_TOOL::GetSelection(), and m_frame.

Referenced by addBlankCustomProperty(), addBlankField(), AfterCommit(), getFrontItem(), getSinglePinMappedSymbol(), onKeyRenamed(), removeCustomProperty(), removeField(), UpdateData(), and valueChanged().

◆ getSinglePinMappedSymbol()

SCH_SYMBOL * SCH_PROPERTIES_PANEL::getSinglePinMappedSymbol ( )
protected
Returns
the single selected SCH_SYMBOL with an effective associated footprint, else nullptr.

Definition at line 317 of file sch_properties_panel.cpp.

References SELECTION::Front(), getSelection(), SCH_SYMBOL::HasEffectiveAssociatedFootprint(), SCH_SYMBOL_T, SELECTION::Size(), and EDA_ITEM::Type().

Referenced by onEditPinMap(), and SCH_PROPERTIES_PANEL().

◆ handleSheetFilenameChange()

◆ hideCategoryButtons()

void PROPERTIES_PANEL::hideCategoryButtons ( )
protectedinherited

Hides all overlay buttons (used when no selection or a rebuild is deferred).

Definition at line 982 of file properties_panel.cpp.

References m_categoryButtons.

Referenced by rebuildProperties().

◆ isKeyEditable()

bool SCH_PROPERTIES_PANEL::isKeyEditable ( const wxPGProperty * aPGProp) const
overrideprotectedvirtual

◆ isKeyNameInUse()

bool SCH_PROPERTIES_PANEL::isKeyNameInUse ( const wxString & aName) const
overrideprotectedvirtual

Reimplemented from PROPERTIES_PANEL.

Definition at line 603 of file sch_properties_panel.cpp.

References getFrontItem(), m_propMgr, and SCH_PROPERTIES_PANEL().

◆ onCharHook()

void PROPERTIES_PANEL::onCharHook ( wxKeyEvent & aEvent)
protectedinherited

Definition at line 808 of file properties_panel.cpp.

References m_grid.

Referenced by PROPERTIES_PANEL().

◆ onContextMenu()

◆ onEditPinMap()

void SCH_PROPERTIES_PANEL::onEditPinMap ( )
protected

◆ onKeyRenamed()

◆ onLabelEditBegin()

void PROPERTIES_PANEL::onLabelEditBegin ( wxPropertyGridEvent & aEvent)
protectedvirtualinherited

Definition at line 637 of file properties_panel.cpp.

References isKeyEditable(), and m_editingOriginalLabel.

Referenced by PROPERTIES_PANEL().

◆ onLabelEditEnding()

void PROPERTIES_PANEL::onLabelEditEnding ( wxPropertyGridEvent & aEvent)
protectedvirtualinherited

◆ OnLanguageChanged()

void SCH_PROPERTIES_PANEL::OnLanguageChanged ( wxCommandEvent & aEvent)
overrideprotectedvirtual

Reimplemented from PROPERTIES_PANEL.

Definition at line 933 of file sch_properties_panel.cpp.

References PROPERTIES_PANEL::OnLanguageChanged().

◆ onNewItemLeftBlank()

void SCH_PROPERTIES_PANEL::onNewItemLeftBlank ( const wxString & aKey)
overrideprotectedvirtual

◆ onRightClick()

void PROPERTIES_PANEL::onRightClick ( wxPropertyGridEvent & aEvent)
protectedinherited

Definition at line 734 of file properties_panel.cpp.

References buildContextMenu(), and m_contextMenuPropertyName.

Referenced by PROPERTIES_PANEL().

◆ onShow()

void PROPERTIES_PANEL::onShow ( wxShowEvent & aEvent)
protectedinherited

Definition at line 628 of file properties_panel.cpp.

References UpdateData().

Referenced by PROPERTIES_PANEL().

◆ positionCategoryButtons()

void PROPERTIES_PANEL::positionCategoryButtons ( )
protectedinherited

Find the caption row for the given untranslated group name, if present.

Definition at line 989 of file properties_panel.cpp.

References categoryForGroup(), m_categoryButtons, and m_grid.

Referenced by PROPERTIES_PANEL(), and updateCategoryButtons().

◆ Properties()

const std::vector< PROPERTY_BASE * > & PROPERTIES_PANEL::Properties ( ) const
inlineinherited

Definition at line 69 of file properties_panel.h.

References m_displayed.

◆ PropertiesCount()

int PROPERTIES_PANEL::PropertiesCount ( ) const
inlineinherited

Definition at line 64 of file properties_panel.h.

References m_displayed.

◆ rebuildProperties()

void SCH_PROPERTIES_PANEL::rebuildProperties ( const SELECTION & aSelection)
overrideprotectedvirtual

Generates the property grid for a given selection of items.

Parameters
aSelectionis a set of items to show properties for.

Reimplemented from PROPERTIES_PANEL.

Definition at line 272 of file sch_properties_panel.cpp.

References _HKI, m_propMgr, m_selContainsJunctions, m_selContainsWiresOrBuses, PROPERTIES_PANEL::rebuildProperties(), and SCH_JUNCTION_T.

Referenced by AfterCommit(), and UpdateData().

◆ RecalculateSplitterPos()

void PROPERTIES_PANEL::RecalculateSplitterPos ( )
inherited

◆ removeCustomProperty()

void SCH_PROPERTIES_PANEL::removeCustomProperty ( const wxString & aName)
protected

◆ removeField()

◆ SetSplitterProportion()

void PROPERTIES_PANEL::SetSplitterProportion ( float aProportion)
inherited

Definition at line 925 of file properties_panel.cpp.

References m_splitter_key_proportion, and RecalculateSplitterPos().

◆ settlePendingLabelEdit()

void PROPERTIES_PANEL::settlePendingLabelEdit ( )
protectedinherited

◆ SplitterProportion()

float PROPERTIES_PANEL::SplitterProportion ( ) const
inlineinherited

Definition at line 77 of file properties_panel.h.

References m_splitter_key_proportion.

◆ updateCategoryButtons()

void PROPERTIES_PANEL::updateCategoryButtons ( )
protectedinherited

Updates overlay button visibility/positions; called after rebuilds and on scroll.

Definition at line 976 of file properties_panel.cpp.

References positionCategoryButtons().

Referenced by rebuildProperties().

◆ UpdateData()

void SCH_PROPERTIES_PANEL::UpdateData ( )
overridevirtual

Implements PROPERTIES_PANEL.

Definition at line 253 of file sch_properties_panel.cpp.

References getSelection(), and rebuildProperties().

Referenced by valueChanged().

◆ valueChanged()

◆ valueChanging()

void SCH_PROPERTIES_PANEL::valueChanging ( wxPropertyGridEvent & aEvent)
overrideprotectedvirtual

Member Data Documentation

◆ m_caption

wxStaticText* PROPERTIES_PANEL::m_caption
protectedinherited

◆ m_categoryButtons

std::vector<CATEGORY_BUTTON> PROPERTIES_PANEL::m_categoryButtons
protectedinherited

◆ m_checkboxEditorInstance

PG_CHECKBOX_EDITOR* SCH_PROPERTIES_PANEL::m_checkboxEditorInstance
protected

Definition at line 111 of file sch_properties_panel.h.

Referenced by SCH_PROPERTIES_PANEL().

◆ m_colorEditorInstance

PG_COLOR_EDITOR* SCH_PROPERTIES_PANEL::m_colorEditorInstance
protected

Definition at line 112 of file sch_properties_panel.h.

Referenced by SCH_PROPERTIES_PANEL().

◆ m_contextMenuPropertyName

wxString PROPERTIES_PANEL::m_contextMenuPropertyName
protectedinherited

◆ m_displayed

std::vector<PROPERTY_BASE*> PROPERTIES_PANEL::m_displayed
protectedinherited

◆ m_editingOriginalLabel

wxString PROPERTIES_PANEL::m_editingOriginalLabel
protectedinherited

Definition at line 177 of file properties_panel.h.

Referenced by onLabelEditBegin(), and onLabelEditEnding().

◆ m_fpEditorInstance

PG_FPID_EDITOR* SCH_PROPERTIES_PANEL::m_fpEditorInstance
protected

Definition at line 113 of file sch_properties_panel.h.

Referenced by SCH_PROPERTIES_PANEL(), and ~SCH_PROPERTIES_PANEL().

◆ m_frame

◆ m_grid

◆ m_nets

wxPGChoices SCH_PROPERTIES_PANEL::m_nets
protected

Definition at line 119 of file sch_properties_panel.h.

◆ m_pendingNewKey

wxString PROPERTIES_PANEL::m_pendingNewKey
protectedinherited

◆ m_propMgr

PROPERTY_MANAGER& SCH_PROPERTIES_PANEL::m_propMgr
protected

◆ m_resolvingPendingKey

bool PROPERTIES_PANEL::m_resolvingPendingKey = false
protectedinherited

True while settling a pending label edit synchronously (see settlePendingLabelEdit).

Definition at line 196 of file properties_panel.h.

Referenced by onLabelEditEnding(), and settlePendingLabelEdit().

◆ m_selContainsJunctions

bool SCH_PROPERTIES_PANEL::m_selContainsJunctions
staticprotected

Definition at line 116 of file sch_properties_panel.h.

Referenced by rebuildProperties().

◆ m_selContainsWiresOrBuses

bool SCH_PROPERTIES_PANEL::m_selContainsWiresOrBuses
staticprotected

Definition at line 117 of file sch_properties_panel.h.

Referenced by rebuildProperties().

◆ m_splitter_key_proportion

float PROPERTIES_PANEL::m_splitter_key_proportion
protectedinherited

Proportion of the grid column splitter that is used for the key column (0.0 - 1.0)

Definition at line 175 of file properties_panel.h.

Referenced by PROPERTIES_PANEL(), RecalculateSplitterPos(), SetSplitterProportion(), and SplitterProportion().

◆ m_SuppressGridChangeEvents

◆ m_unitEditorInstance

PG_UNIT_EDITOR* SCH_PROPERTIES_PANEL::m_unitEditorInstance
protected

Definition at line 110 of file sch_properties_panel.h.

Referenced by SCH_PROPERTIES_PANEL(), and ~SCH_PROPERTIES_PANEL().

◆ m_urlEditorInstance

PG_URL_EDITOR* SCH_PROPERTIES_PANEL::m_urlEditorInstance
protected

Definition at line 114 of file sch_properties_panel.h.

Referenced by SCH_PROPERTIES_PANEL(), and ~SCH_PROPERTIES_PANEL().


The documentation for this class was generated from the following files: