KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2022 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 <rc_json_schema.h>
33#include <eda_item.h>
34#include <base_units.h>
35
36#define WX_DATAVIEW_WINDOW_PADDING 6
37
38
40{
41 if( m_errorMessage.IsEmpty() )
42 return GetErrorText();
43 else
44 return m_errorMessage;
45}
46
47
48static wxString showCoord( UNITS_PROVIDER* aUnitsProvider, const VECTOR2I& aPos )
49{
50 return wxString::Format( wxT( "@(%s, %s)" ),
51 aUnitsProvider->MessageTextFromValue( aPos.x ),
52 aUnitsProvider->MessageTextFromValue( aPos.y ) );
53}
54
55
57{
58 m_ids.push_back( aItem->m_Uuid );
59}
60
61
62void RC_ITEM::SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem,
63 const EDA_ITEM* cItem, const EDA_ITEM* dItem )
64{
65 m_ids.clear();
66
67 m_ids.push_back( aItem->m_Uuid );
68
69 if( bItem )
70 m_ids.push_back( bItem->m_Uuid );
71
72 if( cItem )
73 m_ids.push_back( cItem->m_Uuid );
74
75 if( dItem )
76 m_ids.push_back( dItem->m_Uuid );
77}
78
79
80wxString getSeverityString( SEVERITY aSeverity )
81{
82 wxString severity;
83
84 switch( aSeverity )
85 {
86 case RPT_SEVERITY_ERROR: severity = wxS( "error" ); break;
87 case RPT_SEVERITY_WARNING: severity = wxS( "warning" ); break;
88 case RPT_SEVERITY_ACTION: severity = wxS( "action" ); break;
89 case RPT_SEVERITY_INFO: severity = wxS( "info" ); break;
90 case RPT_SEVERITY_EXCLUSION: severity = wxS( "exclusion" ); break;
91 case RPT_SEVERITY_DEBUG: severity = wxS( "debug" ); break;
92 default:;
93 };
94
95 return severity;
96}
97
98
99wxString RC_ITEM::ShowReport( UNITS_PROVIDER* aUnitsProvider, SEVERITY aSeverity,
100 const std::map<KIID, EDA_ITEM*>& aItemMap ) const
101{
102 wxString severity = getSeverityString( aSeverity );
103
104 if( m_parent && m_parent->IsExcluded() )
105 severity += wxT( " (excluded)" );
106
107 EDA_ITEM* mainItem = nullptr;
108 EDA_ITEM* auxItem = nullptr;
109
110 auto ii = aItemMap.find( GetMainItemID() );
111
112 if( ii != aItemMap.end() )
113 mainItem = ii->second;
114
115 ii = aItemMap.find( GetAuxItemID() );
116
117 if( ii != aItemMap.end() )
118 auxItem = ii->second;
119
120 // Note: some customers machine-process these. So:
121 // 1) don't translate
122 // 2) try not to re-order or change syntax
123 // 3) report settings key (which should be more stable) in addition to message
124
125 if( mainItem && auxItem )
126 {
127 return wxString::Format( wxT( "[%s]: %s\n %s; %s\n %s: %s\n %s: %s\n" ),
131 severity,
132 showCoord( aUnitsProvider, mainItem->GetPosition()),
133 mainItem->GetItemDescription( aUnitsProvider ),
134 showCoord( aUnitsProvider, auxItem->GetPosition()),
135 auxItem->GetItemDescription( aUnitsProvider ) );
136 }
137 else if( mainItem )
138 {
139 return wxString::Format( wxT( "[%s]: %s\n %s; %s\n %s: %s\n" ),
143 severity,
144 showCoord( aUnitsProvider, mainItem->GetPosition()),
145 mainItem->GetItemDescription( aUnitsProvider ) );
146 }
147 else
148 {
149 return wxString::Format( wxT( "[%s]: %s\n %s; %s\n" ),
153 severity );
154 }
155}
156
157
159 SEVERITY aSeverity,
160 const std::map<KIID, EDA_ITEM*>& aItemMap ) const
161{
162 wxString severity = getSeverityString( aSeverity );
163
164 aViolation.severity = severity;
165 aViolation.description = GetErrorMessage();
166 aViolation.type = GetSettingsKey();
167
168 EDA_ITEM* mainItem = nullptr;
169 EDA_ITEM* auxItem = nullptr;
170
171 auto ii = aItemMap.find( GetMainItemID() );
172
173 if( ii != aItemMap.end() )
174 mainItem = ii->second;
175
176 ii = aItemMap.find( GetAuxItemID() );
177
178 if( ii != aItemMap.end() )
179 auxItem = ii->second;
180
181 if( mainItem )
182 {
184 item.description = mainItem->GetItemDescription( aUnitsProvider );
185 item.uuid = mainItem->m_Uuid.AsString();
186 item.pos.x = EDA_UNIT_UTILS::UI::ToUserUnit( aUnitsProvider->GetIuScale(),
187 aUnitsProvider->GetUserUnits(),
188 mainItem->GetPosition().x );
189 item.pos.y = EDA_UNIT_UTILS::UI::ToUserUnit( aUnitsProvider->GetIuScale(),
190 aUnitsProvider->GetUserUnits(),
191 mainItem->GetPosition().y );
192 aViolation.items.emplace_back( item );
193 }
194
195 if( auxItem )
196 {
198 item.description = auxItem->GetItemDescription( aUnitsProvider );
199 item.uuid = auxItem->m_Uuid.AsString();
200 item.pos.x = EDA_UNIT_UTILS::UI::ToUserUnit( aUnitsProvider->GetIuScale(),
201 aUnitsProvider->GetUserUnits(),
202 auxItem->GetPosition().x );
203 item.pos.y = EDA_UNIT_UTILS::UI::ToUserUnit( aUnitsProvider->GetIuScale(),
204 aUnitsProvider->GetUserUnits(),
205 auxItem->GetPosition().y );
206 aViolation.items.emplace_back( item );
207 }
208}
209
210
211KIID RC_TREE_MODEL::ToUUID( wxDataViewItem aItem )
212{
213 const RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aItem );
214
215 if( node && node->m_RcItem )
216 {
217 const std::shared_ptr<RC_ITEM> rc_item = node->m_RcItem;
218
219 switch( node->m_Type )
220 {
222 // rc_item->GetParent() can be null, if the parent is not existing
223 // when a RC item has no corresponding ERC/DRC marker
224 if( rc_item->GetParent() )
225 return rc_item->GetParent()->GetUUID();
226
227 break;
228
229 case RC_TREE_NODE::MAIN_ITEM: return rc_item->GetMainItemID();
230 case RC_TREE_NODE::AUX_ITEM: return rc_item->GetAuxItemID();
231 case RC_TREE_NODE::AUX_ITEM2: return rc_item->GetAuxItem2ID();
232 case RC_TREE_NODE::AUX_ITEM3: return rc_item->GetAuxItem3ID();
233 }
234 }
235
236 return niluuid;
237}
238
239
240RC_TREE_MODEL::RC_TREE_MODEL( EDA_DRAW_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
241 m_editFrame( aParentFrame ),
242 m_view( aView ),
243 m_severities( 0 ),
244 m_rcItemsProvider( nullptr )
245{
246 m_view->GetMainWindow()->Connect( wxEVT_SIZE, wxSizeEventHandler( RC_TREE_MODEL::onSizeView ),
247 nullptr, this );
248}
249
250
252{
253 for( RC_TREE_NODE* topLevelNode : m_tree )
254 delete topLevelNode;
255}
256
257
258void RC_TREE_MODEL::rebuildModel( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider, int aSeverities )
259{
260 wxWindowUpdateLocker updateLock( m_view );
261
262 std::shared_ptr<RC_ITEM> selectedRcItem = nullptr;
263
264 if( m_view )
265 {
266 RC_TREE_NODE* selectedNode = ToNode( m_view->GetSelection() );
267 selectedRcItem = selectedNode ? selectedNode->m_RcItem : nullptr;
268
269 // Even with the updateLock, wxWidgets sometimes ties its knickers in a knot trying
270 // to run a wxdataview_selection_changed_callback() on a row that has been deleted.
271 m_view->UnselectAll();
272 }
273
274 BeforeReset();
275
276 m_rcItemsProvider = aProvider;
277
278 if( aSeverities != m_severities )
279 m_severities = aSeverities;
280
282 m_rcItemsProvider->SetSeverities( m_severities );
283
284 for( RC_TREE_NODE* topLevelNode : m_tree )
285 delete topLevelNode;
286
287 m_tree.clear();
288
289 // wxDataView::ExpandAll() pukes with large lists
290 int count = 0;
291
293 count = std::min( 1000, m_rcItemsProvider->GetCount() );
294
295 for( int i = 0; i < count; ++i )
296 {
297 std::shared_ptr<RC_ITEM> rcItem = m_rcItemsProvider->GetItem( i );
298
299 m_tree.push_back( new RC_TREE_NODE( nullptr, rcItem, RC_TREE_NODE::MARKER ) );
300 RC_TREE_NODE* n = m_tree.back();
301
302 if( rcItem->GetMainItemID() != niluuid )
303 n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::MAIN_ITEM ) );
304
305 if( rcItem->GetAuxItemID() != niluuid )
306 n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM ) );
307
308 if( rcItem->GetAuxItem2ID() != niluuid )
309 n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM2 ) );
310
311 if( rcItem->GetAuxItem3ID() != niluuid )
312 n->m_Children.push_back( new RC_TREE_NODE( n, rcItem, RC_TREE_NODE::AUX_ITEM3 ) );
313 }
314
315 // Must be called after a significant change of items to force the
316 // wxDataViewModel to reread all of them, repopulating itself entirely.
317 AfterReset();
318
319#ifdef __WXGTK__
320 // The fastest method to update wxDataViewCtrl is to rebuild from
321 // scratch by calling Cleared(). Linux requires to reassociate model to
322 // display data, but Windows will create multiple associations.
323 // On MacOS, this crashes KiCad. See https://gitlab.com/kicad/code/kicad/-/issues/3666
324 // and https://gitlab.com/kicad/code/kicad/-/issues/3653
325 m_view->AssociateModel( this );
326#endif
327
328 m_view->ClearColumns();
329 int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
330 m_view->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, width );
331
332 ExpandAll();
333
334 // Most annoyingly wxWidgets won't tell us the scroll position (and no, all the usual
335 // routines don't work), so we can only restore the scroll position based on a selection.
336 if( selectedRcItem )
337 {
338 for( RC_TREE_NODE* candidate : m_tree )
339 {
340 if( candidate->m_RcItem == selectedRcItem )
341 {
342 m_view->Select( ToItem( candidate ) );
343 m_view->EnsureVisible( ToItem( candidate ) );
344 break;
345 }
346 }
347 }
348}
349
350
351void RC_TREE_MODEL::Update( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider, int aSeverities )
352{
353 rebuildModel( aProvider, aSeverities );
354}
355
356
358{
359 for( RC_TREE_NODE* topLevelNode : m_tree )
360 m_view->Expand( ToItem( topLevelNode ) );
361}
362
363
364bool RC_TREE_MODEL::IsContainer( wxDataViewItem const& aItem ) const
365{
366 if( ToNode( aItem ) == nullptr ) // must be tree root...
367 return true;
368 else
369 return ToNode( aItem )->m_Type == RC_TREE_NODE::MARKER;
370}
371
372
373wxDataViewItem RC_TREE_MODEL::GetParent( wxDataViewItem const& aItem ) const
374{
375 return ToItem( ToNode( aItem)->m_Parent );
376}
377
378
379unsigned int RC_TREE_MODEL::GetChildren( wxDataViewItem const& aItem,
380 wxDataViewItemArray& aChildren ) const
381{
382 const RC_TREE_NODE* node = ToNode( aItem );
383 const std::vector<RC_TREE_NODE*>& children = node ? node->m_Children : m_tree;
384
385 for( const RC_TREE_NODE* child: children )
386 aChildren.push_back( ToItem( child ) );
387
388 return children.size();
389}
390
391
392void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
393 wxDataViewItem const& aItem,
394 unsigned int aCol ) const
395{
396 const RC_TREE_NODE* node = ToNode( aItem );
397 const std::shared_ptr<RC_ITEM> rcItem = node->m_RcItem;
398 MARKER_BASE* marker = rcItem->GetParent();
399 EDA_ITEM* item = nullptr;
400 wxString msg;
401
402 switch( node->m_Type )
403 {
405 if( marker )
406 {
407 SEVERITY severity = marker->GetSeverity();
408
409 if( severity == RPT_SEVERITY_EXCLUSION )
410 {
411 if( m_editFrame->GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING )
412 msg = _( "Excluded warning: " );
413 else
414 msg = _( "Excluded error: " );
415 }
416 else if( severity == RPT_SEVERITY_WARNING )
417 {
418 msg = _( "Warning: " );
419 }
420 else
421 {
422 msg = _( "Error: " );
423 }
424 }
425
426 msg += rcItem->GetErrorMessage();
427 break;
428
430 if( marker && marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
431 msg = _( "Drawing Sheet" );
432 else
433 item = m_editFrame->GetItem( rcItem->GetMainItemID() );
434
435 break;
436
438 item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
439 break;
440
442 item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() );
443 break;
444
446 item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() );
447 break;
448 }
449
450 if( item )
451 msg += item->GetItemDescription( m_editFrame );
452
453 msg.Replace( wxS( "\n" ), wxS( " " ) );
454 aVariant = msg;
455}
456
457
458bool RC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
459 unsigned int aCol,
460 wxDataViewItemAttr& aAttr ) const
461{
462 const RC_TREE_NODE* node = ToNode( aItem );
463 wxASSERT( node );
464
465 bool ret = false;
466 bool heading = node->m_Type == RC_TREE_NODE::MARKER;
467
468 if( heading )
469 {
470 aAttr.SetBold( true );
471 ret = true;
472 }
473
474 if( node->m_RcItem->GetParent()
475 && node->m_RcItem->GetParent()->GetSeverity() == RPT_SEVERITY_EXCLUSION )
476 {
477 wxColour textColour = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT );
478 double brightness = KIGFX::COLOR4D( textColour ).GetBrightness();
479
480 if( brightness > 0.5 )
481 {
482 int lightness = static_cast<int>( brightness * ( heading ? 50 : 60 ) );
483 aAttr.SetColour( textColour.ChangeLightness( lightness ) );
484 }
485 else
486 {
487 aAttr.SetColour( textColour.ChangeLightness( heading ? 170 : 165 ) );
488 }
489
490 aAttr.SetItalic( true ); // Strikethrough would be better, if wxWidgets supported it
491 ret = true;
492 }
493
494 return ret;
495}
496
497
499{
501 {
502 ValueChanged( aNode->m_Parent );
503 }
504
505 if( aNode->m_Type == RC_TREE_NODE::MARKER )
506 {
507 wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
508
509 for( const RC_TREE_NODE* child : aNode->m_Children )
510 wxDataViewModel::ValueChanged( ToItem( child ), 0 );
511 }
512}
513
514
516{
517 DeleteItems( true, true, aDeep );
518}
519
520
521void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep )
522{
523 RC_TREE_NODE* current_node = m_view ? ToNode( m_view->GetCurrentItem() ) : nullptr;
524 const std::shared_ptr<RC_ITEM> current_item = current_node ? current_node->m_RcItem : nullptr;
525
527 std::vector<RC_TREE_NODE*> to_delete;
528
529 if( aCurrentOnly && !current_item )
530 {
531 wxBell();
532 return;
533 }
534
535 int lastGood = -1;
536 bool itemDeleted = false;
537
538 if( m_view )
539 {
540 m_view->UnselectAll();
541 wxSafeYield();
542 m_view->Freeze();
543 }
544
545 if( !m_rcItemsProvider )
546 return;
547
548 for( int i = m_rcItemsProvider->GetCount() - 1; i >= 0; --i )
549 {
550 std::shared_ptr<RC_ITEM> rcItem = m_rcItemsProvider->GetItem( i );
551 MARKER_BASE* marker = rcItem->GetParent();
552 bool excluded = false;
553
554 if( marker && marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
555 excluded = true;
556
557 if( aCurrentOnly && itemDeleted && lastGood >= 0 )
558 break;
559
560 if( aCurrentOnly && rcItem != current_item )
561 {
562 lastGood = i;
563 continue;
564 }
565
566 if( excluded && !aIncludeExclusions )
567 continue;
568
569 if( i < (int) m_tree.size() ) // Careful; tree is truncated for large datasets
570 {
571 wxDataViewItem markerItem = ToItem( m_tree[i] );
572 wxDataViewItemArray childItems;
573 wxDataViewItem parentItem = ToItem( m_tree[i]->m_Parent );
574
575 for( RC_TREE_NODE* child : m_tree[i]->m_Children )
576 {
577 childItems.push_back( ToItem( child ) );
578 to_delete.push_back( child );
579 }
580
581 m_tree[i]->m_Children.clear();
582 ItemsDeleted( markerItem, childItems );
583
584 to_delete.push_back( m_tree[i] );
585 m_tree.erase( m_tree.begin() + i );
586 ItemDeleted( parentItem, markerItem );
587 }
588
589 // Only deep delete the current item here; others will be done by the caller, which
590 // can more efficiently delete all markers on the board.
591 m_rcItemsProvider->DeleteItem( i, aDeep && aCurrentOnly );
592
593 if( lastGood > i )
594 lastGood--;
595
596 itemDeleted = true;
597 }
598
599 if( m_view && aCurrentOnly && lastGood >= 0 )
600 m_view->Select( ToItem( m_tree[ lastGood ] ) );
601
602 for( RC_TREE_NODE* item : to_delete )
603 delete( item );
604
605 if( m_view )
606 m_view->Thaw();
607}
608
609
611{
612 RC_TREE_NODE* currentNode = ToNode( m_view->GetCurrentItem() );
613 RC_TREE_NODE* prevMarker = nullptr;
614
615 while( currentNode && currentNode->m_Type != RC_TREE_NODE::MARKER )
616 currentNode = currentNode->m_Parent;
617
618 for( RC_TREE_NODE* candidate : m_tree )
619 {
620 if( candidate == currentNode )
621 break;
622 else
623 prevMarker = candidate;
624 }
625
626 if( prevMarker )
627 m_view->Select( ToItem( prevMarker ) );
628}
629
630
632{
633 RC_TREE_NODE* currentNode = ToNode( m_view->GetCurrentItem() );
634
635 while( currentNode && currentNode->m_Type != RC_TREE_NODE::MARKER )
636 currentNode = currentNode->m_Parent;
637
638 RC_TREE_NODE* nextMarker = nullptr;
639 bool trigger = currentNode == nullptr;
640
641 for( RC_TREE_NODE* candidate : m_tree )
642 {
643 if( candidate == currentNode )
644 {
645 trigger = true;
646 }
647 else if( trigger )
648 {
649 nextMarker = candidate;
650 break;
651 }
652 }
653
654 if( nextMarker )
655 m_view->Select( ToItem( nextMarker ) );
656}
657
658
660{
661 for( RC_TREE_NODE* candidate : m_tree )
662 {
663 if( candidate->m_RcItem->GetParent() == aMarker )
664 {
665 m_view->Select( ToItem( candidate ) );
666 return;
667 }
668 }
669}
670
671
673{
674 for( RC_TREE_NODE* candidate : m_tree )
675 {
676 if( candidate->m_RcItem->GetParent() == aMarker )
677 {
678 m_view->EnsureVisible( ToItem( candidate ) );
679 return;
680 }
681 }
682}
683
684
685void RC_TREE_MODEL::onSizeView( wxSizeEvent& aEvent )
686{
687 int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
688
689 if( m_view->GetColumnCount() > 0 )
690 m_view->GetColumn( 0 )->SetWidth( width );
691
692 // Pass size event to other widgets
693 aEvent.Skip();
694}
virtual SEVERITY GetSeverity(int aErrorCode) const
The base class for create windows for drawing purpose.
virtual EDA_ITEM * GetItem(const KIID &aId) const
Fetch an item by KIID.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:239
const KIID m_Uuid
Definition: eda_item.h:482
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const
Return a user-visible description string of this item.
Definition: eda_item.cpp:108
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
double GetBrightness() const
Returns the brightness value of the color ranged from 0.0 to 1.0.
Definition: color4d.h:333
Definition: kiid.h:49
wxString AsString() const
Definition: kiid.cpp:257
virtual SEVERITY GetSeverity() const
Definition: marker_base.h:100
bool IsExcluded() const
Definition: marker_base.h:97
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:95
@ MARKER_DRAWING_SHEET
Definition: marker_base.h:55
virtual void GetJsonViolation(RC_JSON::VIOLATION &aViolation, UNITS_PROVIDER *aUnitsProvider, SEVERITY aSeverity, const std::map< KIID, EDA_ITEM * > &aItemMap) const
Translate this object into an RC_JSON::VIOLATION object.
Definition: rc_item.cpp:158
void AddItem(EDA_ITEM *aItem)
Definition: rc_item.cpp:56
MARKER_BASE * m_parent
The marker this item belongs to, if any.
Definition: rc_item.h:186
KIIDS m_ids
Definition: rc_item.h:188
virtual KIID GetMainItemID() const
Definition: rc_item.h:121
virtual KIID GetAuxItemID() const
Definition: rc_item.h:122
wxString GetErrorText() const
Definition: rc_item.h:166
virtual wxString ShowReport(UNITS_PROVIDER *aUnitsProvider, 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:99
virtual wxString GetErrorMessage() const
Definition: rc_item.cpp:39
wxString m_errorMessage
A message describing the details of this specific error.
Definition: rc_item.h:183
wxString GetSettingsKey() const
Definition: rc_item.h:171
virtual wxString GetViolatingRuleDesc() const
Definition: rc_item.h:176
void SetItems(const KIIDS &aIds)
Definition: rc_item.h:103
void ExpandAll()
Definition: rc_item.cpp:357
void PrevMarker()
Definition: rc_item.cpp:610
void onSizeView(wxSizeEvent &aEvent)
Definition: rc_item.cpp:685
int m_severities
Definition: rc_item.h:298
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:392
std::vector< RC_TREE_NODE * > m_tree
Definition: rc_item.h:301
unsigned int GetChildren(wxDataViewItem const &aItem, wxDataViewItemArray &aChildren) const override
Definition: rc_item.cpp:379
EDA_DRAW_FRAME * m_editFrame
Definition: rc_item.h:296
static wxDataViewItem ToItem(RC_TREE_NODE const *aNode)
Definition: rc_item.h:221
void SelectMarker(const MARKER_BASE *aMarker)
Definition: rc_item.cpp:659
RC_TREE_MODEL(EDA_DRAW_FRAME *aParentFrame, wxDataViewCtrl *aView)
Definition: rc_item.cpp:240
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:226
void Update(std::shared_ptr< RC_ITEMS_PROVIDER > aProvider, int aSeverities)
Definition: rc_item.cpp:351
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:458
void DeleteItems(bool aCurrentOnly, bool aIncludeExclusions, bool aDeep)
Deletes the current item or all items.
Definition: rc_item.cpp:521
void DeleteCurrentItem(bool aDeep)
Definition: rc_item.cpp:515
wxDataViewItem GetParent(wxDataViewItem const &aItem) const override
Definition: rc_item.cpp:373
void CenterMarker(const MARKER_BASE *aMarker)
Definition: rc_item.cpp:672
static KIID ToUUID(wxDataViewItem aItem)
Definition: rc_item.cpp:211
wxDataViewCtrl * m_view
Definition: rc_item.h:297
std::shared_ptr< RC_ITEMS_PROVIDER > m_rcItemsProvider
Definition: rc_item.h:299
void NextMarker()
Definition: rc_item.cpp:631
void ValueChanged(const RC_TREE_NODE *aNode)
Definition: rc_item.cpp:498
bool IsContainer(wxDataViewItem const &aItem) const override
Definition: rc_item.cpp:364
void rebuildModel(std::shared_ptr< RC_ITEMS_PROVIDER > aProvider, int aSeverities)
Definition: rc_item.cpp:258
std::shared_ptr< RC_ITEM > m_RcItem
Definition: rc_item.h:211
RC_TREE_NODE * m_Parent
Definition: rc_item.h:213
std::vector< RC_TREE_NODE * > m_Children
Definition: rc_item.h:214
NODE_TYPE m_Type
Definition: rc_item.h:210
const EDA_IU_SCALE & GetIuScale() const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
EDA_UNITS GetUserUnits() const
#define _(s)
KIID niluuid(0)
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: eda_units.cpp:190
static wxString showCoord(UNITS_PROVIDER *aUnitsProvider, const VECTOR2I &aPos)
Definition: rc_item.cpp:48
wxString getSeverityString(SEVERITY aSeverity)
Definition: rc_item.cpp:80
#define WX_DATAVIEW_WINDOW_PADDING
Definition: rc_item.cpp:36
SEVERITY
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_EXCLUSION
@ RPT_SEVERITY_DEBUG
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
std::vector< AFFECTED_ITEM > items
Functions to provide common constants and other functions to assist in making a consistent UI.