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 KIWAY_HOLDER

Public Types

typedef std::vector< COMPONENT_SELECTIONHISTORY_LIST
 

Public Member Functions

 SCH_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
 ~SCH_EDIT_FRAME ()
 
SCH_SCREENGetScreen () const override
 Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives. More...
 
void OnCloseWindow (wxCloseEvent &Event)
 
bool GetForceHVLines () const
 
void SetForceHVLines (bool aForceHVdirection)
 
bool GetShowAllPins () const
 
void SetShowAllPins (bool aEnable)
 
const wxString GetNetListFormatName () const
 
void SetNetListFormatName (const wxString &aFormat)
 
bool GetSpiceAjustPassiveValues () const
 
void SetSpiceAjustPassiveValues (bool aEnable)
 
const wxString & GetPlotDirectoryName () const
 accessor to the destination directory to use when generating plot files. More...
 
void SetPlotDirectoryName (const wxString &aDirName)
 
void Process_Special_Functions (wxCommandEvent &event)
 
void Process_Config (wxCommandEvent &event)
 
void OnSelectTool (wxCommandEvent &aEvent)
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Function GeneralControl performs application specific control using aDC at aPosition in logical units. More...
 
PARAM_CFG_ARRAYGetProjectFileParametersList ()
 Return the project file parameter list for Eeschema. More...
 
void SaveProjectSettings (bool aAskForSave) override
 Save changes to the project settings to the project (.pro) file. More...
 
bool LoadProjectFile ()
 Loads the KiCad project file (*.pro) settings specific to Eeschema. More...
 
int AddTemplateFieldName (const TEMPLATE_FIELDNAME &aFieldName)
 Insert or append a wanted symbol field name into the field names template. More...
 
const TEMPLATE_FIELDNAMESGetTemplateFieldNames ()
 Return a template field names list for read only access. More...
 
const TEMPLATESGetTemplates ()
 Return the field names template for read only access. More...
 
void DeleteAllTemplateFieldNames ()
 Remove all template field names. More...
 
PARAM_CFG_ARRAYGetConfigurationSettings ()
 Return the Eeschema applications settings. More...
 
void LoadSettings (wxConfigBase *aCfg) override
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 
void CreateScreens ()
 
void ReCreateHToolbar () override
 
void ReCreateVToolbar () override
 
void ReCreateOptToolbar ()
 
void ReCreateMenuBar () override
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 > More...
 
bool OnHotKey (wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
 
void OnModify ()
 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...
 
virtual wxString GetScreenDesc () const override
 
void InstallConfigFrame (wxCommandEvent &event)
 
virtual void ExecuteRemoteCommand (const char *cmdline) override
 Execute a remote command send by Pcbnew via a socket, port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243) this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
void OnLeftClick (wxDC *aDC, const wxPoint &aPosition) override
 
void OnLeftDClick (wxDC *aDC, const wxPoint &aPosition) override
 Function OnLeftDClick called on a double click event from the drawpanel mouse handler if an editable item is found (text, component) Call the suitable dialog editor. More...
 
bool OnRightClick (const wxPoint &aPosition, wxMenu *PopMenu) override
 
void OnSelectOptionToolbar (wxCommandEvent &event)
 
double BestZoom () override
 Return the zoom level which displays the full page on screen. More...
 
SCH_ITEMLocateAndShowItem (const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0, bool *clarifySelectionMenuCancelled=nullptr)
 Check the schematic at aPosition in logical (drawing) units for a item matching the types in aFilterList. More...
 
SCH_ITEMLocateItem (const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0)
 Check for items at aPosition matching the types in aFilterList. More...
 
bool DeleteItemAtCrossHair (wxDC *aDC)
 Delete the item found under the cross hair. More...
 
bool HighlightConnectionAtPosition (wxPoint aPosition)
 Highlight the connection found at aPosition. More...
 
SCH_ITEMFindComponentAndItem (const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText, bool aWarpMouse)
 Finds a component in the schematic and an item in this component. More...
 
bool BreakSegment (SCH_LINE *aSegment, const wxPoint &aPoint, bool aAppend=false, SCH_LINE **aNewSegment=NULL)
 Breaks a single segment into two at the specified point. More...
 
bool BreakSegments (const wxPoint &aPoint, bool aAppend=false)
 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 (bool aApped=false)
 Tests all junctions and bus entries in the schematic for intersections with wires and buses and breaks any intersections into multiple segments. 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 eeschema for highlighting. More...
 
NETLIST_OBJECT_LISTBuildNetListBase (bool updateStatusText=true)
 Create a flat list which stores all connected objects. More...
 
bool CreateNetlist (int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL, bool silent=false)
 Create a netlist for the current schematic. More...
 
bool WriteNetListFile (NETLIST_OBJECT_LIST *aConnectedItemsList, int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
 Create a netlist file. More...
 
void DeleteAnnotation (bool aCurrentSheetOnly)
 Clear the current component annotation. More...
 
void AnnotateComponents (bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, REPORTER &aReporter)
 Annotate the components in the schematic that are not currently annotated. More...
 
int CheckAnnotate (REPORTER &aReporter, bool aOneSheetOnly)
 Check for annotation errors. More...
 
int ModalAnnotate (const wxString &aMessage)
 Run a modal version of the Annotate dialog for a specific purpose. More...
 
SCH_SHEET_PATHGetCurrentSheet ()
 
void SetCurrentSheet (const SCH_SHEET_PATH &aSheet)
 
void DisplayCurrentSheet ()
 Draw the current sheet on the display. More...
 
bool SetCurrentSheetHighlightFlags ()
 Set or reset the BRIGHTENED of connected objects inside the current sheet, according to the highlighted net name. More...
 
wxString GetUniqueFilenameForCurrentSheet ()
 
void SetSheetNumberAndCount ()
 Set the m_ScreenNumber and m_NumberOfScreens members for screens. More...
 
void OnPrint (wxCommandEvent &event)
 Show the print dialog. More...
 
wxPageSetupDialogData & GetPageSetupData ()
 
void SetPreviewPosition (const wxPoint &aPoint)
 
void SetPreviewSize (const wxSize &aSize)
 
const wxPointGetPreviewPosition ()
 
const wxSize & GetPreviewSize ()
 
void SetPrintDialogPosition (const wxPoint &aPoint)
 
void SetPrintDialogSize (const wxSize &aSize)
 
const wxPointGetPrintDialogPosition ()
 
const wxSize & GetPrintDialogSize ()
 
bool GetPrintMonochrome ()
 
void SetPrintMonochrome (bool aMonochrome)
 
bool GetPrintSheetReference ()
 
void SetPrintSheetReference (bool aShow)
 
void PlotSchematic (wxCommandEvent &event)
 
void Save_File (wxCommandEvent &event)
 
void OnSaveProject (wxCommandEvent &aEvent)
 Command event handler to save the entire project and create a component library archive. More...
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 
bool AppendSchematic ()
 Import a KiCad schematic into the current page. More...
 
bool LoadCmpToFootprintLinkFile ()
 Loads a .cmp file from CvPcb and update the footprint field of components. More...
 
bool ProcessCmpToFootprintLinkFile (const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
 Read the footprint info from each line in the stuff file by reference designator. More...
 
bool SaveEEFile (SCH_SCREEN *aScreen, bool aSaveUnderNewName=false, bool aCreateBackupFile=CREATE_BACKUP_FILE)
 Save aScreen to a schematic file. More...
 
bool IsSearchCacheObsolete (const SCH_FIND_REPLACE_DATA &aSearchCriteria)
 
bool AskToSaveChanges ()
 Checks if any of the screens has unsaved changes and asks the user whether to save or drop them. More...
 
bool EditSheet (SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
 Edit an existing sheet or add a new sheet to the schematic. More...
 
wxPoint GetLastSheetPinPosition () const
 
void DeleteItem (SCH_ITEM *aItem, bool aAppend=false)
 Remove aItem from the current screen and saves it in the undo list. More...
 
void DeleteItemsInList (PICKED_ITEMS_LIST &aItemsList, bool aAppend=false)
 Removes all items (and unused junctions that connect to them) and saves each in the undo list. More...
 
void DeleteJunction (SCH_ITEM *aItem, bool aAppend=false)
 Removes a given junction and heals any wire segments under the junction. More...
 
void CheckListConnections (PICKED_ITEMS_LIST &aItemsList, bool aAppend=false)
 Adds junctions if needed to each item in the list after they have been moved. More...
 
int GetLabelIncrement () const
 
void OrientComponent (COMPONENT_ORIENTATION_T aOrientation=CMP_NORMAL)
 Rotate and mirror a component. More...
 
void SaveCopyInUndoList (SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Create a copy of the current schematic item, and put it in the undo list. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Create a new entry in undo list of commands. More...
 
void Key (wxDC *DC, int hotkey, EDA_ITEM *DrawStruct)
 
void InitBlockPasteInfos () override
 Initialize the parameters used by the block paste command. More...
 
virtual int BlockCommand (EDA_KEY aKey) override
 Return the block command internal code (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse. More...
 
virtual void HandleBlockPlace (wxDC *DC) override
 Call after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place. More...
 
virtual bool HandleBlockEnd (wxDC *aDC) override
 Handle the "end" of a block command, i.e. More...
 
void RepeatDrawItem (wxDC *DC)
 Repeat the last item placement if the last item was a bus, bus entry, label, or component. More...
 
void SetRepeatItem (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...
 
void SetUndoItem (const SCH_ITEM *aItem)
 Clone aItem which can be used to restore the state of the item being edited when the user cancels the editing in progress. More...
 
SCH_ITEMGetUndoItem () const
 
void SaveUndoItemInUndoList (SCH_ITEM *aItem)
 Swap the cloned item in member variable m_undoItem with aItem and saves it to the undo list then swap the data back. 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...
 
bool rescueProject (RESCUER &aRescuer, bool aRunningOnDemand)
 Perform rescue operations to recover old projects from before certain changes were made. More...
 
bool RescueLegacyProject (bool aRunningOnDemand)
 
bool RescueSymbolLibTableProject (bool aRunningOnDemand)
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL) override
 Plot or print the current sheet to the clipboard. More...
 
void SetSimulatorCommand (const wxString &aCommand)
 
wxString GetSimulatorCommand () const
 
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 doUpdatePcb (const wxString &aUpdateOptions="")
 Updates netlist and sends it to pcbnew. More...
 
int GetIconScale () override
 Function GetIconScale. More...
 
void SetIconScale (int aScale) override
 Function SetIconScale. More...
 
const wxPoint GetRepeatStep () const
 
void SetRepeatStep (const wxPoint &aStep)
 Sets the repeat step value for repeat command. More...
 
int GetRepeatDeltaLabel () const
 
void SetRepeatDeltaLabel (int aDelta)
 Sets the repeat delta label value for repeat command. More...
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
COLOR4D GetDrawBgColor () const override
 
void SetDrawBgColor (COLOR4D aColor) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Function UpdateStatusBar updates the status bar information. More...
 
COMPONENT_SELECTION SelectComponentFromLibrary (const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
virtual void OnEditSymbolLibTable (wxCommandEvent &aEvent)
 
LIB_ALIASGetLibAlias (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 Load symbol from symbol library table. More...
 
LIB_PARTGetLibPart (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 Function IsGridVisible() , virtual. More...
 
virtual void SetGridVisibility (bool aVisible)
 Function SetGridVisibility() , virtual It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 Function GetGridColor() , virtual. More...
 
virtual void SetGridColor (COLOR4D aColor)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnActivate (wxActivateEvent &event)
 Function OnActivate (virtual) is called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Function SyncMenusAndToolbars Updates the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static wxString GetDefaultFieldName (int aFieldNdx)
 Return a default symbol field name for field aFieldNdx for all components. More...
 

Static Public Attributes

static const wxCursor CURSOR_PROBE
 

Probe cursor, used by circuit simulator

More...
 
static const wxCursor CURSOR_TUNE
 

Tuner cursor, used by circuit simulator

More...
 

Protected Member Functions

const wxSize & GetLastSheetPinTextSize ()
 Initializing accessor for the pin text size. More...
 
virtual bool doAutoSave () override
 Save the schematic files that have been modified and not yet saved. More...
 
virtual bool isAutoSaveRequired () const override
 Returns true if the schematic has been modified. More...
 
void addCurrentItemToList (bool aRedraw=true)
 Add the item currently being edited to the schematic and adds the changes to the undo/redo container. More...
 
void updateFindReplaceView (wxFindDialogEvent &aEvent)
 
void backAnnotateFootprints (const std::string &aChangedSetOfReferences)
 
bool prepareForNetlist ()
 Verify that annotation is complete so that a proper netlist is even possible. More...
 
void sendNetlist ()
 Send the kicad netlist over to CVPCB. More...
 
void OnOpenLibraryViewer (wxCommandEvent &event)
 Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (wxString &aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Select a component from the list of components in a library. More...
 
wxString SelectLibraryFromList ()
 Dispaly a list of loaded libraries in the symbol library and allows the user to select a library. More...
 
bool SelectPartNameToLoad (wxString &aLibrary, wxString &aBufName)
 Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a library. More...
 
bool saveSymbolLibTables (bool aGlobal, bool aProject)
 Saves Symbol Library Tables to disk. More...
 
void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
virtual void unitsChangeRefresh ()
 Function unitsChangeRefresh is 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...
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting () const
 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...
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

TEMPLATES m_TemplateFieldNames
 
wxPoint m_repeatStep
 the increment value of the position of an item when it is repeated More...
 
int m_repeatDeltaLabel
 the increment value of labels like bus members when they are repeated More...
 
wxSocketServer * m_socketServer
 
std::vector< wxSocketBase * > m_sockets
 interprocess communication More...
 
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
 prevents opening same file multiple times. More...
 
EDA_HOTKEY_CONFIGm_hotkeysDescrList
 
int m_LastGridSizeId
 
bool m_drawGrid
 
bool m_showPageLimits
 true to display the page limits More...
 
COLOR4D m_gridColor
 Grid color. More...
 
COLOR4D m_drawBgColor
 the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema More...
 
double m_zoomLevelCoeff
 a suitable value to convert the internal zoom scaling factor More...
 
int m_UndoRedoCountMax
 default Undo/Redo command Max depth, to be handed More...
 
EDA_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
long m_firstRunDialogSetting
 Key to control whether first run dialog is shown on startup. More...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. More...
 
wxAuiToolBar * m_auxiliaryToolBar
 Auxiliary tool bar typically shown below the main tool bar at the top of the main window. More...
 
wxAuiToolBar * m_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
wxAuiToolBar * m_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
bool m_canvasTypeDirty
 Flag indicating that drawing canvas type needs to be saved to config. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

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...
 
static const wxChar CANVAS_TYPE_KEY [] = wxT( "canvas_type" )
 

Key in KifaceSettings to store the canvas type.

More...
 

Private Member Functions

void OnAutoplaceFields (wxCommandEvent &aEvent)
 Handle the ID_AUTOPLACE_FIELDS event. More...
 
void OnMoveItem (wxCommandEvent &aEvent)
 Handle the ID_SCH_MOVE_ITEM event used to move schematic items. More...
 
void OnRotate (wxCommandEvent &aEvent)
 Handle the ID_SCH_ROTATE_CLOCKWISE and ID_SCH_ROTATE_COUNTERCLOCKWISE events used to rotate schematic items and blocks. More...
 
void OnEditItem (wxCommandEvent &aEvent)
 Handle the ID_SCH_EDIT_ITEM event used to edit schematic items. More...
 
void SelectAllFromSheet (wxCommandEvent &aEvent)
 Handle the ID_POPUP_SCH_SELECT_ON_PCB event used to select items in Pcbnew based on the sheet they are placed on. More...
 
void OnDragItem (wxCommandEvent &aEvent)
 Handle the ID_SCH_DRAG_ITEM event used to drag schematic items. More...
 
void OnOrient (wxCommandEvent &aEvent)
 Handle the ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, and ID_SCH_ORIENT_NORMAL events used to orient schematic items and blocks. More...
 
void OnExit (wxCommandEvent &event)
 
void OnAnnotate (wxCommandEvent &event)
 
void OnErc (wxCommandEvent &event)
 
void OnCreateNetlist (wxCommandEvent &event)
 
void OnUpdatePCB (wxCommandEvent &event)
 
void OnSimulate (wxCommandEvent &event)
 
void OnCreateBillOfMaterials (wxCommandEvent &event)
 
void OnLaunchBomManager (wxCommandEvent &event)
 
void OnFindItems (wxCommandEvent &event)
 
void OnFindDialogClose (wxFindDialogEvent &event)
 
void OnFindDrcMarker (wxFindDialogEvent &event)
 
void OnFindCompnentInLib (wxFindDialogEvent &event)
 
void OnFindSchematicItem (wxFindDialogEvent &aEvent)
 Find an item in the schematic matching the search criteria in aEvent. More...
 
void OnFindReplace (wxFindDialogEvent &aEvent)
 Perform a search and replace of text in an item in the schematic matching the search and replace criteria in aEvent. More...
 
void OnLoadFile (wxCommandEvent &event)
 
void OnLoadCmpToFootprintLinkFile (wxCommandEvent &event)
 
void OnUpdateFields (wxCommandEvent &event)
 
void OnNewProject (wxCommandEvent &event)
 
void OnLoadProject (wxCommandEvent &event)
 
void OnAppendProject (wxCommandEvent &event)
 
void OnImportProject (wxCommandEvent &event)
 
void OnOpenPcbnew (wxCommandEvent &event)
 
void OnOpenPcbModuleEditor (wxCommandEvent &event)
 
void OnOpenCvpcb (wxCommandEvent &event)
 
void OnOpenLibraryEditor (wxCommandEvent &event)
 
void OnRescueProject (wxCommandEvent &event)
 
void OnRemapSymbols (wxCommandEvent &aEvent)
 
void OnEditComponentSymbolsId (wxCommandEvent &aEvent)
 
void OnPreferencesOptions (wxCommandEvent &event)
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
void OnCancelCurrentCommand (wxCommandEvent &aEvent)
 
void OnSelectItem (wxCommandEvent &aEvent)
 
void OnCopySchematicItemRequest (wxCommandEvent &event)
 Command event handler for duplicating the item at the current location. More...
 
void OnUpdatePaste (wxUpdateUIEvent &event)
 
void OnUpdateHiddenPins (wxUpdateUIEvent &event)
 
void OnUpdateBusOrientation (wxUpdateUIEvent &event)
 
void OnUpdateSelectTool (wxUpdateUIEvent &aEvent)
 
void OnUpdateSave (wxUpdateUIEvent &aEvent)
 
void OnUpdateSaveSheet (wxUpdateUIEvent &aEvent)
 
void OnUpdateHierarchySheet (wxUpdateUIEvent &aEvent)
 
void OnUpdateRemapSymbols (wxUpdateUIEvent &aEvent)
 
void UpdateTitle ()
 Set the main window title bar text. More...
 
SCH_BUS_WIRE_ENTRYCreateBusWireEntry ()
 
SCH_BUS_BUS_ENTRYCreateBusBusEntry ()
 
void SetBusEntryShape (wxDC *DC, SCH_BUS_ENTRY_BASE *BusEntry, char entry_shape)
 
SCH_NO_CONNECTAddNoConnect (const wxPoint &aPosition)
 Add no connect item to the current schematic sheet at aPosition. More...
 
SCH_JUNCTIONAddJunction (const wxPoint &aPosition, bool aPutInUndoList=false)
 Add a new junction at aPosition. More...
 
void SaveWireImage ()
 Save a copy of the current wire image in the undo list. More...
 
void GetSchematicConnections (std::vector< wxPoint > &aConnections)
 Collects a unique list of all possible connection points in the schematic. More...
 
bool SchematicCleanUp (bool aAppend=false)
 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, bool aAppend=true)
 If any single wire passes through both points, remove the portion between the two points, potentially splitting the wire into two. More...
 
void PrepareMoveItem (SCH_ITEM *aItem, wxDC *aDC)
 Start moving aItem using the mouse. More...
 
SCH_TEXTCreateNewText (wxDC *aDC, int aType)
 
void EditSchematicText (SCH_TEXT *TextStruct)
 
void ChangeTextOrient (SCH_TEXT *aTextItem)
 
void OnConvertTextType (wxCommandEvent &aEvent)
 Command event handler to change a text type to another one. More...
 
void BeginSegment (wxDC *DC, int type)
 Creates a new segment ( WIRE, BUS ) or terminates the current segment in progress. More...
 
void EndSegment ()
 Terminate a bus, wire, or line creation. More...
 
void DeleteCurrentSegment (wxDC *DC)
 Erase the last segment at the current mouse position. More...
 
void DeleteConnection (bool DeleteFullConnection)
 
void Edge (DRAWSEGMENT *Segment, wxDC *DC)
 
void SetNewWidth (DRAWSEGMENT *DrawSegm, wxDC *DC)
 
void Layer (DRAWSEGMENT *Segment, wxDC *DC)
 
DRAWSEGMENTBegin_Edge (DRAWSEGMENT *Segment, wxDC *DC)
 
SCH_BITMAPCreateNewImage (wxDC *aDC)
 
void MoveImage (SCH_BITMAP *aItem, wxDC *aDC)
 
void RotateImage (SCH_BITMAP *aItem)
 
void MirrorImage (SCH_BITMAP *aItem, bool Is_X_axis)
 Mirror a bitmap. More...
 
void EditImage (SCH_BITMAP *aItem)
 
void InstallHierarchyFrame (wxPoint &pos)
 
SCH_SHEETCreateSheet (wxDC *DC)
 
void ReSizeSheet (SCH_SHEET *Sheet, wxDC *DC)
 
void RotateHierarchicalSheet (SCH_SHEET *aSheet, bool aRotCCW)
 Rotate a sheet object. More...
 
void MirrorSheet (SCH_SHEET *aSheet, bool aFromXaxis)
 Mirror a hierarchical sheet. More...
 
bool LoadCacheLibrary (const wxString &aFileName)
 Loads the cache library associated to the aFileName. More...
 
int EditLine (SCH_LINE *aLine, bool aRedraw)
 Function EditLine displays the dialog for editing the parameters of aLine. More...
 
bool importFile (const wxString &aFileName, int aFileType)
 Load the given filename but sets the path to the current project path. More...
 
bool validateSheet (SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
 
SCH_SHEET_PINCreateSheetPin (SCH_SHEET *aSheet, wxDC *aDC)
 Create a new SCH_SHEET_PIN object and add it to aSheet at the current cursor position. More...
 
int EditSheetPin (SCH_SHEET_PIN *aSheetPin, bool aRedraw)
 Display the dialog for editing the parameters of aSheetPin. More...
 
SCH_SHEET_PINImportSheetPin (SCH_SHEET *aSheet, wxDC *aDC)
 Automatically create a sheet pin from the hierarchical labels in the schematic referenced by aSheet. More...
 
SCH_COMPONENTLoad_Component (wxDC *aDC, const SCHLIB_FILTER *aFilter, SCH_BASE_FRAME::HISTORY_LIST &aHistoryList, bool aUseLibBrowser)
 Load a symbol library and places it on the current schematic. More...
 
void EditComponent (SCH_COMPONENT *aComponent)
 Display the edit component dialog to edit the parameters of aComponent. More...
 
void OnSelectUnit (wxCommandEvent &aEvent)
 
void ConvertPart (SCH_COMPONENT *DrawComponent, wxDC *DC)
 
void SetInitCmp (SCH_COMPONENT *DrawComponent, wxDC *DC)
 
void EditComponentFieldText (SCH_FIELD *aField)
 Display the edit field dialog to edit the parameters of aField. More...
 
void RotateField (SCH_FIELD *aField)
 
void PasteListOfItems (wxDC *DC)
 Paste a list of items from the block stack. 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 GetSchematicFromRedoList (wxCommandEvent &event)
 Redo the last edition. More...
 
void GetSchematicFromUndoList (wxCommandEvent &event)
 Perform an undo the last edition. More...
 
void copyBlockItems (PICKED_ITEMS_LIST &aItemsList)
 Copy the list of block item. More...
 
void addJunctionMenuEntries (wxMenu *aMenu, SCH_JUNCTION *aJunction)
 Add the context menu items to aMenu for aJunction. More...
 

Private Attributes

SCH_SHEET_PATHm_CurrentSheet
 which sheet we are presently working on. More...
 
wxString m_DefaultSchematicFileName
 
wxString m_SelectedNetName
 
PARAM_CFG_ARRAY m_projectFileParams
 
PARAM_CFG_ARRAY m_configSettings
 
wxPageSetupDialogData m_pageSetupData
 
wxFindReplaceData * m_findReplaceData
 
wxPoint m_previewPosition
 
wxSize m_previewSize
 
wxPoint m_printDialogPosition
 
wxSize m_printDialogSize
 
bool m_printMonochrome
 Print monochrome instead of grey scale. More...
 
bool m_printSheetReference
 
DIALOG_ANNOTATEm_annotateDialog
 
DIALOG_SCH_FINDm_dlgFindReplace
 
wxPoint m_findDialogPosition
 
wxSize m_findDialogSize
 
wxArrayString m_findStringHistoryList
 
wxArrayString m_replaceStringHistoryList
 
BLOCK_SELECTOR m_blockItems
 List of selected items. More...
 
SCH_ITEMm_item_to_repeat
 Last item to insert by the repeat command. More...
 
int m_repeatLabelDelta
 Repeat label number increment step. More...
 
SCH_COLLECTOR m_collectedItems
 List of collected items. More...
 
SCH_FIND_COLLECTOR m_foundItems
 List of find/replace items. More...
 
SCH_ITEMm_undoItem
 Copy of the current item being edited. More...
 
wxString m_simulatorCommand
 Command line used to call the circuit simulator (gnucap, spice, ...) 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...
 
bool m_forceHVLines
 force H or V directions for wires, bus, line More...
 
bool m_autoplaceFields
 automatically place component fields More...
 
bool m_autoplaceJustify
 allow autoplace to change justification More...
 
bool m_autoplaceAlign
 align autoplaced fields to the grid More...
 
bool m_footprintPreview
 whether to show footprint previews More...
 
int m_foundItemIndex
 An index to the last find item in the found items list m_foundItems. More...
 
bool m_showAllPins
 Flag to indicate show hidden pins. More...
 
wxString m_plotDirectoryName
 The name of the destination directory to use when generating plot files. More...
 
wxString m_netListFormat
 The name of the format to use when generating a net list. More...
 
bool m_spiceAjustPassiveValues
 Use netcodes (net number) as net names when generating spice net lists. More...
 

Static Private Attributes

static PINSHEETLABEL_SHAPE m_lastSheetPinType = NET_INPUT
 Last sheet pin type. More...
 
static wxSize m_lastSheetPinTextSize
 Last sheet pin text size. More...
 
static wxPoint m_lastSheetPinPosition
 Last sheet pin position. More...
 

Detailed Description

Schematic editor (Eeschema) main window.

Definition at line 118 of file sch_edit_frame.h.

Member Typedef Documentation

typedef std::vector<COMPONENT_SELECTION> SCH_BASE_FRAME::HISTORY_LIST
inherited

Definition at line 171 of file sch_base_frame.h.

Constructor & Destructor Documentation

Definition at line 353 of file sch_edit_frame.cpp.

References g_Schematic_Hokeys_Descr, EDA_PANEINFO::HorizontalToolbarPane(), ID_EDIT_SYM_LIB_TABLE, ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_50, KiBitmap(), PCAD2KICAD::Left, EDA_PANEINFO::MessageToolbarPane(), NAMELESS_PROJECT, SCH_BASE_FRAME::OnEditSymbolLibTable(), PCAD2KICAD::Right, and EDA_PANEINFO::VerticalToolbarPane().

353  :
354  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
355  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
356  m_item_to_repeat( 0 )
357 {
358  m_showAxis = false; // true to show axis
359  m_showBorderAndTitleBlock = true; // true to show sheet references
362  m_DefaultSchematicFileName += wxT( ".sch" );
363  m_showAllPins = false;
364  m_previewPosition = wxDefaultPosition;
365  m_previewSize = wxDefaultSize;
366  m_printMonochrome = true;
367  m_printSheetReference = true;
368  SetShowPageLimits( true );
369  m_annotateDialog = nullptr;
371  m_dlgFindReplace = NULL;
372  m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
373  m_undoItem = NULL;
374  m_hasAutoSave = true;
375 
376  SetForceHVLines( true );
378 
379  // Give an icon
380  wxIcon icon;
381  icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );
382  SetIcon( icon );
383 
384  // Initialize grid id to the default value (50 mils):
385  const int default_grid = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
386  m_LastGridSizeId = default_grid;
387 
388  LoadSettings( config() );
389 
390  CreateScreens();
391 
392  // Ensure m_LastGridSizeId is an offset inside the allowed schematic grid range
393  if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
394  m_LastGridSizeId = default_grid;
395 
396  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
397 
398  if( m_canvas )
400 
401  ReCreateMenuBar();
405 
406  // Initialize common print setup dialog settings.
407  m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
408  m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
409  m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
410  m_pageSetupData.GetPrintData().SetNoCopies( 1 );
411 
412  m_auimgr.SetManagedWindow( this );
413 
414  EDA_PANEINFO horiz;
415  horiz.HorizontalToolbarPane();
416 
417  EDA_PANEINFO vert;
418  vert.VerticalToolbarPane();
419 
420  EDA_PANEINFO mesg;
421  mesg.MessageToolbarPane();
422 
423  if( m_mainToolBar )
424  m_auimgr.AddPane( m_mainToolBar,
425  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
426 
427  if( m_drawToolBar )
428  m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() );
429 
430  if( m_optionsToolBar )
431  m_auimgr.AddPane( m_optionsToolBar,
432  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
433 
434  if( m_canvas )
435  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
436 
437  if( m_messagePanel )
438  m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().
439  Layer(10) );
440 
441  m_auimgr.Update();
442 
443  Zoom_Automatique( false );
444 
445  // Net list generator
447 
448  Bind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this,
450 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
void ReCreateOptToolbar()
Definition: tool_sch.cpp:278
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)
virtual void OnEditSymbolLibTable(wxCommandEvent &aEvent)
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:108
void SetForceHVLines(bool aForceHVdirection)
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
wxString m_DefaultSchematicFileName
void Layer(DRAWSEGMENT *Segment, wxDC *DC)
wxFindReplaceData * m_findReplaceData
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
DIALOG_ANNOTATE * m_annotateDialog
#define SCH_EDIT_FRAME_NAME
wxAuiManager m_auimgr
Specialization of the wxAuiPaneInfo class for KiCad panels.
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:102
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
void ReCreateHToolbar() override
Definition: tool_sch.cpp:45
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:138
DIALOG_SCH_FIND * m_dlgFindReplace
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:81
wxPageSetupDialogData m_pageSetupData
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:141
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:118
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Class SCH_SHEET_PATH.
bool m_printMonochrome
Print monochrome instead of grey scale.
int m_LastGridSizeId
Definition: draw_frame.h:83
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:135
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
bool m_showAllPins
Flag to indicate show hidden pins.
bool m_printSheetReference
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
wxPoint m_previewPosition
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
SCH_ITEM * m_undoItem
Copy of the current item being edited.
void SetEnableBlockCommands(bool aEnable)
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
void SetShowPageLimits(bool aShow)
Definition: draw_frame.h:349
#define NAMELESS_PROJECT
default name for nameless projects
Definition: common.h:73
void SetSpiceAjustPassiveValues(bool aEnable)
void ReCreateVToolbar() override
Definition: tool_sch.cpp:190
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
SCH_EDIT_FRAME::~SCH_EDIT_FRAME ( )

Definition at line 453 of file sch_edit_frame.cpp.

References g_RootSheet, ID_EDIT_SYM_LIB_TABLE, and SCH_BASE_FRAME::OnEditSymbolLibTable().

454 {
455  Unbind( wxEVT_COMMAND_MENU_SELECTED, &SCH_EDIT_FRAME::OnEditSymbolLibTable, this,
457 
458  delete m_item_to_repeat; // we own the cloned object, see this->SetRepeatItem()
459 
460  SetScreen( NULL );
461 
462  delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
463  delete m_undoItem;
464  delete g_RootSheet;
465  delete m_findReplaceData;
466 
467  m_CurrentSheet = NULL;
468  m_undoItem = NULL;
469  g_RootSheet = NULL;
470  m_findReplaceData = NULL;
471 }
virtual void OnEditSymbolLibTable(wxCommandEvent &aEvent)
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:159
wxFindReplaceData * m_findReplaceData
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
SCH_ITEM * m_undoItem
Copy of the current item being edited.

Member Function Documentation

void SCH_EDIT_FRAME::addCurrentItemToList ( bool  aRedraw = true)
protected

Add the item currently being edited to the schematic and adds the changes to the undo/redo container.

Parameters
aRedraw= true (default) to redrw -the screen after adding the item.

Definition at line 1365 of file sch_edit_frame.cpp.

References SCH_SCREEN::Append(), SCH_SCREEN::CheckIfOnDrawList(), EDA_ITEM::ClearFlags(), p2t::cmp(), SCH_ITEM::GetConnectionPoints(), SCH_SCREEN::GetCurItem(), EDA_ITEM::GetParent(), i, SCH_ITEM::IsConnectable(), SCH_SCREEN::IsJunctionNeeded(), EDA_ITEM::IsNew(), SCH_COMPONENT_T, SCH_FIELD_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SCREEN::SetCurItem(), BASE_SCREEN::SetModify(), SCH_SCREEN::TestDanglingEnds(), EDA_ITEM::Type(), UR_CHANGED, and UR_NEW.

Referenced by CreateBusBusEntry(), CreateBusWireEntry(), OnLeftClick(), and Process_Special_Functions().

1366 {
1367  SCH_SCREEN* screen = GetScreen();
1368  SCH_ITEM* item = screen->GetCurItem();
1369 
1370  wxCHECK_RET( item != NULL, wxT( "Cannot add current item to list." ) );
1371 
1372  m_canvas->SetAutoPanRequest( false );
1373 
1374  SCH_ITEM* undoItem = item;
1375 
1376  if( item->Type() == SCH_SHEET_PIN_T )
1377  {
1378  SCH_SHEET* sheet = (SCH_SHEET*) item->GetParent();
1379 
1380  wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
1381  wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
1382 
1383  undoItem = sheet;
1384  }
1385 
1386  else if( item->Type() == SCH_FIELD_T )
1387  {
1388  SCH_COMPONENT* cmp = (SCH_COMPONENT*) item->GetParent();
1389 
1390  wxCHECK_RET( (cmp != NULL) && (cmp->Type() == SCH_COMPONENT_T),
1391  wxT( "Cannot place field in invalid schematic component object." ) );
1392 
1393  undoItem = cmp;
1394  }
1395 
1396  if( item->IsNew() )
1397  {
1398  if( item->Type() == SCH_SHEET_T )
1399  {
1400  // Fix the size and position of the new sheet using the last values set by
1401  // the m_mouseCaptureCallback function.
1402  m_canvas->SetMouseCapture( NULL, NULL );
1403 
1404  if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
1405  {
1406  screen->SetCurItem( NULL );
1407  delete item;
1408 
1409  if( aRedraw )
1410  GetCanvas()->Refresh();
1411 
1412  return;
1413  }
1414 
1416  }
1417 
1418  if( undoItem == item )
1419  {
1420  if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
1421  screen->Append( item );
1422 
1423  SetRepeatItem( item );
1424 
1425  SaveCopyInUndoList( undoItem, UR_NEW );
1426  }
1427  else
1428  {
1429  // Here, item is not a basic schematic item, but an item inside
1430  // a parent basic schematic item,
1431  // currently: sheet pin or component field.
1432  // currently, only a sheet pin can be found as new item,
1433  // because new component fields have a specific handling, and do not appears here
1434  SaveCopyInUndoList( undoItem, UR_CHANGED );
1435 
1436  if( item->Type() == SCH_SHEET_PIN_T )
1437  ( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
1438  else
1439  wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
1440  item->Type() );
1441  }
1442  }
1443  else
1444  {
1445  SaveUndoItemInUndoList( undoItem );
1446  }
1447 
1448  item->ClearFlags();
1449  screen->SetModify();
1450  screen->SetCurItem( NULL );
1451  m_canvas->SetMouseCapture( NULL, NULL );
1453 
1454  if( item->IsConnectable() )
1455  {
1456  std::vector< wxPoint > pts;
1457  item->GetConnectionPoints( pts );
1458  for( auto i = pts.begin(); i != pts.end(); i++ )
1459  {
1460  for( auto j = i + 1; j != pts.end(); j++ )
1461  TrimWire( *i, *j, true );
1462 
1463  if( screen->IsJunctionNeeded( *i, true ) )
1464  AddJunction( *i, true );
1465  }
1466  screen->TestDanglingEnds();
1467  }
1468 
1469  if( aRedraw )
1470  GetCanvas()->Refresh();
1471 }
SCH_JUNCTION * AddJunction(const wxPoint &aPosition, bool aPutInUndoList=false)
Add a new junction at aPosition.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
bool IsNew() const
Definition: base_struct.h:227
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:346
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:351
EDA_ITEM * GetParent() const
Definition: base_struct.h:219
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void SetRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
void SaveUndoItemInUndoList(SCH_ITEM *aItem)
Swap the cloned item in member variable m_undoItem with aItem and saves it to the undo list then swap...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:174
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item...
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
void SetAutoPanRequest(bool aEnable)
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
virtual void GetConnectionPoints(std::vector< wxPoint > &aPoints) const
Function GetConnectionPoints add all the connection points for this item to aPoints.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:140
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Definition: sch_screen.cpp:913
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
size_t i
Definition: json11.cpp:597
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd, bool aAppend=true)
If any single wire passes through both points, remove the portion between the two points...
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
bool EditSheet(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:45
bool cmp(const Point *a, const Point *b)
Definition: shapes.h:221
void SetModify()
Definition: base_screen.h:324
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
bool CheckIfOnDrawList(SCH_ITEM *st)
Definition: sch_screen.cpp:198
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
SCH_JUNCTION * SCH_EDIT_FRAME::AddJunction ( const wxPoint aPosition,
bool  aPutInUndoList = false 
)
private

Add a new junction at aPosition.

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

References SCH_SCREEN::Append(), BreakSegments(), GetScreen(), OnModify(), SaveCopyInUndoList(), SCH_SCREEN::TestDanglingEnds(), and UR_NEW.

Referenced by CheckListConnections(), EndSegment(), importFile(), OnLeftClick(), Process_Special_Functions(), and SetPrintSheetReference().

727 {
728  SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition );
729  SCH_SCREEN* screen = GetScreen();
730  bool broken_segments = false;
731 
732  screen->Append( junction );
733  broken_segments = BreakSegments( aPosition, aAppend );
734  screen->TestDanglingEnds();
735  OnModify();
736  SaveCopyInUndoList( junction, UR_NEW, broken_segments || aAppend );
737  return junction;
738 }
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
bool BreakSegments(const wxPoint &aPoint, bool aAppend=false)
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:140
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Definition: sch_screen.cpp:913
void SCH_EDIT_FRAME::addJunctionMenuEntries ( wxMenu *  aMenu,
SCH_JUNCTION aJunction 
)
private

Add the context menu items to aMenu for aJunction.

Parameters
aMenuThe menu to add the items to.
aJunctionThe SCH_JUNCTION object selected.

Definition at line 653 of file eeschema/onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), EXCLUDE_END_POINTS_T, g_Schematic_Hokeys_Descr, SCH_JUNCTION::GetPosition(), GetScreen(), SCH_SCREEN::GetWire(), SCH_SCREEN::GetWireOrBus(), HK_DELETE, ID_POPUP_SCH_BREAK_WIRE, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_DELETE_CONNECTION, ID_POPUP_SCH_DELETE_NODE, ID_SCH_DRAG_ITEM, SCH_COLLECTOR::IsDraggableJunction(), EDA_ITEM::IsNew(), KiBitmap(), and m_collectedItems.

Referenced by GetLabelIncrement(), and OnRightClick().

654 {
655  wxString msg;
656  SCH_SCREEN* screen = GetScreen();
657 
658  msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
659  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
660 
661  if( !aJunction->IsNew() )
662  {
664  AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
665 
666  if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
667  AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
668  KiBitmap( break_line_xpm ) );
669  }
670 
671  if( screen->GetWireOrBus( aJunction->GetPosition() ) )
672  {
673  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
674  KiBitmap( delete_node_xpm ) );
675  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
676  KiBitmap( delete_connection_xpm ) );
677  }
678 }
bool IsNew() const
Definition: base_struct.h:227
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
SCH_COLLECTOR m_collectedItems
List of collected items.
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
bool IsDraggableJunction() const
Function IsDraggableJunction tests to see if the collected items form a draggable junction...
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_junction.h:94
SCH_LINE * GetWire(const wxPoint &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T)
Definition: sch_screen.h:442
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
SCH_LINE * GetWireOrBus(const wxPoint &aPosition)
Return a wire or bus item located at aPosition.
Definition: sch_screen.cpp:953
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu.

Parameters
MasterMenuThe main menu. The sub menu list will be accessible from the menu item with id ID_KICAD_SELECT_ICONS_OPTIONS

Definition at line 693 of file eda_base_frame.cpp.

References AddMenuItem(), ID_KICAD_SELECT_ICONS_IN_MENUS, ID_KICAD_SELECT_ICONS_OPTIONS, KiBitmap(), and Pgm().

Referenced by EDA_BASE_FRAME::GetMruPath(), preparePreferencesMenu(), PL_EDITOR_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), and GERBVIEW_FRAME::ReCreateMenuBar().

694 {
695  wxMenu* menu = NULL;
696  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
697 
698  if( item ) // This menu exists, do nothing
699  return;
700 
701  menu = new wxMenu;
702 
703  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
704  _( "Icons in Menus" ), wxEmptyString,
705  wxITEM_CHECK ) );
706  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
707 
708  AddMenuItem( MasterMenu, menu,
710  _( "Icons Options" ),
711  _( "Select show icons in menus and icons sizes" ),
712  KiBitmap( icon_xpm ) );
713 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands.

Parameters
aMasterMenu= the menu to populate.

Definition at line 266 of file zoom.cpp.

References AddHotkeyName(), AddMenuItem(), BASE_SCREEN::BuildGridsChoiceList(), g_UserUnit, BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCount(), EDA_DRAW_PANEL::GetScreen(), BASE_SCREEN::GetZoom(), HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, i, ID_POPUP_CANCEL, ID_POPUP_GRID_SELECT, ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_LEVEL_END, ID_POPUP_ZOOM_LEVEL_START, ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_PAGE, ID_POPUP_ZOOM_REDRAW, ID_POPUP_ZOOM_SELECT, INCHES, KiBitmap(), EDA_DRAW_FRAME::m_canvas, GRID_TYPE::m_CmdId, EDA_DRAW_FRAME::m_hotkeysDescrList, EDA_DRAW_FRAME::m_zoomLevelCoeff, and BASE_SCREEN::m_ZoomList.

Referenced by EDA_DRAW_PANEL::OnRightClick().

267 {
268  int maxZoomIds;
269  double zoom;
270  wxString msg;
271  BASE_SCREEN* screen = m_canvas->GetScreen();
272 
273  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
274  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
275  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
276  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
277  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
278  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
279  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
280  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
281  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
282  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
283 
284 
285  wxMenu* zoom_choice = new wxMenu;
286  AddMenuItem( MasterMenu, zoom_choice,
287  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
288  KiBitmap( zoom_selection_xpm ) );
289 
290  zoom = screen->GetZoom();
292  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
293  maxZoomIds : screen->m_ZoomList.size();
294 
295  // Populate zoom submenu.
296  for( int i = 0; i < maxZoomIds; i++ )
297  {
298  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
299 
300  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
301  wxEmptyString, wxITEM_CHECK );
302  if( zoom == screen->m_ZoomList[i] )
303  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
304  }
305 
306  // Create grid submenu as required.
307  if( screen->GetGridCount() )
308  {
309  wxMenu* gridMenu = new wxMenu;
310  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
311  _( "Grid" ), KiBitmap( grid_select_xpm ) );
312 
313  wxArrayString gridsList;
314  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
315 
316  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
317  {
318  GRID_TYPE& grid = screen->GetGrid( i );
319  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
320 
321  if( (int)i == icurr )
322  gridMenu->Check( grid.m_CmdId, true );
323  }
324  }
325 
326  MasterMenu->AppendSeparator();
327  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
328 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:81
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:91
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
SCH_NO_CONNECT * SCH_EDIT_FRAME::AddNoConnect ( const wxPoint aPosition)
private

Add no connect item to the current schematic sheet at aPosition.

Parameters
aPositionThe position in logical (drawing) units to add the no connect.
Returns
The no connect item added.

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

References SCH_SCREEN::Append(), GetScreen(), EDA_DRAW_FRAME::m_canvas, OnModify(), EDA_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), SchematicCleanUp(), SetRepeatItem(), and UR_NEW.

Referenced by OnLeftClick(), and SetPrintSheetReference().

742 {
743  SCH_NO_CONNECT* no_connect = new SCH_NO_CONNECT( aPosition );
744 
745  SetRepeatItem( no_connect );
746  GetScreen()->Append( no_connect );
748  OnModify();
749  m_canvas->Refresh();
750  SaveCopyInUndoList( no_connect, UR_NEW );
751  return no_connect;
752 }
bool SchematicCleanUp(bool aAppend=false)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
void SetRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:140
int SCH_EDIT_FRAME::AddTemplateFieldName ( const TEMPLATE_FIELDNAME aFieldName)
inline

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

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

Parameters
aFieldNameis a full description of the wanted field, and it must not match any of the default field names.
Returns
int - the index within the config container at which aFieldName was added, or -1 if the name is illegal because it matches a default field name.

Definition at line 307 of file sch_edit_frame.h.

References TEMPLATES::AddTemplateFieldName().

308  {
309  return m_TemplateFieldNames.AddTemplateFieldName( aFieldName );
310  }
int AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName)
Function AddTemplateFieldName inserts or appends a wanted symbol field name into the fieldnames templ...
TEMPLATES m_TemplateFieldNames
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

Definition at line 970 of file draw_frame.cpp.

References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetLeft(), EDA_DRAW_FRAME::GetPageSizeIU(), BOX2< Vec >::GetRight(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetTop(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), KiROUND(), EDA_DRAW_FRAME::m_canvas, BASE_SCREEN::m_Center, BASE_SCREEN::m_DrawOrg, BASE_SCREEN::m_ScrollbarNumber, BASE_SCREEN::m_ScrollbarPos, BASE_SCREEN::m_ScrollPixelsPerUnitX, BASE_SCREEN::m_ScrollPixelsPerUnitY, min, BOX2< Vec >::MoveBottomTo(), BOX2< Vec >::MoveLeftTo(), BOX2< Vec >::MoveRightTo(), BOX2< Vec >::MoveTopTo(), scale, EDA_DRAW_FRAME::SetScrollCenterPosition(), traceScrollSettings(), VIRT_MAX, VIRT_MIN, wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_FRAME::RedrawScreen2(), and EDA_DRAW_FRAME::UseGalCanvas().

971 {
972  BASE_SCREEN* screen = GetScreen();
973 
974  if( !screen || !m_canvas )
975  return;
976 
977  double scale = screen->GetScalingFactor();
978 
979  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
980  aCenterPositionIU.x, aCenterPositionIU.y, scale );
981 
982  // Calculate the portion of the drawing that can be displayed in the
983  // client area at the current zoom level.
984 
985  // visible viewport in device units ~ pixels
986  wxSize clientSizeDU = m_canvas->GetClientSize();
987 
988  // Size of the client window in IU
989  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
990 
991  // Full drawing or "page" rectangle in internal units
992  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
993 
994  // Account for scrollbars
995  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
996  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
997  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
998 
999  // The upper left corner of the client rectangle in internal units.
1000  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
1001  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
1002 
1003  // If drawn around the center, adjust the client rectangle accordingly.
1004  if( screen->m_Center )
1005  {
1006  // half page offset.
1007  xIU += pageRectIU.GetWidth() / 2.0;
1008  yIU += pageRectIU.GetHeight() / 2.0;
1009  }
1010 
1011  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
1012  wxPoint centerPositionIU;
1013 
1014  // put "int" limits on the clientRect
1015  if( clientRectIU.GetLeft() < VIRT_MIN )
1016  clientRectIU.MoveLeftTo( VIRT_MIN );
1017  if( clientRectIU.GetTop() < VIRT_MIN )
1018  clientRectIU.MoveTopTo( VIRT_MIN );
1019  if( clientRectIU.GetRight() > VIRT_MAX )
1020  clientRectIU.MoveRightTo( VIRT_MAX );
1021  if( clientRectIU.GetBottom() > VIRT_MAX )
1022  clientRectIU.MoveBottomTo( VIRT_MAX );
1023 
1024  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
1025  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
1026 
1027  if( screen->m_Center )
1028  {
1029  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
1030  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
1031  }
1032 
1033  DSIZE virtualSizeIU;
1034 
1035  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
1036  {
1037  virtualSizeIU.x = pageRectIU.GetSize().x;
1038  }
1039  else
1040  {
1041  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
1042  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
1043 
1044  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
1045  {
1046  if( pageCenterX > clientCenterX )
1047  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
1048  else if( pageCenterX < clientCenterX )
1049  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
1050  else
1051  virtualSizeIU.x = clientRectIU.GetWidth();
1052  }
1053  else
1054  {
1055  if( pageCenterX > clientCenterX )
1056  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
1057  else if( pageCenterX < clientCenterX )
1058  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1059  else
1060  virtualSizeIU.x = pageRectIU.GetWidth();
1061  }
1062  }
1063 
1064  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1065  {
1066  virtualSizeIU.y = pageRectIU.GetSize().y;
1067  }
1068  else
1069  {
1070  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1071  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1072 
1073  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1074  {
1075  if( pageCenterY > clientCenterY )
1076  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1077  else if( pageCenterY < clientCenterY )
1078  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1079  else
1080  virtualSizeIU.y = clientRectIU.GetHeight();
1081  }
1082  else
1083  {
1084  if( pageCenterY > clientCenterY )
1085  virtualSizeIU.y = pageRectIU.GetHeight() +
1086  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1087  else if( pageCenterY < clientCenterY )
1088  virtualSizeIU.y = pageRectIU.GetHeight() +
1089  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1090  else
1091  virtualSizeIU.y = pageRectIU.GetHeight();
1092  }
1093  }
1094 
1095  // put "int" limits on the virtualSizeIU
1096  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1097  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1098 
1099  if( screen->m_Center )
1100  {
1101  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1102  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1103  }
1104  else
1105  {
1106  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1107  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1108  }
1109 
1110  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1111  * around cursor to jump around. This reported problem occurs when the
1112  * zoom point is not on a pixel per unit increment. If you set the
1113  * pixels per unit to 10, you have potential for the zoom point to
1114  * jump around +/-5 pixels from the nearest grid point.
1115  */
1116  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1117 
1118  // Number of scroll bar units for the given zoom level in device units.
1119  double unitsX = virtualSizeIU.x * scale;
1120  double unitsY = virtualSizeIU.y * scale;
1121 
1122  // Store the requested center position for later use
1123  SetScrollCenterPosition( aCenterPositionIU );
1124 
1125  // Calculate the scroll bar position in internal units to place the
1126  // center position at the center of client rectangle.
1127  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1128  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1129 
1130  // Convert scroll bar position to device units.
1131  posX = KiROUND( posX * scale );
1132  posY = KiROUND( posY * scale );
1133 
1134  if( posX < 0 )
1135  {
1136  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1137  posX = 0;
1138  }
1139 
1140  if( posX > unitsX )
1141  {
1142  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1143  posX = unitsX;
1144  }
1145 
1146  if( posY < 0 )
1147  {
1148  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1149  posY = 0;
1150  }
1151 
1152  if( posY > unitsY )
1153  {
1154  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1155  posY = unitsY;
1156  }
1157 
1158  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1159  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1160 
1161  wxLogTrace( traceScrollSettings,
1162  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1163  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1164  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1166  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1167  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1168 
1169  bool noRefresh = true;
1170 
1171  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1172  screen->m_ScrollPixelsPerUnitY,
1173  screen->m_ScrollbarNumber.x,
1174  screen->m_ScrollbarNumber.y,
1175  screen->m_ScrollbarPos.x,
1176  screen->m_ScrollbarPos.y, noRefresh );
1177 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
Definition: base_screen.h:192
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:967
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
Definition: base_screen.h:190
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:966
void SetScrollCenterPosition(const wxPoint &aPoint)
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
bool m_Center
Center on screen.
Definition: base_screen.h:202
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
Definition: base_screen.h:189
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
Definition: base_screen.h:196
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static const double MAX_AXIS
Definition: draw_frame.cpp:964
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:183
#define min(a, b)
Definition: auxiliary.h:85
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 80 of file annotate.cpp.

References SCH_REFERENCE_LIST::Annotate(), CheckAnnotate(), DeleteAnnotation(), g_RootSheet, GetChars(), SCH_SHEET_PATH::GetComponents(), SCH_SHEET_LIST::GetComponents(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetField(), SCH_FIELD::GetFullyQualifiedText(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SHEET_LIST::GetMultiUnitComponents(), EDA_TEXT::GetShownText(), EDA_ITEM::GetTimeStamp(), SCH_COMPONENT::GetUnit(), SCH_COMPONENT::GetUnitCount(), i, INCREMENTAL_BY_REF, EDA_DRAW_FRAME::m_canvas, m_CurrentSheet, mapExistingAnnotation(), OnModify(), REFERENCE, EDA_DRAW_PANEL::Refresh(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), REPORTER::Report(), REPORTER::RPT_ACTION, REPORTER::RPT_WARNING, 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(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_REFERENCE_LIST::UpdateAnnotation(), and VALUE.

Referenced by DeleteAllTemplateFieldNames(), and DIALOG_ANNOTATE::OnApplyClick().

88 {
89  SCH_REFERENCE_LIST references;
90 
91  SCH_SCREENS screens;
92 
93  // Build the sheet list.
94  SCH_SHEET_LIST sheets( g_RootSheet );
95 
96  // Map of locked components
97  SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
98 
99  // Map of previous annotation for building info messages
100  std::map<timestamp_t, wxString> previousAnnotation;
101 
102  // Test for and replace duplicate time stamps in components and sheets. Duplicate
103  // time stamps can happen with old schematics, schematic conversions, or manual
104  // editing of files.
105  if( aRepairTimestamps )
106  {
107  int count = screens.ReplaceDuplicateTimeStamps();
108 
109  if( count )
110  {
111  wxString msg;
112  msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
113  aReporter.Report( msg, REPORTER::RPT_WARNING );
114  }
115  }
116 
117  // If units must be locked, collect all the sets that must be annotated together.
118  if( aLockUnits )
119  {
120  if( aAnnotateSchematic )
121  {
122  sheets.GetMultiUnitComponents( lockedComponents );
123  }
124  else
125  {
126  m_CurrentSheet->GetMultiUnitComponents( lockedComponents );
127  }
128  }
129 
130  // Store previous annotations for building info messages
131  mapExistingAnnotation( previousAnnotation );
132 
133  // If it is an annotation for all the components, reset previous annotation.
134  if( aResetAnnotation )
135  DeleteAnnotation( !aAnnotateSchematic );
136 
137  // Set sheet number and number of sheets.
139 
140  // Build component list
141  if( aAnnotateSchematic )
142  {
143  sheets.GetComponents( references );
144  }
145  else
146  {
147  m_CurrentSheet->GetComponents( references );
148  }
149 
150  // Break full components reference in name (prefix) and number:
151  // example: IC1 become IC, and 1
152  references.SplitReferences();
153 
154  switch( aSortOption )
155  {
156  default:
157  case SORT_BY_X_POSITION:
158  references.SortByXCoordinate();
159  break;
160 
161  case SORT_BY_Y_POSITION:
162  references.SortByYCoordinate();
163  break;
164  }
165 
166  bool useSheetNum = false;
167  int idStep = 100;
168 
169  switch( aAlgoOption )
170  {
171  default:
172  case INCREMENTAL_BY_REF:
173  break;
174 
175  case SHEET_NUMBER_X_100:
176  useSheetNum = true;
177  break;
178 
179  case SHEET_NUMBER_X_1000:
180  useSheetNum = true;
181  idStep = 1000;
182  break;
183  }
184 
185  // Recalculate and update reference numbers in schematic
186  references.Annotate( useSheetNum, idStep, aStartNumber, lockedComponents );
187  references.UpdateAnnotation();
188 
189  for( size_t i = 0; i < references.GetCount(); i++ )
190  {
191  SCH_COMPONENT* comp = references[ i ].GetComp();
192  wxString prevRef = previousAnnotation[ comp->GetTimeStamp() ];
193  wxString newRef = comp->GetField( REFERENCE )->GetFullyQualifiedText();
194  wxString msg;
195 
196  if( prevRef.Length() )
197  {
198  if( newRef == prevRef )
199  continue;
200 
201  if( comp->GetUnitCount() > 1 )
202  msg.Printf( _( "Updated %s (unit %d) from %s to %s" ),
203  GetChars( comp->GetField( VALUE )->GetShownText() ),
204  comp->GetUnit(),
205  GetChars( prevRef ),
206  GetChars( newRef ) );
207  else
208  msg.Printf( _( "Updated %s from %s to %s" ),
209  GetChars( comp->GetField( VALUE )->GetShownText() ),
210  GetChars( prevRef ),
211  GetChars( newRef ) );
212  }
213  else
214  {
215  if( comp->GetUnitCount() > 1 )
216  msg.Printf( _( "Annotated %s (unit %d) as %s" ),
217  GetChars( comp->GetField( VALUE )->GetShownText() ),
218  comp->GetUnit(),
219  GetChars( newRef ) );
220  else
221  msg.Printf( _( "Annotated %s as %s" ),
222  GetChars( comp->GetField( VALUE )->GetShownText() ),
223  GetChars( newRef ) );
224  }
225 
226  aReporter.Report( msg, REPORTER::RPT_ACTION );
227  }
228 
229  // Final control (just in case ... ).
230  if( !CheckAnnotate( aReporter, !aAnnotateSchematic ) )
231  aReporter.Report( _( "Annotation complete." ), REPORTER::RPT_ACTION );
232 
233  OnModify();
234 
235  // Update on screen references, that can be modified by previous calculations:
238 
239  m_canvas->Refresh( true );
240 }
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet...
Class SCH_SHEET_LIST.
void SortByYCoordinate()
Function sortByYCoordinate sorts the list of references by Y position.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
const wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:80
Annotate incrementally using the first free reference number.
int GetUnitCount() const
Return the number of units per package of the symbol.
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
Field Reference of part, i.e. "IC21".
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
void UpdateAnnotation()
function UpdateAnnotation Updates the reference components for the schematic project (or the current ...
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void SortByXCoordinate()
Function sortByXCoordinate sorts the list of references by X position.
void DeleteAnnotation(bool aCurrentSheetOnly)
Clear the current component annotation.
Definition: annotate.cpp:59
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.
int GetUnit() const
void mapExistingAnnotation(std::map< timestamp_t, wxString > &aMap)
Definition: annotate.cpp:41
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Type SCH_MULTI_UNIT_REFERENCE_MAP is used to create a map of reference designators for multi-unit par...
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
Definition: annotate.cpp:243
Annotate by Y position from top to bottom.
Annotate using the first free reference number starting at the sheet number * 100.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
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)...
size_t i
Definition: json11.cpp:597
Annotate by X position from left to right.
Annotate using the first free reference number starting at the sheet number * 1000.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
int ReplaceDuplicateTimeStamps()
Test all sheet and component objects in the schematic for duplicate time stamps and replaces them as ...
void GetMultiUnitComponents(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true)
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
unsigned GetCount()
Function GetCount.
#define VALUE
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:503
timestamp_t GetTimeStamp() const
Definition: base_struct.h:215
void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  textUpper,
const wxString &  textLower,
COLOR4D  color,
int  pad = 6 
)
inherited

Append a message to the message panel.

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

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

Definition at line 812 of file draw_frame.cpp.

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

Referenced by AppendSchematic(), PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), EditSheet(), importFile(), SCH_PRINTOUT::OnPrintPage(), OpenProjectFiles(), LIB_VIEW_FRAME::RedrawActiveWindow(), SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), and ShowNewTrackWhenMovingCursor().

815 {
816  if( m_messagePanel == NULL )
817  return;
818 
819  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
820 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:141
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110
bool SCH_EDIT_FRAME::AppendSchematic ( )

Import a KiCad schematic into the current page.

In order to import a schematic a lot of things have to happen to before the contents of the imported schematic can be appended to the current page. The following list describes this process:

  • Load the schematic into a temporary SCH_SHEET object.
  • Make sure the imported schematic does not cause any hierarchy recursion issues.
  • Verify the imported schematic uses fully qualified LIB_ID objects (symbol library table).
  • Check to see if any symbol libraries need to be added to the current project's symbol library table. This includes:
    • Check if the symbol library already exists in the project or global symbol library table.
    • Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute paths. ${KIPRJMOD} will not be the same for this project.
    • Check for duplicate symbol library nicknames and change the new symbol library nickname to prevent library name clashes.
    • Update all schematic symbol LIB_ID object library nicknames when the library nickname was changed to prevent clashes.
  • Check for duplicate sheet names which is illegal and automatically rename any duplicate sheets in the imported schematic.
  • Clear all of the annotation in the imported schematic to prevent clashes.
  • Append the objects from the temporary sheet to the current page.
  • Replace any duplicate time stamps.
  • Refresh the symbol library links.
Returns
True if the project was imported properly.

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

References PART_LIBS::AddLibrary(), SCH_SCREEN::Append(), EDA_DRAW_FRAME::AppendMsgPanel(), PART_LIBS::CacheName(), SCH_TYPE_COLLECTOR::Collect(), CYAN, DisplayError(), DisplayErrorMessage(), SYMBOL_LIB_TABLE::FindRow(), Format(), g_RootSheet, COLLECTOR::GetCount(), GetCurrentSheet(), LIB_TABLE_ROW::GetDescr(), SCH_SCREEN::GetDrawItems(), SCH_PLUGIN::GetError(), SCH_SCREEN::GetFileName(), LIB_TABLE::GetFullURI(), SCH_SCREENS::GetLibNicknames(), GetNewTimeStamp(), LIB_TABLE_ROW::GetOptions(), GetScreen(), SCH_SCREEN::GetSheet(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName(), SYMBOL_LIB_TABLE_ROW::GetType(), LIB_TABLE::HasLibrary(), i, ID_POPUP_GRID_LEVEL_1000, LIB_TABLE::IsEmpty(), IsOK(), KIWAY_HOLDER::Kiway(), SCH_PLUGIN::Load(), LIB_TABLE::Load(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_LastGridSizeId, name, OnModify(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SchematicFileWildcard(), BASE_SCREEN::SetGrid(), SCH_SHEET::SetName(), SetSheetNumberAndCount(), EDA_ITEM::SetTimeStamp(), SCH_COLLECTOR::SheetsOnly, SCH_SHEET_LIST::TestForRecursion(), SCH_SCREENS::UpdateSymbolLinks(), IO_ERROR::What(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by OnAppendProject(), and SetPrintSheetReference().

384 {
385  wxString msg;
386  wxString fullFileName;
387 
388  SCH_SCREEN* screen = GetScreen();
389 
390  if( !screen )
391  {
392  wxLogError( wxT( "Document not ready, cannot import" ) );
393  return false;
394  }
395 
396  // open file chooser dialog
397  wxString path = wxPathOnly( Prj().GetProjectFullName() );
398 
399  wxFileDialog dlg( this, _( "Append Schematic" ), path,
400  wxEmptyString, SchematicFileWildcard(),
401  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
402 
403  if( dlg.ShowModal() == wxID_CANCEL )
404  return false;
405 
406  fullFileName = dlg.GetPath();
407 
408  wxFileName fn = fullFileName;
409 
410  if( fn.IsRelative() )
411  {
412  fn.MakeAbsolute();
413  fullFileName = fn.GetFullPath();
414  }
415 
416  wxString cache_name = PART_LIBS::CacheName( fullFileName );
417 
418  if( !!cache_name )
419  {
420  PART_LIBS* libs = Prj().SchLibs();
421 
422  try
423  {
424  if( PART_LIB* lib = libs->AddLibrary( cache_name ) )
425  lib->SetCache();
426  }
427  catch( const IO_ERROR& ioe )
428  {
429  DisplayError( this, ioe.What() );
430  }
431  }
432 
433  wxLogDebug( wxT( "Importing schematic " ) + fullFileName );
434 
435  // Load the schematic into a temporary sheet.
436  SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
437  std::unique_ptr< SCH_SHEET> newSheet( new SCH_SHEET );
438 
439  newSheet->SetFileName( fullFileName );
440 
441  try
442  {
443  pi->Load( fullFileName, &Kiway(), newSheet.get() );
444 
445  if( !pi->GetError().IsEmpty() )
446  {
447  DisplayErrorMessage( this,
448  _( "The entire schematic could not be load. Errors "
449  "occurred attempting to load hierarchical sheet "
450  "schematics." ),
451  pi->GetError() );
452  }
453  }
454  catch( const IO_ERROR& ioe )
455  {
456  msg.Printf( _( "Error occurred loading schematic file \"%s\"." ), fullFileName );
457  DisplayErrorMessage( this, msg, ioe.What() );
458 
459  msg.Printf( _( "Failed to load schematic \"%s\"" ), fullFileName );
460  AppendMsgPanel( wxEmptyString, msg, CYAN );
461 
462  return false;
463  }
464 
465  // Make sure any new sheet changes do not cause any recursion issues.
466  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
467  SCH_SHEET_LIST sheetHierarchy( newSheet.get() ); // This is the hierarchy of the import.
468 
469  wxFileName destFile = screen->GetFileName();
470 
471  if( destFile.IsRelative() )
472  destFile.MakeAbsolute( Prj().GetProjectPath() );
473 
474  if( hierarchy.TestForRecursion( sheetHierarchy, destFile.GetFullPath( wxPATH_UNIX ) ) )
475  {
476  msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
477  "has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
478  "the schematic hierarchy." ),
479  destFile.GetFullPath() );
480  DisplayError( this, msg );
481  return false;
482  }
483 
484  wxArrayString names;
485 
486  // Make sure the imported schematic has been remapped to the symbol library table.
487  SCH_SCREENS newScreens( newSheet.get() ); // All screens associated with the import.
488 
489  if( newScreens.HasNoFullyDefinedLibIds() )
490  {
491  if( !IsOK( this,
492  "This schematic has not been remapped to the symbol library table. "
493  "Therefore, all of the library symbol links will be broken. Do you "
494  "want to continue?" ) )
495  return false;
496  }
497  else
498  {
499  // If there are symbol libraries in the imported schematic that are not in the
500  // symbol library table of this project, there could be a lot of broken symbol
501  // library links. Attempt to add the missing libraries to the project symbol
502  // library table.
503  newScreens.GetLibNicknames( names );
504  wxArrayString newLibNames;
505 
506  for( const auto& name : names )
507  {
508  if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
509  newLibNames.Add( name );
510  }
511 
512  wxFileName symLibTableFn( fn.GetPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
513 
514  if( !newLibNames.IsEmpty() && symLibTableFn.Exists() && symLibTableFn.IsFileReadable() )
515  {
516  SYMBOL_LIB_TABLE table;
517 
518  try
519  {
520  table.Load( symLibTableFn.GetFullPath() );
521  }
522  catch( const IO_ERROR& ioe )
523  {
524  msg.Printf( _( "An error occurred loading the symbol library table \"%s\"." ),
525  symLibTableFn.GetFullPath() );
526  DisplayErrorMessage( NULL, msg, ioe.What() );
527  }
528 
529  if( !table.IsEmpty() )
530  {
531  for( const auto& libName : newLibNames )
532  {
533  if( !table.HasLibrary( libName ) )
534  continue;
535 
536  // Don't expand environment variable because KIPRJMOD will not be correct
537  // for a different project.
538  wxString uri = table.GetFullURI( libName, false );
539 
540  wxFileName newLib;
541 
542  if( uri.Contains( "${KIPRJMOD}" ) )
543  {
544  newLib.SetPath( fn.GetPath() );
545  newLib.SetFullName( uri.AfterLast( '}' ) );
546  uri = newLib.GetFullPath();
547  }
548  else
549  {
550  uri = table.GetFullURI( libName );
551  }
552 
553  // Add the library from the imported project to the current project
554  // symbol library table.
555  const SYMBOL_LIB_TABLE_ROW* row = table.FindRow( libName );
556 
557  wxCHECK2_MSG( row, continue, "Library '" + libName +
558  "' missing from symbol library table '" +
559  symLibTableFn.GetFullPath() + "'." );
560 
561  wxString newLibName = libName;
562  int libNameCnt = 1;
563 
564  // Rename the imported symbol library if it already exists.
565  while( Prj().SchSymbolLibTable()->HasLibrary( newLibName ) )
566  {
567  newLibName = wxString::Format( "%s%d", libName, libNameCnt );
568  }
569 
570  SYMBOL_LIB_TABLE_ROW* newRow = new SYMBOL_LIB_TABLE_ROW( newLibName,
571  uri,
572  row->GetType(),
573  row->GetOptions(),
574  row->GetDescr() );
575  Prj().SchSymbolLibTable()->InsertRow( newRow );
576 
577  if( libName != newLibName )
578  newScreens.ChangeSymbolLibNickname( libName, newLibName );
579  }
580  }
581  }
582  }
583 
584  // Check for duplicate sheet names in the current page.
585  wxArrayString duplicateSheetNames;
586  SCH_TYPE_COLLECTOR sheets;
587 
588  sheets.Collect( screen->GetDrawItems(), SCH_COLLECTOR::SheetsOnly );
589 
590  for( int i = 0; i < sheets.GetCount(); ++i )
591  {
592  if( newSheet->GetScreen()->GetSheet( ( ( SCH_SHEET* ) sheets[i] )->GetName() ) )
593  duplicateSheetNames.Add( ( ( SCH_SHEET* ) sheets[i] )->GetName() );
594  }
595 
596  if( !duplicateSheetNames.IsEmpty() )
597  {
598  msg.Printf( "Duplicate sheet names exist on the current page. Do you want to "
599  "automatically rename the duplicate sheet names?" );
600  if( !IsOK( this, msg ) )
601  return false;
602  }
603 
604  SCH_SCREEN* newScreen = newSheet->GetScreen();
605  wxCHECK_MSG( newScreen, false, "No screen defined for imported sheet." );
606 
607  for( const auto& duplicateName : duplicateSheetNames )
608  {
609  SCH_SHEET* renamedSheet = newScreen->GetSheet( duplicateName );
610 
611  wxCHECK2_MSG( renamedSheet, continue,
612  "Sheet " + duplicateName + " not found in imported schematic." );
613 
614  timestamp_t newtimestamp = GetNewTimeStamp();
615  renamedSheet->SetTimeStamp( newtimestamp );
616  renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (unsigned long) newtimestamp ) );
617  }
618 
619  // Clear all annotation in the imported schematic to prevent clashes with existing annotation.
620  newScreens.ClearAnnotation();
621 
622  // It is finally save to add the imported schematic.
623  screen->Append( newScreen );
624 
625  SCH_SCREENS allScreens;
626  allScreens.ReplaceDuplicateTimeStamps();
627 
628  OnModify();
629 
630  // redraw base screen (ROOT) if necessary
631  SCH_SCREENS screens( GetCurrentSheet().Last() );
632 
633  screens.UpdateSymbolLinks( true );
635  Zoom_Automatique( false );
637  m_canvas->Refresh( true );
638  return true;
639 }
Class SCH_SHEET_LIST.
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:106
static const wxString & GetSymbolLibTableFileName()
long timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: base_struct.h:155
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
Class TYPE_COLLECTOR merely gathers up all SCH_ITEMs of a given set of KICAD_T type(s).
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
wxString SchematicFileWildcard()
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:199
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
SCH_SHEET * GetSheet(const wxString &aName)
Returns a sheet object pointer that is named aName.
Definition: sch_screen.cpp:645
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
const wxString & GetFileName() const
Definition: sch_screen.h:120
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
static const wxString CacheName(const wxString &aFullProjectFilename)
Return the name of the cache library after potentially fixing it from an older naming scheme...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:102
timestamp_t GetNewTimeStamp()
Definition: common.cpp:167
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
void SetName(const wxString &aName)
Definition: sch_sheet.h:269
const wxString GetType() const override
Return the type of symbol library table represented by this row.
SCH_SHEET_PATH & GetCurrentSheet()
PART_LIB * AddLibrary(const wxString &aFileName)
Allocate and adds a part library to the library list.
Definition: colors.h:59
int m_LastGridSizeId
Definition: draw_frame.h:83
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
const wxString & GetDescr() const
Return the description of the library referenced by this row.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
A collection of PART_LIB objects.
Helper object to release a SCH_PLUGIN in the context of a potential thrown exception through its dest...
Definition: sch_io_mgr.h:523
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
Definition: draw_frame.cpp:812
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
const char * name
Definition: DXF_plotter.cpp:61
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:140
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
size_t i
Definition: json11.cpp:597
void Collect(SCH_ITEM *aBoard, const KICAD_T aScanList[])
Function Collect scans a BOARD_ITEM using this class&#39;s Inspector method, which does the collection...
static const KICAD_T SheetsOnly[]
A scan list for schematic sheet items only.
bool HasLibrary(const wxString &aNickname) const
Test for the existence of aNickname in the library table.
int ReplaceDuplicateTimeStamps()
Test all sheet and component objects in the schematic for duplicate time stamps and replaces them as ...
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
Object used to load, save, search, and otherwise manipulate symbol library files. ...
size_t GetLibNicknames(wxArrayString &aLibNicknames)
Fetch all of the symbol library nickames into aLibNicknames.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:503
bool IsEmpty(bool aIncludeFallback=true)
Return true if the table is empty.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
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 896 of file eeschema/files-io.cpp.

References dummy(), SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), OnSaveProject(), and YesNoCancelDialog().

Referenced by OnImportProject(), OpenProjectFiles(), and SetPrintSheetReference().

897 {
898  SCH_SCREENS screenList;
899 
900  // Save any currently open and modified project files.
901  for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
902  {
903  if( screen->IsModify() )
904  {
905  int response = YesNoCancelDialog( m_parent, _(
906  "The current schematic has been modified. Do you wish to save the changes?" ),
907  wxEmptyString,
908  _( "Save and Load" ),
909  _( "Load Without Saving" )
910  );
911 
912  if( response == wxID_CANCEL )
913  {
914  return false;
915  }
916  else if( response == wxID_YES )
917  {
918  wxCommandEvent dummy;
919  OnSaveProject( dummy );
920  }
921  // else wxID_NO, so do not save
922 
923  break;
924  }
925  }
926 
927  return true;
928 }
SCH_SCREEN * GetNext()
void OnSaveProject(wxCommandEvent &aEvent)
Command event handler to save the entire project and create a component library archive.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
SCH_SCREEN * GetFirst()
int YesNoCancelDialog(wxWindow *aParent, const wxString &aPrimaryMessage, const wxString &aSecondaryMessage, const wxString &aYesButtonText, const wxString &aNoButtonText, const wxString &aCancelButtonText)
Function YesNoCancelDialog displays a yes/no/cancel dialog with aMessage and returns the user respons...
Definition: confirm.cpp:270
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:503
void SCH_EDIT_FRAME::backAnnotateFootprints ( const std::string &  aChangedSetOfReferences)
protected

Definition at line 51 of file backanno.cpp.

References FOOTPRINT, Format(), FROM_UTF8(), g_RootSheet, SCH_SHEET_LIST::GetComponents(), SCH_REFERENCE_LIST::GetCount(), SCH_COMPONENT::GetField(), STRING_FORMATTER::GetString(), EDA_TEXT::GetText(), EDA_TEXT::IsVisible(), OnModify(), Scan(), EDA_TEXT::SetText(), EDA_TEXT::SetVisible(), and THROW_IO_ERROR.

Referenced by KiwayMailIn().

52 {
53  // Build a flat list of components in schematic:
54  SCH_REFERENCE_LIST refs;
55  SCH_SHEET_LIST sheets( g_RootSheet );
56  bool isChanged = false;
57 
58  sheets.GetComponents( refs, false );
59 
60  DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) );
61  PTREE doc;
62 
63  try
64  {
65  Scan( &doc, &lexer );
66 
67 #if defined(DEBUG) && 0
69  Format( &sf, 0, 0, doc );
70  printf( "%s: '%s'\n", __func__, sf.GetString().c_str() );
71 #endif
72 
73  CPTREE& back_anno = doc.get_child( "back_annotation" );
74  wxString footprint;
75 
76  for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
77  {
78  wxASSERT( ref->first == "ref" );
79 
80  wxString reference = (UTF8&) ref->second.front().first;
81 
82  // Ensure the "fpid" node contains a footprint name,
83  // and get it if exists
84  if( ref->second.get_child( "fpid" ).size() )
85  {
86  wxString tmp = (UTF8&) ref->second.get_child( "fpid" ).front().first;
87  footprint = tmp;
88  }
89  else
90  footprint.Empty();
91 
92  // Search the component in the flat list
93  for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
94  {
95  if( reference == refs[ii].GetRef() )
96  {
97  // We have found a candidate.
98  // Note: it can be not unique (multiple parts per package)
99  // So we *do not* stop the search here
100  SCH_COMPONENT* component = refs[ii].GetComp();
101  SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
102  const wxString& oldfp = fpfield->GetText();
103 
104  if( !oldfp && fpfield->IsVisible() )
105  {
106  fpfield->SetVisible( false );
107  }
108 
109  if( oldfp != footprint )
110  isChanged = true;
111 
112  fpfield->SetText( footprint );
113  }
114  }
115  }
116  }
117  catch( const PTREE_ERROR& ex )
118  {
119  // remap the exception to something the caller is likely to understand.
120  THROW_IO_ERROR( ex.what() );
121  }
122 
123  if( isChanged )
124  OnModify();
125 }
Class UTF8 is an 8 bit string that is assuredly encoded in UTF8, and supplies special conversion supp...
Definition: utf8.h:73
Class SCH_SHEET_LIST.
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;s value...
Definition: sch_field.h:56
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Function Scan fills an empty PTREE with information from a KiCad s-expresion stream.
Definition: ptree.cpp:90
void SetVisible(bool aVisible)
Definition: eda_text.h:173
Field Name Module PCB, i.e. "16DIP300".
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
boost::property_tree::ptree PTREE
Definition: ptree.h:54
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const PTREE CPTREE
Definition: ptree.h:55
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
const std::string & GetString()
Definition: richio.h:475
boost::property_tree::ptree_error PTREE_ERROR
Definition: ptree.h:56
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool IsVisible() const
Definition: eda_text.h:174
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
unsigned GetCount()
Function GetCount.
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
Class DSNLEXER implements a lexical analyzer for the SPECCTRA DSN file format.
Definition: dsnlexer.h:79
virtual void SetText(const wxString &aText)
Definition: eda_text.h:139
DRAWSEGMENT* SCH_EDIT_FRAME::Begin_Edge ( DRAWSEGMENT Segment,
wxDC *  DC 
)
private

Referenced by SetPrintSheetReference().

void SCH_EDIT_FRAME::BeginSegment ( wxDC *  DC,
int  type 
)
private

Creates a new segment ( WIRE, BUS ) or terminates the current segment in progress.

If the end of the current segment is on a different segment, place a junction if needed and terminates the command. If the end of the current segment is on a pin, terminate the command. In all other cases starts a new segment.

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

References AbortCreateNewLine(), SCH_LINE::Back(), EDA_DRAW_PANEL::CallMouseCapture(), EDA_ITEM::ClearFlags(), DrawSegment(), EndSegment(), EDA_DRAW_FRAME::GetCrossHairPosition(), SCH_SCREEN::GetCurItem(), EDA_ITEM::GetFlags(), GetForceHVLines(), SCH_ITEM::GetLayer(), GetScreen(), IS_NEW, SCH_LINE::IsNull(), LAYER_BUS, LAYER_NOTES, LAYER_WIRE, EDA_DRAW_FRAME::m_canvas, DLIST< T >::PushBack(), SCH_LINE_T, SELECTED, SCH_SCREEN::SetCurItem(), SCH_LINE::SetEndPoint(), EDA_ITEM::SetFlags(), EDA_DRAW_PANEL::SetMouseCapture(), SetRepeatItem(), SCH_LINE::SetStartPoint(), and EDA_ITEM::Type().

Referenced by OnLeftClick(), and SetPrintSheetReference().

165 {
166  SCH_LINE* segment;
167  SCH_LINE* nextSegment;
168  wxPoint cursorpos = GetCrossHairPosition();
169 
170  // We should know if a segment is currently in progress
171  segment = (SCH_LINE*) GetScreen()->GetCurItem();
172  if( segment ) // a current item exists, but not necessary a currently edited item
173  {
174  if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) )
175  {
176  if( segment->GetFlags() )
177  {
178  wxLogDebug( wxT( "BeginSegment: item->GetFlags()== %X" ),
179  segment->GetFlags() );
180  }
181  // no wire, bus or graphic line in progress
182  segment = NULL;
183  }
184  }
185 
186  if( !segment ) // first point : Create the first wire or bus segment
187  {
188  switch( type )
189  {
190  default:
191  segment = new SCH_LINE( cursorpos, LAYER_NOTES );
192  break;
193 
194  case LAYER_WIRE:
195  segment = new SCH_LINE( cursorpos, LAYER_WIRE );
196 
197  /* A junction will be created later, when we'll know the
198  * segment end position, and if the junction is really needed */
199  break;
200 
201  case LAYER_BUS:
202  segment = new SCH_LINE( cursorpos, LAYER_BUS );
203  break;
204  }
205 
206  segment->SetFlags( IS_NEW );
207  s_wires.PushBack( segment );
208  GetScreen()->SetCurItem( segment );
209 
210  // We need 2 segments to go from a given start pin to an end point when the horizontal
211  // and vertical lines only switch is on.
212  if( GetForceHVLines() )
213  {
214  nextSegment = new SCH_LINE( *segment );
215  nextSegment->SetFlags( IS_NEW );
216  s_wires.PushBack( nextSegment );
217  GetScreen()->SetCurItem( nextSegment );
218  }
219 
221  SetRepeatItem( NULL );
222  }
223  else // A segment is in progress: terminates the current segment and add a new segment.
224  {
225  SCH_LINE* prevSegment = segment->Back();
226 
227  // Be aware prevSegment can be null when the horizontal and vertical lines only switch is off
228  // when we create the first segment.
229 
230  if( !GetForceHVLines() )
231  {
232  // If only one segment is needed and it has a zero length, do not create a new one.
233  if( segment->IsNull() )
234  return;
235  }
236  else
237  {
238  wxCHECK_RET( prevSegment != NULL, wxT( "Failed to create second line segment." ) );
239 
240  // If two segments are required and they both have zero length, do not
241  // create a new one.
242  if( prevSegment && prevSegment->IsNull() && segment->IsNull() )
243  return;
244  }
245 
246  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
247 
248  // Terminate the command if the end point is on a pin, junction, or another wire or bus.
249  if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) )
250  {
251  EndSegment();
252  return;
253  }
254 
255  // Create a new segment, and chain it after the current new segment.
256  nextSegment = new SCH_LINE( *segment );
257  nextSegment->SetStartPoint( cursorpos );
258  s_wires.PushBack( nextSegment );
259 
260  segment->SetEndPoint( cursorpos );
261  segment->ClearFlags( IS_NEW );
262  segment->SetFlags( SELECTED );
263  nextSegment->SetFlags( IS_NEW );
264  GetScreen()->SetCurItem( nextSegment );
265  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
266  }
267 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
bool GetForceHVLines() const
static void DrawSegment(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Mouse capture callback for drawing line segments.
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
void EndSegment()
Terminate a bus, wire, or line creation.
void SetRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:82
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
#define SELECTED
Definition: base_struct.h:116
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:174
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:78
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
bool IsNull() const
Definition: sch_line.h:74
static void AbortCreateNewLine(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
SCH_LINE * Back() const
Definition: sch_line.h:62
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
static DLIST< SCH_ITEM > s_wires
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

Definition at line 86 of file zoom.cpp.

References EDA_DRAW_FRAME::m_canvas, max, EDA_DRAW_FRAME::SetScrollCenterPosition(), wxPoint::x, and wxPoint::y.

Referenced by FOOTPRINT_EDIT_FRAME::BestZoom(), LIB_VIEW_FRAME::BestZoom(), PL_EDITOR_FRAME::BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), and LIB_EDIT_FRAME::BestZoom().

87 {
88  double bestzoom = std::max( sizeX * scaleFactor / (double) m_canvas->GetClientSize().x,
89  sizeY * scaleFactor / (double) m_canvas->GetClientSize().y );
90 
91  // Take scrollbars into account
92  DSIZE scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize();
93  centre.x -= int( bestzoom * scrollbarSize.x / 2.0 );
94  centre.y -= int( bestzoom * scrollbarSize.y / 2.0 );
95 
96  SetScrollCenterPosition( centre );
97 
98  return bestzoom;
99 }
void SetScrollCenterPosition(const wxPoint &aPoint)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
#define max(a, b)
Definition: auxiliary.h:86
double SCH_EDIT_FRAME::BestZoom ( )
overridevirtual

Return the zoom level which displays the full page on screen.

Implements EDA_DRAW_FRAME.

Definition at line 723 of file sch_edit_frame.cpp.

Referenced by DeleteAllTemplateFieldNames().

724 {
725  double sizeX = (double) GetScreen()->GetPageSettings().GetWidthIU();
726  double sizeY = (double) GetScreen()->GetPageSettings().GetHeightIU();
727  wxPoint centre( wxPoint( sizeX / 2, sizeY / 2 ) );
728 
729  // The sheet boundary already affords us some margin, so add only an
730  // additional 5%.
731  double margin_scale_factor = 1.05;
732 
733  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
734 }
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
Definition: zoom.cpp:86
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:115
int SCH_EDIT_FRAME::BlockCommand ( EDA_KEY  aKey)
overridevirtual

Return the block command internal code (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse.

Parameters
aKey= the key modifiers (Alt, Shift ...)
Returns
the block command id (BLOCK_MOVE, BLOCK_DUPLICATE...)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 55 of file eeschema/block.cpp.

References BLOCK_DELETE, BLOCK_DRAG, BLOCK_DUPLICATE, BLOCK_IDLE, BLOCK_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_KB_SHIFTCTRL, and MOUSE_MIDDLE.

Referenced by GetLabelIncrement().

56 {
57  int cmd = BLOCK_IDLE;
58 
59  switch( key )
60  {
61  default:
62  cmd = key & 0xFF;
63  break;
64 
65  case 0:
66  cmd = BLOCK_MOVE;
67  break;
68 
69  case GR_KB_SHIFT:
70  cmd = BLOCK_DUPLICATE;
71  break;
72 
73  case GR_KB_ALT:
74  cmd = BLOCK_ROTATE;
75  break;
76 
77  case GR_KB_CTRL:
78  cmd = BLOCK_DRAG;
79  break;
80 
81  case GR_KB_SHIFTCTRL:
82  cmd = BLOCK_DELETE;
83  break;
84 
85  case MOUSE_MIDDLE:
86  cmd = BLOCK_ZOOM;
87  break;
88  }
89 
90  return cmd;
91 }
#define GR_KB_ALT
Definition: common.h:65
#define GR_KB_SHIFT
Definition: common.h:66
#define GR_KB_SHIFTCTRL
Definition: common.h:67
#define MOUSE_MIDDLE
Definition: common.h:68
#define GR_KB_CTRL
Definition: common.h:64
bool SCH_EDIT_FRAME::BreakSegment ( SCH_LINE aSegment,
const wxPoint aPoint,
bool  aAppend = false,
SCH_LINE **  aNewSegment = NULL 
)

Breaks a single segment into two at the specified point.

Parameters
aSegmentLine segment to break
aPointPoint at which to break the segment
aAppendAdd the changes to the previous undo state
aNewSegmentPointer to the newly created segment (if given and created)
Returns
True if any wires or buses were broken.

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

References SCH_SCREEN::Append(), SCH_LINE::GetEndPoint(), GetScreen(), SCH_LINE::GetStartPoint(), SCH_LINE::IsEndPoint(), IsPointOnSegment(), SaveCopyInUndoList(), SCH_LINE::SetEndPoint(), SCH_LINE::SetStartPoint(), UR_CHANGED, and UR_NEW.

Referenced by BreakSegments(), DeleteAllTemplateFieldNames(), and TrimWire().

596 {
597  if( !IsPointOnSegment( aSegment->GetStartPoint(), aSegment->GetEndPoint(), aPoint )
598  || aSegment->IsEndPoint( aPoint ) )
599  return false;
600 
601  SaveCopyInUndoList( aSegment, UR_CHANGED, aAppend );
602  SCH_LINE* newSegment = new SCH_LINE( *aSegment );
603  SaveCopyInUndoList( newSegment, UR_NEW, true );
604 
605  newSegment->SetStartPoint( aPoint );
606  aSegment->SetEndPoint( aPoint );
607  GetScreen()->Append( newSegment );
608 
609  if( aNewSegment )
610  *aNewSegment = newSegment;
611 
612  return true;
613 }
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Function IsPointOnSegment.
Definition: trigo.cpp:39
wxPoint GetEndPoint() const
Definition: sch_line.h:80
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:82
wxPoint GetStartPoint() const
Definition: sch_line.h:76
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:78
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:69
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:140
bool SCH_EDIT_FRAME::BreakSegments ( const wxPoint aPoint,
bool  aAppend = false 
)

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

Parameters
aPointTest this point for an intersection.
aAppendAdd the changes to the previous undo state
Returns
True if any wires or buses were broken.

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

References BreakSegment(), GetScreen(), LAYER_NOTES, EDA_ITEM::Next(), and SCH_LINE_T.

Referenced by AddJunction(), BreakSegmentsOnJunctions(), DeleteAllTemplateFieldNames(), and Process_Special_Functions().

617 {
618  bool brokenSegments = false;
619 
620  for( SCH_ITEM* segment = GetScreen()->GetDrawItems(); segment; segment = segment->Next() )
621  {
622  if( ( segment->Type() != SCH_LINE_T ) || ( segment->GetLayer() == LAYER_NOTES ) )
623  continue;
624 
625  brokenSegments |= BreakSegment( (SCH_LINE*) segment, aPoint, aAppend || brokenSegments );
626  }
627 
628  return brokenSegments;
629 }
EDA_ITEM * Next() const
Definition: base_struct.h:217
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
bool BreakSegment(SCH_LINE *aSegment, const wxPoint &aPoint, bool aAppend=false, SCH_LINE **aNewSegment=NULL)
Breaks a single segment into two at the specified point.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions ( bool  aApped = false)

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

Parameters
aAppendAdd the changes to the previous undo state
Returns
True if any wires or buses were broken.

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

References BreakSegments(), SCH_JUNCTION::GetPosition(), SCH_BUS_ENTRY_BASE::GetPosition(), GetScreen(), SCH_BUS_ENTRY_BASE::m_End(), EDA_ITEM::Next(), and SCH_JUNCTION_T.

Referenced by DeleteAllTemplateFieldNames(), importFile(), OpenProjectFiles(), and SchematicCleanUp().

633 {
634  bool brokenSegments = false;
635 
636  for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
637  {
638  if( item->Type() == SCH_JUNCTION_T )
639  {
640  SCH_JUNCTION* junction = ( SCH_JUNCTION* ) item;
641 
642  if( BreakSegments( junction->GetPosition(), brokenSegments || aAppend ) )
643  brokenSegments = true;
644  }
645  else
646  {
647  SCH_BUS_ENTRY_BASE* busEntry = dynamic_cast<SCH_BUS_ENTRY_BASE*>( item );
648  if( busEntry )
649  {
650  if( BreakSegments( busEntry->GetPosition(), brokenSegments || aAppend )
651  || BreakSegments( busEntry->m_End(), brokenSegments || aAppend ) )
652  brokenSegments = true;
653  }
654  }
655  }
656 
657  return brokenSegments;
658 }
bool BreakSegments(const wxPoint &aPoint, bool aAppend=false)
Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an in...
wxPoint m_End() const
EDA_ITEM * Next() const
Definition: base_struct.h:217
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:41
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_junction.h:94
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
wxPoint GetPosition() const override
Function GetPosition.
NETLIST_OBJECT_LIST * SCH_EDIT_FRAME::BuildNetListBase ( bool  updateStatusText = true)

Create a flat list which stores all connected objects.

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

Definition at line 238 of file netlist_generator.cpp.

References Format(), and g_RootSheet.

Referenced by CreateNetlist(), DeleteAllTemplateFieldNames(), HighlightConnectionAtPosition(), OnLeftClick(), sendNetlist(), SetCurrentSheetHighlightFlags(), DIALOG_ERC::TestErc(), and SIM_PLOT_FRAME::updateNetlistExporter().

239 {
240  // I own this list until I return it to the new owner.
241  std::unique_ptr<NETLIST_OBJECT_LIST> ret( new NETLIST_OBJECT_LIST() );
242 
243  // Creates the flattened sheet list:
244  SCH_SHEET_LIST aSheets( g_RootSheet );
245 
246  // Build netlist info
247  bool success = ret->BuildNetListInfo( aSheets );
248 
249  if( !success )
250  {
251  if( updateStatusText )
252  SetStatusText( _( "No Objects" ) );
253  return ret.release();
254  }
255 
256  wxString msg = wxString::Format( _( "Net count = %d" ), int( ret->size() ) );
257 
258  if( updateStatusText )
259  SetStatusText( msg );
260 
261  return ret.release();
262 }
Class SCH_SHEET_LIST.
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void SCH_EDIT_FRAME::ChangeTextOrient ( SCH_TEXT aTextItem)
private

Definition at line 50 of file edit_label.cpp.

References SCH_TEXT::CanIncrementLabel(), EDA_ITEM::GetFlags(), SCH_TEXT::GetLabelSpinStyle(), OnModify(), SaveCopyInUndoList(), SCH_TEXT::SetLabelSpinStyle(), and UR_CHANGED.

Referenced by OnRotate(), and SetPrintSheetReference().

51 {
52  wxCHECK_RET( (aTextItem != NULL) && aTextItem->CanIncrementLabel(),
53  wxT( "Invalid schematic text item." ) );
54 
55  int orient = ( aTextItem->GetLabelSpinStyle() + 1 ) & 3;
56 
57  // Save current text orientation in undo list if is not already in edit.
58  if( aTextItem->GetFlags() == 0 )
59  SaveCopyInUndoList( aTextItem, UR_CHANGED );
60 
61  aTextItem->SetLabelSpinStyle( orient );
62  OnModify();
63 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
virtual bool CanIncrementLabel() const override
Definition: sch_text.h:183
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
virtual void SetLabelSpinStyle(int aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:278
int GetLabelSpinStyle() const
Definition: sch_text.h:116
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
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 243 of file annotate.cpp.

References SCH_REFERENCE_LIST::CheckAnnotation(), g_RootSheet, SCH_SHEET_PATH::GetComponents(), SCH_SHEET_LIST::GetComponents(), and m_CurrentSheet.

Referenced by AnnotateComponents(), DeleteAllTemplateFieldNames(), prepareForNetlist(), and DIALOG_ERC::TestErc().

244 {
245  // build the screen list
246  SCH_SHEET_LIST sheetList( g_RootSheet );
247  SCH_REFERENCE_LIST componentsList;
248 
249  // Build the list of components
250  if( !aOneSheetOnly )
251  sheetList.GetComponents( componentsList );
252  else
253  m_CurrentSheet->GetComponents( componentsList );
254 
255  return componentsList.CheckAnnotation( aReporter );
256 }
void GetComponents(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet...
Class SCH_SHEET_LIST.
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
int CheckAnnotation(REPORTER &aReporter)
Function CheckAnnotation check for annotations errors.
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

Function CheckForAutoSaveFile checks 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.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 598 of file eda_base_frame.cpp.

References AUTOSAVE_PREFIX_FILENAME, Format(), GetChars(), Pgm(), and traceAutoSave.

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

600 {
601  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
602  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
603 
604  wxFileName autoSaveFileName = aFileName;
605 
606  // Check for auto save file.
607  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
608 
609  wxLogTrace( traceAutoSave,
610  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
611 
612  if( !autoSaveFileName.FileExists() )
613  return;
614 
615  wxString msg = wxString::Format( _(
616  "Well this is potentially embarrassing!\n"
617  "It appears that the last time you were editing the file\n"
618  "\"%s\"\n"
619  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
620  GetChars( aFileName.GetFullName() )
621  );
622 
623  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
624 
625  // Make a backup of the current file, delete the file, and rename the auto save file to
626  // the file name.
627  if( response == wxYES )
628  {
629  // Get the backup file name.
630  wxFileName backupFileName = aFileName;
631  backupFileName.SetExt( aBackupFileExtension );
632 
633  // If an old backup file exists, delete it. If an old copy of the file exists, rename
634  // it to the backup file name
635  if( aFileName.FileExists() )
636  {
637  // Remove the old file backup file.
638  if( backupFileName.FileExists() )
639  wxRemoveFile( backupFileName.GetFullPath() );
640 
641  // Rename the old file to the backup file name.
642  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
643  {
644  msg.Printf( _( "Could not create backup file \"%s\"" ),
645  GetChars( backupFileName.GetFullPath() ) );
646  wxMessageBox( msg );
647  }
648  }
649 
650  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
651  {
652  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
653  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
654  }
655  }
656  else
657  {
658  wxLogTrace( traceAutoSave,
659  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
660 
661  // Remove the auto save file when using the previous file as is.
662  wxRemoveFile( autoSaveFileName.GetFullPath() );
663  }
664 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
#define AUTOSAVE_PREFIX_FILENAME
Prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash...
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void SCH_EDIT_FRAME::CheckListConnections ( PICKED_ITEMS_LIST aItemsList,
bool  aAppend = false 
)

Adds junctions if needed to each item in the list after they have been moved.

Parameters
aItemsListThe list of items to check
aAppendTrue if we are updating a previous commit

Definition at line 118 of file operations_on_items_lists.cpp.

References AddJunction(), SCH_ITEM::GetConnectionPoints(), PICKED_ITEMS_LIST::GetCount(), SCH_LINE::GetEndPoint(), PICKED_ITEMS_LIST::GetPickedItem(), GetSchematicConnections(), GetScreen(), SCH_LINE::GetStartPoint(), i, SCH_ITEM::IsConnectable(), SCH_SCREEN::IsJunctionNeeded(), IsPointOnSegment(), SCH_LINE_T, TrimWire(), EDA_ITEM::Type(), wxPoint::x, and wxPoint::y.

Referenced by GetLastSheetPinPosition(), HandleBlockEnd(), and HandleBlockPlace().

119 {
120  std::vector< wxPoint > pts;
121  std::vector< wxPoint > connections;
122 
123  GetSchematicConnections( connections );
124  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
125  {
126  SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
127  std::vector< wxPoint > new_pts;
128 
129  if( !item->IsConnectable() )
130  continue;
131 
132  item->GetConnectionPoints( new_pts );
133  pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
134 
135  // If the item is a line, we also add any connection points from the rest of the schematic
136  // that terminate on the line after it is moved.
137  if( item->Type() == SCH_LINE_T )
138  {
139  SCH_LINE* line = (SCH_LINE*) item;
140  for( auto i : connections )
141  if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), i ) )
142  pts.push_back( i );
143  }
144  else
145  {
146  // Clean up any wires that short non-wire connections in the list
147  for( auto point = new_pts.begin(); point != new_pts.end(); point++ )
148  {
149  for( auto second_point = point + 1; second_point != new_pts.end(); second_point++ )
150  {
151  aAppend |= TrimWire( *point, *second_point, aAppend );
152  }
153  }
154  }
155  }
156 
157  // We always have some overlapping connection points. Drop duplicates here
158  std::sort( pts.begin(), pts.end(),
159  []( const wxPoint& a, const wxPoint& b ) -> bool
160  { return a.x < b.x || (a.x == b.x && a.y < b.y); } );
161  pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
162 
163  for( auto point : pts )
164  {
165  if( GetScreen()->IsJunctionNeeded( point, true ) )
166  {
167  AddJunction( point, aAppend );
168  aAppend = true;
169  }
170  }
171 }
SCH_JUNCTION * AddJunction(const wxPoint &aPosition, bool aPutInUndoList=false)
Add a new junction at aPosition.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Function IsPointOnSegment.
Definition: trigo.cpp:39
void GetSchematicConnections(std::vector< wxPoint > &aConnections)
Collects a unique list of all possible connection points in the schematic.
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:346
wxPoint GetEndPoint() const
Definition: sch_line.h:80
wxPoint GetStartPoint() const
Definition: sch_line.h:76
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item...
unsigned GetCount() const
Function GetCount.
virtual void GetConnectionPoints(std::vector< wxPoint > &aPoints) const
Function GetConnectionPoints add all the connection points for this item to aPoints.
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
size_t i
Definition: json11.cpp:597
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd, bool aAppend=true)
If any single wire passes through both points, remove the portion between the two points...
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
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 1494 of file sch_edit_frame.h.

1494 { m_exec_flags &= ~( aFlags ); }
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, unless m_configFrameName contains a base name. this is the case of frames which can be shown in normal or modal mode. This is needed because we want only one base name prefix, regardless the mode used.

Definition at line 260 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

Referenced by EDA_BASE_FRAME::LoadSettings(), EDA_DRAW_FRAME::LoadSettings(), EDA_BASE_FRAME::SaveSettings(), and EDA_DRAW_FRAME::SaveSettings().

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
void SCH_EDIT_FRAME::ConvertPart ( SCH_COMPONENT DrawComponent,
wxDC *  DC 
)
private

Definition at line 395 of file getpart.cpp.

References EDA_ITEM::ClearFlags(), DisplayError(), SCH_COMPONENT::Draw(), g_GhostColor, g_XorMode, SCH_COMPONENT::GetConvert(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), SCH_BASE_FRAME::GetLibPart(), SCH_BASE_FRAME::GetScreen(), GR_DEFAULT_DRAWMODE, LIB_PART::HasConversion(), EDA_ITEM::IsMoving(), EDA_DRAW_FRAME::m_canvas, SCH_COMPONENT::SetConvert(), EDA_ITEM::SetFlags(), and SCH_SCREEN::TestDanglingEnds().

Referenced by GetLabelIncrement(), and Process_Special_Functions().

396 {
397  if( !aComponent )
398  return;
399 
400  LIB_ID id = aComponent->GetLibId();
401  LIB_PART* part = GetLibPart( id );
402 
403  if( part )
404  {
405  wxString msg;
406 
407  if( !part->HasConversion() )
408  {
409  msg.Printf( _( "No alternate body style found for symbol \"%s\" in library \"%s\"." ),
410  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
411  DisplayError( this, msg );
412  return;
413  }
414 
415  STATUS_FLAGS flags = aComponent->GetFlags();
416 
417  if( aComponent->GetFlags() )
418  aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
419  else
420  aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
421 
422  aComponent->SetConvert( aComponent->GetConvert() + 1 );
423 
424  // ensure m_Convert = 0, 1 or 2
425  // 0 and 1 = shape 1 = not converted
426  // 2 = shape 2 = first converted shape
427  // > 2 is not used but could be used for more shapes
428  // like multiple shapes for a programmable component
429  // When m_Convert = val max, return to the first shape
430  if( aComponent->GetConvert() > 2 )
431  aComponent->SetConvert( 1 );
432 
433  // The alternate symbol may cause a change in the connection status so test the
434  // connections so the connection indicators are drawn correctly.
436  aComponent->ClearFlags();
437  aComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
438 
439  /* Redraw the component in the new position. */
440  if( aComponent->IsMoving() )
441  aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
442  else
443  aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
444 
445  OnModify();
446  }
447 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Define a library symbol object.
unsigned STATUS_FLAGS
Definition: base_struct.h:142
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
Definition: sch_screen.cpp:913
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
COLOR4D g_GhostColor
Draw color for moving objects.
Definition: common.cpp:58
wxString EDA_DRAW_FRAME::CoordinateToString ( int  aValue,
bool  aConvertToMils = false 
) const
inherited

Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting.

Parameters
aValueThe coordinate to convert.
aConvertToMilsConvert inch values to mils if true. This setting has no effect if the current user unit is millimeters.
Returns
The converted string for display in user interface elements.

Definition at line 871 of file draw_frame.cpp.

References CoordinateToString().

Referenced by getOptimalModulePlacement().

872 {
873  return ::CoordinateToString( aValue, aConvertToMils );
874 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:118
void SCH_EDIT_FRAME::copyBlockItems ( PICKED_ITEMS_LIST aItemsList)
private

Copy the list of block item.

See also
m_blockItems
Parameters
aItemsListList to copy the block select items into.

Definition at line 443 of file eeschema/block.cpp.

References EDA_ITEM::ClearFlags(), BLOCK_SELECTOR::ClearListAndDeleteItems(), DuplicateStruct(), PICKED_ITEMS_LIST::GetCount(), EDA_ITEM::GetFlags(), PICKED_ITEMS_LIST::GetPickedItem(), m_blockItems, BLOCK_SELECTOR::PushItem(), EDA_ITEM::SetFlags(), EDA_ITEM::SetParent(), UR_NEW, and UR_TRANSIENT.

Referenced by GetLabelIncrement(), and HandleBlockEnd().

444 {
445  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
446 
447  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
448  {
449  // Clear m_Flag member of selected items:
450  aItemsList.GetPickedItem( ii )->ClearFlags();
451 
452  /* Make a copy of the original picked item. */
453  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
454  copy->SetParent( NULL );
455  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
456  ITEM_PICKER item( copy, UR_NEW );
457 
458  m_blockItems.PushItem( item );
459  }
460 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes only the list of EDA_ITEM * pointers, AND the data printed b...
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
SCH_ITEM * DuplicateStruct(SCH_ITEM *aDrawStruct, bool aClone=false)
Routine to create a new copy of given struct.
unsigned GetCount() const
Function GetCount.
BLOCK_SELECTOR m_blockItems
List of selected items.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:137
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

Function CopyToClipboard copies the current page or the current block to the clipboard.

Definition at line 42 of file copy_to_clipboard.cpp.

References DrawPageOnClipboard(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_PANEL::GetDefaultCursor(), EDA_DRAW_FRAME::GetScreen(), ID_GEN_COPY_BLOCK_TO_CLIPBOARD, BASE_SCREEN::IsBlockActive(), and EDA_DRAW_FRAME::m_canvas.

Referenced by add_search_paths().

43 {
44  DrawPageOnClipboard( this );
45 
46  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
47  {
48  if( GetScreen()->IsBlockActive() )
49  m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
50 
52  }
53 }
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool IsBlockActive() const
Definition: base_screen.h:499
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
int GetDefaultCursor() const
Function GetDefaultCursor.
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.

References DisplayError(), DisplayErrorMessage(), LIB_ID::Format(), SCH_SCREENS::GetFirst(), SCH_COMPONENT::GetLibId(), LIB_ID::GetLibItemName(), SCH_BASE_FRAME::GetLibPart(), LIB_PART::GetName(), SCH_SCREENS::GetNext(), LIBRARY_TYPE_EESCHEMA, SCH_ITEM::Next(), SCH_COMPONENT_T, LIB_PART::SetName(), and UTF8::wx_str().

Referenced by CreateArchiveLibraryCacheFile(), and GetUndoItem().

66 {
67  wxString tmp;
68  wxString errorMsg;
69  SCH_SCREENS screens;
70 
71  // Create a new empty library to archive components:
72  std::unique_ptr<PART_LIB> archLib( new PART_LIB( LIBRARY_TYPE_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  for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
85  {
86  if( item->Type() != SCH_COMPONENT_T )
87  continue;
88 
89  LIB_PART* part = nullptr;
90  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
91 
92  try
93  {
94  if( archLib->FindAlias( component->GetLibId() ) )
95  continue;
96 
97  part = GetLibPart( component->GetLibId(), true );
98  }
99  catch( const IO_ERROR& )
100  {
101  // Queue up error messages for later.
102  tmp.Printf( _( "Failed to add symbol %s to library file." ),
103  component->GetLibId().GetLibItemName().wx_str(), aFileName );
104 
105  // Don't bail out here. Attempt to add as many of the symbols to the library
106  // as possible.
107  }
108  catch( ... )
109  {
110  tmp = _( "Unexpected exception occurred." );
111  }
112 
113  if( part )
114  {
115  // Use the full LIB_ID as the symbol name to prevent symbol name collisions.
116  wxString oldName = part->GetName();
117  part->SetName( component->GetLibId().Format() );
118 
119  // AddPart() does first clone the part before adding.
120  archLib->AddPart( part );
121  part->SetName( oldName );
122  }
123  else
124  {
125  tmp.Printf( _( "Symbol %s not found in any library or cache." ),
126  component->GetLibId().Format().wx_str() );
127  }
128 
129  if( !tmp.empty() )
130  {
131  if( errorMsg.empty() )
132  errorMsg += tmp;
133  else
134  errorMsg += "\n" + tmp;
135  }
136  }
137  }
138 
139  if( !errorMsg.empty() )
140  {
141  tmp.Printf( _( "Errors occurred creating symbol library %s." ), aFileName );
142  DisplayErrorMessage( this, tmp, errorMsg );
143  }
144 
145  archLib->EnableBuffering( false );
146 
147  try
148  {
149  archLib->Save( false );
150  }
151  catch( ... /* IO_ERROR ioe */ )
152  {
153  errorMsg.Printf( _( "Failed to save symbol library file \"%s\"" ), aFileName );
154  DisplayError( this, errorMsg );
155  return false;
156  }
157 
158  return true;
159 }
SCH_SCREEN * GetNext()
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:199
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
SCH_ITEM * Next() const
wxString wx_str() const
Definition: utf8.cpp:48
const UTF8 & GetLibItemName() const
Definition: lib_id.h:118
Define a library symbol object.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
const LIB_ID & GetLibId() const
UTF8 Format() const
Definition: lib_id.cpp:263
const wxString & GetName() const
virtual void SetName(const wxString &aName)
SCH_SCREEN * GetFirst()
Object used to load, save, search, and otherwise manipulate symbol library files. ...
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:503
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.

References CreateArchiveLibrary(), g_RootSheet, SCH_SCREEN::GetFileName(), GetScreen(), SCH_SHEET::GetScreen(), SchematicLibraryFileExtension, and SCH_SCREENS::UpdateSymbolLinks().

Referenced by GetUndoItem(), OnSaveProject(), and Save_File().

43 {
44  wxFileName fn;
45 
46  if( aUseCurrentSheetFilename )
47  fn = GetScreen()->GetFileName();
48  else
50 
51  fn.SetName( fn.GetName() + "-cache" );
52  fn.SetExt( SchematicLibraryFileExtension );
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;
59  schematic.UpdateSymbolLinks();
60 
61  return success;
62 }
const wxString & GetFileName() const
Definition: sch_screen.h:120
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:279
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
void UpdateSymbolLinks(bool aForce=false)
Initialize or reinitialize the weak reference to the LIB_PART for each SCH_COMPONENT found in the ful...
const wxString SchematicLibraryFileExtension
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:503
SCH_BUS_BUS_ENTRY * SCH_EDIT_FRAME::CreateBusBusEntry ( )
private

Definition at line 42 of file busentry.cpp.

References addCurrentItemToList(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetScreen(), IS_NEW, s_LastShape, SCH_SCREEN::SetCurItem(), and EDA_ITEM::SetFlags().

Referenced by OnLeftClick(), and SetPrintSheetReference().

43 {
44  // Create and place a new bus entry at cursor position
46 
47  busEntry->SetFlags( IS_NEW );
48  GetScreen()->SetCurItem( busEntry );
50  return busEntry;
51 }
Class for a bus to bus entry.
void addCurrentItemToList(bool aRedraw=true)
Add the item currently being edited to the schematic and adds the changes to the undo/redo container...
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
static int s_LastShape
Definition: busentry.cpp:39
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
SCH_BUS_WIRE_ENTRY * SCH_EDIT_FRAME::CreateBusWireEntry ( )
private

Definition at line 53 of file busentry.cpp.

References addCurrentItemToList(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetScreen(), IS_NEW, s_LastShape, SCH_SCREEN::SetCurItem(), and EDA_ITEM::SetFlags().

Referenced by OnLeftClick(), and SetPrintSheetReference().

54 {
55  // Create and place a new bus entry at cursor position
57 
58  busEntry->SetFlags( IS_NEW );
59  GetScreen()->SetCurItem( busEntry );
61  return busEntry;
62 }
void addCurrentItemToList(bool aRedraw=true)
Add the item currently being edited to the schematic and adds the changes to the undo/redo container...
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
static int s_LastShape
Definition: busentry.cpp:39
Class for a wire to bus entry.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool SCH_EDIT_FRAME::CreateNetlist ( int  aFormat,
const wxString &  aFullFileName,
unsigned  aNetlistOptions,
REPORTER aReporter = NULL,
bool  silent = false 
)

Create a netlist for the current schematic.

  • Test for some issues (missing or duplicate references and sheet names)
  • Build netlist info
  • Create the netlist file (different formats)
Parameters
aFormat= netlist format (NET_TYPE_PCBNEW ...)
aFullFileName= full netlist file name
aNetlistOptions= netlist options using OR'ed bits.

For SPICE netlist only: if NET_USE_NETNAMES is set, use net names from labels in schematic else use net numbers (net codes) if NET_USE_X_PREFIX is set : change "U" and "IC" reference prefix to "X"

Parameters
aReporter= a REPORTER to report error messages, mainly if a command line must be run (can be NULL
Returns
true if success.

Definition at line 213 of file netlist_generator.cpp.

References SCH_SHEET_LIST::AnnotatePowerSymbols(), BuildNetListBase(), g_RootSheet, prepareForNetlist(), SCH_SCREENS::UpdateSymbolLinks(), and WriteNetListFile().

Referenced by DeleteAllTemplateFieldNames(), NETLIST_DIALOG::GenNetlist(), DIALOG_BOM::OnRunPlugin(), and NETLIST_DIALOG::RunSimulator().

215 {
216  if( !aSilent ) // checks for errors and invokes annotation dialog as neccessary
217  {
218  if( !prepareForNetlist() )
219  return false;
220  }
221  else // performs similar function as prepareForNetlist but without a dialog.
222  {
223  SCH_SCREENS schematic;
224  schematic.UpdateSymbolLinks();
225  SCH_SHEET_LIST sheets( g_RootSheet );
226  sheets.AnnotatePowerSymbols();
227  }
228 
229  std::unique_ptr<NETLIST_OBJECT_LIST> connectedItemsList( BuildNetListBase() );
230 
231  bool success = WriteNetListFile( connectedItemsList.release(), aFormat,
232  aFullFileName, aNetlistOptions, aReporter );
233 
234  return success;
235 }
Class SCH_SHEET_LIST.
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
bool prepareForNetlist()
Verify that annotation is complete so that a proper netlist is even possible.
void UpdateSymbolLinks(bool aForce=false)
Initialize or reinitialize the weak reference to the LIB_PART for each SCH_COMPONENT found in the ful...
bool WriteNetListFile(NETLIST_OBJECT_LIST *aConnectedItemsList, int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
Create a netlist file.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:503
SCH_BITMAP * SCH_EDIT_FRAME::CreateNewImage ( wxDC *  aDC)
private

Definition at line 101 of file edit_bitmap.cpp.

References abortMoveBitmap(), SCH_BITMAP::Draw(), GetChars(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetScreen(), GR_DEFAULT_DRAWMODE, IS_MOVED, IS_NEW, EDA_DRAW_FRAME::m_canvas, moveBitmap(), OnModify(), SCH_BITMAP::ReadImageFile(), SCH_SCREEN::SetCurItem(), EDA_ITEM::SetFlags(), and EDA_DRAW_PANEL::SetMouseCapture().

Referenced by OnLeftClick(), and SetPrintSheetReference().

102 {
103  wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString,
104  _( "Image Files " ) + wxImage::GetImageExtWildcard(),
105  wxFD_OPEN );
106  int diag = fileDlg.ShowModal();
107 
108  if( diag != wxID_OK )
109  return NULL;
110 
111  wxString fullFilename = fileDlg.GetPath();
112 
113  if( !wxFileExists( fullFilename ) )
114  {
115  wxMessageBox( _( "Couldn't load image from \"%s\"" ), GetChars( fullFilename ) );
116  return NULL;
117  }
118 
120 
121  SCH_BITMAP* image = new SCH_BITMAP( pos );
122 
123  if( !image->ReadImageFile( fullFilename ) )
124  {
125  wxMessageBox( _( "Couldn't load image from \"%s\"" ), GetChars( fullFilename ) );
126  delete image;
127  return NULL;
128  }
129 
130 
131  image->SetFlags( IS_NEW | IS_MOVED );
132  image->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
133 
135  GetScreen()->SetCurItem( image );
136 
137  OnModify();
138  return image;
139 }
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
Definition: sch_bitmap.cpp:114
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen* and ...
static void moveBitmap(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: edit_bitmap.cpp:73
static void abortMoveBitmap(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: edit_bitmap.cpp:37
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
bool ReadImageFile(const wxString &aFullFilename)
Reads and stores an image file.
Definition: sch_bitmap.cpp:80
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
#define IS_MOVED
Item being moved.
Definition: base_struct.h:108
SCH_TEXT * SCH_EDIT_FRAME::CreateNewText ( wxDC *  aDC,
int  aType 
)
private

Definition at line 66 of file edit_label.cpp.

References DisplayError(), SCH_TEXT::Draw(), EditSchematicText(), g_XorMode, EDA_DRAW_FRAME::GetCrossHairPosition(), GetDefaultTextSize(), SCH_TEXT::GetLabelSpinStyle(), SCH_TEXT::GetShape(), EDA_TEXT::GetText(), IS_MOVED, IS_NEW, EDA_TEXT::IsBold(), EDA_TEXT::IsItalic(), lastGlobalLabelShape, lastTextBold, lastTextItalic, lastTextOrientation, LAYER_GLOBLABEL, LAYER_HIERLABEL, LAYER_LOCLABEL, LAYER_NOTES, EDA_DRAW_FRAME::m_canvas, PrepareMoveItem(), SCH_GLOBAL_LABEL_T, SCH_HIERARCHICAL_LABEL_T, EDA_TEXT::SetBold(), EDA_ITEM::SetFlags(), EDA_TEXT::SetItalic(), SCH_TEXT::SetLabelSpinStyle(), SetRepeatItem(), SCH_TEXT::SetShape(), EDA_TEXT::SetTextSize(), and EDA_ITEM::Type().

Referenced by OnLeftClick(), Process_Special_Functions(), and SetPrintSheetReference().

67 {
68  SCH_TEXT* textItem = NULL;
69 
70  SetRepeatItem( NULL );
71 
72  switch( aType )
73  {
74  case LAYER_NOTES:
75  textItem = new SCH_TEXT( GetCrossHairPosition() );
76  break;
77 
78  case LAYER_LOCLABEL:
79  textItem = new SCH_LABEL( GetCrossHairPosition() );
80  break;
81 
82  case LAYER_HIERLABEL:
83  textItem = new SCH_HIERLABEL( GetCrossHairPosition() );
84  textItem->SetShape( lastGlobalLabelShape );
85  break;
86 
87  case LAYER_GLOBLABEL:
88  textItem = new SCH_GLOBALLABEL( GetCrossHairPosition() );
89  textItem->SetShape( lastGlobalLabelShape );
90  break;
91 
92  default:
93  DisplayError( this, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
94  return NULL;
95  }
96 
97  textItem->SetBold( lastTextBold );
98  textItem->SetItalic( lastTextItalic );
100  textItem->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
101  textItem->SetFlags( IS_NEW | IS_MOVED );
102 
103  EditSchematicText( textItem );
104 
105  if( textItem->GetText().IsEmpty() )
106  {
107  delete textItem;
108  return NULL;
109  }
110 
111  lastTextBold = textItem->IsBold();
112  lastTextItalic = textItem->IsItalic();
114 
115  if( ( textItem->Type() == SCH_GLOBAL_LABEL_T ) ||
116  ( textItem->Type() == SCH_HIERARCHICAL_LABEL_T ) )
117  {
118  lastGlobalLabelShape = textItem->GetShape();
119  }
120 
121  // Prepare display to move the new item
122  textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
123  PrepareMoveItem( (SCH_ITEM*) textItem, aDC );
124 
125  return textItem;
126 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:118
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:120
virtual void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, const wxPoint &offset, GR_DRAWMODE draw_mode, COLOR4D Color=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
Definition: sch_text.cpp:345
bool IsItalic() const
Definition: eda_text.h:168
static int lastTextOrientation
Definition: edit_label.cpp:45
static PINSHEETLABEL_SHAPE lastGlobalLabelShape
Definition: edit_label.cpp:44
virtual void SetLabelSpinStyle(int aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:278
void SetItalic(bool isItalic)
Definition: eda_text.h:167
int GetLabelSpinStyle() const
Definition: sch_text.h:116
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:212
static bool lastTextItalic
Definition: edit_label.cpp:47
bool IsBold() const
Definition: eda_text.h:171
void PrepareMoveItem(SCH_ITEM *aItem, wxDC *aDC)
Start moving aItem using the mouse.
Definition: schedit.cpp:781
void SetRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
void EditSchematicText(SCH_TEXT *TextStruct)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static bool lastTextBold
Definition: edit_label.cpp:46
void SetBold(bool aBold)
Definition: eda_text.h:170
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
int GetDefaultTextSize()
Default size for text in general.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:108
void SCH_EDIT_FRAME::CreateScreens ( )

Definition at line 551 of file sch_edit_frame.cpp.

References g_RootSheet, SCH_SHEET::GetScreen(), Kiway, SCH_SCREEN::SetFileName(), BASE_SCREEN::SetMaxUndoItems(), and SCH_SHEET::SetScreen().

Referenced by DeleteAllTemplateFieldNames(), importFile(), and OpenProjectFiles().

552 {
553  if( g_RootSheet == NULL )
554  {
555  g_RootSheet = new SCH_SHEET();
556  }
557 
558  if( g_RootSheet->GetScreen() == NULL )
559  {
560  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
562  g_RootSheet->SetScreen( screen );
564  }
565 
567 
568  m_CurrentSheet->clear();
569  m_CurrentSheet->push_back( g_RootSheet );
570 
571  if( GetScreen() == NULL )
572  {
573  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
575  SetScreen( screen );
576  }
577 
578  GetScreen()->SetZoom( 32.0 );
579 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
wxString m_DefaultSchematicFileName
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:159
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:104
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:279
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:94
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
void SetMaxUndoItems(int aMax)
Definition: base_screen.h:313
void SetFileName(const wxString &aFileName)
Definition: sch_screen.h:118
void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

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

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

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

Definition at line 424 of file sheet.cpp.

References EDA_DRAW_PANEL::CallMouseCapture(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), ExitSheet(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetNewTimeStamp(), SCH_SHEET::GetResizePosition(), GetScreen(), IS_NEW, IS_RESIZED, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), resizeSheetWithMouseCursor(), EDA_DRAW_FRAME::SetCrossHairPosition(), SCH_SCREEN::SetCurItem(), EDA_ITEM::SetFlags(), EDA_DRAW_PANEL::SetMouseCapture(), EDA_ITEM::SetParent(), SetRepeatItem(), SCH_SHEET::SetScreen(), and EDA_ITEM::SetTimeStamp().

Referenced by OnLeftClick(), and SetPrintSheetReference().

425 {
426  SetRepeatItem( NULL );
427 
428  SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
429 
430  sheet->SetFlags( IS_NEW | IS_RESIZED );
431  sheet->SetTimeStamp( GetNewTimeStamp() );
432  sheet->SetParent( GetScreen() );
433  sheet->SetScreen( NULL );
434 
435  // need to check if this is being added to the GetDrawItems().
436  // also need to update the hierarchy, if we are adding
437  // a sheet to a screen that already has multiple instances (!)
438  GetScreen()->SetCurItem( sheet );
440  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
441  m_canvas->CrossHairOff( aDC );
442 
444 
446  m_canvas->CrossHairOn( aDC );
447 
448  return sheet;
449 }
static void ExitSheet(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: sheet.cpp:380
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:104
wxPoint GetResizePosition() const
Return the position of the lower right corner of the sheet in drawing units.
Definition: sch_sheet.cpp:906
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
void SetRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:167
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static void resizeSheetWithMouseCursor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: sheet.cpp:338
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:265
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:272
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:110
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
SCH_SHEET_PIN * SCH_EDIT_FRAME::CreateSheetPin ( SCH_SHEET aSheet,
wxDC *  aDC 
)
private

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

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

Definition at line 110 of file sheetlab.cpp.

References SCH_SHEET_PIN::Draw(), EditSheetPin(), g_XorMode, EDA_DRAW_FRAME::GetCrossHairPosition(), GetLastSheetPinTextSize(), SCH_TEXT::GetShape(), EDA_TEXT::GetText(), EDA_TEXT::GetTextSize(), IS_NEW, EDA_DRAW_FRAME::m_canvas, m_lastSheetPinTextSize, m_lastSheetPinType, OnModify(), PrepareMoveItem(), EDA_ITEM::SetFlags(), SCH_SHEET_PIN::SetPosition(), SCH_TEXT::SetShape(), and EDA_TEXT::SetTextSize().

Referenced by GetLastSheetPinPosition(), and OnLeftClick().

111 {
112  wxString line;
113  SCH_SHEET_PIN* sheetPin;
114 
115  sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), line );
116  sheetPin->SetFlags( IS_NEW );
117  sheetPin->SetTextSize( GetLastSheetPinTextSize() );
118  sheetPin->SetShape( m_lastSheetPinType );
119 
120  int response = EditSheetPin( sheetPin, false );
121 
122  if( sheetPin->GetText().IsEmpty() || (response == wxID_CANCEL) )
123  {
124  delete sheetPin;
125  return NULL;
126  }
127 
128  m_lastSheetPinType = sheetPin->GetShape();
129  m_lastSheetPinTextSize = sheetPin->GetTextSize();
130 
131  sheetPin->SetPosition( GetCrossHairPosition() );
132  sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
133  PrepareMoveItem( (SCH_ITEM*) sheetPin, aDC );
134 
135  OnModify();
136  return sheetPin;
137 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:118
void SetShape(PINSHEETLABEL_SHAPE aShape)