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 <dick@softplc.com>
5  * Copyright (C) 2015-2019 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>
27 #include <pgm_base.h>
28 #include <eeschema_settings.h>
29 #include <sch_draw_panel.h>
30 #include <sch_view.h>
31 #include <sch_painter.h>
34 #include <confirm.h>
36 #include <class_library.h>
37 #include <lib_edit_frame.h>
38 #include <lib_view_frame.h>
39 #include <sch_base_frame.h>
40 #include <symbol_lib_table.h>
41 #include <tool/action_toolbar.h>
42 #include <tool/tool_manager.h>
43 #include <tool/tool_dispatcher.h>
44 #include <tools/ee_actions.h>
46 
47 
48 LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
49  wxWindow* aParent, bool aShowErrorMsg )
50 {
51  // wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
52  wxCHECK_MSG( aLibTable, NULL, "Invalid symbol library table." );
53 
54  LIB_PART* symbol = NULL;
55 
56  try
57  {
58  symbol = aLibTable->LoadSymbol( aLibId );
59 
60  if( !symbol && aCacheLib )
61  symbol = aCacheLib->FindPart( aLibId );
62  }
63  catch( const IO_ERROR& ioe )
64  {
65  if( aShowErrorMsg )
66  {
67  wxString msg = wxString::Format( _( "Error loading symbol '%s' from library '%s'." ),
68  aLibId.GetLibItemName().wx_str(),
69  aLibId.GetLibNickname().wx_str() );
70  DisplayErrorMessage( aParent, msg, ioe.What() );
71  }
72  }
73 
74  return symbol;
75 }
76 
77 
78 // Static members:
79 
80 SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindowType,
81  const wxString& aTitle, const wxPoint& aPosition,
82  const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
83  EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName )
84 {
85  createCanvas();
86 
87  m_zoomLevelCoeff = 11.0 * IU_PER_MILS; // Adjusted to roughly displays zoom level = 1
88  // when the screen shows a 1:1 image
89  // obviously depends on the monitor,
90  // but this is an acceptable value
92  Mils2iu( DEFAULT_REPEAT_OFFSET_Y ) );
95  m_repeatComponent = false;
96  m_useAllUnits = false;
97 }
98 
99 
101 {
102 }
103 
104 
106 {
108 }
109 
110 
112 {
113  EDA_DRAW_FRAME::SetScreen( aScreen );
114 
115  if( m_toolManager )
116  {
117  m_toolManager->SetEnvironment( aScreen, GetCanvas()->GetView(),
118  GetCanvas()->GetViewControls(), this );
119  }
120 }
121 
122 
124 {
126 }
127 
128 
129 void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
130 {
131  GetScreen()->SetPageSettings( aPageSettings );
132 }
133 
134 
136 {
137  return GetScreen()->GetPageSettings();
138 }
139 
140 
141 const wxSize SCH_BASE_FRAME::GetPageSizeIU() const
142 {
143  // GetSizeIU is compile time dependent:
144  return GetScreen()->GetPageSettings().GetSizeIU();
145 }
146 
147 
149 {
150  wxASSERT( GetScreen() );
151  return GetScreen()->GetAuxOrigin();
152 }
153 
154 
155 void SCH_BASE_FRAME::SetAuxOrigin( const wxPoint& aPosition )
156 {
157  wxASSERT( GetScreen() );
158  GetScreen()->SetAuxOrigin( aPosition );
159 }
160 
161 
163 {
164  wxASSERT( GetScreen() );
165  return GetScreen()->GetTitleBlock();
166 }
167 
168 
169 void SCH_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
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 coordinates:
188  double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x );
189  double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y );
190 
191  wxString absformatter;
192  wxString locformatter;
193 
194  switch( GetUserUnits() )
195  {
196  case EDA_UNITS::INCHES:
197  absformatter = "X %.3f Y %.3f";
198  locformatter = "dx %.3f dy %.3f dist %.3f";
199  break;
200 
202  absformatter = "X %.4f Y %.4f";
203  locformatter = "dx %.4f dy %.4f dist %.4f";
204  break;
205 
206  case EDA_UNITS::UNSCALED:
207  absformatter = "X %f Y %f";
208  locformatter = "dx %f dy %f dist %f";
209  break;
210 
211  default:
212  wxASSERT( false );
213  break;
214  }
215 
216  line.Printf( absformatter, dXpos, dYpos );
217  SetStatusText( line, 2 );
218 
219  // Display relative coordinates:
220  double dx = cursorPos.x - screen->m_LocalOrigin.x;
221  double dy = cursorPos.y - screen->m_LocalOrigin.y;
222 
223  dXpos = To_User_Unit( GetUserUnits(), dx );
224  dYpos = To_User_Unit( GetUserUnits(), dy );
225 
226  // We already decided the formatter above
227  line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
228  SetStatusText( line, 3 );
229 
230  // refresh grid display
231  DisplayGridMsg();
232 
233  // refresh units display
234  DisplayUnitsMsg();
235 }
236 
237 
238 LIB_PART* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg )
239 {
240  PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
241 
242  return SchGetLibPart( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
243 }
244 
245 
246 bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject )
247 {
248  wxString msg;
249  bool success = true;
250 
251  if( aGlobal )
252  {
253  try
254  {
256  }
257  catch( const IO_ERROR& ioe )
258  {
259  success = false;
260  msg.Printf( _( "Error saving global symbol library table:\n%s" ), ioe.What() );
261  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
262  }
263  }
264 
265  if( aProject && !Prj().GetProjectName().IsEmpty() )
266  {
267  wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
268 
269  try
270  {
271  Prj().SchSymbolLibTable()->Save( fn.GetFullPath() );
272  }
273  catch( const IO_ERROR& ioe )
274  {
275  success = false;
276  msg.Printf( _( "Error saving project-specific symbol library table:\n%s" ), ioe.What() );
277  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
278  }
279  }
280 
281  return success;
282 }
283 
284 
285 void SCH_BASE_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
286 {
287  KIGFX::GAL* gal = GetCanvas()->GetGAL();
288 
289  double selectedZoom = GetScreen()->GetZoom();
290  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
291  double scale = 1.0 / ( zoomFactor * selectedZoom );
292 
293  if( aCenterPoint != wxPoint( 0, 0 ) )
294  GetCanvas()->GetView()->SetScale( scale, aCenterPoint );
295  else
296  GetCanvas()->GetView()->SetScale( scale );
297 
298  GetCanvas()->GetView()->SetCenter( aCenterPoint );
299 
300  if( aWarpPointer )
302 
303  GetCanvas()->Refresh();
304 }
305 
306 
307 void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
308 {
309  GetCanvas()->GetView()->SetCenter( aCenterPoint );
310 
311  if( aWarpPointer )
312  GetCanvas()->GetViewControls()->WarpCursor( aCenterPoint, true );
313 
314  GetCanvas()->Refresh();
315 }
316 
317 
319 {
320  static KIID lastBrightenedItemID( niluuid );
321 
322  SCH_SHEET_LIST sheetList( g_RootSheet );
324  SCH_ITEM* lastItem = sheetList.GetItem( lastBrightenedItemID, &dummy );
325 
326  if( lastItem && lastItem != aItem )
327  {
328  lastItem->ClearBrightened();
329 
330  RefreshItem( lastItem );
331  lastBrightenedItemID = niluuid;
332  }
333 
334  if( aItem )
335  {
336  aItem->SetBrightened();
337 
338  RefreshItem( aItem );
339  lastBrightenedItemID = aItem->m_Uuid;
340 
341  wxPoint position = aItem->GetPosition();
342 
343  if( aItem->GetParent() && aItem->GetParent()->Type() == SCH_COMPONENT_T )
344  {
345  SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( aItem->GetParent() );
346  position += comp->GetPosition();
347  }
348 
349  FocusOnLocation( position );
350  }
351 }
352 
353 
355 {
357  GetCanvas()->ForceRefresh();
358 }
359 
360 
362 {
363  return static_cast<SCH_DRAW_PANEL*>( EDA_DRAW_FRAME::GetCanvas() );
364 }
365 
366 
368 {
369  KIGFX::PAINTER* painter = GetCanvas()->GetView()->GetPainter();
370  return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->GetSettings() );
371 }
372 
373 
375 {
377 
378  // Allows only a CAIRO or OPENGL canvas:
381  {
383  }
384 
385  SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
388 }
389 
390 
391 void SCH_BASE_FRAME::RefreshItem( EDA_ITEM* aItem, bool isAddOrDelete )
392 {
393  EDA_ITEM* parent = aItem->GetParent();
394 
395  if( aItem->Type() == SCH_SHEET_PIN_T )
396  {
397  // Sheet pins aren't in the view. Refresh their parent.
398  if( parent )
399  GetCanvas()->GetView()->Update( parent );
400  }
401  else
402  {
403  if( !isAddOrDelete )
404  GetCanvas()->GetView()->Update( aItem );
405 
406  // Component children are drawn from their parents. Mark them for re-paint.
407  if( parent && parent->Type() == SCH_COMPONENT_T )
408  GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
409  else if( parent && parent->Type() == SCH_SHEET_T )
410  GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
411  }
412 
413  GetCanvas()->Refresh();
414 }
415 
416 
418 {
419  if( m_toolManager )
420  {
422  SELECTION& selection = selectionTool->GetSelection();
423  KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
424 
425  for( EDA_ITEM* item : selection )
426  {
427  EDA_ITEM* parent = item->GetParent();
428 
429  if( item->Type() == SCH_SHEET_PIN_T )
430  {
431  // Sheet pins aren't in the view. Refresh their parent.
432  if( parent )
433  GetCanvas()->GetView()->Update( parent );
434  }
435  else
436  {
437  view->Update( item, KIGFX::REPAINT );
438 
439  // Component children are drawn from their parents. Mark them for re-paint.
440  if( parent && parent->Type() == SCH_COMPONENT_T )
441  GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
442  }
443  }
444  }
445 }
446 
447 
449 {
450  auto screen = aScreen;
451 
452  if( aScreen == nullptr )
453  screen = GetScreen();
454 
455  screen->Append( (SCH_ITEM*) aItem );
456 
457  if( screen == GetScreen() )
458  {
459  GetCanvas()->GetView()->Add( aItem );
460  RefreshItem( aItem, true ); // handle any additional parent semantics
461  }
462 }
463 
464 
466 {
467  auto screen = aScreen;
468 
469  if( aScreen == nullptr )
470  screen = GetScreen();
471 
472  if( screen == GetScreen() )
473  GetCanvas()->GetView()->Remove( aItem );
474 
475  screen->Remove( (SCH_ITEM*) aItem );
476 
477  if( screen == GetScreen() )
478  RefreshItem( aItem, true ); // handle any additional parent semantics
479 }
480 
481 
483 {
484  auto gs = GetScreen()->GetGridSize();
485  GetCanvas()->GetGAL()->SetGridSize( VECTOR2D( gs.x, gs.y ));
487 }
488 
489 
491 {
492  return GetColorSettings()->GetColor( aLayer );
493 }
494 
495 
497 {
498  if( !m_colorSettings )
499  {
500  auto cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
501  m_colorSettings = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
502  }
503 
504  return m_colorSettings;
505 }
double To_User_Unit(EDA_UNITS aUnit, double aValue, bool aUseMils)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:95
void SetScreen(BASE_SCREEN *aScreen) override
void RefreshSelection()
Mark selected items for refresh.
SCH_SHEET_LIST.
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
static const wxString & GetSymbolLibTableFileName()
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:279
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
static S3D_CACHE * cache
Definition: export_vrml.cpp:65
void ForceRefresh()
Function ForceRefresh() Forces a redraw.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
void HardRedraw() override
Rebuild the GAL and redraws the screen.
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
#define DEFAULT_REPEAT_LABEL_INC
the default value (overwritten by the eeschema config)
Definition: general.h:48
virtual void SetScreen(BASE_SCREEN *aScreen)
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:240
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper to retrieve a layer color from the global color settings.
wxPoint m_repeatStep
void SetBrightened()
Definition: base_struct.h:233
LIB_PART * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_PART having aName from the library given by aNickname.
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:162
const wxPoint & GetAuxOrigin() const override
Return the origin of the axis used for plotting and various exports.
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: sch_screen.h:153
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
COLOR_SETTINGS * GetColorSettings() override
Returns a pointer to the active color theme settings.
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen=nullptr)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
void SetAuxOrigin(const wxPoint &aPosition)
Definition: sch_screen.h:160
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Item needs to be redrawn.
Definition: view_item.h:61
The base class for create windows for drawing purpose.
TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout,...
Definition: title_block.h:40
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:152
const wxString GetZoomLevelIndicator() const override
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void DisplayUnitsMsg()
Display current unit pane on the status bar.
void ClearBrightened()
Definition: base_struct.h:237
EE_SELECTION & GetSelection()
Function GetSelection()
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
Definition: common.h:65
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
virtual wxPoint GetPosition() const =0
Function GetPosition.
PAINTER contains all the knowledge about how to draw graphical object onto any particular output devi...
Definition: painter.h:308
Item is being added to the view.
Definition: view_item.h:60
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
#define NULL
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void SetAuxOrigin(const wxPoint &aPosition) override
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:74
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIID niluuid(0)
Define a library symbol object.
virtual ~SCH_BASE_FRAME()
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
EDA_ITEM * GetParent() const
Definition: base_struct.h:217
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
double GetZoomFactor() const
Get the zoom factor.
#define DEFAULT_REPEAT_OFFSET_Y
the default Y value (overwritten by the eeschema config)
Definition: general.h:47
SCH_LAYER_ID
Eeschema drawing layers.
SCH_SHEET_PATH.
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: sch_screen.h:164
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
bool m_showPinElectricalTypeName
void SetPageSettings(const PAGE_INFO &aPageSettings) override
LIB_PART * FindPart(const wxString &aName) const
Find LIB_PART by aName.
void FocusOnItem(SCH_ITEM *aItem)
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: sch_view.cpp:73
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
COLOR_SETTINGS * m_colorSettings
virtual const wxString GetZoomLevelIndicator() const
Return a human readable value which can be displayed as zoom level indicator in dialogs.
#define DEFAULT_REPEAT_OFFSET_X
the default X value (overwritten by the eeschema config)
Definition: general.h:46
const KIID m_Uuid
Definition: base_struct.h:169
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut)
Fetch a SCH_ITEM by ID.
const PAGE_INFO & GetPageSettings() const override
void UpdateStatusBar() override
Update the status bar information.
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
COLOR4D GetColor(int aLayer) const
double m_zoomLevelCoeff
const int scale
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
#define _(s)
Definition: 3d_actions.cpp:33
const TITLE_BLOCK & GetTitleBlock() const override
wxString wx_str() const
Definition: utf8.cpp:51
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:99
wxPoint GetPosition() const override
Function GetPosition.
#define IU_PER_MILS
Definition: plotter.cpp:137
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, EDA_BASE_FRAME *aFrame)
Sets the work environment (model, view, view controls and the parent window).
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:69
virtual void CenterScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
LIB_PART * SchGetLibPart(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, PART_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
TOOL_MANAGER * m_toolManager
SCH_SHEET * g_RootSheet
void UpdateStatusBar() override
Update the status bar information.
Definition for part library class.
void DisplayGridMsg()
Display current grid pane on the status bar.
double GetWorldScale() const
Get the world scale.
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
const wxPoint & GetAuxOrigin() const
Definition: sch_screen.h:159
Object used to load, save, search, and otherwise manipulate symbol library files.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:114
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
Class GAL is the abstract interface for drawing on a 2D-surface.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40