61 auto it = std::find_if( aNodes.begin(), aNodes.end(),
64 return node.m_nodeId == aTargetId;
67 if( it != aNodes.end() )
96 if(
Prj().IsReadOnly() )
98 m_infoBar->ShowMessage(
_(
"Project is missing or read-only. Settings will not be "
109 new wxDataViewCtrl(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES | wxDV_SINGLE );
129 SetMinSize( wxSize( 400, 500 ) );
132 wxLogTrace(
"debug_dlg_size",
"DRC TransferDataToWindow: size=%s minSize=%s",
133 GetSize().IsFullySpecified() ? wxString::Format(
"%dx%d", GetSize().x, GetSize().y )
134 : wxString(
"default" ),
135 GetMinSize().IsFullySpecified()
136 ? wxString::Format(
"%dx%d", GetMinSize().x, GetMinSize().y )
137 : wxString(
"default" ) );
156 std::vector<RULE_TREE_NODE>
result;
159 int electricalItemId;
160 int manufacturabilityItemId;
161 int highSpeedDesignId;
180 result.insert(
result.end(), subItemNodes.begin(), subItemNodes.end() );
183 result.insert(
result.end(), subItemNodes.begin(), subItemNodes.end() );
186 result.insert(
result.end(), subItemNodes.begin(), subItemNodes.end() );
189 result.insert(
result.end(), subItemNodes.begin(), subItemNodes.end() );
202 wxFileName rulesFile(
m_frame->GetDesignRulesPath() );
204 if( !rulesFile.FileExists() )
208 std::vector<DRC_RE_LOADED_PANEL_ENTRY> entries = loader.
LoadFile( rulesFile.GetFullPath() );
210 if( entries.empty() )
213 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
214 wxS(
"[LoadExistingRules] Loaded %zu entries from %s" ),
215 entries.size(), rulesFile.GetFullPath() );
220 std::unordered_map<int, int> constraintTypeToNodeId;
224 if( node.m_nodeType ==
CONSTRAINT && node.m_nodeTypeMap )
226 constraintTypeToNodeId[*node.m_nodeTypeMap] = node.m_nodeId;
228 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
229 wxS(
"[LoadExistingRules] Node '%s': nodeId=%d, m_nodeTypeMap=%d" ),
230 wxString( node.m_nodeName ), node.m_nodeId,
231 static_cast<int>( *node.m_nodeTypeMap ) );
246 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
247 wxS(
"[LoadExistingRules] Processing entry: rule='%s', panelType=%d" ),
248 entry.ruleName,
static_cast<int>( type ) );
250 auto typeIt = constraintTypeToNodeId.find(
static_cast<int>( type ) );
252 if( typeIt == constraintTypeToNodeId.end() )
254 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
255 wxS(
"[LoadExistingRules] No parent found for panelType=%d, skipping" ),
256 static_cast<int>( type ) );
260 int parentId = typeIt->second;
266 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
267 wxS(
"[LoadExistingRules] Tree item not found for parentId=%d, skipping" ),
272 wxTreeItemId parentItem = std::get<2>( histIt->second );
274 if( !parentItem.IsOk() )
276 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
277 wxS(
"[LoadExistingRules] Tree item not valid for parentId=%d, skipping" ),
282 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
283 wxS(
"[LoadExistingRules] Found parent node: parentId=%d" ), parentId );
288 auto ruleData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( entry.constraintData );
293 ruleData->SetParentId( parentId );
294 ruleData->SetOriginalRuleText( entry.originalRuleText );
295 ruleData->SetWasEdited( entry.wasEdited );
296 ruleData->SetLayerSource( entry.layerSource );
298 if( !entry.layerSource.IsEmpty() )
299 ruleData->SetLayers( entry.layerCondition.Seq() );
301 ruleData->SetSeverity( entry.severity );
308 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
309 wxS(
"[LoadExistingRules] Appended rule '%s' to tree under parentId=%d" ),
310 entry.ruleName, parentId );
320 wxTreeItemId treeItemId;
341 auto sourceDataPtr = dynamic_pointer_cast<RULE_EDITOR_DATA_BASE>( sourceTreeNode->
m_nodeData );
347 wxString baseName = sourceDataPtr->GetRuleName();
348 int lastSpace = baseName.Find(
' ',
true );
350 if( lastSpace != wxNOT_FOUND )
352 wxString suffix = baseName.Mid( lastSpace + 1 );
355 if( suffix.ToLong( &num ) )
356 baseName = baseName.Left( lastSpace );
377 std::vector<RULE_TREE_NODE*> ruleNodes;
380 std::vector<DRC_RULE_ROW> rows;
381 rows.reserve( ruleNodes.size() );
386 wxString type = parentNode ? parentNode->
m_nodeName : wxString{};
387 rows.push_back( { type, ruleNode->m_nodeData->GetRuleName(), ruleNode->m_nodeData->GetComment() } );
399 wxString constraintName = paretNodeDetail->
m_nodeName;
404 &constraintName, dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( nodeDetail->
m_nodeData ) );
410 [
this](
int aNodeId )
416 [
this](
int aNodeId )
422 [
this](
int aNodeId )
428 [
this](
int aNodeId, wxString aRuleName )
434 [
this](
int aNodeId ) ->
int
459 bool isNew = data && data->IsNew();
466 std::vector<RULE_TREE_NODE*> modifiedRules;
469 if( modifiedRules.empty() )
481 if(
result == wxID_CANCEL )
487 std::map<wxString, wxString> errors;
494 if( errors.find( node.m_nodeName ) != errors.end() )
498 wxString msg = wxString::Format(
499 _(
"Cannot save due to validation errors in rule '%s':\n\n%s" ),
500 node.m_nodeName, errors[node.m_nodeName] );
515 std::vector<int> newRuleNodeIds;
519 if( node.m_nodeType ==
RULE && node.m_nodeData && node.m_nodeData->IsNew() )
520 newRuleNodeIds.push_back( node.m_nodeId );
523 for(
int nodeId : newRuleNodeIds )
549 auto constraintData =
550 std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( nodeDetail->
m_nodeData );
553 constraintData->SetWasEdited(
true );
575 default:
return true;
588 if(
OKOrCancelDialog(
this,
_(
"Confirmation" ),
"",
_(
"Are you sure you want to delete?" ),
_(
"Delete" ) )
612 std::vector<RULE_TREE_NODE>
result;
642 std::vector<RULE_TREE_NODE>
result;
679 std::vector<RULE_TREE_NODE>
result;
698 std::vector<RULE_TREE_NODE>
result;
743bool nodeExists(
const std::vector<RULE_TREE_NODE>& aRuleTreeNodes,
const wxString& aTargetName )
745 for(
const auto& node : aRuleTreeNodes )
758 const wxString& aBaseName )
761 using ConstraintDataFactory =
765 static const std::unordered_map<DRC_RULE_EDITOR_CONSTRAINT_NAME, ConstraintDataFactory> s_constraintFactories = {
769 return std::make_shared<DRC_RE_VIA_STYLE_CONSTRAINT_DATA>( data );
774 return std::make_shared<DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA>( data );
779 return std::make_shared<DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA>( data );
784 return std::make_shared<DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA>( data );
789 return std::make_shared<DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA>( data );
794 return std::make_shared<DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA>( data );
799 return std::make_shared<DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA>( data );
804 return std::make_shared<DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA>( data );
809 return std::make_shared<DRC_RE_MATCHED_LENGTH_DIFF_PAIR_CONSTRAINT_DATA>( data );
814 return std::make_shared<DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA>( data );
823 treeItemData = aRuleTreeItemData;
834 wxString base = aBaseName.IsEmpty() ? nodeDetail->
m_nodeName : aBaseName;
835 wxString nodeName = base +
" 1";
846 nodeName = base + wxString::Format(
" %d", loop );
860 if( s_constraintFactories.find( nodeType ) != s_constraintFactories.end() )
862 newRuleNode.
m_nodeData = s_constraintFactories.at( nodeType )( clearanceData );
870 newRuleNode.
m_nodeData = std::make_shared<DRC_RE_BOOL_INPUT_CONSTRAINT_DATA>( clearanceData );
874 wxLogWarning(
"No factory found for constraint type: %d", nodeType );
875 newRuleNode.
m_nodeData = std::make_shared<DRC_RE_BASE_CONSTRAINT_DATA>( clearanceData );
878 std::static_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( newRuleNode.
m_nodeData )
893 return node.m_nodeId == aNodeId;
947 std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA> constraintData =
m_ruleEditorPanel->GetConstraintData();
948 std::shared_ptr<DRC_RULE> selectedRule;
950 wxString ruleText = constraintData->GetGeneratedRule();
952 if( ruleText.IsEmpty() )
959 wxString fullText = wxS(
"(version 1)\n" ) + ruleText;
963 std::vector<std::shared_ptr<DRC_RULE>> rules;
965 parser.
Parse( rules,
nullptr );
974 selectedRule = rules[0];
975 condition = selectedRule->m_Condition ? selectedRule->m_Condition->GetExpression() : wxString();
977 if( selectedRule->m_Condition && !selectedRule->m_Condition->GetExpression().IsEmpty()
978 && !selectedRule->m_Condition->Compile(
nullptr ) )
988 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ), wxS(
"[ShowMatches] nodeId=%d, condition='%s'" ), aNodeId,
993 std::vector<BOARD_ITEM*> allMatches;
998 std::vector<BOARD_ITEM*> matches;
1002 switch( item->Type() )
1010 matches.push_back( item );
1015 int matchCount =
static_cast<int>( matches.size() );
1017 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ), wxS(
"[ShowMatches] matched_count=%d (filtered from %zu)" ),
1018 matchCount, allMatches.size() );
1023 if( matches.size() > 0 )
1025 std::vector<EDA_ITEM*> selectItems;
1028 selectItems.push_back( item );
1035 m_frame->FocusOnItems( matches );
1047 return node.m_nodeName == aRuleName && node.m_nodeId != aNodeId
1048 && node.m_nodeType == RULE;
1067 return node.m_nodeId == aNodeId;
1080 std::vector<RULE_TREE_NODE> children;
1083 for(
const auto& child : children )
1088 aResult.push_back( childNode );
1099 if( node.m_nodeType !=
RULE )
1102 if( node.m_nodeData && node.m_nodeData->IsNew() )
1104 aResult.push_back( &node );
1108 auto constraintData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1110 if( constraintData && constraintData->WasEdited() )
1111 aResult.push_back( &node );
1118 bool allValid =
true;
1124 std::map<std::pair<wxString, wxString>, std::set<wxString>> ruleConditions;
1128 if( node.m_nodeType !=
RULE )
1131 if( node.m_nodeData && node.m_nodeData->IsNew() )
1134 auto constraintData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1136 if( constraintData )
1145 for(
const wxString& err :
result.errors )
1147 if( !errorMsg.IsEmpty() )
1148 errorMsg += wxS(
"\n" );
1153 aErrors[node.m_nodeName] = errorMsg;
1157 wxString ruleName = constraintData->GetRuleName();
1158 wxString condition = constraintData->GetRuleCondition();
1159 wxString layerSource = constraintData->GetLayerSource();
1160 ruleConditions[std::make_pair( ruleName, layerSource )].insert( condition );
1165 for(
const auto& [key, conditions] : ruleConditions )
1167 if( conditions.size() > 1 )
1169 wxString errorMsg =
_(
"Multiple rules with the same name have different conditions. "
1170 "Rules with the same name must have identical conditions to be merged." );
1171 aErrors[key.first] = errorMsg;
1182 std::vector<RULE_TREE_NODE*> modifiedRules;
1185 if( modifiedRules.empty() )
1188 wxString message =
_(
"The following rules have unsaved changes:\n\n" );
1191 message += wxString::Format( wxS(
" \u2022 %s\n" ), rule->m_nodeName );
1193 message +=
_(
"\nDo you want to save your changes?" );
1195 int result = wxMessageBox( message,
_(
"Save Changes?" ),
1196 wxYES_NO | wxCANCEL | wxICON_QUESTION,
this );
1200 else if(
result == wxNO )
1210 wxTreeItemIdValue cookie;
1213 std::function<wxTreeItemId( wxTreeItemId )> findItem = [&]( wxTreeItemId parent ) -> wxTreeItemId
1215 wxTreeItemId item =
m_ruleTreeCtrl->GetFirstChild( parent, cookie );
1217 while( item.IsOk() )
1222 if( data && data->
GetNodeId() == aNodeId )
1225 wxTreeItemId found = findItem( item );
1233 return wxTreeItemId();
1236 wxTreeItemId itemId = findItem( root );
1245 const std::optional<DRC_RULE_EDITOR_CONSTRAINT_NAME>& aConstraintType,
1246 const std::vector<RULE_TREE_NODE>& aChildNodes,
const std::optional<int>&
id )
1265 baseData.
SetId( newId );
1273 .m_nodeName = aName,
1274 .m_nodeType = aNodeType,
1276 .m_nodeTypeMap = aConstraintType,
1277 .m_childNodes = aChildNodes,
1278 .m_nodeData = std::make_shared<RULE_EDITOR_DATA_BASE>( baseData ) };
1283 const std::optional<int>& aParentId )
1289 auto baseData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.
m_nodeData );
1316 std::vector<DRC_RE_LOADED_PANEL_ENTRY> entries;
1320 if( node.m_nodeType !=
RULE )
1323 auto data = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1328 if( node.m_nodeData->IsNew() )
1333 if( node.m_nodeTypeMap )
1339 entry.
ruleName = data->GetRuleName();
1340 entry.
condition = data->GetRuleCondition();
1343 entry.
severity = data->GetSeverity();
1347 entries.push_back( entry );
1355 m_frame->GetBoard()->GetDesignSettings().m_DRCEngine->InitEngine(
1356 m_frame->GetDesignRulesPath() );
1360 wxLogError(
_(
"Failed to reload DRC rules: %s" ), pe.
What() );
static TOOL_ACTION zoomFitSelection
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
std::vector< RULE_TREE_NODE > m_ruleTreeNodeDatas
PANEL_DRC_GROUP_HEADER * m_groupHeaderPanel
bool validateAllRules(std::map< wxString, wxString > &aErrors)
Validates all rules and returns any that have validation errors.
~DIALOG_DRC_RULE_EDITOR()
std::vector< RULE_TREE_NODE > buildElectricalRuleTreeNodes(int &aParentId)
std::vector< RULE_TREE_NODE > buildHighspeedDesignRuleTreeNodes(int &aParentId)
void UpdateRuleTypeTreeItemData(RULE_TREE_ITEM_DATA *aCurrentRuleTreeItemData) override
Updates the rule tree item data by transferring data from the rule editor panel and updating the item...
void collectChildRuleNodes(int aParentId, std::vector< RULE_TREE_NODE * > &aResult)
Collects all child rule nodes for a given parent node ID.
int highlightMatchingItems(int aNodeId)
Highlights board items matching the current rule.
RULE_TREE_NODE buildRuleTreeNodeData(const wxString &aName, const DRC_RULE_EDITOR_ITEM_TYPE &aNodeType, const std::optional< int > &aParentId=std::nullopt, const std::optional< DRC_RULE_EDITOR_CONSTRAINT_NAME > &aConstraintType=std::nullopt, const std::vector< RULE_TREE_NODE > &aChildNodes={}, const std::optional< int > &aId=std::nullopt)
Creates a new rule tree node with the specified parameters, generating a new ID if not provided.
RULE_TREE_NODE buildRuleTreeNode(RULE_TREE_ITEM_DATA *aRuleTreeItemData, const wxString &aBaseName=wxEmptyString)
Creates a new rule tree node with a unique name and assigns the appropriate constraint data.
RC_TREE_MODEL * m_markersTreeModel
void saveRule(int aNodeId)
Saves the rule after validating the rule editor panel.
void AddNewRule(RULE_TREE_ITEM_DATA *aRuleTreeItemData) override
Adds a new rule to the rule tree, either as a child or under the parent, based on the node type (CONS...
void RuleTreeItemSelectionChanged(RULE_TREE_ITEM_DATA *aCurrentRuleTreeItemData) override
Handles rule tree item selection changes, updating the content panel with appropriate editor or heade...
int promptUnsavedChanges()
Shows a prompt for unsaved changes when closing with modifications.
RULE_TREE_NODE buildRuleNodeFromKicadDrc(const wxString &aName, const wxString &aCode, const std::optional< int > &aParentId=std::nullopt)
Build a rule tree node from a constraint keyword loaded from a .kicad_drc file.
std::vector< RULE_TREE_NODE > GetDefaultRuleTreeItems() override
Pure virtual method to get the default rule tree items.
bool TransferDataFromWindow() override
std::shared_ptr< RC_ITEMS_PROVIDER > m_markersProvider
std::vector< RULE_TREE_NODE > buildManufacturabilityRuleTreeNodes(int &aParentId)
wxDataViewCtrl * m_markerDataView
void RemoveRule(int aNodeId) override
Removes a rule from the rule tree after confirmation, deleting the item and associated data.
void OnCancel(wxCommandEvent &aEvent) override
bool TransferDataToWindow() override
std::vector< RULE_TREE_NODE > buildFootprintsRuleTreeNodes(int &aParentId)
RULE_TREE_NODE * getRuleTreeNodeInfo(const int &aNodeId)
Retrieves the rule tree node for a given ID.
void selectRuleNode(int aNodeId)
Selects a rule node in the tree by its ID.
bool validateRuleName(int aNodeId, const wxString &aRuleName)
Validates if the rule name is unique for the given node ID.
PANEL_DRC_RULE_EDITOR * m_ruleEditorPanel
void collectModifiedRules(std::vector< RULE_TREE_NODE * > &aResult)
Collects all rule nodes that have unsaved changes (new or edited).
bool deleteTreeNodeData(const int &aNodeId)
Deletes a rule tree node by its ID.
bool isEnabled(RULE_TREE_ITEM_DATA *aRuleTreeItemData, RULE_EDITOR_TREE_CONTEXT_OPT aOption) override
Verifies if a context menu option should be enabled based on the rule tree item type.
void closeRuleEntryView(int aNodeId)
Closes the rule entry view and re-enables controls.
void OnSave(wxCommandEvent &aEvent) override
void DuplicateRule(RULE_TREE_ITEM_DATA *aRuleTreeItemData) override
Duplicates a rule from the source tree node and appends it as a new item under the same parent.
void Parse(std::vector< std::shared_ptr< DRC_RULE > > &aRules, REPORTER *aReporter)
static bool IsNumericInputType(const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType)
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 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 std::shared_ptr< DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA > CreateNumericConstraintData(DRC_RULE_EDITOR_CONSTRAINT_NAME aType)
static bool IsBoolInputType(const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType)
Loads DRC rules from .kicad_dru files and converts them to panel entries.
std::vector< DRC_RE_LOADED_PANEL_ENTRY > LoadFile(const wxString &aPath)
Load all rules from a .kicad_dru file.
Saves DRC panel entries back to .kicad_dru files.
bool SaveFile(const wxString &aPath, const std::vector< DRC_RE_LOADED_PANEL_ENTRY > &aEntries, const BOARD *aBoard=nullptr)
Save all panel entries to a file.
virtual const wxString What() const
A composite of Problem() and Where()
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
LSET is a set of PCB_LAYER_IDs.
The main frame for Pcbnew.
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
PROGRESS_REPORTER_BASE(int aNumPhases)
virtual void SetCurrentProgress(double aProgress) override
Set the progress value to aProgress (0..1).
std::atomic_bool m_cancelled
virtual void AdvancePhase()=0
Use the next available virtual zone of the dialog progress bar.
Concrete class representing the base data structure for a rule editor.
bool IsNew()
Check if the rule is marked as new.
int GetId()
Get the unique ID of the rule.
void SetIsNew(bool aIsNew)
Mark the rule as new or not.
void SetId(int aId)
Set the unique ID of the rule.
void SetParentId(int aParentId)
Set the parent ID of the rule.
void CopyFrom(const ICopyable &aSource) override
Implementation of the polymorphic CopyFrom method.
wxString GetRuleName()
Get the name of the rule.
void DeleteRuleTreeItem(wxTreeItemId aItemId, const int &aNodeId)
Deletes a tree item and removes its corresponding node from history.
void UpdateRuleTreeItemText(wxTreeItemId aItemId, wxString aItemText)
Updates the text of a specified rule tree item.
void SetModified()
Marks the dialog as modified, indicating unsaved changes.
void AppendNewRuleTreeItem(const RULE_TREE_NODE &aRuleTreeNode, wxTreeItemId aParentTreeItemId)
Adds a new rule tree item under the specified parent and updates the tree history.
void InitRuleTreeItems(const std::vector< RULE_TREE_NODE > &aRuleTreeNodes)
Initializes the rule tree by adding nodes, setting up the structure, and saving its state.
void SetContentPanel(wxPanel *aContentPanel)
Replaces the current content panel with a new one based on the selected constraint type.
wxTreeCtrl * m_ruleTreeCtrl
wxScrolledWindow * m_scrolledContentWin
void ClearModified()
Clears the modified flag, typically after saving.
bool TransferDataToWindow() override
RULE_EDITOR_DIALOG_BASE(wxWindow *aParent, const wxString &aTitle, const wxSize &aInitialSize=wxDefaultSize)
friend class DIALOG_DRC_RULE_EDITOR
bool m_suppressSelectionEvents
std::unordered_map< int, std::tuple< wxString, std::vector< int >, wxTreeItemId > > m_treeHistoryData
bool IsModified() const
Returns whether the dialog has unsaved changes.
bool TransferDataFromWindow() override
void getRuleTreeChildNodes(const std::vector< RULE_TREE_NODE > &aNodes, int aParentId, std::vector< RULE_TREE_NODE > &aResult)
Retrieves child nodes of a given parent node.
RULE_TREE_ITEM_DATA * GetCurrentlySelectedRuleTreeItemData()
Retrieves the currently selected rule tree item data.
void SetControlsEnabled(bool aEnable)
Enables or disables controls within the rule editor dialog.
A class representing additional data associated with a wxTree item.
wxTreeItemId GetTreeItemId() const
wxTreeItemId GetParentTreeItemId() const
int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aDetailedMessage, const wxString &aOKLabel, const wxString &aCancelLabel, bool *aApplyToAll)
Display a warning dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
bool nodeExists(const RULE_TREE_NODE &aRuleTreeNode, const wxString &aTargetName)
Checks if a node with the given name exists in the rule tree or its child nodes.
const RULE_TREE_NODE * FindNodeById(const std::vector< RULE_TREE_NODE > &aNodes, int aTargetId)
#define DIALOG_DRC_RULE_EDITOR_WINDOW_NAME
SIM_MODEL::PARAM::CATEGORY CATEGORY
DRC_RULE_EDITOR_CONSTRAINT_NAME
@ SILK_TO_SOLDERMASK_CLEARANCE
@ MINIMUM_CONNECTION_WIDTH
@ MINIMUM_THERMAL_RELIEF_SPOKE_COUNT
@ MINIMUM_TEXT_HEIGHT_AND_THICKNESS
@ COPPER_TO_HOLE_CLEARANCE
@ MATCHED_LENGTH_DIFF_PAIR
@ COPPER_TO_EDGE_CLEARANCE
@ MINIMUM_SOLDERMASK_SLIVER
DRC_RULE_EDITOR_ITEM_TYPE
RULE_EDITOR_TREE_CONTEXT_OPT
Enumeration representing the available context menu options for the rule editor tree.
Represents a rule loaded from a .kicad_dru file and mapped to a panel.
wxString originalRuleText
wxString layerSource
Original layer text: "inner", "outer", or layer name.
std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > constraintData
DRC_RULE_EDITOR_CONSTRAINT_NAME panelType
A filename or source description, a problem input line, a line number, a byte offset,...
Structure representing a node in a rule tree, collection of this used for building the rule tree.
std::shared_ptr< RULE_EDITOR_DATA_BASE > m_nodeData
std::optional< int > m_nodeTypeMap
std::vector< RULE_TREE_NODE > m_childNodes
Result of a validation operation.
wxString result
Test unit parsing edge cases and error handling.
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net