KiCad PCB EDA Suite
SCH_EDIT_FRAME Class Reference

Schematic editor (Eeschema) main window. More...

#include <sch_edit_frame.h>

Inheritance diagram for SCH_EDIT_FRAME:
SCH_BASE_FRAME EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME TOOLS_HOLDER KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

 SCH_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
 ~SCH_EDIT_FRAME () override
 
SCH_SCREENGetScreen () const override
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
SCHEMATICSchematic () const
 
void OnCloseWindow (wxCloseEvent &Event)
 
bool GetShowAllPins () const override
 Allow edit frame to show/hide hidden pins. More...
 
void SaveProjectSettings () override
 Save changes to the project settings to the project (.pro) file. More...
 
bool LoadProjectSettings ()
 Loads the KiCad project file (*.pro) settings specific to Eeschema. More...
 
void ShowSchematicSetupDialog (const wxString &aInitialPage=wxEmptyString)
 
void AddTemplateFieldName (const TEMPLATE_FIELDNAME &aFieldName, bool aGlobal)
 Insert or append a wanted symbol field name into the field names template. More...
 
void DeleteAllTemplateFieldNames (bool aGlobal)
 Remove all global or project fieldname templates. More...
 
void LoadSettings (APP_SETTINGS_BASE *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (APP_SETTINGS_BASE *aCfg) override
 Saves common frame parameters to a configuration data file. More...
 
void CreateScreens ()
 
void ReCreateHToolbar () override
 
void ReCreateVToolbar () override
 
void ReCreateOptToolbar () override
 
void ReCreateMenuBar () override
 Recreates the menu bar. More...
 
bool IsContentModified () override
 Get if the current schematic has been modified but not saved. More...
 
void OnModify () override
 Must be called after a schematic change in order to set the "modify" flag of the current screen and update the date in frame reference. More...
 
wxString GetScreenDesc () const override
 Return a human-readable description of the current screen. More...
 
void ExecuteRemoteCommand (const char *cmdline) override
 Execute a remote command sent by Pcbnew via a socket connection. More...
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
void AddItemToScreenAndUndoList (SCH_ITEM *aItem, bool aUndoAppend=false)
 Add an item to the schematic and adds the changes to the undo/redo container. More...
 
void ShowFindReplaceDialog (bool aReplace)
 Run the Find or Find & Replace dialog. More...
 
void UpdateHierarchyNavigator (bool aForceUpdate=false)
 Run the Hierarchy Navigator dialog. More...
 
HIERARCHY_NAVIG_DLGFindHierarchyNavigator ()
 
void ShowFindReplaceStatus (const wxString &aMsg, int aStatusTime)
 
void ClearFindReplaceStatus ()
 
wxFindReplaceData * GetFindReplaceData ()
 Get the find criteria (as set by the dialog). More...
 
void OnFindDialogClose ()
 Notification that the Find dialog has closed. More...
 
bool BreakSegment (SCH_LINE *aSegment, const wxPoint &aPoint, SCH_LINE **aNewSegment=NULL, SCH_SCREEN *aScreen=nullptr)
 Breaks a single segment into two at the specified point. More...
 
bool BreakSegments (const wxPoint &aPoint, SCH_SCREEN *aScreen=nullptr)
 Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an intersection is found. More...
 
bool BreakSegmentsOnJunctions (SCH_SCREEN *aScreen=nullptr)
 Tests all junctions and bus entries in the schematic for intersections with wires and buses and breaks any intersections into multiple segments. More...
 
bool TestDanglingEnds ()
 Test all of the connectable objects in the schematic for unused connection points. More...
 
void SendMessageToPCBNEW (EDA_ITEM *aObjectToSync, SCH_COMPONENT *aPart)
 Send a message to Pcbnew via a socket connection. More...
 
void SendCrossProbeNetName (const wxString &aNetName)
 Sends a net name to pcbnew for highlighting. More...
 
void SetCrossProbeConnection (const SCH_CONNECTION *aConnection)
 Sends a connection (net or bus) to pcbnew for highlighting. More...
 
void SendCrossProbeClearHighlight ()
 Tells PcbNew to clear the existing highlighted net, if one exists. More...
 
const SCH_CONNECTIONGetHighlightedConnection () const
 
void SetHighlightedConnection (const SCH_CONNECTION *aConnection)
 
NETLIST_OBJECT_LISTBuildNetListBase (bool updateStatusText=true)
 Create a flat list which stores all connected objects. More...
 
bool ReadyToNetlist (bool aSilent=false, bool aSilentAnnotate=false)
 Checks if we are ready to write a netlist file for the current schematic. More...
 
bool WriteNetListFile (int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
 Create a netlist file. More...
 
void DeleteAnnotation (bool aCurrentSheetOnly)
 Clear the current component annotation. More...
 
void AnnotateComponents (bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, REPORTER &aReporter)
 Annotate the components in the schematic that are not currently annotated. More...
 
int CheckAnnotate (REPORTER &aReporter, bool aOneSheetOnly)
 Check for annotation errors. More...
 
int ModalAnnotate (const wxString &aMessage)
 Run a modal version of the Annotate dialog for a specific purpose. More...
 
SCH_SHEET_PATHGetCurrentSheet () const
 
void SetCurrentSheet (const SCH_SHEET_PATH &aSheet)
 
void HardRedraw () override
 Rebuild the GAL and redraw the screen. More...
 
void DisplayCurrentSheet ()
 Draw the current sheet on the display. More...
 
void DrawCurrentSheetToClipboard ()
 Use the wxWidgets print code to draw an image of the current sheet onto the clipboard. More...
 
void OnPageSettingsChange () override
 Called when modifying the page settings. More...
 
wxString GetUniqueFilenameForCurrentSheet ()
 
void SetSheetNumberAndCount ()
 Set the m_ScreenNumber and m_NumberOfScreens members for screens. More...
 
wxPageSetupDialogData & GetPageSetupData ()
 
void NewProject ()
 
void LoadProject ()
 
void Save_File (bool doSaveAs=false)
 
bool SaveProject ()
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
wxString GetCurrentFileName () const override
 Get the full filename + path of the currently opened file in the frame. More...
 
bool AppendSchematic ()
 Import a KiCad schematic into the current sheet. More...
 
bool SaveEEFile (SCH_SHEET *aSheet, bool aSaveUnderNewName=false)
 Save aSheet to a schematic file. More...
 
bool AskToSaveChanges ()
 Checks if any of the screens has unsaved changes and asks the user whether to save or drop them. More...
 
SCH_JUNCTIONAddJunction (const wxPoint &aPos, bool aAppendToUndo=false, bool aFinal=true)
 
bool SchematicCleanUp (SCH_SCREEN *aScreen=nullptr)
 Performs routine schematic cleaning including breaking wire and buses and deleting identical objects superimposed on top of each other. More...
 
bool TrimWire (const wxPoint &aStart, const wxPoint &aEnd)
 If any single wire passes through both points, remove the portion between the two points, potentially splitting the wire into two. More...
 
void GetSchematicConnections (std::vector< wxPoint > &aConnections)
 Collects a unique list of all possible connection points in the schematic. More...
 
void OnOpenPcbnew (wxCommandEvent &event)
 
void OnOpenCvpcb (wxCommandEvent &event)
 
void OnUpdatePCB (wxCommandEvent &event)
 
void OnAnnotate (wxCommandEvent &event)
 
bool CheckSheetForRecursion (SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
 Verify that aSheet will not cause a recursion error in aHierarchy. More...
 
bool AllowCaseSensitiveFileNameClashes (const wxString &aSchematicFileName)
 Check aSchematicFileName for a potential file name case sensitivity clashes. More...
 
bool EditSheetProperties (SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
 Edit an existing sheet or add a new sheet to the schematic. More...
 
void InitSheet (SCH_SHEET *aSheet, const wxString &aNewFilename)
 
bool LoadSheetFromFile (SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
 Load a the KiCad schematic file aFileName into the sheet aSheet. More...
 
SCH_SHEET_PINCreateSheetPin (SCH_SHEET *aSheet, SCH_HIERLABEL *aLabel)
 Create a new SCH_SHEET_PIN object and add it to aSheet at the current cursor position. More...
 
SCH_HIERLABELImportHierLabel (SCH_SHEET *aSheet)
 Import a hierarchical label with no attached sheet pin. More...
 
void DeleteJunction (SCH_ITEM *aItem, bool aAppend=false)
 Removes a given junction and heals any wire segments under the junction. More...
 
void ConvertPart (SCH_COMPONENT *aComponent)
 
void SelectUnit (SCH_COMPONENT *aComponent, int aUnit)
 
void SaveCopyInUndoList (SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Create a copy of the current schematic item, and put it in the undo list. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Create a new entry in undo list of commands. More...
 
void PutDataInPreviousState (PICKED_ITEMS_LIST *aList, bool aRedoCommand)
 Restore an undo or redo command to put data pointed by aList in the previous state. More...
 
void SaveCopyForRepeatItem (SCH_ITEM *aItem)
 Clone aItem and owns that clone in this container. More...
 
SCH_ITEMGetRepeatItem () const
 Return the item which is to be repeated with the insert key. More...
 
EDA_ITEMGetItem (const KIID &aId) override
 Fetch an item by KIID. More...
 
void RollbackSchematicFromUndo ()
 Performs an undo of the last edit WITHOUT logging a corresponding redo. More...
 
bool CreateArchiveLibraryCacheFile (bool aUseCurrentSheetFilename=false)
 Create a symbol library file with the name of the root document plus the '-cache' suffix,. More...
 
bool CreateArchiveLibrary (const wxString &aFileName)
 Create a library aFileName that contains all components used in the current schematic. More...
 
virtual void PrintPage (RENDER_SETTINGS *aSettings) override
 Plot or print the current sheet to the clipboard. More...
 
void SetNetListerCommand (const wxString &aCommand)
 
void DefaultExecFlags ()
 Reset the execution flags to defaults for external netlist and bom generators. More...
 
void SetExecFlags (const int aFlags)
 Set (adds) specified flags for next execution of external generator of the netlist or bom. More...
 
void ClearExecFlags (const int aFlags)
 Clear (removes) specified flags that not needed for next execution of external generator of the netlist or bom. More...
 
wxString GetNetListerCommand () const
 
void RecalculateConnections (SCH_CLEANUP_FLAGS aCleanupFlags)
 Generates the connection data for the entire schematic hierarchy. More...
 
void InstallPreferences (PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
 Allows Eeschema to install its preferences panels into the preferences dialog. More...
 
void CommonSettingsChanged (bool aEnvVarsChanged) override
 Called after the preferences dialog is run. More...
 
void ShowChangedLanguage () override
 Redraw the menus and what not in current language. More...
 
void SyncToolbars () override
 Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
void SetScreen (BASE_SCREEN *aScreen) override
 
const BOX2I GetDocumentExtents () const override
 
void FixupJunctions ()
 
void FocusOnItem (SCH_ITEM *aItem)
 
void ConvertTimeStampUuids ()
 Convert sheet and symbol legacy time stamp UUIDs to full UUIDs. More...
 
void createCanvas ()
 
SCH_DRAW_PANELGetCanvas () const override
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
EESCHEMA_SETTINGSeeconfig () const
 
LIBEDIT_SETTINGSlibeditconfig () const
 
KIGFX::SCH_RENDER_SETTINGSGetRenderSettings ()
 
SCHEMATIC_SETTINGSGetDefaults ()
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Update the status bar information. More...
 
COMPONENT_SELECTION SelectCompFromLibTree (const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
const TEMPLATE_FIELDNAMESGetTemplateFieldNames ()
 Return a template field names list for read only access. More...
 
const TEMPLATE_FIELDNAMESGetTemplateFieldNames (bool aGlobal)
 Return a specific template field names list (global or project) for read only access. More...
 
const TEMPLATE_FIELDNAMEGetTemplateFieldName (const wxString &aName)
 Search for aName in the the template field name list. More...
 
LIB_PARTGetLibPart (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 Load symbol from symbol library table. More...
 
LIB_PARTGetFlattenedLibPart (const LIB_ID &aLibId, bool aShowErrorMsg=false)
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 
virtual void CenterScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 
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, if not the current screen. More...
 
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, if not the current screen. More...
 
void RefreshItem (EDA_ITEM *aItem, bool isAddOrDelete=false)
 Mark an item for refresh. More...
 
void RefreshSelection ()
 Mark selected items for refresh. More...
 
void SyncView ()
 Mark all items for refresh. More...
 
COLOR4D GetLayerColor (SCH_LAYER_ID aLayer)
 Helper to retrieve a layer color from the global color settings. More...
 
COLOR_SETTINGSGetColorSettings () override
 Returns a pointer to the active color theme settings. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
wxArrayString & GetFindHistoryList ()
 
bool GetShowPolarCoords () const
 For those frames that support polar coordinates. More...
 
void SetShowPolarCoords (bool aShow)
 
void ToggleUserUnits () override
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition) const
 Return the nearest aGridSize location to aPosition. More...
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
void EraseMsgBox ()
 
virtual void ReCreateAuxiliaryToolbar ()
 
bool IsGridVisible () const
 
virtual void SetGridVisibility (bool aVisible)
 
virtual COLOR4D GetGridColor ()
 
virtual void SetGridColor (COLOR4D aColor)
 
void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
void OnGridSettings (wxCommandEvent &event)
 
void UpdateGridSelectBox ()
 Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes, etc.) More...
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 Update the checked item in the grid combobox. More...
 
void UpdateZoomSelectBox ()
 Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes, etc.) More...
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 Update the checked item in the zoom combobox. More...
 
const wxString GetZoomLevelIndicator () const
 Return a human readable value for display in dialogs. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnMove (wxMoveEvent &aEvent) override
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void FocusOnLocation (const wxPoint &aPos)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
void AddStandardSubMenus (TOOL_MENU &aMenu)
 Function CreateBasicMenu. More...
 
void PrintWorkSheet (RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Prints the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg) override
 
void DisplayUnitsMsg ()
 Display current unit pane in the status bar. More...
 
virtual void DisplayGridMsg ()
 Display current grid size in the status bar. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
virtual void ClearMsgPanel ()
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
virtual void ActivateGalCanvas ()
 Use to start up the GAL drawing canvas. More...
 
virtual void SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
void SetCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
wxWindow * GetToolCanvas () const override
 Canvas access. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
void RefreshCanvas () override
 
void RecreateToolbars ()
 Rebuild all toolbars, and update the checked state of ckeck tools. More...
 
virtual void ParseArgs (wxCmdLineParser &aParser)
 Handles command-line arguments in a frame-specific way. More...
 
virtual bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool IsModal () const
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
EDA_UNITS GetUserUnits () const
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS aUnits)
 
void ChangeUserUnits (EDA_UNITS aUnits)
 
SETTINGS_MANAGERGetSettingsManager () const
 
virtual int GetSeverity (int aErrorCode) const
 
bool ProcessEvent (wxEvent &aEvent) override
 Override the default process event handler to implement the auto save feature. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
void OnMenuEvent (wxMenuEvent &event)
 The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
void OnMaximize (wxMaximizeEvent &aEvent)
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
virtual const SEARCH_STACKsys_search ()
 Return a SEARCH_STACK pertaining to entire program. More...
 
virtual wxString help_name ()
 
void OnKicadAbout (wxCommandEvent &event)
 
void OnPreferences (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
WX_INFOBARGetInfoBar ()
 
virtual APP_SETTINGS_BASEconfig () const
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
void LoadWindowSettings (WINDOW_SETTINGS *aCfg)
 Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Saves window settings to the given settings object Normally called by SaveSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
virtual WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg)
 Returns a pointer to the window settings for this frame. More...
 
wxString ConfigBaseName () override
 
void ImportHotkeyConfigFromFile (std::map< std::string, TOOL_ACTION * > aActionMap, const wxString &aDefaultShortname)
 Prompt the user for a hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
 Fetches the file name from the file history list. More...
 
void ClearFileHistory (FILE_HISTORY *aFileHistory=nullptr)
 Removes all files from the file history. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
 Update the list of recently opened files. More...
 
FILE_HISTORYGetFileHistory ()
 Get the frame's main file history. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
void AddStandardHelpMenu (wxMenuBar *aMenuBar)
 Adds the standard KiCad help menu to the menubar. More...
 
bool IsWritable (const wxFileName &aFileName)
 Checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
const wxString & GetAboutTitle () const
 
void SetShutdownBlockReason (const wxString &reason)
 Sets the block reason why the window/application is preventing OS shutdown. More...
 
void RemoveShutdownBlockReason ()
 Removes any shutdown block reason set. More...
 
bool SupportsShutdownBlockReason ()
 Whether or not the window supports setting a shutdown block reason. More...
 
wxSize GetWindowSize ()
 Get the undecorated window size that can be used for restoring the window size. More...
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const std::string &actionName)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const std::string &actionName)
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
bool GetDoImmediateActions () const
 Indicates that hotkeys should perform an immediate action even if another tool is currently active. More...
 
bool GetDragSelects () const
 Indicates that a drag should draw a selection rectangle, even when started over an item. More...
 
bool GetMoveWarpsCursor () const
 Indicates that a move operation should warp the mouse pointer to the origin of the move object. More...
 
HOLDER_TYPE GetType ()
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

bool doAutoSave () override
 Save the schematic files that have been modified and not yet saved. More...
 
bool isAutoSaveRequired () const override
 Returns true if the schematic has been modified. More...
 
void sendNetlistToCvpcb ()
 Send the kicad netlist over to CVPCB. More...
 
bool saveSymbolLibTables (bool aGlobal, bool aProject)
 Saves Symbol Library Tables to disk. More...
 
void unitsChangeRefresh () override
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
void InitExitKey ()
 Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id. More...
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Handle the auto save timer event. More...
 

Static Protected Member Functions

static wxString GetBackupSuffix ()
 
static wxString GetAutoSaveFilePrefix ()
 

Protected Attributes

TEMPLATES m_templateFieldNames
 
SCHEMATIC_SETTINGS m_base_frame_defaults
 These are only used by libedit. Eeschema should be using the one inside the SCHEMATIC. More...
 
SCHEMATIC_SETTINGSm_defaults
 
wxSocketServer * m_socketServer
 
std::vector< wxSocketBase * > m_sockets
 interprocess communication More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
bool m_showPageLimits
 
COLOR4D m_gridColor
 
COLOR4D m_drawBgColor
 
int m_UndoRedoCountMax
 
bool m_PolarCoords
 
bool m_showBorderAndTitleBlock
 
long m_firstRunDialogSetting
 
wxChoice * m_gridSelectBox
 
wxChoice * m_zoomSelectBox
 
ACTION_TOOLBARm_mainToolBar
 
ACTION_TOOLBARm_auxiliaryToolBar
 
ACTION_TOOLBARm_drawToolBar
 
ACTION_TOOLBARm_optionsToolBar
 
wxFindReplaceData * m_findReplaceData
 
wxArrayString m_findStringHistoryList
 
wxArrayString m_replaceStringHistoryList
 
EDA_MSG_PANELm_messagePanel
 
int m_MsgFrameHeight
 
COLOR_SETTINGSm_colorSettings
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxPoint m_NormalFramePos
 
wxSize m_NormalFrameSize
 
wxString m_AboutTitle
 
wxAuiManager m_auimgr
 
wxString m_perspective
 
WX_INFOBARm_infoBar
 
wxString m_configName
 
SETTINGS_MANAGERm_settingsManager
 
FILE_HISTORYm_fileHistory
 
bool m_hasAutoSave
 
bool m_autoSaveState
 
int m_autoSaveInterval
 
wxTimer * m_autoSaveTimer
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
bool m_dragSelects
 
bool m_moveWarpsCursor
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Member Functions

void setupTools ()
 
void OnExit (wxCommandEvent &event)
 
void OnLoadFile (wxCommandEvent &event)
 
void OnAppendProject (wxCommandEvent &event)
 
void OnImportProject (wxCommandEvent &event)
 
void OnClearFileHistory (wxCommandEvent &aEvent)
 
void UpdateTitle ()
 Set the main window title bar text. More...
 
bool checkForNoFullyDefinedLibIds (SCH_SHEET *aSheet)
 Verify that the symbol library links aSheet and all of it's child sheets have been remapped to the symbol library table. More...
 
bool importFile (const wxString &aFileName, int aFileType)
 Load the given filename but sets the path to the current project path. More...
 
void mapExistingAnnotation (std::map< wxString, wxString > &aMap)
 Fills a map of uuid -> reference from the currently loaded schematic. More...
 

Private Attributes

SCHEMATICm_schematic
 The currently loaded schematic. More...
 
const SCH_CONNECTIONm_highlightedConn
 The highlighted net or bus, or nullptr. More...
 
wxPageSetupDialogData m_pageSetupData
 
SCH_ITEMm_item_to_repeat
 Last item to insert by the repeat command. More...
 
wxString m_netListerCommand
 Command line to call a custom net list generator. More...
 
int m_exec_flags
 Flags of the wxExecute() function to call a custom net list generator. More...
 
DIALOG_SCH_FINDm_findReplaceDialog
 

Static Private Attributes

static PINSHEETLABEL_SHAPE m_lastSheetPinType = PINSHEETLABEL_SHAPE::PS_INPUT
 Last sheet pin type. More...
 

Friends

class SCH_EDITOR_CONTROL
 

Detailed Description

Schematic editor (Eeschema) main window.

Definition at line 118 of file sch_edit_frame.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ SCH_EDIT_FRAME()

SCH_EDIT_FRAME::SCH_EDIT_FRAME ( KIWAY aKiway,
wxWindow *  aParent 
)

Definition at line 208 of file sch_edit_frame.cpp.

208  :
209  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
210  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
211  m_highlightedConn( nullptr ),
212  m_item_to_repeat( nullptr )
213 {
214  m_schematic = new SCHEMATIC( nullptr );
215 
216  m_showBorderAndTitleBlock = true; // true to show sheet references
217  m_hasAutoSave = true;
218  m_AboutTitle = "Eeschema";
219 
220  m_findReplaceDialog = nullptr;
221 
222  // Give an icon
223  wxIcon icon;
224  icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
225  SetIcon( icon );
226 
227  LoadSettings( eeconfig() );
228 
229  // Also links the schematic to the loaded project
230  CreateScreens();
231 
232  // After schematic has been linked to project, SCHEMATIC_SETTINGS works
235 
236  setupTools();
237  ReCreateMenuBar();
241 
242  // Create the infobar
243  m_infoBar = new WX_INFOBAR( this, &m_auimgr );
244 
245  // Initialize common print setup dialog settings.
246  m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
247  m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
248  m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
249  m_pageSetupData.GetPrintData().SetNoCopies( 1 );
250 
251  m_auimgr.SetManagedWindow( this );
252 
253  m_auimgr.AddPane( m_mainToolBar,
254  EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
255  m_auimgr.AddPane( m_optionsToolBar,
256  EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
257  m_auimgr.AddPane( m_drawToolBar,
258  EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
259  m_auimgr.AddPane( m_infoBar,
260  EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
261  m_auimgr.AddPane( GetCanvas(),
262  EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
263  m_auimgr.AddPane( m_messagePanel,
264  EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
265 
266  // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
267  // hidding it.
268  m_auimgr.Update();
269 
270  // We don't want the infobar displayed right away
271  m_auimgr.GetPane( "InfoBar" ).Hide();
272  m_auimgr.Update();
273 
275 
276  if( GetCanvas() )
277  {
278  GetCanvas()->GetGAL()->SetAxesEnabled( false );
279 
280  if( auto p = dynamic_cast<KIGFX::SCH_PAINTER*>( GetCanvas()->GetView()->GetPainter() ) )
281  p->SetSchematic( m_schematic );
282  }
283 
284  InitExitKey();
285 
286  // Net list generator
288 
289  UpdateTitle();
290 
291  // Default shutdown reason until a file is loaded
292  SetShutdownBlockReason( _( "New schematic file is unsaved" ) );
293 
294  // Ensure the window is on top
295  Raise();
296 }
SCHEMATIC * m_schematic
The currently loaded schematic.
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
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 SetShutdownBlockReason(const wxString &reason)
Sets the block reason why the window/application is preventing OS shutdown.
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:42
ACTION_TOOLBAR * m_optionsToolBar
void ReCreateMenuBar() override
Recreates the menu bar.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:138
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
void UpdateTitle()
Set the main window title bar text.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
wxString m_AboutTitle
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_mainToolBar
EESCHEMA_SETTINGS * eeconfig() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
const BITMAP_OPAQUE icon_eeschema_xpm[1]
void ReCreateHToolbar() override
#define SCH_EDIT_FRAME_NAME
wxPageSetupDialogData m_pageSetupData
EDA_MSG_PANEL * m_messagePanel
bool m_showBorderAndTitleBlock
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
DIALOG_SCH_FIND * m_findReplaceDialog
#define KICAD_DEFAULT_DRAWFRAME_STYLE
SCHEMATIC_SETTINGS * m_defaults
void InitExitKey()
Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id.
void SetAxesEnabled(bool aAxesEnabled)
Enables drawing the axes.
Specialization of the wxAuiPaneInfo class for KiCad panels.
void ReCreateOptToolbar() override
bool LoadProjectSettings()
Loads the KiCad project file (*.pro) settings specific to Eeschema.
const SCH_CONNECTION * m_highlightedConn
The highlighted net or bus, or nullptr.
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:68
WX_INFOBAR * m_infoBar
#define _(s)
Definition: 3d_actions.cpp:33
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
void ReCreateVToolbar() override
ACTION_TOOLBAR * m_drawToolBar

References _, PCAD2KICAD::Center, KIGFX::eeconfig(), icon_eeschema_xpm, KiBitmap(), PCAD2KICAD::Left, PCAD2KICAD::Right, and ACTIONS::zoomFitScreen.

◆ ~SCH_EDIT_FRAME()

SCH_EDIT_FRAME::~SCH_EDIT_FRAME ( )
override

Definition at line 299 of file sch_edit_frame.cpp.

300 {
301  // Shutdown all running tools
302  if( m_toolManager )
304 
305  delete m_item_to_repeat; // we own the cloned object, see this->SaveCopyForRepeatItem()
306 
307  SetScreen( NULL );
308 
309  delete m_schematic;
310 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
SCHEMATIC * m_schematic
The currently loaded schematic.
void SetScreen(BASE_SCREEN *aScreen) override
#define NULL
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48

References m_item_to_repeat, m_schematic, TOOLS_HOLDER::m_toolManager, NULL, SetScreen(), and TOOL_MANAGER::ShutdownAllTools().

Member Function Documentation

◆ ActivateGalCanvas()

void EDA_DRAW_FRAME::ActivateGalCanvas ( )
virtualinherited

Use to start up the GAL drawing canvas.

Reimplemented in GERBVIEW_FRAME, PCB_EDIT_FRAME, PCB_BASE_FRAME, FOOTPRINT_EDIT_FRAME, and PCB_BASE_EDIT_FRAME.

Definition at line 638 of file eda_draw_frame.cpp.

639 {
640  GetCanvas()->SetEvtHandlerEnabled( true );
641  GetCanvas()->StartDrawing();
642 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.

References EDA_DRAW_FRAME::GetCanvas(), and EDA_DRAW_PANEL_GAL::StartDrawing().

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), SCH_BASE_FRAME::createCanvas(), SCH_DRAW_PANEL::OnShow(), and EDA_DRAW_FRAME::SwitchCanvas().

◆ AddItemToScreenAndUndoList()

void SCH_EDIT_FRAME::AddItemToScreenAndUndoList ( SCH_ITEM aItem,
bool  aUndoAppend = false 
)

Add an item to the schematic and adds the changes to the undo/redo container.

Parameters
aUndoAppendTrue if the action should be appended to the current undo record.

Definition at line 894 of file sch_edit_frame.cpp.

895 {
896  SCH_SCREEN* screen = GetScreen();
897 
898  wxCHECK_RET( aItem != NULL, wxT( "Cannot add null item to list." ) );
899 
900  SCH_SHEET* parentSheet = nullptr;
901  SCH_COMPONENT* parentComponent = nullptr;
902  SCH_ITEM* undoItem = aItem;
903 
904  if( aItem->Type() == SCH_SHEET_PIN_T )
905  {
906  parentSheet = (SCH_SHEET*) aItem->GetParent();
907 
908  wxCHECK_RET( parentSheet && parentSheet->Type() == SCH_SHEET_T,
909  wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
910 
911  undoItem = parentSheet;
912  }
913 
914  else if( aItem->Type() == SCH_FIELD_T )
915  {
916  parentComponent = (SCH_COMPONENT*) aItem->GetParent();
917 
918  wxCHECK_RET( parentComponent && parentComponent->Type() == SCH_COMPONENT_T,
919  wxT( "Cannot place field in invalid schematic component object." ) );
920 
921  undoItem = parentComponent;
922  }
923 
924  if( aItem->IsNew() )
925  {
926  if( aItem->Type() == SCH_SHEET_PIN_T )
927  {
928  // Sheet pins are owned by their parent sheet.
929  SaveCopyInUndoList( undoItem, UR_CHANGED, aUndoAppend ); // save the parent sheet
930 
931  parentSheet->AddPin( (SCH_SHEET_PIN*) aItem );
932  }
933  else if( aItem->Type() == SCH_FIELD_T )
934  {
935  // Component fields are also owned by their parent, but new component fields
936  // are handled elsewhere.
937  wxLogMessage( wxT( "addCurrentItemToScreen: unexpected new SCH_FIELD" ) );
938  }
939  else
940  {
941  if( !screen->CheckIfOnDrawList( aItem ) ) // don't want a loop!
942  AddToScreen( aItem );
943 
944  SaveCopyForRepeatItem( aItem );
945  SaveCopyInUndoList( undoItem, UR_NEW, aUndoAppend );
946  }
947 
948  // Update connectivity info for new item
949  if( !aItem->IsMoving() )
951  }
952 
953  aItem->ClearFlags( IS_NEW );
954 
955  screen->SetModify();
956  RefreshItem( aItem );
957 
958  if( !aItem->IsMoving() && aItem->IsConnectable() )
959  {
960  std::vector< wxPoint > pts;
961  aItem->GetConnectionPoints( pts );
962 
963  for( auto i = pts.begin(); i != pts.end(); i++ )
964  {
965  for( auto j = i + 1; j != pts.end(); j++ )
966  TrimWire( *i, *j );
967 
968  if( screen->IsJunctionNeeded( *i, true ) )
969  AddJunction( *i, true, false );
970  }
971 
973 
974  for( SCH_ITEM* item : aItem->ConnectedItems( GetCurrentSheet() ) )
975  RefreshItem( item );
976  }
977 
978  aItem->ClearEditFlags();
979  GetCanvas()->Refresh();
980 }
virtual bool IsConnectable() const
Definition: sch_item.h:370
ITEM_SET & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieves the set of items connected to this item on the given sheet.
Definition: sch_item.cpp:176
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
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,...
bool IsJunctionNeeded(const wxPoint &aPosition, bool aNew=false)
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:372
bool IsMoving() const
Definition: base_struct.h:200
virtual void GetConnectionPoints(std::vector< wxPoint > &aPoints) const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:379
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
Definition: sch_sheet.cpp:276
bool IsNew() const
Definition: base_struct.h:199
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define NULL
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
SCH_JUNCTION * AddJunction(const wxPoint &aPos, bool aAppendToUndo=false, bool aFinal=true)
EDA_ITEM * GetParent() const
Definition: base_struct.h:195
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
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...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
Schematic symbol object.
Definition: sch_component.h:88
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
SCH_SHEET_PATH & GetCurrentSheet() const
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
void SetModify()
Definition: base_screen.h:183
void ClearEditFlags()
Definition: base_struct.h:251
bool CheckIfOnDrawList(SCH_ITEM *st)
Definition: sch_screen.cpp:304
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References AddJunction(), SCH_SHEET::AddPin(), SCH_BASE_FRAME::AddToScreen(), SCH_SCREEN::CheckIfOnDrawList(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearFlags(), SCH_ITEM::ConnectedItems(), SCH_BASE_FRAME::GetCanvas(), SCH_ITEM::GetConnectionPoints(), GetCurrentSheet(), EDA_ITEM::GetParent(), GetScreen(), IS_NEW, SCH_ITEM::IsConnectable(), SCH_SCREEN::IsJunctionNeeded(), EDA_ITEM::IsMoving(), EDA_ITEM::IsNew(), LOCAL_CLEANUP, NULL, RecalculateConnections(), EDA_DRAW_PANEL_GAL::Refresh(), SCH_BASE_FRAME::RefreshItem(), SaveCopyForRepeatItem(), SaveCopyInUndoList(), SCH_COMPONENT_T, SCH_FIELD_T, SCH_SHEET_PIN_T, SCH_SHEET_T, BASE_SCREEN::SetModify(), TestDanglingEnds(), TrimWire(), EDA_ITEM::Type(), UR_CHANGED, and UR_NEW.

Referenced by SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), BACK_ANNOTATE::processNetNameChange(), SCH_DRAWING_TOOLS::SingleClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ AddJunction()

SCH_JUNCTION * SCH_EDIT_FRAME::AddJunction ( const wxPoint aPos,
bool  aAppendToUndo = false,
bool  aFinal = true 
)

Definition at line 430 of file bus-wire-junction.cpp.

431 {
432  SCH_JUNCTION* junction = new SCH_JUNCTION( aPos );
433 
434  AddToScreen( junction );
435  SaveCopyInUndoList( junction, UR_NEW, aUndoAppend );
436  BreakSegments( aPos );
437 
438  if( aFinal )
439  {
441 
443  OnModify();
444 
445  auto view = GetCanvas()->GetView();
446  view->ClearPreview();
447  view->ShowPreview( false );
448  view->ClearHiddenFlags();
449  }
450 
451  return junction;
452 }
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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,...
bool BreakSegments(const wxPoint &aPoint, SCH_SCREEN *aScreen=nullptr)
Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an in...
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void ClearPreview()
Definition: sch_view.cpp:183
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:268

References SCH_BASE_FRAME::AddToScreen(), BreakSegments(), KIGFX::SCH_VIEW::ClearPreview(), SCH_BASE_FRAME::GetCanvas(), SCH_DRAW_PANEL::GetView(), TOOLS_HOLDER::m_toolManager, OnModify(), TOOL_MANAGER::PostEvent(), SaveCopyInUndoList(), EVENTS::SelectedItemsModified, TestDanglingEnds(), and UR_NEW.

Referenced by AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), SCH_EDIT_TOOL::BreakWire(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), FixupJunctions(), SCH_MOVE_TOOL::Main(), and SCH_DRAWING_TOOLS::SingleClickPlace().

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 297 of file eda_base_frame.cpp.

298 {
299  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
300  ACTION_MENU* helpMenu = new ACTION_MENU( false );
301 
302  helpMenu->SetTool( commonControl );
303 
304  helpMenu->Add( ACTIONS::help );
305  helpMenu->Add( ACTIONS::gettingStarted );
306  helpMenu->Add( ACTIONS::listHotKeys );
307  helpMenu->Add( ACTIONS::getInvolved );
308  helpMenu->Add( ACTIONS::reportBug );
309 
310  helpMenu->AppendSeparator();
311  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
312 
313  aMenuBar->Append( helpMenu, _( "&Help" ) );
314 }
static TOOL_ACTION listHotKeys
Definition: actions.h:172
ACTION_MENU.
Definition: action_menu.h:44
static TOOL_ACTION reportBug
Definition: actions.h:174
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:171
static TOOL_ACTION getInvolved
Definition: actions.h:173
static TOOL_ACTION gettingStarted
Definition: actions.h:170

References _, about_xpm, ACTIONS::getInvolved, ACTIONS::gettingStarted, TOOL_MANAGER::GetTool(), ACTIONS::help, ACTIONS::listHotKeys, TOOLS_HOLDER::m_toolManager, and ACTIONS::reportBug.

Referenced by EDA_3D_VIEWER::CreateMenuBar(), LIB_VIEW_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

◆ AddStandardSubMenus()

void EDA_DRAW_FRAME::AddStandardSubMenus ( TOOL_MENU aMenu)
inherited

Function CreateBasicMenu.

Construct a "basic" menu for a tool, containing only items that apply to all tools (e.g. zoom and grid)

Definition at line 431 of file eda_draw_frame.cpp.

432 {
433  COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
434  CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
435 
436  aMenu.AddSeparator( 1000 );
438  aMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 );
439  aMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways, 1000 );
441 
442  aMenu.AddSeparator( 1000 );
443 
444  auto zoomMenu = std::make_shared<ZOOM_MENU>( this );
445  zoomMenu->SetTool( commonTools );
446  aToolMenu.AddSubMenu( zoomMenu );
447 
448  auto gridMenu = std::make_shared<GRID_MENU>( this );
449  gridMenu->SetTool( commonTools );
450  aToolMenu.AddSubMenu( gridMenu );
451 
452  aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
453  aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
454 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
COMMON_TOOLS.
Definition: common_tools.h:38
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
static TOOL_ACTION zoomCenter
Definition: actions.h:92
static TOOL_ACTION zoomIn
Definition: actions.h:88
static TOOL_ACTION zoomOut
Definition: actions.h:89

References CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::m_toolManager, SELECTION_CONDITIONS::ShowAlways(), ACTIONS::zoomCenter, ACTIONS::zoomFitScreen, ACTIONS::zoomIn, and ACTIONS::zoomOut.

Referenced by PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), PL_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), SELECTION_TOOL::Init(), and EDIT_TOOL::Init().

◆ AddTemplateFieldName()

void SCH_EDIT_FRAME::AddTemplateFieldName ( const TEMPLATE_FIELDNAME aFieldName,
bool  aGlobal 
)
inline

Insert or append a wanted symbol field name into the field names template.

Should be used for any symbol property editor. If the name already exists, it overwrites the same name.

Parameters
aFieldNameis a full description of the wanted field, and it must not match any of the default field names.
aGlobalindicates whether to add to the global or project table

Definition at line 196 of file sch_edit_frame.h.

197  {
198  m_templateFieldNames.AddTemplateFieldName( aFieldName, aGlobal );
199  }
void AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName, bool aGlobal)
Function AddTemplateFieldName inserts or appends a wanted symbol field name into the fieldnames templ...
TEMPLATES m_templateFieldNames

References TEMPLATES::AddTemplateFieldName(), and SCH_BASE_FRAME::m_templateFieldNames.

Referenced by PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromWindow().

◆ AddToScreen()

void SCH_BASE_FRAME::AddToScreen ( EDA_ITEM aItem,
SCH_SCREEN aScreen = nullptr 
)
inherited

Add an item to the screen (and view) aScreen is the screen the item is located on, if not the current screen.

Definition at line 375 of file sch_base_frame.cpp.

376 {
377  auto screen = aScreen;
378 
379  if( aScreen == nullptr )
380  screen = GetScreen();
381 
382  screen->Append( (SCH_ITEM*) aItem );
383 
384  if( screen == GetScreen() )
385  {
386  GetCanvas()->GetView()->Add( aItem );
387  RefreshItem( aItem, true ); // handle any additional parent semantics
388  }
389 }
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187

References KIGFX::VIEW::Add(), SCH_BASE_FRAME::GetCanvas(), SCH_BASE_FRAME::GetScreen(), SCH_DRAW_PANEL::GetView(), and SCH_BASE_FRAME::RefreshItem().

Referenced by AddItemToScreenAndUndoList(), AddJunction(), BreakSegment(), SCH_EDIT_TOOL::ChangeTextType(), DeleteJunction(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SCH_EDIT_TOOL::Duplicate(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_MOVE_TOOL::getConnectedDragItems(), PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), and SchematicCleanUp().

◆ AllowCaseSensitiveFileNameClashes()

bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes ( const wxString &  aSchematicFileName)

Check aSchematicFileName for a potential file name case sensitivity clashes.

On platforms where file names are case sensitive, it is possible to schematic sheet file names that would cause issues on platforms where file name are case insensitive. File names foo.sch and Foo.sch are unique files on Linux and MacOS but on Windows this would result in a broken schematic.

Parameters
aSchematicFileNameis the absolute path and file name of the file to test.
Returns
true if the user accepts the potential file name clase risk.

Definition at line 623 of file sheet.cpp.

624 {
625  wxString msg;
626  SCH_SCREENS screens( Schematic().Root() );
627  wxFileName fn = aSchematicFileName;
628 
629  wxCHECK( fn.IsAbsolute(), false );
630 
632  && screens.CanCauseCaseSensitivityIssue( aSchematicFileName ) )
633  {
634  msg.Printf( _( "The file name \"%s\" can cause issues with an existing file name\n"
635  "already defined in the schematic on systems that support case\n"
636  "insensitive file names. This will cause issues if you copy this\n"
637  "project to an operating system that supports case insensitive file\n"
638  "names.\n\nDo you wish to continue?" ),
639  fn.GetName() );
640 
641  wxRichMessageDialog dlg( this, msg, _( "Warning" ),
642  wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
643  dlg.ShowCheckBox( _( "Do not show this message again." ) );
644  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Create New Sheet" ) ),
645  wxMessageDialog::ButtonLabel( _( "Discard New Sheet" ) ) );
646 
647  if( dlg.ShowModal() == wxID_NO )
648  return false;
649 
651  !dlg.IsCheckBoxChecked();
652  }
653 
654  return true;
655 }
EESCHEMA_SETTINGS * eeconfig() const
SCHEMATIC & Schematic() const
#define _(s)
Definition: 3d_actions.cpp:33
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References _, SCH_SCREENS::CanCauseCaseSensitivityIssue(), SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::m_Appearance, Schematic(), and EESCHEMA_SETTINGS::APPEARANCE::show_sheet_filename_case_sensitivity_dialog.

Referenced by DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged().

◆ AnnotateComponents()

void SCH_EDIT_FRAME::AnnotateComponents ( bool  aAnnotateSchematic,
ANNOTATE_ORDER_T  aSortOption,
ANNOTATE_OPTION_T  aAlgoOption,
int  aStartNumber,
bool  aResetAnnotation,
bool  aRepairTimestamps,
bool  aLockUnits,
REPORTER aReporter 
)

Annotate the components in the schematic that are not currently annotated.

Parameters
aAnnotateSchematicAnnotate the entire schematic if true. Otherwise annotate the current sheet only.
aSortOptionDefine the annotation order. See ANNOTATE_ORDER_T.
aAlgoOptionDefine the annotation style. See ANNOTATE_OPTION_T.
aStartNumberThe start number for non-sheet-based annotation styles.
aResetAnnotationClear any previous annotation if true. Otherwise, keep the existing component annotation.
aRepairTimestampsTest for and repair any duplicate time stamps if true. Otherwise, keep the existing time stamps. This option could change previous annotation because time stamps are used to handle annotation in complex hierarchies.
aLockUnitsWhen both aLockUnits and aResetAnnotation are true, all unit associations should be kept when reannotating. That is, if two components were R8A and R8B, they may become R3A and R3B, but not R3A and R3C or R3C and R4D. When aResetAnnotation is true but aLockUnits is false, the usual behavior of annotating each part individually is performed. When aResetAnnotation is false, this option has no effect.
aReporterA sink for error messages. Use NULL_REPORTER if you don't need errors.

When the sheet number is used in annotation, each sheet annotation starts from sheet number * 100. In other words the first sheet uses 100 to 199, the second sheet uses 200 to 299, and so on.

Definition at line 84 of file eeschema/annotate.cpp.

92 {
93  SCH_REFERENCE_LIST references;
94 
95  SCH_SCREENS screens( Schematic().Root() );
96 
97  // Build the sheet list.
98  SCH_SHEET_LIST sheets = Schematic().GetSheets();
99 
100  // Map of locked components
101  SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
102 
103  // Map of previous annotation for building info messages
104  std::map<wxString, wxString> previousAnnotation;
105 
106  // Test for and replace duplicate time stamps in components and sheets. Duplicate
107  // time stamps can happen with old schematics, schematic conversions, or manual
108  // editing of files.
109  if( aRepairTimestamps )
110  {
111  int count = screens.ReplaceDuplicateTimeStamps();
112 
113  if( count )
114  {
115  wxString msg;
116  msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
117  aReporter.ReportTail( msg, RPT_SEVERITY_WARNING );
118  }
119  }
120 
121  // If units must be locked, collect all the sets that must be annotated together.
122  if( aLockUnits )
123  {
124  if( aAnnotateSchematic )
125  sheets.GetMultiUnitComponents( lockedComponents );
126  else
127  GetCurrentSheet().GetMultiUnitComponents( lockedComponents );
128  }
129 
130  // Store previous annotations for building info messages
131  mapExistingAnnotation( previousAnnotation );
132 
133  // If it is an annotation for all the components, reset previous annotation.
134  if( aResetAnnotation )
135  DeleteAnnotation( !aAnnotateSchematic );
136 
137  // Set sheet number and number of sheets.
139 
140  // Build component list
141  if( aAnnotateSchematic )
142  sheets.GetComponents( references );
143  else
144  GetCurrentSheet().GetComponents( references );
145 
146  // Break full components reference in name (prefix) and number:
147  // example: IC1 become IC, and 1
148  references.SplitReferences();
149 
150  switch( aSortOption )
151  {
152  default:
153  case SORT_BY_X_POSITION: references.SortByXCoordinate(); break;
154  case SORT_BY_Y_POSITION: references.SortByYCoordinate(); break;
155  }
156 
157  bool useSheetNum = false;
158  int idStep = 100;
159 
160  switch( aAlgoOption )
161  {
162  default:
163  case INCREMENTAL_BY_REF:
164  break;
165 
166  case SHEET_NUMBER_X_100:
167  useSheetNum = true;
168  break;
169 
170  case SHEET_NUMBER_X_1000:
171  useSheetNum = true;
172  idStep = 1000;
173  break;
174  }
175 
176  // Recalculate and update reference numbers in schematic
177  references.Annotate( useSheetNum, idStep, aStartNumber, lockedComponents );
178  references.UpdateAnnotation();
179 
180  for( size_t i = 0; i < references.GetCount(); i++ )
181  {
182  SCH_COMPONENT* comp = references[ i ].GetComp();
183  SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
184  KIID_PATH curr_full_uuid = curr_sheetpath->Path();
185  curr_full_uuid.push_back( comp->m_Uuid );
186 
187  wxString prevRef = previousAnnotation[ curr_full_uuid.AsString() ];
188 
189  wxString newRef = comp->GetRef( curr_sheetpath );
190 
191  if( comp->GetUnitCount() > 1 )
192  newRef << LIB_PART::SubReference( comp->GetUnitSelection( curr_sheetpath ) );
193 
194  wxString msg;
195 
196  if( prevRef.Length() )
197  {
198  if( newRef == prevRef )
199  continue;
200 
201  if( comp->GetUnitCount() > 1 )
202  msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
203  comp->GetField( VALUE )->GetShownText(),
204  LIB_PART::SubReference( comp->GetUnit(), false ),
205  prevRef, newRef );
206  else
207  msg.Printf( _( "Updated %s from %s to %s" ),
208  comp->GetField( VALUE )->GetShownText(),
209  prevRef, newRef );
210  }
211  else
212  {
213  if( comp->GetUnitCount() > 1 )
214  msg.Printf( _( "Annotated %s (unit %s) as %s" ),
215  comp->GetField( VALUE )->GetShownText(),
216  LIB_PART::SubReference( comp->GetUnit(), false ),
217  newRef );
218  else
219  msg.Printf( _( "Annotated %s as %s" ),
220  comp->GetField( VALUE )->GetShownText(),
221  newRef );
222  }
223 
224  aReporter.Report( msg, RPT_SEVERITY_ACTION );
225  }
226 
227  // Final control (just in case ... ).
228  if( !CheckAnnotate( aReporter, !aAnnotateSchematic ) )
229  aReporter.ReportTail( _( "Annotation complete." ), RPT_SEVERITY_ACTION );
230 
231  // Update on screen references, that can be modified by previous calculations:
234 
235  SyncView();
236  GetCanvas()->Refresh();
237  OnModify();
238 }
SCH_SHEET_LIST.
void SortByYCoordinate()
Function sortByYCoordinate sorts the list of references by Y position.
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet.
void mapExistingAnnotation(std::map< wxString, wxString > &aMap)
Fills a map of uuid -> reference from the currently loaded schematic.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:94
int GetUnitCount() const
Return the number of units per package of the symbol.
Annotate incrementally using the first free reference number.
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:102
void GetMultiUnitComponents(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
void GetMultiUnitComponents(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierarchy,...
void UpdateAnnotation()
function UpdateAnnotation Updates the reference components for the schematic project (or the current ...
int GetUnit() const
void SortByXCoordinate()
Function sortByXCoordinate sorts the list of references by X position.
void DeleteAnnotation(bool aCurrentSheetOnly)
Clear the current component annotation.
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the list of...
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
void Annotate(bool aUseSheetNum, int aSheetIntervalId, int aStartNumber, SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap)
Function Annotate set the reference designators in the list that have not been annotated.
SCH_SHEET_PATH.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false)
Return the reference for the given sheet path.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Type SCH_MULTI_UNIT_REFERENCE_MAP is used to create a map of reference designators for multi-unit par...
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...
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
const KIID m_Uuid
Definition: base_struct.h:162
Annotate by Y position from top to bottom.
unsigned GetCount() const
Function GetCount.
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
Field Value of part, i.e. "3.3K".
Annotate using the first free reference number starting at the sheet number * 100.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SplitReferences()
Function SplitReferences attempts to split all reference designators into a name (U) and number (1).
#define _(s)
Definition: 3d_actions.cpp:33
wxString AsString() const
Definition: common.h:137
Annotate by X position from left to right.
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Annotate using the first free reference number starting at the sheet number * 1000.
Schematic symbol object.
Definition: sch_component.h:88
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References _, SCH_REFERENCE_LIST::Annotate(), KIID_PATH::AsString(), CheckAnnotate(), DeleteAnnotation(), SCH_BASE_FRAME::GetCanvas(), SCH_SHEET_PATH::GetComponents(), SCH_SHEET_LIST::GetComponents(), SCH_REFERENCE_LIST::GetCount(), GetCurrentSheet(), SCH_COMPONENT::GetField(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SHEET_LIST::GetMultiUnitComponents(), SCH_COMPONENT::GetRef(), SCHEMATIC::GetSheets(), SCH_FIELD::GetShownText(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), SCH_COMPONENT::GetUnitSelection(), INCREMENTAL_BY_REF, EDA_ITEM::m_Uuid, mapExistingAnnotation(), OnModify(), SCH_SHEET_PATH::Path(), EDA_DRAW_PANEL_GAL::Refresh(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), REPORTER::Report(), REPORTER::ReportTail(), RPT_SEVERITY_ACTION, RPT_SEVERITY_WARNING, Schematic(), SetSheetNumberAndCount(), SHEET_NUMBER_X_100, SHEET_NUMBER_X_1000, SORT_BY_X_POSITION, SORT_BY_Y_POSITION, SCH_REFERENCE_LIST::SortByXCoordinate(), SCH_REFERENCE_LIST::SortByYCoordinate(), SCH_REFERENCE_LIST::SplitReferences(), LIB_PART::SubReference(), SCH_BASE_FRAME::SyncView(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_REFERENCE_LIST::UpdateAnnotation(), and VALUE.

Referenced by KiwayMailIn(), DIALOG_ANNOTATE::OnApplyClick(), and ReadyToNetlist().

◆ AppendMsgPanel()

void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  textUpper,
const wxString &  textLower,
COLOR4D  color,
int  pad = 6 
)
inherited

Append a message to the message panel.

This helper method checks to make sure the message panel exists in the frame and appends a message to it using the message panel AppendMessage() method.

Parameters
textUpper- The message upper text.
textLower- The message lower text.
color- A color ID from the KiCad color list (see colors.h).
pad- Number of spaces to pad between messages (default = 4).

Definition at line 595 of file eda_draw_frame.cpp.

597 {
598  if( m_messagePanel )
599  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
600 }
int color
Definition: DXF_plotter.cpp:61
EDA_MSG_PANEL * m_messagePanel
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110

References EDA_MSG_PANEL::AppendMessage(), color, and EDA_DRAW_FRAME::m_messagePanel.

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), importFile(), LoadSheetFromFile(), SCH_PRINTOUT::OnPrintPage(), DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged(), OpenProjectFiles(), SaveEEFile(), PCB_EDIT_FRAME::SavePcbFile(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ AppendSchematic()

bool SCH_EDIT_FRAME::AppendSchematic ( )

Import a KiCad schematic into the current sheet.

Returns
True if the schematic was imported properly.

Definition at line 531 of file eeschema/files-io.cpp.

532 {
533  wxString fullFileName;
534  SCH_SCREEN* screen = GetScreen();
535 
536  if( !screen )
537  {
538  wxLogError( wxT( "Document not ready, cannot import" ) );
539  return false;
540  }
541 
542  // open file chooser dialog
543  wxString path = wxPathOnly( Prj().GetProjectFullName() );
544 
545  wxFileDialog dlg( this, _( "Append Schematic" ), path, wxEmptyString,
546  KiCadSchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
547 
548  if( dlg.ShowModal() == wxID_CANCEL )
549  return false;
550 
551  fullFileName = dlg.GetPath();
552 
553  if( !LoadSheetFromFile( GetCurrentSheet().Last(), &GetCurrentSheet(), fullFileName ) )
554  return false;
555 
556  SCH_SCREENS screens( GetCurrentSheet().Last() );
557  screens.TestDanglingEnds();
558 
561 
562  SyncView();
563  HardRedraw(); // Full reinit of the current screen and the display.
564  OnModify();
565 
566  return true;
567 }
wxString KiCadSchematicFileWildcard()
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, const wxString &aFileName)
Load a the KiCad schematic file aFileName into the sheet aSheet.
Definition: sheet.cpp:104
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References _, GetCurrentSheet(), GetScreen(), HardRedraw(), KiCadSchematicFileWildcard(), LoadSheetFromFile(), TOOLS_HOLDER::m_toolManager, OnModify(), KIWAY_HOLDER::Prj(), TOOL_MANAGER::RunAction(), SetSheetNumberAndCount(), SCH_BASE_FRAME::SyncView(), SCH_SCREENS::TestDanglingEnds(), and ACTIONS::zoomFitScreen.

Referenced by OnAppendProject().

◆ AskToSaveChanges()

bool SCH_EDIT_FRAME::AskToSaveChanges ( )

Checks if any of the screens has unsaved changes and asks the user whether to save or drop them.

Returns
True if user decided to save or drop changes, false if the operation should be canceled.

Definition at line 904 of file eeschema/files-io.cpp.

905 {
906  SCH_SCREENS screenList( Schematic().Root() );
907 
908  // Save any currently open and modified project files.
909  for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
910  {
911  if( screen->IsModify() )
912  {
913  if( !HandleUnsavedChanges( this, _( "The current schematic has been modified. "
914  "Save changes?" ),
915  [&]()->bool { return SaveProject(); } ) )
916  {
917  return false;
918  }
919  }
920  }
921 
922  return true;
923 }
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:201
SCHEMATIC & Schematic() const
#define _(s)
Definition: 3d_actions.cpp:33
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References _, SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), HandleUnsavedChanges(), SaveProject(), and Schematic().

Referenced by OnImportProject(), and OpenProjectFiles().

◆ BreakSegment()

bool SCH_EDIT_FRAME::BreakSegment ( SCH_LINE aSegment,
const wxPoint aPoint,
SCH_LINE **  aNewSegment = NULL,
SCH_SCREEN aScreen = nullptr 
)

Breaks a single segment into two at the specified point.

NOTE: always appends to the existing undo state.

Parameters
aSegmentLine segment to break
aPointPoint at which to break the segment
aNewSegmentPointer to the newly created segment (if given and created)
aScreenis the screen to examine, or nullptr to examine the current screen
Returns
True if any wires or buses were broken.

Definition at line 276 of file bus-wire-junction.cpp.

278 {
279  if( !IsPointOnSegment( aSegment->GetStartPoint(), aSegment->GetEndPoint(), aPoint )
280  || aSegment->IsEndPoint( aPoint ) )
281  return false;
282 
283  if( aScreen == nullptr )
284  aScreen = GetScreen();
285 
286  SCH_LINE* newSegment = new SCH_LINE( *aSegment );
287 
288  newSegment->SetStartPoint( aPoint );
289  AddToScreen( newSegment, aScreen );
290 
291  SaveCopyInUndoList( newSegment, UR_NEW, true );
292  SaveCopyInUndoList( aSegment, UR_CHANGED, true );
293 
294  RefreshItem( aSegment );
295  aSegment->SetEndPoint( aPoint );
296 
297  if( aNewSegment )
298  *aNewSegment = newSegment;
299 
300  return true;
301 }
wxPoint GetStartPoint() const
Definition: sch_line.h:94
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,...
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:98
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:95
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:87
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References SCH_BASE_FRAME::AddToScreen(), SCH_LINE::GetEndPoint(), GetScreen(), SCH_LINE::GetStartPoint(), SCH_LINE::IsEndPoint(), IsPointOnSegment(), SCH_BASE_FRAME::RefreshItem(), SaveCopyInUndoList(), SCH_LINE::SetEndPoint(), SCH_LINE::SetStartPoint(), UR_CHANGED, and UR_NEW.

Referenced by BreakSegments(), and TrimWire().

◆ BreakSegments()

bool SCH_EDIT_FRAME::BreakSegments ( const wxPoint aPoint,
SCH_SCREEN aScreen = nullptr 
)

Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an intersection is found.

NOTE: always appends to the existing undo state.

Parameters
aPointTest this point for an intersection.
aScreenis the screen to examine, or nullptr to examine the current screen
Returns
True if any wires or buses were broken.

Definition at line 304 of file bus-wire-junction.cpp.

305 {
306  static const KICAD_T wiresAndBuses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
307 
308  if( aScreen == nullptr )
309  aScreen = GetScreen();
310 
311  bool brokenSegments = false;
312  std::vector<SCH_LINE*> wires;
313  EDA_RECT bbox( aPoint, wxSize( 2, 2 ) );
314 
315  for( auto item : aScreen->Items().Overlapping( SCH_LINE_T, aPoint ) )
316  {
317  if( item->IsType( wiresAndBuses ) )
318  wires.push_back( static_cast<SCH_LINE*>( item ) );
319  }
320 
321  for( auto wire : wires )
322  brokenSegments |= BreakSegment( wire, aPoint, NULL, aScreen );
323 
324  return brokenSegments;
325 }
bool BreakSegment(SCH_LINE *aSegment, const wxPoint &aPoint, SCH_LINE **aNewSegment=NULL, SCH_SCREEN *aScreen=nullptr)
Breaks a single segment into two at the specified point.
EE_TYPE Overlapping(const EDA_RECT &aRect)
Definition: sch_rtree.h:224
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define NULL
EE_RTREE & Items()
Definition: sch_screen.h:158
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References BreakSegment(), EOT, GetScreen(), SCH_SCREEN::Items(), NULL, EE_RTREE::Overlapping(), SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, and SCH_LINE_T.

Referenced by AddJunction(), BreakSegmentsOnJunctions(), and SCH_EDIT_TOOL::BreakWire().

◆ BreakSegmentsOnJunctions()

bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions ( SCH_SCREEN aScreen = nullptr)

Tests all junctions and bus entries in the schematic for intersections with wires and buses and breaks any intersections into multiple segments.

NOTE: always appends to the existing undo state.

Parameters
aScreenis the screen to examine, or nullptr to examine the current screen
Returns
True if any wires or buses were broken.

Definition at line 328 of file bus-wire-junction.cpp.

329 {
330  if( aScreen == nullptr )
331  aScreen = GetScreen();
332 
333  bool brokenSegments = false;
334 
335  std::set<wxPoint> point_set;
336 
337  for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
338  point_set.insert( item->GetPosition() );
339 
340  for( SCH_ITEM* item : aScreen->Items().OfType( SCH_BUS_WIRE_ENTRY_T ) )
341  {
342  SCH_BUS_WIRE_ENTRY* entry = static_cast<SCH_BUS_WIRE_ENTRY*>( item );
343  point_set.insert( entry->GetPosition() );
344  point_set.insert( entry->m_End() );
345  }
346 
347 
348  for( auto pt : point_set )
349  brokenSegments |= BreakSegments( pt, aScreen );
350 
351  return brokenSegments;
352 }
bool BreakSegments(const wxPoint &aPoint, SCH_SCREEN *aScreen=nullptr)
Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an in...
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint m_End() const
EE_RTREE & Items()
Definition: sch_screen.h:158
Class for a wire to bus entry.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
wxPoint GetPosition() const override

References BreakSegments(), SCH_BUS_ENTRY_BASE::GetPosition(), GetScreen(), SCH_SCREEN::Items(), SCH_BUS_ENTRY_BASE::m_End(), EE_RTREE::OfType(), SCH_BUS_WIRE_ENTRY_T, and SCH_JUNCTION_T.

Referenced by SchematicCleanUp().

◆ BuildNetListBase()

NETLIST_OBJECT_LIST * SCH_EDIT_FRAME::BuildNetListBase ( bool  updateStatusText = true)

Create a flat list which stores all connected objects.

TODO(JE) Remove this once ERC is moved off of it

Parameters
updateStatusTextdecides if window StatusText should be modified.
Returns
NETLIST_OBJECT_LIST* - caller owns the object.

Definition at line 215 of file netlist_generator.cpp.

216 {
217  // Ensure netlist is up to date
219 
220  // I own this list until I return it to the new owner.
221  std::unique_ptr<NETLIST_OBJECT_LIST> ret( new NETLIST_OBJECT_LIST() );
222 
223  // Creates the flattened sheet list:
224  SCH_SHEET_LIST aSheets = Schematic().GetSheets();
225 
226  // Build netlist info
227  bool success = ret->BuildNetListInfo( aSheets );
228 
229  if( !success )
230  {
231  if( updateStatusText )
232  SetStatusText( _( "No Objects" ) );
233  return ret.release();
234  }
235 
236  wxString msg = wxString::Format( _( "Net count = %d" ), int( ret->size() ) );
237 
238  if( updateStatusText )
239  SetStatusText( msg );
240 
241  return ret.release();
242 }
SCH_SHEET_LIST.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected items in a...
SCHEMATIC & Schematic() const
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
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), SCHEMATIC::GetSheets(), NO_CLEANUP, RecalculateConnections(), and Schematic().

Referenced by DIALOG_ERC::TestErc().

◆ CenterScreen()

void SCH_BASE_FRAME::CenterScreen ( const wxPoint aCenterPoint,
bool  aWarpPointer 
)
virtualinherited

Definition at line 270 of file sch_base_frame.cpp.

271 {
272  GetCanvas()->GetView()->SetCenter( aCenterPoint );
273 
274  if( aWarpPointer )
275  GetCanvas()->GetViewControls()->WarpCursor( aCenterPoint, true );
276 
277  GetCanvas()->Refresh();
278 }
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
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...

References SCH_BASE_FRAME::GetCanvas(), SCH_DRAW_PANEL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by SCH_EDITOR_CONTROL::FindComponentAndItem().

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inherited

Definition at line 796 of file eda_base_frame.cpp.

797 {
798  SetUserUnits( aUnits );
800 
801  wxCommandEvent e( UNITS_CHANGED );
802  ProcessEventLocally( e );
803 }
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void SetUserUnits(EDA_UNITS aUnits)

References EDA_BASE_FRAME::SetUserUnits(), and EDA_BASE_FRAME::unitsChangeRefresh().

Referenced by COMMON_TOOLS::ImperialUnits(), COMMON_TOOLS::MetricUnits(), and COMMON_TOOLS::ToggleUnits().

◆ CheckAnnotate()

int SCH_EDIT_FRAME::CheckAnnotate ( REPORTER aReporter,
bool  aOneSheetOnly 
)

Check for annotation errors.

The following list of items are checked:

  • Components that are not annotated.
  • Duplicate component references.
  • Multiple part per package components where the part number is greater number of parts in the package.
  • Multiple part per package components where the reference designator is different between parts.
Returns
Number of annotation errors found.
Parameters
aReporterA sink for error messages. Use NULL_REPORTER if you don't need errors.
aOneSheetOnlyCheck the current sheet only if true. Otherwise check the entire schematic.

Definition at line 241 of file eeschema/annotate.cpp.

242 {
243  SCH_REFERENCE_LIST componentsList;
244 
245  // Build the list of components
246  if( !aOneSheetOnly )
247  Schematic().GetSheets().GetComponents( componentsList );
248  else
249  GetCurrentSheet().GetComponents( componentsList );
250 
251  // Empty schematic does not need annotation
252  if( componentsList.GetCount() == 0 )
253  return 0;
254 
255  return componentsList.CheckAnnotation( aReporter );
256 }
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierarchy,...
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the list of...
SCHEMATIC & Schematic() const
unsigned GetCount() const
Function GetCount.
SCH_SHEET_PATH & GetCurrentSheet() const
int CheckAnnotation(REPORTER &aReporter)
Function CheckAnnotation check for annotations errors.

References SCH_REFERENCE_LIST::CheckAnnotation(), SCH_SHEET_PATH::GetComponents(), SCH_SHEET_LIST::GetComponents(), SCH_REFERENCE_LIST::GetCount(), GetCurrentSheet(), SCHEMATIC::GetSheets(), and Schematic().

Referenced by AnnotateComponents(), ReadyToNetlist(), and DIALOG_ERC::TestErc().

◆ CheckForAutoSaveFile()

void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName)
inherited

Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input.

If an auto save file exists for aFileName, the user is prompted if they wish to replace file aFileName with the auto saved file. If the user chooses to replace the file, the backup file of aFileName is removed, aFileName is renamed to the backup file name, and the auto save file is renamed to aFileName. If user chooses to keep the existing version of aFileName, the auto save file is removed.

Parameters
aFileNameA wxFileName object containing the file name to check.

Definition at line 743 of file eda_base_frame.cpp.

744 {
745  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
746 
747  wxFileName autoSaveFileName = aFileName;
748 
749  // Check for auto save file.
750  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
751 
752  wxLogTrace( traceAutoSave,
753  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
754 
755  if( !autoSaveFileName.FileExists() )
756  return;
757 
758  wxString msg = wxString::Format( _(
759  "Well this is potentially embarrassing!\n"
760  "It appears that the last time you were editing the file\n"
761  "\"%s\"\n"
762  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
763  GetChars( aFileName.GetFullName() )
764  );
765 
766  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
767 
768  // Make a backup of the current file, delete the file, and rename the auto save file to
769  // the file name.
770  if( response == wxYES )
771  {
772  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
773  {
774  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
775  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
776  }
777  }
778  else
779  {
780  wxLogTrace( traceAutoSave,
781  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
782 
783  // Remove the auto save file when using the previous file as is.
784  wxRemoveFile( autoSaveFileName.GetFullPath() );
785  }
786 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
static wxString GetAutoSaveFilePrefix()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
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
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), GetChars(), Pgm(), and traceAutoSave.

Referenced by OpenProjectFiles(), and PCB_EDIT_FRAME::OpenProjectFiles().

◆ checkForNoFullyDefinedLibIds()

bool SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds ( SCH_SHEET aSheet)
private

Verify that the symbol library links aSheet and all of it's child sheets have been remapped to the symbol library table.

Parameters
aSheetis the SCH_SHEET object to test.
Returns
true if aSheet and it's child sheets have not been remapped.

Definition at line 74 of file sheet.cpp.

75 {
76  wxASSERT( aSheet && aSheet->GetScreen() );
77 
78  wxString msg;
79  SCH_SCREENS newScreens( aSheet );
80 
81  if( newScreens.HasNoFullyDefinedLibIds() )
82  {
83  msg.Printf( _( "The schematic \"%s\" has not had it's symbol library links remapped "
84  "to the symbol library table. The project this schematic belongs to "
85  "must first be remapped before it can be imported into the current "
86  "project." ), aSheet->GetScreen()->GetFileName() );
87  DisplayInfoMessage( this, msg );
88  return true;
89  }
90 
91  return false;
92 }
const wxString & GetFileName() const
Definition: sch_screen.h:185
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:282
#define _(s)
Definition: 3d_actions.cpp:33
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References _, DisplayInfoMessage(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetScreen(), and SCH_SCREENS::HasNoFullyDefinedLibIds().

Referenced by LoadSheetFromFile().

◆ CheckSheetForRecursion()

bool SCH_EDIT_FRAME::CheckSheetForRecursion ( SCH_SHEET aSheet,
SCH_SHEET_PATH aHierarchy 
)

Verify that aSheet will not cause a recursion error in aHierarchy.

Parameters
aSheetis the SCH_SHEET object to test.
aHierarchyis the SCH_SHEET_PATH where aSheet is going to reside.
Returns
true if aSheet will cause a resursion error in aHierarchy.

Definition at line 46 of file sheet.cpp.

47 {
48  wxASSERT( aSheet && aHierarchy );
49 
50  wxString msg;
51  SCH_SHEET_LIST hierarchy = Schematic().GetSheets(); // The full schematic sheet hierarchy.
52  SCH_SHEET_LIST sheetHierarchy( aSheet ); // This is the hierarchy of the loaded file.
53 
54  wxFileName destFile = aHierarchy->LastScreen()->GetFileName();
55 
56  // SCH_SCREEN object file paths are expected to be absolute. If this assert fires,
57  // something is seriously broken.
58  wxASSERT( destFile.IsAbsolute() );
59 
60  if( hierarchy.TestForRecursion( sheetHierarchy, destFile.GetFullPath() ) )
61  {
62  msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
63  "has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
64  "the schematic hierarchy." ),
65  destFile.GetFullPath() );
66  DisplayError( this, msg );
67  return true;
68  }
69 
70  return false;
71 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
SCH_SHEET_LIST.
const wxString & GetFileName() const
Definition: sch_screen.h:185
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Function TestForRecursion.
SCHEMATIC & Schematic() const
SCH_SCREEN * LastScreen()
Function LastScreen.
#define _(s)
Definition: 3d_actions.cpp:33

References _, DisplayError(), SCH_SCREEN::GetFileName(), SCHEMATIC::GetSheets(), SCH_SHEET_PATH::LastScreen(), Schematic(), and SCH_SHEET_LIST::TestForRecursion().

Referenced by LoadSheetFromFile(), and DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged().

◆ ClearExecFlags()

void SCH_EDIT_FRAME::ClearExecFlags ( const int  aFlags)
inline

Clear (removes) specified flags that not needed for next execution of external generator of the netlist or bom.

Parameters
aFlags= wxEXEC_* flags, see wxExecute docs.

Definition at line 912 of file sch_edit_frame.h.

912 { m_exec_flags &= ~( aFlags ); }
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.

References m_exec_flags.

◆ ClearFileHistory()

void EDA_BASE_FRAME::ClearFileHistory ( FILE_HISTORY aFileHistory = nullptr)
inherited

Removes all files from the file history.

Parameters
aFileHistoryThe FILE_HISTORY in use. If null, the main application file history is used

Definition at line 640 of file eda_base_frame.cpp.

641 {
642  if( !aFileHistory )
643  aFileHistory = m_fileHistory;
644 
645  wxASSERT( aFileHistory );
646 
647  aFileHistory->ClearFileHistory();
648 
649  // Update the menubar to update the file history menu
650  if( GetMenuBar() )
651  {
652  ReCreateMenuBar();
653  GetMenuBar()->Refresh();
654  }
655 }
void ClearFileHistory()
Clear all entries from the file history.
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

References FILE_HISTORY::ClearFileHistory(), EDA_BASE_FRAME::m_fileHistory, and EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by GERBVIEW_FRAME::OnClearDrlFileHistory(), KICAD_MANAGER_FRAME::OnClearFileHistory(), PL_EDITOR_FRAME::OnClearFileHistory(), PCB_EDIT_FRAME::OnClearFileHistory(), OnClearFileHistory(), GERBVIEW_FRAME::OnClearGbrFileHistory(), GERBVIEW_FRAME::OnClearJobFileHistory(), and GERBVIEW_FRAME::OnClearZipFileHistory().

◆ ClearFindReplaceStatus()

void SCH_EDIT_FRAME::ClearFindReplaceStatus ( )

Definition at line 700 of file sch_edit_frame.cpp.

701 {
702  m_infoBar->Dismiss();
703 }
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:139
WX_INFOBAR * m_infoBar

References WX_INFOBAR::Dismiss(), and EDA_BASE_FRAME::m_infoBar.

Referenced by SCH_EDITOR_CONTROL::FindNext().

◆ ClearMsgPanel()

◆ CommonSettingsChanged()

void SCH_EDIT_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from SCH_BASE_FRAME.

Definition at line 1037 of file sch_edit_frame.cpp.

1038 {
1039  SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
1040 
1041  RecreateToolbars();
1042  Layout();
1043  SendSizeEvent();
1044 }
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of ckeck tools.
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.

References SCH_BASE_FRAME::CommonSettingsChanged(), and EDA_DRAW_FRAME::RecreateToolbars().

◆ config()

APP_SETTINGS_BASE * EDA_BASE_FRAME::config ( ) const
virtualinherited

Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 557 of file eda_base_frame.cpp.

558 {
559  // KICAD_MANAGER_FRAME overrides this
560  return Kiface().KifaceSettings();
561 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

References Kiface(), and KIFACE_I::KifaceSettings().

Referenced by PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), BM2CMP_FRAME::BM2CMP_FRAME(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), SCH_BASE_FRAME::eeconfig(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), DISPLAY_FOOTPRINTS_FRAME::GetAutoZoom(), GRID_MENU::GRID_MENU(), COMMON_TOOLS::GridFast1(), COMMON_TOOLS::GridFast2(), EDA_DRAW_FRAME::IsGridVisible(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), SCH_BASE_FRAME::libeditconfig(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), EDA_DRAW_FRAME::OnUpdateSelectZoom(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), DISPLAY_FOOTPRINTS_FRAME::SetAutoZoom(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetGridVisibility(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), LIB_VIEW_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), LIB_EDIT_FRAME::setupTools(), CVPCB_MAINFRAME::setupTools(), setupTools(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataToWindow(), ZOOM_MENU::update(), GRID_MENU::update(), EDA_DRAW_FRAME::UpdateGridSelectBox(), EDA_DRAW_FRAME::UpdateZoomSelectBox(), EDA_BASE_FRAME::windowClosing(), ZOOM_MENU::ZOOM_MENU(), and BM2CMP_FRAME::~BM2CMP_FRAME().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineoverridevirtualinherited
Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, except for frames shown in multiple modes in which case the m_configName must be set to the base name so that a single config can be used.

Reimplemented from TOOLS_HOLDER.

Definition at line 337 of file eda_base_frame.h.

338  {
339  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
340  return baseCfgName;
341  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by EDA_BASE_FRAME::SaveWindowSettings().

◆ ConvertPart()

void SCH_EDIT_FRAME::ConvertPart ( SCH_COMPONENT aComponent)

Definition at line 235 of file getpart.cpp.

236 {
237  if( !aComponent || !aComponent->GetPartRef() )
238  return;
239 
240  wxString msg;
241 
242  if( !aComponent->GetPartRef()->HasConversion() )
243  {
244  LIB_ID id = aComponent->GetPartRef()->GetLibId();
245 
246  msg.Printf( _( "No alternate body style found for symbol \"%s\" in library \"%s\"." ),
247  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
248  DisplayError( this, msg );
249  return;
250  }
251 
252  STATUS_FLAGS savedFlags = aComponent->GetFlags();
253 
254  aComponent->SetConvert( aComponent->GetConvert() + 1 );
255 
256  // ensure m_Convert = 1 or 2
257  // 1 = shape 1 = not converted
258  // 2 = shape 2 = first converted shape
259  // > 2 is not used but could be used for more shapes
260  // like multiple shapes for a programmable component
261  // When m_Convert = val max, return to the first shape
262  if( aComponent->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN )
263  aComponent->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
264 
266  aComponent->ClearFlags();
267  aComponent->SetFlags( savedFlags ); // Restore m_Flags (modified by SetConvert())
268 
269  // If selected make sure all the now-included pins are selected
270  if( aComponent->IsSelected() )
271  m_toolManager->RunAction( EE_ACTIONS::addItemToSel, true, aComponent );
272 
273  RefreshItem( aComponent );
274  OnModify();
275 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
bool IsSelected() const
Definition: base_struct.h:203
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SetConvert(int aConvert)
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
unsigned STATUS_FLAGS
Definition: base_struct.h:152
std::unique_ptr< LIB_PART > & GetPartRef()
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
void RefreshItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
#define _(s)
Definition: 3d_actions.cpp:33
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
int GetConvert() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:234

References _, EE_ACTIONS::addItemToSel, EDA_ITEM::ClearFlags(), DisplayError(), SCH_COMPONENT::GetConvert(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetPartRef(), EDA_ITEM::IsSelected(), TOOLS_HOLDER::m_toolManager, OnModify(), SCH_BASE_FRAME::RefreshItem(), TOOL_MANAGER::RunAction(), SCH_COMPONENT::SetConvert(), EDA_ITEM::SetFlags(), and TestDanglingEnds().

Referenced by SCH_EDIT_TOOL::ConvertDeMorgan().

◆ ConvertTimeStampUuids()

void SCH_EDIT_FRAME::ConvertTimeStampUuids ( )

Convert sheet and symbol legacy time stamp UUIDs to full UUIDs.

Warning
This is a work in progress. It only contains the original code that automatically updated the UUIDs when loading legacy schematics. This is an incomplete solution because a way to force a PCB update from schematic with the update symbol links from references setting must be executed to ensure proper synchronization between the schematic and board.

Definition at line 1181 of file sch_edit_frame.cpp.

1182 {
1183  // Remove this once this method is fully implemented. Otherwise, don't use it.
1184  wxCHECK( false, /* void */ );
1185 
1186  // Replace sheet and symbol time stamps with real UUIDs and update symbol instance
1187  // sheet paths using the new UUID based sheet paths.
1188 
1189  // Save the time stamp sheet paths.
1190  SCH_SHEET_LIST timeStampSheetPaths = Schematic().GetSheets();
1191 
1192  std::vector<KIID_PATH> oldSheetPaths = timeStampSheetPaths.GetPaths();
1193 
1194  // The root sheet now gets a permanent UUID.
1195  const_cast<KIID&>( Schematic().Root().m_Uuid ).ConvertTimestampToUuid();
1196 
1197  SCH_SCREENS schematic( Schematic().Root() );
1198 
1199  // Change the sheet and symbol time stamps to UUIDs.
1200  for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
1201  {
1202  for( auto sheet : screen->Items().OfType( SCH_SHEET_T ) )
1203  const_cast<KIID&>( sheet->m_Uuid ).ConvertTimestampToUuid();
1204 
1205  for( auto symbol : screen->Items().OfType( SCH_COMPONENT_T ) )
1206  const_cast<KIID&>( symbol->m_Uuid ).ConvertTimestampToUuid();
1207  }
1208 
1209  timeStampSheetPaths.ReplaceLegacySheetPaths( oldSheetPaths );
1210 }
SCH_SHEET_LIST.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
SCHEMATIC & Schematic() const
std::vector< KIID_PATH > GetPaths() const
void ReplaceLegacySheetPaths(const std::vector< KIID_PATH > &aOldSheetPaths)
Update all of the symbol sheet paths to the sheet paths defined in aOldSheetPaths.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), SCH_SHEET_LIST::GetPaths(), SCHEMATIC::GetSheets(), SCH_SHEET_LIST::ReplaceLegacySheetPaths(), SCH_COMPONENT_T, SCH_SHEET_T, and Schematic().

◆ CreateArchiveLibrary()

bool SCH_EDIT_FRAME::CreateArchiveLibrary ( const wxString &  aFileName)

Create a library aFileName that contains all components used in the current schematic.

Parameters
aFileNameThe full path and file name of the archive library.
Returns
True if aFileName was written successfully.

Definition at line 66 of file libarch.cpp.

67 {
68  wxString tmp;
69  wxString errorMsg;
70  SCH_SCREENS screens( Schematic().Root() );
71 
72  // Create a new empty library to archive components:
73  std::unique_ptr<PART_LIB> archLib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) );
74 
75  // Save symbols to file only when the library will be fully filled
76  archLib->EnableBuffering();
77 
78  /* Examine all screens (not hierarchical sheets) used in the schematic and build a
79  * library of unique symbols found in all screens. Complex hierarchies are not a
80  * problem because we just want to know the library symbols used in the schematic
81  * not their reference.
82  */
83  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
84  {
85 
86  for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
87  {
88  LIB_PART* part = nullptr;
89  auto component = static_cast<SCH_COMPONENT*>( aItem );
90 
91  try
92  {
93  if( archLib->FindPart( component->GetLibId() ) )
94  continue;
95 
96  part = GetLibPart( component->GetLibId(), true );
97  }
98  catch( const IO_ERROR& )
99  {
100  // Queue up error messages for later.
101  tmp.Printf( _( "Failed to add symbol \"%s\" to library file \"%s\"." ),
102  component->GetLibId().GetUniStringLibItemName(), aFileName );
103 
104  // Don't bail out here. Attempt to add as many of the symbols to the library
105  // as possible.
106  }
107  catch( ... )
108  {
109  tmp = _( "Unexpected exception occurred." );
110  }
111 
112  if( part )
113  {
114  std::unique_ptr<LIB_PART> flattenedPart = part->Flatten();
115 
116  // Use the full LIB_ID as the symbol name to prevent symbol name collisions.
117  flattenedPart->SetName( component->GetLibId().GetUniStringLibId() );
118 
119  // AddPart() does first clone the part before adding.
120  archLib->AddPart( flattenedPart.get() );
121  }
122  else
123  {
124  tmp.Printf( _( "Symbol %s not found in any library or cache." ),
125  component->GetLibId().GetUniStringLibId() );
126  }
127 
128  if( !tmp.empty() && !errorMsg.Contains( component->GetLibId().GetUniStringLibId() ) )
129  {
130  if( errorMsg.empty() )
131  errorMsg += tmp;
132  else
133  errorMsg += "\n" + tmp;
134  }
135  }
136  }
137 
138  if( !errorMsg.empty() )
139  {
140  tmp.Printf( _( "Errors occurred creating symbol library %s." ), aFileName );
141  DisplayErrorMessage( this, tmp, errorMsg );
142  }
143 
144  archLib->EnableBuffering( false );
145 
146  try
147  {
148  archLib->Save( false );
149  }
150  catch( const IO_ERROR& ioe )
151  {
152  errorMsg.Printf( _( "Failed to save symbol library file \"%s\"" ), aFileName );
153  DisplayErrorMessage( this, errorMsg, ioe.What() );
154  return false;
155  }
156  catch( std::exception& error )
157  {
158  errorMsg.Printf( _( "Failed to save symbol library file \"%s\"" ), aFileName );
159  DisplayErrorMessage( this, errorMsg, error.what() );
160  return false;
161  }
162 
163  return true;
164 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
SCHEMATIC & Schematic() const
Define a library symbol object.
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
#define _(s)
Definition: 3d_actions.cpp:33
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
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References _, DisplayErrorMessage(), LIB_PART::Flatten(), SCH_SCREENS::GetFirst(), SCH_BASE_FRAME::GetLibPart(), SCH_SCREENS::GetNext(), LIBRARY_TYPE_EESCHEMA, SCH_COMPONENT_T, Schematic(), and IO_ERROR::What().

Referenced by CreateArchiveLibraryCacheFile().

◆ CreateArchiveLibraryCacheFile()

bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile ( bool  aUseCurrentSheetFilename = false)

Create a symbol library file with the name of the root document plus the '-cache' suffix,.

This file will contain all components used in the current schematic.

Parameters
aUseCurrentSheetFilename= false to use the root sheet filename (default) or true to use the currently opened sheet.
Returns
true if the file was written successfully.

Definition at line 43 of file libarch.cpp.

44 {
45  wxFileName fn;
46 
47  if( aUseCurrentSheetFilename )
48  fn = GetScreen()->GetFileName();
49  else
50  fn = Schematic().RootScreen()->GetFileName();
51 
52  fn.SetName( fn.GetName() + "-cache" );
53  fn.SetExt( LegacySymbolLibFileExtension );
54 
55  bool success = CreateArchiveLibrary( fn.GetFullPath() );
56 
57  // Update the schematic symbol library links.
58  // because the lib cache has changed
59  SCH_SCREENS schematic( Schematic().Root() );
60  schematic.UpdateSymbolLinks();
61 
62  return success;
63 }
const wxString & GetFileName() const
Definition: sch_screen.h:185
const std::string LegacySymbolLibFileExtension
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCHEMATIC & Schematic() const
SCH_SCREEN * RootScreen() const
Helper to retreive the screen of the root sheet.
Definition: schematic.cpp:126
bool CreateArchiveLibrary(const wxString &aFileName)
Create a library aFileName that contains all components used in the current schematic.
Definition: libarch.cpp:66
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References CreateArchiveLibrary(), SCH_SCREEN::GetFileName(), GetScreen(), LegacySymbolLibFileExtension, SCHEMATIC::RootScreen(), and Schematic().

Referenced by Save_File().

◆ createCanvas()

void SCH_BASE_FRAME::createCanvas ( )
inherited

Definition at line 301 of file sch_base_frame.cpp.

302 {
304 
305  // Allows only a CAIRO or OPENGL canvas:
308  {
310  }
311 
312  SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
315 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)

References EDA_DRAW_FRAME::ActivateGalCanvas(), EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, EDA_DRAW_FRAME::GetGalDisplayOptions(), EDA_DRAW_FRAME::LoadCanvasTypeSetting(), EDA_DRAW_FRAME::m_canvasType, EDA_BASE_FRAME::m_FrameSize, and EDA_DRAW_FRAME::SetCanvas().

Referenced by SCH_BASE_FRAME::SCH_BASE_FRAME().

◆ CreateScreens()

void SCH_EDIT_FRAME::CreateScreens ( )

Definition at line 416 of file sch_edit_frame.cpp.

417 {
418  m_schematic->Reset();
419  m_schematic->SetProject( &Prj() );
421 
423 
425 
426  SCH_SCREEN* rootScreen = new SCH_SCREEN( m_schematic );
427  rootScreen->SetMaxUndoItems( m_UndoRedoCountMax );
428  m_schematic->Root().SetScreen( rootScreen );
429  SetScreen( Schematic().RootScreen() );
430 
431  m_schematic->RootScreen()->SetFileName( wxEmptyString );
432 
433  if( GetScreen() == NULL )
434  {
435  SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
437  SetScreen( screen );
438  }
439 }
SCHEMATIC * m_schematic
The currently loaded schematic.
void SetScreen(BASE_SCREEN *aScreen) override
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:138
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:151
TEMPLATES m_templateFieldNames
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SetRoot(SCH_SHEET *aRootSheet)
Initializes the schematic with a new root sheet.
Definition: schematic.cpp:113
void SetTemplateFieldNames(TEMPLATES *aTemplates)
Sets up the template fieldnames link if this project is opened in eeschema.
Definition: schematic.cpp:101
#define NULL
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCHEMATIC & Schematic() const
SCHEMATIC_SETTINGS * m_defaults
void SetProject(PROJECT *aPrj)
Definition: schematic.cpp:72
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:216
void Reset()
Initializes this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:49
SCH_SHEET & Root() const
Definition: schematic.h:97
void SetMaxUndoItems(int aMax)
Definition: base_screen.h:172
void SetFileName(const wxString &aFileName)
Definition: sch_screen.h:183
SCH_SCREEN * RootScreen() const
Helper to retreive the screen of the root sheet.
Definition: schematic.cpp:126

References GetScreen(), SCH_BASE_FRAME::m_defaults, m_schematic, SCH_BASE_FRAME::m_templateFieldNames, EDA_DRAW_FRAME::m_UndoRedoCountMax, NULL, KIWAY_HOLDER::Prj(), SCHEMATIC::Reset(), SCHEMATIC::Root(), SCHEMATIC::RootScreen(), Schematic(), SCH_SCREEN::SetFileName(), BASE_SCREEN::SetMaxUndoItems(), SCHEMATIC::SetProject(), SCHEMATIC::SetRoot(), SCH_SHEET::SetScreen(), SetScreen(), SCHEMATIC::SetTemplateFieldNames(), and SCHEMATIC::Settings().

Referenced by importFile(), and OpenProjectFiles().

◆ CreateServer()

void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

50 {
51  wxIPV4address addr;
52 
53  // Set the port number
54  addr.Service( service );
55 
56  // Listen on localhost only if requested
57  if( local )
58  addr.Hostname( HOSTNAME );
59 
60  delete m_socketServer;
61  m_socketServer = new wxSocketServer( addr );
62 
63  m_socketServer->SetNotify( wxSOCKET_CONNECTION_FLAG );
64  m_socketServer->SetEventHandler( *this, ID_EDA_SOCKET_EVENT_SERV );
65  m_socketServer->Notify( true );
66 }
static const wxString HOSTNAME(wxT("localhost"))
wxSocketServer * m_socketServer

References HOSTNAME(), ID_EDA_SOCKET_EVENT_SERV, and EDA_DRAW_FRAME::m_socketServer.

Referenced by SCH::IFACE::CreateWindow().

◆ CreateSheetPin()

SCH_SHEET_PIN * SCH_EDIT_FRAME::CreateSheetPin ( SCH_SHEET aSheet,
SCH_HIERLABEL aLabel 
)

Create a new SCH_SHEET_PIN object and add it to aSheet at the current cursor position.

Parameters
aSheetThe sheet to add the new sheet pin to.
Returns
The new sheet pin object created or NULL if the task was aborted by the user.

Definition at line 501 of file sheet.cpp.

502 {
503  SCHEMATIC_SETTINGS& settings = aSheet->Schematic()->Settings();
504  wxString text;
505  SCH_SHEET_PIN* sheetPin;
506 
507  if( aLabel )
508  {
509  text = aLabel->GetText();
510  m_lastSheetPinType = aLabel->GetShape();
511  }
512 
513  sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), text );
514  sheetPin->SetFlags( IS_NEW );
515  sheetPin->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
516  sheetPin->SetShape( m_lastSheetPinType );
517 
518  if( !aLabel )
519  {
520  DIALOG_EDIT_SHEET_PIN dlg( this, sheetPin );
521 
522  if( dlg.ShowModal() != wxID_OK || sheetPin->GetText().IsEmpty() )
523  {
524  delete sheetPin;
525  return nullptr;
526  }
527  }
528 
529  m_lastSheetPinType = sheetPin->GetShape();
530 
531  sheetPin->SetPosition( (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition() );
532 
533  return sheetPin;
534 }
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:239
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:138
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:116
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:237
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
static PINSHEETLABEL_SHAPE m_lastSheetPinType
Last sheet pin type.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:84
void SetPosition(const wxPoint &aPosition) override
Set the schematic item position to aPosition.
Definition: sch_sheet.h:205
These settings were stored in SCH_BASE_FRAME previously.
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:126
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:237

References SCH_BASE_FRAME::GetCanvas(), SCH_TEXT::GetShape(), EDA_TEXT::GetText(), IS_NEW, SCHEMATIC_SETTINGS::m_DefaultTextSize, m_lastSheetPinType, SCH_ITEM::Schematic(), EDA_ITEM::SetFlags(), SCH_SHEET_PIN::SetPosition(), SCH_TEXT::SetShape(), EDA_TEXT::SetTextSize(), and SCHEMATIC::Settings().

Referenced by SCH_DRAWING_TOOLS::TwoClickPlace().

◆ CurrentToolName()

std::string TOOLS_HOLDER::CurrentToolName ( ) const
inherited

Definition at line 99 of file tools_holder.cpp.

100 {
101  if( m_toolStack.empty() )
102  return ACTIONS::selectionTool.GetName();
103  else
104  return m_toolStack.back();
105 }
std::vector< std::string > m_toolStack
Definition: tools_holder.h:52
static TOOL_ACTION selectionTool
Definition: actions.h:147

References TOOLS_HOLDER::m_toolStack, and ACTIONS::selectionTool.

Referenced by TOOL_MANAGER::processEvent().

◆ DefaultExecFlags()

void SCH_EDIT_FRAME::DefaultExecFlags ( )
inline

Reset the execution flags to defaults for external netlist and bom generators.

Definition at line 897 of file sch_edit_frame.h.

897 { m_exec_flags = wxEXEC_SYNC; }
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.

References m_exec_flags.

Referenced by WriteNetListFile().

◆ DeleteAllTemplateFieldNames()

void SCH_EDIT_FRAME::DeleteAllTemplateFieldNames ( bool  aGlobal)
inline

Remove all global or project fieldname templates.

Definition at line 204 of file sch_edit_frame.h.

205  {
207  }
TEMPLATES m_templateFieldNames
void DeleteAllFieldNameTemplates(bool aGlobal)
Function DeleteAllFieldNameTemplates deletes the entire contents.

References TEMPLATES::DeleteAllFieldNameTemplates(), and SCH_BASE_FRAME::m_templateFieldNames.

Referenced by PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromWindow().

◆ DeleteAnnotation()

void SCH_EDIT_FRAME::DeleteAnnotation ( bool  aCurrentSheetOnly)

Clear the current component annotation.

Parameters
aCurrentSheetOnlyClear only the annotation for the current sheet if true. Otherwise clear the entire schematic annotation.

Definition at line 61 of file eeschema/annotate.cpp.

62 {
63  if( aCurrentSheetOnly )
64  {
65  SCH_SCREEN* screen = GetScreen();
66  wxCHECK_RET( screen != NULL, wxT( "Attempt to clear annotation of a NULL screen." ) );
67  screen->ClearAnnotation( &GetCurrentSheet() );
68  }
69  else
70  {
71  SCH_SCREENS ScreenList( Schematic().Root() );
72  ScreenList.ClearAnnotation();
73  }
74 
75  // Update the references for the sheet that is currently being displayed.
77 
78  SyncView();
79  GetCanvas()->Refresh();
80  OnModify();
81 }
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define NULL
void SyncView()
Mark all items for refresh.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCHEMATIC & Schematic() const
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...
SCH_SHEET_PATH & GetCurrentSheet() const
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Clear the annotation for the components in aSheetPath on the screen.
Definition: sch_screen.cpp:909
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References SCH_SCREEN::ClearAnnotation(), SCH_SCREENS::ClearAnnotation(), SCH_BASE_FRAME::GetCanvas(), GetCurrentSheet(), GetScreen(), NULL, OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), Schematic(), SCH_BASE_FRAME::SyncView(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

Referenced by AnnotateComponents(), and DIALOG_ANNOTATE::OnClearAnnotationCmpClick().

◆ DeleteJunction()

void SCH_EDIT_FRAME::DeleteJunction ( SCH_ITEM aItem,
bool  aAppend = false 
)

Removes a given junction and heals any wire segments under the junction.

Parameters
aItemThe junction to delete
aAppendTrue if we are updating an ongoing commit

Note that std::list or similar is required here as we may insert values in the loop below. This will invalidate iterators in a std::vector or std::deque

Definition at line 355 of file bus-wire-junction.cpp.

356 {
357  SCH_SCREEN* screen = GetScreen();
358  PICKED_ITEMS_LIST undoList;
361 
362  auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void
363  {
364  aItem->SetFlags( STRUCT_DELETED );
365  undoList.PushItem( ITEM_PICKER( aItem, UR_DELETED ) );
366  };
367 
368  remove_item( aJunction );
369  RemoveFromScreen( aJunction );
370 
373  std::list<SCH_LINE*> lines;
374 
375  for( SCH_ITEM* item : screen->Items().Overlapping( SCH_LINE_T, aJunction->GetPosition() ) )
376  {
377  SCH_LINE* line = static_cast<SCH_LINE*>( item );
378 
379  if( line->IsType( wiresAndBuses ) && line->IsEndPoint( aJunction->GetPosition() )
380  && !( line->GetEditFlags() & STRUCT_DELETED ) )
381  lines.push_back( line );
382  }
383 
385  lines.begin(), lines.end(), [&]( SCH_LINE* firstLine, SCH_LINE* secondLine ) {
386  if( ( firstLine->GetEditFlags() & STRUCT_DELETED )
387  || ( secondLine->GetEditFlags() & STRUCT_DELETED )
388  || !secondLine->IsParallel( firstLine ) )
389  return;
390 
391  // Remove identical lines
392  if( firstLine->IsEndPoint( secondLine->GetStartPoint() )
393  && firstLine->IsEndPoint( secondLine->GetEndPoint() ) )
394  {
395  remove_item( firstLine );
396  return;
397  }
398 
399  // Try to merge the remaining lines
400  if( SCH_LINE* line = secondLine->MergeOverlap( firstLine ) )
401  {
402  remove_item( firstLine );
403  remove_item( secondLine );
404  undoList.PushItem( ITEM_PICKER( line, UR_NEW ) );
405  AddToScreen( line );
406 
407  if( line->IsSelected() )
408  selectionTool->AddItemToSel( line, true /*quiet mode*/ );
409 
410  lines.push_back( line );
411  }
412  } );
413 
414  SaveCopyInUndoList( undoList, UR_DELETED, aAppend );
415 
416 
417  for( auto line : lines )
418  {
419  if( line->GetEditFlags() & STRUCT_DELETED )
420  {
421  if( line->IsSelected() )
422  selectionTool->RemoveItemFromSel( line, true /*quiet mode*/ );
423 
424  RemoveFromScreen( line );
425  }
426  }
427 }
SCH_LINE * MergeOverlap(SCH_LINE *aLine)
Check line against aLine to see if it overlaps and merge if it does.
Definition: sch_line.cpp:369
bool IsSelected() const
Definition: base_struct.h:203
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,...
EE_TYPE Overlapping(const EDA_RECT &aRect)
Definition: sch_rtree.h:224
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
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,...
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void for_all_pairs(_InputIterator __first, _InputIterator __last, _Function __f)
Apply a function to every possible pair of elements of a sequence.
Definition: kicad_algo.h:63
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:87
PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
int AddItemToSel(const TOOL_EVENT &aEvent)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
EE_RTREE & Items()
Definition: sch_screen.h:158
bool IsType(const KICAD_T aScanTypes[]) const override
Function IsType Checks whether the item is one of the listed types.
Definition: sch_line.h:69
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187

References EE_SELECTION_TOOL::AddItemToSel(), SCH_BASE_FRAME::AddToScreen(), EOT, alg::for_all_pairs(), EDA_ITEM::GetEditFlags(), EDA_ITEM::GetPosition(), GetScreen(), TOOL_MANAGER::GetTool(), SCH_LINE::IsEndPoint(), SCH_LINE::IsType(), SCH_SCREEN::Items(), TOOLS_HOLDER::m_toolManager, SCH_LINE::MergeOverlap(), EE_RTREE::Overlapping(), PICKED_ITEMS_LIST::PushItem(), SCH_BASE_FRAME::RemoveFromScreen(), EE_SELECTION_TOOL::RemoveItemFromSel(), SaveCopyInUndoList(), SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, SCH_LINE_T, STRUCT_DELETED, UR_DELETED, and UR_NEW.

Referenced by SCH_EDIT_TOOL::DoDelete().

◆ Destroy()

◆ DismissModal()

void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
inherited

Definition at line 160 of file kiway_player.cpp.

161 {
162  m_modal_ret_val = aRetVal;
163  m_modal_string = aResult;
164 
165  if( m_modal_loop )
166  {
167  m_modal_loop->Exit();
168  m_modal_loop = 0; // this marks it as dismissed.
169  }
170 
171  Show( false );
172 }
bool m_modal_ret_val
Definition: kiway_player.h:205
wxString m_modal_string
Definition: kiway_player.h:204
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:202

References KIWAY_PLAYER::m_modal_loop, KIWAY_PLAYER::m_modal_ret_val, and KIWAY_PLAYER::m_modal_string.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), LIB_VIEW_FRAME::FinishModal(), LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

◆ DisplayCurrentSheet()

void SCH_EDIT_FRAME::DisplayCurrentSheet ( )

Draw the current sheet on the display.

Definition at line 229 of file hierarch.cpp.

230 {
233 
234  SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
235 
236  wxASSERT( screen );
237 
238  SetScreen( screen );
239 
240  // update the References
243 
244  if( !screen->m_Initialized )
245  {
247  screen->m_Initialized = true;
248  screen->ClearUndoORRedoList( screen->m_UndoList, 1 );
249  }
250  else
251  {
252  // RedrawScreen() will set zoom to last used
253  RedrawScreen( (wxPoint) GetScreen()->m_ScrollCenter, false );
254  }
255 
256  UpdateTitle();
257 
260  editTool->UpdateNetHighlighting( dummy );
261 
262  HardRedraw(); // Ensure any item has its view updated, especially the worksheet items
263 }
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
void SetScreen(BASE_SCREEN *aScreen) override
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
void UpdateTitle()
Set the main window title bar text.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_EDITOR_CONTROL.
void HardRedraw() override
Rebuild the GAL and redraw the screen.
UNDO_REDO_CONTAINER m_UndoList
Objects list for the undo command (old data)
Definition: base_screen.h:82
bool m_Initialized
Definition: base_screen.h:79
TOOL_EVENT.
Definition: tool_event.h:171
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Updates net highlighting after an edit
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
SCH_SCREEN * LastScreen()
Function LastScreen.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
SCH_SHEET_PATH & GetCurrentSheet() const
virtual void ClearUndoORRedoList(UNDO_REDO_CONTAINER &aList, int aItemCount=-1) override
Free the undo or redo list from aList element.
Definition: sch_screen.cpp:804

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SCH_SCREEN::ClearUndoORRedoList(), dummy(), GetCurrentSheet(), GetScreen(), TOOL_MANAGER::GetTool(), HardRedraw(), SCH_SHEET_PATH::LastScreen(), BASE_SCREEN::m_Initialized, TOOLS_HOLDER::m_toolManager, BASE_SCREEN::m_UndoList, SCH_BASE_FRAME::RedrawScreen(), TOOL_MANAGER::RunAction(), SetScreen(), SetSheetNumberAndCount(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), UpdateTitle(), and ACTIONS::zoomFitScreen.

Referenced by SCH_EDITOR_CONTROL::EnterSheet(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_EDITOR_CONTROL::LeaveSheet(), DIALOG_ERC::OnERCItemSelected(), OnPageSettingsChange(), and HIERARCHY_NAVIG_DLG::onSelectSheetPath().

◆ DisplayGridMsg()

void EDA_DRAW_FRAME::DisplayGridMsg ( )
virtualinherited

Display current grid size in the status bar.

Reimplemented in PCB_BASE_FRAME, GERBVIEW_FRAME, and PL_EDITOR_FRAME.

Definition at line 475 of file eda_draw_frame.cpp.

476 {
477  wxString line;
478  wxString gridformatter;
479 
480  switch( m_userUnits )
481  {
482  case EDA_UNITS::INCHES: gridformatter = "grid %.3f"; break;
483  case EDA_UNITS::MILLIMETRES: gridformatter = "grid %.4f"; break;
484  default: gridformatter = "grid %f"; break;
485  }
486 
487  double grid = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x );
488  line.Printf( gridformatter, grid );
489 
490  SetStatusText( line, 4 );
491 }
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:92
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
EDA_UNITS m_userUnits

References EDA_DRAW_FRAME::GetCanvas(), INCHES, EDA_BASE_FRAME::m_userUnits, MILLIMETRES, and To_User_Unit().

Referenced by SCH_BASE_FRAME::UpdateStatusBar().

◆ DisplayToolMsg()

void EDA_DRAW_FRAME::DisplayToolMsg ( const wxString &  msg)
overridevirtualinherited

Reimplemented from TOOLS_HOLDER.

Definition at line 466 of file eda_draw_frame.cpp.

467 {
468  SetStatusText( msg, 6 );
469 }

Referenced by EDIT_TOOL::Duplicate(), and PCBNEW_CONTROL::Paste().

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane in the status bar.

Definition at line 494 of file eda_draw_frame.cpp.

495 {
496  wxString msg;
497 
498  switch( m_userUnits )
499  {
500  case EDA_UNITS::INCHES: msg = _( "Inches" ); break;
501  case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
502  default: msg = _( "Units" ); break;
503  }
504 
505  SetStatusText( msg, 5 );
506 }
#define _(s)
Definition: 3d_actions.cpp:33
EDA_UNITS m_userUnits

References _, INCHES, EDA_BASE_FRAME::m_userUnits, and MILLIMETRES.

Referenced by EDA_DRAW_FRAME::UpdateGridSelectBox(), SCH_BASE_FRAME::UpdateStatusBar(), and EDA_DRAW_FRAME::UpdateStatusBar().

◆ doAutoSave()

bool SCH_EDIT_FRAME::doAutoSave ( )
overrideprotectedvirtual

Save the schematic files that have been modified and not yet saved.

Returns
true if the auto save was successful otherwise false.

Reimplemented from EDA_BASE_FRAME.

Definition at line 743 of file eeschema/files-io.cpp.

744 {
745  wxFileName tmpFileName = Schematic().Root().GetFileName();
746  wxFileName fn = tmpFileName;
747  wxFileName tmp;
748  SCH_SCREENS screens( Schematic().Root() );
749 
750  bool autoSaveOk = true;
751 
752  tmp.AssignDir( fn.GetPath() );
753 
754  if( !tmp.IsOk() )
755  return false;
756 
757  if( !IsWritable( tmp ) )
758  return false;
759 
760  for( size_t i = 0; i < screens.GetCount(); i++ )
761  {
762  // Only create auto save files for the schematics that have been modified.
763  if( !screens.GetScreen( i )->IsSave() )
764  continue;
765 
766  tmpFileName = fn = screens.GetScreen( i )->GetFileName();
767 
768  // Auto save file name is the normal file name prefixed with GetAutoSavePrefix().
769  fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
770 
771  screens.GetScreen( i )->SetFileName( fn.GetFullPath() );
772 
773  if( SaveEEFile( screens.GetSheet( i ), false ) )
774  screens.GetScreen( i )->SetModify();
775  else
776  autoSaveOk = false;
777 
778  screens.GetScreen( i )->SetFileName( tmpFileName.GetFullPath() );
779  }
780 
781  if( autoSaveOk )
782  {
783  m_autoSaveState = false;
784 
787  }
788 
789  return autoSaveOk;
790 }
SETTINGS_MANAGER * GetSettingsManager() const
AUTO_BACKUP m_Backup
bool IsWritable(const wxFileName &aFileName)
Checks if aFileName can be written.
bool SaveEEFile(SCH_SHEET *aSheet, bool aSaveUnderNewName=false)
Save aSheet to a schematic file.
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Calls BackupProject if a new backup is needed according to the current backup policy.
COMMON_SETTINGS * GetCommonSettings() const
Retrieves the common settings shared by all applications.
SCHEMATIC & Schematic() const
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:496
static wxString GetAutoSaveFilePrefix()
SCH_SHEET & Root() const
Definition: schematic.h:97
bool backup_on_autosave
Trigger a backup on autosave.
static REPORTER & GetInstance()
Definition: reporter.cpp:105
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546

References COMMON_SETTINGS::AUTO_BACKUP::backup_on_autosave, EDA_BASE_FRAME::GetAutoSaveFilePrefix(), SETTINGS_MANAGER::GetCommonSettings(), SCH_SCREENS::GetCount(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetFileName(), NULL_REPORTER::GetInstance(), SCH_SCREENS::GetScreen(), EDA_BASE_FRAME::GetSettingsManager(), SCH_SCREENS::GetSheet(), BASE_SCREEN::IsSave(), EDA_BASE_FRAME::IsWritable(), EDA_BASE_FRAME::m_autoSaveState, COMMON_SETTINGS::m_Backup, SCHEMATIC::Root(), SaveEEFile(), Schematic(), SCH_SCREEN::SetFileName(), BASE_SCREEN::SetModify(), and SETTINGS_MANAGER::TriggerBackupIfNeeded().

◆ DrawCurrentSheetToClipboard()

void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard ( )

Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.

Definition at line 555 of file sheet.cpp.

556 {
557  wxRect DrawArea;
558  BASE_SCREEN* screen = GetScreen();
559 
560  DrawArea.SetSize( GetPageSizeIU() );
561 
562  // Calculate a reasonable dc size, in pixels, and the dc scale to fit
563  // the drawings into the dc size
564  // scale is the ratio resolution (in PPI) / internal units
565  double ppi = 300; // Use 300 pixels per inch to create bitmap images on start
566  double inch2Iu = 1000.0 * IU_PER_MILS;
567  double scale = ppi / inch2Iu;
568 
569  wxSize dcsize = DrawArea.GetSize();
570 
571  int maxdim = std::max( dcsize.x, dcsize.y );
572 
573  // the max size in pixels of the bitmap used to build the sheet copy
574  const int maxbitmapsize = 5600;
575 
576  while( int( maxdim * scale ) > maxbitmapsize )
577  {
578  ppi = ppi / 1.5;
579  scale = ppi / inch2Iu;
580  }
581 
582  dcsize.x *= scale;
583  dcsize.y *= scale;
584 
585  // Set draw offset, zoom... to values needed to draw in the memory DC
586  // after saving initial values:
587  wxPoint tmp_startvisu = screen->m_StartVisu;
588  wxPoint old_org = screen->m_DrawOrg;
589  screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
590  screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
591 
592  wxMemoryDC dc;
593  wxBitmap image( dcsize );
594  dc.SelectObject( image );
595  dc.Clear();
596 
597  GRResetPenAndBrush( &dc );
598  GRForceBlackPen( false );
599  dc.SetUserScale( scale, scale );
600 
601  GetRenderSettings()->SetPrintDC( &dc );
602 
604 
605  if( wxTheClipboard->Open() )
606  {
607  // This data objects are held by the clipboard, so do not delete them in the app.
608  wxBitmapDataObject* clipbrd_data = new wxBitmapDataObject( image );
609  wxTheClipboard->SetData( clipbrd_data );
610  wxTheClipboard->Close();
611  }
612 
613  // Deselect Bitmap from DC in order to delete the MemoryDC
614  dc.SelectObject( wxNullBitmap );
615 
616  GRForceBlackPen( false );
617 
618  screen->m_StartVisu = tmp_startvisu;
619  screen->m_DrawOrg = old_org;
620 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:122
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint m_StartVisu
Coordinates in drawing units of the current view position (upper left corner of device)
Definition: base_screen.h:67
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:203
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:44
virtual void PrintPage(RENDER_SETTINGS *aSettings) override
Plot or print the current sheet to the clipboard.
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:62
#define IU_PER_MILS
Definition: plotter.cpp:138
void SetPrintDC(wxDC *aDC)

References SCH_BASE_FRAME::GetPageSizeIU(), SCH_BASE_FRAME::GetRenderSettings(), GetScreen(), GRForceBlackPen(), GRResetPenAndBrush(), IU_PER_MILS, BASE_SCREEN::m_DrawOrg, BASE_SCREEN::m_StartVisu, PrintPage(), scale, KIGFX::RENDER_SETTINGS::SetPrintDC(), wxPoint::x, and wxPoint::y.

Referenced by SCH_EDITOR_CONTROL::DrawSheetOnClipboard().

◆ EditSheetProperties()

bool SCH_EDIT_FRAME::EditSheetProperties ( SCH_SHEET aSheet,
SCH_SHEET_PATH aHierarchy,
bool *  aClearAnnotationNewItems 
)

Edit an existing sheet or add a new sheet to the schematic.

When aSheet is a new sheet:

  • and the file name already exists in the schematic hierarchy, the screen associated with the sheet found in the hierarchy is associated with aSheet.
  • and the file name already exists on the system, then aSheet is loaded with the existing file.
  • and the file name does not exist in the schematic hierarchy or on the file system, then a new screen is created and associated with aSheet.

When aSheet is an existing sheet:

  • and the file name already exists in the schematic hierarchy, the current associated screen is replace by the one found in the hierarchy.
  • and the file name already exists on the system, the current associated screen file name is changed and the file is loaded.
  • and the file name does not exist in the schematic hierarchy or on the file system, the current associated screen file name is changed and saved to disk.

Note: the screen is not refresh. The caller is responsible to do that

Parameters
aSheetis the sheet to edit
aHierarchyis the current hierarchy containing aSheet
aClearAnnotationNewItemsis a reference to a bool to know if the items managed by this sheet need to have their annotation cleared i.e. when an existing item list is used. it can happens when the edited sheet used an existying file, or becomes a new instance of a already existing sheet.

Definition at line 482 of file sheet.cpp.

484 {
485  if( aSheet == NULL || aHierarchy == NULL )
486  return false;
487 
488  // Get the new texts
489  DIALOG_SCH_SHEET_PROPS dlg( this, aSheet, aClearAnnotationNewItems );
490 
491  if( dlg.ShowModal() == wxID_CANCEL )
492  return false;
493 
494  return true;
495 }
#define NULL

References NULL.

Referenced by SCH_DRAWING_TOOLS::DrawSheet(), and SCH_EDIT_TOOL::Properties().

◆ eeconfig()

EESCHEMA_SETTINGS * SCH_BASE_FRAME::eeconfig ( ) const
inherited

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 223 of file eda_draw_frame.cpp.

224 {
225  if( m_messagePanel )
227 }
EDA_MSG_PANEL * m_messagePanel
void EraseMsgBox()
Definition: msgpanel.cpp:216

References EDA_MSG_PANEL::EraseMsgBox(), and EDA_DRAW_FRAME::m_messagePanel.

Referenced by GERBVIEW_CONTROL::UpdateMessagePanel().

◆ ExecuteRemoteCommand()

void SCH_EDIT_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
overridevirtual

Execute a remote command sent by Pcbnew via a socket connection.

When user selects a module or pin in Pcbnew, Eeschema shows that same component or pin and moves cursor on the item. The socket port used is KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.

Valid commands are:

  • $PART: "reference" Put cursor on component.
  • $PART: "reference" $REF: "ref" Put cursor on component reference.
  • $PART: "reference" $VAL: "value" Put cursor on component value.
  • $PART: "reference" $PAD: "pin name" Put cursor on the component pin.
  • $NET: "netname" Highlight a specified net
  • $CLEAR: "HIGHLIGHTED" Clear components highlight

They are a keyword followed by a quoted string.

Parameters
cmdline= received command from Pcbnew

Reimplemented from EDA_DRAW_FRAME.

Definition at line 182 of file eeschema/cross-probing.cpp.

183 {
185  char line[1024];
186 
187  strncpy( line, cmdline, sizeof(line) - 1 );
188  line[ sizeof(line) - 1 ] = '\0';
189 
190  char* idcmd = strtok( line, " \n\r" );
191  char* text = strtok( NULL, "\"\n\r" );
192 
193  if( idcmd == NULL )
194  return;
195 
196  CROSS_PROBING_SETTINGS& crossProbingSettings = eeconfig()->m_CrossProbing;
197 
198  if( strcmp( idcmd, "$NET:" ) == 0 )
199  {
200  if( !crossProbingSettings.auto_highlight )
201  return;
202 
203  wxString netName = FROM_UTF8( text );
204 
205  if( auto sg = Schematic().ConnectionGraph()->FindFirstSubgraphByName( netName ) )
206  m_highlightedConn = sg->m_driver_connection;
207 
209 
210  SetStatusText( _( "Selected net: " ) + UnescapeString( netName ) );
211  return;
212  }
213 
214  if( strcmp( idcmd, "$CLEAR:" ) == 0 )
215  {
216  // Cross-probing is now done through selection so we no longer need a clear command
217  return;
218  }
219 
220  if( text == NULL )
221  return;
222 
223  if( strcmp( idcmd, "$PART:" ) != 0 )
224  return;
225 
226  wxString part_ref = FROM_UTF8( text );
227 
228  /* look for a complement */
229  idcmd = strtok( NULL, " \n\r" );
230 
231  if( idcmd == NULL ) // Highlight component only (from Cvpcb or Pcbnew)
232  {
233  // Highlight component part_ref, or clear Highlight, if part_ref is not existing
234  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
235  return;
236  }
237 
238  text = strtok( NULL, "\"\n\r" );
239 
240  if( text == NULL )
241  return;
242 
243  wxString msg = FROM_UTF8( text );
244 
245  if( strcmp( idcmd, "$REF:" ) == 0 )
246  {
247  // Highlighting the reference itself isn't actually that useful, and it's harder to
248  // see. Highlight the parent and display the message.
249  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
250  }
251  else if( strcmp( idcmd, "$VAL:" ) == 0 )
252  {
253  // Highlighting the value itself isn't actually that useful, and it's harder to see.
254  // Highlight the parent and display the message.
255  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
256  }
257  else if( strcmp( idcmd, "$PAD:" ) == 0 )
258  {
259  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_PIN, msg );
260  }
261  else
262  {
263  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
264  }
265 }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static TOOL_ACTION updateNetHighlighting
Definition: ee_actions.h:208
EESCHEMA_SETTINGS * eeconfig() const
SCH_EDITOR_CONTROL.
Cross-probing behavior.
Definition: app_settings.h:30
SCH_ITEM * FindComponentAndItem(const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText)
Finds a component in the schematic and an item in this component.
#define NULL
SCHEMATIC & Schematic() const
const SCH_CONNECTION * m_highlightedConn
The highlighted net or bus, or nullptr.
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:141

References _, CROSS_PROBING_SETTINGS::auto_highlight, SCH_BASE_FRAME::eeconfig(), SCH_EDITOR_CONTROL::FindComponentAndItem(), FROM_UTF8(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), HIGHLIGHT_COMPONENT, HIGHLIGHT_PIN, APP_SETTINGS_BASE::m_CrossProbing, m_highlightedConn, TOOLS_HOLDER::m_toolManager, NULL, TOOL_MANAGER::RunAction(), Schematic(), UnescapeString(), and EE_ACTIONS::updateNetHighlighting.

Referenced by KiwayMailIn().

◆ FindHierarchyNavigator()

HIERARCHY_NAVIG_DLG * SCH_EDIT_FRAME::FindHierarchyNavigator ( )
Returns
a reference to the Hierarchy Navigator dialog if exists, or nullptr.

Definition at line 650 of file sch_edit_frame.cpp.

651 {
652  wxWindow* navigator = wxWindow::FindWindowByName( HIERARCHY_NAVIG_DLG_WNAME );
653 
654  return static_cast< HIERARCHY_NAVIG_DLG* >( navigator );
655 }
#define HIERARCHY_NAVIG_DLG_WNAME
Definition: hierarch.h:35

References HIERARCHY_NAVIG_DLG_WNAME.

Referenced by OnCloseWindow(), and UpdateHierarchyNavigator().

◆ FixupJunctions()

void SCH_EDIT_FRAME::FixupJunctions ( )

Definition at line 1090 of file sch_edit_frame.cpp.

1091 {
1092  // Save the current sheet, to retrieve it later
1093  SCH_SHEET_PATH oldsheetpath = GetCurrentSheet();
1094 
1095  bool modified = false;
1096 
1097  SCH_SHEET_LIST sheetList = Schematic().GetSheets();
1098 
1099  for( const SCH_SHEET_PATH& sheet : sheetList )
1100  {
1101  // We require a set here to avoid adding multiple junctions to the same spot
1102  std::set<wxPoint> junctions;
1103 
1104  SetCurrentSheet( sheet );
1106 
1107  auto screen = GetCurrentSheet().LastScreen();
1108 
1109  for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
1110  {
1111  auto cmp = static_cast<SCH_COMPONENT*>( aItem );
1112 
1113  for( const SCH_PIN* pin : cmp->GetSchPins( &sheet ) )
1114  {
1115  auto pos = pin->GetPosition();
1116 
1117  // Test if a _new_ junction is needed, and add it if missing
1118  if( screen->IsJunctionNeeded( pos, true ) )
1119  junctions.insert( pos );
1120  }
1121  }
1122 
1123  for( auto& pos : junctions )
1124  AddJunction( pos, false, false );
1125 
1126  if( junctions.size() )
1127  modified = true;
1128  }
1129 
1130  if( modified )
1131  OnModify();
1132 
1133  // Reselect the initial sheet:
1134  SetCurrentSheet( oldsheetpath );
1136  SetScreen( GetCurrentSheet().LastScreen() );
1137 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
SCH_SHEET_LIST.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void SetScreen(BASE_SCREEN *aScreen) override
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCHEMATIC & Schematic() const
SCH_JUNCTION * AddJunction(const wxPoint &aPos, bool aAppendToUndo=false, bool aFinal=true)
SCH_SHEET_PATH.
SCH_SCREEN * LastScreen()
Function LastScreen.
SCH_SHEET_PATH & GetCurrentSheet() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...

References AddJunction(), GetCurrentSheet(), SCHEMATIC::GetSheets(), SCH_SHEET_PATH::LastScreen(), OnModify(), SCH_COMPONENT_T, Schematic(), SetCurrentSheet(), SetScreen(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

Referenced by OpenProjectFiles().

◆ FocusOnItem()

void SCH_EDIT_FRAME::FocusOnItem ( SCH_ITEM aItem)

Definition at line 1153 of file sch_edit_frame.cpp.

1154 {
1155  static KIID lastBrightenedItemID( niluuid );
1156 
1157  SCH_SHEET_LIST sheetList = Schematic().GetSheets();
1159  SCH_ITEM* lastItem = sheetList.GetItem( lastBrightenedItemID, &dummy );
1160 
1161  if( lastItem && lastItem != aItem )
1162  {
1163  lastItem->ClearBrightened();
1164 
1165  RefreshItem( lastItem );
1166  lastBrightenedItemID = niluuid;
1167  }
1168 
1169  if( aItem )
1170  {
1171  aItem->SetBrightened();
1172 
1173  RefreshItem( aItem );
1174  lastBrightenedItemID = aItem->m_Uuid;
1175 
1176  FocusOnLocation( aItem->GetFocusPosition() );
1177  }
1178 }
SCH_SHEET_LIST.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr)
Fetch a SCH_ITEM by ID.
virtual const wxPoint GetFocusPosition() const
Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rath...
Definition: base_struct.h:344
void SetBrightened()
Definition: base_struct.h:209
void ClearBrightened()
Definition: base_struct.h:212
Definition: common.h:68
KIID niluuid(0)
SCHEMATIC & Schematic() const
SCH_SHEET_PATH.
const KIID m_Uuid
Definition: base_struct.h:162
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.
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187

References EDA_ITEM::ClearBrightened(), dummy(), EDA_DRAW_FRAME::FocusOnLocation(), EDA_ITEM::GetFocusPosition(), SCH_SHEET_LIST::GetItem(), SCHEMATIC::GetSheets(), EDA_ITEM::m_Uuid, niluuid, SCH_BASE_FRAME::RefreshItem(), Schematic(), and EDA_ITEM::SetBrightened().

Referenced by HardRedraw(), DIALOG_ERC::OnButtonCloseClick(), DIALOG_ERC::OnCloseErcDialog(), DIALOG_ERC::OnERCItemSelected(), and SetCurrentSheet().

◆ FocusOnLocation()

void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint aPos)
inherited

Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested.

Parameters
aPosis the point to go to.

Definition at line 771 of file eda_draw_frame.cpp.

772 {
773  bool centerView = false;
774  BOX2D r = GetCanvas()->GetView()->GetViewport();
775 
776  // Center if we're off the current view, or within 10% of its edge
777  r.Inflate( - (int) r.GetWidth() / 10 );
778 
779  if( !r.Contains( aPos ) )
780  centerView = true;
781 
782  // Center if we're behind an obscuring dialog, or within 10% of its edge
783  wxWindow* dialog = findDialog( GetChildren() );
784 
785  if( dialog )
786  {
787  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
788  dialog->GetSize() );
789  dialogRect.Inflate( dialogRect.GetWidth() / 10 );
790 
791  if( dialogRect.Contains( (wxPoint) GetCanvas()->GetView()->ToScreen( aPos ) ) )
792  centerView = true;
793  }
794 
795  if( centerView )
796  {
797  // If a dialog partly obscures the window, then center on the uncovered area.
798  if( dialog )
799  {
800  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
801  dialog->GetSize() );
802  GetCanvas()->GetView()->SetCenter( aPos, dialogRect );
803  }
804  else
805  GetCanvas()->GetView()->SetCenter( aPos );
806  }
807 
809 }
BOX2D GetViewport() const
Function GetViewport() Returns the current viewport visible area rectangle.
Definition: view.cpp:538
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
coord_type GetWidth() const
Definition: box2.h:196
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:150
wxWindow * findDialog(wxWindowList &aList)
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301

References BOX2< Vec >::Contains(), findDialog(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Inflate(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition().

Referenced by SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindNext(), PCB_BASE_FRAME::FocusOnItem(), FocusOnItem(), and DIALOG_FIND::search().

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 488 of file eda_base_frame.h.

488 { return m_AboutTitle; }
wxString m_AboutTitle

References EDA_BASE_FRAME::m_AboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT(), and COMMON_CONTROL::ReportBug().

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited
Returns
the string to prepend to a file name for automatic save.

Definition at line 165 of file eda_base_frame.h.

166  {
167  return wxT( "_autosave-" );
168  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::Files_io_from_id(), OnCloseWindow(), PCB_EDIT_FRAME::OnExportSTEP(), SaveEEFile(), and PCB_EDIT_FRAME::SavePcbFile().

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 259 of file eda_base_frame.h.

259 { return m_autoSaveInterval; }

References EDA_BASE_FRAME::m_autoSaveInterval.

◆ GetBackupSuffix()

static wxString EDA_BASE_FRAME::GetBackupSuffix ( )
inlinestaticprotectedinherited
Returns
the suffix to be appended to the file extension on backup

Definition at line 157 of file eda_base_frame.h.

158  {
159  return wxT( "-bak" );
160  }

◆ GetCanvas()

SCH_DRAW_PANEL * SCH_BASE_FRAME::GetCanvas ( ) const
overridevirtualinherited

Return a pointer to GAL-based canvas of given EDA draw frame.

Returns
Pointer to GAL-based canvas.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 288 of file sch_base_frame.cpp.

289 {
290  return static_cast<SCH_DRAW_PANEL*>( EDA_DRAW_FRAME::GetCanvas() );
291 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.

References EDA_DRAW_FRAME::GetCanvas().

Referenced by AddItemToScreenAndUndoList(), AddJunction(), SCH_BASE_FRAME::AddToScreen(), AnnotateComponents(), SCH_EDITOR_CONTROL::BackAnnotateFootprints(), SCH_EDIT_TOOL::BreakWire(), SCH_BASE_FRAME::CenterScreen(), LIB_VIEW_FRAME::ClickOnCmpList(), LIB_EDIT_FRAME::CommonSettingsChanged(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CreateSheetPin(), DeleteAnnotation(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EE_SELECTION_TOOL::doSelectionMenu(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::editFieldProperties(), LIB_EDIT_TOOL::editGraphicProperties(), LIB_EDIT_TOOL::editTextProperties(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_EDITOR_CONTROL::FindNext(), SCH_BASE_FRAME::GetRenderSettings(), SCH_BASE_FRAME::HardRedraw(), HardRedraw(), SCH_EDITOR_CONTROL::ImportFPAssignments(), KiwayMailIn(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), DIALOG_MIGRATE_BUSES::onAcceptClicked(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_ANNOTATE::OnApplyClick(), LIB_VIEW_FRAME::OnCloseWindow(), DIALOG_ERC::OnEraseDrcMarkersClick(), DIALOG_MIGRATE_BUSES::onItemSelected(), OnModify(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_EDIT_TOOL::Properties(), PutDataInPreviousState(), LIB_EDIT_FRAME::RebuildView(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_EDIT_FRAME::ReCreateMenuBar(), ReCreateMenuBar(), SCH_EDITOR_CONTROL::Redo(), DIALOG_ERC::RedrawDrawPanel(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RefreshSelection(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), SCH_EDITOR_CONTROL::RemapSymbols(), SCH_BASE_FRAME::RemoveFromScreen(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::rescueProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), RollbackSchematicFromUndo(), SetCurrentSheet(), EE_POINT_EDITOR::setEditedPoint(), SetScreen(), LIB_VIEW_FRAME::SetSelectedLibrary(), LIB_VIEW_FRAME::setupTools(), LIB_EDIT_FRAME::setupTools(), setupTools(), LIB_CONTROL::ShowElectricalTypes(), ShowSchematicSetupDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_EDIT_FRAME::SwitchCanvas(), SCH_BASE_FRAME::SyncView(), TestDanglingEnds(), DIALOG_ERC::TestErc(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), DIALOG_JUNCTION_PROPS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow(), PANEL_LIBEDIT_COLOR_SETTINGS::TransferDataFromWindow(), DIALOG_EDIT_SHEET_PIN::TransferDataFromWindow(), PANEL_SETUP_FORMATTING::TransferDataFromWindow(), PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow(), DIALOG_UPDATE_FIELDS::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SCH_EDIT_TOOL::UpdateFields(), SCH_EDITOR_CONTROL::UpdateFind(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), LIB_VIEW_FRAME::updatePreviewSymbol(), SCH_BASE_FRAME::UpdateStatusBar(), and LIB_VIEW_FRAME::~LIB_VIEW_FRAME().

◆ GetColorSettings()

COLOR_SETTINGS * SCH_BASE_FRAME::GetColorSettings ( )
overridevirtualinherited

Returns a pointer to the active color theme settings.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 430 of file sch_base_frame.cpp.

431 {
432  if( !m_colorSettings )
433  {
434  EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
435  m_colorSettings = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
436  }
437 
438  return m_colorSettings;
439 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
COLOR_SETTINGS * m_colorSettings
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:156

References EDA_DRAW_FRAME::m_colorSettings, APP_SETTINGS_BASE::m_ColorTheme, and Pgm().

Referenced by SCH_BASE_FRAME::GetLayerColor(), SCH_PRINTOUT::PrintPage(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), and DIALOG_SCH_SHEET_PROPS::TransferDataToWindow().

◆ GetCurrentFileName()

wxString SCH_EDIT_FRAME::GetCurrentFileName ( ) const
overridevirtual

Get the full filename + path of the currently opened file in the frame.

If no file is open, an empty string is returned.

Returns
the filename and full path to the open file

Reimplemented from EDA_BASE_FRAME.

Definition at line 1213 of file sch_edit_frame.cpp.

1214 {
1215  return Schematic().GetFileName();
1216 }
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:132
SCHEMATIC & Schematic() const

References SCHEMATIC::GetFileName(), and Schematic().

◆ GetCurrentSheet()

SCH_SHEET_PATH & SCH_EDIT_FRAME::GetCurrentSheet ( ) const

Definition at line 442 of file sch_edit_frame.cpp.

443 {
444  return m_schematic->CurrentSheet();
445 }
SCHEMATIC * m_schematic
The currently loaded schematic.
SCH_SHEET_PATH & CurrentSheet() const
Definition: schematic.h:122

References SCHEMATIC::CurrentSheet(), and m_schematic.

Referenced by AddItemToScreenAndUndoList(), LIB_CONTROL::AddSymbolToSchematic(), AnnotateComponents(), AppendSchematic(), BACK_ANNOTATE::BackAnnotateSymbols(), CheckAnnotate(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::createPSFile(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), DeleteAnnotation(), DisplayCurrentSheet(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EnterSheet(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_EDITOR_CONTROL::FindNext(), FixupJunctions(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), SCH_LINE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_COMPONENT::GetMsgPanelInfo(), GetScreen(), GetScreenDesc(), GetUniqueFilenameForCurrentSheet(), HardRedraw(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), highlightNet(), importFile(), SCH_DRAWING_TOOLS::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SCH_EDITOR_CONTROL::LeaveSheet(), OnCloseWindow(), DIALOG_ERC::OnERCItemSelected(), DIALOG_MIGRATE_BUSES::onItemSelected(), SCH_PRINTOUT::OnPrintPage(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_EDIT_TOOL::Properties(), ReCreateMenuBar(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), DIALOG_PLOT_SCHEMATIC::restoreEnvironment(), SaveEEFile(), SelectUnit(), SetCurrentSheet(), SetSheetNumberAndCount(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), DIALOG_SCH_SHEET_PROPS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), BUS_UNFOLD_MENU::update(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), HIERARCHY_NAVIG_DLG::UpdateHierarchyTree(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and UpdateTitle().

◆ GetDefaults()

SCHEMATIC_SETTINGS& SCH_BASE_FRAME::GetDefaults ( )
inlineinherited

Definition at line 123 of file sch_base_frame.h.

124  {
125  return *m_defaults;
126  }
SCHEMATIC_SETTINGS * m_defaults

References SCH_BASE_FRAME::m_defaults.

◆ GetDocumentExtents()

const BOX2I SCH_EDIT_FRAME::GetDocumentExtents ( ) const
overridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1082 of file sch_edit_frame.cpp.

1083 {
1084  int sizeX = GetScreen()->GetPageSettings().GetWidthIU();
1085  int sizeY = GetScreen()->GetPageSettings().GetHeightIU();
1086 
1087  return BOX2I( VECTOR2I(0, 0), VECTOR2I( sizeX, sizeY ) );
1088 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:521
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:180
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.

References SCH_SCREEN::GetPageSettings(), and GetScreen().

◆ GetDoImmediateActions()

bool TOOLS_HOLDER::GetDoImmediateActions ( ) const
inlineinherited

Indicates that hotkeys should perform an immediate action even if another tool is currently active.

If false, the first hotkey should select the relevant tool.

Definition at line 95 of file tools_holder.h.

95 { return m_immediateActions; }
bool m_immediateActions
Definition: tools_holder.h:59

References TOOLS_HOLDER::m_immediateActions.

◆ GetDragSelects()

bool TOOLS_HOLDER::GetDragSelects ( ) const
inlineinherited

Indicates that a drag should draw a selection rectangle, even when started over an item.

Definition at line 101 of file tools_holder.h.

101 { return m_dragSelects; }
bool m_dragSelects
Definition: tools_holder.h:63

References TOOLS_HOLDER::m_dragSelects.

Referenced by EE_SELECTION_TOOL::Main().

◆ GetDrawBgColor()

◆ GetFileFromHistory()

wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
FILE_HISTORY aFileHistory = nullptr 
)
inherited

Fetches the file name from the file history list.

This removes the selected file, if this file does not exist. The menu is also updated, if FILE_HISTORY::UseMenu was called at init time

Parameters
cmdIdThe command ID associated with the aFileHistory object.
typePlease document me!
aFileHistoryThe FILE_HISTORY in use. If null, the main application file history is used
Returns
a wxString containing the selected filename

Definition at line 600 of file eda_base_frame.cpp.

602 {
603  if( !aFileHistory )
604  aFileHistory = m_fileHistory;
605 
606  wxASSERT( aFileHistory );
607 
608  int baseId = aFileHistory->GetBaseId();
609 
610  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
611 
612  unsigned i = cmdId - baseId;
613 
614  if( i < aFileHistory->GetCount() )
615  {
616  wxString fn = aFileHistory->GetHistoryFile( i );
617 
618  if( wxFileName::FileExists( fn ) )
619  return fn;
620  else
621  {
622  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
623  wxMessageBox( msg );
624 
625  aFileHistory->RemoveFileFromHistory( i );
626  }
627  }
628 
629  // Update the menubar to update the file history menu
630  if( GetMenuBar() )
631  {
632  ReCreateMenuBar();
633  GetMenuBar()->Refresh();
634  }
635 
636  return wxEmptyString;
637 }
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
#define _(s)
Definition: 3d_actions.cpp:33
FILE_HISTORY * m_fileHistory
virtual void ReCreateMenuBar()
Recreates the menu bar.

References _, Format(), EDA_BASE_FRAME::m_fileHistory, and EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), OnLoadFile(), and GERBVIEW_FRAME::OnZipFileHistory().

◆ GetFileHistory()

FILE_HISTORY& EDA_BASE_FRAME::GetFileHistory ( )
inlineinherited

◆ GetFindHistoryList()

wxArrayString& EDA_DRAW_FRAME::GetFindHistoryList ( )
inlineinherited

Definition at line 169 of file eda_draw_frame.h.

169 { return m_findStringHistoryList; }
wxArrayString m_findStringHistoryList

References EDA_DRAW_FRAME::m_findStringHistoryList.

Referenced by DIALOG_FIND::DIALOG_FIND(), and DIALOG_FIND::search().

◆ GetFindReplaceData()

wxFindReplaceData * SCH_EDIT_FRAME::GetFindReplaceData ( )

Get the find criteria (as set by the dialog).

Definition at line 638 of file sch_edit_frame.cpp.

639 {
640  if( m_findReplaceDialog && m_findReplaceDialog->IsVisible()
641  && !m_findReplaceData->GetFindString().IsEmpty() )
642  {
643  return m_findReplaceData;
644  }
645 
646  return nullptr;
647 }
DIALOG_SCH_FIND * m_findReplaceDialog
wxFindReplaceData * m_findReplaceData

References EDA_DRAW_FRAME::m_findReplaceData, and m_findReplaceDialog.

Referenced by SCH_EDITOR_CONTROL::FindNext(), SCH_EDITOR_CONTROL::HasMatch(), SCH_EDITOR_CONTROL::ReplaceAll(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ GetFlattenedLibPart()

LIB_PART* SCH_BASE_FRAME::GetFlattenedLibPart ( const LIB_ID aLibId,
bool  aShowErrorMsg = false 
)
inherited

◆ GetGalDisplayOptions()

◆ GetGridColor()

virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

◆ GetGridOrigin()

const wxPoint& SCH_BASE_FRAME::GetGridOrigin ( ) const
inlineoverridevirtualinherited

Return the absolute coordinates of the origin of the snap grid.

This is treated as a relative offset, and snapping will occur at multiples of the grid size relative to this point.

Implements EDA_DRAW_FRAME.

Definition at line 137 of file sch_base_frame.h.

138  {
139  static wxPoint zero;
140  return zero;
141  }

◆ GetHighlightedConnection()

const SCH_CONNECTION* SCH_EDIT_FRAME::GetHighlightedConnection ( ) const
inline

Definition at line 369 of file sch_edit_frame.h.

370  {
371  return m_highlightedConn;
372  }
const SCH_CONNECTION * m_highlightedConn
The highlighted net or bus, or nullptr.

References m_highlightedConn.

Referenced by SCH_EDITOR_CONTROL::AssignNetclass(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ GetInfoBar()

WX_INFOBAR* EDA_BASE_FRAME::GetInfoBar ( )
inlineinherited

Definition at line 277 of file eda_base_frame.h.

277 { return m_infoBar; }
WX_INFOBAR * m_infoBar

References EDA_BASE_FRAME::m_infoBar.

Referenced by PAD_TOOL::EditPad(), and SCH_EDIT_TOOL::RefreshSymbolFromLibrary().

◆ GetItem()

EDA_ITEM * SCH_EDIT_FRAME::GetItem ( const KIID aId)
overridevirtual

Fetch an item by KIID.

Frame-type-specific implementation.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 361 of file sch_edit_frame.cpp.

362 {
363  return Schematic().GetSheets().GetItem( aId );
364 }
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr)
Fetch a SCH_ITEM by ID.
SCHEMATIC & Schematic() const

References SCH_SHEET_LIST::GetItem(), SCHEMATIC::GetSheets(), and Schematic().

◆ GetLayerColor()

COLOR4D SCH_BASE_FRAME::GetLayerColor ( SCH_LAYER_ID  aLayer)
inherited

Helper to retrieve a layer color from the global color settings.

Definition at line 415 of file sch_base_frame.cpp.

416 {
417  return GetColorSettings()->GetColor( aLayer );
418 }
COLOR_SETTINGS * GetColorSettings() override
Returns a pointer to the active color theme settings.
COLOR4D GetColor(int aLayer) const

References COLOR_SETTINGS::GetColor(), and SCH_BASE_FRAME::GetColorSettings().

◆ GetLibPart()

LIB_PART * SCH_BASE_FRAME::GetLibPart ( const LIB_ID aLibId,
bool  aUseCacheLib = false,
bool  aShowErrorMsg = false 
)
inherited

Load symbol from symbol library table.

Parameters
aLibIdis the symbol library identifier to load.
aUseCacheLibset to true to fall back to cache library if symbol is not found in symbol library table.
aShowErrorMessageset to true to show any error messages.
Returns
The symbol found in the library or NULL if the symbol was not found.

Definition at line 212 of file sch_base_frame.cpp.

213 {
214  PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
215 
216  return SchGetLibPart( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
217 }
static S3D_CACHE * cache
Definition: export_vrml.cpp:65
#define NULL
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
LIB_PART * SchGetLibPart(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, PART_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
Object used to load, save, search, and otherwise manipulate symbol library files.

References cache, NULL, KIWAY_HOLDER::Prj(), and SchGetLibPart().

Referenced by CreateArchiveLibrary(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_BASE_FRAME::SelectCompFromLibTree(), SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_UPDATE_FIELDS::updateFields().

◆ GetMoveWarpsCursor()

bool TOOLS_HOLDER::GetMoveWarpsCursor ( ) const
inlineinherited

Indicates that a move operation should warp the mouse pointer to the origin of the move object.

This improves snapping, but some users are alergic to mouse warping.

Definition at line 107 of file tools_holder.h.

107 { return m_moveWarpsCursor; }
bool m_moveWarpsCursor
Definition: tools_holder.h:64

References TOOLS_HOLDER::m_moveWarpsCursor.

Referenced by LIB_MOVE_TOOL::Main(), and SCH_MOVE_TOOL::Main().

◆ GetMruPath()

◆ GetNearestGridPosition()

wxPoint EDA_DRAW_FRAME::GetNearestGridPosition ( const wxPoint aPosition) const
inherited

Return the nearest aGridSize location to aPosition.

Parameters
aPositionThe position to check.
Returns
The nearst grid position.

Definition at line 727 of file eda_draw_frame.cpp.

728 {
729  const wxPoint& gridOrigin = GetGridOrigin();
730  VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
731 
732  double xOffset = fmod( gridOrigin.x, gridSize.x );
733  int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
734  double yOffset = fmod( gridOrigin.y, gridSize.y );
735  int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
736 
737  return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
738 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
const VECTOR2D & GetGridSize() const
Returns the grid size.
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:68

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), EDA_DRAW_FRAME::GetGridOrigin(), KIGFX::GAL::GetGridSize(), KiROUND(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), and SCH_DRAWING_TOOLS::sizeSheet().

◆ GetNetListerCommand()

wxString SCH_EDIT_FRAME::GetNetListerCommand ( ) const
inline

Definition at line 914 of file sch_edit_frame.h.

914 { return m_netListerCommand; }
wxString m_netListerCommand
Command line to call a custom net list generator.

References m_netListerCommand.

◆ GetPageSettings()

const PAGE_INFO & SCH_BASE_FRAME::GetPageSettings ( ) const
overridevirtualinherited

Implements EDA_DRAW_FRAME.

Definition at line 123 of file sch_base_frame.cpp.

124 {
125  return GetScreen()->GetPageSettings();
126 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:180

References SCH_SCREEN::GetPageSettings(), and SCH_BASE_FRAME::GetScreen().

Referenced by DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF().

◆ GetPageSetupData()

◆ GetPageSizeIU()

const wxSize SCH_BASE_FRAME::GetPageSizeIU ( ) const
overridevirtualinherited

Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view.

Implements EDA_DRAW_FRAME.

Definition at line 129 of file sch_base_frame.cpp.

130 {
131  // GetSizeIU is compile time dependent:
132  return GetScreen()->GetPageSettings().GetSizeIU();
133 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:180

References SCH_SCREEN::GetPageSettings(), and SCH_BASE_FRAME::GetScreen().

Referenced by DrawCurrentSheetToClipboard().

◆ GetRenderSettings()

KIGFX::SCH_RENDER_SETTINGS * SCH_BASE_FRAME::GetRenderSettings ( )
inherited

Definition at line 294 of file sch_base_frame.cpp.

295 {
296  KIGFX::PAINTER* painter = GetCanvas()->GetView()->GetPainter();
297  return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->GetSettings() );
298 }
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
PAINTER contains all the knowledge about how to draw graphical object onto any particular output devi...
Definition: painter.h:58
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.

References SCH_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), and SCH_DRAW_PANEL::GetView().

Referenced by DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DrawCurrentSheetToClipboard(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), LoadProjectSettings(), LIB_VIEW_FRAME::LoadSettings(), LoadSettings(), LIB_EDIT_FRAME::LoadSettings(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), DIALOG_PLOT_SCHEMATIC::PlotSchematic(), SCH_PRINTOUT::PrintPage(), LIB_EDIT_FRAME::RebuildView(), LIB_VIEW_FRAME::ReCreateMenuBar(), LIB_VIEW_FRAME::SaveSettings(), LIB_EDIT_FRAME::SaveSettings(), LIB_CONTROL::ShowElectricalTypes(), LIB_EDIT_FRAME::SVG_PlotComponent(), LIB_EDIT_FRAME::SyncToolbars(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_SETUP_FORMATTING::TransferDataFromWindow(), PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow(), PANEL_LIBEDIT_SETTINGS::TransferDataToWindow(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ GetRepeatItem()

SCH_ITEM* SCH_EDIT_FRAME::GetRepeatItem ( ) const
inline

Return the item which is to be repeated with the insert key.

Such object is owned by this container, and must be cloned.

Definition at line 856 of file sch_edit_frame.h.

856 { return m_item_to_repeat; }
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.

References m_item_to_repeat.

Referenced by SCH_EDIT_TOOL::RepeatDrawItem().

◆ GetSchematicConnections()

void SCH_EDIT_FRAME::GetSchematicConnections ( std::vector< wxPoint > &  aConnections)

Collects a unique list of all possible connection points in the schematic.

Parameters
aConnectionsvector of connections

Definition at line 45 of file bus-wire-junction.cpp.

46 {
47  for( auto item : GetScreen()->Items() )
48  {
49  // Avoid items that are changing
50  if( !( item->GetEditFlags() & ( IS_DRAGGED | IS_MOVED | IS_DELETED ) ) )
51  item->GetConnectionPoints( aConnections );
52  }
53 
54  // We always have some overlapping connection points. Drop duplicates here
55  std::sort( aConnections.begin(), aConnections.end(),
56  []( const wxPoint& a, const wxPoint& b ) -> bool
57  { return a.x < b.x || (a.x == b.x && a.y < b.y); } );
58  aConnections.erase(
59  std::unique( aConnections.begin(), aConnections.end() ), aConnections.end() );
60 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define IS_DELETED
Definition: base_struct.h:120
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References GetScreen(), IS_DELETED, IS_DRAGGED, IS_MOVED, wxPoint::x, and wxPoint::y.

Referenced by SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), and SCH_LINE_WIRE_BUS_TOOL::finishSegments().

◆ GetScreen()

SCH_SCREEN * SCH_EDIT_FRAME::GetScreen ( ) const
overridevirtual

Return a pointer to a BASE_SCREEN or one of its derivatives.

It is overloaded by derived classes to return SCH_SCREEN or PCB_SCREEN.

Reimplemented from SCH_BASE_FRAME.

Definition at line 396 of file sch_edit_frame.cpp.

397 {
398  return GetCurrentSheet().LastScreen();
399 }
SCH_SCREEN * LastScreen()
Function LastScreen.
SCH_SHEET_PATH & GetCurrentSheet() const

References GetCurrentSheet(), and SCH_SHEET_PATH::LastScreen().

Referenced by AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), AppendSchematic(), SCH_EDIT_TOOL::AutoplaceFields(), BreakSegment(), BreakSegments(), BreakSegmentsOnJunctions(), SCH_EDIT_TOOL::BreakWire(), SCH_EDIT_TOOL::CleanupSheetPins(), CreateArchiveLibraryCacheFile(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), CreateScreens(), DeleteAnnotation(), SCH_EDIT_TOOL::DeleteItemCursor(), DeleteJunction(), DisplayCurrentSheet(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DrawCurrentSheetToClipboard(), SCH_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::FindNext(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_MOVE_TOOL::getConnectedDragItems(), GetDocumentExtents(), GetSchematicConnections(), SCH_LINE_WIRE_BUS_TOOL::getSheetPin(), importFile(), SCH_MOVE_TOOL::Main(), SCH_EDIT_TOOL::Mirror(), OnAppendProject(), DIALOG_ERC::OnERCItemSelected(), OnModify(), SCH_PRINTOUT::OnPrintPage(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), PrintPage(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_TOOL::Properties(), RecalculateConnections(), ReCreateMenuBar(), SCH_EDITOR_CONTROL::Redo(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), SCH_EDITOR_CONTROL::rescueProject(), RollbackSchematicFromUndo(), SCH_EDIT_TOOL::Rotate(), Save_File(), SaveCopyInUndoList(), SchematicCleanUp(), SelectUnit(), SetSheetNumberAndCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), SyncToolbars(), TestDanglingEnds(), DIALOG_ERC::TestErc(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PRINT_USING_PRINTER::TransferDataToWindow(), TrimWire(), SCH_EDITOR_CONTROL::Undo(), SCH_EDIT_TOOL::UpdateFields(), SCH_EDITOR_CONTROL::UpdateFind(), and UpdateTitle().

◆ GetScreenDesc()

wxString SCH_EDIT_FRAME::GetScreenDesc ( ) const
overridevirtual

Return a human-readable description of the current screen.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 408 of file sch_edit_frame.cpp.

409 {
410  wxString s = GetCurrentSheet().PathHumanReadable();
411 
412  return s;
413 }
SCH_SHEET_PATH & GetCurrentSheet() const
wxString PathHumanReadable() const
Function PathHumanReadable returns the sheet path in a human readable form, i.e.

References GetCurrentSheet(), and SCH_SHEET_PATH::PathHumanReadable().

Referenced by DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG().

◆ GetSettingsManager()

◆ GetSeverity()

virtual int EDA_BASE_FRAME::GetSeverity ( int  aErrorCode) const
inlinevirtualinherited

Reimplemented in PCB_BASE_FRAME.

Definition at line 225 of file eda_base_frame.h.

References RPT_SEVERITY_UNDEFINED.

Referenced by RC_TREE_MODEL::GetValue().

◆ GetShowAllPins()

bool SCH_EDIT_FRAME::GetShowAllPins ( ) const
overridevirtual

Allow edit frame to show/hide hidden pins.

Reimplemented from SCH_BASE_FRAME.

Definition at line 1146 of file sch_edit_frame.cpp.

1147 {
1148  EESCHEMA_SETTINGS* cfg = eeconfig();
1149  return cfg->m_Appearance.show_hidden_pins;
1150 }
EESCHEMA_SETTINGS * eeconfig() const

References SCH_BASE_FRAME::eeconfig(), EESCHEMA_SETTINGS::m_Appearance, and EESCHEMA_SETTINGS::APPEARANCE::show_hidden_pins.

Referenced by ReCreateMenuBar(), SyncToolbars(), and SCH_EDITOR_CONTROL::ToggleHiddenPins().

◆ GetShowPolarCoords()

◆ GetTemplateFieldName()

const TEMPLATE_FIELDNAME* SCH_BASE_FRAME::GetTemplateFieldName ( const wxString &  aName)
inlineinherited

Search for aName in the the template field name list.

Parameters
aNameA wxString object containing the field name to search for.
Returns
the template fieldname if found; NULL otherwise.

Definition at line 205 of file sch_base_frame.h.

206  {
207  return m_templateFieldNames.GetFieldName( aName );
208  }
TEMPLATES m_templateFieldNames
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Function GetFieldName searches for aName in the the template field name list.

References TEMPLATES::GetFieldName(), and SCH_BASE_FRAME::m_templateFieldNames.

◆ GetTemplateFieldNames() [1/2]

const TEMPLATE_FIELDNAMES& SCH_BASE_FRAME::GetTemplateFieldNames ( )
inlineinherited

Return a template field names list for read only access.

Definition at line 186 of file sch_base_frame.h.

187  {
189  }
TEMPLATES m_templateFieldNames
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Function GetTemplateFieldName returns a template fieldnames list for read only access.

References TEMPLATES::GetTemplateFieldNames(), and SCH_BASE_FRAME::m_templateFieldNames.

Referenced by DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToWindow(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

◆ GetTemplateFieldNames() [2/2]

const TEMPLATE_FIELDNAMES& SCH_BASE_FRAME::GetTemplateFieldNames ( bool  aGlobal)
inlineinherited

Return a specific template field names list (global or project) for read only access.

Definition at line 194 of file sch_base_frame.h.

195  {
197  }
TEMPLATES m_templateFieldNames
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Function GetTemplateFieldName returns a template fieldnames list for read only access.

References TEMPLATES::GetTemplateFieldNames(), and SCH_BASE_FRAME::m_templateFieldNames.

◆ GetTitleBlock()

const TITLE_BLOCK & SCH_BASE_FRAME::GetTitleBlock ( ) const
overridevirtualinherited

Implements EDA_DRAW_FRAME.

Definition at line 136 of file sch_base_frame.cpp.

137 {
138  wxASSERT( GetScreen() );
139  return GetScreen()->GetTitleBlock();
140 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:190

References SCH_BASE_FRAME::GetScreen(), and SCH_SCREEN::GetTitleBlock().

Referenced by DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG().

◆ GetToolCanvas()

wxWindow* EDA_DRAW_FRAME::GetToolCanvas ( ) const
inlineoverridevirtualinherited

Canvas access.

Implements TOOLS_HOLDER.

Definition at line 456 of file eda_draw_frame.h.

456 { return GetCanvas(); }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.

References EDA_DRAW_FRAME::GetCanvas().

◆ GetToolManager()