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 <eda_doc.h>
45#include <sch_marker.h>
46#include <project.h>
47#include <project_sch.h>
49#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
372 if( !libs->HasLibrary( libName, false ) )
373 {
374 r->Report( _( "The library is not included in the current configuration." )
375 + wxS( "&nbsp;&nbsp;&nbsp" )
376 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
377 }
378 else if( !libs->HasLibrary( libName, true ) )
379 {
380 r->Report( _( "The library is not enabled in the current configuration." )
381 + wxS( "&nbsp;&nbsp;&nbsp" )
382 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
383 }
384 else
385 {
386 std::unique_ptr<LIB_SYMBOL> flattenedLibSymbol;
387 std::unique_ptr<LIB_SYMBOL> flattenedSchSymbol = symbol->GetLibSymbolRef()->Flatten();
388
389 try
390 {
391 if( LIB_SYMBOL* libAlias = libs->LoadSymbol( libName, symbolName ) )
392 flattenedLibSymbol = libAlias->Flatten();
393 }
394 catch( const IO_ERROR& )
395 {
396 }
397
398 if( !flattenedLibSymbol )
399 {
400 r->Report( wxString::Format( _( "The library no longer contains the item %s." ),
401 symbolName ) );
402 }
403 else
404 {
405 std::vector<SCH_FIELD> fields;
406
407 for( SCH_FIELD& field : symbol->GetFields() )
408 {
409 fields.emplace_back( SCH_FIELD( flattenedLibSymbol.get(), field.GetId(),
410 field.GetName( false ) ) );
411 fields.back().CopyText( field );
412 fields.back().SetAttributes( field );
413 fields.back().Move( -symbol->GetPosition() );
414 }
415
416 flattenedSchSymbol->SetFields( fields );
417
418 if( flattenedSchSymbol->Compare( *flattenedLibSymbol, SCH_ITEM::COMPARE_FLAGS::ERC,
419 r ) == 0 )
420 {
421 r->Report( _( "No relevant differences detected." ) );
422 }
423
424 wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) );
425 SYMBOL_DIFF_WIDGET* diff = constructDiffPanel( panel );
426
427 diff->DisplayDiff( flattenedSchSymbol.release(), flattenedLibSymbol.release(),
428 symbol->GetUnit(), symbol->GetBodyStyle() );
429 }
430 }
431
432 r->Flush();
433
434 dialog->Raise();
435 dialog->Show( true );
436}
437
438
440{
441 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
442
443 EDA_DRAW_PANEL_GAL::GAL_TYPE backend = m_frame->GetCanvas()->GetBackend();
444 SYMBOL_DIFF_WIDGET* diffWidget = new SYMBOL_DIFF_WIDGET( aParentPanel, backend );
445
446 sizer->Add( diffWidget, 1, wxEXPAND | wxALL, 5 );
447 aParentPanel->SetSizer( sizer );
448 aParentPanel->Layout();
449
450 return diffWidget;
451}
452
453
455{
456 SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, true );
457
458 if( !simFrame )
459 return -1;
460
461 if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() )
462 blocking_win->Close( true );
463
464 simFrame->Show( true );
465
466 // On Windows, Raise() does not bring the window on screen, when iconized
467 if( simFrame->IsIconized() )
468 simFrame->Iconize( false );
469
470 simFrame->Raise();
471
472 return 0;
473}
474
475
477{
478 wxString datasheet;
479 std::vector<EMBEDDED_FILES*> filesStack;
480
481 if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
482 {
483 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
484
485 if( !symbol )
486 return 0;
487
488 datasheet = symbol->GetDatasheetField().GetText();
489 filesStack.push_back( symbol );
490 }
491 else if( m_frame->IsType( FRAME_SCH_VIEWER ) )
492 {
493 LIB_SYMBOL* entry = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame )->GetSelectedSymbol();
494
495 if( !entry )
496 return 0;
497
499 filesStack.push_back( entry );
500 }
501 else if( m_frame->IsType( FRAME_SCH ) )
502 {
503 SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
504
505 if( selection.Empty() )
506 return 0;
507
508 SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
509 SCH_FIELD* field = symbol->GetField( FIELD_T::DATASHEET );
510
511 // Use GetShownText() to resolve any text variables, but don't allow adding extra text
512 // (ie: the field name)
513 datasheet = field->GetShownText( &symbol->Schematic()->CurrentSheet(), false );
514 filesStack.push_back( symbol->Schematic() );
515
516 if( symbol->GetLibSymbolRef() )
517 filesStack.push_back( symbol->GetLibSymbolRef().get() );
518 }
519
520 if( datasheet.IsEmpty() || datasheet == wxS( "~" ) )
521 {
522 m_frame->ShowInfoBarError( _( "No datasheet defined." ) );
523 }
524 else
525 {
527 PROJECT_SCH::SchSearchS( &m_frame->Prj() ), filesStack );
528 }
529
530 return 0;
531}
532
533
535{
536 SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
537 SCH_EDIT_FRAME* schEditFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
538 SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
539 SCH_SELECTION& selection = selTool->GetSelection();
540
541 // Note: the symbol viewer manages its own message panel
542
543 if( symbolEditFrame || schEditFrame )
544 {
545 if( selection.GetSize() == 1 )
546 {
547 EDA_ITEM* item = (EDA_ITEM*) selection.Front();
548 std::vector<MSG_PANEL_ITEM> msgItems;
549
550 if( std::optional<wxString> uuid = GetMsgPanelDisplayUuid( item->m_Uuid ) )
551 msgItems.emplace_back( _( "UUID" ), *uuid );
552
553 item->GetMsgPanelInfo( m_frame, msgItems );
554 m_frame->SetMsgPanel( msgItems );
555 }
556 else
557 {
558 m_frame->ClearMsgPanel();
559 }
560 }
561
562 if( schEditFrame )
563 {
564 schEditFrame->UpdateNetHighlightStatus();
565 schEditFrame->UpdateHierarchySelection();
566 }
567
568 return 0;
569}
570
571
596
597
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:667
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library tables.
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:87
SCH_FIELD & GetDatasheetField()
Return reference to the datasheet field.
Definition lib_symbol.h:350
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
Definition marker_base.h:94
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
static SEARCH_STACK * SchSearchS(PROJECT *aProject)
Accessor for Eeschema search stack.
SCH_SHEET_PATH & CurrentSheet() const
Definition schematic.h:186
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:244
int GetBodyStyle() const
Definition sch_item.h:247
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:808
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.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
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:176
@ SCH_MARKER_T
Definition typeinfo.h:162