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
 (Re)Create the menubar for the part editor frame More...
 
void InstallConfigFrame (wxCommandEvent &event)
 
void OnPreferencesOptions (wxCommandEvent &event)
 
void Process_Config (wxCommandEvent &event)
 
bool SynchronizePins ()
 Pin edition (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 OnSaveLibrary (wxCommandEvent &event)
 The command event handler to save the changes to the current library. More...
 
void OnSaveAllLibraries (wxCommandEvent &event)
 Saves all changes in modified libraries. More...
 
void OnRevertLibrary (wxCommandEvent &aEvent)
 Reverts unsaved changes in a 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 OnSavePart (wxCommandEvent &aEvent)
 Saves a single part in the selected library. More...
 
void OnRevertPart (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 OnCopyCutPart (wxCommandEvent &aEvent)
 
void OnPasteDuplicatePart (wxCommandEvent &aEvent)
 
void OnSelectAlias (wxCommandEvent &event)
 
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 InstallFieldsEditorDialog (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 OnUpdatePartModified (wxUpdateUIEvent &aEvent)
 
void OnUpdateLibModified (wxUpdateUIEvent &aEvent)
 
void OnUpdateClipboardNotEmpty (wxUpdateUIEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &event)
 
void OnUpdateRedo (wxUpdateUIEvent &event)
 
void OnUpdateSaveLib (wxUpdateUIEvent &event)
 
void OnUpdateSaveLibAs (wxUpdateUIEvent &event)
 
void OnUpdateViewDoc (wxUpdateUIEvent &event)
 
void OnUpdateSyncPinEdit (wxUpdateUIEvent &event)
 
void OnUpdatePinTable (wxUpdateUIEvent &event)
 
void OnUpdatePartNumber (wxUpdateUIEvent &event)
 
void OnUpdateDeMorganNormal (wxUpdateUIEvent &event)
 
void OnUpdateDeMorganConvert (wxUpdateUIEvent &event)
 
void OnUpdateSelectAlias (wxUpdateUIEvent &event)
 
void OnUpdateElectricalType (wxUpdateUIEvent &aEvent)
 
void UpdateAliasSelectList ()
 
void UpdatePartSelectList ()
 
void DisplayLibInfos ()
 Updates the main window title bar with the current library name and read only status of the library. More...
 
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
 Function GeneralControl performs 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...
 
const wxString & GetAliasName ()
 
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)
 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 CreatePNGorJPEGFile (const wxString &aFileName, bool aFmt_jpeg)
 Creates an image (screenshot) of the current component in PNG or JPEG format. 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 aLoad)
 Synchronize the library manager and the symbol library table. More...
 
int GetIconScale () override
 Function GetIconScale. More...
 
void SetIconScale (int aScale) override
 Function SetIconScale. More...
 
SCH_SCREENGetScreen () const override
 Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives. More...
 
const wxPoint GetRepeatStep () const
 
void SetRepeatStep (const wxPoint &aStep)
 Sets the repeat step value for repeat command. More...
 
int GetRepeatDeltaLabel () const
 
void SetRepeatDeltaLabel (int aDelta)
 Sets the repeat delta label value for repeat command. More...
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
COLOR4D GetDrawBgColor () const override
 
void SetDrawBgColor (COLOR4D aColor) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Function UpdateStatusBar updates the status bar information. More...
 
COMPONENT_SELECTION SelectComponentFromLibrary (const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
LIB_ALIASGetLibAlias (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 Load symbol from symbol library table. More...
 
LIB_PARTGetLibPart (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
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 ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 Function IsGridVisible() , virtual. More...
 
virtual void SetGridVisibility (bool aVisible)
 Function SetGridVisibility() , virtual It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 Function GetGridColor() , virtual. More...
 
virtual void SetGridColor (COLOR4D aColor)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Function SyncMenusAndToolbars Updates the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
VTBL_ENTRY bool 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...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static int GetPinNumDefaultSize ()
 
static int GetPinNameDefaultSize ()
 
static int GetDefaultPinLength ()
 
static void SetDefaultPinLength (int aLength)
 Set the default pin len. More...
 

Protected Member Functions

void OnOpenLibraryViewer (wxCommandEvent &event)
 Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (wxString &aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Select a component from the list of components in a library. More...
 
wxString SelectLibraryFromList ()
 Dispaly a list of loaded libraries in the symbol library and allows the user to select a library. More...
 
bool SelectPartNameToLoad (wxString &aLibrary, wxString &aBufName)
 Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a library. More...
 
bool saveSymbolLibTables (bool aGlobal, bool aProject)
 Saves Symbol Library Tables to disk. More...
 
void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
virtual void unitsChangeRefresh ()
 Function unitsChangeRefresh is called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting () const
 Returns the canvas type stored in the application settings. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual 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

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

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

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

Key in KifaceSettings to store the canvas type.

More...
 

Private Member Functions

LIB_ITEMlocateItem (const wxPoint &aPosition, const KICAD_T aFilterList[])
 
void loadPart (const wxString &aLibrary, const wxString &aPart, int Unit)
 
bool saveLibrary (const wxString &aLibrary, bool aNewFile)
 Saves the changes to the current 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)
 Create a copy of aLibEntry into memory. More...
 
void DisplayCmpDoc ()
 Display the documentation of the selected component. More...
 
void OnRotateItem (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 ()
 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 aClosing)
 
bool addLibraryFile (bool aCreateNew)
 

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

More...
 
wxFileName getLibraryFileName (bool aExisting)
 

Displays a file browser dialog to select a library file.

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...
 
wxComboBox * m_aliasSelectBox
 a box to select the alias to edit (if any) More...
 
CMP_TREE_PANEm_treePane
 component search tree widget More...
 
LIB_MANAGERm_libMgr
 manager taking care of temporary modificatoins More...
 
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...
 
std::unique_ptr< LIB_PARTm_copiedPart
 

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 wxString m_aliasName
 
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 58 of file lib_edit_frame.h.

Member Typedef Documentation

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

Definition at line 171 of file sch_base_frame.h.

Constructor & Destructor Documentation

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

Definition at line 206 of file lib_edit_frame.cpp.

References EDA_BASE_FRAME::config(), DEFAULT_REPEAT_OFFSET_PIN, DisplayCmpDoc(), DisplayLibInfos(), g_Libedit_Hokeys_Descr, LIB_PART::GetAlias(), GetCurPart(), GetDefaultTextSize(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), EDA_PANEINFO::HorizontalToolbarPane(), ID_EDIT_SYM_LIB_TABLE, ID_POPUP_GRID_LEVEL_1, ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_50, ID_ZOOM_PAGE, KiBitmap(), PCAD2KICAD::Left, LoadSettings(), m_aliasName, EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_canvas, BASE_SCREEN::m_Center, m_drawSpecificConvert, m_drawSpecificUnit, EDA_DRAW_FRAME::m_drawToolBar, m_dummyScreen, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_DRAW_FRAME::m_hotkeysDescrList, EDA_DRAW_FRAME::m_LastGridSizeId, m_libMgr, EDA_BASE_FRAME::m_mainToolBar, EDA_DRAW_FRAME::m_messagePanel, m_my_part, EDA_DRAW_FRAME::m_optionsToolBar, m_repeatPinStep, EDA_DRAW_FRAME::m_showAxis, m_syncPinEdit, m_tempCopyComponent, m_textSize, m_treePane, EDA_DRAW_FRAME::m_UndoRedoCountMax, EDA_PANEINFO::MessageToolbarPane(), OnEditSymbolLibTable(), ReCreateHToolbar(), ReCreateMenuBar(), ReCreateOptToolbar(), ReCreateVToolbar(), PCAD2KICAD::Right, EDA_DRAW_FRAME::SetCrossHairPosition(), EDA_DRAW_PANEL::SetEnableBlockCommands(), BASE_SCREEN::SetGrid(), BASE_SCREEN::SetMaxUndoItems(), EDA_DRAW_FRAME::SetScreen(), SetShowDeMorgan(), SetShowElectricalType(), SyncLibraries(), UpdateAliasSelectList(), UpdatePartSelectList(), EDA_PANEINFO::VerticalToolbarPane(), wxPoint::x, and wxPoint::y.

206  :
207  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
208  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
209 {
210  m_showAxis = true; // true to draw axis
211  SetShowDeMorgan( false );
212  m_drawSpecificConvert = true;
213  m_drawSpecificUnit = false;
215  m_syncPinEdit = false;
217  SetShowElectricalType( true );
218 
219  m_my_part = NULL;
220  m_tempCopyComponent = NULL;
221  m_treePane = nullptr;
222  m_libMgr = nullptr;
223 
224  // Delayed initialization
225  if( m_textSize == -1 )
227 
228  // Initialize grid id to the default value 50 mils:
230 
231  wxIcon icon;
232  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
233  SetIcon( icon );
234 
235  LoadSettings( config() );
236 
237  m_dummyScreen = new SCH_SCREEN( aKiway );
239  GetScreen()->m_Center = true;
241 
242  SetCrossHairPosition( wxPoint( 0, 0 ) );
243 
244  // Ensure m_LastGridSizeId is an offset inside the allowed schematic range
245  if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
247 
248  if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
250 
251  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
252 
253  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
254 
255  if( m_canvas )
257 
258  m_libMgr = new LIB_MANAGER( *this );
259  SyncLibraries( true );
260  m_treePane = new CMP_TREE_PANE( this, m_libMgr );
261 
262  ReCreateMenuBar();
265 
266  // Ensure the current alias name is valid if a part is loaded
267  // Sometimes it is not valid. This is the case
268  // when a part value (the part lib name), or the alias list was modified
269  // during a previous session and the modifications not saved in lib.
270  // Reopen libedit in a new session gives a non valid m_aliasName
271  // because the curr part is reloaded from the library (and this is the unmodified part)
272  // and the old alias name (from the previous edition) can be invalid
273  LIB_PART* part = GetCurPart();
274 
275  if( part == NULL )
276  m_aliasName.Empty();
277  else if( m_aliasName != part->GetName() )
278  {
279  LIB_ALIAS* alias = part->GetAlias( m_aliasName );
280 
281  if( !alias )
282  m_aliasName = part->GetName();
283  }
284 
286  DisplayLibInfos();
287  DisplayCmpDoc();
290 
291  m_auimgr.SetManagedWindow( this );
292 
293  EDA_PANEINFO horiz;
294  horiz.HorizontalToolbarPane();
295 
296  EDA_PANEINFO vert;
297  vert.VerticalToolbarPane();
298 
299  EDA_PANEINFO mesg;
300  mesg.MessageToolbarPane();
301 
302  m_auimgr.AddPane( m_mainToolBar,
303  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
304 
305  m_auimgr.AddPane( m_drawToolBar,
306  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right() );
307 
308  m_auimgr.AddPane( m_optionsToolBar,
309  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ).Left().Row( 0 ) );
310 
311  m_auimgr.AddPane( m_canvas,
312  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
313 
314  m_auimgr.AddPane( m_messagePanel,
315  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
316 
317  m_auimgr.AddPane( m_treePane, wxAuiPaneInfo().Name( "ComponentTree" ).Left().Row( 1 )
318  .Resizable().MinSize( 250, 400 ).Dock().CloseButton( false ) );
319 
320  m_auimgr.Update();
321 
322  Raise();
323  Show( true );
324 
325  Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
327 
328  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
329  wxPostEvent( this, evt );
330 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Part library alias object definition.
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void ReCreateOptToolbar()
Definition: tool_lib.cpp:241
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:108
LIB_ALIAS * GetAlias(size_t aIndex)
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
bool m_syncPinEdit
Set to true to not synchronize pins at the same position when editing symbols with multiple units or ...
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:159
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
#define DEFAULT_REPEAT_OFFSET_PIN
the default value (overwritten by the eeschema config)
Definition: general.h:50
wxAuiManager m_auimgr
void UpdateAliasSelectList()
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Specialization of the wxAuiPaneInfo class for KiCad panels.
void SetShowDeMorgan(bool show)
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:58
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:138
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:81
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void ReCreateMenuBar() override
(Re)Create the menubar for the part editor frame
bool m_Center
Center on screen.
Definition: base_screen.h:202
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:141
Define a library symbol object.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:94
static int m_textSize
The current text size setting.
int m_LastGridSizeId
Definition: draw_frame.h:83
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:135
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:656
void SetShowElectricalType(bool aShow)
Class to handle modifications to the symbol libraries.
Definition: lib_manager.h:49
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
void ReCreateHToolbar() override
Definition: tool_lib.cpp:103
static wxString m_aliasName
#define LIB_EDIT_FRAME_NAME
Library Editor pane with component tree and symbol library table selector.
Definition: cmp_tree_pane.h:40
void SetMaxUndoItems(int aMax)
Definition: base_screen.h:313
void SyncLibraries(bool aLoad)
Synchronize the library manager and the symbol library table.
void SetEnableBlockCommands(bool aEnable)
int m_repeatPinStep
Default repeat offset for pins in repeat place pin.
const wxString & GetName() const
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
bool m_drawSpecificConvert
Convert of the item currently being drawn.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
void UpdatePartSelectList()
int GetDefaultTextSize()
Default size for text in general.
CMP_TREE_PANE * m_treePane
component search tree widget
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
void ReCreateVToolbar() override
Definition: tool_lib.cpp:48
LIB_EDIT_FRAME::~LIB_EDIT_FRAME ( )

Definition at line 333 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 EDA_DRAW_FRAME::SetScreen().

334 {
335  Unbind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
337 
338  // current screen is destroyed in EDA_DRAW_FRAME
340 
341  m_lastDrawItem = NULL;
343 
344  delete m_tempCopyComponent;
345  delete m_libMgr;
346  delete m_my_part;
347 }
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:159
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
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 1524 of file lib_edit_frame.cpp.

References LIB_MANAGER::AddLibrary(), LIB_MANAGER::CreateLibrary(), DisplayError(), Format(), GetChars(), SYMBOL_LIB_TABLE::GetGlobalLibTable(), getLibraryFileName(), LIB_MANAGER::LibraryExists(), m_libMgr, SCH_BASE_FRAME::saveSymbolLibTables(), and selectSymLibTable().

Referenced by OnAddLibrary(), and OnCreateNewLibrary().

1525 {
1526  wxFileName fileName = getLibraryFileName( !aCreateNew );
1527  wxString libName = fileName.GetName();
1528  bool res = false;
1529 
1530  if( libName.IsEmpty() )
1531  return false;
1532 
1533  if( m_libMgr->LibraryExists( libName ) )
1534  {
1535  DisplayError( this,
1536  wxString::Format( _( "Library \"%s\" already exists" ), GetChars( libName ) ) );
1537  return false;
1538  }
1539 
1540  // Select the target library table (global/project)
1541  SYMBOL_LIB_TABLE* libTable = selectSymLibTable();
1542 
1543  if( !libTable )
1544  return false;
1545 
1546  if( aCreateNew )
1547  {
1548  res = m_libMgr->CreateLibrary( fileName.GetFullPath(), libTable );
1549 
1550  if( !res )
1551  DisplayError( this, _( "Could not create the library file. Check write permission." ) );
1552  }
1553  else
1554  {
1555  res = m_libMgr->AddLibrary( fileName.GetFullPath(), libTable );
1556 
1557  if( !res )
1558  DisplayError( this, _( "Could not open the library file." ) );
1559  }
1560 
1561  bool globalTable = ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
1562  saveSymbolLibTables( globalTable, !globalTable );
1563 
1564  return res;
1565 }
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
SYMBOL_LIB_TABLE * selectSymLibTable()
Displays a dialog asking the user to select a symbol library table.
bool AddLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Adds an existing library.
Definition: lib_manager.h:99
wxFileName getLibraryFileName(bool aExisting)
Displays a file browser dialog to select a library file.
bool LibraryExists(const wxString &aLibrary) const
Returns true if library exists.
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
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 DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

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

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

Definition at line 693 of file eda_base_frame.cpp.

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

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

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

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

Parameters
aMasterMenu= the menu to populate.

Definition at line 266 of file zoom.cpp.

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

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

Definition at line 970 of file draw_frame.cpp.

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

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

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

Append a message to the message panel.

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

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

Definition at line 812 of file draw_frame.cpp.

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

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

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

Creates a backup copy of a file with requested extension

Definition at line 1702 of file lib_edit_frame.cpp.

References DisplayError().

Referenced by saveLibrary().

1703 {
1704  if( aOriginalFile.FileExists() )
1705  {
1706  wxFileName backupFileName( aOriginalFile );
1707  backupFileName.SetExt( "bck" );
1708 
1709  if( backupFileName.FileExists() )
1710  wxRemoveFile( backupFileName.GetFullPath() );
1711 
1712  if( !wxCopyFile( aOriginalFile.GetFullPath(), backupFileName.GetFullPath() ) )
1713  {
1714  DisplayError( this, _( "Failed to save backup document to file " ) +
1715  backupFileName.GetFullPath() );
1716  return false;
1717  }
1718  }
1719 
1720  return true;
1721 }
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

Definition at line 86 of file zoom.cpp.

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

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

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

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

Implements EDA_DRAW_FRAME.

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

360 {
361  LIB_PART* part = GetCurPart();
362  double defaultLibraryZoom = 7.33;
363 
364  if( !part )
365  {
366  SetScrollCenterPosition( wxPoint( 0, 0 ) );
367  return defaultLibraryZoom;
368  }
369 
371 
372  double sizeX = (double) boundingBox.GetWidth();
373  double sizeY = (double) boundingBox.GetHeight();
374  wxPoint centre = boundingBox.Centre();
375 
376  // Reserve a 20% margin around component bounding box.
377  double margin_scale_factor = 1.2;
378 
379  return bestZoom( sizeX, sizeY, margin_scale_factor, centre);
380 }
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)
Definition: zoom.cpp:86
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
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 44 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().

45 {
46  int cmd = BLOCK_IDLE;
47 
48  switch( key )
49  {
50  default:
51  cmd = key & 0xFF;
52  break;
53 
54  case EDA_KEY_C( 0xffffffff ): // -1
55  // Historically, -1 has been used as a key, which can cause bit flag
56  // clashes with unaware code. On debug builds, catch any old code that
57  // might still be doing this. TODO: remove if sure all this old code is gone.
58  wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
59  // fall through on release builds
60 
61  case GR_KEY_INVALID:
63  break;
64 
65  case GR_KEY_NONE:
66  cmd = BLOCK_MOVE;
67  break;
68 
69  case GR_KB_SHIFT:
70  cmd = BLOCK_DUPLICATE;
71  break;
72 
73  case GR_KB_ALT:
74  cmd = BLOCK_ROTATE;
75  break;
76 
77  case GR_KB_SHIFTCTRL:
78  cmd = BLOCK_DELETE;
79  break;
80 
81  case GR_KB_CTRL:
82  cmd = BLOCK_MIRROR_Y;
83  break;
84 
85  case MOUSE_MIDDLE:
86  cmd = BLOCK_ZOOM;
87  break;
88  }
89 
90  return cmd;
91 }
#define GR_KB_ALT
Definition: common.h:65
#define GR_KEY_INVALID
Definition: common.h:69
#define GR_KB_SHIFT
Definition: common.h:66
#define GR_KB_SHIFTCTRL
Definition: common.h:67
#define GR_KEY_NONE
Definition: common.h:70
#define MOUSE_MIDDLE
Definition: common.h:68
#define EDA_KEY_C
Definition: common.h:60
#define GR_KB_CTRL
Definition: common.h:64
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

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

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

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

Definition at line 598 of file eda_base_frame.cpp.

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

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

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

Definition at line 467 of file lib_edit_frame.cpp.

References CMP_TREE_PANE::GetCmpTree(), m_treePane, and COMPONENT_TREE::Unselect().

Referenced by OnAddLibrary().

468 {
470 }
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
COMPONENT_TREE * GetCmpTree() const
Definition: cmp_tree_pane.h:46
CMP_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 1079 of file lib_edit_frame.cpp.

References m_tempCopyComponent.

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

1080 {
1081  delete m_tempCopyComponent;
1082  m_tempCopyComponent = NULL;
1083 }
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 407 of file lib_edit_frame.h.

References OnModify().

408  {
409  // Generate a wxCloseEvent
410  Close( false );
411  }
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

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

Definition at line 260 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
wxString EDA_DRAW_FRAME::CoordinateToString ( int  aValue,
bool  aConvertToMils = false 
) const
inherited

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

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

Definition at line 871 of file draw_frame.cpp.

References CoordinateToString().

Referenced by getOptimalModulePlacement().

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

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

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

376 {
377  LIB_PART* part = GetCurPart();
378 
379  if( !part )
380  return;
381 
382  m_clipboard.ClearListAndDeleteItems(); // delete previous saved list, if exists
383  m_clipboard.SetLastCursorPosition( GetScreen()->m_BlockLocate.GetEnd() ); // store the reference point
384 
385  for( LIB_ITEM& item : part->GetDrawItems() )
386  {
387  // We *do not* copy fields because they are unique for the whole component
388  // so skip them (do not duplicate) if they are flagged selected.
389  if( item.Type() == LIB_FIELD_T )
390  item.ClearFlags( SELECTED );
391 
392  if( !item.IsSelected() )
393  continue;
394 
395  // Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
396  LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
397  copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
398  ITEM_PICKER picker( copy, UR_NEW );
399  m_clipboard.PushItem( picker );
400  }
401 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
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
Function GetScreen returns 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:66
#define SELECTED
Definition: base_struct.h:116
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:264
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:137
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

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

Definition at line 42 of file copy_to_clipboard.cpp.

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

Referenced by add_search_paths().

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

Definition at line 153 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(), 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(), SymbolDisplayDraw(), and EDA_ITEM::Type().

Referenced by IsEditingDrawItem(), and OnLeftClick().

154 {
155  LIB_ITEM* item = GetDrawItem();
157  wxPoint drawPos = GetCrossHairPosition( true );
158 
159  // no temp copy -> the current version of symbol will be used for Undo
160  // This is normal when adding new items to the current symbol
162 
163  switch( GetToolId() )
164  {
166  item = new LIB_ARC( LibEntry );
167  break;
168 
170  item = new LIB_CIRCLE( LibEntry );
171  break;
172 
174  item = new LIB_RECTANGLE( LibEntry );
175  break;
176 
178  item = new LIB_POLYLINE( LibEntry );
179  break;
180 
182  {
183  LIB_TEXT* text = new LIB_TEXT( LibEntry );
184  text->SetTextSize( wxSize( m_textSize, m_textSize ) );
186 
187  // Enter the graphic text info
189  EditSymbolText( NULL, text );
190 
191  m_canvas->SetIgnoreMouseEvents( false );
193 
194  if( text->GetText().IsEmpty() )
195  {
196  delete text;
197  item = NULL;
198  }
199  else
200  {
201  item = text;
202  }
203  }
204  break;
205 
206  default:
207  DisplayError( this, wxT( "LIB_EDIT_FRAME::CreateGraphicItem() error" ) );
208  return NULL;
209  }
210 
211  if( item )
212  {
213  item->BeginEdit( IS_NEW, drawPos );
214 
215  // Don't set line parameters for text objects.
216  if( item->Type() != LIB_TEXT_T )
217  {
218  item->SetWidth( m_drawLineWidth );
219  item->SetFillMode( m_drawFillStyle );
220  }
221 
222  if( m_drawSpecificUnit )
223  item->SetUnit( m_unit );
224 
226  item->SetConvert( m_convert );
227 
228  // Draw initial symbol:
229  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
230  }
231  else
232  {
234  return NULL;
235  }
236 
238  m_canvas->SetIgnoreMouseEvents( false );
239  SetDrawItem( item );
240 
241  return item;
242 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:154
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
static double m_current_text_angle
Current text angle setting.
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.
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:212
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:66
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
void SetDrawItem(LIB_ITEM *drawItem)
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
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.
static void AbortSymbolTraceOn(EDA_DRAW_PANEL *Panel, wxDC *DC)
Definition: symbdraw.cpp:130
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:98
void SetUnit(int aUnit)
static int m_unit
int GetToolId() const
Definition: draw_frame.h:488
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
LIB_ITEM * GetDrawItem() const
void SetIgnoreMouseEvents(bool aIgnore)
static void SymbolDisplayDraw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Manage mouse events when creating new graphic object or modifying an graphic object.
Definition: symbdraw.cpp:329
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
bool m_drawSpecificConvert
Convert of the item currently being drawn.
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
bool 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:185
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
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 495 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().

496 {
497  int ii;
498  LIB_PIN* newPin;
499 
500  // if "synchronize pins edition" option is off, do not create any similar pin for other
501  // units and/or shapes: each unit is edited regardless other units or body
502  if( !SynchronizePins() )
503  return;
504 
505  if( aPin->GetUnit() == 0 ) // Pin common to all units: no need to create similar pins.
506  return;
507 
508  // When units are interchangeable, all units are expected to have similar pins
509  // at the same position
510  // to facilitate pin edition, create pins for all other units for the current body style
511  // at the same position as aPin
512 
513  for( ii = 1; ii <= aPin->GetParent()->GetUnitCount(); ii++ )
514  {
515  if( ii == aPin->GetUnit() )
516  continue;
517 
518  newPin = (LIB_PIN*) aPin->Clone();
519 
520  // To avoid mistakes, gives this pin a new pin number because
521  // it does no have the save pin number as the master pin
522  // Because we do not know the actual number, give it a temporary number
523  wxString unknownNum;
524  unknownNum.Printf( "%s-U%c", aPin->GetNumber(), wxChar( 'A' + ii - 1 ) );
525  newPin->SetNumber( unknownNum );
526 
527  newPin->SetUnit( ii );
528  aPin->GetParent()->AddDrawItem( newPin );
529  }
530 }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_pin.cpp:1543
int GetUnit() const
const wxString & GetNumber() const
Definition: lib_pin.h:193
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 edition (add, delete, move...) can be synchronized between units when units are interchangeable b...
void LIB_EDIT_FRAME::CreatePin ( wxDC *  DC)
private

Definition at line 428 of file pinedit.cpp.

References AbortPinMove(), LIB_PART::ClearStatus(), ClearTempCopyComponent(), DefaultTransform, deleteItem(), LIB_ITEM::Draw(), DrawMovePin(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetCurPart(), EDA_ITEM::GetFlags(), GetLastPinLength(), GetLastPinNameSize(), GetLastPinNumSize(), LIB_PIN::GetPosition(), GetShowElectricalType(), GR_COPY, 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(), PIN_DANGLING_HIDDEN, PIN_DRAW_DANGLING, PIN_DRAW_ELECTRICAL_TYPE_NAME, PIN_DRAW_TEXTS, 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().

429 {
430  LIB_PART* part = GetCurPart();
431 
432  if( !part )
433  return;
434 
435  part->ClearStatus();
436 
437  LIB_PIN* pin = new LIB_PIN( part );
438 
439  SetDrawItem( pin );
440 
441  pin->SetFlags( IS_NEW );
442  pin->SetUnit( m_unit );
443  pin->SetConvert( m_convert );
444 
445  // Flag pins to consider
446  if( SynchronizePins() )
447  pin->SetFlags( IS_LINKED );
448 
449  pin->Move( GetCrossHairPosition( true ) );
450  pin->SetLength( GetLastPinLength() );
452  pin->SetType( LastPinType );
453  pin->SetShape( LastPinShape );
457  pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
458  pin->SetVisible( LastPinVisible );
459  PinPreviousPos = pin->GetPosition();
461  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
462  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
463  GetEventHandler()->ProcessEvent( cmd );
465  m_canvas->SetIgnoreMouseEvents( false );
466 
467  if( pin->GetFlags() & IS_CANCELLED )
468  {
469  deleteItem( DC, pin );
470  }
471  else
472  {
475 
476  if( DC )
477  {
479 
480  if( GetShowElectricalType() )
481  show_opts |= PIN_DRAW_ELECTRICAL_TYPE_NAME;
482 
483  // In LIB_PIN::Draw() a void* parameter used as flag to pass show_opts.
484  // Build it:
485  void* showOptions = reinterpret_cast<void*>( show_opts );
486 
487  pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_COPY,
488  showOptions, DefaultTransform );
489  }
490 
491  }
492 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:106
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
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
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
static bool LastPinVisible
Definition: pinedit.cpp:63
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SetDrawItem(LIB_ITEM *drawItem)
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 wxPoint PinPreviousPos
Definition: pinedit.cpp:57
static GRAPHIC_PINSHAPE LastPinShape
Definition: pinedit.cpp:60
void SetConvert(int aConvert)
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:462
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:98
void SetUnit(int aUnit)
void ClearStatus()
Clears the status flag all draw objects in this part.
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
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.
static int m_unit
#define IS_CANCELLED
flag set when edit dialogs are canceled when editing a
Definition: base_struct.h:122
void SetIgnoreMouseEvents(bool aIgnore)
void SetType(ELECTRICAL_PINTYPE aType, bool aTestOtherPins=true)
Set the electrical type of the pin.
Definition: lib_pin.cpp:327
static void AbortPinMove(EDA_DRAW_PANEL *Panel, wxDC *DC)
Clean up after aborting a move pin command.
Definition: pinedit.cpp:211
void Move(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_pin.cpp:1587
bool SynchronizePins()
Pin edition (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:380
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void 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
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool GetShowElectricalType()
void SetNumberTextSize(int aSize, bool aTestOtherPins=true)
Set the size of the pin number text.
Definition: lib_pin.cpp:241
void LIB_EDIT_FRAME::CreatePNGorJPEGFile ( const wxString &  aFileName,
bool  aFmt_jpeg 
)

Creates an image (screenshot) of the current component in PNG or JPEG format.

Parameters
aFileName= the full filename
aFmt_jpeg= true to use JPEG file format, false to use PNG file format

Definition at line 120 of file libedit_plot_component.cpp.

References GetChars(), and EDA_DRAW_FRAME::m_canvas.

Referenced by IsEditingDrawItem(), and OnPlotCurrentComponent().

121 {
122  wxSize image_size = m_canvas->GetClientSize();
123 
124  wxClientDC dc( m_canvas );
125  wxBitmap bitmap( image_size.x, image_size.y );
126  wxMemoryDC memdc;
127 
128  memdc.SelectObject( bitmap );
129  memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
130  memdc.SelectObject( wxNullBitmap );
131 
132  wxImage image = bitmap.ConvertToImage();
133 
134  if( !image.SaveFile( aFileName, aFmt_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
135  {
136  wxString msg;
137  msg.Printf( _( "Can't save file \"%s\"" ), GetChars( aFileName ) );
138  wxMessageBox( msg );
139  }
140 
141  image.Destroy();
142 }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

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

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

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

References EDA_DRAW_PANEL::CallEndMouseCapture(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), 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(), EDA_DRAW_PANEL::Refresh(), LIB_PART::RemoveDrawItem(), SaveCopyInUndoList(), SetDrawItem(), SynchronizePins(), and EDA_ITEM::Type().

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

1402 {
1403  if( !aItem )
1404  return;
1405 
1406  m_canvas->CrossHairOff( aDC );
1407 
1408  LIB_PART* part = GetCurPart();
1409 
1410  SaveCopyInUndoList( part );
1411 
1412  if( aItem->Type() == LIB_PIN_T )
1413  {
1414  LIB_PIN* pin = static_cast<LIB_PIN*>( aItem );
1415  wxPoint pos = pin->GetPosition();
1416 
1417  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1418 
1419  // when pin edition is synchronized, all pins of the same body style
1420  // are removed:
1421  if( SynchronizePins() )
1422  {
1423  int curr_convert = pin->GetConvert();
1424  LIB_PIN* next_pin = part->GetNextPin();
1425 
1426  while( next_pin != NULL )
1427  {
1428  pin = next_pin;
1429  next_pin = part->GetNextPin( pin );
1430 
1431  if( pin->GetPosition() != pos )
1432  continue;
1433 
1434  if( pin->GetConvert() != curr_convert )
1435  continue;
1436 
1437  part->RemoveDrawItem( pin );
1438  }
1439  }
1440 
1441  m_canvas->Refresh();
1442  }
1443  else
1444  {
1445  if( m_canvas->IsMouseCaptured() )
1446  {
1447  m_canvas->CallEndMouseCapture( aDC );
1448  }
1449  else
1450  {
1451  part->RemoveDrawItem( aItem, m_canvas, aDC );
1452  m_canvas->Refresh();
1453  }
1454  }
1455 
1456  SetDrawItem( NULL );
1457  m_lastDrawItem = NULL;
1458  OnModify();
1459  m_canvas->CrossHairOn( aDC );
1460 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
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:66
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void SetDrawItem(LIB_ITEM *drawItem)
bool IsMouseCaptured() const
Define a library symbol object.
static LIB_ITEM * m_lastDrawItem
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:265
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:462
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:98
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:272
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 edition (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 656 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_aliasName, m_convert, m_unit, MAGENTA, and RED.

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

657 {
658  LIB_ALIAS* alias;
659  LIB_PART* part = GetCurPart();
660 
661  ClearMsgPanel();
662 
663  if( !part )
664  return;
665 
666  wxString msg = part->GetName();
667 
668  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
669 
670  if( m_aliasName == part->GetName() )
671  msg = _( "None" );
672  else
673  msg = m_aliasName;
674 
675  alias = part->GetAlias( m_aliasName );
676 
677  wxCHECK_RET( alias != NULL, "Alias not found in symbol." );
678 
679  AppendMsgPanel( _( "Alias" ), msg, RED, 8 );
680 
681  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
682  msg = UnitLetter[m_unit];
683 
684  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
685 
686  if( m_convert > 1 )
687  msg = _( "Convert" );
688  else
689  msg = _( "Normal" );
690 
691  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
692 
693  if( part->IsPower() )
694  msg = _( "Power Symbol" );
695  else
696  msg = _( "Symbol" );
697 
698  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
699  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
700  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
701  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
702 }
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.
wxString GetDescription() const
Definition: colors.h:59
Define a library symbol object.
Definition: colors.h:60
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
Definition: draw_frame.cpp:812
wxString GetDocFileName() const
Definition: colors.h:58
static wxString m_aliasName
static int m_unit
const wxString & GetName() const
wxString GetKeyWords() const
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:823
Definition: colors.h:62
void LIB_EDIT_FRAME::DisplayLibInfos ( )

Updates the main window title bar with the current library name and read only status of the library.

Definition at line 58 of file libedit.cpp.

References GetCurLib(), and KIWAY_HOLDER::Prj().

Referenced by GetComponentFromRedoList(), GetComponentFromUndoList(), LIB_EDIT_FRAME(), LoadOneLibraryPartAux(), OnAddLibrary(), OnEditComponentProperties(), RedrawActiveWindow(), and SelectActiveLibrary().

59 {
60  wxString lib = GetCurLib();
61  wxString title = _( "Symbol Library Editor - " );
62 
63  if( !lib.empty() && Prj().SchSymbolLibTable()->HasLibrary( lib ) )
64  {
65  wxString fileName = Prj().SchSymbolLibTable()->GetFullURI( lib );
66 
67  title += lib + " (" + fileName + ")";
68 
69  if( wxFileName::FileExists( fileName ) && !wxFileName::IsFileWritable( fileName ) )
70  title += " " + _( "[Read Only]" );
71  }
72  else
73  title += _( "no library selected" );
74 
75  SetTitle( title );
76 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
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:199
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:232
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:47
void EDA_DRAW_FRAME::DisplayToolMsg ( const wxString &  msg)
inherited
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 559 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

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

560 {
561  wxString msg;
562 
563  switch( g_UserUnit )
564  {
565  case INCHES:
566  msg = _( "Inches" );
567  break;
568 
569  case MILLIMETRES:
570  msg = _( "mm" );
571  break;
572 
573  default:
574  msg = _( "Units" );
575  break;
576  }
577 
578  SetStatusText( msg, 4 );
579 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
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 251 of file eda_base_frame.cpp.

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

252 {
253  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
254 }
void EDA_DRAW_FRAME::DrawWorkSheet ( wxDC *  aDC,
BASE_SCREEN aScreen,
int  aLineWidth,
double  aScale,
const wxString &  aFilename,
const wxString &  aSheetLayer = wxEmptyString 
)
inherited

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

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

Definition at line 76 of file worksheet.cpp.

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

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

79 {
81  return;
82 
83  const PAGE_INFO& pageInfo = GetPageSettings();
84  wxSize pageSize = pageInfo.GetSizeMils();
85 
86  // if not printing, draw the page limits:
87  if( !aScreen->m_IsPrinting && m_showPageLimits )
88  {
89  GRSetDrawMode( aDC, GR_COPY );
90  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
91  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
93  }
94 
95  TITLE_BLOCK t_block = GetTitleBlock();
96  COLOR4D color = COLOR4D( RED );
97 
98  wxPoint origin = aDC->GetDeviceOrigin();
99 
100  if( aScreen->m_IsPrinting && origin.y > 0 )
101  {
102  aDC->SetDeviceOrigin( 0, 0 );
103  aDC->SetAxisOrientation( true, false );
104  }
105 
106  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
107  GetScreenDesc(), aFilename, t_block,
108  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
109  aLineWidth, aScalar, color, color, aSheetLayer );
110 
111  if( aScreen->m_IsPrinting && origin.y > 0 )
112  {
113  aDC->SetDeviceOrigin( origin.x, origin.y );
114  aDC->SetAxisOrientation( true, true );
115  }
116 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:89
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:39
const wxSize & GetSizeMils() const
Definition: page_info.h:137
virtual const PAGE_INFO & GetPageSettings() const =0
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1098
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:119
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:49
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:118
EDA_RECT * GetClipBox()
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:98
void DrawPageLayout(wxDC *aDC, EDA_RECT *aClipBox, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, TITLE_BLOCK &aTitleBlock, int aSheetCount, int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor, COLOR4D aAltColor, const wxString &aSheetLayer)
Function DrawPageLayout is a core function to draw the page layout with the frame and the basic inscr...
Definition: worksheet.cpp:48
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:87
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(), GetChars(), CMP_TREE_PANE::GetCmpTree(), GetCurLib(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), LIB_FIELD::GetName(), LIB_ITEM::GetParent(), DIALOG_EDIT_ONE_FIELD::GetText(), LIB_PART::HasAlias(), LIB_ITEM::InEditMode(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_libMgr, m_treePane, m_unit, OnModify(), LIB_MANAGER::PartExists(), EDA_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), COMPONENT_TREE::SelectLibId(), LIB_PART::SetName(), DIALOG_SHIM::ShowQuasiModal(), UpdateAliasSelectList(), DIALOG_LIB_EDIT_ONE_FIELD::UpdateField(), LIB_MANAGER::UpdatePartAfterRename(), UR_LIB_RENAME, LIB_ALIAS::ValidateName(), 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 = _( "Component Name" );
57  else
58  caption.Printf( _( "Edit Field %s" ), 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 = dlg.GetText();
68  LIB_ALIAS::ValidateName( newFieldValue );
69  wxString oldFieldValue = aField->GetFullText( m_unit );
70  bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
71 
72  if( renamed )
73  {
74  wxString msg;
75  wxString lib = GetCurLib();
76 
77  // Test the current library for name conflicts
78  if( !lib.empty() && m_libMgr->PartExists( newFieldValue, lib ) )
79  {
80  msg.Printf( _(
81  "The name \"%s\" conflicts with an existing entry in the symbol library \"%s\"." ),
82  newFieldValue, lib );
83 
84  DisplayErrorMessage( this, msg );
85  return;
86  }
87 
89  parent->SetName( newFieldValue );
90 
91  if( !parent->HasAlias( m_aliasName ) )
92  m_aliasName = newFieldValue;
93 
94  m_libMgr->UpdatePartAfterRename( parent, oldFieldValue, lib );
95 
96  // Reselect the renamed part
97  m_treePane->GetCmpTree()->SelectLibId( LIB_ID( lib, newFieldValue ) );
98  }
99 
100  if( !aField->InEditMode() && !renamed )
101  SaveCopyInUndoList( parent );
102 
103  dlg.UpdateField( aField );
104  m_canvas->Refresh();
105 
106  OnModify();
108 }
static void ValidateName(wxString &aName)
Helper function to replace illegal chars in symbol names
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:199
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:219
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void UpdateAliasSelectList()
Class DIALOG_LIB_EDIT_ONE_FIELD is a the class to handle editing a single component field in the libr...
Define a library symbol object.
wxString GetCurLib() const
The nickname of the current library being edited and empty string if none.
void SelectLibId(const LIB_ID &aLibId)
Select a part in the tree widget.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
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 wxString m_aliasName
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.
virtual void SetName(const wxString &aName)
COMPONENT_TREE * GetCmpTree() const
Definition: cmp_tree_pane.h:46
#define VALUE
CMP_TREE_PANE * m_treePane
component search tree widget
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 55 of file symbdraw.cpp.

References g_UserUnit, LIB_ITEM::GetConvert(), GetConvert(), LIB_ITEM::GetFillMode(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::GetParent(), GetShowDeMorgan(), LIB_ITEM::GetTypeName(), LIB_ITEM::GetUnit(), GetUnit(), LIB_PART::GetUnitCount(), LIB_ITEM::GetWidth(), LIB_PART::HasConversion(), LIB_ITEM::InEditMode(), LIB_ITEM::IsFillable(), EDA_DRAW_FRAME::m_canvas, m_drawFillStyle, m_drawLineWidth, m_drawSpecificConvert, m_drawSpecificUnit, OnModify(), EDA_DRAW_PANEL::Refresh(), ReturnUnitSymbol(), SaveCopyInUndoList(), LIB_ITEM::SetConvert(), LIB_ITEM::SetFillMode(), EDA_DRAW_FRAME::SetMsgPanel(), LIB_ITEM::SetUnit(), LIB_ITEM::SetWidth(), DIALOG_LIB_EDIT_DRAW_ITEM::SetWidthUnits(), StringFromValue(), and ValueFromString().

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

56 {
57  if( DrawItem == NULL )
58  return;
59 
60  LIB_PART* symbol = DrawItem->GetParent();
61 
62  DIALOG_LIB_EDIT_DRAW_ITEM dialog( this, DrawItem->GetTypeName() );
63 
65 
66  wxString val = StringFromValue( g_UserUnit, DrawItem->GetWidth() );
67  dialog.SetWidth( val );
68  dialog.SetApplyToAllUnits( DrawItem->GetUnit() == 0 );
69  dialog.EnableApplyToAllUnits( symbol && symbol->GetUnitCount() > 1 );
70  dialog.SetApplyToAllConversions( DrawItem->GetConvert() == 0 );
71  bool enblConvOptStyle = symbol && symbol->HasConversion();
72  // if a symbol contains no graphic items, symbol->HasConversion() returns false.
73  // but when creating a new symbol, with DeMorgan option set, the ApplyToAllConversions
74  // must be enabled even if symbol->HasConversion() returns false in order to be able
75  // to create graphic items shared by all body styles
76  if( GetShowDeMorgan() )
77  enblConvOptStyle = true;
78 
79  dialog.EnableApplyToAllConversions( enblConvOptStyle );
80  dialog.SetFillStyle( DrawItem->GetFillMode() );
81  dialog.EnableFillStyle( DrawItem->IsFillable() );
82 
83  if( dialog.ShowModal() == wxID_CANCEL )
84  return;
85 
86  // Init default values (used to create a new draw item)
87  val = dialog.GetWidth();
89  m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
90  m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
91 
92 #if 0
93  /* TODO: see if m_drawFillStyle must retain the last fill option or not.
94  * if the last is Filled, having next new graphic items created
95  * with filled body is often bad.
96  * currently m_drawFillStyle is left with the default value (not filled)
97  */
98  if( DrawItem->IsFillable() )
99  m_drawFillStyle = (FILL_T) dialog.GetFillStyle();
100 #endif
101 
102  // Save copy for undo if not in edit (edit command already handle the save copy)
103  if( !DrawItem->InEditMode() )
104  SaveCopyInUndoList( DrawItem->GetParent() );
105 
106  if( m_drawSpecificUnit )
107  DrawItem->SetUnit( GetUnit() );
108  else
109  DrawItem->SetUnit( 0 );
110 
112  DrawItem->SetConvert( GetConvert() );
113  else
114  DrawItem->SetConvert( 0 );
115 
116  if( DrawItem->IsFillable() )
117  DrawItem->SetFillMode( (FILL_T) dialog.GetFillStyle() );
118 
119  DrawItem->SetWidth( m_drawLineWidth );
120 
121  OnModify( );
122 
123  MSG_PANEL_ITEMS items;
124  DrawItem->GetMsgPanelInfo( items );
125  SetMsgPanel( items );
126  m_canvas->Refresh();
127 }
FILL_T GetFillMode() const
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
int GetUnit() const
wxString ReturnUnitSymbol(EDA_UNITS_T aUnit, const wxString &formatString)
Returns the units symbol.
Definition: base_units.cpp:426
virtual void SetWidth(int aWidth)=0
Set the width of the draw item to aWidth.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
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...
LIB_PART * GetParent() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:832
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:370
Define a library symbol object.
void SetFillMode(FILL_T aFillMode)
void SetWidthUnits(const wxString &units)
void SetConvert(int aConvert)
int GetUnitCount() const
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
Dialog to edit library component graphic items.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
virtual int GetWidth() const =0
Return the width of the draw item.
void SetUnit(int aUnit)
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
bool GetShowDeMorgan()
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.
virtual wxString GetTypeName()=0
Provide a user-consumable name of the object type.
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:52
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.
int GetConvert() const
void LIB_EDIT_FRAME::EditSymbolText ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 1086 of file lib_edit_frame.cpp.

References DefaultTransform, DIALOG_LIB_EDIT_TEXT, LIB_ITEM::Draw(), g_XorMode, GR_DEFAULT_DRAWMODE, LIB_ITEM::InEditMode(), LIB_TEXT_T, EDA_DRAW_FRAME::m_canvas, OnModify(), and EDA_ITEM::Type().

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

1087 {
1088  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
1089  return;
1090 
1091  // Deleting old text
1092  if( DC && !DrawItem->InEditMode() )
1093  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1094  DefaultTransform );
1095 
1096  DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
1097  frame->ShowModal();
1098  frame->Destroy();
1099  OnModify();
1100 
1101  // Display new text
1102  if( DC && !DrawItem->InEditMode() )
1103  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1104  NULL, DefaultTransform );
1105 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
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...
friend class DIALOG_LIB_EDIT_TEXT
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
TRANSFORM DefaultTransform
Definition: eeschema.cpp:58
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 1740 of file lib_edit_frame.cpp.

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

Referenced by OnCopyCutPart(), OnRemovePart(), OnRevertLibrary(), and OnRevertPart().

1741 {
1742  SetCurLib( wxEmptyString );
1743  SetCurPart( nullptr );
1744  m_aliasName.Empty();
1745  m_lastDrawItem = nullptr;
1746  SetDrawItem( NULL );
1749  Zoom_Automatique( false );
1750  Refresh();
1751 }
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:159
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:102
void Refresh()
Update the board display after modifying it bu 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
static wxString m_aliasName
void SetCurPart(LIB_PART *aPart)
Take ownership of aPart and notes that it is the one currently being edited.
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 343 of file symbdraw.cpp.

References LIB_ITEM::EndEdit(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetCurPart(), EDA_DRAW_PANEL::GetDefaultCursor(), GetDrawItem(), GetTempCopyComponent(), EDA_DRAW_FRAME::GetToolId(), ID_NO_TOOL_SELECTED, EDA_ITEM::IsNew(), EDA_DRAW_FRAME::m_canvas, OnModify(), EDA_DRAW_PANEL::Refresh(), SaveCopyInUndoList(), SetDrawItem(), and EDA_DRAW_PANEL::SetMouseCapture().

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

344 {
345  LIB_ITEM* item = GetDrawItem();
346 
347  if( item == NULL )
348  return;
349 
350  if( LIB_PART* part = GetCurPart() )
351  {
352  if( GetToolId() != ID_NO_TOOL_SELECTED )
353  SetCursor( wxCURSOR_PENCIL );
354  else
355  SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
356 
357  if( GetTempCopyComponent() ) // used when editing an existing item
359  else
360  {
361  // When creating a new item, there is still no change for the
362  // current symbol. So save it.
363  SaveCopyInUndoList( part );
364  }
365 
366  if( item->IsNew() )
367  part->AddDrawItem( item );
368 
369  item->EndEdit( GetCrossHairPosition( true ) );
370 
371  SetDrawItem( NULL );
372 
373  OnModify();
374 
375  m_canvas->SetMouseCapture( NULL, NULL );
376  m_canvas->Refresh();
377  }
378 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
bool IsNew() const
Definition: base_struct.h:227
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...
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:66
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void SetDrawItem(LIB_ITEM *drawItem)
Define a library symbol object.
LIB_PART * GetTempCopyComponent()
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
int GetToolId() const
Definition: draw_frame.h:488
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
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
int GetDefaultCursor() const
Function GetDefaultCursor.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 275 of file draw_frame.cpp.

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

Referenced by GERBVIEW_FRAME::SetCurItem().

276 {
277  if( m_messagePanel )
279 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:141
void EraseMsgBox()
Definition: msgpanel.cpp:215
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 372 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

372 {}
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 757 of file hotkeys_basic.cpp.

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

Referenced by KICAD_MANAGER_FRAME::Process_Config(), Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

759 {
760  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
761  wxString mask = wxT( "*." ) + ext;
762 
763 #if 0
764  wxString path = wxPathOnly( Prj().GetProjectFullName() );
765 #else
766  wxString path = GetMruPath();
767 #endif
768  wxFileName fn( aDefaultShortname );
769  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
770 
771  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
772  path,
773  fn.GetFullPath(),
774  ext,
775  mask,
776  this,
777  wxFD_SAVE,
778  true );
779 
780  if( filename.IsEmpty() )
781  return;
782 
783  WriteHotkeyConfig( aDescList, &filename );
784  SetMruPath( wxFileName( filename ).GetPath() );
785 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:270
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 439 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().

440 {
441  wxString newName;
442 
443  for( unsigned int i = 0; i < aPart->GetAliasCount(); ++i )
444  {
445  LIB_ALIAS* alias = aPart->GetAlias( i );
446  int sfx = 0;
447  newName = alias->GetName();
448 
449  while( m_libMgr->PartExists( newName, aLibrary ) )
450  {
451  newName = wxString::Format( "%s_%d", alias->GetName(), sfx );
452  ++sfx;
453  }
454 
455  if( i == 0 )
456  aPart->SetName( newName );
457  else
458  alias->SetName( newName );
459  }
460 }
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
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)
bool LIB_EDIT_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

Function GeneralControl performs 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 277 of file eeschema/controle.cpp.

References EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_FRAME::GetCrossHairPosition(), SCH_EDIT_FRAME::GetScreen(), EDA_ITEM::GetState(), EDA_DRAW_FRAME::m_movingCursorWithKeyboard, SCH_EDIT_FRAME::OnHotKey(), EDA_DRAW_FRAME::RefreshCrossHair(), EDA_DRAW_FRAME::SetCrossHairPosition(), STATE_NO_BLOCK, and SCH_BASE_FRAME::UpdateStatusBar().

Referenced by OnAddLibrary().

278 {
279  // Filter out the 'fake' mouse motion after a keyboard movement
280  if( !aHotKey && m_movingCursorWithKeyboard )
281  {
283  return false;
284  }
285 
286  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
287  // for next cursor position
288  // ( shift or ctrl key down are PAN command with mouse wheel)
289  bool snapToGrid = true;
290 
291  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
292  snapToGrid = false;
293 
294  // Cursor is left off grid only if no block in progress
295  if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
296  snapToGrid = true;
297 
298  wxPoint pos = aPosition;
299  wxPoint oldpos = GetCrossHairPosition();
300  bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
301 
302  // Update the cursor position.
303  SetCrossHairPosition( pos, snapToGrid );
304  RefreshCrossHair( oldpos, aPosition, aDC );
305 
306  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition, NULL ) )
307  {
308  keyHandled = true;
309  }
310 
311  // Make sure current-part highlighting doesn't get lost in seleciton highlighting
313 
314  UpdateStatusBar();
315 
316  return keyHandled;
317 }
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
void ClearSearchTreeSelection()
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
int GetState(int type) const
Definition: base_struct.h:248
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:151
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protectedinherited

Function GeneralControlKeyMovement 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 1393 of file 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 DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), and GERBVIEW_FRAME::GeneralControl().

1395 {
1396  bool key_handled = false;
1397 
1398  // If requested snap the current position to the grid
1399  if( aSnapToGrid )
1400  *aPos = GetNearestGridPosition( *aPos );
1401 
1402  switch( aHotKey )
1403  {
1404  // All these keys have almost the same treatment
1405  case GR_KB_CTRL | WXK_NUMPAD8:
1406  case GR_KB_CTRL | WXK_UP:
1407  case GR_KB_CTRL | WXK_NUMPAD2:
1408  case GR_KB_CTRL | WXK_DOWN:
1409  case GR_KB_CTRL | WXK_NUMPAD4:
1410  case GR_KB_CTRL | WXK_LEFT:
1411  case GR_KB_CTRL | WXK_NUMPAD6:
1412  case GR_KB_CTRL | WXK_RIGHT:
1413  case WXK_NUMPAD8:
1414  case WXK_UP:
1415  case WXK_NUMPAD2:
1416  case WXK_DOWN:
1417  case WXK_NUMPAD4:
1418  case WXK_LEFT:
1419  case WXK_NUMPAD6:
1420  case WXK_RIGHT:
1421  key_handled = true;
1422  {
1423  /* Here's a tricky part: when doing cursor key movement, the
1424  * 'previous' point should be taken from memory, *not* from the
1425  * freshly computed position in the event. Otherwise you can't do
1426  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1427  * the automatic motion event generated by cursor warping */
1428  wxRealPoint gridSize = GetScreen()->GetGridSize();
1429  *aPos = GetCrossHairPosition();
1430 
1431  // Bonus: ^key moves faster (x10)
1432  switch( aHotKey )
1433  {
1434  case GR_KB_CTRL|WXK_NUMPAD8:
1435  case GR_KB_CTRL|WXK_UP:
1436  aPos->y -= KiROUND( 10 * gridSize.y );
1437  break;
1438 
1439  case GR_KB_CTRL|WXK_NUMPAD2:
1440  case GR_KB_CTRL|WXK_DOWN:
1441  aPos->y += KiROUND( 10 * gridSize.y );
1442  break;
1443 
1444  case GR_KB_CTRL|WXK_NUMPAD4:
1445  case GR_KB_CTRL|WXK_LEFT:
1446  aPos->x -= KiROUND( 10 * gridSize.x );
1447  break;
1448 
1449  case GR_KB_CTRL|WXK_NUMPAD6:
1450  case GR_KB_CTRL|WXK_RIGHT:
1451  aPos->x += KiROUND( 10 * gridSize.x );
1452  break;
1453 
1454  case WXK_NUMPAD8:
1455  case WXK_UP:
1456  aPos->y -= KiROUND( gridSize.y );
1457  break;
1458 
1459  case WXK_NUMPAD2:
1460  case WXK_DOWN:
1461  aPos->y += KiROUND( gridSize.y );
1462  break;
1463 
1464  case WXK_NUMPAD4:
1465  case WXK_LEFT:
1466  aPos->x -= KiROUND( gridSize.x );
1467  break;
1468 
1469  case WXK_NUMPAD6:
1470  case WXK_RIGHT:
1471  aPos->x += KiROUND( gridSize.x );
1472  break;
1473 
1474  default: /* Can't happen since we entered the statement */
1475  break;
1476  }
1477 
1478  m_canvas->MoveCursor( *aPos );
1480  }
1481  break;
1482 
1483  default:
1484  break;
1485  }
1486 
1487  return key_handled;
1488 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:366
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
#define GR_KB_CTRL
Definition: common.h:64
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition 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:151
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 219 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

Referenced by DIALOG_GENERALOPTIONS::init(), and SCH_EDIT_FRAME::OnPreferencesOptions().

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

Definition at line 448 of file draw_frame.h.

448 { 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:131
const wxPoint & SCH_BASE_FRAME::GetAuxOrigin ( ) const
overridevirtualinherited

Function GetAuxOrigin returns the origin of the axis used for plotting and various exports.

Implements EDA_DRAW_FRAME.

Definition at line 164 of file sch_base_frame.cpp.

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

Referenced by SCH_BASE_FRAME::SetRepeatDeltaLabel().

165 {
166  wxASSERT( GetScreen() );
167  return GetScreen()->GetAuxOrigin();
168 }
const wxPoint & GetAuxOrigin() const
Definition: sch_screen.h:122
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( )
inlineinherited

Definition at line 351 of file draw_frame.h.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), AddNewTrace(), Autoroute_One_Track(), SCH_EDIT_FRAME::DeleteAnnotation(), PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), SCH_EDIT_FRAME::EditComponent(), getOptimalModulePlacement(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClick(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_LABEL_EDITOR::OnCancelClick(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), GERBER_LAYER_WIDGET::OnLayerSelect(), PCB_LAYER_WIDGET::OnLayerVisible(), GERBER_LAYER_WIDGET::OnLayerVisible(), SCH_EDIT_FRAME::OnLeftDClick(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GENERALOPTIONS::OnOkClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_PAGES_SETTINGS::OnOkClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PROPERTIES_FRAME::OnSetDefaultValues(), OnShowElectricalType(), EDA_DRAW_FRAME::OnZoom(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), SCH_FIELD::Place(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), PCB_BASE_FRAME::SetNextGrid(), PCB_BASE_FRAME::SetPrevGrid(), GERBVIEW_FRAME::SortLayersByX2Attributes(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings().

351 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void LIB_EDIT_FRAME::GetComponentFromRedoList ( wxCommandEvent &  event)
private

Definition at line 55 of file libedit_undo_redo.cpp.

References DisplayCmpDoc(), DisplayLibInfos(), CMP_TREE_PANE::GetCmpTree(), GetCurLib(), GetCurPart(), EDA_ITEM::GetFlags(), ITEM_PICKER::GetItem(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), ITEM_PICKER::GetStatus(), LIB_PART::HasAlias(), LIB_PART::HasConversion(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_libMgr, m_my_part, m_treePane, OnModify(), BASE_SCREEN::PopCommandFromRedoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToUndoList(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), COMPONENT_TREE::SelectLibId(), SetDrawItem(), EDA_ITEM::SetFlags(), SetShowDeMorgan(), UpdateAliasSelectList(), LIB_MANAGER::UpdatePartAfterRename(), UpdatePartSelectList(), 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->GetCmpTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
90  }
91 
92  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
93  m_aliasName = part->GetName();
94 
95  SetDrawItem( NULL );
98  SetShowDeMorgan( part->HasConversion() );
100  DisplayCmpDoc();
101  OnModify();
102  m_canvas->Refresh();
103 }
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:266
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
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.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void UpdateAliasSelectList()
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)
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:58
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:264
void SetDrawItem(LIB_ITEM *drawItem)
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:656
void SelectLibId(const LIB_ID &aLibId)
Select a part in the tree widget.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static wxString m_aliasName
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:137
COMPONENT_TREE * GetCmpTree() const
Definition: cmp_tree_pane.h:46
void UpdatePartSelectList()
CMP_TREE_PANE * m_treePane
component search tree widget
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 106 of file libedit_undo_redo.cpp.

References DisplayCmpDoc(), DisplayLibInfos(), CMP_TREE_PANE::GetCmpTree(), GetCurLib(), GetCurPart(), EDA_ITEM::GetFlags(), ITEM_PICKER::GetItem(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), ITEM_PICKER::GetStatus(), LIB_PART::HasAlias(), LIB_PART::HasConversion(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_libMgr, m_my_part, m_treePane, OnModify(), BASE_SCREEN::PopCommandFromUndoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToRedoList(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), COMPONENT_TREE::SelectLibId(), SetDrawItem(), EDA_ITEM::SetFlags(), SetShowDeMorgan(), UpdateAliasSelectList(), LIB_MANAGER::UpdatePartAfterRename(), UpdatePartSelectList(), UR_LIB_RENAME, and UR_TRANSIENT.

Referenced by IsEditingDrawItem().

107 {
108  if( GetScreen()->GetUndoCommandCount() <= 0 )
109  return;
110 
111  // Load the last undo entry
113  ITEM_PICKER undoWrapper = undoCommand->PopItem();
114  delete undoCommand;
115  LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
116  wxCHECK( part, /* void */ );
117  part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
118  UNDO_REDO_T undoRedoType = undoWrapper.GetStatus();
119 
120  // Store the current part in the redo buffer
121  PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
122  LIB_PART* oldPart = GetCurPart();
123  oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
124  ITEM_PICKER redoWrapper( oldPart, undoRedoType );
125  redoCommand->PushItem( redoWrapper );
126  GetScreen()->PushCommandToRedoList( redoCommand );
127 
128  // Do not delete the previous part by calling SetCurPart( part ),
129  // which calls delete <previous part>.
130  // <previous part> is now put in redo list and is owned by this list.
131  // Just set the current part to the part which come from the undo list
132  m_my_part = part;
133 
134  if( undoRedoType == UR_LIB_RENAME )
135  {
136  wxString lib = GetCurLib();
137  m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
138 
139  // Reselect the renamed part
140  m_treePane->GetCmpTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
141  }
142 
143  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
144  m_aliasName = part->GetName();
145 
146  SetDrawItem( NULL );
149  SetShowDeMorgan( part->HasConversion() );
150  DisplayLibInfos();
151  DisplayCmpDoc();
152  OnModify();
153  m_canvas->Refresh();
154 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
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.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void UpdateAliasSelectList()
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...
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:58
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:264
void SetDrawItem(LIB_ITEM *drawItem)
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:656
void SelectLibId(const LIB_ID &aLibId)
Select a part in the tree widget.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
static wxString m_aliasName
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:137
COMPONENT_TREE * GetCmpTree() const
Definition: cmp_tree_pane.h:46
void UpdatePartSelectList()
CMP_TREE_PANE * m_treePane
component search tree widget
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

Definition at line 429 of file lib_edit_frame.h.

References m_convert.

Referenced by DrawMovingBlockOutlines(), EditGraphicSymbol(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), and SVG_PlotComponent().

429 { return m_convert; }
static int m_convert
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const
inherited

Function GetCrossHairPosition 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 1286 of file draw_frame.cpp.

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

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::AutoPlaceModule(), 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(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), EDA_DRAW_PANEL::DrawCrossHair(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), GraphicItemBeginDraw(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), moveBitmap(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnDragItem(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditValue(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), OnOrient(), 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(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), EDA_DRAW_FRAME::RedrawScreen2(), RedrawWhileMovingCursor(), EDA_DRAW_FRAME::RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), RepeatPinItem(), resizeSheetWithMouseCursor(), 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(), SymbolDisplayDraw(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

1287 {
1288  // subject to change, borrow from old BASE_SCREEN for now.
1289  if( IsGalCanvasActive() )
1290  {
1292 
1293  return wxPoint( cursor.x, cursor.y );
1294  }
1295  else
1296  {
1297  BASE_SCREEN* screen = GetScreen(); // virtual call
1298  return screen->getCrossHairPosition( aInvertY );
1299  }
1300 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Definition: base_screen.h:107
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:887
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
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:895
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const
inherited

Function GetCursorScreenPosition returns the cross hair position in device (display) units.b.

Returns
The current cross hair position.

Definition at line 1324 of file draw_frame.cpp.

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

1325 {
1326  BASE_SCREEN* screen = GetScreen(); // virtual call
1327  return screen->getCrossHairScreenPosition();
1328 }
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
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 993 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::checkNewAlias(), DisplayLibInfos(), EditField(), GetComponentFromRedoList(), GetComponentFromUndoList(), getTargetLib(), LoadComponentFromCurrentLib(), OnEditComponentProperties(), OnRevertLibrary(), saveAllLibraries(), SetCurLib(), and storeCurrentPart().

994 {
995  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
996 
997  if( !libNickname.empty() )
998  {
999  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
1000  {
1001  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
1002  libNickname = wxEmptyString;
1003  }
1004  }
1005 
1006  return libNickname;
1007 }
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 169 of file lib_edit_frame.h.

References m_my_part, and SetCurPart().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter(), BestZoom(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocFromRootToAlias(), copySelectedItems(), CreatePin(), deleteItem(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter(), DisplayCmpDoc(), DrawMovingBlockOutlines(), EndDrawGraphicItem(), GetComponentFromRedoList(), GetComponentFromUndoList(), getTargetLibId(), getTargetPart(), GlobalSetPins(), HandleBlockEnd(), HandleBlockPlace(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc(), isCurrentPart(), LIB_EDIT_FRAME(), LoadComponentFromCurrentLib(), LoadOneLibraryPartAux(), LoadOneSymbol(), locateItem(), LocateItemUsingCursor(), OnCheckComponent(), OnEditComponentProperties(), OnLeftClick(), OnLeftDClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick(), OnOpenPinTable(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), OnPlotCurrentComponent(), OnRightClick(), OnRotateItem(), OnSelectTool(), OnUpdateDeMorganConvert(), OnUpdateDeMorganNormal(), OnUpdateEditingPart(), OnUpdatePartNumber(), OnUpdatePinTable(), OnUpdateRedo(), OnUpdateSelectAlias(), OnUpdateSyncPinEdit(), OnUpdateUndo(), OnUpdateViewDoc(), OnViewEntryDoc(), pasteClipboard(), PlaceAnchor(), PlacePin(), PrintPage(), Process_Special_Functions(), RedrawComponent(), RepeatPinItem(), SaveOneSymbol(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), StartMovePin(), SVG_PlotComponent(), SynchronizePins(), TempCopyComponent(), UpdateAliasSelectList(), and UpdatePartSelectList().

170  {
171  return m_my_part;
172  }
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

Function GetCursorPosition returns 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 1310 of file draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

1311 {
1312  BASE_SCREEN* screen = GetScreen(); // virtual call
1313  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1314 }
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns 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 189 of file lib_edit_frame.h.

References m_defaultPinLength.

Referenced by GetLastPinLength(), LIB_PIN::LIB_PIN(), OnPreferencesOptions(), and SaveSettings().

189 { return m_defaultPinLength; }
static int m_defaultPinLength
Default pin length.
virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

Function GetDisplayOptions 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 910 of file draw_frame.h.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), EDA_DRAW_PANEL::GetDisplayOptions(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

910 { return NULL; }
COLOR4D SCH_BASE_FRAME::GetDrawBgColor ( ) const
overridevirtualinherited
Returns
the COLOR4D for the canvas background

Reimplemented from EDA_DRAW_FRAME.

Definition at line 120 of file sch_base_frame.cpp.

References GetLayerColor(), and LAYER_SCHEMATIC_BACKGROUND.

Referenced by DIALOG_RESCUE_EACH::renderPreview(), DIALOG_CHOOSE_COMPONENT::RenderPreview(), and SCH_BASE_FRAME::SetGridOrigin().

121 {
123 }
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
LIB_ITEM* LIB_EDIT_FRAME::GetDrawItem ( ) const
inline
wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 447 of file draw_frame.h.

447 { 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:135
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 420 of file eda_base_frame.cpp.

References Format(), GetChars(), 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().

422 {
423  wxFileHistory* fileHistory = aFileHistory;
424 
425  if( !fileHistory )
426  fileHistory = &Kiface().GetFileHistory();
427 
428  int baseId = fileHistory->GetBaseId();
429 
430  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
431 
432  unsigned i = cmdId - baseId;
433 
434  if( i < fileHistory->GetCount() )
435  {
436  wxString fn = fileHistory->GetHistoryFile( i );
437 
438  if( wxFileName::FileExists( fn ) )
439  return fn;
440  else
441  {
442  wxString msg = wxString::Format(
443  _( "File \"%s\" was not found." ),
444  GetChars( fn ) );
445 
446  wxMessageBox( msg );
447 
448  fileHistory->RemoveFileFromHistory( i );
449  }
450  }
451 
452  return wxEmptyString;
453 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
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
size_t i
Definition: json11.cpp:597
FILL_T LIB_EDIT_FRAME::GetFillStyle ( void  )
inline

Definition at line 456 of file lib_edit_frame.h.

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

456 { 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

Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.

Returns
Pointer to GAL-based canvas.

Definition at line 895 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_TOOL::canvas(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE_EDITOR_TOOLS::EnumeratePads(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), PCB_BASE_FRAME::FocusOnLocation(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_DRAW_FRAME::GetCrossHairPosition(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), GERBVIEW_CONTROL::HighlightControl(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_FRAME::loadListOfGerberFiles(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), GERBVIEW_FRAME::OnSelectHighlightChoice(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(),