KiCad PCB EDA Suite
LIB_VIEW_FRAME Class Reference

Symbol library viewer main window. More...

#include <viewlib_frame.h>

Inheritance diagram for LIB_VIEW_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_VIEW_FRAME (KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aLibraryName=wxEmptyString)
 Constructor. More...
 
 ~LIB_VIEW_FRAME ()
 
void OnSize (wxSizeEvent &event) override
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
bool ReCreateListLib ()
 Creates or recreates a sorted list of currently loaded libraries. More...
 
bool ReCreateListCmp ()
 Create or recreate the list of components in the currently selected library. More...
 
void DisplayLibInfos ()
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 
void OnCloseWindow (wxCloseEvent &Event)
 
void CloseLibraryViewer (wxCommandEvent &event)
 
void ReCreateHToolbar () override
 
void ReCreateVToolbar () override
 
void ReCreateMenuBar () override
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
void OnLeftClick (wxDC *DC, const wxPoint &MousePos) override
 
double BestZoom () override
 Return the zoom level which displays the full page on screen. More...
 
void ClickOnLibList (wxCommandEvent &event)
 
void ClickOnCmpList (wxCommandEvent &event)
 
void OnSetRelativeOffset (wxCommandEvent &event)
 
void OnSelectSymbol (wxCommandEvent &aEvent)
 
void OnShowElectricalType (wxCommandEvent &event)
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey) override
 Perform application specific control using aDC at aPosition in logical units. More...
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 > More...
 
bool OnHotKey (wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem) override
 Handle hot key events. 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 SetFilter (const SCHLIB_FILTER *aFilter)
 Set a filter to display only libraries and/or components which match the filter. More...
 
void SetSelectedLibrary (const wxString &aLibName)
 Set the selected library in the library window. More...
 
void SetSelectedComponent (const wxString &aComponentName)
 Set the selected component. More...
 
void SetUnitAndConvert (int aUnit, int aConvert)
 Set unit and convert, and set flag preventing them from automatically resetting to 1. More...
 
int GetUnit () const
 
int GetConvert () const
 
bool GetShowElectricalType () const
 
void SetShowElectricalType (bool aShow)
 
const BOX2I GetDocumentExtents () const override
 
void createCanvas ()
 
SCH_DRAW_PANELGetCanvas () const override
 
SCH_SCREENGetScreen () const override
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
KIGFX::SCH_RENDER_SETTINGSGetRenderSettings ()
 
void OnSwitchCanvas (wxCommandEvent &aEvent)
 switches currently used canvas ( Cairo / OpenGL). More...
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (Cairo / OpenGL). 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
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPoint & GetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPoint & GetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
void OnGridSettings (wxCommandEvent &aEvent) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Update the status bar information. More...
 
COMPONENT_SELECTION SelectComponentFromLibTree (const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
const TEMPLATE_FIELDNAMESGetTemplateFieldNames () const
 Return a template field names list for read only access. More...
 
const TEMPLATE_FIELDNAMEGetTemplateFieldName (const wxString &aName) const
 Search for aName in the the template field name list. More...
 
virtual void OnEditSymbolLibTable (wxCommandEvent &aEvent)
 
LIB_ALIASGetLibAlias (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowError=false)
 Load symbol from symbol library table. More...
 
LIB_PARTGetLibPart (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
virtual void Zoom_Automatique (bool aWarpPointer) override
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
virtual void Window_Zoom (EDA_RECT &aRect) override
 
virtual void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer) override
 Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
virtual void RedrawScreen2 (const wxPoint &posBefore) override
 Put the crosshair back to the screen position it had before zooming. More...
 
virtual void CenterScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 
virtual void HardRedraw () override
 Rebuild the GAL and redraws the screen. More...
 
void AddToScreen (SCH_ITEM *aItem)
 Add an item to the screen (and view) More...
 
void AddToScreen (DLIST< SCH_ITEM > &aItems)
 Add a list of items to the screen (and view) More...
 
void RemoveFromScreen (SCH_ITEM *aItem)
 Remove an item from the screen (and view) More...
 
void RefreshItem (SCH_ITEM *aItem, bool isAddOrDelete=false)
 Mark an item for refresh. More...
 
void SyncView ()
 Mark all items for refresh. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
EDA_UNITS_T GetUserUnits () const override
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Set the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Return the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Return the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Return the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPoint & GetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
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 ()
 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
 Return a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 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
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Set the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 
virtual void SetGridVisibility (bool aVisible)
 It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 
virtual void SetGridColor (COLOR4D aColor)
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Return the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Change the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Change the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Change 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)
 Set 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 OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Change the zoom to the next one available. More...
 
void SetNextZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the next one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPrevZoom ()
 Change the zoom to the previous one available. More...
 
void SetPreviousZoomAndRedraw (const wxPoint &aCenterPoint, bool aWarpPointer)
 Change the zoom to the previous one available redraws the screen and warp the mouse pointer on request. More...
 
void SetPresetZoom (int aIndex)
 Change zoom to one of the preset values. More...
 
void FocusOnLocation (const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void OnLeftDClick (wxDC *DC, const wxPoint &MousePos)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual int BlockCommand (EDA_KEY aKey)
 Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse. More...
 
virtual void HandleBlockPlace (wxDC *DC)
 Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place (bloc move, drag, copy . More...
 
virtual bool HandleBlockEnd (wxDC *DC)
 Handle the "end" of a block command, i.e. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Copy the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Push preferences from a parent window to a child window. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
 Print the page pointed by current screen, set by the calling print function. More...
 
virtual void UseGalCanvas (bool aEnable)
 Use to switch between standard and GAL-based canvas. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Return the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
bool GetShowAxis () const
 
bool GetShowGridAxis () const
 
bool GetShowOriginAxis () const
 
VTBL_ENTRY bool OpenProjectFiles (const std::vector< wxString > &aFileList, int aCtl=0)
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
bool ShowPreferences (EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
 
void PrintMsg (const wxString &text)
 
virtual void InstallPreferences (PAGED_DIALOG *aParent)
 Function InstallPreferences allows a Frame to load its preference panels (if any) into the preferences dialog. More...
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. 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...
 
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 EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 

Protected Member Functions

void OnOpenLibraryViewer (wxCommandEvent &event)
 Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (wxString &aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Select a component from the list of components in a library. More...
 
wxString SelectLibraryFromList ()
 Dispaly a list of loaded libraries in the symbol library and allows the user to select a library. More...
 
bool SelectPartNameToLoad (wxString &aLibrary, wxString &aBufName)
 Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a library. More...
 
bool saveSymbolLibTables (bool aGlobal, bool aProject)
 Saves Symbol Library Tables to disk. More...
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0) override
 Initialize a block command. More...
 
virtual void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
virtual void unitsChangeRefresh ()
 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 CommonSettingsChanged () override
 Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have changed. More...
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool saveCanvasImageToFile (const wxString &aFileName, wxBitmapType aBitmapType=wxBITMAP_TYPE_PNG)
 
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 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

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

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

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

Key in KifaceSettings to store the canvas type.

More...
 

Private Member Functions

virtual void OnActivate (wxActivateEvent &event) override
 Called when the frame is activated to reload the libraries and component lists that can be changed by the schematic editor or the library editor. More...
 
void ExportToSchematicLibraryPart (wxCommandEvent &event)
 Function ExportToSchematicLibraryPart exports the current component to schematic and close the library browser. More...
 
bool OnRightClick (const wxPoint &MousePos, wxMenu *PopMenu) override
 
void DClickOnCmpList (wxCommandEvent &event)
 
void onUpdateAltBodyStyleButton (wxUpdateUIEvent &aEvent)
 
void onUpdateNormalBodyStyleButton (wxUpdateUIEvent &aEvent)
 
void onUpdateDocButton (wxUpdateUIEvent &aEvent)
 
void OnUpdateElectricalType (wxUpdateUIEvent &aEvent)
 
void onUpdateUnitChoice (wxUpdateUIEvent &aEvent)
 
void onSelectNextSymbol (wxCommandEvent &aEvent)
 
void onSelectPreviousSymbol (wxCommandEvent &aEvent)
 
void onViewSymbolDocument (wxCommandEvent &aEvent)
 
void onSelectSymbolBodyStyle (wxCommandEvent &aEvent)
 
void onSelectSymbolUnit (wxCommandEvent &aEvent)
 
LIB_ALIASgetSelectedAlias () const
 
LIB_PARTgetSelectedSymbol () const
 
void updatePreviewSymbol ()
 

Private Attributes

wxChoice * m_unitChoice
 
wxListBox * m_libList
 
int m_libListWidth
 
wxListBox * m_cmpList
 
int m_cmpListWidth
 
bool m_listPowerCmpOnly
 
wxArrayString m_allowedLibs
 
bool m_selection_changed
 Updated to true if a list rewrite on GUI activation resulted in the component selection changing, or if the user has changed the selection manually. More...
 
LIB_ALIASm_previewItem
 
bool m_showPinElectricalTypeName
 the option to show the pin electrical name in the component editor More...
 

Static Private Attributes

static wxString m_libraryName
 
static wxString m_entryName
 
static int m_unit = 1
 
static int m_convert = 1
 

Detailed Description

Symbol library viewer main window.

Definition at line 44 of file viewlib_frame.h.

Member Typedef Documentation

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

Definition at line 193 of file sch_base_frame.h.

Constructor & Destructor Documentation

LIB_VIEW_FRAME::LIB_VIEW_FRAME ( KIWAY aKiway,
wxWindow *  aParent,
FRAME_T  aFrameType,
const wxString &  aLibraryName = wxEmptyString 
)

Constructor.

Parameters
aKiway
aParent= the parent frame
aFrameTypemust be given either FRAME_SCH_LIB_VIEWER or FRAME_SCH_LIB_VIEWER_MODAL
aLibrary= the library to open when starting (default = NULL)
LIB_VIEW_FRAME::~LIB_VIEW_FRAME ( )

Definition at line 221 of file viewlib_frame.cpp.

References SCH_BASE_FRAME::GetCanvas(), SCH_DRAW_PANEL::GetView(), m_previewItem, and KIGFX::VIEW::Remove().

222 {
223  if( m_previewItem )
225 }
LIB_ALIAS * m_previewItem
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:375
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const

Member Function Documentation

void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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 1540 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

1541 {
1542  int maxZoomIds;
1543  double zoom;
1544  wxString msg;
1545  BASE_SCREEN* screen = m_canvas->GetScreen();
1546 
1547  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
1548  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
1549  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
1550  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
1551  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
1552  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
1553  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
1554  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
1555  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
1556  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
1557 
1558 
1559  wxMenu* zoom_choice = new wxMenu;
1560  AddMenuItem( MasterMenu, zoom_choice,
1561  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
1562  KiBitmap( zoom_selection_xpm ) );
1563 
1564  zoom = screen->GetZoom();
1566  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
1567  maxZoomIds : screen->m_ZoomList.size();
1568 
1569  // Populate zoom submenu.
1570  for( int i = 0; i < maxZoomIds; i++ )
1571  {
1572  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
1573 
1574  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
1575  wxEmptyString, wxITEM_CHECK );
1576  if( zoom == screen->m_ZoomList[i] )
1577  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
1578  }
1579 
1580  // Create grid submenu as required.
1581  if( screen->GetGridCount() )
1582  {
1583  wxMenu* gridMenu = new wxMenu;
1584  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
1585  _( "Grid" ), KiBitmap( grid_select_xpm ) );
1586 
1587  wxArrayString gridsList;
1588  int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
1589 
1590  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
1591  {
1592  GRID_TYPE& grid = screen->GetGrid( i );
1593  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
1594 
1595  if( (int)i == icurr )
1596  gridMenu->Check( grid.m_CmdId, true );
1597  }
1598  }
1599 
1600  MasterMenu->AppendSeparator();
1601  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
1602 }
virtual BASE_SCREEN * GetScreen()=0
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:223
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:105
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:281
Definition: common.h:161
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:115
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
void SCH_BASE_FRAME::AddToScreen ( SCH_ITEM aItem)
inherited

Add an item to the screen (and view)

Definition at line 627 of file sch_base_frame.cpp.

References KIGFX::VIEW::Add(), SCH_SCREEN::Append(), SCH_BASE_FRAME::GetCanvas(), SCH_BASE_FRAME::GetScreen(), SCH_DRAW_PANEL::GetView(), and SCH_BASE_FRAME::RefreshItem().

Referenced by SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::AddNoConnect(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_FRAME::DuplicateItemsInList(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::PasteListOfItems(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), and SCH_EDIT_FRAME::SchematicCleanUp().

628 {
629  GetScreen()->Append( aItem );
630  GetCanvas()->GetView()->Add( aItem );
631  RefreshItem( aItem, true ); // handle any additional parent semantics
632 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:162
void RefreshItem(SCH_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
void SCH_BASE_FRAME::AddToScreen ( DLIST< SCH_ITEM > &  aItems)
inherited

Add a list of items to the screen (and view)

Definition at line 635 of file sch_base_frame.cpp.

References KIGFX::VIEW::Add(), SCH_SCREEN::Append(), DLIST< T >::begin(), SCH_BASE_FRAME::GetCanvas(), SCH_BASE_FRAME::GetScreen(), SCH_DRAW_PANEL::GetView(), SCH_ITEM::Next(), and SCH_BASE_FRAME::RefreshItem().

636 {
637  for( SCH_ITEM* item = aItems.begin(); item; item = item->Next() )
638  {
639  GetCanvas()->GetView()->Add( item );
640  RefreshItem( item, true ); // handle any additional parent semantics
641  }
642 
643  GetScreen()->Append( aItems );
644 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
T * begin() const
Definition: dlist.h:218
SCH_ITEM * Next() const
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
void Append(SCH_ITEM *aItem)
Definition: sch_screen.h:162
void RefreshItem(SCH_ITEM *aItem, bool isAddOrDelete=false)
Mark an item for refresh.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint &  aCenterPosition)
inherited

Definition at line 1019 of file legacy_gal/eda_draw_frame.cpp.

1020 {
1021 }
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 880 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), SCH_EDIT_FRAME::EditSheet(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), ShowNewTrackWhenMovingCursor(), and updatePreviewSymbol().

883 {
884  if( m_messagePanel == NULL )
885  return;
886 
887  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
888 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:163
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_VIEW_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 405 of file viewlib_frame.cpp.

References EDA_DRAW_FRAME::bestZoom(), boundingBox(), EDA_RECT::Centre(), EDA_RECT::GetHeight(), LIB_ALIAS::GetPart(), LIB_PART::GetUnitBoundingBox(), EDA_RECT::GetWidth(), m_convert, m_entryName, m_libraryName, m_unit, KIWAY_HOLDER::Prj(), and EDA_DRAW_FRAME::SetScrollCenterPosition().

406 {
407  LIB_PART* part = NULL;
408  double defaultLibraryZoom = 7.33;
409 
410  if( m_libraryName.IsEmpty() || m_entryName.IsEmpty() )
411  {
412  SetScrollCenterPosition( wxPoint( 0, 0 ) );
413  return defaultLibraryZoom;
414  }
415 
416  LIB_ALIAS* alias = nullptr;
417 
418  try
419  {
420  alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
421  }
422  catch( ... )
423  {
424  }
425 
426  if( alias )
427  part = alias->GetPart();
428 
429  if( !part )
430  {
431  SetScrollCenterPosition( wxPoint( 0, 0 ) );
432  return defaultLibraryZoom;
433  }
434 
436 
437  double sizeX = (double) boundingBox.GetWidth();
438  double sizeY = (double) boundingBox.GetHeight();
439  wxPoint centre = boundingBox.Centre();
440 
441  // Reserve a 20% margin around component bounding box.
442  double margin_scale_factor = 1.2;
443 
444  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
445 }
static int m_unit
static int m_convert
static wxString m_entryName
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Part library alias object definition.
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
void SetScrollCenterPosition(const wxPoint &aPoint)
int GetHeight() const
Definition: eda_rect.h:118
static wxString m_libraryName
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Define a library symbol object.
wxPoint Centre() const
Definition: eda_rect.h:60
LIB_PART * GetPart() const
Get the shared LIB_PART.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited
int EDA_DRAW_FRAME::BlockCommand ( EDA_KEY  aKey)
virtualinherited

Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging the mouse.

Parameters
aKey= the key modifiers (Alt, Shift ...)
Returns
the block command id (BLOCK_MOVE, BLOCK_COPY...)

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, FOOTPRINT_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 760 of file legacy_gal/eda_draw_frame.cpp.

Referenced by SCH_BASE_FRAME::HandleBlockBegin(), and EDA_DRAW_FRAME::HandleBlockBegin().

761 {
762  return 0;
763 }
void SCH_BASE_FRAME::CenterScreen ( const wxPoint &  aCenterPoint,
bool  aWarpPointer 
)
virtualinherited

Definition at line 466 of file sch_base_frame.cpp.

References SCH_BASE_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetGalCanvas(), SCH_DRAW_PANEL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW_CONTROLS::WarpCursor().

Referenced by SCH_EDIT_FRAME::FindComponentAndItem(), SCH_EDIT_FRAME::OnFindDrcMarker(), and SCH_EDIT_FRAME::updateFindReplaceView().

467 {
468  GetCanvas()->GetView()->SetCenter( aCenterPoint );
469 
470  if( aWarpPointer )
471  GetCanvas()->GetViewControls()->WarpCursor( aCenterPoint, true );
472 
473  GetGalCanvas()->Refresh();
474 }
virtual void WarpCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
Function WarpCursor() If enabled (.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:600
SCH_DRAW_PANEL * GetCanvas() const override
KIGFX::SCH_VIEW * GetView() const
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
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
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:925
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 585 of file eda_base_frame.cpp.

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

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

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

Definition at line 600 of file viewlib_frame.cpp.

References m_cmpList, m_selection_changed, and SetSelectedComponent().

601 {
602  int ii = m_cmpList->GetSelection();
603 
604  if( ii < 0 )
605  return;
606 
607  m_selection_changed = true;
608 
609  SetSelectedComponent( m_cmpList->GetString( ii ) );
610 }
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the component selection changing...
wxListBox * m_cmpList
void SetSelectedComponent(const wxString &aComponentName)
Set the selected component.
void LIB_VIEW_FRAME::ClickOnLibList ( wxCommandEvent &  event)

Definition at line 570 of file viewlib_frame.cpp.

References m_libList, m_selection_changed, and SetSelectedLibrary().

571 {
572  int ii = m_libList->GetSelection();
573 
574  if( ii < 0 )
575  return;
576 
577  m_selection_changed = true;
578 
579  SetSelectedLibrary( m_libList->GetString( ii ) );
580 }
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the component selection changing...
wxListBox * m_libList
void SetSelectedLibrary(const wxString &aLibName)
Set the selected library in the library window.
void LIB_VIEW_FRAME::CloseLibraryViewer ( wxCommandEvent &  event)

Definition at line 749 of file viewlib_frame.cpp.

750 {
751  Close();
752 }
void EDA_DRAW_FRAME::CommonSettingsChanged ( )
overrideprotectedvirtualinherited

Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have changed.

Update menus, toolbars, local variables, etc.

Reimplemented from EDA_BASE_FRAME.

Reimplemented in PCB_BASE_FRAME.

Definition at line 276 of file legacy_gal/eda_draw_frame.cpp.

References AUTOSAVE_INTERVAL_KEY, KIGFX::GAL_DISPLAY_OPTIONS::cairo_antialiasing_mode, CAIRO_ANTIALIASING_MODE_KEY, PGM_BASE::CommonSettings(), EDA_BASE_FRAME::CommonSettingsChanged(), DEFAULT_FILE_HISTORY_SIZE, ENBL_AUTO_PAN_KEY, ENBL_MOUSEWHEEL_PAN_KEY, ENBL_ZOOM_NO_CENTER_KEY, FILE_HISTORY_SIZE_KEY, GAL_ANTIALIASING_MODE_KEY, KIFACE_I::GetFileHistory(), KIGFX::GAL_DISPLAY_OPTIONS::gl_antialiasing_mode, Kiface(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_galDisplayOptions, max, KIGFX::NONE, KIGFX::GAL_DISPLAY_OPTIONS::NotifyChanged(), Pgm(), EDA_BASE_FRAME::SetAutoSaveInterval(), EDA_DRAW_PANEL::SetEnableAutoPan(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), and FILE_HISTORY::SetMaxFiles().

Referenced by PCB_BASE_FRAME::CommonSettingsChanged(), GERBVIEW_FRAME::CommonSettingsChanged(), LIB_EDIT_FRAME::CommonSettingsChanged(), and SCH_EDIT_FRAME::CommonSettingsChanged().

277 {
279 
280  wxConfigBase* settings = Pgm().CommonSettings();
281 
282  int autosaveInterval;
283  settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
284  SetAutoSaveInterval( autosaveInterval );
285 
286  int historySize;
287  settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE );
288  Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) );
289 
290  bool option;
291  settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
292  m_canvas->SetEnableMousewheelPan( option );
293 
294  settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
295  m_canvas->SetEnableZoomNoCenter( option );
296 
297  settings->Read( ENBL_AUTO_PAN_KEY, &option );
298  m_canvas->SetEnableAutoPan( option );
299 
300  int tmp;
303 
306 
308 }
virtual void SetEnableZoomNoCenter(bool aEnable)
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
#define ENBL_ZOOM_NO_CENTER_KEY
Definition: pgm_base.h:48
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode
#define ENBL_AUTO_PAN_KEY
Definition: pgm_base.h:51
#define DEFAULT_FILE_HISTORY_SIZE
The default file history size is 9.
Definition: pgm_base.h:60
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:49
#define FILE_HISTORY_SIZE_KEY
Definition: pgm_base.h:52
#define AUTOSAVE_INTERVAL_KEY
Definition: pgm_base.h:47
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void SetMaxFiles(size_t aMaxFiles)
Definition: pgm_base.cpp:79
#define GAL_ANTIALIASING_MODE_KEY
Definition: pgm_base.h:54
void SetAutoSaveInterval(int aInterval)
#define max(a, b)
Definition: auxiliary.h:86
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
Definition: draw_frame.h:94
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:189
virtual void SetEnableMousewheelPan(bool aEnable)
#define CAIRO_ANTIALIASING_MODE_KEY
Definition: pgm_base.h:55
virtual void CommonSettingsChanged()
Function CommonSettingsChanged Notification event that some of the common (suite-wide) settings have ...
virtual void SetEnableAutoPan(bool aEnable)
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited

Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 360 of file eda_base_frame.cpp.

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_BASE_FRAME::isAutoSaveRequired(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OpenProjectFiles(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and EDA_BASE_FRAME::windowClosing().

361 {
362  // KICAD_MANAGER_FRAME overrides this
363  wxConfigBase* ret = Kiface().KifaceSettings();
364  //wxASSERT( ret );
365  return ret;
366 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
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 269 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

270  {
271  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
272  return baseCfgName;
273  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

Copy the current page or the current block to the clipboard.

Definition at line 1644 of file legacy_gal/eda_draw_frame.cpp.

References DrawPageOnClipboard(), EDA_DRAW_PANEL::EndMouseCapture(), ID_GEN_COPY_BLOCK_TO_CLIPBOARD, and EDA_DRAW_FRAME::m_canvas.

Referenced by add_search_paths(), and findDialog().

1645 {
1646  DrawPageOnClipboard( this );
1647 
1648  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
1649  {
1650  // fixme-gal
1651  //if( GetScreen()->IsBlockActive() )
1652  //m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
1653 
1655  }
1656 }
virtual void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void SCH_BASE_FRAME::createCanvas ( )
inherited

Definition at line 584 of file sch_base_frame.cpp.

References EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, EDA_DRAW_FRAME::GetGalDisplayOptions(), EDA_DRAW_FRAME::LoadCanvasTypeSetting(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_canvasType, EDA_BASE_FRAME::m_FrameSize, EDA_DRAW_FRAME::m_useSingleCanvasPane, EDA_DRAW_FRAME::SetGalCanvas(), and EDA_DRAW_FRAME::UseGalCanvas().

Referenced by SCH_BASE_FRAME::SCH_BASE_FRAME().

585 {
587 
588  // Allows only a CAIRO or OPENGL canvas:
592 
593  m_canvas = new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
595 
596  m_useSingleCanvasPane = true;
597 
598  SetGalCanvas( static_cast<SCH_DRAW_PANEL*> (m_canvas) );
599  UseGalCanvas( true );
600 }
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:943
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
Definition: draw_frame.h:176
static EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:926
bool m_useSingleCanvasPane
Definition: draw_frame.h:98
virtual void UseGalCanvas(bool aEnable)
Use to switch between standard and GAL-based canvas.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

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

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

50 {
51  wxIPV4address addr;
52 
53  // Set the port number
54  addr.Service( service );
55 
56  // Listen on localhost only if requested
57  if( local )
58  addr.Hostname( HOSTNAME );
59 
60  delete m_socketServer;
61  m_socketServer = new wxSocketServer( addr );
62 
63  m_socketServer->SetNotify( wxSOCKET_CONNECTION_FLAG );
64  m_socketServer->SetEventHandler( *this, ID_EDA_SOCKET_EVENT_SERV );
65  m_socketServer->Notify( true );
66 }
static const wxString HOSTNAME(wxT("localhost"))
wxSocketServer * m_socketServer
Definition: draw_frame.h:100
void LIB_VIEW_FRAME::DClickOnCmpList ( wxCommandEvent &  event)
private

Definition at line 638 of file viewlib_frame.cpp.

References ExportToSchematicLibraryPart(), KIWAY_PLAYER::IsModal(), and EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

Referenced by SetShowElectricalType().

639 {
640  if( IsModal() )
641  {
643 
644  // The schematic editor might not be the parent of the library viewer.
645  // It could be a python window.
646  SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
647 
648  if( schframe )
649  {
650  // Prevent the double click from being as a single click in the parent
651  // window which would cause the part to be parked rather than staying
652  // in drag mode.
653  schframe->SkipNextLeftButtonReleaseEvent();
654  }
655  }
656 }
Schematic editor (Eeschema) main window.
void SkipNextLeftButtonReleaseEvent()
After calling this function, if the left mouse button is down, the next left mouse button release eve...
bool IsModal()
Definition: kiway_player.h:226
void ExportToSchematicLibraryPart(wxCommandEvent &event)
Function ExportToSchematicLibraryPart exports the current component to schematic and close the librar...
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited

Definition at line 162 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop, KIWAY_PLAYER::m_modal_ret_val, and KIWAY_PLAYER::m_modal_string.

Referenced by FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint(), ExportToSchematicLibraryPart(), OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

163 {
164  m_modal_ret_val = aRetVal;
165  m_modal_string = aResult;
166 
167  if( m_modal_loop )
168  {
169  m_modal_loop->Exit();
170  m_modal_loop = 0; // this marks it as dismissed.
171  }
172 
173  Show( false );
174 }
bool m_modal_ret_val
Definition: kiway_player.h:253
wxString m_modal_string
Definition: kiway_player.h:252
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:250
void LIB_VIEW_FRAME::DisplayLibInfos ( )

Definition at line 176 of file viewlibs.cpp.

References Format(), LIB_TABLE_ROW::GetFullURI(), m_libList, m_libraryName, and KIWAY_HOLDER::Prj().

Referenced by OnActivate(), ReCreateListLib(), RedrawActiveWindow(), SetSelectedComponent(), and SetSelectedLibrary().

177 {
178  if( m_libList && !m_libList->IsEmpty() && !m_libraryName.IsEmpty() )
179  {
180  const SYMBOL_LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRow( m_libraryName );
181 
182  wxString title = wxString::Format( _( "Symbol Library Browser -- %s" ),
183  row ? row->GetFullURI() : _( "no library selected" ) );
184  SetTitle( title );
185  }
186 }
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
static wxString m_libraryName
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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
wxListBox * m_libList
bool SCH_BASE_FRAME::DisplayListComponentsInLib ( wxString &  aLibrary,
wxString &  aBuffer,
wxString &  aPreviousChoice 
)
protectedinherited

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

Parameters
aLibrarya reference to the library nickname to explore If empty, the user will be prompted tp chose a library
aBuffer= a wxString to put the selected component name
aPreviousChoice= the previously selected component name. it will be added to the selection list. Can be empty.
Returns
true if a component is selected false on cancel

Definition at line 125 of file selpart.cpp.

References DisplayCmpDocAndKeywords(), DisplayErrorMessage(), Format(), EDA_LIST_DIALOG::GetTextSelection(), i, KIWAY_HOLDER::Prj(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_ID::SetLibItemName(), and IO_ERROR::What().

Referenced by SCH_BASE_FRAME::SelectPartNameToLoad().

127 {
128  wxArrayString nameList;
129 
130  if( !aLibrary )
131  aLibrary = SelectLibraryFromList();
132 
133  if( !aLibrary )
134  return false;
135 
136  try
137  {
138  Prj().SchSymbolLibTable()->EnumerateSymbolLib( aLibrary, nameList );
139  }
140  catch( const IO_ERROR& ioe )
141  {
142  wxString msg;
143 
144  msg.Printf( _( "Error occurred loading symbol library \"%s\"." ), aLibrary );
145  DisplayErrorMessage( this, msg, ioe.What() );
146  return false;
147  }
148 
149  wxArrayString headers;
150  headers.Add( _( "Library:Symbol" ) );
151 
152  std::vector<wxArrayString> itemsToDisplay;
153 
154  // Conversion from wxArrayString to vector of ArrayString
155  for( unsigned i = 0; i < nameList.GetCount(); i++ )
156  {
157  LIB_ID id;
158  wxArrayString item;
159  id.SetLibItemName( nameList[i], false );
160  id.SetLibNickname( aLibrary );
161  item.Add( id.Format() );
162  itemsToDisplay.push_back( item );
163  }
164 
165  EDA_LIST_DIALOG dlg( this, _( "Select Symbol" ), headers, itemsToDisplay, aPreviousChoice,
166  DisplayCmpDocAndKeywords, Prj().SchSymbolLibTable() );
167 
168  if( dlg.ShowModal() != wxID_OK )
169  return false;
170 
171  aBuffer = dlg.GetTextSelection();
172 
173  return true;
174 }
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:259
wxString SelectLibraryFromList()
Dispaly a list of loaded libraries in the symbol library and allows the user to select a library...
Definition: selpart.cpp:76
static void DisplayCmpDocAndKeywords(wxString &aSelection, void *aData)
Definition: selpart.cpp:41
class EDA_LIST_DIALOG
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:206
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
size_t i
Definition: json11.cpp:597
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane on the status bar.

Definition at line 627 of file legacy_gal/eda_draw_frame.cpp.

References INCHES, EDA_DRAW_FRAME::m_UserUnits, and MILLIMETRES.

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

628 {
629  wxString msg;
630 
631  switch( m_UserUnits )
632  {
633  case INCHES: msg = _( "Inches" ); break;
634  case MILLIMETRES: msg = _( "mm" ); break;
635  default: msg = _( "Units" ); break;
636  }
637 
638  SetStatusText( msg, 4 );
639 }
Definition: common.h:161
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
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 223 of file eda_base_frame.cpp.

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

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

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 1793 of file legacy_gal/eda_draw_frame.cpp.

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

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

1796 {
1798  return;
1799 
1800  const PAGE_INFO& pageInfo = GetPageSettings();
1801  wxSize pageSize = pageInfo.GetSizeMils();
1802 
1803  // if not printing, draw the page limits:
1804  if( !aScreen->m_IsPrinting && m_showPageLimits )
1805  {
1806  GRSetDrawMode( aDC, GR_COPY );
1807  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
1808  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
1810  }
1811 
1812  TITLE_BLOCK t_block = GetTitleBlock();
1813  COLOR4D color = COLOR4D( RED );
1814 
1815  wxPoint origin = aDC->GetDeviceOrigin();
1816 
1817  if( aScreen->m_IsPrinting && origin.y > 0 )
1818  {
1819  aDC->SetDeviceOrigin( 0, 0 );
1820  aDC->SetAxisOrientation( true, false );
1821  }
1822 
1823  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
1824  GetScreenDesc(), aFilename, t_block,
1825  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
1826  aLineWidth, aScalar, color, color, aSheetLayer );
1827 
1828  if( aScreen->m_IsPrinting && origin.y > 0 )
1829  {
1830  aDC->SetDeviceOrigin( origin.x, origin.y );
1831  aDC->SetAxisOrientation( true, true );
1832  }
1833 }
int m_ScreenNumber
Definition: base_screen.h:216
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
virtual const TITLE_BLOCK & GetTitleBlock() const =0
int color
Definition: DXF_plotter.cpp:62
virtual EDA_RECT * GetClipBox()
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:113
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
const wxSize & GetSizeMils() const
Definition: page_info.h:142
virtual const PAGE_INFO & GetPageSettings() const =0
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...
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
virtual wxString GetScreenDesc() const
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:143
Definition: colors.h:60
bool m_IsPrinting
Definition: base_screen.h:220
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:111
Definition: colors.h:49
int m_NumberOfScreens
Definition: base_screen.h:217
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 311 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by GERBVIEW_FRAME::SetCurItem().

312 {
313  if( m_messagePanel )
315 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:163
void EraseMsgBox()
Definition: msgpanel.cpp:216
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 405 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

405 {}
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 738 of file hotkeys_basic.cpp.

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

Referenced by PANEL_HOTKEYS_EDITOR::installButtons(), and EDA_BASE_FRAME::SaveProjectSettings().

740 {
741  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
742  wxString mask = wxT( "*." ) + ext;
743 
744 #if 0
745  wxString path = wxPathOnly( Prj().GetProjectFullName() );
746 #else
747  wxString path = GetMruPath();
748 #endif
749  wxFileName fn( aDefaultShortname );
750  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
751 
752  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
753  path,
754  fn.GetFullPath(),
755  ext,
756  mask,
757  this,
758  wxFD_SAVE,
759  true );
760 
761  if( filename.IsEmpty() )
762  return;
763 
764  WriteHotkeyConfig( aDescList, &filename );
765  SetMruPath( wxFileName( filename ).GetPath() );
766 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:292
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
void LIB_VIEW_FRAME::ExportToSchematicLibraryPart ( wxCommandEvent &  event)
private

Function ExportToSchematicLibraryPart exports the current component to schematic and close the library browser.

Definition at line 659 of file viewlib_frame.cpp.

References KIWAY_PLAYER::DismissModal(), m_cmpList, and m_libraryName.

Referenced by DClickOnCmpList(), and SetShowElectricalType().

660 {
661  int ii = m_cmpList->GetSelection();
662 
663  if( ii >= 0 )
664  {
665  wxString part_name = m_libraryName + ':' + m_cmpList->GetString( ii );
666 
667  // a selection was made, pass true
668  DismissModal( true, part_name );
669  }
670  else
671  {
672  // no selection was made, pass false
673  DismissModal( false );
674  }
675 
676  Close( true );
677 }
wxListBox * m_cmpList
static wxString m_libraryName
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint &  aPos,
bool  aWarpCursor = true,
bool  aCenterView = false 
)
inherited

Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested.

Parameters
aPosis the point to go to.
aWarpCursoris true if the pointer should be warped to the new position.
aCenterViewis true if the new cursor position should be centered on canvas.

Definition at line 1617 of file legacy_gal/eda_draw_frame.cpp.

References DrawPageOnClipboard(), findDialog(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::SetCenter(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), and KIGFX::VIEW_CONTROLS::SetCursorPosition().

Referenced by findDialog(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_ERC::OnLeftClickMarkersList(), DIALOG_ERC::OnLeftDblClickMarkersList(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), and DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent().

1618 {
1619  if( aCenterView )
1620  {
1621  wxWindow* dialog = findDialog( GetChildren() );
1622 
1623  // If a dialog partly obscures the window, then center on the uncovered area.
1624  if( dialog )
1625  {
1626  wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
1627  dialog->GetSize() );
1628  GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect );
1629  }
1630  else
1631  GetGalCanvas()->GetView()->SetCenter( aPos );
1632  }
1633 
1634  if( aWarpCursor )
1636  else
1638 }
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:600
wxWindow * findDialog(wxWindowList &aList)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
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
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:925
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false)=0
Moves cursor to the requested position expressed in world coordinates.
bool LIB_VIEW_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint &  aPosition,
EDA_KEY  aHotKey 
)
overridevirtual

Perform application specific control using aDC at aPosition in logical units.

Override this function for application specific control. This function gets called on every mouse and key event.

Parameters
aDCA device context.
aPositionThe current cursor position in logical (drawing) units.
aHotKeyA key event used for application specific control if not zero.
Returns
true if the hotkey code is handled (captured).

Reimplemented from EDA_DRAW_FRAME.

Definition at line 312 of file eeschema/controle.cpp.

References EDA_DRAW_PANEL::CrossHairOn(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), SCH_SCREEN::GetCurItem(), EDA_ITEM::GetFlags(), SCH_EDIT_FRAME::GetScreen(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_movingCursorWithKeyboard, SCH_EDIT_FRAME::OnHotKey(), EDA_DRAW_FRAME::SetCrossHairPosition(), and SCH_BASE_FRAME::UpdateStatusBar().

313 {
314  bool eventHandled = true;
315 
316  // Filter out the 'fake' mouse motion after a keyboard movement
317  if( !aHotKey && m_movingCursorWithKeyboard )
318  {
320  return false;
321  }
322 
323  wxPoint pos = aPosition;
324  GeneralControlKeyMovement( aHotKey, &pos, true );
325 
326  // Update cursor position.
327  m_canvas->CrossHairOn( aDC );
328  SetCrossHairPosition( pos, true );
329 
330  if( aHotKey )
331  {
332  SCH_SCREEN* screen = GetScreen();
333 
334  if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
335  eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
336  else
337  eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
338  }
339 
340  UpdateStatusBar(); // Display cursor coordinates info.
341 
342  return eventHandled;
343 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Handle the common part of GeneralControl dedicated to global cursor keys (i.e.
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:196
virtual void CrossHairOn(wxDC *DC=nullptr)
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem) override
Handle hot key events.
void UpdateStatusBar() override
Update the status bar information.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:173
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint *  aPos,
bool  aSnapToGrid 
)
protectedinherited

Handle the common part of GeneralControl dedicated to global cursor keys (i.e.

cursor movement by keyboard)

Parameters
aHotKeyis the hotkey code
aPosis the position of the cursor (initial then new)
aSnapToGrid= true to force the cursor position on grid
Returns
true if the hotkey code is handled (captured).

Definition at line 1217 of file legacy_gal/eda_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, and EDA_DRAW_PANEL::MoveCursor().

Referenced by 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(), LIB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), and PCB_EDIT_FRAME::GeneralControl().

1219 {
1220  bool key_handled = false;
1221 
1222  // If requested snap the current position to the grid
1223  if( aSnapToGrid )
1224  *aPos = GetNearestGridPosition( *aPos );
1225 
1226  switch( aHotKey )
1227  {
1228  // All these keys have almost the same treatment
1229  case GR_KB_CTRL | WXK_NUMPAD8:
1230  case GR_KB_CTRL | WXK_UP:
1231  case GR_KB_CTRL | WXK_NUMPAD2:
1232  case GR_KB_CTRL | WXK_DOWN:
1233  case GR_KB_CTRL | WXK_NUMPAD4:
1234  case GR_KB_CTRL | WXK_LEFT:
1235  case GR_KB_CTRL | WXK_NUMPAD6:
1236  case GR_KB_CTRL | WXK_RIGHT:
1237  case WXK_NUMPAD8:
1238  case WXK_UP:
1239  case WXK_NUMPAD2:
1240  case WXK_DOWN:
1241  case WXK_NUMPAD4:
1242  case WXK_LEFT:
1243  case WXK_NUMPAD6:
1244  case WXK_RIGHT:
1245  key_handled = true;
1246  {
1247  /* Here's a tricky part: when doing cursor key movement, the
1248  * 'previous' point should be taken from memory, *not* from the
1249  * freshly computed position in the event. Otherwise you can't do
1250  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1251  * the automatic motion event generated by cursor warping */
1252  wxRealPoint gridSize = GetScreen()->GetGridSize();
1253  *aPos = GetCrossHairPosition();
1254 
1255  // Bonus: ^key moves faster (x10)
1256  switch( aHotKey )
1257  {
1258  case GR_KB_CTRL|WXK_NUMPAD8:
1259  case GR_KB_CTRL|WXK_UP:
1260  aPos->y -= KiROUND( 10 * gridSize.y );
1261  break;
1262 
1263  case GR_KB_CTRL|WXK_NUMPAD2:
1264  case GR_KB_CTRL|WXK_DOWN:
1265  aPos->y += KiROUND( 10 * gridSize.y );
1266  break;
1267 
1268  case GR_KB_CTRL|WXK_NUMPAD4:
1269  case GR_KB_CTRL|WXK_LEFT:
1270  aPos->x -= KiROUND( 10 * gridSize.x );
1271  break;
1272 
1273  case GR_KB_CTRL|WXK_NUMPAD6:
1274  case GR_KB_CTRL|WXK_RIGHT:
1275  aPos->x += KiROUND( 10 * gridSize.x );
1276  break;
1277 
1278  case WXK_NUMPAD8:
1279  case WXK_UP:
1280  aPos->y -= KiROUND( gridSize.y );
1281  break;
1282 
1283  case WXK_NUMPAD2:
1284  case WXK_DOWN:
1285  aPos->y += KiROUND( gridSize.y );
1286  break;
1287 
1288  case WXK_NUMPAD4:
1289  case WXK_LEFT:
1290  aPos->x -= KiROUND( gridSize.x );
1291  break;
1292 
1293  case WXK_NUMPAD6:
1294  case WXK_RIGHT:
1295  aPos->x += KiROUND( gridSize.x );
1296  break;
1297 
1298  default: /* Can't happen since we entered the statement */
1299  break;
1300  }
1301 
1302  m_canvas->MoveCursor( *aPos );
1304  }
1305  break;
1306 
1307  default:
1308  break;
1309  }
1310 
1311  return key_handled;
1312 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:121
#define GR_KB_CTRL
virtual void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
wxPoint GetCrossHairPosition(bool aInvertY=false) const
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:173
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 217 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

Definition at line 475 of file draw_frame.h.

475 { return m_auxiliaryToolBar; }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
const wxPoint & SCH_BASE_FRAME::GetAuxOrigin ( ) const
overridevirtualinherited

Return the origin of the axis used for plotting and various exports.

Implements EDA_DRAW_FRAME.

Definition at line 194 of file sch_base_frame.cpp.

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

195 {
196  wxASSERT( GetScreen() );
197  return GetScreen()->GetAuxOrigin();
198 }
const wxPoint & GetAuxOrigin() const
Definition: sch_screen.h:133
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * SCH_BASE_FRAME::GetCanvas ( ) const
overridevirtualinherited

Reimplemented from EDA_DRAW_FRAME.

Definition at line 484 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetGalCanvas().

Referenced by SCH_EDIT_FRAME::AddJunction(), SCH_EDIT_FRAME::AddNoConnect(), SCH_BASE_FRAME::AddToScreen(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_BASE_FRAME::CenterScreen(), SCH_EDIT_FRAME::DeleteAnnotation(), LIB_EDIT_FRAME::deleteItem(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DrawMovePin(), LIB_EDIT_FRAME::EditField(), LIB_EDIT_FRAME::EditGraphicSymbol(), SCH_EDIT_FRAME::EditSheet(), LIB_EDIT_FRAME::EditSymbolText(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::FindComponentAndItem(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_EDIT_FRAME::GetSchematicFromRedoList(), SCH_EDIT_FRAME::GetSchematicFromUndoList(), LIB_EDIT_FRAME::GlobalSetPins(), SCH_BASE_FRAME::HandleBlockBegin(), LIB_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_BASE_FRAME::HardRedraw(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), SCH_EDIT_FRAME::LoadSettings(), LIB_EDIT_FRAME::LoadSettings(), SCH_EDIT_FRAME::MirrorSheet(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_ANNOTATE::OnApplyClick(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), OnCloseWindow(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditComponentProperties(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), LIB_EDIT_FRAME::OnOpenPinTable(), LIB_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectOptionToolbar(), SCH_EDIT_FRAME::OnSelectUnit(), OnShowElectricalType(), LIB_EDIT_FRAME::OnShowElectricalType(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), SCH_EDIT_FRAME::OrientComponent(), LIB_EDIT_FRAME::pasteClipboard(), SCH_FIELD::Place(), LIB_EDIT_FRAME::PlacePin(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::PutDataInPreviousState(), LIB_EDIT_FRAME::RebuildView(), DIALOG_ERC::RedrawDrawPanel(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RedrawScreen2(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RemoveFromScreen(), LIB_EDIT_FRAME::RepeatPinItem(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::SaveWireImage(), SetUnitAndConvert(), SCH_EDIT_FRAME::TestDanglingEnds(), DIALOG_ERC::TestErc(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow(), DIALOG_UPDATE_FIELDS::TransferDataFromWindow(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), updatePreviewSymbol(), DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL(), and ~LIB_VIEW_FRAME().

485 {
486  return static_cast<SCH_DRAW_PANEL*>( GetGalCanvas() );
487 }
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:925
int LIB_VIEW_FRAME::GetConvert ( ) const
inline

Definition at line 144 of file viewlib_frame.h.

References m_convert.

Referenced by SCH_BASE_FRAME::SelectComponentFromLibBrowser().

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

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 1116 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddModuleToBoard(), PCB_BASE_FRAME::AddPad(), 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(), LIB_EDIT_FRAME::CreateGraphicItem(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopupMenuForTracks(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTextePcb(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), PCB_EDIT_FRAME::EditDimension(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_PANEL::GetScreen(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_WIZARD_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), OnSetRelativeOffset(), FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset(), FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset(), EDA_DRAW_FRAME::OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), LIB_EDIT_FRAME::PlaceAnchor(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_BASE_FRAME::PlaceTexteModule(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), RedrawWhileMovingCursor(), EDA_DRAW_FRAME::RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), resizeSheetWithMouseCursor(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), 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(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

1117 {
1119  return wxPoint( cursor.x, aInvertY ? -cursor.y : cursor.y );
1120 }
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
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
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:925
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const
inherited

Return the cross hair position in device (display) units.b.

Returns
The current cross hair position.

Definition at line 1152 of file legacy_gal/eda_draw_frame.cpp.

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

1153 {
1154  BASE_SCREEN* screen = GetScreen(); // virtual call
1155  return screen->getCrossHairScreenPosition();
1156 }
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
wxPoint EDA_DRAW_FRAME::GetCursorPosition ( bool  aOnGrid,
wxRealPoint *  aGridSize = NULL 
) const
inherited

Return 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 1137 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

1138 {
1139  BASE_SCREEN* screen = GetScreen(); // virtual call
1140  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1141 }
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
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

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 938 of file draw_frame.h.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), EDA_DRAW_PANEL::GetParent(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow().

938 { return NULL; }
const BOX2I LIB_VIEW_FRAME::GetDocumentExtents ( ) const
overridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 769 of file viewlib_frame.cpp.

References EDA_RECT::GetHeight(), EDA_RECT::GetOrigin(), LIB_ALIAS::GetPart(), getSelectedAlias(), LIB_PART::GetUnitBoundingBox(), EDA_RECT::GetWidth(), m_convert, and m_unit.

Referenced by SetShowElectricalType().

770 {
771  LIB_ALIAS* alias = getSelectedAlias();
772  LIB_PART* part = alias ? alias->GetPart() : nullptr;
773 
774  if( !part )
775  {
776  return BOX2I( VECTOR2I(-200, -200), VECTOR2I( 400, 400 ) );
777  }
778  else
779  {
780  EDA_RECT bbox = part->GetUnitBoundingBox( m_unit, m_convert );
781  return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) );
782 
783  }
784 }
static int m_unit
static int m_convert
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
const EDA_RECT GetUnitBoundingBox(int aUnit, int aConvert) const
Get the bounding box for the symbol.
Part library alias object definition.
const wxPoint GetOrigin() const
Definition: eda_rect.h:112
int GetHeight() const
Definition: eda_rect.h:118
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
Define a library symbol object.
LIB_PART * GetPart() const
Get the shared LIB_PART.
LIB_ALIAS * getSelectedAlias() const
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited
wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 474 of file draw_frame.h.

474 { return m_drawToolBar; }
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
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 399 of file eda_base_frame.cpp.

References Format(), KIFACE_I::GetFileHistory(), i, and Kiface().

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), GERBVIEW_FRAME::OnZipFileHistory(), and EDA_BASE_FRAME::SaveProjectSettings().

401 {
402  wxFileHistory* fileHistory = aFileHistory;
403 
404  if( !fileHistory )
405  fileHistory = &Kiface().GetFileHistory();
406 
407  int baseId = fileHistory->GetBaseId();
408 
409  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
410 
411  unsigned i = cmdId - baseId;
412 
413  if( i < fileHistory->GetCount() )
414  {
415  wxString fn = fileHistory->GetHistoryFile( i );
416 
417  if( wxFileName::FileExists( fn ) )
418  return fn;
419  else
420  {
421  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
422  wxMessageBox( msg );
423 
424  fileHistory->RemoveFileFromHistory( i );
425  }
426  }
427 
428  return wxEmptyString;
429 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
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
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123
size_t i
Definition: json11.cpp:597
EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetGalCanvas ( ) const
inlineinherited

Return a pointer to GAL-based canvas of given EDA draw frame.

Returns
Pointer to GAL-based canvas.

Definition at line 925 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL(), DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_TOOL::canvas(), COMMON_TOOLS::CenterContents(), SCH_BASE_FRAME::CenterScreen(), PCB_EDIT_FRAME::Check_All_Zones(), GERBVIEW_FRAME::Clear_DrawLayers(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), DIALOG_PRINT_PCBNEW::createPrintout(), DIALOG_PRINT_GERBVIEW::createPrintout(), PCB::IFACE::CreateWindow(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), PCB_EDIT_FRAME::Edit_Zone_Params(), LIB_EDIT_FRAME::EndDrawGraphicItem(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), findDialog(), EDA_DRAW_FRAME::FocusOnLocation(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), SCH_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GERBVIEW_FRAME(), SCH_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetCollectorsGuide(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_PANEL::GetGrid(), SCH_BASE_FRAME::GetRenderSettings(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HighlightConnectionAtPosition(), GERBVIEW_CONTROL::HighlightControl(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_FRAME::loadListOfGerberAndDrillFiles(), FOOTPRINT_PREVIEW_PANEL::New(), SCH_EDIT_FRAME::OnCancelCurrentCommand(), STATUS_POPUP::onCharHook(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnCreateNewPart(), LIB_EDIT_FRAME::OnEditComponentProperties(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnPaint(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), LIB_EDIT_FRAME::OnSelectBodyStyle(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), SCH_BASE_FRAME::OnSwitchCanvas(), PCB_BASE_FRAME::OnToggleEdgeDrawMode(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnToggleTextDrawMode(), GERBVIEW_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSelectZoom(), SCH_BASE_FRAME::OnUpdateSwitchCanvas(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), FOOTPRINT_TREE_PANE::onUpdateUI(), EDA_DRAW_FRAME::OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), LIB_EDIT_FRAME::PlaceAnchor(), DIALOG_PAD_PROPERTIES::prepareCanvas(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), processBoardItem(), TOOL_MANAGER::ProcessEvent(), BOARD_COMMIT::Push(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), SCH_BASE_FRAME::RedrawScreen2(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), refreshCallback(), SELECTION_TOOL::RequestSelection(), SaveCanvasImageToFile(), LIB_EDIT_FRAME::saveLibrary(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), EDA_DRAW_FRAME::SetCrossHairPosition(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNextZoomAndRedraw(), EDA_DRAW_FRAME::SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), EDA_DRAW_FRAME::SetPresetGrid(), EDA_DRAW_FRAME::SetPreviousZoomAndRedraw(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), GERBVIEW_FRAME::SortLayersByX2Attributes(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), EDA_DRAW_FRAME::SwitchCanvas(), SCH_BASE_FRAME::SyncView(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PANEL_PCBNEW_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_PCBNEW_SETTINGS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), GERBVIEW_FRAME::UpdateDisplayOptions(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_EDIT_FRAME::UpdateUserInterface(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), PCB_BASE_EDIT_FRAME::UseGalCanvas(), FOOTPRINT_EDIT_FRAME::UseGalCanvas(), PCB_BASE_FRAME::UseGalCanvas(), GERBVIEW_FRAME::UseGalCanvas(), EDA_DRAW_FRAME::UseGalCanvas(), CVPCB_CONTROL::view(), SCH_BASE_FRAME::Window_Zoom(), SCH_BASE_FRAME::Zoom_Automatique(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

925 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame&#39;s interface to setting GAL display options.
Definition: draw_frame.h:91
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited
Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 542 of file draw_frame.h.

Referenced by GERBVIEW_FRAME::GetVisibleElementColor(), and PCBNEW_CONTROL::Reset().

543  {
544  return m_gridColor;
545  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:112
const wxPoint& SCH_BASE_FRAME::GetGridOrigin ( ) const
inlineoverridevirtualinherited

Return 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 164 of file sch_base_frame.h.

165  {
166  static wxPoint zero;
167  return zero;
168  }
wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint &  aPosition) const
inherited

Return 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 686 of file legacy_gal/eda_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().

687 {
688  wxPoint pos = aPosition;
689 
690  if( m_currentScreen != NULL && m_snapToGrid )
691  pos = GetNearestGridPosition( aPosition );
692 
693  return pos;
694 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:87
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Return the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:89
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

Return a structure containing currently used hotkey mapping.

Definition at line 428 of file draw_frame.h.

Referenced by GERBVIEW_CONTROL::ShowHelp(), and PCBNEW_CONTROL::ShowHelp().

428 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:105
EDA_HOTKEY * LIB_VIEW_FRAME::GetHotKeyDescription ( int  aCommand) const
overridevirtual

>

Search 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 881 of file eeschema/hotkeys.cpp.

References GetDescriptorFromCommand().

882 {
883  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
884 
885  if( HK_Descr == NULL )
886  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
887 
888  return HK_Descr;
889 }
static EDA_HOTKEY * common_Hotkey_List[]
static EDA_HOTKEY * viewlib_Hotkey_List[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
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 506 of file eda_base_frame.cpp.

References ShowAboutDialog().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

507 {
508  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
509  ShowAboutDialog( this );
510 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 493 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

494 {
495  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
496  {
497  wxString msg;
498  msg.Printf( _( "Could not launch the default browser.\n"
499  "For information on how to help the KiCad project, visit %s" ),
501  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
502  }
503 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 432 of file eda_base_frame.cpp.

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

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

433 {
434  const SEARCH_STACK& search = sys_search();
435 
436  /* We have to get document for beginners,
437  * or the full specific doc
438  * if event id is wxID_INDEX, we want the document for beginners.
439  * else the specific doc file (its name is in Kiface().GetHelpFileName())
440  * The document for beginners is the same for all KiCad utilities
441  */
442  if( event.GetId() == wxID_INDEX )
443  {
444  // List of possible names for Getting Started in KiCad
445  const wxChar* names[2] = {
446  wxT( "getting_started_in_kicad" ),
447  wxT( "Getting_Started_in_KiCad" )
448  };
449 
450  wxString helpFile;
451  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
452  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
453  for( unsigned ii = 0; ii < arrayDim( names ); ii++ )
454  {
455  helpFile = SearchHelpFileFullPath( search, names[ii] );
456 
457  if( !helpFile.IsEmpty() )
458  break;
459  }
460 
461  if( !helpFile )
462  {
463  wxString msg = wxString::Format( _(
464  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
465  wxMessageBox( msg );
466  }
467  else
468  {
469  GetAssociatedDocument( this, helpFile );
470  }
471 
472  return;
473  }
474 
475  wxString base_name = help_name();
476  wxString helpFile = SearchHelpFileFullPath( search, base_name );
477 
478  if( !helpFile )
479  {
480  wxString msg = wxString::Format( _(
481  "Help file \"%s\" could not be found." ),
482  GetChars( base_name )
483  );
484  wxMessageBox( msg );
485  }
486  else
487  {
488  GetAssociatedDocument( this, helpFile );
489  }
490 }
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSearchStack, const wxString &aBaseName)
Return the help file&#39;s full path.
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:87
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
virtual const SEARCH_STACK & sys_search()
Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_M...
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
of elements in an array. This implements type-safe compile time checking
Definition: macros.h:99
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
virtual wxString help_name()
int EDA_DRAW_FRAME::GetLastGridSizeId ( ) const
inlineinherited

Definition at line 298 of file draw_frame.h.

298 { return m_LastGridSizeId; }
int m_LastGridSizeId
Definition: draw_frame.h:107
LIB_ALIAS * SCH_BASE_FRAME::GetLibAlias ( const LIB_ID aLibId,
bool  aUseCacheLib = false,
bool  aShowError = false 
)
inherited

Load symbol from symbol library table.

Parameters
aLibIdis the symbol library identifier to load.
aUseCacheLibset to true to fall back to cache library if symbol is not found in symbol library table.
aShowErrorMessageset to true to show any error messages.
Returns
The symbol found in the library or NULL if the symbol was not found.

Definition at line 306 of file sch_base_frame.cpp.

References cache, KIWAY_HOLDER::Prj(), and SchGetLibAlias().

Referenced by SCH_BASE_FRAME::SelectComponentFromLibTree(), and DIALOG_UPDATE_FIELDS::updateFields().

307 {
308  PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
309 
310  return SchGetLibAlias( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowError );
311 }
static S3D_CACHE * cache
Definition: export_vrml.cpp:64
LIB_ALIAS * SchGetLibAlias(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, PART_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Load symbol from symbol library table.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Object used to load, save, search, and otherwise manipulate symbol library files. ...
LIB_PART * SCH_BASE_FRAME::GetLibPart ( const LIB_ID aLibId,
bool  aUseCacheLib = false,
bool  aShowErrorMsg = false 
)
inherited

Definition at line 314 of file sch_base_frame.cpp.

References cache, KIWAY_HOLDER::Prj(), and SchGetLibPart().

Referenced by SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::CreateArchiveLibrary(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), SCH_EDIT_FRAME::Load_Component(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary(), SCH_EDIT_FRAME::OnSelectUnit(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow().

315 {
316  PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
317 
318  return SchGetLibPart( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
319 }
static S3D_CACHE * cache
Definition: export_vrml.cpp:64
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
LIB_PART * SchGetLibPart(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, PART_LIB *aCacheLib, wxWindow *aParent, bool aShowErrorMsg)
Object used to load, save, search, and otherwise manipulate symbol library files. ...
wxAuiToolBar* EDA_DRAW_FRAME::GetMainToolBar ( ) const
inlineinherited

Definition at line 472 of file draw_frame.h.

472 { return m_mainToolBar; }
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition ( const wxPoint &  aPosition,
wxRealPoint *  aGridSize = NULL 
) const
inherited

Return the nearest aGridSize location to aPosition.

Parameters
aPositionThe position to check.
aGridSizeThe grid size to locate to if provided. If NULL then the current grid size is used.
Returns
The nearst grid position.

Definition at line 1144 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::copyBlockItems(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_FRAME::GetGridPosition(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), GERBVIEW_FRAME::Locate(), SCH_EDIT_FRAME::LocateAndShowItem(), LIB_EDIT_FRAME::LocateItemUsingCursor(), LIB_EDIT_FRAME::OnOrient(), SCH_EDIT_FRAME::OnOrient(), EDA_DRAW_PANEL::OnPaint(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnRotate(), resizeSheetWithMouseCursor(), and SCH_EDIT_FRAME::RotateHierarchicalSheet().

1146 {
1147  BASE_SCREEN* screen = GetScreen(); // virtual call
1148  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1149 }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
wxPoint getNearestGridPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getNearestGridPosition returns the nearest aGridSize location to aPosition.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
wxAuiToolBar* EDA_DRAW_FRAME::GetOptionsToolBar ( ) const
inlineinherited

Definition at line 473 of file draw_frame.h.

473 { return m_optionsToolBar; }
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
const PAGE_INFO & SCH_BASE_FRAME::GetPageSettings ( ) const
overridevirtualinherited

Implements EDA_DRAW_FRAME.

Definition at line 181 of file sch_base_frame.cpp.

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

Referenced by DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetPS().

182 {
183  return GetScreen()->GetPageSettings();
184 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:126
const wxSize SCH_BASE_FRAME::GetPageSizeIU ( ) const
overridevirtualinherited

Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view.

Implements EDA_DRAW_FRAME.

Definition at line 187 of file sch_base_frame.cpp.

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

188 {
189  // GetSizeIU is compile time dependent:
190  return GetScreen()->GetPageSettings().GetSizeIU();
191 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:126
KIGFX::SCH_RENDER_SETTINGS * SCH_BASE_FRAME::GetRenderSettings ( )
inherited

Definition at line 490 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), and EDA_DRAW_PANEL_GAL::GetView().

Referenced by DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), OnShowElectricalType(), LIB_EDIT_FRAME::OnShowElectricalType(), LIB_EDIT_FRAME::RebuildView(), SetUnitAndConvert(), PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), and updatePreviewSymbol().

491 {
492  KIGFX::PAINTER* painter = GetGalCanvas()->GetView()->GetPainter();
493  return static_cast<KIGFX::SCH_RENDER_SETTINGS*>( painter->GetSettings() );
494 }
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Class PAINTER contains all the knowledge about how to draw graphical object onto any particular outpu...
Definition: painter.h:308
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
Class SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:66
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:925
int SCH_BASE_FRAME::GetRepeatDeltaLabel ( ) const
inlineinherited
Returns
the increment value of labels like bus members for the repeat command

Definition at line 139 of file sch_base_frame.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), LIB_EDIT_FRAME::SaveSettings(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), and PANEL_LIBEDIT_SETTINGS::TransferDataToWindow().

139 { return m_repeatDeltaLabel; }
int m_repeatDeltaLabel
the increment value of labels like bus members when they are repeated
const wxPoint SCH_BASE_FRAME::GetRepeatStep ( ) const
inlineinherited
Returns
the increment value of the position of an item for the repeat command

Definition at line 126 of file sch_base_frame.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::SaveSettings(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), and PANEL_LIBEDIT_SETTINGS::TransferDataToWindow().

126 { return m_repeatStep; }
wxPoint m_repeatStep
the increment value of the position of an item when it is repeated
SCH_SCREEN * SCH_BASE_FRAME::GetScreen ( ) const
overridevirtualinherited

Return a pointer to a BASE_SCREEN or one of its derivatives.

It is overloaded by derived classes to return SCH_SCREEN or PCB_SCREEN.

Reimplemented from EDA_DRAW_FRAME.

Reimplemented in SCH_EDIT_FRAME.

Definition at line 163 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetScreen().

Referenced by AddMenusForBlock(), SCH_BASE_FRAME::AddToScreen(), LIB_EDIT_FRAME::copySelectedItems(), DIALOG_SET_GRID::DIALOG_SET_GRID(), LIB_EDIT_FRAME::GeneralControl(), SCH_BASE_FRAME::GetAuxOrigin(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), LIB_EDIT_FRAME::GetDrawItem(), SCH_BASE_FRAME::GetPageSettings(), SCH_BASE_FRAME::GetPageSizeIU(), SCH_BASE_FRAME::GetTitleBlock(), SCH_BASE_FRAME::HandleBlockBegin(), LIB_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::InitBlockPasteInfos(), LIB_EDIT_FRAME::LoadComponentAndSelectLib(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::OnModify(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), LIB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), OnSetRelativeOffset(), LIB_EDIT_FRAME::OnUpdateRedo(), LIB_EDIT_FRAME::OnUpdateUndo(), SCH_EDIT_FRAME::OrientComponent(), LIB_EDIT_FRAME::pasteClipboard(), LIB_EDIT_FRAME::PrintPage(), LIB_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::RedrawActiveWindow(), SCH_BASE_FRAME::RedrawScreen(), SCH_BASE_FRAME::RedrawScreen2(), SCH_BASE_FRAME::RemoveFromScreen(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_BASE_FRAME::SetAuxOrigin(), LIB_EDIT_FRAME::SetCurPart(), LIB_EDIT_FRAME::SetDrawItem(), SCH_BASE_FRAME::SetPageSettings(), SCH_BASE_FRAME::SetTitleBlock(), LIB_EDIT_FRAME::storeCurrentPart(), LIB_EDIT_FRAME::SVG_PlotComponent(), SCH_BASE_FRAME::SyncView(), SCH_BASE_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::Window_Zoom(), and SCH_BASE_FRAME::Zoom_Automatique().

164 {
166 }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

Definition at line 1836 of file legacy_gal/eda_draw_frame.cpp.

Referenced by ConfigureDrawList(), KIGFX::SCH_VIEW::DisplaySheet(), DrawPageLayout(), EDA_DRAW_FRAME::DrawWorkSheet(), PL_EDITOR_FRAME::Locate(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG().

1837 {
1838  // Virtual function. Base class implementation returns an empty string.
1839  return wxEmptyString;
1840 }
const wxPoint & EDA_DRAW_FRAME::GetScrollCenterPosition ( ) const
inherited

Definition at line 1173 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseWheel(), EDA_DRAW_PANEL::OnPan(), EDA_DRAW_PANEL::OnScroll(), EDA_DRAW_FRAME::OnSelectZoom(), and EDA_DRAW_FRAME::SetPresetZoom().

1174 {
1175  BASE_SCREEN* screen = GetScreen(); // virtual call
1176  return screen->getScrollCenterPosition();
1177 }
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
const wxPoint & getScrollCenterPosition() const
Definition: base_screen.h:173
LIB_ALIAS * LIB_VIEW_FRAME::getSelectedAlias ( ) const
private

Definition at line 242 of file viewlib_frame.cpp.

References m_entryName, m_libraryName, and KIWAY_HOLDER::Prj().

Referenced by GetDocumentExtents(), getSelectedSymbol(), onUpdateDocButton(), onViewSymbolDocument(), SetShowElectricalType(), and updatePreviewSymbol().

243 {
244  LIB_ALIAS* alias = NULL;
245 
246  if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
247  {
248  alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
249  }
250 
251  return alias;
252 }
static wxString m_entryName
Part library alias object definition.
static wxString m_libraryName
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
LIB_PART * LIB_VIEW_FRAME::getSelectedSymbol ( ) const
private

Definition at line 255 of file viewlib_frame.cpp.

References LIB_ALIAS::GetPart(), and getSelectedAlias().

Referenced by onUpdateAltBodyStyleButton(), onUpdateNormalBodyStyleButton(), onUpdateUnitChoice(), and SetShowElectricalType().

256 {
257  LIB_PART* symbol = NULL;
258  LIB_ALIAS* alias = getSelectedAlias();
259 
260  if( alias )
261  symbol = alias->GetPart();
262 
263  return symbol;
264 }
Part library alias object definition.
Define a library symbol object.
LIB_PART * GetPart() const
Get the shared LIB_PART.
LIB_ALIAS * getSelectedAlias() const
bool EDA_DRAW_FRAME::GetShowAxis ( ) const
inlineinherited

Definition at line 951 of file draw_frame.h.

951 { return m_showAxis; }
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:133
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inlineinherited

Definition at line 379 of file draw_frame.h.

379 { return m_showBorderAndTitleBlock; }
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:143
bool LIB_VIEW_FRAME::GetShowElectricalType ( ) const
inline

Definition at line 146 of file viewlib_frame.h.

References m_showPinElectricalTypeName.

Referenced by OnUpdateElectricalType().

146 { return m_showPinElectricalTypeName; }
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
bool EDA_DRAW_FRAME::GetShowGridAxis ( ) const
inlineinherited

Definition at line 952 of file draw_frame.h.

952 { return m_showGridAxis; }
bool m_showGridAxis
True shows the grid axis indicators.
Definition: draw_frame.h:136
bool EDA_DRAW_FRAME::GetShowOriginAxis ( ) const
inlineinherited

Definition at line 953 of file draw_frame.h.

953 { return m_showOriginAxis; }
bool m_showOriginAxis
True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files.
Definition: draw_frame.h:140
const TEMPLATE_FIELDNAME* SCH_BASE_FRAME::GetTemplateFieldName ( const wxString &  aName) const
inlineinherited

Search for aName in the the template field name list.

Parameters
aNameA wxString object containing the field name to search for.
Returns
the template fieldname if found; NULL otherwise.

Definition at line 245 of file sch_base_frame.h.

References TEMPLATES::GetFieldName().

Referenced by FIELDS_GRID_TABLE< T >::GetAttr().

246  {
247  return m_templateFieldNames.GetFieldName( aName );
248  }
TEMPLATES m_templateFieldNames
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName) const
Function GetFieldName searches for aName in the the template field name list.
const TEMPLATE_FIELDNAMES& SCH_BASE_FRAME::GetTemplateFieldNames ( ) const
inlineinherited

Return a template field names list for read only access.

Definition at line 234 of file sch_base_frame.h.

References TEMPLATES::GetTemplateFieldNames().

Referenced by DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToWindow(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

235  {
237  }
TEMPLATES m_templateFieldNames
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames() const
Function GetTemplateFieldName returns a template fieldnames list for read only access.
const TITLE_BLOCK & SCH_BASE_FRAME::GetTitleBlock ( ) const
overridevirtualinherited

Implements EDA_DRAW_FRAME.

Definition at line 208 of file sch_base_frame.cpp.

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

Referenced by DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL(), DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetPS().

209 {
210  wxASSERT( GetScreen() );
211  return GetScreen()->GetTitleBlock();
212 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:136
wxAuiToolBarItem * EDA_DRAW_FRAME::GetToolbarTool ( int  aToolId)
inherited

Checks all the toolbars and returns a reference to the given tool id or nullptr if not found.

Definition at line 367 of file legacy_gal/eda_draw_frame.cpp.

References EDA_DRAW_FRAME::m_auxiliaryToolBar, EDA_DRAW_FRAME::m_drawToolBar, EDA_BASE_FRAME::m_mainToolBar, and EDA_DRAW_FRAME::m_optionsToolBar.

368 {
369  // Checks all the toolbars and returns a reference to the given tool id
370  // (or the first tool found, but only one or 0 tool is expected, because on
371  // Windows, when different tools have the same ID, it creates issues)
372  if( m_mainToolBar && m_mainToolBar->FindTool( aToolId ) )
373  return m_mainToolBar->FindTool( aToolId );
374 
375  if( m_optionsToolBar && m_optionsToolBar->FindTool( aToolId ) )
376  return m_optionsToolBar->FindTool( aToolId );
377 
378  if( m_drawToolBar && m_drawToolBar->FindTool( aToolId ) )
379  return m_drawToolBar->FindTool( aToolId );
380 
381  if( m_auxiliaryToolBar && m_auxiliaryToolBar->FindTool( aToolId ) )
382  return m_auxiliaryToolBar->FindTool( aToolId );
383 
384  return nullptr;
385 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
int EDA_DRAW_FRAME::GetToolId ( ) const
inlineinherited
Returns
the current tool ID when there is no active tool, the ID_NO_TOOL_SELECTED is returned (the id of the default Tool (idle tool) of the right vertical toolbar)

Definition at line 516 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::Begin_Zone(), LIB_EDIT_FRAME::CreateGraphicItem(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), LIB_EDIT_FRAME::EndDrawGraphicItem(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), GERBVIEW_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), PL_EDITOR_FRAME::HandleBlockPlace(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), GERBVIEW_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PCB_EDIT_FRAME::MuWaveCommand(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), LIB_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), PL_EDITOR_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection(), LIB_EDIT_FRAME::OnUpdateEditingPart(), PCB_EDIT_FRAME::OnUpdateMuWaveToolbar(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool(), PL_EDITOR_FRAME::OnUpdateSelectTool(), GERBVIEW_FRAME::OnUpdateSelectTool(), LIB_EDIT_FRAME::OnUpdateSelectTool(), SCH_EDIT_FRAME::OnUpdateSelectTool(), FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar(), PCB_EDIT_FRAME::OnUpdateVerticalToolbar(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_BASE_FRAME::SetToolID(), and PCB_EDIT_FRAME::SwitchLayer().

516 { return m_toolId; }
bool EDA_DRAW_FRAME::GetToolToggled ( int  aToolId)
inherited

Checks all the toolbars and returns true if the given tool id is toggled.

This is needed because GerbView and Pcbnew can put some of the same tools in different toolbars.

Definition at line 356 of file legacy_gal/eda_draw_frame.cpp.

References EDA_DRAW_FRAME::m_auxiliaryToolBar, EDA_DRAW_FRAME::m_drawToolBar, EDA_BASE_FRAME::m_mainToolBar, and EDA_DRAW_FRAME::m_optionsToolBar.

Referenced by ZOOM_TOOL::Main().

357 {
358  // Checks all the toolbars and returns true if the given tool id is toggled.
359  return ( ( m_mainToolBar && m_mainToolBar->GetToolToggled( aToolId ) ) ||
360  ( m_optionsToolBar && m_optionsToolBar->GetToolToggled( aToolId ) ) ||
361  ( m_drawToolBar && m_drawToolBar->GetToolToggled( aToolId ) ) ||
362  ( m_auxiliaryToolBar && m_auxiliaryToolBar->GetToolToggled( aToolId ) )
363  );
364 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:153
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:157
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
int LIB_VIEW_FRAME::GetUnit ( ) const
inline

Definition at line 143 of file viewlib_frame.h.

References m_unit.

Referenced by SCH_BASE_FRAME::SelectComponentFromLibBrowser().

143 { return m_unit; }
static int m_unit
EDA_UNITS_T EDA_DRAW_FRAME::GetUserUnits ( ) const
inlineoverrideinherited

Return the user units currently in use.

Definition at line 281 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::AddMenuZoomAndGrid(), PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs(), PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth(), PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize(), PCB_EDIT_FRAME::Create_MuWaveComponent(), MWAVE::CreateMicrowaveInductor(), PCB_EDIT_FRAME::createPopupMenuForTracks(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), GERBER_FILE_IMAGE::DisplayImageInfo(), MARKER_BASE::DisplayMarkerInfo(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), PCB_EDIT_FRAME::Edit_Gap(), EVT_GRID_CMD_CELL_CHANGED(), PANEL_MODEDIT_DEFAULTS::getGridValue(), PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue(), PANEL_SETUP_NETCLASSES::getNetclassValue(), GRID_MENU::GRID_MENU(), highlightNet(), GERBVIEW_FRAME::Liste_D_Codes(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), DRC::newMarker(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_WIZARD_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnRightClick(), PANEL_PREV_3D::PANEL_PREV_3D(), CVPCB_CONTROL::SwitchUnits(), GERBVIEW_CONTROL::SwitchUnits(), PCBNEW_CONTROL::SwitchUnits(), PCB_EDIT_FRAME::SyncMenusAndToolbars(), DRC::testDrilledHoles(), DRC::testUnconnected(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), PANEL_MODEDIT_SETTINGS::TransferDataToWindow(), PANEL_GERBVIEW_SETTINGS::TransferDataToWindow(), PANEL_PCBNEW_SETTINGS::TransferDataToWindow(), PANEL_SETUP_NETCLASSES::TransferDataToWindow(), UNIT_BINDER::UNIT_BINDER(), GRID_MENU::update(), GERBVIEW_FRAME::updateDCodeSelectBox(), GERBVIEW_FRAME::updateGridSelectBox(), PCB_BASE_FRAME::UpdateGridSelectBox(), DRC::updatePointers(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_EDIT_FRAME::UpdateTrackWidthSelectBox(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), PANEL_SETUP_TRACKS_AND_VIAS::validateData(), and PANEL_SETUP_NETCLASSES::validateData().

281 { return m_UserUnits; }
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
double EDA_DRAW_FRAME::GetZoom ( )
inherited
Returns
The current zoom level.

Definition at line 604 of file legacy_gal/eda_draw_frame.cpp.

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

Referenced by SCH_EDIT_FRAME::FindComponentAndItem(), SCH_EDIT_FRAME::OnFindDrcMarker(), EDA_DRAW_FRAME::OnSelectZoom(), SCH_EDIT_FRAME::updateFindReplaceView(), PCB_BASE_FRAME::updateZoomSelectBox(), and GERBVIEW_FRAME::updateZoomSelectBox().

605 {
606  return GetScreen()->GetZoom();
607 }
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
double EDA_DRAW_FRAME::GetZoomLevelCoeff ( ) const
inlineinherited

Return the coefficient to convert internal display scale factor to zoom level.

Definition at line 461 of file draw_frame.h.

Referenced by COMMON_TOOLS::doZoomToPreset(), EDA_DRAW_PANEL_GAL::GetLegacyZoom(), EDA_DRAW_FRAME::UseGalCanvas(), and ZOOM_MENU::ZOOM_MENU().

461 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:115
const wxString SCH_BASE_FRAME::GetZoomLevelIndicator ( ) const
overridevirtualinherited

Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs.

Virtual from the base class

Reimplemented from EDA_DRAW_FRAME.

Definition at line 169 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

170 {
172 }
virtual const wxString GetZoomLevelIndicator() const
Return a human readable value which can be displayed as zoom level indicator in dialogs.
bool SCH_BASE_FRAME::HandleBlockBegin ( wxDC *  aDC,
EDA_KEY  aKey,
const wxPoint &  aPosition,
int  aExplicitCommand = 0 
)
overrideprotectedvirtualinherited

Initialize a block command.

Parameters
aDCis the device context to perform the block command.
aKeyis the block command key press.
aPositionis the logical position of the start of the block command.
aExplicitCommand- if this is given, begin with this command, rather than looking up the command from aKey.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 497 of file sch_base_frame.cpp.

References BLOCK_COPY, BLOCK_DELETE, BLOCK_DRAG, BLOCK_DRAG_ITEM, BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, BLOCK_FLIP, BLOCK_IDLE, BLOCK_MIRROR_X, BLOCK_MIRROR_Y, BLOCK_MOVE, BLOCK_PASTE, BLOCK_PRESELECT_MOVE, BLOCK_ZOOM, EDA_DRAW_FRAME::BlockCommand(), EDA_DRAW_PANEL::CallMouseCapture(), BLOCK_SELECTOR::ClearItemsList(), DisplayError(), Format(), EDA_ITEM::GetBoundingBox(), SCH_BASE_FRAME::GetCanvas(), BLOCK_SELECTOR::GetCommand(), BLOCK_SELECTOR::GetCount(), BLOCK_SELECTOR::GetItem(), SCH_BASE_FRAME::GetScreen(), BLOCK_SELECTOR::GetState(), SCH_DRAW_PANEL::GetView(), i, EDA_DRAW_FRAME::InitBlockPasteInfos(), BLOCK_SELECTOR::InitData(), IS_MOVED, EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::Refresh(), BLOCK_SELECTOR::SetCommand(), BLOCK_SELECTOR::SetFlags(), BLOCK_SELECTOR::SetLastCursorPosition(), BLOCK_SELECTOR::SetMessageBlock(), EDA_DRAW_PANEL::SetMouseCaptureCallback(), EDA_RECT::SetOrigin(), EDA_RECT::SetSize(), BLOCK_SELECTOR::SetState(), KIGFX::SCH_VIEW::ShowSelectionArea(), STATE_BLOCK_MOVE, and STATE_NO_BLOCK.

Referenced by SCH_EDIT_FRAME::OnDragItem(), LIB_EDIT_FRAME::Process_Special_Functions(), and SCH_EDIT_FRAME::Process_Special_Functions().

499 {
501 
502  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
503  return false;
504 
505  if( aExplicitCommand == 0 )
506  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
507  else
508  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
509 
510  if( block->GetCommand() == 0 )
511  return false;
512 
513  switch( block->GetCommand() )
514  {
515  case BLOCK_IDLE:
516  break;
517 
518  case BLOCK_MOVE: // Move
519  case BLOCK_DRAG: // Drag (block defined)
520  case BLOCK_DRAG_ITEM: // Drag from a drag item command
521  case BLOCK_DUPLICATE: // Duplicate
522  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
523  case BLOCK_DELETE: // Delete
524  case BLOCK_COPY: // Copy
525  case BLOCK_FLIP: // Flip
526  case BLOCK_ZOOM: // Window Zoom
527  case BLOCK_MIRROR_X:
528  case BLOCK_MIRROR_Y: // mirror
529  case BLOCK_PRESELECT_MOVE: // Move with preselection list
530  block->InitData( m_canvas, aPosition );
532  break;
533 
534  case BLOCK_PASTE:
535  {
536  block->InitData( m_canvas, aPosition );
538 
539  wxRect bounds( 0, 0, 0, 0 );
540 
541  for( unsigned i = 0; i < block->GetCount(); ++i )
542  bounds.Union( block->GetItem( i )->GetBoundingBox() );
543 
544  block->SetOrigin( bounds.GetPosition() );
545  block->SetSize( bounds.GetSize() );
546  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
547 
548  if( block->GetCount() == 0 ) // No data to paste
549  {
550  DisplayError( this, _( "Nothing to paste" ), 20 );
553  block->SetState( STATE_NO_BLOCK );
554  block->SetMessageBlock( this );
555  return true;
556  }
557 
558  if( !m_canvas->IsMouseCaptured() )
559  {
560  block->ClearItemsList();
561  wxFAIL_MSG( "SCH_BASE_FRAME::HandleBlockBegin() error: m_mouseCaptureCallback NULL" );
562  block->SetState( STATE_NO_BLOCK );
563  block->SetMessageBlock( this );
564  return true;
565  }
566 
567  block->SetState( STATE_BLOCK_MOVE );
568  block->SetFlags( IS_MOVED );
569  m_canvas->CallMouseCapture( aDC, aPosition, false );
570  m_canvas->Refresh();
571  }
572  break;
573 
574  default:
575  wxFAIL_MSG( wxString::Format( "SCH_BASE_FRAME::HandleBlockBegin() unknown command: %s",
576  block->GetCommand() ) );
577  break;
578  }
579 
580  block->SetMessageBlock( this );
581  return true;
582 }
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
virtual int BlockCommand(EDA_KEY aKey)
Return the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the keys pressed (ALT...
void SetMessageBlock(EDA_DRAW_FRAME *frame)
Function SetMessageBlock Displays the type of block command in the status bar of the window...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void ShowSelectionArea(bool aShow=true)
Definition: sch_view.cpp:159
BLOCK_COMMAND_T
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:124
EDA_ITEM * GetItem(unsigned aIndex)
virtual void InitBlockPasteInfos()
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
void SetState(BLOCK_STATE_T aState)
SCH_DRAW_PANEL * GetCanvas() const override
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void SetFlags(const STATUS_FLAGS aFlag)
Function SetFlags sets a status flag on each item in a block selector.
KIGFX::SCH_VIEW * GetView() const
Definition: solve.cpp:178
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void SetSize(const wxSize &size)
Definition: eda_rect.h:126
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
BLOCK_STATE_T GetState() const
size_t i
Definition: json11.cpp:597
BLOCK_COMMAND_T GetCommand() const
void InitData(EDA_DRAW_PANEL *Panel, const wxPoint &startpos)
Function InitData sets the initial values of a BLOCK_SELECTOR, before starting a block command...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
unsigned GetCount() const
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void SetCommand(BLOCK_COMMAND_T aCommand)
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113
bool EDA_DRAW_FRAME::HandleBlockEnd ( wxDC *  DC)
virtualinherited

Handle the "end" of a block command, i.e.

is called at the end of the definition of the area of a block. depending on the current block command, this command is executed or parameters are initialized to prepare a call to HandleBlockPlace in GetScreen()->m_BlockLocate

Returns
false if no item selected, or command finished, true if some items found and HandleBlockPlace must be called later

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, FOOTPRINT_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 778 of file legacy_gal/eda_draw_frame.cpp.

Referenced by AbortBlockCurrentCommand(), InvokeDialogImportGfxBoard(), InvokeDialogImportGfxModule(), and EDA_DRAW_PANEL::OnMouseEvent().

779 {
780  return false;
781 }
void EDA_DRAW_FRAME::HandleBlockPlace ( wxDC *  DC)
virtualinherited

Called after HandleBlockEnd, when a block command needs to be executed after the block is moved to its new place (bloc move, drag, copy .

. ) Parameters must be initialized in GetScreen()->m_BlockLocate

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, FOOTPRINT_EDIT_FRAME, and PL_EDITOR_FRAME.

Definition at line 773 of file legacy_gal/eda_draw_frame.cpp.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

774 {
775 }
void SCH_BASE_FRAME::HardRedraw ( )
overridevirtualinherited

Rebuild the GAL and redraws the screen.

Call when something went wrong.

Reimplemented from EDA_DRAW_FRAME.

Reimplemented in LIB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 477 of file sch_base_frame.cpp.

References SCH_BASE_FRAME::GetCanvas(), and SCH_DRAW_PANEL::Refresh().

478 {
479  // Currently: just refresh the screen
480  GetCanvas()->Refresh();
481 }
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
SCH_DRAW_PANEL * GetCanvas() const override
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 375 of file eda_base_frame.cpp.

References KIFACE_I::GetHelpFileName(), and Kiface().

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

376 {
377  return Kiface().GetHelpFileName();
378 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:121
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ImportHotkeyConfigFromFile 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 709 of file hotkeys_basic.cpp.

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

Referenced by PANEL_HOTKEYS_EDITOR::installButtons(), and EDA_BASE_FRAME::SaveProjectSettings().

711 {
712  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
713  wxString mask = wxT( "*." ) + ext;
714 
715 
716  wxString path = GetMruPath();
717  wxFileName fn( aDefaultShortname );
718  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
719 
720  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
721  path,
722  fn.GetFullPath(),
723  ext,
724  mask,
725  this,
726  wxFD_OPEN,
727  true );
728 
729  if( filename.IsEmpty() )
730  return;
731 
732  ::ReadHotkeyConfigFile( filename, aDescList, false );
733  WriteHotkeyConfig( aDescList );
734  SetMruPath( wxFileName( filename ).GetPath() );
735 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList, const bool aDefaultLocation)
Function ReadHotkeyConfig Read hotkey configuration for a given app, possibly before the frame for th...
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
void EDA_DRAW_FRAME::InitBlockPasteInfos ( )
virtualinherited

Reimplemented in SCH_EDIT_FRAME, and LIB_EDIT_FRAME.

Definition at line 766 of file legacy_gal/eda_draw_frame.cpp.

References BLOCK_SELECTOR::ClearItemsList(), EDA_DRAW_FRAME::GetScreen(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, and EDA_DRAW_PANEL::SetMouseCaptureCallback().

Referenced by SCH_BASE_FRAME::HandleBlockBegin(), and EDA_DRAW_FRAME::HandleBlockBegin().

767 {
770 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
virtual void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
virtual void EDA_BASE_FRAME::InstallPreferences ( PAGED_DIALOG aParent)
inlinevirtualinherited

Function InstallPreferences allows a Frame to load its preference panels (if any) into the preferences dialog.

Parameters
aParenta paged dialog into which the preference panels should be installed

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, LIB_EDIT_FRAME, GERBVIEW_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 238 of file eda_base_frame.h.

References EDA_BASE_FRAME::LoadSettings(), and EDA_BASE_FRAME::SaveSettings().

Referenced by EDA_BASE_FRAME::ShowPreferences().

238 { }
virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Function autoSaveRequired returns the auto save status of the application.

Override this function if your derived frame supports automatic file saving.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 173 of file eda_base_frame.h.

References EDA_BASE_FRAME::config(), EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::EDA_BASE_FRAME(), EDA_BASE_FRAME::help_name(), EDA_BASE_FRAME::ProcessEvent(), EDA_BASE_FRAME::SetAutoSaveInterval(), EDA_BASE_FRAME::sys_search(), and EDA_BASE_FRAME::~EDA_BASE_FRAME().

Referenced by EDA_BASE_FRAME::ProcessEvent().

173 { return false; }
bool EDA_DRAW_FRAME::isBusy ( ) const
protectedinherited
Returns
true if an item edit or a block operation is in progress.

Definition at line 1315 of file legacy_gal/eda_draw_frame.cpp.

References BASE_SCREEN::GetCurItem(), EDA_ITEM::GetFlags(), EDA_DRAW_FRAME::GetScreen(), BLOCK_SELECTOR::GetState(), BASE_SCREEN::m_BlockLocate, and STATE_NO_BLOCK.

Referenced by SCH_EDIT_FRAME::GetSchematicFromRedoList(), and SCH_EDIT_FRAME::GetSchematicFromUndoList().

1316 {
1317  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1318 
1319  if( !screen )
1320  return false;
1321 
1322  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1323  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1324 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
BLOCK_STATE_T GetState() const
bool KIWAY_PLAYER::IsDismissed ( )
protectedinherited

Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal().

IOW, it will return true if the dialog is not modal or if it is modal and has been dismissed.

Definition at line 156 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop.

Referenced by OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

157 {
158  return !m_modal_loop;
159 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:250
bool EDA_DRAW_FRAME::IsGalCanvasActive ( ) const
inlineinherited

Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.

Returns
True for GAL-based canvas, false for standard canvas.

Definition at line 918 of file draw_frame.h.

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), PCB_EDIT_FRAME::AppendBoardFile(), GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_EDIT_FRAME::Check_All_Zones(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), findDialog(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), FOOTPRINT_EDIT_FRAME::Import_Module(), DIALOG_PAD_PROPERTIES::OnCancel(), DIALOG_PAD_PROPERTIES::onChangePadMode(), STATUS_POPUP::onCharHook(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), PCB_BASE_FRAME::OnModify(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), EDA_DRAW_FRAME::OnSelectZoom(), EDA_DRAW_FRAME::OnToggleGridState(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), GERBVIEW_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateOptToolbar(), DIALOG_PAD_PROPERTIES::redraw(), Refresh(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), EDA_DRAW_FRAME::SetToolID(), DIALOG_SET_GRID::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_WIZARD_FRAME::updateView(), EDA_DRAW_FRAME::Zoom_Automatique(), and FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME().

918 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:97
bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited
bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

Function IsWritable checks if aFileName can be written.

The function performs a number of tests on aFileName to verify that it can be saved. If aFileName defines a path with no file name, them the path is tested for user write permission. If aFileName defines a file name that does not exist in the path, the path is tested for user write permission. If aFileName defines a file that already exits, the file name is tested for user write permissions.

Note
The file name path must be set or an assertion will be raised on debug builds and return false on release builds.
Parameters
aFileNameThe full path and/or file name of the file to test.
Returns
False if aFileName cannot be written.

Definition at line 541 of file eda_base_frame.cpp.

References GetChars().

Referenced by SCH_EDIT_FRAME::doAutoSave(), EDA_BASE_FRAME::GetMruPath(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), CVPCB_MAINFRAME::SaveProjectFile(), and SCH_EDIT_FRAME::SaveProjectSettings().

542 {
543  wxString msg;
544  wxFileName fn = aFileName;
545 
546  // Check for absence of a file path with a file name. Unfortunately KiCad
547  // uses paths relative to the current project path without the ./ part which
548  // confuses wxFileName. Making the file name path absolute may be less than
549  // elegant but it solves the problem.
550  if( fn.GetPath().IsEmpty() && fn.HasName() )
551  fn.MakeAbsolute();
552 
553  wxCHECK_MSG( fn.IsOk(), false,
554  wxT( "File name object is invalid. Bad programmer!" ) );
555  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
556  wxT( "File name object path <" ) + fn.GetFullPath() +
557  wxT( "> is not set. Bad programmer!" ) );
558 
559  if( fn.IsDir() && !fn.IsDirWritable() )
560  {
561  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
562  GetChars( fn.GetPath() ) );
563  }
564  else if( !fn.FileExists() && !fn.IsDirWritable() )
565  {
566  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
567  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
568  }
569  else if( fn.FileExists() && !fn.IsFileWritable() )
570  {
571  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
572  GetChars( fn.GetFullPath() ) );
573  }
574 
575  if( !msg.IsEmpty() )
576  {
577  wxMessageBox( msg );
578  return false;
579  }
580 
581  return true;
582 }
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
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::GetUserUnits(), KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), and VTBL_ENTRY.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 177 of file kiway_player.cpp.

References KIWAY_PLAYER::KiwayMailIn().

178 {
179  // logging support
180  KiwayMailIn( aEvent ); // call the virtual, override in derived.
181 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
void KIWAY_PLAYER::KiwayMailIn ( KIWAY_EXPRESS aEvent)
virtualinherited

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

Reimplemented in LIB_EDIT_FRAME, FOOTPRINT_EDIT_FRAME, SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 71 of file kiway_player.cpp.

Referenced by KIWAY_PLAYER::kiway_express(), and KIWAY::ProcessEvent().

72 {
73  // override this in derived classes.
74 }
void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

Function language_change is an event handler called on a language menu selection.

Definition at line 184 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::SetLanguage().

185 {
186  int id = event.GetId();
187 
188  // tell all the KIWAY_PLAYERs about the language change.
189  Kiway().SetLanguage( id );
190 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs...
Definition: kiway.cpp:395
bool EDA_DRAW_FRAME::LibraryFileBrowser ( bool  doOpen,
wxFileName &  aFilename,
const wxString &  wildcard,
const wxString &  ext,
bool  isDirectory 
)
protectedinherited
Parameters
doOpenif true runs an Open Library browser, otherwise New Library
aFilenamefor New may contain a default name; in both cases return the chosen filename.
wildcarda wildcard to filter the displayed files
extthe library file extension
isDirectoryindicates the library files are directories
Returns
true for OK; false for Cancel.

Definition at line 1842 of file legacy_gal/eda_draw_frame.cpp.

References KIWAY_HOLDER::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_EDIT_FRAME::addLibraryFile(), and PCB_BASE_EDIT_FRAME::CreateNewLibrary().

1845 {
1846  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
1847  aFilename.SetExt( ext );
1848 
1849  if( isDirectory )
1850  {
1851  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
1852  doOpen ? wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST : wxDD_DEFAULT_STYLE );
1853 
1854  if( dlg.ShowModal() == wxID_CANCEL )
1855  return false;
1856 
1857  aFilename = dlg.GetPath();
1858  aFilename.SetExt( ext );
1859  }
1860  else
1861  {
1862  wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
1863  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
1864  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
1865 
1866  if( dlg.ShowModal() == wxID_CANCEL )
1867  return false;
1868 
1869  aFilename = dlg.GetPath();
1870  aFilename.SetExt( ext );
1871  }
1872 
1873  return true;
1874 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting ( )
staticinherited

Returns the canvas type stored in the application settings.

Definition at line 1069 of file legacy_gal/eda_draw_frame.cpp.

References EDA_DRAW_FRAME::CANVAS_TYPE_KEY, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, ADVANCED_CFG::GetCfg(), Kiface(), and KIFACE_I::KifaceSettings().

Referenced by SCH_BASE_FRAME::createCanvas(), PCB::IFACE::CreateWindow(), and GERBVIEW_FRAME::GERBVIEW_FRAME().

1070 {
1072  wxConfigBase* cfg = Kiface().KifaceSettings();
1073 
1074  if( cfg )
1075  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1077 
1078  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1079  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1080  {
1081  wxASSERT( false );
1082  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1083  }
1084 
1085  // Coerce the value into a GAL type when Legacy is not available
1086  // Default to Cairo, and on the first, user will be prompted for OpenGL
1087  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1088  && !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
1089  {
1091  }
1092 
1093  return canvasType;
1094 }
Sentinel, do not use as a parameter.
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:234
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
static const ADVANCED_CFG & GetCfg()
Get the singleton instance&#39;s config, which is shared by all consumers of advanced config...
void LIB_VIEW_FRAME::LoadSettings ( wxConfigBase *  aCfg)
overridevirtual

Function LoadSettings loads common frame parameters from a configuration file.

Don't forget to call the base method or your frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Definition at line 685 of file viewlib_frame.cpp.

References CMPLIST_WIDTH_KEY, CMPVIEW_SHOW_PINELECTRICALTYPE_KEY, GAL_DISPLAY_OPTIONS_KEY, EDA_DRAW_FRAME::GetGalDisplayOptions(), GridColorEntryKeyword(), LIB_EDIT_FRAME_NAME, LIBLIST_WIDTH_KEY, EDA_DRAW_FRAME::LoadSettings(), m_cmpListWidth, EDA_BASE_FRAME::m_FrameSize, m_libListWidth, m_showPinElectricalTypeName, KIGFX::GAL_DISPLAY_OPTIONS::ReadConfig(), EDA_DRAW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetGridVisibility(), and ShowGridEntryKeyword().

686 {
688 
689  // Fetch grid settings from Symbol Editor
690  wxString symbolEditor = LIB_EDIT_FRAME_NAME;
691  bool btmp;
692  COLOR4D wtmp;
693 
694  if( aCfg->Read( symbolEditor + ShowGridEntryKeyword, &btmp ) )
695  SetGridVisibility( btmp );
696 
697  if( wtmp.SetFromWxString( aCfg->Read( symbolEditor + GridColorEntryKeyword, wxT( "NONE" ) ) ) )
698  SetGridColor( wtmp );
699 
700  // Grid shape, etc.
701  GetGalDisplayOptions().ReadConfig( aCfg, symbolEditor + GAL_DISPLAY_OPTIONS_KEY );
702 
703  aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
704  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
705  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
707 
708  // Set parameters to a reasonable value.
709  if( m_libListWidth > m_FrameSize.x/2 )
711 
712  if( m_cmpListWidth > m_FrameSize.x/2 )
714 }
#define LIB_EDIT_FRAME_NAME
Definition: draw_frame.h:49
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
Definition: draw_frame.h:943
virtual void SetGridColor(COLOR4D aColor)
Definition: draw_frame.h:550
#define LIBLIST_WIDTH_KEY
#define GAL_DISPLAY_OPTIONS_KEY
Definition: pgm_base.h:53
void ReadConfig(wxConfigBase *aCfg, const wxString &aBaseName)
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
static const wxString ShowGridEntryKeyword(wxT("ShowGrid"))
Nonzero to show grid (suffix)
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
#define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY
virtual void SetGridVisibility(bool aVisible)
It may be overloaded by derived classes.
Definition: draw_frame.h:534
static const wxString GridColorEntryKeyword(wxT("GridColor"))
Grid color ID (suffix)
#define CMPLIST_WIDTH_KEY
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool EDA_DRAW_FRAME::LockFile ( const wxString &  aFileName)
inherited

Mark a schematic file as being in use.

Use ReleaseFile() to undo this.

Parameters
aFileName= full path to the file.
Returns
false if the file was already locked, true otherwise.

Definition at line 261 of file legacy_gal/eda_draw_frame.cpp.

References EDA_DRAW_FRAME::m_file_checker.

Referenced by SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::SaveEEFile().

262 {
263  m_file_checker = ::LockFile( aFileName );
264 
265  return bool( m_file_checker );
266 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:103
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
void LIB_VIEW_FRAME::OnActivate ( wxActivateEvent &  event)
overrideprivatevirtual

Called when the frame is activated to reload the libraries and component lists that can be changed by the schematic editor or the library editor.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 734 of file viewlib_frame.cpp.

References DisplayLibInfos(), m_libList, m_selection_changed, EDA_DRAW_FRAME::OnActivate(), ReCreateListLib(), and updatePreviewSymbol().

Referenced by SetShowElectricalType().

735 {
737 
738  bool changed = m_libList ? ReCreateListLib() : false;
739 
740  if (changed)
741  m_selection_changed = true;
742 
744 
745  DisplayLibInfos();
746 }
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the component selection changing...
void DisplayLibInfos()
Definition: viewlibs.cpp:176
void updatePreviewSymbol()
wxListBox * m_libList
bool ReCreateListLib()
Creates or recreates a sorted list of currently loaded libraries.
virtual void OnActivate(wxActivateEvent &event)
Called when activating the frame.
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 216 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::m_autoSaveInterval, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

217 {
218  if( !doAutoSave() )
219  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
220 }
virtual bool doAutoSave()
Function doAutoSave should be overridden by the derived class to handle the auto save feature...
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
int m_autoSaveInterval
The auto save interval time in seconds.
void EDA_DRAW_FRAME::OnCharHook ( wxKeyEvent &  event)
virtualinherited

Capture the key event before it is sent to the GUI.

the basic frame does not capture this event. editor frames should override this event function to capture and filter these keys when they are used as hotkeys, and skip it if the key is not used as hotkey (otherwise the key events will be not sent to menus)

Definition at line 246 of file legacy_gal/eda_draw_frame.cpp.

References dump(), and kicadTraceKeyEvent.

247 {
248  wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_FRAME::OnCharHook %s", dump( event ) );
249  // Key events can be filtered here.
250  // Currently no filtering is made.
251  event.Skip();
252 }
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
void LIB_VIEW_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 323 of file viewlib_frame.cpp.

References KIWAY_PLAYER::Destroy(), KIWAY_PLAYER::DismissModal(), SCH_BASE_FRAME::GetCanvas(), KIWAY_PLAYER::IsDismissed(), KIWAY_PLAYER::IsModal(), and EDA_DRAW_PANEL_GAL::StopDrawing().

324 {
325  GetCanvas()->StopDrawing();
326 
327  if( !IsModal() )
328  {
329  Destroy();
330  }
331  else if( !IsDismissed() )
332  {
333  // only dismiss modal frame if not already dismissed.
334  DismissModal( false );
335 
336  // Modal frame will be destroyed by the calling function.
337  }
338 }
bool IsDismissed()
Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been...
SCH_DRAW_PANEL * GetCanvas() const override
bool IsModal()
Definition: kiway_player.h:226
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void SCH_BASE_FRAME::OnConfigurePaths ( wxCommandEvent &  aEvent)
inherited

Definition at line 293 of file sch_base_frame.cpp.

Referenced by add_search_paths(), and EVT_UPDATE_UI_RANGE().

294 {
295  DIALOG_CONFIGURE_PATHS dlg( this, nullptr );
296  dlg.ShowModal();
297 }
void SCH_BASE_FRAME::OnEditSymbolLibTable ( wxCommandEvent &  aEvent)
virtualinherited

Reimplemented in LIB_EDIT_FRAME.

Definition at line 300 of file sch_base_frame.cpp.

References InvokeSchEditSymbolLibTable(), and KIWAY_HOLDER::Kiway().

Referenced by EVT_UPDATE_UI_RANGE(), LIB_EDIT_FRAME::OnEditSymbolLibTable(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

301 {
303 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
void EDA_DRAW_FRAME::OnEraseBackground ( wxEraseEvent &  SizeEvent)
inherited
void SCH_BASE_FRAME::OnGridSettings ( wxCommandEvent &  aEvent)
overridevirtualinherited

Reimplemented from EDA_DRAW_FRAME.

Definition at line 86 of file eeschema/dialogs/dialog_set_grid.cpp.

Referenced by add_search_paths().

87 {
88  DIALOG_SET_GRID dlg( this );
89 
90  dlg.ShowModal();
91 }
bool LIB_VIEW_FRAME::OnHotKey ( wxDC *  aDC,
int  aHotKey,
const wxPoint &  aPosition,
EDA_ITEM aItem 
)
overridevirtual

Handle hot key events.

Some commands are relative to the item under the mouse cursor. Commands are case insensitive

Reimplemented from EDA_DRAW_FRAME.

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

References DisplayHotkeyList(), EDA_DRAW_FRAME::GetCrossHairPosition(), GetDescriptorFromHotkey(), SCH_EDIT_FRAME::GetScreen(), HK_HELP, HK_LEFT_CLICK, HK_LEFT_DCLICK, HK_NOT_FOUND, HK_RESET_LOCAL_COORD, HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, ID_KEY_ZOOM_IN, ID_KEY_ZOOM_OUT, ID_POPUP_ZOOM_CENTER, ID_ZOOM_PAGE, ID_ZOOM_REDRAW, EDA_HOTKEY::m_Idcommand, BASE_SCREEN::m_O_Curseur, SCH_EDIT_FRAME::OnLeftClick(), and SCH_EDIT_FRAME::OnLeftDClick().

893 {
894  if( aHotKey == 0 )
895  return false;
896 
897  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
898  cmd.SetEventObject( this );
899 
900  /* Convert lower to upper case (the usual toupper function has problem with non ascii
901  * codes like function keys */
902  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
903  aHotKey += 'A' - 'a';
904 
906 
907  if( HK_Descr == NULL )
908  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
909 
910  if( HK_Descr == NULL )
911  return false;
912 
913  switch( HK_Descr->m_Idcommand )
914  {
915  default:
916  case HK_NOT_FOUND:
917  return false;
918 
919  case HK_HELP: // Display Current hotkey list
921  break;
922 
923  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
925  break;
926 
927  case HK_LEFT_CLICK:
928  OnLeftClick( aDC, aPosition );
929  break;
930 
931  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
932  OnLeftClick( aDC, aPosition );
933  OnLeftDClick( aDC, aPosition );
934  break;
935 
936  case HK_ZOOM_IN:
937  cmd.SetId( ID_KEY_ZOOM_IN );
938  GetEventHandler()->ProcessEvent( cmd );
939  break;
940 
941  case HK_ZOOM_OUT:
942  cmd.SetId( ID_KEY_ZOOM_OUT );
943  GetEventHandler()->ProcessEvent( cmd );
944  break;
945 
946  case HK_ZOOM_REDRAW:
947  cmd.SetId( ID_ZOOM_REDRAW );
948  GetEventHandler()->ProcessEvent( cmd );
949  break;
950 
951  case HK_ZOOM_CENTER:
952  cmd.SetId( ID_POPUP_ZOOM_CENTER );
953  GetEventHandler()->ProcessEvent( cmd );
954  break;
955 
956  case HK_ZOOM_AUTO:
957  cmd.SetId( ID_ZOOM_PAGE );
958  GetEventHandler()->ProcessEvent( cmd );
959  break;
960  }
961 
962  return true;
963 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
Definition: viewlibs.cpp:165
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
EDA_HOTKEY * GetDescriptorFromHotkey(int aKey, EDA_HOTKEY **aList)
Function GetDescriptorFromHotkey Return a EDA_HOTKEY * pointer from a key code for OnHotKey() functio...
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
static EDA_HOTKEY * common_basic_Hotkey_List[]
static EDA_HOTKEY * viewlib_Hotkey_List[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void LIB_VIEW_FRAME::OnLeftClick ( wxDC *  DC,
const wxPoint &  MousePos 
)
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 165 of file viewlibs.cpp.

166 {
167 }
void EDA_DRAW_FRAME::OnLeftDClick ( wxDC *  DC,
const wxPoint &  MousePos 
)
virtualinherited
void EDA_DRAW_FRAME::OnMenuOpen ( wxMenuEvent &  event)
inherited

Definition at line 327 of file legacy_gal/eda_draw_frame.cpp.

References EDA_DRAW_FRAME::m_canvas, and EDA_DRAW_PANEL::SetCanStartBlock().

328 {
329  if( m_canvas )
330  m_canvas->SetCanStartBlock( -1 );
331 
332  event.Skip();
333 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void EDA_DRAW_FRAME::OnMouseEvent ( wxMouseEvent &  event)
inherited

Definition at line 610 of file legacy_gal/eda_draw_frame.cpp.

611 {
612  event.Skip();
613 }
void SCH_BASE_FRAME::OnOpenLibraryViewer ( wxCommandEvent &  event)
protectedinherited

Open the library viewer only to browse library contents.

If the viewed is already opened from this, raise the viewer If the viewed is already opened from another window, close it and reopen

Definition at line 148 of file sch_base_frame.cpp.

References FRAME_SCH_VIEWER, KIWAY_HOLDER::Kiway(), EDA_DRAW_FRAME::m_canvas, KIWAY::Player(), and EDA_DRAW_FRAME::PushPreferences().

Referenced by add_search_paths().

149 {
150  LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true );
151 
152  viewlibFrame->PushPreferences( m_canvas );
153 
154  // On Windows, Raise() does not bring the window on screen, when iconized
155  if( viewlibFrame->IsIconized() )
156  viewlibFrame->Iconize( false );
157 
158  viewlibFrame->Show( true );
159  viewlibFrame->Raise();
160 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Push preferences from a parent window to a child window.
Symbol library viewer main window.
Definition: viewlib_frame.h:44
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
virtual void EDA_DRAW_FRAME::OnPageSettingsChange ( )
inlinevirtualinherited

Called when modifying the page settings.

In derived classes it can be used to modify parameters like draw area size, and any other local parameter related to the page settings.

Reimplemented in SCH_EDIT_FRAME.

Definition at line 754 of file draw_frame.h.

References color, and EDA_DRAW_PANEL::OnActivate().

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

754 {};
bool LIB_VIEW_FRAME::OnRightClick ( const wxPoint &  MousePos,
wxMenu *  PopMenu 
)
overrideprivatevirtual

Implements EDA_DRAW_FRAME.

Definition at line 170 of file viewlibs.cpp.

Referenced by SetShowElectricalType().

171 {
172  return true;
173 }
void EDA_DRAW_FRAME::OnSelectGrid ( wxCommandEvent &  event)
virtualinherited

Command event handler for selecting grid sizes.

All commands that set the grid size should eventually end up here. This is where the application setting is saved. If you override this method, make sure you call down to the base class.

Parameters
event- Command event passed by selecting grid size from the grid size combobox on the toolbar.

Definition at line 518 of file legacy_gal/eda_draw_frame.cpp.

References dummy(), ID_POPUP_GRID_LEVEL_100, ID_POPUP_GRID_LEVEL_1000, EDA_DRAW_FRAME::m_gridSelectBox, EDA_DRAW_FRAME::OnGridSettings(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), and EDA_DRAW_FRAME::SetPresetGrid().

Referenced by PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), PCB_BASE_FRAME::SetNextGrid(), and PCB_BASE_FRAME::SetPrevGrid().

519 {
520  int* clientData;
521  int eventId = ID_POPUP_GRID_LEVEL_100;
522 
523  if( event.GetEventType() == wxEVT_COMBOBOX )
524  {
525  if( m_gridSelectBox == NULL ) // Should not happen
526  return;
527 
528  /*
529  * Don't use wxCommandEvent::GetClientData() here. It always
530  * returns NULL in GTK. This solution is not as elegant but
531  * it works.
532  */
533  int index = m_gridSelectBox->GetSelection();
534  wxASSERT( index != wxNOT_FOUND );
535 
536  if( index == int( m_gridSelectBox->GetCount() - 2 ) )
537  {
538  // this is the separator
539  wxUpdateUIEvent dummy;
540  OnUpdateSelectGrid( dummy );
541  return;
542  }
543  else if( index == int( m_gridSelectBox->GetCount() - 1 ) )
544  {
545  wxUpdateUIEvent dummy;
546  OnUpdateSelectGrid( dummy );
547  wxCommandEvent dummy2;
548  OnGridSettings( dummy2 );
549  return;
550  }
551 
552  clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
553 
554  if( clientData != NULL )
555  eventId = *clientData;
556  }
557  else
558  {
559  eventId = event.GetId();
560  }
561 
562  int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
563 
564  SetPresetGrid( idx );
565 }
virtual void OnGridSettings(wxCommandEvent &event)
Definition: draw_frame.h:594
wxComboBox * m_gridSelectBox
Definition: draw_frame.h:148
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
void SetPresetGrid(int aIndex)
Change the grid size to one of the preset values.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
void LIB_VIEW_FRAME::onSelectNextSymbol ( wxCommandEvent &  aEvent)
private

Definition at line 83 of file viewlibs.cpp.

References ID_LIBVIEW_CMP_LIST, m_cmpList, and EDA_BASE_FRAME::ProcessEvent().

Referenced by SetShowElectricalType().

84 {
85  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
86  int ii = m_cmpList->GetSelection();
87 
88  // Select the next symbol or stop at the end of the list.
89  if( ii != wxNOT_FOUND || ii != (int)m_cmpList->GetCount() - 1 )
90  ii += 1;
91 
92  m_cmpList->SetSelection( ii );
93  ProcessEvent( evt );
94 }
wxListBox * m_cmpList
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
void LIB_VIEW_FRAME::onSelectPreviousSymbol ( wxCommandEvent &  aEvent)
private

Definition at line 97 of file viewlibs.cpp.

References ID_LIBVIEW_CMP_LIST, m_cmpList, and EDA_BASE_FRAME::ProcessEvent().

Referenced by SetShowElectricalType().

98 {
99  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
100  int ii = m_cmpList->GetSelection();
101 
102  // Select the previous symbol or stop at the beginning of list.
103  if( ii != wxNOT_FOUND && ii != 0 )
104  ii -= 1;
105 
106  m_cmpList->SetSelection( ii );
107  ProcessEvent( evt );
108 }
wxListBox * m_cmpList
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
void LIB_VIEW_FRAME::OnSelectSymbol ( wxCommandEvent &  aEvent)

Definition at line 45 of file viewlibs.cpp.

References SYMBOL_TREE_MODEL_ADAPTER::Create(), DIALOG_CHOOSE_COMPONENT::g_Mutex, LIB_TABLE::GetLogicalLibs(), DIALOG_CHOOSE_COMPONENT::GetSelectedLibId(), m_convert, KIWAY_HOLDER::Prj(), SetSelectedComponent(), SetSelectedLibrary(), SetUnitAndConvert(), and DIALOG_SHIM::ShowQuasiModal().

46 {
47  std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock );
48 
49  // One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway.
50  if( !dialogLock.try_lock() )
51  return;
52 
53  // Container doing search-as-you-type.
54  SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
55  auto adapterPtr( SYMBOL_TREE_MODEL_ADAPTER::Create( libs ) );
56  auto adapter = static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( adapterPtr.get() );
57 
58  const auto libNicknames = libs->GetLogicalLibs();
59  adapter->AddLibraries( libNicknames, this );
60 
61  LIB_ID id;
62  int unit;
63 
64  wxString dialogTitle;
65  dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
66 
67  DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapterPtr, m_convert, false, false, false );
68 
69  if( dlg.ShowQuasiModal() == wxID_CANCEL )
70  return;
71 
72  id = dlg.GetSelectedLibId( &unit );
73 
74  if( !id.IsValid() )
75  return;
76 
77  SetSelectedLibrary( id.GetLibNickname() );
78  SetSelectedComponent( id.GetLibItemName() );
79  SetUnitAndConvert( unit, 1 );
80 }
static int m_convert
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1...
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SetSelectedComponent(const wxString &aComponentName)
Set the selected component.
Dialog class to select a component from the libraries.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
static PTR Create(LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE...
void SetSelectedLibrary(const wxString &aLibName)
Set the selected library in the library window.
void LIB_VIEW_FRAME::onSelectSymbolBodyStyle ( wxCommandEvent &  aEvent)
private

Definition at line 132 of file viewlibs.cpp.

References ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, m_convert, and updatePreviewSymbol().

Referenced by SetShowElectricalType().

133 {
134  int id = aEvent.GetId();
135 
136  switch( id )
137  {
138  default:
140  m_convert = 1;
141  break;
142 
144  m_convert = 2;
145  break;
146  }
147 
149 }
static int m_convert
void updatePreviewSymbol()
void LIB_VIEW_FRAME::onSelectSymbolUnit ( wxCommandEvent &  aEvent)
private

Definition at line 152 of file viewlibs.cpp.

References m_unit, m_unitChoice, and updatePreviewSymbol().

Referenced by SetShowElectricalType().

153 {
154  int ii = m_unitChoice->GetSelection();
155 
156  if( ii < 0 )
157  return;
158 
159  m_unit = ii + 1;
160 
162 }
static int m_unit
void updatePreviewSymbol()
wxChoice * m_unitChoice
void EDA_DRAW_FRAME::OnSelectUnits ( wxCommandEvent &  aEvent)
inherited

Definition at line 388 of file legacy_gal/eda_draw_frame.cpp.

References ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_MM, INCHES, EDA_DRAW_FRAME::m_UserUnits, MILLIMETRES, and EDA_DRAW_FRAME::unitsChangeRefresh().

389 {
390  if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && m_UserUnits != MILLIMETRES )
391  {
394  }
395  else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && m_UserUnits != INCHES )
396  {
399  }
400 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: common.h:161
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
void EDA_DRAW_FRAME::OnSelectZoom ( wxCommandEvent &  event)
virtualinherited

Set the zoom factor when selected by the zoom list box in the main tool bar.

Note
List position 0 is fit to page List position >= 1 = zoom (1 to zoom max) Last list position is custom zoom not in zoom list.

Definition at line 568 of file legacy_gal/eda_draw_frame.cpp.

References EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), EDA_DRAW_FRAME::GetToolManager(), EDA_DRAW_FRAME::GetZoom(), EDA_DRAW_FRAME::IsGalCanvasActive(), BASE_SCREEN::m_ZoomList, EDA_DRAW_FRAME::m_zoomSelectBox, EDA_DRAW_FRAME::RedrawScreen(), TOOL_MANAGER::RunAction(), BASE_SCREEN::SetZoom(), EDA_DRAW_FRAME::UpdateStatusBar(), and EDA_DRAW_FRAME::Zoom_Automatique().

569 {
570  if( m_zoomSelectBox == NULL )
571  return; // Should not happen!
572 
573  int id = m_zoomSelectBox->GetCurrentSelection();
574 
575  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
576  return;
577 
578  if( id == 0 ) // Auto zoom (Fit in Page)
579  {
580  Zoom_Automatique( true );
581  }
582  else
583  {
584  double selectedZoom = GetScreen()->m_ZoomList[id-1];
585 
586  if( GetScreen()->GetZoom() == selectedZoom )
587  return;
588 
589  GetScreen()->SetZoom( selectedZoom );
591  }
592 
593  // Notify GAL
594  TOOL_MANAGER* mgr = GetToolManager();
595 
596  if( mgr && IsGalCanvasActive() )
597  {
598  mgr->RunAction( "common.Control.zoomPreset", true, id );
599  UpdateStatusBar();
600  }
601 }
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
const wxPoint & GetScrollCenterPosition() const
wxComboBox * m_zoomSelectBox
Definition: draw_frame.h:149
Class TOOL_MANAGER.
Definition: tool_manager.h:49
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board...
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:394
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:918
virtual bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterP...
TOOL_MANAGER * GetToolManager() const
Return the tool manager instance, if any.
Definition: draw_frame.h:931
virtual void UpdateStatusBar()
Update the status bar information.
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
void LIB_VIEW_FRAME::OnSetRelativeOffset ( wxCommandEvent &  event)

Definition at line 350 of file viewlib_frame.cpp.

References EDA_DRAW_FRAME::GetCrossHairPosition(), SCH_BASE_FRAME::GetScreen(), BASE_SCREEN::m_O_Curseur, and SCH_BASE_FRAME::UpdateStatusBar().

351 {
353  UpdateStatusBar();
354 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
void UpdateStatusBar() override
Update the status bar information.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void LIB_VIEW_FRAME::OnShowElectricalType ( wxCommandEvent &  event)