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;
654 std::vector<RULE_TREE_NODE>
result;
705 std::vector<RULE_TREE_NODE>
result;
738 std::vector<RULE_TREE_NODE>
result;
796bool nodeExists(
const std::vector<RULE_TREE_NODE>& aRuleTreeNodes,
const wxString& aTargetName )
798 for(
const auto& node : aRuleTreeNodes )
811 const wxString& aBaseName )
814 using ConstraintDataFactory =
818 static const std::unordered_map<DRC_RULE_EDITOR_CONSTRAINT_NAME, ConstraintDataFactory> s_constraintFactories = {
822 return std::make_shared<DRC_RE_VIA_STYLE_CONSTRAINT_DATA>( data );
827 return std::make_shared<DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA>( data );
832 return std::make_shared<DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA>( data );
837 return std::make_shared<DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA>( data );
842 return std::make_shared<DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA>( data );
847 return std::make_shared<DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA>( data );
852 return std::make_shared<DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA>( data );
857 return std::make_shared<DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA>( data );
862 return std::make_shared<DRC_RE_MATCHED_LENGTH_DIFF_PAIR_CONSTRAINT_DATA>( data );
867 return std::make_shared<DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA>( data );
876 treeItemData = aRuleTreeItemData;
887 wxString base = aBaseName.IsEmpty() ? nodeDetail->
m_nodeName : aBaseName;
888 wxString nodeName = base +
" 1";
899 nodeName = base + wxString::Format(
" %d", loop );
913 if( s_constraintFactories.find( nodeType ) != s_constraintFactories.end() )
915 newRuleNode.
m_nodeData = s_constraintFactories.at( nodeType )( clearanceData );
923 newRuleNode.
m_nodeData = std::make_shared<DRC_RE_BOOL_INPUT_CONSTRAINT_DATA>( clearanceData );
927 wxLogWarning(
"No factory found for constraint type: %d", nodeType );
928 newRuleNode.
m_nodeData = std::make_shared<DRC_RE_BASE_CONSTRAINT_DATA>( clearanceData );
931 std::static_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( newRuleNode.
m_nodeData )
946 return node.m_nodeId == aNodeId;
1001 if( condition.IsEmpty() )
1005 if( !ruleText.IsEmpty() )
1007 wxString fullText = wxS(
"(version 1)\n" ) + ruleText;
1011 std::vector<std::shared_ptr<DRC_RULE>> rules;
1013 parser.
Parse( rules,
nullptr );
1015 if( !rules.empty() && rules[0]->m_Condition )
1016 condition = rules[0]->m_Condition->GetExpression();
1025 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ),
1026 wxS(
"[ShowMatches] nodeId=%d, condition='%s'" ), aNodeId, condition );
1029 if( condition.IsEmpty() )
1039 if( !testCondition.
Compile(
nullptr ) )
1041 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ), wxS(
"[ShowMatches] compile failed" ) );
1047 std::vector<BOARD_ITEM*> allMatches =
1051 std::vector<BOARD_ITEM*> matches;
1055 switch( item->Type() )
1063 matches.push_back( item );
1068 int matchCount =
static_cast<int>( matches.size() );
1070 wxLogTrace( wxS(
"KI_TRACE_DRC_RULE_EDITOR" ), wxS(
"[ShowMatches] matched_count=%d (filtered from %zu)" ),
1071 matchCount, allMatches.size() );
1076 if( matches.size() > 0 )
1078 std::vector<EDA_ITEM*> selectItems;
1081 selectItems.push_back( item );
1088 m_frame->FocusOnItems( matches );
1100 return node.m_nodeName == aRuleName && node.m_nodeId != aNodeId
1101 && node.m_nodeType == RULE;
1120 return node.m_nodeId == aNodeId;
1133 std::vector<RULE_TREE_NODE> children;
1136 for(
const auto& child : children )
1141 aResult.push_back( childNode );
1152 if( node.m_nodeType !=
RULE )
1155 if( node.m_nodeData && node.m_nodeData->IsNew() )
1157 aResult.push_back( &node );
1161 auto constraintData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1163 if( constraintData && constraintData->WasEdited() )
1164 aResult.push_back( &node );
1171 bool allValid =
true;
1177 std::map<std::pair<wxString, wxString>, std::set<wxString>> ruleConditions;
1181 if( node.m_nodeType !=
RULE )
1184 if( node.m_nodeData && node.m_nodeData->IsNew() )
1187 auto constraintData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1189 if( constraintData )
1198 for(
const wxString& err :
result.errors )
1200 if( !errorMsg.IsEmpty() )
1201 errorMsg += wxS(
"\n" );
1206 aErrors[node.m_nodeName] = errorMsg;
1210 wxString ruleName = constraintData->GetRuleName();
1211 wxString condition = constraintData->GetRuleCondition();
1212 wxString layerSource = constraintData->GetLayerSource();
1213 ruleConditions[std::make_pair( ruleName, layerSource )].insert( condition );
1218 for(
const auto& [key, conditions] : ruleConditions )
1220 if( conditions.size() > 1 )
1222 wxString errorMsg =
_(
"Multiple rules with the same name have different conditions. "
1223 "Rules with the same name must have identical conditions to be merged." );
1224 aErrors[key.first] = errorMsg;
1235 std::vector<RULE_TREE_NODE*> modifiedRules;
1238 if( modifiedRules.empty() )
1241 wxString message =
_(
"The following rules have unsaved changes:\n\n" );
1244 message += wxString::Format( wxS(
" \u2022 %s\n" ), rule->m_nodeName );
1246 message +=
_(
"\nDo you want to save your changes?" );
1248 int result = wxMessageBox( message,
_(
"Save Changes?" ),
1249 wxYES_NO | wxCANCEL | wxICON_QUESTION,
this );
1253 else if(
result == wxNO )
1263 wxTreeItemIdValue cookie;
1266 std::function<wxTreeItemId( wxTreeItemId )> findItem = [&]( wxTreeItemId parent ) -> wxTreeItemId
1268 wxTreeItemId item =
m_ruleTreeCtrl->GetFirstChild( parent, cookie );
1270 while( item.IsOk() )
1275 if( data && data->
GetNodeId() == aNodeId )
1278 wxTreeItemId found = findItem( item );
1286 return wxTreeItemId();
1289 wxTreeItemId itemId = findItem( root );
1298 const std::optional<DRC_RULE_EDITOR_CONSTRAINT_NAME>& aConstraintType,
1299 const std::vector<RULE_TREE_NODE>& aChildNodes,
const std::optional<int>&
id )
1318 baseData.
SetId( newId );
1326 .m_nodeName = aName,
1327 .m_nodeType = aNodeType,
1329 .m_nodeTypeMap = aConstraintType,
1330 .m_childNodes = aChildNodes,
1331 .m_nodeData = std::make_shared<RULE_EDITOR_DATA_BASE>( baseData ) };
1336 const std::optional<int>& aParentId )
1342 auto baseData = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.
m_nodeData );
1369 std::vector<DRC_RE_LOADED_PANEL_ENTRY> entries;
1373 if( node.m_nodeType !=
RULE )
1376 auto data = std::dynamic_pointer_cast<DRC_RE_BASE_CONSTRAINT_DATA>( node.m_nodeData );
1381 if( node.m_nodeData->IsNew() )
1386 if( node.m_nodeTypeMap )
1392 entry.
ruleName = data->GetRuleName();
1393 entry.
condition = data->GetRuleCondition();
1396 entry.
severity = data->GetSeverity();
1400 entries.push_back( entry );
1408 m_frame->GetBoard()->GetDesignSettings().m_DRCEngine->InitEngine(
1409 m_frame->GetDesignRulesPath() );
1413 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 condition.
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)
bool Compile(REPORTER *aReporter, int aSourceLine=0, int aSourceOffset=0)
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