|
KiCad PCB EDA Suite
|
#include <drc_rule_editor_utils.h>
Public Types | |
| using | RuleConverter = std::function<std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>( const std::shared_ptr<DRC_RULE>& )> |
Static Public Member Functions | |
| static void | RegisterRuleConverter (RuleConverter aConverter) |
| static bool | IsBoolInputType (const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType) |
| static bool | IsNumericInputType (const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType) |
| static std::shared_ptr< DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA > | CreateNumericConstraintData (DRC_RULE_EDITOR_CONSTRAINT_NAME aType) |
| static std::shared_ptr< DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA > | CreateNumericConstraintData (DRC_RULE_EDITOR_CONSTRAINT_NAME aType, const DRC_RE_BASE_CONSTRAINT_DATA &aBase) |
| static wxString | FormatErrorMessage (int aErrorCount, const wxString &aErrorMessage) |
| static std::vector< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > > | ParseRules (const wxString &aRules) |
| static bool | SaveRules (const wxString &aFilename, const std::vector< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > > &aRules, const BOARD *aBoard) |
| static wxString | GetConstraintCode (DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType) |
| Translate a rule tree node type into the keyword used by the rules file for that constraint. | |
| static std::optional< DRC_RULE_EDITOR_CONSTRAINT_NAME > | GetConstraintTypeFromCode (const wxString &aCode) |
| Resolve a constraint keyword from a rules file into the corresponding rule tree enumeration value. | |
| static wxString | ConstraintToKicadDrc (DRC_RULE_EDITOR_CONSTRAINT_NAME aType) |
| Convert a constraint type into the keyword used in a .kicad_drc file. | |
| static bool | ConstraintFromKicadDrc (const wxString &aCode, DRC_RE_BASE_CONSTRAINT_DATA *aData) |
| Populate a constraint data object using a keyword from a .kicad_drc file. | |
| static bool | ValidateNumericCtrl (wxTextCtrl *aTextCtrl, const wxString &aLabel, bool aCanBeZero, int *aErrorCount, wxString *aValidationMessage) |
| Validates a numeric input control, checking if the value is valid, non-empty, and greater than zero. | |
| static bool | ValidateIntegerCtrl (wxTextCtrl *aTextCtrl, const wxString &aLabel, bool aCanBeZero, int *aErrorCount, wxString *aValidationMessage) |
| Validates an integer input control, ensuring the value is a valid integer, non-empty, and greater than zero. | |
| static bool | ValidateComboCtrl (wxComboBox *aComboBox, const wxString &aLabel, int *aErrorCount, wxString *aValidationMessage) |
| Validates a combo box control, ensuring that a selection has been made. | |
| static bool | ValidateMinMaxCtrl (wxTextCtrl *aMinTextCtrl, wxTextCtrl *aMaxTextCtrl, const wxString &aMinLabel, const wxString &aMaxLabel, int *aErrorCount, wxString *aValidationMessage) |
| Validates the minimum and maximum value controls, ensuring that the minimum value is not greater than the maximum value. | |
| static bool | ValidateMinPreferredMaxCtrl (wxTextCtrl *aMinTextCtrl, wxTextCtrl *aPreferredTextCtrl, wxTextCtrl *aMaxTextCtrl, const wxString &aMinLabel, const wxString &aPreferredLabel, const wxString &aMaxLabel, int *aErrorCount, wxString *aValidationMessage) |
| Validates the minimum, preferred, and maximum value controls, ensuring that: | |
| static bool | ValidateCheckBoxCtrls (const std::vector< wxCheckBox * > &aCheckboxes, const wxString &aLabel, int *aErrorCount, wxString *aValidationMessage) |
| Validates a list of checkboxes, ensuring that at least one option is selected. | |
| static bool | ValidateNumericValue (double aValue, bool aCanBeZero, const wxString &aLabel, VALIDATION_RESULT *aResult) |
| Validates a numeric value. | |
| static bool | ValidateNumericString (const wxString &aValueStr, bool aCanBeZero, bool aIntegerOnly, const wxString &aLabel, VALIDATION_RESULT *aResult) |
| Validates that a string represents a valid numeric value. | |
| static bool | ValidateMinMax (double aMin, double aMax, const wxString &aMinLabel, const wxString &aMaxLabel, VALIDATION_RESULT *aResult) |
| Validates that min <= max. | |
| static bool | ValidateMinPreferredMax (double aMin, double aPreferred, double aMax, const wxString &aMinLabel, const wxString &aPrefLabel, const wxString &aMaxLabel, VALIDATION_RESULT *aResult) |
| Validates that min <= preferred <= max. | |
| static bool | ValidateAtLeastOneSelected (const std::vector< bool > &aSelected, const wxString &aLabel, VALIDATION_RESULT *aResult) |
| Validates that at least one option is selected. | |
| static bool | ValidateSelection (int aSelectionIndex, const wxString &aLabel, VALIDATION_RESULT *aResult) |
| Validates that a selection has been made (index >= 0). | |
| static DRC_LAYER_CATEGORY | GetLayerCategoryForConstraint (DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType) |
| Get the layer category for a constraint type. | |
| static wxString | TranslateTopBottomLayer (DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType, bool aIsTop) |
| Translate a top/bottom selection to the appropriate layer clause or condition. | |
Definition at line 42 of file drc_rule_editor_utils.h.
| using DRC_RULE_EDITOR_UTILS::RuleConverter = std::function<std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>( const std::shared_ptr<DRC_RULE>& )> |
Definition at line 45 of file drc_rule_editor_utils.h.
|
static |
Populate a constraint data object using a keyword from a .kicad_drc file.
| aCode | The keyword read from the rules file. |
| aData | The constraint data instance to update. |
Definition at line 248 of file drc_rule_editor_utils.cpp.
References GetConstraintCode(), GetConstraintTypeFromCode(), and DRC_RE_BASE_CONSTRAINT_DATA::SetConstraintCode().
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleNodeFromKicadDrc().
|
static |
Convert a constraint type into the keyword used in a .kicad_drc file.
| aType | The constraint type to convert. |
Definition at line 242 of file drc_rule_editor_utils.cpp.
References GetConstraintCode().
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode().
|
static |
Definition at line 878 of file drc_rule_editor_utils.cpp.
References COPPER_TO_EDGE_CLEARANCE, COPPER_TO_HOLE_CLEARANCE, COURTYARD_CLEARANCE, CREEPAGE_DISTANCE, HOLE_SIZE, HOLE_TO_HOLE_CLEARANCE, HOLE_TO_HOLE_DISTANCE, MAXIMUM_ALLOWED_DEVIATION, MAXIMUM_VIA_COUNT, MINIMUM_ANGULAR_RING, MINIMUM_ANNULAR_WIDTH, MINIMUM_CLEARANCE, MINIMUM_CONNECTION_WIDTH, MINIMUM_SOLDERMASK_SILVER, MINIMUM_THERMAL_RELIEF_SPOKE_COUNT, MINIMUM_THROUGH_HOLE, MINIMUM_UVIA_DIAMETER, MINIMUM_UVIA_HOLE, MINIMUM_VIA_DIAMETER, PHYSICAL_CLEARANCE, SILK_TO_SILK_CLEARANCE, SILK_TO_SOLDERMASK_CLEARANCE, SOLDERMASK_EXPANSION, and SOLDERPASTE_EXPANSION.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), DRC_RULE_LOADER::createConstraintData(), and RegisterDefaultConverters().
|
static |
Definition at line 912 of file drc_rule_editor_utils.cpp.
References COPPER_TO_EDGE_CLEARANCE, COPPER_TO_HOLE_CLEARANCE, COURTYARD_CLEARANCE, CREEPAGE_DISTANCE, HOLE_SIZE, HOLE_TO_HOLE_CLEARANCE, HOLE_TO_HOLE_DISTANCE, MAXIMUM_ALLOWED_DEVIATION, MAXIMUM_VIA_COUNT, MINIMUM_ANGULAR_RING, MINIMUM_ANNULAR_WIDTH, MINIMUM_CLEARANCE, MINIMUM_CONNECTION_WIDTH, MINIMUM_SOLDERMASK_SILVER, MINIMUM_THERMAL_RELIEF_SPOKE_COUNT, MINIMUM_THROUGH_HOLE, MINIMUM_UVIA_DIAMETER, MINIMUM_UVIA_HOLE, MINIMUM_VIA_DIAMETER, PHYSICAL_CLEARANCE, SILK_TO_SILK_CLEARANCE, SILK_TO_SOLDERMASK_CLEARANCE, SOLDERMASK_EXPANSION, and SOLDERPASTE_EXPANSION.
|
static |
Definition at line 538 of file drc_rule_editor_utils.cpp.
Referenced by ValidateCheckBoxCtrls(), ValidateComboCtrl(), DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::ValidateInputs(), DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL::ValidateInputs(), DRC_RE_BOOL_INPUT_OVERLAY_PANEL::ValidateInputs(), DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL::ValidateInputs(), DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::ValidateInputs(), DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL::ValidateInputs(), DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL::ValidateInputs(), DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL::ValidateInputs(), DRC_RE_VIA_STYLE_OVERLAY_PANEL::ValidateInputs(), PANEL_DRC_RULE_EDITOR::ValidateInputs(), ValidateIntegerCtrl(), ValidateMinMaxCtrl(), ValidateMinPreferredMaxCtrl(), and ValidateNumericCtrl().
|
static |
Translate a rule tree node type into the keyword used by the rules file for that constraint.
| aConstraintType | The constraint type selected in the rule tree. |
Definition at line 222 of file drc_rule_editor_utils.cpp.
References sCodeMap.
Referenced by ConstraintFromKicadDrc(), ConstraintToKicadDrc(), and DRC_RULE_LOADER::createConstraintData().
|
static |
Resolve a constraint keyword from a rules file into the corresponding rule tree enumeration value.
| aCode | The textual keyword for the constraint. |
Definition at line 232 of file drc_rule_editor_utils.cpp.
References sCodeReverse.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleNodeFromKicadDrc(), and ConstraintFromKicadDrc().
|
static |
Get the layer category for a constraint type.
Determines which layers should be shown in the layer selector dropdown.
| aConstraintType | The constraint type. |
Definition at line 786 of file drc_rule_editor_utils.cpp.
References ABSOLUTE_LENGTH, ALLOWED_ORIENTATION, COPPER_ONLY, COPPER_TO_EDGE_CLEARANCE, COPPER_TO_HOLE_CLEARANCE, COURTYARD_CLEARANCE, CREEPAGE_DISTANCE, CUSTOM_RULE, GENERAL_ANY_LAYER, HOLE_SIZE, HOLE_TO_HOLE_CLEARANCE, HOLE_TO_HOLE_DISTANCE, MATCHED_LENGTH_DIFF_PAIR, MAXIMUM_ALLOWED_DEVIATION, MAXIMUM_VIA_COUNT, MINIMUM_ANGULAR_RING, MINIMUM_ANNULAR_WIDTH, MINIMUM_CLEARANCE, MINIMUM_CONNECTION_WIDTH, MINIMUM_SOLDERMASK_SILVER, MINIMUM_TEXT_HEIGHT_AND_THICKNESS, MINIMUM_THERMAL_RELIEF_SPOKE_COUNT, MINIMUM_THROUGH_HOLE, MINIMUM_UVIA_DIAMETER, MINIMUM_UVIA_HOLE, MINIMUM_VIA_DIAMETER, NO_LAYER_SELECTOR, PERMITTED_LAYERS, PHYSICAL_CLEARANCE, ROUTING_DIFF_PAIR, ROUTING_WIDTH, SILK_TO_SILK_CLEARANCE, SILK_TO_SOLDERMASK_CLEARANCE, SILKSCREEN_ONLY, SOLDERMASK_EXPANSION, SOLDERMASK_ONLY, SOLDERPASTE_EXPANSION, SOLDERPASTE_ONLY, TOP_BOTTOM_ANY, VIA_STYLE, and VIAS_UNDER_SMD.
Referenced by PANEL_DRC_RULE_EDITOR::PANEL_DRC_RULE_EDITOR().
|
static |
Definition at line 265 of file drc_rule_editor_utils.cpp.
References VIAS_UNDER_SMD.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), PANEL_DRC_RULE_EDITOR::getConstraintPanel(), and RegisterDefaultConverters().
|
static |
Definition at line 275 of file drc_rule_editor_utils.cpp.
References COPPER_TO_EDGE_CLEARANCE, COPPER_TO_HOLE_CLEARANCE, COURTYARD_CLEARANCE, CREEPAGE_DISTANCE, HOLE_SIZE, HOLE_TO_HOLE_CLEARANCE, HOLE_TO_HOLE_DISTANCE, MATCHED_LENGTH_DIFF_PAIR, MAXIMUM_ALLOWED_DEVIATION, MAXIMUM_VIA_COUNT, MINIMUM_ANGULAR_RING, MINIMUM_ANNULAR_WIDTH, MINIMUM_CLEARANCE, MINIMUM_CONNECTION_WIDTH, MINIMUM_SOLDERMASK_SILVER, MINIMUM_THERMAL_RELIEF_SPOKE_COUNT, MINIMUM_THROUGH_HOLE, MINIMUM_UVIA_DIAMETER, MINIMUM_UVIA_HOLE, MINIMUM_VIA_DIAMETER, PHYSICAL_CLEARANCE, SILK_TO_SILK_CLEARANCE, SILK_TO_SOLDERMASK_CLEARANCE, SOLDERMASK_EXPANSION, and SOLDERPASTE_EXPANSION.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), DRC_RULE_LOADER::createConstraintData(), PANEL_DRC_RULE_EDITOR::getConstraintPanel(), and RegisterDefaultConverters().
|
static |
Definition at line 693 of file drc_rule_editor_utils.cpp.
References GetRuleConverters(), DRC_RULES_PARSER::Parse(), and RegisterDefaultConverters().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 97 of file drc_rule_editor_utils.cpp.
References GetRuleConverters().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and RegisterDefaultConverters().
|
static |
Definition at line 740 of file drc_rule_editor_utils.cpp.
References RULE_GENERATION_CONTEXT::comment, RULE_GENERATION_CONTEXT::conditionExpression, RULE_GENERATION_CONTEXT::constraintCode, BOARD::GetLayerName(), RULE_GENERATION_CONTEXT::layerClause, and RULE_GENERATION_CONTEXT::ruleName.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Translate a top/bottom selection to the appropriate layer clause or condition.
Used for TOP_BOTTOM_ANY category constraints where "Top" and "Bottom" have different meanings depending on the constraint type.
| aConstraintType | The constraint type. |
| aIsTop | True for top/front, false for bottom/back. |
Definition at line 852 of file drc_rule_editor_utils.cpp.
References ALLOWED_ORIENTATION, COURTYARD_CLEARANCE, SILK_TO_SOLDERMASK_CLEARANCE, and VIAS_UNDER_SMD.
Referenced by PANEL_DRC_RULE_EDITOR::buildLayerClause().
|
static |
Validates that at least one option is selected.
| aSelected | Vector of boolean values indicating selection state. |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 665 of file drc_rule_editor_utils.cpp.
References _, and VALIDATION_RESULT::AddError().
|
static |
Validates a list of checkboxes, ensuring that at least one option is selected.
| aCheckboxes | A vector of wxCheckBox controls to validate. |
| aLabel | The label for the checkbox list. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 510 of file drc_rule_editor_utils.cpp.
References _, FormatErrorMessage(), VALIDATE_CHECKBOX_LIST::GetValidationState(), and VALIDATE_CHECKBOX_LIST::NotSelected.
|
static |
Validates a combo box control, ensuring that a selection has been made.
| aComboBox | The combo box control to validate. |
| aLabel | The label of the combo box for error messages. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 395 of file drc_rule_editor_utils.cpp.
References _, FormatErrorMessage(), VALIDATOR_COMBO_CTRL::GetValidationState(), and VALIDATOR_COMBO_CTRL::NothingSelected.
|
static |
Validates an integer input control, ensuring the value is a valid integer, non-empty, and greater than zero.
| aTextCtrl | The text control to validate. |
| aLabel | The label of the control for error messages. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 353 of file drc_rule_editor_utils.cpp.
References _, VALIDATOR_NUMERIC_CTRL::Empty, FormatErrorMessage(), VALIDATOR_NUMERIC_CTRL::GetValidationState(), VALIDATOR_NUMERIC_CTRL::NotGreaterThanZero, and VALIDATOR_NUMERIC_CTRL::NotInteger.
|
static |
Validates that min <= max.
| aMin | The minimum value. |
| aMax | The maximum value. |
| aMinLabel | The label for the minimum value. |
| aMaxLabel | The label for the maximum value. |
| aResult | The validation result to update. |
Definition at line 622 of file drc_rule_editor_utils.cpp.
References _, and VALIDATION_RESULT::AddError().
|
static |
Validates the minimum and maximum value controls, ensuring that the minimum value is not greater than the maximum value.
| aMinTextCtrl | The minimum value text control to validate. |
| aMaxTextCtrl | The maximum value text control to validate. |
| aMinLabel | The label for the minimum value text control. |
| aMaxLabel | The label for the maximum value text control. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 422 of file drc_rule_editor_utils.cpp.
References _, FormatErrorMessage(), VALIDATE_MIN_MAX_CTRL::GetValidationState(), and VALIDATE_MIN_MAX_CTRL::MinGreaterThanMax.
|
static |
Validates that min <= preferred <= max.
| aMin | The minimum value. |
| aPreferred | The preferred value. |
| aMax | The maximum value. |
| aMinLabel | The label for the minimum value. |
| aPrefLabel | The label for the preferred value. |
| aMaxLabel | The label for the maximum value. |
| aResult | The validation result to update. |
Definition at line 635 of file drc_rule_editor_utils.cpp.
References _, and VALIDATION_RESULT::AddError().
|
static |
Validates the minimum, preferred, and maximum value controls, ensuring that:
| aMinTextCtrl | The minimum value text control to validate. |
| aPreferredTextCtrl | The preferred value text control to validate. |
| aMaxTextCtrl | The maximum value text control to validate. |
| aMinLabel | The label for the minimum value text control. |
| aPreferredLabel | The label for the preferred value text control. |
| aMaxLabel | The label for the maximum value text control. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 456 of file drc_rule_editor_utils.cpp.
References _, FormatErrorMessage(), VALIDATE_MIN_PREFERRED_MAX_CTRL::GetValidationState(), VALIDATE_MIN_PREFERRED_MAX_CTRL::MinGreaterThanMax, VALIDATE_MIN_PREFERRED_MAX_CTRL::MinGreaterThanPreferred, and VALIDATE_MIN_PREFERRED_MAX_CTRL::PreferredGreaterThanMax.
|
static |
Validates a numeric input control, checking if the value is valid, non-empty, and greater than zero.
| aTextCtrl | The text control to validate. |
| aLabel | The label of the control for error messages. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 311 of file drc_rule_editor_utils.cpp.
References _, VALIDATOR_NUMERIC_CTRL::Empty, FormatErrorMessage(), VALIDATOR_NUMERIC_CTRL::GetValidationState(), VALIDATOR_NUMERIC_CTRL::NotGreaterThanZero, and VALIDATOR_NUMERIC_CTRL::NotNumeric.
|
static |
Validates that a string represents a valid numeric value.
| aValueStr | The string to validate. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aIntegerOnly | If true, only integer values are accepted. |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 559 of file drc_rule_editor_utils.cpp.
References _, and VALIDATION_RESULT::AddError().
|
static |
Validates a numeric value.
| aValue | The value to validate. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 546 of file drc_rule_editor_utils.cpp.
References _, and VALIDATION_RESULT::AddError().
|
static |
Validates that a selection has been made (index >= 0).
| aSelectionIndex | The selection index (-1 for no selection). |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 680 of file drc_rule_editor_utils.cpp.
References _, and VALIDATION_RESULT::AddError().