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_COPY...) 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...
 
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 ()
 
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...
 
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 () const
 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)
 Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables. 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)
 
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)
 Function LoadComponentFromCurrentLib loads a component from the current active library. 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 141 of file sch_base_frame.h.

Constructor & Destructor Documentation

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

Definition at line 186 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_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(), 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.

186  :
187  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
188  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
189 {
190  m_showAxis = true; // true to draw axis
191  SetShowDeMorgan( false );
192  m_drawSpecificConvert = true;
193  m_drawSpecificUnit = false;
197  SetShowElectricalType( true );
198 
199  m_my_part = NULL;
200  m_tempCopyComponent = NULL;
201 
202  // Delayed initialization
203  if( m_textSize == -1 )
205 
206  // Initialize grid id to the default value 50 mils:
208 
209  wxIcon icon;
210  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
211  SetIcon( icon );
212 
213  LoadSettings( config() );
214 
215  SetScreen( new SCH_SCREEN( aKiway ) );
216  GetScreen()->m_Center = true;
218 
219  SetCrossHairPosition( wxPoint( 0, 0 ) );
220 
221  // Ensure m_LastGridSizeId is an offset inside the allowed schematic range
222  if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
224 
225  if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
227 
228  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
229 
230  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
231 
232  if( m_canvas )
234 
235  ReCreateMenuBar();
238 
239  // Ensure the current alias name is valid if a part is loaded
240  // Sometimes it is not valid. This is the case
241  // when a part value (the part lib name), or the alias list was modified
242  // during a previous session and the modifications not saved in lib.
243  // Reopen libedit in a new session gives a non valid m_aliasName
244  // because the curr part is reloaded from the library (and this is the unmodified part)
245  // and the old alias name (from the previous edition) can be invalid
246  LIB_PART* part = GetCurPart();
247 
248  if( part == NULL )
249  m_aliasName.Empty();
250  else if( m_aliasName != part->GetName() )
251  {
252  LIB_ALIAS* alias = part->GetAlias( m_aliasName );
253 
254  if( !alias )
255  m_aliasName = part->GetName();
256  }
257 
258 
260  DisplayLibInfos();
261  DisplayCmpDoc();
264 
265  m_auimgr.SetManagedWindow( this );
266 
267  EDA_PANEINFO horiz;
268  horiz.HorizontalToolbarPane();
269 
270  EDA_PANEINFO vert;
271  vert.VerticalToolbarPane();
272 
273  EDA_PANEINFO mesg;
274  mesg.MessageToolbarPane();
275 
276  m_auimgr.AddPane( m_mainToolBar,
277  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
278 
279  m_auimgr.AddPane( m_drawToolBar,
280  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right() );
281 
282  m_auimgr.AddPane( m_optionsToolBar,
283  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ).Left() );
284 
285  m_auimgr.AddPane( m_canvas,
286  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
287 
288  m_auimgr.AddPane( m_messagePanel,
289  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer(10) );
290 
291  m_auimgr.Update();
292 
293  Raise();
294  Show( true );
295 
296  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
297  wxPostEvent( this, evt );
298 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:474
#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)
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:49
wxAuiManager m_auimgr
Definition: wxstruct.h:139
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:465
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:492
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:129
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:135
void CreateOptionToolbar()
Definition: tool_lib.cpp:224
void DisplayCmpDoc()
Function DisplayCmpDoc displays the documentation of the selected component.
Definition: libedit.cpp:454
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:511
void ReCreateHToolbar() override
Definition: tool_lib.cpp:102
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:130
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 301 of file libeditframe.cpp.

References m_drawItem, m_lastDrawItem, m_my_part, and m_tempCopyComponent.

302 {
303  m_drawItem = m_lastDrawItem = NULL;
304 
305  delete m_tempCopyComponent;
306  delete m_my_part;
307  m_my_part = NULL;
308  m_tempCopyComponent = NULL;
309 }
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 671 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().

672 {
673  wxMenu* menu = NULL;
674  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
675 
676  if( item ) // This menu exists, do nothing
677  return;
678 
679  menu = new wxMenu;
680 
681  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
682  _( "Icons in Menus" ), wxEmptyString,
683  wxITEM_CHECK ) );
684  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
685 
686  AddMenuItem( MasterMenu, menu,
688  _( "Icons Options" ),
689  _( "Select show icons in menus and icons sizes" ),
690  KiBitmap( hammer_xpm ) );
691 }
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:188
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

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

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

734 {
735  if( m_messagePanel == NULL )
736  return;
737 
738  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
739 }
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 365 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().

366 {
367  /* Please, note: wxMSW before version 2.9 seems have
368  * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
369  * edit file <wxWidgets>/src/msw/dc.cpp
370  * search for line static const int VIEWPORT_EXTENT = 1000;
371  * and replace by static const int VIEWPORT_EXTENT = 10000;
372  */
373  int dx, dy;
374 
375  LIB_PART* part = GetCurPart();
376 
377  if( part )
378  {
380 
381  dx = boundingBox.GetWidth();
382  dy = boundingBox.GetHeight();
383  SetScrollCenterPosition( wxPoint( 0, 0 ) );
384  }
385  else
386  {
387  const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
388 
389  dx = pageInfo.GetSizeIU().x;
390  dy = pageInfo.GetSizeIU().y;
391 
392  SetScrollCenterPosition( wxPoint( 0, 0 ) );
393  }
394 
395  wxSize size = m_canvas->GetClientSize();
396 
397  // Reserve a 10% margin around component bounding box.
398  double margin_scale_factor = 0.8;
399  double zx =(double) dx / ( margin_scale_factor * (double)size.x );
400  double zy = (double) dy / ( margin_scale_factor * (double)size.y );
401 
402  double bestzoom = std::max( zx, zy );
403 
404  // keep it >= minimal existing zoom (can happen for very small components
405  // for instance when starting a new component
406  if( bestzoom < GetScreen()->m_ZoomList[0] )
407  bestzoom = GetScreen()->m_ZoomList[0];
408 
409  return bestzoom;
410 }
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_COPY...) corresponding to the aKey (ALT, SHIFT ALT ..)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 44 of file block_libedit.cpp.

References BLOCK_COPY, BLOCK_DELETE, 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_COPY;
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 576 of file basicframe.cpp.

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

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

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

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

Definition at line 1052 of file libeditframe.cpp.

References m_tempCopyComponent.

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

1053 {
1054  delete m_tempCopyComponent;
1055  m_tempCopyComponent = NULL;
1056 }
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 255 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().

256  {
257  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
258  return baseCfgName;
259  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
Definition: wxstruct.h:132
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 790 of file draw_frame.cpp.

References CoordinateToString().

791 {
792  return ::CoordinateToString( aValue, aConvertToMils );
793 }
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:309
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 return the default cursor shape.
LIB_ITEM * LIB_EDIT_FRAME::CreateGraphicItem ( LIB_PART LibEntry,
wxDC *  DC 
)
private

Definition at line 150 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, 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(), and SymbolDisplayDraw().

Referenced by OnLeftClick().

151 {
153  wxPoint drawPos = GetCrossHairPosition( true );
154 
155  // no temp copy -> the current version of component will be used for Undo
156  // This is normal when adding new items to the current component
158 
159  switch( GetToolId() )
160  {
162  m_drawItem = new LIB_ARC( LibEntry );
163  break;
164 
166  m_drawItem = new LIB_CIRCLE( LibEntry );
167  break;
168 
170  m_drawItem = new LIB_RECTANGLE( LibEntry );
171  break;
172 
174  m_drawItem = new LIB_POLYLINE( LibEntry );
175  break;
176 
178  {
179  LIB_TEXT* text = new LIB_TEXT( LibEntry );
180  text->SetTextSize( wxSize( m_textSize, m_textSize ) );
182 
183  // Enter the graphic text info
185  EditSymbolText( NULL, text );
186 
187  m_canvas->SetIgnoreMouseEvents( false );
189 
190  if( text->GetText().IsEmpty() )
191  {
192  delete text;
193  m_drawItem = NULL;
194  }
195  else
196  {
197  m_drawItem = text;
198  }
199  }
200  break;
201 
202  default:
203  DisplayError( this, wxT( "LIB_EDIT_FRAME::CreateGraphicItem() error" ) );
204  return NULL;
205  }
206 
207  if( m_drawItem )
208  {
209  m_drawItem->BeginEdit( IS_NEW, drawPos );
212 
213  if( m_drawSpecificUnit )
217 
218  // Draw initial symbol:
219  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
220  }
221  else
222  {
224  return NULL;
225  }
226 
228  m_canvas->SetIgnoreMouseEvents( false );
229 
230  return m_drawItem;
231 }
void SetTextAngle(double aAngle)
Definition: eda_text.h:156
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:348
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
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:127
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:406
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:317
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:69
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::SetPinNumFromString(), 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->SetPinNumFromString( 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->SetPinNumFromString( 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:1925
int GetUnit() const
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
LIB_PART * GetParent() const
void SetConvert(int aConvert)
int GetUnitCount() const
void SetUnit(int aUnit)
void SetPinNumFromString(wxString &aBuffer)
Function SetPinNumFromString fill the pin number buffer with aBuffer.
Definition: lib_pin.cpp:1905
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 598 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, 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().

599 {
600  wxString name;
601 
602  if( GetCurPart() && GetScreen()->IsModify() && !IsOK( this, _(
603  "All changes to the current component will be lost!\n\n"
604  "Clear the current component from the screen?" ) ) )
605  {
606  return;
607  }
608 
610 
611  m_drawItem = NULL;
612 
613  DIALOG_LIB_NEW_COMPONENT dlg( this );
614 
615  dlg.SetMinSize( dlg.GetSize() );
616 
617  if( dlg.ShowModal() == wxID_CANCEL )
618  return;
619 
620  if( dlg.GetName().IsEmpty() )
621  {
622  wxMessageBox( _( "This new component has no name and cannot be created. Aborted" ) );
623  return;
624  }
625 
626  name = dlg.GetName();
627  name.Replace( " ", "_" );
628 
629  PART_LIB* lib = GetCurLib();
630 
631  // Test if there a component with this name already.
632  if( lib && lib->FindAlias( name ) )
633  {
634  wxString msg = wxString::Format( _(
635  "Part '%s' already exists in library '%s'" ),
636  GetChars( name ),
637  GetChars( lib->GetName() )
638  );
639  DisplayError( this, msg );
640  return;
641  }
642 
643  LIB_PART* new_part = new LIB_PART( name );
644 
645  SetCurPart( new_part );
646  m_aliasName = new_part->GetName();
647 
648  new_part->GetReferenceField().SetText( dlg.GetReference() );
649  new_part->SetUnitCount( dlg.GetUnitCount() );
650 
651  // Initialize new_part->m_TextInside member:
652  // if 0, pin text is outside the body (on the pin)
653  // if > 0, pin text is inside the body
654  new_part->SetConversion( dlg.GetAlternateBodyStyle() );
655  SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
656 
657  if( dlg.GetPinNameInside() )
658  {
659  new_part->SetPinNameOffset( dlg.GetPinTextPosition() );
660 
661  if( new_part->GetPinNameOffset() == 0 )
662  new_part->SetPinNameOffset( 1 );
663  }
664  else
665  {
666  new_part->SetPinNameOffset( 0 );
667  }
668 
669  ( dlg.GetPowerSymbol() ) ? new_part->SetPower() : new_part->SetNormal();
670  new_part->SetShowPinNumbers( dlg.GetShowPinNumber() );
671  new_part->SetShowPinNames( dlg.GetShowPinName() );
672  new_part->LockUnits( dlg.GetLockItems() );
673 
674  if( dlg.GetUnitCount() < 2 )
675  new_part->LockUnits( false );
676 
677  m_unit = 1;
678  m_convert = 1;
679 
680  DisplayLibInfos();
681  DisplayCmpDoc();
684 
685  m_editPinsPerPartOrConvert = new_part->UnitsLocked() ? true : false;
686  m_lastDrawItem = NULL;
687 
689  OnModify();
690 
691  m_canvas->Refresh();
692  m_mainToolBar->Refresh();
693 }
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
Definition: draw_panel.cpp:326
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:135
void DisplayCmpDoc()
Function DisplayCmpDoc displays the documentation of the selected component.
Definition: libedit.cpp:454
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.
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 return the default cursor shape.
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:69
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:111
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 the 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:231
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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:256
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:282
static bool LastPinCommonConvert
Definition: pinedit.cpp:62
void SetLength(int aLength)
Set the pin length.
Definition: lib_pin.cpp:344
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
static bool LastPinVisible
Definition: pinedit.cpp:64
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
void SetType(ELECTRICAL_PINTYPE aType)
Set the electrical type of the pin.
Definition: lib_pin.cpp:311
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
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:459
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:471
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:57
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:189
#define IS_CANCELLED
flag set when edit dialogs are canceled when editing a
Definition: base_struct.h:126
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:1969
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 1350 of file libeditframe.cpp.

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

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

1351 {
1352  wxCHECK_RET( m_drawItem != NULL, "No drawing item selected to delete." );
1353 
1354  m_canvas->CrossHairOff( aDC );
1355 
1356  LIB_PART* part = GetCurPart();
1357 
1358  SaveCopyInUndoList( part );
1359 
1360  if( m_drawItem->Type() == LIB_PIN_T )
1361  {
1362  LIB_PIN* pin = (LIB_PIN*) m_drawItem;
1363  wxPoint pos = pin->GetPosition();
1364 
1365  part->RemoveDrawItem( (LIB_ITEM*) pin, m_canvas, aDC );
1366 
1367  if( SynchronizePins() )
1368  {
1369  LIB_PIN* tmp = part->GetNextPin();
1370 
1371  while( tmp != NULL )
1372  {
1373  pin = tmp;
1374  tmp = part->GetNextPin( pin );
1375 
1376  if( pin->GetPosition() != pos )
1377  continue;
1378 
1379  part->RemoveDrawItem( (LIB_ITEM*) pin );
1380  }
1381  }
1382 
1383  m_canvas->Refresh();
1384  }
1385  else
1386  {
1387  if( m_canvas->IsMouseCaptured() )
1388  {
1389  m_canvas->CallEndMouseCapture( aDC );
1390  }
1391  else
1392  {
1393  part->RemoveDrawItem( m_drawItem, m_canvas, aDC );
1394  m_canvas->Refresh();
1395  }
1396  }
1397 
1398  m_drawItem = NULL;
1399  m_lastDrawItem = NULL;
1400  OnModify();
1401  m_canvas->CrossHairOn( aDC );
1402 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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:77
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:253
wxPoint GetPosition() const override
Function GetPosition returns the current draw object position.
Definition: lib_pin.h:471
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:260
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 504 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, KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL::Refresh(), PART_LIB::RemoveAlias(), SelectActiveLibrary(), SetCurPart(), DIALOG_SHIM::ShowQuasiModal(), and EDA_DRAW_FRAME::Zoom_Automatique().

505 {
506  wxString cmp_name;
507  LIB_ALIAS* libEntry;
508  wxArrayString nameList;
509  wxString msg;
510 
512 
513  m_lastDrawItem = NULL;
514  m_drawItem = NULL;
515 
516  LIB_PART *part = GetCurPart();
517  PART_LIB* lib = GetCurLib();
518 
519  if( !lib )
520  {
522 
523  lib = GetCurLib();
524  if( !lib )
525  {
526  DisplayError( this, _( "Please select a component library." ) );
527  return;
528  }
529  }
530 
531  auto adapter( CMP_TREE_MODEL_ADAPTER::Create( Prj().SchLibs() ) );
532 
533  wxString name = part ? part->GetName() : wxString( wxEmptyString );
534  adapter->SetPreselectNode( name, /* aUnit */ 0 );
535  adapter->ShowUnits( false );
536  adapter->AddLibrary( *lib );
537 
538  wxString dialogTitle;
539  dialogTitle.Printf( _( "Delete Component (%u items loaded)" ), adapter->GetComponentsCount() );
540 
541  DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false );
542 
543  if( dlg.ShowQuasiModal() == wxID_CANCEL )
544  {
545  return;
546  }
547 
548  libEntry = dlg.GetSelectedAlias( NULL );
549 
550  if( !libEntry )
551  {
552  return;
553  }
554 
555  msg.Printf( _( "Delete component '%s' from library '%s' ?" ),
556  GetChars( libEntry->GetName() ),
557  GetChars( lib->GetName() ) );
558 
559  if( !IsOK( this, msg ) )
560  return;
561 
562  part = GetCurPart();
563 
564  if( !part || !part->HasAlias( libEntry->GetName() ) )
565  {
566  lib->RemoveAlias( libEntry );
567  m_canvas->Refresh();
568  return;
569  }
570 
571  // If deleting the current entry or removing one of the aliases for
572  // the current entry, sync the changes in the current entry as well.
573 
574  if( GetScreen()->IsModify() && !IsOK( this, _(
575  "The component being deleted has been modified."
576  " All changes will be lost. Discard changes?" ) ) )
577  {
578  return;
579  }
580 
581  LIB_ALIAS* nextEntry = lib->RemoveAlias( libEntry );
582 
583  if( nextEntry != NULL )
584  {
585  if( LoadOneLibraryPartAux( nextEntry, lib ) )
586  Zoom_Automatique( false );
587  }
588  else
589  {
590  SetCurPart( NULL ); // delete CurPart
591  m_aliasName.Empty();
592  }
593 
594  m_canvas->Refresh();
595 }
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
Definition: draw_panel.cpp:326
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:192
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.
int GetDefaultCursor() const
Function GetDefaultCursor return the default cursor shape.
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:69
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:111
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 454 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().

455 {
456  LIB_ALIAS* alias;
457  PART_LIB* lib = GetCurLib();
458  LIB_PART* part = GetCurPart();
459 
460  ClearMsgPanel();
461 
462  if( !lib || !part )
463  return;
464 
465  wxString msg = part->GetName();
466 
467  AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
468 
469  if( m_aliasName == part->GetName() )
470  msg = _( "None" );
471  else
472  msg = m_aliasName;
473 
474  alias = part->GetAlias( m_aliasName );
475 
476  wxCHECK_RET( alias != NULL, "Alias not found in component." );
477 
478  AppendMsgPanel( _( "Alias" ), msg, RED, 8 );
479 
480  static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
481  msg = UnitLetter[m_unit];
482 
483  AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
484 
485  if( m_convert > 1 )
486  msg = _( "Convert" );
487  else
488  msg = _( "Normal" );
489 
490  AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
491 
492  if( part->IsPower() )
493  msg = _( "Power Symbol" );
494  else
495  msg = _( "Part" );
496 
497  AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
498  AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
499  AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
500  AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
501 }
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:731
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:742
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( L"Part Library Editor \u2014 %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
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 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
Definition: draw_panel.cpp:326
bool HasAlias(const wxString &aName) const
Test if alias aName is in part alias list.
EDA_ITEM * GetParent() const
Definition: base_struct.h:208
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_PART::GetDrawItemList(), 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  if( component )
117  component->GetDrawItemList().sort();
118  OnModify( );
119 
120  MSG_PANEL_ITEMS items;
121  DrawItem->GetMsgPanelInfo( items );
122  SetMsgPanel( items );
123  m_canvas->Refresh();
124 }
FILL_T GetFillMode() const
LIB_ITEMS & GetDrawItemList()
Return a reference to the draw item list.
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
Definition: draw_panel.cpp:326
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:751
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:56
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 1059 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().

1060 {
1061  if ( ( DrawItem == NULL ) || ( DrawItem->Type() != LIB_TEXT_T ) )
1062  return;
1063 
1064  // Deleting old text
1065  if( DC && !DrawItem->InEditMode() )
1066  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
1067  DefaultTransform );
1068 
1069  DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
1070  frame->ShowModal();
1071  frame->Destroy();
1072  OnModify();
1073 
1074  // Display new text
1075  if( DC && !DrawItem->InEditMode() )
1076  DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE,
1077  NULL, DefaultTransform );
1078 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
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:69
TRANSFORM DefaultTransform
Definition: eeschema.cpp:57
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 331 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().

332 {
333  if( LIB_PART* part = GetCurPart() )
334  {
335  if( !m_drawItem )
336  return;
337 
338  if( GetToolId() != ID_NO_TOOL_SELECTED )
339  SetCursor( wxCURSOR_PENCIL );
340  else
341  SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
342 
343  if( GetTempCopyComponent() ) // used when editing an existing item
345  else
346  {
347  // When creating a new item, there is still no change for the
348  // current component. So save it.
349  SaveCopyInUndoList( part );
350  }
351 
352  if( m_drawItem->IsNew() )
353  part->AddDrawItem( m_drawItem );
354 
356 
357  m_drawItem = NULL;
358 
359  OnModify();
360 
361  m_canvas->SetMouseCapture( NULL, NULL );
362  m_canvas->Refresh();
363  }
364 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
bool IsNew() const
Definition: base_struct.h:216
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:406
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 return the default cursor shape.
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 320 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::OnSockRequest().

320 {}
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:356
PROJECT & Prj()
Definition: kicad.cpp:293
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:358
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:237
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
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 1255 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 LIB_VIEW_FRAME::GeneralControl(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GeneralControl(), GERBVIEW_FRAME::GeneralControl(), and PCB_EDIT_FRAME::GeneralControl().

1257 {
1258 
1259  // If requested snap the current position to the grid
1260  if( aSnapToGrid )
1261  *aPos = GetNearestGridPosition( *aPos );
1262 
1263  switch( aHotKey )
1264  {
1265  // All these keys have almost the same treatment
1266  case GR_KB_CTRL | WXK_NUMPAD8:
1267  case GR_KB_CTRL | WXK_UP:
1268  case GR_KB_CTRL | WXK_NUMPAD2:
1269  case GR_KB_CTRL | WXK_DOWN:
1270  case GR_KB_CTRL | WXK_NUMPAD4:
1271  case GR_KB_CTRL | WXK_LEFT:
1272  case GR_KB_CTRL | WXK_NUMPAD6:
1273  case GR_KB_CTRL | WXK_RIGHT:
1274  case WXK_NUMPAD8:
1275  case WXK_UP:
1276  case WXK_NUMPAD2:
1277  case WXK_DOWN:
1278  case WXK_NUMPAD4:
1279  case WXK_LEFT:
1280  case WXK_NUMPAD6:
1281  case WXK_RIGHT:
1282  {
1283  /* Here's a tricky part: when doing cursor key movement, the
1284  * 'previous' point should be taken from memory, *not* from the
1285  * freshly computed position in the event. Otherwise you can't do
1286  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1287  * the automatic motion event generated by cursor warping */
1288  wxRealPoint gridSize = GetScreen()->GetGridSize();
1289  *aPos = GetCrossHairPosition();
1290 
1291  // Bonus: ^key moves faster (x10)
1292  switch( aHotKey )
1293  {
1294  case GR_KB_CTRL|WXK_NUMPAD8:
1295  case GR_KB_CTRL|WXK_UP:
1296  aPos->y -= KiROUND( 10 * gridSize.y );
1297  break;
1298 
1299  case GR_KB_CTRL|WXK_NUMPAD2:
1300  case GR_KB_CTRL|WXK_DOWN:
1301  aPos->y += KiROUND( 10 * gridSize.y );
1302  break;
1303 
1304  case GR_KB_CTRL|WXK_NUMPAD4:
1305  case GR_KB_CTRL|WXK_LEFT:
1306  aPos->x -= KiROUND( 10 * gridSize.x );
1307  break;
1308 
1309  case GR_KB_CTRL|WXK_NUMPAD6:
1310  case GR_KB_CTRL|WXK_RIGHT:
1311  aPos->x += KiROUND( 10 * gridSize.x );
1312  break;
1313 
1314  case WXK_NUMPAD8:
1315  case WXK_UP:
1316  aPos->y -= KiROUND( gridSize.y );
1317  break;
1318 
1319  case WXK_NUMPAD2:
1320  case WXK_DOWN:
1321  aPos->y += KiROUND( gridSize.y );
1322  break;
1323 
1324  case WXK_NUMPAD4:
1325  case WXK_LEFT:
1326  aPos->x -= KiROUND( gridSize.x );
1327  break;
1328 
1329  case WXK_NUMPAD6:
1330  case WXK_RIGHT:
1331  aPos->x += KiROUND( gridSize.x );
1332  break;
1333 
1334  default: /* Can't happen since we entered the statement */
1335  break;
1336  }
1337  m_canvas->MoveCursor( *aPos );
1339  }
1340  break;
1341 
1342  default:
1343  break;
1344  }
1345 }
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:354
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
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 214 of file wxstruct.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

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

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

108 {
109  wxASSERT( GetScreen() );
110  return GetScreen()->GetAuxOrigin();
111 }
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 299 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(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), 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(), 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(), DRC::testUnconnected(), 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().

299 { 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
Definition: draw_panel.cpp:326
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:454
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
Definition: draw_panel.cpp:326
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:454
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 1148 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(), LIB_VIEW_FRAME::GeneralControl(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GeneralControl(), GERBVIEW_FRAME::GeneralControl(), PCB_EDIT_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().

1149 {
1150  // subject to change, borrow from old BASE_SCREEN for now.
1151  if( IsGalCanvasActive() )
1152  {
1154 
1155  return wxPoint( cursor.x, cursor.y );
1156  }
1157  else
1158  {
1159  BASE_SCREEN* screen = GetScreen(); // virtual call
1160  return screen->getCrossHairPosition( aInvertY );
1161  }
1162 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
virtual VECTOR2D GetCursorPosition() const =0
Function GetCursorPosition() Returns the current cursor position in world coordinates.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:795
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:803
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 1186 of file draw_frame.cpp.

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

1187 {
1188  BASE_SCREEN* screen = GetScreen(); // virtual call
1189  return screen->getCrossHairScreenPosition();
1190 }
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:309
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 966 of file libeditframe.cpp.

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

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

967 {
968  wxString name = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
969 
970  if( !!name )
971  {
972  PART_LIB* lib = Prj().SchLibs()->FindLibrary( name );
973 
974  if( !lib )
975  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_LIB, wxEmptyString );
976 
977  return lib;
978  }
979 
980  return NULL;
981 }
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
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 997 of file libeditframe.cpp.

References PROJECT::GetRString(), m_my_part, 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().

998 {
999  if( !m_my_part )
1000  {
1001  wxString name = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_PART );
1002  LIB_PART* part;
1003 
1004  if( !!name && ( part = Prj().SchLibs()->FindLibPart( LIB_ID( wxEmptyString, name ) ) ) )
1005  {
1006  // clone it from the PART_LIB and own it.
1007  m_my_part = new LIB_PART( *part );
1008  }
1009  else
1010  Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, wxEmptyString );
1011  }
1012 
1013  return m_my_part;
1014 }
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
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 1172 of file draw_frame.cpp.

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

1173 {
1174  BASE_SCREEN* screen = GetScreen(); // virtual call
1175  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1176 }
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:309
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 818 of file draw_frame.h.

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

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 66 of file sch_base_frame.cpp.

References GetLayerColor(), and LAYER_BACKGROUND.

Referenced by SCH_PRINTOUT::DrawPage(), DIALOG_RESCUE_EACH::renderPreview(), and DIALOG_CHOOSE_COMPONENT::RenderPreview().

67 {
69 }
COLOR4D GetLayerColor(LAYERSCH_ID aLayer)
Definition: eeschema.cpp:166
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(), 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:121
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 803 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(), PCBNEW_CONTROL::CursorControl(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_EDIT_FRAME::Edit_Zone_Params(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::Fill_Zone(), SELECTION_TOOL::findCallback(), EDA_DRAW_FRAME::GetCrossHairPosition(), 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(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), GRID_HELPER::queryVisible(), PCB_BASE_FRAME::RecalculateAllTracksNetcode(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), 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(), 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().

803 { 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
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( ) const
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 435 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().

436  {
437  return m_gridColor;
438  }
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 108 of file sch_base_frame.h.

109  {
110  static wxPoint zero;
111  return zero;
112  }
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 556 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().

557 {
558  wxPoint pos = aPosition;
559 
560  if( m_currentScreen != NULL && m_snapToGrid )
561  pos = GetNearestGridPosition( aPosition );
562 
563  return pos;
564 }
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 345 of file draw_frame.h.

References EDA_DRAW_FRAME::m_hotkeysDescrList.

Referenced by PCBNEW_CONTROL::ShowHelp().

345 { 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 of hot key identifiers (HK_xxx) used in the frame to find a matching hot key descriptor.

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

Implements EDA_DRAW_FRAME.

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

References GetDescriptorFromCommand().

631 {
632  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
633 
634  if( HK_Descr == NULL )
635  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
636 
637  return HK_Descr;
638 }
static EDA_HOTKEY * common_Hotkey_List[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
static EDA_HOTKEY * libEdit_Hotkey_List[]
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 525 of file basicframe.cpp.

References ShowAboutDialog().

526 {
527  bool ShowAboutDialog(wxWindow * parent);
528  ShowAboutDialog( this );
529 }
bool ShowAboutDialog(wxWindow *parent)
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 514 of file basicframe.cpp.

References URL_GET_INVOLVED.

515 {
516  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
517  {
518  wxString msg = _( "Could not launch the default browser. For information on how to help the KiCad project, visit " );
519  msg.Append( URL_GET_INVOLVED );
520  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
521  }
522 }
#define URL_GET_INVOLVED
Definition: basicframe.cpp:51
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 436 of file basicframe.cpp.

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

437 {
438  const SEARCH_STACK& search = sys_search();
439 
440  /* We have to get document for beginners,
441  * or the full specific doc
442  * if event id is wxID_INDEX, we want the document for beginners.
443  * else the specific doc file (its name is in Kiface().GetHelpFileName())
444  * The document for beginners is the same for all KiCad utilities
445  */
446  if( event.GetId() == wxID_INDEX )
447  {
448  // List of possible names for Getting Started in KiCad
449  const wxChar* names[2] = {
450  wxT( "getting_started_in_kicad" ),
451  wxT( "Getting_Started_in_KiCad" )
452  };
453 
454  wxString helpFile;
455  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
456  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
457  for( unsigned ii = 0; ii < DIM( names ); ii++ )
458  {
459  helpFile = SearchHelpFileFullPath( search, names[ii] );
460 
461  if( !helpFile.IsEmpty() )
462  break;
463  }
464 
465  if( !helpFile )
466  {
467  wxString msg = wxString::Format( _(
468  "Html or pdf help file \n'%s'\n or\n'%s' could not be found." ), names[0], names[1] );
469  wxMessageBox( msg );
470  }
471  else
472  {
473  GetAssociatedDocument( this, helpFile );
474  }
475 
476  return;
477  }
478 
479  wxString base_name = help_name();
480  wxString helpFile = SearchHelpFileFullPath( search, base_name );
481 
482  if( !helpFile )
483  {
484  wxString msg = wxString::Format( _(
485  "Help file '%s' could not be found." ),
486  GetChars( base_name )
487  );
488  wxMessageBox( msg );
489  }
490  else
491&#