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  UNDO_REDO_LIST { UNDO_LIST, REDO_LIST }
 Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if needed. More...
 
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...
 
SELECTIONGetCurrentSelection () override
 Get the current selection from the canvas area. More...
 
SCHEMATICSchematic () const
 
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 LoadSettings (APP_SETTINGS_BASE *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (APP_SETTINGS_BASE *aCfg) override
 Save 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...
 
void setupUIConditions () override
 Setup the UI conditions for the various actions and their controls in this frame. 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...
 
void RecordERCExclusions ()
 Scan existing markers and record data from any that are Excluded. More...
 
void ResolveERCExclusions ()
 Update markers to match recorded exclusions. 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
 Receive KIWAY_EXPRESS messages from other players. More...
 
void AddItemToScreenAndUndoList (SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
 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...
 
void 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)
 
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, bool *appendUndo)
 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
 Open 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 (SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, 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...
 
std::vector< wxPoint > GetSchematicConnections ()
 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...
 
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_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, 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 aTypeCommand, bool aAppend, 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 ClearUndoORRedoList (UNDO_REDO_LIST whichList, int aItemCount=-1) override
 Free the undo or redo list from aList element. 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 (const 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, bool aTextVarsChanged) override
 Called after the preferences dialog is run. More...
 
void UpdateNetHighlightStatus ()
 
void ShowChangedLanguage () override
 Redraw the menus and what not in current language. More...
 
void SetScreen (BASE_SCREEN *aScreen) override
 
const BOX2I GetDocumentExtents (bool aIncludeAllVisible=true) const override
 Returns bbox of document with option to not include some items. More...
 
void FixupJunctions ()
 
void FocusOnItem (SCH_ITEM *aItem)
 
void UpdateSymbolFromEditor (const LIB_PART &aSymbol)
 Update the LIB_PART of the currently selected symbol. More...
 
void RecomputeIntersheetRefs ()
 Update the schematic's page reference map for all global labels, and refresh the labels so that they are redrawn with up-to-date references. More...
 
void ShowAllIntersheetRefs (bool aShow)
 
void createCanvas ()
 
SCH_DRAW_PANELGetCanvas () const override
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
EESCHEMA_SETTINGSeeconfig () const
 
SYMBOL_EDITOR_SETTINGSlibeditconfig () const
 
KIGFX::SCH_RENDER_SETTINGSGetRenderSettings ()
 
SCHEMATIC_SETTINGSGetDefaults ()
 
COLOR4D GetDrawBgColor () const override
 
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 wxPoint & GetGridOrigin () 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...
 
PICKED_SYMBOL PickSymbolFromLibTree (const SCHLIB_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function PickSymbolFromLibTree Calls the library viewer to select component to import into schematic. 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)
 
PICKED_SYMBOL PickSymbolFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibId, int aUnit, int aConvert)
 Function PickSymbolFromLibBrowser 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)
 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)
 Remove an item from the screen (and view) aScreen is the screen the item is located on, if not the current screen. More...
 
void UpdateItem (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 () const 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
 
void GetUnitPair (EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
 Get the pair or units in current use. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition) const
 Return the nearest aGridSize location to aPosition. More...
 
virtual ORIGIN_TRANSFORMSGetOriginTransforms ()
 Return a reference to the default ORIGIN_TRANSFORMS object. More...
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
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. More...
 
void AddStandardSubMenus (TOOL_MENU &aMenu)
 Construct a "basic" menu for a tool, containing only items that apply to all tools (e.g. More...
 
void PrintWorkSheet (const RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, double aMils2Iu, 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 &aTextUpper, const wxString &aTextLower, int aPadding=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)
 
void SetMsgPanel (const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
 Helper function that erases the msg panel and then appends a single message. More...
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. 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 check tools. More...
 
virtual void ParseArgs (wxCmdLineParser &aParser)
 Handle command-line arguments in a frame-specific way. More...
 
virtual bool ShowModal (wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
 Show 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 override
 Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame. More...
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 
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 SEVERITY 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...
 
virtual void RegisterUIUpdateHandler (int aID, const ACTION_CONDITIONS &aConditions) override
 Register a UI update handler for the control with ID aID. More...
 
virtual void RegisterUIUpdateHandler (const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
 Register an action's update conditions with the UI layer to allow the UI to appropriately display the state of its controls. More...
 
virtual void UnregisterUIUpdateHandler (int aID) override
 Unregister a UI handler for a given ID that was registered using RegisterUIUpdateHandler. More...
 
virtual void UnregisterUIUpdateHandler (const TOOL_ACTION &aAction)
 Unregister a UI handler for an action that was registered using RegisterUIUpdateHandler. 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)
 
void CreateInfoBar ()
 
void FinishAUIInitialization ()
 
WX_INFOBARGetInfoBar ()
 
void ShowInfoBarError (const wxString &aErrorMsg, bool aShowCloseButton=false)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left of the infobar, and an optional closebox to the right. More...
 
void ShowInfoBarError (const wxString &aErrorMsg, bool aShowCloseButton, std::function< void(void)> aCallback)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left of the infobar, and an optional closebox to the right. More...
 
void ShowInfoBarWarning (const wxString &aWarningMsg, bool aShowCloseButton=false)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and a warning icon on the left of the infobar. More...
 
void ShowInfoBarMsg (const wxString &aMsg, bool aShowCloseButton=false)
 Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of the infobar. More...
 
virtual APP_SETTINGS_BASEconfig () const
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
void LoadWindowState (const wxString &aFileName)
 
virtual void LoadWindowState (const WINDOW_STATE &aState)
 Load frame state info from a configuration file. More...
 
void LoadWindowSettings (const WINDOW_SETTINGS *aCfg)
 Load window settings from the given settings object. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Save window settings to the given settings object. More...
 
virtual WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg)
 Return a pointer to the window settings for this frame. More...
 
wxString ConfigBaseName () override
 Get the configuration base name. More...
 
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...
 
virtual void ProjectChanged ()
 Notification event that the project has changed. More...
 
const wxString & GetAboutTitle () const
 
wxSize GetWindowSize ()
 Get the undecorated window size that can be used for restoring the window size. More...
 
virtual void ClearUndoRedoList ()
 Clear the undo and redo list using ClearUndoORRedoList() More...
 
virtual void PushCommandToUndoList (PICKED_ITEMS_LIST *aItem)
 Add a command to undo in the undo list. More...
 
virtual void PushCommandToRedoList (PICKED_ITEMS_LIST *aItem)
 Add a command to redo in the redo list. More...
 
virtual PICKED_ITEMS_LISTPopCommandFromUndoList ()
 Return the last command to undo and remove it from list, nothing is deleted. More...
 
virtual PICKED_ITEMS_LISTPopCommandFromRedoList ()
 Return the last command to undo and remove it from list, nothing is deleted. More...
 
virtual int GetUndoCommandCount () const
 
virtual int GetRedoCommandCount () const
 
int GetMaxUndoItems () const
 
bool NonUserClose (bool aForce)
 
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
 Indicate that hotkeys should perform an immediate action even if another tool is currently active. More...
 
MOUSE_DRAG_ACTION GetDragAction () const
 Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects. More...
 
bool GetMoveWarpsCursor () const
 Indicate that a move operation should warp the mouse pointer to the origin of the move object. More...
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

static void HandleUpdateUIEvent (wxUpdateUIEvent &aEvent, EDA_BASE_FRAME *aFrame, ACTION_CONDITIONS aCond)
 Handle events generated when the UI is trying to figure out the current state of the UI controls related to TOOL_ACTIONS (e.g. 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...
 
void onSize (wxSizeEvent &aEvent)
 
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 setupUnits (APP_SETTINGS_BASE *aCfg)
 
void resolveCanvasType ()
 Determines the Canvas type to load (with prompt if required) and initializes m_canvasType. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
void initExitKey ()
 Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id. More...
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 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

SCHEMATIC_SETTINGS m_base_frame_defaults
 These are only used by symbol_editor. 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
 
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
 The current canvas type. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 < Points to nested event_loop. NULL means not modal and dismissed. More...
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_ident
 
wxPoint m_framePos
 
wxSize m_frameSize
 
bool m_maximizeByDefault
 
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
 
UNDO_REDO_CONTAINER m_undoList
 
UNDO_REDO_CONTAINER m_redoList
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 Map containing the UI update handlers registered with wx for each action. More...
 
std::map< int, UIUpdateHandlerm_uiUpdateMap
 Set by the close window event handler after frames are asked if they can close. More...
 
bool m_isClosing
 Set by NonUserClose() to indicate that the user did not request the current close. More...
 
bool m_isNonUserClose
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
SELECTION m_dummySelection
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
MOUSE_DRAG_ACTION m_dragAction
 
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)
 
bool canCloseWindow (wxCloseEvent &aCloseEvent) override
 
void doCloseWindow () override
 
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
 

Friends

class SCH_EDITOR_CONTROL
 

Detailed Description

Schematic editor (Eeschema) main window.

Definition at line 117 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.

◆ UNDO_REDO_LIST

Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if needed.

Because picked items must be deleted only if they are not in use, this is a virtual pure function that must be created for SCH_SCREEN and PCB_SCREEN. Commands are deleted from the older to the last.

Parameters
aList= the UNDO_REDO_CONTAINER of commands.
aItemCountnumber of old commands to delete. -1 to remove all old commands this will empty the list of commands.
Enumerator
UNDO_LIST 
REDO_LIST 

Definition at line 519 of file eda_base_frame.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" ), wxDefaultPosition,
211  m_highlightedConn( nullptr ),
212  m_item_to_repeat( nullptr )
213 {
214  m_maximizeByDefault = true;
215  m_schematic = new SCHEMATIC( nullptr );
216 
217  m_showBorderAndTitleBlock = true; // true to show sheet references
218  m_hasAutoSave = true;
219  m_aboutTitle = "Eeschema";
220 
221  m_findReplaceDialog = nullptr;
222 
223  // Give an icon
224  wxIcon icon;
225  wxIconBundle icon_bundle;
226 
227  icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
228  icon_bundle.AddIcon( icon );
229  icon.CopyFromBitmap( KiBitmap( icon_eeschema_32_xpm ) );
230  icon_bundle.AddIcon( icon );
231  icon.CopyFromBitmap( KiBitmap( icon_eeschema_16_xpm ) );
232  icon_bundle.AddIcon( icon );
233 
234  SetIcons( icon_bundle );
235 
236  LoadSettings( eeconfig() );
237 
238  // Also links the schematic to the loaded project
239  CreateScreens();
240 
241  // After schematic has been linked to project, SCHEMATIC_SETTINGS works
244 
245  setupTools();
247  ReCreateMenuBar();
251 
252  // Initialize common print setup dialog settings.
253  m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
254  m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
255  m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
256  m_pageSetupData.GetPrintData().SetNoCopies( 1 );
257 
258  m_auimgr.SetManagedWindow( this );
259 
260  CreateInfoBar();
261  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
262  .Top().Layer( 6 ) );
263  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
264  .Left().Layer( 3 ) );
265  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
266  .Right().Layer( 2 ) );
267  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
268  .Center() );
269  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
270  .Bottom().Layer( 6 ) );
271 
273 
276 
278 
279  // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
280  // to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
281  Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
282 
283  if( GetCanvas() )
284  {
285  GetCanvas()->GetGAL()->SetAxesEnabled( false );
286 
287  if( auto p = dynamic_cast<KIGFX::SCH_PAINTER*>( GetCanvas()->GetView()->GetPainter() ) )
288  p->SetSchematic( m_schematic );
289  }
290 
291  initExitKey();
292  setupUnits( eeconfig() );
293 
294  // Net list generator
296 
297  UpdateTitle();
298 
299  // Default shutdown reason until a file is loaded
300  KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
301 
302  // Ensure the window is on top
303  Raise();
304 }
void onSize(wxSizeEvent &aEvent)
const BITMAP_OPAQUE icon_eeschema_32_xpm[1]
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)
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:44
const BITMAP_OPAQUE icon_eeschema_16_xpm[1]
void initExitKey()
Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id.
ACTION_TOOLBAR * m_optionsToolBar
void ReCreateMenuBar() override
Recreates the menu bar.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
void UpdateTitle()
Set the main window title bar text.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void resolveCanvasType()
Determines the Canvas type to load (with prompt if required) and initializes m_canvasType.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_mainToolBar
EESCHEMA_SETTINGS * eeconfig() const
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:51
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
const BITMAP_OPAQUE icon_eeschema_xpm[1]
void ReCreateHToolbar() override
#define SCH_EDIT_FRAME_NAME
wxPageSetupDialogData m_pageSetupData
void FinishAUIInitialization()
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
Return 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 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.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
#define _(s)
Definition: 3d_actions.cpp:33
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void setupUnits(APP_SETTINGS_BASE *aCfg)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
wxString m_aboutTitle
void ReCreateVToolbar() override
ACTION_TOOLBAR * m_drawToolBar

References _, PCAD2KICAD::Center, KIGFX::eeconfig(), icon_eeschema_16_xpm, icon_eeschema_32_xpm, icon_eeschema_xpm, KiBitmap(), PCAD2KICAD::Left, onSize(), PCAD2KICAD::Right, KIPLATFORM::APP::SetShutdownBlockReason(), and ACTIONS::zoomFitScreen.

◆ ~SCH_EDIT_FRAME()

SCH_EDIT_FRAME::~SCH_EDIT_FRAME ( )
override

Definition at line 307 of file sch_edit_frame.cpp.

308 {
309  // Shutdown all running tools
310  if( m_toolManager )
311  {
313  delete m_toolManager;
314  m_toolManager = nullptr;
315  }
316 
317  delete m_item_to_repeat; // we own the cloned object, see this->SaveCopyForRepeatItem()
318 
319  SetScreen( NULL );
320 
321  delete m_schematic;
322  m_schematic = nullptr;
323 
324  // Close the project if we are standalone, so it gets cleaned up properly
325  if( Kiface().IsSingle() )
327 }
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.
SETTINGS_MANAGER * GetSettingsManager() const
void SetScreen(BASE_SCREEN *aScreen) override
#define NULL
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.

References EDA_BASE_FRAME::GetSettingsManager(), Kiface(), m_item_to_repeat, m_schematic, TOOLS_HOLDER::m_toolManager, NULL, KIWAY_HOLDER::Prj(), SetScreen(), TOOL_MANAGER::ShutdownAllTools(), and SETTINGS_MANAGER::UnloadProject().

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 652 of file eda_draw_frame.cpp.

653 {
654  GetCanvas()->SetEvtHandlerEnabled( true );
655  GetCanvas()->StartDrawing();
656 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void StartDrawing()
Begin 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_SCREEN aScreen,
SCH_ITEM aItem,
bool  aUndoAppend 
)

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 1134 of file sch_edit_frame.cpp.

1136 {
1137  wxCHECK_RET( aItem != NULL, wxT( "Cannot add null item to list." ) );
1138 
1139  SCH_SHEET* parentSheet = nullptr;
1140  SCH_COMPONENT* parentSymbol = nullptr;
1141  SCH_ITEM* undoItem = aItem;
1142 
1143  if( aItem->Type() == SCH_SHEET_PIN_T )
1144  {
1145  parentSheet = (SCH_SHEET*) aItem->GetParent();
1146 
1147  wxCHECK_RET( parentSheet && parentSheet->Type() == SCH_SHEET_T,
1148  wxT( "Cannot place sheet pin in invalid schematic sheet." ) );
1149 
1150  undoItem = parentSheet;
1151  }
1152 
1153  else if( aItem->Type() == SCH_FIELD_T )
1154  {
1155  parentSymbol = (SCH_COMPONENT*) aItem->GetParent();
1156 
1157  wxCHECK_RET( parentSymbol && parentSymbol->Type() == SCH_COMPONENT_T,
1158  wxT( "Cannot place field in invalid schematic symbol." ) );
1159 
1160  undoItem = parentSymbol;
1161  }
1162 
1163  if( aItem->IsNew() )
1164  {
1165  if( aItem->Type() == SCH_SHEET_PIN_T )
1166  {
1167  // Sheet pins are owned by their parent sheet.
1168  SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::CHANGED, aUndoAppend );
1169 
1170  parentSheet->AddPin( (SCH_SHEET_PIN*) aItem );
1171  }
1172  else if( aItem->Type() == SCH_FIELD_T )
1173  {
1174  // Symbol fields are also owned by their parent, but new symbol fields are
1175  // handled elsewhere.
1176  wxLogMessage( wxT( "addCurrentItemToScreen: unexpected new SCH_FIELD" ) );
1177  }
1178  else
1179  {
1180  if( !aScreen->CheckIfOnDrawList( aItem ) ) // don't want a loop!
1181  AddToScreen( aItem, aScreen );
1182 
1183  SaveCopyForRepeatItem( aItem );
1184  SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::NEWITEM, aUndoAppend );
1185  }
1186 
1187  // Update connectivity info for new item
1188  if( !aItem->IsMoving() )
1189  {
1191 
1192  if( SCH_TEXT* textItem = dynamic_cast<SCH_TEXT*>( aItem ) )
1193  inheritNetclass( GetCurrentSheet(), textItem );
1194  }
1195  }
1196 
1197  aItem->ClearFlags( IS_NEW );
1198 
1199  aScreen->SetModify();
1200  UpdateItem( aItem );
1201 
1202  if( !aItem->IsMoving() && aItem->IsConnectable() )
1203  {
1204  std::vector< wxPoint > pts = aItem->GetConnectionPoints();
1205 
1206  for( auto i = pts.begin(); i != pts.end(); i++ )
1207  {
1208  for( auto j = i + 1; j != pts.end(); j++ )
1209  TrimWire( *i, *j );
1210 
1211  if( aScreen->IsJunctionNeeded( *i, true ) )
1212  AddJunction( aScreen, *i, true, false );
1213  }
1214 
1215  TestDanglingEnds();
1216 
1217  for( SCH_ITEM* item : aItem->ConnectedItems( GetCurrentSheet() ) )
1218  UpdateItem( item );
1219  }
1220 
1221  aItem->ClearEditFlags();
1222  GetCanvas()->Refresh();
1223 }
virtual bool IsConnectable() const
Definition: sch_item.h:383
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
virtual std::vector< wxPoint > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:397
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
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:371
bool IsMoving() const
Definition: eda_item.h:168
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
Definition: sch_sheet.cpp:283
bool IsNew() const
Definition: eda_item.h:167
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
#define NULL
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
static void inheritNetclass(const SCH_SHEET_PATH &aSheetPath, SCH_TEXT *aItem)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, 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.
EDA_ITEM * GetParent() const
Definition: eda_item.h:163
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:85
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:219
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
SCH_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:164
Schematic symbol object.
Definition: sch_component.h:79
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:202
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:59
void ClearEditFlags()
Definition: eda_item.h:220
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:194
#define IS_NEW
New item, just created.
Definition: eda_item.h:106
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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

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 ( SCH_SCREEN aScreen,
const wxPoint &  aPos,
bool  aAppendToUndo,
bool  aFinal = true 
)

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

446 {
447  SCH_JUNCTION* junction = new SCH_JUNCTION( aPos );
448 
449  AddToScreen( junction, aScreen );
450  SaveCopyInUndoList( aScreen, junction, UNDO_REDO::NEWITEM, aUndoAppend );
451  BreakSegments( aPos );
452 
453  if( aFinal )
454  {
456 
458  OnModify();
459 
460  auto view = GetCanvas()->GetView();
461  view->ClearPreview();
462  view->ShowPreview( false );
463  view->ClearHiddenFlags();
464  }
465 
466  return junction;
467 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
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...
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:216
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void ClearPreview()
Definition: view.cpp:1535
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
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)
Put an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:267

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

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

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 388 of file eda_base_frame.cpp.

389 {
390  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
391  ACTION_MENU* helpMenu = new ACTION_MENU( false, commonControl );
392 
393  helpMenu->Add( ACTIONS::help );
394  helpMenu->Add( ACTIONS::gettingStarted );
395  helpMenu->Add( ACTIONS::listHotKeys );
396  helpMenu->Add( ACTIONS::getInvolved );
397  helpMenu->Add( ACTIONS::reportBug );
398 
399  helpMenu->AppendSeparator();
400  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
401 
402  aMenuBar->Append( helpMenu, _( "&Help" ) );
403 }
static TOOL_ACTION listHotKeys
Definition: actions.h:182
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:45
static TOOL_ACTION reportBug
Definition: actions.h:184
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:40
Handle actions that are shared between different applications.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:181
static TOOL_ACTION getInvolved
Definition: actions.h:183
static TOOL_ACTION gettingStarted
Definition: actions.h:180

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(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), SYMBOL_VIEWER_FRAME::ReCreateMenuBar(), SYMBOL_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_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

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

zoom and grid).

Definition at line 437 of file eda_draw_frame.cpp.

438 {
439  COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
440  CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
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)
The default condition function (always returns true).
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
Handles action that are shared between different applications.
Definition: common_tools.h:37
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157

References CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::m_toolManager, and SELECTION_CONDITIONS::ShowAlways().

Referenced by ROUTER_TOOL::Init(), PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), PL_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), and PCB_SELECTION_TOOL::Init().

◆ AddToScreen()

void SCH_BASE_FRAME::AddToScreen ( EDA_ITEM aItem,
SCH_SCREEN aScreen 
)
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 362 of file sch_base_frame.cpp.

363 {
364  auto screen = aScreen;
365 
366  if( aScreen == nullptr )
367  screen = GetScreen();
368 
369  screen->Append( (SCH_ITEM*) aItem );
370 
371  if( screen == GetScreen() )
372  {
373  GetCanvas()->GetView()->Add( aItem );
374  UpdateItem( aItem, true ); // handle any additional parent semantics
375  }
376 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
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.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:327
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194

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

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(), SchematicCleanUp(), and ShowAllIntersheetRefs().

◆ 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 549 of file sheet.cpp.

550 {
551  wxString msg;
552  SCH_SCREENS screens( Schematic().Root() );
553  wxFileName fn = aSchematicFileName;
554 
555  wxCHECK( fn.IsAbsolute(), false );
556 
558  && screens.CanCauseCaseSensitivityIssue( aSchematicFileName ) )
559  {
560  msg.Printf( _( "The file name \"%s\" can cause issues with an existing file name\n"
561  "already defined in the schematic on systems that support case\n"
562  "insensitive file names. This will cause issues if you copy this\n"
563  "project to an operating system that supports case insensitive file\n"
564  "names.\n\nDo you wish to continue?" ),
565  fn.GetName() );
566 
567  wxRichMessageDialog dlg( this, msg, _( "Warning" ),
568  wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION );
569  dlg.ShowCheckBox( _( "Do not show this message again." ) );
570  dlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Create New Sheet" ) ),
571  wxMessageDialog::ButtonLabel( _( "Discard New Sheet" ) ) );
572 
573  if( dlg.ShowModal() == wxID_NO )
574  return false;
575 
577  !dlg.IsCheckBoxChecked();
578  }
579 
580  return true;
581 }
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:528

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_SHEET_PROPERTIES::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 98 of file eeschema/annotate.cpp.

106 {
107  SCH_REFERENCE_LIST references;
108  SCH_SCREENS screens( Schematic().Root() );
109  SCH_SHEET_LIST sheets = Schematic().GetSheets();
110  bool appendUndo = false;
111 
112  // Map of locked components
113  SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
114 
115  // Map of previous annotation for building info messages
116  std::map<wxString, wxString> previousAnnotation;
117 
118  // Test for and replace duplicate time stamps in components and sheets. Duplicate
119  // time stamps can happen with old schematics, schematic conversions, or manual
120  // editing of files.
121  if( aRepairTimestamps )
122  {
123  int count = screens.ReplaceDuplicateTimeStamps();
124 
125  if( count )
126  {
127  wxString msg;
128  msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
129  aReporter.ReportTail( msg, RPT_SEVERITY_WARNING );
130  }
131  }
132 
133  // If units must be locked, collect all the sets that must be annotated together.
134  if( aLockUnits )
135  {
136  if( aAnnotateSchematic )
137  sheets.GetMultiUnitSymbols( lockedComponents );
138  else
139  GetCurrentSheet().GetMultiUnitComponents( lockedComponents );
140  }
141 
142  // Store previous annotations for building info messages
143  mapExistingAnnotation( previousAnnotation );
144 
145  // If it is an annotation for all the components, reset previous annotation.
146  if( aResetAnnotation )
147  DeleteAnnotation( !aAnnotateSchematic, &appendUndo );
148 
149  // Set sheet number and number of sheets.
151 
152  // Build component list
153  if( aAnnotateSchematic )
154  sheets.GetSymbols( references );
155  else
156  GetCurrentSheet().GetSymbols( references );
157 
158  // Break full components reference in name (prefix) and number:
159  // example: IC1 become IC, and 1
160  references.SplitReferences();
161 
162  switch( aSortOption )
163  {
164  default:
165  case SORT_BY_X_POSITION: references.SortByXCoordinate(); break;
166  case SORT_BY_Y_POSITION: references.SortByYCoordinate(); break;
167  }
168 
169  bool useSheetNum = false;
170  int idStep = 100;
171 
172  switch( aAlgoOption )
173  {
174  default:
175  case INCREMENTAL_BY_REF:
176  break;
177 
178  case SHEET_NUMBER_X_100:
179  useSheetNum = true;
180  break;
181 
182  case SHEET_NUMBER_X_1000:
183  useSheetNum = true;
184  idStep = 1000;
185  break;
186  }
187 
188  // Recalculate and update reference numbers in schematic
189  references.Annotate( useSheetNum, idStep, aStartNumber, lockedComponents );
190 
191  for( size_t i = 0; i < references.GetCount(); i++ )
192  {
193  SCH_REFERENCE& ref = references[i];
194  SCH_COMPONENT* symbol = ref.GetSymbol();
195  SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
196 
197  SaveCopyInUndoList( sheet->LastScreen(), symbol, UNDO_REDO::CHANGED, appendUndo );
198  appendUndo = true;
199  ref.Annotate();
200 
201  KIID_PATH full_uuid = sheet->Path();
202  full_uuid.push_back( symbol->m_Uuid );
203 
204  wxString prevRef = previousAnnotation[ full_uuid.AsString() ];
205  wxString newRef = symbol->GetRef( sheet );
206 
207  if( symbol->GetUnitCount() > 1 )
208  newRef << LIB_PART::SubReference( symbol->GetUnitSelection( sheet ) );
209 
210  wxString msg;
211 
212  if( prevRef.Length() )
213  {
214  if( newRef == prevRef )
215  continue;
216 
217  if( symbol->GetUnitCount() > 1 )
218  msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
219  symbol->GetValue( sheet, true ),
220  LIB_PART::SubReference( symbol->GetUnit(), false ),
221  prevRef,
222  newRef );
223  else
224  msg.Printf( _( "Updated %s from %s to %s" ),
225  symbol->GetValue( sheet, true ),
226  prevRef,
227  newRef );
228  }
229  else
230  {
231  if( symbol->GetUnitCount() > 1 )
232  msg.Printf( _( "Annotated %s (unit %s) as %s" ),
233  symbol->GetValue( sheet, true ),
234  LIB_PART::SubReference( symbol->GetUnit(), false ),
235  newRef );
236  else
237  msg.Printf( _( "Annotated %s as %s" ),
238  symbol->GetValue( sheet, true ),
239  newRef );
240  }
241 
242  aReporter.Report( msg, RPT_SEVERITY_ACTION );
243  }
244 
245  // Final control (just in case ... ).
246  if( !CheckAnnotate( aReporter, !aAnnotateSchematic ) )
247  aReporter.ReportTail( _( "Annotation complete." ), RPT_SEVERITY_ACTION );
248 
249  // Update on screen references, that can be modified by previous calculations:
252 
253  SyncView();
254  GetCanvas()->Refresh();
255  OnModify();
256 
257  // Must go after OnModify() so the connectivity graph has been updated
259 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void SortByYCoordinate()
Function SortByYCoordinate sorts the list of references by Y position.
void UpdateNetHighlightStatus()
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:97
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Add a SCH_REFERENCE object to aReferences for each component in the list of sheets.
void GetMultiUnitSymbols(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the li...
const SCH_SHEET_PATH & GetSheetPath() const
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Definition: reporter.h:93
int GetUnitCount() const
Return the number of units per package of the symbol.
Annotate incrementally using the first free reference number.
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
void DeleteAnnotation(bool aCurrentSheetOnly, bool *appendUndo)
Clear the current component annotation.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
void GetMultiUnitComponents(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sh...
SCH_REFERENCE_LIST is used to create a flattened list of symbols because in a complex hierarchy,...
int GetUnit() const
const wxString GetValue(const SCH_SHEET_PATH *sheet, bool aResolve) const
void SortByXCoordinate()
Function SortByXCoordinate sorts the list of references by X position.
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.
void Annotate()
Function Annotate updates the annotation of the symbol according the the current object state.
SCHEMATIC & Schematic() const
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
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.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
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_COMPONENT * GetSymbol() const
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
const KIID m_Uuid
Definition: eda_item.h:523
Annotate by Y position from top to bottom.
unsigned GetCount() const
Annotate using the first free reference number starting at the sheet number * 100.
SCH_SCREEN * LastScreen()
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: kiid.cpp:245
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:79
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
SCH_REFERENCE is used as a helper to define a symbol's reference designator in a schematic.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Adds SCH_REFERENCE object to aReferences for each component in the sheet.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.

References _, SCH_REFERENCE::Annotate(), SCH_REFERENCE_LIST::Annotate(), KIID_PATH::AsString(), CHANGED, CheckAnnotate(), DeleteAnnotation(), SCH_BASE_FRAME::GetCanvas(), SCH_REFERENCE_LIST::GetCount(), GetCurrentSheet(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SHEET_LIST::GetMultiUnitSymbols(), SCH_COMPONENT::GetRef(), SCH_REFERENCE::GetSheetPath(), SCHEMATIC::GetSheets(), SCH_REFERENCE::GetSymbol(), SCH_SHEET_PATH::GetSymbols(), SCH_SHEET_LIST::GetSymbols(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), SCH_COMPONENT::GetUnitSelection(), SCH_COMPONENT::GetValue(), INCREMENTAL_BY_REF, SCH_SHEET_PATH::LastScreen(), 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, SaveCopyInUndoList(), 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(), and UpdateNetHighlightStatus().

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

◆ AppendMsgPanel()

void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  aTextUpper,
const wxString &  aTextLower,
int  aPadding = 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
aTextUpperThe message upper text.
aTextLowerThe message lower text.
aPaddingNumber of spaces to pad between messages.

Definition at line 597 of file eda_draw_frame.cpp.

599 {
600  if( m_messagePanel )
601  m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
602 }
EDA_MSG_PANEL * m_messagePanel
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, int aPadding=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:118

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

Referenced by GERBER_FILE_IMAGE::DisplayImageInfo(), SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet(), and SYMBOL_VIEWER_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 577 of file eeschema/files-io.cpp.

578 {
579  wxString fullFileName;
580  SCH_SCREEN* screen = GetScreen();
581 
582  if( !screen )
583  {
584  wxLogError( wxT( "Document not ready, cannot import" ) );
585  return false;
586  }
587 
588  // open file chooser dialog
589  wxString path = wxPathOnly( Prj().GetProjectFullName() );
590 
591  wxFileDialog dlg( this, _( "Append Schematic" ), path, wxEmptyString,
592  KiCadSchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
593 
594  if( dlg.ShowModal() == wxID_CANCEL )
595  return false;
596 
597  fullFileName = dlg.GetPath();
598 
599  if( !LoadSheetFromFile( GetCurrentSheet().Last(), &GetCurrentSheet(), fullFileName ) )
600  return false;
601 
604 
605  SyncView();
606  OnModify();
607  HardRedraw(); // Full reinit of the current screen and the display.
608 
609  return true;
610 }
wxString KiCadSchematicFileWildcard()
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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:101
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
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...

References _, GetCurrentSheet(), GetScreen(), HardRedraw(), KiCadSchematicFileWildcard(), LoadSheetFromFile(), TOOLS_HOLDER::m_toolManager, OnModify(), KIWAY_HOLDER::Prj(), TOOL_MANAGER::RunAction(), SetSheetNumberAndCount(), SCH_BASE_FRAME::SyncView(), 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 1020 of file eeschema/files-io.cpp.

1021 {
1022  SCH_SCREENS screenList( Schematic().Root() );
1023 
1024  // Save any currently open and modified project files.
1025  for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
1026  {
1027  if( screen->IsModify() )
1028  {
1029  if( !HandleUnsavedChanges( this, _( "The current schematic has been modified. "
1030  "Save changes?" ),
1031  [&]()->bool { return SaveProject(); } ) )
1032  {
1033  return false;
1034  }
1035  }
1036  }
1037 
1038  return true;
1039 }
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:208
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:528

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 285 of file bus-wire-junction.cpp.

287 {
288  if( !IsPointOnSegment( aSegment->GetStartPoint(), aSegment->GetEndPoint(), aPoint )
289  || aSegment->IsEndPoint( aPoint ) )
290  {
291  return false;
292  }
293 
294  if( aScreen == nullptr )
295  aScreen = GetScreen();
296 
297  SCH_LINE* newSegment = new SCH_LINE( *aSegment );
298 
299  newSegment->SetStartPoint( aPoint );
300  AddToScreen( newSegment, aScreen );
301 
302  SaveCopyInUndoList( aScreen, newSegment, UNDO_REDO::NEWITEM, true );
303  SaveCopyInUndoList( aScreen, aSegment, UNDO_REDO::CHANGED, true );
304 
305  UpdateItem( aSegment );
306  aSegment->SetEndPoint( aPoint );
307 
308  if( aNewSegment )
309  *aNewSegment = newSegment;
310 
311  return true;
312 }
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
wxPoint GetStartPoint() const
Definition: sch_line.h:94
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_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, 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
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
wxPoint GetEndPoint() const
Definition: sch_line.h:97

References SCH_BASE_FRAME::AddToScreen(), CHANGED, SCH_LINE::GetEndPoint(), GetScreen(), SCH_LINE::GetStartPoint(), SCH_LINE::IsEndPoint(), IsPointOnSegment(), NEWITEM, SaveCopyInUndoList(), SCH_LINE::SetEndPoint(), SCH_LINE::SetStartPoint(), and SCH_BASE_FRAME::UpdateItem().

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 315 of file bus-wire-junction.cpp.

316 {
317  static const KICAD_T wiresAndBuses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
318 
319  if( aScreen == nullptr )
320  aScreen = GetScreen();
321 
322  bool brokenSegments = false;
323  std::vector<SCH_LINE*> wires;
324  EDA_RECT bbox( aPoint, wxSize( 2, 2 ) );
325 
326  for( auto item : aScreen->Items().Overlapping( SCH_LINE_T, aPoint ) )
327  {
328  if( item->IsType( wiresAndBuses ) )
329  wires.push_back( static_cast<SCH_LINE*>( item ) );
330  }
331 
332  for( auto wire : wires )
333  brokenSegments |= BreakSegment( wire, aPoint, NULL, aScreen );
334 
335  return brokenSegments;
336 }
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:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
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:159
Handle the component boundary box.
Definition: eda_rect.h:42

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 339 of file bus-wire-junction.cpp.

340 {
341  if( aScreen == nullptr )
342  aScreen = GetScreen();
343 
344  bool brokenSegments = false;
345 
346  std::set<wxPoint> point_set;
347 
348  for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
349  point_set.insert( item->GetPosition() );
350 
351  for( SCH_ITEM* item : aScreen->Items().OfType( SCH_BUS_WIRE_ENTRY_T ) )
352  {
353  SCH_BUS_WIRE_ENTRY* entry = static_cast<SCH_BUS_WIRE_ENTRY*>( item );
354  point_set.insert( entry->GetPosition() );
355  point_set.insert( entry->GetEnd() );
356  }
357 
358 
359  for( auto pt : point_set )
360  brokenSegments |= BreakSegments( pt, aScreen );
361 
362  return brokenSegments;
363 }
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:219
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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
EE_RTREE & Items()
Definition: sch_screen.h:159
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:194
wxPoint GetEnd() const
wxPoint GetPosition() const override

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

Referenced by SchematicCleanUp().

◆ canCloseWindow()

bool SCH_EDIT_FRAME::canCloseWindow ( wxCloseEvent &  aCloseEvent)
overrideprivatevirtual

Reimplemented from EDA_BASE_FRAME.

Definition at line 586 of file sch_edit_frame.cpp.

587 {
588  // Exit interactive editing
589  // Note this this will commit *some* pending changes. For instance, the EE_POINT_EDITOR
590  // will cancel any drag currently in progress, but commit all changes from previous drags.
591  if( m_toolManager )
593 
594  // Shutdown blocks must be determined and vetoed as early as possible
595  if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
596  && Schematic().GetSheets().IsModified() )
597  {
598  return false;
599  }
600 
601  if( Kiface().IsSingle() )
602  {
603  auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
604 
605  if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
606  return false;
607 
608  auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
609 
610  if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
611  return false;
612 
613  symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
614 
615  if( symbolViewer && !symbolViewer->Close() ) // Can close modal symbol viewer?
616  return false;
617  }
618 
619  SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );
620 
621  if( simFrame && !simFrame->Close() ) // Can close the simulator?
622  return false;
623 
624  // We may have gotten multiple events; don't clean up twice
625  if( !Schematic().IsValid() )
626  return false;
627 
628  SCH_SHEET_LIST sheetlist = Schematic().GetSheets();
629 
630  if( sheetlist.IsModified() )
631  {
632  wxFileName fileName = Schematic().RootScreen()->GetFileName();
633  wxString msg = _( "Save changes to \"%s\" before closing?" );
634 
635  if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
636  [&]()->bool { return SaveProject(); } ) )
637  {
638  return false;
639  }
640  }
641 
642  return true;
643 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
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:208
bool IsModified()
Check the entire hierarchy for any modifications.
const wxString & GetFileName() const
Definition: sch_screen.h:186
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition: schematic.h:116
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
Symbol library viewer main window.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
bool IsSingle() const
Is this KIFACE_I running under single_top?
Definition: kiface_i.h:104
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
SCHEMATIC & Schematic() const
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:40
Implementing SIM_PLOT_FRAME_BASE.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
#define _(s)
Definition: 3d_actions.cpp:33
SCH_SCREEN * RootScreen() const
Helper to retreive the screen of the root sheet.
Definition: schematic.cpp:113
The symbol library editor main window.

References _, ACTIONS::cancelInteractive, Format(), FRAME_SCH_SYMBOL_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, FRAME_SIMULATOR, SCH_SCREEN::GetFileName(), SCHEMATIC::GetSheets(), HandleUnsavedChanges(), SCH_SHEET_LIST::IsModified(), KIFACE_I::IsSingle(), SCHEMATIC::IsValid(), Kiface(), KIWAY_HOLDER::Kiway(), TOOLS_HOLDER::m_toolManager, KIWAY::Player(), SCHEMATIC::RootScreen(), TOOL_MANAGER::RunAction(), SaveProject(), Schematic(), and KIPLATFORM::APP::SupportsShutdownBlockReason().

◆ CenterScreen()

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

Definition at line 253 of file sch_base_frame.cpp.

254 {
255  GetCanvas()->GetView()->SetCenter( aCenterPoint );
256 
257  if( aWarpPointer )
258  GetCanvas()->GetViewControls()->WarpCursor( aCenterPoint, true );
259 
260  GetCanvas()->Refresh();
261 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:585
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 1025 of file eda_base_frame.cpp.

1026 {
1027  SetUserUnits( aUnits );
1029 
1030  wxCommandEvent e( UNITS_CHANGED );
1031  ProcessEventLocally( e );
1032 }
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::SwitchUnits(), 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 262 of file eeschema/annotate.cpp.

263 {
264  SCH_REFERENCE_LIST referenceList;
265  constexpr bool includePowerSymbols = false;
266 
267  // Build the list of symbols
268  if( !aOneSheetOnly )
269  Schematic().GetSheets().GetSymbols( referenceList, includePowerSymbols );
270  else
271  GetCurrentSheet().GetSymbols( referenceList );
272 
273  // Empty schematic does not need annotation
274  if( referenceList.GetCount() == 0 )
275  return 0;
276 
277  return referenceList.CheckAnnotation( aReporter );
278 }
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Add a SCH_REFERENCE object to aReferences for each component in the list of sheets.
SCH_REFERENCE_LIST is used to create a flattened list of symbols because in a complex hierarchy,...
SCHEMATIC & Schematic() const
unsigned GetCount() const
SCH_SHEET_PATH & GetCurrentSheet() const
int CheckAnnotation(REPORTER &aReporter)
Function CheckAnnotation check for annotations errors.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Adds SCH_REFERENCE object to aReferences for each component in the sheet.

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

Referenced by AnnotateComponents(), DIALOG_ERC::DIALOG_ERC(), DIALOG_ERC::OnRunERCClick(), 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 923 of file eda_base_frame.cpp.

924 {
925  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
926 
927  wxFileName autoSaveFileName = aFileName;
928 
929  // Check for auto save file.
930  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
931 
932  wxLogTrace( traceAutoSave,
933  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
934 
935  if( !autoSaveFileName.FileExists() )
936  return;
937 
938  wxString msg = wxString::Format( _(
939  "Well this is potentially embarrassing!\n"
940  "It appears that the last time you were editing the file\n"
941  "\"%s\"\n"
942  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
943  aFileName.GetFullName()
944  );
945 
946  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
947 
948  // Make a backup of the current file, delete the file, and rename the auto save file to
949  // the file name.
950  if( response == wxYES )
951  {
952  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
953  {
954  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
955  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
956  }
957  }
958  else
959  {
960  wxLogTrace( traceAutoSave,
961  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
962 
963  // Remove the auto save file when using the previous file as is.
964  wxRemoveFile( autoSaveFileName.GetFullPath() );
965  }
966 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static wxString GetAutoSaveFilePrefix()
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), 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 72 of file sheet.cpp.

73 {
74  wxASSERT( aSheet && aSheet->GetScreen() );
75 
76  wxString msg;
77  SCH_SCREENS newScreens( aSheet );
78 
79  if( newScreens.HasNoFullyDefinedLibIds() )
80  {
81  msg.Printf( _( "The schematic \"%s\" has not had it's symbol library links remapped "
82  "to the symbol library table. The project this schematic belongs to "
83  "must first be remapped before it can be imported into the current "
84  "project." ), aSheet->GetScreen()->GetFileName() );
85  DisplayInfoMessage( this, msg );
86  return true;
87  }
88 
89  return false;
90 }
const wxString & GetFileName() const
Definition: sch_screen.h:186
SCH_SCREEN * GetScreen() const
Definition: sch_sheet.h:285
#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:281
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528

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 44 of file sheet.cpp.

45 {
46  wxASSERT( aSheet && aHierarchy );
47 
48  wxString msg;
49  SCH_SHEET_LIST hierarchy = Schematic().GetSheets(); // The full schematic sheet hierarchy.
50  SCH_SHEET_LIST sheetHierarchy( aSheet ); // This is the hierarchy of the loaded file.
51 
52  wxFileName destFile = aHierarchy->LastScreen()->GetFileName();
53 
54  // SCH_SCREEN object file paths are expected to be absolute. If this assert fires,
55  // something is seriously broken.
56  wxASSERT( destFile.IsAbsolute() );
57 
58  if( hierarchy.TestForRecursion( sheetHierarchy, destFile.GetFullPath() ) )
59  {
60  msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
61  "has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
62  "the schematic hierarchy." ),
63  destFile.GetFullPath() );
64  DisplayError( this, msg );
65  return true;
66  }
67 
68  return false;
69 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
const wxString & GetFileName() const
Definition: sch_screen.h:186
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName)
Test every SCH_SHEET_PATH in this SCH_SHEET_LIST to verify if adding the sheets stored in aSrcSheetHi...
SCHEMATIC & Schematic() const
SCH_SCREEN * 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_SHEET_PROPERTIES::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 890 of file sch_edit_frame.h.

890 { 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 820 of file eda_base_frame.cpp.

821 {
822  if( !aFileHistory )
823  aFileHistory = m_fileHistory;
824 
825  wxASSERT( aFileHistory );
826 
827  aFileHistory->ClearFileHistory();
828 
829  // Update the menubar to update the file history menu
830  if( GetMenuBar() )
831  {
832  ReCreateMenuBar();
833  GetMenuBar()->Refresh();
834  }
835 }
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 889 of file sch_edit_frame.cpp.

890 {
891  m_infoBar->Dismiss();
892 }
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:143
WX_INFOBAR * m_infoBar

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

Referenced by SCH_EDITOR_CONTROL::FindNext().

◆ ClearMsgPanel()

◆ ClearUndoORRedoList()

void SCH_EDIT_FRAME::ClearUndoORRedoList ( UNDO_REDO_LIST  whichList,
int  aItemCount = -1 
)
overridevirtual

Free the undo or redo list from aList element.

  • Wrappers are deleted.
  • data pointed by wrappers are deleted if not in use in schematic i.e. when they are copy of a schematic item or they are no more in use (DELETED)
Parameters
whichList= the UNDO_REDO_CONTAINER to clear
aItemCount= the count of items to remove. < 0 for all items items are removed from the beginning of the list. So this function can be called to remove old commands

Reimplemented from EDA_BASE_FRAME.

Definition at line 380 of file schematic_undo_redo.cpp.

381 {
382  if( aItemCount == 0 )
383  return;
384 
385  UNDO_REDO_CONTAINER& list = whichList == UNDO_LIST ? m_undoList : m_redoList;
386 
387  for( PICKED_ITEMS_LIST* command : list.m_CommandsList )
388  {
389  command->ClearListAndDeleteItems();
390  delete command;
391  }
392 
393  list.m_CommandsList.clear();
394 }
UNDO_REDO_CONTAINER m_undoList
A holder to handle a list of undo (or redo) commands.
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
A holder to handle information on schematic or board items.
UNDO_REDO_CONTAINER m_redoList
void ClearListAndDeleteItems()
Delete the list of pickers AND the data pointed by #m_PickedItem or #m_PickedItemLink according to th...

References PICKED_ITEMS_LIST::ClearListAndDeleteItems(), UNDO_REDO_CONTAINER::m_CommandsList, EDA_BASE_FRAME::m_redoList, EDA_BASE_FRAME::m_undoList, and EDA_BASE_FRAME::UNDO_LIST.

Referenced by DIALOG_SYMBOL_REMAP::OnRemapSymbols(), and SaveCopyInUndoList().

◆ ClearUndoRedoList()

◆ CommonSettingsChanged()

void SCH_EDIT_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged,
bool  aTextVarsChanged 
)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from SCH_BASE_FRAME.

Definition at line 1372 of file sch_edit_frame.cpp.

1373 {
1374  SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1375  SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1376 
1378 
1379  RecreateToolbars();
1380  Layout();
1381  SendSizeEvent();
1382 }
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
void ShowAllIntersheetRefs(bool aShow)
SCHEMATIC & Schematic() const
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
These settings were stored in SCH_BASE_FRAME previously.

References SCH_BASE_FRAME::CommonSettingsChanged(), SCHEMATIC_SETTINGS::m_IntersheetRefsShow, EDA_DRAW_FRAME::RecreateToolbars(), Schematic(), SCHEMATIC::Settings(), and ShowAllIntersheetRefs().

◆ 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, and FOOTPRINT_EDIT_FRAME.

Definition at line 661 of file eda_base_frame.cpp.

662 {
663  // KICAD_MANAGER_FRAME overrides this
664  return Kiface().KifaceSettings();
665 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:92
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_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), SIM_PLOT_FRAME::doCloseWindow(), 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(), SCH_BASE_FRAME::libeditconfig(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), EDA_DRAW_FRAME::OnUpdateSelectZoom(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), EDA_DRAW_FRAME::resolveCanvasType(), DISPLAY_FOOTPRINTS_FRAME::SetAutoZoom(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetGridVisibility(), PL_EDITOR_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), CVPCB_MAINFRAME::setupTools(), setupTools(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_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

Get the configuration base name.

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 configuration can be used.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in configuration.

Reimplemented from TOOLS_HOLDER.

Definition at line 338 of file eda_base_frame.h.

339  {
340  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
341  return baseCfgName;
342  }
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 237 of file getpart.cpp.

238 {
239  if( !aComponent || !aComponent->GetPartRef() )
240  return;
241 
242  wxString msg;
243 
244  if( !aComponent->GetPartRef()->HasConversion() )
245  {
246  LIB_ID id = aComponent->GetPartRef()->GetLibId();
247 
248  msg.Printf( _( "No alternate body style found for symbol \"%s\" in library \"%s\"." ),
249  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
250  DisplayError( this, msg );
251  return;
252  }
253 
254  STATUS_FLAGS savedFlags = aComponent->GetFlags();
255 
256  aComponent->SetConvert( aComponent->GetConvert() + 1 );
257 
258  // ensure m_Convert = 1 or 2
259  // 1 = shape 1 = not converted
260  // 2 = shape 2 = first converted shape
261  // > 2 is not used but could be used for more shapes
262  // like multiple shapes for a programmable component
263  // When m_Convert = val max, return to the first shape
264  if( aComponent->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN )
265  aComponent->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
266 
268  aComponent->ClearFlags();
269  aComponent->SetFlags( savedFlags ); // Restore m_flags (modified by SetConvert())
270 
271  // If selected make sure all the now-included pins are selected
272  if( aComponent->IsSelected() )
273  m_toolManager->RunAction( EE_ACTIONS::addItemToSel, true, aComponent );
274 
275  UpdateItem( aComponent );
276  OnModify();
277 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
bool IsSelected() const
Definition: eda_item.h:171
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
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: eda_item.h:201
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
unsigned STATUS_FLAGS
Definition: eda_item.h:143
std::unique_ptr< LIB_PART > & GetPartRef()
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
#define _(s)
Definition: 3d_actions.cpp:33
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:202
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: eda_item.h:203

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(), TOOL_MANAGER::RunAction(), SCH_COMPONENT::SetConvert(), EDA_ITEM::SetFlags(), TestDanglingEnds(), and SCH_BASE_FRAME::UpdateItem().

Referenced by SCH_EDIT_TOOL::ConvertDeMorgan().

◆ 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 65 of file libarch.cpp.

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

References _, DisplayErrorMessage(), LIB_PART::Flatten(), SCH_SCREENS::GetFirst(), SCH_BASE_FRAME::GetLibPart(), SCH_SCREENS::GetNext(), LT_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 42 of file libarch.cpp.

43 {
44  wxFileName fn;
45 
46  if( aUseCurrentSheetFilename )
47  fn = GetScreen()->GetFileName();
48  else
49  fn = Schematic().RootScreen()->GetFileName();
50 
51  fn.SetName( fn.GetName() + "-cache" );
52  fn.SetExt( LegacySymbolLibFileExtension );
53 
54  bool success = CreateArchiveLibrary( fn.GetFullPath() );
55 
56  // Update the schematic symbol library links.
57  // because the lib cache has changed
58  SCH_SCREENS schematic( Schematic().Root() );
59  schematic.UpdateSymbolLinks();
60 
61  return success;
62 }
const wxString & GetFileName() const
Definition: sch_screen.h:186
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:113
bool CreateArchiveLibrary(const wxString &aFileName)
Create a library aFileName that contains all components used in the current schematic.
Definition: libarch.cpp:65
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528

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 284 of file sch_base_frame.cpp.

285 {
287 
288  // Allows only a CAIRO or OPENGL canvas:
291  {
293  }
294 
295  SetCanvas( new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_frameSize,
298 }
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
static constexpr GAL_TYPE GAL_FALLBACK
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Returns the canvas type stored in the application settings.

References EDA_DRAW_FRAME::ActivateGalCanvas(), EDA_DRAW_PANEL_GAL::GAL_FALLBACK, 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().

◆ CreateInfoBar()

void EDA_BASE_FRAME::CreateInfoBar ( )
inherited

Definition at line 686 of file eda_base_frame.cpp.

687 {
688 #if defined( __WXOSX_MAC__ )
690 #else
691  m_infoBar = new WX_INFOBAR( this, &m_auimgr );
692 
693  m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
694 #endif
695 }
wxAuiManager m_auimgr
virtual wxWindow * GetToolCanvas() const =0
Canvas access.
Specialization of the wxAuiPaneInfo class for KiCad panels.
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:71
WX_INFOBAR * m_infoBar

References TOOLS_HOLDER::GetToolCanvas(), EDA_BASE_FRAME::m_auimgr, and EDA_BASE_FRAME::m_infoBar.

◆ CreateScreens()

void SCH_EDIT_FRAME::CreateScreens ( )

Definition at line 534 of file sch_edit_frame.cpp.

535 {
536  m_schematic->Reset();
537  m_schematic->SetProject( &Prj() );
538 
540 
542 
543  SCH_SCREEN* rootScreen = new SCH_SCREEN( m_schematic );
544  m_schematic->Root().SetScreen( rootScreen );
545  SetScreen( Schematic().RootScreen() );
546 
547  m_schematic->RootScreen()->SetFileName( wxEmptyString );
548 
549  if( GetScreen() == NULL )
550  {
551  SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
552  SetScreen( screen );
553  }
554 }
SCHEMATIC * m_schematic
The currently loaded schematic.
void SetScreen(BASE_SCREEN *aScreen) override
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:125
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:154
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:100
#define NULL
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCHEMATIC & Schematic() const
SCHEMATIC_SETTINGS * m_defaults
void SetProject(PROJECT *aPrj)
Definition: schematic.cpp:73
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:219
void Reset()
Initializes this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:50
SCH_SHEET & Root() const
Definition: schematic.h:102
void SetFileName(const wxString &aFileName)
Definition: sch_screen.h:184
SCH_SCREEN * RootScreen() const
Helper to retreive the screen of the root sheet.
Definition: schematic.cpp:113

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

Referenced by importFile(), and OpenProjectFiles().

◆ CreateServer()

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

Definition at line 48 of file eda_dde.cpp.

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

◆ 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:163
static TOOL_ACTION selectionTool
Definition: actions.h:156

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 875 of file sch_edit_frame.h.

875 { 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().

◆ DeleteAnnotation()

void SCH_EDIT_FRAME::DeleteAnnotation ( bool  aCurrentSheetOnly,
bool *  appendUndo 
)

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  auto clearAnnotation =
64  [&]( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet )
65  {
66  for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) )
67  {
68  SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
69 
70  SaveCopyInUndoList( aScreen, component, UNDO_REDO::CHANGED, *aAppendUndo );
71  *aAppendUndo = true;
72  component->ClearAnnotation( aSheet );
73  }
74  };
75 
76  if( aCurrentSheetOnly )
77  {
78  clearAnnotation( GetScreen(), &GetCurrentSheet() );
79  }
80  else
81  {
82  for( const SCH_SHEET_PATH& sheet : Schematic().GetSheets() )
83  clearAnnotation( sheet.LastScreen(), nullptr );
84  }
85 
86  // Update the references for the sheet that is currently being displayed.
88 
89  SyncView();
90  GetCanvas()->Refresh();
91  OnModify();
92 
93  // Must go after OnModify() so the connectivity graph has been updated
95 }
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:219
void UpdateNetHighlightStatus()
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
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 SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
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...
EE_RTREE & Items()
Definition: sch_screen.h:159
Schematic symbol object.
Definition: sch_component.h:79
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...
void ClearAnnotation(const SCH_SHEET_PATH *aSheetPath)
Clear exiting component annotation.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194

References CHANGED, SCH_COMPONENT::ClearAnnotation(), SCH_BASE_FRAME::GetCanvas(), GetCurrentSheet(), GetScreen(), SCH_SCREEN::Items(), EE_RTREE::OfType(), OnModify(), EDA_DRAW_PANEL_GAL::Refresh(), SaveCopyInUndoList(), SCH_COMPONENT_T, Schematic(), SCH_BASE_FRAME::SyncView(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and UpdateNetHighlightStatus().

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

◆ 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 366 of file bus-wire-junction.cpp.

367 {
368  SCH_SCREEN* screen = GetScreen();
369  PICKED_ITEMS_LIST undoList;
372 
373  auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void
374  {
375  aItem->SetFlags( STRUCT_DELETED );
376  undoList.PushItem( ITEM_PICKER( screen, aItem, UNDO_REDO::DELETED ) );
377  };
378 
379  remove_item( aJunction );
380  RemoveFromScreen( aJunction, screen );
381 
384  std::list<SCH_LINE*> lines;
385 
386  for( SCH_ITEM* item : screen->Items().Overlapping( SCH_LINE_T, aJunction->GetPosition() ) )
387  {
388  SCH_LINE* line = static_cast<SCH_LINE*>( item );
389 
390  if( line->IsType( wiresAndBuses ) && line->IsEndPoint( aJunction->GetPosition() )
391  && !( line->GetEditFlags() & STRUCT_DELETED ) )
392  lines.push_back( line );
393  }
394 
395  alg::for_all_pairs( lines.begin(), lines.end(),
396  [&]( SCH_LINE* firstLine, SCH_LINE* secondLine )
397  {
398  if( ( firstLine->GetEditFlags() & STRUCT_DELETED )
399  || ( secondLine->GetEditFlags() & STRUCT_DELETED )
400  || !secondLine->IsParallel( firstLine ) )
401  {
402  return;
403  }
404 
405  // Remove identical lines
406  if( firstLine->IsEndPoint( secondLine->GetStartPoint() )
407  && firstLine->IsEndPoint( secondLine->GetEndPoint() ) )
408  {
409  remove_item( firstLine );
410  return;
411  }
412 
413  // Try to merge the remaining lines
414  if( SCH_LINE* line = secondLine->MergeOverlap( screen, firstLine, false ) )
415  {
416  remove_item( firstLine );
417  remove_item( secondLine );
418  undoList.PushItem( ITEM_PICKER( screen, line, UNDO_REDO::NEWITEM ) );
419  AddToScreen( line, screen );
420 
421  if( line->IsSelected() )
422  selectionTool->AddItemToSel( line, true /*quiet mode*/ );
423 
424  lines.push_back( line );
425  }
426  } );
427 
428  SaveCopyInUndoList( undoList, UNDO_REDO::DELETED, aAppend );
429 
430 
431  for( auto line : lines )
432  {
433  if( line->GetEditFlags() & STRUCT_DELETED )
434  {
435  if( line->IsSelected() )
436  selectionTool->RemoveItemFromSel( line, true /*quiet mode*/ );
437 
438  RemoveFromScreen( line, screen );
439  }
440  }
441 }
SCH_LINE * MergeOverlap(SCH_SCREEN *aScreen, SCH_LINE *aLine, bool aCheckJunctions)
Check line against aLine to see if it overlaps and merge if it does.
Definition: sch_line.cpp:404
bool IsSelected() const
Definition: eda_item.h:171
EE_TYPE Overlapping(const EDA_RECT &aRect)
Definition: sch_rtree.h:224
void RemoveFromScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Remove an item from the screen (and view) aScreen is the screen the item is located on,...
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
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:65
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:201
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:206
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, 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
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
A holder to handle information on schematic or board items.
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
int AddItemToSel(const TOOL_EVENT &aEvent)
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
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:159
bool IsType(const KICAD_T aScanTypes[]) const override
Check 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:194

References EE_SELECTION_TOOL::AddItemToSel(), SCH_BASE_FRAME::AddToScreen(), DELETED, 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(), NEWITEM, 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, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::DoDelete().

◆ Destroy()

◆ DismissModal()

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

Definition at line 161 of file kiway_player.cpp.

162 {
163  m_modal_ret_val = aRetVal;
164  m_modal_string = aResult;
165 
166  if( m_modal_loop )
167  {
168  m_modal_loop->Exit();
169  m_modal_loop = 0; // this marks it as dismissed.
170  }
171 
172  Show( false );
173 }
bool m_modal_ret_val
Definition: kiway_player.h:198
wxString m_modal_string
Definition: kiway_player.h:197
WX_EVENT_LOOP * m_modal_loop
< Points to nested event_loop. NULL means not modal and dismissed.
Definition: kiway_player.h:195

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SYMBOL_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::doCloseWindow(), FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), and SYMBOL_VIEWER_FRAME::FinishModal().

◆ DisplayCurrentSheet()

void SCH_EDIT_FRAME::DisplayCurrentSheet ( )

Draw the current sheet on the display.

Definition at line 289 of file hierarch.cpp.

290 {
293  SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
294 
295  wxASSERT( screen );
296 
297  SetScreen( screen );
298 
299  // update the References
302 
303  if( !screen->m_Initialized )
304  {
306  screen->m_Initialized = true;
307  }
308  else
309  {
310  // Set zoom to last used in this screen
311  GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
312  RedrawScreen( (wxPoint) GetScreen()->m_ScrollCenter, false );
313  }
314 
315  UpdateTitle();
316 
319  editTool->UpdateNetHighlighting( dummy );
320 
321  HardRedraw(); // Ensure any item has its view updated, especially the worksheet items
322 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
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:99
void UpdateTitle()
Set the main window title bar text.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
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.
bool m_Initialized
Definition: base_screen.h:106
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:170
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
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition: sch_view.cpp:75
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
SCH_SCREEN * 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

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, dummy(), SCH_BASE_FRAME::GetCanvas(), GetCurrentSheet(), GetScreen(), TOOL_MANAGER::GetTool(), SCH_DRAW_PANEL::GetView(), HardRedraw(), SCH_SHEET_PATH::LastScreen(), BASE_SCREEN::m_Initialized, TOOLS_HOLDER::m_toolManager, SCH_BASE_FRAME::RedrawScreen(), TOOL_MANAGER::RunAction(), KIGFX::SCH_VIEW::SetScale(), SetScreen(), SetSheetNumberAndCount(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), UpdateTitle(), and ACTIONS::zoomFitScreen.

Referenced by SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_NAVIGATE_TOOL::HypertextCommand(), SCH_NAVIGATE_TOOL::LeaveSheet(), 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 GERBVIEW_FRAME, PCB_BASE_FRAME, and PL_EDITOR_FRAME.

Definition at line 472 of file eda_draw_frame.cpp.

473 {
474  wxString line;
475 
476  line.Printf( "grid %s",
477  MessageTextFromValue( GetUserUnits(), GetCanvas()->GetGAL()->GetGridSize().x, false ) );
478 
479  SetStatusText( line, 4 );
480 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Definition: base_units.cpp:123
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_DRAW_FRAME::GetCanvas(), EDA_BASE_FRAME::GetUserUnits(), and MessageTextFromValue().

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 PCB_CONTROL::Paste().

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane in the status bar.

Definition at line 483 of file eda_draw_frame.cpp.

484 {
485  wxString msg;
486 
487  switch( m_userUnits )
488  {
489  case EDA_UNITS::INCHES: msg = _( "inches" ); break;
490  case EDA_UNITS::MILS: msg = _( "mils" ); break;
491  case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
492  default: msg = _( "Units" ); break;
493  }
494 
495  SetStatusText( msg, 5 );
496 }
#define _(s)
Definition: 3d_actions.cpp:33
EDA_UNITS m_userUnits
Map containing the UI update handlers registered with wx for each action.

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

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 849 of file eeschema/files-io.cpp.

850 {
851  wxFileName tmpFileName = Schematic().Root().GetFileName();
852  wxFileName fn = tmpFileName;
853  wxFileName tmp;
854  SCH_SCREENS screens( Schematic().Root() );
855 
856  bool autoSaveOk = true;
857 
858  if( fn.GetPath().IsEmpty() )
859  tmp.AssignDir( Prj().GetProjectPath() );
860  else
861  tmp.AssignDir( fn.GetPath() );
862 
863  if( !tmp.IsOk() )
864  return false;
865 
866  if( !IsWritable( tmp ) )
867  return false;
868 
869  for( size_t i = 0; i < screens.GetCount(); i++ )
870  {
871  // Only create auto save files for the schematics that have been modified.
872  if( !screens.GetScreen( i )->IsSave() )
873  continue;
874 
875  tmpFileName = fn = screens.GetScreen( i )->GetFileName();
876 
877  // Auto save file name is the normal file name prefixed with GetAutoSavePrefix().
878  fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
879 
880  screens.GetScreen( i )->SetFileName( fn.GetFullPath() );
881 
882  if( SaveEEFile( screens.GetSheet( i ), false ) )
883  screens.GetScreen( i )->SetModify();
884  else
885  autoSaveOk = false;
886 
887  screens.GetScreen( i )->SetFileName( tmpFileName.GetFullPath() );
888  }
889 
890  if( autoSaveOk )
891  {
892  m_autoSaveState = false;
893 
894  if( !Kiface().IsSingle() &&
896  {
898  }
899  }
900 
901  return autoSaveOk;
902 }
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 IsSingle() const
Is this KIFACE_I running under single_top?
Definition: kiface_i.h:104
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Calls BackupProject if a new backup is needed according to the current backup policy.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
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:499
static wxString GetAutoSaveFilePrefix()
SCH_SHEET & Root() const
Definition: schematic.h:102
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:528

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(), KIFACE_I::IsSingle(), EDA_BASE_FRAME::IsWritable(), Kiface(), EDA_BASE_FRAME::m_autoSaveState, COMMON_SETTINGS::m_Backup, KIWAY_HOLDER::Prj(), SCHEMATIC::Root(), SaveEEFile(), Schematic(), SCH_SCREEN::SetFileName(), BASE_SCREEN::SetModify(), and SETTINGS_MANAGER::TriggerBackupIfNeeded().

◆ doCloseWindow()

void SCH_EDIT_FRAME::doCloseWindow ( )
overrideprivatevirtual

Reimplemented from EDA_BASE_FRAME.

Definition at line 646 of file sch_edit_frame.cpp.

647 {
648  SCH_SHEET_LIST sheetlist = Schematic().GetSheets();
649 
650  // Shutdown all running tools
651  if( m_toolManager )
653 
655 
656  // Close the find dialog and preserve it's setting if it is displayed.
657  if( m_findReplaceDialog )
658  {
661 
662  m_findReplaceDialog->Destroy();
663  m_findReplaceDialog = nullptr;
664  }
665 
666  if( FindHierarchyNavigator() )
667  FindHierarchyNavigator()->Close( true );
668 
669  SCH_SCREENS screens( Schematic().Root() );
670  wxFileName fn;
671 
672  for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
673  {
674  fn = Prj().AbsolutePath( screen->GetFileName() );
675 
676  // Auto save file name is the normal file name prepended with GetAutoSaveFilePrefix().
677  fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
678 
679  if( fn.FileExists() && fn.IsFileWritable() )
680  wxRemoveFile( fn.GetFullPath() );
681  }
682 
683  sheetlist.ClearModifyStatus();
684 
685  wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
686 
687  if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
688  UpdateFileHistory( fileName );
689 
690  Schematic().RootScreen()->Clear();
691 
692  // all sub sheets are deleted, only the main sheet is usable
694 
695  // Clear view before destroying schematic as repaints depend on schematic being valid
696  SetScreen( nullptr );
697 
699  Schematic().Reset();
700 
701  Destroy();
702 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
HIERARCHY_NAVIG_DLG * FindHierarchyNavigator()
wxArrayString GetFindEntries() const
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
SETTINGS_MANAGER * GetSettingsManager() const
void SetScreen(BASE_SCREEN *aScreen) override
wxArrayString m_findStringHistoryList
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
Definition: sch_screen.cpp:196
wxArrayString GetReplaceEntries() const
#define NULL
wxArrayString m_replaceStringHistoryList
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCHEMATIC & Schematic() const
DIALOG_SCH_FIND * m_findReplaceDialog
void clear()
Forwarded method from std::vector.
static wxString GetAutoSaveFilePrefix()
void Reset()
Initializes this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:50
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
bool SaveProject(const wxString &aFullPath=wxEmptyString)
Saves a loaded project.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
SCH_SHEET_PATH & GetCurrentSheet() const
SCH_SCREEN * RootScreen() const
Helper to retreive the screen of the root sheet.
Definition: schematic.cpp:113
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:528

References PROJECT::AbsolutePath(), SCH_SHEET_PATH::clear(), SCH_SCREEN::Clear(), SCH_SHEET_LIST::ClearModifyStatus(), KIWAY_PLAYER::Destroy(), FindHierarchyNavigator(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), GetCurrentSheet(), DIALOG_SCH_FIND::GetFindEntries(), SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), DIALOG_SCH_FIND::GetReplaceEntries(), EDA_BASE_FRAME::GetSettingsManager(), SCHEMATIC::GetSheets(), m_findReplaceDialog, EDA_DRAW_FRAME::m_findStringHistoryList, EDA_DRAW_FRAME::m_replaceStringHistoryList, TOOLS_HOLDER::m_toolManager, NULL, KIWAY_HOLDER::Prj(), RecordERCExclusions(), SCHEMATIC::Reset(), SCHEMATIC::RootScreen(), SETTINGS_MANAGER::SaveProject(), Schematic(), SetScreen(), TOOL_MANAGER::ShutdownAllTools(), and EDA_BASE_FRAME::UpdateFileHistory().

◆ 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 481 of file sheet.cpp.

482 {
483  wxRect DrawArea;
484  BASE_SCREEN* screen = GetScreen();
485 
486  DrawArea.SetSize( GetPageSizeIU() );
487 
488  // Calculate a reasonable dc size, in pixels, and the dc scale to fit
489  // the drawings into the dc size
490  // scale is the ratio resolution (in PPI) / internal units
491  double ppi = 300; // Use 300 pixels per inch to create bitmap images on start
492  double inch2Iu = 1000.0 * IU_PER_MILS;
493  double scale = ppi / inch2Iu;
494 
495  wxSize dcsize = DrawArea.GetSize();
496 
497  int maxdim = std::max( dcsize.x, dcsize.y );
498 
499  // the max size in pixels of the bitmap used to build the sheet copy
500  const int maxbitmapsize = 5600;
501 
502  while( int( maxdim * scale ) > maxbitmapsize )
503  {
504  ppi = ppi / 1.5;
505  scale = ppi / inch2Iu;
506  }
507 
508  dcsize.x *= scale;
509  dcsize.y *= scale;
510 
511  // Set draw offset, zoom... to values needed to draw in the memory DC
512  // after saving initial values:
513  wxPoint tmp_startvisu = screen->m_StartVisu;
514  wxPoint old_org = screen->m_DrawOrg;
515  screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
516  screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
517 
518  wxMemoryDC dc;
519  wxBitmap image( dcsize );
520  dc.SelectObject( image );
521  dc.Clear();
522 
523  GRResetPenAndBrush( &dc );
524  GRForceBlackPen( false );
525  dc.SetUserScale( scale, scale );
526 
527  GetRenderSettings()->SetPrintDC( &dc );
528 
530 
531  if( wxTheClipboard->Open() )
532  {
533  // This data objects are held by the clipboard, so do not delete them in the app.
534  wxBitmapDataObject* clipbrd_data = new wxBitmapDataObject( image );
535  wxTheClipboard->SetData( clipbrd_data );
536  wxTheClipboard->Close();
537  }
538 
539  // Deselect Bitmap from DC in order to delete the MemoryDC
540  dc.SelectObject( wxNullBitmap );
541 
542  GRForceBlackPen( false );
543 
544  screen->m_StartVisu = tmp_startvisu;
545  screen->m_DrawOrg = old_org;
546 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:118
virtual void PrintPage(const RENDER_SETTINGS *aSettings) override
Plot or print the current sheet to the clipboard.
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:97
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:199
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:40
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:92
#define IU_PER_MILS
Definition: plotter.cpp:137
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, and KIGFX::RENDER_SETTINGS::SetPrintDC().

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 465 of file sheet.cpp.

467 {
468  if( aSheet == NULL || aHierarchy == NULL )
469  return false;
470 
471  // Get the new texts
472  DIALOG_SHEET_PROPERTIES dlg( this, aSheet, aClearAnnotationNewItems );
473 
474  if( dlg.ShowModal() == wxID_CANCEL )
475  return false;
476 
477  return true;
478 }
#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 229 of file eda_draw_frame.cpp.

230 {
231  if( m_messagePanel )
233 }
EDA_MSG_PANEL * m_messagePanel
void EraseMsgBox()
Definition: msgpanel.cpp:214

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 footprint 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 288 of file eeschema/cross-probing.cpp.

289 {
291  char line[1024];
292 
293  strncpy( line, cmdline, sizeof(line) - 1 );
294  line[ sizeof(line) - 1 ] = '\0';
295 
296  char* idcmd = strtok( line, " \n\r" );
297  char* text = strtok( NULL, "\"\n\r" );
298 
299  if( idcmd == NULL )
300  return;
301 
302  CROSS_PROBING_SETTINGS& crossProbingSettings = eeconfig()->m_CrossProbing;
303 
304  if( strcmp( idcmd, "$NET:" ) == 0 )
305  {
306  if( !crossProbingSettings.auto_highlight )
307  return;
308 
309  wxString netName = FROM_UTF8( text );
310 
311  if( auto sg = Schematic().ConnectionGraph()->FindFirstSubgraphByName( netName ) )
312  m_highlightedConn = sg->m_driver_connection;
313  else
314  m_highlightedConn = nullptr;
315 
317 
318  SetStatusText( _( "Selected net:" ) + wxS( " " ) + UnescapeString( netName ) );
319  return;
320  }
321 
322  if( strcmp( idcmd, "$CLEAR:" ) == 0 )
323  {
324  // Cross-probing is now done through selection so we no longer need a clear command
325  return;
326  }
327 
328  if( text == NULL )
329  return;
330 
331  if( strcmp( idcmd, "$PART:" ) != 0 )
332  return;
333 
334  wxString part_ref = FROM_UTF8( text );
335 
336  /* look for a complement */
337  idcmd = strtok( NULL, " \n\r" );
338 
339  if( idcmd == NULL ) // Highlight component only (from Cvpcb or Pcbnew)
340  {
341  // Highlight component part_ref, or clear Highlight, if part_ref is not existing
342  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
343  return;
344  }
345 
346  text = strtok( NULL, "\"\n\r" );
347 
348  if( text == NULL )
349  return;
350 
351  wxString msg = FROM_UTF8( text );
352 
353  if( strcmp( idcmd, "$REF:" ) == 0 )
354  {
355  // Highlighting the reference itself isn't actually that useful, and it's harder to
356  // see. Highlight the parent and display the message.
357  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
358  }
359  else if( strcmp( idcmd, "$VAL:" ) == 0 )
360  {
361  // Highlighting the value itself isn't actually that useful, and it's harder to see.
362  // Highlight the parent and display the message.
363  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
364  }
365  else if( strcmp( idcmd, "$PAD:" ) == 0 )
366  {
367  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_PIN, msg );
368  }
369  else
370  {
371  editor->FindComponentAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
372  }
373 }
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
static TOOL_ACTION updateNetHighlighting
Definition: ee_actions.h:219
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:157
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:159

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 838 of file sch_edit_frame.cpp.

839 {
840  wxWindow* navigator = wxWindow::FindWindowByName( HIERARCHY_NAVIG_DLG_WNAME );
841 
842  return static_cast< HIERARCHY_NAVIG_DLG* >( navigator );
843 }
#define HIERARCHY_NAVIG_DLG_WNAME
Definition: hierarch.h:36

References HIERARCHY_NAVIG_DLG_WNAME.

Referenced by doCloseWindow(), and UpdateHierarchyNavigator().

◆ FinishAUIInitialization()

void EDA_BASE_FRAME::FinishAUIInitialization ( )
inherited

Definition at line 698 of file eda_base_frame.cpp.

699 {
700 #if defined( __WXOSX_MAC__ )
701  m_auimgr.Update();
702 #else
703  // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
704  // hidding it.
705  m_auimgr.Update();
706 
707  // We don't want the infobar displayed right away
708  m_auimgr.GetPane( "InfoBar" ).Hide();
709  m_auimgr.Update();
710 #endif
711 }
wxAuiManager m_auimgr

References EDA_BASE_FRAME::m_auimgr.

◆ FixupJunctions()

void SCH_EDIT_FRAME::FixupJunctions ( )

Definition at line 1481 of file sch_edit_frame.cpp.

1482 {
1483  // Save the current sheet, to retrieve it later
1484  SCH_SHEET_PATH oldsheetpath = GetCurrentSheet();
1485 
1486  bool modified = false;
1487 
1488  SCH_SHEET_LIST sheetList = Schematic().GetSheets();
1489 
1490  for( const SCH_SHEET_PATH& sheet : sheetList )
1491  {
1492  // We require a set here to avoid adding multiple junctions to the same spot
1493  std::set<wxPoint> junctions;
1494 
1495  SetCurrentSheet( sheet );
1497 
1498  SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
1499 
1500  for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
1501  {
1502  auto cmp = static_cast<SCH_COMPONENT*>( aItem );
1503 
1504  for( const SCH_PIN* pin : cmp->GetPins( &sheet ) )
1505  {
1506  auto pos = pin->GetPosition();
1507 
1508  // Test if a _new_ junction is needed, and add it if missing
1509  if( screen->IsJunctionNeeded( pos, true ) )
1510  junctions.insert( pos );
1511  }
1512  }
1513 
1514  for( const wxPoint& pos : junctions )
1515  AddJunction( screen, pos, false, false );
1516 
1517  if( junctions.size() )
1518  modified = true;
1519  }
1520 
1521  if( modified )
1522  OnModify();
1523 
1524  // Reselect the initial sheet:
1525  SetCurrentSheet( oldsheetpath );
1527  SetScreen( GetCurrentSheet().LastScreen() );
1528 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:219
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
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:371
void SetScreen(BASE_SCREEN *aScreen) override
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const wxPoint &aPos, bool aAppendToUndo, bool aFinal=true)
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
EE_RTREE & Items()
Definition: sch_screen.h:159
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_SCREEN::IsJunctionNeeded(), SCH_SCREEN::Items(), SCH_SHEET_PATH::LastScreen(), EE_RTREE::OfType(), 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 1544 of file sch_edit_frame.cpp.

1545 {
1546  static KIID lastBrightenedItemID( niluuid );
1547 
1548  SCH_SHEET_LIST sheetList = Schematic().GetSheets();
1550  SCH_ITEM* lastItem = sheetList.GetItem( lastBrightenedItemID, &dummy );
1551 
1552  if( lastItem && lastItem != aItem )
1553  {
1554  lastItem->ClearBrightened();
1555 
1556  UpdateItem( lastItem );
1557  lastBrightenedItemID = niluuid;
1558  }
1559 
1560  if( aItem )
1561  {
1562  aItem->SetBrightened();
1563 
1564  UpdateItem( aItem );
1565  lastBrightenedItemID = aItem->m_Uuid;
1566 
1567  FocusOnLocation( aItem->GetFocusPosition() );
1568  }
1569 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
KIID niluuid(0)
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr)
Fetch a SCH_ITEM by ID.
virtual const wxPoint GetFocusPosition() const
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: eda_item.h:307
void SetBrightened()
Definition: eda_item.h:178
void ClearBrightened()
Definition: eda_item.h:181
Definition: kiid.h:44
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const KIID m_Uuid
Definition: eda_item.h:523
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194

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

Referenced by HardRedraw(), DIALOG_ERC::OnCancelClick(), 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 785 of file eda_draw_frame.cpp.

786 {
787  bool centerView = false;
788  BOX2D r = GetCanvas()->GetView()->GetViewport();
789 
790  // Center if we're off the current view, or within 10% of its edge
791  r.Inflate( - (int) r.GetWidth() / 10 );
792 
793  if( !r.Contains( aPos ) )
794  centerView = true;
795 
796  // Center if we're behind an obscuring dialog, or within 10% of its edge
797  wxWindow* dialog = findDialog( GetChildren() );
798 
799  if( dialog )
800  {
801  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
802  dialog->GetSize() );
803  dialogRect.Inflate( dialogRect.GetWidth() / 10 );
804 
805  if( dialogRect.Contains( (wxPoint) GetCanvas()->GetView()->ToScreen( aPos ) ) )
806  centerView = true;
807  }
808 
809  if( centerView )
810  {
811  // If a dialog partly obscures the window, then center on the uncovered area.
812  if( dialog )
813  {
814  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
815  dialog->GetSize() );
816  GetCanvas()->GetView()->SetCenter( aPos, dialogRect );
817  }
818  else
819  GetCanvas()->GetView()->SetCenter( aPos );
820  }
821 
823 }
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:519
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return 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)
Set the center point of the VIEW (i.e.
Definition: view.cpp:585
coord_type GetWidth() const
Definition: box2.h:197
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:151
wxWindow * findDialog(wxWindowList &aList)
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move 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:302

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 PCB_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 580 of file eda_base_frame.h.

581  {
582  return wxT( "_autosave-" );
583  }

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

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 190 of file eda_base_frame.h.

190 { 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 572 of file eda_base_frame.h.

573  {
574  return wxT( "-bak" );
575  }

◆ 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 271 of file sch_base_frame.cpp.

272 {
273  return static_cast<SCH_DRAW_PANEL*>( EDA_DRAW_FRAME::GetCanvas() );
274 }
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::AssignFootprints(), SCH_EDIT_TOOL::BreakWire(), SCH_BASE_FRAME::CenterScreen(), SYMBOL_VIEWER_FRAME::ClickOnCmpList(), SCH_BASE_FRAME::CommonSettingsChanged(), SYMBOL_EDIT_FRAME::CommonSettingsChanged(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), DeleteAnnotation(), DisplayCurrentSheet(), SYMBOL_VIEWER_FRAME::doCloseWindow(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EE_SELECTION_TOOL::doSelectionMenu(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), SCH_EDITOR_CONTROL::EnterSheet(), DIALOG_ERC::ExcludeMarker(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_EDITOR_CONTROL::FindNext(), GetDocumentExtents(), SCH_BASE_FRAME::GetRenderSettings(), SCH_BASE_FRAME::HardRedraw(), HardRedraw(), SCH_EDITOR_CONTROL::ImportFPAssignments(), KiwayMailIn(), SCH_EDITOR_CONTROL::LeaveSheet(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), DIALOG_MIGRATE_BUSES::onAcceptClicked(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_ERC::OnEraseDrcMarkersClick(), DIALOG_ERC::OnERCItemRClick(), EE_SELECTION_TOOL::OnIdle(), DIALOG_MIGRATE_BUSES::onItemSelected(), OnModify(), OnPageSettingsChange(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), HIERARCHY_NAVIG_DLG::onSelectSheetPath(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), SYMBOL_TREE_PANE::onUpdateUI(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_EDIT_TOOL::Properties(), PutDataInPreviousState(), ReannotateFromPCBNew(), SYMBOL_EDIT_FRAME::RebuildView(), RecalculateConnections(), RecomputeIntersheetRefs(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), SCH_EDITOR_CONTROL::Redo(), DIALOG_ERC::redrawDrawPanel(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RefreshSelection(), SCH_EDITOR_CONTROL::RemapSymbols(), SCH_BASE_FRAME::RemoveFromScreen(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::rescueProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), RollbackSchematicFromUndo(), EE_SELECTION_TOOL::selectMultiple(), SYMBOL_EDIT_FRAME::SetCurPart(), SetCurrentSheet(), EE_POINT_EDITOR::setEditedPoint(), SetScreen(), SYMBOL_VIEWER_FRAME::SetSelectedLibrary(), SYMBOL_VIEWER_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), setupTools(), SYMBOL_EDITOR_CONTROL::ShowElectricalTypes(), ShowSchematicSetupDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDIT_FRAME::SwitchCanvas(), SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME(), 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_SETUP_FORMATTING::TransferDataFromWindow(), PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow(), PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SCH_EDITOR_CONTROL::UpdateFind(), SCH_BASE_FRAME::UpdateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), SCH_BASE_FRAME::UpdateStatusBar(), UpdateSymbolFromEditor(), and SYMBOL_VIEWER_FRAME::~SYMBOL_VIEWER_FRAME().

◆ GetColorSettings()

COLOR_SETTINGS * SCH_BASE_FRAME::GetColorSettings ( ) const
overridevirtualinherited

Returns a pointer to the active color theme settings.

Reimplemented from EDA_DRAW_FRAME.

Reimplemented in SYMBOL_EDIT_FRAME.

Definition at line 420 of file sch_base_frame.cpp.

421 {
422  if( !m_colorSettings )
423  {
424  SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
425  EESCHEMA_SETTINGS* cfg = settingsManager.GetAppSettings<EESCHEMA_SETTINGS>();
426  COLOR_SETTINGS* colorSettings = settingsManager.GetColorSettings( cfg->m_ColorTheme );
427 
428  const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = colorSettings;
429  }
430 
431  return m_colorSettings;
432 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
AppSettings * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * m_colorSettings
The current canvas type.
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:176

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

Referenced by SCH_BASE_FRAME::GetDrawBgColor(), SCH_BASE_FRAME::GetLayerColor(), SCH_PRINTOUT::PrintPage(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow(), and DIALOG_SHEET_PROPERTIES::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 1572 of file sch_edit_frame.cpp.

1573 {
1574  return Schematic().GetFileName();
1575 }
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:119
SCHEMATIC & Schematic() const

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

Referenced by OpenProjectFiles().

◆ GetCurrentSelection()

SELECTION & SCH_EDIT_FRAME::GetCurrentSelection ( )
overridevirtual

Get the current selection from the canvas area.

Returns
the current selection.

Reimplemented from TOOLS_HOLDER.

Definition at line 1578 of file sch_edit_frame.cpp.

1579 {
1580  return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1581 }
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157

References TOOL_MANAGER::GetTool(), and TOOLS_HOLDER::m_toolManager.

◆ GetCurrentSheet()

SCH_SHEET_PATH & SCH_EDIT_FRAME::GetCurrentSheet ( ) const

Definition at line 557 of file sch_edit_frame.cpp.

558 {
559  return m_schematic->CurrentSheet();
560 }
SCHEMATIC * m_schematic
The currently loaded schematic.
SCH_SHEET_PATH & CurrentSheet() const
Definition: schematic.h:127

References SCHEMATIC::CurrentSheet(), and m_schematic.

Referenced by AddItemToScreenAndUndoList(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), AnnotateComponents(), AppendSchematic(), CheckAnnotate(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::createPSFile(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), DeleteAnnotation(), DisplayCurrentSheet(), doCloseWindow(), SCH_EDITOR_CONTROL::doCopy(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editFieldText(), SCH_EDIT_TOOL::EditPageNumber(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_EDITOR_CONTROL::FindNext(), FixupJunctions(), SCH_PIN::GetMsgPanelInfo(), SCH_COMPONENT::GetMsgPanelInfo(), GetScreen(), GetScreenDesc(), GetUniqueFilenameForCurrentSheet(), HardRedraw(), SCH_EDITOR_CONTROL::HasMatch(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), SCH_NAVIGATE_TOOL::HypertextCommand(), importFile(), SCH_DRAWING_TOOLS::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), DIALOG_ERC::OnERCItemSelected(), DIALOG_MIGRATE_BUSES::onItemSelected(), SCH_PRINTOUT::OnPrintPage(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), SCH_EDIT_TOOL::Properties(), ReannotateFromPCBNew(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), DIALOG_PLOT_SCHEMATIC::restoreEnvironment(), SaveEEFile(), SelectUnit(), SetCurrentSheet(), SetSheetNumberAndCount(), setupUIConditions(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), SCH_EDITOR_CONTROL::UpdateFind(), HIERARCHY_NAVIG_DLG::UpdateHierarchyTree(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and UpdateTitle().

◆ GetDefaults()

SCHEMATIC_SETTINGS& SCH_BASE_FRAME::GetDefaults ( )
inlineinherited

Definition at line 121 of file sch_base_frame.h.

122  {
123  return *m_defaults;
124  }
SCHEMATIC_SETTINGS * m_defaults

References SCH_BASE_FRAME::m_defaults.

◆ GetDocumentExtents()

const BOX2I SCH_EDIT_FRAME::GetDocumentExtents ( bool  aIncludeAllVisible = true) const
overridevirtual

Returns bbox of document with option to not include some items.

Used most commonly by "Zoom to Fit" and "Zoom to Objects". In Eeschema for "Zoom to Fit", it's passed "true" to include worksheet border. It's passed false by "Zoom To Objects" to ignore worksheet border. In Pcbnew, false makes it ignore any items outside the PCB edge such as fabrication notes.

Parameters
aIncludeAllVisibleTrue to include everything visible in bbox calculations, false to ignore some visible items (program dependent).
Returns
Bounding box of the document (ignoring some items as requested).

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1440 of file sch_edit_frame.cpp.

1441 {
1442  BOX2I bBoxDoc;
1443 
1444  if( aIncludeAllVisible )
1445  {
1446  // Get the whole page size and return that
1447  int sizeX = GetScreen()->GetPageSettings().GetWidthIU();
1448  int sizeY = GetScreen()->GetPageSettings().GetHeightIU();
1449  bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
1450  }
1451  else
1452  {
1453  // Get current worksheet in a form we can compare to an EDA_ITEM
1455  EDA_ITEM* currWsAsItem = static_cast<EDA_ITEM*>( currWs );
1456 
1457  // Need an EDA_RECT so the first ".Merge" sees it's uninitialized
1458  EDA_RECT bBoxItems;
1459 
1460  // Calc the bounding box of all items on screen except the page border
1461  for( EDA_ITEM* item : GetScreen()->Items() )
1462  {
1463  if( item != currWsAsItem ) // Ignore the worksheet itself
1464  {
1465  if( item->Type() == SCH_COMPONENT_T )
1466  {
1467  // For symbols we need to get the bounding box without invisible text
1468  SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
1469  bBoxItems.Merge( symbol->GetBoundingBox( false ) );
1470  }
1471  else
1472  bBoxItems.Merge( item->GetBoundingBox() );
1473  }
1474  bBoxDoc = bBoxItems;
1475  }
1476  }
1477  return bBoxDoc;
1478 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
WS_PROXY_VIEW_ITEM * GetWorksheet() const
Definition: sch_view.h:97
VECTOR2< int > VECTOR2I
Definition: vector2d.h:630
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:181
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
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.
Handle the component boundary box.
Definition: eda_rect.h:42
Schematic symbol object.
Definition: sch_component.h:79
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148

References SCH_COMPONENT::GetBoundingBox(), SCH_BASE_FRAME::GetCanvas(), SCH_SCREEN::GetPageSettings(), GetScreen(), SCH_DRAW_PANEL::GetView(), KIGFX::SCH_VIEW::GetWorksheet(), EDA_RECT::Merge(), and SCH_COMPONENT_T.

◆ GetDoImmediateActions()

bool TOOLS_HOLDER::GetDoImmediateActions ( ) const
inlineinherited

Indicate 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 128 of file tools_holder.h.

128 { return m_immediateActions; }
bool m_immediateActions
Definition: tools_holder.h:170

References TOOLS_HOLDER::m_immediateActions.

◆ GetDragAction()

MOUSE_DRAG_ACTION TOOLS_HOLDER::GetDragAction ( ) const
inlineinherited

Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects.

Definition at line 134 of file tools_holder.h.

134 { return m_dragAction; }
MOUSE_DRAG_ACTION m_dragAction
Definition: tools_holder.h:174

References TOOLS_HOLDER::m_dragAction.

Referenced by PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), and PCB_SELECTION_TOOL::Main().

◆ GetDrawBgColor()

COLOR4D SCH_BASE_FRAME::GetDrawBgColor ( ) const
overridevirtualinherited

Reimplemented from EDA_DRAW_FRAME.

Definition at line 435 of file sch_base_frame.cpp.

436 {
438 }
COLOR_SETTINGS * GetColorSettings() const override
Returns a pointer to the active color theme settings.
COLOR4D GetColor(int aLayer) const

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

Referenced by SCH_PRINTOUT::PrintPage().

◆ 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 initialization 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 780 of file eda_base_frame.cpp.

782 {
783  if( !aFileHistory )
784  aFileHistory = m_fileHistory;
785 
786  wxASSERT( aFileHistory );
787 
788  int baseId = aFileHistory->GetBaseId();
789 
790  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
791 
792  unsigned i = cmdId - baseId;
793 
794  if( i < aFileHistory->GetCount() )
795  {
796  wxString fn = aFileHistory->GetHistoryFile( i );
797 
798  if( wxFileName::FileExists( fn ) )
799  return fn;
800  else
801  {
802  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
803  wxMessageBox( msg );
804 
805  aFileHistory->RemoveFileFromHistory( i );
806  }
807  }
808 
809  // Update the menubar to update the file history menu
810  if( GetMenuBar() )
811  {
812  ReCreateMenuBar();
813  GetMenuBar()->Refresh();
814  }
815 
816  return wxEmptyString;
817 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#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

Get the frame's main file history.

Returns
the main file history

Definition at line 403 of file eda_base_frame.h.

404  {
405  return *m_fileHistory;
406  }
FILE_HISTORY * m_fileHistory

References EDA_BASE_FRAME::m_fileHistory.

Referenced by KICAD_MANAGER_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

◆ GetFindHistoryList()

wxArrayString& EDA_DRAW_FRAME::GetFindHistoryList ( )
inlineinherited

Definition at line 94 of file eda_draw_frame.h.

94 { 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 826 of file sch_edit_frame.cpp.

827 {
828  if( m_findReplaceDialog && m_findReplaceDialog->IsVisible()
829  && !m_findReplaceData->GetFindString().IsEmpty() )
830  {
831  return m_findReplaceData;
832  }
833 
834  return nullptr;
835 }
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 357 of file sch_edit_frame.h.

358  {
359  return m_highlightedConn;
360  }
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(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and UpdateNetHighlightStatus().

◆ GetInfoBar()

◆ 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 479 of file sch_edit_frame.cpp.

480 {
481  return Schematic().GetSheets().GetItem( aId );
482 }
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
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 402 of file sch_base_frame.cpp.

403 {
404  return GetColorSettings()->GetColor( aLayer );
405 }
COLOR_SETTINGS * GetColorSettings() const 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 
)