47 wxWindow* aParent,
bool aShowErrorMsg )
49 wxCHECK_MSG( aLibTable,
nullptr,
"Invalid symbol library table." );
57 if( !symbol && aCacheLib )
59 wxCHECK_MSG( aCacheLib->
IsCache(),
nullptr,
"Invalid cache library." );
63 symbol = aCacheLib->
FindPart( cacheName );
70 wxString msg =
wxString::Format(
_(
"Error loading symbol '%s' from library '%s'." ),
82 const wxString& aTitle,
const wxPoint& aPosition,
83 const wxSize& aSize,
long aStyle,
const wxString& aFrameName ) :
84 EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName ),
85 m_base_frame_defaults( nullptr,
"base_Frame_defaults" ),
86 m_defaults( &m_base_frame_defaults )
91 [
this]( wxIdleEvent& aEvent )
100 selTool->
OnIdle( aEvent );
119 return dynamic_cast<EESCHEMA_SETTINGS*>(
config() );
125 return dynamic_cast<SYMBOL_EDITOR_SETTINGS*>(
config() );
176 line.Printf(
"X %s Y %s",
179 SetStatusText( line, 2 );
181 line.Printf(
"dx %s dy %s dist %s",
185 SetStatusText( line, 3 );
217 msg.Printf(
_(
"Error saving global symbol library table:\n%s" ), ioe.
What() );
218 wxMessageBox( msg,
_(
"File Save Error" ), wxOK | wxICON_ERROR );
222 if( aProject && !
Prj().GetProjectName().IsEmpty() )
228 Prj().SchSymbolLibTable()->Save( fn.GetFullPath() );
233 msg.Printf(
_(
"Error saving project-specific symbol library table:\n%s" ), ioe.
What() );
234 wxMessageBox( msg,
_(
"File Save Error" ), wxOK | wxICON_ERROR );
280 return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->
GetSettings() );
319 if( parent && parent->
IsType( parentTypes ) )
364 auto screen = aScreen;
366 if( aScreen ==
nullptr )
369 screen->Append( (
SCH_ITEM*) aItem );
381 auto screen = aScreen;
383 if( aScreen ==
nullptr )
389 screen->Remove( (
SCH_ITEM*) aItem );
428 const_cast<SCH_BASE_FRAME*>(
this )->m_colorSettings = colorSettings;
void RefreshSelection()
Mark selected items for refresh.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static const wxString & GetSymbolLibTableFileName()
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
const UTF8 & GetLibItemName() const
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 UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
void ForceRefresh()
Force a redraw.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return 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.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
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.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
static constexpr GAL_TYPE GAL_FALLBACK
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper to retrieve a layer color from the global color settings.
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,...
LIB_PART * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_PART having aName from the library given by aNickname.
const TITLE_BLOCK & GetTitleBlock() const
void SetPageSettings(const PAGE_INFO &aPageSettings)
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
A logical library item identifier and consists of various portions much like a URI.
The base class for create windows for drawing purpose.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
const PAGE_INFO & GetPageSettings() const
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
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
Return the painter object used by the view for drawing #VIEW_ITEMS.
void DisplayUnitsMsg()
Display current unit pane in the status bar.
EESCHEMA_SETTINGS * eeconfig() const
virtual void CenterOnCursor() const =0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Item needs to be redrawn.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
virtual const wxString What() const
A composite of Problem() and Where()
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Describe the page size and margins of a paper page on which to eventually print or plot.
Handles how to draw a screen (a board, a schematic ...)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Define a library symbol object.
virtual ~SCH_BASE_FRAME()
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
EDA_ITEM * GetParent() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
AppSettings * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
SYMBOL_EDITOR_SETTINGS * libeditconfig() const
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
SCH_LAYER_ID
Eeschema drawing layers.
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
COLOR4D GetDrawBgColor() const override
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
COLOR_SETTINGS * GetColorSettings() const override
Returns a pointer to the active color theme settings.
void SetPageSettings(const PAGE_INFO &aPageSettings) override
LIB_PART * FindPart(const wxString &aName) const
Find LIB_PART by aName.
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
The current canvas type.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
const PAGE_INFO & GetPageSettings() const override
void UpdateStatusBar() override
Update the status bar information.
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
COLOR4D GetColor(int aLayer) const
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,...
const TITLE_BLOCK & GetTitleBlock() const override
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
A base class for most all the KiCad significant classes used in schematics and boards.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Color settings are a bit different than most of the settings objects in that there can be more than o...
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)
Add a VIEW_ITEM to the view.
void UpdateStatusBar() override
Update the status bar information.
Definition for part library class.
virtual void DisplayGridMsg()
Display current grid size in the status bar.
Object used to load, save, search, and otherwise manipulate symbol library files.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Base class for any item which can be embedded within the SCHEMATIC container class,...
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
Return the current cursor position in world coordinates.
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...
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
KICAD_T Type() const
Returns the type of object.
wxString m_ColorTheme
Active color theme name.
A color representation with 4 components: red, green, blue, alpha.