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 )
168 {
169 if( !dlg->IsShownOnScreen() )
170 {
171 dlg->Show( true );
172 dlg->Raise();
173 }
174
175 dlg->SelectMarker( static_cast<SCH_MARKER*>( selection.Front() ) );
176 }
177 }
178
179 // Show the item info on a left click on this item
180 UpdateMessagePanel( aEvent );
181
182 return 0;
183}
184
185
186wxString EE_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr<RC_ITEM>& aERCItem )
187{
188 auto menuDescription =
189 [&]( const TOOL_ACTION& aAction )
190 {
191 wxString menuItemLabel = aAction.GetMenuLabel();
192 wxMenuBar* menuBar = m_frame->GetMenuBar();
193
194 for( size_t ii = 0; ii < menuBar->GetMenuCount(); ++ii )
195 {
196 for( wxMenuItem* menuItem : menuBar->GetMenu( ii )->GetMenuItems() )
197 {
198 if( menuItem->GetItemLabelText() == menuItemLabel )
199 {
200 wxString menuTitleLabel = menuBar->GetMenuLabelText( ii );
201
202 menuTitleLabel.Replace( wxS( "&" ), wxS( "&&" ) );
203 menuItemLabel.Replace( wxS( "&" ), wxS( "&&" ) );
204
205 return wxString::Format( _( "Run %s > %s" ),
206 menuTitleLabel,
207 menuItemLabel );
208 }
209 }
210 }
211
212 return wxString::Format( _( "Run %s" ), aAction.GetFriendlyName() );
213 };
214
215 if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
216 {
217 return menuDescription( EE_ACTIONS::showBusSyntaxHelp );
218 }
219 else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
220 {
221 return menuDescription( EE_ACTIONS::diffSymbol );
222 }
223
224 return wxEmptyString;
225}
226
227
228void EE_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCItem )
229{
230 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
231
232 wxCHECK( frame, /* void */ );
233
234 EDA_ITEM* a = frame->GetItem( aERCItem->GetMainItemID() );
235
236 if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
237 {
239 }
240 else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
241 {
242 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( a ) )
243 DiffSymbol( symbol );
244 }
245}
246
247
249{
251 EE_SELECTION& selection = selTool->GetSelection();
252 SCH_MARKER* marker = nullptr;
253
254 if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
255 marker = static_cast<SCH_MARKER*>( selection.Front() );
256
257 SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
258
259 wxCHECK( frame, 0 );
260
261 DIALOG_ERC* dlg = frame->GetErcDialog();
262
263 wxCHECK( dlg, 0 );
264
265 // Let the ERC dialog handle it since it has more update hassles to worry about
266 // Note that if marker is nullptr the dialog will exclude whichever marker is selected
267 // in the dialog itself
268 dlg->ExcludeMarker( marker );
269
270 if( marker != nullptr )
271 {
272 marker->SetExcluded( true );
273 m_frame->GetCanvas()->GetView()->Update( marker );
275 m_frame->OnModify();
276 }
277
278 return 0;
279}
280
281
282extern void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
283 int aGridForPins, EDA_DRAW_FRAME* aUnitsProvider );
284
286{
287 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
288
289 if( !symbol )
290 return 0;
291
292 std::vector<wxString> messages;
293 const int grid_size = KiROUND( getView()->GetGAL()->GetGridSize().x );
294
295 CheckLibSymbol( symbol, messages, grid_size, m_frame );
296
297 if( messages.empty() )
298 {
299 DisplayInfoMessage( m_frame, _( "No symbol issues found." ) );
300 }
301 else
302 {
303 HTML_MESSAGE_BOX dlg( m_frame, _( "Symbol Warnings" ) );
304
305 for( const wxString& single_msg : messages )
306 dlg.AddHTML_Text( single_msg );
307
308 dlg.ShowModal();
309 }
310
311 return 0;
312}
313
314
316{
317 if( m_busSyntaxHelp )
318 {
319 m_busSyntaxHelp->Raise();
320 m_busSyntaxHelp->Show( true );
321 return 0;
322 }
323
325 return 0;
326}
327
328
330{
331 SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
332
333 wxCHECK( schEditorFrame, 0 );
334
336
337 if( selection.Empty() )
338 {
339 m_frame->ShowInfoBarError( _( "Select a symbol to diff against its library equivalent." ) );
340 return 0;
341 }
342
343 DiffSymbol( static_cast<SCH_SYMBOL*>( selection.Front() ) );
344 return 0;
345}
346
347
349{
350 SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
351
352 wxCHECK( schEditorFrame, /* void */ );
353
354 DIALOG_BOOK_REPORTER* dialog = schEditorFrame->GetSymbolDiffDialog();
355
356 wxCHECK( dialog, /* void */ );
357
358 dialog->DeleteAllPages();
359
360 wxString symbolDesc = wxString::Format( _( "Symbol %s" ),
361 symbol->GetField( REFERENCE_FIELD )->GetText() );
362 LIB_ID libId = symbol->GetLibId();
363 wxString libName = libId.GetLibNickname();
364 wxString symbolName = libId.GetLibItemName();
365
366 WX_HTML_REPORT_BOX* r = dialog->AddHTMLPage( _( "Summary" ) );
367
368 r->Report( wxS( "<h7>" ) + _( "Schematic vs library diff for:" ) + wxS( "</h7>" ) );
369 r->Report( wxS( "<ul><li>" ) + EscapeHTML( symbolDesc ) + wxS( "</li>" )
370 + wxS( "<li>" ) + _( "Library: " ) + EscapeHTML( libName ) + wxS( "</li>" )
371 + wxS( "<li>" ) + _( "Library item: " ) + EscapeHTML( symbolName )
372 + wxS( "</li></ul>" ) );
373
374 r->Report( "" );
375
377 const LIB_TABLE_ROW* libTableRow = libTable->FindRow( libName );
378
379 if( !libTableRow )
380 {
381 r->Report( _( "The library is not included in the current configuration." )
382 + wxS( "&nbsp;&nbsp;&nbsp" )
383 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
384 }
385 else if( !libTable->HasLibrary( libName, true ) )
386 {
387 r->Report( _( "The library is not enabled in the current configuration." )
388 + wxS( "&nbsp;&nbsp;&nbsp" )
389 + wxS( "<a href='$CONFIG'>" ) + _( "Manage Symbol Libraries" ) + wxS( "</a>" ) );
390 }
391 else
392 {
393 std::unique_ptr<LIB_SYMBOL> flattenedLibSymbol;
394 std::unique_ptr<LIB_SYMBOL> flattenedSchSymbol = symbol->GetLibSymbolRef()->Flatten();
395
396 try
397 {
398 if( LIB_SYMBOL* libAlias = libTable->LoadSymbol( libName, symbolName ) )
399 flattenedLibSymbol = libAlias->Flatten();
400 }
401 catch( const IO_ERROR& )
402 {
403 }
404
405 if( !flattenedLibSymbol )
406 {
407 r->Report( wxString::Format( _( "The library no longer contains the item %s." ),
408 symbolName ) );
409 }
410 else
411 {
412 std::vector<LIB_FIELD> fields;
413
414 for( SCH_FIELD& field : symbol->GetFields() )
415 {
416 fields.emplace_back( LIB_FIELD( flattenedLibSymbol.get(), field.GetId(),
417 field.GetName( false ) ) );
418 fields.back().CopyText( field );
419 fields.back().SetAttributes( field );
420 fields.back().Offset( -symbol->GetPosition() );
421 }
422
423 flattenedSchSymbol->SetFields( fields );
424
425 if( flattenedSchSymbol->Compare( *flattenedLibSymbol, LIB_ITEM::COMPARE_FLAGS::ERC,
426 r ) == 0 )
427 {
428 r->Report( _( "No relevant differences detected." ) );
429 }
430
431 wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) );
432 SYMBOL_DIFF_WIDGET* diff = constructDiffPanel( panel );
433
434 diff->DisplayDiff( flattenedSchSymbol.release(), flattenedLibSymbol.release(),
435 symbol->GetUnit(), symbol->GetBodyStyle() );
436 }
437 }
438
439 r->Flush();
440
441 dialog->Raise();
442 dialog->Show( true );
443}
444
445
447{
448 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
449
451 SYMBOL_DIFF_WIDGET* diffWidget = new SYMBOL_DIFF_WIDGET( aParentPanel, backend );
452
453 sizer->Add( diffWidget, 1, wxEXPAND | wxALL, 5 );
454 aParentPanel->SetSizer( sizer );
455 aParentPanel->Layout();
456
457 return diffWidget;
458}
459
460
462{
464
465 if( !simFrame )
466 return -1;
467
468 if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() )
469 blocking_win->Close( true );
470
471 simFrame->Show( true );
472
473 // On Windows, Raise() does not bring the window on screen, when iconized
474 if( simFrame->IsIconized() )
475 simFrame->Iconize( false );
476
477 simFrame->Raise();
478
479 return 0;
480}
481
482
484{
485 wxString datasheet;
486
488 {
489 LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
490
491 if( !symbol )
492 return 0;
493
494 datasheet = symbol->GetDatasheetField().GetText();
495 }
496 else if( m_frame->IsType( FRAME_SCH_VIEWER ) )
497 {
498 LIB_SYMBOL* entry = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame )->GetSelectedSymbol();
499
500 if( !entry )
501 return 0;
502
504 }
505 else if( m_frame->IsType( FRAME_SCH ) )
506 {
508
509 if( selection.Empty() )
510 return 0;
511
512 SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
513
514 // Use GetShownText() to resolve any text variables, but don't allow adding extra text
515 // (ie: the field name)
516 datasheet = symbol->GetField( DATASHEET_FIELD )->GetShownText( false );
517 }
518
519 if( datasheet.IsEmpty() || datasheet == wxS( "~" ) )
520 {
521 m_frame->ShowInfoBarError( _( "No datasheet defined." ) );
522 }
523 else
524 {
527 }
528
529 return 0;
530}
531
532
534{
535 SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
536 SCH_EDIT_FRAME* schEditFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
538 EE_SELECTION& selection = selTool->GetSelection();
539
540 // Note: the symbol viewer manages its own message panel
541
542 if( symbolEditFrame || schEditFrame )
543 {
544 if( selection.GetSize() == 1 )
545 {
546 EDA_ITEM* item = (EDA_ITEM*) selection.Front();
547
548 std::vector<MSG_PANEL_ITEM> msgItems;
549 item->GetMsgPanelInfo( m_frame, msgItems );
550 m_frame->SetMsgPanel( msgItems );
551 }
552 else
553 {
555 }
556 }
557
558 if( schEditFrame )
559 {
560 schEditFrame->UpdateNetHighlightStatus();
561 schEditFrame->UpdateHierarchySelection();
562 }
563
564 return 0;
565}
566
567
569{
573 // See note 1:
577
582
584
585 // Note 1: tUpdateMessagePanel is called by CrossProbe. So uncomment this line if
586 // call to CrossProbe is modifiied
587 // Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedEvent );
591}
592
593
static TOOL_ACTION excludeMarker
Definition: actions.h:111
static TOOL_ACTION nextMarker
Definition: actions.h:110
static TOOL_ACTION prevMarker
Definition: actions.h:109
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:871
void SelectMarker(const SCH_MARKER *aMarker)
Definition: dialog_erc.cpp:848
void PrevMarker()
Definition: dialog_erc.cpp:824
void NextMarker()
Definition: dialog_erc.cpp:836
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
The base class for create windows for drawing purpose.
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:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
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:199
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
static TOOL_ACTION runERC
Definition: ee_actions.h:148
static TOOL_ACTION showSimulator
Definition: ee_actions.h:273
static TOOL_ACTION diffSymbol
Definition: ee_actions.h:163
static TOOL_ACTION showDatasheet
Inspection and Editing.
Definition: ee_actions.h:147
static TOOL_ACTION checkSymbol
Definition: ee_actions.h:162
static TOOL_ACTION showBusSyntaxHelp
Definition: ee_actions.h:164
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:255
static const TOOL_EVENT SelectedEvent
Definition: actions.h:253
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:260
static const TOOL_EVENT PointSelectedEvent
Definition: actions.h:252
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:254
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:1619
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:53
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:432
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:689
Field object used in symbol libraries.
Definition: lib_field.h:62
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:99
LIB_FIELD & GetDatasheetField()
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
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:52
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
Definition: sch_field.cpp:188
Schematic symbol object.
Definition: sch_symbol.h:109
int GetUnit() const
Definition: sch_symbol.h:258
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
Definition: sch_symbol.cpp:950
VECTOR2I GetPosition() const override
Definition: sch_symbol.h:813
const LIB_ID & GetLibId() const
Definition: sch_symbol.h:203
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:998
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:222
int GetBodyStyle() const
Definition: sch_symbol.h:300
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Definition: sch_label.cpp:2072
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:99
EDA_ITEM * Front() const
Definition: selection.h:208
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
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:216
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:145
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:332
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:60
This file is part of the common library.
void CheckLibSymbol(LIB_SYMBOL *aSymbol, std::vector< wxString > &aMessages, int aGridForPins, EDA_DRAW_FRAME *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:66
@ ERCE_LIB_SYMBOL_MISMATCH
Symbol doesn't match copy in library.
Definition: erc_settings.h:75
@ 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: gtk/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, EDA_DRAW_FRAME *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:160
@ SCH_MARKER_T
Definition: typeinfo.h:143
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:85