KiCad PCB EDA Suite
sch_base_frame.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) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright (C) 2015-2022 KiCad Developers, see change_log.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 <base_units.h>
26#include <kiway.h>
28#include <pgm_base.h>
29#include <eda_list_dialog.h>
30#include <eeschema_settings.h>
33#include <sch_draw_panel.h>
34#include <sch_view.h>
35#include <sch_painter.h>
37#include <confirm.h>
39#include <symbol_library.h>
40#include <sch_base_frame.h>
41#include <symbol_lib_table.h>
42#include <tool/action_toolbar.h>
43#include <tool/tool_manager.h>
45#include <tools/ee_actions.h>
47#include <wx/choicdlg.h>
48
49#if defined( KICAD_USE_3DCONNEXION )
51#endif
52
54 SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg )
55{
56 wxCHECK_MSG( aLibTable, nullptr, "Invalid symbol library table." );
57
58 LIB_SYMBOL* symbol = nullptr;
59
60 try
61 {
62 symbol = aLibTable->LoadSymbol( aLibId );
63
64 if( !symbol && aCacheLib )
65 {
66 wxCHECK_MSG( aCacheLib->IsCache(), nullptr, "Invalid cache library." );
67
68 wxString cacheName = aLibId.GetLibNickname().wx_str();
69 cacheName += "_" + aLibId.GetLibItemName();
70 symbol = aCacheLib->FindSymbol( cacheName );
71 }
72 }
73 catch( const IO_ERROR& ioe )
74 {
75 if( aShowErrorMsg )
76 {
77 wxString msg = wxString::Format( _( "Error loading symbol %s from library '%s'." ),
78 aLibId.GetLibItemName().wx_str(),
79 aLibId.GetLibNickname().wx_str() );
80 DisplayErrorMessage( aParent, msg, ioe.What() );
81 }
82 }
83
84 return symbol;
85}
86
87
88SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindowType,
89 const wxString& aTitle, const wxPoint& aPosition,
90 const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
91 EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
92 aFrameName, schIUScale ),
93 m_base_frame_defaults( nullptr, "base_Frame_defaults" )
94#if defined( KICAD_USE_3DCONNEXION )
95 ,m_spaceMouse( nullptr )
96#endif
97{
99
100 Bind( wxEVT_IDLE,
101 [this]( wxIdleEvent& aEvent )
102 {
103 // Handle cursor adjustments. While we can get motion and key events through
104 // wxWidgets, we can't get modifier-key-up events.
105 if( m_toolManager )
106 {
108
109 if( selTool )
110 selTool->OnIdle( aEvent );
111 }
112 } );
113}
114
115
117{
118#if defined( KICAD_USE_3DCONNEXION )
119 if( m_spaceMouse != nullptr )
120 delete m_spaceMouse;
121#endif
122}
123
124
126{
128}
129
130
132{
133 return dynamic_cast<EESCHEMA_SETTINGS*>( config() );
134}
135
136
138{
139 return dynamic_cast<SYMBOL_EDITOR_SETTINGS*>( config() );
140}
141
142
143void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
144{
145 GetScreen()->SetPageSettings( aPageSettings );
146}
147
148
150{
151 return GetScreen()->GetPageSettings();
152}
153
154
156{
157 // GetSizeIU is compile time dependent:
159}
160
161
163{
164 wxASSERT( GetScreen() );
165 return GetScreen()->GetTitleBlock();
166}
167
168
170{
171 wxASSERT( GetScreen() );
172 GetScreen()->SetTitleBlock( aTitleBlock );
173}
174
175
177{
178 wxString line;
179 BASE_SCREEN* screen = GetScreen();
180
181 if( !screen )
182 return;
183
185
186 // Display absolute and relative coordinates
188 VECTOR2D d = cursorPos - screen->m_LocalOrigin;
189
190 line.Printf( "X %s Y %s",
191 MessageTextFromValue( cursorPos.x, false ),
192 MessageTextFromValue( cursorPos.y, false ) );
193 SetStatusText( line, 2 );
194
195 line.Printf( "dx %s dy %s dist %s",
196 MessageTextFromValue( d.x, false ),
197 MessageTextFromValue( d.y, false ),
198 MessageTextFromValue( hypot( d.x, d.y ), false ) );
199 SetStatusText( line, 3 );
200
203}
204
205
206LIB_SYMBOL* SCH_BASE_FRAME::GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib,
207 bool aShowErrorMsg )
208{
209 SYMBOL_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : nullptr;
210
211 return SchGetLibSymbol( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
212}
213
214
215bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject )
216{
217 wxString msg;
218 bool success = true;
219
220 if( aGlobal )
221 {
222 try
223 {
225 }
226 catch( const IO_ERROR& ioe )
227 {
228 success = false;
229 msg.Printf( _( "Error saving global symbol library table:\n%s" ), ioe.What() );
230 wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
231 }
232 }
233
234 if( aProject && !Prj().GetProjectName().IsEmpty() )
235 {
236 wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
237
238 try
239 {
240 Prj().SchSymbolLibTable()->Save( fn.GetFullPath() );
241 }
242 catch( const IO_ERROR& ioe )
243 {
244 success = false;
245 msg.Printf( _( "Error saving project-specific symbol library table:\n%s" ),
246 ioe.What() );
247 wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
248 }
249 }
250
251 return success;
252}
253
254
256{
257 // If no project is loaded, always work with the global table
258 if( Prj().IsNullProject() )
259 {
261
262 if( aOptional )
263 {
264 wxMessageDialog dlg( this, _( "Add the library to the global library table?" ),
265 _( "Add To Global Library Table" ), wxYES_NO );
266
267 if( dlg.ShowModal() != wxID_OK )
268 ret = nullptr;
269 }
270
271 return ret;
272 }
273
274 wxArrayString libTableNames;
275 libTableNames.Add( _( "Global" ) );
276 libTableNames.Add( _( "Project" ) );
277
278 wxSingleChoiceDialog dlg( this, _( "Choose the Library Table to add the library to:" ),
279 _( "Add To Library Table" ), libTableNames );
280
281 if( aOptional )
282 {
283 dlg.FindWindow( wxID_CANCEL )->SetLabel( _( "Skip" ) );
284 dlg.FindWindow( wxID_OK )->SetLabel( _( "Add" ) );
285 }
286
287 if( dlg.ShowModal() != wxID_OK )
288 return nullptr;
289
290 switch( dlg.GetSelection() )
291 {
292 case 0: return &SYMBOL_LIB_TABLE::GetGlobalLibTable();
293 case 1: return Prj().SchSymbolLibTable();
294 default: return nullptr;
295 }
296}
297
298
299void SCH_BASE_FRAME::RedrawScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer )
300{
301 GetCanvas()->GetView()->SetCenter( aCenterPoint );
302
303 if( aWarpPointer )
305
306 GetCanvas()->Refresh();
307}
308
309
311{
312 if( GetCanvas() && GetCanvas()->GetView() )
313 {
316 }
317}
318
319
321{
322 return static_cast<SCH_DRAW_PANEL*>( EDA_DRAW_FRAME::GetCanvas() );
323}
324
325
327{
328 if( GetCanvas() && GetCanvas()->GetView() )
329 {
330 if( KIGFX::PAINTER* painter = GetCanvas()->GetView()->GetPainter() )
331 return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->GetSettings() );
332 }
333
334 return nullptr;
335}
336
337
339{
341
342 SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize,
345}
346
347
349{
351
352#if defined( KICAD_USE_3DCONNEXION )
353 try
354 {
355 if( !m_spaceMouse )
356 {
357 m_spaceMouse = new NL_SCHEMATIC_PLUGIN();
358 }
359
360 m_spaceMouse->SetCanvas( GetCanvas() );
361 }
362 catch( const std::system_error& e )
363 {
364 wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
365 }
366#endif
367}
368
369
370void SCH_BASE_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
371{
372 EDA_ITEM* parent = aItem->GetParent();
373
374 if( aItem->Type() == SCH_SHEET_PIN_T )
375 {
376 // Sheet pins aren't in the view. Refresh their parent.
377 if( parent )
378 GetCanvas()->GetView()->Update( parent );
379 }
380 else
381 {
382 if( !isAddOrDelete )
383 GetCanvas()->GetView()->Update( aItem );
384
385 // Some children are drawn from their parents. Mark them for re-paint.
386 if( parent && parent->IsType( { SCH_SYMBOL_T, SCH_SHEET_T, SCH_LABEL_LOCATE_ANY_T } ) )
387 GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
388 }
389
394 if( aUpdateRtree)
395 GetScreen()->Update( static_cast<SCH_ITEM*>( aItem ) );
396
397 // Calling Refresh() here introduces a bi-stable state: when doing operations on a
398 // large number of items if at some point the refresh timer times out and does a
399 // refresh it will take long enough that the next item will also time out, and the
400 // next, and the next, etc.
401 // GetCanvas()->Refresh();
402}
403
404
406{
407 // We currently have two zoom-dependent renderings: text, which is rendered as bitmap text
408 // when too small to see the difference, and selection shadows.
409 //
410 // Because non-selected text is cached by OpenGL, we only apply the bitmap performance hack
411 // to selected text items.
412 //
413 // Thus, as it currently stands, all zoom-dependent items can be found in the list of selected
414 // items.
415
416 if( m_toolManager )
417 {
419 SELECTION& selection = selectionTool->GetSelection();
420 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
421
422 for( EDA_ITEM* item : selection )
423 {
424 if( item->RenderAsBitmap( view->GetGAL()->GetWorldScale() ) != item->IsShownAsBitmap()
426 {
427 view->Update( item, KIGFX::REPAINT );
428
429 EDA_ITEM* parent = item->GetParent();
430
431 // Symbol children are drawn from their parents. Mark them for re-paint.
432 if( parent && parent->Type() == SCH_SYMBOL_T )
433 GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
434 }
435 }
436 }
437}
438
439
441{
442 // Null pointers will cause boost::ptr_vector to raise a boost::bad_pointer exception which
443 // will be unhandled. There is no valid reason to pass an invalid EDA_ITEM pointer to the
444 // screen append function.
445 wxCHECK( aItem != nullptr, /* voide */ );
446
447 auto screen = aScreen;
448
449 if( aScreen == nullptr )
450 screen = GetScreen();
451
452 screen->Append( (SCH_ITEM*) aItem );
453
454 if( screen == GetScreen() )
455 {
456 GetCanvas()->GetView()->Add( aItem );
457 UpdateItem( aItem, true ); // handle any additional parent semantics
458 }
459}
460
461
463{
464 auto screen = aScreen;
465
466 if( aScreen == nullptr )
467 screen = GetScreen();
468
469 if( screen == GetScreen() )
470 GetCanvas()->GetView()->Remove( aItem );
471
472 screen->Remove( (SCH_ITEM*) aItem );
473
474 if( screen == GetScreen() )
475 UpdateItem( aItem, true ); // handle any additional parent semantics
476}
477
478
480{
482}
483
484
486{
487 return GetColorSettings()->GetColor( aLayer );
488}
489
490
491void SCH_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
492{
493 EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
494
495 COLOR_SETTINGS* colorSettings = GetColorSettings( true );
496
497 GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( colorSettings );
499
503}
504
505
507{
508 if( !m_colorSettings || aForceRefresh )
509 {
510 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
512 wxString colorTheme = cfg->m_ColorTheme;
513
515 {
517
518 if( !symCfg->m_UseEeschemaColorSettings )
519 colorTheme = symCfg->m_ColorTheme;
520 }
521
522 COLOR_SETTINGS* colorSettings = mgr.GetColorSettings( colorTheme );
523
524 const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = colorSettings;
525 }
526
527 return m_colorSettings;
528}
529
530
532{
534}
535
536
537void SCH_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
538{
540
541#if defined( KICAD_USE_3DCONNEXION )
542 if( m_spaceMouse )
543 {
544 m_spaceMouse->SetFocus( aEvent.GetActive() );
545 }
546#endif
547}
548
549
550void SCH_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
551{
553
554#if defined( KICAD_USE_3DCONNEXION )
555 if( m_spaceMouse && aEvent.IsIconized() )
556 {
557 m_spaceMouse->SetFocus( false );
558 }
559#endif
560}
561
562
564{
565 COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
566 PROJECT& prj = Prj();
567
568 if( prj.SchSymbolLibTable()->IsEmpty() )
569 {
570 ShowInfoBarError( _( "No symbol libraries are loaded." ) );
571 return wxEmptyString;
572 }
573
574 wxArrayString headers;
575
576 headers.Add( _( "Library" ) );
577
578 std::vector< wxArrayString > itemsToDisplay;
579 std::vector< wxString > libNicknames = prj.SchSymbolLibTable()->GetLogicalLibs();
580
581 for( const wxString& name : libNicknames )
582 {
583 // Exclude read only libraries.
584 if( !prj.SchSymbolLibTable()->IsSymbolLibWritable( name ) )
585 continue;
586
589 {
590 wxArrayString item;
591
593 itemsToDisplay.push_back( item );
594 }
595 }
596
597 for( const wxString& name : libNicknames )
598 {
599 // Exclude read only libraries.
600 if( !prj.SchSymbolLibTable()->IsSymbolLibWritable( name ) )
601 continue;
602
605 {
606 wxArrayString item;
607
608 item.Add( name );
609 itemsToDisplay.push_back( item );
610 }
611 }
612
613 wxString oldLibName = prj.GetRString( PROJECT::SCH_LIB_SELECT );
614
615 EDA_LIST_DIALOG dlg( this, _( "Select Symbol Library" ), headers, itemsToDisplay, oldLibName,
616 false );
617
618 if( dlg.ShowModal() != wxID_OK )
619 return wxEmptyString;
620
621 wxString libName = dlg.GetTextSelection();
622
623 if( !libName.empty() )
624 {
625 if( prj.SchSymbolLibTable()->HasLibrary( libName ) )
626 prj.SetRString( PROJECT::SCH_LIB_SELECT, libName );
627 else
628 libName = wxEmptyString;
629 }
630
631 return libName;
632}
const char * name
Definition: DXF_plotter.cpp:56
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:187
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void handleIconizeEvent(wxIconizeEvent &aEvent)
Handle a window iconize event.
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 ActivateGalCanvas()
Use to start up the GAL drawing canvas.
COLOR_SETTINGS * m_colorSettings
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
void DisplayUnitsMsg()
Display current unit pane in the status bar.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
virtual void handleActivateEvent(wxActivateEvent &aEvent)
Handle a window activation event.
void UpdateStatusBar() override
Update the status bar information.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual void DisplayGridMsg()
Display current grid size in the status bar.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
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 bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
A dialog which shows:
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void OnIdle(wxIdleEvent &aEvent)
Zoom the screen to fit the bounding box for cross probing/selection sync.
EE_SELECTION & GetSelection()
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
double GetWorldScale() const
Get the world scale.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:58
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
static std::vector< KICAD_T > g_ScaledSelectionTypes
Definition: sch_painter.h:200
Store schematic specific render settings.
Definition: sch_painter.h:71
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void CenterOnCursor() const =0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:316
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:346
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:1574
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1381
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1478
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:574
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
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:101
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:98
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
static const wxString GetPinningSymbol()
The class that implements the public interface to the SpaceMouse plug-in.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
const wxSize GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:162
std::vector< wxString > m_PinnedSymbolLibs
Below are project-level settings that have not been moved to a dedicated file.
Definition: project_file.h:115
Container for project specific data.
Definition: project.h:63
@ SCH_LIB_SELECT
Definition: project.h:165
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:148
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition: project.cpp:253
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition: project.cpp:264
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
virtual void RedrawScreen(const VECTOR2I &aCenterPoint, bool aWarpPointer)
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void UpdateStatusBar() override
Update the status bar information.
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
void SetPageSettings(const PAGE_INFO &aPageSettings) override
void handleIconizeEvent(wxIconizeEvent &aEvent) override
Handle a window iconize event.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SYMBOL_EDITOR_SETTINGS * libeditconfig() const
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
SYMBOL_LIB_TABLE * SelectSymLibTable(bool aOptional=false)
Display a dialog asking the user to select a symbol library table.
wxString SelectLibraryFromList()
Display a list of loaded libraries and allows the user to select a library.
void SyncView()
Mark all items for refresh.
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
virtual ~SCH_BASE_FRAME()
const TITLE_BLOCK & GetTitleBlock() const override
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Save Symbol Library Tables to disk.
void RefreshZoomDependentItems()
Mark selected items for refresh.
EESCHEMA_SETTINGS * eeconfig() const
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
void handleActivateEvent(wxActivateEvent &aEvent) override
Handle a window activation event.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
const PAGE_INFO & GetPageSettings() const override
COLOR4D GetDrawBgColor() const override
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper to retrieve a layer color from the global color settings.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:130
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: sch_screen.h:156
void Update(SCH_ITEM *aItem)
Update aItem's bounding box in the tree.
Definition: sch_screen.cpp:259
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:131
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:154
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
static const wxString & GetSymbolLibTableFileName()
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
Object used to load, save, search, and otherwise manipulate symbol library files.
bool IsCache() const
LIB_SYMBOL * FindSymbol(const wxString &aName) const
Find LIB_SYMBOL by aName.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
wxString wx_str() const
Definition: utf8.cpp:46
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
This file is part of the common library.
#define _(s)
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:341
@ LAYER_SCHEMATIC_GRID_AXES
Definition: layer_ids.h:375
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:53
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
Declaration of the NL_SCHEMATIC_PLUGIN class.
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
LIB_SYMBOL * SchGetLibSymbol(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, SYMBOL_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
std::vector< wxString > pinned_symbol_libs
const double IU_PER_MILS
Definition: base_units.h:78
Definition for symbol library class.
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:156