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() );
205 wxFileName rulesFile(
m_frame->GetBoard()->GetDesignRulesPath() );
207 if( !rulesFile.FileExists() )
211 std::vector<DRC_RE_LOADED_PANEL_ENTRY> entries = loader.
LoadFile( rulesFile.GetFullPath() );
213 if( entries.empty() )
216 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
217 wxS(
"[LoadExistingRules] Loaded %zu entries from %s" ),
218 entries.size(), rulesFile.GetFullPath() );
223 std::unordered_map<int, int> constraintTypeToNodeId;
227 if( node.m_nodeType ==
CONSTRAINT && node.m_nodeTypeMap )
229 constraintTypeToNodeId[*node.m_nodeTypeMap] = node.m_nodeId;
231 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
232 wxS(
"[LoadExistingRules] Node '%s': nodeId=%d, m_nodeTypeMap=%d" ),
233 wxString( node.m_nodeName ), node.m_nodeId,
234 static_cast<int>( *node.m_nodeTypeMap ) );
249 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
250 wxS(
"[LoadExistingRules] Processing entry: rule='%s', panelType=%d" ),
251 entry.ruleName,
static_cast<int>( type ) );
253 auto typeIt = constraintTypeToNodeId.find(
static_cast<int>( type ) );
255 if( typeIt == constraintTypeToNodeId.end() )
257 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
258 wxS(
"[LoadExistingRules] No parent found for panelType=%d, skipping" ),
259 static_cast<int>( type ) );
263 int parentId = typeIt->second;
269 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
270 wxS(
"[LoadExistingRules] Tree item not found for parentId=%d, skipping" ),
275 wxTreeItemId parentItem = std::get<2>( histIt->second );
277 if( !parentItem.IsOk() )
279 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
280 wxS(
"[LoadExistingRules] Tree item not valid for parentId=%d, skipping" ),
285 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
286 wxS(
"[LoadExistingRules] Found parent node: parentId=%d" ), parentId );
291 auto ruleData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( entry.constraintData );
296 ruleData->SetParentId( parentId );
297 ruleData->SetOriginalRuleText( entry.originalRuleText );
298 ruleData->SetWasEdited( entry.wasEdited );
299 ruleData->SetLayerSource( entry.layerSource );
301 if( !entry.layerSource.IsEmpty() )
302 ruleData->SetLayers( entry.layerCondition.Seq() );
304 ruleData->SetSeverity( entry.severity );
311 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
312 wxS(
"[LoadExistingRules] Appended rule '%s' to tree under parentId=%d" ),
313 entry.ruleName, parentId );
323 wxTreeItemId treeItemId;
344 auto sourceDataPtr = dynamic_pointer_cast<RULE_EDITOR_DATA_BASE>( sourceTreeNode->
m_nodeData );
350 wxString baseName = sourceDataPtr->GetRuleName();
351 int lastSpace = baseName.Find(
' ',
true );
353 if( lastSpace != wxNOT_FOUND )
355 wxString suffix = baseName.Mid( lastSpace + 1 );
358 if( suffix.ToLong( &num ) )
359 baseName = baseName.Left( lastSpace );
380 std::vector<RULE_TREE_NODE*> ruleNodes;
383 std::vector<DRC_RULE_ROW> rows;
384 rows.reserve( ruleNodes.size() );
389 wxString type = parentNode ? parentNode->
m_nodeName : wxString{};
390 rows.push_back( { type, ruleNode->m_nodeData->GetRuleName(), ruleNode->m_nodeData->GetComment() } );
402 wxString constraintName = paretNodeDetail->
m_nodeName;
407 &constraintName, dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( nodeDetail->
m_nodeData ) );
413 [
this](
int aNodeId )
419 [
this](
int aNodeId )
425 [
this](
int aNodeId )
431 [
this](
int aNodeId, wxString aRuleName )
437 [
this](
int aNodeId ) ->
int
462 bool isNew = data && data->IsNew();
469 std::vector<RULE_TREE_NODE*> modifiedRules;
472 if( modifiedRules.empty() )
484 if(
result == wxID_CANCEL )
490 std::map<wxString, wxString> errors;
497 if( errors.find( node.m_nodeName ) != errors.end() )
501 wxString msg = wxString::Format(
502 _(
"Cannot save due to validation errors in rule '%s':\n\n%s" ),
503 node.m_nodeName, errors[node.m_nodeName] );
518 std::vector<int> newRuleNodeIds;
522 if( node.m_nodeType ==
RULE && node.m_nodeData && node.m_nodeData->IsNew() )
523 newRuleNodeIds.push_back( node.m_nodeId );
526 for(
int nodeId : newRuleNodeIds )
552 auto constraintData =
553 std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( nodeDetail->
m_nodeData );
556 constraintData->SetWasEdited(
true );
578 default:
return true;
591 if(
OKOrCancelDialog(
this,
_(
"Confirmation" ),
"",
_(
"Are you sure you want to delete?" ),
_(
"Delete" ) )
615 std::vector<RULE_TREE_NODE>
result;
645 std::vector<RULE_TREE_NODE>
result;
682 std::vector<RULE_TREE_NODE>
result;
701 std::vector<RULE_TREE_NODE>
result;
746bool nodeExists(
const std::vector<RULE_TREE_NODE>& aRuleTreeNodes,
const wxString& aTargetName )
748 for(
const auto& node : aRuleTreeNodes )
761 const wxString& aBaseName )
764 using ConstraintDataFactory =
768 static const std::unordered_map<DRC_RULE_EDITOR_CONSTRAINT_NAME, ConstraintDataFactory> s_constraintFactories = {
772 return std::make_shared<DRC_RE_VIA_STYLE_CONSTRAINT_DATA>( data );
777 return std::make_shared<DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA>( data );
782 return std::make_shared<DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA>( data );
787 return std::make_shared<DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA>( data );
792 return std::make_shared<DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA>( data );
797 return std::make_shared<DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA>( data );
802 return std::make_shared<DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA>( data );
807 return std::make_shared<DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA>( data );
812 return std::make_shared<DRC_RE_MATCHED_LENGTH_DIFF_PAIR_CONSTRAINT_DATA>( data );
817 return std::make_shared<DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA>( data );
826 treeItemData = aRuleTreeItemData;
837 wxString base = aBaseName.IsEmpty() ? nodeDetail->
m_nodeName : aBaseName;
838 wxString nodeName = base +
" 1";
849 nodeName = base + wxString::Format(
" %d", loop );
863 if( s_constraintFactories.find( nodeType ) != s_constraintFactories.end() )
865 newRuleNode.
m_nodeData = s_constraintFactories.at( nodeType )( clearanceData );
873 newRuleNode.
m_nodeData = std::make_shared<DRC_RE_BOOL_INPUT_CONSTRAINT_DATA>( clearanceData );
877 wxLogWarning(
"No factory found for constraint type: %d", nodeType );
878 newRuleNode.
m_nodeData = std::make_shared<DRC_RE_BASE_CONSTRAINT_DATA>( clearanceData );
881 std::static_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( newRuleNode.
m_nodeData )
896 return node.m_nodeId == aNodeId;
950 std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA> constraintData =
m_ruleEditorPanel->GetConstraintData();
951 std::shared_ptr<DRC_RULE> selectedRule;
953 wxString ruleText = constraintData->GetGeneratedRule();
955 if( ruleText.IsEmpty() )
962 wxString fullText = wxS(
"(version 2)\n" ) + ruleText;
966 std::vector<std::shared_ptr<DRC_RULE>> rules;
968 parser.
Parse( rules,
nullptr );
977 selectedRule = rules[0];
978 condition = selectedRule->m_Condition ? selectedRule->m_Condition->GetExpression() : wxString();
980 if( selectedRule->m_Condition && !selectedRule->m_Condition->GetExpression().IsEmpty()
981 && !selectedRule->m_Condition->Compile(
nullptr ) )
991 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ), wxS(
"[ShowMatches] nodeId=%d, condition='%s'" ), aNodeId,
996 std::vector<BOARD_ITEM*> allMatches;
1001 std::vector<BOARD_ITEM*> matches;
1005 switch( item->Type() )
1013 matches.push_back( item );
1018 int matchCount =
static_cast<int>( matches.size() );
1020 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ), wxS(
"[ShowMatches] matched_count=%d (filtered from %zu)" ),
1021 matchCount, allMatches.size() );
1026 if( matches.size() > 0 )
1028 std::vector<EDA_ITEM*> selectItems;
1031 selectItems.push_back( item );
1038 m_frame->FocusOnItems( matches );
1050 return node.m_nodeName == aRuleName && node.m_nodeId != aNodeId
1051 && node.m_nodeType == RULE;
1070 return node.m_nodeId == aNodeId;
1083 std::vector<RULE_TREE_NODE> children;
1086 for(
const auto& child : children )
1091 aResult.push_back( childNode );
1102 if( node.m_nodeType !=
RULE )
1105 if( node.m_nodeData && node.m_nodeData->IsNew() )
1107 aResult.push_back( &node );
1111 auto constraintData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1113 if( constraintData && constraintData->WasEdited() )
1114 aResult.push_back( &node );
1121 bool allValid =
true;
1127 std::map<std::pair<wxString, wxString>, std::set<wxString>> ruleConditions;
1131 if( node.m_nodeType !=
RULE )
1134 if( node.m_nodeData && node.m_nodeData->IsNew() )
1137 auto constraintData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1139 if( constraintData )
1148 for(
const wxString& err :
result.errors )
1150 if( !errorMsg.IsEmpty() )
1151 errorMsg += wxS(
"\n" );
1156 aErrors[node.m_nodeName] = errorMsg;
1160 wxString ruleName = constraintData->GetRuleName();
1161 wxString condition = constraintData->GetRuleCondition();
1162 wxString layerSource = constraintData->GetLayerSource();
1163 ruleConditions[std::make_pair( ruleName, layerSource )].insert( condition );
1168 for(
const auto& [key, conditions] : ruleConditions )
1170 if( conditions.size() > 1 )
1172 wxString errorMsg =
_(
"Multiple rules with the same name have different conditions. "
1173 "Rules with the same name must have identical conditions to be merged." );
1174 aErrors[key.first] = errorMsg;
1185 std::vector<RULE_TREE_NODE*> modifiedRules;
1188 if( modifiedRules.empty() )
1191 wxString message =
_(
"The following rules have unsaved changes:\n\n" );
1194 message += wxString::Format( wxS(
" \u2022 %s\n" ), rule->m_nodeName );
1196 message +=
_(
"\nDo you want to save your changes?" );
1198 int result = wxMessageBox( message,
_(
"Save Changes?" ),
1199 wxYES_NO | wxCANCEL | wxICON_QUESTION,
this );
1203 else if(
result == wxNO )
1213 wxTreeItemIdValue cookie;
1216 std::function<wxTreeItemId( wxTreeItemId )> findItem = [&]( wxTreeItemId parent ) -> wxTreeItemId
1218 wxTreeItemId item =
m_ruleTreeCtrl->GetFirstChild( parent, cookie );
1220 while( item.IsOk() )
1225 if( data && data->
GetNodeId() == aNodeId )
1228 wxTreeItemId found = findItem( item );
1236 return wxTreeItemId();
1239 wxTreeItemId itemId = findItem( root );
1248 const std::optional<DRC_RULE_EDITOR_CONSTRAINT_NAME>& aConstraintType,
1249 const std::vector<RULE_TREE_NODE>& aChildNodes,
const std::optional<int>&
id )
1268 baseData.
SetId( newId );
1276 .m_nodeName = aName,
1277 .m_nodeType = aNodeType,
1279 .m_nodeTypeMap = aConstraintType,
1280 .m_childNodes = aChildNodes,
1281 .m_nodeData = std::make_shared<RULE_EDITOR_DATA_BASE>( baseData ) };
1286 const std::optional<int>& aParentId )
1292 auto baseData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.
m_nodeData );
1319 std::vector<DRC_RE_LOADED_PANEL_ENTRY> entries;
1323 if( node.m_nodeType !=
RULE )
1326 auto data = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1331 if( node.m_nodeData->IsNew() )
1336 if( node.m_nodeTypeMap )
1342 entry.
ruleName = data->GetRuleName();
1343 entry.
condition = data->GetRuleCondition();
1346 entry.
severity = data->GetSeverity();
1350 entries.push_back( entry );
1358 m_frame->GetBoard()->GetDesignSettings().m_DRCEngine->InitEngine(
m_frame->GetBoard()->GetDesignRulesPath() );
1362 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