KiCad PCB EDA Suite
LIB_EDIT_FRAME Class Reference

The symbol library editor main window. More...

#include <lib_edit_frame.h>

Inheritance diagram for LIB_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

 LIB_EDIT_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
 ~LIB_EDIT_FRAME ()
 
void OnSwitchCanvas (wxCommandEvent &aEvent) override
 switches currently used canvas ( Cairo / OpenGL). More...
 
wxString GetCurLib () const
 The nickname of the current library being edited and empty string if none. More...
 
wxString SetCurLib (const wxString &aLibNickname)
 Sets the current library nickname and returns the old library nickname. More...
 
LIB_PARTGetCurPart () const
 Return the current part being edited or NULL if none selected. More...
 
void SetCurPart (LIB_PART *aPart)
 Take ownership of aPart and notes that it is the one currently being edited. More...
 
int GetRepeatPinStep () const
 
void SetRepeatPinStep (int aStep)
 Sets the repeat step value for pins repeat command. More...
 
void ReCreateMenuBar () override
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
void InstallConfigFrame (wxCommandEvent &event)
 
void OnPreferencesOptions (wxCommandEvent &event)
 
void Process_Config (wxCommandEvent &event)
 
bool SynchronizePins ()
 Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable because in this case similar pins are expected at the same location. More...
 
void OnPlotCurrentComponent (wxCommandEvent &event)
 Plot the current symbol in SVG or PNG format. More...
 
void Process_Special_Functions (wxCommandEvent &event)
 
void OnSelectTool (wxCommandEvent &aEvent)
 
void OnCreateNewLibrary (wxCommandEvent &aEvent)
 Creates a new library. More...
 
void OnAddLibrary (wxCommandEvent &aEvent)
 Adds an existing library. More...
 
void OnCreateNewPart (wxCommandEvent &aEvent)
 Creates a new part in the selected library. More...
 
void OnEditPart (wxCommandEvent &aEvent)
 Opens the selected part for editing. More...
 
void OnImportPart (wxCommandEvent &event)
 Routine to read one part. More...
 
void OnExportPart (wxCommandEvent &event)
 Creates a new library and backup the current component in this library or exports the component of the current library. More...
 
void OnSave (wxCommandEvent &aEvent)
 Saves the selected part or library. More...
 
void OnSaveAs (wxCommandEvent &aEvent)
 Saves the selected part or library to a new name and/or location. More...
 
void OnSaveAll (wxCommandEvent &aEvent)
 Saves all modified parts and libraries. More...
 
void OnRevert (wxCommandEvent &aEvent)
 Reverts unsaved changes in a part, restoring to the last saved state. More...
 
void OnRemovePart (wxCommandEvent &aEvent)
 Removes a part from the working copy of a library. More...
 
void OnDuplicatePart (wxCommandEvent &aEvent)
 
void OnCopyCutPart (wxCommandEvent &aEvent)
 
void OnPasteDuplicatePart (wxCommandEvent &aEvent)
 
void OnSelectPart (wxCommandEvent &event)
 
void OnShowElectricalType (wxCommandEvent &event)
 From Option toolbar: option to show the electrical pin type name. More...
 
void OnToggleSearchTree (wxCommandEvent &event)
 
void OnEditSymbolLibTable (wxCommandEvent &aEvent) override
 
bool IsSearchTreeShown ()
 
void ClearSearchTreeSelection ()
 
void OnEditComponentProperties (wxCommandEvent &event)
 
void OnViewEntryDoc (wxCommandEvent &event)
 
void OnCheckComponent (wxCommandEvent &event)
 
void OnSelectBodyStyle (wxCommandEvent &event)
 
void OnEditPin (wxCommandEvent &event)
 
void OnSelectItem (wxCommandEvent &aEvent)
 
void OnOpenPinTable (wxCommandEvent &aEvent)
 
void OnUpdatePaste (wxUpdateUIEvent &event)
 
void OnUpdateSelectTool (wxUpdateUIEvent &aEvent)
 
void OnUpdateEditingPart (wxUpdateUIEvent &event)
 
void OnUpdateHavePart (wxUpdateUIEvent &aEvent)
 
void OnUpdateSave (wxUpdateUIEvent &aEvent)
 
void OnUpdateSaveAs (wxUpdateUIEvent &aEvent)
 
void OnUpdateRevert (wxUpdateUIEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &event)
 
void OnUpdateRedo (wxUpdateUIEvent &event)
 
void OnUpdateSyncPinEdit (wxUpdateUIEvent &event)
 
void OnUpdatePinTable (wxUpdateUIEvent &event)
 
void OnUpdatePartNumber (wxUpdateUIEvent &event)
 
void OnUpdateDeMorganNormal (wxUpdateUIEvent &event)
 
void OnUpdateDeMorganConvert (wxUpdateUIEvent &event)
 
void OnUpdateElectricalType (wxUpdateUIEvent &aEvent)
 
void OnUpdateSearchTreeTool (wxUpdateUIEvent &aEvent)
 
void UpdatePartSelectList ()
 
void RedrawComponent (wxDC *aDC, wxPoint aOffset)
 Redraw the current component loaded in library editor Display reference like in schematic (a reference U is shown U? or U?A) accordint to the current selected unit and De Morgan selection although it is stored without ? and part id. More...
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 Redraw the current component loaded in library editor, an axes Display reference like in schematic (a reference U is shown U? or U?A) update status bar and info shown in the bottom of the window. More...
 
void OnCloseWindow (wxCloseEvent &Event)
 
void ReCreateHToolbar () override
 
void ReCreateVToolbar () override
 
void ReCreateOptToolbar ()
 
void OnLeftClick (wxDC *DC, const wxPoint &MousePos) override
 
bool OnRightClick (const wxPoint &MousePos, wxMenu *PopMenu) override
 
double BestZoom () override
 Return the zoom level which displays the full page on screen. More...
 
void OnLeftDClick (wxDC *DC, const wxPoint &MousePos) override
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 

More...
 
bool OnHotKey (wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Perform application specific control using aDC at aPosition in logical units. 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 CloseWindow (wxCommandEvent &event)
 Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro: More...
 
void OnModify ()
 Must be called after a schematic change in order to set the "modify" flag of the current screen. More...
 
int GetUnit ()
 
void SetUnit (int unit)
 
int GetConvert ()
 
void SetConvert (int convert)
 
LIB_ITEMGetLastDrawItem ()
 
void SetLastDrawItem (LIB_ITEM *drawItem)
 
LIB_ITEMGetDrawItem () const
 
void SetDrawItem (LIB_ITEM *drawItem)
 
bool GetShowDeMorgan ()
 
void SetShowDeMorgan (bool show)
 
bool GetShowElectricalType ()
 
void SetShowElectricalType (bool aShow)
 
FILL_T GetFillStyle ()
 
void TempCopyComponent ()
 Create a temporary copy of the current edited component. More...
 
void RestoreComponent ()
 Restore the current edited component from its temporary copy. More...
 
LIB_PARTGetTempCopyComponent ()
 
void ClearTempCopyComponent ()
 Delete temporary copy of the current component and clear pointer. More...
 
bool IsEditingDrawItem ()
 
void SaveCopyInUndoList (EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
 Create a copy of the current component, and save it in the undo list. More...
 
bool LoadComponentAndSelectLib (const LIB_ID &aLibId, int aUnit, int aConvert)
 Selects the currently active library and loads the symbol from aLibId. More...
 
virtual int BlockCommand (EDA_KEY aKey) override
 Returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the aKey (ALT, SHIFT ALT ..) More...
 
virtual void HandleBlockPlace (wxDC *DC) override
 Handles the block place command. More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Performs a block end command. More...
 
void PlacePin ()
 Place at cursor location the pin currently moved (i.e. More...
 
void GlobalSetPins (LIB_PIN *aMasterPin, int aId)
 
void RepeatPinItem (wxDC *DC, LIB_PIN *Pin)
 
void CreateImageFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 Creates an image (screenshot) of the current symbol. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL) override
 Print a page. More...
 
void SVG_PlotComponent (const wxString &aFullFileName)
 Creates the SVG print file for the current edited component. More...
 
void SyncLibraries (bool aShowProgress)
 Synchronize the library manager to the symbol library table, and then the symbol tree to the library manager. More...
 
void InstallPreferences (PAGED_DIALOG *aParent) override
 Allows Libedit to install its preferences panel into the preferences dialog. More...
 
void CommonSettingsChanged () override
 Called after the preferences dialog is run. More...
 
void ShowChangedLanguage () override
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void SetScreen (BASE_SCREEN *aScreen) override
 
virtual const BOX2I GetDocumentExtents () const override
 
void RebuildView ()
 
void HardRedraw () override
 Rebuild the GAL and redraw the screen. More...
 
int BlockSelectItems (LIB_PART *aPart, BLOCK_SELECTOR *aBlock, int aUnit, int aConvert, bool aSyncPinEdit)
 Checks all draw objects of part to see if they are with block. More...
 
void BlockClearSelectedItems (LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
 Clears all the draw items marked by a block select. More...
 
void BlockMoveSelectedItems (const wxPoint &aOffset, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
 
void BlockDeleteSelectedItems (LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
 
void BlockCopySelectedItems (const wxPoint &aOffset, LIB_PART *aPart, BLOCK_SELECTOR *aBlock)
 
void KiwayMailIn (KIWAY_EXPRESS &mail) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
void createCanvas ()
 
SCH_DRAW_PANELGetCanvas () const override
 
SCH_SCREENGetScreen () const override
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
KIGFX::SCH_RENDER_SETTINGSGetRenderSettings ()
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (Cairo / OpenGL). More...
 
const wxPoint GetRepeatStep () const
 
void SetRepeatStep (const wxPoint &aStep)
 Sets the repeat step value for repeat command. More...
 
int GetRepeatDeltaLabel () const
 
void SetRepeatDeltaLabel (int aDelta)
 Sets the repeat delta label value for repeat command. More...
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPoint & GetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPoint & GetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
void OnGridSettings (wxCommandEvent &aEvent) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Update the status bar information. More...
 
COMPONENT_SELECTION SelectComponentFromLibTree (const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
const TEMPLATE_FIELDNAMESGetTemplateFieldNames () const
 Return a template field names list for read only access. More...
 
const TEMPLATE_FIELDNAMEGetTemplateFieldName (const wxString &aName) const
 Search for aName in the the template field name list. More...
 
LIB_ALIASGetLibAlias (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowError=false)
 Load symbol from symbol library table. More...
 
LIB_PARTGetLibPart (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
virtual void Zoom_Automatique (bool aWarpPointer) override
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
virtual void Window_Zoom (EDA_RECT &aRect) override
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer) override
 Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore) override
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void CenterScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 
void AddToScreen (SCH_ITEM *aItem)
 Add an item to the screen (and view) More...
 
void AddToScreen (DLIST< SCH_ITEM > &aItems)
 Add a list of items to the screen (and view) More...
 
void RemoveFromScreen (SCH_ITEM *aItem)
 Remove an item from the screen (and view) More...
 
void RefreshItem (SCH_ITEM *aItem, bool isAddOrDelete=false)
 Mark an item for refresh. More...
 
void SyncView ()
 Mark all items for refresh. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPoint & GetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void 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
 Return a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 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
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Set the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 
virtual void SetGridVisibility (bool aVisible)
 It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 
virtual void SetGridColor (COLOR4D aColor)
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Change the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Change the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Change 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)
 Set 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 OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
void SetNextZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the next one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 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 OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
virtual void UseGalCanvas (bool aEnable)
 Use to switch between standard and GAL-based canvas. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Return the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
VTBL_ENTRY bool OpenProjectFiles (const std::vector< wxString > &aFileList, int aCtl=0)
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. 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)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. 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 int GetPinNumDefaultSize ()
 
static void SetPinNumDefaultSize (int aSize)
 
static int GetPinNameDefaultSize ()
 
static void SetPinNameDefaultSize (int aSize)
 
static int GetDefaultPinLength ()
 
static void SetDefaultPinLength (int aLength)
 Set the default pin len. More...
 

Protected Member Functions

void OnOpenLibraryViewer (wxCommandEvent &event)
 Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (wxString &aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Select a component from the list of components in a library. More...
 
wxString SelectLibraryFromList ()
 Dispaly a list of loaded libraries in the symbol library and allows the user to select a library. More...
 
bool SelectPartNameToLoad (wxString &aLibrary, wxString &aBufName)
 Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a library. More...
 
bool saveSymbolLibTables (bool aGlobal, bool aProject)
 Saves Symbol Library Tables to disk. More...
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0) override
 Initialize a block command. More...
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
virtual void unitsChangeRefresh ()
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool saveCanvasImageToFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 
virtual wxString GetCanvasTypeKey ()
 
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 onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. 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 ()
 

Static Protected Member Functions

static wxString GetBackupSuffix ()
 Function GetBackupSuffix. More...
 
static wxString GetAutoSaveFilePrefix ()
 Function GetAutoSaveFilePrefix. More...
 

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

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Member Functions

LIB_ITEMlocateItem (const wxPoint &aPosition, const KICAD_T aFilterList[])
 
void loadPart (const wxString &aLibrary, const wxString &aPart, int Unit)
 
void savePartAs ()
 
bool saveLibrary (const wxString &aLibrary, bool aNewFile)
 Saves the changes to the current library. More...
 
void updateTitle ()
 Updates the main window title bar with the current library name and read only status of the library. More...
 
virtual void OnActivate (wxActivateEvent &event) override
 Called when the frame is activated. More...
 
void SelectActiveLibrary (const wxString &aLibrary=wxEmptyString)
 Set the current active library to aLibrary. More...
 
bool LoadComponentFromCurrentLib (const wxString &aAliasName, int aUnit=0, int aConvert=0)
 Loads a symbol from the current active library, optionally setting the selected unit and convert. More...
 
bool LoadOneLibraryPartAux (LIB_ALIAS *aLibEntry, const wxString &aLibrary, int aUnit, int aConvert)
 Create a copy of aLibEntry into memory. More...
 
void DisplayCmpDoc ()
 Display the documentation of the selected component. More...
 
void OnRotate (wxCommandEvent &aEvent)
 Rotates the current item. More...
 
void OnOrient (wxCommandEvent &aEvent)
 Handles the ID_LIBEDIT_MIRROR_X and ID_LIBEDIT_MIRROR_Y events. More...
 
void deleteItem (wxDC *aDC, LIB_ITEM *aItem)
 Deletes the currently selected draw item. More...
 
void GetComponentFromUndoList (wxCommandEvent &event)
 
void GetComponentFromRedoList (wxCommandEvent &event)
 
void CreatePin (wxDC *DC)
 
void StartMovePin (LIB_ITEM *aPin)
 Prepare the displacement of a pin. More...
 
void CreateImagePins (LIB_PIN *aPin)
 Adds copies of aPin in components with multiple units in all units. More...
 
void PlaceAnchor ()
 Places an anchor reference coordinate for the current component. More...
 
LIB_ITEMCreateGraphicItem (LIB_PART *LibEntry, wxDC *DC)
 
void GraphicItemBeginDraw (wxDC *DC)
 
void StartMoveDrawSymbol (wxDC *DC, LIB_ITEM *aItem)
 
void StartModifyDrawSymbol (wxDC *DC, LIB_ITEM *aItem)
 
void EndDrawGraphicItem (wxDC *DC)
 
void LoadOneSymbol ()
 Read a component symbol file (*.sym ) and add graphic items to the current component. More...
 
void SaveOneSymbol ()
 Saves the current symbol to a symbol file. More...
 
void EditGraphicSymbol (wxDC *DC, LIB_ITEM *DrawItem)
 
void EditSymbolText (wxDC *DC, LIB_ITEM *DrawItem)
 
LIB_ITEMLocateItemUsingCursor (const wxPoint &aPosition, const KICAD_T aFilterList[]=LIB_COLLECTOR::AllItems)
 
void EditField (LIB_FIELD *Field)
 
void refreshSchematic ()
 
SYMBOL_LIB_TABLEselectSymLibTable (bool aOptional=false)
 Displays a dialog asking the user to select a symbol library table. More...
 
bool backupFile (const wxFileName &aOriginalFile, const wxString &aBackupExt)
 

Creates a backup copy of a file with requested extension

More...
 
LIB_PARTgetTargetPart () const
 

Returns currently edited part.

More...
 
LIB_ID getTargetLibId () const
 

Returns either the part selected in the component tree, if context menu is active or the currently modified part.

More...
 
wxString getTargetLib () const
 

Returns either the library selected in the component tree, if context menu is active or the library that is currently modified.

More...
 
bool saveAllLibraries (bool aRequireConfirmation)
 
bool saveCurrentPart ()
 

Saves the current part.

More...
 
bool addLibraryFile (bool aCreateNew)
 

Creates or adds an existing library to the symbol library table.

More...
 
void storeCurrentPart ()
 

Stores the currently modified part in the library manager buffer.

More...
 
bool isCurrentPart (const LIB_ID &aLibId) const
 

Returns true if aLibId is an alias for the editor screen part.

More...
 
void emptyScreen ()
 

Restores the empty editor screen, without any part or library selected.

More...
 
void fixDuplicateAliases (LIB_PART *aPart, const wxString &aLibrary)
 

Renames LIB_PART aliases to avoid conflicts before adding a component to a library

More...
 
void InitBlockPasteInfos () override
 
void copySelectedItems ()
 Copies items selected in the current part to the internal clipboard. More...
 
void pasteClipboard (const wxPoint &aOffset)
 Pastes items from the internal clipboard to the current part. More...
 

Private Attributes

LIB_PARTm_my_part
 a part I own, it is not in any library, but a copy could be. More...
 
LIB_PARTm_tempCopyComponent
 temp copy of a part during edit, I own it here. More...
 
LIB_COLLECTOR m_collectedItems
 Used for hit testing. More...
 
wxComboBox * m_partSelectBox
 a Box to select a part to edit (if any) More...
 
SYMBOL_TREE_PANEm_treePane
 component search tree widget More...
 
LIB_MANAGERm_libMgr
 manager taking care of temporary modificatoins More...
 
std::unique_ptr< LIB_PARTm_copiedPart
 
bool m_drawSpecificConvert
 Convert of the item currently being drawn. More...
 
bool m_drawSpecificUnit
 Specify which component parts the current draw item applies to. More...
 
bool m_syncPinEdit
 Set to true to not synchronize pins at the same position when editing symbols with multiple units or multiple body styles. More...
 
bool m_showPinElectricalTypeName
 the option to show the pin electrical name in the component editor More...
 
int m_repeatPinStep
 Default repeat offset for pins in repeat place pin. More...
 
int m_defaultLibWidth
 
SCH_SCREENm_dummyScreen
 

Helper screen used when no part is loaded

More...
 
BLOCK_SELECTOR m_clipboard
 

Clipboard buffer storing LIB_ITEMs

More...
 

Static Private Attributes

static FILL_T m_drawFillStyle = NO_FILL
 The current draw or edit graphic item fill style. More...
 
static int m_drawLineWidth = 0
 Default line width for drawing or editing graphic items. More...
 
static LIB_ITEMm_lastDrawItem = NULL
 
static int m_unit = 1
 
static int m_convert = 1
 
static bool m_showDeMorgan = false
 
static int m_textSize = -1
 The current text size setting. More...
 
static double m_current_text_angle = TEXT_ANGLE_HORIZ
 Current text angle setting. More...
 
static int m_textPinNumDefaultSize = DEFAULTPINNUMSIZE
 The default pin num text size setting. More...
 
static int m_textPinNameDefaultSize = DEFAULTPINNAMESIZE
 The default pin name text size setting. More...
 
static int m_defaultPinLength = DEFAULTPINLENGTH
 Default pin length. More...
 

Friends

class DIALOG_LIB_EDIT_TEXT
 

Detailed Description

The symbol library editor main window.

Definition at line 56 of file lib_edit_frame.h.

Member Typedef Documentation

◆ HISTORY_LIST

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

Definition at line 193 of file sch_base_frame.h.

Constructor & Destructor Documentation

◆ LIB_EDIT_FRAME()

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

◆ ~LIB_EDIT_FRAME()

LIB_EDIT_FRAME::~LIB_EDIT_FRAME ( )

Definition at line 305 of file lib_edit_frame.cpp.

306 {
307  Unbind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
309 
310  // current screen is destroyed in EDA_DRAW_FRAME
312 
313  m_lastDrawItem = NULL;
315 
316  delete m_tempCopyComponent;
317  delete m_libMgr;
318  delete m_my_part;
319 }
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
void SetDrawItem(LIB_ITEM *drawItem)
static LIB_ITEM * m_lastDrawItem
virtual void SetScreen(BASE_SCREEN *aScreen) override
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.

References ID_EDIT_SYM_LIB_TABLE, m_dummyScreen, m_lastDrawItem, m_libMgr, m_my_part, m_tempCopyComponent, OnEditSymbolLibTable(), SetDrawItem(), and SetScreen().

Member Function Documentation

◆ addLibraryFile()

bool LIB_EDIT_FRAME::addLibraryFile ( bool  aCreateNew)
private

Creates or adds an existing library to the symbol library table.

Definition at line 1512 of file lib_edit_frame.cpp.

1513 {
1514  wxFileName fn = m_libMgr->GetUniqueLibraryName();
1515 
1516  if( !LibraryFileBrowser( !aCreateNew, fn,
1518  false ) )
1519  {
1520  return false;
1521  }
1522 
1523  wxString libName = fn.GetName();
1524 
1525  if( libName.IsEmpty() )
1526  return false;
1527 
1528  if( m_libMgr->LibraryExists( libName ) )
1529  {
1530  DisplayError( this, wxString::Format( _( "Library \"%s\" already exists" ), libName ) );
1531  return false;
1532  }
1533 
1534  // Select the target library table (global/project)
1535  SYMBOL_LIB_TABLE* libTable = selectSymLibTable();
1536 
1537  if( !libTable )
1538  return false;
1539 
1540  if( aCreateNew )
1541  {
1542  if( !m_libMgr->CreateLibrary( fn.GetFullPath(), libTable ) )
1543  {
1544  DisplayError( this, _( "Could not create the library file. Check write permission." ) );
1545  return false;
1546  }
1547  }
1548  else
1549  {
1550  if( !m_libMgr->AddLibrary( fn.GetFullPath(), libTable ) )
1551  {
1552  DisplayError( this, _( "Could not open the library file." ) );
1553  return false;
1554  }
1555  }
1556 
1557  bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
1558  saveSymbolLibTables( globalTable, !globalTable );
1559 
1560  return true;
1561 }
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Creates an empty library and adds it to the library table.
Definition: lib_manager.h:91
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
wxString SchematicLibraryFileWildcard()
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Adds an existing library.
Definition: lib_manager.h:99
wxString GetUniqueLibraryName() const
Returns a library name that is not currently in use.
const std::string SchematicLibraryFileExtension
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
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 LibraryExists(const wxString &aLibrary, bool aCheckEnabled=false) const
Returns true if library exists.
SYMBOL_LIB_TABLE * selectSymLibTable(bool aOptional=false)
Displays a dialog asking the user to select a symbol library table.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243

References LIB_MANAGER::AddLibrary(), LIB_MANAGER::CreateLibrary(), DisplayError(), Format(), SYMBOL_LIB_TABLE::GetGlobalLibTable(), LIB_MANAGER::GetUniqueLibraryName(), LIB_MANAGER::LibraryExists(), EDA_DRAW_FRAME::LibraryFileBrowser(), m_libMgr, SCH_BASE_FRAME::saveSymbolLibTables(), SchematicLibraryFileExtension, SchematicLibraryFileWildcard(), and selectSymLibTable().

Referenced by OnAddLibrary(), and OnCreateNewLibrary().

◆ AddMenuZoomAndGrid()

void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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 1566 of file legacy_gal/eda_draw_frame.cpp.

1567 {
1568  int maxZoomIds;
1569  double zoom;
1570  wxString msg;
1571  BASE_SCREEN* screen = m_canvas->GetScreen();
1572 
1573  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
1574  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
1575  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
1576  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
1577  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
1578  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
1579  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
1580  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
1581  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
1582  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
1583 
1584 
1585  wxMenu* zoom_choice = new wxMenu;
1586  AddMenuItem( MasterMenu, zoom_choice,
1587  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
1588  KiBitmap( zoom_selection_xpm ) );
1589 
1590  zoom = screen->GetZoom();
1592  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
1593  maxZoomIds : screen->m_ZoomList.size();
1594 
1595  // Populate zoom submenu.
1596  for( int i = 0; i < maxZoomIds; i++ )
1597  {
1598  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
1599 
1600  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
1601  wxEmptyString, wxITEM_CHECK );
1602  if( zoom == screen->m_ZoomList[i] )
1603  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
1604  }
1605 
1606  // Create grid submenu as required.
1607  if( screen->GetGridCount() )
1608  {
1609  wxMenu* gridMenu = new wxMenu;
1610  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
1611  _( "Grid" ), KiBitmap( grid_select_xpm ) );
1612 
1613  wxArrayString gridsList;
1614  int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
1615 
1616  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
1617  {
1618  GRID_TYPE& grid = screen->GetGrid( i );
1619  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
1620 
1621  if( (int)i == icurr )
1622  gridMenu->Check( grid.m_CmdId, true );
1623  }
1624  }
1625 
1626  MasterMenu->AppendSeparator();
1627  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
1628 }
virtual BASE_SCREEN * GetScreen()=0
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
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:223
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:291
Definition: common.h:161
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:118
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value)
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

◆ AddToScreen() [1/2]

void SCH_BASE_FRAME::AddToScreen ( SCH_ITEM aItem)
inherited

Add an item to the screen (and view)

Definition at line 626 of file sch_base_frame.cpp.

627 {
628  GetScreen()->Append( aItem );
629  GetCanvas()->GetView()->Add( aItem );
630  RefreshItem( aItem, true ); // handle any additional parent semantics
631 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:162
void RefreshItem(SCH_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346

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

Referenced by SCH_EDIT_FRAME::addCurrentItemToScreen(), SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::AddNoConnect(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_FRAME::DuplicateItemsInList(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::PasteListOfItems(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), and SCH_EDIT_FRAME::SchematicCleanUp().

◆ AddToScreen() [2/2]

void SCH_BASE_FRAME::AddToScreen ( DLIST< SCH_ITEM > &  aItems)
inherited

Add a list of items to the screen (and view)

Definition at line 634 of file sch_base_frame.cpp.

635 {
636  for( SCH_ITEM* item = aItems.begin(); item; item = item->Next() )
637  {
638  GetCanvas()->GetView()->Add( item );
639  RefreshItem( item, true ); // handle any additional parent semantics
640  }
641 
642  GetScreen()->Append( aItems );
643 }
SCH_ITEM * Next() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
T * begin() const
Definition: dlist.h:218
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:162
void RefreshItem(SCH_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...

References KIGFX::VIEW::Add(), SCH_SCREEN::Append(), DLIST< T >::begin(), SCH_BASE_FRAME::GetCanvas(), SCH_BASE_FRAME::GetScreen(), SCH_DRAW_PANEL::GetView(), SCH_ITEM::Next(), and SCH_BASE_FRAME::RefreshItem().

◆ AdjustScrollBars()

void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint &  aCenterPosition)
inherited

Definition at line 1016 of file legacy_gal/eda_draw_frame.cpp.

1017 {
1018 }

◆ AppendMsgPanel()

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

Append a message to the message panel.

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

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

Definition at line 877 of file legacy_gal/eda_draw_frame.cpp.

880 {
881  if( m_messagePanel == NULL )
882  return;
883 
884  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
885 }
int color
Definition: DXF_plotter.cpp:62
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110

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

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

◆ backupFile()

bool LIB_EDIT_FRAME::backupFile ( const wxFileName &  aOriginalFile,
const wxString &  aBackupExt 
)
private

Creates a backup copy of a file with requested extension

Definition at line 1685 of file lib_edit_frame.cpp.

1686 {
1687  if( aOriginalFile.FileExists() )
1688  {
1689  wxFileName backupFileName( aOriginalFile );
1690  backupFileName.SetExt( "bck" );
1691 
1692  if( backupFileName.FileExists() )
1693  wxRemoveFile( backupFileName.GetFullPath() );
1694 
1695  if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1696  {
1697  DisplayError( this, _( "Failed to save backup document to file " ) +
1698  backupFileName.GetFullPath() );
1699  return false;
1700  }
1701  }
1702 
1703  return true;
1704 }
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243

References DisplayError().

Referenced by saveLibrary().

◆ bestZoom()

double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

◆ BestZoom()

double LIB_EDIT_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 331 of file lib_edit_frame.cpp.

332 {
333  LIB_PART* part = GetCurPart();
334  double defaultLibraryZoom = 7.33;
335 
336  if( !part )
337  {
338  SetScrollCenterPosition( wxPoint( 0, 0 ) );
339  return defaultLibraryZoom;
340  }
341 
343 
344  double sizeX = (double) boundingBox.GetWidth();
345  double sizeY = (double) boundingBox.GetHeight();
346  wxPoint centre = boundingBox.Centre();
347 
348  // Reserve a 20% margin around component bounding box.
349  double margin_scale_factor = 1.2;
350 
351  return bestZoom( sizeX, sizeY, margin_scale_factor, centre);
352 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
static int m_convert
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
void SetScrollCenterPosition(const wxPoint &aPoint)
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
coord_type GetWidth() const
Definition: box2.h:195
Define a library symbol object.
static int m_unit
Vec Centre() const
Definition: box2.h:77
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
coord_type GetHeight() const
Definition: box2.h:196

References EDA_DRAW_FRAME::bestZoom(), boundingBox(), BOX2< Vec >::Centre(), GetCurPart(), BOX2< Vec >::GetHeight(), LIB_PART::GetUnitBoundingBox(), BOX2< Vec >::GetWidth(), m_convert, m_unit, and EDA_DRAW_FRAME::SetScrollCenterPosition().

◆ BlockClearSelectedItems()

void LIB_EDIT_FRAME::BlockClearSelectedItems ( LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Clears all the draw items marked by a block select.

Definition at line 83 of file block_libedit.cpp.

84 {
85  for( LIB_ITEM& item : aPart->GetDrawItems() )
86  {
87  item.ClearFlags();
88  }
89  aBlock->ClearItemsList();
90 }
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.

References BLOCK_SELECTOR::ClearItemsList(), and LIB_PART::GetDrawItems().

Referenced by HandleBlockEnd().

◆ BlockCommand()

int LIB_EDIT_FRAME::BlockCommand ( EDA_KEY  aKey)
overridevirtual

Returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the aKey (ALT, SHIFT ALT ..)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 167 of file block_libedit.cpp.

168 {
169  int cmd = BLOCK_IDLE;
170 
171  switch( key )
172  {
173  default:
174  cmd = key & 0xFF;
175  break;
176 
177  case EDA_KEY_C( 0xffffffff ): // -1
178  // Historically, -1 has been used as a key, which can cause bit flag
179  // clashes with unaware code. On debug builds, catch any old code that
180  // might still be doing this. TODO: remove if sure all this old code is gone.
181  wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
182  // fall through on release builds
183 
184  case GR_KEY_INVALID:
185  cmd = BLOCK_PRESELECT_MOVE;
186  break;
187 
188  case GR_KEY_NONE:
189  cmd = BLOCK_MOVE;
190  break;
191 
192  case GR_KB_SHIFT:
193  cmd = BLOCK_DUPLICATE;
194  break;
195 
196  case GR_KB_ALT:
197  cmd = BLOCK_ROTATE;
198  break;
199 
200  case GR_KB_SHIFTCTRL:
201  cmd = BLOCK_DELETE;
202  break;
203 
204  case GR_KB_CTRL:
205  cmd = BLOCK_MIRROR_Y;
206  break;
207 
208  case MOUSE_MIDDLE:
209  cmd = BLOCK_ZOOM;
210  break;
211  }
212 
213  return cmd;
214 }
#define GR_KB_ALT
#define MOUSE_MIDDLE
#define GR_KB_CTRL
#define EDA_KEY_C
#define GR_KEY_INVALID
#define GR_KB_SHIFT
#define GR_KEY_NONE
#define GR_KB_SHIFTCTRL

References BLOCK_DELETE, BLOCK_DUPLICATE, BLOCK_IDLE, BLOCK_MIRROR_Y, BLOCK_MOVE, BLOCK_PRESELECT_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, EDA_KEY_C, GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_KB_SHIFTCTRL, GR_KEY_INVALID, GR_KEY_NONE, and MOUSE_MIDDLE.

◆ BlockCopySelectedItems()

void LIB_EDIT_FRAME::BlockCopySelectedItems ( const wxPoint &  aOffset,
LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Definition at line 135 of file block_libedit.cpp.

136 {
137  PICKED_ITEMS_LIST& aItemsList = aBlock->GetItems();
138  LIB_ITEM* oldItem;
139  LIB_ITEM* newItem;
140 
141  for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
142  {
143  oldItem = static_cast<LIB_ITEM*>( aItemsList.GetPickedItem( ii ) );
144 
145  // We *do not* copy fields because they are unique for the whole component
146  // so skip them (do not duplicate) if they are flagged selected.
147  if( oldItem->Type() == LIB_FIELD_T )
148  oldItem->ClearFlags( SELECTED );
149 
150  if( !oldItem->IsSelected() )
151  continue;
152 
153  newItem = (LIB_ITEM*) oldItem->Clone();
154  newItem->SetFlags( SELECTED );
155  oldItem->ClearFlags( SELECTED );
156 
157  newItem->SetOffset( aBlock->GetMoveVector() );
158 
159  aItemsList.SetPickedItem( newItem, ii );
160  aItemsList.SetPickedItemStatus( UR_NEW, ii );
161 
162  aPart->GetDrawItems().push_back( newItem );
163  }
164 }
bool IsSelected() const
Definition: base_struct.h:224
wxPoint GetMoveVector() const
unsigned GetCount() const
Function GetCount.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
virtual void SetOffset(const wxPoint &aOffset)=0
Set the drawing object by aOffset from the current position.
#define SELECTED
Definition: base_struct.h:121
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
bool SetPickedItem(EDA_ITEM *aItem, unsigned aIdx)
Function SetPickedItem.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
void push_back(T *aItem)
Definition: multivector.h:169
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item.
PICKED_ITEMS_LIST & GetItems()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201

References EDA_ITEM::ClearFlags(), EDA_ITEM::Clone(), PICKED_ITEMS_LIST::GetCount(), LIB_PART::GetDrawItems(), BLOCK_SELECTOR::GetItems(), BLOCK_SELECTOR::GetMoveVector(), PICKED_ITEMS_LIST::GetPickedItem(), EDA_ITEM::IsSelected(), LIB_FIELD_T, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back(), SELECTED, EDA_ITEM::SetFlags(), LIB_ITEM::SetOffset(), PICKED_ITEMS_LIST::SetPickedItem(), PICKED_ITEMS_LIST::SetPickedItemStatus(), EDA_ITEM::Type(), and UR_NEW.

Referenced by HandleBlockEnd().

◆ BlockDeleteSelectedItems()

void LIB_EDIT_FRAME::BlockDeleteSelectedItems ( LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Definition at line 108 of file block_libedit.cpp.

109 {
111 
112  // We *do not* remove the 2 mandatory fields: reference and value
113  // so skip them (do not remove) if they are flagged selected.
114  // Skip also not visible items.
115  // But I think fields must not be deleted by a block delete command or other global command
116  // because they are not really graphic items
117  while( item != aPart->GetDrawItems().end() )
118  {
119  if( item->Type() == LIB_FIELD_T )
120  {
121  item->ClearFlags( SELECTED );
122  }
123 
124  if( !item->IsSelected() )
125  ++item;
126  else
127  item = aPart->GetDrawItems().erase( item );
128  }
129 
130  // view update
131 
132 }
ITERATOR begin(int aType=UNDEFINED_TYPE)
Definition: multivector.h:183
ITERATOR end(int aType=UNDEFINED_TYPE)
Definition: multivector.h:189
#define SELECTED
Definition: base_struct.h:121
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
ITERATOR erase(const ITERATOR &aIterator)
Definition: multivector.h:174
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The non-const iterator
Definition: multivector.h:160

References MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end(), MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::erase(), LIB_PART::GetDrawItems(), LIB_FIELD_T, and SELECTED.

Referenced by HandleBlockEnd().

◆ BlockMoveSelectedItems()

void LIB_EDIT_FRAME::BlockMoveSelectedItems ( const wxPoint &  aOffset,
LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Definition at line 93 of file block_libedit.cpp.

94 {
95  for( LIB_ITEM& item : aPart->GetDrawItems() )
96  {
97  if( !item.IsSelected() )
98  continue;
99 
100  item.SetOffset( aOffset );
101  item.ClearFlags();
102  }
103 
104  // view update
105 }
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.

References LIB_PART::GetDrawItems().

Referenced by HandleBlockPlace(), and pasteClipboard().

◆ BlockSelectItems()

int LIB_EDIT_FRAME::BlockSelectItems ( LIB_PART aPart,
BLOCK_SELECTOR aBlock,
int  aUnit,
int  aConvert,
bool  aSyncPinEdit 
)

Checks all draw objects of part to see if they are with block.

Use this method to mark draw objects as selected during block functions.

Parameters
aRect- The bounding rectangle to test in draw items are inside.
aUnit- The current unit number to test against.
aConvert- Are the draw items being selected a conversion.
aSyncPinEdit- Enable pin selection in other units.
Returns
The number of draw objects found inside the block select rectangle.

Definition at line 47 of file block_libedit.cpp.

48 {
49  int itemCount = 0;
50 
51  for( LIB_ITEM& item : aPart->GetDrawItems() )
52  {
53  item.ClearFlags( SELECTED );
54 
55  if( ( item.GetUnit() && item.GetUnit() != aUnit )
56  || ( item.GetConvert() && item.GetConvert() != aConvert ) )
57  {
58  if( item.Type() != LIB_PIN_T )
59  continue;
60 
61  // Specific rules for pins:
62  // - do not select pins in other units when synchronized pin edit mode is disabled
63  // - do not select pins in other units when units are not interchangeable
64  // - in other cases verify if the pin belongs to the requested unit
65  if( !aSyncPinEdit || aPart->UnitsLocked()
66  || ( item.GetConvert() && item.GetConvert() != aConvert ) )
67  continue;
68  }
69 
70  if( item.Inside( *aBlock ) )
71  {
72  auto picker = ITEM_PICKER( &item );
73  aBlock->PushItem( picker );
74  item.SetFlags( SELECTED );
75  itemCount++;
76  }
77  }
78 
79  return itemCount;
80 }
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
#define SELECTED
Definition: base_struct.h:121
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
bool UnitsLocked() const
Check whether part units are interchangeable.
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.

References LIB_PART::GetDrawItems(), LIB_PIN_T, BLOCK_SELECTOR::PushItem(), SELECTED, and LIB_PART::UnitsLocked().

Referenced by HandleBlockEnd().

◆ CenterScreen()

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

Definition at line 465 of file sch_base_frame.cpp.

466 {
467  GetCanvas()->GetView()->SetCenter( aCenterPoint );
468 
469  if( aWarpPointer )
470  GetCanvas()->GetViewControls()->WarpCursor( aCenterPoint, true );
471 
472  GetGalCanvas()->Refresh();
473 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
SCH_DRAW_PANEL * GetCanvas() const override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
KIGFX::SCH_VIEW * GetView() const

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

Referenced by SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDIT_FRAME::FindComponentAndItem(), SCH_EDIT_FRAME::OnFindDrcMarker(), and SCH_EDIT_FRAME::updateFindReplaceView().

◆ CheckForAutoSaveFile()

void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName)
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.

Definition at line 585 of file eda_base_frame.cpp.

586 {
587  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
588 
589  wxFileName autoSaveFileName = aFileName;
590 
591  // Check for auto save file.
592  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
593 
594  wxLogTrace( traceAutoSave,
595  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
596 
597  if( !autoSaveFileName.FileExists() )
598  return;
599 
600  wxString msg = wxString::Format( _(
601  "Well this is potentially embarrassing!\n"
602  "It appears that the last time you were editing the file\n"
603  "\"%s\"\n"
604  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
605  GetChars( aFileName.GetFullName() )
606  );
607 
608  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
609 
610  // Make a backup of the current file, delete the file, and rename the auto save file to
611  // the file name.
612  if( response == wxYES )
613  {
614  // Get the backup file name.
615  wxFileName backupFileName = aFileName;
616  backupFileName.SetExt( aFileName.GetExt() + GetBackupSuffix() );
617 
618  // If an old backup file exists, delete it. If an old copy of the file exists, rename
619  // it to the backup file name
620  if( aFileName.FileExists() )
621  {
622  // Rename the old file to the backup file name.
623  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath(), true ) )
624  {
625  msg.Printf( _( "Could not create backup file \"%s\"" ),
626  GetChars( backupFileName.GetFullPath() ) );
627  wxMessageBox( msg );
628  }
629  }
630 
631  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
632  {
633  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
634  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
635  }
636  }
637  else
638  {
639  wxLogTrace( traceAutoSave,
640  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
641 
642  // Remove the auto save file when using the previous file as is.
643  wxRemoveFile( autoSaveFileName.GetFullPath() );
644  }
645 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
static wxString GetBackupSuffix()
Function GetBackupSuffix.
static wxString GetAutoSaveFilePrefix()
Function GetAutoSaveFilePrefix.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h: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

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

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

◆ ClearMsgPanel()

◆ ClearSearchTreeSelection()

void LIB_EDIT_FRAME::ClearSearchTreeSelection ( )

Definition at line 425 of file lib_edit_frame.cpp.

426 {
428 }
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:177
LIB_TREE * GetLibTree() const
SYMBOL_TREE_PANE * m_treePane
component search tree widget

References SYMBOL_TREE_PANE::GetLibTree(), m_treePane, and LIB_TREE::Unselect().

Referenced by GeneralControl().

◆ ClearTempCopyComponent()

void LIB_EDIT_FRAME::ClearTempCopyComponent ( )

Delete temporary copy of the current component and clear pointer.

Definition at line 998 of file lib_edit_frame.cpp.

999 {
1000  delete m_tempCopyComponent;
1001  m_tempCopyComponent = NULL;
1002 }
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.

References m_tempCopyComponent.

Referenced by CreateGraphicItem(), CreatePin(), and RepeatPinItem().

◆ CloseWindow()

void LIB_EDIT_FRAME::CloseWindow ( wxCommandEvent &  event)
inline

Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:

EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )

Definition at line 394 of file lib_edit_frame.h.

395  {
396  // Generate a wxCloseEvent
397  Close( false );
398  }

◆ CommonSettingsChanged()

void LIB_EDIT_FRAME::CommonSettingsChanged ( )
overridevirtual

Called after the preferences dialog is run.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1736 of file lib_edit_frame.cpp.

1737 {
1739 
1740  ReCreateHToolbar();
1741  ReCreateVToolbar();
1743  Layout();
1744  SendSizeEvent();
1745 }
void CommonSettingsChanged() override
Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have ...
void ReCreateOptToolbar()
Definition: tool_lib.cpp:201
void ReCreateHToolbar() override
Definition: tool_lib.cpp:103
void ReCreateVToolbar() override
Definition: tool_lib.cpp:48

References EDA_DRAW_FRAME::CommonSettingsChanged(), ReCreateHToolbar(), ReCreateOptToolbar(), and ReCreateVToolbar().

◆ config()

wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited

Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 360 of file eda_base_frame.cpp.

361 {
362  // KICAD_MANAGER_FRAME overrides this
363  wxConfigBase* ret = Kiface().KifaceSettings();
364  //wxASSERT( ret );
365  return ret;
366 }
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), PCB_EDIT_FRAME::GetSettings(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), OnPreferencesOptions(), SCH_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OpenProjectFiles(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and EDA_BASE_FRAME::windowClosing().

◆ ConfigBaseName()

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

276  {
277  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
278  return baseCfgName;
279  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...

References EDA_BASE_FRAME::m_configFrameName.

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

◆ copySelectedItems()

void LIB_EDIT_FRAME::copySelectedItems ( )
private

Copies items selected in the current part to the internal clipboard.

Definition at line 498 of file block_libedit.cpp.

499 {
500  LIB_PART* part = GetCurPart();
501 
502  if( !part )
503  return;
504 
505  m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
506  m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
507 
508  for( LIB_ITEM& item : part->GetDrawItems() )
509  {
510  // We *do not* copy fields because they are unique for the whole component
511  // so skip them (do not duplicate) if they are flagged selected.
512  if( item.Type() == LIB_FIELD_T )
513  item.ClearFlags( SELECTED );
514 
515  if( !item.IsSelected() )
516  continue;
517 
518  // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
519  LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
520  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
521  ITEM_PICKER picker( copy, UR_NEW );
522  m_clipboard.PushItem( picker );
523  }
524 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
#define SELECTED
Definition: base_struct.h:121
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes only the list of EDA_ITEM * pointers, AND the data printed b...
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Define a library symbol object.
BLOCK_SELECTOR m_clipboard
Clipboard buffer storing LIB_ITEMs
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.

References BLOCK_SELECTOR::ClearListAndDeleteItems(), EDA_ITEM::Clone(), GetCurPart(), LIB_PART::GetDrawItems(), EDA_ITEM::GetFlags(), SCH_BASE_FRAME::GetScreen(), LIB_FIELD_T, m_clipboard, BLOCK_SELECTOR::PushItem(), SELECTED, EDA_ITEM::SetFlags(), BLOCK_SELECTOR::SetLastCursorPosition(), UR_NEW, and UR_TRANSIENT.

Referenced by HandleBlockEnd().

◆ CopyToClipboard()

void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

Copy the current page or the current block to the clipboard.

Definition at line 1670 of file legacy_gal/eda_draw_frame.cpp.

1671 {
1672  DrawPageOnClipboard( this );
1673 
1674  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
1675  {
1676  // fixme-gal
1677  //if( GetScreen()->IsBlockActive() )
1678  //m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
1679 
1681  }
1682 }
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

References DrawPageOnClipboard(), EDA_DRAW_PANEL::EndMouseCapture(), ID_GEN_COPY_BLOCK_TO_CLIPBOARD, and EDA_DRAW_FRAME::m_canvas.

◆ createCanvas()

void SCH_BASE_FRAME::createCanvas ( )
inherited

Definition at line 583 of file sch_base_frame.cpp.

584 {
586 
587  // Allows only a CAIRO or OPENGL canvas:
591 
592  m_canvas = new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
594 
595  m_useSingleCanvasPane = true;
596 
597  SetGalCanvas( static_cast<SCH_DRAW_PANEL*> (m_canvas) );
598  UseGalCanvas( true );
599 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:953
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:179
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:936
bool m_useSingleCanvasPane
Definition: draw_frame.h:101
virtual void UseGalCanvas(bool aEnable)
Use to switch between standard and GAL-based canvas.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126

References EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, EDA_DRAW_FRAME::GetGalDisplayOptions(), EDA_DRAW_FRAME::LoadCanvasTypeSetting(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_canvasType, EDA_BASE_FRAME::m_FrameSize, EDA_DRAW_FRAME::m_useSingleCanvasPane, EDA_DRAW_FRAME::SetGalCanvas(), and EDA_DRAW_FRAME::UseGalCanvas().

Referenced by SCH_BASE_FRAME::SCH_BASE_FRAME().

◆ CreateGraphicItem()

LIB_ITEM * LIB_EDIT_FRAME::CreateGraphicItem ( LIB_PART LibEntry,
wxDC *  DC 
)
private

Definition at line 134 of file symbdraw.cpp.

135 {
136  LIB_ITEM* item = GetDrawItem();
138  wxPoint drawPos = GetCrossHairPosition( true );
139 
140  // no temp copy -> the current version of symbol will be used for Undo
141  // This is normal when adding new items to the current symbol
143 
144  auto view = static_cast<SCH_DRAW_PANEL*>(m_canvas)->GetView();
145  view->ShowPreview( true );
146 
147  switch( GetToolId() )
148  {
150  item = new LIB_ARC( LibEntry );
151  break;
152 
154  item = new LIB_CIRCLE( LibEntry );
155  break;
156 
158  item = new LIB_RECTANGLE( LibEntry );
159  break;
160 
162  item = new LIB_POLYLINE( LibEntry );
163  break;
164 
166  {
167  LIB_TEXT* text = new LIB_TEXT( LibEntry );
168  text->SetTextSize( wxSize( m_textSize, m_textSize ) );
170 
171  // Enter the graphic text info
173  EditSymbolText( NULL, text );
174 
175  m_canvas->SetIgnoreMouseEvents( false );
177 
178  if( text->GetText().IsEmpty() )
179  {
180  delete text;
181  item = NULL;
182  }
183  else
184  {
185  item = text;
186  }
187  }
188  break;
189 
190  default:
191  DisplayError( this, wxT( "LIB_EDIT_FRAME::CreateGraphicItem() error" ) );
192  return NULL;
193  }
194 
195  if( item )
196  {
197  item->BeginEdit( IS_NEW, drawPos );
198 
199  // Don't set line parameters for text objects.
200  if( item->Type() != LIB_TEXT_T )
201  {
202  item->SetWidth( m_drawLineWidth );
203  item->SetFillMode( m_drawFillStyle );
204  }
205 
206  if( m_drawSpecificUnit )
207  item->SetUnit( m_unit );
208 
210  item->SetConvert( m_convert );
211 
212  // Draw initial symbol:
213  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
214  }
215  else
216  {
218  return NULL;
219  }
220 
222  m_canvas->SetIgnoreMouseEvents( false );
223  SetDrawItem( item );
224 
225  return item;
226 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:169
static double m_current_text_angle
Current text angle setting.
static void RedrawWhileMovingCursor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: symbdraw.cpp:250
static int m_convert
Define a symbol library graphical text item.
Definition: lib_text.h:44
void ClearTempCopyComponent()
Delete temporary copy of the current component and clear pointer.
virtual void BeginEdit(STATUS_FLAGS aEditMode, const wxPoint aPosition=wxPoint(0, 0))
Begin an editing a component library draw item in aEditMode at aPosition.
virtual void SetWidth(int aWidth)=0
Set the width of the draw item to aWidth.
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:227
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
void SetDrawItem(LIB_ITEM *drawItem)
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static int m_textSize
The current text size setting.
void SetFillMode(FILL_T aFillMode)
void SetConvert(int aConvert)
void EditSymbolText(wxDC *DC, LIB_ITEM *DrawItem)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SetUnit(int aUnit)
static int m_unit
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
void SetIgnoreMouseEvents(bool aIgnore)
LIB_ITEM * GetDrawItem() const
static void AbortSymbolTraceOn(EDA_DRAW_PANEL *aPanel, wxDC *DC)
Definition: symbdraw.cpp:108
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
bool m_drawSpecificConvert
Convert of the item currently being drawn.
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:243
int GetToolId() const
Definition: draw_frame.h:526
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201

References AbortSymbolTraceOn(), LIB_ITEM::BeginEdit(), EDA_DRAW_PANEL::CallMouseCapture(), ClearTempCopyComponent(), DisplayError(), EditSymbolText(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetDrawItem(), EDA_TEXT::GetText(), EDA_DRAW_FRAME::GetToolId(), ID_LIBEDIT_BODY_ARC_BUTT, ID_LIBEDIT_BODY_CIRCLE_BUTT, ID_LIBEDIT_BODY_LINE_BUTT, ID_LIBEDIT_BODY_RECT_BUTT, ID_LIBEDIT_BODY_TEXT_BUTT, IS_NEW, LIB_TEXT_T, EDA_DRAW_FRAME::m_canvas, m_convert, m_current_text_angle, m_drawFillStyle, m_drawLineWidth, m_drawSpecificConvert, m_drawSpecificUnit, m_textSize, m_unit, EDA_DRAW_PANEL::MoveCursorToCrossHair(), RedrawWhileMovingCursor(), LIB_ITEM::SetConvert(), SetDrawItem(), LIB_ITEM::SetFillMode(), EDA_DRAW_PANEL::SetIgnoreMouseEvents(), EDA_DRAW_PANEL::SetMouseCapture(), EDA_TEXT::SetTextAngle(), EDA_TEXT::SetTextSize(), LIB_ITEM::SetUnit(), LIB_ITEM::SetWidth(), and EDA_ITEM::Type().

Referenced by OnLeftClick().

◆ CreateImageFile()

void LIB_EDIT_FRAME::CreateImageFile ( const wxString &  aFileName,
wxBitmapType  aBitmapType = wxBITMAP_TYPE_PNG 
)

Creates an image (screenshot) of the current symbol.

Parameters
aFileName= the full filename
aBitmapType= bitmap file format

Definition at line 117 of file libedit_plot_component.cpp.

118 {
119  if( !saveCanvasImageToFile( aFileName, aBitmapType ) )
120  {
121  wxString msg;
122  msg.Printf( _( "Can't save file \"%s\"." ), aFileName );
123  wxMessageBox( msg );
124  }
125 }
bool saveCanvasImageToFile(const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)

References EDA_DRAW_FRAME::saveCanvasImageToFile().

Referenced by OnPlotCurrentComponent().

◆ CreateImagePins()

void LIB_EDIT_FRAME::CreateImagePins ( LIB_PIN aPin)
private

Adds copies of aPin in components with multiple units in all units.

Parameters
aPinThe pin to copy to others units.

Definition at line 398 of file pinedit.cpp.

399 {
400  int ii;
401  LIB_PIN* newPin;
402 
403  // if "synchronize pins editing" option is off, do not create any similar pin for other
404  // units and/or shapes: each unit is edited regardless other units or body
405  if( !SynchronizePins() )
406  return;
407 
408  if( aPin->GetUnit() == 0 ) // Pin common to all units: no need to create similar pins.
409  return;
410 
411  // When units are interchangeable, all units are expected to have similar pins
412  // at the same position
413  // to facilitate pin editing, create pins for all other units for the current body style
414  // at the same position as aPin
415 
416  for( ii = 1; ii <= aPin->GetParent()->GetUnitCount(); ii++ )
417  {
418  if( ii == aPin->GetUnit() )
419  continue;
420 
421  newPin = (LIB_PIN*) aPin->Clone();
422 
423  // To avoid mistakes, gives this pin a new pin number because
424  // it does no have the save pin number as the master pin
425  // Because we do not know the actual number, give it a temporary number
426  wxString unknownNum;
427  unknownNum.Printf( "%s-U%c", aPin->GetNumber(), wxChar( 'A' + ii - 1 ) );
428  newPin->SetNumber( unknownNum );
429 
430  newPin->SetUnit( ii );
431  aPin->GetParent()->AddDrawItem( newPin );
432  }
433 }
int GetUnitCount() const
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_pin.cpp:1551
LIB_PART * GetParent() const
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
void SetNumber(const wxString &aNumber)
Set the pin number.
Definition: lib_pin.cpp:222
int GetUnit() const
const wxString & GetNumber() const
Definition: lib_pin.h:194
void SetUnit(int aUnit)
bool SynchronizePins()
Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable b...

References LIB_PART::AddDrawItem(), LIB_PIN::Clone(), LIB_PIN::GetNumber(), LIB_ITEM::GetParent(), LIB_ITEM::GetUnit(), LIB_PART::GetUnitCount(), LIB_PIN::SetNumber(), LIB_ITEM::SetUnit(), and SynchronizePins().

Referenced by PlacePin().

◆ CreatePin()

void LIB_EDIT_FRAME::CreatePin ( wxDC *  DC)
private

Definition at line 348 of file pinedit.cpp.

349 {
350  LIB_PART* part = GetCurPart();
351 
352  if( !part )
353  return;
354 
355  part->ClearStatus();
356 
357  LIB_PIN* pin = new LIB_PIN( part );
358 
359  SetDrawItem( pin );
360 
361  pin->SetFlags( IS_NEW );
362  pin->SetUnit( m_unit );
363  pin->SetConvert( m_convert );
364 
365  // Flag pins to consider
366  if( SynchronizePins() )
367  pin->SetFlags( IS_LINKED );
368 
369  pin->Move( GetCrossHairPosition( ) );
370  pin->SetLength( GetLastPinLength() );
372  pin->SetType( LastPinType );
373  pin->SetShape( LastPinShape );
377  pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
378  pin->SetVisible( LastPinVisible );
380  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
381  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
382  GetEventHandler()->ProcessEvent( cmd );
384  m_canvas->SetIgnoreMouseEvents( false );
385 
386  if( pin->GetFlags() & IS_CANCELLED )
387  {
388  deleteItem( DC, pin );
389  }
390  else
391  {
394  }
395 }
static void AbortPinMove(EDA_DRAW_PANEL *Panel, wxDC *DC)
Clean up after aborting a move pin command.
Definition: pinedit.cpp:148
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:111
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void SetLength(int aLength, bool aTestOtherPins=true)
Set the pin length.
Definition: lib_pin.cpp:363
static int GetLastPinLength()
Definition: pinedit.cpp:70
static int m_convert
static bool LastPinCommonUnit
Definition: pinedit.cpp:62
void ClearTempCopyComponent()
Delete temporary copy of the current component and clear pointer.
static int GetLastPinNameSize()
Definition: pinedit.cpp:78
void SetShape(GRAPHIC_PINSHAPE aShape)
Set the shape of the pin to aShape.
Definition: lib_pin.cpp:298
static bool LastPinCommonConvert
Definition: pinedit.cpp:61
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
static bool LastPinVisible
Definition: pinedit.cpp:63
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void SetDrawItem(LIB_ITEM *drawItem)
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
Define a library symbol object.
void SetVisible(bool aVisible)
Set or clear the visibility flag for the pin.
Definition: lib_pin.cpp:481
static ELECTRICAL_PINTYPE LastPinType
Definition: pinedit.cpp:58
static int GetLastPinNumSize()
Definition: pinedit.cpp:86
static int LastPinOrient
Definition: pinedit.cpp:59
static GRAPHIC_PINSHAPE LastPinShape
Definition: pinedit.cpp:60
void SetConvert(int aConvert)
void deleteItem(wxDC *aDC, LIB_ITEM *aItem)
Deletes the currently selected draw item.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SetUnit(int aUnit)
void ClearStatus()
Clears the status flag all draw objects in this part.
static int m_unit
#define IS_CANCELLED
flag set when edit dialogs are canceled when editing a
Definition: base_struct.h:127
void SetIgnoreMouseEvents(bool aIgnore)
void SetType(ELECTRICAL_PINTYPE aType, bool aTestOtherPins=true)
Set the electrical type of the pin.
Definition: lib_pin.cpp:327
void Move(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_pin.cpp:1595
bool SynchronizePins()
Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable b...
void SetOrientation(int aOrientation, bool aTestOtherPins=true)
Set orientation on the pin.
Definition: lib_pin.cpp:269
static void DrawMovePin(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPositon, bool aErase)
Definition: pinedit.cpp:319
void SetNameTextSize(int aSize, bool aTestOtherPins=true)
Set the aSize of the pin name text.
Definition: lib_pin.cpp:194
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void SetNumberTextSize(int aSize, bool aTestOtherPins=true)
Set the size of the pin number text.
Definition: lib_pin.cpp:241

References AbortPinMove(), LIB_PART::ClearStatus(), ClearTempCopyComponent(), deleteItem(), DrawMovePin(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetCurPart(), EDA_ITEM::GetFlags(), GetLastPinLength(), GetLastPinNameSize(), GetLastPinNumSize(), ID_LIBEDIT_EDIT_PIN, IS_CANCELLED, IS_LINKED, IS_NEW, LastPinCommonConvert, LastPinCommonUnit, LastPinOrient, LastPinShape, LastPinType, LastPinVisible, EDA_DRAW_FRAME::m_canvas, m_convert, m_unit, LIB_PIN::Move(), EDA_DRAW_PANEL::MoveCursorToCrossHair(), LIB_ITEM::SetConvert(), SetDrawItem(), EDA_ITEM::SetFlags(), EDA_DRAW_PANEL::SetIgnoreMouseEvents(), LIB_PIN::SetLength(), EDA_DRAW_PANEL::SetMouseCapture(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetShape(), LIB_PIN::SetType(), LIB_ITEM::SetUnit(), LIB_PIN::SetVisible(), and SynchronizePins().

Referenced by OnLeftClick().

◆ CreateServer()

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

Definition at line 49 of file eda_dde.cpp.

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

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

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

◆ deleteItem()

void LIB_EDIT_FRAME::deleteItem ( wxDC *  aDC,
LIB_ITEM aItem 
)
private

Deletes the currently selected draw item.

Parameters
aDCThe device context to draw upon when removing item.
aItemThe item to delete

Definition at line 1398 of file lib_edit_frame.cpp.

1399 {
1400  if( !aItem )
1401  return;
1402 
1403  m_canvas->CrossHairOff( aDC );
1404 
1405  LIB_PART* part = GetCurPart();
1406 
1407  SaveCopyInUndoList( part );
1408 
1409  if( aItem->Type() == LIB_PIN_T )
1410  {
1411  LIB_PIN* pin = static_cast<LIB_PIN*>( aItem );
1412  wxPoint pos = pin->GetPosition();
1413 
1414  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1415 
1416  // when pin editing is synchronized, all pins of the same body style are removed:
1417  if( SynchronizePins() )
1418  {
1419  int curr_convert = pin->GetConvert();
1420  LIB_PIN* next_pin = part->GetNextPin();
1421 
1422  while( next_pin != NULL )
1423  {
1424  pin = next_pin;
1425  next_pin = part->GetNextPin( pin );
1426 
1427  if( pin->GetPosition() != pos )
1428  continue;
1429 
1430  if( pin->GetConvert() != curr_convert )
1431  continue;
1432 
1433  part->RemoveDrawItem( pin );
1434  }
1435  }
1436  }
1437  else
1438  {
1439  if( m_canvas->IsMouseCaptured() )
1440  m_canvas->CallEndMouseCapture( aDC );
1441  else
1442  part->RemoveDrawItem( aItem, m_canvas, aDC );
1443  }
1444 
1445  SetDrawItem( NULL );
1446  m_lastDrawItem = NULL;
1447  OnModify();
1448  m_canvas->CrossHairOn( aDC );
1449 
1450  RebuildView();
1451  GetCanvas()->Refresh();
1452 }
virtual wxPoint GetPosition() const =0
Return the current draw object position.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
void SetDrawItem(LIB_ITEM *drawItem)
virtual void CrossHairOn(wxDC *DC=nullptr)
SCH_DRAW_PANEL * GetCanvas() const override
Define a library symbol object.
virtual void CrossHairOff(wxDC *DC=nullptr)
static LIB_ITEM * m_lastDrawItem
int GetConvert() const
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:463
LIB_PIN * GetNextPin(LIB_PIN *aItem=NULL)
Return the next pin object from the draw list.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
void RemoveDrawItem(LIB_ITEM *aItem, EDA_DRAW_PANEL *aPanel=NULL, wxDC *aDc=NULL)
Remove draw aItem from list.
bool SynchronizePins()
Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable b...
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201

References EDA_DRAW_PANEL::CallEndMouseCapture(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), SCH_BASE_FRAME::GetCanvas(), LIB_ITEM::GetConvert(), GetCurPart(), LIB_PART::GetNextPin(), LIB_ITEM::GetPosition(), LIB_PIN::GetPosition(), EDA_DRAW_PANEL::IsMouseCaptured(), LIB_PIN_T, EDA_DRAW_FRAME::m_canvas, m_lastDrawItem, OnModify(), RebuildView(), SCH_DRAW_PANEL::Refresh(), LIB_PART::RemoveDrawItem(), SaveCopyInUndoList(), SetDrawItem(), SynchronizePins(), and EDA_ITEM::Type().

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

◆ Destroy()

◆ DismissModal()

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

◆ DisplayCmpDoc()

void LIB_EDIT_FRAME::DisplayCmpDoc ( )
private

Display the documentation of the selected component.

Definition at line 803 of file libedit.cpp.

804 {
805  LIB_PART* part = GetCurPart();
806 
807  ClearMsgPanel();
808 
809  if( !part )
810  return;
811 
812  LIB_ALIAS* alias = part->GetAlias( part->GetName() );
813  wxString msg = part->GetName();
814 
815  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
816 
817  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
818  msg = UnitLetter[m_unit];
819 
820  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
821 
822  if( m_convert > 1 )
823  msg = _( "Convert" );
824  else
825  msg = _( "Normal" );
826 
827  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
828 
829  if( part->IsPower() )
830  msg = _( "Power Symbol" );
831  else
832  msg = _( "Symbol" );
833 
834  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
835  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
836  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
837  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
838 }
Definition: colors.h:57
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Part library alias object definition.
static int m_convert
LIB_ALIAS * GetAlias(size_t aIndex)
Definition: colors.h:61
const wxString & GetDocFileName() const
const wxString & GetKeyWords() const
Definition: colors.h:59
Define a library symbol object.
const wxString & GetDescription() override
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
bool IsPower() const
Definition: colors.h:58
static int m_unit
const wxString & GetName() const
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: colors.h:62

References EDA_DRAW_FRAME::AppendMsgPanel(), BLUE, BROWN, EDA_DRAW_FRAME::ClearMsgPanel(), CYAN, DARKDARKGRAY, LIB_PART::GetAlias(), GetCurPart(), LIB_ALIAS::GetDescription(), LIB_ALIAS::GetDocFileName(), LIB_ALIAS::GetKeyWords(), LIB_PART::GetName(), GREEN, LIB_PART::IsPower(), m_convert, m_unit, and MAGENTA.

Referenced by GetComponentFromRedoList(), GetComponentFromUndoList(), LoadOneLibraryPartAux(), OnEditComponentProperties(), OnLeftClick(), and OnSelectPart().

◆ DisplayListComponentsInLib()

bool SCH_BASE_FRAME::DisplayListComponentsInLib ( wxString &  aLibrary,
wxString &  aBuffer,
wxString &  aPreviousChoice 
)
protectedinherited

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

Parameters
aLibrarya reference to the library nickname to explore If empty, the user will be prompted tp chose a library
aBuffer= a wxString to put the selected component name
aPreviousChoice= the previously selected component name. it will be added to the selection list. Can be empty.
Returns
true if a component is selected false on cancel

Definition at line 125 of file selpart.cpp.

127 {
128  wxArrayString nameList;
129 
130  if( !aLibrary )
131  aLibrary = SelectLibraryFromList();
132 
133  if( !aLibrary )
134  return false;
135 
136  try
137  {
138  Prj().SchSymbolLibTable()->EnumerateSymbolLib( aLibrary, nameList );
139  }
140  catch( const IO_ERROR& ioe )
141  {
142  wxString msg;
143 
144  msg.Printf( _( "Error occurred loading symbol library \"%s\"." ), aLibrary );
145  DisplayErrorMessage( this, msg, ioe.What() );
146  return false;
147  }
148 
149  wxArrayString headers;
150  headers.Add( _( "Library:Symbol" ) );
151 
152  std::vector<wxArrayString> itemsToDisplay;
153 
154  // Conversion from wxArrayString to vector of ArrayString
155  for( unsigned i = 0; i < nameList.GetCount(); i++ )
156  {
157  LIB_ID id;
158  wxArrayString item;
159  id.SetLibItemName( nameList[i], false );
160  id.SetLibNickname( aLibrary );
161  item.Add( id.Format() );
162  itemsToDisplay.push_back( item );
163  }
164 
165  EDA_LIST_DIALOG dlg( this, _( "Select Symbol" ), headers, itemsToDisplay, aPreviousChoice,
166  DisplayCmpDocAndKeywords, Prj().SchSymbolLibTable() );
167 
168  if( dlg.ShowModal() != wxID_OK )
169  return false;
170 
171  aBuffer = dlg.GetTextSelection();
172 
173  return true;
174 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:257
wxString SelectLibraryFromList()
Dispaly a list of loaded libraries in the symbol library and allows the user to select a library.
Definition: selpart.cpp:76
static void DisplayCmpDocAndKeywords(wxString &aSelection, void *aData)
Definition: selpart.cpp:41
class EDA_LIST_DIALOG
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:206
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
size_t i
Definition: json11.cpp:597
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References DisplayCmpDocAndKeywords(), DisplayErrorMessage(), Format(), EDA_LIST_DIALOG::GetTextSelection(), i, KIWAY_HOLDER::Prj(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_ID::SetLibItemName(), and IO_ERROR::What().

Referenced by SCH_BASE_FRAME::SelectPartNameToLoad().

◆ DisplayToolMsg()

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane on the status bar.

Definition at line 624 of file legacy_gal/eda_draw_frame.cpp.

625 {
626  wxString msg;
627 
628  switch( m_UserUnits )
629  {
630  case INCHES: msg = _( "Inches" ); break;
631  case MILLIMETRES: msg = _( "mm" ); break;
632  default: msg = _( "Units" ); break;
633  }
634 
635  SetStatusText( msg, 4 );
636 }
Definition: common.h:161
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

References INCHES, EDA_DRAW_FRAME::m_UserUnits, and MILLIMETRES.

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

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

Function doAutoSave should be overridden by the derived class to handle the auto save feature.

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 223 of file eda_base_frame.cpp.

224 {
225  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
226 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ DrawWorkSheet()

void EDA_DRAW_FRAME::DrawWorkSheet ( wxDC *  aDC,
BASE_SCREEN aScreen,
int  aLineWidth,
double  aScale,
const wxString &  aFilename,
const wxString &  aSheetLayer = wxEmptyString 
)
inherited

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 1819 of file legacy_gal/eda_draw_frame.cpp.

1822 {
1824  return;
1825 
1826  const PAGE_INFO& pageInfo = GetPageSettings();
1827  wxSize pageSize = pageInfo.GetSizeMils();
1828 
1829  // if not printing, draw the page limits:
1830  if( !aScreen->m_IsPrinting && m_showPageLimits )
1831  {
1832  GRSetDrawMode( aDC, GR_COPY );
1833  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
1834  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
1836  }
1837 
1838  TITLE_BLOCK t_block = GetTitleBlock();
1839  COLOR4D color = COLOR4D( RED );
1840 
1841  wxPoint origin = aDC->GetDeviceOrigin();
1842 
1843  if( aScreen->m_IsPrinting && origin.y > 0 )
1844  {
1845  aDC->SetDeviceOrigin( 0, 0 );
1846  aDC->SetAxisOrientation( true, false );
1847  }
1848 
1849  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
1850  GetScreenDesc(), aFilename, t_block,
1851  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
1852  aLineWidth, aScalar, color, color, aSheetLayer );
1853 
1854  if( aScreen->m_IsPrinting && origin.y > 0 )
1855  {
1856  aDC->SetDeviceOrigin( origin.x, origin.y );
1857  aDC->SetAxisOrientation( true, true );
1858  }
1859 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema
Definition: draw_frame.h:116
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot,...
Definition: title_block.h:40
virtual const PAGE_INFO & GetPageSettings() const =0
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...
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:146
Definition: colors.h:60
const wxSize & GetSizeMils() const
Definition: page_info.h:142
bool m_IsPrinting
Definition: base_screen.h:220
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:114
Definition: colors.h:49
int m_NumberOfScreens
Definition: base_screen.h:217
virtual wxString GetScreenDesc() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

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, and WHITE.

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

◆ EditField()

void LIB_EDIT_FRAME::EditField ( LIB_FIELD Field)
private

Definition at line 42 of file libfield.cpp.

43 {
44  wxString newFieldValue;
45  wxString caption;
46 
47  if( aField == NULL )
48  return;
49 
50  LIB_PART* parent = aField->GetParent();
51  wxCHECK( parent, /* void */ );
52 
53  // Editing the component value field is equivalent to creating a new component based
54  // on the current component. Set the dialog message to inform the user.
55  if( aField->GetId() == VALUE )
56  caption = _( "Edit Component Name" );
57  else
58  caption.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) );
59 
60  DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
61 
62  // The dialog may invoke a kiway player for footprint fields
63  // so we must use a quasimodal dialog.
64  if( dlg.ShowQuasiModal() != wxID_OK )
65  return;
66 
67  newFieldValue = LIB_ID::FixIllegalChars( dlg.GetText(), LIB_ID::ID_SCH );
68  wxString oldFieldValue = aField->GetFullText( m_unit );
69  bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
70 
71  if( renamed )
72  {
73  wxString msg;
74  wxString lib = GetCurLib();
75 
76  // Test the current library for name conflicts
77  if( !lib.empty() && m_libMgr->PartExists( newFieldValue, lib ) )
78  {
79  msg.Printf( _(
80  "The name \"%s\" conflicts with an existing entry in the symbol library \"%s\"." ),
81  newFieldValue, lib );
82 
83  DisplayErrorMessage( this, msg );
84  return;
85  }
86 
88  parent->SetName( newFieldValue );
89 
90  m_libMgr->UpdatePartAfterRename( parent, oldFieldValue, lib );
91 
92  // Reselect the renamed part
93  m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newFieldValue ) );
94  }
95 
96  if( !aField->InEditMode() && !renamed )
97  SaveCopyInUndoList( parent );
98 
99  dlg.UpdateField( aField );
100 
101  GetCanvas()->GetView()->Update( aField );
102  GetCanvas()->Refresh();
103  OnModify();
104 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:257
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
#define VALUE
Class DIALOG_LIB_EDIT_ONE_FIELD is a the class to handle editing a single component field in the libr...
SCH_DRAW_PANEL * GetCanvas() const override
Define a library symbol object.
EDA_ITEM * GetParent() const
Definition: base_struct.h:211
bool PartExists(const wxString &aAlias, const wxString &aLibrary) const
Returns true if part with a specific alias exists in library (either original one or buffered).
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
KIGFX::SCH_VIEW * GetView() const
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
static int m_unit
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, LIB_ID_TYPE aType, bool aLib=false)
Replace illegal LIB_ID item name characters with underscores '_'.
Definition: lib_id.cpp:352
virtual void SetName(const wxString &aName)
LIB_TREE * GetLibTree() const
SYMBOL_TREE_PANE * m_treePane
component search tree widget
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:165
bool UpdatePartAfterRename(LIB_PART *aPart, const wxString &oldAlias, const wxString &aLibrary)
Updates the part buffer with a new version of the part when the name has changed.

References DisplayErrorMessage(), LIB_ID::FixIllegalChars(), SCH_BASE_FRAME::GetCanvas(), GetChars(), GetCurLib(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), SYMBOL_TREE_PANE::GetLibTree(), LIB_FIELD::GetName(), LIB_ITEM::GetParent(), DIALOG_EDIT_ONE_FIELD::GetText(), SCH_DRAW_PANEL::GetView(), LIB_ID::ID_SCH, LIB_ITEM::InEditMode(), m_libMgr, m_treePane, m_unit, OnModify(), LIB_MANAGER::PartExists(), SCH_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), LIB_TREE::SelectLibId(), LIB_PART::SetName(), DIALOG_SHIM::ShowQuasiModal(), KIGFX::VIEW::Update(), DIALOG_LIB_EDIT_ONE_FIELD::UpdateField(), LIB_MANAGER::UpdatePartAfterRename(), UR_LIB_RENAME, and VALUE.

Referenced by OnLeftDClick(), and Process_Special_Functions().

◆ EditGraphicSymbol()

void LIB_EDIT_FRAME::EditGraphicSymbol ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 54 of file symbdraw.cpp.

55 {
56  if( DrawItem == NULL )
57  return;
58 
59  DIALOG_LIB_EDIT_DRAW_ITEM dialog( this, DrawItem );
60 
61  if( dialog.ShowModal() == wxID_CANCEL )
62  return;
63 
64  // Init default values (used to create a new draw item)
65  m_drawLineWidth = dialog.GetWidth();
66  m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
67  m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
68 
69 #if 0
70  /* TODO: see if m_drawFillStyle must retain the last fill option or not.
71  * if the last is Filled, having next new graphic items created
72  * with filled body is often bad.
73  * currently m_drawFillStyle is left with the default value (not filled)
74  */
75  if( DrawItem->IsFillable() )
76  m_drawFillStyle = (FILL_T) dialog.GetFillStyle();
77 #endif
78 
79  // Save copy for undo if not in edit (edit command already handle the save copy)
80  if( !DrawItem->InEditMode() )
81  SaveCopyInUndoList( DrawItem->GetParent() );
82 
83  if( m_drawSpecificUnit )
84  DrawItem->SetUnit( GetUnit() );
85  else
86  DrawItem->SetUnit( 0 );
87 
89  DrawItem->SetConvert( GetConvert() );
90  else
91  DrawItem->SetConvert( 0 );
92 
93  if( DrawItem->IsFillable() )
94  DrawItem->SetFillMode( (FILL_T) dialog.GetFillStyle() );
95 
96  DrawItem->SetWidth( m_drawLineWidth );
97 
98  GetCanvas()->GetView()->Update( DrawItem );
99  GetCanvas()->Refresh();
100  OnModify( );
101 
102  MSG_PANEL_ITEMS items;
103  DrawItem->GetMsgPanelInfo( m_UserUnits, items );
104  SetMsgPanel( items );
105 }
virtual void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
LIB_PART * GetParent() const
virtual void SetWidth(int aWidth)=0
Set the width of the draw item to aWidth.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool InEditMode() const
Return the draw item editing mode status.
SCH_DRAW_PANEL * GetCanvas() const override
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
void SetFillMode(FILL_T aFillMode)
KIGFX::SCH_VIEW * GetView() const
void SetConvert(int aConvert)
Dialog to edit library component graphic items.
void SetUnit(int aUnit)
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:54
bool IsFillable() const
Check if draw object can be filled.
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
bool m_drawSpecificConvert
Convert of the item currently being drawn.
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:123

References DIALOG_LIB_EDIT_DRAW_ITEM::GetApplyToAllConversions(), DIALOG_LIB_EDIT_DRAW_ITEM::GetApplyToAllUnits(), SCH_BASE_FRAME::GetCanvas(), GetConvert(), DIALOG_LIB_EDIT_DRAW_ITEM::GetFillStyle(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::GetParent(), GetUnit(), SCH_DRAW_PANEL::GetView(), DIALOG_LIB_EDIT_DRAW_ITEM::GetWidth(), LIB_ITEM::InEditMode(), LIB_ITEM::IsFillable(), m_drawFillStyle, m_drawLineWidth, m_drawSpecificConvert, m_drawSpecificUnit, EDA_DRAW_FRAME::m_UserUnits, OnModify(), SCH_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), LIB_ITEM::SetConvert(), LIB_ITEM::SetFillMode(), EDA_DRAW_FRAME::SetMsgPanel(), LIB_ITEM::SetUnit(), LIB_ITEM::SetWidth(), and KIGFX::VIEW::Update().

Referenced by OnLeftDClick(), and Process_Special_Functions().

◆ EditSymbolText()

void LIB_EDIT_FRAME::EditSymbolText ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 1005 of file lib_edit_frame.cpp.

1006 {
1007  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
1008  return;
1009 
1010  // Deleting old text
1011  if( DC && !DrawItem->InEditMode() )
1012  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1013  DefaultTransform );
1014 
1015  DIALOG_LIB_EDIT_TEXT dlg( this, (LIB_TEXT*) DrawItem );
1016 
1017  if( dlg.ShowModal() != wxID_OK )
1018  return;
1019 
1020  GetCanvas()->GetView()->Update( DrawItem );
1021  GetCanvas()->Refresh();
1022  OnModify();
1023 
1024  // Display new text
1025  if( DC && !DrawItem->InEditMode() )
1026  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1027  NULL, DefaultTransform );
1028 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:74
Define a symbol library graphical text item.
Definition: lib_text.h:44
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool InEditMode() const
Return the draw item editing mode status.
SCH_DRAW_PANEL * GetCanvas() const override
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
KIGFX::SCH_VIEW * GetView() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
#define GR_DEFAULT_DRAWMODE
Definition: general.h:73
TRANSFORM DefaultTransform
Definition: eeschema.cpp:59
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform)
Draw an item.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201

References DefaultTransform, LIB_ITEM::Draw(), g_XorMode, SCH_BASE_FRAME::GetCanvas(), SCH_DRAW_PANEL::GetView(), GR_DEFAULT_DRAWMODE, LIB_ITEM::InEditMode(), LIB_TEXT_T, EDA_DRAW_FRAME::m_canvas, OnModify(), SCH_DRAW_PANEL::Refresh(), EDA_ITEM::Type(), and KIGFX::VIEW::Update().

Referenced by CreateGraphicItem(), OnLeftDClick(), and Process_Special_Functions().

◆ emptyScreen()

void LIB_EDIT_FRAME::emptyScreen ( )
private

Restores the empty editor screen, without any part or library selected.

Definition at line 1723 of file lib_edit_frame.cpp.

1724 {
1725  SetCurLib( wxEmptyString );
1726  SetCurPart( nullptr );
1727  m_lastDrawItem = nullptr;
1728  SetDrawItem( NULL );
1731  Zoom_Automatique( false );
1732  Refresh();
1733 }
virtual void Zoom_Automatique(bool aWarpPointer) override
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetDrawItem(LIB_ITEM *drawItem)
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
static LIB_ITEM * m_lastDrawItem
void SetCurPart(LIB_PART *aPart)
Take ownership of aPart and notes that it is the one currently being edited.
virtual void SetScreen(BASE_SCREEN *aScreen) override
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
wxString SetCurLib(const wxString &aLibNickname)
Sets the current library nickname and returns the old library nickname.

References BASE_SCREEN::ClearUndoRedoList(), m_dummyScreen, m_lastDrawItem, Refresh(), SetCurLib(), SetCurPart(), SetDrawItem(), SetScreen(), and SCH_BASE_FRAME::Zoom_Automatique().

Referenced by OnRemovePart(), and OnRevert().

◆ EndDrawGraphicItem()

void LIB_EDIT_FRAME::EndDrawGraphicItem ( wxDC *  DC)
private

Definition at line 306 of file symbdraw.cpp.

307 {
308  LIB_ITEM* item = GetDrawItem();
309 
310  if( item == NULL )
311  return;
312 
313  if( LIB_PART* part = GetCurPart() )
314  {
315  if( GetToolId() != ID_NO_TOOL_SELECTED )
316  SetCursor( wxCURSOR_PENCIL );
317  else
318  SetCursor( (wxStockCursor) GetGalCanvas()->GetDefaultCursor() );
319 
320  if( GetTempCopyComponent() ) // used when editing an existing item
322  else
323  {
324  // When creating a new item, there is still no change for the
325  // current symbol. So save it.
326  SaveCopyInUndoList( part );
327  }
328 
329  if( item->IsNew() )
330  part->AddDrawItem( item );
331 
332  item->EndEdit( GetCrossHairPosition( true ) );
333 
334  SetDrawItem( NULL );
335 
336  m_canvas->SetMouseCapture( NULL, NULL );
337 
338  auto view = static_cast<SCH_DRAW_PANEL*>(m_canvas)->GetView();
339 
340  DBG(printf("end: pos %d %d\n", item->GetPosition().x, item->GetPosition().y );)
341 
342  view->ClearHiddenFlags();
343  view->ClearPreview();
344 
345  OnModify();
346  }
347 
348  RebuildView();
349  GetCanvas()->Refresh();
350 }
virtual wxPoint GetPosition() const =0
Return the current draw object position.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
virtual void EndEdit(const wxPoint &aPosition, bool aAbort=false)
End an object editing action.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool IsNew() const
Definition: base_struct.h:219
void SetDrawItem(LIB_ITEM *drawItem)
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
SCH_DRAW_PANEL * GetCanvas() const override
Define a library symbol object.
LIB_PART * GetTempCopyComponent()
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
LIB_ITEM * GetDrawItem() const
#define DBG(x)
Definition: fctsys.h:33
int GetToolId() const
Definition: draw_frame.h:526
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References DBG, LIB_ITEM::EndEdit(), SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetCurPart(), GetDrawItem(), EDA_DRAW_FRAME::GetGalCanvas(), LIB_ITEM::GetPosition(), GetTempCopyComponent(), EDA_DRAW_FRAME::GetToolId(), ID_NO_TOOL_SELECTED, EDA_ITEM::IsNew(), EDA_DRAW_FRAME::m_canvas, OnModify(), RebuildView(), SCH_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), SetDrawItem(), and EDA_DRAW_PANEL::SetMouseCapture().

Referenced by GraphicItemBeginDraw(), OnLeftClick(), OnLeftDClick(), and Process_Special_Functions().

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 308 of file legacy_gal/eda_draw_frame.cpp.

309 {
310  if( m_messagePanel )
312 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:166
void EraseMsgBox()
Definition: msgpanel.cpp:216

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

Referenced by GERBVIEW_FRAME::SetCurItem().

◆ ExecuteRemoteCommand()

virtual void EDA_DRAW_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
inlinevirtualinherited

Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest().

this is a virtual function becuse the actual commands depends on the application. the basic function do nothing

Parameters
cmdline= received command from socket

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 415 of file draw_frame.h.

415 {}

Referenced by EDA_DRAW_FRAME::OnSockRequest().

◆ ExportHotkeyConfigToFile()

void EDA_BASE_FRAME::ExportHotkeyConfigToFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 738 of file hotkeys_basic.cpp.

740 {
741  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
742  wxString mask = wxT( "*." ) + ext;
743 
744 #if 0
745  wxString path = wxPathOnly( Prj().GetProjectFullName() );
746 #else
747  wxString path = GetMruPath();
748 #endif
749  wxFileName fn( aDefaultShortname );
750  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
751 
752  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
753  path,
754  fn.GetFullPath(),
755  ext,
756  mask,
757  this,
758  wxFD_SAVE,
759  true );
760 
761  if( filename.IsEmpty() )
762  return;
763 
764  WriteHotkeyConfig( aDescList, &filename );
765  SetMruPath( wxFileName( filename ).GetPath() );
766 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:303
wxString GetMruPath() const
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), EDA_BASE_FRAME::GetMruPath(), Prj(), EDA_BASE_FRAME::SetMruPath(), and EDA_BASE_FRAME::WriteHotkeyConfig().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons().

◆ fixDuplicateAliases()

void LIB_EDIT_FRAME::fixDuplicateAliases ( LIB_PART aPart,
const wxString &  aLibrary 
)
private

Renames LIB_PART aliases to avoid conflicts before adding a component to a library

Definition at line 565 of file libedit.cpp.

566 {
567  wxString newName;
568 
569  for( unsigned int i = 0; i < aPart->GetAliasCount(); ++i )
570  {
571  LIB_ALIAS* alias = aPart->GetAlias( i );
572  int sfx = 0;
573  newName = alias->GetName();
574 
575  while( m_libMgr->PartExists( newName, aLibrary ) )
576  {
577  if( sfx == 0 )
578  newName = wxString::Format( "%s_copy", alias->GetName() );
579  else
580  newName = wxString::Format( "%s_copy%d", alias->GetName(), sfx );
581  ++sfx;
582  }
583 
584  if( i == 0 )
585  aPart->SetName( newName );
586  else
587  alias->SetName( newName );
588  }
589 }
Part library alias object definition.
LIB_ALIAS * GetAlias(size_t aIndex)
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
void SetName(const wxString &aName)
bool PartExists(const wxString &aAlias, const wxString &aLibrary) const
Returns true if part with a specific alias exists in library (either original one or buffered).
const wxString & GetName() const override
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
size_t i
Definition: json11.cpp:597
virtual void SetName(const wxString &aName)
size_t GetAliasCount() const

References Format(), LIB_PART::GetAlias(), LIB_PART::GetAliasCount(), LIB_ALIAS::GetName(), i, m_libMgr, LIB_MANAGER::PartExists(), LIB_ALIAS::SetName(), and LIB_PART::SetName().

Referenced by OnPasteDuplicatePart(), and savePartAs().

◆ FocusOnLocation()

void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint &  aPos,
bool  aWarpCursor = true,
bool  aCenterView = false 
)
inherited

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

Parameters
aPosis the point to go to.
aWarpCursoris true if the pointer should be warped to the new position.
aCenterViewis true if the new cursor position should be centered on canvas.

Definition at line 1643 of file legacy_gal/eda_draw_frame.cpp.

1644 {
1645  if( aCenterView )
1646  {
1647  wxWindow* dialog = findDialog( GetChildren() );
1648 
1649  // If a dialog partly obscures the window, then center on the uncovered area.
1650  if( dialog )
1651  {
1652  wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
1653  dialog->GetSize() );
1654  GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
1655  }
1656  else
1657  GetGalCanvas()->GetView()->SetCenter( aPos );
1658  }
1659 
1660  if( aWarpCursor )
1662  else
1664 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:601
wxWindow * findDialog(wxWindowList &aList)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.

References findDialog(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), and KIGFX::VIEW_CONTROLS::SetCursorPosition().

Referenced by DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_ERC::OnLeftClickMarkersList(), DIALOG_ERC::OnLeftDblClickMarkersList(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), and DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent().

◆ GeneralControl()

bool LIB_EDIT_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint &  aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

Perform application specific control using aDC at aPosition in logical units.

Override this function for application specific control. This function gets called on every mouse and key event.

Parameters
aDCA device context.
aPositionThe current cursor position in logical (drawing) units.
aHotKeyA key event used for application specific control if not zero.
Returns
true if the hotkey code is handled (captured).

Reimplemented from EDA_DRAW_FRAME.

Definition at line 48 of file controller.cpp.

49 {
50  // Filter out the 'fake' mouse motion after a keyboard movement
51  if( !aHotKey && m_movingCursorWithKeyboard )
52  {
54  return false;
55  }
56 
57  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
58  // for next cursor position
59  // ( shift or ctrl key down are PAN command with mouse wheel)
60  bool snapToGrid = true;
61 
62  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
63  snapToGrid = false;
64 
65  // Cursor is left off grid only if no block in progress
66  if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
67  snapToGrid = true;
68 
69  wxPoint pos = aPosition;
70  bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
71 
73  m_canvas->CrossHairOff( aDC );
74  else
75  m_canvas->CrossHairOn( aDC );
76 
77  GetGalCanvas()->GetViewControls()->SetSnapping( snapToGrid );
78  SetCrossHairPosition( pos, snapToGrid );
79 
80  if( m_canvas->IsMouseCaptured() )
81  m_canvas->CallMouseCapture( aDC, aPosition, true );
82 
83  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition, NULL ) )
84  keyHandled = true;
85 
86  // Make sure current-part highlighting doesn't get lost in seleciton highlighting
88 
90 
91  return keyHandled;
92 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
void ClearSearchTreeSelection()
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Handle the common part of GeneralControl dedicated to global cursor keys (i.e.
virtual void CrossHairOn(wxDC *DC=nullptr)
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
virtual void CrossHairOff(wxDC *DC=nullptr)
void UpdateStatusBar() override
Update the status bar information.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
int GetState(int type) const
Definition: base_struct.h:240
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:176
int GetToolId() const
Definition: draw_frame.h:526

References EDA_DRAW_PANEL::CallMouseCapture(), ClearSearchTreeSelection(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_FRAME::GetGalCanvas(), SCH_BASE_FRAME::GetScreen(), EDA_ITEM::GetState(), EDA_DRAW_FRAME::GetToolId(), EDA_DRAW_PANEL_GAL::GetViewControls(), ID_NO_TOOL_SELECTED, EDA_DRAW_PANEL::IsMouseCaptured(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_movingCursorWithKeyboard, OnHotKey(), EDA_DRAW_FRAME::SetCrossHairPosition(), KIGFX::VIEW_CONTROLS::SetSnapping(), STATE_NO_BLOCK, and SCH_BASE_FRAME::UpdateStatusBar().

◆ GeneralControlKeyMovement()

bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint *  aPos,
bool  aSnapToGrid 
)
protectedinherited

Handle the common part of GeneralControl dedicated to global cursor keys (i.e.

cursor movement by keyboard)

Parameters
aHotKeyis the hotkey code
aPosis the position of the cursor (initial then new)
aSnapToGrid= true to force the cursor position on grid
Returns
true if the hotkey code is handled (captured).

Definition at line 1243 of file legacy_gal/eda_draw_frame.cpp.

1245 {
1246  bool key_handled = false;
1247 
1248  // If requested snap the current position to the grid
1249  if( aSnapToGrid )
1250  *aPos = GetNearestGridPosition( *aPos );
1251 
1252  switch( aHotKey )
1253  {
1254  // All these keys have almost the same treatment
1255  case GR_KB_CTRL | WXK_NUMPAD8:
1256  case GR_KB_CTRL | WXK_UP:
1257  case GR_KB_CTRL | WXK_NUMPAD2:
1258  case GR_KB_CTRL | WXK_DOWN:
1259  case GR_KB_CTRL | WXK_NUMPAD4:
1260  case GR_KB_CTRL | WXK_LEFT:
1261  case GR_KB_CTRL | WXK_NUMPAD6:
1262  case GR_KB_CTRL | WXK_RIGHT:
1263  case WXK_NUMPAD8:
1264  case WXK_UP:
1265  case WXK_NUMPAD2:
1266  case WXK_DOWN:
1267  case WXK_NUMPAD4:
1268  case WXK_LEFT:
1269  case WXK_NUMPAD6:
1270  case WXK_RIGHT:
1271  key_handled = true;
1272  {
1273  /* Here's a tricky part: when doing cursor key movement, the
1274  * 'previous' point should be taken from memory, *not* from the
1275  * freshly computed position in the event. Otherwise you can't do
1276  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1277  * the automatic motion event generated by cursor warping */
1278  wxRealPoint gridSize = GetScreen()->GetGridSize();
1279  *aPos = GetCrossHairPosition();
1280 
1281  // Bonus: ^key moves faster (x10)
1282  switch( aHotKey )
1283  {
1284  case GR_KB_CTRL|WXK_NUMPAD8:
1285  case GR_KB_CTRL|WXK_UP:
1286  aPos->y -= KiROUND( 10 * gridSize.y );
1287  break;
1288 
1289  case GR_KB_CTRL|WXK_NUMPAD2:
1290  case GR_KB_CTRL|WXK_DOWN:
1291  aPos->y += KiROUND( 10 * gridSize.y );
1292  break;
1293 
1294  case GR_KB_CTRL|WXK_NUMPAD4:
1295  case GR_KB_CTRL|WXK_LEFT:
1296  aPos->x -= KiROUND( 10 * gridSize.x );
1297  break;
1298 
1299  case GR_KB_CTRL|WXK_NUMPAD6:
1300  case GR_KB_CTRL|WXK_RIGHT:
1301  aPos->x += KiROUND( 10 * gridSize.x );
1302  break;
1303 
1304  case WXK_NUMPAD8:
1305  case WXK_UP:
1306  aPos->y -= KiROUND( gridSize.y );
1307  break;
1308 
1309  case WXK_NUMPAD2:
1310  case WXK_DOWN:
1311  aPos->y += KiROUND( gridSize.y );
1312  break;
1313 
1314  case WXK_NUMPAD4:
1315  case WXK_LEFT:
1316  aPos->x -= KiROUND( gridSize.x );
1317  break;
1318 
1319  case WXK_NUMPAD6:
1320  case WXK_RIGHT:
1321  aPos->x += KiROUND( gridSize.x );
1322  break;
1323 
1324  default: /* Can't happen since we entered the statement */
1325  break;
1326  }
1327 
1328  m_canvas->MoveCursor( *aPos );
1330  }
1331  break;
1332 
1333  default:
1334  break;
1335  }
1336 
1337  return key_handled;
1338 }
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
#define GR_KB_CTRL
virtual void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:126
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:176
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

References EDA_DRAW_FRAME::GetCrossHairPosition(), BASE_SCREEN::GetGridSize(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_DRAW_FRAME::GetScreen(), GR_KB_CTRL, KiROUND(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_movingCursorWithKeyboard, and EDA_DRAW_PANEL::MoveCursor().

Referenced by LIB_VIEW_FRAME::GeneralControl(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GeneralControl(), GERBVIEW_FRAME::GeneralControl(), and PCB_EDIT_FRAME::GeneralControl().

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited

Function GetAutoSaveFilePrefix.

Returns
the string to prepend to a file name for automatic save.

Definition at line 163 of file eda_base_frame.h.

164  {
165  return wxT( "_autosave-" );
166  }

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

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 223 of file eda_base_frame.h.

223 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.

References EDA_BASE_FRAME::m_autoSaveInterval.

◆ GetAuxiliaryToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetAuxiliaryToolBar ( ) const
inlineinherited

Definition at line 485 of file draw_frame.h.

485 { return m_auxiliaryToolBar; }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window.
Definition: draw_frame.h:156

References EDA_DRAW_FRAME::m_auxiliaryToolBar.

◆ GetAuxOrigin()

const wxPoint & SCH_BASE_FRAME::GetAuxOrigin ( ) const
overridevirtualinherited

Return the origin of the axis used for plotting and various exports.

Implements EDA_DRAW_FRAME.

Definition at line 194 of file sch_base_frame.cpp.

195 {
196  wxASSERT( GetScreen() );
197  return GetScreen()->GetAuxOrigin();
198 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const wxPoint & GetAuxOrigin() const
Definition: sch_screen.h:133

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

◆ GetBackupSuffix()

static wxString EDA_BASE_FRAME::GetBackupSuffix ( )
inlinestaticprotectedinherited

Function GetBackupSuffix.

Returns
the suffix to be appended to the file extension on backup

Definition at line 154 of file eda_base_frame.h.

155  {
156  return wxT( "-bak" );
157  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), PCB_EDIT_FRAME::createBackupFile(), and PCB_EDIT_FRAME::Files_io_from_id().

◆ GetCanvas()

SCH_DRAW_PANEL * SCH_BASE_FRAME::GetCanvas ( ) const
overridevirtualinherited

Reimplemented from EDA_DRAW_FRAME.

Definition at line 483 of file sch_base_frame.cpp.

484 {
485  return static_cast<SCH_DRAW_PANEL*>( GetGalCanvas() );
486 }
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935

References EDA_DRAW_FRAME::GetGalCanvas().

Referenced by SCH_EDIT_FRAME::addCurrentItemToScreen(), SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::AddNoConnect(), SCH_BASE_FRAME::AddToScreen(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_BASE_FRAME::CenterScreen(), SCH_EDIT_FRAME::DeleteAnnotation(), deleteItem(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), SCH_EDIT_FRAME::DisplayCurrentSheet(), DrawMovePin(), SCH_PRINTOUT::DrawPage(), SCH_EDIT_FRAME::EditComponent(), EditField(), EditGraphicSymbol(), SCH_EDIT_FRAME::EditSheet(), EditSymbolText(), EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::FindComponentAndItem(), GetComponentFromRedoList(), GetComponentFromUndoList(), SCH_EDIT_FRAME::GetSchematicFromRedoList(), SCH_EDIT_FRAME::GetSchematicFromUndoList(), GlobalSetPins(), SCH_BASE_FRAME::HandleBlockBegin(), HandleBlockEnd(), HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_BASE_FRAME::HardRedraw(), SCH_EDIT_FRAME::HardRedraw(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), SCH_EDIT_FRAME::LoadSettings(), LoadSettings(), SCH_EDIT_FRAME::MirrorSheet(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_ANNOTATE::OnApplyClick(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), LIB_VIEW_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), OnEditComponentProperties(), SCH_EDIT_FRAME::OnEditItem(), OnEditPin(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnHotKey(), OnHotKey(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), OnOpenPinTable(), OnOrient(), SCH_EDIT_FRAME::OnOrient(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), OnRotate(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), SCH_EDIT_FRAME::OnSelectUnit(), LIB_VIEW_FRAME::OnShowElectricalType(), OnShowElectricalType(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), SCH_EDIT_FRAME::OrientComponent(), pasteClipboard(), SCH_FIELD::Place(), PlacePin(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::PutDataInPreviousState(), RebuildView(), DIALOG_ERC::RedrawDrawPanel(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RedrawScreen2(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RemoveFromScreen(), RepeatPinItem(), SCH_EDIT_FRAME::rescueProject(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::SaveWireImage(), LIB_VIEW_FRAME::SetUnitAndConvert(), SCH_EDIT_FRAME::TestDanglingEnds(), DIALOG_ERC::TestErc(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow(), DIALOG_UPDATE_FIELDS::TransferDataFromWindow(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), LIB_VIEW_FRAME::updatePreviewSymbol(), DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL(), and LIB_VIEW_FRAME::~LIB_VIEW_FRAME().

◆ GetCanvasTypeKey()

virtual wxString EDA_DRAW_FRAME::GetCanvasTypeKey ( )
inlineprotectedvirtualinherited
Returns
the key in KifaceSettings to store the canvas type. the base version returns only CanvasTypeKeyBase. Can be overriden to return a key specific of a frame name

Definition at line 241 of file draw_frame.h.

242  {
243  return CanvasTypeKeyBase;
244  }
#define CanvasTypeKeyBase
The key to store the canvas type in config.
Definition: draw_frame.h:73

References CanvasTypeKeyBase.

Referenced by EDA_DRAW_FRAME::LoadCanvasTypeSetting(), and EDA_DRAW_FRAME::saveCanvasTypeSetting().

◆ GetComponentFromRedoList()

void LIB_EDIT_FRAME::GetComponentFromRedoList ( wxCommandEvent &  event)
private

Definition at line 55 of file libedit_undo_redo.cpp.

56 {
57  if( GetScreen()->GetRedoCommandCount() <= 0 )
58  return;
59 
60  // Load the last redo entry
62  ITEM_PICKER redoWrapper = redoCommand->PopItem();
63  delete redoCommand;
64  LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
65  wxCHECK( part, /* void */ );
66  part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
67  UNDO_REDO_T undoRedoType = redoWrapper.GetStatus();
68 
69  // Store the current part in the undo buffer
70  PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
71  LIB_PART* oldPart = GetCurPart();
72  oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
73  ITEM_PICKER undoWrapper( oldPart, undoRedoType );
74  undoCommand->PushItem( undoWrapper );
75  GetScreen()->PushCommandToUndoList( undoCommand );
76 
77  // Do not delete the previous part by calling SetCurPart( part )
78  // which calls delete <previous part>.
79  // <previous part> is now put in undo list and is owned by this list
80  // Just set the current part to the part which come from the redo list
81  m_my_part = part;
82 
83  if( undoRedoType == UR_LIB_RENAME )
84  {
85  wxString lib = GetCurLib();
86  m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
87 
88  // Reselect the renamed part
89  m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
90  }
91 
92  SetDrawItem( NULL );
94  SetShowDeMorgan( part->HasConversion() );
95  updateTitle();
96  DisplayCmpDoc();
97 
98  RebuildView();
99  GetCanvas()->Refresh();
100  OnModify();
101 }
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToUndoList add a command to undo in undo list delete the very old commands when t...
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
UNDO_REDO_T GetStatus() const
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
EDA_ITEM * GetItem() const
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
void SetShowDeMorgan(bool show)
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void SetDrawItem(LIB_ITEM *drawItem)
SCH_DRAW_PANEL * GetCanvas() const override
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted.
Define a library symbol object.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:803
void updateTitle()
Updates the main window title bar with the current library name and read only status of the library.
Definition: libedit.cpp:58
const wxString & GetName() const
ITEM_PICKER PopItem()
Function PopItem.
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
LIB_TREE * GetLibTree() const
SYMBOL_TREE_PANE * m_treePane
component search tree widget
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
void UpdatePartSelectList()
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:165
bool UpdatePartAfterRename(LIB_PART *aPart, const wxString &oldAlias, const wxString &aLibrary)
Updates the part buffer with a new version of the part when the name has changed.

References DisplayCmpDoc(), SCH_BASE_FRAME::GetCanvas(), GetCurLib(), GetCurPart(), EDA_ITEM::GetFlags(), ITEM_PICKER::GetItem(), SYMBOL_TREE_PANE::GetLibTree(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), ITEM_PICKER::GetStatus(), LIB_PART::HasConversion(), m_libMgr, m_my_part, m_treePane, OnModify(), BASE_SCREEN::PopCommandFromRedoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToUndoList(), PICKED_ITEMS_LIST::PushItem(), RebuildView(), SCH_DRAW_PANEL::Refresh(), LIB_TREE::SelectLibId(), SetDrawItem(), EDA_ITEM::SetFlags(), SetShowDeMorgan(), LIB_MANAGER::UpdatePartAfterRename(), UpdatePartSelectList(), updateTitle(), UR_LIB_RENAME, and UR_TRANSIENT.

◆ GetComponentFromUndoList()

void LIB_EDIT_FRAME::GetComponentFromUndoList ( wxCommandEvent &  event)
private

Definition at line 104 of file libedit_undo_redo.cpp.

105 {
106  if( GetScreen()->GetUndoCommandCount() <= 0 )
107  return;
108 
109  // Load the last undo entry
111  ITEM_PICKER undoWrapper = undoCommand->PopItem();
112  delete undoCommand;
113  LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
114  wxCHECK( part, /* void */ );
115  part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
116  UNDO_REDO_T undoRedoType = undoWrapper.GetStatus();
117 
118  // Store the current part in the redo buffer
119  PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
120  LIB_PART* oldPart = GetCurPart();
121  oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
122  ITEM_PICKER redoWrapper( oldPart, undoRedoType );
123  redoCommand->PushItem( redoWrapper );
124  GetScreen()->PushCommandToRedoList( redoCommand );
125 
126  // Do not delete the previous part by calling SetCurPart( part ),
127  // which calls delete <previous part>.
128  // <previous part> is now put in redo list and is owned by this list.
129  // Just set the current part to the part which come from the undo list
130  m_my_part = part;
131 
132  if( undoRedoType == UR_LIB_RENAME )
133  {
134  wxString lib = GetCurLib();
135  m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
136 
137  // Reselect the renamed part
138  m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
139  }
140 
141  SetDrawItem( NULL );
143  SetShowDeMorgan( part->HasConversion() );
144  updateTitle();
145  DisplayCmpDoc();
146 
147  RebuildView();
148  GetCanvas()->Refresh();
149  OnModify();
150 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
UNDO_REDO_T GetStatus() const
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
EDA_ITEM * GetItem() const
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen.
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
void SetShowDeMorgan(bool show)
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void SetDrawItem(LIB_ITEM *drawItem)
SCH_DRAW_PANEL * GetCanvas() const override
Define a library symbol object.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:803
void updateTitle()
Updates the main window title bar with the current library name and read only status of the library.
Definition: libedit.cpp:58
const wxString & GetName() const
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToRedoList add a command to redo in redo list delete the very old commands when t...
ITEM_PICKER PopItem()
Function PopItem.
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
LIB_TREE * GetLibTree() const
SYMBOL_TREE_PANE * m_treePane
component search tree widget
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
void UpdatePartSelectList()
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:165
bool UpdatePartAfterRename(LIB_PART *aPart, const wxString &oldAlias, const wxString &aLibrary)
Updates the part buffer with a new version of the part when the name has changed.

References DisplayCmpDoc(), SCH_BASE_FRAME::GetCanvas(), GetCurLib(), GetCurPart(), EDA_ITEM::GetFlags(), ITEM_PICKER::GetItem(), SYMBOL_TREE_PANE::GetLibTree(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), ITEM_PICKER::GetStatus(), LIB_PART::HasConversion(), m_libMgr, m_my_part, m_treePane, OnModify(), BASE_SCREEN::PopCommandFromUndoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToRedoList(), PICKED_ITEMS_LIST::PushItem(), RebuildView(), SCH_DRAW_PANEL::Refresh(), LIB_TREE::SelectLibId(), SetDrawItem(), EDA_ITEM::SetFlags(), SetShowDeMorgan(), LIB_MANAGER::UpdatePartAfterRename(), UpdatePartSelectList(), updateTitle(), UR_LIB_RENAME, and UR_TRANSIENT.

◆ GetConvert()

int LIB_EDIT_FRAME::GetConvert ( )
inline

◆ GetCrossHairPosition()

wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const
inherited

Return the current cross hair position in logical (drawing) coordinates.

Parameters
aInvertYInverts the Y axis position.
Returns
The cross hair position in drawing coordinates.

Definition at line 1142 of file legacy_gal/eda_draw_frame.cpp.

1143 {
1145  return wxPoint( cursor.x, aInvertY ? -cursor.y : cursor.y );
1146 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetViewControls(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddModuleToBoard(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PL_EDITOR_FRAME::Block_Move(), GERBVIEW_FRAME::Block_Move(), BuildDimension(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), CreateGraphicItem(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), CreatePin(), PCB_EDIT_FRAME::createPopupMenuForTracks(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), PCB_EDIT_FRAME::EditDimension(), EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), GraphicItemBeginDraw(), HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_WIZARD_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), OnHotKey(), GERBVIEW_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOrient(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), LIB_VIEW_FRAME::OnSetRelativeOffset(), FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset(), FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset(), EDA_DRAW_FRAME::OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), PlaceAnchor(), PCB_BASE_FRAME::PlaceModule(), PlacePin(), PCB_BASE_FRAME::PlaceTexteModule(), SCH_EDIT_FRAME::PrepareMoveItem(), Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), RedrawWhileMovingCursor(), EDA_DRAW_FRAME::RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), RepeatPinItem(), resizeSheetWithMouseCursor(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), Show_MoveTexte_Module(), Show_New_Edge_While_Move_Mouse(), Show_Pad_Move(), Show_Zone_Corner_Or_Outline_While_Move_Mouse(), ShowBoundingBoxMicroWaveInductor(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), ShowTargetShapeWhileMovingMouse(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), StartModifyDrawSymbol(), StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

◆ GetCrossHairScreenPosition()

wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const
inherited

Return the cross hair position in device (display) units.b.

Returns
The current cross hair position.

Definition at line 1178 of file legacy_gal/eda_draw_frame.cpp.

1179 {
1180  BASE_SCREEN* screen = GetScreen(); // virtual call
1181  return screen->getCrossHairScreenPosition();
1182 }
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units....
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References BASE_SCREEN::getCrossHairScreenPosition(), and EDA_DRAW_FRAME::GetScreen().

◆ GetCurLib()

wxString LIB_EDIT_FRAME::GetCurLib ( ) const

The nickname of the current library being edited and empty string if none.

Definition at line 910 of file lib_edit_frame.cpp.

911 {
912  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
913 
914  if( !libNickname.empty() )
915  {
916  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
917  {
918  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
919  libNickname = wxEmptyString;
920  }
921  }
922 
923  return libNickname;
924 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:171
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:186

References PROJECT::GetRString(), KIWAY_HOLDER::Prj(), PROJECT::SCH_LIBEDIT_CUR_LIB, and PROJECT::SetRString().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), EditField(), GetComponentFromRedoList(), GetComponentFromUndoList(), LoadComponentFromCurrentLib(), OnEditComponentProperties(), SetCurLib(), storeCurrentPart(), SyncLibraries(), and updateTitle().

◆ GetCurPart()

LIB_PART* LIB_EDIT_FRAME::GetCurPart ( ) const
inline

Return the current part being edited or NULL if none selected.

This is a LIB_PART that I own, it is at best a copy of one in a library.

Definition at line 173 of file lib_edit_frame.h.

174  {
175  return m_my_part;
176  }
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.

References m_my_part.

Referenced by BestZoom(), copySelectedItems(), CreatePin(), deleteItem(), DisplayCmpDoc(), DrawMovingBlockOutlines(), EndDrawGraphicItem(), GetComponentFromRedoList(), GetComponentFromUndoList(), GetDocumentExtents(), getTargetLibId(), getTargetPart(), GlobalSetPins(), HandleBlockEnd(), HandleBlockPlace(), InitBlockPasteInfos(), isCurrentPart(), LoadComponentAndSelectLib(), LoadComponentFromCurrentLib(), LoadOneSymbol(), locateItem(), LocateItemUsingCursor(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddFootprintFilter(), OnCheckComponent(), OnEditComponentProperties(), OnLeftClick(), OnLeftDClick(), OnOpenPinTable(), OnOrient(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), OnPlotCurrentComponent(), OnRevert(), OnRightClick(), OnRotate(), OnSelectTool(), OnUpdateDeMorganConvert(), OnUpdateDeMorganNormal(), OnUpdateEditingPart(), OnUpdatePartNumber(), OnUpdatePinTable(), OnUpdateRedo(), OnUpdateSyncPinEdit(), OnUpdateUndo(), OnViewEntryDoc(), pasteClipboard(), PlaceAnchor(), PlacePin(), PrintPage(), Process_Special_Functions(), RedrawComponent(), RepeatPinItem(), saveCurrentPart(), SaveOneSymbol(), StartMovePin(), SVG_PlotComponent(), SynchronizePins(), SyncLibraries(), TempCopyComponent(), UpdatePartSelectList(), and updateTitle().

◆ GetCursorPosition()

wxPoint EDA_DRAW_FRAME::GetCursorPosition ( bool  aOnGrid,
wxRealPoint *  aGridSize = NULL 
) const
inherited

Return the current cursor position in logical (drawing) units.

Parameters
aOnGridReturns the nearest grid position at the current cursor position.
aGridSizeCustom grid size instead of the current grid size. Only valid if aOnGrid is true.
Returns
The current cursor position.

Definition at line 1163 of file legacy_gal/eda_draw_frame.cpp.

1164 {
1165  BASE_SCREEN* screen = GetScreen(); // virtual call
1166  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1167 }
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:404

References BASE_SCREEN::getCursorPosition(), EDA_DRAW_FRAME::GetGridOrigin(), and EDA_DRAW_FRAME::GetScreen().

◆ GetDefaultPinLength()

static int LIB_EDIT_FRAME::GetDefaultPinLength ( )
inlinestatic
Returns
The default pin len setting.

Definition at line 195 of file lib_edit_frame.h.

195 { return m_defaultPinLength; }
static int m_defaultPinLength
Default pin length.

References m_defaultPinLength.

Referenced by GetLastPinLength(), LIB_PIN::LIB_PIN(), SaveSettings(), and PANEL_LIBEDIT_SETTINGS::TransferDataToWindow().

◆ GetDisplayOptions()

virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

A way to pass info to draw functions.

the base class has no knowledge about these options. It is virtual because this function must be overloaded to pass usefull info.

Reimplemented in PCB_BASE_FRAME.

Definition at line 948 of file draw_frame.h.

948 { return NULL; }

Referenced by GERBVIEW_DRAW_PANEL_GAL::OnShow(), PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow().

◆ GetDocumentExtents()

const BOX2I LIB_EDIT_FRAME::GetDocumentExtents ( ) const
overridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1788 of file lib_edit_frame.cpp.

1789 {
1790  LIB_PART* part = GetCurPart();
1791 
1792  if( !part )
1793  {
1794  return BOX2I( VECTOR2I(-100, -100), VECTOR2I( 200, 200 ) );
1795  }
1796  else
1797  {
1800  }
1801 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
static int m_convert
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
coord_type GetWidth() const
Definition: box2.h:195
Define a library symbol object.
static int m_unit
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
coord_type GetHeight() const
Definition: box2.h:196
const Vec & GetOrigin() const
Definition: box2.h:191

References boundingBox(), GetCurPart(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetOrigin(), LIB_PART::GetUnitBoundingBox(), BOX2< Vec >::GetWidth(), m_convert, and m_unit.

◆ GetDrawBgColor()

virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited

◆ GetDrawItem()

◆ GetDrawToolBar()

wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 484 of file draw_frame.h.

484 { return m_drawToolBar; }
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:160

References EDA_DRAW_FRAME::m_drawToolBar.

◆ GetFileFromHistory()

wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function GetFileFromHistory fetches the file name from the file history list.

and removes the selected file, if this file does not exists Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

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

Definition at line 399 of file eda_base_frame.cpp.

401 {
402  wxFileHistory* fileHistory = aFileHistory;
403 
404  if( !fileHistory )
405  fileHistory = &Kiface().GetFileHistory();
406 
407  int baseId = fileHistory->GetBaseId();
408 
409  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
410 
411  unsigned i = cmdId - baseId;
412 
413  if( i < fileHistory->GetCount() )
414  {
415  wxString fn = fileHistory->GetHistoryFile( i );
416 
417  if( wxFileName::FileExists( fn ) )
418  return fn;
419  else
420  {
421  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
422  wxMessageBox( msg );
423 
424  fileHistory->RemoveFileFromHistory( i );
425  }
426  }
427 
428  return wxEmptyString;
429 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
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
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123
size_t i
Definition: json11.cpp:597

References Format(), KIFACE_I::GetFileHistory(), i, and Kiface().

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

◆ GetFillStyle()

FILL_T LIB_EDIT_FRAME::GetFillStyle ( void  )
inline

Definition at line 441 of file lib_edit_frame.h.

441 { return m_drawFillStyle; }
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.

References m_drawFillStyle.

◆ GetGalCanvas()

EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetGalCanvas ( ) const
inlineinherited

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

Returns
Pointer to GAL-based canvas.

Definition at line 935 of file draw_frame.h.

935 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:94

References EDA_DRAW_FRAME::m_galCanvas.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL(), DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), COMMON_TOOLS::CenterContents(), SCH_BASE_FRAME::CenterScreen(), PCB_EDIT_FRAME::Check_All_Zones(), GERBVIEW_FRAME::Clear_DrawLayers(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), DIALOG_PRINT_PCBNEW::createPrintout(), DIALOG_PRINT_GERBVIEW::createPrintout(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Edit_Zone_Params(), EndDrawGraphicItem(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), EDA_DRAW_FRAME::FocusOnLocation(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), SCH_EDIT_FRAME::GeneralControl(), GeneralControl(), GERBVIEW_FRAME::GERBVIEW_FRAME(), SCH_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetCollectorsGuide(), EDA_DRAW_FRAME::GetCrossHairPosition(), SCH_BASE_FRAME::GetRenderSettings(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HighlightConnectionAtPosition(), GERBVIEW_CONTROL::HighlightControl(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), FOOTPRINT_PREVIEW_PANEL::New(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), STATUS_POPUP::onCharHook(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), OnCreateNewPart(), OnEditComponentProperties(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), OnSelectBodyStyle(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), FOOTPRINT_EDIT_FRAME::OnSwitchCanvas(), SCH_BASE_FRAME::OnSwitchCanvas(), OnSwitchCanvas(), PCB_BASE_FRAME::OnToggleEdgeDrawMode(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnToggleTextDrawMode(), GERBVIEW_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSelectZoom(), SCH_BASE_FRAME::OnUpdateSwitchCanvas(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), FOOTPRINT_TREE_PANE::onUpdateUI(), EDA_DRAW_FRAME::OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), PlaceAnchor(), DIALOG_PAD_PROPERTIES::prepareCanvas(), Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), processBoardItem(), BOARD_COMMIT::Push(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), SCH_BASE_FRAME::RedrawScreen2(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), refreshCallback(), SELECTION_TOOL::RequestSelection(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), SaveCanvasImageToFile(), saveLibrary(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetCrossHairPosition(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNextZoomAndRedraw(), EDA_DRAW_FRAME::SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), EDA_DRAW_FRAME::SetPresetGrid(), EDA_DRAW_FRAME::SetPreviousZoomAndRedraw(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), GERBVIEW_FRAME::SortLayersByX2Attributes(), StartMoveDrawSymbol(), PCB_EDIT_FRAME::Swap_Layers(), EDA_DRAW_FRAME::SwitchCanvas(), SCH_BASE_FRAME::SyncView(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PCBNEW_SETTINGS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), GERBVIEW_FRAME::UpdateDisplayOptions(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_EDIT_FRAME::UpdateUserInterface(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), PCB_BASE_EDIT_FRAME::UseGalCanvas(), FOOTPRINT_EDIT_FRAME::UseGalCanvas(), PCB_BASE_FRAME::UseGalCanvas(), GERBVIEW_FRAME::UseGalCanvas(), EDA_DRAW_FRAME::UseGalCanvas(), CVPCB_CONTROL::view(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), GERBVIEW_FRAME::~GERBVIEW_FRAME(), and PCB_BASE_FRAME::~PCB_BASE_FRAME().

◆ GetGalDisplayOptions()

◆ GetGridColor()

virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited
Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 552 of file draw_frame.h.

553  {
554  return m_gridColor;
555  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:115

References EDA_DRAW_FRAME::m_gridColor.

Referenced by GERBVIEW_FRAME::GetVisibleElementColor(), and PCBNEW_CONTROL::Reset().

◆ GetGridOrigin()

const wxPoint& SCH_BASE_FRAME::GetGridOrigin ( ) const
inlineoverridevirtualinherited

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

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

Implements EDA_DRAW_FRAME.

Definition at line 164 of file sch_base_frame.h.

165  {
166  static wxPoint zero;
167  return zero;
168  }

◆ GetGridPosition()

wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint &  aPosition) const
inherited

Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled.

Otherwise, the original positions is returned.

See also
m_snapToGrid and m_BaseScreen members.
Parameters
aPositionThe position to test.
Returns
The wxPoint of the appropriate cursor position.

Definition at line 683 of file legacy_gal/eda_draw_frame.cpp.

684 {
685  wxPoint pos = aPosition;
686 
687  if( m_currentScreen != NULL && m_snapToGrid )
688  pos = GetNearestGridPosition( aPosition );
689 
690  return pos;
691 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:90
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:92

References EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_DRAW_FRAME::m_currentScreen, and EDA_DRAW_FRAME::m_snapToGrid.

Referenced by SCH_EDIT_FRAME::HighlightConnectionAtPosition(), and SCH_EDIT_FRAME::OnLeftClick().

◆ GetHotkeyConfig()

EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

Return a structure containing currently used hotkey mapping.

Definition at line 438 of file draw_frame.h.

438 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:108

References EDA_DRAW_FRAME::m_hotkeysDescrList.

Referenced by GERBVIEW_CONTROL::ShowHelp(), and PCBNEW_CONTROL::ShowHelp().

◆ GetHotKeyDescription()

EDA_HOTKEY * LIB_EDIT_FRAME::GetHotKeyDescription ( int  aCommand) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 665 of file eeschema/hotkeys.cpp.

666 {
667  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
668 
669  if( HK_Descr == NULL )
670  HK_Descr = GetDescriptorFromCommand( aCommand,