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
 Function OnSize recalculates 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=0) override
 Function GeneralControl performs 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=NULL) 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 (void)
 
int GetConvert (void)
 
bool GetShowElectricalType ()
 
void SetShowElectricalType (bool aShow)
 
SCH_SCREENGetScreen () const override
 Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives. More...
 
const wxPoint GetRepeatStep () const
 
void SetRepeatStep (const wxPoint &aStep)
 Sets the repeat step value for repeat command. More...
 
int GetRepeatDeltaLabel () const
 
void SetRepeatDeltaLabel (int aDelta)
 Sets the repeat delta label value for repeat command. More...
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPosition) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
COLOR4D GetDrawBgColor () const override
 
void SetDrawBgColor (COLOR4D aColor) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void UpdateStatusBar () override
 Function UpdateStatusBar updates the status bar information. More...
 
COMPONENT_SELECTION SelectComponentFromLibrary (const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
 Function SelectComponentFromLib Calls the library viewer to select component to import into schematic. More...
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
virtual void OnEditSymbolLibTable (wxCommandEvent &aEvent)
 
LIB_ALIASGetLibAlias (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 Load symbol from symbol library table. More...
 
LIB_PARTGetLibPart (const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
 
COMPONENT_SELECTION SelectComponentFromLibBrowser (wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
 Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into schematic. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
virtual void ExecuteRemoteCommand (const char *cmdline)
 Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest(). More...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
virtual void ReCreateAuxiliaryToolbar ()
 
wxAuiToolBar * GetMainToolBar () const
 
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)
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 Function IsGridVisible() , virtual. More...
 
virtual void SetGridVisibility (bool aVisible)
 Function SetGridVisibility() , virtual It may be overloaded by derived classes. More...
 
virtual COLOR4D GetGridColor ()
 Function GetGridColor() , virtual. More...
 
virtual void SetGridColor (COLOR4D aColor)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void OnLeftDClick (wxDC *DC, const wxPoint &MousePos)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
virtual int BlockCommand (EDA_KEY aKey)
 Function BlockCommand Returns 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)
 Function HandleBlockPlace( ) 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)
 Function HandleBlockEnd( ) Handle the "end" of a block command, i.e. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies 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)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
 Function PrintPage used to print a page Print the page pointed by current screen, set by the calling print function. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. More...
 
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
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Function SyncMenusAndToolbars Updates the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
VTBL_ENTRY bool OpenProjectFiles (const std::vector< wxString > &aFileList, int aCtl=0)
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
virtual int GetIconScale ()
 Function GetIconScale. More...
 
virtual void SetIconScale (int aScale)
 Function SetIconScale. 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...
 

Protected Member Functions

void OnOpenLibraryViewer (wxCommandEvent &event)
 Open the library viewer only to browse library contents. More...
 
bool DisplayListComponentsInLib (wxString &aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
 Select a component from the list of components in a library. More...
 
wxString SelectLibraryFromList ()
 Dispaly a list of loaded libraries in the symbol library and allows the user to select a library. More...
 
bool SelectPartNameToLoad (wxString &aLibrary, wxString &aBufName)
 Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a library. More...
 
bool saveSymbolLibTables (bool aGlobal, bool aProject)
 Saves Symbol Library Tables to disk. More...
 
void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
virtual void unitsChangeRefresh ()
 Function unitsChangeRefresh is called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting () const
 Returns the canvas type stored in the application settings. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

wxPoint m_repeatStep
 the increment value of the position of an item when it is repeated More...
 
int m_repeatDeltaLabel
 the increment value of labels like bus members when they are repeated More...
 
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_DRAW_PANELm_canvas
 The area to draw on. More...
 
TOOL_MANAGERm_toolManager
 
TOOL_DISPATCHERm_toolDispatcher
 
ACTIONSm_actions
 
int m_lastDrawToolId
 Tool ID of previously active draw tool bar button. More...
 
bool m_showAxis
 True shows the X and Y axis indicators. More...
 
bool m_showGridAxis
 True shows the grid axis indicators. More...
 
bool m_showOriginAxis
 True shows the origin axis used to indicate the coordinate offset for drill, gerber, and component position files. More...
 
bool m_showBorderAndTitleBlock
 True shows the drawing border and title block. More...
 
long m_firstRunDialogSetting
 Key to control whether first run dialog is shown on startup. More...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. More...
 
wxAuiToolBar * m_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...
 
bool m_canvasTypeDirty
 Flag indicating that drawing canvas type needs to be saved to config. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
 The current canvas type. More...
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxAuiToolBar * m_mainToolBar
 Standard horizontal Toolbar. More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

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

Key in KifaceSettings to store the canvas type.

More...
 

Private Member Functions

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 onUpdateAlternateBodyStyleButton (wxUpdateUIEvent &aEvent)
 
void onUpdateNormalBodyStyleButton (wxUpdateUIEvent &aEvent)
 
void onUpdateViewDoc (wxUpdateUIEvent &aEvent)
 
void OnUpdateElectricalType (wxUpdateUIEvent &aEvent)
 
void onSelectNextSymbol (wxCommandEvent &aEvent)
 
void onSelectPreviousSymbol (wxCommandEvent &aEvent)
 
void onViewSymbolDocument (wxCommandEvent &aEvent)
 
void onSelectSymbolBodyStyle (wxCommandEvent &aEvent)
 
void onSelectSymbolUnit (wxCommandEvent &aEvent)
 
LIB_ALIASgetSelectedAlias ()
 
LIB_PARTgetSelectedSymbol ()
 

Private Attributes

wxComboBox * m_selpartBox
 
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...
 
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 49 of file viewlib_frame.h.

Member Typedef Documentation

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

Definition at line 171 of file sch_base_frame.h.

Constructor & Destructor Documentation

LIB_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)

Definition at line 115 of file viewlib_frame.cpp.

References BestZoom(), EDA_BASE_FRAME::config(), DisplayLibInfos(), FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, g_Viewlib_Hokeys_Descr, SCH_BASE_FRAME::GetScreen(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_50, EDA_PANEINFO::InfoToolbarPane(), KIWAY_PLAYER::IsModal(), KiBitmap(), PCAD2KICAD::Left, LIB_VIEW_FRAME_NAME, LoadSettings(), EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_canvas, BASE_SCREEN::m_Center, m_cmpList, m_cmpListWidth, EDA_BASE_FRAME::m_configFrameName, m_convert, m_entryName, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_DRAW_FRAME::m_hotkeysDescrList, EDA_DRAW_FRAME::m_LastGridSizeId, m_libList, m_libListWidth, m_libraryName, m_listPowerCmpOnly, EDA_BASE_FRAME::m_mainToolBar, EDA_DRAW_FRAME::m_messagePanel, m_selection_changed, m_unit, EDA_PANEINFO::MessageToolbarPane(), ReCreateHToolbar(), ReCreateListLib(), ReCreateMenuBar(), ReCreateVToolbar(), BASE_SCREEN::SetGrid(), KIWAY_PLAYER::SetModal(), BASE_SCREEN::SetScalingFactor(), EDA_DRAW_FRAME::SetScreen(), SetShowElectricalType(), EDA_PANEINFO::VerticalToolbarPane(), wxPoint::x, wxPoint::y, and EDA_DRAW_FRAME::Zoom_Automatique().

116  :
117  SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ),
118  wxDefaultPosition, wxDefaultSize,
119  aFrameType == FRAME_SCH_VIEWER_MODAL ?
121  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
123  aFrameType == FRAME_SCH_VIEWER_MODAL ?
125 {
126  wxASSERT( aFrameType == FRAME_SCH_VIEWER ||
127  aFrameType == FRAME_SCH_VIEWER_MODAL );
128 
129  if( aFrameType == FRAME_SCH_VIEWER_MODAL )
130  SetModal( true );
131 
132  // Force the frame name used in config. the lib viewer frame has a name
133  // depending on aFrameType (needed to identify the frame by wxWidgets),
134  // but only one configuration is preferable.
136 
137  // Give an icon
138  wxIcon icon;
139  icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
140  SetIcon( icon );
141 
143  m_cmpList = NULL;
144  m_libList = NULL;
145  m_listPowerCmpOnly = false;
146  SetShowElectricalType( true );
147 
148  SetScreen( new SCH_SCREEN( aKiway ) );
149  GetScreen()->m_Center = true; // Axis origin centered on screen.
150  LoadSettings( config() );
151 
152  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
153 
154  // Initialize grid id to the default value (50 mils):
156  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
157 
158  // Menu bar is not mandatory: uncomment/comment the next line
159  // to add/remove the menubar
160  ReCreateMenuBar();
163 
164  if( aLibraryName.empty() )
165  {
166  // Creates the libraries window display
167  m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
168  wxPoint( 0, 0 ), wxSize( m_libListWidth, -1 ),
169  0, NULL, wxLB_HSCROLL );
170  }
171  else
172  {
173  m_libraryName = aLibraryName;
174  m_entryName.Clear();
175  m_unit = 1;
176  m_convert = 1;
177  m_libListWidth = 0;
178  }
179 
180  m_selection_changed = false;
181 
182  // Creates the component window display
183  m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ),
184  wxSize( m_cmpListWidth, -1 ), 0, NULL, wxLB_HSCROLL );
185 
186  if( m_libList )
187  ReCreateListLib();
188 
189  DisplayLibInfos();
190 
191  m_auimgr.SetManagedWindow( this );
192 
193  EDA_PANEINFO horiz;
194  horiz.HorizontalToolbarPane();
195 
196  EDA_PANEINFO vert;
197  vert.VerticalToolbarPane();
198 
199  EDA_PANEINFO info;
200  info.InfoToolbarPane();
201 
202  EDA_PANEINFO mesg;
203  mesg.MessageToolbarPane();
204 
205 
206  // Manage main toolbar
207  m_auimgr.AddPane( m_mainToolBar,
208  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
209 
210  // Manage the left window (list of libraries)
211  if( m_libList )
212  m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( "m_libList" ).Left().Row( 0 ) );
213 
214  // Manage the list of components)
215  m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( "m_cmpList" ).Left().Row( 1 ) );
216 
217  // Manage the draw panel
218  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
219 
220  // Manage the message panel
221  m_auimgr.AddPane( m_messagePanel,
222  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
223 
224  /* Now the minimum windows are fixed, set library list
225  * and component list of the previous values from last viewlib use
226  */
227  if( m_libList )
228  {
229  m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1 ) );
230  m_auimgr.GetPane( m_libList ).BestSize( wxSize( m_libListWidth, -1 ) );
231  }
232 
233  m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) );
234  m_auimgr.GetPane( m_cmpList ).BestSize( wxSize( m_cmpListWidth, -1 ) );
235 
236  m_auimgr.Update();
237 
238  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
239 #ifdef USE_WX_GRAPHICS_CONTEXT
241 #else
242  Zoom_Automatique( false );
243 #endif
244 
245  if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
246  {
247  Raise();
248  Show( true );
249  }
250 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
static int m_unit
static int m_convert
static wxString m_entryName
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
#define LIB_VIEW_FRAME_NAME
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the component selection changing...
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:167
void SetShowElectricalType(bool aShow)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxListBox * m_cmpList
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
wxAuiManager m_auimgr
static wxString m_libraryName
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:106
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:89
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
bool m_Center
Center on screen.
Definition: base_screen.h:202
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:149
void SetScalingFactor(double iu_per_du)
Function SetScalingFactor sets the scaling factor of "internal unit per device unit".
Definition: base_screen.cpp:99
void ReCreateHToolbar() override
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
#define KICAD_DEFAULT_DRAWFRAME_STYLE
bool IsModal()
Definition: kiway_player.h:217
int m_LastGridSizeId
Definition: draw_frame.h:91
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
void DisplayLibInfos()
Definition: viewlibs.cpp:176
void SetModal(bool aIsModal)
Definition: kiway_player.h:218
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]
wxListBox * m_libList
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
#define MODAL_MODE_EXTRASTYLE
double BestZoom() override
Return the zoom level which displays the full page on screen.
void ReCreateVToolbar() override
#define LIB_VIEW_FRAME_NAME_MODAL
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
bool ReCreateListLib()
Creates or recreates a sorted list of currently loaded libraries.
LIB_VIEW_FRAME::~LIB_VIEW_FRAME ( )

Definition at line 253 of file viewlib_frame.cpp.

254 {
255 }

Member Function Documentation

void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu.

Parameters
MasterMenuThe main menu. The sub menu list will be accessible from the menu item with id ID_KICAD_SELECT_ICONS_OPTIONS

Definition at line 686 of file eda_base_frame.cpp.

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

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

687 {
688  wxMenu* menu = NULL;
689  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
690 
691  if( item ) // This menu exists, do nothing
692  return;
693 
694  menu = new wxMenu;
695 
696  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
697  _( "Icons in Menus" ), wxEmptyString,
698  wxITEM_CHECK ) );
699  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
700 
701  AddMenuItem( MasterMenu, menu,
703  _( "Icons Options" ),
704  _( "Select show icons in menus and icons sizes" ),
705  KiBitmap( icon_xpm ) );
706 }
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:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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

Parameters
aMasterMenu= the menu to populate.

Definition at line 270 of file zoom.cpp.

References AddHotkeyName(), AddMenuItem(), BASE_SCREEN::BuildGridsChoiceList(), g_UserUnit, BASE_SCREEN::GetGrid(), BASE_SCREEN::GetGridCount(), EDA_DRAW_PANEL::GetScreen(), BASE_SCREEN::GetZoom(), HK_ZOOM_AUTO, HK_ZOOM_CENTER, HK_ZOOM_IN, HK_ZOOM_OUT, HK_ZOOM_REDRAW, 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().

271 {
272  int maxZoomIds;
273  double zoom;
274  wxString msg;
275  BASE_SCREEN* screen = m_canvas->GetScreen();
276 
277  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
278  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
279  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
280  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
281  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
282  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
283  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
284  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
285  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
286  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
287 
288 
289  wxMenu* zoom_choice = new wxMenu;
290  AddMenuItem( MasterMenu, zoom_choice,
291  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
292  KiBitmap( zoom_selection_xpm ) );
293 
294  zoom = screen->GetZoom();
296  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
297  maxZoomIds : screen->m_ZoomList.size();
298 
299  // Populate zoom submenu.
300  for( int i = 0; i < maxZoomIds; i++ )
301  {
302  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
303 
304  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
305  wxEmptyString, wxITEM_CHECK );
306  if( zoom == screen->m_ZoomList[i] )
307  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
308  }
309 
310  // Create grid submenu as required.
311  if( screen->GetGridCount() )
312  {
313  wxMenu* gridMenu = new wxMenu;
314  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
315  _( "Grid" ), KiBitmap( grid_select_xpm ) );
316 
317  wxArrayString gridsList;
318  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
319 
320  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
321  {
322  GRID_TYPE& grid = screen->GetGrid( i );
323  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
324 
325  if( (int)i == icurr )
326  gridMenu->Check( grid.m_CmdId, true );
327  }
328  }
329 
330  MasterMenu->AppendSeparator();
331  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
332 }
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:174
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)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:89
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
Definition: common.h:146
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:99
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
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
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 EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

Definition at line 969 of file draw_frame.cpp.

References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetLeft(), EDA_DRAW_FRAME::GetPageSizeIU(), BOX2< Vec >::GetRight(), BASE_SCREEN::GetScalingFactor(), EDA_DRAW_FRAME::GetScreen(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetTop(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), KiROUND(), EDA_DRAW_FRAME::m_canvas, BASE_SCREEN::m_Center, BASE_SCREEN::m_DrawOrg, BASE_SCREEN::m_ScrollbarNumber, BASE_SCREEN::m_ScrollbarPos, BASE_SCREEN::m_ScrollPixelsPerUnitX, BASE_SCREEN::m_ScrollPixelsPerUnitY, min, BOX2< Vec >::MoveBottomTo(), BOX2< Vec >::MoveLeftTo(), BOX2< Vec >::MoveRightTo(), BOX2< Vec >::MoveTopTo(), scale, EDA_DRAW_FRAME::SetScrollCenterPosition(), traceScrollSettings(), VIRT_MAX, VIRT_MIN, wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_FRAME::RedrawScreen2(), and EDA_DRAW_FRAME::UseGalCanvas().

970 {
971  BASE_SCREEN* screen = GetScreen();
972 
973  if( !screen || !m_canvas )
974  return;
975 
976  double scale = screen->GetScalingFactor();
977 
978  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
979  aCenterPositionIU.x, aCenterPositionIU.y, scale );
980 
981  // Calculate the portion of the drawing that can be displayed in the
982  // client area at the current zoom level.
983 
984  // visible viewport in device units ~ pixels
985  wxSize clientSizeDU = m_canvas->GetClientSize();
986 
987  // Size of the client window in IU
988  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
989 
990  // Full drawing or "page" rectangle in internal units
991  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
992 
993  // Remark: if something is modified here, perhaps EDA_DRAW_FRAME::RedrawScreen2()
994  // will need changes accordint to the way the center is computed
995  // Account for scrollbars
996  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
997  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
998  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
999 
1000  // The upper left corner of the client rectangle in internal units.
1001  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
1002  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
1003 
1004  // If drawn around the center, adjust the client rectangle accordingly.
1005  if( screen->m_Center )
1006  {
1007  // half page offset.
1008  xIU += pageRectIU.GetWidth() / 2.0;
1009  yIU += pageRectIU.GetHeight() / 2.0;
1010  }
1011 
1012  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
1013  wxPoint centerPositionIU;
1014 
1015  // put "int" limits on the clientRect
1016  if( clientRectIU.GetLeft() < VIRT_MIN )
1017  clientRectIU.MoveLeftTo( VIRT_MIN );
1018  if( clientRectIU.GetTop() < VIRT_MIN )
1019  clientRectIU.MoveTopTo( VIRT_MIN );
1020  if( clientRectIU.GetRight() > VIRT_MAX )
1021  clientRectIU.MoveRightTo( VIRT_MAX );
1022  if( clientRectIU.GetBottom() > VIRT_MAX )
1023  clientRectIU.MoveBottomTo( VIRT_MAX );
1024 
1025  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
1026  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
1027 
1028  if( screen->m_Center )
1029  {
1030  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
1031  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
1032  }
1033 
1034  DSIZE virtualSizeIU;
1035 
1036  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
1037  {
1038  virtualSizeIU.x = pageRectIU.GetSize().x;
1039  }
1040  else
1041  {
1042  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
1043  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
1044 
1045  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
1046  {
1047  if( pageCenterX > clientCenterX )
1048  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
1049  else if( pageCenterX < clientCenterX )
1050  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
1051  else
1052  virtualSizeIU.x = clientRectIU.GetWidth();
1053  }
1054  else
1055  {
1056  if( pageCenterX > clientCenterX )
1057  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
1058  else if( pageCenterX < clientCenterX )
1059  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1060  else
1061  virtualSizeIU.x = pageRectIU.GetWidth();
1062  }
1063  }
1064 
1065  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1066  {
1067  virtualSizeIU.y = pageRectIU.GetSize().y;
1068  }
1069  else
1070  {
1071  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1072  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1073 
1074  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1075  {
1076  if( pageCenterY > clientCenterY )
1077  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1078  else if( pageCenterY < clientCenterY )
1079  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1080  else
1081  virtualSizeIU.y = clientRectIU.GetHeight();
1082  }
1083  else
1084  {
1085  if( pageCenterY > clientCenterY )
1086  virtualSizeIU.y = pageRectIU.GetHeight() +
1087  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1088  else if( pageCenterY < clientCenterY )
1089  virtualSizeIU.y = pageRectIU.GetHeight() +
1090  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1091  else
1092  virtualSizeIU.y = pageRectIU.GetHeight();
1093  }
1094  }
1095 
1096  // put "int" limits on the virtualSizeIU
1097  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1098  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1099 
1100  if( screen->m_Center )
1101  {
1102  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1103  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1104  }
1105  else
1106  {
1107  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1108  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1109  }
1110 
1111  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1112  * around cursor to jump around. This reported problem occurs when the
1113  * zoom point is not on a pixel per unit increment. If you set the
1114  * pixels per unit to 10, you have potential for the zoom point to
1115  * jump around +/-5 pixels from the nearest grid point.
1116  */
1117  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1118 
1119  // Number of scroll bar units for the given zoom level in device units.
1120  double unitsX = virtualSizeIU.x * scale;
1121  double unitsY = virtualSizeIU.y * scale;
1122 
1123  // Store the requested center position for later use
1124  SetScrollCenterPosition( aCenterPositionIU );
1125 
1126  // Calculate the scroll bar position in internal units to place the
1127  // center position at the center of client rectangle.
1128  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1129  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1130 
1131  // Convert scroll bar position to device units.
1132  posX = KiROUND( posX * scale );
1133  posY = KiROUND( posY * scale );
1134 
1135  if( posX < 0 )
1136  {
1137  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1138  posX = 0;
1139  }
1140 
1141  if( posX > unitsX )
1142  {
1143  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1144  posX = unitsX;
1145  }
1146 
1147  if( posY < 0 )
1148  {
1149  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1150  posY = 0;
1151  }
1152 
1153  if( posY > unitsY )
1154  {
1155  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1156  posY = unitsY;
1157  }
1158 
1159  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1160  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1161 
1162  wxLogTrace( traceScrollSettings,
1163  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1164  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1165  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1167  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1168  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1169 
1170  bool noRefresh = true;
1171 
1172  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1173  screen->m_ScrollPixelsPerUnitY,
1174  screen->m_ScrollbarNumber.x,
1175  screen->m_ScrollbarNumber.y,
1176  screen->m_ScrollbarPos.x,
1177  screen->m_ScrollbarPos.y, noRefresh );
1178 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
Definition: base_screen.h:192
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:966
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
Definition: base_screen.h:190
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:965
void SetScrollCenterPosition(const wxPoint &aPoint)
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
bool m_Center
Center on screen.
Definition: base_screen.h:202
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
Definition: base_screen.h:189
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
Definition: base_screen.h:196
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
static const double MAX_AXIS
Definition: draw_frame.cpp:963
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Definition: base_screen.h:183
#define min(a, b)
Definition: auxiliary.h:85
void EDA_DRAW_FRAME::AppendMsgPanel ( const wxString &  textUpper,
const wxString &  textLower,
COLOR4D  color,
int  pad = 6 
)
inherited

Append a message to the message panel.

This helper method checks to make sure the message panel exists in the frame and appends a message to it using the message panel AppendMessage() method.

Parameters
textUpper- The message upper text.
textLower- The message lower text.
color- A color ID from the KiCad color list (see colors.h).
pad- Number of spaces to pad between messages (default = 4).

Definition at line 811 of file draw_frame.cpp.

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

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

814 {
815  if( m_messagePanel == NULL )
816  return;
817 
818  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
819 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:149
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 370 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().

Referenced by LIB_VIEW_FRAME().

371 {
372  LIB_PART* part = NULL;
373  double defaultLibraryZoom = 7.33;
374 
375  if( m_libraryName.IsEmpty() || m_entryName.IsEmpty() )
376  {
377  SetScrollCenterPosition( wxPoint( 0, 0 ) );
378  return defaultLibraryZoom;
379  }
380 
381  LIB_ALIAS* alias = nullptr;
382 
383  try
384  {
385  alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
386  }
387  catch( ... )
388  {
389  }
390 
391  if( alias )
392  part = alias->GetPart();
393 
394  if( !part )
395  {
396  SetScrollCenterPosition( wxPoint( 0, 0 ) );
397  return defaultLibraryZoom;
398  }
399 
401 
402  double sizeX = (double) boundingBox.GetWidth();
403  double sizeY = (double) boundingBox.GetHeight();
404  wxPoint centre = boundingBox.Centre();
405 
406  // Reserve a 20% margin around component bounding box.
407  double margin_scale_factor = 1.2;
408 
409  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
410 }
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)
Definition: zoom.cpp:90
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

Definition at line 90 of file zoom.cpp.

References EDA_DRAW_FRAME::m_canvas, max, EDA_DRAW_FRAME::SetScrollCenterPosition(), wxPoint::x, and wxPoint::y.

Referenced by FOOTPRINT_EDIT_FRAME::BestZoom(), BestZoom(), PL_EDITOR_FRAME::BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), and LIB_EDIT_FRAME::BestZoom().

91 {
92  double bestzoom = std::max( sizeX * scaleFactor / (double) m_canvas->GetClientSize().x,
93  sizeY * scaleFactor / (double) m_canvas->GetClientSize().y );
94 
95  // Take scrollbars into account
96  DSIZE scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize();
97  centre.x -= int( bestzoom * scrollbarSize.x / 2.0 );
98  centre.y -= int( bestzoom * scrollbarSize.y / 2.0 );
99 
100  SetScrollCenterPosition( centre );
101 
102  return bestzoom;
103 }
void SetScrollCenterPosition(const wxPoint &aPoint)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
#define max(a, b)
Definition: auxiliary.h:86
int EDA_DRAW_FRAME::BlockCommand ( EDA_KEY  aKey)
virtualinherited

Function BlockCommand Returns 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 700 of file draw_frame.cpp.

Referenced by EDA_DRAW_FRAME::HandleBlockBegin().

701 {
702  return 0;
703 }
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 591 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().

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

References m_cmpList, m_selection_changed, and SetSelectedComponent().

568 {
569  int ii = m_cmpList->GetSelection();
570 
571  if( ii < 0 )
572  return;
573 
574  m_selection_changed = true;
575 
576  SetSelectedComponent( m_cmpList->GetString( ii ) );
577 }
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 536 of file viewlib_frame.cpp.

References m_libList, m_selection_changed, and SetSelectedLibrary().

537 {
538  int ii = m_libList->GetSelection();
539 
540  if( ii < 0 )
541  return;
542 
543  m_selection_changed = true;
544 
545  SetSelectedLibrary( m_libList->GetString( ii ) );
546 }
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 710 of file viewlib_frame.cpp.

711 {
712  Close();
713 }
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 374 of file eda_base_frame.cpp.

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_EDIT_FRAME::Export_Module(), GERBVIEW_FRAME::GERBVIEW_FRAME(), FOOTPRINT_EDIT_FRAME::Import_Module(), EDA_BASE_FRAME::isAutoSaveRequired(), LIB_VIEW_FRAME(), 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().

375 {
376  // KICAD_MANAGER_FRAME overrides this
377  wxConfigBase* ret = Kiface().KifaceSettings();
378  //wxASSERT( ret );
379  return ret;
380 }
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 260 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
wxString EDA_DRAW_FRAME::CoordinateToString ( int  aValue,
bool  aConvertToMils = false 
) const
inherited

Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting.

Parameters
aValueThe coordinate to convert.
aConvertToMilsConvert inch values to mils if true. This setting has no effect if the current user unit is millimeters.
Returns
The converted string for display in user interface elements.

Definition at line 870 of file draw_frame.cpp.

References CoordinateToString().

Referenced by getOptimalModulePlacement().

871 {
872  return ::CoordinateToString( aValue, aConvertToMils );
873 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:118
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

Function CopyToClipboard copies the current page or the current block to the clipboard.

Definition at line 42 of file copy_to_clipboard.cpp.

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

Referenced by add_search_paths().

43 {
44  DrawPageOnClipboard( this );
45 
46  if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
47  {
48  if( GetScreen()->IsBlockActive() )
49  m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
50 
52  }
53 }
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool IsBlockActive() const
Definition: base_screen.h:499
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
static bool DrawPageOnClipboard(EDA_DRAW_FRAME *aFrame)
int GetDefaultCursor() const
Function GetDefaultCursor.
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:84
void LIB_VIEW_FRAME::DClickOnCmpList ( wxCommandEvent &  event)
private

Definition at line 607 of file viewlib_frame.cpp.

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

Referenced by SetShowElectricalType().

608 {
609  if( IsModal() )
610  {
612 
613  // The schematic editor might not be the parent of the library viewer.
614  // It could be a python window.
615  SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
616 
617  if( schframe )
618  {
619  // Prevent the double click from being as a single click in the parent
620  // window which would cause the part to be parked rather than staying
621  // in drag mode.
622  schframe->SkipNextLeftButtonReleaseEvent();
623  }
624  }
625 }
Schematic editor (Eeschema) main window.
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:300
bool IsModal()
Definition: kiway_player.h:217
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 164 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().

165 {
166  m_modal_ret_val = aRetVal;
167  m_modal_string = aResult;
168 
169  if( m_modal_loop )
170  {
171  m_modal_loop->Exit();
172  m_modal_loop = 0; // this marks it as dismissed.
173  }
174 
175  Show( false );
176 }
bool m_modal_ret_val
Definition: kiway_player.h:251
wxString m_modal_string
Definition: kiway_player.h:250
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:248
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 LIB_VIEW_FRAME(), OnActivate(), ReCreateListLib(), 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:199
wxString SelectLibraryFromList()
Dispaly a list of loaded libraries in the symbol library and allows the user to select a library...
Definition: selpart.cpp:76
static void DisplayCmpDocAndKeywords(wxString &aSelection, void *aData)
Definition: selpart.cpp:41
class EDA_LIST_DIALOG
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
int SetLibItemName(const UTF8 &aLibItemName, bool aTestForRev=true)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:232
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
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::DisplayToolMsg ( const wxString &  msg)
inherited
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 558 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

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

559 {
560  wxString msg;
561 
562  switch( g_UserUnit )
563  {
564  case INCHES:
565  msg = _( "Inches" );
566  break;
567 
568  case MILLIMETRES:
569  msg = _( "mm" );
570  break;
571 
572  default:
573  msg = _( "Units" );
574  break;
575  }
576 
577  SetStatusText( msg, 4 );
578 }
Definition: common.h:146
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
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 244 of file eda_base_frame.cpp.

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

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

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

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

Definition at line 76 of file worksheet.cpp.

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

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

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

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

Referenced by GERBVIEW_FRAME::SetCurItem().

276 {
277  if( m_messagePanel )
279 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:149
void EraseMsgBox()
Definition: msgpanel.cpp:215
virtual void EDA_DRAW_FRAME::ExecuteRemoteCommand ( const char *  cmdline)
inlinevirtualinherited

Execute a remote command send via a socket to the application, port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) It called by EDA_DRAW_FRAME::OnSockRequest().

this is a virtual function becuse the actual commands depends on the application. the basic function do nothing

Parameters
cmdline= received command from socket

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 380 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

380 {}
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 777 of file hotkeys_basic.cpp.

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

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

779 {
780  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
781  wxString mask = wxT( "*." ) + ext;
782 
783 #if 0
784  wxString path = wxPathOnly( Prj().GetProjectFullName() );
785 #else
786  wxString path = GetMruPath();
787 #endif
788  wxFileName fn( aDefaultShortname );
789  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
790 
791  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
792  path,
793  fn.GetFullPath(),
794  ext,
795  mask,
796  this,
797  wxFD_SAVE,
798  true );
799 
800  if( filename.IsEmpty() )
801  return;
802 
803  WriteHotkeyConfig( aDescList, &filename );
804  SetMruPath( wxFileName( filename ).GetPath() );
805 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:287
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 628 of file viewlib_frame.cpp.

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

Referenced by DClickOnCmpList(), and SetShowElectricalType().

629 {
630  int ii = m_cmpList->GetSelection();
631 
632  if( ii >= 0 )
633  {
634  wxString part_name = m_libraryName + ':' + m_cmpList->GetString( ii );
635 
636  // a selection was made, pass true
637  DismissModal( true, part_name );
638  }
639  else
640  {
641  // no selection was made, pass false
642  DismissModal( false );
643  }
644 
645  Close( true );
646 }
wxListBox * m_cmpList
static wxString m_libraryName
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
bool LIB_VIEW_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

Function GeneralControl performs application specific control using aDC at aPosition in logical units.

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

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

Reimplemented from EDA_DRAW_FRAME.

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

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

322 {
323  bool eventHandled = true;
324 
325  // Filter out the 'fake' mouse motion after a keyboard movement
326  if( !aHotKey && m_movingCursorWithKeyboard )
327  {
329  return false;
330  }
331 
332  wxPoint pos = aPosition;
333  wxPoint oldpos = GetCrossHairPosition();
334  GeneralControlKeyMovement( aHotKey, &pos, true );
335 
336  // Update cursor position.
337  SetCrossHairPosition( pos, true );
338  RefreshCrossHair( oldpos, aPosition, aDC );
339 
340  if( aHotKey )
341  {
342  SCH_SCREEN* screen = GetScreen();
343 
344  if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
345  eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
346  else
347  eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
348  }
349 
350  UpdateStatusBar(); // Display cursor coordinates info.
351 
352  return eventHandled;
353 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Handle hot key events.
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:174
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:159
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protectedinherited

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

cursor movement by keyboard)

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

Definition at line 1394 of file draw_frame.cpp.

References EDA_DRAW_FRAME::GetCrossHairPosition(), BASE_SCREEN::GetGridSize(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_DRAW_FRAME::GetScreen(), GR_KB_CTRL, KiROUND(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_movingCursorWithKeyboard, EDA_DRAW_PANEL::MoveCursor(), wxPoint::x, and wxPoint::y.

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

1396 {
1397  bool key_handled = false;
1398 
1399  // If requested snap the current position to the grid
1400  if( aSnapToGrid )
1401  *aPos = GetNearestGridPosition( *aPos );
1402 
1403  switch( aHotKey )
1404  {
1405  // All these keys have almost the same treatment
1406  case GR_KB_CTRL | WXK_NUMPAD8:
1407  case GR_KB_CTRL | WXK_UP:
1408  case GR_KB_CTRL | WXK_NUMPAD2:
1409  case GR_KB_CTRL | WXK_DOWN:
1410  case GR_KB_CTRL | WXK_NUMPAD4:
1411  case GR_KB_CTRL | WXK_LEFT:
1412  case GR_KB_CTRL | WXK_NUMPAD6:
1413  case GR_KB_CTRL | WXK_RIGHT:
1414  case WXK_NUMPAD8:
1415  case WXK_UP:
1416  case WXK_NUMPAD2:
1417  case WXK_DOWN:
1418  case WXK_NUMPAD4:
1419  case WXK_LEFT:
1420  case WXK_NUMPAD6:
1421  case WXK_RIGHT:
1422  key_handled = true;
1423  {
1424  /* Here's a tricky part: when doing cursor key movement, the
1425  * 'previous' point should be taken from memory, *not* from the
1426  * freshly computed position in the event. Otherwise you can't do
1427  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1428  * the automatic motion event generated by cursor warping */
1429  wxRealPoint gridSize = GetScreen()->GetGridSize();
1430  *aPos = GetCrossHairPosition();
1431 
1432  // Bonus: ^key moves faster (x10)
1433  switch( aHotKey )
1434  {
1435  case GR_KB_CTRL|WXK_NUMPAD8:
1436  case GR_KB_CTRL|WXK_UP:
1437  aPos->y -= KiROUND( 10 * gridSize.y );
1438  break;
1439 
1440  case GR_KB_CTRL|WXK_NUMPAD2:
1441  case GR_KB_CTRL|WXK_DOWN:
1442  aPos->y += KiROUND( 10 * gridSize.y );
1443  break;
1444 
1445  case GR_KB_CTRL|WXK_NUMPAD4:
1446  case GR_KB_CTRL|WXK_LEFT:
1447  aPos->x -= KiROUND( 10 * gridSize.x );
1448  break;
1449 
1450  case GR_KB_CTRL|WXK_NUMPAD6:
1451  case GR_KB_CTRL|WXK_RIGHT:
1452  aPos->x += KiROUND( 10 * gridSize.x );
1453  break;
1454 
1455  case WXK_NUMPAD8:
1456  case WXK_UP:
1457  aPos->y -= KiROUND( gridSize.y );
1458  break;
1459 
1460  case WXK_NUMPAD2:
1461  case WXK_DOWN:
1462  aPos->y += KiROUND( gridSize.y );
1463  break;
1464 
1465  case WXK_NUMPAD4:
1466  case WXK_LEFT:
1467  aPos->x -= KiROUND( gridSize.x );
1468  break;
1469 
1470  case WXK_NUMPAD6:
1471  case WXK_RIGHT:
1472  aPos->x += KiROUND( gridSize.x );
1473  break;
1474 
1475  default: /* Can't happen since we entered the statement */
1476  break;
1477  }
1478 
1479  m_canvas->MoveCursor( *aPos );
1481  }
1482  break;
1483 
1484  default:
1485  break;
1486  }
1487 
1488  return key_handled;
1489 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:366
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
Definition: base_screen.h:410
#define GR_KB_CTRL
Definition: common.h:64
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:159
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 219 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

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

Definition at line 456 of file draw_frame.h.

456 { 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:139
const wxPoint & SCH_BASE_FRAME::GetAuxOrigin ( ) const
overridevirtualinherited

Function GetAuxOrigin returns the origin of the axis used for plotting and various exports.

Implements EDA_DRAW_FRAME.

Definition at line 165 of file sch_base_frame.cpp.

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

Referenced by SCH_BASE_FRAME::SetRepeatDeltaLabel().

166 {
167  wxASSERT( GetScreen() );
168  return GetScreen()->GetAuxOrigin();
169 }
const wxPoint & GetAuxOrigin() const
Definition: sch_screen.h:122
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( )
inlineinherited

Definition at line 359 of file draw_frame.h.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), AddNewTrace(), Autoroute_One_Track(), PCB_EDIT_FRAME::Check_All_Zones(), SCH_EDIT_FRAME::DeleteAnnotation(), PLEDITOR_PRINTOUT::DrawPage(), SCH_PRINTOUT::DrawPage(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), SCH_EDIT_FRAME::EditComponent(), getOptimalModulePlacement(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_EDIT_COMPONENTS_LIBID::onApplyButton(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClick(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_LABEL_EDITOR::OnCancelClick(), DIALOG_ERC::OnEraseDrcMarkersClick(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), GERBER_LAYER_WIDGET::OnLayerSelect(), PCB_LAYER_WIDGET::OnLayerVisible(), GERBER_LAYER_WIDGET::OnLayerVisible(), SCH_EDIT_FRAME::OnLeftDClick(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GENERALOPTIONS::OnOkClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_PAGES_SETTINGS::OnOkClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), PROPERTIES_FRAME::OnSetDefaultValues(), LIB_EDIT_FRAME::OnShowElectricalType(), EDA_DRAW_FRAME::OnZoom(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), SCH_FIELD::Place(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), DIALOG_EDIT_COMPONENTS_LIBID::revertChanges(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), PCB_BASE_FRAME::SetNextGrid(), PCB_BASE_FRAME::SetPrevGrid(), GERBVIEW_FRAME::SortLayersByX2Attributes(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings().

359 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
int LIB_VIEW_FRAME::GetConvert ( void  )
inline

Definition at line 150 of file viewlib_frame.h.

References m_convert.

Referenced by SCH_BASE_FRAME::SelectComponentFromLibBrowser().

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

Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates.

Parameters
aInvertYInverts the Y axis position.
Returns
The cross hair position in drawing coordinates.

Definition at line 1287 of file draw_frame.cpp.

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

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::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(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), EDA_DRAW_PANEL::DrawCrossHair(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), 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(), PCB_EDIT_FRAME::GeneralControl(), GERBVIEW_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), moveBitmap(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnDragItem(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditValue(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_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(), LIB_EDIT_FRAME::OnOrient(), 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(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), EDA_DRAW_FRAME::RedrawScreen2(), RedrawWhileMovingCursor(), EDA_DRAW_FRAME::RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), resizeSheetWithMouseCursor(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), Show_MoveTexte_Module(), Show_New_Edge_While_Move_Mouse(), Show_Pad_Move(), Show_Zone_Corner_Or_Outline_While_Move_Mouse(), ShowBoundingBoxMicroWaveInductor(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), ShowTargetShapeWhileMovingMouse(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SymbolDisplayDraw(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and GERBVIEW_FRAME::UpdateStatusBar().

1288 {
1289  // subject to change, borrow from old BASE_SCREEN for now.
1290  if( IsGalCanvasActive() )
1291  {
1293 
1294  return wxPoint( cursor.x, cursor.y );
1295  }
1296  else
1297  {
1298  BASE_SCREEN* screen = GetScreen(); // virtual call
1299  return screen->getCrossHairPosition( aInvertY );
1300  }
1301 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Definition: base_screen.h:107
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:895
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:903
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition ( ) const
inherited

Function GetCursorScreenPosition returns the cross hair position in device (display) units.b.

Returns
The current cross hair position.

Definition at line 1325 of file draw_frame.cpp.

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

1326 {
1327  BASE_SCREEN* screen = GetScreen(); // virtual call
1328  return screen->getCrossHairScreenPosition();
1329 }
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
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

Function GetCursorPosition returns the current cursor position in logical (drawing) units.

Parameters
aOnGridReturns the nearest grid position at the current cursor position.
aGridSizeCustom grid size instead of the current grid size. Only valid if aOnGrid is true.
Returns
The current cursor position.

Definition at line 1311 of file draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

1312 {
1313  BASE_SCREEN* screen = GetScreen(); // virtual call
1314  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1315 }
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

Function GetDisplayOptions A way to pass info to draw functions.

the base class has no knowledge about these options. It is virtual because this function must be overloaded to pass usefull info.

Reimplemented in PCB_BASE_FRAME.

Definition at line 918 of file draw_frame.h.

Referenced by GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), EDA_DRAW_PANEL::GetDisplayOptions(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 121 of file sch_base_frame.cpp.

References GetLayerColor(), and LAYER_SCHEMATIC_BACKGROUND.

Referenced by DIALOG_RESCUE_EACH::renderPreview(), DIALOG_CHOOSE_COMPONENT::RenderPreview(), and SCH_BASE_FRAME::SetGridOrigin().

122 {
124 }
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 455 of file draw_frame.h.

455 { 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:143
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 413 of file eda_base_frame.cpp.

References Format(), GetChars(), 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().

415 {
416  wxFileHistory* fileHistory = aFileHistory;
417 
418  if( !fileHistory )
419  fileHistory = &Kiface().GetFileHistory();
420 
421  int baseId = fileHistory->GetBaseId();
422 
423  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
424 
425  unsigned i = cmdId - baseId;
426 
427  if( i < fileHistory->GetCount() )
428  {
429  wxString fn = fileHistory->GetHistoryFile( i );
430 
431  if( wxFileName::FileExists( fn ) )
432  return fn;
433  else
434  {
435  wxString msg = wxString::Format(
436  _( "File \"%s\" was not found." ),
437  GetChars( fn ) );
438 
439  wxMessageBox( msg );
440 
441  fileHistory->RemoveFileFromHistory( i );
442  }
443  }
444 
445  return wxEmptyString;
446 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
size_t i
Definition: json11.cpp:597
EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetGalCanvas ( ) const
inlineinherited

Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.

Returns
Pointer to GAL-based canvas.

Definition at line 903 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBVIEW_FRAME::applyDisplaySettingsToGAL(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCB_TOOL::canvas(), PCB_EDIT_FRAME::Check_All_Zones(), GERBVIEW_FRAME::Clear_DrawLayers(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE_EDITOR_TOOLS::EnumeratePads(), EVT_TOOL(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SELECTION_TOOL::findCallback(), PCB_BASE_FRAME::FocusOnLocation(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDA_DRAW_FRAME::GetCrossHairPosition(), GERBVIEW_FRAME::GetVisibleLayers(), GRID_HELPER::GRID_HELPER(), GERBVIEW_CONTROL::HighlightControl(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_FRAME::loadListOfGerberFiles(), STATUS_POPUP::onCharHook(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), GERBVIEW_FRAME::OnCloseWindow(), 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(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), BOARD_COMMIT::Push(), GRID_HELPER::queryVisible(), PCB_EDITOR_CONTROL::ratsnestTimer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), GERBER_LAYER_WIDGET::ReFill(), Refresh(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), GERBVIEW_FRAME::SetActiveLayer(), GRID_HELPER::SetAuxAxes(), PCB_BASE_EDIT_FRAME::SetBoard(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableAutoPan(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), GERBVIEW_FRAME::SetVisibleLayers(), GERBVIEW_FRAME::SortLayersByX2Attributes(), EDA_DRAW_FRAME::SwitchCanvas(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), GERBVIEW_FRAME::UpdateDisplayOptions(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::updateView(), PCB_BASE_EDIT_FRAME::UseGalCanvas(), FOOTPRINT_EDIT_FRAME::UseGalCanvas(), PCB_BASE_FRAME::UseGalCanvas(), GERBVIEW_FRAME::UseGalCanvas(), EDA_DRAW_FRAME::UseGalCanvas(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().

903 { 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:77
KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_FRAME::GetGalDisplayOptions ( )
inlineinherited
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

Function GetGridColor() , virtual.

Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 525 of file draw_frame.h.

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

526  {
527  return m_gridColor;
528  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:96
const wxPoint& SCH_BASE_FRAME::GetGridOrigin ( ) const
inlineoverridevirtualinherited

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

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

Implements EDA_DRAW_FRAME.

Definition at line 139 of file sch_base_frame.h.

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

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

Otherwise, the original positions is returned.

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

Definition at line 630 of file draw_frame.cpp.

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

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

631 {
632  wxPoint pos = aPosition;
633 
634  if( m_currentScreen != NULL && m_snapToGrid )
635  pos = GetNearestGridPosition( aPosition );
636 
637  return pos;
638 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:72
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:74
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

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

Definition at line 405 of file draw_frame.h.

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

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

>

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

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

Implements EDA_DRAW_FRAME.

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

References GetDescriptorFromCommand().

869 {
870  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
871 
872  if( HK_Descr == NULL )
873  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
874 
875  return HK_Descr;
876 }
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.
virtual int EDA_BASE_FRAME::GetIconScale ( )
inlinevirtualinherited

Function GetIconScale.

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

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

Definition at line 437 of file eda_base_frame.h.

Referenced by get_scale_factor().

437 { return -1; }
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 540 of file eda_base_frame.cpp.

References ShowAboutDialog().

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

541 {
542  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
543  ShowAboutDialog( this );
544 }
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 527 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

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

528 {
529  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
530  {
531  wxString msg;
532  msg.Printf( _( "Could not launch the default browser.\n"
533  "For information on how to help the KiCad project, visit %s" ),
535  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
536  }
537 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 449 of file eda_base_frame.cpp.

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

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

450 {
451  const SEARCH_STACK& search = sys_search();
452 
453  /* We have to get document for beginners,
454  * or the full specific doc
455  * if event id is wxID_INDEX, we want the document for beginners.
456  * else the specific doc file (its name is in Kiface().GetHelpFileName())
457  * The document for beginners is the same for all KiCad utilities
458  */
459  if( event.GetId() == wxID_INDEX )
460  {
461  // List of possible names for Getting Started in KiCad
462  const wxChar* names[2] = {
463  wxT( "getting_started_in_kicad" ),
464  wxT( "Getting_Started_in_KiCad" )
465  };
466 
467  wxString helpFile;
468  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
469  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
470  for( unsigned ii = 0; ii < DIM( names ); ii++ )
471  {
472  helpFile = SearchHelpFileFullPath( search, names[ii] );
473 
474  if( !helpFile.IsEmpty() )
475  break;
476  }
477 
478  if( !helpFile )
479  {
480  wxString msg = wxString::Format( _(
481  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
482  wxMessageBox( msg );
483  }
484  else
485  {
486  GetAssociatedDocument( this, helpFile );
487  }
488 
489  return;
490  }
491 
492  wxString base_name = help_name();
493  wxString helpFile = SearchHelpFileFullPath( search, base_name );
494 
495  if( !helpFile )
496  {
497  wxString msg = wxString::Format( _(
498  "Help file \"%s\" could not be found." ),
499  GetChars( base_name )
500  );
501  wxMessageBox( msg );
502  }
503  else
504  {
505  GetAssociatedDocument( this, helpFile );
506  }
507 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
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...
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSStack, const wxString &aBaseName)
Return the help file&#39;s full path.
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()
LIB_ALIAS * SCH_BASE_FRAME::GetLibAlias ( const LIB_ID aLibId,
bool  aUseCacheLib = false,
bool  aShowErrorMsg = 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 296 of file sch_base_frame.cpp.

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

Referenced by SCH_EDIT_FRAME::Load_Component(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

298 {
299  // wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
300 
301  PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
302 
303  return SchGetLibAlias( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
304 }
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 307 of file sch_base_frame.cpp.

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

Referenced by SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::CreateArchiveLibrary(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), SCH_EDIT_FRAME::Load_Component(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName(), SCH_EDIT_FRAME::OnSelectUnit(), ReCreateHToolbar(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp().

308 {
309  // wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
310 
311  PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
312 
313  return SchGetLibPart( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
314 }
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 453 of file draw_frame.h.

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

Function GetNearestGridPosition returns 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 1318 of file draw_frame.cpp.

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

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), EDA_DRAW_PANEL::DrawGrid(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_FRAME::GetGridPosition(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), GERBVIEW_FRAME::Locate(), SCH_EDIT_FRAME::LocateAndShowItem(), LIB_EDIT_FRAME::LocateItemUsingCursor(), PCB_EDIT_FRAME::OnRightClick(), resizeSheetWithMouseCursor(), and SCH_EDIT_FRAME::RotateHierarchicalSheet().

1319 {
1320  BASE_SCREEN* screen = GetScreen(); // virtual call
1321  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1322 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
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
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
wxAuiToolBar* EDA_DRAW_FRAME::GetOptionsToolBar ( ) const
inlineinherited

Definition at line 454 of file draw_frame.h.

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

Implements EDA_DRAW_FRAME.

Definition at line 152 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(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), and SCH_BASE_FRAME::SetRepeatDeltaLabel().

153 {
154  return GetScreen()->GetPageSettings();
155 }
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:115
const wxSize SCH_BASE_FRAME::GetPageSizeIU ( ) const
overridevirtualinherited

Function GetPageSizeIU 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 158 of file sch_base_frame.cpp.

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

Referenced by SCH_BASE_FRAME::SetRepeatDeltaLabel().

159 {
160  // GetSizeIU is compile time dependent:
161  return GetScreen()->GetPageSettings().GetSizeIU();
162 }
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:115
int SCH_BASE_FRAME::GetRepeatDeltaLabel ( ) const
inlineinherited
Returns
the increment value of labels like bus members for the repeat command

Definition at line 114 of file sch_base_frame.h.

References SCH_BASE_FRAME::m_repeatDeltaLabel.

Referenced by SCH_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), and LIB_EDIT_FRAME::SaveSettings().

114 { 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 101 of file sch_base_frame.h.

References SCH_BASE_FRAME::m_repeatStep.

Referenced by SCH_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::RepeatDrawItem(), and LIB_EDIT_FRAME::SaveSettings().

101 { 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

Function GetScreen returns 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 134 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetScreen().

Referenced by AddMenusForBlock(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_FRAME::copySelectedItems(), 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(), LIB_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::InitBlockPasteInfos(), LIB_VIEW_FRAME(), LIB_EDIT_FRAME::LoadComponentAndSelectLib(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::OnModify(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), LIB_EDIT_FRAME::OnPreferencesOptions(), SCH_EDIT_FRAME::OnPreferencesOptions(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnSelectUnit(), OnSetRelativeOffset(), LIB_EDIT_FRAME::OnUpdateRedo(), LIB_EDIT_FRAME::OnUpdateUndo(), SCH_EDIT_FRAME::OrientComponent(), LIB_EDIT_FRAME::PrintPage(), LIB_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::RedrawActiveWindow(), 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(), and SCH_BASE_FRAME::UpdateStatusBar().

135 {
137 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

Definition at line 119 of file worksheet.cpp.

Referenced by ConfigureDrawList(), EDA_DRAW_FRAME::DrawWorkSheet(), PL_EDITOR_FRAME::Locate(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG().

120 {
121  // Virtual function. In basic class, returns
122  // an empty string.
123  return wxEmptyString;
124 }
const wxPoint & EDA_DRAW_FRAME::GetScrollCenterPosition ( ) const
inherited

Definition at line 1346 of file 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(), EDA_DRAW_FRAME::OnZoom(), EDA_DRAW_FRAME::SetPresetZoom(), and EDA_DRAW_FRAME::Zoom_Automatique().

1347 {
1348  BASE_SCREEN* screen = GetScreen(); // virtual call
1349  return screen->getScrollCenterPosition();
1350 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
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 ( )
private

Definition at line 266 of file viewlib_frame.cpp.

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

Referenced by getSelectedSymbol(), onUpdateViewDoc(), and SetShowElectricalType().

267 {
268  LIB_ALIAS* alias = NULL;
269 
270  if( !m_libraryName.IsEmpty() && !m_entryName.IsEmpty() )
271  {
272  alias = Prj().SchSymbolLibTable()->LoadSymbol( m_libraryName, m_entryName );
273  }
274 
275  return alias;
276 }
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 ( )
private

Definition at line 279 of file viewlib_frame.cpp.

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

Referenced by onUpdateAlternateBodyStyleButton(), onUpdateNormalBodyStyleButton(), and SetShowElectricalType().

280 {
281  LIB_PART* symbol = NULL;
282  LIB_ALIAS* alias = getSelectedAlias();
283 
284  if( alias )
285  symbol = alias->GetPart();
286 
287  return symbol;
288 }
Part library alias object definition.
LIB_ALIAS * getSelectedAlias()
Define a library symbol object.
LIB_PART * GetPart() const
Get the shared LIB_PART.
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inlineinherited

Definition at line 353 of file draw_frame.h.

Referenced by DIALOG_PAGE_SHOW_PAGE_BORDERS::DIALOG_PAGE_SHOW_PAGE_BORDERS(), and DIALOG_DISPLAY_OPTIONS::initOptDialog().

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

Definition at line 152 of file viewlib_frame.h.

References m_showPinElectricalTypeName.

Referenced by OnShowElectricalType(), OnUpdateElectricalType(), and RedrawActiveWindow().

152 { return m_showPinElectricalTypeName; }
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
const TITLE_BLOCK & SCH_BASE_FRAME::GetTitleBlock ( ) const
overridevirtualinherited

Implements EDA_DRAW_FRAME.

Definition at line 179 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(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), and SCH_BASE_FRAME::SetGridOrigin().

180 {
181  wxASSERT( GetScreen() );
182  return GetScreen()->GetTitleBlock();
183 }
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:125
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 330 of file 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.

331 {
332  // Checks all the toolbars and returns a reference to the given tool id
333  // (or the first tool found, but only one or 0 tool is expected, because on
334  // Windows, when different tools have the same ID, it creates issues)
335  if( m_mainToolBar && m_mainToolBar->FindTool( aToolId ) )
336  return m_mainToolBar->FindTool( aToolId );
337 
338  if( m_optionsToolBar && m_optionsToolBar->FindTool( aToolId ) )
339  return m_optionsToolBar->FindTool( aToolId );
340 
341  if( m_drawToolBar && m_drawToolBar->FindTool( aToolId ) )
342  return m_drawToolBar->FindTool( aToolId );
343 
344  if( m_auxiliaryToolBar && m_auxiliaryToolBar->FindTool( aToolId ) )
345  return m_auxiliaryToolBar->FindTool( aToolId );
346 
347  return nullptr;
348 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:139
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:146
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:143
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 496 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(), 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(), PICKER_TOOL::Init(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), 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(), 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::OnRotateItem(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), LIB_EDIT_FRAME::OnSelectTool(), SCH_EDIT_FRAME::OnSelectTool(), PCB_EDIT_FRAME::OnSelectTool(), 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().

496 { 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 319 of file 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().

320 {
321  // Checks all the toolbars and returns true if the given tool id is toggled.
322  return ( ( m_mainToolBar && m_mainToolBar->GetToolToggled( aToolId ) ) ||
323  ( m_optionsToolBar && m_optionsToolBar->GetToolToggled( aToolId ) ) ||
324  ( m_drawToolBar && m_drawToolBar->GetToolToggled( aToolId ) ) ||
325  ( m_auxiliaryToolBar && m_auxiliaryToolBar->GetToolToggled( aToolId ) )
326  );
327 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:139
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:146
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:143
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
int LIB_VIEW_FRAME::GetUnit ( void  )
inline

Definition at line 149 of file viewlib_frame.h.

References m_unit.

Referenced by SCH_BASE_FRAME::SelectComponentFromLibBrowser().

149 { return m_unit; }
static int m_unit
double EDA_DRAW_FRAME::GetZoom ( )
inherited

Function GetZoom.

Returns
The current zoom level.

Definition at line 535 of file 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(), and PCB_BASE_FRAME::updateZoomSelectBox().

536 {
537  return GetScreen()->GetZoom();
538 }
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
double EDA_DRAW_FRAME::GetZoomLevelCoeff ( ) const
inlineinherited

Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level.

Definition at line 442 of file draw_frame.h.

Referenced by ZOOM_MENU::ZOOM_MENU().

442 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:99
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 140 of file sch_base_frame.cpp.

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

Referenced by SCH_BASE_FRAME::SetRepeatDeltaLabel().

141 {
143 }
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:735
bool EDA_DRAW_FRAME::HandleBlockBegin ( wxDC *  aDC,
EDA_KEY  aKey,
const wxPoint aPosition,
int  aExplicitCommand = 0 
)
virtualinherited

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.

Definition at line 881 of file draw_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_ROTATE, BLOCK_ZOOM, EDA_DRAW_FRAME::BlockCommand(), EDA_DRAW_PANEL::CallMouseCapture(), BLOCK_SELECTOR::ClearItemsList(), DisplayError(), BLOCK_SELECTOR::GetCommand(), BLOCK_SELECTOR::GetCount(), EDA_DRAW_FRAME::GetScreen(), BLOCK_SELECTOR::GetState(), EDA_DRAW_FRAME::InitBlockPasteInfos(), BLOCK_SELECTOR::InitData(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, BLOCK_SELECTOR::SetCommand(), BLOCK_SELECTOR::SetLastCursorPosition(), BLOCK_SELECTOR::SetMessageBlock(), EDA_DRAW_PANEL::SetMouseCaptureCallback(), BLOCK_SELECTOR::SetState(), STATE_BLOCK_MOVE, and STATE_NO_BLOCK.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), PCB_BASE_EDIT_FRAME::duplicateItem(), SCH_EDIT_FRAME::OnDragItem(), EDA_DRAW_PANEL::OnMouseEvent(), LIB_EDIT_FRAME::Process_Special_Functions(), and SCH_EDIT_FRAME::Process_Special_Functions().

883 {
885 
886  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
887  return false;
888 
889  if( aExplicitCommand == 0 )
890  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
891  else
892  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
893 
894  if( block->GetCommand() == 0 )
895  return false;
896 
897  switch( block->GetCommand() )
898  {
899  case BLOCK_IDLE:
900  break;
901 
902  case BLOCK_MOVE: // Move
903  case BLOCK_DRAG: // Drag (block defined)
904  case BLOCK_DRAG_ITEM: // Drag from a drag item command
905  case BLOCK_DUPLICATE: // Duplicate
906  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
907  case BLOCK_DELETE: // Delete
908  case BLOCK_COPY: // Copy
909  case BLOCK_ROTATE: // Rotate 90 deg
910  case BLOCK_FLIP: // Flip
911  case BLOCK_ZOOM: // Window Zoom
912  case BLOCK_MIRROR_X:
913  case BLOCK_MIRROR_Y: // mirror
914  case BLOCK_PRESELECT_MOVE: // Move with preselection list
915  block->InitData( m_canvas, aPosition );
916  break;
917 
918  case BLOCK_PASTE:
919  block->InitData( m_canvas, aPosition );
920  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
922 
923  if( block->GetCount() == 0 ) // No data to paste
924  {
925  DisplayError( this, wxT( "No block to paste" ), 20 );
928  block->SetState( STATE_NO_BLOCK );
929  block->SetMessageBlock( this );
930  return true;
931  }
932 
933  if( !m_canvas->IsMouseCaptured() )
934  {
935  block->ClearItemsList();
936  DisplayError( this,
937  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
938  block->SetState( STATE_NO_BLOCK );
939  block->SetMessageBlock( this );
940  return true;
941  }
942 
943  block->SetState( STATE_BLOCK_MOVE );
944  m_canvas->CallMouseCapture( aDC, aPosition, false );
945  break;
946 
947  default:
948  {
949  wxString msg;
950  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
951  block->GetCommand();
952  DisplayError( this, msg );
953  }
954  break;
955  }
956 
957  block->SetMessageBlock( this );
958  return true;
959 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:700
void SetMessageBlock(EDA_DRAW_FRAME *frame)
Function SetMessageBlock Displays the type of block command in the status bar of the window...
BLOCK_COMMAND_T
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:706
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)
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
Definition: solve.cpp:178
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
BLOCK_STATE_T GetState() const
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...
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:185
unsigned GetCount() const
void SetCommand(BLOCK_COMMAND_T aCommand)
bool EDA_DRAW_FRAME::HandleBlockEnd ( wxDC *  DC)
virtualinherited

Function HandleBlockEnd( ) 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 718 of file draw_frame.cpp.

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

719 {
720  return false;
721 }
void EDA_DRAW_FRAME::HandleBlockPlace ( wxDC *  DC)
virtualinherited

Function HandleBlockPlace( ) 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 713 of file draw_frame.cpp.

Referenced by EDA_DRAW_PANEL::OnMouseEvent().

714 {
715 }
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 389 of file eda_base_frame.cpp.

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

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

390 {
391  return Kiface().GetHelpFileName();
392 }
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 748 of file hotkeys_basic.cpp.

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

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

750 {
751  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
752  wxString mask = wxT( "*." ) + ext;
753 
754 
755  wxString path = GetMruPath();
756  wxFileName fn( aDefaultShortname );
757  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
758 
759  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
760  path,
761  fn.GetFullPath(),
762  ext,
763  mask,
764  this,
765  wxFD_OPEN,
766  true );
767 
768  if( filename.IsEmpty() )
769  return;
770 
771  ::ReadHotkeyConfigFile( filename, aDescList, false );
772  WriteHotkeyConfig( aDescList );
773  SetMruPath( wxFileName( filename ).GetPath() );
774 }
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 706 of file 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 EDA_DRAW_FRAME::HandleBlockBegin().

707 {
710 }
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
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 175 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().

175 { 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 1492 of file 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().

1493 {
1494  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1495 
1496  if( !screen )
1497  return false;
1498 
1499  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1500  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1501 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
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
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
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 158 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop.

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

159 {
160  return !m_modal_loop;
161 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:248
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 895 of file draw_frame.h.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_LAYER_WIDGET::AreArbitraryColorsAllowed(), PCB_EDIT_FRAME::Check_All_Zones(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_EDIT_FRAME::Edit_Zone_Params(), EVT_TOOL(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_BASE_FRAME::FocusOnLocation(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), EDA_DRAW_FRAME::GetCrossHairPosition(), 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(), FOOTPRINT_VIEWER_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(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_DRC_CONTROL::OnPopupMenu(), PCB_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), GERBER_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnSelectGrid(), GERBVIEW_FRAME::OnSelectHighlightChoice(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), EDA_DRAW_FRAME::OnSelectZoom(), EDA_DRAW_FRAME::OnToggleGridState(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), GERBVIEW_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateOptToolbar(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_FRAME::RedrawScreen2(), Refresh(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetNoToolSelected(), GERBVIEW_FRAME::SetPageSettings(), EDA_DRAW_FRAME::SetToolID(), DIALOG_SET_GRID::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), EDA_DRAW_FRAME::WriteHotkeyConfig(), and EDA_DRAW_FRAME::Zoom_Automatique().

895 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:75
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 547 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().

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

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), 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(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), 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(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), 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(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), 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:85
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 179 of file kiway_player.cpp.

References KIWAY_PLAYER::KiwayMailIn().

180 {
181  // logging support
182  KiwayMailIn( aEvent ); // call the virtual, override in derived.
183 }
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 SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 73 of file kiway_player.cpp.

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

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

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

Definition at line 186 of file kiway_player.cpp.

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

187 {
188  int id = event.GetId();
189 
190  // tell all the KIWAY_PLAYERs about the language change.
191  Kiway().SetLanguage( id );
192 }
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
wxString EDA_DRAW_FRAME::LengthDoubleToString ( double  aValue,
bool  aConvertToMils = false 
) const
inherited

Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting.

Parameters
aValueThe coordinate to convert.
aConvertToMilsConvert inch values to mils if true. This setting has no effect if the current user unit is millimeters.
Returns
The converted string for display in user interface elements.

Definition at line 875 of file draw_frame.cpp.

References LengthDoubleToString().

876 {
877  return ::LengthDoubleToString( aValue, aConvertToMils );
878 }
wxString LengthDoubleToString(double aValue, bool aConvertToMils)
Function LengthDoubleToString is a helper to convert the double length aValue to a string in inches...
Definition: base_units.cpp:123
EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::loadCanvasTypeSetting ( ) const
protectedinherited

Returns the canvas type stored in the application settings.

Definition at line 1248 of file draw_frame.cpp.

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

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME().

1249 {
1251  wxConfigBase* cfg = Kiface().KifaceSettings();
1252 
1253  if( cfg )
1254  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE) cfg->ReadLong( CANVAS_TYPE_KEY,
1256 
1257  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
1258  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1259  {
1260  assert( false );
1261  canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
1262  }
1263 
1264  return canvasType;
1265 }
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
static const wxChar CANVAS_TYPE_KEY[]
Key in KifaceSettings to store the canvas type.
Definition: draw_frame.h:212
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 659 of file viewlib_frame.cpp.

References CMPLIST_WIDTH_KEY, CMPVIEW_SHOW_PINELECTRICALTYPE_KEY, GetLayerColor(), LAYER_SCHEMATIC_BACKGROUND, LAYER_SCHEMATIC_GRID, LIBLIST_WIDTH_KEY, EDA_DRAW_FRAME::LoadSettings(), m_cmpListWidth, EDA_BASE_FRAME::m_FrameSize, m_libListWidth, m_showPinElectricalTypeName, SCH_BASE_FRAME::SetDrawBgColor(), and EDA_DRAW_FRAME::SetGridColor().

Referenced by LIB_VIEW_FRAME().

660 {
662 
665 
666  aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
667  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
668  aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
670 
671  // Set parameters to a reasonable value.
672  if( m_libListWidth > m_FrameSize.x/2 )
674 
675  if( m_cmpListWidth > m_FrameSize.x/2 )
677 }
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:534
#define LIBLIST_WIDTH_KEY
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
bool m_showPinElectricalTypeName
the option to show the pin electrical name in the component editor
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:760
#define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY
void SetDrawBgColor(COLOR4D aColor) override
#define CMPLIST_WIDTH_KEY
bool EDA_DRAW_FRAME::LockFile ( const wxString &  aFileName)
inherited

Function LockFile marks 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 260 of file draw_frame.cpp.

References EDA_DRAW_FRAME::m_file_checker.

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

261 {
262  m_file_checker = ::LockFile( aFileName );
263 
264  return bool( m_file_checker );
265 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:87
bool LockFile(const wxString &aFileName)
Function LockFile marks a schematic file as being in use.
Definition: draw_frame.cpp:260
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 697 of file viewlib_frame.cpp.

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

Referenced by SetShowElectricalType().

698 {
700 
701  bool changed = m_libList ? ReCreateListLib() : false;
702 
703  if (changed)
704  m_selection_changed = true;
705 
706  DisplayLibInfos();
707 }
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
wxListBox * m_libList
bool ReCreateListLib()
Creates or recreates a sorted list of currently loaded libraries.
virtual void OnActivate(wxActivateEvent &event)
Function OnActivate (virtual) is called when activating the frame.
Definition: draw_frame.cpp:282
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

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

238 {
239  if( !doAutoSave() )
240  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
241 }
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 KIWAY_PLAYER::OnChangeIconsOptions ( wxCommandEvent &  event)
overrideprotectedvirtualinherited

Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection.

Reimplemented from EDA_BASE_FRAME.

Definition at line 195 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), EDA_BASE_FRAME::OnChangeIconsOptions(), and KIWAY::ShowChangedIcons().

196 {
199 }
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
virtual void OnChangeIconsOptions(wxCommandEvent &event)
Function OnChangeIconsOptions Selects the current icons options in menus (or toolbars) in Kicad (the ...
VTBL_ENTRY void ShowChangedIcons()
Function ShowChangedIcons Calls ShowChangedIcons() on all KIWAY_PLAYERs.
Definition: kiway.cpp:431
void EDA_DRAW_FRAME::OnCharHook ( wxKeyEvent &  event)
virtualinherited

this function 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 245 of file draw_frame.cpp.

References dump(), and kicadTraceKeyEvent.

246 {
247  wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_FRAME::OnCharHook %s", dump( event ) );
248  // Key events can be filtered here.
249  // Currently no filtering is made.
250  event.Skip();
251 }
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 325 of file viewlib_frame.cpp.

References KIWAY_PLAYER::Destroy(), KIWAY_PLAYER::DismissModal(), KIWAY_PLAYER::IsDismissed(), and KIWAY_PLAYER::IsModal().

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...
bool IsModal()
Definition: kiway_player.h:217
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void SCH_BASE_FRAME::OnConfigurePaths ( wxCommandEvent &  aEvent)
inherited

Definition at line 264 of file sch_base_frame.cpp.

References PGM_BASE::ConfigurePaths(), and Pgm().

Referenced by add_search_paths(), and LIB_EDIT_FRAME::LIB_EDIT_FRAME().

265 {
266  Pgm().ConfigurePaths( this );
267 }
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
VTBL_ENTRY void ConfigurePaths(wxWindow *aParent=NULL)
Function ConfigurePaths.
Definition: pgm_base.cpp:970
void SCH_BASE_FRAME::OnEditSymbolLibTable ( wxCommandEvent &  aEvent)
virtualinherited

Reimplemented in LIB_EDIT_FRAME.

Definition at line 270 of file sch_base_frame.cpp.

References KIWAY::ExpressMail(), FRAME_SCH, FRAME_SCH_LIB_EDITOR, FRAME_SCH_VIEWER, SYMBOL_LIB_TABLE::GetGlobalLibTable(), KIWAY_HOLDER::Kiway(), MAIL_SCH_REFRESH, KIWAY::Player(), KIWAY_HOLDER::Prj(), ReCreateListLib(), and SCH_BASE_FRAME::saveSymbolLibTables().

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

271 {
273  Prj().SchSymbolLibTable() );
274 
275  if( dlg.ShowModal() == wxID_CANCEL )
276  return;
277 
278  saveSymbolLibTables( true, true );
279 
281 
282  if( this == editor )
283  {
284  // There may be no parent window so use KIWAY message to refresh the schematic editor
285  // in case any symbols have changed.
286  Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_REFRESH, std::string( "" ), this );
287  }
288 
289  LIB_VIEW_FRAME* viewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
290 
291  if( viewer )
292  viewer->ReCreateListLib();
293 }
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
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
Symbol library viewer main window.
Definition: viewlib_frame.h:49
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:386
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
The the schematic editor to refresh the display.
Definition: mail_type.h:49
The symbol library editor main window.
bool ReCreateListLib()
Creates or recreates a sorted list of currently loaded libraries.
Dialog to show and edit symbol library tables.
void EDA_DRAW_FRAME::OnEraseBackground ( wxEraseEvent &  SizeEvent)
inherited
bool LIB_VIEW_FRAME::OnHotKey ( wxDC *  aDC,
int  aHotKey,
const wxPoint aPosition,
EDA_ITEM aItem = NULL 
)
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 879 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().

880 {
881  if( aHotKey == 0 )
882  return false;
883 
884  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
885  cmd.SetEventObject( this );
886 
887  /* Convert lower to upper case (the usual toupper function has problem with non ascii
888  * codes like function keys */
889  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
890  aHotKey += 'A' - 'a';
891 
893 
894  if( HK_Descr == NULL )
895  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
896 
897  if( HK_Descr == NULL )
898  return false;
899 
900  switch( HK_Descr->m_Idcommand )
901  {
902  default:
903  case HK_NOT_FOUND:
904  return false;
905 
906  case HK_HELP: // Display Current hotkey list
908  break;
909 
910  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
912  break;
913 
914  case HK_LEFT_CLICK:
915  OnLeftClick( aDC, aPosition );
916  break;
917 
918  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
919  OnLeftClick( aDC, aPosition );
920  OnLeftDClick( aDC, aPosition );
921  break;
922 
923  case HK_ZOOM_IN:
924  cmd.SetId( ID_KEY_ZOOM_IN );
925  GetEventHandler()->ProcessEvent( cmd );
926  break;
927 
928  case HK_ZOOM_OUT:
929  cmd.SetId( ID_KEY_ZOOM_OUT );
930  GetEventHandler()->ProcessEvent( cmd );
931  break;
932 
933  case HK_ZOOM_REDRAW:
934  cmd.SetId( ID_ZOOM_REDRAW );
935  GetEventHandler()->ProcessEvent( cmd );
936  break;
937 
938  case HK_ZOOM_CENTER:
939  cmd.SetId( ID_POPUP_ZOOM_CENTER );
940  GetEventHandler()->ProcessEvent( cmd );
941  break;
942 
943  case HK_ZOOM_AUTO:
944  cmd.SetId( ID_ZOOM_PAGE );
945  GetEventHandler()->ProcessEvent( cmd );
946  break;
947  }
948 
949  return true;
950 }
SCH_SCREEN * GetScreen() const override
Function GetScreen returns 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)
Definition: draw_frame.cpp:547
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition 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 291 of file draw_frame.cpp.

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

292 {
293  if( m_canvas )
294  m_canvas->SetCanStartBlock( -1 );
295 
296  event.Skip();
297 }
void SetCanStartBlock(int aStartBlock)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
void EDA_DRAW_FRAME::OnMouseEvent ( wxMouseEvent &  event)
inherited

Definition at line 541 of file draw_frame.cpp.

542 {
543  event.Skip();
544 }
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 105 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().

106 {
107  LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true );
108 
109  viewlibFrame->PushPreferences( m_canvas );
110 
111  // On Windows, Raise() does not bring the window on screen, when iconized
112  if( viewlibFrame->IsIconized() )
113  viewlibFrame->Iconize( false );
114 
115  viewlibFrame->Show( true );
116  viewlibFrame->Raise();
117 }
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)
Function PushPreferences Pushes a few preferences from a parent window to a child window...
Definition: draw_frame.cpp:864
Symbol library viewer main window.
Definition: viewlib_frame.h:49
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:106
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 456 of file draw_frame.cpp.

References EDA_DRAW_FRAME::GetToolManager(), ID_POPUP_GRID_LEVEL_100, ID_POPUP_GRID_LEVEL_1000, EDA_DRAW_FRAME::IsGalCanvasActive(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_gridSelectBox, EDA_DRAW_PANEL::Refresh(), TOOL_MANAGER::RunAction(), and EDA_DRAW_FRAME::SetPresetGrid().

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

457 {
458  int* clientData;
459  int eventId = ID_POPUP_GRID_LEVEL_100;
460 
461  if( event.GetEventType() == wxEVT_CHOICE )
462  {
463  if( m_gridSelectBox == NULL ) // Should not happen
464  return;
465 
466  /*
467  * Don't use wxCommandEvent::GetClientData() here. It always
468  * returns NULL in GTK. This solution is not as elegant but
469  * it works.
470  */
471  int index = m_gridSelectBox->GetSelection();
472  wxASSERT( index != wxNOT_FOUND );
473  clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
474 
475  if( clientData != NULL )
476  eventId = *clientData;
477  }
478  else
479  {
480  eventId = event.GetId();
481  }
482 
483  int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
484 
485  // Notify GAL
486  TOOL_MANAGER* mgr = GetToolManager();
487 
488  if( mgr && IsGalCanvasActive() )
489  {
490  mgr->RunAction( "common.Control.gridPreset", true, idx );
491  }
492  else
493  SetPresetGrid( idx );
494 
495  m_canvas->Refresh();
496 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
wxChoice * m_gridSelectBox
Choice box to choose the grid size.
Definition: draw_frame.h:132
Class TOOL_MANAGER.
Definition: tool_manager.h:49
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:895
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:669
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:910
void LIB_VIEW_FRAME::onSelectNextSymbol ( wxCommandEvent &  aEvent)
private

Definition at line 91 of file viewlibs.cpp.

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

Referenced by SetShowElectricalType().

92 {
93  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
94  int ii = m_cmpList->GetSelection();
95 
96  // Select the next symbol or stop at the end of the list.
97  if( ii != wxNOT_FOUND || ii != (int)m_cmpList->GetCount() - 1 )
98  ii += 1;
99 
100  m_cmpList->SetSelection( ii );
101  ProcessEvent( evt );
102 }
wxListBox * m_cmpList
bool ProcessEvent(wxEvent &aEvent) override
Function ProcessEvent overrides the default process event handler to implement the auto save feature...
void EDA_BASE_FRAME::OnSelectPreferredEditor ( wxCommandEvent &  event)
virtualinherited

Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ...

) The full filename editor is saved in configuration (global params)

Definition at line 510 of file eda_base_frame.cpp.

References PGM_BASE::AskUserForPreferredEditor(), PGM_BASE::GetEditorName(), Pgm(), and PGM_BASE::SetEditorName().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

511 {
512  // Ask for the current editor and instruct GetEditorName() to not show
513  // unless we pass false as argument.
514  wxString editorname = Pgm().GetEditorName( false );
515 
516  // Ask the user to select a new editor, but suggest the current one as the default.
517  editorname = Pgm().AskUserForPreferredEditor( editorname );
518 
519  // If we have a new editor name request it to be copied to m_editor_name and saved
520  // to the preferences file. If the user cancelled the dialog then the previous
521  // value will be retained.
522  if( !editorname.IsEmpty() )
523  Pgm().SetEditorName( editorname );
524 }
VTBL_ENTRY void SetEditorName(const wxString &aFileName)
Definition: pgm_base.cpp:330
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
VTBL_ENTRY const wxString AskUserForPreferredEditor(const wxString &aDefaultEditor=wxEmptyString)
Shows a dialog that instructs the user to select a new preferred editor.
Definition: pgm_base.cpp:375
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:338
void LIB_VIEW_FRAME::onSelectPreviousSymbol ( wxCommandEvent &  aEvent)
private

Definition at line 105 of file viewlibs.cpp.

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

Referenced by SetShowElectricalType().

106 {
107  wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
108  int ii = m_cmpList->GetSelection();
109 
110  // Select the previous symbol or stop at the beginning of list.
111  if( ii != wxNOT_FOUND && ii != 0 )
112  ii -= 1;
113 
114  m_cmpList->SetSelection( ii );
115  ProcessEvent( evt );
116 }
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)
Todo:
: The unit selection gets reset to 1 by SetSelectedComponent() so the unit selection feature of the choose symbol dialog doesn't work.

Definition at line 44 of file viewlibs.cpp.

References CMP_TREE_MODEL_ADAPTER::Create(), empty(), DIALOG_CHOOSE_COMPONENT::g_Mutex, LIB_TABLE::GetLogicalLibs(), DIALOG_CHOOSE_COMPONENT::GetSelectedLibId(), m_convert, m_entryName, m_libraryName, m_unit, KIWAY_HOLDER::Prj(), SetSelectedComponent(), SetSelectedLibrary(), DIALOG_SHIM::ShowQuasiModal(), and EDA_DRAW_FRAME::Zoom_Automatique().

45 {
46  std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock );
47  wxString dialogTitle;
48  SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
49 
50  // One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway.
51  if( !dialogLock.try_lock() )
52  return;
53 
54  // Container doing search-as-you-type.
55  auto adapter( CMP_TREE_MODEL_ADAPTER::Create( libs ) );
56 
57  const auto libNicknames = libs->GetLogicalLibs();
58 
59  adapter->AddLibrariesWithProgress( libNicknames, this );
60 
61  dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ),
62  adapter->GetComponentsCount() );
63  DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert, false, false );
64 
65  if( dlg.ShowQuasiModal() == wxID_CANCEL )
66  return;
67 
70  LIB_ID id = dlg.GetSelectedLibId( &m_unit );
71 
72  if( !id.IsValid() || id.GetLibNickname().empty() )
73  return;
74 
75  if( m_libraryName == id.GetLibNickname() )
76  {
77  if( m_entryName != id.GetLibItemName() )
78  SetSelectedComponent( id.GetLibItemName() );
79  }
80  else
81  {
82  m_entryName = id.GetLibItemName();
83  SetSelectedLibrary( id.GetLibNickname() );
84  SetSelectedComponent( id.GetLibItemName() );
85  }
86 
87  Zoom_Automatique( false );
88 }
static int m_unit
static int m_convert
static wxString m_entryName
static wxString m_libraryName
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.
static PTR Create(SYMBOL_LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
Dialog class to select a component from the libraries.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:106
static bool empty(const wxTextEntryBase *aCtrl)
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 133 of file viewlibs.cpp.

References ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, EDA_DRAW_FRAME::m_canvas, m_convert, and EDA_DRAW_PANEL::Refresh().

Referenced by SetShowElectricalType().

134 {
135  int id = aEvent.GetId();
136 
137  switch( id )
138  {
139  default:
141  m_convert = 1;
142  break;
143 
145  m_convert = 2;
146  break;
147  }
148 
149  m_canvas->Refresh();
150 }
static int m_convert
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
void LIB_VIEW_FRAME::onSelectSymbolUnit ( wxCommandEvent &  aEvent)
private

Definition at line 153 of file viewlibs.cpp.

References EDA_DRAW_FRAME::m_canvas, m_selpartBox, m_unit, and EDA_DRAW_PANEL::Refresh().

Referenced by SetShowElectricalType().

154 {
155  int ii = m_selpartBox->GetCurrentSelection();
156 
157  if( ii < 0 )
158  return;
159 
160  m_unit = ii + 1;
161  m_canvas->Refresh();
162 }
static int m_unit
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:106
wxComboBox * m_selpartBox
void EDA_DRAW_FRAME::OnSelectUnits ( wxCommandEvent &  aEvent)
inherited

Definition at line 351 of file draw_frame.cpp.

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

352 {
353  if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES )
354  {
357  }
358  else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES )
359  {
360  g_UserUnit = INCHES;
362  }
363 }
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:123
Definition: common.h:146
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:268
void EDA_DRAW_FRAME::OnSelectZoom ( wxCommandEvent &  event)
virtualinherited

Functions OnSelectZoom sets 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 499 of file 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().

500 {
501  if( m_zoomSelectBox == NULL )
502  return; // Should not happen!
503 
504  int id = m_zoomSelectBox->GetCurrentSelection();
505 
506  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
507  return;
508 
509  if( id == 0 ) // Auto zoom (Fit in Page)
510  {
511  Zoom_Automatique( true );
512  }
513  else
514  {
515  double selectedZoom = GetScreen()->m_ZoomList[id-1];
516 
517  if( GetScreen()->GetZoom() == selectedZoom )
518  return;
519 
520  GetScreen()->SetZoom( selectedZoom );
522  }
523 
524  // Notify GAL
525  TOOL_MANAGER* mgr = GetToolManager();
526 
527  if( mgr && IsGalCanvasActive() )
528  {
529  mgr->RunAction( "common.Control.zoomPreset", true, id );
530  UpdateStatusBar();
531  }
532 }
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
Class TOOL_MANAGER.
Definition: tool_manager.h:49
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:106
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:369
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:135
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:535
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:895
bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:910
virtual void UpdateStatusBar()
Function UpdateStatusBar updates the status bar information.
Definition: draw_frame.cpp:724
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
void LIB_VIEW_FRAME::OnSetRelativeOffset ( wxCommandEvent &  event)