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

#include <panel_setup_constraint_rules.h>

Inheritance diagram for PANEL_SETUP_CONSTRAINT_RULES:

Classes

struct  DEFAULT_FIELD
 One board default, as this page shows it. More...
 

Public Types

enum class  FAMILY {
  CLEARANCE , TRACKS_AND_VIAS , HOLES , SILKSCREEN ,
  SOLDER_MASK , HIGH_SPEED , FOOTPRINT_RULES
}
 

Public Member Functions

 PANEL_SETUP_CONSTRAINT_RULES (wxWindow *aParent, PCB_EDIT_FRAME *aFrame, DRC_RULE_DOCUMENT *aDocument, BOARD_DESIGN_SETTINGS &aSettings, const CONSTRAINT_SECTION &aSection)
 
void ShowRule (DRC_RULE_EDITOR_CONSTRAINT_NAME aType, int aIndex)
 Opens one of this page's rules in its editor, when the page holds that rule type.
 
void RefreshDefaults ()
 Reads the board defaults back into their fields, after something other than this page changed them.
 
wxString ImportGroup () const
 The Import Settings group this page's defaults travel with.
 
void RefreshFromDocument ()
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 Called when the dialog is accepted.
 
bool Validate () override
 The rule form is always on screen, so its fields are empty until a rule is being written.
 

Static Public Member Functions

static std::vector< CONSTRAINT_SECTION > SectionsFor (FAMILY aFamily)
 The sections of one family, in the order they are shown in the tree.
 
static bool RulesCanOverride (const wxString &aSetting, DRC_CONSTRAINT_T *aConstraint)
 Whether rules can set a value other than this board default, and the DRC constraint that does it.
 
static wxString PageTitleFor (DRC_RULE_EDITOR_CONSTRAINT_NAME aType)
 The title of the page that edits rules of this type, or empty when no page does.
 
static std::map< int, std::vector< wxString > > NetclassValuesFor (const wxString &aSetting, const NET_SETTINGS &aNetSettings)
 The net class values set for a constraint, grouped by value so equal classes list together.
 
static wxString PageEditingDefault (const wxString &aSetting)
 The title of the page that edits a board default, or empty where no rule page edits one.
 
static void LinkToPage (wxWindow *aField, const wxString &aPage, int aSlot=1)
 Puts a link to another page holding the same value at the field's right edge.
 
static std::vector< std::pair< wxString, CONSTRAINT_DEFAULT_FIELD > > EditedDefaults ()
 Every board default a rule page edits, each with the group it is imported with.
 

Private Member Functions

void buildSection ()
 
void wrapLabels ()
 
void showPage (const wxString &aTitle)
 
bool applyDefaults ()
 Writes the default fields to the board, or reports the first value out of range.
 
void writeDefaults (BOARD_DESIGN_SETTINGS &aSettings) const
 Copies the defaults this page edits into aSettings.
 
void updateWarnings ()
 Shows a warning icon, with the reason as its tooltip, over each default whose value has an issue.
 
bool confirmPendingRule ()
 Offers what to do with a rule the form holds.
 

Static Private Member Functions

static std::optional< CONSTRAINT_SECTION > sectionForSetting (const wxString &aSetting)
 The section whose board defaults include a setting, where one holds it.
 

Private Attributes

PCB_EDIT_FRAME * m_frame
 
BOARD_DESIGN_SETTINGS * m_settings
 
DRC_RULE_DOCUMENT * m_document
 
wxScrolledWindow * m_scrolled
 
CONSTRAINT_SECTION m_section
 
std::vector< DEFAULT_FIELD > m_defaults
 
wxStaticText * m_note
 
wxString m_noteText
 
wxStaticText * m_defaultsNote
 
wxString m_defaultsNoteText
 
wxTimer m_validationTimer
 
CONSTRAINT_RULES_LIST * m_list
 Null until the section is built, and where a section carries no rules of its own.
 

Detailed Description

Definition at line 103 of file panel_setup_constraint_rules.h.

Member Enumeration Documentation

◆ FAMILY

Enumerator
CLEARANCE 
TRACKS_AND_VIAS 
HOLES 
SILKSCREEN 
SOLDER_MASK 
HIGH_SPEED 
FOOTPRINT_RULES 

Definition at line 106 of file panel_setup_constraint_rules.h.

Constructor & Destructor Documentation

◆ PANEL_SETUP_CONSTRAINT_RULES()

PANEL_SETUP_CONSTRAINT_RULES::PANEL_SETUP_CONSTRAINT_RULES ( wxWindow * aParent,
PCB_EDIT_FRAME * aFrame,
DRC_RULE_DOCUMENT * aDocument,
BOARD_DESIGN_SETTINGS & aSettings,
const CONSTRAINT_SECTION & aSection )
Parameters
aSettingsis where this page reads and writes its defaults. Board Setup passes a copy that reaches the board only when the dialog is accepted.

Definition at line 47 of file panel_setup_constraint_rules.cpp.

References buildSection(), m_defaultsNote, m_document, m_frame, m_list, m_note, m_scrolled, m_section, m_settings, m_validationTimer, updateWarnings(), and wrapLabels().

Member Function Documentation

◆ applyDefaults()

bool PANEL_SETUP_CONSTRAINT_RULES::applyDefaults ( )
private

Writes the default fields to the board, or reports the first value out of range.

Definition at line 285 of file panel_setup_constraint_rules.cpp.

References PAGED_DIALOG::GetDialog(), m_defaults, m_frame, m_settings, BOARD_DESIGN_SETTINGS::ValidateDesignRules(), and writeDefaults().

Referenced by TransferDataFromWindow().

◆ buildSection()

◆ confirmPendingRule()

bool PANEL_SETUP_CONSTRAINT_RULES::confirmPendingRule ( )
private

Offers what to do with a rule the form holds.

False while the offer stands, which is what holds the page until it is answered.

Definition at line 377 of file panel_setup_constraint_rules.cpp.

References m_list.

Referenced by TransferDataFromWindow(), and Validate().

◆ EditedDefaults()

std::vector< std::pair< wxString, CONSTRAINT_DEFAULT_FIELD > > PANEL_SETUP_CONSTRAINT_RULES::EditedDefaults ( )
static

Every board default a rule page edits, each with the group it is imported with.

A default is written by the page that edits it, so an import has to reach the board itself for a page that was never opened.

Definition at line 422 of file panel_setup_constraint_rules.cpp.

References CLEARANCE, FOOTPRINT_RULES, group, HIGH_SPEED, HOLES, importGroup(), SectionsFor(), SILKSCREEN, SOLDER_MASK, and TRACKS_AND_VIAS.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ ImportGroup()

wxString PANEL_SETUP_CONSTRAINT_RULES::ImportGroup ( ) const

The Import Settings group this page's defaults travel with.

Definition at line 409 of file panel_setup_constraint_rules.cpp.

References importGroup(), and m_section.

◆ LinkToPage()

void PANEL_SETUP_CONSTRAINT_RULES::LinkToPage ( wxWindow * aField,
const wxString & aPage,
int aSlot = 1 )
static

Puts a link to another page holding the same value at the field's right edge.

The field stays editable: the value can be set in either place.

Parameters
aSlotis where the link sits among the icons at the field's right edge.

Definition at line 501 of file panel_setup_constraint_rules.cpp.

References _, PAGED_DIALOG::GetDialog(), link, and small_new_window.

Referenced by PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS(), and PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE().

◆ NetclassValuesFor()

std::map< int, std::vector< wxString > > PANEL_SETUP_CONSTRAINT_RULES::NetclassValuesFor ( const wxString & aSetting,
const NET_SETTINGS & aNetSettings )
static

The net class values set for a constraint, grouped by value so equal classes list together.

Definition at line 546 of file panel_setup_constraint_rules.cpp.

References sectionForSetting().

Referenced by PANEL_SETUP_CONSTRAINTS::showOverridingRules().

◆ PageEditingDefault()

wxString PANEL_SETUP_CONSTRAINT_RULES::PageEditingDefault ( const wxString & aSetting)
static

◆ PageTitleFor()

wxString PANEL_SETUP_CONSTRAINT_RULES::PageTitleFor ( DRC_RULE_EDITOR_CONSTRAINT_NAME aType)
static

The title of the page that edits rules of this type, or empty when no page does.

Definition at line 565 of file panel_setup_constraint_rules.cpp.

References CLEARANCE, FOOTPRINT_RULES, HIGH_SPEED, HOLES, SectionsFor(), SILKSCREEN, SOLDER_MASK, and TRACKS_AND_VIAS.

Referenced by BOOST_AUTO_TEST_CASE(), and PANEL_SETUP_CONSTRAINTS::showOverridingRules().

◆ RefreshDefaults()

void PANEL_SETUP_CONSTRAINT_RULES::RefreshDefaults ( )

Reads the board defaults back into their fields, after something other than this page changed them.

Definition at line 273 of file panel_setup_constraint_rules.cpp.

References m_defaults, m_settings, and updateWarnings().

Referenced by TransferDataToWindow().

◆ RefreshFromDocument()

void PANEL_SETUP_CONSTRAINT_RULES::RefreshFromDocument ( )

◆ RulesCanOverride()

◆ sectionForSetting()

std::optional< CONSTRAINT_SECTION > PANEL_SETUP_CONSTRAINT_RULES::sectionForSetting ( const wxString & aSetting)
staticprivate

The section whose board defaults include a setting, where one holds it.

Definition at line 442 of file panel_setup_constraint_rules.cpp.

References CLEARANCE, FOOTPRINT_RULES, HIGH_SPEED, HOLES, SectionsFor(), CONSTRAINT_DEFAULT_FIELD::settingName, SILKSCREEN, SOLDER_MASK, and TRACKS_AND_VIAS.

Referenced by NetclassValuesFor(), and PageEditingDefault().

◆ SectionsFor()

◆ showPage()

void PANEL_SETUP_CONSTRAINT_RULES::showPage ( const wxString & aTitle)
private

Definition at line 244 of file panel_setup_constraint_rules.cpp.

References PAGED_DIALOG::GetDialog().

Referenced by buildSection().

◆ ShowRule()

void PANEL_SETUP_CONSTRAINT_RULES::ShowRule ( DRC_RULE_EDITOR_CONSTRAINT_NAME aType,
int aIndex )

Opens one of this page's rules in its editor, when the page holds that rule type.

Definition at line 558 of file panel_setup_constraint_rules.cpp.

References m_list, and m_section.

◆ TransferDataFromWindow()

bool PANEL_SETUP_CONSTRAINT_RULES::TransferDataFromWindow ( )
override

Called when the dialog is accepted.

A rule left in the form has not reached the document, so this is the last chance to add it.

Definition at line 389 of file panel_setup_constraint_rules.cpp.

References applyDefaults(), and confirmPendingRule().

◆ TransferDataToWindow()

bool PANEL_SETUP_CONSTRAINT_RULES::TransferDataToWindow ( )
override

Definition at line 395 of file panel_setup_constraint_rules.cpp.

References RefreshDefaults(), and RefreshFromDocument().

◆ updateWarnings()

void PANEL_SETUP_CONSTRAINT_RULES::updateWarnings ( )
private

Shows a warning icon, with the reason as its tooltip, over each default whose value has an issue.

Definition at line 334 of file panel_setup_constraint_rules.cpp.

References BOARD_DESIGN_SETTINGS::GetDesignRuleWarnings(), m_defaults, m_frame, m_list, m_settings, m_validationTimer, BOARD_DESIGN_SETTINGS::ValidateDesignRules(), and writeDefaults().

Referenced by PANEL_SETUP_CONSTRAINT_RULES(), and RefreshDefaults().

◆ Validate()

bool PANEL_SETUP_CONSTRAINT_RULES::Validate ( )
override

The rule form is always on screen, so its fields are empty until a rule is being written.

Their validators must not decide whether the page can be left, which is what the base class would use them for. The form reports its own errors when it is applied. What this does check is whether a rule is waiting to be added, since leaving the page would drop it.

Definition at line 383 of file panel_setup_constraint_rules.cpp.

References confirmPendingRule().

◆ wrapLabels()

void PANEL_SETUP_CONSTRAINT_RULES::wrapLabels ( )
private

◆ writeDefaults()

void PANEL_SETUP_CONSTRAINT_RULES::writeDefaults ( BOARD_DESIGN_SETTINGS & aSettings) const
private

Copies the defaults this page edits into aSettings.

Definition at line 327 of file panel_setup_constraint_rules.cpp.

References m_defaults.

Referenced by applyDefaults(), and updateWarnings().

Member Data Documentation

◆ m_defaults

std::vector<DEFAULT_FIELD> PANEL_SETUP_CONSTRAINT_RULES::m_defaults
private

◆ m_defaultsNote

wxStaticText* PANEL_SETUP_CONSTRAINT_RULES::m_defaultsNote
private

◆ m_defaultsNoteText

wxString PANEL_SETUP_CONSTRAINT_RULES::m_defaultsNoteText
private

Definition at line 236 of file panel_setup_constraint_rules.h.

Referenced by buildSection(), and wrapLabels().

◆ m_document

DRC_RULE_DOCUMENT* PANEL_SETUP_CONSTRAINT_RULES::m_document
private

Definition at line 213 of file panel_setup_constraint_rules.h.

Referenced by buildSection(), and PANEL_SETUP_CONSTRAINT_RULES().

◆ m_frame

PCB_EDIT_FRAME* PANEL_SETUP_CONSTRAINT_RULES::m_frame
private

◆ m_list

CONSTRAINT_RULES_LIST* PANEL_SETUP_CONSTRAINT_RULES::m_list
private

Null until the section is built, and where a section carries no rules of its own.

Definition at line 239 of file panel_setup_constraint_rules.h.

Referenced by buildSection(), confirmPendingRule(), PANEL_SETUP_CONSTRAINT_RULES(), RefreshFromDocument(), ShowRule(), and updateWarnings().

◆ m_note

wxStaticText* PANEL_SETUP_CONSTRAINT_RULES::m_note
private

◆ m_noteText

wxString PANEL_SETUP_CONSTRAINT_RULES::m_noteText
private

Definition at line 234 of file panel_setup_constraint_rules.h.

Referenced by buildSection(), and wrapLabels().

◆ m_scrolled

wxScrolledWindow* PANEL_SETUP_CONSTRAINT_RULES::m_scrolled
private

◆ m_section

CONSTRAINT_SECTION PANEL_SETUP_CONSTRAINT_RULES::m_section
private

◆ m_settings

BOARD_DESIGN_SETTINGS* PANEL_SETUP_CONSTRAINT_RULES::m_settings
private

◆ m_validationTimer

wxTimer PANEL_SETUP_CONSTRAINT_RULES::m_validationTimer
private

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