KiCad PCB EDA Suite
LIB_EDIT_FRAME Class Reference

The component 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 ()
 
PART_LIBGetCurLib ()
 The current library being edited, or NULL if none. More...
 
PART_LIBSetCurLib (PART_LIB *aLib)
 Sets the current library and return the old. More...
 
LIB_PARTGetCurPart ()
 Function GetCurPart returns the current part being edited, or NULL if none selected. More...
 
void SetCurPart (LIB_PART *aPart)
 Function SetCurPart takes ownership over 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 ()
 Function SycnronizePins. More...
 
void OnPlotCurrentComponent (wxCommandEvent &event)
 Function OnPlotCurrentComponent plot the current component 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)
 Function DeleteOnePart is the command event handler to delete an entry from the current library. More...
 
void CreateNewLibraryPart (wxCommandEvent &event)
 Function CreateNewLibraryPart is the command event handler to create a new library component. More...
 
void OnCreateNewPartFromExisting (wxCommandEvent &event)
 
void OnEditComponentProperties (wxCommandEvent &event)
 
void InstallFieldsEditorDialog (wxCommandEvent &event)
 
void LoadOneLibraryPart (wxCommandEvent &event)
 Function LoadOneLibraryPart loads a library component 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 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 ()
 Function 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)
 Function RedrawComponent 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
 Function RedrawActiveWindow 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)
 Function CloseWindow triggers the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro: More...
 
void OnModify ()
 Function 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 ()
 Function TempCopyComponent create a temporary copy of the current edited component Used to prepare an Undo ant/or abort command before editing the component. More...
 
void RestoreComponent ()
 Function RestoreComponent Restore the current edited component from its temporary copy. More...
 
LIB_PARTGetTempCopyComponent ()
 Function GetTempCopyComponent. More...
 
void ClearTempCopyComponent ()
 Function ClearTempCopyComponent delete temporary copy of the current component and clear pointer. More...
 
bool IsEditingDrawItem ()
 
void SaveCopyInUndoList (EDA_ITEM *ItemToCopy)
 Function SaveCopyInUndoList. More...
 
bool LoadComponentAndSelectLib (LIB_ALIAS *aLibEntry, PART_LIB *aLibrary)
 Function LoadComponentAndSelectLib selects the current active library. More...
 
virtual int BlockCommand (EDA_KEY aKey) override
 Function BlockCommand returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the aKey (ALT, SHIFT ALT ..) More...
 
virtual void HandleBlockPlace (wxDC *DC) override
 Function HandleBlockPlace handles the block place command. More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Function HandleBlockEnd performs a block end command. More...
 
void PlacePin ()
 Function PlacePin Place at cursor location the pin currently moved (i.e. More...
 
void GlobalSetPins (LIB_PIN *aMasterPin, int aId)
 Function GlobalSetPins. More...
 
void RepeatPinItem (wxDC *DC, LIB_PIN *Pin)
 
void CreatePNGorJPEGFile (const wxString &aFileName, bool aFmt_jpeg)
 Function CreatePNGorJPEGFile 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
 Virtual function PrintPage used to print a page. More...
 
void SVG_PlotComponent (const wxString &aFullFileName)
 Function SVG_PlotComponent 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 wxString &aHighlight=wxEmptyString, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
void OnEditSymbolLibTable (wxCommandEvent &aEvent)
 
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 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...
 
static void EnsureActiveLibExists ()
 Function EnsureActiveLibExists must be called after the libraries are reloaded (for instance after loading a schematic project) More...
 

Protected Member Functions

COMPONENT_SELECTION SelectComponentFromLibBrowser (const SCHLIB_FILTER *aFilter, LIB_ALIAS *aPreselectedAlias, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
void OnOpenLibraryViewer (wxCommandEvent &event)
 Function OnOpenLibraryViewer Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (PART_LIB *aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Function DisplayComponentsNamesInLib Select a component from the list of components in a library. More...
 
PART_LIBSelectLibraryFromList ()
 Function SelectLibraryFromList displays a list of current loaded libraries, and allows the user to select a library This list is sorted, with the library cache always at end of the list. More...
 
bool SelectPartNameToLoad (PART_LIB *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...
 
void 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
 
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...
 

Private Member Functions

LIB_ITEMlocateItem (const wxPoint &aPosition, const KICAD_T aFilterList[])
 
virtual void OnActivate (wxActivateEvent &event) override
 Function OnActivate is called when the frame is activated. More...
 
bool SaveOnePart (PART_LIB *aLib, bool aPromptUser=true)
 Function SaveOnePart saves the current LIB_PART into the provided PART_LIB. More...
 
void SelectActiveLibrary (PART_LIB *aLibrary=NULL)
 Function SelectActiveLibrary sets the current active library to aLibrary. More...
 
void OnSaveActiveLibrary (wxCommandEvent &event)
 Function OnSaveActiveLibrary it the command event handler to save the changes to the current library. More...
 
bool SaveActiveLibrary (bool newFile)
 Function SaveActiveLibrary saves the changes to the current library. More...
 
bool LoadComponentFromCurrentLib (LIB_ALIAS *aLibEntry, int aUnit=0, int aConvert=0)
 Function LoadComponentFromCurrentLib loads a component from the current active library, optionally setting the selected unit and convert. More...
 
bool LoadOneLibraryPartAux (LIB_ALIAS *aLibEntry, PART_LIB *aLibrary)
 Function LoadOneLibraryPartAux loads a copy of aLibEntry from aLibrary into memory. More...
 
void DisplayCmpDoc ()
 Function DisplayCmpDoc displays the documentation of the selected component. More...
 
void OnRotateItem (wxCommandEvent &aEvent)
 Function OnRotateItem rotates the current item. More...
 
void OnOrient (wxCommandEvent &aEvent)
 Function OnOrient Handles the ID_LIBEDIT_MIRROR_X and ID_LIBEDIT_MIRROR_Y events. More...
 
void deleteItem (wxDC *aDC)
 Function deleteItem 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)
 Function CreateImagePins adds copies of aPin for aUnit in components with multiple parts and aConvert for components that have multiple body styles. More...
 
void PlaceAnchor ()
 Function 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 ()
 Function LoadOneSymbol read a component symbol file (*.sym ) and add graphic items to the current component. More...
 
void SaveOneSymbol ()
 Function SaveOneSymbol saves the current component 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 component library editor main window.

Definition at line 51 of file libeditframe.h.

Member Typedef Documentation

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

Definition at line 143 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 
259 
261  DisplayLibInfos();
262  DisplayCmpDoc();
265 
266  m_auimgr.SetManagedWindow( this );
267 
268  EDA_PANEINFO horiz;
269  horiz.HorizontalToolbarPane();
270 
271  EDA_PANEINFO vert;
272  vert.VerticalToolbarPane();
273 
274  EDA_PANEINFO mesg;
275  mesg.MessageToolbarPane();
276 
277  m_auimgr.AddPane( m_mainToolBar,
278  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
279 
280  m_auimgr.AddPane( m_drawToolBar,
281  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right() );
282 
283  m_auimgr.AddPane( m_optionsToolBar,
284  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ).Left() );
285 
286  m_auimgr.AddPane( m_canvas,
287  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
288 
289  m_auimgr.AddPane( m_messagePanel,
290  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer(10) );
291 
292  m_auimgr.Update();
293 
294  Raise();
295  Show( true );
296 
297  Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
299 
300  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
301  wxPostEvent( this, evt );
302 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:479
#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:102
LIB_ALIAS * GetAlias(size_t aIndex)
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
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:361
#define DEFAULT_REPEAT_OFFSET_PIN
the default value (overwritten by the eeschema config)
Definition: general.h:50
wxAuiManager m_auimgr
Definition: wxstruct.h:144
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:53
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:470
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:405
void DisplayLibInfos()
Function DisplayLibInfos updates the main window title bar with the current library name and read onl...
Definition: libedit.cpp:55
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:497
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
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:128
const wxString & GetName() const
#define LIB_EDIT_FRAME_NAME
Class LIB_PART defines a library part object.
wxPoint m_FramePos
Definition: wxstruct.h:134
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:88
static int m_textSize
The current text size setting.
Definition: libeditframe.h:109
int m_LastGridSizeId
Definition: draw_frame.h:77
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:122
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:140
void CreateOptionToolbar()
Definition: tool_lib.cpp:224
void DisplayCmpDoc()
Function DisplayCmpDoc displays the documentation of the selected component.
Definition: libedit.cpp:464
void SetShowElectricalType(bool aShow)
Definition: libeditframe.h:409
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:516
void ReCreateHToolbar() override
Definition: tool_lib.cpp:99
static wxString m_aliasName
Definition: libeditframe.h:92
LIB_PART * GetCurPart()
Function GetCurPart returns 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:124
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:60
wxSize m_FrameSize
Definition: wxstruct.h:135
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:68
bool m_editPinsPerPartOrConvert
Set to true to not synchronize pins at the same position when editing components with multiple parts ...
Definition: libeditframe.h:77
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:54
void ReCreateVToolbar() override
Definition: tool_lib.cpp:53
LIB_EDIT_FRAME::~LIB_EDIT_FRAME ( )

Definition at line 305 of file libeditframe.cpp.

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

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

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

674 {
675  wxMenu* menu = NULL;
676  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
677 
678  if( item ) // This menu exists, do nothing
679  return;
680 
681  menu = new wxMenu;
682 
683  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
684  _( "Icons in Menus" ), wxEmptyString,
685  wxITEM_CHECK ) );
686  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
687 
688  AddMenuItem( MasterMenu, menu,
690  _( "Icons Options" ),
691  _( "Select show icons in menus and icons sizes" ),
692  KiBitmap( icon_xpm ) );
693 }
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:76
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
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 911 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().

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

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

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), PCB_EDIT_FRAME::Fill_Zone(), 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().

756 {
757  if( m_messagePanel == NULL )
758  return;
759 
760  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
761 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
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 372 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().

373 {
374  /* Please, note: wxMSW before version 2.9 seems have
375  * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
376  * edit file <wxWidgets>/src/msw/dc.cpp
377  * search for line static const int VIEWPORT_EXTENT = 1000;
378  * and replace by static const int VIEWPORT_EXTENT = 10000;
379  */
380  int dx, dy;
381 
382  LIB_PART* part = GetCurPart();
383 
384  if( part )
385  {
387 
388  dx = boundingBox.GetWidth();
389  dy = boundingBox.GetHeight();
390  SetScrollCenterPosition( wxPoint( 0, 0 ) );
391  }
392  else
393  {
394  const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
395 
396  dx = pageInfo.GetSizeIU().x;
397  dy = pageInfo.GetSizeIU().y;
398 
399  SetScrollCenterPosition( wxPoint( 0, 0 ) );
400  }
401 
402  wxSize size = m_canvas->GetClientSize();
403 
404  // Reserve a 10% margin around component bounding box.
405  double margin_scale_factor = 0.8;
406  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
407  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
408 
409  double bestzoom = std::max( zx, zy );
410 
411  // keep it >= minimal existing zoom (can happen for very small components
412  // for instance when starting a new component
413  if( bestzoom < GetScreen()->m_ZoomList[0] )
414  bestzoom = GetScreen()->m_ZoomList[0];
415 
416  return bestzoom;
417 }
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Function GetBoundingBox.
static int m_convert
Definition: libeditframe.h:99
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:92
static int m_unit
Definition: libeditframe.h:95
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
LIB_PART * GetCurPart()
Function GetCurPart returns 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

Function BlockCommand returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to the aKey (ALT, SHIFT ALT ..)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 44 of file block_libedit.cpp.

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

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

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

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

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

Definition at line 578 of file basicframe.cpp.

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

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

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

Function ClearTempCopyComponent delete temporary copy of the current component and clear pointer.

Definition at line 1065 of file libeditframe.cpp.

References m_tempCopyComponent.

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

1066 {
1067  delete m_tempCopyComponent;
1068  m_tempCopyComponent = NULL;
1069 }
LIB_PART * m_tempCopyComponent
temp copy of a part during edit, I own it here.
Definition: libeditframe.h:54
void LIB_EDIT_FRAME::CloseWindow ( wxCommandEvent &  event)
inline

Function CloseWindow triggers the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:

EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )

Definition at line 358 of file libeditframe.h.

359  {
360  // Generate a wxCloseEvent
361  Close( false );
362  }
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

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

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

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
Definition: wxstruct.h:137
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 812 of file draw_frame.cpp.

References CoordinateToString().

813 {
814  return ::CoordinateToString( aValue, aConvertToMils );
815 }
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:314
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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:112
static int m_convert
Definition: libeditframe.h:99
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:91
Class LIB_TEXT defines a component library graphical text item.
Definition: lib_text.h:45
void ClearTempCopyComponent()
Function 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:109
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:92
void SetUnit(int aUnit)
static int m_unit
Definition: libeditframe.h:95
int GetToolId() const
Definition: draw_frame.h:438
static FILL_T m_drawFillStyle
The current draw or edit graphic item fill style.
Definition: libeditframe.h:85
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:88
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:60
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:68
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

Function CreateImagePins 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:1855
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:200
LIB_PART * GetParent() const
void SetConvert(int aConvert)
int GetUnitCount() const
void SetUnit(int aUnit)
bool SynchronizePins()
Function SycnronizePins.
int GetConvert() const
void LIB_EDIT_FRAME::CreateNewLibraryPart ( wxCommandEvent &  event)

Function CreateNewLibraryPart is the command event handler to create a new library component.

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

Definition at line 608 of file libedit.cpp.

References BASE_SCREEN::ClearUndoRedoList(), DisplayCmpDoc(), DisplayError(), DisplayLibInfos(), EDA_DRAW_PANEL::EndMouseCapture(), PART_LIB::FindAlias(), Format(), DIALOG_LIB_NEW_COMPONENT::GetAlternateBodyStyle(), GetChars(), GetCurLib(), GetCurPart(), EDA_DRAW_PANEL::GetDefaultCursor(), DIALOG_LIB_NEW_COMPONENT::GetLockItems(), DIALOG_LIB_NEW_COMPONENT::GetName(), LIB_PART::GetName(), PART_LIB::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(), 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().

609 {
610  wxString name;
611 
612  if( GetCurPart() && GetScreen()->IsModify() && !IsOK( this, _(
613  "All changes to the current component will be lost!\n\n"
614  "Clear the current component from the screen?" ) ) )
615  {
616  return;
617  }
618 
620 
621  m_drawItem = NULL;
622 
623  DIALOG_LIB_NEW_COMPONENT dlg( this );
624 
625  dlg.SetMinSize( dlg.GetSize() );
626 
627  if( dlg.ShowModal() == wxID_CANCEL )
628  return;
629 
630  if( dlg.GetName().IsEmpty() )
631  {
632  wxMessageBox( _( "This new component has no name and cannot be created. Aborted" ) );
633  return;
634  }
635 
636  name = dlg.GetName();
637  name.Replace( " ", "_" );
638 
639  PART_LIB* lib = GetCurLib();
640 
641  // Test if there a component with this name already.
642  if( lib && lib->FindAlias( name ) )
643  {
644  wxString msg = wxString::Format( _(
645  "Part '%s' already exists in library '%s'" ),
646  GetChars( name ),
647  GetChars( lib->GetName() )
648  );
649  DisplayError( this, msg );
650  return;
651  }
652 
653  LIB_PART* new_part = new LIB_PART( name );
654 
655  SetCurPart( new_part );
656  m_aliasName = new_part->GetName();
657 
658  new_part->GetReferenceField().SetText( dlg.GetReference() );
659  new_part->SetUnitCount( dlg.GetUnitCount() );
660 
661  // Initialize new_part->m_TextInside member:
662  // if 0, pin text is outside the body (on the pin)
663  // if > 0, pin text is inside the body
664  new_part->SetConversion( dlg.GetAlternateBodyStyle() );
665  SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
666 
667  if( dlg.GetPinNameInside() )
668  {
669  new_part->SetPinNameOffset( dlg.GetPinTextPosition() );
670 
671  if( new_part->GetPinNameOffset() == 0 )
672  new_part->SetPinNameOffset( 1 );
673  }
674  else
675  {
676  new_part->SetPinNameOffset( 0 );
677  }
678 
679  ( dlg.GetPowerSymbol() ) ? new_part->SetPower() : new_part->SetNormal();
680  new_part->SetShowPinNumbers( dlg.GetShowPinNumber() );
681  new_part->SetShowPinNames( dlg.GetShowPinName() );
682  new_part->LockUnits( dlg.GetLockItems() );
683 
684  if( dlg.GetUnitCount() < 2 )
685  new_part->LockUnits( false );
686 
687  m_unit = 1;
688  m_convert = 1;
689 
690  DisplayLibInfos();
691  DisplayCmpDoc();
694 
695  m_editPinsPerPartOrConvert = new_part->UnitsLocked() ? true : false;
696  m_lastDrawItem = NULL;
697 
699  OnModify();
700 
701  m_canvas->Refresh();
702  m_mainToolBar->Refresh();
703 }
bool UnitsLocked() const
void SetConversion(bool aSetConvert)
Set or clear the alternate body style (DeMorgan) for the part.
void SetPower()
PART_LIB * GetCurLib()
The current library being edited, or NULL if none.
int GetPinNameOffset()
static int m_convert
Definition: libeditframe.h:99
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:91
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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
void UpdateAliasSelectList()
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:405
void DisplayLibInfos()
Function DisplayLibInfos updates the main window title bar with the current library name and read onl...
Definition: libedit.cpp:55
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:679
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...
const wxString GetName() const
Return the file name without path or extension.
Class LIB_PART defines a library part object.
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:90
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:140
void DisplayCmpDoc()
Function DisplayCmpDoc displays the documentation of the selected component.
Definition: libedit.cpp:464
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
static wxString m_aliasName
Definition: libeditframe.h:92
static int m_unit
Definition: libeditframe.h:95
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)
Function SetCurPart takes ownership over aPart and notes that it is the one currently being edited...
LIB_PART * GetCurPart()
Function GetCurPart returns the current part being edited, or NULL if none selected.
const char * name
Implementing DIALOG_LIB_NEW_COMPONENT.
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.
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
bool m_editPinsPerPartOrConvert
Set to true to not synchronize pins at the same position when editing components with multiple parts ...
Definition: libeditframe.h:77
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()
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
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(), 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  wxAUI_TB_DEFAULT_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:121
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:125
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 }
void SetNumberTextSize(int aSize)
Set the size of the pin number text.
Definition: lib_pin.cpp:213
#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
static int GetLastPinLength()
Definition: pinedit.cpp:71
static int m_convert
Definition: libeditframe.h:99
void SetOrientation(int aOrientation)
Set orientation on the pin.
Definition: lib_pin.cpp:238
static bool LastPinCommonUnit
Definition: pinedit.cpp:63
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:91
void ClearTempCopyComponent()
Function 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:264
static bool LastPinCommonConvert
Definition: pinedit.cpp:62
void SetLength(int aLength)
Set the pin length.
Definition: lib_pin.cpp:326
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 SetType(ELECTRICAL_PINTYPE aType)
Set the electrical type of the pin.
Definition: lib_pin.cpp:293
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void deleteItem(wxDC *aDC)
Function deleteItem 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:441
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:452
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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:95
void SetNameTextSize(int aSize)
Set the aSize of the pin name text.
Definition: lib_pin.cpp:188
#define IS_CANCELLED
flag set when edit dialogs are canceled when editing a
Definition: base_struct.h:140
void SetIgnoreMouseEvents(bool aIgnore)
LIB_PART * GetCurPart()
Function GetCurPart returns 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:1899
bool SynchronizePins()
Function SycnronizePins.
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...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool GetShowElectricalType()
Definition: libeditframe.h:407
void LIB_EDIT_FRAME::CreatePNGorJPEGFile ( const wxString &  aFileName,
bool  aFmt_jpeg 
)

Function CreatePNGorJPEGFile 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:92
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

Function deleteItem deletes the currently selected draw item.

Parameters
aDCThe device context to draw upon when removing item.

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

1375 {
1376  wxCHECK_RET( m_drawItem != NULL, "No drawing item selected to delete." );
1377 
1378  m_canvas->CrossHairOff( aDC );
1379 
1380  LIB_PART* part = GetCurPart();
1381 
1382  SaveCopyInUndoList( part );
1383 
1384  if( m_drawItem->Type() == LIB_PIN_T )
1385  {
1386  LIB_PIN* pin = (LIB_PIN*) m_drawItem;
1387  wxPoint pos = pin->GetPosition();
1388 
1389  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1390 
1391  if( SynchronizePins() )
1392  {
1393  LIB_PIN* tmp = part->GetNextPin();
1394 
1395  while( tmp != NULL )
1396  {
1397  pin = tmp;
1398  tmp = part->GetNextPin( pin );
1399 
1400  if( pin->GetPosition() != pos )
1401  continue;
1402 
1403  part->RemoveDrawItem( (LIB_ITEM*) pin );
1404  }
1405  }
1406 
1407  m_canvas->Refresh();
1408  }
1409  else
1410  {
1411  if( m_canvas->IsMouseCaptured() )
1412  {
1413  m_canvas->CallEndMouseCapture( aDC );
1414  }
1415  else
1416  {
1417  part->RemoveDrawItem( m_drawItem, m_canvas, aDC );
1418  m_canvas->Refresh();
1419  }
1420  }
1421 
1422  m_drawItem = NULL;
1423  m_lastDrawItem = NULL;
1424  OnModify();
1425  m_canvas->CrossHairOn( aDC );
1426 }
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:91
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
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:90
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:452
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:92
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:259
LIB_PART * GetCurPart()
Function GetCurPart returns 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.
bool SynchronizePins()
Function SycnronizePins.
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Function SaveCopyInUndoList.
void LIB_EDIT_FRAME::DeleteOnePart ( wxCommandEvent &  event)

Function DeleteOnePart is the command event handler to delete an entry 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 514 of file libedit.cpp.

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

515 {
516  wxString cmp_name;
517  LIB_ALIAS* libEntry;
518  wxArrayString nameList;
519  wxString msg;
520 
522 
523  m_lastDrawItem = NULL;
524  m_drawItem = NULL;
525 
526  LIB_PART *part = GetCurPart();
527  PART_LIB* lib = GetCurLib();
528 
529  if( !lib )
530  {
532 
533  lib = GetCurLib();
534  if( !lib )
535  {
536  DisplayError( this, _( "Please select a component library." ) );
537  return;
538  }
539  }
540 
541  auto adapter( CMP_TREE_MODEL_ADAPTER::Create( Prj().SchLibs() ) );
542 
543  wxString name = part ? part->GetName() : wxString( wxEmptyString );
544  adapter->SetPreselectNode( name, /* aUnit */ 0 );
545  adapter->ShowUnits( false );
546  adapter->AddLibrary( *lib );
547 
548  wxString dialogTitle;
549  dialogTitle.Printf( _( "Delete Component (%u items loaded)" ), adapter->GetComponentsCount() );
550 
551  DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false );
552 
553  if( dlg.ShowQuasiModal() == wxID_CANCEL )
554  {
555  return;
556  }
557 
558  libEntry = dlg.GetSelectedAlias( NULL );
559 
560  if( !libEntry )
561  {
562  return;
563  }
564 
565  msg.Printf( _( "Delete component '%s' from library '%s' ?" ),
566  GetChars( libEntry->GetName() ),
567  GetChars( lib->GetName() ) );
568 
569  if( !IsOK( this, msg ) )
570  return;
571 
572  part = GetCurPart();
573 
574  if( !part || !part->HasAlias( libEntry->GetName() ) )
575  {
576  lib->RemoveAlias( libEntry );
577  m_canvas->Refresh();
578  return;
579  }
580 
581  // If deleting the current entry or removing one of the aliases for
582  // the current entry, sync the changes in the current entry as well.
583 
584  if( GetScreen()->IsModify() && !IsOK( this, _(
585  "The component being deleted has been modified."
586  " All changes will be lost. Discard changes?" ) ) )
587  {
588  return;
589  }
590 
591  LIB_ALIAS* nextEntry = lib->RemoveAlias( libEntry );
592 
593  if( nextEntry != NULL )
594  {
595  if( LoadOneLibraryPartAux( nextEntry, lib ) )
596  Zoom_Automatique( false );
597  }
598  else
599  {
600  SetCurPart( NULL ); // delete CurPart
601  m_aliasName.Empty();
602  }
603 
604  m_canvas->Refresh();
605 }
Part library alias object definition.
PART_LIB * GetCurLib()
The current library being edited, or NULL if none.
static int m_convert
Definition: libeditframe.h:99
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:91
LIB_ALIAS * RemoveAlias(LIB_ALIAS *aEntry)
Safely remove aEntry from the library and return the next entry.
bool LoadOneLibraryPartAux(LIB_ALIAS *aLibEntry, PART_LIB *aLibrary)
Function LoadOneLibraryPartAux loads a copy of aLibEntry from aLibrary into memory.
Definition: libedit.cpp:201
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.
void SelectActiveLibrary(PART_LIB *aLibrary=NULL)
Function SelectActiveLibrary sets the current active library to aLibrary.
Definition: libedit.cpp:66
static PTR Create(PART_LIBS *aLibs)
Factory function: create a model adapter in a reference-counting container.
Dialog class to select a component from the libraries.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
const wxString & GetName() const
const wxString GetName() const
Return the file name without path or extension.
Class LIB_PART defines a library part object.
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:90
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
static wxString m_aliasName
Definition: libeditframe.h:92
const wxString & GetName() const
void SetCurPart(LIB_PART *aPart)
Function SetCurPart takes ownership over aPart and notes that it is the one currently being edited...
LIB_PART * GetCurPart()
Function GetCurPart returns the current part being edited, or NULL if none selected.
const char * name
int GetDefaultCursor() const
Function GetDefaultCursor.
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
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

Function DisplayCmpDoc displays the documentation of the selected component.

Definition at line 464 of file libedit.cpp.

References EDA_DRAW_FRAME::AppendMsgPanel(), BLUE, BROWN, EDA_DRAW_FRAME::ClearMsgPanel(), CYAN, DARKDARKGRAY, LIB_PART::GetAlias(), GetCurLib(), 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().

465 {
466  LIB_ALIAS* alias;
467  PART_LIB* lib = GetCurLib();
468  LIB_PART* part = GetCurPart();
469 
470  ClearMsgPanel();
471 
472  if( !lib || !part )
473  return;
474 
475  wxString msg = part->GetName();
476 
477  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
478 
479  if( m_aliasName == part->GetName() )
480  msg = _( "None" );
481  else
482  msg = m_aliasName;
483 
484  alias = part->GetAlias( m_aliasName );
485 
486  wxCHECK_RET( alias != NULL, "Alias not found in component." );
487 
488  AppendMsgPanel( _( "Alias" ), msg, RED, 8 );
489 
490  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
491  msg = UnitLetter[m_unit];
492 
493  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
494 
495  if( m_convert > 1 )
496  msg = _( "Convert" );
497  else
498  msg = _( "Normal" );
499 
500  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
501 
502  if( part->IsPower() )
503  msg = _( "Power Symbol" );
504  else
505  msg = _( "Part" );
506 
507  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
508  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
509  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
510  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
511 }
Definition: colors.h:57
Part library alias object definition.
PART_LIB * GetCurLib()
The current library being edited, or NULL if none.
static int m_convert
Definition: libeditframe.h:99
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:753
wxString GetDocFileName() const
Definition: colors.h:58
static wxString m_aliasName
Definition: libeditframe.h:92
static int m_unit
Definition: libeditframe.h:95
LIB_PART * GetCurPart()
Function GetCurPart returns the current part being edited, or NULL if none selected.
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
wxString GetKeyWords() const
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:764
Definition: colors.h:62
void LIB_EDIT_FRAME::DisplayLibInfos ( )

Function DisplayLibInfos updates the main window title bar with the current library name and read only status of the library.

Definition at line 55 of file libedit.cpp.

References Format(), GetCurLib(), PART_LIB::GetFullFileName(), and PART_LIB::IsReadOnly().

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

56 {
57  PART_LIB* lib = GetCurLib();
58  wxString title = wxString::Format( _( "Part Library Editor -- %s %s" ),
59  lib ? lib->GetFullFileName() : _( "no library selected" ),
60  lib && lib->IsReadOnly() ? _( "[Read Only]") : wxString( wxEmptyString ) );
61 
62  SetTitle( title );
63 }
PART_LIB * GetCurLib()
The current library being edited, or NULL if none.
wxString GetFullFileName()
Function GetFullFileName returns the full file library name with path and extension.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool IsReadOnly() const
Function IsReadOnly.
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
bool SCH_BASE_FRAME::DisplayListComponentsInLib ( PART_LIB aLibrary,
wxString &  aBuffer,
wxString &  aPreviousChoice 
)
protectedinherited

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

Parameters
aLibrary= a reference to the library to explore If NULL 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 113 of file selpart.cpp.

References DisplayCmpDocAndKeywords(), PART_LIB::GetAliasNames(), PART_LIB::GetLogicalName(), EDA_LIST_DIALOG::GetTextSelection(), KIWAY_HOLDER::Prj(), and SCH_BASE_FRAME::SelectLibraryFromList().

Referenced by SCH_BASE_FRAME::SelectPartNameToLoad().

115 {
116  wxArrayString nameList;
117 
118  if( aLibrary == NULL )
119  aLibrary = SelectLibraryFromList();
120 
121  if( aLibrary == NULL )
122  return false;
123 
124  aLibrary->GetAliasNames( nameList );
125 
126  wxArrayString headers;
127  headers.Add( wxT("Component") );
128  headers.Add( wxT("Library") );
129  std::vector<wxArrayString> itemsToDisplay;
130 
131  // Conversion from wxArrayString to vector of ArrayString
132  for( unsigned i = 0; i < nameList.GetCount(); i++ )
133  {
134  wxArrayString item;
135  item.Add( nameList[i] );
136  item.Add( aLibrary->GetLogicalName() );
137  itemsToDisplay.push_back( item );
138  }
139 
140  EDA_LIST_DIALOG dlg( this, _( "Select Component" ), headers, itemsToDisplay,
141  aPreviousChoice, DisplayCmpDocAndKeywords, Prj().SchLibs() );
142 
143  if( dlg.ShowModal() != wxID_OK )
144  return false;
145 
146  aBuffer = dlg.GetTextSelection();
147 
148  return true;
149 }
void GetAliasNames(wxArrayString &aNames)
Load a string array with the names of all the entries in this library.
const wxString GetLogicalName()
Function GetLogicalName returns the logical name of the library.
class EDA_LIST_DIALOG
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
static void DisplayCmpDocAndKeywords(wxString &aName, void *aData)
Definition: selpart.cpp:41
PART_LIB * SelectLibraryFromList()
Function SelectLibraryFromList displays a list of current loaded libraries, and allows the user to se...
Definition: selpart.cpp:58
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

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

504 {
505  wxString msg;
506 
507  switch( g_UserUnit )
508  {
509  case INCHES:
510  msg = _( "Inches" );
511  break;
512 
513  case MILLIMETRES:
514  msg = _( "mm" );
515  break;
516 
517  default:
518  msg = _( "Units" );
519  break;
520  }
521 
522  SetStatusText( msg, 4 );
523 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

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

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 231 of file basicframe.cpp.

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

232 {
233  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
234 }
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:290
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:83
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:1077
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:112
EDA_RECT * GetClipBox()
Definition: colors.h:60
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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:81
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 39 of file libfield.cpp.

References PART_LIB::FindAlias(), LIB_PART::GetAliasCount(), LIB_PART::GetAliasNames(), PART_LIB::GetAliasNames(), GetChars(), GetCurLib(), LIB_FIELD::GetFullText(), LIB_FIELD::GetId(), LIB_FIELD::GetName(), PART_LIB::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(), 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().

40 {
41  wxString newFieldValue;
42  wxString title;
43  wxString caption;
44  wxString oldName;
45 
46  if( aField == NULL )
47  return;
48 
49  LIB_PART* parent = aField->GetParent();
50 
51  wxASSERT( parent );
52 
53  // Editing the component value field is equivalent to creating a new component based
54  // on the current component. Set the dialog message to inform the user.
55  if( aField->GetId() == VALUE )
56  {
57  caption = _( "Component Name" );
58  title = _( "Enter a name to create a new component based on this one." );
59  }
60  else
61  {
62  caption.Printf( _( "Edit Field %s" ), GetChars( aField->GetName() ) );
63  title.Printf( _( "Enter a new value for the %s field." ),
64  GetChars( aField->GetName().Lower() ) );
65  }
66 
67  DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
68 
69  // The dialog may invoke a kiway player for footprint fields
70  // so we must use a quasimodal dialog.
71  if( dlg.ShowQuasiModal() != wxID_OK )
72  return;
73 
74  newFieldValue = dlg.GetText();
75  wxString fieldText = aField->GetFullText( m_unit );
76 
77  /* If the value field is changed, this is equivalent to creating a new component from
78  * the old one. Rename the component and remove any conflicting aliases to prevent name
79  * errors when updating the library.
80  */
81  if( aField->GetId() == VALUE && newFieldValue != aField->GetText() )
82  {
83  wxString msg;
84 
85  PART_LIB* lib = GetCurLib();
86 
87  // Test the current library for name conflicts.
88  if( lib && lib->FindAlias( 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  GetChars( newFieldValue ),
94  GetChars( lib->GetName() )
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 )
123  {
124  bool conflicts = false;
125  wxArrayString libAliasNames, symbolAliasNames;
126 
127  lib->GetAliasNames( 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 component contains alias names that conflict with "
142  "entries in the component library '%s'.\n\n"
143  "Do you wish to remove all of the conflicting aliases from "
144  "this component?" ),
145  GetChars( lib->GetName() )
146  );
147 
148  int rsp = wxMessageBox( msg, _( "Confirm" ), wxYES_NO | wxICON_QUESTION, this );
149 
150  if( rsp == wxNO )
151  {
152  parent->SetName( fieldText );
153  return;
154  }
155 
156  wxArrayString aliases = parent->GetAliasNames( false );
157 
158  for( size_t i = 0; i < aliases.GetCount(); i++ )
159  {
160  if( lib->FindAlias( aliases[ i ] ) != NULL )
161  parent->RemoveAlias( aliases[ i ] );
162  }
163  }
164  }
165 
166  if( !parent->HasAlias( m_aliasName ) )
167  m_aliasName = newFieldValue;
168  }
169 
170  dlg.UpdateField( aField );
171 
172  if( !aField->InEditMode() )
173  SaveCopyInUndoList( parent );
174 
175  m_canvas->Refresh();
176 
177  OnModify();
179 }
void GetAliasNames(wxArrayString &aNames)
Load a string array with the names of all the entries in this library.
PART_LIB * GetCurLib()
The current library being edited, or NULL if none.
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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
size_t GetAliasCount() const
void UpdateAliasSelectList()
Class DIALOG_LIB_EDIT_ONE_FIELD is a the class to handle editing a single component field in the libr...
const wxString GetName() const
Return the file name without path or extension.
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:92
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:92
static int m_unit
Definition: libeditframe.h:95
wxArrayString GetAliasNames(bool aIncludeRoot=true) const
virtual void SetName(const wxString &aName)
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Function SaveCopyInUndoList.
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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
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:773
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:92
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:85
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:88
bool m_drawSpecificConvert
Convert of the item currently being drawn.
Definition: libeditframe.h:60
bool m_drawSpecificUnit
Specify which component parts the current draw item applies to.
Definition: libeditframe.h:68
int GetConvert() const
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy)
Function SaveCopyInUndoList.
void LIB_EDIT_FRAME::EditSymbolText ( wxDC *  DC,
LIB_ITEM DrawItem 
)
private

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

1073 {
1074  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
1075  return;
1076 
1077  // Deleting old text
1078  if( DC && !DrawItem->InEditMode() )
1079  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1080  DefaultTransform );
1081 
1082  DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
1083  frame->ShowModal();
1084  frame->Destroy();
1085  OnModify();
1086 
1087  // Display new text
1088  if( DC && !DrawItem->InEditMode() )
1089  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1090  NULL, DefaultTransform );
1091 }
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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
friend class DIALOG_LIB_EDIT_TEXT
Definition: libeditframe.h:128
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
#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 192 of file basicframe.cpp.

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

193 {
194  // so we can do logging of this state change:
195 
196 #if defined(DEBUG)
197  const char* type_id = typeid( *this ).name();
198  printf( "wxFrame %-28s: %s\n", type_id, enable ? "enabled" : "disabled" );
199 #endif
200 
201  return wxFrame::Enable( enable );
202 }
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:91
virtual void EndEdit(const wxPoint &aPosition, bool aAbort=false)
End an object editing action.
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
Class LIB_PART defines a library part object.
LIB_PART * GetTempCopyComponent()
Function GetTempCopyComponent.
Definition: libeditframe.h:431
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
int GetToolId() const
Definition: draw_frame.h:438
LIB_PART * GetCurPart()
Function GetCurPart returns 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)
Function SaveCopyInUndoList.
static void LIB_EDIT_FRAME::EnsureActiveLibExists ( )
static

Function EnsureActiveLibExists must be called after the libraries are reloaded (for instance after loading a schematic project)

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

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

251 {
252  if( m_messagePanel )
254 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
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 325 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::OnSockRequest().

325 {}
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 KICAD_MANAGER_FRAME::Process_Config(), Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

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:361
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:363
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.

Reimplemented from EDA_DRAW_FRAME.

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

265 {
266  bool eventHandled = true;
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  GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
290 
291  // Update the cursor position.
292  SetCrossHairPosition( pos, snapToGrid );
293  RefreshCrossHair( oldpos, aPosition, aDC );
294 
295  if( aHotKey )
296  {
297  eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
298  }
299 
300  UpdateStatusBar();
301 
302  return eventHandled;
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
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 GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
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:138
void 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)

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

1283 {
1284 
1285  // If requested snap the current position to the grid
1286  if( aSnapToGrid )
1287  *aPos = GetNearestGridPosition( *aPos );
1288 
1289  switch( aHotKey )
1290  {
1291  // All these keys have almost the same treatment
1292  case GR_KB_CTRL | WXK_NUMPAD8:
1293  case GR_KB_CTRL | WXK_UP:
1294  case GR_KB_CTRL | WXK_NUMPAD2:
1295  case GR_KB_CTRL | WXK_DOWN:
1296  case GR_KB_CTRL | WXK_NUMPAD4:
1297  case GR_KB_CTRL | WXK_LEFT:
1298  case GR_KB_CTRL | WXK_NUMPAD6:
1299  case GR_KB_CTRL | WXK_RIGHT:
1300  case WXK_NUMPAD8:
1301  case WXK_UP:
1302  case WXK_NUMPAD2:
1303  case WXK_DOWN:
1304  case WXK_NUMPAD4:
1305  case WXK_LEFT:
1306  case WXK_NUMPAD6:
1307  case WXK_RIGHT:
1308  {
1309  /* Here's a tricky part: when doing cursor key movement, the
1310  * 'previous' point should be taken from memory, *not* from the
1311  * freshly computed position in the event. Otherwise you can't do
1312  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1313  * the automatic motion event generated by cursor warping */
1314  wxRealPoint gridSize = GetScreen()->GetGridSize();
1315  *aPos = GetCrossHairPosition();
1316 
1317  // Bonus: ^key moves faster (x10)
1318  switch( aHotKey )
1319  {
1320  case GR_KB_CTRL|WXK_NUMPAD8:
1321  case GR_KB_CTRL|WXK_UP:
1322  aPos->y -= KiROUND( 10 * gridSize.y );
1323  break;
1324 
1325  case GR_KB_CTRL|WXK_NUMPAD2:
1326  case GR_KB_CTRL|WXK_DOWN:
1327  aPos->y += KiROUND( 10 * gridSize.y );
1328  break;
1329 
1330  case GR_KB_CTRL|WXK_NUMPAD4:
1331  case GR_KB_CTRL|WXK_LEFT:
1332  aPos->x -= KiROUND( 10 * gridSize.x );
1333  break;
1334 
1335  case GR_KB_CTRL|WXK_NUMPAD6:
1336  case GR_KB_CTRL|WXK_RIGHT:
1337  aPos->x += KiROUND( 10 * gridSize.x );
1338  break;
1339 
1340  case WXK_NUMPAD8:
1341  case WXK_UP:
1342  aPos->y -= KiROUND( gridSize.y );
1343  break;
1344 
1345  case WXK_NUMPAD2:
1346  case WXK_DOWN:
1347  aPos->y += KiROUND( gridSize.y );
1348  break;
1349 
1350  case WXK_NUMPAD4:
1351  case WXK_LEFT:
1352  aPos->x -= KiROUND( gridSize.x );
1353  break;
1354 
1355  case WXK_NUMPAD6:
1356  case WXK_RIGHT:
1357  aPos->x += KiROUND( gridSize.x );
1358  break;
1359 
1360  default: /* Can't happen since we entered the statement */
1361  break;
1362  }
1363  m_canvas->MoveCursor( *aPos );
1365  }
1366  break;
1367 
1368  default:
1369  break;
1370  }
1371 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:353
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:314
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
#define GR_KB_CTRL
Definition: common.h:64
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:138
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 219 of file wxstruct.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

219 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:153
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 120 of file sch_base_frame.cpp.

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

121 {
122  wxASSERT( GetScreen() );
123  return GetScreen()->GetAuxOrigin();
124 }
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 304 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::InstallConfigFrame(), 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(), 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().

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

Definition at line 54 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.

55 {
56  if( GetScreen()->GetRedoCommandCount() <= 0 )
57  return;
58 
59  PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
60 
61  LIB_PART* part = GetCurPart();
62 
63  ITEM_PICKER wrapper( part, UR_LIBEDIT );
64 
65  lastcmd->PushItem( wrapper );
66  GetScreen()->PushCommandToUndoList( lastcmd );
67 
68  lastcmd = GetScreen()->PopCommandFromRedoList();
69 
70  wrapper = lastcmd->PopItem();
71 
72  part = (LIB_PART*) wrapper.GetItem();
73 
74  // Do not delete the previous part by calling SetCurPart( part )
75  // which calls delete <previous part>.
76  // <previous part> is now put in undo list and is owned by this list
77  // Just set the current part to the part which come from the redo list
78  m_my_part = part;
79 
80  if( !part )
81  return;
82 
83  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
84  m_aliasName = part->GetName();
85 
86  m_drawItem = NULL;
89  SetShowDeMorgan( part->HasConversion() );
91  DisplayCmpDoc();
92  OnModify();
93  m_canvas->Refresh();
94 }
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:91
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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
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:53
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:405
void DisplayLibInfos()
Function DisplayLibInfos updates the main window title bar with the current library name and read onl...
Definition: libedit.cpp:55
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()
Function DisplayCmpDoc displays the documentation of the selected component.
Definition: libedit.cpp:464
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static wxString m_aliasName
Definition: libeditframe.h:92
LIB_PART * GetCurPart()
Function GetCurPart returns 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 97 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.

98 {
99  if( GetScreen()->GetUndoCommandCount() <= 0 )
100  return;
101 
102  PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
103 
104  LIB_PART* part = GetCurPart();
105 
106  ITEM_PICKER wrapper( part, UR_LIBEDIT );
107 
108  lastcmd->PushItem( wrapper );
109  GetScreen()->PushCommandToRedoList( lastcmd );
110 
111  lastcmd = GetScreen()->PopCommandFromUndoList();
112 
113  wrapper = lastcmd->PopItem();
114 
115  part = (LIB_PART* ) wrapper.GetItem();
116 
117  // Do not delete the previous part by calling SetCurPart( part ),
118  // which calls delete <previous part>.
119  // <previous part> is now put in redo list and is owned by this list.
120  // Just set the current part to the part which come from the undo list
121  m_my_part = part;
122 
123  if( !part )
124  return;
125 
126  if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
127  m_aliasName = part->GetName();
128 
129  m_drawItem = NULL;
132  SetShowDeMorgan( part->HasConversion() );
133  DisplayLibInfos();
134  DisplayCmpDoc();
135  OnModify();
136  m_canvas->Refresh();
137 }
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:91
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()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: libeditframe.h:369
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:53
void SetShowDeMorgan(bool show)
Definition: libeditframe.h:405
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
PopCommandFromUndoList return the last command to undo and remove it from list nothing is deleted...
void DisplayLibInfos()
Function DisplayLibInfos updates the main window title bar with the current library name and read onl...
Definition: libedit.cpp:55
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()
Function DisplayCmpDoc displays the documentation of the selected component.
Definition: libedit.cpp:464
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
static wxString m_aliasName
Definition: libeditframe.h:92
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()
Function GetCurPart returns 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 384 of file libeditframe.h.

References m_convert.

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

384 { return m_convert; }
static int m_convert
Definition: libeditframe.h:99
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 1174 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(), SCH_BASE_FRAME::UpdateStatusBar(), PL_EDITOR_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

1175 {
1176  // subject to change, borrow from old BASE_SCREEN for now.
1177  if( IsGalCanvasActive() )
1178  {
1180 
1181  return wxPoint( cursor.x, cursor.y );
1182  }
1183  else
1184  {
1185  BASE_SCREEN* screen = GetScreen(); // virtual call
1186  return screen->getCrossHairPosition( aInvertY );
1187  }
1188 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:314
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:828
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:836
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 1212 of file draw_frame.cpp.

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

1213 {
1214  BASE_SCREEN* screen = GetScreen(); // virtual call
1215  return screen->getCrossHairScreenPosition();
1216 }
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:314
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
PART_LIB * LIB_EDIT_FRAME::GetCurLib ( )

The current library being edited, or NULL if none.

Definition at line 979 of file libeditframe.cpp.

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

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), CreateNewLibraryPart(), DeleteOnePart(), DisplayCmpDoc(), DisplayLibInfos(), EditField(), LoadComponentFromCurrentLib(), LoadOneLibraryPart(), OnSaveCurrentPart(), OnUpdateSaveCurrentLib(), OnUpdateViewDoc(), SaveActiveLibrary(), and SetCurLib().

980 {
982 
983  if( !!name )
984  {
985  PART_LIB* lib = Prj().SchLibs()->FindLibrary( name );
986 
987  if( !lib )
988  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
989 
990  return lib;
991  }
992 
993  return NULL;
994 }
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:162
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:177
const char * name
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
LIB_PART * LIB_EDIT_FRAME::GetCurPart ( )

Function GetCurPart returns 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 1010 of file libeditframe.cpp.

References PROJECT::GetRString(), m_my_part, name, KIWAY_HOLDER::Prj(), PROJECT::SCH_LIBEDIT_CUR_PART, and PROJECT::SetRString().

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(), SaveOnePart(), SaveOneSymbol(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), StartMovePin(), SVG_PlotComponent(), SynchronizePins(), TempCopyComponent(), UpdateAliasSelectList(), and UpdatePartSelectList().

1011 {
1012  if( !m_my_part )
1013  {
1015  LIB_PART* part;
1016 
1017  if( !!name && ( part = Prj().SchLibs()->FindLibPart( LIB_ID( wxEmptyString, name ) ) ) )
1018  {
1019  // clone it from the PART_LIB and own it.
1020  m_my_part = new LIB_PART( *part );
1021  }
1022  else
1023  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, wxEmptyString );
1024  }
1025 
1026  return m_my_part;
1027 }
Class LIB_ID.
Definition: lib_id.h:56
LIB_PART * m_my_part
a part I own, it is not in any library, but a copy could be.
Definition: libeditframe.h:53
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Class LIB_PART defines a library part object.
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:162
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:177
const char * name
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 1198 of file draw_frame.cpp.

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

1199 {
1200  BASE_SCREEN* screen = GetScreen(); // virtual call
1201  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1202 }
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:314
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 168 of file libeditframe.h.

References m_defaultPinLength.

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

168 { return m_defaultPinLength; }
static int m_defaultPinLength
Default pin length.
Definition: libeditframe.h:121
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 851 of file draw_frame.h.

Referenced by EDA_DRAW_PANEL::GetDisplayOptions(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

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

Reimplemented from EDA_DRAW_FRAME.

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

79 {
81 }
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
LIB_ITEM* LIB_EDIT_FRAME::GetDrawItem ( )
inline

Definition at line 399 of file libeditframe.h.

References m_drawItem.

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

399 { return m_drawItem; }
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:91
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 400 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().

402 {
403  wxFileHistory* fileHistory = aFileHistory;
404 
405  if( !fileHistory )
406  fileHistory = &Kiface().GetFileHistory();
407 
408  int baseId = fileHistory->GetBaseId();
409 
410  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
411 
412  unsigned i = cmdId - baseId;
413 
414  if( i < fileHistory->GetCount() )
415  {
416  wxString fn = fileHistory->GetHistoryFile( i );
417 
418  if( wxFileName::FileExists( fn ) )
419  return fn;
420  else
421  {
422  wxString msg = wxString::Format(
423  wxT( "file '%s' was not found." ),
424  GetChars( fn ) );
425 
426  wxMessageBox( msg );
427 
428  fileHistory->RemoveFileFromHistory( i );
429  }
430  }
431 
432  return wxEmptyString;
433 }
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 411 of file libeditframe.h.

References m_drawFillStyle.

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

References EDA_DRAW_FRAME::m_galCanvas.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE_EDITOR_TOOLS::EnumeratePads(), EVT_TOOL(), EVT_UPDATE_UI(), SELECTION_TOOL::findCallback(), EDA_DRAW_FRAME::GetCrossHairPosition(), GRID_HELPER::GRID_HELPER(), PCBNEW_CONTROL::HighContrastMode(), 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(), PCB_LAYER_WIDGET::OnLayerVisible(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_DRC_CONTROL::OnPopupMenu(), PCB_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), PCBNEW_CONTROL::PadDisplayMode(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), Refresh(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), PCB_BASE_FRAME::SwitchCanvas(), SELECTION_TOOL::toggleSelection(), PCBNEW_CONTROL::TrackDisplayMode(), 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(), EDA_DRAW_FRAME::UseGalCanvas(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOut(), and COMMON_TOOLS::ZoomPreset().

836 { 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:67
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 467 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().

468  {
469  return m_gridColor;
470  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:82
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 110 of file sch_base_frame.h.

111  {
112  static wxPoint zero;
113  return zero;
114  }
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 575 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().

576 {
577  wxPoint pos = aPosition;
578 
579  if( m_currentScreen != NULL && m_snapToGrid )
580  pos = GetNearestGridPosition( aPosition );
581 
582  return pos;
583 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:62
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:64
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

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

Definition at line 350 of file draw_frame.h.

References EDA_DRAW_FRAME::m_hotkeysDescrList.

Referenced by PCBNEW_CONTROL::ShowHelp().

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

>

Function GetHotKeyDescription Searches lists o