KiCad PCB EDA Suite
LIB_EDIT_FRAME Class Reference

The symbol library editor main window. More...

#include <libeditframe.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 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 OnUpdatePinByPin (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)
 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)
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 
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
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. 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)
 Function OnZoom Called from any zoom event (toolbar , hotkey or popup ) More...
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window screen. More...
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
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 OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
VTBL_ENTRY bool 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 ImportFile (const wxString &aFileName, int aFileType)
 Function ImportFile load the given filename but sets the path to the current project path. More...
 
VTBL_ENTRY void ReadPcbNetlist (const wxString &aNetlistFileName, const wxString &aCmpFileName, REPORTER *aReporter, bool aChangeFootprint, bool aDeleteBadTracks, bool aDeleteExtraFootprints, bool aSelectByTimestamp, bool aDeleteSinglePadNets, bool aIsDryRun)
 Function ReadPcbNetlist provides access to PcbNew's function ReadPcbNetlist. More...
 
VTBL_ENTRY bool CreateNetlist (int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL, bool silent=false)
 Function ReadPcbNetlist provides access to Eeschema's function CreateNetlist. 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)
 
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...
 
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_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)
 Deletes the currently selected draw item. More...
 
void GetComponentFromUndoList (wxCommandEvent &event)
 
void GetComponentFromRedoList (wxCommandEvent &event)
 
void CreatePin (wxDC *DC)
 
void StartMovePin (wxDC *DC)
 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)
 
void StartModifyDrawSymbol (wxDC *DC)
 
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 ()
 

Returns true when the operation has succeded (all requested libraries have been saved or none was selected and confirmed by OK).

More...
 
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 currently modified part has the same LIB_ID.

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_editPinsSeparately
 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 59 of file libeditframe.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 205 of file libeditframe.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, m_editPinsSeparately, 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_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.

205  :
206  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
207  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
208 {
209  m_showAxis = true; // true to draw axis
210  SetShowDeMorgan( false );
211  m_drawSpecificConvert = true;
212  m_drawSpecificUnit = false;
214  m_editPinsSeparately = false;
216  SetShowElectricalType( true );
217 
218  m_my_part = NULL;
219  m_tempCopyComponent = NULL;
220  m_treePane = nullptr;
221  m_libMgr = nullptr;
222 
223  // Delayed initialization
224  if( m_textSize == -1 )
226 
227  // Initialize grid id to the default value 50 mils:
229 
230  wxIcon icon;
231  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
232  SetIcon( icon );
233 
234  LoadSettings( config() );
235 
236  m_dummyScreen = new SCH_SCREEN( aKiway );
238  GetScreen()->m_Center = true;
240 
241  SetCrossHairPosition( wxPoint( 0, 0 ) );
242 
243  // Ensure m_LastGridSizeId is an offset inside the allowed schematic range
244  if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
246 
247  if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
249 
250  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
251 
252  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
253 
254  if( m_canvas )
256 
257  m_libMgr = new LIB_MANAGER( *this );
258  SyncLibraries( true );
259  m_treePane = new CMP_TREE_PANE( this, m_libMgr );
260 
261  ReCreateMenuBar();
264 
265  // Ensure the current alias name is valid if a part is loaded
266  // Sometimes it is not valid. This is the case
267  // when a part value (the part lib name), or the alias list was modified
268  // during a previous session and the modifications not saved in lib.
269  // Reopen libedit in a new session gives a non valid m_aliasName
270  // because the curr part is reloaded from the library (and this is the unmodified part)
271  // and the old alias name (from the previous edition) can be invalid
272  LIB_PART* part = GetCurPart();
273 
274  if( part == NULL )
275  m_aliasName.Empty();
276  else if( m_aliasName != part->GetName() )
277  {
278  LIB_ALIAS* alias = part->GetAlias( m_aliasName );
279 
280  if( !alias )
281  m_aliasName = part->GetName();
282  }
283 
285  DisplayLibInfos();
286  DisplayCmpDoc();
289 
290  m_auimgr.SetManagedWindow( this );
291 
292  EDA_PANEINFO horiz;
293  horiz.HorizontalToolbarPane();
294 
295  EDA_PANEINFO vert;
296  vert.VerticalToolbarPane();
297 
298  EDA_PANEINFO mesg;
299  mesg.MessageToolbarPane();
300 
301  m_auimgr.AddPane( m_mainToolBar,
302  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
303 
304  m_auimgr.AddPane( m_drawToolBar,
305  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right() );
306 
307  m_auimgr.AddPane( m_optionsToolBar,
308  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ).Left().Row( 0 ) );
309 
310  m_auimgr.AddPane( m_canvas,
311  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
312 
313  m_auimgr.AddPane( m_messagePanel,
314  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
315 
316  m_auimgr.AddPane( m_treePane, wxAuiPaneInfo().Name( "ComponentTree" ).Left().Row( 1 )
317  .Resizable().MinSize( 250, 400 ).Dock().CloseButton( false ) );
318 
319  m_auimgr.Update();
320 
321  Raise();
322  Show( true );
323 
324  Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
326 
327  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
328  wxPostEvent( this, evt );
329 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:500
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
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:224
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:103
LIB_ALIAS * GetAlias(size_t aIndex)
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:150
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
Definition: libeditframe.h:67
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...
Definition: basicframe.cpp:365
#define DEFAULT_REPEAT_OFFSET_PIN
the default value (overwritten by the eeschema config)
Definition: general.h:50
wxAuiManager m_auimgr
Definition: wxstruct.h:149
void UpdateAliasSelectList()
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:61
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:491
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:446
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:59
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.
Definition: wxstruct.h:518
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Definition: libeditframe.h:166
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:129
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
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.
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
#define LIB_EDIT_FRAME_NAME
Define a library symbol object.
wxPoint m_FramePos
Definition: wxstruct.h:139
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:89
static int m_textSize
The current text size setting.
Definition: libeditframe.h:126
int m_LastGridSizeId
Definition: draw_frame.h:78
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:126
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:145
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:632
void SetShowElectricalType(bool aShow)
Definition: libeditframe.h:450
Class to handle modifications to the symbol libraries.
Definition: lib_manager.h:48
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:537
void ReCreateHToolbar() override
Definition: tool_lib.cpp:94
static wxString m_aliasName
Definition: libeditframe.h:109
bool m_editPinsSeparately
Set to true to not synchronize pins at the same position when editing symbols with multiple units or ...
Definition: libeditframe.h:95
Library Editor pane with component tree and symbol library table selector.
Definition: cmp_tree_pane.h:40
void SetMaxUndoItems(int aMax)
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.
Definition: libeditframe.h:141
const wxString & GetName() const
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
Definition: libeditframe.h:705
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:70
wxSize m_FrameSize
Definition: wxstruct.h:140
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.
Definition: libeditframe.h:78
void UpdatePartSelectList()
int GetDefaultTextSize()
Default size for text in general.
CMP_TREE_PANE * m_treePane
component search tree widget
Definition: libeditframe.h:66
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:62
void ReCreateVToolbar() override
Definition: tool_lib.cpp:48
LIB_EDIT_FRAME::~LIB_EDIT_FRAME ( )

Definition at line 332 of file libeditframe.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().

333 {
334  Unbind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
336 
337  // current screen is destroyed in EDA_DRAW_FRAME
339 
340  m_lastDrawItem = NULL;
342 
343  delete m_tempCopyComponent;
344  delete m_libMgr;
345  delete m_my_part;
346 }
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:150
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
Definition: libeditframe.h:67
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:61
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:108
SCH_SCREEN * m_dummyScreen
Helper screen used when no part is loaded
Definition: libeditframe.h:705
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:62

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 1529 of file libeditframe.cpp.

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

Referenced by OnAddLibrary(), and OnCreateNewLibrary().

1530 {
1531  wxFileName fileName = getLibraryFileName( !aCreateNew );
1532  wxString libName = fileName.GetName();
1533  bool res = false;
1534 
1535  if( libName.IsEmpty() )
1536  return false;
1537 
1538  if( m_libMgr->LibraryExists( libName ) )
1539  {
1540  DisplayError( this,
1541  wxString::Format( _( "Library \"%s\" already exists" ), GetChars( libName ) ) );
1542  return false;
1543  }
1544 
1545  // Select the target library table (global/project)
1546  SYMBOL_LIB_TABLE* libTable = selectSymLibTable();
1547 
1548  if( !libTable )
1549  return false;
1550 
1551  if( aCreateNew )
1552  {
1553  res = m_libMgr->CreateLibrary( fileName.GetFullPath(), libTable );
1554 
1555  if( !res )
1556  DisplayError( this, _( "Could not create the library file. Check write permission." ) );
1557  }
1558  else
1559  {
1560  res = m_libMgr->AddLibrary( fileName.GetFullPath(), libTable );
1561 
1562  if( !res )
1563  DisplayError( this, _( "Could not open the library file." ) );
1564  }
1565 
1566  return res;
1567 }
bool CreateLibrary(const wxString &aFilePath, SYMBOL_LIB_TABLE *aTable)
Creates an empty library and adds it to the library table.
Definition: lib_manager.h:85
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
Definition: libeditframe.h:67
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:93
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.
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:74
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 677 of file basicframe.cpp.

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

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

678 {
679  wxMenu* menu = NULL;
680  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
681 
682  if( item ) // This menu exists, do nothing
683  return;
684 
685  menu = new wxMenu;
686 
687  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
688  _( "Icons in Menus" ), wxEmptyString,
689  wxITEM_CHECK ) );
690  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
691 
692  AddMenuItem( MasterMenu, menu,
694  _( "Icons Options" ),
695  _( "Select show icons in menus and icons sizes" ),
696  KiBitmap( icon_xpm ) );
697 }
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:173
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 239 of file zoom.cpp.

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

240 {
241  int maxZoomIds;
242  double zoom;
243  wxString msg;
244  BASE_SCREEN* screen = m_canvas->GetScreen();
245 
246  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
247  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
248  msg = AddHotkeyName( _( "Zoom in" ), m_hotkeysDescrList, HK_ZOOM_IN );
249  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
250  msg = AddHotkeyName( _( "Zoom out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
251  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
252  msg = AddHotkeyName( _( "Redraw view" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
253  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
254  msg = AddHotkeyName( _( "Zoom auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
255  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
256 
257 
258  wxMenu* zoom_choice = new wxMenu;
259  AddMenuItem( MasterMenu, zoom_choice,
260  ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ),
261  KiBitmap( zoom_selection_xpm ) );
262 
263  zoom = screen->GetZoom();
265  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
266  maxZoomIds : screen->m_ZoomList.size();
267 
268  // Populate zoom submenu.
269  for( int i = 0; i < maxZoomIds; i++ )
270  {
271  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
272 
273  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
274  wxEmptyString, wxITEM_CHECK );
275  if( zoom == screen->m_ZoomList[i] )
276  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
277  }
278 
279  // Create grid submenu as required.
280  if( screen->GetGridCount() )
281  {
282  wxMenu* gridMenu = new wxMenu;
283  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
284  _( "Grid Select" ), KiBitmap( grid_select_xpm ) );
285 
286  wxArrayString gridsList;
287  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
288 
289  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
290  {
291  GRID_TYPE& grid = screen->GetGrid( i );
292  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
293 
294  if( (int)i == icurr )
295  gridMenu->Check( grid.m_CmdId, true );
296  }
297  }
298 
299  MasterMenu->AppendSeparator();
300  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
301 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:173
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
size_t GetGridCount() const
Function GetGridCount().
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:77
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:86
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:194
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

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

932 {
933  BASE_SCREEN* screen = GetScreen();
934 
935  if( !screen || !m_canvas )
936  return;
937 
938  double scale = screen->GetScalingFactor();
939 
940  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
941  aCenterPositionIU.x, aCenterPositionIU.y, scale );
942 
943  // Calculate the portion of the drawing that can be displayed in the
944  // client area at the current zoom level.
945 
946  // visible viewport in device units ~ pixels
947  wxSize clientSizeDU = m_canvas->GetClientSize();
948 
949  // Size of the client window in IU
950  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
951 
952  // Full drawing or "page" rectangle in internal units
953  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
954 
955  // Account for scrollbars
956  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
957  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
958  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
959 
960  // The upper left corner of the client rectangle in internal units.
961  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
962  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
963 
964  // If drawn around the center, adjust the client rectangle accordingly.
965  if( screen->m_Center )
966  {
967  // half page offset.
968  xIU += pageRectIU.GetWidth() / 2.0;
969  yIU += pageRectIU.GetHeight() / 2.0;
970  }
971 
972  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
973  wxPoint centerPositionIU;
974 
975  // put "int" limits on the clientRect
976  if( clientRectIU.GetLeft() < VIRT_MIN )
977  clientRectIU.MoveLeftTo( VIRT_MIN );
978  if( clientRectIU.GetTop() < VIRT_MIN )
979  clientRectIU.MoveTopTo( VIRT_MIN );
980  if( clientRectIU.GetRight() > VIRT_MAX )
981  clientRectIU.MoveRightTo( VIRT_MAX );
982  if( clientRectIU.GetBottom() > VIRT_MAX )
983  clientRectIU.MoveBottomTo( VIRT_MAX );
984 
985  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
986  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
987 
988  if( screen->m_Center )
989  {
990  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
991  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
992  }
993 
994  DSIZE virtualSizeIU;
995 
996  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
997  {
998  virtualSizeIU.x = pageRectIU.GetSize().x;
999  }
1000  else
1001  {
1002  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
1003  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
1004 
1005  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
1006  {
1007  if( pageCenterX > clientCenterX )
1008  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
1009  else if( pageCenterX < clientCenterX )
1010  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
1011  else
1012  virtualSizeIU.x = clientRectIU.GetWidth();
1013  }
1014  else
1015  {
1016  if( pageCenterX > clientCenterX )
1017  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
1018  else if( pageCenterX < clientCenterX )
1019  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1020  else
1021  virtualSizeIU.x = pageRectIU.GetWidth();
1022  }
1023  }
1024 
1025  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1026  {
1027  virtualSizeIU.y = pageRectIU.GetSize().y;
1028  }
1029  else
1030  {
1031  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1032  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1033 
1034  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1035  {
1036  if( pageCenterY > clientCenterY )
1037  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1038  else if( pageCenterY < clientCenterY )
1039  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1040  else
1041  virtualSizeIU.y = clientRectIU.GetHeight();
1042  }
1043  else
1044  {
1045  if( pageCenterY > clientCenterY )
1046  virtualSizeIU.y = pageRectIU.GetHeight() +
1047  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1048  else if( pageCenterY < clientCenterY )
1049  virtualSizeIU.y = pageRectIU.GetHeight() +
1050  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1051  else
1052  virtualSizeIU.y = pageRectIU.GetHeight();
1053  }
1054  }
1055 
1056  // put "int" limits on the virtualSizeIU
1057  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1058  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1059 
1060  if( screen->m_Center )
1061  {
1062  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1063  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1064  }
1065  else
1066  {
1067  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1068  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1069  }
1070 
1071  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1072  * around cursor to jump around. This reported problem occurs when the
1073  * zoom point is not on a pixel per unit increment. If you set the
1074  * pixels per unit to 10, you have potential for the zoom point to
1075  * jump around +/-5 pixels from the nearest grid point.
1076  */
1077  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1078 
1079  // Number of scroll bar units for the given zoom level in device units.
1080  double unitsX = virtualSizeIU.x * scale;
1081  double unitsY = virtualSizeIU.y * scale;
1082 
1083  // Store the requested center position for later use
1084  SetScrollCenterPosition( aCenterPositionIU );
1085 
1086  // Calculate the scroll bar position in internal units to place the
1087  // center position at the center of client rectangle.
1088  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1089  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1090 
1091  // Convert scroll bar position to device units.
1092  posX = KiROUND( posX * scale );
1093  posY = KiROUND( posY * scale );
1094 
1095  if( posX < 0 )
1096  {
1097  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1098  posX = 0;
1099  }
1100 
1101  if( posX > unitsX )
1102  {
1103  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1104  posX = unitsX;
1105  }
1106 
1107  if( posY < 0 )
1108  {
1109  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1110  posY = 0;
1111  }
1112 
1113  if( posY > unitsY )
1114  {
1115  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1116  posY = unitsY;
1117  }
1118 
1119  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1120  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1121 
1122  wxLogTrace( traceScrollSettings,
1123  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1124  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1125  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1127  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1128  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1129 
1130  bool noRefresh = true;
1131 
1132  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1133  screen->m_ScrollPixelsPerUnitY,
1134  screen->m_ScrollbarNumber.x,
1135  screen->m_ScrollbarNumber.y,
1136  screen->m_ScrollbarPos.x,
1137  screen->m_ScrollbarPos.y, noRefresh );
1138 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:928
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:927
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:356
bool m_Center
Center on screen.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static const double MAX_AXIS
Definition: draw_frame.cpp:925
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
#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 773 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(), ShowNewTrackWhenMovingCursor(), and PCB_EDIT_FRAME::Solve().

776 {
777  if( m_messagePanel == NULL )
778  return;
779 
780  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
781 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
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 1704 of file libeditframe.cpp.

References DisplayError().

Referenced by saveLibrary().

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

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

Implements EDA_DRAW_FRAME.

Definition at line 363 of file libeditframe.cpp.

References boundingBox(), GetCurPart(), EDA_RECT::GetHeight(), SCH_SCREEN::GetPageSettings(), SCH_BASE_FRAME::GetScreen(), LIB_PART::GetUnitBoundingBox(), EDA_RECT::GetWidth(), EDA_DRAW_FRAME::m_canvas, m_convert, m_unit, BASE_SCREEN::m_ZoomList, max, and EDA_DRAW_FRAME::SetScrollCenterPosition().

364 {
365  /* Please, note: wxMSW before version 2.9 seems have
366  * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
367  * edit file <wxWidgets>/src/msw/dc.cpp
368  * search for line static const int VIEWPORT_EXTENT = 1000;
369  * and replace by static const int VIEWPORT_EXTENT = 10000;
370  */
371  int dx, dy;
372 
373  LIB_PART* part = GetCurPart();
374 
375  if( part )
376  {
378 
379  dx = boundingBox.GetWidth();
380  dy = boundingBox.GetHeight();
381  SetScrollCenterPosition( wxPoint( 0, 0 ) );
382  }
383  else
384  {
385  const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
386 
387  dx = pageInfo.GetSizeIU().x;
388  dy = pageInfo.GetSizeIU().y;
389 
390  SetScrollCenterPosition( wxPoint( 0, 0 ) );
391  }
392 
393  wxSize size = m_canvas->GetClientSize();
394 
395  // Reserve a 10% margin around component bounding box.
396  double margin_scale_factor = 0.8;
397  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
398  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
399 
400  double bestzoom = std::max( zx, zy );
401 
402  // keep it >= minimal existing zoom (can happen for very small components
403  // for instance when starting a new component
404  if( bestzoom < GetScreen()->m_ZoomList[0] )
405  bestzoom = GetScreen()->m_ZoomList[0];
406 
407  return bestzoom;
408 }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
static int m_convert
Definition: libeditframe.h:116
void SetScrollCenterPosition(const wxPoint &aPoint)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
int GetHeight() const
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.
Definition: libeditframe.h:166
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Define a library symbol object.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static int m_unit
Definition: libeditframe.h:112
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
int GetWidth() const
const PAGE_INFO & GetPageSettings() const
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
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.

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 582 of file basicframe.cpp.

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

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

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

Delete temporary copy of the current component and clear pointer.

Definition at line 1099 of file libeditframe.cpp.

References m_tempCopyComponent.

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

1100 {
1101  delete m_tempCopyComponent;
1102  m_tempCopyComponent = NULL;
1103 }
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:62
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 403 of file libeditframe.h.

404  {
405  // Generate a wxCloseEvent
406  Close( false );
407  }
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 266 of file wxstruct.h.

References EDA_BASE_FRAME::m_configFrameName.

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

267  {
268  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
269  return baseCfgName;
270  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
Definition: wxstruct.h:142
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 832 of file draw_frame.cpp.

References CoordinateToString().

833 {
834  return ::CoordinateToString( aValue, aConvertToMils );
835 }
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(), SCH_BASE_FRAME::GetScreen(), LIB_FIELD_T, m_clipboard, BLOCK_SELECTOR::PushItem(), SELECTED, BLOCK_SELECTOR::SetLastCursorPosition(), and UR_DELETED.

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 
398  // In list the wrapper is owner of the schematic item, we can use the UR_DELETED
399  // status for the picker because pickers with this status are owner of the picked item
400  // (or TODO ?: create a new status like UR_DUPLICATE)
401  ITEM_PICKER picker( copy, UR_DELETED );
402  m_clipboard.PushItem( picker );
403  }
404 }
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:134
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Definition: libeditframe.h:166
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes only the list of EDA_ITEM * pointers, AND the data printed b...
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
Definition: libeditframe.h:763
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 43 of file copy_to_clipboard.cpp.

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

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

157 {
158  LIB_ITEM* item = GetDrawItem();
160  wxPoint drawPos = GetCrossHairPosition( true );
161 
162  // no temp copy -> the current version of symbol will be used for Undo
163  // This is normal when adding new items to the current symbol
165 
166  switch( GetToolId() )
167  {
169  item = new LIB_ARC( LibEntry );
170  break;
171 
173  item = new LIB_CIRCLE( LibEntry );
174  break;
175 
177  item = new LIB_RECTANGLE( LibEntry );
178  break;
179 
181  item = new LIB_POLYLINE( LibEntry );
182  break;
183 
185  {
186  LIB_TEXT* text = new LIB_TEXT( LibEntry );
187  text->SetTextSize( wxSize( m_textSize, m_textSize ) );
189 
190  // Enter the graphic text info
192  EditSymbolText( NULL, text );
193 
194  m_canvas->SetIgnoreMouseEvents( false );
196 
197  if( text->GetText().IsEmpty() )
198  {
199  delete text;
200  item = NULL;
201  }
202  else
203  {
204  item = text;
205  }
206  }
207  break;
208 
209  default:
210  DisplayError( this, wxT( "LIB_EDIT_FRAME::CreateGraphicItem() error" ) );
211  return NULL;
212  }
213 
214  if( item )
215  {
216  item->BeginEdit( IS_NEW, drawPos );
217 
218  // Don't set line parameters for text objects.
219  if( item->Type() != LIB_TEXT_T )
220  {
221  item->SetWidth( m_drawLineWidth );
222  item->SetFillMode( m_drawFillStyle );
223  }
224 
225  if( m_drawSpecificUnit )
226  item->SetUnit( m_unit );
227 
229  item->SetConvert( m_convert );
230 
231  // Draw initial symbol:
232  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
233  }
234  else
235  {
237  return NULL;
238  }
239 
241  m_canvas->SetIgnoreMouseEvents( false );
242  SetDrawItem( item );
243 
244  return item;
245 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:154
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
static double m_current_text_angle
Current text angle setting.
Definition: libeditframe.h:129
static int m_convert
Definition: libeditframe.h:116
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:354
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:127
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
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.
Definition: libeditframe.h:126
static void AbortSymbolTraceOn(EDA_DRAW_PANEL *Panel, wxDC *DC)
Definition: symbdraw.cpp:133
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:93
void SetUnit(int aUnit)
static int m_unit
Definition: libeditframe.h:112
int GetToolId() const
Definition: draw_frame.h:480
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:103
LIB_ITEM * GetDrawItem() const
Definition: libeditframe.h:440
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:336
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
Definition: libeditframe.h:106
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:70
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.
Definition: libeditframe.h:78
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:74
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 502 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 PlacePin().

503 {
504  int ii;
505  LIB_PIN* newPin;
506 
507  // if "synchronize pins edition" option is off, do not create any similar pin for other
508  // units and/or shapes: each unit is edited regardless other units or body
509  if( !SynchronizePins() )
510  return;
511 
512  if( aPin->GetUnit() == 0 ) // Pin common to all units: no need to create similar pins.
513  return;
514 
515  // When units are interchangeable, all units are expected to have similar pins
516  // at the same position
517  // to facilitate pin edition, create pins for all other units for the current body style
518  // at the same position as aPin
519 
520  for( ii = 1; ii <= aPin->GetParent()->GetUnitCount(); ii++ )
521  {
522  if( ii == aPin->GetUnit() )
523  continue;
524 
525  newPin = (LIB_PIN*) aPin->Clone();
526 
527  // To avoid mistakes, gives this pin a new pin number because
528  // it does no have the save pin number as the master pin
529  // Because we do not know the actual number, give it a temporary number
530  wxString unknownNum;
531  unknownNum.Printf( "%s-U%c", aPin->GetNumber(), wxChar( 'A' + ii - 1 ) );
532  newPin->SetNumber( unknownNum );
533 
534  newPin->SetUnit( ii );
535  aPin->GetParent()->AddDrawItem( newPin );
536  }
537 }
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:183
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...
VTBL_ENTRY bool KIWAY_PLAYER::CreateNetlist ( int  aFormat,
const wxString &  aFullFileName,
unsigned  aNetlistOptions,
REPORTER aReporter = NULL,
bool  silent = false 
)
inlineinherited

Function ReadPcbNetlist provides access to Eeschema's function CreateNetlist.

Definition at line 215 of file kiway_player.h.

220  {
221  return false;
222  };
void LIB_EDIT_FRAME::CreatePin ( wxDC *  DC)
private

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

436 {
437  LIB_PART* part = GetCurPart();
438 
439  if( !part )
440  return;
441 
442  part->ClearStatus();
443 
444  LIB_PIN* pin = new LIB_PIN( part );
445 
446  SetDrawItem( pin );
447 
448  pin->SetFlags( IS_NEW );
449  pin->SetUnit( m_unit );
450  pin->SetConvert( m_convert );
451 
452  // Flag pins to consider
453  if( SynchronizePins() )
454  pin->SetFlags( IS_LINKED );
455 
456  pin->Move( GetCrossHairPosition( true ) );
457  pin->SetLength( GetLastPinLength() );
459  pin->SetType( LastPinType );
460  pin->SetShape( LastPinShape );
464  pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
465  pin->SetVisible( LastPinVisible );
466  PinPreviousPos = pin->GetPosition();
468  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
469  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
470  GetEventHandler()->ProcessEvent( cmd );
472  m_canvas->SetIgnoreMouseEvents( false );
473 
474  if( pin->GetFlags() & IS_CANCELLED )
475  {
476  deleteItem( DC );
477  }
478  else
479  {
482 
483  if( DC )
484  {
486 
487  if( GetShowElectricalType() )
488  show_opts |= PIN_DRAW_ELECTRICAL_TYPE_NAME;
489 
490  // In LIB_PIN::Draw() a void* parameter used as flag to pass show_opts.
491  // Build it:
492  void* showOptions = reinterpret_cast<void*>( show_opts );
493 
494  pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_COPY,
495  showOptions, DefaultTransform );
496  }
497 
498  }
499 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:124
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
void SetLength(int aLength, bool aTestOtherPins=true)
Set the pin length.
Definition: lib_pin.cpp:363
static int GetLastPinLength()
Definition: pinedit.cpp:71
static int m_convert
Definition: libeditframe.h:116
static bool LastPinCommonUnit
Definition: pinedit.cpp:63
void ClearTempCopyComponent()
Delete temporary copy of the current component and clear pointer.
static int GetLastPinNameSize()
Definition: pinedit.cpp:79
void SetShape(GRAPHIC_PINSHAPE aShape)
Set the shape of the pin to aShape.
Definition: lib_pin.cpp:298
static bool LastPinCommonConvert
Definition: pinedit.cpp:62
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:354
static bool LastPinVisible
Definition: pinedit.cpp:64
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Definition: libeditframe.h:166
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:280
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
void deleteItem(wxDC *aDC)
Deletes the currently selected draw item.
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:59
static int GetLastPinNumSize()
Definition: pinedit.cpp:87
static int LastPinOrient
Definition: pinedit.cpp:60
static wxPoint PinPreviousPos
Definition: pinedit.cpp:58
static GRAPHIC_PINSHAPE LastPinShape
Definition: pinedit.cpp:61
void SetConvert(int aConvert)
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:450
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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
Definition: libeditframe.h:112
#define IS_CANCELLED
flag set when edit dialogs are canceled when editing a
Definition: base_struct.h:140
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:212
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:387
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()
Definition: libeditframe.h:448
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 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:93
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 LIB_EDIT_FRAME::deleteItem ( wxDC *  aDC)
private

Deletes the currently selected draw item.

Parameters
aDCThe device context to draw upon when removing item.

Definition at line 1405 of file libeditframe.cpp.

References EDA_DRAW_PANEL::CallEndMouseCapture(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), LIB_ITEM::GetConvert(), GetCurPart(), GetDrawItem(), 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(), OnLeftClick(), and Process_Special_Functions().

1406 {
1407  LIB_ITEM* item = GetDrawItem();
1408 
1409  wxCHECK_RET( item != NULL, "No drawing item selected to delete." );
1410 
1411  m_canvas->CrossHairOff( aDC );
1412 
1413  LIB_PART* part = GetCurPart();
1414 
1415  SaveCopyInUndoList( part );
1416 
1417  if( item->Type() == LIB_PIN_T )
1418  {
1419  LIB_PIN* pin = static_cast<LIB_PIN*>( item );
1420  wxPoint pos = pin->GetPosition();
1421 
1422  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1423 
1424  // when pin edition is synchronized, all pins of the same body style
1425  // are removed:
1426  if( SynchronizePins() )
1427  {
1428  int curr_convert = pin->GetConvert();
1429  LIB_PIN* next_pin = part->GetNextPin();
1430 
1431  while( next_pin != NULL )
1432  {
1433  pin = next_pin;
1434  next_pin = part->GetNextPin( pin );
1435 
1436  if( pin->GetPosition() != pos )
1437  continue;
1438 
1439  if( pin->GetConvert() != curr_convert )
1440  continue;
1441 
1442  part->RemoveDrawItem( pin );
1443  }
1444  }
1445 
1446  m_canvas->Refresh();
1447  }
1448  else
1449  {
1450  if( m_canvas->IsMouseCaptured() )
1451  {
1452  m_canvas->CallEndMouseCapture( aDC );
1453  }
1454  else
1455  {
1456  part->RemoveDrawItem( item, m_canvas, aDC );
1457  m_canvas->Refresh();
1458  }
1459  }
1460 
1461  SetDrawItem( NULL );
1462  m_lastDrawItem = NULL;
1463  OnModify();
1464  m_canvas->CrossHairOn( aDC );
1465 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
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:332
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.
Definition: libeditframe.h:166
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
bool IsMouseCaptured() const
Define a library symbol object.
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:108
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:259
wxPoint GetPosition() const override
Return the current draw object position.
Definition: lib_pin.h:450
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:93
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:266
LIB_ITEM * GetDrawItem() const
Definition: libeditframe.h:440
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 SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Create a copy of the current component, and save it in the undo list.
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 632 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(), LIB_EDIT_FRAME(), LoadOneLibraryPartAux(), OnEditComponentProperties(), OnLeftClick(), OnSelectAlias(), and OnSelectPart().

633 {
634  LIB_ALIAS* alias;
635  LIB_PART* part = GetCurPart();
636 
637  ClearMsgPanel();
638 
639  if( !part )
640  return;
641 
642  wxString msg = part->GetName();
643 
644  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
645 
646  if( m_aliasName == part->GetName() )
647  msg = _( "None" );
648  else
649  msg = m_aliasName;
650 
651  alias = part->GetAlias( m_aliasName );
652 
653  wxCHECK_RET( alias != NULL, "Alias not found in symbol." );
654 
655  AppendMsgPanel( _( "Alias" ), msg, RED, 8 );
656 
657  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
658  msg = UnitLetter[m_unit];
659 
660  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
661 
662  if( m_convert > 1 )
663  msg = _( "Convert" );
664  else
665  msg = _( "Normal" );
666 
667  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
668 
669  if( part->IsPower() )
670  msg = _( "Power Symbol" );
671  else
672  msg = _( "Symbol" );
673 
674  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
675  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
676  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
677  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
678 }
Definition: colors.h:57
Part library alias object definition.
static int m_convert
Definition: libeditframe.h:116
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.
Definition: libeditframe.h:166
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:773
wxString GetDocFileName() const
Definition: colors.h:58
static wxString m_aliasName
Definition: libeditframe.h:109
static int m_unit
Definition: libeditframe.h:112
const wxString & GetName() const
wxString GetKeyWords() const
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:784
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 59 of file libedit.cpp.

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

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

60 {
61  wxString lib = GetCurLib();
62  wxString title = _( "Symbol Library Editor - " );
63 
64  if( !lib.empty() && Prj().SchSymbolLibTable()->HasLibrary( lib ) )
65  {
66  wxString fileName = Prj().SchSymbolLibTable()->GetFullURI( lib );
67 
68  title += lib + " (" + fileName + ")";
69 
70  if( wxFileName::FileExists( fileName ) && !wxFileName::IsFileWritable( fileName ) )
71  title += " " + _( "[Read Only]" );
72  }
73  else
74  title += _( "no library selected" );
75 
76  SetTitle( title );
77 }
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(), 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:88
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
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::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

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

521 {
522  wxString msg;
523 
524  switch( g_UserUnit )
525  {
526  case INCHES:
527  msg = _( "Inches" );
528  break;
529 
530  case MILLIMETRES:
531  msg = _( "mm" );
532  break;
533 
534  default:
535  msg = _( "Units" );
536  break;
537  }
538 
539  SetStatusText( msg, 4 );
540 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
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 235 of file basicframe.cpp.

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

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

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

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

Definition at line 77 of file worksheet.cpp.

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

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

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

Referenced by OnLeftDClick(), and Process_Special_Functions().

45 {
46  wxString newFieldValue;
47  wxString title;
48  wxString caption;
49 
50  if( aField == NULL )
51  return;
52 
53  LIB_PART* parent = aField->GetParent();
54  wxCHECK( parent, /* void */ );
55 
56  // Editing the component value field is equivalent to creating a new component based
57  // on the current component. Set the dialog message to inform the user.
58  if( aField->GetId() == VALUE )
59  {
60  caption = _( "Component Name" );
61  title = _( "Enter a name to create a new component based on this one." );
62  }
63  else
64  {
65  caption.Printf( _( "Edit Field %s" ), GetChars( aField->GetName() ) );
66  title.Printf( _( "Enter a new value for the %s field." ),
67  GetChars( aField->GetName().Lower() ) );
68  }
69 
70  DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
71 
72  // The dialog may invoke a kiway player for footprint fields
73  // so we must use a quasimodal dialog.
74  if( dlg.ShowQuasiModal() != wxID_OK )
75  return;
76 
77  newFieldValue = dlg.GetText();
78  wxString oldFieldValue = aField->GetFullText( m_unit );
79  bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
80 
81  if( renamed )
82  {
83  wxString msg;
84  wxString lib = GetCurLib();
85 
86  // Test the current library for name conflicts
87  if( !lib.empty() && m_libMgr->PartExists( newFieldValue, lib ) )
88  {
89  msg.Printf( _(
90  "The name \"%s\" conflicts with an existing entry in the symbol library \"%s\"." ),
91  newFieldValue, lib );
92 
93  DisplayErrorMessage( this, msg );
94  return;
95  }
96 
97  parent->SetName( newFieldValue );
98 
99  if( !parent->HasAlias( m_aliasName ) )
100  m_aliasName = newFieldValue;
101 
102  m_libMgr->RemovePart( oldFieldValue, lib );
103  m_libMgr->UpdatePart( parent, lib );
104 
105  // Reselect the renamed part
106  m_treePane->GetCmpTree()->SelectLibId( LIB_ID( lib, newFieldValue ) );
107  }
108 
109  if( !aField->InEditMode() && !renamed )
110  SaveCopyInUndoList( parent );
111 
112  dlg.UpdateField( aField );
113  m_canvas->Refresh();
114 
115  OnModify();
117 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:88
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:332
bool RemovePart(const wxString &aName, const wxString &aLibrary)
Removes the part from the part buffer.
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
Definition: libeditframe.h:67
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:235
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.
bool UpdatePart(LIB_PART *aPart, const wxString &aLibrary)
Updates the part buffer with a new version of the part.
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:93
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
Definition: libeditframe.h:109
static int m_unit
Definition: libeditframe.h:112
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
Definition: libeditframe.h:66
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Create a copy of the current component, and save it in the undo list.
void LIB_EDIT_FRAME::EditGraphicSymbol ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 58 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 OnLeftDClick(), and Process_Special_Functions().

59 {
60  if( DrawItem == NULL )
61  return;
62 
63  LIB_PART* symbol = DrawItem->GetParent();
64 
65  DIALOG_LIB_EDIT_DRAW_ITEM dialog( this, DrawItem->GetTypeName() );
66 
68 
69  wxString val = StringFromValue( g_UserUnit, DrawItem->GetWidth() );
70  dialog.SetWidth( val );
71  dialog.SetApplyToAllUnits( DrawItem->GetUnit() == 0 );
72  dialog.EnableApplyToAllUnits( symbol && symbol->GetUnitCount() > 1 );
73  dialog.SetApplyToAllConversions( DrawItem->GetConvert() == 0 );
74  bool enblConvOptStyle = symbol && symbol->HasConversion();
75  // if a symbol contains no graphic items, symbol->HasConversion() returns false.
76  // but when creating a new symbol, with DeMorgan option set, the ApplyToAllConversions
77  // must be enabled even if symbol->HasConversion() returns false in order to be able
78  // to create graphic items shared by all body styles
79  if( GetShowDeMorgan() )
80  enblConvOptStyle = true;
81 
82  dialog.EnableApplyToAllConversions( enblConvOptStyle );
83  dialog.SetFillStyle( DrawItem->GetFillMode() );
84  dialog.EnableFillStyle( DrawItem->IsFillable() );
85 
86  if( dialog.ShowModal() == wxID_CANCEL )
87  return;
88 
89  // Init default values (used to create a new draw item)
90  val = dialog.GetWidth();
92  m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
93  m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
94 
95 #if 0
96  /* TODO: see if m_drawFillStyle must retain the last fill option or not.
97  * if the last is Filled, having next new graphic items created
98  * with filled body is often bad.
99  * currently m_drawFillStyle is left with the default value (not filled)
100  */
101  if( DrawItem->IsFillable() )
102  m_drawFillStyle = (FILL_T) dialog.GetFillStyle();
103 #endif
104 
105  // Save copy for undo if not in edit (edit command already handle the save copy)
106  if( !DrawItem->InEditMode() )
107  SaveCopyInUndoList( DrawItem->GetParent() );
108 
109  if( m_drawSpecificUnit )
110  DrawItem->SetUnit( GetUnit() );
111  else
112  DrawItem->SetUnit( 0 );
113 
115  DrawItem->SetConvert( GetConvert() );
116  else
117  DrawItem->SetConvert( 0 );
118 
119  if( DrawItem->IsFillable() )
120  DrawItem->SetFillMode( (FILL_T) dialog.GetFillStyle() );
121 
122  DrawItem->SetWidth( m_drawLineWidth );
123 
124  OnModify( );
125 
126  MSG_PANEL_ITEMS items;
127  DrawItem->GetMsgPanelInfo( items );
128  SetMsgPanel( items );
129  m_canvas->Refresh();
130 }
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:332
int GetUnit() const
wxString ReturnUnitSymbol(EDA_UNITS_T aUnit, const wxString &formatString)
Returns the units symbol.
Definition: base_units.cpp:425
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:204
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:793
wxString GetTypeName()
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:369
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:56
Dialog to edit library component graphic items.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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()
Definition: libeditframe.h:444
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:103
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:70
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
Definition: libeditframe.h:106
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:70
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
Definition: libeditframe.h:78
int GetConvert() const
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Create a copy of the current component, and save it in the undo list.
void LIB_EDIT_FRAME::EditSymbolText ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

Definition at line 1106 of file libeditframe.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(), OnLeftDClick(), and Process_Special_Functions().

1107 {
1108  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
1109  return;
1110 
1111  // Deleting old text
1112  if( DC && !DrawItem->InEditMode() )
1113  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1114  DefaultTransform );
1115 
1116  DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
1117  frame->ShowModal();
1118  frame->Destroy();
1119  OnModify();
1120 
1121  // Display new text
1122  if( DC && !DrawItem->InEditMode() )
1123  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1124  NULL, DefaultTransform );
1125 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
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
Definition: libeditframe.h:145
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
#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 1739 of file libeditframe.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().

1740 {
1741  SetCurLib( wxEmptyString );
1742  SetCurPart( nullptr );
1743  m_aliasName.Empty();
1744  m_lastDrawItem = nullptr;
1745  SetDrawItem( NULL );
1748  Zoom_Automatique( false );
1749  Refresh();
1750 }
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:150
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
void Refresh()
Update the board display after modifying it bu a python script (note: it is automatically called by a...
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:108
static wxString m_aliasName
Definition: libeditframe.h:109
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
Definition: libeditframe.h:705
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 350 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(), OnLeftClick(), OnLeftDClick(), and Process_Special_Functions().

351 {
352  LIB_ITEM* item = GetDrawItem();
353 
354  if( item == NULL )
355  return;
356 
357  if( LIB_PART* part = GetCurPart() )
358  {
359  if( GetToolId() != ID_NO_TOOL_SELECTED )
360  SetCursor( wxCURSOR_PENCIL );
361  else
362  SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
363 
364  if( GetTempCopyComponent() ) // used when editing an existing item
366  else
367  {
368  // When creating a new item, there is still no change for the
369  // current symbol. So save it.
370  SaveCopyInUndoList( part );
371  }
372 
373  if( item->IsNew() )
374  part->AddDrawItem( item );
375 
376  item->EndEdit( GetCrossHairPosition( true ) );
377 
378  SetDrawItem( NULL );
379 
380  OnModify();
381 
382  m_canvas->SetMouseCapture( NULL, NULL );
383  m_canvas->Refresh();
384  }
385 }
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:332
bool IsNew() const
Definition: base_struct.h:243
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.
Definition: libeditframe.h:166
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
Define a library symbol object.
LIB_PART * GetTempCopyComponent()
Definition: libeditframe.h:470
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
int GetToolId() const
Definition: draw_frame.h:480
LIB_ITEM * GetDrawItem() const
Definition: libeditframe.h:440
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 SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Create a copy of the current component, and save it in the undo list.
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 267 of file draw_frame.cpp.

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

Referenced by GERBVIEW_FRAME::SetCurItem(), and PCB_EDIT_FRAME::Solve().

268 {
269  if( m_messagePanel )
271 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:132
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 367 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::OnSockRequest().

367 {}
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(), EDA_BASE_FRAME::GetMruPath(), Prj(), EDA_BASE_FRAME::SetMruPath(), and EDA_BASE_FRAME::WriteHotkeyConfig().

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(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

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)
Definition: wxstruct.h:367
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
Definition: wxstruct.h:369
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 436 of file libedit.cpp.

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

Referenced by OnPasteDuplicatePart().

437 {
438  wxString newName;
439 
440  for( unsigned int i = 0; i < aPart->GetAliasCount(); ++i )
441  {
442  LIB_ALIAS* alias = aPart->GetAlias( i );
443  int sfx = 0;
444  newName = alias->GetName();
445 
446  while( m_libMgr->PartExists( newName, aLibrary ) )
447  {
448  newName = wxString::Format( "%s_%d", alias->GetName(), sfx );
449  ++sfx;
450  }
451 
452  if( i == 0 )
453  aPart->SetName( newName );
454  else
455  alias->SetName( newName );
456  }
457 }
Part library alias object definition.
LIB_ALIAS * GetAlias(size_t aIndex)
LIB_MANAGER * m_libMgr
manager taking care of temporary modificatoins
Definition: libeditframe.h:67
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
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_BASE_FRAME::GetScreen(), EDA_ITEM::GetState(), EDA_DRAW_FRAME::m_movingCursorWithKeyboard, OnHotKey(), EDA_DRAW_FRAME::RefreshCrossHair(), EDA_DRAW_FRAME::SetCrossHairPosition(), STATE_NO_BLOCK, and SCH_BASE_FRAME::UpdateStatusBar().

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  UpdateStatusBar();
312 
313  return keyHandled;
314 }
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
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:264
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:142
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 1340 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().

1342 {
1343  bool key_handled = false;
1344 
1345  // If requested snap the current position to the grid
1346  if( aSnapToGrid )
1347  *aPos = GetNearestGridPosition( *aPos );
1348 
1349  switch( aHotKey )
1350  {
1351  // All these keys have almost the same treatment
1352  case GR_KB_CTRL | WXK_NUMPAD8:
1353  case GR_KB_CTRL | WXK_UP:
1354  case GR_KB_CTRL | WXK_NUMPAD2:
1355  case GR_KB_CTRL | WXK_DOWN:
1356  case GR_KB_CTRL | WXK_NUMPAD4:
1357  case GR_KB_CTRL | WXK_LEFT:
1358  case GR_KB_CTRL | WXK_NUMPAD6:
1359  case GR_KB_CTRL | WXK_RIGHT:
1360  case WXK_NUMPAD8:
1361  case WXK_UP:
1362  case WXK_NUMPAD2:
1363  case WXK_DOWN:
1364  case WXK_NUMPAD4:
1365  case WXK_LEFT:
1366  case WXK_NUMPAD6:
1367  case WXK_RIGHT:
1368  key_handled = true;
1369  {
1370  /* Here's a tricky part: when doing cursor key movement, the
1371  * 'previous' point should be taken from memory, *not* from the
1372  * freshly computed position in the event. Otherwise you can't do
1373  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1374  * the automatic motion event generated by cursor warping */
1375  wxRealPoint gridSize = GetScreen()->GetGridSize();
1376  *aPos = GetCrossHairPosition();
1377 
1378  // Bonus: ^key moves faster (x10)
1379  switch( aHotKey )
1380  {
1381  case GR_KB_CTRL|WXK_NUMPAD8:
1382  case GR_KB_CTRL|WXK_UP:
1383  aPos->y -= KiROUND( 10 * gridSize.y );
1384  break;
1385 
1386  case GR_KB_CTRL|WXK_NUMPAD2:
1387  case GR_KB_CTRL|WXK_DOWN:
1388  aPos->y += KiROUND( 10 * gridSize.y );
1389  break;
1390 
1391  case GR_KB_CTRL|WXK_NUMPAD4:
1392  case GR_KB_CTRL|WXK_LEFT:
1393  aPos->x -= KiROUND( 10 * gridSize.x );
1394  break;
1395 
1396  case GR_KB_CTRL|WXK_NUMPAD6:
1397  case GR_KB_CTRL|WXK_RIGHT:
1398  aPos->x += KiROUND( 10 * gridSize.x );
1399  break;
1400 
1401  case WXK_NUMPAD8:
1402  case WXK_UP:
1403  aPos->y -= KiROUND( gridSize.y );
1404  break;
1405 
1406  case WXK_NUMPAD2:
1407  case WXK_DOWN:
1408  aPos->y += KiROUND( gridSize.y );
1409  break;
1410 
1411  case WXK_NUMPAD4:
1412  case WXK_LEFT:
1413  aPos->x -= KiROUND( gridSize.x );
1414  break;
1415 
1416  case WXK_NUMPAD6:
1417  case WXK_RIGHT:
1418  aPos->x += KiROUND( gridSize.x );
1419  break;
1420 
1421  default: /* Can't happen since we entered the statement */
1422  break;
1423  }
1424 
1425  m_canvas->MoveCursor( *aPos );
1427  }
1428  break;
1429 
1430  default:
1431  break;
1432  }
1433 
1434  return key_handled;
1435 }
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:360
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:356
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
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.
#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:142
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 225 of file wxstruct.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

225 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:158
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().

165 {
166  wxASSERT( GetScreen() );
167  return GetScreen()->GetAuxOrigin();
168 }
const wxPoint & GetAuxOrigin() const
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 346 of file draw_frame.h.

References EDA_DRAW_FRAME::m_canvas.

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(), LEGACY_ARRAY_CREATOR::finalise(), getOptimalModulePlacement(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::KiwayMailIn(), GERBVIEW_FRAME::LoadGerberJobFile(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_ANNOTATE::OnApplyClick(), SCH_EDIT_FRAME::OnAutoplaceFields(), 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_EXCHANGE_MODULE::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(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Process_Config(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), PCB_BASE_FRAME::ResetModuleTextSizes(), 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(), 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_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings().

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

Definition at line 51 of file libedit_undo_redo.cpp.

References DisplayCmpDoc(), DisplayLibInfos(), GetCurPart(), ITEM_PICKER::GetItem(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), LIB_PART::HasAlias(), LIB_PART::HasConversion(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_my_part, OnModify(), BASE_SCREEN::PopCommandFromRedoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToUndoList(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), SetDrawItem(), SetShowDeMorgan(), UpdateAliasSelectList(), UpdatePartSelectList(), and UR_LIBEDIT.

52 {
53  if( GetScreen()->GetRedoCommandCount() <= 0 )
54  return;
55 
56  // Store the current part in the undo buffer
57  PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
58  LIB_PART* part = GetCurPart();
59  ITEM_PICKER wrapper( part, UR_LIBEDIT );
60  lastcmd->PushItem( wrapper );
61  GetScreen()->PushCommandToUndoList( lastcmd );
62 
63  // Load the last redo entry
64  lastcmd = GetScreen()->PopCommandFromRedoList();
65  wrapper = lastcmd->PopItem();
66  delete lastcmd;
67  part = (LIB_PART*) wrapper.GetItem();
68 
69  // Do not delete the previous part by calling SetCurPart( part )
70  // which calls delete <previous part>.
71  // <previous part> is now put in undo list and is owned by this list
72  // Just set the current part to the part which come from the redo list
73  m_my_part = part;
74 
75  if( !part )
76  return;
77 
78  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
79  m_aliasName = part->GetName();
80 
81  SetDrawItem( NULL );
84  SetShowDeMorgan( part->HasConversion() );
86  DisplayCmpDoc();
87  OnModify();
88  m_canvas->Refresh();
89 }
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToUndoList add a command to undo in undo list delete the very old commands when t...
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:332
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.
void UpdateAliasSelectList()
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:61
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:446
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:59
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Definition: libeditframe.h:166
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted...
Define a library symbol object.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:632
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static wxString m_aliasName
Definition: libeditframe.h:109
ITEM_PICKER PopItem()
Function PopItem.
const wxString & GetName() const
void UpdatePartSelectList()
void LIB_EDIT_FRAME::GetComponentFromUndoList ( wxCommandEvent &  event)
private

Definition at line 92 of file libedit_undo_redo.cpp.

References DisplayCmpDoc(), DisplayLibInfos(), GetCurPart(), ITEM_PICKER::GetItem(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), LIB_PART::HasAlias(), LIB_PART::HasConversion(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_my_part, OnModify(), BASE_SCREEN::PopCommandFromUndoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToRedoList(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), SetDrawItem(), SetShowDeMorgan(), UpdateAliasSelectList(), UpdatePartSelectList(), and UR_LIBEDIT.

93 {
94  if( GetScreen()->GetUndoCommandCount() <= 0 )
95  return;
96 
97  // Store the current part in the redo buffer
98  PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
99  LIB_PART* part = GetCurPart();
100  ITEM_PICKER wrapper( part, UR_LIBEDIT );
101  lastcmd->PushItem( wrapper );
102  GetScreen()->PushCommandToRedoList( lastcmd );
103 
104  // Load the last undo entry
105  lastcmd = GetScreen()->PopCommandFromUndoList();
106  wrapper = lastcmd->PopItem();
107  delete lastcmd;
108  part = (LIB_PART*) wrapper.GetItem();
109 
110  printf("RestoreCopy [%p]\n", part);
111 
112  // Do not delete the previous part by calling SetCurPart( part ),
113  // which calls delete <previous part>.
114  // <previous part> is now put in redo list and is owned by this list.
115  // Just set the current part to the part which come from the undo list
116  m_my_part = part;
117 
118  if( !part )
119  return;
120 
121  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
122  m_aliasName = part->GetName();
123 
124  SetDrawItem( NULL );
127  SetShowDeMorgan( part->HasConversion() );
128  DisplayLibInfos();
129  DisplayCmpDoc();
130  OnModify();
131  m_canvas->Refresh();
132 }
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:332
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.
void UpdateAliasSelectList()
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:61
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:446
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:59
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
Definition: libeditframe.h:166
void SetDrawItem(LIB_ITEM *drawItem)
Definition: libeditframe.h:442
Define a library symbol object.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:632
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static wxString m_aliasName
Definition: libeditframe.h:109
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
void UpdatePartSelectList()
int LIB_EDIT_FRAME::GetConvert ( )
inline

Definition at line 425 of file libeditframe.h.

References m_convert.

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

425 { return m_convert; }
static int m_convert
Definition: libeditframe.h:116
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 1233 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::CreateTarget(), 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(), PCB_EDIT_FRAME::EditDimension(), 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_MODULE_MODULE_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_MODULE_EDITOR::OnEditValue(), DIALOG_MODULE_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(), 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().

1234 {
1235  // subject to change, borrow from old BASE_SCREEN for now.
1236  if( IsGalCanvasActive() )
1237  {
1239 
1240  return wxPoint( cursor.x, cursor.y );
1241  }
1242  else
1243  {
1244  BASE_SCREEN* screen = GetScreen(); // virtual call
1245  return screen->getCrossHairPosition( aInvertY );
1246  }
1247 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:356
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
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:871
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:879
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 1271 of file draw_frame.cpp.

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

1272 {
1273  BASE_SCREEN* screen = GetScreen(); // virtual call
1274  return screen->getCrossHairScreenPosition();
1275 }
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:356
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
wxString LIB_EDIT_FRAME::GetCurLib ( ) const

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

Definition at line 1021 of file libeditframe.cpp.

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

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), DisplayLibInfos(), EditField(), getTargetLib(), LoadComponentFromCurrentLib(), OnEditComponentProperties(), OnRevertLibrary(), SetCurLib(), and storeCurrentPart().

1022 {
1023  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
1024 
1025  if( !libNickname.empty() )
1026  {
1027  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
1028  {
1029  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
1030  libNickname = wxEmptyString;
1031  }
1032  }
1033 
1034  return libNickname;
1035 }
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 166 of file libeditframe.h.

References m_my_part.

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter(), BestZoom(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocFromRootToAlias(), copySelectedItems(), CreatePin(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(), 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(), InstallFieldsEditorDialog(), 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(), OnUpdatePinByPin(), OnUpdatePinTable(), OnUpdateRedo(), OnUpdateSelectAlias(), 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().

167  {
168  return m_my_part;
169  }
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:61
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 1257 of file draw_frame.cpp.

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

1258 {
1259  BASE_SCREEN* screen = GetScreen(); // virtual call
1260  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1261 }
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:356
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
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 186 of file libeditframe.h.

References m_defaultPinLength.

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

186 { return m_defaultPinLength; }
static int m_defaultPinLength
Default pin length.
Definition: libeditframe.h:138
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 894 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().

894 { 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 SCH_PRINTOUT::DrawPage(), DIALOG_RESCUE_EACH::renderPreview(), and DIALOG_CHOOSE_COMPONENT::RenderPreview().

121 {
123 }
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
LIB_ITEM* LIB_EDIT_FRAME::GetDrawItem ( ) const
inline
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 404 of file basicframe.cpp.

References Format(), GetChars(), KIFACE_I::GetFileHistory(), 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(), and GERBVIEW_FRAME::OnZipFileHistory().

406 {
407  wxFileHistory* fileHistory = aFileHistory;
408 
409  if( !fileHistory )
410  fileHistory = &Kiface().GetFileHistory();
411 
412  int baseId = fileHistory->GetBaseId();
413 
414  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
415 
416  unsigned i = cmdId - baseId;
417 
418  if( i < fileHistory->GetCount() )
419  {
420  wxString fn = fileHistory->GetHistoryFile( i );
421 
422  if( wxFileName::FileExists( fn ) )
423  return fn;
424  else
425  {
426  wxString msg = wxString::Format(
427  _( "File \"%s\" was not found." ),
428  GetChars( fn ) );
429 
430  wxMessageBox( msg );
431 
432  fileHistory->RemoveFileFromHistory( i );
433  }
434  }
435 
436  return wxEmptyString;
437 }
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
FILL_T LIB_EDIT_FRAME::GetFillStyle ( void  )
inline

Definition at line 452 of file libeditframe.h.

References m_drawFillStyle.

452 { return m_drawFillStyle; }
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:103
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 879 of file draw_frame.h.

References EDA_DRAW_FRAME::m_galCanvas.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_TOOL::canvas(), GERBVIEW_FRAME::Clear_DrawLayers(), 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(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), PCB_EDIT_FRAME::ListNetsAndSelect(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), 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_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), BOARD_COMMIT::Push(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableAutoPan(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), PCB_BASE_FRAME::SwitchCanvas(), GERBVIEW_FRAME::SwitchCanvas(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), PCB_BASE_EDIT_FRAME::UseGalCanvas(), FOOTPRINT_EDIT_FRAME::UseGalCanvas(), PCB_BASE_FRAME::UseGalCanvas(), GERBVIEW_FRAME::UseGalCanvas(), EDA_DRAW_FRAME::UseGalCanvas(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOut(), COMMON_TOOLS::ZoomPreset(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

879 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:68
KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_FRAME::GetGalDisplayOptions ( )
inlineinherited
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

Function GetGridColor() , virtual.

Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 509 of file draw_frame.h.

References EDA_DRAW_FRAME::m_gridColor.

Referenced by EDA_DRAW_PANEL::DrawGridAxis(), GERBVIEW_FRAME::GetVisibleElementColor(), and EDA_DRAW_FRAME::SaveSettings().

510  {
511  return m_gridColor;
512  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:83
const wxPoint& SCH_BASE_FRAME::GetGridOrigin ( ) const
inlineoverridevirtualinherited

Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid.

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

Implements EDA_DRAW_FRAME.

Definition at line 139 of file sch_base_frame.h.

140  {
141  static wxPoint zero;
142  return zero;
143  }
wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint aPosition) const
inherited

Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled.

Otherwise, the original positions is returned.

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

Definition at line 592 of file draw_frame.cpp.

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

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

593 {
594  wxPoint pos = aPosition;
595 
596  if( m_currentScreen != NULL && m_snapToGrid )
597  pos = GetNearestGridPosition( aPosition );
598 
599  return pos;
600 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:63
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:65
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping.

Definition at line 392 of file draw_frame.h.

References EDA_DRAW_FRAME::m_hotkeysDescrList.

Referenced by PCBNEW_CONTROL::ShowHelp().

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

>

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

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

Implements EDA_DRAW_FRAME.

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

References GetDescriptorFromCommand().

645 {
646  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
647 
648  if( HK_Descr == NULL )
649  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
650 
651  return HK_Descr;
652 }
static EDA_HOTKEY * common_Hotkey_List[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
static EDA_HOTKEY * libEdit_Hotkey_List[]
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
int LIB_EDIT_FRAME::GetIconScale ( )
overridevirtual

Function GetIconScale.

Return the desired scaling for toolbar/menubar icons in fourths (e.g. 4 is unity). A negative number indicates autoscale based on font size.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1753 of file libeditframe.cpp.

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

Referenced by DIALOG_LIBEDIT_OPTIONS::TransferDataToWindow().

1754 {
1755  int scale = 0;
1756  Kiface().KifaceSettings()->Read( LibIconScaleEntry, &scale, 0 );
1757  return scale;
1758 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
const wxChar LibIconScaleEntry[]
const int scale
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 531 of file basicframe.cpp.

References ShowAboutDialog().

532 {
533  void