KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ee_inspection_tool.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) 2019-2023 CERN
5 * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <sch_symbol.h>
26#include <id.h>
27#include <kiway.h>
28#include <kiplatform/ui.h>
29#include <confirm.h>
30#include <string_utils.h>
34#include <tools/ee_actions.h>
37#include <tools/ee_selection.h>
38#include <sim/simulator_frame.h>
39#include <sch_edit_frame.h>
40#include <symbol_edit_frame.h>
41#include <symbol_viewer_frame.h>
42#include <eda_doc.h>
43#include <sch_marker.h>
44#include <project.h>
45#include <project_sch.h>
47#include <dialogs/dialog_erc.h>
51#include <math/util.h> // for KiROUND
52
53
55 EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.InspectionTool" ), m_busSyntaxHelp( nullptr )
56{
57}
58
59
61{
63
64 // Add inspection actions to the selection tool menu
65 //
67
69
72
73 return true;
74}
75
76
78{
79 EE_TOOL_BASE::Reset( aReason );
80
81 if( aReason == SUPERMODEL_RELOAD )
82 {
83 wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_CLOSE_ERC_DIALOG, wxID_ANY );
84
85 wxQueueEvent( m_frame, evt );
86 }
87}
88
89
91{
93 return 0;
94}
95
96
98{
99 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
100
101 wxCHECK( frame, /* void */ );
102
103 DIALOG_ERC* dlg = frame->GetErcDialog();
104
105 wxCHECK( dlg, /* void */ );
106
107 // Needed at least on Windows. Raise() is not enough
108 dlg->Show( true );
109
110 // Bring it to the top if already open. Dual monitor users need this.
111 dlg->Raise();
112
113 KIPLATFORM::UI::ForceFocus( dlg->FindWindow( wxID_OK ) );
114}
115
116
118{
119 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
120
121 wxCHECK( frame, 0 );
122
123 DIALOG_ERC* dlg = frame->GetErcDialog();
124
125 if( dlg )
126 {
127 dlg->Show( true );
128 dlg->Raise();
129 dlg->PrevMarker();
130 }
131
132 return 0;
133}
134
135
137{
138 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
139
140 wxCHECK( frame, 0 );
141
142 DIALOG_ERC* dlg = frame->GetErcDialog();
143
144 wxCHECK( dlg, 0 );
145
146 dlg->Show( true );
147 dlg->Raise();
148 dlg->NextMarker();
149
150 return 0;
151}
152
153
155{
157
158 wxCHECK( selectionTool, 0 );
159
160 EE_SELECTION& selection = selectionTool->GetSelection();
161
162 if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
163 {
164 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
165 DIALOG_ERC* dlg = frame ? frame->GetErcDialog() : nullptr;
166
167 if( dlg && dlg->IsShownOnScreen() )
168 dlg->SelectMarker( static_cast<SCH_MARKER*>( selection.Front() ) );
169 }
170
171 // Show the item info on a left click on this item
172 UpdateMessagePanel( aEvent );
173
174 return 0;
175}
176
177
179{
180 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
181
182 wxCHECK( frame, /* void */ );
183
184 DIALOG_ERC* dlg = frame->GetErcDialog();
185
186 if( dlg )
187 {
188 if( !dlg->IsShownOnScreen() )
189 {
190 dlg->Show( true );
191 dlg->Raise();
192 }
193
194 dlg->SelectMarker( aMarker );
195 }
196}
197
198
199wxString EE_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr<RC_ITEM>& aERCItem )
200{
201 auto menuDescription =
202 [&]( const TOOL_ACTION& aAction )
203 {
204 wxString menuItemLabel = aAction.GetMenuLabel();
205 wxMenuBar* menuBar = m_frame->GetMenuBar();
206
207 for( size_t ii = 0; ii < menuBar->GetMenuCount(); ++ii )
208 {
209 for( wxMenuItem* menuItem : menuBar->GetMenu( ii )->GetMenuItems() )
210 {
211 if( menuItem->GetItemLabelText() == menuItemLabel )
212 {
213 wxString menuTitleLabel = menuBar->GetMenuLabelText( ii );
214
215 menuTitleLabel.Replace( wxS( "&" ), wxS( "&&" ) );
216 menuItemLabel.Replace( wxS( "&" ), wxS( "&&" ) );
217
218 return wxString::Format( _( "Run %s > %s" ),
219 menuTitleLabel,
220 menuItemLabel );
221 }
222 }
223 }
224
225 return wxString::Format( _( "Run %s" ), aAction.GetFriendlyName() );
226 };
227
228 if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
229 {
230 return menuDescription( EE_ACTIONS::showBusSyntaxHelp );
231 }
232 else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
233 {
234 return menuDescription( EE_ACTIONS::diffSymbol );
235 }
236
237 return wxEmptyString;
238}
239
240
241void EE_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCItem )
242{
243 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
244
245 wxCHECK( frame, /* void */ );
246
247 EDA_ITEM* a = frame->GetItem( aERCItem->GetMainItemID() );
248
249 if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
250 {
252 }
253 else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
254 {
255 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( a ) )
256 DiffSymbol( symbol );
257 }
258}
259
260
262{
264 EE_SELECTION& selection = selTool->GetSelection();
265 SCH_MARKER* marker = nullptr;
266
267 if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
268 marker = static_cast<SCH_MARKER*>( selection.Front() );
269
270 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
271
272 wxCHECK( frame, 0 );
273
274 DIALOG_ERC* dlg = frame->GetErcDialog();
275
276 wxCHECK( dlg, 0 );
277
278 // Let the ERC dialog handle it since it has more update hassles to worry about
279 // Note that if marker is nullptr the dialog will exclude whichever marker is selected
280 // in the dialog itself
281 dlg->ExcludeMarker( marker );
282
283 if( marker != nullptr )
284 {
285 marker->SetExcluded( true );
286 m_frame->GetCanvas()->GetView()->Update( marker );
288 m_frame->OnModify();
289 }
290
291 return 0;
292}
293
294
295extern void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
296 int aGridForPins, UNITS_PROVIDER* aUnitsProvider );
297
299{
300 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
301
302 if( !symbol )
303 return 0;
304
305 std::vector<wxString> messages;
306 const int grid_size = KiROUND( getView()->GetGAL()->GetGridSize().x );
307
308 CheckLibSymbol( symbol, messages, grid_size, m_frame );
309
310 if( messages.empty() )
311 {
312 DisplayInfoMessage( m_frame, _( "No symbol issues found." ) );
313 }
314 else
315 {
316 HTML_MESSAGE_BOX dlg( m_frame, _( "Symbol Warnings" ) );
317
318 for( const wxString& single_msg : messages )
319 dlg.AddHTML_Text( single_msg );
320
321 dlg.ShowModal();
322 }
323
324 return 0;
325}
326
327
329{
330 if( m_busSyntaxHelp )
331 {
332 m_busSyntaxHelp->Raise();
333 m_busSyntaxHelp->Show( true );
334 return 0;
335 }
336
338 return 0;
339}
340
341
343{
344 SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
345
346 wxCHECK( schEditorFrame, 0 );
347
349
350 if( selection.Empty() )
351 {
352 m_frame->ShowInfoBarError( _( "Select a symbol to diff against its library equivalent." ) );
353 return 0;
354 }
355
356 DiffSymbol( static_cast<SCH_SYMBOL*>( selection.Front() ) );
357 return 0;
358}
359
360
362{
363 SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
364
365 wxCHECK( schEditorFrame, /* void */ );
366
367 DIALOG_BOOK_REPORTER* dialog = schEditorFrame->GetSymbolDiffDialog();
368
369 wxCHECK( dialog, /* void */ );
370
371 dialog->DeleteAllPages();
372
373 wxString symbolDesc = wxString::Format( _( "Symbol %s" ),
374 symbol->GetField( REFERENCE_FIELD )->GetText() );
375 LIB_ID libId = symbol->GetLibId();
376 wxString libName = libId.GetLibNickname();
377 wxString symbolName = libId.GetLibItemName();
378
379 WX_HTML_REPORT_BOX* r = dialog->AddHTMLPage( _( "Summary" ) );
380
381 r->Report( wxS( "<h7>" ) + _( "Schematic vs library diff for:" ) + wxS( "</h7>" ) );
382 r->Report( wxS( "<ul><li>" ) + EscapeHTML( symbolDesc ) + wxS( "</li>" )
383 + wxS( "<li>" ) + _( "Library: " ) + EscapeHTML( libName ) + wxS( "</li>" )
384 + wxS( "<li>" ) + _( "Library item: " ) + EscapeHTML( symbolName )
385 + wxS( "</li></ul>" ) );
386
387 r->Report( "" );
388
390 const LIB_TABLE_ROW* libTableRow = libTable->FindRow( libName );
391
392 if( !libTableRow )
393 {
394 r->Report( _( "The library is not included in the current configuration." )
395 + wxS( "&nbsp;&nbsp;&nbsp" )
396 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
397 }
398 else if( !libTable->HasLibrary( libName, true ) )
399 {
400 r->Report( _( "The library is not enabled in the current configuration." )
401 + wxS( "&nbsp;&nbsp;&nbsp" )
402 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
403 }
404 else
405 {
406 std::unique_ptr<LIB_SYMBOL> flattenedLibSymbol;
407 std::unique_ptr<LIB_SYMBOL> flattenedSchSymbol = symbol->GetLibSymbolRef()->Flatten();
408
409 try
410 {
411 if( LIB_SYMBOL* libAlias = libTable->LoadSymbol( libName, symbolName ) )
412 flattenedLibSymbol = libAlias->Flatten();
413 }
414 catch( const IO_ERROR& )
415 {
416 }
417
418 if( !flattenedLibSymbol )
419 {
420 r->Report( wxString::Format( _( "The library no longer contains the item %s." ),
421 symbolName ) );
422 }
423 else
424 {
425 std::vector<SCH_FIELD> fields;
426
427 for( SCH_FIELD& field : symbol->GetFields() )
428 {
429 fields.emplace_back( SCH_FIELD( flattenedLibSymbol.get(), field.GetId(),
430 field.GetName( false ) ) );
431 fields.back().CopyText( field );
432 fields.back().SetAttributes( field );
433 fields.back().Move( -symbol->GetPosition() );
434 }
435
436 flattenedSchSymbol->SetFields( fields );
437
438 if( flattenedSchSymbol->Compare( *flattenedLibSymbol, SCH_ITEM::COMPARE_FLAGS::ERC,
439 r ) == 0 )
440 {
441 r->Report( _( "No relevant differences detected." ) );
442 }
443
444 wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) );
445 SYMBOL_DIFF_WIDGET* diff = constructDiffPanel( panel );
446
447 diff->DisplayDiff( flattenedSchSymbol.release(), flattenedLibSymbol.release(),
448 symbol->GetUnit(), symbol->GetBodyStyle() );
449 }
450 }
451
452 r->Flush();
453
454 dialog->Raise();
455 dialog->Show( true );
456}
457
458
460{
461 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
462
464 SYMBOL_DIFF_WIDGET* diffWidget = new SYMBOL_DIFF_WIDGET( aParentPanel, backend );
465
466 sizer->Add( diffWidget, 1, wxEXPAND | wxALL, 5 );
467 aParentPanel->SetSizer( sizer );
468 aParentPanel->Layout();
469
470 return diffWidget;
471}
472
473
475{
477
478 if( !simFrame )
479 return -1;
480
481 if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() )
482 blocking_win->Close( true );
483
484 simFrame->Show( true );
485
486 // On Windows, Raise() does not bring the window on screen, when iconized
487 if( simFrame->IsIconized() )
488 simFrame->Iconize( false );
489
490 simFrame->Raise();
491
492 return 0;
493}
494
495
497{
498 wxString datasheet;
499
501 {
502 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
503
504 if( !symbol )
505 return 0;
506
507 datasheet = symbol->GetDatasheetField().GetText();
508 }
509 else if( m_frame->IsType( FRAME_SCH_VIEWER ) )
510 {
511 LIB_SYMBOL* entry = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame )->GetSelectedSymbol();
512
513 if( !entry )
514 return 0;
515
517 }
518 else if( m_frame->IsType( FRAME_SCH ) )
519 {
521
522 if( selection.Empty() )
523 return 0;
524
525 SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
526 SCH_FIELD* field = symbol->GetField( DATASHEET_FIELD );
527
528 // Use GetShownText() to resolve any text variables, but don't allow adding extra text
529 // (ie: the field name)
530 datasheet = field->GetShownText( &symbol->Schematic()->CurrentSheet(), false );
531 }
532
533 if( datasheet.IsEmpty() || datasheet == wxS( "~" ) )
534 {
535 m_frame->ShowInfoBarError( _( "No datasheet defined." ) );
536 }
537 else
538 {
541 }
542
543 return 0;
544}
545
546
548{
549 SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
550 SCH_EDIT_FRAME* schEditFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
552 EE_SELECTION& selection = selTool->GetSelection();
553
554 // Note: the symbol viewer manages its own message panel
555
556 if( symbolEditFrame || schEditFrame )
557 {
558 if( selection.GetSize() == 1 )
559 {
560 EDA_ITEM* item = (EDA_ITEM*) selection.Front();
561
562 std::vector<MSG_PANEL_ITEM> msgItems;
563 item->GetMsgPanelInfo( m_frame, msgItems );
564 m_frame->SetMsgPanel( msgItems );
565 }
566 else
567 {
569 }
570 }
571
572 if( schEditFrame )
573 {
574 schEditFrame->UpdateNetHighlightStatus();
575 schEditFrame->UpdateHierarchySelection();
576 }
577
578 return 0;
579}
580
581
583{
587 // See note 1:
591
596
598
599 // Note 1: tUpdateMessagePanel is called by CrossProbe. So uncomment this line if
600 // call to CrossProbe is modifiied
601 // Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedEvent );
605}
606
607
static TOOL_ACTION excludeMarker
Definition: actions.h:112
static TOOL_ACTION nextMarker
Definition: actions.h:111
static TOOL_ACTION prevMarker
Definition: actions.h:110
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
wxPanel * AddBlankPage(const wxString &aTitle)
WX_HTML_REPORT_BOX * AddHTMLPage(const wxString &aTitle)
void ExcludeMarker(SCH_MARKER *aMarker=nullptr)
Exclude aMarker from the ERC list.
Definition: dialog_erc.cpp:942
void SelectMarker(const SCH_MARKER *aMarker)
Definition: dialog_erc.cpp:919
void PrevMarker()
Definition: dialog_erc.cpp:895
void NextMarker()
Definition: dialog_erc.cpp:907
bool Show(bool show) override
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
bool IsType(FRAME_T aType) const
virtual void ClearMsgPanel()
Clear all messages from the message panel.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: eda_item.h:202
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
static TOOL_ACTION runERC
Definition: ee_actions.h:151
static TOOL_ACTION showSimulator
Definition: ee_actions.h:278
static TOOL_ACTION diffSymbol
Definition: ee_actions.h:166
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:150
static TOOL_ACTION checkSymbol
Definition: ee_actions.h:165
static TOOL_ACTION showBusSyntaxHelp
Definition: ee_actions.h:167
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION SingleNonExcludedMarker
void InspectERCError(const std::shared_ptr< RC_ITEM > &aERCItem)
HTML_MESSAGE_BOX * m_busSyntaxHelp
int RunSimulation(const TOOL_EVENT &aEvent)
int NextMarker(const TOOL_EVENT &aEvent)
int DiffSymbol(const TOOL_EVENT &aEvent)
int PrevMarker(const TOOL_EVENT &aEvent)
wxString InspectERCErrorMenuText(const std::shared_ptr< RC_ITEM > &aERCItem)
int ShowDatasheet(const TOOL_EVENT &aEvent)
SYMBOL_DIFF_WIDGET * constructDiffPanel(wxPanel *aParentPanel)
This method is meant to be overridden in order to specify handlers for events.
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int ExcludeMarker(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
Display the selected item info (when clicking on a item)
int ShowBusSyntaxHelp(const TOOL_EVENT &aEvent)
bool Init() override
Init() is called once upon a registration of the tool.
int RunERC(const TOOL_EVENT &aEvent)
int CheckSymbol(const TOOL_EVENT &aEvent)
int CrossProbe(const TOOL_EVENT &aEvent)
Called when clicking on a item:
EE_SELECTION & RequestSelection(const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T }, bool aPromoteCellSelections=false)
Return either an existing selection (filtered), or the selection at the current cursor position if th...
EE_SELECTION & GetSelection()
A foundation class for a tool operating on a schematic or symbol.
Definition: ee_tool_base.h:48
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
Definition: ee_tool_base.h:84
EE_SELECTION_TOOL * m_selectionTool
Definition: ee_tool_base.h:200
bool Init() override
Init() is called once upon a registration of the tool.
Definition: ee_tool_base.h:64
static const TOOL_EVENT ClearedEvent
Definition: actions.h:266
static const TOOL_EVENT SelectedEvent
Definition: actions.h:264
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:271
static const TOOL_EVENT PointSelectedEvent
Definition: actions.h:263
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:265
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1631
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:55
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:669
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
Define a library symbol object.
Definition: lib_symbol.h:77
SCH_FIELD & GetDatasheetField() const
Return reference to the datasheet field.
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
Definition: marker_base.h:99
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
Definition: project_sch.cpp:41
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:143
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Schematic editor (Eeschema) main window.
EDA_ITEM * GetItem(const KIID &aId) const override
Fetch an item by KIID.
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
DIALOG_ERC * GetErcDialog()
void UpdateNetHighlightStatus()
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
Definition: sch_field.cpp:200
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:150
int GetBodyStyle() const
Definition: sch_item.h:232
int GetUnit() const
Definition: sch_item.h:229
Schematic symbol object.
Definition: sch_symbol.h:105
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:919
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:802
const LIB_ID & GetLibId() const override
Definition: sch_symbol.h:194
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:967
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:213
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Definition: sch_label.cpp:2212
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:100
EDA_ITEM * Front() const
Definition: selection.h:172
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:110
The SIMULATOR_FRAME holds the main user-interface for running simulations.
void DisplayDiff(LIB_SYMBOL *aSchSymbol, LIB_SYMBOL *aLibSymbol, int aUnit, int aConvert)
Set the currently displayed symbol.
The symbol library editor main window.
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
Symbol library viewer main window.
Represent a single user action.
Definition: tool_action.h:269
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:217
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
@ SUPERMODEL_RELOAD
For schematics, the entire schematic changed, not just the sheet.
Definition: tool_base.h:81
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
TOOL_MENU & GetToolMenu()
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
A slimmed down version of WX_HTML_REPORT_PANEL.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Flush()
Build the HTML messages page.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:222
This file is part of the common library.
#define _(s)
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths)
Open a document (file) with the suitable browser.
Definition: eda_doc.cpp:61
This file is part of the common library.
void CheckLibSymbol(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, int aGridForPins, UNITS_PROVIDER *aUnitsProvider)
Check a lib symbol to find incorrect settings Pins not on a valid grid Pins duplicated Conflict with ...
@ ERCE_BUS_TO_NET_CONFLICT
A bus wire is graphically connected to a net port/pin (or vice versa).
Definition: erc_settings.h:67
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
Definition: erc_settings.h:77
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_SIMULATOR
Definition: frame_type.h:38
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: wxgtk/ui.cpp:67
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
void CheckLibSymbol(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, int aGridForPins, UNITS_PROVIDER *aUnitsProvider)
Check a lib symbol to find incorrect settings Pins not on a valid grid Pins duplicated Conflict with ...
@ DATASHEET_FIELD
name of datasheet
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_MARKER_T
Definition: typeinfo.h:158
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:121