KiCad PCB EDA Suite
rc_item.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 
25 #include <wx/wupdlock.h>
26 #include <wx/dataview.h>
27 #include <wx/settings.h>
28 #include <widgets/ui_common.h>
29 #include <marker_base.h>
30 #include <eda_draw_frame.h>
31 #include <rc_item.h>
32 #include <eda_item.h>
33 #include <base_units.h>
34 
35 #define WX_DATAVIEW_WINDOW_PADDING 6
36 
37 
38 wxString RC_ITEM::GetErrorMessage() const
39 {
40  if( m_errorMessage.IsEmpty() )
41  return GetErrorText();
42  else
43  return m_errorMessage;
44 }
45 
46 
47 wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
48 {
49  return wxString::Format( "@(%s, %s)",
50  MessageTextFromValue( aUnits, aPos.x ),
51  MessageTextFromValue( aUnits, aPos.y ) );
52 }
53 
54 
55 void RC_ITEM::AddItem( EDA_ITEM* aItem )
56 {
57  m_ids.push_back( aItem->m_Uuid );
58 }
59 
60 
61 void RC_ITEM::SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem,
62  const EDA_ITEM* cItem, const EDA_ITEM* dItem )
63 {
64  m_ids.clear();
65 
66  m_ids.push_back( aItem->m_Uuid );
67 
68  if( bItem )
69  m_ids.push_back( bItem->m_Uuid );
70 
71  if( cItem )
72  m_ids.push_back( cItem->m_Uuid );
73 
74  if( dItem )
75  m_ids.push_back( dItem->m_Uuid );
76 }
77 
78 
79 wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
80  const std::map<KIID, EDA_ITEM*>& aItemMap ) const
81 {
82  wxString severity;
83 
84  switch( aSeverity )
85  {
86  case RPT_SEVERITY_ERROR: severity = wxT( "Severity: error" ); break;
87  case RPT_SEVERITY_WARNING: severity = wxT( "Severity: warning" ); break;
88  case RPT_SEVERITY_ACTION: severity = wxT( "Severity: action" ); break;
89  case RPT_SEVERITY_INFO: severity = wxT( "Severity: info" ); break;
90  default: ;
91  };
92 
93  if( m_parent && m_parent->IsExcluded() )
94  severity += wxT( " (excluded)" );
95 
96  EDA_ITEM* mainItem = nullptr;
97  EDA_ITEM* auxItem = nullptr;
98 
99  auto ii = aItemMap.find( GetMainItemID() );
100 
101  if( ii != aItemMap.end() )
102  mainItem = ii->second;
103 
104  ii = aItemMap.find( GetAuxItemID() );
105 
106  if( ii != aItemMap.end() )
107  auxItem = ii->second;
108 
109  // Note: some customers machine-process these. So:
110  // 1) don't translate
111  // 2) try not to re-order or change syntax
112  // 3) report settings key (which should be more stable) in addition to message
113 
114  if( mainItem && auxItem )
115  {
116  return wxString::Format( wxT( "[%s]: %s\n %s; %s\n %s: %s\n %s: %s\n" ),
117  GetSettingsKey(),
118  GetErrorMessage(),
120  severity,
121  ShowCoord( aUnits, mainItem->GetPosition() ),
122  mainItem->GetSelectMenuText( aUnits ),
123  ShowCoord( aUnits, auxItem->GetPosition() ),
124  auxItem->GetSelectMenuText( aUnits ) );
125  }
126  else if( mainItem )
127  {
128  return wxString::Format( wxT( "[%s]: %s\n %s; %s\n %s: %s\n" ),
129  GetSettingsKey(),
130  GetErrorMessage(),
132  severity,
133  ShowCoord( aUnits, mainItem->GetPosition() ),
134  mainItem->GetSelectMenuText( aUnits ) );
135  }
136  else
137  {
138  return wxString::Format( wxT( "[%s]: %s\n %s; %s\n" ),
139  GetSettingsKey(),
140  GetErrorMessage(),
142  severity );
143  }
144 }
145 
146 
147 KIID RC_TREE_MODEL::ToUUID( wxDataViewItem aItem )
148 {
149  const RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aItem );
150 
151  if( node && node->m_RcItem )
152  {
153  const std::shared_ptr<RC_ITEM> rc_item = node->m_RcItem;
154 
155  switch( node->m_Type )
156  {
158  // rc_item->GetParent() can be null, if the parent is not existing
159  // when a RC item has no corresponding ERC/DRC marker
160  if( rc_item->GetParent() )
161  return rc_item->GetParent()->GetUUID();
162 
163  break;
164 
165  case RC_TREE_NODE::MAIN_ITEM: return rc_item->GetMainItemID();
166  case RC_TREE_NODE::AUX_ITEM: return rc_item->GetAuxItemID();
167  case RC_TREE_NODE::AUX_ITEM2: return rc_item->GetAuxItem2ID();
168  case RC_TREE_NODE::AUX_ITEM3: return rc_item->GetAuxItem3ID();
169  }
170  }
171 
172  return niluuid;
173 }
174 
175 
176 RC_TREE_MODEL::RC_TREE_MODEL( EDA_DRAW_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
177  m_editFrame( aParentFrame ),
178  m_view( aView ),
179  m_severities( 0 ),
180  m_rcItemsProvider( nullptr )
181 {
182  m_view->GetMainWindow()->Connect( wxEVT_SIZE,
183  wxSizeEventHandler( RC_TREE_MODEL::onSizeView ),
184  nullptr, this );
185 }
186 
187 
189 {
190  delete m_rcItemsProvider;
191 
192  for( RC_TREE_NODE* topLevelNode : m_tree )
193  delete topLevelNode;
194 }
195 
196 
197 void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities )
198 {
199  wxWindowUpdateLocker updateLock( m_view );
200 
201  std::shared_ptr<RC_ITEM> selectedRcItem = nullptr;
202 
203  if( m_view )
204  {
205  RC_TREE_NODE* selectedNode = ToNode( m_view->GetSelection() );
206  selectedRcItem = selectedNode ? selectedNode->m_RcItem : nullptr;
207 
208  // Even with the updateLock, wxWidgets sometimes ties its knickers in a knot trying
209  // to run a wxdataview_selection_changed_callback() on a row that has been deleted.
210  m_view->UnselectAll();
211  }
212 
213  if( aProvider != m_rcItemsProvider )
214  {
215  delete m_rcItemsProvider;
216  m_rcItemsProvider = aProvider;
217  }
218 
219  if( aSeverities != m_severities )
220  m_severities = aSeverities;
221 
222  if( m_rcItemsProvider )
224 
225  for( RC_TREE_NODE* topLevelNode : m_tree )
226  delete topLevelNode;
227 
228  m_tree.clear();
229 
230  // wxDataView::ExpandAll() pukes with large lists
231  int count = 0;
232 
233  if( m_rcItemsProvider )
234  count = std::min( 1000, m_rcItemsProvider->GetCount() );
235 
236  for( int i = 0; i < count; ++i )
237  {
238  std::shared_ptr<RC_ITEM> rcItem = m_rcItemsProvider->GetItem( i );
239 
240  m_tree.push_back( new RC_TREE_NODE( nullptr, rcItem, RC_TREE_NODE::MARKER ) );
241  RC_TREE_NODE* n = m_tree.back();
242 
243  if( rcItem->GetMainItemID() != niluuid )
244  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::MAIN_ITEM ) );
245 
246  if( rcItem->GetAuxItemID() != niluuid )
247  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM ) );
248 
249  if( rcItem->GetAuxItem2ID() != niluuid )
250  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM2 ) );
251 
252  if( rcItem->GetAuxItem3ID() != niluuid )
253  n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM3 ) );
254  }
255 
256  // Must be called after a significant change of items to force the
257  // wxDataViewModel to reread all of them, repopulating itself entirely.
258  Cleared();
259 
260 #ifdef __WXGTK__
261  // The fastest method to update wxDataViewCtrl is to rebuild from
262  // scratch by calling Cleared(). Linux requires to reassociate model to
263  // display data, but Windows will create multiple associations.
264  // On MacOS, this crashes KiCad. See https://gitlab.com/kicad/code/kicad/issues/3666
265  // and https://gitlab.com/kicad/code/kicad/issues/3653
266  m_view->AssociateModel( this );
267 #endif
268 
269  m_view->ClearColumns();
270  int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
271  m_view->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, width );
272 
273  ExpandAll();
274 
275  // Most annoyingly wxWidgets won't tell us the scroll position (and no, all the usual
276  // routines don't work), so we can only restore the scroll position based on a selection.
277  if( selectedRcItem )
278  {
279  for( RC_TREE_NODE* candidate : m_tree )
280  {
281  if( candidate->m_RcItem == selectedRcItem )
282  {
283  m_view->Select( ToItem( candidate ) );
284  m_view->EnsureVisible( ToItem( candidate ) );
285  break;
286  }
287  }
288  }
289 }
290 
291 
293 {
294  rebuildModel( aProvider, m_severities );
295 }
296 
297 
298 void RC_TREE_MODEL::SetSeverities( int aSeverities )
299 {
300  rebuildModel( m_rcItemsProvider, aSeverities );
301 }
302 
303 
305 {
306  for( RC_TREE_NODE* topLevelNode : m_tree )
307  m_view->Expand( ToItem( topLevelNode ) );
308 }
309 
310 
311 bool RC_TREE_MODEL::IsContainer( wxDataViewItem const& aItem ) const
312 {
313  if( ToNode( aItem ) == nullptr ) // must be tree root...
314  return true;
315  else
316  return ToNode( aItem )->m_Type == RC_TREE_NODE::MARKER;
317 }
318 
319 
320 wxDataViewItem RC_TREE_MODEL::GetParent( wxDataViewItem const& aItem ) const
321 {
322  return ToItem( ToNode( aItem)->m_Parent );
323 }
324 
325 
326 unsigned int RC_TREE_MODEL::GetChildren( wxDataViewItem const& aItem,
327  wxDataViewItemArray& aChildren ) const
328 {
329  const RC_TREE_NODE* node = ToNode( aItem );
330  const std::vector<RC_TREE_NODE*>& children = node ? node->m_Children : m_tree;
331 
332  for( const RC_TREE_NODE* child: children )
333  aChildren.push_back( ToItem( child ) );
334 
335  return children.size();
336 }
337 
338 
339 void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
340  wxDataViewItem const& aItem,
341  unsigned int aCol ) const
342 {
343  const RC_TREE_NODE* node = ToNode( aItem );
344  const std::shared_ptr<RC_ITEM> rcItem = node->m_RcItem;
345 
346  switch( node->m_Type )
347  {
349  {
350  wxString prefix;
351 
352  if( rcItem->GetParent() && rcItem->GetParent()->IsExcluded() )
353  prefix = _( "Excluded " );
354 
355  switch( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) )
356  {
357  case RPT_SEVERITY_ERROR: prefix += _( "Error: " ); break;
358  case RPT_SEVERITY_WARNING: prefix += _( "Warning: " ); break;
359 
362  case RPT_SEVERITY_INFO:
363  case RPT_SEVERITY_ACTION:
364  case RPT_SEVERITY_IGNORE:
365  break;
366  }
367 
368  aVariant = prefix + rcItem->GetErrorMessage();
369  }
370  break;
371 
373  {
374  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() );
375  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
376  }
377  break;
378 
380  {
381  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
382  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
383  }
384  break;
385 
387  {
388  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() );
389  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
390  }
391  break;
392 
394  {
395  EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() );
396  aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
397  }
398  break;
399  }
400 }
401 
402 
403 bool RC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
404  unsigned int aCol,
405  wxDataViewItemAttr& aAttr ) const
406 {
407  const RC_TREE_NODE* node = ToNode( aItem );
408  wxASSERT( node );
409 
410  bool ret = false;
411  bool heading = node->m_Type == RC_TREE_NODE::MARKER;
412 
413  if( heading )
414  {
415  aAttr.SetBold( true );
416  ret = true;
417  }
418 
419  if( node->m_RcItem->GetParent() && node->m_RcItem->GetParent()->IsExcluded() )
420  {
421  wxColour textColour = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT );
422 
423  if( KIGFX::COLOR4D( textColour ).GetBrightness() > 0.5 )
424  aAttr.SetColour( textColour.ChangeLightness( heading ? 30 : 35 ) );
425  else
426  aAttr.SetColour( textColour.ChangeLightness( heading ? 170 : 165 ) );
427 
428  aAttr.SetItalic( true ); // Strikethrough would be better, if wxWidgets supported it
429  ret = true;
430  }
431 
432  return ret;
433 }
434 
435 
437 {
438  if( aNode->m_Type == RC_TREE_NODE::MAIN_ITEM || aNode->m_Type == RC_TREE_NODE::AUX_ITEM )
439  {
440  ValueChanged( aNode->m_Parent );
441  }
442 
443  if( aNode->m_Type == RC_TREE_NODE::MARKER )
444  {
445  wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
446 
447  for( const RC_TREE_NODE* child : aNode->m_Children )
448  wxDataViewModel::ValueChanged( ToItem( child ), 0 );
449  }
450 }
451 
452 
454 {
455  DeleteItems( true, true, aDeep );
456 }
457 
458 
459 void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep )
460 {
461  RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
462  const std::shared_ptr<RC_ITEM> current_item = current_node ? current_node->m_RcItem : nullptr;
463 
465  std::vector<RC_TREE_NODE*> to_delete;
466 
467  if( aCurrentOnly && !current_item )
468  {
469  wxBell();
470  return;
471  }
472 
473  if( !m_rcItemsProvider )
474  return;
475 
476  int lastGood = -1;
477  bool itemDeleted = false;
478 
479  if( m_view )
480  {
481  m_view->UnselectAll();
482  wxSafeYield();
483  m_view->Freeze();
484  }
485 
486  for( int i = m_rcItemsProvider->GetCount() - 1; i >= 0; --i )
487  {
488  std::shared_ptr<RC_ITEM> rcItem = m_rcItemsProvider->GetItem( i );
489  MARKER_BASE* marker = rcItem->GetParent();
490  bool excluded = marker ? marker->IsExcluded() : false;
491 
492  if( aCurrentOnly && itemDeleted && lastGood >= 0 )
493  break;
494 
495  if( aCurrentOnly && rcItem != current_item )
496  {
497  lastGood = i;
498  continue;
499  }
500 
501  if( excluded && !aIncludeExclusions )
502  continue;
503 
504  if( i < (int) m_tree.size() ) // Careful; tree is truncated for large datasets
505  {
506  wxDataViewItem markerItem = ToItem( m_tree[i] );
507  wxDataViewItemArray childItems;
508  wxDataViewItem parentItem = ToItem( m_tree[i]->m_Parent );
509 
510  for( RC_TREE_NODE* child : m_tree[i]->m_Children )
511  {
512  childItems.push_back( ToItem( child ) );
513  to_delete.push_back( child );
514  }
515 
516  m_tree[i]->m_Children.clear();
517  ItemsDeleted( markerItem, childItems );
518 
519  to_delete.push_back( m_tree[i] );
520  m_tree.erase( m_tree.begin() + i );
521  ItemDeleted( parentItem, markerItem );
522  }
523 
524  // Only deep delete the current item here; others will be done through the
525  // DeleteAllItems() call below, which is more efficient.
526  m_rcItemsProvider->DeleteItem( i, aDeep && aCurrentOnly );
527 
528  if( lastGood > i )
529  lastGood--;
530 
531  itemDeleted = true;
532  }
533 
534  if( m_view && aCurrentOnly && lastGood >= 0 )
535  m_view->Select( ToItem( m_tree[ lastGood ] ) );
536 
537  for( RC_TREE_NODE* item : to_delete )
538  delete( item );
539 
540  if( !aCurrentOnly )
541  m_rcItemsProvider->DeleteAllItems( aIncludeExclusions, aDeep );
542 
543  if( m_view )
544  m_view->Thaw();
545 }
546 
547 
549 {
550  RC_TREE_NODE* currentNode = ToNode( m_view->GetCurrentItem() );
551  RC_TREE_NODE* prevMarker = nullptr;
552 
553  while( currentNode && currentNode->m_Type != RC_TREE_NODE::MARKER )
554  currentNode = currentNode->m_Parent;
555 
556  for( RC_TREE_NODE* candidate : m_tree )
557  {
558  if( candidate == currentNode )
559  break;
560  else
561  prevMarker = candidate;
562  }
563 
564  if( prevMarker )
565  m_view->Select( ToItem( prevMarker ) );
566 }
567 
568 
570 {
571  RC_TREE_NODE* currentNode = ToNode( m_view->GetCurrentItem() );
572 
573  while( currentNode && currentNode->m_Type != RC_TREE_NODE::MARKER )
574  currentNode = currentNode->m_Parent;
575 
576  RC_TREE_NODE* nextMarker = nullptr;
577  bool trigger = currentNode == nullptr;
578 
579  for( RC_TREE_NODE* candidate : m_tree )
580  {
581  if( candidate == currentNode )
582  {
583  trigger = true;
584  }
585  else if( trigger )
586  {
587  nextMarker = candidate;
588  break;
589  }
590  }
591 
592  if( nextMarker )
593  m_view->Select( ToItem( nextMarker ) );
594 }
595 
596 
597 void RC_TREE_MODEL::onSizeView( wxSizeEvent& aEvent )
598 {
599  int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
600 
601  if( m_view->GetColumnCount() > 0 )
602  m_view->GetColumn( 0 )->SetWidth( width );
603 
604  // Pass size event to other widgets
605  aEvent.Skip();
606 }
void DeleteItems(bool aCurrentOnly, bool aIncludeExclusions, bool aDeep)
Deletes the current item or all items.
Definition: rc_item.cpp:459
KIIDS m_ids
Definition: rc_item.h:172
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
void NextMarker()
Definition: rc_item.cpp:569
virtual void DeleteAllItems(bool aIncludeExclusions, bool aDeep)=0
KIID niluuid(0)
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:205
void SetProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: rc_item.cpp:292
Implementation of conversion functions that require both schematic and board internal units.
bool GetAttr(wxDataViewItem const &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
Called by the wxDataView to fetch an item's formatting.
Definition: rc_item.cpp:403
RC_TREE_NODE * m_Parent
Definition: rc_item.h:197
static KIID ToUUID(wxDataViewItem aItem)
Definition: rc_item.cpp:147
wxDataViewCtrl * m_view
Definition: rc_item.h:284
virtual SEVERITY GetSeverity(int aErrorCode) const
#define WX_DATAVIEW_WINDOW_PADDING
Definition: rc_item.cpp:35
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
virtual int GetCount(int aSeverity=-1) const =0
The base class for create windows for drawing purpose.
void DeleteCurrentItem(bool aDeep)
Definition: rc_item.cpp:453
void SetSeverities(int aSeverities)
Definition: rc_item.cpp:298
Provide an abstract interface of a RC_ITEM* list manager.
Definition: rc_item.h:45
void GetValue(wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
Called by the wxDataView to fetch an item's value.
Definition: rc_item.cpp:339
wxString GetErrorText() const
Definition: rc_item.h:145
std::vector< RC_TREE_NODE * > m_Children
Definition: rc_item.h:198
virtual wxString GetViolatingRuleDesc() const
Definition: rc_item.h:155
RC_ITEMS_PROVIDER * m_rcItemsProvider
Definition: rc_item.h:286
Definition: kiid.h:44
std::shared_ptr< RC_ITEM > m_RcItem
Definition: rc_item.h:195
void ExpandAll()
Definition: rc_item.cpp:304
void rebuildModel(RC_ITEMS_PROVIDER *aProvider, int aSeverities)
Definition: rc_item.cpp:197
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:210
static wxString ShowCoord(EDA_UNITS aUnits, const wxPoint &aPos)
Format a coordinate or position to text.
Definition: rc_item.cpp:47
KIID GetAuxItemID() const
Definition: rc_item.h:121
RC_TREE_MODEL(EDA_DRAW_FRAME *aParentFrame, wxDataViewCtrl *aView)
Definition: rc_item.cpp:176
Functions to provide common constants and other functions to assist in making a consistent UI.
#define _(s)
EDA_DRAW_FRAME * m_editFrame
Definition: rc_item.h:283
wxString m_errorMessage
A message describing the details of this specific error.
Definition: rc_item.h:167
bool IsExcluded() const
Definition: marker_base.h:94
void onSizeView(wxSizeEvent &aEvent)
Definition: rc_item.cpp:597
SEVERITY
void PrevMarker()
Definition: rc_item.cpp:548
virtual void SetSeverities(int aSeverities)=0
unsigned int GetChildren(wxDataViewItem const &aItem, wxDataViewItemArray &aChildren) const override
Definition: rc_item.cpp:326
virtual EDA_ITEM * GetItem(const KIID &aId) const
Fetch an item by KIID.
void AddItem(EDA_ITEM *aItem)
Definition: rc_item.cpp:55
const KIID m_Uuid
Definition: eda_item.h:475
NODE_TYPE m_Type
Definition: rc_item.h:194
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS
Definition: eda_units.h:38
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:288
virtual wxString ShowReport(EDA_UNITS aUnits, SEVERITY aSeverity, const std::map< KIID, EDA_ITEM * > &aItemMap) const
Translate this object into a text string suitable for saving to disk in a report.
Definition: rc_item.cpp:79
virtual std::shared_ptr< RC_ITEM > GetItem(int aIndex) const =0
Retrieve a RC_ITEM by index.
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:170
int m_severities
Definition: rc_item.h:285
void SetItems(const KIIDS &aIds)
Definition: rc_item.h:99
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:109
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
wxString GetSettingsKey() const
Definition: rc_item.h:150
KIID GetMainItemID() const
Definition: rc_item.h:120
void ValueChanged(const RC_TREE_NODE *aNode)
Definition: rc_item.cpp:436
bool IsContainer(wxDataViewItem const &aItem) const override
Definition: rc_item.cpp:311
wxDataViewItem GetParent(wxDataViewItem const &aItem) const override
Definition: rc_item.cpp:320
virtual wxString GetErrorMessage() const
Return the error message of a RC_ITEM.
Definition: rc_item.cpp:38
virtual void DeleteItem(int aIndex, bool aDeep)=0
Remove (and optionally deletes) the indexed item from the list.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103