KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_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 The 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
27
28#include <sch_symbol.h>
29#include <id.h>
30#include <kiway.h>
31#include <kiplatform/ui.h>
32#include <confirm.h>
33#include <string_utils.h>
37#include <tools/sch_actions.h>
39#include <tools/sch_selection.h>
40#include <sim/simulator_frame.h>
41#include <sch_edit_frame.h>
42#include <symbol_edit_frame.h>
43#include <symbol_viewer_frame.h>
44#include <symbol_lib_table.h>
45#include <eda_doc.h>
46#include <sch_marker.h>
47#include <project.h>
48#include <project_sch.h>
50#include <dialogs/dialog_erc.h>
54#include <math/util.h> // for KiROUND
55
56
58 SCH_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.InspectionTool" ), m_busSyntaxHelp( nullptr )
59{
60}
61
62
64{
66
67 // Add inspection actions to the selection tool menu
68 //
69 CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
70
72
75
76 return true;
77}
78
79
81{
82 SCH_TOOL_BASE::Reset( aReason );
83
84 if( aReason == SUPERMODEL_RELOAD || aReason == RESET_REASON::SHUTDOWN )
85 {
86 wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_CLOSE_ERC_DIALOG, wxID_ANY );
87
88 wxQueueEvent( m_frame, evt );
89 }
90}
91
92
94{
96 return 0;
97}
98
99
101{
102 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
103
104 wxCHECK( frame, /* void */ );
105
106 DIALOG_ERC* dlg = frame->GetErcDialog();
107
108 wxCHECK( dlg, /* void */ );
109
110 // Needed at least on Windows. Raise() is not enough
111 dlg->Show( true );
112
113 // Bring it to the top if already open. Dual monitor users need this.
114 dlg->Raise();
115
116 if( wxButton* okButton = dynamic_cast<wxButton*>( dlg->FindWindow( wxID_OK ) ) )
117 {
118 KIPLATFORM::UI::ForceFocus( okButton );
119 okButton->SetDefault();
120 }
121}
122
123
125{
126 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
127
128 wxCHECK( frame, 0 );
129
130 DIALOG_ERC* dlg = frame->GetErcDialog();
131
132 if( dlg )
133 {
134 dlg->Show( true );
135 dlg->Raise();
136 dlg->PrevMarker();
137 }
138
139 return 0;
140}
141
142
144{
145 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
146
147 wxCHECK( frame, 0 );
148
149 DIALOG_ERC* dlg = frame->GetErcDialog();
150
151 wxCHECK( dlg, 0 );
152
153 dlg->Show( true );
154 dlg->Raise();
155 dlg->NextMarker();
156
157 return 0;
158}
159
160
162{
163 SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
164
165 wxCHECK( selectionTool, 0 );
166
167 SCH_SELECTION& selection = selectionTool->GetSelection();
168
169 if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
170 {
171 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
172 DIALOG_ERC* dlg = frame ? frame->GetErcDialog() : nullptr;
173
174 if( dlg && dlg->IsShownOnScreen() )
175 dlg->SelectMarker( static_cast<SCH_MARKER*>( selection.Front() ) );
176 }
177
178 // Show the item info on a left click on this item
179 UpdateMessagePanel( aEvent );
180
181 return 0;
182}
183
184
186{
187 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
188
189 wxCHECK( frame, /* void */ );
190
191 DIALOG_ERC* dlg = frame->GetErcDialog();
192
193 if( dlg )
194 {
195 if( !dlg->IsShownOnScreen() )
196 {
197 dlg->Show( true );
198 dlg->Raise();
199 }
200
201 dlg->SelectMarker( aMarker );
202 }
203}
204
205
206wxString SCH_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr<RC_ITEM>& aERCItem )
207{
208 if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
209 {
210 return m_frame->GetRunMenuCommandDescription( SCH_ACTIONS::showBusSyntaxHelp );
211 }
212 else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
213 {
214 return m_frame->GetRunMenuCommandDescription( SCH_ACTIONS::diffSymbol );
215 }
216
217 return wxEmptyString;
218}
219
220
221void SCH_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCItem )
222{
223 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
224
225 wxCHECK( frame, /* void */ );
226
227 EDA_ITEM* a = frame->ResolveItem( aERCItem->GetMainItemID() );
228
229 if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
230 {
232 }
233 else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
234 {
235 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( a ) )
236 DiffSymbol( symbol );
237 }
238}
239
240
242{
243 SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
244 SCH_SELECTION& selection = selTool->GetSelection();
245 SCH_MARKER* marker = nullptr;
246
247 if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
248 marker = static_cast<SCH_MARKER*>( selection.Front() );
249
250 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
251
252 wxCHECK( frame, 0 );
253
254 DIALOG_ERC* dlg = frame->GetErcDialog();
255
256 wxCHECK( dlg, 0 );
257
258 // Let the ERC dialog handle it since it has more update hassles to worry about
259 // Note that if marker is nullptr the dialog will exclude whichever marker is selected
260 // in the dialog itself
261 dlg->ExcludeMarker( marker );
262
263 if( marker != nullptr )
264 {
265 marker->SetExcluded( true );
266 m_frame->GetCanvas()->GetView()->Update( marker );
267 m_frame->GetCanvas()->Refresh();
268 m_frame->OnModify();
269 }
270
271 return 0;
272}
273
274
275extern void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
276 int aGridForPins, UNITS_PROVIDER* aUnitsProvider );
277
279{
280 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
281
282 if( !symbol )
283 return 0;
284
285 std::vector<wxString> messages;
286 const int grid_size = KiROUND( getView()->GetGAL()->GetGridSize().x );
287
288 CheckLibSymbol( symbol, messages, grid_size, m_frame );
289
290 if( messages.empty() )
291 {
292 DisplayInfoMessage( m_frame, _( "No symbol issues found." ) );
293 }
294 else
295 {
296 HTML_MESSAGE_BOX dlg( m_frame, _( "Symbol Warnings" ) );
297
298 for( const wxString& single_msg : messages )
299 dlg.AddHTML_Text( single_msg );
300
301 dlg.ShowModal();
302 }
303
304 return 0;
305}
306
307
309{
310 if( m_busSyntaxHelp )
311 {
312 m_busSyntaxHelp->Raise();
313 m_busSyntaxHelp->Show( true );
314 return 0;
315 }
316
318 return 0;
319}
320
321
323{
324 SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
325
326 wxCHECK( schEditorFrame, 0 );
327
328 SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
329
330 if( selection.Empty() )
331 {
332 m_frame->ShowInfoBarError( _( "Select a symbol to diff against its library equivalent." ) );
333 return 0;
334 }
335
336 DiffSymbol( static_cast<SCH_SYMBOL*>( selection.Front() ) );
337 return 0;
338}
339
340
342{
343 SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
344
345 wxCHECK( schEditorFrame, /* void */ );
346
347 DIALOG_BOOK_REPORTER* dialog = schEditorFrame->GetSymbolDiffDialog();
348
349 wxCHECK( dialog, /* void */ );
350
351 dialog->DeleteAllPages();
352 dialog->SetUserItemID( symbol->m_Uuid );
353
354 wxString symbolDesc = wxString::Format( _( "Symbol %s" ),
355 symbol->GetField( FIELD_T::REFERENCE )->GetText() );
356 LIB_ID libId = symbol->GetLibId();
357 wxString libName = libId.GetLibNickname();
358 wxString symbolName = libId.GetLibItemName();
359
360 WX_HTML_REPORT_BOX* r = dialog->AddHTMLPage( _( "Summary" ) );
361
362 r->Report( wxS( "<h7>" ) + _( "Schematic vs library diff for:" ) + wxS( "</h7>" ) );
363 r->Report( wxS( "<ul><li>" ) + EscapeHTML( symbolDesc ) + wxS( "</li>" )
364 + wxS( "<li>" ) + _( "Library: " ) + EscapeHTML( libName ) + wxS( "</li>" )
365 + wxS( "<li>" ) + _( "Library item: " ) + EscapeHTML( symbolName )
366 + wxS( "</li></ul>" ) );
367
368 r->Report( "" );
369
371 const LIB_TABLE_ROW* libTableRow = libTable->FindRow( libName );
372
373 if( !libTableRow )
374 {
375 r->Report( _( "The library is not included in the current configuration." )
376 + wxS( "&nbsp;&nbsp;&nbsp" )
377 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
378 }
379 else if( !libTable->HasLibrary( libName, true ) )
380 {
381 r->Report( _( "The library is not enabled in the current configuration." )
382 + wxS( "&nbsp;&nbsp;&nbsp" )
383 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
384 }
385 else
386 {
387 std::unique_ptr<LIB_SYMBOL> flattenedLibSymbol;
388 std::unique_ptr<LIB_SYMBOL> flattenedSchSymbol = symbol->GetLibSymbolRef()->Flatten();
389
390 try
391 {
392 if( LIB_SYMBOL* libAlias = libTable->LoadSymbol( libName, symbolName ) )
393 flattenedLibSymbol = libAlias->Flatten();
394 }
395 catch( const IO_ERROR& )
396 {
397 }
398
399 if( !flattenedLibSymbol )
400 {
401 r->Report( wxString::Format( _( "The library no longer contains the item %s." ),
402 symbolName ) );
403 }
404 else
405 {
406 std::vector<SCH_FIELD> fields;
407
408 for( SCH_FIELD& field : symbol->GetFields() )
409 {
410 fields.emplace_back( SCH_FIELD( flattenedLibSymbol.get(), field.GetId(),
411 field.GetName( false ) ) );
412 fields.back().CopyText( field );
413 fields.back().SetAttributes( field );
414 fields.back().Move( -symbol->GetPosition() );
415 }
416
417 flattenedSchSymbol->SetFields( fields );
418
419 if( flattenedSchSymbol->Compare( *flattenedLibSymbol, SCH_ITEM::COMPARE_FLAGS::ERC,
420 r ) == 0 )
421 {
422 r->Report( _( "No relevant differences detected." ) );
423 }
424
425 wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) );
426 SYMBOL_DIFF_WIDGET* diff = constructDiffPanel( panel );
427
428 diff->DisplayDiff( flattenedSchSymbol.release(), flattenedLibSymbol.release(),
429 symbol->GetUnit(), symbol->GetBodyStyle() );
430 }
431 }
432
433 r->Flush();
434
435 dialog->Raise();
436 dialog->Show( true );
437}
438
439
441{
442 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
443
444 EDA_DRAW_PANEL_GAL::GAL_TYPE backend = m_frame->GetCanvas()->GetBackend();
445 SYMBOL_DIFF_WIDGET* diffWidget = new SYMBOL_DIFF_WIDGET( aParentPanel, backend );
446
447 sizer->Add( diffWidget, 1, wxEXPAND | wxALL, 5 );
448 aParentPanel->SetSizer( sizer );
449 aParentPanel->Layout();
450
451 return diffWidget;
452}
453
454
456{
457 SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, true );
458
459 if( !simFrame )
460 return -1;
461
462 if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() )
463 blocking_win->Close( true );
464
465 simFrame->Show( true );
466
467 // On Windows, Raise() does not bring the window on screen, when iconized
468 if( simFrame->IsIconized() )
469 simFrame->Iconize( false );
470
471 simFrame->Raise();
472
473 return 0;
474}
475
476
478{
479 wxString datasheet;
480 std::vector<EMBEDDED_FILES*> filesStack;
481
482 if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
483 {
484 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
485
486 if( !symbol )
487 return 0;
488
489 datasheet = symbol->GetDatasheetField().GetText();
490 filesStack.push_back( symbol );
491 }
492 else if( m_frame->IsType( FRAME_SCH_VIEWER ) )
493 {
494 LIB_SYMBOL* entry = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame )->GetSelectedSymbol();
495
496 if( !entry )
497 return 0;
498
500 filesStack.push_back( entry );
501 }
502 else if( m_frame->IsType( FRAME_SCH ) )
503 {
504 SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
505
506 if( selection.Empty() )
507 return 0;
508
509 SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
510 SCH_FIELD* field = symbol->GetField( FIELD_T::DATASHEET );
511
512 // Use GetShownText() to resolve any text variables, but don't allow adding extra text
513 // (ie: the field name)
514 datasheet = field->GetShownText( &symbol->Schematic()->CurrentSheet(), false );
515 filesStack.push_back( symbol->Schematic() );
516
517 if( symbol->GetLibSymbolRef() )
518 filesStack.push_back( symbol->GetLibSymbolRef().get() );
519 }
520
521 if( datasheet.IsEmpty() || datasheet == wxS( "~" ) )
522 {
523 m_frame->ShowInfoBarError( _( "No datasheet defined." ) );
524 }
525 else
526 {
528 PROJECT_SCH::SchSearchS( &m_frame->Prj() ), filesStack );
529 }
530
531 return 0;
532}
533
534
536{
537 SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
538 SCH_EDIT_FRAME* schEditFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
539 SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
540 SCH_SELECTION& selection = selTool->GetSelection();
541
542 // Note: the symbol viewer manages its own message panel
543
544 if( symbolEditFrame || schEditFrame )
545 {
546 if( selection.GetSize() == 1 )
547 {
548 EDA_ITEM* item = (EDA_ITEM*) selection.Front();
549 std::vector<MSG_PANEL_ITEM> msgItems;
550
551 if( std::optional<wxString> uuid = GetMsgPanelDisplayUuid( item->m_Uuid ) )
552 msgItems.emplace_back( _( "UUID" ), *uuid );
553
554 item->GetMsgPanelInfo( m_frame, msgItems );
555 m_frame->SetMsgPanel( msgItems );
556 }
557 else
558 {
559 m_frame->ClearMsgPanel();
560 }
561 }
562
563 if( schEditFrame )
564 {
565 schEditFrame->UpdateNetHighlightStatus();
566 schEditFrame->UpdateHierarchySelection();
567 }
568
569 return 0;
570}
571
572
597
598
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:990
static TOOL_ACTION excludeMarker
Definition actions.h:128
static TOOL_ACTION nextMarker
Definition actions.h:127
static TOOL_ACTION showDatasheet
Definition actions.h:266
static TOOL_ACTION prevMarker
Definition actions.h:126
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 SetUserItemID(const KIID &aID)
void ExcludeMarker(SCH_MARKER *aMarker=nullptr)
Exclude aMarker from the ERC list.
void SelectMarker(const SCH_MARKER *aMarker)
void PrevMarker()
void NextMarker()
bool Show(bool show) override
int ShowModal() override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
const KIID m_Uuid
Definition eda_item.h:516
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
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:220
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
static const TOOL_EVENT ClearedEvent
Definition actions.h:348
static const TOOL_EVENT SelectedEvent
Definition actions.h:346
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition actions.h:353
static const TOOL_EVENT PointSelectedEvent
Definition actions.h:345
static const TOOL_EVENT UnselectedEvent
Definition actions.h:347
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.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition kiway.cpp:660
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:85
SCH_FIELD & GetDatasheetField()
Return reference to the datasheet field.
Definition lib_symbol.h:348
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
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:94
static SYMBOL_LIB_TABLE * SchSymbolLibTable(PROJECT *aProject)
Accessor for project symbol library table.
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:171
static TOOL_ACTION showBusSyntaxHelp
static TOOL_ACTION checkSymbol
static TOOL_ACTION showSimulator
static TOOL_ACTION runERC
Inspection and Editing.
static TOOL_ACTION diffSymbol
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
static SELECTION_CONDITION SingleSymbol
static SELECTION_CONDITION SingleNonExcludedMarker
Schematic editor (Eeschema) main window.
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
DIALOG_ERC * GetErcDialog()
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
void UpdateNetHighlightStatus()
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
void InspectERCError(const std::shared_ptr< RC_ITEM > &aERCItem)
bool Init() override
Init() is called once upon a registration of the tool.
SYMBOL_DIFF_WIDGET * constructDiffPanel(wxPanel *aParentPanel)
This method is meant to be overridden in order to specify handlers for events.
int NextMarker(const TOOL_EVENT &aEvent)
int DiffSymbol(const TOOL_EVENT &aEvent)
int RunERC(const TOOL_EVENT &aEvent)
HTML_MESSAGE_BOX * m_busSyntaxHelp
int RunSimulation(const TOOL_EVENT &aEvent)
int ShowDatasheet(const TOOL_EVENT &aEvent)
wxString InspectERCErrorMenuText(const std::shared_ptr< RC_ITEM > &aERCItem)
int ExcludeMarker(const TOOL_EVENT &aEvent)
int CheckSymbol(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
Display the selected item info (when clicking on a item)
int PrevMarker(const TOOL_EVENT &aEvent)
int CrossProbe(const TOOL_EVENT &aEvent)
Called when clicking on a item:
int ShowBusSyntaxHelp(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:217
int GetBodyStyle() const
Definition sch_item.h:244
int GetUnit() const
Definition sch_item.h:238
SCH_SELECTION & GetSelection()
Schematic symbol object.
Definition sch_symbol.h:75
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
VECTOR2I GetPosition() const override
Definition sch_symbol.h:760
const LIB_ID & GetLibId() const override
Definition sch_symbol.h:164
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:183
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
bool Init() override
Init() is called once upon a registration of the tool.
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
SCH_TOOL_BASE(const std::string &aName)
SCH_SELECTION_TOOL * m_selectionTool
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:105
EDA_ITEM * Front() const
Definition selection.h:177
bool Empty() const
Checks if there is anything selected.
Definition selection.h:115
The SIMULATOR_FRAME holds the main user-interface for running simulations.
void DisplayDiff(LIB_SYMBOL *aSchSymbol, LIB_SYMBOL *aLibSymbol, int aUnit, int aBodyStyle)
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.
KIGFX::VIEW * getView() const
Definition tool_base.cpp:38
@ SHUTDOWN
Tool is being shut down.
Definition tool_base.h:84
Generic, UI-independent tool event.
Definition tool_event.h:171
void Go(int(SCH_BASE_FRAME::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
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, std::vector< EMBEDDED_FILES * > aFilesStack)
Open a document (file) with the suitable browser.
Definition eda_doc.cpp:62
This file is part of the common library.
@ ERCE_BUS_TO_NET_CONFLICT
A bus wire is graphically connected to a net port/pin (or vice versa).
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
@ 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
std::optional< wxString > GetMsgPanelDisplayUuid(const KIID &aKiid)
Get a formatted UUID string for display in the message panel, according to the current advanced confi...
Definition msgpanel.cpp:245
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition wxgtk/ui.cpp:124
void CheckLibSymbol(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, int aGridForPins, UNITS_PROVIDER *aUnitsProvider)
Check a library symbol to find incorrect settings.
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 library symbol to find incorrect settings.
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ SCH_SYMBOL_T
Definition typeinfo.h:174
@ SCH_MARKER_T
Definition typeinfo.h:160