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 ()
 
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 OnSwitchCanvas (wxCommandEvent &aEvent)
 switches currently used canvas ( Cairo / OpenGL). More...
 
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 wxPointGetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPointGetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
void OnGridSettings (wxCommandEvent &aEvent)
 
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 wxPointGetScrollCenterPosition () 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 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)
 
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...
 
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, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
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...
 
static EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. 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)
 
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)
 
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 ()
 

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...
 
bool m_canvasTypeDirty
 Flag indicating that drawing canvas type needs to be saved to config. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 
static const wxChar CANVAS_TYPE_KEY [] = wxT( "canvas_type" )
 

Key in KifaceSettings to store the canvas type.

More...
 

Private Member Functions

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...
 
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...
 
static wxSize m_clientSize = wxSize( -1, -1 )
 

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

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 ( KIWAY aKiway,
wxWindow *  aParent 
)
LIB_EDIT_FRAME::~LIB_EDIT_FRAME ( )

Definition at line 290 of file lib_edit_frame.cpp.

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

291 {
292  Unbind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
294 
295  // current screen is destroyed in EDA_DRAW_FRAME
297 
298  m_lastDrawItem = NULL;
300 
301  delete m_tempCopyComponent;
302  delete m_libMgr;
303  delete m_my_part;
304 }
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.

Member Function Documentation

bool LIB_EDIT_FRAME::addLibraryFile ( bool  aCreateNew)
private

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

Definition at line 1501 of file lib_edit_frame.cpp.

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

1502 {
1503  wxFileName fn = m_libMgr->GetUniqueLibraryName();
1504 
1505  if( !LibraryFileBrowser( !aCreateNew, fn,
1507  false ) )
1508  {
1509  return false;
1510  }
1511 
1512  wxString libName = fn.GetName();
1513 
1514  if( libName.IsEmpty() )
1515  return false;
1516 
1517  if( m_libMgr->LibraryExists( libName ) )
1518  {
1519  DisplayError( this, wxString::Format( _( "Library \"%s\" already exists" ), libName ) );
1520  return false;
1521  }
1522 
1523  // Select the target library table (global/project)
1524  SYMBOL_LIB_TABLE* libTable = selectSymLibTable();
1525 
1526  if( !libTable )
1527  return false;
1528 
1529  if( aCreateNew )
1530  {
1531  if( !m_libMgr->CreateLibrary( fn.GetFullPath(), libTable ) )
1532  {
1533  DisplayError( this, _( "Could not create the library file. Check write permission." ) );
1534  return false;
1535  }
1536  }
1537  else
1538  {
1539  if( !m_libMgr->AddLibrary( fn.GetFullPath(), libTable ) )
1540  {
1541  DisplayError( this, _( "Could not open the library file." ) );
1542  return false;
1543  }
1544  }
1545 
1546  bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
1547  saveSymbolLibTables( globalTable, !globalTable );
1548 
1549  return true;
1550 }
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
const std::string SchematicLibraryFileExtension
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory)
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.
wxString GetUniqueLibraryName() const
Returns a library name that is not currently in use.
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:245
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 1493 of file legacy_gal/eda_draw_frame.cpp.

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

1494 {
1495  int maxZoomIds;
1496  double zoom;
1497  wxString msg;
1498  BASE_SCREEN* screen = m_canvas->GetScreen();
1499 
1500  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
1501  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
1502  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
1503  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
1504  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
1505  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
1506  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
1507  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
1508  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
1509  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
1510 
1511 
1512  wxMenu* zoom_choice = new wxMenu;
1513  AddMenuItem( MasterMenu, zoom_choice,
1514  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
1515  KiBitmap( zoom_selection_xpm ) );
1516 
1517  zoom = screen->GetZoom();
1519  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
1520  maxZoomIds : screen->m_ZoomList.size();
1521 
1522  // Populate zoom submenu.
1523  for( int i = 0; i < maxZoomIds; i++ )
1524  {
1525  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
1526 
1527  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
1528  wxEmptyString, wxITEM_CHECK );
1529  if( zoom == screen->m_ZoomList[i] )
1530  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
1531  }
1532 
1533  // Create grid submenu as required.
1534  if( screen->GetGridCount() )
1535  {
1536  wxMenu* gridMenu = new wxMenu;
1537  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
1538  _( "Grid" ), KiBitmap( grid_select_xpm ) );
1539 
1540  wxArrayString gridsList;
1541  int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
1542 
1543  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
1544  {
1545  GRID_TYPE& grid = screen->GetGrid( i );
1546  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
1547 
1548  if( (int)i == icurr )
1549  gridMenu->Check( grid.m_CmdId, true );
1550  }
1551  }
1552 
1553  MasterMenu->AppendSeparator();
1554  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
1555 }
virtual BASE_SCREEN * GetScreen()=0
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
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
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:105
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:284
Definition: common.h:160
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:115
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
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
void SCH_BASE_FRAME::AddToScreen ( SCH_ITEM aItem)
inherited

Add an item to the screen (and view)

Definition at line 628 of file sch_base_frame.cpp.

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

629 {
630  GetScreen()->Append( aItem );
631  GetCanvas()->GetView()->Add( aItem );
632  RefreshItem( aItem, true ); // handle any additional parent semantics
633 }
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:335
void SCH_BASE_FRAME::AddToScreen ( DLIST< SCH_ITEM > &  aItems)
inherited

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

Definition at line 636 of file sch_base_frame.cpp.

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

637 {
638  for( SCH_ITEM* item = aItems.begin(); item; item = item->Next() )
639  {
640  GetCanvas()->GetView()->Add( item );
641  RefreshItem( item, true ); // handle any additional parent semantics
642  }
643 
644  GetScreen()->Append( aItems );
645 }
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_ITEM * Next() const
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:335
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

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

980 {
981 }
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 833 of file legacy_gal/eda_draw_frame.cpp.

References EDA_MSG_PANEL::AppendMessage(), 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_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::SaveEEFile(), saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), ShowNewTrackWhenMovingCursor(), and LIB_VIEW_FRAME::updatePreviewSymbol().

836 {
837  if( m_messagePanel == NULL )
838  return;
839 
840  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
841 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:163
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110
bool LIB_EDIT_FRAME::backupFile ( const wxFileName &  aOriginalFile,
const wxString &  aBackupExt 
)
private

Creates a backup copy of a file with requested extension

Definition at line 1667 of file lib_edit_frame.cpp.

References DisplayError().

Referenced by saveLibrary().

1668 {
1669  if( aOriginalFile.FileExists() )
1670  {
1671  wxFileName backupFileName( aOriginalFile );
1672  backupFileName.SetExt( "bck" );
1673 
1674  if( backupFileName.FileExists() )
1675  wxRemoveFile( backupFileName.GetFullPath() );
1676 
1677  if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1678  {
1679  DisplayError( this, _( "Failed to save backup document to file " ) +
1680  backupFileName.GetFullPath() );
1681  return false;
1682  }
1683  }
1684 
1685  return true;
1686 }
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited
double LIB_EDIT_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 316 of file lib_edit_frame.cpp.

References EDA_DRAW_FRAME::bestZoom(), boundingBox(), EDA_RECT::Centre(), GetCurPart(), EDA_RECT::GetHeight(), LIB_PART::GetUnitBoundingBox(), EDA_RECT::GetWidth(), m_convert, m_unit, and EDA_DRAW_FRAME::SetScrollCenterPosition().

Referenced by OnAddLibrary().

317 {
318  LIB_PART* part = GetCurPart();
319  double defaultLibraryZoom = 7.33;
320 
321  if( !part )
322  {
323  SetScrollCenterPosition( wxPoint( 0, 0 ) );
324  return defaultLibraryZoom;
325  }
326 
328 
329  double sizeX = (double) boundingBox.GetWidth();
330  double sizeY = (double) boundingBox.GetHeight();
331  wxPoint centre = boundingBox.Centre();
332 
333  // Reserve a 20% margin around component bounding box.
334  double margin_scale_factor = 1.2;
335 
336  return bestZoom( sizeX, sizeY, margin_scale_factor, centre);
337 }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
static int m_convert
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
void SetScrollCenterPosition(const wxPoint &aPoint)
int GetHeight() const
Definition: eda_rect.h:118
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Define a library symbol object.
wxPoint Centre() const
Definition: eda_rect.h:60
static int m_unit
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
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.

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

Referenced by HandleBlockEnd(), and IsEditingDrawItem().

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

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.

Referenced by IsEditingDrawItem().

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
void LIB_EDIT_FRAME::BlockCopySelectedItems ( const wxPoint aOffset,
LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Definition at line 135 of file block_libedit.cpp.

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

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 = dynamic_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 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
bool IsSelected() const
Definition: base_struct.h:224
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
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
unsigned GetCount() const
Function GetCount.
bool SetPickedItemStatus(UNDO_REDO_T aStatus, unsigned aIdx)
Function SetPickedItemStatus sets the type of undo/redo operation for a given picked item...
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
PICKED_ITEMS_LIST & GetItems()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
wxPoint GetMoveVector() const
void LIB_EDIT_FRAME::BlockDeleteSelectedItems ( LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Definition at line 108 of file block_libedit.cpp.

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

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
void LIB_EDIT_FRAME::BlockMoveSelectedItems ( const wxPoint aOffset,
LIB_PART aPart,
BLOCK_SELECTOR aBlock 
)

Definition at line 93 of file block_libedit.cpp.

References LIB_PART::GetDrawItems().

Referenced by HandleBlockPlace(), IsEditingDrawItem(), and pasteClipboard().

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

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

Referenced by HandleBlockEnd(), and IsEditingDrawItem().

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 }
bool UnitsLocked() const
Check whether part units are interchangeable.
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.
void PushItem(ITEM_PICKER &aItem)
Function PushItem adds aItem to the list of items.
void SCH_BASE_FRAME::CenterScreen ( const wxPoint aCenterPoint,
bool  aWarpPointer 
)
virtualinherited

Definition at line 467 of file sch_base_frame.cpp.

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::FindComponentAndItem(), SCH_EDIT_FRAME::OnFindDrcMarker(), and SCH_EDIT_FRAME::updateFindReplaceView().

468 {
469  GetCanvas()->GetView()->SetCenter( aCenterPoint );
470 
471  if( aWarpPointer )
472  GetCanvas()->GetViewControls()->WarpCursor( aCenterPoint, true );
473 
474  GetGalCanvas()->Refresh();
475 }
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:590
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
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:918
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

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

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

Parameters
aFileNameA wxFileName object containing the file name to check.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 585 of file eda_base_frame.cpp.

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

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

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

Definition at line 410 of file lib_edit_frame.cpp.

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

Referenced by GeneralControl(), and OnAddLibrary().

411 {
413 }
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:174
LIB_TREE * GetLibTree() const
SYMBOL_TREE_PANE * m_treePane
component search tree widget
void LIB_EDIT_FRAME::ClearTempCopyComponent ( )

Delete temporary copy of the current component and clear pointer.

Definition at line 984 of file lib_edit_frame.cpp.

References m_tempCopyComponent.

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

985 {
986  delete m_tempCopyComponent;
987  m_tempCopyComponent = NULL;
988 }
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
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 389 of file lib_edit_frame.h.

References OnModify().

390  {
391  // Generate a wxCloseEvent
392  Close( false );
393  }
void LIB_EDIT_FRAME::CommonSettingsChanged ( )
overridevirtual

Called after the preferences dialog is run.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1718 of file lib_edit_frame.cpp.

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

Referenced by IsEditingDrawItem().

1719 {
1721 
1722  ReCreateHToolbar();
1723  ReCreateVToolbar();
1725  Layout();
1726  SendSizeEvent();
1727 }
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
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.

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_BASE_FRAME::isAutoSaveRequired(), 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().

361 {
362  // KICAD_MANAGER_FRAME overrides this
363  wxConfigBase* ret = Kiface().KifaceSettings();
364  //wxASSERT( ret );
365  return ret;
366 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
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 269 of file eda_base_frame.h.

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(), and EDA_DRAW_FRAME::SaveSettings().

270  {
271  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
272  return baseCfgName;
273  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
void LIB_EDIT_FRAME::copySelectedItems ( )
private

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

Definition at line 497 of file block_libedit.cpp.

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

498 {
499  LIB_PART* part = GetCurPart();
500 
501  if( !part )
502  return;
503 
504  m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
505  m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
506 
507  for( LIB_ITEM& item : part->GetDrawItems() )
508  {
509  // We *do not* copy fields because they are unique for the whole component
510  // so skip them (do not duplicate) if they are flagged selected.
511  if( item.Type() == LIB_FIELD_T )
512  item.ClearFlags( SELECTED );
513 
514  if( !item.IsSelected() )
515  continue;
516 
517  // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
518  LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
519  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
520  ITEM_PICKER picker( copy, UR_NEW );
521  m_clipboard.PushItem( picker );
522  }
523 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
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_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
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
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.
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

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

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

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

Referenced by add_search_paths(), and findDialog().

1598 {
1599  DrawPageOnClipboard( this );
1600 
1601  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
1602  {
1603  // fixme-gal
1604  //if( GetScreen()->IsBlockActive() )
1605  //m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
1606 
1608  }
1609 }
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:123
void SCH_BASE_FRAME::createCanvas ( )
inherited

Definition at line 585 of file sch_base_frame.cpp.

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

586 {
588 
589  // Allows only a CAIRO or OPENGL canvas:
593 
594  m_canvas = new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
596 
597  m_useSingleCanvasPane = true;
598 
599  SetGalCanvas( static_cast<SCH_DRAW_PANEL*> (m_canvas) );
600  UseGalCanvas( true );
601 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:936
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:179
static 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:919
bool m_useSingleCanvasPane
Definition: draw_frame.h:98
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:123
LIB_ITEM * LIB_EDIT_FRAME::CreateGraphicItem ( LIB_PART LibEntry,
wxDC *  DC 
)
private

Definition at line 134 of file symbdraw.cpp.

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 IsEditingDrawItem(), and OnLeftClick().

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
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
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:123
void SetUnit(int aUnit)
static int m_unit
int GetToolId() const
Definition: draw_frame.h:519
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
LIB_ITEM * GetDrawItem() const
void SetIgnoreMouseEvents(bool aIgnore)
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:245
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
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.

References EDA_DRAW_FRAME::saveCanvasImageToFile().

Referenced by IsEditingDrawItem(), and OnPlotCurrentComponent().

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

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 IsEditingDrawItem(), and PlacePin().

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 }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_pin.cpp:1553
int GetUnit() const
const wxString & GetNumber() const
Definition: lib_pin.h:194
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
LIB_PART * GetParent() const
int GetUnitCount() const
void SetUnit(int aUnit)
bool SynchronizePins()
Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable b...
void LIB_EDIT_FRAME::CreatePin ( wxDC *  DC)
private

Definition at line 348 of file pinedit.cpp.

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 IsEditingDrawItem(), and OnLeftClick().

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
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
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
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
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:123
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:1597
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
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
void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

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

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

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

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_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(), IsEditingDrawItem(), OnLeftClick(), and Process_Special_Functions().

1379 {
1380  if( !aItem )
1381  return;
1382 
1383  m_canvas->CrossHairOff( aDC );
1384 
1385  LIB_PART* part = GetCurPart();
1386 
1387  SaveCopyInUndoList( part );
1388 
1389  if( aItem->Type() == LIB_PIN_T )
1390  {
1391  LIB_PIN* pin = static_cast<LIB_PIN*>( aItem );
1392  wxPoint pos = pin->GetPosition();
1393 
1394  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1395 
1396  // when pin editing is synchronized, all pins of the same body style are removed:
1397  if( SynchronizePins() )
1398  {
1399  int curr_convert = pin->GetConvert();
1400  LIB_PIN* next_pin = part->GetNextPin();
1401 
1402  while( next_pin != NULL )
1403  {
1404  pin = next_pin;
1405  next_pin = part->GetNextPin( pin );
1406 
1407  if( pin->GetPosition() != pos )
1408  continue;
1409 
1410  if( pin->GetConvert() != curr_convert )
1411  continue;
1412 
1413  part->RemoveDrawItem( pin );
1414  }
1415  }
1416  }
1417  else
1418  {
1419  if( m_canvas->IsMouseCaptured() )
1420  m_canvas->CallEndMouseCapture( aDC );
1421  else
1422  part->RemoveDrawItem( aItem, m_canvas, aDC );
1423  }
1424 
1425  SetDrawItem( NULL );
1426  m_lastDrawItem = NULL;
1427  OnModify();
1428  m_canvas->CrossHairOn( aDC );
1429 
1430  RebuildView();
1431  GetCanvas()->Refresh();
1432 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
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
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
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
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:123
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...
int GetConvert() const
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited
void LIB_EDIT_FRAME::DisplayCmpDoc ( )
private

Display the documentation of the selected component.

Definition at line 772 of file libedit.cpp.

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(), IsEditingDrawItem(), LoadOneLibraryPartAux(), OnEditComponentProperties(), OnLeftClick(), and OnSelectPart().

773 {
774  LIB_PART* part = GetCurPart();
775 
776  ClearMsgPanel();
777 
778  if( !part )
779  return;
780 
781  LIB_ALIAS* alias = part->GetAlias( part->GetName() );
782  wxString msg = part->GetName();
783 
784  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
785 
786  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
787  msg = UnitLetter[m_unit];
788 
789  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
790 
791  if( m_convert > 1 )
792  msg = _( "Convert" );
793  else
794  msg = _( "Normal" );
795 
796  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
797 
798  if( part->IsPower() )
799  msg = _( "Power Symbol" );
800  else
801  msg = _( "Symbol" );
802 
803  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
804  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
805  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
806  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
807 }
Definition: colors.h:57
Part library alias object definition.
static int m_convert
bool IsPower() const
LIB_ALIAS * GetAlias(size_t aIndex)
Definition: colors.h:61
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
const wxString & GetKeyWords() const
Definition: colors.h:59
Define a library symbol object.
const wxString & GetDescription() override
const wxString & GetDocFileName() const
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
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
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.

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

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:259
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
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
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
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
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane on the status bar.

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

References INCHES, EDA_DRAW_FRAME::m_UserUnits, and MILLIMETRES.

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

585 {
586  wxString msg;
587 
588  switch( m_UserUnits )
589  {
590  case INCHES: msg = _( "Inches" ); break;
591  case MILLIMETRES: msg = _( "mm" ); break;
592  default: msg = _( "Units" ); break;
593  }
594 
595  SetStatusText( msg, 4 );
596 }
Definition: common.h:160
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
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.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), and EDA_BASE_FRAME::onAutoSaveTimer().

224 {
225  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
226 }
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 1746 of file legacy_gal/eda_draw_frame.cpp.

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

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

1749 {
1751  return;
1752 
1753  const PAGE_INFO& pageInfo = GetPageSettings();
1754  wxSize pageSize = pageInfo.GetSizeMils();
1755 
1756  // if not printing, draw the page limits:
1757  if( !aScreen->m_IsPrinting && m_showPageLimits )
1758  {
1759  GRSetDrawMode( aDC, GR_COPY );
1760  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
1761  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
1763  }
1764 
1765  TITLE_BLOCK t_block = GetTitleBlock();
1766  COLOR4D color = COLOR4D( RED );
1767 
1768  wxPoint origin = aDC->GetDeviceOrigin();
1769 
1770  if( aScreen->m_IsPrinting && origin.y > 0 )
1771  {
1772  aDC->SetDeviceOrigin( 0, 0 );
1773  aDC->SetAxisOrientation( true, false );
1774  }
1775 
1776  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
1777  GetScreenDesc(), aFilename, t_block,
1778  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
1779  aLineWidth, aScalar, color, color, aSheetLayer );
1780 
1781  if( aScreen->m_IsPrinting && origin.y > 0 )
1782  {
1783  aDC->SetDeviceOrigin( origin.x, origin.y );
1784  aDC->SetAxisOrientation( true, true );
1785  }
1786 }
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:113
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
const wxSize & GetSizeMils() const
Definition: page_info.h:142
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
virtual wxString GetScreenDesc() const
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:143
Definition: colors.h:60
bool m_IsPrinting
Definition: base_screen.h:220
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:111
Definition: colors.h:49
int m_NumberOfScreens
Definition: base_screen.h:217
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void LIB_EDIT_FRAME::EditField ( LIB_FIELD Field)
private

Definition at line 42 of file libfield.cpp.

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 IsEditingDrawItem(), OnLeftDClick(), and Process_Special_Functions().

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:259
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
EDA_ITEM * GetParent() const
Definition: base_struct.h:211
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
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.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
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:1521
KIGFX::SCH_VIEW * GetView() const
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)...
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.
LIB_TREE * GetLibTree() const
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, LIB_ID_TYPE aType, bool aLib=false)
Replace illegal LIB_ID item name characters with underscores &#39;_&#39;.
Definition: lib_id.cpp:352
virtual void SetName(const wxString &aName)
SYMBOL_TREE_PANE * m_treePane
component search tree widget
#define VALUE
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:162
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. ...
void LIB_EDIT_FRAME::EditGraphicSymbol ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 54 of file symbdraw.cpp.

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 IsEditingDrawItem(), OnLeftDClick(), and Process_Special_Functions().

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.
virtual void SetWidth(int aWidth)=0
Set the width of the draw item to aWidth.
bool InEditMode() const
Return the draw item editing mode status.
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...
LIB_PART * GetParent() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
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:1521
KIGFX::SCH_VIEW * GetView() const
void SetFillMode(FILL_T aFillMode)
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
bool IsFillable() const
Check if draw object can be filled.
FILL_T
Enum FILL_T is the set of fill types used in plotting or drawing enclosed areas.
Definition: base_struct.h:54
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:120
void LIB_EDIT_FRAME::EditSymbolText ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 991 of file lib_edit_frame.cpp.

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(), IsEditingDrawItem(), OnLeftDClick(), and Process_Special_Functions().

992 {
993  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
994  return;
995 
996  // Deleting old text
997  if( DC && !DrawItem->InEditMode() )
998  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1000 
1001  DIALOG_LIB_EDIT_TEXT dlg( this, (LIB_TEXT*) DrawItem );
1002 
1003  if( dlg.ShowModal() != wxID_OK )
1004  return;
1005 
1006  GetCanvas()->GetView()->Update( DrawItem );
1007  GetCanvas()->Refresh();
1008  OnModify();
1009 
1010  // Display new text
1011  if( DC && !DrawItem->InEditMode() )
1012  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1013  NULL, DefaultTransform );
1014 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:74
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
Define a symbol library graphical text item.
Definition: lib_text.h:44
bool InEditMode() const
Return the draw item editing mode status.
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...
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:1521
KIGFX::SCH_VIEW * GetView() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
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.
void LIB_EDIT_FRAME::emptyScreen ( )
private

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

Definition at line 1705 of file lib_edit_frame.cpp.

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

Referenced by OnRemovePart(), and OnRevert().

1706 {
1707  SetCurLib( wxEmptyString );
1708  SetCurPart( nullptr );
1709  m_lastDrawItem = nullptr;
1710  SetDrawItem( NULL );
1713  Zoom_Automatique( false );
1714  Refresh();
1715 }
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.
void LIB_EDIT_FRAME::EndDrawGraphicItem ( wxDC *  DC)
private

Definition at line 306 of file symbdraw.cpp.

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(), EDA_DRAW_PANEL::SetMouseCapture(), wxPoint::x, and wxPoint::y.

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

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.
bool IsNew() const
Definition: base_struct.h:219
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
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
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:123
int GetToolId() const
Definition: draw_frame.h:519
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
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:918
#define DBG(x)
Definition: fctsys.h:33
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

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

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

Referenced by GERBVIEW_FRAME::SetCurItem().

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:163
void EraseMsgBox()
Definition: msgpanel.cpp:216
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 408 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

408 {}
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.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), and Prj().

Referenced by PANEL_HOTKEYS_EDITOR::installButtons(), and EDA_BASE_FRAME::SaveProjectSettings().

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:292
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
wxString GetMruPath() const
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 539 of file libedit.cpp.

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

540 {
541  wxString newName;
542 
543  for( unsigned int i = 0; i < aPart->GetAliasCount(); ++i )
544  {
545  LIB_ALIAS* alias = aPart->GetAlias( i );
546  int sfx = 0;
547  newName = alias->GetName();
548 
549  while( m_libMgr->PartExists( newName, aLibrary ) )
550  {
551  if( sfx == 0 )
552  newName = wxString::Format( "%s_copy", alias->GetName() );
553  else
554  newName = wxString::Format( "%s_copy%d", alias->GetName(), sfx );
555  ++sfx;
556  }
557 
558  if( i == 0 )
559  aPart->SetName( newName );
560  else
561  alias->SetName( newName );
562  }
563 }
Part library alias object definition.
LIB_ALIAS * GetAlias(size_t aIndex)
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
size_t GetAliasCount() const
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)
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 1570 of file legacy_gal/eda_draw_frame.cpp.

References DrawPageOnClipboard(), 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 findDialog(), 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().

1571 {
1572  if( aCenterView )
1573  {
1574  wxWindow* dialog = findDialog( GetChildren() );
1575 
1576  // If a dialog partly obscures the window, then center on the uncovered area.
1577  if( dialog )
1578  {
1579  wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
1580  dialog->GetSize() );
1581  GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
1582  }
1583  else
1584  GetGalCanvas()->GetView()->SetCenter( aPos );
1585  }
1586 
1587  if( aWarpCursor )
1589  else
1591 }
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)=0
Moves cursor to the requested position expressed in world coordinates.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:590
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_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:918
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 47 of file controller.cpp.

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

Referenced by OnAddLibrary().

48 {
49  // Filter out the 'fake' mouse motion after a keyboard movement
50  if( !aHotKey && m_movingCursorWithKeyboard )
51  {
53  return false;
54  }
55 
56  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
57  // for next cursor position
58  // ( shift or ctrl key down are PAN command with mouse wheel)
59  bool snapToGrid = true;
60 
61  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
62  snapToGrid = false;
63 
64  // Cursor is left off grid only if no block in progress
65  if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
66  snapToGrid = true;
67 
68  wxPoint pos = aPosition;
69  bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
70 
72  m_canvas->CrossHairOff( aDC );
73  else
74  m_canvas->CrossHairOn( aDC );
75 
76  SetCrossHairPosition( pos, snapToGrid );
77 
78  if( m_canvas->IsMouseCaptured() )
79  m_canvas->CallMouseCapture( aDC, aPosition, true );
80 
81  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition, NULL ) )
82  keyHandled = true;
83 
84  // Make sure current-part highlighting doesn't get lost in seleciton highlighting
86 
88 
89  return keyHandled;
90 }
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
void ClearSearchTreeSelection()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
int GetState(int type) const
Definition: base_struct.h:240
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:123
int GetToolId() const
Definition: draw_frame.h:519
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:173
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 1170 of file legacy_gal/eda_draw_frame.cpp.

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, EDA_DRAW_PANEL::MoveCursor(), wxPoint::x, and wxPoint::y.

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

1172 {
1173  bool key_handled = false;
1174 
1175  // If requested snap the current position to the grid
1176  if( aSnapToGrid )
1177  *aPos = GetNearestGridPosition( *aPos );
1178 
1179  switch( aHotKey )
1180  {
1181  // All these keys have almost the same treatment
1182  case GR_KB_CTRL | WXK_NUMPAD8:
1183  case GR_KB_CTRL | WXK_UP:
1184  case GR_KB_CTRL | WXK_NUMPAD2:
1185  case GR_KB_CTRL | WXK_DOWN:
1186  case GR_KB_CTRL | WXK_NUMPAD4:
1187  case GR_KB_CTRL | WXK_LEFT:
1188  case GR_KB_CTRL | WXK_NUMPAD6:
1189  case GR_KB_CTRL | WXK_RIGHT:
1190  case WXK_NUMPAD8:
1191  case WXK_UP:
1192  case WXK_NUMPAD2:
1193  case WXK_DOWN:
1194  case WXK_NUMPAD4:
1195  case WXK_LEFT:
1196  case WXK_NUMPAD6:
1197  case WXK_RIGHT:
1198  key_handled = true;
1199  {
1200  /* Here's a tricky part: when doing cursor key movement, the
1201  * 'previous' point should be taken from memory, *not* from the
1202  * freshly computed position in the event. Otherwise you can't do
1203  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1204  * the automatic motion event generated by cursor warping */
1205  wxRealPoint gridSize = GetScreen()->GetGridSize();
1206  *aPos = GetCrossHairPosition();
1207 
1208  // Bonus: ^key moves faster (x10)
1209  switch( aHotKey )
1210  {
1211  case GR_KB_CTRL|WXK_NUMPAD8:
1212  case GR_KB_CTRL|WXK_UP:
1213  aPos->y -= KiROUND( 10 * gridSize.y );
1214  break;
1215 
1216  case GR_KB_CTRL|WXK_NUMPAD2:
1217  case GR_KB_CTRL|WXK_DOWN:
1218  aPos->y += KiROUND( 10 * gridSize.y );
1219  break;
1220 
1221  case GR_KB_CTRL|WXK_NUMPAD4:
1222  case GR_KB_CTRL|WXK_LEFT:
1223  aPos->x -= KiROUND( 10 * gridSize.x );
1224  break;
1225 
1226  case GR_KB_CTRL|WXK_NUMPAD6:
1227  case GR_KB_CTRL|WXK_RIGHT:
1228  aPos->x += KiROUND( 10 * gridSize.x );
1229  break;
1230 
1231  case WXK_NUMPAD8:
1232  case WXK_UP:
1233  aPos->y -= KiROUND( gridSize.y );
1234  break;
1235 
1236  case WXK_NUMPAD2:
1237  case WXK_DOWN:
1238  aPos->y += KiROUND( gridSize.y );
1239  break;
1240 
1241  case WXK_NUMPAD4:
1242  case WXK_LEFT:
1243  aPos->x -= KiROUND( gridSize.x );
1244  break;
1245 
1246  case WXK_NUMPAD6:
1247  case WXK_RIGHT:
1248  aPos->x += KiROUND( gridSize.x );
1249  break;
1250 
1251  default: /* Can't happen since we entered the statement */
1252  break;
1253  }
1254 
1255  m_canvas->MoveCursor( *aPos );
1257  }
1258  break;
1259 
1260  default:
1261  break;
1262  }
1263 
1264  return key_handled;
1265 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
#define GR_KB_CTRL
virtual void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:173
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 217 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

217 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
wxAuiToolBar* EDA_DRAW_FRAME::GetAuxiliaryToolBar ( ) const
inlineinherited

Definition at line 478 of file draw_frame.h.

478 { 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:153
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 195 of file sch_base_frame.cpp.

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

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 485 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetGalCanvas().

Referenced by 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(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DrawMovePin(), EditField(), EditGraphicSymbol(), SCH_EDIT_FRAME::EditSheet(), EditSymbolText(), EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), 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::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(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), OnOpenPinTable(), OnOrient(), SCH_EDIT_FRAME::OnOrient(), OnRotate(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), SCH_EDIT_FRAME::OnSelectUnit(), LIB_VIEW_FRAME::OnShowElectricalType(), OnShowElectricalType(), 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(), 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_SETTINGS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::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(), and LIB_VIEW_FRAME::~LIB_VIEW_FRAME().

486 {
487  return static_cast<SCH_DRAW_PANEL*>( GetGalCanvas() );
488 }
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:918
void LIB_EDIT_FRAME::GetComponentFromRedoList ( wxCommandEvent &  event)
private

Definition at line 55 of file libedit_undo_redo.cpp.

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.

Referenced by IsEditingDrawItem().

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...
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
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.
UNDO_REDO_T GetStatus() const
void SetShowDeMorgan(bool show)
EDA_ITEM * GetItem() const
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
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.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
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:772
void updateTitle()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:58
LIB_TREE * GetLibTree() const
ITEM_PICKER PopItem()
Function PopItem.
const wxString & GetName() const
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
SYMBOL_TREE_PANE * m_treePane
component search tree widget
void UpdatePartSelectList()
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:162
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. ...
void LIB_EDIT_FRAME::GetComponentFromUndoList ( wxCommandEvent &  event)
private

Definition at line 104 of file libedit_undo_redo.cpp.

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.

Referenced by IsEditingDrawItem().

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 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
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.
UNDO_REDO_T GetStatus() const
void SetShowDeMorgan(bool show)
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted...
EDA_ITEM * GetItem() const
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
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.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
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:772
void updateTitle()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:58
LIB_TREE * GetLibTree() 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.
const wxString & GetName() const
#define UR_TRANSIENT
indicates the item is owned by the undo/redo stack
Definition: base_struct.h:142
SYMBOL_TREE_PANE * m_treePane
component search tree widget
void UpdatePartSelectList()
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:162
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. ...
int LIB_EDIT_FRAME::GetConvert ( )
inline
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 1069 of file legacy_gal/eda_draw_frame.cpp.

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::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(), PL_EDITOR_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_PANEL::GetScreen(), 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(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), 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().

1070 {
1072  return wxPoint( cursor.x, aInvertY ? -cursor.y : cursor.y );
1073 }
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
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:918
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 1105 of file legacy_gal/eda_draw_frame.cpp.

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

1106 {
1107  BASE_SCREEN* screen = GetScreen(); // virtual call
1108  return screen->getCrossHairScreenPosition();
1109 }
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:397
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
wxString LIB_EDIT_FRAME::GetCurLib ( ) const

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

Definition at line 895 of file lib_edit_frame.cpp.

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

896 {
897  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
898 
899  if( !libNickname.empty() )
900  {
901  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
902  {
903  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
904  libNickname = wxEmptyString;
905  }
906  }
907 
908  return libNickname;
909 }
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
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 168 of file lib_edit_frame.h.

References m_my_part, and SetCurPart().

Referenced by BestZoom(), copySelectedItems(), CreatePin(), deleteItem(), DisplayCmpDoc(), DrawMovingBlockOutlines(), EndDrawGraphicItem(), GetComponentFromRedoList(), GetComponentFromUndoList(), GetDocumentExtents(), getTargetLibId(), getTargetPart(), GlobalSetPins(), HandleBlockEnd(), HandleBlockPlace(), 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(), TempCopyComponent(), UpdatePartSelectList(), and updateTitle().

169  {
170  return m_my_part;
171  }
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
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 1090 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

1091 {
1092  BASE_SCREEN* screen = GetScreen(); // virtual call
1093  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1094 }
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units...
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:397
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.
static int LIB_EDIT_FRAME::GetDefaultPinLength ( )
inlinestatic
Returns
The default pin len setting.

Definition at line 190 of file lib_edit_frame.h.

References m_defaultPinLength.

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

190 { return m_defaultPinLength; }
static int m_defaultPinLength
Default pin length.
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 931 of file draw_frame.h.

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

931 { return NULL; }
const BOX2I LIB_EDIT_FRAME::GetDocumentExtents ( ) const
overridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1770 of file lib_edit_frame.cpp.

References boundingBox(), GetCurPart(), EDA_RECT::GetHeight(), EDA_RECT::GetOrigin(), LIB_PART::GetUnitBoundingBox(), EDA_RECT::GetWidth(), m_convert, and m_unit.

Referenced by IsEditingDrawItem().

1771 {
1772  LIB_PART* part = GetCurPart();
1773 
1774  if( !part )
1775  {
1776  return BOX2I( VECTOR2I(-100, -100), VECTOR2I( 200, 200 ) );
1777  }
1778  else
1779  {
1781  return BOX2I( boundingBox.GetOrigin(), VECTOR2I( boundingBox.GetWidth(), boundingBox.GetHeight() ) );
1782  }
1783 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
const wxPoint GetOrigin() const
Definition: eda_rect.h:112
static int m_convert
int GetHeight() const
Definition: eda_rect.h:118
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Define a library symbol object.
static int m_unit
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited
wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 477 of file draw_frame.h.

477 { 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:157
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.

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(), GERBVIEW_FRAME::OnZipFileHistory(), and EDA_BASE_FRAME::SaveProjectSettings().

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
FILL_T LIB_EDIT_FRAME::GetFillStyle ( void  )
inline

Definition at line 436 of file lib_edit_frame.h.

References m_drawFillStyle, RestoreComponent(), and TempCopyComponent().

436 { return m_drawFillStyle; }
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
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 918 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL(), DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_TOOL::canvas(), 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::IFACE::CreateWindow(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), PCB_EDIT_FRAME::Edit_Zone_Params(), EndDrawGraphicItem(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), findDialog(), EDA_DRAW_FRAME::FocusOnLocation(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_PANEL::GetGrid(), 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::loadListOfGerberFiles(), 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(), EDA_DRAW_PANEL::OnPaint(), 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(), SCH_BASE_FRAME::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(), DIALOG_PAD_PROPERTIES::prepareCanvas(), Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), processBoardItem(), TOOL_MANAGER::ProcessEvent(), 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(), SELECTION_TOOL::RequestSelection(), 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(), EDA_DRAW_FRAME::SwitchCanvas(), SCH_BASE_FRAME::SyncView(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_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(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

918 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame&#39;s interface to setting GAL display options.
Definition: draw_frame.h:91
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 545 of file draw_frame.h.

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

546  {
547  return m_gridColor;
548  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:112
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  }
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 643 of file legacy_gal/eda_draw_frame.cpp.

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

644 {
645  wxPoint pos = aPosition;
646 
647  if( m_currentScreen != NULL && m_snapToGrid )
648  pos = GetNearestGridPosition( aPosition );
649 
650  return pos;
651 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:87
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:89
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

Return a structure containing currently used hotkey mapping.

Definition at line 431 of file draw_frame.h.

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

431 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:105
EDA_HOTKEY * LIB_EDIT_FRAME::GetHotKeyDescription ( int  aCommand) const
overridevirtual

>

Search lists of hot key identifiers (HK_xxx) used in the frame to find a matching hot key descriptor.

Parameters
aCommandis the hot key identifier.
Returns
Hot key descriptor or NULL if none found.

Implements EDA_DRAW_FRAME.

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

References GetDescriptorFromCommand().

Referenced by OnAddLibrary().

666 {
667  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
668 
669  if( HK_Descr == NULL )
670  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
671 
672  return HK_Descr;
673 }
static EDA_HOTKEY * common_Hotkey_List[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
static EDA_HOTKEY * libEdit_Hotkey_List[]
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 506 of file eda_base_frame.cpp.

References ShowAboutDialog().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

507 {
508  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
509  ShowAboutDialog( this );
510 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 493 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

494 {
495  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
496  {
497  wxString msg;
498  msg.Printf( _( "Could not launch the default browser.\n"
499  "For information on how to help the KiCad project, visit %s" ),
501  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
502  }
503 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 432 of file eda_base_frame.cpp.

References DIM, Format(), GetAssociatedDocument(), GetChars(), EDA_BASE_FRAME::help_name(), numEval::SearchHelpFileFullPath(), and EDA_BASE_FRAME::sys_search().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

433 {
434  const SEARCH_STACK& search = sys_search();
435 
436  /* We have to get document for beginners,
437  * or the full specific doc
438  * if event id is wxID_INDEX, we want the document for beginners.
439  * else the specific doc file (its name is in Kiface().GetHelpFileName())
440  * The document for beginners is the same for all KiCad utilities
441  */
442  if( event.GetId() == wxID_INDEX )
443  {
444  // List of possible names for Getting Started in KiCad
445  const wxChar* names[2] = {
446  wxT( "getting_started_in_kicad" ),
447  wxT( "Getting_Started_in_KiCad" )
448  };
449 
450  wxString helpFile;
451  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
452  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
453  for( unsigned ii = 0; ii < DIM( names ); ii++ )
454  {
455  helpFile = SearchHelpFileFullPath( search, names[ii] );
456 
457  if( !helpFile.IsEmpty() )
458  break;
459  }
460 
461  if( !helpFile )