KiCad PCB EDA Suite
SCH_EDIT_FRAME Class Reference

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

#include <schframe.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 ()
 Function GetProjectFileParametersList returns the project file parameter list for Eeschema. More...
 
void SaveProjectSettings (bool aAskForSave) override
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
bool LoadProjectFile ()
 Function LoadProjectFile loads the KiCad project file (*.pro) settings specific to Eeschema. More...
 
int AddTemplateFieldName (const TEMPLATE_FIELDNAME &aFieldName)
 Function AddTemplateFieldName inserts or appends a wanted symbol field name into the field names template. More...
 
const TEMPLATE_FIELDNAMESGetTemplateFieldNames ()
 Function GetTemplateFieldName returns a template field names list for read only access. More...
 
const TEMPLATESGetTemplates ()
 Function GetTemplates returns the field names template for read only access. More...
 
void DeleteAllTemplateFieldNames ()
 Function DeleteAllTemplateFieldNames removes all template field names. More...
 
PARAM_CFG_ARRAYGetConfigurationSettings ()
 Function GetConfigurationSettings returns 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 ()
 Function 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)
 Function LocateAndShowItem checks 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)
 Function LocateItem checks for items at aPosition matching the types in aFilterList. More...
 
bool DeleteItemAtCrossHair (wxDC *aDC)
 Function DeleteItemAtCrossHair delete the item found under the cross hair. More...
 
bool HighlightConnectionAtPosition (wxPoint aPosition)
 Function HighlightConnectionAtPosition Highlight the connection found at aPosition. More...
 
SCH_ITEMFindComponentAndItem (const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText, bool aWarpMouse)
 Function FindComponentAndItem finds a component in the schematic and an item in this component. More...
 
void SendMessageToPCBNEW (EDA_ITEM *aObjectToSync, SCH_COMPONENT *aPart)
 Function SendMessageToPcbnew send a remote to Pcbnew via a socket connection. More...
 
NETLIST_OBJECT_LISTBuildNetListBase (bool updateStatusText=true)
 BuildNetListBase netlist generation: Creates a flat list which stores all connected objects, and mainly pins and labels. More...
 
bool CreateNetlist (int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
 Function CreateNetlist. More...
 
bool WriteNetListFile (NETLIST_OBJECT_LIST *aConnectedItemsList, int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
 Function WriteNetListFile Create the netlist file. More...
 
void DeleteAnnotation (bool aCurrentSheetOnly)
 Function DeleteAnnotation clears the current component annotation. More...
 
void AnnotateComponents (bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits)
 Function AnnotateComponents. More...
 
int CheckAnnotate (wxArrayString *aMessageList, bool aOneSheetOnly)
 Function CheckAnnotate checks for annotation errors. More...
 
SCH_SHEET_PATHGetCurrentSheet ()
 
void SetCurrentSheet (const SCH_SHEET_PATH &aSheet)
 
void DisplayCurrentSheet ()
 Function DisplayCurrentSheet draws the current sheet on the display. More...
 
bool SetCurrentSheetHighlightFlags ()
 Function SetCurrentSheetHighlightFlags Set/reset the BRIGHTENED of connected objects inside the current sheet, according to the highligthed net name. More...
 
wxString GetUniqueFilenameForCurrentSheet ()
 Function GetUniqueFilenameForCurrentSheet. More...
 
void SetSheetNumberAndCount ()
 Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must be called after a delete or add sheet command, and when entering a sheet. 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)
 Function OnSaveProject is the 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 AppendOneEEProject ()
 Function AppendOneEEProject read an entire project and loads it into the schematic editor without replacing the existing contents. More...
 
bool LoadOneEEFile (SCH_SCREEN *aScreen, const wxString &aFullFileName, bool append=false)
 Function LoadOneEEFile loads the schematic (.sch) file aFullFileName into aScreen. More...
 
bool LoadCmpToFootprintLinkFile ()
 Function ReadCmpToFootprintLinkFile Loads a .cmp file from CvPcb and update the footprin field of components Prepares parameters and calls ProcessCmpToFootprintLinkFile to actually read the file and update Fp fields. More...
 
bool ProcessCmpToFootprintLinkFile (const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
 Function ProcessStuffFile gets footprint info from each line in the Stuff File by Ref Desg. More...
 
bool SaveEEFile (SCH_SCREEN *aScreen, bool aSaveUnderNewName=false, bool aCreateBackupFile=CREATE_BACKUP_FILE)
 Function SaveEEFile saves aScreen to a schematic file. More...
 
bool IsSearchCacheObsolete (const SCH_FIND_REPLACE_DATA &aSearchCriteria)
 
bool EditSheet (SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
 Function EditSheet is used to edit an existing sheet or add a new sheet to the schematic. More...
 
wxPoint GetLastSheetPinPosition () const
 
void DeleteItem (SCH_ITEM *aItem)
 Function DeleteItem removes aItem from the current screen and saves it in the undo list. More...
 
int GetLabelIncrement () const
 
void OrientComponent (COMPONENT_ORIENTATION_T aOrientation=CMP_NORMAL)
 Function OrientComponent rotates and mirrors a component. More...
 
void SaveCopyInUndoList (SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Function SaveCopyInUndoList. More...
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Function SaveCopyInUndoList (overloaded). More...
 
void Key (wxDC *DC, int hotkey, EDA_ITEM *DrawStruct)
 
void InitBlockPasteInfos () override
 Function InitBlockPasteInfos initializes the parameters used by the block paste command. More...
 
virtual int BlockCommand (EDA_KEY aKey) override
 Function BlockCommand Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...) 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
 Function HandleBlockPlace Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place (bloc move, drag, copy . More...
 
virtual bool HandleBlockEnd (wxDC *aDC) override
 Function HandleBlockEnd Handle the "end" of a block command, i.e. More...
 
void RepeatDrawItem (wxDC *DC)
 Function RepeatDrawItem repeats the last item placement if the last item was a bus, bus entry, label, or component. More...
 
void SetRepeatItem (SCH_ITEM *aItem)
 Function SetRepeatItem clones aItem and owns that clone in this container. More...
 
SCH_ITEMGetRepeatItem () const
 Function GetRepeatItem returns the item which is to be repeated with the insert key. More...
 
void SetUndoItem (const SCH_ITEM *aItem)
 Function SetUndoItem clones 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)
 Function SaveUndoItemInUndoList swaps 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)
 Function CreateArchiveLibraryCacheFile creates a library file with the name of the root document plus the '-cache' suffix, That file will contain all components used in the current schematic. More...
 
bool CreateArchiveLibrary (const wxString &aFileName)
 Function CreateArchiveLibrary creates a library aFileName that contains all components used in the current schematic. More...
 
bool RescueProject (bool aRunningOnDemand)
 Function RescueProject performs rescue operations to recover old projects from before certain changes were made. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL) override
 Function PrintPage plots or prints the current sheet to the clipboard. More...
 
void SetSimulatorCommand (const wxString &aCommand)
 
wxString GetSimulatorCommand () const
 
void SetNetListerCommand (const wxString &aCommand)
 
void DefaultExecFlags ()
 Function DefaultExecFlags resets the execution flags to defaults for external netlist and bom generators. More...
 
void SetExecFlags (const int aFlags)
 Function SetExecFlags sets (adds) specified flags for next execution of external generator of the netlist or bom. More...
 
void ClearExecFlags (const int aFlags)
 Function ClearExecFlags clears (removes) specified flags that not needed for next execution of external generator of the netlist or bom. More...
 
wxString GetNetListerCommand () const
 
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, const wxString &aHighlight=wxEmptyString, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. 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 ()
 
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...
 
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 () const
 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)
 Function OnZoom Called from any zoom event (toolbar , hotkey or popup ) More...
 
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)
 Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window screen. More...
 
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)
 Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
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...
 
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...
 
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...
 
bool Enable (bool enable) override
 
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)
 Function GetDefaultFieldName returns 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
 Function doAutoSave saves the schematic files that have been modified and not yet saved. More...
 
virtual bool isAutoSaveRequired () const override
 Function autoSaveRequired returns true if the schematic has been modified. More...
 
void addCurrentItemToList (bool aRedraw=true)
 Function addCurrentItemToList adds 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) throw ( IO_ERROR, boost::bad_pointer )
 
bool prepareForNetlist ()
 Function prepareForNetlist verifies that annotation is complete so that a proper netlist is even possible. More...
 
void sendNetlist ()
 Function sendNetlist sends the kicad netlist over to CVPCB. More...
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (const SCHLIB_FILTER *aFilter, LIB_ALIAS *aPreselectedAlias, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
void OnOpenLibraryViewer (wxCommandEvent &event)
 Function OnOpenLibraryViewer Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (PART_LIB *aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Function DisplayComponentsNamesInLib Select a component from the list of components in a library. More...
 
PART_LIBSelectLibraryFromList ()
 Function SelectLibraryFromList displays a list of current loaded libraries, and allows the user to select a library This list is sorted, with the library cache always at end of the list. More...
 
bool SelectPartNameToLoad (PART_LIB *aLibrary, wxString &aBufName)
 Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a library. More...
 
void SetScreen (BASE_SCREEN *aScreen)
 
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...
 
void 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)
 
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...
 
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...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. 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_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...
 

Private Member Functions

void OnAutoplaceFields (wxCommandEvent &aEvent)
 Function OnAutoplaceFields handles the ID_AUTOPLACE_FIELDS event. More...
 
void OnMoveItem (wxCommandEvent &aEvent)
 Function OnMoveItem handles the ID_SCH_MOVE_ITEM event used to move schematic itams. More...
 
void OnRotate (wxCommandEvent &aEvent)
 Function OnRotate handles the ID_SCH_ROTATE_CLOCKWISE and ID_SCH_ROTATE_COUNTERCLOCKWISE events used to rotate schematic itams and blocks. More...
 
void OnEditItem (wxCommandEvent &aEvent)
 Function OnEditItem handles the ID_SCH_EDIT_ITEM event used to edit schematic itams. More...
 
void OnDragItem (wxCommandEvent &aEvent)
 Function OnDragItem handles the ID_SCH_DRAG_ITEM event used to drag schematic itams. More...
 
void OnOrient (wxCommandEvent &aEvent)
 Function OnOrient handles the ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, and ID_SCH_ORIENT_NORMAL events used to orient schematic itams 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)
 Function OnFindSchematicItem finds an item in the schematic matching the search criteria in aEvent. More...
 
void OnFindReplace (wxFindDialogEvent &aEvent)
 Function OnReplace performs 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 OnNewProject (wxCommandEvent &event)
 
void OnLoadProject (wxCommandEvent &event)
 
void OnAppendProject (wxCommandEvent &event)
 
void OnOpenPcbnew (wxCommandEvent &event)
 
void OnOpenPcbModuleEditor (wxCommandEvent &event)
 
void OnOpenCvpcb (wxCommandEvent &event)
 
void OnOpenLibraryEditor (wxCommandEvent &event)
 
void OnRescueProject (wxCommandEvent &event)
 
void OnPreferencesOptions (wxCommandEvent &event)
 
void OnCancelCurrentCommand (wxCommandEvent &aEvent)
 
void OnSelectItem (wxCommandEvent &aEvent)
 
void OnCopySchematicItemRequest (wxCommandEvent &event)
 Function OnCopySchematicItemRequest is the command event handler for duplicating the item at the current location. More...
 
void OnUpdateBlockSelected (wxUpdateUIEvent &event)
 
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 UpdateTitle ()
 Function UpdateTitle sets 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 (wxDC *aDC, const wxPoint &aPosition)
 Function AddNoConnect add a no connect item to the current schematic sheet at aPosition. More...
 
SCH_JUNCTIONAddJunction (wxDC *aDC, const wxPoint &aPosition, bool aPutInUndoList=false)
 Function AddJunction adds a new junction at aPosition. More...
 
void PrepareMoveItem (SCH_ITEM *aItem, wxDC *aDC)
 Function PrepareMoveItem 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)
 Function OnCovertTextType is a command event handler to change a text type to an other one. More...
 
void BeginSegment (wxDC *DC, int type)
 Function BeginSegment creates a new segment ( WIRE, BUS ) or terminates the current segment in progress. More...
 
void EndSegment (wxDC *DC)
 Function EndSegment called to terminate a bus, wire, or line creation. More...
 
void DeleteCurrentSegment (wxDC *DC)
 Function DeleteCurrentSegment erases 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)
 Function MirrorImage 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 on itself. More...
 
void MirrorSheet (SCH_SHEET *aSheet, bool aFromXaxis)
 Function MirrorSheet Mirror a hierarchical sheet Mirroring is made around its centre. More...
 
bool LoadCacheLibrary (const wxString &aFileName)
 Loads the cache library associated to the aFileName. More...
 
SCH_SHEET_PINCreateSheetPin (SCH_SHEET *aSheet, wxDC *aDC)
 Function CreateSheetPin creates 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)
 Function EditSheetPin displays the dialog for editing the parameters of aSheetPin. More...
 
SCH_SHEET_PINImportSheetPin (SCH_SHEET *aSheet, wxDC *aDC)
 Function ImportSheetPin automatically creates 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)
 Function Load_Component loads from a library and places a component. More...
 
void EditComponent (SCH_COMPONENT *aComponent)
 Function EditComponent displays 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)
 Function EditComponentFieldText displays the edit field dialog to edit the parameters of aField. More...
 
void RotateField (SCH_FIELD *aField)
 
void PasteListOfItems (wxDC *DC)
 Function PastListOfItems pastes a list of items from the block stack. More...
 
void PutDataInPreviousState (PICKED_ITEMS_LIST *aList, bool aRedoCommand)
 Function PutDataInPreviousState is used in undo or redo command to put data pointed by List in the previous state, i.e. More...
 
void GetSchematicFromRedoList (wxCommandEvent &event)
 Function GetSchematicFromRedoList Redo the last edition: More...
 
void GetSchematicFromUndoList (wxCommandEvent &event)
 Function GetSchematicFromUndoList performs an undo the last edition: More...
 
void copyBlockItems (PICKED_ITEMS_LIST &aItemsList)
 Function copyBlockItems copies the list of block item. More...
 
void addJunctionMenuEntries (wxMenu *aMenu, SCH_JUNCTION *aJunction)
 Function addJunctionMenuEntries adds 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_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...
 
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 117 of file schframe.h.

Member Typedef Documentation

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

Definition at line 141 of file sch_base_frame.h.

Constructor & Destructor Documentation

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

Definition at line 442 of file schframe.cpp.

References g_RootSheet.

443 {
444  delete m_item_to_repeat; // we own the cloned object, see this->SetRepeatItem()
445 
446  SetScreen( NULL );
447 
448  delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
449  delete m_undoItem;
450  delete g_RootSheet;
451  delete m_findReplaceData;
452 
453  m_CurrentSheet = NULL;
454  m_undoItem = NULL;
455  g_RootSheet = NULL;
456  m_findReplaceData = NULL;
457 }
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
wxFindReplaceData * m_findReplaceData
Definition: schframe.h:127
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
Definition: schframe.h:140
SCH_ITEM * m_undoItem
Copy of the current item being edited.
Definition: schframe.h:144

Member Function Documentation

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

Function addCurrentItemToList adds 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 1279 of file schframe.cpp.

References SCH_SCREEN::Append(), SCH_SCREEN::CheckIfOnDrawList(), EDA_ITEM::ClearFlags(), p2t::cmp(), SCH_SCREEN::GetCurItem(), EDA_ITEM::GetParent(), SCH_ITEM::IsConnectable(), 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().

1280 {
1281  SCH_SCREEN* screen = GetScreen();
1282  SCH_ITEM* item = screen->GetCurItem();
1283 
1284  wxCHECK_RET( item != NULL, wxT( "Cannot add current item to list." ) );
1285 
1286  m_canvas->SetAutoPanRequest( false );
1287 
1288  SCH_ITEM* undoItem = item;
1289 
1290  if( item->Type() == SCH_SHEET_PIN_T )
1291  {
1292  SCH_SHEET* sheet = (SCH_SHEET*) item->GetParent();
1293 
1294  wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
1295  wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
1296 
1297  undoItem = sheet;
1298  }
1299 
1300  else if( item->Type() == SCH_FIELD_T )
1301  {
1302  SCH_COMPONENT* cmp = (SCH_COMPONENT*) item->GetParent();
1303 
1304  wxCHECK_RET( (cmp != NULL) && (cmp->Type() == SCH_COMPONENT_T),
1305  wxT( "Cannot place field in invalid schematic component object." ) );
1306 
1307  undoItem = cmp;
1308  }
1309 
1310  if( item->IsNew() )
1311  {
1312  if( item->Type() == SCH_SHEET_T )
1313  {
1314  // Fix the size and position of the new sheet using the last values set by
1315  // the m_mouseCaptureCallback function.
1316  m_canvas->SetMouseCapture( NULL, NULL );
1317 
1318  if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
1319  {
1320  screen->SetCurItem( NULL );
1321  delete item;
1322 
1323  if( aRedraw )
1324  GetCanvas()->Refresh();
1325 
1326  return;
1327  }
1328 
1330  }
1331 
1332  if( undoItem == item )
1333  {
1334  if( !screen->CheckIfOnDrawList( item ) ) // don't want a loop!
1335  screen->Append( item );
1336 
1337  SetRepeatItem( item );
1338 
1339  SaveCopyInUndoList( undoItem, UR_NEW );
1340  }
1341  else
1342  {
1343  // Here, item is not a basic schematic item, but an item inside
1344  // a parent basic schematic item,
1345  // currently: sheet pin or component field.
1346  // currently, only a sheet pin can be found as new item,
1347  // because new component fields have a specific handling, and do not appears here
1348  SaveCopyInUndoList( undoItem, UR_CHANGED );
1349 
1350  if( item->Type() == SCH_SHEET_PIN_T )
1351  ( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
1352  else
1353  wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
1354  item->Type() );
1355  }
1356  }
1357  else
1358  {
1359  SaveUndoItemInUndoList( undoItem );
1360  }
1361 
1362  item->ClearFlags();
1363  screen->SetModify();
1364  screen->SetCurItem( NULL );
1365  m_canvas->SetMouseCapture( NULL, NULL );
1367 
1368  if( item->IsConnectable() )
1369  screen->TestDanglingEnds();
1370 
1371  if( aRedraw )
1372  GetCanvas()->Refresh();
1373 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
bool IsNew() const
Definition: base_struct.h:216
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
EDA_ITEM * GetParent() const
Definition: base_struct.h:208
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)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
void SaveUndoItemInUndoList(SCH_ITEM *aItem)
Function SaveUndoItemInUndoList swaps the cloned item in member variable m_undoItem with aItem and sa...
Definition: schframe.cpp:598
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item...
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SetAutoPanRequest(bool aEnable)
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void Append(SCH_ITEM *aItem)
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:486
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:911
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
bool EditSheet(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
Function EditSheet is used to edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:44
bool cmp(const Point *a, const Point *b)
Definition: shapes.h:227
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:187
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 ( wxDC *  aDC,
const wxPoint aPosition,
bool  aPutInUndoList = false 
)
private

Function AddJunction adds a new junction at aPosition.

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

References SCH_SCREEN::Append(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), SCH_JUNCTION::Draw(), GetScreen(), GR_DEFAULT_DRAWMODE, EDA_DRAW_FRAME::m_canvas, OnModify(), SaveCopyInUndoList(), SetRepeatItem(), and UR_NEW.

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

416 {
417  SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition );
418 
419  SetRepeatItem( junction );
420 
421  m_canvas->CrossHairOff( aDC ); // Erase schematic cursor
422  junction->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
423  m_canvas->CrossHairOn( aDC ); // Display schematic cursor
424 
425  if( aPutInUndoList )
426  {
427  GetScreen()->Append( junction );
428  SaveCopyInUndoList( junction, UR_NEW );
429  OnModify();
430  }
431 
432  return junction;
433 }
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.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
void Append(SCH_ITEM *aItem)
void SCH_EDIT_FRAME::addJunctionMenuEntries ( wxMenu *  aMenu,
SCH_JUNCTION aJunction 
)
private

Function addJunctionMenuEntries adds the context menu items to aMenu for aJunction.

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

Definition at line 632 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 OnRightClick().

633 {
634  wxString msg;
635  SCH_SCREEN* screen = GetScreen();
636 
637  msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
638  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
639 
640  if( !aJunction->IsNew() )
641  {
643  AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( move_xpm ) );
644 
645  if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
646  AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
647  KiBitmap( break_line_xpm ) );
648  }
649 
650  if( screen->GetWireOrBus( aJunction->GetPosition() ) )
651  {
652  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
653  KiBitmap( delete_node_xpm ) );
654  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
655  KiBitmap( delete_connection_xpm ) );
656  }
657 }
bool IsNew() const
Definition: base_struct.h:216
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:55
SCH_COLLECTOR m_collectedItems
List of collected items.
Definition: schframe.h:142
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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:92
SCH_LINE * GetWire(const wxPoint &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T)
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)
Function GetWireOrBus returns a wire or bus item located at aPosition.
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 671 of file basicframe.cpp.

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

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

672 {
673  wxMenu* menu = NULL;
674  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
675 
676  if( item ) // This menu exists, do nothing
677  return;
678 
679  menu = new wxMenu;
680 
681  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
682  _( "Icons in Menus" ), wxEmptyString,
683  wxITEM_CHECK ) );
684  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
685 
686  AddMenuItem( MasterMenu, menu,
688  _( "Icons Options" ),
689  _( "Select show icons in menus and icons sizes" ),
690  KiBitmap( hammer_xpm ) );
691 }
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:55
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:36
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 239 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, 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().

240 {
241  int maxZoomIds;
242  double zoom;
243  wxString msg;
244  BASE_SCREEN* screen = m_canvas->GetScreen();
245 
246  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
247  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
248  msg = AddHotkeyName( _( "Zoom in" ), m_hotkeysDescrList, HK_ZOOM_IN );
249  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
250  msg = AddHotkeyName( _( "Zoom out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
251  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
252  msg = AddHotkeyName( _( "Redraw view" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
253  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
254  msg = AddHotkeyName( _( "Zoom auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
255  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
256 
257 
258  wxMenu* zoom_choice = new wxMenu;
259  AddMenuItem( MasterMenu, zoom_choice,
260  ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ),
261  KiBitmap( zoom_selection_xpm ) );
262 
263  zoom = screen->GetZoom();
265  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
266  maxZoomIds : screen->m_ZoomList.size();
267 
268  // Populate zoom submenu.
269  for( int i = 0; i < maxZoomIds; i++ )
270  {
271  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
272 
273  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
274  wxEmptyString, wxITEM_CHECK );
275  if( zoom == screen->m_ZoomList[i] )
276  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
277  }
278 
279  // Create grid submenu as required.
280  if( screen->GetGridCount() )
281  {
282  wxMenu* gridMenu = new wxMenu;
283  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
284  _( "Grid Select" ), KiBitmap( grid_select_xpm ) );
285 
286  wxArrayString gridsList;
287  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
288 
289  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
290  {
291  GRID_TYPE& grid = screen->GetGrid( i );
292  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
293 
294  if( (int)i == icurr )
295  gridMenu->Check( grid.m_CmdId, true );
296  }
297  }
298 
299  MasterMenu->AppendSeparator();
300  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
301 }
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:55
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
size_t GetGridCount() const
Function GetGridCount().
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:36
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
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.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
SCH_NO_CONNECT * SCH_EDIT_FRAME::AddNoConnect ( wxDC *  aDC,
const wxPoint aPosition 
)
private

Function AddNoConnect add a no connect item to the current schematic sheet at aPosition.

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

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

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

Referenced by OnLeftClick().

437 {
438  SCH_NO_CONNECT* no_connect = new SCH_NO_CONNECT( aPosition );
439 
440  SetRepeatItem( no_connect );
441  GetScreen()->Append( no_connect );
443  OnModify();
444  m_canvas->Refresh();
445  SaveCopyInUndoList( no_connect, UR_NEW );
446  return no_connect;
447 }
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
bool SchematicCleanUp()
Function SchematicCleanUp performs routine schematic cleaning including breaking wire and buses and d...
Definition: sch_screen.cpp:426
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void Append(SCH_ITEM *aItem)
int SCH_EDIT_FRAME::AddTemplateFieldName ( const TEMPLATE_FIELDNAME aFieldName)
inline

Function AddTemplateFieldName inserts or appends 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 317 of file schframe.h.

References TEMPLATES::AddTemplateFieldName().

Referenced by OnPreferencesOptions().

318  {
319  return m_TemplateFieldNames.AddTemplateFieldName( aFieldName );
320  }
int AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName)
Function AddTemplateFieldName inserts or appends a wanted symbol field name into the fieldnames templ...
TEMPLATES m_TemplateFieldNames
Definition: schframe.h:183
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

Definition at line 888 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().

889 {
890  BASE_SCREEN* screen = GetScreen();
891 
892  if( !screen || !m_canvas )
893  return;
894 
895  double scale = screen->GetScalingFactor();
896 
897  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
898  aCenterPositionIU.x, aCenterPositionIU.y, scale );
899 
900  // Calculate the portion of the drawing that can be displayed in the
901  // client area at the current zoom level.
902 
903  // visible viewport in device units ~ pixels
904  wxSize clientSizeDU = m_canvas->GetClientSize();
905 
906  // Size of the client window in IU
907  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
908 
909  // Full drawing or "page" rectangle in internal units
910  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
911 
912  // Account for scrollbars
913  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
914  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
915  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
916 
917  // The upper left corner of the client rectangle in internal units.
918  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
919  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
920 
921  // If drawn around the center, adjust the client rectangle accordingly.
922  if( screen->m_Center )
923  {
924  // half page offset.
925  xIU += pageRectIU.GetWidth() / 2.0;
926  yIU += pageRectIU.GetHeight() / 2.0;
927  }
928 
929  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
930  wxPoint centerPositionIU;
931 
932  // put "int" limits on the clientRect
933  if( clientRectIU.GetLeft() < VIRT_MIN )
934  clientRectIU.MoveLeftTo( VIRT_MIN );
935  if( clientRectIU.GetTop() < VIRT_MIN )
936  clientRectIU.MoveTopTo( VIRT_MIN );
937  if( clientRectIU.GetRight() > VIRT_MAX )
938  clientRectIU.MoveRightTo( VIRT_MAX );
939  if( clientRectIU.GetBottom() > VIRT_MAX )
940  clientRectIU.MoveBottomTo( VIRT_MAX );
941 
942  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
943  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
944 
945  if( screen->m_Center )
946  {
947  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
948  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
949  }
950 
951  DSIZE virtualSizeIU;
952 
953  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
954  {
955  virtualSizeIU.x = pageRectIU.GetSize().x;
956  }
957  else
958  {
959  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
960  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
961 
962  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
963  {
964  if( pageCenterX > clientCenterX )
965  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
966  else if( pageCenterX < clientCenterX )
967  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
968  else
969  virtualSizeIU.x = clientRectIU.GetWidth();
970  }
971  else
972  {
973  if( pageCenterX > clientCenterX )
974  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
975  else if( pageCenterX < clientCenterX )
976  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
977  else
978  virtualSizeIU.x = pageRectIU.GetWidth();
979  }
980  }
981 
982  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
983  {
984  virtualSizeIU.y = pageRectIU.GetSize().y;
985  }
986  else
987  {
988  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
989  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
990 
991  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
992  {
993  if( pageCenterY > clientCenterY )
994  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
995  else if( pageCenterY < clientCenterY )
996  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
997  else
998  virtualSizeIU.y = clientRectIU.GetHeight();
999  }
1000  else
1001  {
1002  if( pageCenterY > clientCenterY )
1003  virtualSizeIU.y = pageRectIU.GetHeight() +
1004  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1005  else if( pageCenterY < clientCenterY )
1006  virtualSizeIU.y = pageRectIU.GetHeight() +
1007  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1008  else
1009  virtualSizeIU.y = pageRectIU.GetHeight();
1010  }
1011  }
1012 
1013  // put "int" limits on the virtualSizeIU
1014  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1015  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1016 
1017  if( screen->m_Center )
1018  {
1019  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1020  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1021  }
1022  else
1023  {
1024  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1025  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1026  }
1027 
1028  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1029  * around cursor to jump around. This reported problem occurs when the
1030  * zoom point is not on a pixel per unit increment. If you set the
1031  * pixels per unit to 10, you have potential for the zoom point to
1032  * jump around +/-5 pixels from the nearest grid point.
1033  */
1034  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1035 
1036  // Number of scroll bar units for the given zoom level in device units.
1037  double unitsX = virtualSizeIU.x * scale;
1038  double unitsY = virtualSizeIU.y * scale;
1039 
1040  // Store the requested center position for later use
1041  SetScrollCenterPosition( aCenterPositionIU );
1042 
1043  // Calculate the scroll bar position in internal units to place the
1044  // center position at the center of client rectangle.
1045  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1046  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1047 
1048  // Convert scroll bar position to device units.
1049  posX = KiROUND( posX * scale );
1050  posY = KiROUND( posY * scale );
1051 
1052  if( posX < 0 )
1053  {
1054  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1055  posX = 0;
1056  }
1057 
1058  if( posX > unitsX )
1059  {
1060  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1061  posX = unitsX;
1062  }
1063 
1064  if( posY < 0 )
1065  {
1066  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1067  posY = 0;
1068  }
1069 
1070  if( posY > unitsY )
1071  {
1072  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1073  posY = unitsY;
1074  }
1075 
1076  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1077  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1078 
1079  wxLogTrace( traceScrollSettings,
1080  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1081  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1082  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1084  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1085  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1086 
1087  bool noRefresh = true;
1088 
1089  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1090  screen->m_ScrollPixelsPerUnitY,
1091  screen->m_ScrollbarNumber.x,
1092  screen->m_ScrollbarNumber.y,
1093  screen->m_ScrollbarPos.x,
1094  screen->m_ScrollbarPos.y, noRefresh );
1095 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:885
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
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:884
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:309
bool m_Center
Center on screen.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
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:92
static const double MAX_AXIS
Definition: draw_frame.cpp:882
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
#define min(a, b)
Definition: auxiliary.h:85
void SCH_EDIT_FRAME::AnnotateComponents ( bool  aAnnotateSchematic,
ANNOTATE_ORDER_T  aSortOption,
ANNOTATE_OPTION_T  aAlgoOption,
bool  aResetAnnotation,
bool  aRepairTimestamps,
bool  aLockUnits 
)

Function AnnotateComponents.

annotates 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.
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.

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 60 of file annotate.cpp.

References SCH_REFERENCE_LIST::Annotate(), CheckAnnotate(), DeleteAnnotation(), DisplayInfoMessage(), g_RootSheet, SCH_SHEET_PATH::GetComponents(), SCH_SHEET_LIST::GetComponents(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SHEET_LIST::GetMultiUnitComponents(), INCREMENTAL_BY_REF, EDA_DRAW_FRAME::m_canvas, m_CurrentSheet, OnModify(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), 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(), and SCH_REFERENCE_LIST::UpdateAnnotation().

66 {
67  SCH_REFERENCE_LIST references;
68 
69  SCH_SCREENS screens;
70 
71  // Build the sheet list.
72  SCH_SHEET_LIST sheets( g_RootSheet );
73 
74  // Map of locked components
75  SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents;
76 
77  // Test for and replace duplicate time stamps in components and sheets. Duplicate
78  // time stamps can happen with old schematics, schematic conversions, or manual
79  // editing of files.
80  if( aRepairTimestamps )
81  {
82  int count = screens.ReplaceDuplicateTimeStamps();
83 
84  if( count )
85  {
86  wxString msg;
87  msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count );
88  DisplayInfoMessage( NULL, msg, 2 );
89  }
90  }
91 
92  // If units must be locked, collect all the sets that must be annotated together.
93  if( aLockUnits )
94  {
95  if( aAnnotateSchematic )
96  {
97  sheets.GetMultiUnitComponents( Prj().SchLibs(), lockedComponents );
98  }
99  else
100  {
101  m_CurrentSheet->GetMultiUnitComponents( Prj().SchLibs(), lockedComponents );
102  }
103  }
104 
105  // If it is an annotation for all the components, reset previous annotation.
106  if( aResetAnnotation )
107  DeleteAnnotation( !aAnnotateSchematic );
108 
109  // Set sheet number and number of sheets.
111 
112  // Build component list
113  if( aAnnotateSchematic )
114  {
115  sheets.GetComponents( Prj().SchLibs(), references );
116  }
117  else
118  {
119  m_CurrentSheet->GetComponents( Prj().SchLibs(), references );
120  }
121 
122  // Break full components reference in name (prefix) and number:
123  // example: IC1 become IC, and 1
124  references.SplitReferences();
125 
126  switch( aSortOption )
127  {
128  default:
129  case SORT_BY_X_POSITION:
130  references.SortByXCoordinate();
131  break;
132 
133  case SORT_BY_Y_POSITION:
134  references.SortByYCoordinate();
135  break;
136  }
137 
138  bool useSheetNum = false;
139  int idStep = 100;
140 
141  switch( aAlgoOption )
142  {
143  default:
144  case INCREMENTAL_BY_REF:
145  break;
146 
147  case SHEET_NUMBER_X_100:
148  useSheetNum = true;
149  break;
150 
151  case SHEET_NUMBER_X_1000:
152  useSheetNum = true;
153  idStep = 1000;
154  break;
155  }
156 
157  // Recalculate and update reference numbers in schematic
158  references.Annotate( useSheetNum, idStep, lockedComponents );
159  references.UpdateAnnotation();
160 
161  wxArrayString errors;
162 
163  // Final control (just in case ... ).
164  if( CheckAnnotate( &errors, !aAnnotateSchematic ) )
165  {
166  wxString msg;
167 
168  for( size_t i = 0; i < errors.GetCount(); i++ )
169  msg += errors[i];
170 
171  // wxLogWarning is a cheap and dirty way to dump a potentially long list of
172  // strings to a dialog that can be saved to a file. This should be replaced
173  // by a more elegant solution.
174  wxLogWarning( msg );
175  }
176 
177  OnModify();
178 
179  // Update on screen references, that can be modified by previous calculations:
182 
183  m_canvas->Refresh( true );
184 }
Class SCH_SHEET_LIST.
Annotate using the first free reference number starting at the sheet number * 100.
Definition: schframe.h:95
void SortByYCoordinate()
Function sortByYCoordinate sorts the list of references by Y position.
void GetComponents(PART_LIBS *aLibs, SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
int CheckAnnotate(wxArrayString *aMessageList, bool aOneSheetOnly)
Function CheckAnnotate checks for annotation errors.
Definition: annotate.cpp:187
void GetMultiUnitComponents(PART_LIBS *aLibs, SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true)
Function GetMultiUnitComponents adds a SCH_REFERENCE_LIST object to aRefList for each same-reference ...
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
void UpdateAnnotation()
function UpdateAnnotation Updates the reference components for the schematic project (or the current ...
Annotate by X position from left to right.
Definition: schframe.h:85
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
void SortByXCoordinate()
Function sortByXCoordinate sorts the list of references by X position.
void DeleteAnnotation(bool aCurrentSheetOnly)
Function DeleteAnnotation clears the current component annotation.
Definition: annotate.cpp:39
void Annotate(bool aUseSheetNum, int aSheetIntervalId, SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap)
Function Annotate set the reference designators in the list that have not been annotated.
Annotate by Y position from top to bottom.
Definition: schframe.h:86
Annotate incrementally using the first free reference number.
Definition: schframe.h:94
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...
Annotate using the first free reference number starting at the sheet number * 1000.
Definition: schframe.h:97
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void DisplayInfoMessage(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:89
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:486
void SplitReferences()
Function SplitReferences attempts to split all reference designators into a name (U) and number (1)...
int ReplaceDuplicateTimeStamps()
Function ReplaceDuplicateTimeStamps test all sheet and component objects in the schematic for duplica...
Class SCH_SCREENS is a container class that holds multiple SCH_SCREENs in a hierarchy.
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 734 of file draw_frame.cpp.

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

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), PCB_EDIT_FRAME::Fill_Zone(), SCH_PRINTOUT::OnPrintPage(), OpenProjectFiles(), LIB_VIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::SaveActiveLibrary(), SaveEEFile(), PCB_EDIT_FRAME::SavePcbFile(), ShowNewTrackWhenMovingCursor(), and PCB_EDIT_FRAME::Solve().

737 {
738  if( m_messagePanel == NULL )
739  return;
740 
741  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
742 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
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::AppendOneEEProject ( )

Function AppendOneEEProject read an entire project and loads it into the schematic editor without replacing the existing contents.

Returns
True if the project was imported properly.

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

References PART_LIBS::AddLibrary(), PART_LIBS::CacheName(), EDA_ITEM::ClearFlags(), DisplayError(), Format(), SCH_SCREEN::GetDrawItems(), SCH_SHEET::GetFileName(), SCH_SHEET::GetName(), GetNewTimeStamp(), GetScreen(), SCH_SHEET::GetScreen(), SCH_SCREEN::GetSheet(), ID_POPUP_GRID_LEVEL_1000, KIWAY_HOLDER::Kiway(), LoadOneEEFile(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_LastGridSizeId, EDA_DRAW_FRAME::m_UndoRedoCountMax, SCH_ITEM::Next(), OnModify(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), SCH_COMPONENT_T, SCH_SHEET_T, SchematicFileWildcard, SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), BASE_SCREEN::SetGrid(), BASE_SCREEN::SetMaxUndoItems(), SCH_SHEET::SetName(), SCH_SHEET::SetScreen(), SetSheetNumberAndCount(), EDA_ITEM::SetTimeStamp(), EDA_ITEM::Type(), IO_ERROR::What(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by OnAppendProject().

388 {
389  wxString fullFileName;
390 
391  SCH_SCREEN* screen = GetScreen();
392 
393  if( !screen )
394  {
395  wxLogError( wxT( "Document not ready, cannot import" ) );
396  return false;
397  }
398 
399  // open file chooser dialog
400  wxString path = wxPathOnly( Prj().GetProjectFullName() );
401 
402  wxFileDialog dlg( this, _( "Import Schematic" ), path,
403  wxEmptyString, SchematicFileWildcard,
404  wxFD_OPEN | wxFD_FILE_MUST_EXIST );
405 
406  if( dlg.ShowModal() == wxID_CANCEL )
407  return false;
408 
409  fullFileName = dlg.GetPath();
410 
411  wxFileName fn = fullFileName;
412 
413  if( fn.IsRelative() )
414  {
415  fn.MakeAbsolute();
416  fullFileName = fn.GetFullPath();
417  }
418 
419  wxString cache_name = PART_LIBS::CacheName( fullFileName );
420 
421  if( !!cache_name )
422  {
423  PART_LIBS* libs = Prj().SchLibs();
424 
425  try
426  {
427  if( PART_LIB* lib = libs->AddLibrary( cache_name ) )
428  lib->SetCache();
429  }
430  catch( const IO_ERROR& ioe )
431  {
432  DisplayError( this, ioe.What() );
433  }
434  }
435 
436  wxLogDebug( wxT( "Importing schematic " ) + fullFileName );
437 
438  // Keep trace of the last item in list.
439  // New items will be loaded after this one.
440  SCH_ITEM* bs = screen->GetDrawItems();
441 
442  if( bs )
443  {
444  while( bs->Next() )
445  bs = bs->Next();
446  }
447 
448  // load the project
449  bool success = LoadOneEEFile( screen, fullFileName, true );
450 
451  if( success )
452  {
453  // the new loaded items need cleaning to avoid duplicate parameters
454  // which should be unique (ref and time stamp).
455  // Clear ref and set a new time stamp for new items
456  if( bs == NULL )
457  bs = screen->GetDrawItems();
458  else
459  bs = bs->Next();
460 
461  while( bs )
462  {
463  SCH_ITEM* nextbs = bs->Next();
464 
465  // To avoid issues with the current hieratchy,
466  // do not load included sheets files and give new filenames
467  // and new sheet names.
468  // There are many tricky cases (loops, creation of complex hierarchies
469  // with duplicate file names, duplicate sheet names...)
470  // So the included sheets names are renamed if existing,
471  // and filenames are just renamed to avoid loops and
472  // creation of complex hierarchies.
473  // If someone want to change it for a better append function, remember
474  // these cases need work to avoid issues.
475  if( bs->Type() == SCH_SHEET_T )
476  {
477  SCH_SHEET * sheet = (SCH_SHEET *) bs;
478  time_t newtimestamp = GetNewTimeStamp();
479  sheet->SetTimeStamp( newtimestamp );
480 
481  // Check for existing subsheet name in the current sheet
482  wxString tmp = sheet->GetName();
483  sheet->SetName( wxEmptyString );
484  const SCH_SHEET* subsheet = GetScreen()->GetSheet( tmp );
485 
486  if( subsheet )
487  sheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), (long) newtimestamp ) );
488  else
489  sheet->SetName( tmp );
490 
491  sheet->SetFileName( wxString::Format( wxT( "file%8.8lX.sch" ),
492  (long) newtimestamp ) );
493  SCH_SCREEN* new_screen = new SCH_SCREEN( &Kiway() );
494  new_screen->SetMaxUndoItems( m_UndoRedoCountMax );
495  sheet->SetScreen( new_screen );
496  sheet->GetScreen()->SetFileName( sheet->GetFileName() );
497  }
498  // clear annotation and init new time stamp for the new components
499  else if( bs->Type() == SCH_COMPONENT_T )
500  {
501  ( (SCH_COMPONENT*) bs )->SetTimeStamp( GetNewTimeStamp() );
502  ( (SCH_COMPONENT*) bs )->ClearAnnotation( NULL );
503 
504  // Clear flags, which are set by these previous modifications:
505  bs->ClearFlags();
506  }
507 
508  bs = nextbs;
509  }
510  }
511 
512  OnModify();
513 
514  // redraw base screen (ROOT) if necessary
516  Zoom_Automatique( false );
518  m_canvas->Refresh( true );
519  return success;
520 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
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
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void SetFileName(const wxString &aFilename)
Definition: sch_sheet.h:503
SCH_SHEET * GetSheet(const wxString &aName)
Function GetSheet returns a sheet object pointer that is named aName.
Definition: sch_screen.cpp:680
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:105
time_t GetNewTimeStamp()
Definition: common.cpp:166
static const wxString CacheName(const wxString &aFullProjectFilename)
Function cacheName returns the name of the cache library after potentially fixing it from an older na...
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:286
SCH_ITEM * Next() const
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
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:77
void SetName(const wxString &aName)
Definition: sch_sheet.h:276
PART_LIB * AddLibrary(const wxString &aFileName)
Function AddLibrary allocates and adds a part library to the library list.
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:88
const wxString SchematicFileWildcard
int m_LastGridSizeId
Definition: draw_frame.h:77
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:849
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
Class PART_LIBS is a collection of PART_LIBs.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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 SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:486
bool LoadOneEEFile(SCH_SCREEN *aScreen, const wxString &aFullFileName, bool append=false)
Function LoadOneEEFile loads the schematic (.sch) file aFullFileName into aScreen.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
void SetMaxUndoItems(int aMax)
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void SetFileName(const wxString &aFileName)
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
wxString GetName() const
Definition: sch_sheet.h:274
Class PART_LIB is used to load, save, search, and otherwise manipulate part 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:69
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...
void SCH_EDIT_FRAME::backAnnotateFootprints ( const std::string &  aChangedSetOfReferences)
throw ( IO_ERROR,
boost::bad_pointer
)
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(), Prj(), Scan(), EDA_TEXT::SetText(), EDA_TEXT::SetVisible(), and THROW_IO_ERROR.

Referenced by KiwayMailIn().

53 {
54  // Build a flat list of components in schematic:
55  SCH_REFERENCE_LIST refs;
56  SCH_SHEET_LIST sheets( g_RootSheet );
57  bool isChanged = false;
58 
59  sheets.GetComponents( Prj().SchLibs(), refs, false );
60 
61  DSNLEXER lexer( aChangedSetOfReferences, FROM_UTF8( __func__ ) );
62  PTREE doc;
63 
64  try
65  {
66  Scan( &doc, &lexer );
67 
68 #if defined(DEBUG) && 0
70  Format( &sf, 0, 0, doc );
71  printf( "%s: '%s'\n", __func__, sf.GetString().c_str() );
72 #endif
73 
74  CPTREE& back_anno = doc.get_child( "back_annotation" );
75  wxString footprint;
76 
77  for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
78  {
79  wxASSERT( ref->first == "ref" );
80 
81  wxString reference = (UTF8&) ref->second.front().first;
82 
83  // Ensure the "fpid" node contains a footprint name,
84  // and get it if exists
85  if( ref->second.get_child( "fpid" ).size() )
86  {
87  wxString tmp = (UTF8&) ref->second.get_child( "fpid" ).front().first;
88  footprint = tmp;
89  }
90  else
91  footprint.Empty();
92 
93  // DBG( printf( "%s: ref:%s fpid:%s\n", __func__, TO_UTF8( reference ), TO_UTF8( footprint ) ); )
94 
95  // Search the component in the flat list
96  for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
97  {
98  if( reference == refs[ii].GetRef() )
99  {
100  // We have found a candidate.
101  // Note: it can be not unique (multiple parts per package)
102  // So we *do not* stop the search here
103  SCH_COMPONENT* component = refs[ii].GetComp();
104  SCH_FIELD* fpfield = component->GetField( FOOTPRINT );
105  const wxString& oldfp = fpfield->GetText();
106 
107  if( !oldfp && fpfield->IsVisible() )
108  {
109  fpfield->SetVisible( false );
110  }
111 
112  // DBG( printf("%s: ref:%s fpid:%s\n", __func__, TO_UTF8( refs[ii].GetRef() ), TO_UTF8( footprint ) );)
113  if( oldfp != footprint )
114  isChanged = true;
115 
116  fpfield->SetText( footprint );
117  }
118  }
119  }
120  }
121  catch( const PTREE_ERROR& ex )
122  {
123  // remap the exception to something the caller is likely to understand.
124  THROW_IO_ERROR( ex.what() );
125  }
126 
127  if( isChanged )
128  OnModify();
129 }
Class UTF8 is an 8 bit std::string that is assuredly encoded in UTF8, and supplies special conversion...
Definition: utf8.h:53
Class SCH_SHEET_LIST.
Class SCH_FIELD instances are attached to a component and provide a place for the component'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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
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:175
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...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
boost::property_tree::ptree PTREE
Definition: ptree.h:54
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
SCH_FIELD * GetField(int aFieldNdx) const
Function GetField returns a field.
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:130
const std::string & GetString()
Definition: richio.h:475
#define THROW_IO_ERROR(x)
Definition: utf8.cpp:60
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:176
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
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:141
DRAWSEGMENT* SCH_EDIT_FRAME::Begin_Edge ( DRAWSEGMENT Segment,
wxDC *  DC 
)
private
void SCH_EDIT_FRAME::BeginSegment ( wxDC *  DC,
int  type 
)
private

Function BeginSegment creates a new segment ( WIRE, BUS ) or terminates the current segment in progress.

If the end of the current segment is on an other 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 158 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().

159 {
160  SCH_LINE* segment;
161  SCH_LINE* nextSegment;
162  wxPoint cursorpos = GetCrossHairPosition();
163 
164  // We should know if a segment is currently in progress
165  segment = (SCH_LINE*) GetScreen()->GetCurItem();
166  if( segment ) // a current item exists, but not necessary a currently edited item
167  {
168  if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) )
169  {
170  if( segment->GetFlags() )
171  {
172  wxLogDebug( wxT( "BeginSegment: item->GetFlags()== %X" ),
173  segment->GetFlags() );
174  }
175  // no wire, bus or graphic line in progress
176  segment = NULL;
177  }
178  }
179 
180  if( !segment ) // first point : Create the first wire or bus segment
181  {
182  switch( type )
183  {
184  default:
185  segment = new SCH_LINE( cursorpos, LAYER_NOTES );
186  break;
187 
188  case LAYER_WIRE:
189  segment = new SCH_LINE( cursorpos, LAYER_WIRE );
190 
191  /* A junction will be created later, when we'll know the
192  * segment end position, and if the junction is really needed */
193  break;
194 
195  case LAYER_BUS:
196  segment = new SCH_LINE( cursorpos, LAYER_BUS );
197  break;
198  }
199 
200  segment->SetFlags( IS_NEW );
201  s_wires.PushBack( segment );
202  GetScreen()->SetCurItem( segment );
203 
204  // We need 2 segments to go from a given start pin to an end point when the horizontal
205  // and vertical lines only switch is on.
206  if( GetForceHVLines() )
207  {
208  nextSegment = new SCH_LINE( *segment );
209  nextSegment->SetFlags( IS_NEW );
210  s_wires.PushBack( nextSegment );
211  GetScreen()->SetCurItem( nextSegment );
212  }
213 
215  SetRepeatItem( NULL );
216  }
217  else // A segment is in progress: terminates the current segment and add a new segment.
218  {
219  SCH_LINE* prevSegment = segment->Back();
220 
221  // Be aware prevSegment can be null when the horizontal and vertical lines only switch is off
222  // when we create the first segment.
223 
224  if( !GetForceHVLines() )
225  {
226  // If only one segment is needed and it has a zero length, do not create a new one.
227  if( segment->IsNull() )
228  return;
229  }
230  else
231  {
232  wxCHECK_RET( prevSegment != NULL, wxT( "Failed to create second line segment." ) );
233 
234  // If two segments are required and they both have zero length, do not
235  // create a new one.
236  if( prevSegment && prevSegment->IsNull() && segment->IsNull() )
237  return;
238  }
239 
240  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
241 
242  // Terminate the command if the end point is on a pin, junction, or another wire or bus.
243  if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) )
244  {
245  EndSegment( DC );
246  return;
247  }
248 
249  // Create a new segment, and chain it after the current new segment.
250  nextSegment = new SCH_LINE( *segment );
251  nextSegment->SetStartPoint( cursorpos );
252  s_wires.PushBack( nextSegment );
253 
254  segment->SetEndPoint( cursorpos );
255  segment->ClearFlags( IS_NEW );
256  segment->SetFlags( SELECTED );
257  nextSegment->SetFlags( IS_NEW );
258  GetScreen()->SetCurItem( nextSegment );
259  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
260  }
261 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
bool GetForceHVLines() const
Definition: schframe.h:240
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 SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:77
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:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void EndSegment(wxDC *DC)
Function EndSegment called to terminate a bus, wire, or line creation.
#define SELECTED
Definition: base_struct.h:120
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:73
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
bool IsNull() const
Definition: sch_line.h:69
static void AbortCreateNewLine(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
Class SCH_LINE is a segment description base class to describe items which have 2 end points (track...
Definition: sch_line.h:42
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
SCH_LINE * Back() const
Definition: sch_line.h:57
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
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 SCH_EDIT_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 707 of file schframe.cpp.

References max.

708 {
709  int dx, dy;
710  wxSize size;
711 
712  dx = GetScreen()->GetPageSettings().GetWidthIU();
713  dy = GetScreen()->GetPageSettings().GetHeightIU();
714 
715  size = m_canvas->GetClientSize();
716 
717  // Reserve no margin because best zoom shows the full page
718  // and margins are already included in function that draws the sheet refernces
719  double margin_scale_factor = 1.0;
720  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
721  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
722 
723  double bestzoom = std::max( zx, zy );
724 
725  SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
726 
727  return bestzoom;
728 }
void SetScrollCenterPosition(const wxPoint &aPoint)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#define max(a, b)
Definition: auxiliary.h:86
const PAGE_INFO & GetPageSettings() const
int SCH_EDIT_FRAME::BlockCommand ( EDA_KEY  aKey)
overridevirtual

Function BlockCommand Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...) 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_COPY...)

Reimplemented from EDA_DRAW_FRAME.

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

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

66 {
67  int cmd = BLOCK_IDLE;
68 
69  switch( key )
70  {
71  default:
72  cmd = key & 0xFF;
73  break;
74 
75  case 0:
76  cmd = BLOCK_MOVE;
77  break;
78 
79  case GR_KB_SHIFT:
80  cmd = BLOCK_COPY;
81  break;
82 
83  case GR_KB_ALT:
84  cmd = BLOCK_ROTATE;
85  break;
86 
87  case GR_KB_CTRL:
88  cmd = BLOCK_DRAG;
89  break;
90 
91  case GR_KB_SHIFTCTRL:
92  cmd = BLOCK_DELETE;
93  break;
94 
95  case MOUSE_MIDDLE:
96  cmd = BLOCK_ZOOM;
97  break;
98  }
99 
100  return cmd;
101 }
#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
NETLIST_OBJECT_LIST * SCH_EDIT_FRAME::BuildNetListBase ( bool  updateStatusText = true)

BuildNetListBase netlist generation: Creates a flat list which stores all connected objects, and mainly pins and labels.

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

Definition at line 161 of file eeschema/netlist.cpp.

References Format(), and g_RootSheet.

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

162 {
163  // I own this list until I return it to the new owner.
164  std::unique_ptr<NETLIST_OBJECT_LIST> ret( new NETLIST_OBJECT_LIST() );
165 
166  // Creates the flattened sheet list:
167  SCH_SHEET_LIST aSheets( g_RootSheet );
168 
169  // Build netlist info
170  bool success = ret->BuildNetListInfo( aSheets );
171 
172  if( !success )
173  {
174  if( updateStatusText )
175  SetStatusText( _( "No Objects" ) );
176  return ret.release();
177  }
178 
179  wxString msg = wxString::Format( _( "Net count = %d" ), int( ret->size() ) );
180 
181  if( updateStatusText )
182  SetStatusText( msg );
183 
184  return ret.release();
185 }
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:54
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().

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:255
virtual bool CanIncrementLabel() const override
Definition: sch_text.h:191
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
virtual void SetLabelSpinStyle(int aSpinStyle)
Function SetLabelSpinStyle sets a spin or rotation angle, along with specific horizontal and vertical...
Definition: sch_text.cpp:277
int GetLabelSpinStyle() const
Definition: sch_text.h:119
int SCH_EDIT_FRAME::CheckAnnotate ( wxArrayString *  aMessageList,
bool  aOneSheetOnly 
)

Function CheckAnnotate checks 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
aMessageListA wxArrayString to store error messages.
aOneSheetOnlyCheck the current sheet only if true. Otherwise check the entire schematic.

Definition at line 187 of file annotate.cpp.

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

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

188 {
189  // build the screen list
190  SCH_SHEET_LIST sheetList( g_RootSheet );
191  SCH_REFERENCE_LIST componentsList;
192 
193  // Build the list of components
194  if( !aOneSheetOnly )
195  sheetList.GetComponents( Prj().SchLibs(), componentsList );
196  else
197  m_CurrentSheet->GetComponents( Prj().SchLibs(), componentsList );
198 
199  return componentsList.CheckAnnotation( aMessageList );
200 }
Class SCH_SHEET_LIST.
void GetComponents(PART_LIBS *aLibs, SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true)
Function GetComponents adds a SCH_REFERENCE() object to aReferences for each component in the sheet...
int CheckAnnotation(wxArrayString *aMessageList)
Function CheckAnnotation check for annotations errors.
Class SCH_REFERENCE_LIST is used to create a flattened list of components because in a complex hierar...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
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 576 of file basicframe.cpp.

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

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

578 {
579  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
580  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
581 
582  wxFileName autoSaveFileName = aFileName;
583 
584  // Check for auto save file.
585  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
586 
587  wxLogTrace( traceAutoSave,
588  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
589 
590  if( !autoSaveFileName.FileExists() )
591  return;
592 
593  wxString msg = wxString::Format( _(
594  "Well this is potentially embarrassing!\n"
595  "It appears that the last time you were editing the file\n"
596  "'%s'\n"
597  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
598  GetChars( aFileName.GetFullName() )
599  );
600 
601  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
602 
603  // Make a backup of the current file, delete the file, and rename the auto save file to
604  // the file name.
605  if( response == wxYES )
606  {
607  // Get the backup file name.
608  wxFileName backupFileName = aFileName;
609  backupFileName.SetExt( aBackupFileExtension );
610 
611  // If an old backup file exists, delete it. If an old copy of the file exists, rename
612  // it to the backup file name
613  if( aFileName.FileExists() )
614  {
615  // Remove the old file backup file.
616  if( backupFileName.FileExists() )
617  wxRemoveFile( backupFileName.GetFullPath() );
618 
619  // Rename the old file to the backup file name.
620  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
621  {
622  msg.Printf( _( "Could not create backup file <%s>" ),
623  GetChars( backupFileName.GetFullPath() ) );
624  wxMessageBox( msg );
625  }
626  }
627 
628  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
629  {
630  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
631  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
632  }
633  }
634  else
635  {
636  wxLogTrace( traceAutoSave,
637  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
638 
639  // Remove the auto save file when using the previous file as is.
640  wxRemoveFile( autoSaveFileName.GetFullPath() );
641  }
642 }
const wxChar traceAutoSave[]
Custom trace mask to enable and disable auto save tracing.
Definition: basicframe.cpp:53
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
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
#define AUTOSAVE_PREFIX_FILENAME
a prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash ...
Definition: wxstruct.h:70
void SCH_EDIT_FRAME::ClearExecFlags ( const int  aFlags)
inline

Function ClearExecFlags clears (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 1397 of file schframe.h.

1397 { m_exec_flags &= ~( aFlags ); }
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.
Definition: schframe.h:149
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 255 of file wxstruct.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().

256  {
257  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
258  return baseCfgName;
259  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
Definition: wxstruct.h:132
void SCH_EDIT_FRAME::ConvertPart ( SCH_COMPONENT DrawComponent,
wxDC *  DC 
)
private

Definition at line 370 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(), GetScreen(), GR_DEFAULT_DRAWMODE, EDA_ITEM::IsMoving(), EDA_DRAW_FRAME::m_canvas, OnModify(), KIWAY_HOLDER::Prj(), SCH_COMPONENT::SetConvert(), EDA_ITEM::SetFlags(), and SCH_SCREEN::TestDanglingEnds().

Referenced by Process_Special_Functions().

371 {
372  if( !DrawComponent )
373  return;
374 
375  if( LIB_PART* part = Prj().SchLibs()->FindLibPart( DrawComponent->GetLibId() ) )
376  {
377  if( !part->HasConversion() )
378  {
379  DisplayError( this, wxT( "No convert found" ) );
380  return;
381  }
382 
383  STATUS_FLAGS flags = DrawComponent->GetFlags();
384 
385  if( DrawComponent->GetFlags() )
386  DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
387  else
388  DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
389 
390  DrawComponent->SetConvert( DrawComponent->GetConvert() + 1 );
391 
392  // ensure m_Convert = 0, 1 or 2
393  // 0 and 1 = shape 1 = not converted
394  // 2 = shape 2 = first converted shape
395  // > 2 is not used but could be used for more shapes
396  // like multiple shapes for a programmable component
397  // When m_Convert = val max, return to the first shape
398  if( DrawComponent->GetConvert() > 2 )
399  DrawComponent->SetConvert( 1 );
400 
401  // The alternate symbol may cause a change in the connection status so test the
402  // connections so the connection indicators are drawn correctly.
404  DrawComponent->ClearFlags();
405  DrawComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
406 
407  /* Redraw the component in the new position. */
408  if( DrawComponent->IsMoving() )
409  DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
410  else
411  DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
412 
413  OnModify();
414  }
415 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
bool IsMoving() const
Definition: base_struct.h:218
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
void SetConvert(int aConvert)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
int GetConvert() const
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
Class LIB_PART defines a library part object.
unsigned STATUS_FLAGS
Definition: base_struct.h:144
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:911
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Virtual function, from the base class SCH_ITEM::Draw.
const LIB_ID & GetLibId() const
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
COLOR4D g_GhostColor
Draw color for moving objects.
Definition: common.cpp:57
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 793 of file draw_frame.cpp.

References CoordinateToString().

794 {
795  return ::CoordinateToString( aValue, aConvertToMils );
796 }
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:117
void SCH_EDIT_FRAME::copyBlockItems ( PICKED_ITEMS_LIST aItemsList)
private

Function copyBlockItems copies the list of block item.

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

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

References EDA_ITEM::ClearFlags(), BLOCK_SELECTOR::ClearListAndDeleteItems(), DuplicateStruct(), PICKED_ITEMS_LIST::GetCount(), PICKED_ITEMS_LIST::GetPickedItem(), m_blockItems, BLOCK_SELECTOR::PushItem(), EDA_ITEM::SetParent(), and UR_DELETED.

Referenced by HandleBlockEnd().

425 {
426  m_blockItems.ClearListAndDeleteItems(); // delete previous saved list, if exists
427 
428  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
429  {
430  // Clear m_Flag member of selected items:
431  aItemsList.GetPickedItem( ii )->ClearFlags();
432 
433  /* Make a copy of the original picked item. */
434  SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
435  copy->SetParent( NULL );
436 
437  // In list the wrapper is owner of the schematic item, we can use the UR_DELETED
438  // status for the picker because pickers with this status are owner of the picked item
439  // (or TODO ?: create a new status like UR_DUPLICATE)
440  ITEM_PICKER item( copy, UR_DELETED );
441 
442  m_blockItems.PushItem( item );
443  }
444 }
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes only the list of EDA_ITEM * pointers, AND the data printed b...
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
unsigned GetCount() const
Function GetCount.
BLOCK_SELECTOR m_blockItems
List of selected items.
Definition: schframe.h:139
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
SCH_ITEM * DuplicateStruct(SCH_ITEM *aDrawStruct, bool aClone)
Function DuplicateStruct Routine to create a new copy of given struct.
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 43 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.

44 {
45  DrawPageOnClipboard( this );
46 
47  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
48  {
49  if( GetScreen()->IsBlockActive() )
50  m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
51 
53  }
54 }
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool IsBlockActive() const
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
int GetDefaultCursor() const
Function GetDefaultCursor return the default cursor shape.
bool SCH_EDIT_FRAME::CreateArchiveLibrary ( const wxString &  aFileName)

Function CreateArchiveLibrary creates 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 59 of file libarch.cpp.

References PART_LIB::AddPart(), DisplayError(), PART_LIB::EnableBuffering(), PART_LIB::FindAlias(), PART_LIBS::FindLibPart(), PART_LIBS::FindLibraryByFullFileName(), FROM_UTF8(), SCH_SCREENS::GetFirst(), SCH_COMPONENT::GetLibId(), LIB_ID::GetLibItemName(), SCH_SCREENS::GetNext(), LIBRARY_TYPE_EESCHEMA, SCH_ITEM::Next(), KIWAY_HOLDER::Prj(), PART_LIB::Save(), SCH_COMPONENT_T, and PART_LIB::SetCache().

Referenced by CreateArchiveLibraryCacheFile().

60 {
61  wxString msg;
62  SCH_SCREENS screens;
63  PART_LIBS* libs = Prj().SchLibs();
64  PART_LIB* cacheLib = libs->FindLibraryByFullFileName( aFileName );
65 
66  if( !cacheLib )
67  {
68  cacheLib = new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName );
69  libs->push_back( cacheLib );
70  }
71 
72  cacheLib->SetCache();
73  cacheLib->EnableBuffering();
74 
75  /* Examine all screens (not hierarchical sheets) used in the schematic and build a
76  * library of unique symbols found in all screens. Complex hierarchies are not a
77  * problem because we just want to know the library symbols used in the schematic.
78  */
79  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
80  {
81  for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
82  {
83  if( item->Type() != SCH_COMPONENT_T )
84  continue;
85 
86  SCH_COMPONENT* component = (SCH_COMPONENT*) item;
87 
88  if( !cacheLib->FindAlias( FROM_UTF8( component->GetLibId().GetLibItemName() ) ) )
89  {
90  LIB_PART* part = NULL;
91 
92  try
93  {
94  part = libs->FindLibPart( component->GetLibId() );
95 
96  if( part )
97  {
98  // AddPart() does first clone the part before adding.
99  cacheLib->AddPart( part );
100  }
101  }
102  catch( ... /* IO_ERROR ioe */ )
103  {
104  msg.Printf( _( "Failed to add symbol %s to library file '%s'" ),
105  FROM_UTF8( component->GetLibId().GetLibItemName() ), aFileName );
106  DisplayError( this, msg );
107  return false;
108  }
109  }
110  }
111  }
112 
113  try
114  {
115  cacheLib->Save( false );
116  cacheLib->EnableBuffering( false );
117  }
118  catch( ... /* IO_ERROR ioe */ )
119  {
120  msg.Printf( _( "Failed to save symbol library file '%s'" ), aFileName );
121  DisplayError( this, msg );
122  return false;
123  }
124 
125  return true;
126 }
SCH_SCREEN * GetNext()
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 Save(bool aSaveDocFile=true)
SCH_ITEM * Next() const
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void EnableBuffering(bool aEnable=true)
const UTF8 & GetLibItemName() const
Function GetLibItemName.
Definition: lib_id.h:129
Class LIB_PART defines a library part object.
void SetCache()
LIB_PART * FindLibPart(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibPart searches all libraries in the list for a part.
Class PART_LIBS is a collection of PART_LIBs.
void AddPart(LIB_PART *aPart)
Add aPart entry to library.
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
const LIB_ID & GetLibId() const
PART_LIB * FindLibraryByFullFileName(const wxString &aFullFileName)
SCH_SCREEN * GetFirst()
Class PART_LIB is used to load, save, search, and otherwise manipulate part 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:69
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
Class SCH_SCREENS is a container class that holds multiple SCH_SCREENs in a hierarchy.
bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile ( bool  aUseCurrentSheetFilename = false)

Function CreateArchiveLibraryCacheFile creates a library file with the name of the root document plus the '-cache' suffix, That file will contain all components used in the current schematic.

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

Definition at line 43 of file libarch.cpp.

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

Referenced by OnSaveProject(), and Save_File().

44 {
45  wxFileName fn;
46 
47  if( aUseCurrentSheetFilename )
48  fn = GetScreen()->GetFileName();
49  else
51 
52  fn.SetName( fn.GetName() + "-cache" );
53  fn.SetExt( SchematicLibraryFileExtension );
54 
55  return CreateArchiveLibrary( fn.GetFullPath() );
56 }
const wxString & GetFileName() const
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:286
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
const wxString SchematicLibraryFileExtension
bool CreateArchiveLibrary(const wxString &aFileName)
Function CreateArchiveLibrary creates a library aFileName that contains all components used in the cu...
Definition: libarch.cpp:59
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().

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 SCH_BUS_WIRE_ENTRY.
void addCurrentItemToList(bool aRedraw=true)
Function addCurrentItemToList adds the item currently being edited to the schematic and adds the chan...
Definition: schframe.cpp:1279
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
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().

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)
Function addCurrentItemToList adds the item currently being edited to the schematic and adds the chan...
Definition: schframe.cpp:1279
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
static int s_LastShape
Definition: busentry.cpp:39
Class SCH_BUS_WIRE_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 
)

Function CreateNetlist.

  • 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" refernce 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 112 of file eeschema/netlist.cpp.

References BuildNetListBase(), prepareForNetlist(), and WriteNetListFile().

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

114 {
115  if( !prepareForNetlist() )
116  return false;
117 
118  std::unique_ptr<NETLIST_OBJECT_LIST> connectedItemsList( BuildNetListBase() );
119 
120  bool success = WriteNetListFile( connectedItemsList.release(), aFormat,
121  aFullFileName, aNetlistOptions, aReporter );
122 
123  return success;
124 }
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
BuildNetListBase netlist generation: Creates a flat list which stores all connected objects...
bool prepareForNetlist()
Function prepareForNetlist verifies that annotation is complete so that a proper netlist is even poss...
bool WriteNetListFile(NETLIST_OBJECT_LIST *aConnectedItemsList, int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
Function WriteNetListFile Create the netlist file.
Definition: netform.cpp:46
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().

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:193
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
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:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#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)
Function SetCurItem sets the currently selected object, m_CurrentItem.
bool ReadImageFile(const wxString &aFullFilename)
Function ReadImageFile Reads and stores an image file.
Definition: sch_bitmap.cpp:85
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:112
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(), and Process_Special_Functions().

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:51
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:121
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:123
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:344
bool IsItalic() const
Definition: eda_text.h:170
static int lastTextOrientation
Definition: edit_label.cpp:45
static PINSHEETLABEL_SHAPE lastGlobalLabelShape
Definition: edit_label.cpp:44
virtual void SetLabelSpinStyle(int aSpinStyle)
Function SetLabelSpinStyle sets a spin or rotation angle, along with specific horizontal and vertical...
Definition: sch_text.cpp:277
void SetItalic(bool isItalic)
Definition: eda_text.h:169
int GetLabelSpinStyle() const
Definition: sch_text.h:119
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:214
static bool lastTextItalic
Definition: edit_label.cpp:47
bool IsBold() const
Definition: eda_text.h:173
void PrepareMoveItem(SCH_ITEM *aItem, wxDC *aDC)
Function PrepareMoveItem start moving aItem using the mouse.
Definition: schedit.cpp:784
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
void EditSchematicText(SCH_TEXT *TextStruct)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static bool lastTextBold
Definition: edit_label.cpp:46
void SetBold(bool aBold)
Definition: eda_text.h:172
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
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:112
void SCH_EDIT_FRAME::CreateScreens ( )

Definition at line 535 of file schframe.cpp.

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

Referenced by OpenProjectFiles().

536 {
537  if( g_RootSheet == NULL )
538  {
539  g_RootSheet = new SCH_SHEET();
540  }
541 
542  if( g_RootSheet->GetScreen() == NULL )
543  {
544  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
546  g_RootSheet->SetScreen( screen );
548  }
549 
551 
552  m_CurrentSheet->clear();
553  m_CurrentSheet->push_back( g_RootSheet );
554 
555  if( GetScreen() == NULL )
556  {
557  SCH_SCREEN* screen = new SCH_SCREEN( &Kiway() );
559  SetScreen( screen );
560  }
561 
562  GetScreen()->SetZoom( 32.0 );
563 }
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
Definition: schframe.h:121
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:105
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:286
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
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:88
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
void SetMaxUndoItems(int aMax)
void SetFileName(const wxString &aFileName)
SCH_SHEET * SCH_EDIT_FRAME::CreateSheet ( wxDC *  DC)
private

Definition at line 352 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().

353 {
354  SetRepeatItem( NULL );
355 
356  SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
357 
358  sheet->SetFlags( IS_NEW | IS_RESIZED );
359  sheet->SetTimeStamp( GetNewTimeStamp() );
360  sheet->SetParent( GetScreen() );
361  sheet->SetScreen( NULL );
362 
363  // need to check if this is being added to the GetDrawItems().
364  // also need to update the hierarchy, if we are adding
365  // a sheet to a screen that already has multiple instances (!)
366  GetScreen()->SetCurItem( sheet );
368  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
369  m_canvas->CrossHairOff( aDC );
370 
372 
374  m_canvas->CrossHairOn( aDC );
375 
376  return sheet;
377 }
static void ExitSheet(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: sheet.cpp:308
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:105
wxPoint GetResizePosition() const
Function GetResizePos returns the position of the lower right corner of the sheet in drawing units...
Definition: sch_sheet.cpp:1109
time_t GetNewTimeStamp()
Definition: common.cpp:166
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
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:269
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:114
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...
SCH_SHEET_PIN * SCH_EDIT_FRAME::CreateSheetPin ( SCH_SHEET aSheet,
wxDC *  aDC 
)
private

Function CreateSheetPin creates 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 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:51
PINSHEETLABEL_SHAPE GetShape() const
Definition: sch_text.h:121
void SetShape(PINSHEETLABEL_SHAPE aShape)
Definition: sch_text.h:123
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
static wxSize m_lastSheetPinTextSize
Last sheet pin text size.
Definition: schframe.h:179
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:214
void PrepareMoveItem(SCH_ITEM *aItem, wxDC *aDC)
Function PrepareMoveItem start moving aItem using the mouse.
Definition: schedit.cpp:784
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
static PINSHEETLABEL_SHAPE m_lastSheetPinType
Last sheet pin type.
Definition: schframe.h:178
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
const wxSize & GetLastSheetPinTextSize()
Initializing accessor for the pin text size.
Definition: sheetlab.cpp:50
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
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.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_sheet.h:201
const wxSize & GetTextSize() const
Definition: eda_text.h:215
int EditSheetPin(SCH_SHEET_PIN *aSheetPin, bool aRedraw)
Function EditSheetPin displays the dialog for editing the parameters of aSheetPin.
Definition: sheetlab.cpp:61
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...
void SCH_EDIT_FRAME::DefaultExecFlags ( )
inline

Function DefaultExecFlags resets the execution flags to defaults for external netlist and bom generators.

Definition at line 1381 of file schframe.h.

Referenced by WriteNetListFile().

1381 { m_exec_flags = wxEXEC_SYNC; }
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.
Definition: schframe.h:149
void SCH_EDIT_FRAME::DeleteAllTemplateFieldNames ( )
inline

Function DeleteAllTemplateFieldNames removes all template field names.

Definition at line 346 of file schframe.h.

References TEMPLATES::DeleteAllTemplateFieldNames().

Referenced by OnPreferencesOptions().

347  {
349  }
TEMPLATES m_TemplateFieldNames
Definition: schframe.h:183
void DeleteAllTemplateFieldNames()
Function DeleteAllTemplateFieldNames deletes the entire contents.
void SCH_EDIT_FRAME::DeleteAnnotation ( bool  aCurrentSheetOnly)

Function DeleteAnnotation clears the current component annotation.

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

Definition at line 39 of file annotate.cpp.

References SCH_SCREEN::ClearAnnotation(), SCH_SCREENS::ClearAnnotation(), EDA_DRAW_FRAME::GetCanvas(), GetScreen(), m_CurrentSheet, OnModify(), EDA_DRAW_PANEL::Refresh(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

Referenced by AnnotateComponents().

40 {
41  if( aCurrentSheetOnly )
42  {
43  SCH_SCREEN* screen = GetScreen();
44  wxCHECK_RET( screen != NULL, wxT( "Attempt to clear annotation of a NULL screen." ) );
46  }
47  else
48  {
49  SCH_SCREENS ScreenList;
50  ScreenList.ClearAnnotation();
51  }
52 
53  // Update the references for the sheet that is currently being displayed.
55  GetCanvas()->Refresh();
56  OnModify();
57 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
void ClearAnnotation()
Function ClearAnnotation clears the annotation for all components in the hierarchy.
void ClearAnnotation(SCH_SHEET_PATH *aSheetPath)
Function ClearAnnotation clears the annotation for the components in aSheetPath on the screen...
Definition: sch_screen.cpp:735
Class SCH_SCREENS is a container class that holds multiple SCH_SCREENs in a hierarchy.
void SCH_EDIT_FRAME::DeleteConnection ( bool  DeleteFullConnection)
private

Definition at line 652 of file schedit.cpp.

References DeleteItemsInList(), SCH_SCREEN::GetConnection(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetScreen(), EDA_DRAW_FRAME::m_canvas, and OnModify().

Referenced by Process_Special_Functions().

653 {
654  PICKED_ITEMS_LIST pickList;
655  SCH_SCREEN* screen = GetScreen();
657 
658  if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
659  {
660  DeleteItemsInList( m_canvas, pickList );
661  OnModify();
662  }
663 }
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
int GetConnection(const wxPoint &aPosition, PICKED_ITEMS_LIST &aList, bool aFullConnection)
Functions GetConnection adds all of the wires and junctions to aList that make up a connection to the...
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void DeleteItemsInList(EDA_DRAW_PANEL *panel, PICKED_ITEMS_LIST &aItemsList)
Function DeleteItemsInList delete schematic items in aItemsList deleted items are put in undo list...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void SCH_EDIT_FRAME::DeleteCurrentSegment ( wxDC *  DC)
private

Function DeleteCurrentSegment erases the last segment at the current mouse position.

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

References DrawSegment(), SCH_SCREEN::GetCurItem(), GetScreen(), EDA_ITEM::IsNew(), EDA_DRAW_FRAME::m_canvas, SCH_SCREEN::Remove(), SCH_SCREEN::SetCurItem(), EDA_DRAW_PANEL::SetMouseCaptureCallback(), and SetRepeatItem().

398 {
399  SCH_SCREEN* screen = GetScreen();
400 
401  SetRepeatItem( NULL );
402 
403  if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
404  return;
405 
406  DrawSegment( m_canvas, DC, wxDefaultPosition, false );
407 
408  screen->Remove( screen->GetCurItem() );
410  screen->SetCurItem( NULL );
411 }
bool IsNew() const
Definition: base_struct.h:216
static void DrawSegment(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Mouse capture callback for drawing line segments.
void Remove(SCH_ITEM *aItem)
Function Remove removes aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:158
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
void SCH_EDIT_FRAME::DeleteItem ( SCH_ITEM aItem)

Function DeleteItem removes aItem from the current screen and saves it in the undo list.

Parameters
aItemThe item to remove from the current screen.

Definition at line 158 of file operations_on_items_lists.cpp.

References EDA_ITEM::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), EDA_ITEM::GetParent(), GetScreen(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::RefreshDrawingRect(), SCH_SCREEN::Remove(), SCH_SHEET::RemovePin(), SaveCopyInUndoList(), SCH_SHEET_PIN_T, SCH_SHEET_T, EDA_ITEM::Type(), UR_CHANGED, and UR_DELETED.

Referenced by DeleteItemAtCrossHair(), and Process_Special_Functions().

159 {
160  wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) );
161 
162  // Here, aItem is not null.
163 
164  SCH_SCREEN* screen = GetScreen();
165 
166  if( aItem->Type() == SCH_SHEET_PIN_T )
167  {
168  // This iten is attached to a node, and is not accessible by the global list directly.
169  SCH_SHEET* sheet = (SCH_SHEET*) aItem->GetParent();
170  wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
171  wxT( "Sheet label has invalid parent item." ) );
173  sheet->RemovePin( (SCH_SHEET_PIN*) aItem );
175  }
176  else
177  {
178  screen->Remove( aItem );
179  SaveCopyInUndoList( aItem, UR_DELETED );
181  }
182 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
EDA_ITEM * GetParent() const
Definition: base_struct.h:208
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:306
void Remove(SCH_ITEM *aItem)
Function Remove removes aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:158
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
void RemovePin(SCH_SHEET_PIN *aSheetPin)
Remove aSheetPin from the sheet.
Definition: sch_sheet.cpp:370
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:649
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
bool SCH_EDIT_FRAME::DeleteItemAtCrossHair ( wxDC *  aDC)

Function DeleteItemAtCrossHair delete the item found under the cross hair.

If multiple items are found at the cross hair position, a context menu is displayed to clarify which item to delete. See LocateItem() for more information on locating multiple items.

Parameters
aDCThe device context to update if and item is deleted.
Returns
True if an item was deleted.

Definition at line 666 of file schedit.cpp.

References DeleteItem(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetScreen(), SCH_ITEM::IsConnectable(), LocateItem(), EDA_DRAW_FRAME::m_canvas, OnModify(), SCH_COLLECTOR::ParentItems, EDA_DRAW_PANEL::Refresh(), SCH_SCREEN::SetCurItem(), SetRepeatItem(), and SCH_SCREEN::TestDanglingEnds().

Referenced by OnHotKey(), and OnLeftClick().

667 {
668  SCH_ITEM* item;
669  SCH_SCREEN* screen = GetScreen();
670 
672 
673  if( item )
674  {
675  bool itemHasConnections = item->IsConnectable();
676 
677  screen->SetCurItem( NULL );
678  SetRepeatItem( NULL );
679  DeleteItem( item );
680 
681  if( itemHasConnections && screen->TestDanglingEnds() )
682  m_canvas->Refresh();
683 
684  OnModify();
685  return true;
686  }
687 
688  return false;
689 }
static const KICAD_T ParentItems[]
A scan list for only parent schematic items.
void DeleteItem(SCH_ITEM *aItem)
Function DeleteItem removes aItem from the current screen and saves it in the undo list...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
SCH_ITEM * LocateItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0)
Function LocateItem checks for items at aPosition matching the types in aFilterList.
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
virtual bool IsConnectable() const
Function IsConnectable returns true if the schematic item can connect to another schematic item...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
bool TestDanglingEnds()
Function TestDanglingEnds tests all of the connectible objects in the schematic for unused connection...
Definition: sch_screen.cpp:911
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
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...
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited
void SCH_EDIT_FRAME::DisplayCurrentSheet ( )

Function DisplayCurrentSheet draws the current sheet on the display.

Definition at line 279 of file hierarch.cpp.

References EDA_DRAW_FRAME::ClearMsgPanel(), GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), ID_POPUP_GRID_LEVEL_1000, SCH_SHEET_PATH::LastScreen(), EDA_DRAW_FRAME::m_canvas, m_CurrentSheet, BASE_SCREEN::m_FirstRedraw, EDA_DRAW_FRAME::m_LastGridSizeId, EDA_DRAW_PANEL::MoveCursorToCrossHair(), EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_PANEL::Refresh(), SCH_SCREEN::SchematicCleanUp(), EDA_DRAW_PANEL::SetCanStartBlock(), EDA_DRAW_FRAME::SetCrossHairPosition(), SetCurrentSheetHighlightFlags(), BASE_SCREEN::SetGrid(), SetRepeatItem(), EDA_DRAW_FRAME::SetScreen(), SetSheetNumberAndCount(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by OnLeftClick(), OnLeftDClick(), HIERARCHY_NAVIG_DLG::OnSelect(), and Process_Special_Functions().

280 {
281  SetRepeatItem( NULL );
282  ClearMsgPanel();
283 
284  SCH_SCREEN* screen = m_CurrentSheet->LastScreen();
285 
286  // Switch to current sheet,
287  // and update the grid size, because it can be modified in latest screen
288  SetScreen( screen );
290 
291  // update the References
294  m_canvas->SetCanStartBlock( -1 );
295 
296  if( screen->m_FirstRedraw )
297  {
298  Zoom_Automatique( false );
299  screen->m_FirstRedraw = false;
302  screen->SchematicCleanUp();
303  }
304  else
305  {
307  }
308 
309  // Some items (wires, labels) can be highlighted. So prepare the highlight flag:
311 
312  // Now refresh m_canvas. Should be not necessary, but because screen has changed
313  // the previous refresh has set all new draw parameters (scroll position ..)
314  // but most of time there were some inconsitencies about cursor parameters
315  // ( previous position of cursor ...) and artefacts can happen
316  // mainly when sheet size has changed
317  // This second refresh clears artefacts because at this point,
318  // all parameters are now updated
319  m_canvas->Refresh();
320 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
void SetCanStartBlock(int aStartBlock)
const wxPoint & GetScrollCenterPosition() const
SCH_SCREEN * LastScreen() const
Function LastScreen.
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
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:77
bool SchematicCleanUp()
Function SchematicCleanUp performs routine schematic cleaning including breaking wire and buses and d...
Definition: sch_screen.cpp:426
int m_LastGridSizeId
Definition: draw_frame.h:77
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:486
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:745
bool SetCurrentSheetHighlightFlags()
Function SetCurrentSheetHighlightFlags Set/reset the BRIGHTENED of connected objects inside the curre...
bool SCH_BASE_FRAME::DisplayListComponentsInLib ( PART_LIB aLibrary,
wxString &  aBuffer,
wxString &  aPreviousChoice 
)
protectedinherited

Function DisplayComponentsNamesInLib Select a component from the list of components in a library.

Parameters
aLibrary= a reference to the library to explore If NULL the user will be prompted tp chose a library
aBuffer= a wxString to put the selected component name
Returns
true if a component is selected false on cancel

Definition at line 113 of file selpart.cpp.

References DisplayCmpDocAndKeywords(), PART_LIB::GetAliasNames(), PART_LIB::GetLogicalName(), EDA_LIST_DIALOG::GetTextSelection(), KIWAY_HOLDER::Prj(), and SCH_BASE_FRAME::SelectLibraryFromList().

Referenced by SCH_BASE_FRAME::SelectPartNameToLoad().

115 {
116  wxArrayString nameList;
117 
118  if( aLibrary == NULL )
119  aLibrary = SelectLibraryFromList();
120 
121  if( aLibrary == NULL )
122  return false;
123 
124  aLibrary->GetAliasNames( nameList );
125 
126  wxArrayString headers;
127  headers.Add( wxT("Component") );
128  headers.Add( wxT("Library") );
129  std::vector<wxArrayString> itemsToDisplay;
130 
131  // Conversion from wxArrayString to vector of ArrayString
132  for( unsigned i = 0; i < nameList.GetCount(); i++ )
133  {
134  wxArrayString item;
135  item.Add( nameList[i] );
136  item.Add( aLibrary->GetLogicalName() );
137  itemsToDisplay.push_back( item );
138  }
139 
140  EDA_LIST_DIALOG dlg( this, _( "Select Component" ), headers, itemsToDisplay,
141  aPreviousChoice, DisplayCmpDocAndKeywords, Prj().SchLibs() );
142 
143  if( dlg.ShowModal() != wxID_OK )
144  return false;
145 
146  aBuffer = dlg.GetTextSelection();
147 
148  return true;
149 }
void GetAliasNames(wxArrayString &aNames)
Load a string array with the names of all the entries in this library.
const wxString GetLogicalName()
Function GetLogicalName returns the logical name of the library.
class EDA_LIST_DIALOG
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
static void DisplayCmpDocAndKeywords(wxString &aName, void *aData)
Definition: selpart.cpp:41
PART_LIB * SelectLibraryFromList()
Function SelectLibraryFromList displays a list of current loaded libraries, and allows the user to se...
Definition: selpart.cpp:58
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 503 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

Referenced by EDA_DRAW_FRAME::OnUpdateUnits(), PCB_BASE_FRAME::updateGridSelectBox(), SCH_BASE_FRAME::UpdateStatusBar(), and EDA_DRAW_FRAME::UpdateStatusBar().

504 {
505  wxString msg;
506 
507  switch( g_UserUnit )
508  {
509  case INCHES:
510  msg = _( "Inches" );
511  break;
512 
513  case MILLIMETRES:
514  msg = _( "mm" );
515  break;
516 
517  default:
518  msg = _( "Units" );
519  break;
520  }
521 
522  SetStatusText( msg, 4 );
523 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
bool SCH_EDIT_FRAME::doAutoSave ( )
overrideprotectedvirtual

Function doAutoSave saves the schematic files that have been modified and not yet saved.

Returns
true if the auto save was successful otherwise false.

Reimplemented from EDA_BASE_FRAME.

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

References AUTOSAVE_PREFIX_FILENAME, g_RootSheet, SCH_SHEET::GetFileName(), SCH_SCREENS::GetFirst(), SCH_SCREENS::GetNext(), EDA_BASE_FRAME::IsWritable(), EDA_BASE_FRAME::m_autoSaveState, NO_BACKUP_FILE, and SaveEEFile().

567 {
568  wxFileName tmpFileName = g_RootSheet->GetFileName();
569  wxFileName fn = tmpFileName;
570  wxFileName tmp;
571  SCH_SCREENS screens;
572 
573  bool autoSaveOk = true;
574 
575  tmp.AssignDir( fn.GetPath() );
576 
577  if( !tmp.IsOk() )
578  return false;
579 
580  if( !IsWritable( tmp ) )
581  return false;
582 
583  for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
584  {
585  // Only create auto save files for the schematics that have been modified.
586  if( !screen->IsSave() )
587  continue;
588 
589  tmpFileName = fn = screen->GetFileName();
590 
591  // Auto save file name is the normal file name prefixed with AUTOSAVE_PREFIX_FILENAME.
592  fn.SetName( AUTOSAVE_PREFIX_FILENAME + fn.GetName() );
593 
594  screen->SetFileName( fn.GetFullPath() );
595 
596  if( SaveEEFile( screen, false, NO_BACKUP_FILE ) )
597  screen->SetModify();
598  else
599  autoSaveOk = false;
600 
601  screen->SetFileName( tmpFileName.GetFullPath() );
602  }
603 
604  if( autoSaveOk )
605  m_autoSaveState = false;
606 
607  return autoSaveOk;
608 }
bool m_autoSaveState
Flag to indicate the last auto save state.
Definition: wxstruct.h:145
SCH_SCREEN * GetNext()
#define NO_BACKUP_FILE
Definition: wxstruct.h:60
bool IsWritable(const wxFileName &aFileName)
Function IsWritable checks if aFileName can be written.
Definition: basicframe.cpp:532
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
bool SaveEEFile(SCH_SCREEN *aScreen, bool aSaveUnderNewName=false, bool aCreateBackupFile=CREATE_BACKUP_FILE)
Function SaveEEFile saves aScreen to a schematic file.
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:849
SCH_SCREEN * GetFirst()
#define AUTOSAVE_PREFIX_FILENAME
a prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash ...
Definition: wxstruct.h:70
Class SCH_SCREENS is a container class that holds multiple SCH_SCREENs in a hierarchy.
void EDA_DRAW_FRAME::DrawWorkSheet ( wxDC *  aDC,
BASE_SCREEN aScreen,
int  aLineWidth,
double  aScale,
const wxString &  aFilename,
const wxString &  aSheetLayer = wxEmptyString 
)
inherited

Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions.

Parameters
aDCThe device context.
aScreenscreen to draw
aLineWidthThe pen width to use to draw the layout.
aScaleThe mils to Iu conversion factor.
aFilenameThe filename to display in basic inscriptions.
aSheetLayerThe layer displayed from pcbnew.

Definition at line 77 of file worksheet.cpp.

References color, DARKDARKGRAY, DrawPageLayout(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_FRAME::GetPageSettings(), EDA_DRAW_FRAME::GetScreenDesc(), PAGE_INFO::GetSizeMils(), EDA_DRAW_FRAME::GetTitleBlock(), GR_COPY, GRRect(), GRSetDrawMode(), LIGHTGRAY, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_drawBgColor, BASE_SCREEN::m_IsPrinting, BASE_SCREEN::m_NumberOfScreens, BASE_SCREEN::m_ScreenNumber, EDA_DRAW_FRAME::m_showBorderAndTitleBlock, EDA_DRAW_FRAME::m_showPageLimits, RED, WHITE, wxPoint::x, and wxPoint::y.

Referenced by PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), PL_EDITOR_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), PL_EDITOR_FRAME::RedrawActiveWindow(), GERBVIEW_FRAME::RedrawActiveWindow(), RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

80 {
82  return;
83 
84  const PAGE_INFO& pageInfo = GetPageSettings();
85  wxSize pageSize = pageInfo.GetSizeMils();
86 
87  // if not printing, draw the page limits:
88  if( !aScreen->m_IsPrinting && m_showPageLimits )
89  {
90  GRSetDrawMode( aDC, GR_COPY );
91  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
92  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
94  }
95 
96  TITLE_BLOCK t_block = GetTitleBlock();
97  COLOR4D color = COLOR4D( RED );
98 
99  wxPoint origin = aDC->GetDeviceOrigin();
100 
101  if( aScreen->m_IsPrinting && origin.y > 0 )
102  {
103  aDC->SetDeviceOrigin( 0, 0 );
104  aDC->SetAxisOrientation( true, false );
105  }
106 
107  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
108  GetScreenDesc(), aFilename, t_block,
109  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
110  aLineWidth, aScalar, color, color, aSheetLayer );
111 
112  if( aScreen->m_IsPrinting && origin.y > 0 )
113  {
114  aDC->SetDeviceOrigin( origin.x, origin.y );
115  aDC->SetAxisOrientation( true, true );
116  }
117 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
virtual const TITLE_BLOCK & GetTitleBlock() const =0
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:83
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
const wxSize & GetSizeMils() const
virtual const PAGE_INFO & GetPageSettings() const =0
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:120
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:112
EDA_RECT * GetClipBox()
Definition: colors.h:60
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void DrawPageLayout(wxDC *aDC, EDA_RECT *aClipBox, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, TITLE_BLOCK &aTitleBlock, int aSheetCount, int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor, COLOR4D aAltColor, const wxString &aSheetLayer)
Function DrawPageLayout is a core function to draw the page layout with the frame and the basic inscr...
Definition: worksheet.cpp:49
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:81
Definition: colors.h:49
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void SCH_EDIT_FRAME::Edge ( DRAWSEGMENT Segment,
wxDC *  DC 
)
private
void SCH_EDIT_FRAME::EditComponent ( SCH_COMPONENT aComponent)
private

Function EditComponent displays the edit component dialog to edit the parameters of aComponent.

Parameters
aComponentis a pointer to the SCH_COMPONENT object to be edited.

Definition at line 161 of file dialog_edit_component_in_schematic.cpp.

References SCH_COMPONENT::AutoAutoplaceFields(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::chipnameTextCtrl, EnsureTextCtrlWidth(), EDA_DRAW_FRAME::GetCanvas(), GetScreen(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), m_autoplaceFields, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::MoveCursorToCrossHair(), EDA_DRAW_PANEL::Refresh(), SCH_COMPONENT_T, EDA_DRAW_PANEL::SetIgnoreMouseEvents(), DIALOG_SHIM::ShowQuasiModal(), and EDA_ITEM::Type().

Referenced by OnEditItem(), and OnLeftDClick().

162 {
163  wxCHECK_RET( aComponent != NULL && aComponent->Type() == SCH_COMPONENT_T,
164  wxT( "Invalid component object pointer. Bad Programmer!" ) );
165 
167 
169 
170  dlg->InitBuffers( aComponent );
171 
172  // make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names:
174 
175  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
176  // frame. Therefore this dialog as a modal frame parent, MUST be run under
177  // quasimodal mode for the quasimodal frame support to work. So don't use
178  // the QUASIMODAL macros here.
179  int ret = dlg->ShowQuasiModal();
180 
181  if( m_autoplaceFields )
182  aComponent->AutoAutoplaceFields( GetScreen() );
183 
184  m_canvas->SetIgnoreMouseEvents( false );
186  dlg->Destroy();
187 
188  if( ret == wxID_OK )
189  GetCanvas()->Refresh();
190 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Function AutoAutoplaceFields Autoplace fields only if correct to do so automatically.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
bool EnsureTextCtrlWidth(wxTextCtrl *aCtrl, const wxString *aString)
Function EnsureTextCtrlWidth sets the minimum pixel width on a text control in order to make a text s...
Definition: common.cpp:108
int ShowQuasiModal()
bool m_autoplaceFields
automatically place component fields
Definition: schframe.h:154
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMA...
void SetIgnoreMouseEvents(bool aIgnore)
void InitBuffers(SCH_COMPONENT *aComponent)
Function InitBuffers sets up to edit the given component.
void SCH_EDIT_FRAME::EditComponentFieldText ( SCH_FIELD aField)
private

Function EditComponentFieldText displays the edit field dialog to edit the parameters of aField.

Parameters
aFieldis a pointer to the SCH_FIELD object to be edited.

Definition at line 45 of file edit_component_in_schematic.cpp.

References FROM_UTF8(), GetChars(), GetCurrentSheet(), EDA_ITEM::GetFlags(), SCH_FIELD::GetName(), EDA_ITEM::GetParent(), GetScreen(), m_autoplaceFields, EDA_DRAW_FRAME::m_canvas, m_CurrentSheet, EDA_DRAW_PANEL::MoveCursorToCrossHair(), OnModify(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), SCH_COMPONENT_T, SCH_FIELD_T, EDA_DRAW_PANEL::SetIgnoreMouseEvents(), EDA_DRAW_FRAME::SetMsgPanel(), DIALOG_SHIM::ShowQuasiModal(), EDA_ITEM::Type(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), and UR_CHANGED.

Referenced by OnEditItem(), and OnLeftDClick().

46 {
47  wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T,
48  wxT( "Cannot edit invalid schematic field." ) );
49 
50  SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
51 
52  wxCHECK_RET( component != NULL && component->Type() == SCH_COMPONENT_T,
53  wxT( "Invalid schematic field parent item." ) );
54 
55  LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetLibId() );
56 
57  wxCHECK_RET( part, wxT( "Library part for component <" ) +
58  FROM_UTF8( component->GetLibId().GetLibItemName() ) +
59  wxT( "> could not be found." ) );
60 
61  // Save old component in undo list if not already in edit, or moving.
62  if( aField->GetFlags() == 0 )
63  SaveCopyInUndoList( component, UR_CHANGED );
64 
65  // Don't use GetText() here. If the field is the reference designator and it's parent
66  // component has multiple parts, we don't want the part suffix added to the field.
68 
69  wxString title;
70  title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) );
71 
72  DIALOG_SCH_EDIT_ONE_FIELD dlg( this, title, aField );
73 
74  // The dialog may invoke a kiway player for footprint fields
75  // so we must use a quasimodal
76  if( dlg.ShowQuasiModal() != wxID_OK )
77  {
80  return;
81  }
82 
83  dlg.UpdateField( aField, m_CurrentSheet );
86  OnModify();
87 
88  if( m_autoplaceFields )
89  component->AutoAutoplaceFields( GetScreen() );
90 
91  m_canvas->Refresh();
92 
93  MSG_PANEL_ITEMS items;
94  component->SetCurrentSheetPath( &GetCurrentSheet() );
95  component->GetMsgPanelInfo( items );
96  SetMsgPanel( items );
97 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:473
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 SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
EDA_ITEM * GetParent() const
Definition: base_struct.h:208
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:120
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:566
Class LIB_PART defines a library part object.
Class DIALOG_SCH_EDIT_ONE_FIELD is a the class to handle editing a single component field in the sche...
bool m_autoplaceFields
automatically place component fields
Definition: schframe.h:154
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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 SetIgnoreMouseEvents(bool aIgnore)
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
void SCH_EDIT_FRAME::EditImage ( SCH_BITMAP aItem)
private

Definition at line 187 of file edit_bitmap.cpp.

References EDA_ITEM::GetFlags(), SCH_BITMAP::GetImage(), GetScreen(), BLOCK_SELECTOR::GetState(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, OnModify(), EDA_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), STATE_NO_BLOCK, and UR_CHANGED.

Referenced by OnEditItem(), and OnLeftDClick().

188 {
189  // TODO: change image scale or more
190  DIALOG_IMAGE_EDITOR dlg( this, aItem->GetImage() );
191 
192  if( dlg.ShowModal() != wxID_OK )
193  return;
194 
195  // save old image in undo list if not already in edit
196  // or the image to be edited is part of a block
197  if( aItem->GetFlags() == 0 ||
199  SaveCopyInUndoList( aItem, UR_CHANGED );
200 
201  dlg.TransfertToImage( aItem->GetImage() );
202  OnModify();
203  m_canvas->Refresh();
204 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
BITMAP_BASE * GetImage()
Definition: sch_bitmap.h:61
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
BLOCK_STATE_T GetState() const
Definition: