KiCad PCB EDA Suite
RC_TREE_MODEL Class Reference

#include <rc_item.h>

Inheritance diagram for RC_TREE_MODEL:

Public Member Functions

 RC_TREE_MODEL (EDA_DRAW_FRAME *aParentFrame, wxDataViewCtrl *aView)
 
 ~RC_TREE_MODEL ()
 
void SetProvider (RC_ITEMS_PROVIDER *aProvider)
 
void SetSeverities (int aSeverities)
 
int GetDRCItemCount () const
 
void ExpandAll ()
 
bool IsContainer (wxDataViewItem const &aItem) const override
 
wxDataViewItem GetParent (wxDataViewItem const &aItem) const override
 
unsigned int GetChildren (wxDataViewItem const &aItem, wxDataViewItemArray &aChildren) const override
 
unsigned int GetColumnCount () const override
 
wxString GetColumnType (unsigned int aCol) const override
 
bool HasContainerColumns (wxDataViewItem const &aItem) const override
 
void GetValue (wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
 Called by the wxDataView to fetch an item's value. More...
 
bool SetValue (wxVariant const &aVariant, wxDataViewItem const &aItem, unsigned int aCol) override
 Called by the wxDataView to edit an item's content. More...
 
bool GetAttr (wxDataViewItem const &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
 Called by the wxDataView to fetch an item's formatting. More...
 
void ValueChanged (RC_TREE_NODE *aNode)
 
void DeleteCurrentItem (bool aDeep)
 
void DeleteAllItems ()
 

Static Public Member Functions

static wxDataViewItem ToItem (RC_TREE_NODE const *aNode)
 
static RC_TREE_NODEToNode (wxDataViewItem aItem)
 
static KIID ToUUID (wxDataViewItem aItem)
 

Private Member Functions

void rebuildModel (RC_ITEMS_PROVIDER *aProvider, int aSeverities)
 
void onSizeView (wxSizeEvent &aEvent)
 

Private Attributes

EDA_DRAW_FRAMEm_editFrame
 
wxDataViewCtrl * m_view
 
int m_severities
 
RC_ITEMS_PROVIDERm_rcItemsProvider
 
std::vector< RC_TREE_NODE * > m_tree
 

Detailed Description

Definition at line 212 of file rc_item.h.

Constructor & Destructor Documentation

◆ RC_TREE_MODEL()

RC_TREE_MODEL::RC_TREE_MODEL ( EDA_DRAW_FRAME aParentFrame,
wxDataViewCtrl *  aView 
)

Definition at line 120 of file rc_item.cpp.

120  :
121  m_editFrame( aParentFrame ),
122  m_view( aView ),
123  m_severities( 0 ),
124  m_rcItemsProvider( nullptr )
125 {
126  m_view->GetMainWindow()->Connect( wxEVT_SIZE,
127  wxSizeEventHandler( RC_TREE_MODEL::onSizeView ),
128  NULL, this );
129 }
wxDataViewCtrl * m_view
Definition: rc_item.h:289
RC_ITEMS_PROVIDER * m_rcItemsProvider
Definition: rc_item.h:291
#define NULL
EDA_DRAW_FRAME * m_editFrame
Definition: rc_item.h:288
void onSizeView(wxSizeEvent &aEvent)
Definition: rc_item.cpp:418
int m_severities
Definition: rc_item.h:290

References m_view, NULL, and onSizeView().

◆ ~RC_TREE_MODEL()

RC_TREE_MODEL::~RC_TREE_MODEL ( )

Definition at line 132 of file rc_item.cpp.

133 {
134  delete m_rcItemsProvider;
135 
136  for( RC_TREE_NODE* topLevelNode : m_tree )
137  delete topLevelNode;
138 }
RC_ITEMS_PROVIDER * m_rcItemsProvider
Definition: rc_item.h:291
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293

References m_rcItemsProvider, and m_tree.

Member Function Documentation

◆ DeleteAllItems()

void RC_TREE_MODEL::DeleteAllItems ( )

Definition at line 406 of file rc_item.cpp.

407 {
408  if( m_rcItemsProvider )
409  {
411 
412  m_tree.clear();
413  Cleared();
414  }
415 }
virtual void DeleteAllItems()=0
Function DeleteAllItems removes and deletes all the items in the list.
RC_ITEMS_PROVIDER * m_rcItemsProvider
Definition: rc_item.h:291
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293

References RC_ITEMS_PROVIDER::DeleteAllItems(), m_rcItemsProvider, and m_tree.

Referenced by DIALOG_ERC::deleteAllMarkers(), and DIALOG_DRC::deleteAllMarkers().

◆ DeleteCurrentItem()

void RC_TREE_MODEL::DeleteCurrentItem ( bool  aDeep)

Definition at line 367 of file rc_item.cpp.

368 {
369  RC_TREE_NODE* tree_node = ToNode( m_view->GetCurrentItem() );
370  const RC_ITEM* drc_item = tree_node ? tree_node->m_RcItem : nullptr;
371 
372  if( !drc_item )
373  {
374  wxBell();
375  return;
376  }
377 
378  for( int i = 0; i < m_rcItemsProvider->GetCount(); ++i )
379  {
380  if( m_rcItemsProvider->GetItem( i ) == drc_item )
381  {
382  wxDataViewItem markerItem = ToItem( m_tree[i] );
383  wxDataViewItemArray childItems;
384  wxDataViewItem parentItem = ToItem( m_tree[i]->m_Parent );
385 
386  for( RC_TREE_NODE* child : m_tree[i]->m_Children )
387  {
388  childItems.push_back( ToItem( child ) );
389  delete child;
390  }
391 
392  m_tree[i]->m_Children.clear();
393  ItemsDeleted( markerItem, childItems );
394 
395  delete m_tree[i];
396  m_tree.erase( m_tree.begin() + i );
397  ItemDeleted( parentItem, markerItem );
398 
399  m_rcItemsProvider->DeleteItem( i, aDeep );
400  break;
401  }
402  }
403 }
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:215
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:77
virtual int GetCount(int aSeverity=-1)=0
wxDataViewCtrl * m_view
Definition: rc_item.h:289
virtual RC_ITEM * GetItem(int aIndex)=0
Function GetItem retrieves a RC_ITEM by index.
RC_ITEMS_PROVIDER * m_rcItemsProvider
Definition: rc_item.h:291
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293
RC_ITEM * m_RcItem
Definition: rc_item.h:205
virtual void DeleteItem(int aIndex, bool aDeep)=0
Function DeleteItem removes (and optionally deletes) the indexed item from the list.

References RC_ITEMS_PROVIDER::DeleteItem(), RC_ITEMS_PROVIDER::GetCount(), RC_ITEMS_PROVIDER::GetItem(), RC_TREE_NODE::m_RcItem, m_rcItemsProvider, m_tree, m_view, ToItem(), and ToNode().

Referenced by DIALOG_DRC::OnDeleteOneClick().

◆ ExpandAll()

void RC_TREE_MODEL::ExpandAll ( )

Definition at line 218 of file rc_item.cpp.

219 {
220  for( RC_TREE_NODE* topLevelNode : m_tree )
221  m_view->Expand( ToItem( topLevelNode ) );
222 }
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:215
wxDataViewCtrl * m_view
Definition: rc_item.h:289
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293

References m_tree, m_view, and ToItem().

Referenced by rebuildModel().

◆ GetAttr()

bool RC_TREE_MODEL::GetAttr ( wxDataViewItem const &  aItem,
unsigned int  aCol,
wxDataViewItemAttr &  aAttr 
) const
override

Called by the wxDataView to fetch an item's formatting.

Return true iff the item has non-default attributes.

Definition at line 317 of file rc_item.cpp.

320 {
321  const RC_TREE_NODE* node = ToNode( aItem );
322  wxASSERT( node );
323 
324  bool ret = false;
325  bool heading = node->m_Type == RC_TREE_NODE::MARKER;
326 
327  if( heading )
328  {
329  aAttr.SetBold( true );
330  ret = true;
331  }
332 
333  if( node->m_RcItem->GetParent() && node->m_RcItem->GetParent()->IsExcluded() )
334  {
335  wxColour textColour = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT );
336 
337  if( KIGFX::COLOR4D( textColour ).GetBrightness() > 0.5 )
338  aAttr.SetColour( textColour.ChangeLightness( heading ? 30 : 35 ) );
339  else
340  aAttr.SetColour( textColour.ChangeLightness( heading ? 170 : 165 ) );
341 
342  aAttr.SetItalic( true ); // Strikethrough would be better, if wxWidgets supported it
343  ret = true;
344  }
345 
346  return ret;
347 }
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
bool IsExcluded() const
Definition: marker_base.h:108
NODE_TYPE m_Type
Definition: rc_item.h:204
RC_ITEM * m_RcItem
Definition: rc_item.h:205
MARKER_BASE * GetParent() const
Definition: rc_item.h:149
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99

References RC_ITEM::GetParent(), MARKER_BASE::IsExcluded(), RC_TREE_NODE::m_RcItem, RC_TREE_NODE::m_Type, RC_TREE_NODE::MARKER, and ToNode().

◆ GetChildren()

unsigned int RC_TREE_MODEL::GetChildren ( wxDataViewItem const &  aItem,
wxDataViewItemArray &  aChildren 
) const
override

Definition at line 240 of file rc_item.cpp.

242 {
243  const RC_TREE_NODE* node = ToNode( aItem );
244  const std::vector<RC_TREE_NODE*>& children = node ? node->m_Children : m_tree;
245 
246  for( const RC_TREE_NODE* child: children )
247  aChildren.push_back( ToItem( child ) );
248 
249  return children.size();
250 }
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:215
std::vector< RC_TREE_NODE * > m_Children
Definition: rc_item.h:208
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293

References RC_TREE_NODE::m_Children, m_tree, ToItem(), and ToNode().

◆ GetColumnCount()

unsigned int RC_TREE_MODEL::GetColumnCount ( ) const
inlineoverride

Definition at line 248 of file rc_item.h.

248 { return 1; }

◆ GetColumnType()

wxString RC_TREE_MODEL::GetColumnType ( unsigned int  aCol) const
inlineoverride

Definition at line 249 of file rc_item.h.

249 { return "string"; }

◆ GetDRCItemCount()

int RC_TREE_MODEL::GetDRCItemCount ( ) const
inline

Definition at line 236 of file rc_item.h.

236 { return m_tree.size(); }
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293

References m_tree.

Referenced by DIALOG_DRC::updateDisplayedCounts().

◆ GetParent()

wxDataViewItem RC_TREE_MODEL::GetParent ( wxDataViewItem const &  aItem) const
override

Definition at line 234 of file rc_item.cpp.

235 {
236  return ToItem( ToNode( aItem)->m_Parent );
237 }
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:215
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220

References ToItem(), and ToNode().

◆ GetValue()

void RC_TREE_MODEL::GetValue ( wxVariant &  aVariant,
wxDataViewItem const &  aItem,
unsigned int  aCol 
) const
override

Called by the wxDataView to fetch an item's value.

Definition at line 256 of file rc_item.cpp.

259 {
260  const RC_TREE_NODE* node = ToNode( aItem );
261  const RC_ITEM* rcItem = node->m_RcItem;
262 
263  switch( node->m_Type )
264  {
266  {
267  wxString prefix;
268 
269  if( rcItem->GetParent() && rcItem->GetParent()->IsExcluded() )
270  prefix = _( "Excluded " );
271 
272  switch( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) )
273  {
274  case RPT_SEVERITY_ERROR: prefix += _( "Error: " ); break;
275  case RPT_SEVERITY_WARNING: prefix += _( "Warning: " ); break;
276  }
277 
278  aVariant = prefix + rcItem->GetErrorMessage();
279  }
280  break;
281 
283  {
284  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() );
285  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
286  }
287  break;
288 
290  {
291  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
292  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
293  }
294  break;
295 
297  {
298  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() );
299  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
300  }
301  break;
302 
304  {
305  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() );
306  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
307  }
308  break;
309  }
310 }
virtual EDA_ITEM * GetItem(const KIID &aId)
Fetch an item by KIID.
KIID GetAuxItem2ID() const
Definition: rc_item.h:145
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:77
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
KIID GetAuxItemID() const
Definition: rc_item.h:144
int GetErrorCode() const
Definition: rc_item.h:160
EDA_DRAW_FRAME * m_editFrame
Definition: rc_item.h:288
bool IsExcluded() const
Definition: marker_base.h:108
virtual int GetSeverity(int aErrorCode) const
NODE_TYPE m_Type
Definition: rc_item.h:204
RC_ITEM * m_RcItem
Definition: rc_item.h:205
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
KIID GetMainItemID() const
Definition: rc_item.h:143
MARKER_BASE * GetParent() const
Definition: rc_item.h:149
KIID GetAuxItem3ID() const
Definition: rc_item.h:146
virtual wxString GetErrorMessage() const
Function GetErrorMessage returns the error message of a RC_ITEM.
Definition: rc_item.cpp:36
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, RC_TREE_NODE::AUX_ITEM, RC_TREE_NODE::AUX_ITEM2, RC_TREE_NODE::AUX_ITEM3, RC_ITEM::GetAuxItem2ID(), RC_ITEM::GetAuxItem3ID(), RC_ITEM::GetAuxItemID(), RC_ITEM::GetErrorCode(), RC_ITEM::GetErrorMessage(), EDA_DRAW_FRAME::GetItem(), RC_ITEM::GetMainItemID(), RC_ITEM::GetParent(), EDA_ITEM::GetSelectMenuText(), EDA_BASE_FRAME::GetSeverity(), EDA_BASE_FRAME::GetUserUnits(), MARKER_BASE::IsExcluded(), m_editFrame, RC_TREE_NODE::m_RcItem, RC_TREE_NODE::m_Type, RC_TREE_NODE::MAIN_ITEM, RC_TREE_NODE::MARKER, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and ToNode().

◆ HasContainerColumns()

bool RC_TREE_MODEL::HasContainerColumns ( wxDataViewItem const &  aItem) const
inlineoverride

Definition at line 250 of file rc_item.h.

250 { return true; }

◆ IsContainer()

bool RC_TREE_MODEL::IsContainer ( wxDataViewItem const &  aItem) const
override

Definition at line 225 of file rc_item.cpp.

226 {
227  if( ToNode( aItem ) == nullptr ) // must be tree root...
228  return true;
229  else
230  return ToNode( aItem )->m_Type == RC_TREE_NODE::MARKER;
231 }
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
NODE_TYPE m_Type
Definition: rc_item.h:204

References RC_TREE_NODE::m_Type, RC_TREE_NODE::MARKER, and ToNode().

◆ onSizeView()

void RC_TREE_MODEL::onSizeView ( wxSizeEvent &  aEvent)
private

Definition at line 418 of file rc_item.cpp.

419 {
420  int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
421 
422  if( m_view->GetColumnCount() > 0 )
423  m_view->GetColumn( 0 )->SetWidth( width );
424 
425  // Pass size event to other widgets
426  aEvent.Skip();
427 }
wxDataViewCtrl * m_view
Definition: rc_item.h:289
#define WX_DATAVIEW_WINDOW_PADDING
Definition: rc_item.cpp:33

References m_view, and WX_DATAVIEW_WINDOW_PADDING.

Referenced by RC_TREE_MODEL().

◆ rebuildModel()

void RC_TREE_MODEL::rebuildModel ( RC_ITEMS_PROVIDER aProvider,
int  aSeverities 
)
private

Definition at line 141 of file rc_item.cpp.

142 {
143  wxWindowUpdateLocker updateLock( m_view );
144 
145  // Even with the updateLock, wxWidgets sometimes ties its knickers in
146  // a knot when trying to run a wxdataview_selection_changed_callback()
147  // on a row that has been deleted.
148  if( m_view )
149  m_view->UnselectAll();
150 
151  if( aProvider != m_rcItemsProvider )
152  {
153  delete m_rcItemsProvider;
154  m_rcItemsProvider = aProvider;
155  }
156 
157  if( aSeverities != m_severities )
158  m_severities = aSeverities;
159 
160  if( m_rcItemsProvider )
162 
163  m_tree.clear();
164 
165  for( int i = 0; m_rcItemsProvider && i < m_rcItemsProvider->GetCount(); ++i )
166  {
167  RC_ITEM* rcItem = m_rcItemsProvider->GetItem( i );
168 
169  m_tree.push_back( new RC_TREE_NODE( nullptr, rcItem, RC_TREE_NODE::MARKER ) );
170  RC_TREE_NODE* n = m_tree.back();
171 
172  if( rcItem->GetMainItemID() != niluuid )
173  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::MAIN_ITEM ) );
174 
175  if( rcItem->GetAuxItemID() != niluuid )
176  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM ) );
177 
178  if( rcItem->GetAuxItem2ID() != niluuid )
179  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM2 ) );
180 
181  if( rcItem->GetAuxItem3ID() != niluuid )
182  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM3 ) );
183  }
184 
185  // Must be called after a significant change of items to force the
186  // wxDataViewModel to reread all of them, repopulating itself entirely.
187  Cleared();
188 
189 #ifdef __WXGTK__
190  // The fastest method to update wxDataViewCtrl is to rebuild from
191  // scratch by calling Cleared(). Linux requires to reassociate model to
192  // display data, but Windows will create multiple associations.
193  // On MacOS, this crashes kicad. See https://gitlab.com/kicad/code/kicad/issues/3666
194  // and https://gitlab.com/kicad/code/kicad/issues/3653
195  m_view->AssociateModel( this );
196 #endif
197 
198  m_view->ClearColumns();
199  int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
200  m_view->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, width );
201 
202  ExpandAll();
203 }
KIID GetAuxItem2ID() const
Definition: rc_item.h:145
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:77
virtual int GetCount(int aSeverity=-1)=0
wxDataViewCtrl * m_view
Definition: rc_item.h:289
#define WX_DATAVIEW_WINDOW_PADDING
Definition: rc_item.cpp:33
virtual RC_ITEM * GetItem(int aIndex)=0
Function GetItem retrieves a RC_ITEM by index.
std::vector< RC_TREE_NODE * > m_Children
Definition: rc_item.h:208
RC_ITEMS_PROVIDER * m_rcItemsProvider
Definition: rc_item.h:291
void ExpandAll()
Definition: rc_item.cpp:218
KIID niluuid(0)
KIID GetAuxItemID() const
Definition: rc_item.h:144
virtual void SetSeverities(int aSeverities)=0
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:293
int m_severities
Definition: rc_item.h:290
KIID GetMainItemID() const
Definition: rc_item.h:143
KIID GetAuxItem3ID() const
Definition: rc_item.h:146

References RC_TREE_NODE::AUX_ITEM, RC_TREE_NODE::AUX_ITEM2, RC_TREE_NODE::AUX_ITEM3, ExpandAll(), RC_ITEM::GetAuxItem2ID(), RC_ITEM::GetAuxItem3ID(), RC_ITEM::GetAuxItemID(), RC_ITEMS_PROVIDER::GetCount(), RC_ITEMS_PROVIDER::GetItem(), RC_ITEM::GetMainItemID(), RC_TREE_NODE::m_Children, m_rcItemsProvider, m_severities, m_tree, m_view, RC_TREE_NODE::MAIN_ITEM, RC_TREE_NODE::MARKER, niluuid, RC_ITEMS_PROVIDER::SetSeverities(), and WX_DATAVIEW_WINDOW_PADDING.

Referenced by SetProvider(), and SetSeverities().

◆ SetProvider()

◆ SetSeverities()

void RC_TREE_MODEL::SetSeverities ( int  aSeverities)

◆ SetValue()

bool RC_TREE_MODEL::SetValue ( wxVariant const &  aVariant,
wxDataViewItem const &  aItem,
unsigned int  aCol 
)
inlineoverride

Called by the wxDataView to edit an item's content.

Definition at line 262 of file rc_item.h.

265  {
266  // Editing not supported
267  return false;
268  }

◆ ToItem()

static wxDataViewItem RC_TREE_MODEL::ToItem ( RC_TREE_NODE const *  aNode)
inlinestatic

Definition at line 215 of file rc_item.h.

216  {
217  return wxDataViewItem( const_cast<void*>( static_cast<void const*>( aNode ) ) );
218  }

Referenced by DeleteCurrentItem(), ExpandAll(), GetChildren(), GetParent(), and ValueChanged().

◆ ToNode()

static RC_TREE_NODE* RC_TREE_MODEL::ToNode ( wxDataViewItem  aItem)
inlinestatic

Definition at line 220 of file rc_item.h.

221  {
222  return static_cast<RC_TREE_NODE*>( aItem.GetID() );
223  }

Referenced by DeleteCurrentItem(), GetAttr(), GetChildren(), GetParent(), GetValue(), IsContainer(), DIALOG_DRC::OnDRCItemRClick(), DIALOG_ERC::OnERCItemRClick(), and ToUUID().

◆ ToUUID()

KIID RC_TREE_MODEL::ToUUID ( wxDataViewItem  aItem)
static

Definition at line 91 of file rc_item.cpp.

92 {
93  const RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aItem );
94 
95  if( node )
96  {
97  const RC_ITEM* rc_item = node->m_RcItem;
98 
99  switch( node->m_Type )
100  {
102  // rc_item->GetParent() can be null, if the parent is not existing
103  // when a RC item has no corresponding ERC/DRC marker
104  if( rc_item->GetParent() )
105  return rc_item->GetParent()->GetUUID();
106 
107  break;
108 
109  case RC_TREE_NODE::MAIN_ITEM: return rc_item->GetMainItemID();
110  case RC_TREE_NODE::AUX_ITEM: return rc_item->GetAuxItemID();
111  case RC_TREE_NODE::AUX_ITEM2: return rc_item->GetAuxItem2ID();
112  case RC_TREE_NODE::AUX_ITEM3: return rc_item->GetAuxItem3ID();
113  }
114  }
115 
116  return niluuid;
117 }
KIID GetAuxItem2ID() const
Definition: rc_item.h:145
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:77
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
KIID niluuid(0)
KIID GetAuxItemID() const
Definition: rc_item.h:144
NODE_TYPE m_Type
Definition: rc_item.h:204
RC_ITEM * m_RcItem
Definition: rc_item.h:205
KIID GetMainItemID() const
Definition: rc_item.h:143
MARKER_BASE * GetParent() const
Definition: rc_item.h:149
KIID GetAuxItem3ID() const
Definition: rc_item.h:146
virtual const KIID GetUUID() const =0

References RC_TREE_NODE::AUX_ITEM, RC_TREE_NODE::AUX_ITEM2, RC_TREE_NODE::AUX_ITEM3, RC_ITEM::GetAuxItem2ID(), RC_ITEM::GetAuxItem3ID(), RC_ITEM::GetAuxItemID(), RC_ITEM::GetMainItemID(), RC_ITEM::GetParent(), MARKER_BASE::GetUUID(), RC_TREE_NODE::m_RcItem, RC_TREE_NODE::m_Type, RC_TREE_NODE::MAIN_ITEM, RC_TREE_NODE::MARKER, niluuid, and ToNode().

Referenced by DIALOG_DRC::OnDRCItemSelected(), DIALOG_ERC::OnERCItemSelected(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), and DIALOG_CLEANUP_GRAPHICS::OnSelectItem().

◆ ValueChanged()

void RC_TREE_MODEL::ValueChanged ( RC_TREE_NODE aNode)

Definition at line 350 of file rc_item.cpp.

351 {
352  if( aNode->m_Type == RC_TREE_NODE::MAIN_ITEM || aNode->m_Type == RC_TREE_NODE::AUX_ITEM )
353  {
354  ValueChanged( aNode->m_Parent );
355  }
356 
357  if( aNode->m_Type == RC_TREE_NODE::MARKER )
358  {
359  wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
360 
361  for( auto & child : aNode->m_Children )
362  wxDataViewModel::ValueChanged( ToItem( child ), 0 );
363  }
364 }
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:215
RC_TREE_NODE * m_Parent
Definition: rc_item.h:207
std::vector< RC_TREE_NODE * > m_Children
Definition: rc_item.h:208
NODE_TYPE m_Type
Definition: rc_item.h:204
void ValueChanged(RC_TREE_NODE *aNode)
Definition: rc_item.cpp:350

References RC_TREE_NODE::AUX_ITEM, RC_TREE_NODE::m_Children, RC_TREE_NODE::m_Parent, RC_TREE_NODE::m_Type, RC_TREE_NODE::MAIN_ITEM, RC_TREE_NODE::MARKER, and ToItem().

Member Data Documentation

◆ m_editFrame

EDA_DRAW_FRAME* RC_TREE_MODEL::m_editFrame
private

Definition at line 288 of file rc_item.h.

Referenced by GetValue().

◆ m_rcItemsProvider

RC_ITEMS_PROVIDER* RC_TREE_MODEL::m_rcItemsProvider
private

◆ m_severities

int RC_TREE_MODEL::m_severities
private

Definition at line 290 of file rc_item.h.

Referenced by rebuildModel(), and SetProvider().

◆ m_tree

std::vector<RC_TREE_NODE*> RC_TREE_MODEL::m_tree
private

◆ m_view

wxDataViewCtrl* RC_TREE_MODEL::m_view
private

Definition at line 289 of file rc_item.h.

Referenced by DeleteCurrentItem(), ExpandAll(), onSizeView(), RC_TREE_MODEL(), and rebuildModel().


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