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 ()
 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 ()
 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 component editor frame More...
 
void InstallConfigFrame (wxCommandEvent &event)
 
void OnPreferencesOptions (wxCommandEvent &event)
 
void Process_Config (wxCommandEvent &event)
 
bool SynchronizePins ()
 
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 OnImportPart (wxCommandEvent &event)
 Routine to read one part. More...
 
void OnExportPart (wxCommandEvent &event)
 Function OnExportPart creates a new library and backup the current component in this library or export the component of the current library. More...
 
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 DeleteOnePart (wxCommandEvent &event)
 Delete a symbol from the current library. More...
 
void CreateNewLibraryPart (wxCommandEvent &event)
 Create a new library symbol. More...
 
void OnCreateNewPartFromExisting (wxCommandEvent &event)
 
void OnEditComponentProperties (wxCommandEvent &event)
 
void InstallFieldsEditorDialog (wxCommandEvent &event)
 
void LoadOneLibraryPart (wxCommandEvent &event)
 Loads a symbol from the currently selected library. More...
 
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 OnSaveCurrentPart (wxCommandEvent &aEvent)
 
void OnUpdateSelectTool (wxUpdateUIEvent &aEvent)
 
void OnUpdateEditingPart (wxUpdateUIEvent &event)
 
void OnUpdateNotEditingPart (wxUpdateUIEvent &event)
 
void OnUpdateUndo (wxUpdateUIEvent &event)
 
void OnUpdateRedo (wxUpdateUIEvent &event)
 
void OnUpdateSaveCurrentLib (wxUpdateUIEvent &event)
 
void OnUpdateSaveCurrentLibAs (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 CreateOptionToolbar ()
 
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 ()
 
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...
 
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, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
void OnEditSymbolLibTable (wxCommandEvent &aEvent)
 
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)
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
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 void InitBlockPasteInfos ()
 
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...
 
bool Enable (bool enable) override
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void 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

COMPONENT_SELECTION SelectComponentFromLibBrowser (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...
 
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...
 
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...
 
virtual void forceColorsToLegacy ()
 Helper function to coerce all colors to legacy-compatible when switching from GAL to legacy canvas. 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...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. More...
 
wxAuiToolBar * m_drawToolBar
 The tool bar that contains the buttons for quick access to the application draw tools. More...
 
wxAuiToolBar * m_optionsToolBar
 The options tool bar typcially located on the left edge of the main window. More...
 
EDA_MSG_PANELm_messagePanel
 Panel used to display information at the bottom of the main window. More...
 
int m_MsgFrameHeight
 
bool m_movingCursorWithKeyboard
 One-shot to avoid a recursive mouse event during hotkey movement. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

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[])
 
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...
 
void OnSaveActiveLibrary (wxCommandEvent &event)
 The command event handler to save the changes to the current library. More...
 
bool SaveActiveLibrary (bool newFile)
 Saves the changes to the current library. 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, int aUnit, int aConvert, bool aDeMorgan)
 Adds copies of aPin for aUnit in components with multiple parts and aConvert for components that have multiple body styles. 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 ()
 

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...
 
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_editPinsPerPartOrConvert
 Set to true to not synchronize pins at the same position when editing components with multiple parts 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...
 

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 LIB_ITEMm_drawItem = 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 52 of file libeditframe.h.

Member Typedef Documentation

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

Definition at line 170 of file sch_base_frame.h.

Constructor & Destructor Documentation

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

Definition at line 187 of file libeditframe.cpp.

References EDA_BASE_FRAME::config(), CreateOptionToolbar(), 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_editPinsPerPartOrConvert, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_DRAW_FRAME::m_hotkeysDescrList, EDA_DRAW_FRAME::m_LastGridSizeId, 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, EDA_DRAW_FRAME::m_UndoRedoCountMax, EDA_PANEINFO::MessageToolbarPane(), SCH_BASE_FRAME::OnEditSymbolLibTable(), ReCreateHToolbar(), ReCreateMenuBar(), ReCreateVToolbar(), PCAD2KICAD::Right, EDA_DRAW_FRAME::SetCrossHairPosition(), EDA_DRAW_PANEL::SetEnableBlockCommands(), BASE_SCREEN::SetGrid(), BASE_SCREEN::SetMaxUndoItems(), EDA_DRAW_FRAME::SetScreen(), SetShowDeMorgan(), SetShowElectricalType(), UpdateAliasSelectList(), UpdatePartSelectList(), EDA_PANEINFO::VerticalToolbarPane(), wxPoint::x, and wxPoint::y.

187  :
188  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
189  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
190 {
191  m_showAxis = true; // true to draw axis
192  SetShowDeMorgan( false );
193  m_drawSpecificConvert = true;
194  m_drawSpecificUnit = false;
198  SetShowElectricalType( true );
199 
200  m_my_part = NULL;
201  m_tempCopyComponent = NULL;
202 
203  // Delayed initialization
204  if( m_textSize == -1 )
206 
207  // Initialize grid id to the default value 50 mils:
209 
210  wxIcon icon;
211  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
212  SetIcon( icon );
213 
214  LoadSettings( config() );
215 
216  SetScreen( new SCH_SCREEN( aKiway ) );
217  GetScreen()->m_Center = true;
219 
220  SetCrossHairPosition( wxPoint( 0, 0 ) );
221 
222  // Ensure m_LastGridSizeId is an offset inside the allowed schematic range
223  if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
225 
226  if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
228 
229  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
230 
231  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
232 
233  if( m_canvas )
235 
236  ReCreateMenuBar();
239 
240  // Ensure the current alias name is valid if a part is loaded
241  // Sometimes it is not valid. This is the case
242  // when a part value (the part lib name), or the alias list was modified
243  // during a previous session and the modifications not saved in lib.
244  // Reopen libedit in a new session gives a non valid m_aliasName
245  // because the curr part is reloaded from the library (and this is the unmodified part)
246  // and the old alias name (from the previous edition) can be invalid
247  LIB_PART* part = GetCurPart();
248 
249  if( part == NULL )
250  m_aliasName.Empty();
251  else if( m_aliasName != part->GetName() )
252  {
253  LIB_ALIAS* alias = part->GetAlias( m_aliasName );
254 
255  if( !alias )
256  m_aliasName = part->GetName();
257  }
258 
260  DisplayLibInfos();
261  DisplayCmpDoc();
264 
265  m_auimgr.SetManagedWindow( this );
266 
267  EDA_PANEINFO horiz;
268  horiz.HorizontalToolbarPane();
269 
270  EDA_PANEINFO vert;
271  vert.VerticalToolbarPane();
272 
273  EDA_PANEINFO mesg;
274  mesg.MessageToolbarPane();
275 
276  m_auimgr.AddPane( m_mainToolBar,
277  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
278 
279  m_auimgr.AddPane( m_drawToolBar,
280  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right() );
281 
282  m_auimgr.AddPane( m_optionsToolBar,
283  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ).Left() );
284 
285  m_auimgr.AddPane( m_canvas,
286  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
287 
288  m_auimgr.AddPane( m_messagePanel,
289  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer(10) );
290 
291  m_auimgr.Update();
292 
293  Raise();
294  Show( true );
295 
296  Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
298 
299  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
300  wxPostEvent( this, evt );
301 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:487
#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 OnEditSymbolLibTable(wxCommandEvent &aEvent)
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:103
LIB_ALIAS * GetAlias(size_t aIndex)
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:141
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:380
#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:54
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:478
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:388
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:56
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:505
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:126
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 component 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:129
const wxString & GetName() const
#define LIB_EDIT_FRAME_NAME
Class LIB_PART defines a library part 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:110
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:123
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:145
void CreateOptionToolbar()
Definition: tool_lib.cpp:224
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:449
void SetShowElectricalType(bool aShow)
Definition: libeditframe.h:392
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:524
void ReCreateHToolbar() override
Definition: tool_lib.cpp:99
static wxString m_aliasName
Definition: libeditframe.h:93
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
void SetMaxUndoItems(int aMax)
void SetEnableBlockCommands(bool aEnable)
int m_repeatPinStep
Default repeat offset for pins in repeat place pin.
Definition: libeditframe.h:125
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:61
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:69
bool m_editPinsPerPartOrConvert
Set to true to not synchronize pins at the same position when editing components with multiple parts ...
Definition: libeditframe.h:78
void UpdatePartSelectList()
int GetDefaultTextSize()
Default size for text in general.
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:55
void ReCreateVToolbar() override
Definition: tool_lib.cpp:53
LIB_EDIT_FRAME::~LIB_EDIT_FRAME ( )

Definition at line 304 of file libeditframe.cpp.

References ID_EDIT_SYM_LIB_TABLE, m_drawItem, m_lastDrawItem, m_my_part, m_tempCopyComponent, and SCH_BASE_FRAME::OnEditSymbolLibTable().

305 {
306  Unbind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
308 
309  m_drawItem = m_lastDrawItem = NULL;
310 
311  delete m_tempCopyComponent;
312  delete m_my_part;
313  m_my_part = NULL;
314  m_tempCopyComponent = NULL;
315 }
void OnEditSymbolLibTable(wxCommandEvent &aEvent)
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:54
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:91
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:55

Member Function Documentation

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

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

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

Parameters
aMasterMenu= the menu to populate.

Definition at line 239 of file zoom.cpp.

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

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

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

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

767 {
768  if( m_messagePanel == NULL )
769  return;
770 
771  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
772 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
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
double LIB_EDIT_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

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

354 {
355  /* Please, note: wxMSW before version 2.9 seems have
356  * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
357  * edit file <wxWidgets>/src/msw/dc.cpp
358  * search for line static const int VIEWPORT_EXTENT = 1000;
359  * and replace by static const int VIEWPORT_EXTENT = 10000;
360  */
361  int dx, dy;
362 
363  LIB_PART* part = GetCurPart();
364 
365  if( part )
366  {
368 
369  dx = boundingBox.GetWidth();
370  dy = boundingBox.GetHeight();
371  SetScrollCenterPosition( wxPoint( 0, 0 ) );
372  }
373  else
374  {
375  const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
376 
377  dx = pageInfo.GetSizeIU().x;
378  dy = pageInfo.GetSizeIU().y;
379 
380  SetScrollCenterPosition( wxPoint( 0, 0 ) );
381  }
382 
383  wxSize size = m_canvas->GetClientSize();
384 
385  // Reserve a 10% margin around component bounding box.
386  double margin_scale_factor = 0.8;
387  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
388  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
389 
390  double bestzoom = std::max( zx, zy );
391 
392  // keep it >= minimal existing zoom (can happen for very small components
393  // for instance when starting a new component
394  if( bestzoom < GetScreen()->m_ZoomList[0] )
395  bestzoom = GetScreen()->m_ZoomList[0];
396 
397  return bestzoom;
398 }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Function GetBoundingBox.
static int m_convert
Definition: libeditframe.h:100
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
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Class LIB_PART defines a library part object.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static int m_unit
Definition: libeditframe.h:96
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
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:64
#define GR_KEY_INVALID
Definition: common.h:68
#define GR_KB_SHIFT
Definition: common.h:65
#define GR_KB_SHIFTCTRL
Definition: common.h:66
#define GR_KEY_NONE
Definition: common.h:69
#define MOUSE_MIDDLE
Definition: common.h:67
#define EDA_KEY_C
Definition: common.h:59
#define GR_KB_CTRL
Definition: common.h:63
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 597 of file basicframe.cpp.

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

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

599 {
600  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
601  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
602 
603  wxFileName autoSaveFileName = aFileName;
604 
605  // Check for auto save file.
606  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
607 
608  wxLogTrace( traceAutoSave,
609  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
610 
611  if( !autoSaveFileName.FileExists() )
612  return;
613 
614  wxString msg = wxString::Format( _(
615  "Well this is potentially embarrassing!\n"
616  "It appears that the last time you were editing the file\n"
617  "'%s'\n"
618  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
619  GetChars( aFileName.GetFullName() )
620  );
621 
622  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
623 
624  // Make a backup of the current file, delete the file, and rename the auto save file to
625  // the file name.
626  if( response == wxYES )
627  {
628  // Get the backup file name.
629  wxFileName backupFileName = aFileName;
630  backupFileName.SetExt( aBackupFileExtension );
631 
632  // If an old backup file exists, delete it. If an old copy of the file exists, rename
633  // it to the backup file name
634  if( aFileName.FileExists() )
635  {
636  // Remove the old file backup file.
637  if( backupFileName.FileExists() )
638  wxRemoveFile( backupFileName.GetFullPath() );
639 
640  // Rename the old file to the backup file name.
641  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
642  {
643  msg.Printf( _( "Could not create backup file <%s>" ),
644  GetChars( backupFileName.GetFullPath() ) );
645  wxMessageBox( msg );
646  }
647  }
648 
649  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
650  {
651  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
652  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
653  }
654  }
655  else
656  {
657  wxLogTrace( traceAutoSave,
658  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
659 
660  // Remove the auto save file when using the previous file as is.
661  wxRemoveFile( autoSaveFileName.GetFullPath() );
662  }
663 }
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 1041 of file libeditframe.cpp.

References m_tempCopyComponent.

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

1042 {
1043  delete m_tempCopyComponent;
1044  m_tempCopyComponent = NULL;
1045 }
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:55
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 342 of file libeditframe.h.

343  {
344  // Generate a wxCloseEvent
345  Close( false );
346  }
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 268 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().

269  {
270  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
271  return baseCfgName;
272  }
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 823 of file draw_frame.cpp.

References CoordinateToString().

824 {
825  return ::CoordinateToString( aValue, aConvertToMils );
826 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:117
void 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:347
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 148 of file symbdraw.cpp.

References AbortSymbolTraceOn(), LIB_ITEM::BeginEdit(), EDA_DRAW_PANEL::CallMouseCapture(), ClearTempCopyComponent(), DisplayError(), EditSymbolText(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_FRAME::GetCrossHairPosition(), 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_drawItem, m_drawLineWidth, m_drawSpecificConvert, m_drawSpecificUnit, m_textSize, m_unit, EDA_DRAW_PANEL::MoveCursorToCrossHair(), LIB_ITEM::SetConvert(), 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().

149 {
151  wxPoint drawPos = GetCrossHairPosition( true );
152 
153  // no temp copy -> the current version of component will be used for Undo
154  // This is normal when adding new items to the current component
156 
157  switch( GetToolId() )
158  {
160  m_drawItem = new LIB_ARC( LibEntry );
161  break;
162 
164  m_drawItem = new LIB_CIRCLE( LibEntry );
165  break;
166 
168  m_drawItem = new LIB_RECTANGLE( LibEntry );
169  break;
170 
172  m_drawItem = new LIB_POLYLINE( LibEntry );
173  break;
174 
176  {
177  LIB_TEXT* text = new LIB_TEXT( LibEntry );
178  text->SetTextSize( wxSize( m_textSize, m_textSize ) );
180 
181  // Enter the graphic text info
183  EditSymbolText( NULL, text );
184 
185  m_canvas->SetIgnoreMouseEvents( false );
187 
188  if( text->GetText().IsEmpty() )
189  {
190  delete text;
191  m_drawItem = NULL;
192  }
193  else
194  {
195  m_drawItem = text;
196  }
197  }
198  break;
199 
200  default:
201  DisplayError( this, wxT( "LIB_EDIT_FRAME::CreateGraphicItem() error" ) );
202  return NULL;
203  }
204 
205  if( m_drawItem )
206  {
207  m_drawItem->BeginEdit( IS_NEW, drawPos );
208 
209  // Don't set line parameters for text objects.
210  if( m_drawItem->Type() != LIB_TEXT_T )
211  {
214  }
215 
216  if( m_drawSpecificUnit )
218 
221 
222  // Draw initial symbol:
223  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
224  }
225  else
226  {
228  return NULL;
229  }
230 
232  m_canvas->SetIgnoreMouseEvents( false );
233 
234  return m_drawItem;
235 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:156
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
static double m_current_text_angle
Current text angle setting.
Definition: libeditframe.h:113
static int m_convert
Definition: libeditframe.h:100
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
Class LIB_TEXT defines a component library graphical text item.
Definition: lib_text.h:45
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
Function SetWidth sets 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:214
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:347
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
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:110
static void AbortSymbolTraceOn(EDA_DRAW_PANEL *Panel, wxDC *DC)
Definition: symbdraw.cpp:125
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:96
int GetToolId() const
Definition: draw_frame.h:471
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:86
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:322
static int m_drawLineWidth
Default line width for drawing or editing graphic items.
Definition: libeditframe.h:89
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:61
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:69
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
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,
int  aUnit,
int  aConvert,
bool  aDeMorgan 
)
private

Adds copies of aPin for aUnit in components with multiple parts and aConvert for components that have multiple body styles.

Parameters
aPinThe pin to copy.
aUnitThe unit to add a copy of aPin to.
aConvertThe alternate body style to add a copy of aPin to.
aDeMorganFlag to indicate if aPin should be created for the alternate body style.

Definition at line 491 of file pinedit.cpp.

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

Referenced by PlacePin().

492 {
493  int ii;
494  LIB_PIN* NewPin;
495 
496  if( !SynchronizePins() )
497  return;
498 
499  // Create "convert" pin at the current position.
500  if( aDeMorgan && ( aPin->GetConvert() != 0 ) )
501  {
502  NewPin = (LIB_PIN*) aPin->Clone();
503 
504  if( aPin->GetConvert() > 1 )
505  NewPin->SetConvert( 1 );
506  else
507  NewPin->SetConvert( 2 );
508 
509  aPin->GetParent()->AddDrawItem( NewPin );
510  }
511 
512  for( ii = 1; ii <= aPin->GetParent()->GetUnitCount(); ii++ )
513  {
514  if( ii == aUnit || aPin->GetUnit() != 0 )
515  continue; // Pin common to all units.
516 
517  NewPin = (LIB_PIN*) aPin->Clone();
518 
519  // To avoid mistakes, gives this pin a new pin number because
520  // it does no have the save pin number as the master pin
521  // Because we do not know the actual number, give it '??'
522  wxString unknownNum( wxT( "??" ) );
523  NewPin->SetNumber( unknownNum );
524 
525  if( aConvert != 0 )
526  NewPin->SetConvert( 1 );
527 
528  NewPin->SetUnit( ii );
529  aPin->GetParent()->AddDrawItem( NewPin );
530 
531  if( !( aDeMorgan && ( aPin->GetConvert() != 0 ) ) )
532  continue;
533 
534  NewPin = (LIB_PIN*) aPin->Clone();
535  NewPin->SetConvert( 2 );
536  // Gives this pin a new pin number
537  // Because we do not know the actual number, give it '??'
538  NewPin->SetNumber( unknownNum );
539 
540  if( aPin->GetUnit() != 0 )
541  NewPin->SetUnit( ii );
542 
543  aPin->GetParent()->AddDrawItem( NewPin );
544  }
545 }
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: lib_pin.cpp:1874
int GetUnit() const
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
void SetNumber(const wxString &aNumber)
Set the pin number.
Definition: lib_pin.h:203
LIB_PART * GetParent() const
void SetConvert(int aConvert)
int GetUnitCount() const
void SetUnit(int aUnit)
int GetConvert() const
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::CreateNewLibraryPart ( wxCommandEvent &  event)

Create a new library symbol.

If an old component is currently in edit, it is deleted.

Definition at line 597 of file libedit.cpp.

References BASE_SCREEN::ClearUndoRedoList(), DisplayCmpDoc(), DisplayError(), DisplayLibInfos(), EDA_DRAW_PANEL::EndMouseCapture(), Format(), DIALOG_LIB_NEW_COMPONENT::GetAlternateBodyStyle(), GetCurLib(), GetCurPart(), EDA_DRAW_PANEL::GetDefaultCursor(), DIALOG_LIB_NEW_COMPONENT::GetLockItems(), DIALOG_LIB_NEW_COMPONENT::GetName(), LIB_PART::GetName(), DIALOG_LIB_NEW_COMPONENT::GetPinNameInside(), LIB_PART::GetPinNameOffset(), DIALOG_LIB_NEW_COMPONENT::GetPinTextPosition(), DIALOG_LIB_NEW_COMPONENT::GetPowerSymbol(), DIALOG_LIB_NEW_COMPONENT::GetReference(), LIB_PART::GetReferenceField(), SCH_BASE_FRAME::GetScreen(), DIALOG_LIB_NEW_COMPONENT::GetShowPinName(), DIALOG_LIB_NEW_COMPONENT::GetShowPinNumber(), DIALOG_LIB_NEW_COMPONENT::GetUnitCount(), ID_NO_TOOL_SELECTED, IsOK(), LIB_PART::LockUnits(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_convert, m_drawItem, m_editPinsPerPartOrConvert, m_lastDrawItem, EDA_BASE_FRAME::m_mainToolBar, m_unit, name, OnModify(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), LIB_PART::SetConversion(), SetCurPart(), LIB_PART::SetNormal(), LIB_PART::SetPinNameOffset(), LIB_PART::SetPower(), SetShowDeMorgan(), LIB_PART::SetShowPinNames(), LIB_PART::SetShowPinNumbers(), LIB_FIELD::SetText(), LIB_PART::SetUnitCount(), LIB_PART::UnitsLocked(), UpdateAliasSelectList(), and UpdatePartSelectList().

598 {
599  wxString name;
600 
601  if( GetCurPart() && GetScreen()->IsModify() && !IsOK( this, _(
602  "All changes to the current symbol will be lost!\n\n"
603  "Clear the current symbol from the screen?" ) ) )
604  {
605  return;
606  }
607 
609 
610  m_drawItem = NULL;
611 
612  DIALOG_LIB_NEW_COMPONENT dlg( this );
613 
614  dlg.SetMinSize( dlg.GetSize() );
615 
616  if( dlg.ShowModal() == wxID_CANCEL )
617  return;
618 
619  if( dlg.GetName().IsEmpty() )
620  {
621  wxMessageBox( _( "This new symbol has no name and cannot be created." ) );
622  return;
623  }
624 
625  name = dlg.GetName();
626  name.Replace( " ", "_" );
627 
628  wxString lib = GetCurLib();
629 
630  // Test if there a component with this name already.
631  if( !lib.empty() && Prj().SchSymbolLibTable()->LoadSymbol( lib, name ) != NULL )
632  {
633  wxString msg = wxString::Format( _( "Symbol '%s' already exists in library '%s'" ),
634  name, lib );
635  DisplayError( this, msg );
636  return;
637  }
638 
639  LIB_PART* new_part = new LIB_PART( name );
640 
641  SetCurPart( new_part );
642  m_aliasName = new_part->GetName();
643 
644  new_part->GetReferenceField().SetText( dlg.GetReference() );
645  new_part->SetUnitCount( dlg.GetUnitCount() );
646 
647  // Initialize new_part->m_TextInside member:
648  // if 0, pin text is outside the body (on the pin)
649  // if > 0, pin text is inside the body
650  new_part->SetConversion( dlg.GetAlternateBodyStyle() );
651  SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
652 
653  if( dlg.GetPinNameInside() )
654  {
655  new_part->SetPinNameOffset( dlg.GetPinTextPosition() );
656 
657  if( new_part->GetPinNameOffset() == 0 )
658  new_part->SetPinNameOffset( 1 );
659  }
660  else
661  {
662  new_part->SetPinNameOffset( 0 );
663  }
664 
665  ( dlg.GetPowerSymbol() ) ? new_part->SetPower() : new_part->SetNormal();
666  new_part->SetShowPinNumbers( dlg.GetShowPinNumber() );
667  new_part->SetShowPinNames( dlg.GetShowPinName() );
668  new_part->LockUnits( dlg.GetLockItems() );
669 
670  if( dlg.GetUnitCount() < 2 )
671  new_part->LockUnits( false );
672 
673  m_unit = 1;
674  m_convert = 1;
675 
676  DisplayLibInfos();
677  DisplayCmpDoc();
680 
681  m_editPinsPerPartOrConvert = new_part->UnitsLocked() ? true : false;
682  m_lastDrawItem = NULL;
683 
685  OnModify();
686 
687  m_canvas->Refresh();
688  m_mainToolBar->Refresh();
689 }
bool UnitsLocked() const
void SetConversion(bool aSetConvert)
Set or clear the alternate body style (DeMorgan) for the part.
void SetPower()
int GetPinNameOffset()
static int m_convert
Definition: libeditframe.h:100
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:325
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
Definition: libeditframe.h:352
void UpdateAliasSelectList()
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:388
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:56
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetText(const wxString &aText) override
Sets the field text to aText.
Definition: lib_field.cpp:675
void SetUnitCount(int count)
Set the units per part count.
const wxString & GetName() const
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
Class LIB_PART defines a library part object.
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:91
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:145
void DisplayCmpDoc()
Display the documentation of the selected component.
Definition: libedit.cpp:449
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static wxString m_aliasName
Definition: libeditframe.h:93
static int m_unit
Definition: libeditframe.h:96
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 SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
void SetCurPart(LIB_PART *aPart)
Take ownership of aPart and notes that it is the one currently being edited.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
const char * name
Implementing DIALOG_LIB_NEW_COMPONENT.
wxString GetCurLib()
The nickname of the current library being edited and empty string if none.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
int GetDefaultCursor() const
Function GetDefaultCursor.
bool m_editPinsPerPartOrConvert
Set to true to not synchronize pins at the same position when editing components with multiple parts ...
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:71
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:129
void UpdatePartSelectList()
void LockUnits(bool aLockUnits)
void SetNormal()
void LIB_EDIT_FRAME::CreateOptionToolbar ( )

Definition at line 224 of file tool_lib.cpp.

References ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, ID_OPT_TOOLBAR, ID_TB_OPTIONS_SELECT_CURSOR, ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SHOW_GRID, KiBitmap(), EDA_BASE_FRAME::KICAD_AUI_TB_STYLE, and EDA_DRAW_FRAME::m_optionsToolBar.

Referenced by LIB_EDIT_FRAME().

225 {
226  if( m_optionsToolBar )
227  return;
228 
229  m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
230  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
231 
232  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
233  _( "Turn grid off" ), wxITEM_CHECK );
234 
235  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
236  KiBitmap( unit_inch_xpm ), _( "Set units to inches" ),
237  wxITEM_CHECK );
238 
239  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
240  KiBitmap( unit_mm_xpm ),
241  _( "Set units to millimeters" ), wxITEM_CHECK );
242 
243 #ifndef __APPLE__
244  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
245  KiBitmap( cursor_shape_xpm ),
246  _( "Change cursor shape" ), wxITEM_CHECK );
247 #endif // !__APPLE__
248 
249  m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, wxEmptyString,
250  KiBitmap( pin_show_etype_xpm ),
251  _( "Show pins electrical type" ), wxITEM_CHECK );
252 
253  m_optionsToolBar->Realize();
254 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:124
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:126
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
Definition: wxstruct.h:168
void LIB_EDIT_FRAME::CreatePin ( wxDC *  DC)
private

Definition at line 424 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_drawItem, 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(), 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().

425 {
426  LIB_PART* part = GetCurPart();
427 
428  if( !part )
429  return;
430 
431  part->ClearStatus();
432 
433  LIB_PIN* pin = new LIB_PIN( part );
434 
435  m_drawItem = pin;
436 
437  pin->SetFlags( IS_NEW );
438  pin->SetUnit( m_unit );
439  pin->SetConvert( m_convert );
440 
441  // Flag pins to consider
442  if( SynchronizePins() )
443  pin->SetFlags( IS_LINKED );
444 
445  pin->Move( GetCrossHairPosition( true ) );
446  pin->SetLength( GetLastPinLength() );
448  pin->SetType( LastPinType );
449  pin->SetShape( LastPinShape );
453  pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
454  pin->SetVisible( LastPinVisible );
455  PinPreviousPos = pin->GetPosition();
457  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
458  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
459  GetEventHandler()->ProcessEvent( cmd );
461  m_canvas->SetIgnoreMouseEvents( false );
462 
463  if( pin->GetFlags() & IS_CANCELLED )
464  {
465  deleteItem( DC );
466  }
467  else
468  {
471 
472  if( DC )
473  {
475 
476  if( GetShowElectricalType() )
477  show_opts |= PIN_DRAW_ELECTRICAL_TYPE_NAME;
478 
479  // In LIB_PIN::Draw() a void* parameter used as flag to pass show_opts.
480  // Build it:
481  void* showOptions = reinterpret_cast<void*>( show_opts );
482 
483  pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_COPY,
484  showOptions, DefaultTransform );
485  }
486 
487  }
488 }
#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:269
void SetLength(int aLength, bool aTestOtherPins=true)
Set the pin length.
Definition: lib_pin.cpp:342
static int GetLastPinLength()
Definition: pinedit.cpp:71
static int m_convert
Definition: libeditframe.h:100
static bool LastPinCommonUnit
Definition: pinedit.cpp:63
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
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:277
static bool LastPinCommonConvert
Definition: pinedit.cpp:62
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:347
static bool LastPinVisible
Definition: pinedit.cpp:64
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void deleteItem(wxDC *aDC)
Deletes the currently selected draw item.
Class LIB_PART defines a library part object.
void SetVisible(bool aVisible)
Set or clear the visibility flag for the pin.
Definition: lib_pin.cpp:460
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
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:465
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:96
#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:306
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
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
Function Move moves a draw object to aPosition.
Definition: lib_pin.cpp:1918
void SetOrientation(int aOrientation, bool aTestOtherPins=true)
Set orientation on the pin.
Definition: lib_pin.cpp:248
static void DrawMovePin(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPositon, bool aErase)
Definition: pinedit.cpp:376
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:192
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool GetShowElectricalType()
Definition: libeditframe.h:390
void SetNumberTextSize(int aSize, bool aTestOtherPins=true)
Set the size of the pin number text.
Definition: lib_pin.cpp:220
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 1350 of file libeditframe.cpp.

References EDA_DRAW_PANEL::CallEndMouseCapture(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), GetCurPart(), LIB_PART::GetNextPin(), LIB_PIN::GetPosition(), EDA_DRAW_PANEL::IsMouseCaptured(), LIB_PIN_T, EDA_DRAW_FRAME::m_canvas, m_drawItem, m_lastDrawItem, OnModify(), EDA_DRAW_PANEL::Refresh(), LIB_PART::RemoveDrawItem(), SaveCopyInUndoList(), SynchronizePins(), and EDA_ITEM::Type().

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

1351 {
1352  wxCHECK_RET( m_drawItem != NULL, "No drawing item selected to delete." );
1353 
1354  m_canvas->CrossHairOff( aDC );
1355 
1356  LIB_PART* part = GetCurPart();
1357 
1358  SaveCopyInUndoList( part );
1359 
1360  if( m_drawItem->Type() == LIB_PIN_T )
1361  {
1362  LIB_PIN* pin = (LIB_PIN*) m_drawItem;
1363  wxPoint pos = pin->GetPosition();
1364 
1365  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1366 
1367  if( SynchronizePins() )
1368  {
1369  LIB_PIN* tmp = part->GetNextPin();
1370 
1371  while( tmp != NULL )
1372  {
1373  pin = tmp;
1374  tmp = part->GetNextPin( pin );
1375 
1376  if( pin->GetPosition() != pos )
1377  continue;
1378 
1379  part->RemoveDrawItem( (LIB_ITEM*) pin );
1380  }
1381  }
1382 
1383  m_canvas->Refresh();
1384  }
1385  else
1386  {
1387  if( m_canvas->IsMouseCaptured() )
1388  {
1389  m_canvas->CallEndMouseCapture( aDC );
1390  }
1391  else
1392  {
1393  part->RemoveDrawItem( m_drawItem, m_canvas, aDC );
1394  m_canvas->Refresh();
1395  }
1396  }
1397 
1398  m_drawItem = NULL;
1399  m_lastDrawItem = NULL;
1400  OnModify();
1401  m_canvas->CrossHairOn( aDC );
1402 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
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:325
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
Definition: libeditframe.h:352
void CallEndMouseCapture(wxDC *aDC)
Function CallEndMouseCapture calls the end mouse capture callback.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
bool IsMouseCaptured() const
Class LIB_PART defines a library part object.
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:91
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:252
wxPoint GetPosition() const override
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:465
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:259
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
void RemoveDrawItem(LIB_ITEM *aItem, EDA_DRAW_PANEL *aPanel=NULL, wxDC *aDc=NULL)
Remove draw aItem from list.
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Create a copy of the current component, and save it in the undo list.
void LIB_EDIT_FRAME::DeleteOnePart ( wxCommandEvent &  event)

Delete a symbol from the current library.

The deleted entry can be an alias or a component. If the entry is an alias, it is removed from the component and the list of alias is updated. If the entry is a component and the list of aliases is empty, the component and all it drawable items are deleted. Otherwise the first alias in the alias list becomes the new component name and the other aliases become dependent on renamed component.

Note
This only deletes the entry in memory. The file does not change.

Definition at line 498 of file libedit.cpp.

References CMP_TREE_MODEL_ADAPTER::Create(), DisplayError(), EDA_DRAW_PANEL::EndMouseCapture(), GetCurLib(), GetCurPart(), EDA_DRAW_PANEL::GetDefaultCursor(), LIB_PART::GetName(), SCH_BASE_FRAME::GetScreen(), DIALOG_CHOOSE_COMPONENT::GetSelectedLibId(), LIB_PART::HasAlias(), ID_NO_TOOL_SELECTED, IsOK(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_convert, m_drawItem, m_lastDrawItem, name, KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), SelectActiveLibrary(), SetCurPart(), and DIALOG_SHIM::ShowQuasiModal().

499 {
500  wxString cmp_name;
501  wxArrayString nameList;
502  wxString msg;
503 
505 
506  m_lastDrawItem = NULL;
507  m_drawItem = NULL;
508 
509  LIB_PART *part = GetCurPart();
510  wxString lib = GetCurLib();
511 
512  if( lib.empty() )
513  {
515 
516  lib = GetCurLib();
517 
518  if( !lib )
519  {
520  DisplayError( this, _( "Please select a symbol library." ) );
521  return;
522  }
523  }
524 
525  auto adapter( CMP_TREE_MODEL_ADAPTER::Create( Prj().SchSymbolLibTable() ) );
526 
527  wxString name = part ? part->GetName() : wxString( wxEmptyString );
528  adapter->SetPreselectNode( name, /* aUnit */ 0 );
529  adapter->ShowUnits( false );
530  adapter->AddLibrary( lib );
531 
532  wxString dialogTitle;
533  dialogTitle.Printf( _( "Delete Symbol (%u items loaded)" ), adapter->GetComponentsCount() );
534 
535  DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false );
536 
537  if( dlg.ShowQuasiModal() == wxID_CANCEL )
538  {
539  return;
540  }
541 
542  LIB_ID id;
543 
544  id = dlg.GetSelectedLibId();
545 
546  if( !id.IsValid() )
547  return;
548 
549  LIB_ALIAS* alias = Prj().SchSymbolLibTable()->LoadSymbol( id );
550 
551  if( !alias )
552  return;
553 
554  msg.Printf( _( "Delete symbol '%s' from library '%s'?" ),
555  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
556 
557  if( !IsOK( this, msg ) )
558  return;
559 
560  part = GetCurPart();
561 
562  if( !part || !part->HasAlias( id.GetLibItemName() ) )
563  {
564  Prj().SchSymbolLibTable()->DeleteAlias( id.GetLibNickname(), id.GetLibItemName() );
565  m_canvas->Refresh();
566  return;
567  }
568 
569  // If deleting the current entry or removing one of the aliases for
570  // the current entry, sync the changes in the current entry as well.
571 
572  if( GetScreen()->IsModify() && !IsOK( this, _(
573  "The symbol being deleted has been modified."
574  " All changes will be lost. Discard changes?" ) ) )
575  {
576  return;
577  }
578 
579  try
580  {
581  Prj().SchSymbolLibTable()->DeleteAlias( id.GetLibNickname(), id.GetLibItemName() );
582  }
583  catch( ... /* IO_ERROR ioe */ )
584  {
585  msg.Printf( _( "Error occurred deleting symbol '%s' from library '%s'" ),
586  id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
587  DisplayError( this, msg );
588  return;
589  }
590 
591  SetCurPart( NULL ); // delete CurPart
592  m_aliasName.Empty();
593  m_canvas->Refresh();
594 }
static PTR Create(SYMBOL_LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
Part library alias object definition.
static int m_convert
Definition: libeditframe.h:100
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:325
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
void SelectActiveLibrary(const wxString &aLibrary=wxEmptyString)
Set the current active library to aLibrary.
Definition: libedit.cpp:77
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 EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
Class LIB_ID.
Definition: lib_id.h:56
Dialog class to select a component from the libraries.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const wxString & GetName() const
Class LIB_PART defines a library part object.
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:91
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static wxString m_aliasName
Definition: libeditframe.h:93
void SetCurPart(LIB_PART *aPart)
Take ownership of aPart and notes that it is the one currently being edited.
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
const char * name
wxString GetCurLib()
The nickname of the current library being edited and empty string if none.
int GetDefaultCursor() const
Function GetDefaultCursor.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:129
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 449 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 CreateNewLibraryPart(), GetComponentFromRedoList(), GetComponentFromUndoList(), LIB_EDIT_FRAME(), LoadOneLibraryPartAux(), OnEditComponentProperties(), OnLeftClick(), OnSelectAlias(), and OnSelectPart().

450 {
451  LIB_ALIAS* alias;
452  LIB_PART* part = GetCurPart();
453 
454  ClearMsgPanel();
455 
456  if( !part )
457  return;
458 
459  wxString msg = part->GetName();
460 
461  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
462 
463  if( m_aliasName == part->GetName() )
464  msg = _( "None" );
465  else
466  msg = m_aliasName;
467 
468  alias = part->GetAlias( m_aliasName );
469 
470  wxCHECK_RET( alias != NULL, "Alias not found in symbol." );
471 
472  AppendMsgPanel( _( "Alias" ), msg, RED, 8 );
473 
474  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
475  msg = UnitLetter[m_unit];
476 
477  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
478 
479  if( m_convert > 1 )
480  msg = _( "Convert" );
481  else
482  msg = _( "Normal" );
483 
484  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
485 
486  if( part->IsPower() )
487  msg = _( "Power Symbol" );
488  else
489  msg = _( "Part" );
490 
491  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
492  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
493  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
494  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
495 }
Definition: colors.h:57
Part library alias object definition.
static int m_convert
Definition: libeditframe.h:100
bool IsPower() const
LIB_ALIAS * GetAlias(size_t aIndex)
Definition: colors.h:61
const wxString & GetName() const
wxString GetDescription() const
Definition: colors.h:59
Class LIB_PART defines a library part 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:764
wxString GetDocFileName() const
Definition: colors.h:58
static wxString m_aliasName
Definition: libeditframe.h:93
static int m_unit
Definition: libeditframe.h:96
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
wxString GetKeyWords() const
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:775
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 56 of file libedit.cpp.

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

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

57 {
58  wxString lib = GetCurLib();
59  wxString title = _( "Symbol Library Editor - " );
60 
61  if( !lib.empty() && Prj().SchSymbolLibTable()->HasLibrary( lib ) )
62  {
63  wxString fileName = Prj().SchSymbolLibTable()->GetFullURI( lib );
64 
65  title += lib + " (" + fileName + ")";
66 
67  if( !wxFileName::IsFileWritable( fileName ) )
68  title += " " + _( "[Read Only]" );
69  }
70  else
71  title += _( "no library selected" );
72 
73  SetTitle( title );
74 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxString GetCurLib()
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 }
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
Class LIB_ID.
Definition: lib_id.h:56
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:85
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Function SetLibItemName.
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 514 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().

515 {
516  wxString msg;
517 
518  switch( g_UserUnit )
519  {
520  case INCHES:
521  msg = _( "Inches" );
522  break;
523 
524  case MILLIMETRES:
525  msg = _( "mm" );
526  break;
527 
528  default:
529  msg = _( "Units" );
530  break;
531  }
532 
533  SetStatusText( msg, 4 );
534 }
Definition: common.h:144
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 250 of file basicframe.cpp.

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

251 {
252  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
253 }
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:296
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:1076
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 40 of file libfield.cpp.

References LIB_PART::GetAliasCount(), LIB_PART::GetAliasNames(), GetChars(), GetCurLib(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), LIB_FIELD::GetName(), LIB_ITEM::GetParent(), DIALOG_EDIT_ONE_FIELD::GetText(), EDA_TEXT::GetText(), LIB_PART::HasAlias(), LIB_ITEM::InEditMode(), m_aliasName, EDA_DRAW_FRAME::m_canvas, m_unit, OnModify(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), LIB_PART::RemoveAlias(), SaveCopyInUndoList(), LIB_PART::SetName(), DIALOG_SHIM::ShowQuasiModal(), UpdateAliasSelectList(), DIALOG_LIB_EDIT_ONE_FIELD::UpdateField(), and VALUE.

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

41 {
42  wxString newFieldValue;
43  wxString title;
44  wxString caption;
45  wxString oldName;
46 
47  if( aField == NULL )
48  return;
49 
50  LIB_PART* parent = aField->GetParent();
51 
52  wxASSERT( parent );
53 
54  // Editing the component value field is equivalent to creating a new component based
55  // on the current component. Set the dialog message to inform the user.
56  if( aField->GetId() == VALUE )
57  {
58  caption = _( "Component Name" );
59  title = _( "Enter a name to create a new component based on this one." );
60  }
61  else
62  {
63  caption.Printf( _( "Edit Field %s" ), GetChars( aField->GetName() ) );
64  title.Printf( _( "Enter a new value for the %s field." ),
65  GetChars( aField->GetName().Lower() ) );
66  }
67 
68  DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
69 
70  // The dialog may invoke a kiway player for footprint fields
71  // so we must use a quasimodal dialog.
72  if( dlg.ShowQuasiModal() != wxID_OK )
73  return;
74 
75  newFieldValue = dlg.GetText();
76  wxString fieldText = aField->GetFullText( m_unit );
77 
78  /* If the value field is changed, this is equivalent to creating a new component from
79  * the old one. Rename the component and remove any conflicting aliases to prevent name
80  * errors when updating the library.
81  */
82  if( aField->GetId() == VALUE && newFieldValue != aField->GetText() )
83  {
84  wxString msg;
85  wxString lib = GetCurLib();
86 
87  // Test the current library for name conflicts.
88  if( !lib.empty() && Prj().SchSymbolLibTable()->LoadSymbol( lib, newFieldValue ) )
89  {
90  msg.Printf( _(
91  "The name '%s' conflicts with an existing entry in the component library '%s'.\n\n"
92  "Do you wish to replace the current component in the library with this one?" ),
93  newFieldValue,
94  lib
95  );
96 
97  int rsp = wxMessageBox( msg, _( "Confirm" ),
98  wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT, this );
99 
100  if( rsp == wxNO )
101  return;
102  }
103 
104  // Test the current component for name conflicts.
105  if( parent->HasAlias( newFieldValue ) )
106  {
107  msg.Printf( _( "The current component already has an alias named '%s'.\n\n"
108  "Do you wish to remove this alias from the component?" ),
109  GetChars( newFieldValue ) );
110 
111  int rsp = wxMessageBox( msg, _( "Confirm" ), wxYES_NO | wxICON_QUESTION, this );
112 
113  if( rsp == wxNO )
114  return;
115 
116  parent->RemoveAlias( newFieldValue );
117  }
118 
119  parent->SetName( newFieldValue );
120 
121  // Test the library for any conflicts with the any aliases in the current component.
122  if( parent->GetAliasCount() > 1 && !lib.empty() )
123  {
124  bool conflicts = false;
125  wxArrayString libAliasNames, symbolAliasNames;
126 
127  Prj().SchSymbolLibTable()->EnumerateSymbolLib( lib, libAliasNames );
128  symbolAliasNames = parent->GetAliasNames();
129 
130  for( size_t i = 0; i < symbolAliasNames.GetCount(); i++ )
131  {
132  if( libAliasNames.Index( symbolAliasNames[i] ) != wxNOT_FOUND )
133  {
134  conflicts = true;
135  break;
136  }
137  }
138 
139  if( conflicts )
140  {
141  msg.Printf( _( "The new symbol contains alias names that conflict with "
142  "entries in the library '%s'.\n\n"
143  "Do you wish to remove all of the conflicting aliases from "
144  "this symbol?" ),
145  lib );
146 
147  int rsp = wxMessageBox( msg, _( "Confirm" ), wxYES_NO | wxICON_QUESTION, this );
148 
149  if( rsp == wxNO )
150  {
151  parent->SetName( fieldText );
152  return;
153  }
154 
155  wxArrayString aliases = parent->GetAliasNames( false );
156 
157  for( size_t i = 0; i < aliases.GetCount(); i++ )
158  {
159  if( Prj().SchSymbolLibTable()->LoadSymbol( lib, aliases[ i ] ) != NULL )
160  parent->RemoveAlias( aliases[ i ] );
161  }
162  }
163  }
164 
165  if( !parent->HasAlias( m_aliasName ) )
166  m_aliasName = newFieldValue;
167  }
168 
169  dlg.UpdateField( aField );
170 
171  if( !aField->InEditMode() )
172  SaveCopyInUndoList( parent );
173 
174  m_canvas->Refresh();
175 
176  OnModify();
178 }
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:325
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:222
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
Definition: libeditframe.h:352
size_t GetAliasCount() const
void UpdateAliasSelectList()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Class DIALOG_LIB_EDIT_ONE_FIELD is a the class to handle editing a single component field in the libr...
Class LIB_PART defines a library part object.
Field Value of part, i.e. "3.3K".
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 RemoveAlias(const wxString &aName)
static wxString m_aliasName
Definition: libeditframe.h:93
static int m_unit
Definition: libeditframe.h:96
wxArrayString GetAliasNames(bool aIncludeRoot=true) const
virtual void SetName(const wxString &aName)
wxString GetCurLib()
The nickname of the current library being edited and empty string if none.
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, GetConvert(), LIB_ITEM::GetConvert(), LIB_ITEM::GetFillMode(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::GetParent(), LIB_ITEM::GetTypeName(), GetUnit(), LIB_ITEM::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* component = 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( component && component->GetUnitCount() > 1 );
73  dialog.SetApplyToAllConversions( DrawItem->GetConvert() == 0 );
74  dialog.EnableApplyToAllConversions( component && component->HasConversion() );
75  dialog.SetFillStyle( DrawItem->GetFillMode() );
76  dialog.EnableFillStyle( DrawItem->IsFillable() );
77 
78  if( dialog.ShowModal() == wxID_CANCEL )
79  return;
80 
81  // Init default values (used to create a new draw item)
82  val = dialog.GetWidth();
84  m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
85  m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
86 
87 #if 0
88  /* TODO: see if m_drawFillStyle must retain the last fill option or not.
89  * if the last is Filled, having next new graphic items created
90  * with filled body is often bad.
91  * currently m_drawFillStyle is left with the default value (not filled)
92  */
93  if( DrawItem->IsFillable() )
94  m_drawFillStyle = (FILL_T) dialog.GetFillStyle();
95 #endif
96 
97  // Save copy for undo if not in edit (edit command already handle the save copy)
98  if( !DrawItem->InEditMode() )
99  SaveCopyInUndoList( DrawItem->GetParent() );
100 
101  if( m_drawSpecificUnit )
102  DrawItem->SetUnit( GetUnit() );
103  else
104  DrawItem->SetUnit( 0 );
105 
107  DrawItem->SetConvert( GetConvert() );
108  else
109  DrawItem->SetConvert( 0 );
110 
111  if( DrawItem->IsFillable() )
112  DrawItem->SetFillMode( (FILL_T) dialog.GetFillStyle() );
113 
114  DrawItem->SetWidth( m_drawLineWidth );
115 
116  OnModify( );
117 
118  MSG_PANEL_ITEMS items;
119  DrawItem->GetMsgPanelInfo( items );
120  SetMsgPanel( items );
121  m_canvas->Refresh();
122 }
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:325
int GetUnit() const
wxString ReturnUnitSymbol(EDA_UNITS_T aUnit, const wxString &formatString)
Returns the units symbol.
Definition: base_units.cpp:420
virtual void SetWidth(int aWidth)=0
Function SetWidth sets 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:203
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...
Definition: libeditframe.h:352
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:784
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:368
Class LIB_PART defines a library part 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
Function GetWidth return the width of the draw item.
void SetUnit(int aUnit)
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo displays basic info (type, part and convert) about the current item in messa...
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:86
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:89
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:61
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
Definition: libeditframe.h:69
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 1048 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().

1049 {
1050  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
1051  return;
1052 
1053  // Deleting old text
1054  if( DC && !DrawItem->InEditMode() )
1055  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1056  DefaultTransform );
1057 
1058  DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
1059  frame->ShowModal();
1060  frame->Destroy();
1061  OnModify();
1062 
1063  // Display new text
1064  if( DC && !DrawItem->InEditMode() )
1065  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1066  NULL, DefaultTransform );
1067 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
Class LIB_TEXT defines a component library graphical text item.
Definition: lib_text.h:45
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...
Definition: libeditframe.h:352
friend class DIALOG_LIB_EDIT_TEXT
Definition: libeditframe.h:129
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.
bool EDA_BASE_FRAME::Enable ( bool  enable)
overrideinherited

Definition at line 211 of file basicframe.cpp.

Referenced by FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), and KIWAY_PLAYER::ShowModal().

212 {
213  // so we can do logging of this state change:
214 
215 #if defined(DEBUG)
216  const char* type_id = typeid( *this ).name();
217  printf( "wxFrame %-28s: %s\n", type_id, enable ? "enabled" : "disabled" );
218 #endif
219 
220  return wxFrame::Enable( enable );
221 }
void LIB_EDIT_FRAME::EndDrawGraphicItem ( wxDC *  DC)
private

Definition at line 336 of file symbdraw.cpp.

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

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

337 {
338  if( LIB_PART* part = GetCurPart() )
339  {
340  if( !m_drawItem )
341  return;
342 
343  if( GetToolId() != ID_NO_TOOL_SELECTED )
344  SetCursor( wxCURSOR_PENCIL );
345  else
346  SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
347 
348  if( GetTempCopyComponent() ) // used when editing an existing item
350  else
351  {
352  // When creating a new item, there is still no change for the
353  // current component. So save it.
354  SaveCopyInUndoList( part );
355  }
356 
357  if( m_drawItem->IsNew() )
358  part->AddDrawItem( m_drawItem );
359 
361 
362  m_drawItem = NULL;
363 
364  OnModify();
365 
366  m_canvas->SetMouseCapture( NULL, NULL );
367  m_canvas->Refresh();
368  }
369 }
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:325
bool IsNew() const
Definition: base_struct.h:230
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
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...
Definition: libeditframe.h:352
Class LIB_PART defines a library part object.
LIB_PART * GetTempCopyComponent()
Definition: libeditframe.h:412
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
int GetToolId() const
Definition: draw_frame.h:471
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
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 261 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().

262 {
263  if( m_messagePanel )
265 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:129
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 358 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::OnSockRequest().

358 {}
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 768 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 Process_Config(), KICAD_MANAGER_FRAME::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().

770 {
771  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
772  wxString mask = wxT( "*." ) + ext;
773 
774 #if 0
775  wxString path = wxPathOnly( Prj().GetProjectFullName() );
776 #else
777  wxString path = GetMruPath();
778 #endif
779  wxFileName fn( aDefaultShortname );
780  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
781 
782  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
783  path,
784  fn.GetFullPath(),
785  ext,
786  mask,
787  this,
788  wxFD_SAVE,
789  true );
790 
791  if( filename.IsEmpty() )
792  return;
793 
794  WriteHotkeyConfig( aDescList, &filename );
795  SetMruPath( wxFileName( filename ).GetPath() );
796 }
void SetMruPath(const wxString &aPath)
Definition: wxstruct.h:369
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:371
virtual void EDA_DRAW_FRAME::forceColorsToLegacy ( )
inlineprotectedvirtualinherited

Helper function to coerce all colors to legacy-compatible when switching from GAL to legacy canvas.

Reimplemented in GERBVIEW_FRAME, and PCB_EDIT_FRAME.

Definition at line 156 of file draw_frame.h.

156 {}
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 266 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().

267 {
268  // Filter out the 'fake' mouse motion after a keyboard movement
269  if( !aHotKey && m_movingCursorWithKeyboard )
270  {
272  return false;
273  }
274 
275  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
276  // for next cursor position
277  // ( shift or ctrl key down are PAN command with mouse wheel)
278  bool snapToGrid = true;
279 
280  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
281  snapToGrid = false;
282 
283  // Cursor is left off grid only if no block in progress
284  if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
285  snapToGrid = true;
286 
287  wxPoint pos = aPosition;
288  wxPoint oldpos = GetCrossHairPosition();
289  bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
290 
291  // Update the cursor position.
292  SetCrossHairPosition( pos, snapToGrid );
293  RefreshCrossHair( oldpos, aPosition, aDC );
294 
295  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition, NULL ) )
296  {
297  keyHandled = true;
298  }
299 
300  UpdateStatusBar();
301 
302  return keyHandled;
303 }
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:251
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:139
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 1330 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_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), and GERBVIEW_FRAME::GeneralControl().

1332 {
1333  bool key_handled = false;
1334 
1335  // If requested snap the current position to the grid
1336  if( aSnapToGrid )
1337  *aPos = GetNearestGridPosition( *aPos );
1338 
1339  switch( aHotKey )
1340  {
1341  // All these keys have almost the same treatment
1342  case GR_KB_CTRL | WXK_NUMPAD8:
1343  case GR_KB_CTRL | WXK_UP:
1344  case GR_KB_CTRL | WXK_NUMPAD2:
1345  case GR_KB_CTRL | WXK_DOWN:
1346  case GR_KB_CTRL | WXK_NUMPAD4:
1347  case GR_KB_CTRL | WXK_LEFT:
1348  case GR_KB_CTRL | WXK_NUMPAD6:
1349  case GR_KB_CTRL | WXK_RIGHT:
1350  case WXK_NUMPAD8:
1351  case WXK_UP:
1352  case WXK_NUMPAD2:
1353  case WXK_DOWN:
1354  case WXK_NUMPAD4:
1355  case WXK_LEFT:
1356  case WXK_NUMPAD6:
1357  case WXK_RIGHT:
1358  key_handled = true;
1359  {
1360  /* Here's a tricky part: when doing cursor key movement, the
1361  * 'previous' point should be taken from memory, *not* from the
1362  * freshly computed position in the event. Otherwise you can't do
1363  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1364  * the automatic motion event generated by cursor warping */
1365  wxRealPoint gridSize = GetScreen()->GetGridSize();
1366  *aPos = GetCrossHairPosition();
1367 
1368  // Bonus: ^key moves faster (x10)
1369  switch( aHotKey )
1370  {
1371  case GR_KB_CTRL|WXK_NUMPAD8:
1372  case GR_KB_CTRL|WXK_UP:
1373  aPos->y -= KiROUND( 10 * gridSize.y );
1374  break;
1375 
1376  case GR_KB_CTRL|WXK_NUMPAD2:
1377  case GR_KB_CTRL|WXK_DOWN:
1378  aPos->y += KiROUND( 10 * gridSize.y );
1379  break;
1380 
1381  case GR_KB_CTRL|WXK_NUMPAD4:
1382  case GR_KB_CTRL|WXK_LEFT:
1383  aPos->x -= KiROUND( 10 * gridSize.x );
1384  break;
1385 
1386  case GR_KB_CTRL|WXK_NUMPAD6:
1387  case GR_KB_CTRL|WXK_RIGHT:
1388  aPos->x += KiROUND( 10 * gridSize.x );
1389  break;
1390 
1391  case WXK_NUMPAD8:
1392  case WXK_UP:
1393  aPos->y -= KiROUND( gridSize.y );
1394  break;
1395 
1396  case WXK_NUMPAD2:
1397  case WXK_DOWN:
1398  aPos->y += KiROUND( gridSize.y );
1399  break;
1400 
1401  case WXK_NUMPAD4:
1402  case WXK_LEFT:
1403  aPos->x -= KiROUND( gridSize.x );
1404  break;
1405 
1406  case WXK_NUMPAD6:
1407  case WXK_RIGHT:
1408  aPos->x += KiROUND( gridSize.x );
1409  break;
1410 
1411  default: /* Can't happen since we entered the statement */
1412  break;
1413  }
1414 
1415  m_canvas->MoveCursor( *aPos );
1417  }
1418  break;
1419 
1420  default:
1421  break;
1422  }
1423 
1424  return key_handled;
1425 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:353
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:347
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:63
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:139
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 227 of file wxstruct.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

227 { 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 337 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_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(), 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(), DialogEditModuleText::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().

337 { 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_drawItem, m_my_part, OnModify(), BASE_SCREEN::PopCommandFromRedoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToUndoList(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), 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  m_drawItem = 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:325
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
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...
Definition: libeditframe.h:352
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:54
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:388
void DisplayLibInfos()
Updates the main window title bar with the current library name and read only status of the library...
Definition: libedit.cpp:56
const wxString & GetName() const
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
PopCommandFromRedoList return the last command to undo and remove it from list nothing is deleted...
Class LIB_PART defines a library part 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:449
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static wxString m_aliasName
Definition: libeditframe.h:93
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
ITEM_PICKER PopItem()
Function PopItem.
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_drawItem, m_my_part, OnModify(), BASE_SCREEN::PopCommandFromUndoList(), PICKED_ITEMS_LIST::PopItem(), BASE_SCREEN::PushCommandToRedoList(), PICKED_ITEMS_LIST::PushItem(), EDA_DRAW_PANEL::Refresh(), 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  // Do not delete the previous part by calling SetCurPart( part ),
111  // which calls delete <previous part>.
112  // <previous part> is now put in redo list and is owned by this list.
113  // Just set the current part to the part which come from the undo list
114  m_my_part = part;
115 
116  if( !part )
117  return;
118 
119  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
120  m_aliasName = part->GetName();
121 
122  m_drawItem = NULL;
125  SetShowDeMorgan( part->HasConversion() );
126  DisplayLibInfos();
127  DisplayCmpDoc();
128  OnModify();
129  m_canvas->Refresh();
130 }
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:325
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
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...
Definition: libeditframe.h:352
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:54
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:388
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:56
const wxString & GetName() const
Class LIB_PART defines a library part 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:449
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
static wxString m_aliasName
Definition: libeditframe.h:93
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Function PushCommandToRedoList add a command to redo in redo list delete the very old commands when t...
LIB_PART * GetCurPart()
Return the current part being edited or NULL if none selected.
ITEM_PICKER PopItem()
Function PopItem.
void UpdatePartSelectList()
int LIB_EDIT_FRAME::GetConvert ( )
inline

Definition at line 367 of file libeditframe.h.

References m_convert.

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

367 { return m_convert; }
static int m_convert
Definition: libeditframe.h:100
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 1223 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_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_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(), OnHotKey(), SCH_EDIT_FRAME::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().

1224 {
1225  // subject to change, borrow from old BASE_SCREEN for now.
1226  if( IsGalCanvasActive() )
1227  {
1229 
1230  return wxPoint( cursor.x, cursor.y );
1231  }
1232  else
1233  {
1234  BASE_SCREEN* screen = GetScreen(); // virtual call
1235  return screen->getCrossHairPosition( aInvertY );
1236  }
1237 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:347
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:862
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:870
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 1261 of file draw_frame.cpp.

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

1262 {
1263  BASE_SCREEN* screen = GetScreen(); // virtual call
1264  return screen->getCrossHairScreenPosition();
1265 }
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:347
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
wxString LIB_EDIT_FRAME::GetCurLib ( )

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

Definition at line 971 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(), CreateNewLibraryPart(), DeleteOnePart(), DisplayLibInfos(), EditField(), LoadComponentFromCurrentLib(), LoadOneLibraryPart(), OnSaveCurrentPart(), OnUpdateSaveCurrentLib(), OnUpdateSaveCurrentLibAs(), SaveActiveLibrary(), and SetCurLib().

972 {
973  wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
974 
975  if( !libNickname.empty() )
976  {
977  if( !Prj().SchSymbolLibTable()->HasLibrary( libNickname ) )
978  {
979  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
980  libNickname = wxEmptyString;
981  }
982  }
983 
984  return libNickname;
985 }
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:173
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:188
LIB_PART * LIB_EDIT_FRAME::GetCurPart ( )

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

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(), CreateNewLibraryPart(), CreatePin(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(), deleteItem(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter(), DeleteOnePart(), DisplayCmpDoc(), DrawMovingBlockOutlines(), EndDrawGraphicItem(), GetComponentFromRedoList(), GetComponentFromUndoList(), GlobalSetPins(), HandleBlockEnd(), HandleBlockPlace(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc(), InstallFieldsEditorDialog(), LIB_EDIT_FRAME(), LoadComponentFromCurrentLib(), LoadOneLibraryPart(), LoadOneSymbol(), locateItem(), LocateItemUsingCursor(), OnCheckComponent(), OnCreateNewPartFromExisting(), OnEditComponentProperties(), OnExportPart(), OnLeftClick(), OnLeftDClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick(), OnOpenPinTable(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), OnPlotCurrentComponent(), OnRightClick(), OnRotateItem(), OnSaveCurrentPart(), OnSelectTool(), OnUpdateDeMorganConvert(), OnUpdateDeMorganNormal(), OnUpdateEditingPart(), OnUpdateNotEditingPart(), OnUpdatePartNumber(), OnUpdatePinByPin(), OnUpdatePinTable(), OnUpdateRedo(), OnUpdateSelectAlias(), OnUpdateUndo(), OnUpdateViewDoc(), OnViewEntryDoc(), PlaceAnchor(), PlacePin(), PrintPage(), Process_Special_Functions(), RedrawComponent(), RepeatPinItem(), SaveActiveLibrary(), SaveOneSymbol(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), StartMovePin(), SVG_PlotComponent(), SynchronizePins(), TempCopyComponent(), UpdateAliasSelectList(), and UpdatePartSelectList().

1002 {
1003  return m_my_part;
1004 }
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:54
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 1247 of file draw_frame.cpp.

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

1248 {
1249  BASE_SCREEN* screen = GetScreen(); // virtual call
1250  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1251 }
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:347
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 167 of file libeditframe.h.

References m_defaultPinLength.

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

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

885 { 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 ( )
inline

Definition at line 382 of file libeditframe.h.

References m_drawItem.

Referenced by AbortPinMove(), AbortSymbolTraceOn(), DrawMovePin(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), and OnRightClick().

382 { return m_drawItem; }
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:92
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 419 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().

421 {
422  wxFileHistory* fileHistory = aFileHistory;
423 
424  if( !fileHistory )
425  fileHistory = &Kiface().GetFileHistory();
426 
427  int baseId = fileHistory->GetBaseId();
428 
429  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
430 
431  unsigned i = cmdId - baseId;
432 
433  if( i < fileHistory->GetCount() )
434  {
435  wxString fn = fileHistory->GetHistoryFile( i );
436 
437  if( wxFileName::FileExists( fn ) )
438  return fn;
439  else
440  {
441  wxString msg = wxString::Format(
442  wxT( "file '%s' was not found." ),
443  GetChars( fn ) );
444 
445  wxMessageBox( msg );
446 
447  fileHistory->RemoveFileFromHistory( i );
448  }
449  }
450 
451  return wxEmptyString;
452 }
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 394 of file libeditframe.h.

References m_drawFillStyle.

394 { return m_drawFillStyle; }
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:86
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 870 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(), SELECTION_TOOL::findCallback(), 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_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_DRC_CONTROL::OnPopupMenu(), 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(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), 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::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().

870 { 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 500 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().

501  {
502  return m_gridColor;
503  }
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 138 of file sch_base_frame.h.

139  {
140  static wxPoint zero;
141  return zero;
142  }
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 586 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().

587 {
588  wxPoint pos = aPosition;
589 
590  if( m_currentScreen != NULL && m_snapToGrid )
591  pos = GetNearestGridPosition( aPosition );
592 
593  return pos;
594 }
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 383 of file draw_frame.h.

References EDA_DRAW_FRAME::m_hotkeysDescrList.

Referenced by PCBNEW_CONTROL::ShowHelp().

383 { 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 641 of file eeschema/hotkeys.cpp.

References GetDescriptorFromCommand().

642 {
643  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
644 
645  if( HK_Descr == NULL )
646  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
647 
648  return HK_Descr;
649&#