KiCad PCB EDA Suite
GERBVIEW_FRAME Class Reference

#include <gerbview_frame.h>

Inheritance diagram for GERBVIEW_FRAME:
EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

Public Member Functions

const GBR_DISPLAY_OPTIONSGetDisplayOptions () const
 Function GetDisplayOptions returns the display options current in use. More...
 
void SetDisplayOptions (const GBR_DISPLAY_OPTIONS &aOptions)
 
void SetLayout (GBR_LAYOUT *aLayout)
 Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous GBR_LAYOUT. More...
 
GBR_LAYOUTGetGerberLayout () const
 
GERBER_FILE_IMAGE_LISTGetImagesList () const
 Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data. More...
 
GERBER_FILE_IMAGEGetGbrImage (int aIdx) const
 
unsigned ImagesMaxCount () const
 The max number of file images. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPointGetGridOrigin () const override
 Return the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
int SelectPCBLayer (int aDefaultLayer, int aOpperLayerCount, bool aNullLayer=false)
 Install the dialog box for layer selection. More...
 
virtual void SetGridColor (COLOR4D aColor) override
 

More...
 
const BOX2I GetDocumentExtents () const override
 
 GERBVIEW_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
 ~GERBVIEW_FRAME ()
 
void OnCloseWindow (wxCloseEvent &Event)
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl) override
 Function OpenProjectFiles is abstract, and opens a project or set of files given by aFileList. More...
 
void ReCreateHToolbar () override
 
void ReCreateAuxiliaryToolbar () override
 
void ReCreateVToolbar () override
 Function ReCreateVToolbar creates or updates the right vertical toolbar. More...
 
void ReCreateOptToolbar () override
 Create or update the left vertical toolbar (option toolbar. More...
 
void ReCreateMenuBar () override
 Recreates the menu bar. More...
 
void OnUpdateSelectZoom (wxUpdateUIEvent &aEvent)
 
void UpdateStatusBar () override
 Update the status bar information. More...
 
const wxString GetZoomLevelIndicator () const override
 Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level indicator in dialogs. More...
 
int GetDisplayMode ()
 Function GetDisplayMode. More...
 
void SetDisplayMode (int aMode)
 Function SetDisplayMode. More...
 
bool IsElementVisible (int aLayerID) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (int aLayerID, bool aNewState)
 Function SetElementVisibility changes the visibility of an element category. More...
 
void SetGridVisibility (bool aVisible) override
 Function SetGridVisibility(), virtual from EDA_DRAW_FRAME It may be overloaded by derived classes. More...
 
LSET GetVisibleLayers () const
 Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSettings. More...
 
void SetVisibleLayers (LSET aLayerMask)
 Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSettings. More...
 
bool IsLayerVisible (int aLayer) const
 Function IsLayerVisible tests whether a given layer is visible. More...
 
COLOR4D GetVisibleElementColor (int aLayerID)
 Function GetVisibleElementColor returns the color of a gerber visible element. More...
 
void SetVisibleElementColor (int aLayerID, COLOR4D aColor)
 
COLOR4D GetLayerColor (int aLayer) const
 Function GetLayerColor gets a layer color for any valid layer. More...
 
void SetLayerColor (int aLayer, COLOR4D aColor)
 Function SetLayerColor changes a layer color for any valid layer. More...
 
COLOR4D GetNegativeItemsColor ()
 Function GetNegativeItemsColor. More...
 
void ReFillLayerWidget ()
 Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new gerber files. More...
 
void SetActiveLayer (int aLayer, bool doLayerWidgetUpdate=true)
 Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_LAYER_WIDGET. More...
 
int GetActiveLayer ()
 Function SetActiveLayer returns the active layer. More...
 
int getNextAvailableLayer (int aLayer=0) const
 Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the caller. More...
 
bool hasAvailableLayers () const
 
void syncLayerWidget ()
 Function syncLayerWidget updates the currently "selected" layer within the GERBER_LAYER_WIDGET. More...
 
void syncLayerBox (bool aRebuildLayerBox=false)
 Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently active layer, as defined by the return value of GetActiveLayer(). More...
 
void UpdateTitleAndInfo ()
 Function UpdateTitleAndInfo displays the short filename (if exists) of the selected layer on the caption of the main GerbView window and some other parameters Name of the layer (found in the gerber file: LN &ltname&gt command) in the status bar Name of the Image (found in the gerber file: IN &ltname&gt command) in the status bar and other data in toolbar. More...
 
void DisplayGridMsg ()
 Function DisplayGridMsg() More...
 
void LoadSettings (APP_SETTINGS_BASE *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (APP_SETTINGS_BASE *aCfg) override
 Saves common frame parameters to a configuration data file. More...
 
void OnToggleShowLayerManager (wxCommandEvent &aEvent)
 
void ShowChangedLanguage () override
 Redraw the menus and what not in current language. More...
 
void Process_Special_Functions (wxCommandEvent &event)
 
void OnSelectHighlightChoice (wxCommandEvent &event)
 Handles the changing of the highlighted component/net/attribute. More...
 
void OnSelectActiveDCode (wxCommandEvent &event)
 Function OnSelectActiveDCode Selects the active DCode for the current active layer. More...
 
void OnSelectActiveLayer (wxCommandEvent &event)
 Function OnSelectActiveLayer Selects the active layer: More...
 
void OnShowGerberSourceFile (wxCommandEvent &event)
 Function OnShowGerberSourceFile Call the preferred editor to show (and edit) the gerber source file loaded in the active layer. More...
 
void OnSelectDisplayMode (wxCommandEvent &event)
 Function OnSelectDisplayMode called on a display mode selection Mode selection can be fast display, or exact mode with stacked images or with transparency. More...
 
void OnQuit (wxCommandEvent &event)
 Function OnQuit called on request of application quit. More...
 
void OnUpdateDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectDCode (wxUpdateUIEvent &aEvent)
 
void OnUpdateLayerSelectBox (wxUpdateUIEvent &aEvent)
 
void Files_io (wxCommandEvent &event)
 
void OnGbrFileHistory (wxCommandEvent &event)
 Function OnGbrFileHistory deletes the current data and loads a Gerber file selected from history list on current layer. More...
 
void OnDrlFileHistory (wxCommandEvent &event)
 Function OnDrlFileHistory deletes the current data and load a drill file in Excellon format selected from history list on current layer. More...
 
void OnZipFileHistory (wxCommandEvent &event)
 Function OnZipFileHistory deletes the current data and load a zip archive file selected from the history list. More...
 
void OnJobFileHistory (wxCommandEvent &event)
 deletes the current data and load a gerber job file selected from the history list. More...
 
bool unarchiveFiles (const wxString &aFullFileName, REPORTER *aReporter=nullptr)
 Extracts gerber and drill files from the zip archive, and load them. More...
 
bool LoadGerberFiles (const wxString &aFileName)
 function LoadGerberFiles Load a photoplot (Gerber) file or many files. More...
 
bool Read_GERBER_File (const wxString &GERBER_FullFileName)
 
bool LoadExcellonFiles (const wxString &aFileName)
 function LoadExcellonFiles Load a drill (EXCELLON) file or many files. More...
 
bool Read_EXCELLON_File (const wxString &aFullFileName)
 
bool LoadZipArchiveFile (const wxString &aFileName)
 function LoadZipArchiveFileLoadZipArchiveFile Load a zipped archive file. More...
 
bool LoadGerberJobFile (const wxString &aFileName)
 Load a Gerber job file, and load gerber files found in job files. More...
 
void Liste_D_Codes ()
 Set Size Items (Lines, Flashes) from DCodes List. More...
 
bool Clear_DrawLayers (bool query)
 
void Erase_Current_DrawLayer (bool query)
 
void SortLayersByX2Attributes ()
 
void UpdateDisplayOptions (const GBR_DISPLAY_OPTIONS &aOptions)
 Updates the display options and refreshes the view as needed. More...
 
void ExportDataInPcbnewFormat (wxCommandEvent &event)
 
void SaveCopyInUndoList (GERBER_DRAW_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand=UR_UNSPECIFIED, const wxPoint &aTransformPoint=wxPoint(0, 0))
 
void SaveCopyInUndoList (const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
 Function SaveCopyInUndoList (overloaded). More...
 
void ActivateGalCanvas () override
 

More...
 
void InstallPreferences (PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
 Allows Gerbview to install its preferences panels into the preferences dialog. More...
 
void CommonSettingsChanged (bool aEnvVarsChanged) override
 Called after the preferences dialog is run. More...
 
void SyncToolbars () override
 Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
bool LockFile (const wxString &aFileName)
 Mark a schematic file as being in use. More...
 
void ReleaseFile ()
 Release the current file marked in use. More...
 
wxFindReplaceData & GetFindReplaceData ()
 
wxArrayString & GetFindHistoryList ()
 
bool GetShowPolarCoords () const
 For those frames that support polar coordinates. More...
 
void SetShowPolarCoords (bool aShow)
 
int GetLastGridSizeId () const
 
void SetLastGridSizeId (int aId)
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition) const
 Return the nearest aGridSize location to aPosition. More...
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
virtual COLOR_SETTINGSGetColorSettings ()
 Returns a pointer to the active color theme settings. More...
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
virtual wxString GetScreenDesc () const
 
virtual BASE_SCREENGetScreen () const
 Return a pointer to a BASE_SCREEN or one of its derivatives. More...
 
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...
 
double GetZoomLevelCoeff () const
 Return the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
virtual bool IsGridVisible () const
 
virtual COLOR4D GetGridColor ()
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnGridSettings (wxCommandEvent &event)
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Set the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnUpdateSelectGrid (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Recalculate the size of toolbars and display panel when the frame size changes. More...
 
void OnMove (wxMoveEvent &aEvent) override
 
virtual void HardRedraw ()
 Rebuild the GAL and redraws the screen. More...
 
virtual void Zoom_Automatique (bool aWarpPointer)
 Redraw the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void FocusOnLocation (const wxPoint &aPos)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void AddStandardSubMenus (TOOL_MENU &aMenu)
 Function CreateBasicMenu. More...
 
void PrintWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString, COLOR4D aColor=COLOR4D::UNSPECIFIED)
 Prints the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg) override
 
virtual void OnPageSettingsChange ()
 Called when modifying the page settings. More...
 
void DisplayUnitsMsg ()
 Display current unit pane on the status bar. 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...
 
virtual void ClearMsgPanel ()
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Clear the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Redraw the message panel. More...
 
virtual void PrintPage (wxDC *aDC)
 Print the page pointed by current screen, set by the calling print function. More...
 
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting ()
 Returns the canvas type stored in the application settings. More...
 
virtual void SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
virtual EDA_DRAW_PANEL_GALGetCanvas () const
 Return a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
void RefreshCanvas () override
 Notification to refresh the drawing canvas (if any). More...
 
void RecreateToolbars ()
 Rebuild all toolbars, and update the checked state of ckeck tools. More...
 
virtual 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 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)
 
EDA_UNITS GetUserUnits () const
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS aUnits)
 
void ChangeUserUnits (EDA_UNITS aUnits)
 
SETTINGS_MANAGERGetSettingsManager () const
 
virtual int GetSeverity (int aErrorCode) const
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void PushTool (const std::string &actionName)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const std::string &actionName)
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
bool GetDoImmediateActions () const
 Indicates that hotkeys should perform an immediate action even if another tool is currently active. More...
 
bool GetDragSelects () const
 Indicates that a drag should draw a selection rectangle, even when started over an item. More...
 
bool GetMoveWarpsCursor () const
 Indicates that a move operation should warp the mouse pointer to the origin of the move object. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Override the default process event handler to implement the auto save feature. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 Capture the key event before it is sent to the GUI. More...
 
void OnMenuOpen (wxMenuEvent &event)
 Workaround some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
virtual const SEARCH_STACKsys_search ()
 Return a SEARCH_STACK pertaining to entire program. More...
 
virtual wxString help_name ()
 
void OnKicadAbout (wxCommandEvent &event)
 
void OnPreferences (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
virtual APP_SETTINGS_BASEconfig ()
 Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
void LoadWindowSettings (WINDOW_SETTINGS *aCfg)
 Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
void SaveWindowSettings (WINDOW_SETTINGS *aCfg)
 Saves window settings to the given settings object Normally called by SaveSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window. More...
 
virtual WINDOW_SETTINGSGetWindowSettings (APP_SETTINGS_BASE *aCfg)
 Returns a pointer to the window settings for this frame. More...
 
wxString ConfigBaseName ()
 
virtual void SaveProjectSettings ()
 Save changes to the project settings to the project (.pro) file. More...
 
void ImportHotkeyConfigFromFile (std::map< std::string, TOOL_ACTION * > aActionMap, const wxString &aDefaultShortname)
 Prompt the user for a hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
 Fetches the file name from the file history list. More...
 
void ClearFileHistory (FILE_HISTORY *aFileHistory=NULL)
 Removes all files from the file history. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
 Update the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
void AddStandardHelpMenu (wxMenuBar *aMenuBar)
 Adds the standard KiCad help menu to the menubar. More...
 
bool IsWritable (const wxFileName &aFileName)
 Checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
const wxString & GetAboutTitle () const
 
void SetShutdownBlockReason (const wxString &reason)
 Sets the block reason why the window/application is preventing OS shutdown. More...
 
void RemoveShutdownBlockReason ()
 Removes any shutdown block reason set. More...
 
bool SupportsShutdownBlockReason ()
 Whether or not the window supports setting a shutdown block reason. More...
 
virtual bool IsContentModified ()
 Get if the contents of the frame have been modified since the last save. More...
 
HOLDER_TYPE GetType ()
 
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...
 

Public Attributes

wxChoice * m_SelComponentBox
 
wxChoice * m_SelNetnameBox
 
wxChoice * m_SelAperAttributesBox
 
GBR_LAYER_BOX_SELECTORm_SelLayerBox
 
DCODE_SELECTION_BOXm_DCodeSelector
 
wxTextCtrl * m_TextInfo
 

Protected Member Functions

virtual void SetScreen (BASE_SCREEN *aScreen)
 
void InitExitKey ()
 Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id. More...
 
bool LibraryFileBrowser (bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Handle the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Return the auto save status of the application. More...
 
virtual bool doAutoSave ()
 This should be overridden by the derived class to handle the auto save feature. More...
 

Static Protected Member Functions

static wxString GetBackupSuffix ()
 
static wxString GetAutoSaveFilePrefix ()
 

Protected Attributes

GERBER_LAYER_WIDGETm_LayersManager
 
FILE_HISTORY m_zipFileHistory
 
FILE_HISTORY m_drillFileHistory
 
FILE_HISTORY m_jobFileHistory
 
wxString m_lastFileName
 
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...
 
int m_LastGridSizeId
 
bool m_drawGrid
 
bool m_showPageLimits
 
COLOR4D m_gridColor
 
COLOR4D m_drawBgColor
 
double m_zoomLevelCoeff
 
int m_UndoRedoCountMax
 
bool m_PolarCoords
 
TOOL_DISPATCHERm_toolDispatcher
 
bool m_showBorderAndTitleBlock
 
long m_firstRunDialogSetting
 
wxChoice * m_gridSelectBox
 
wxChoice * m_zoomSelectBox
 
ACTION_TOOLBARm_mainToolBar
 
ACTION_TOOLBARm_auxiliaryToolBar
 
ACTION_TOOLBARm_drawToolBar
 
ACTION_TOOLBARm_optionsToolBar
 
wxFindReplaceData * m_findReplaceData
 
wxArrayString m_findStringHistoryList
 
wxArrayString m_replaceStringHistoryList
 
EDA_MSG_PANELm_messagePanel
 
int m_MsgFrameHeight
 
COLOR_SETTINGSm_colorSettings
 
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
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_AboutTitle
 
wxAuiManager m_auimgr
 
wxString m_configName
 
SETTINGS_MANAGERm_settingsManager
 
TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
bool m_dragSelects
 
bool m_moveWarpsCursor
 
bool m_hasAutoSave
 
bool m_autoSaveState
 
int m_autoSaveInterval
 
wxTimer * m_autoSaveTimer
 
wxString m_perspective
 
wxString m_mruPath
 
EDA_UNITS m_userUnits
 

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...
 

Private Member Functions

void updateComponentListSelectBox ()
 
void updateNetnameListSelectBox ()
 
void updateAperAttributesSelectBox ()
 
void updateDCodeSelectBox ()
 
void updateGridSelectBox ()
 
void updateZoomSelectBox ()
 
void unitsChangeRefresh () override
 Called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
void OnClearJobFileHistory (wxCommandEvent &aEvent)
 
void OnClearZipFileHistory (wxCommandEvent &aEvent)
 
void OnClearDrlFileHistory (wxCommandEvent &aEvent)
 
void OnClearGbrFileHistory (wxCommandEvent &aEvent)
 
void setupTools ()
 
void applyDisplaySettingsToGAL ()
 Updates the GAL with display settings changes. More...
 
bool loadListOfGerberAndDrillFiles (const wxString &aPath, const wxArrayString &aFilenameList, const std::vector< int > *aFileType=nullptr)
 Loads a list of Gerber and NC drill files and updates the view based on them. More...
 

Private Attributes

GBR_LAYOUTm_gerberLayout
 
wxPoint m_grid_origin
 
PAGE_INFO m_paper
 
GBR_DISPLAY_OPTIONS m_DisplayOptions
 
std::vector< PARAM_CFG * > m_configSettings
 
int m_displayMode
 
bool m_show_layer_manager_tools
 

Detailed Description

Definition at line 55 of file gerbview_frame.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 
SCREEN 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ GERBVIEW_FRAME()

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

Definition at line 61 of file gerbview_frame.cpp.

62  : EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition,
65  ID_GERBVIEW_ZIP_FILE_LIST_CLEAR, _( "Clear Recent Zip Files" ) ),
67  ID_GERBVIEW_DRILL_FILE_LIST_CLEAR, _( "Clear Recent Drill Files" ) ),
69  ID_GERBVIEW_JOB_FILE_LIST_CLEAR, _( "Clear Recent Job Files" ) )
70 {
72  m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1
73  // when the screen shows a 1:1 image
74  // obviously depends on the monitor,
75  // but this is an acceptable value
76 
78 
79  m_showBorderAndTitleBlock = false; // true for reference drawings.
82  m_SelComponentBox = nullptr;
83  m_SelNetnameBox = nullptr;
84  m_SelAperAttributesBox = nullptr;
85  m_displayMode = 0;
86  m_AboutTitle = "GerbView";
87 
88  SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include
89  // some methods in code and avoid link errors
90 
91  int fileHistorySize = Pgm().GetCommonSettings()->m_System.file_history_size;
92  m_drillFileHistory.SetMaxFiles( fileHistorySize );
93  m_zipFileHistory.SetMaxFiles( fileHistorySize );
94  m_jobFileHistory.SetMaxFiles( fileHistorySize );
95 
96  auto* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
99 
100  SetCanvas( galCanvas );
101 
102  // GerbView requires draw priority for rendering negative objects
103  galCanvas->GetView()->UseDrawPriority( true );
104 
105  // Give an icon
106  wxIcon icon;
107  icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
108  SetIcon( icon );
109 
110  // Be sure a page info is set. this default value will be overwritten later.
111  PAGE_INFO pageInfo( wxT( "GERBER" ) );
112  SetLayout( new GBR_LAYOUT() );
113  SetPageSettings( pageInfo );
114 
115  SetVisibleLayers( LSET::AllLayersMask() ); // All draw layers visible.
116 
117  SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
118 
119  // Create the PCB_LAYER_WIDGET *after* SetLayout():
121 
122  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
123  // initialize parameters in m_LayersManager
124  LoadSettings( config() );
125 
126  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
127 
128  if( m_LastGridSizeId < 0 )
129  m_LastGridSizeId = 0;
130 
133 
134  setupTools();
135  ReCreateMenuBar();
139 
140  m_auimgr.SetManagedWindow( this );
141 
142  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
143  m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) );
144  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
145 
146  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
147  m_auimgr.AddPane( m_LayersManager, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
148  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
149  .MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) );
150 
151  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
152 
153  ReFillLayerWidget(); // this is near end because contents establish size
154  m_auimgr.Update();
155 
156  SetActiveLayer( 0, true );
158 
160 
161  // Nudge user to switch to OpenGL if they are on legacy or Cairo
162  if( m_firstRunDialogSetting < 1 )
163  {
164  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
165  {
166  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
167  "and faster experience. This option is turned off by "
168  "default since it is not compatible with all computers.\n\n"
169  "Would you like to try enabling graphics acceleration?\n\n"
170  "If you'd like to choose later, select Accelerated Graphics "
171  "in the Preferences menu." );
172 
173  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
174 
175  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
176 
177  if( dlg.ShowModal() == wxID_YES )
178  {
179  // Save Cairo as default in case OpenGL crashes
181 
182  // Switch to OpenGL, which will save the new setting if successful
184 
185  // Switch back to Cairo if OpenGL is not supported
186  if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
188  }
189  else
190  {
191  // If they were on legacy, switch to Cairo
193  }
194  }
195 
197  SaveSettings( config() );
198  }
199 
200  SwitchCanvas( canvasType );
201 
202  // Enable the axes to match legacy draw style
203  auto& galOptions = GetGalDisplayOptions();
204  galOptions.m_axesEnabled = true;
205  galOptions.NotifyChanged();
206 
208  m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
209 
212 
213  if( GetCanvas() )
215 
216  // Update the checked state of tools
217  SyncToolbars();
218 }
GBR_LAYOUT holds list of GERBER_DRAW_ITEM currently loaded.
Definition: gbr_layout.h:47
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
ACTION_TOOLBAR * m_auxiliaryToolBar
ACTION_TOOLBAR * m_optionsToolBar
virtual void SetScreen(BASE_SCREEN *aScreen)
FILE_HISTORY m_jobFileHistory
void SetPageSettings(const PAGE_INFO &aPageSettings) override
virtual bool IsGridVisible() const
GERBER_LAYER_WIDGET * m_LayersManager
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
static TOOL_ACTION standardGraphics
Definition: actions.h:159
wxString m_AboutTitle
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_mainToolBar
#define ZOOM_FACTOR(x)
Definition: sch_screen.cpp:74
wxChoice * m_SelNetnameBox
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
void ReCreateHToolbar() override
FILE_HISTORY m_zipFileHistory
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
static TOOL_ACTION gridPreset
Definition: actions.h:134
void ReCreateAuxiliaryToolbar() override
#define NULL
SHAPE_POLY_SET.
EDA_MSG_PANEL * m_messagePanel
GAL not used (the legacy wxDC engine is used)
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
GBR_LAYOUT * m_gerberLayout
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
static LSET AllLayersMask()
Definition: lset.cpp:723
GERBER_LAYER_WIDGET is here to implement the abtract functions of LAYER_WIDGET so they may be tied in...
#define KICAD_DEFAULT_DRAWFRAME_STYLE
FILE_HISTORY m_drillFileHistory
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
#define GERBVIEW_FRAME_NAME
GERBVIEW_FRAME is the main window used in GerbView.
Specialization of the wxAuiPaneInfo class for KiCad panels.
const BITMAP_OPAQUE icon_gerbview_xpm[1]
DCODE_SELECTION_BOX * m_DCodeSelector
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
const PAGE_INFO & GetPageSettings() const override
void SetMaxFiles(size_t aMaxFiles)
Update the number of files that will be contained inside the file history.
Definition: filehistory.cpp:83
double m_zoomLevelCoeff
wxChoice * m_SelAperAttributesBox
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
#define _(s)
Definition: 3d_actions.cpp:33
#define DEFAULT_FILE_HISTORY_SIZE
IDs range for menuitems file history: The default range file history size is 9 (compatible with defau...
Definition: id.h:69
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:158
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
wxChoice * m_SelComponentBox
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void ReFillRender()
Function ReFillRender Rebuild Render for instance after the config is read.
bool m_show_layer_manager_tools
void ReCreateMenuBar() override
Recreates the menu bar.
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
virtual APP_SETTINGS_BASE * config()
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void SetLayout(GBR_LAYOUT *aLayout)
Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous G...
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
long m_firstRunDialogSetting
void ReCreateOptToolbar() override
Create or update the left vertical toolbar (option toolbar.

References _, ACTIONS::acceleratedGraphics, LSET::AllLayersMask(), PCAD2KICAD::Center, EDA_BASE_FRAME::config(), dummy(), EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, LAYER_WIDGET::GetBestSize(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), EDA_DRAW_FRAME::GetGalDisplayOptions(), GetPageSettings(), EDA_BASE_FRAME::GetToolManager(), ACTIONS::gridPreset, icon_gerbview_xpm, ID_POPUP_GRID_LEVEL_0_0_1MM, ID_POPUP_GRID_LEVEL_1000, EDA_DRAW_FRAME::IsGridVisible(), KiBitmap(), PCAD2KICAD::Left, EDA_DRAW_FRAME::LoadCanvasTypeSetting(), LoadSettings(), EDA_BASE_FRAME::m_AboutTitle, EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_auxiliaryToolBar, m_DCodeSelector, m_displayMode, m_drillFileHistory, EDA_DRAW_FRAME::m_firstRunDialogSetting, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_gerberLayout, m_jobFileHistory, EDA_DRAW_FRAME::m_LastGridSizeId, m_LayersManager, EDA_DRAW_FRAME::m_mainToolBar, EDA_DRAW_FRAME::m_messagePanel, EDA_DRAW_FRAME::m_optionsToolBar, m_SelAperAttributesBox, m_SelComponentBox, m_SelLayerBox, m_SelNetnameBox, m_show_layer_manager_tools, EDA_DRAW_FRAME::m_showBorderAndTitleBlock, m_zipFileHistory, EDA_DRAW_FRAME::m_zoomLevelCoeff, NULL, Pgm(), ReCreateAuxiliaryToolbar(), ReCreateHToolbar(), ReCreateMenuBar(), ReCreateOptToolbar(), GERBER_LAYER_WIDGET::ReFill(), ReFillLayerWidget(), GERBER_LAYER_WIDGET::ReFillRender(), PCAD2KICAD::Right, TOOL_MANAGER::RunAction(), EDA_DRAW_FRAME::saveCanvasTypeSetting(), SaveSettings(), SetActiveLayer(), EDA_DRAW_FRAME::SetCanvas(), KIGFX::GAL::SetGridVisibility(), SetLayout(), FILE_HISTORY::SetMaxFiles(), SetPageSettings(), EDA_DRAW_FRAME::SetScreen(), setupTools(), SetVisibleLayers(), ACTIONS::standardGraphics, EDA_DRAW_FRAME::SwitchCanvas(), SyncToolbars(), wxPoint::x, wxPoint::y, ZOOM_FACTOR, and ACTIONS::zoomFitScreen.

◆ ~GERBVIEW_FRAME()

GERBVIEW_FRAME::~GERBVIEW_FRAME ( )

Definition at line 221 of file gerbview_frame.cpp.

222 {
223  // Shutdown all running tools
224  if( m_toolManager )
226 
227  GetCanvas()->GetView()->Clear();
228 
230  delete m_gerberLayout;
231 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
void DeleteAllImages()
remove all loaded data in list, and delete all images.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1111
GBR_LAYOUT * m_gerberLayout
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
GBR_LAYOUT * GetGerberLayout() const
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:44
TOOL_MANAGER * m_toolManager

References KIGFX::VIEW::Clear(), GERBER_FILE_IMAGE_LIST::DeleteAllImages(), EDA_DRAW_FRAME::GetCanvas(), GetGerberLayout(), GBR_LAYOUT::GetImagesList(), EDA_DRAW_PANEL_GAL::GetView(), m_gerberLayout, EDA_BASE_FRAME::m_toolManager, and TOOL_MANAGER::ShutdownAllTools().

Member Function Documentation

◆ ActivateGalCanvas()

void GERBVIEW_FRAME::ActivateGalCanvas ( )
overridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1090 of file gerbview_frame.cpp.

1091 {
1093 
1094  EDA_DRAW_PANEL_GAL* galCanvas = GetCanvas();
1095 
1096  if( m_toolManager )
1097  {
1099  GetCanvas()->GetViewControls(), this );
1101  }
1102 
1104 
1106 
1107  galCanvas->GetView()->RecacheAllItems();
1108  galCanvas->SetEventDispatcher( m_toolDispatcher );
1109  galCanvas->StartDrawing();
1110 
1113 
1115  ReCreateMenuBar();
1116 
1117  // Update the checked state of tools
1118  SyncToolbars();
1119 }
TOOL_DISPATCHER * m_toolDispatcher
void SetPageSettings(const PAGE_INFO &aPageSettings) override
GERBER_LAYER_WIDGET * m_LayersManager
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void RecacheAllItems()
Function RecacheAllItems() Rebuilds GAL display lists.
Definition: view.cpp:1402
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
GBR_LAYOUT * m_gerberLayout
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
const PAGE_INFO & GetPageSettings() const override
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.
COLOR4D GetLayerColor(int aLayer) const
Function GetLayerColor gets a layer color for any valid layer.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, EDA_BASE_FRAME *aFrame)
Sets the work environment (model, view, view controls and the parent window).
TOOL_MANAGER * m_toolManager
void ReFillRender()
Function ReFillRender Rebuild Render for instance after the config is read.
void ReCreateMenuBar() override
Recreates the menu bar.
Rendering engine changes.
Definition: tool_base.h:82
void ReCreateOptToolbar() override
Create or update the left vertical toolbar (option toolbar.

References EDA_DRAW_FRAME::ActivateGalCanvas(), TOOL_BASE::GAL_SWITCH, EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), GetLayerColor(), GetPageSettings(), EDA_DRAW_PANEL_GAL::GetView(), LAYER_GERBVIEW_GRID, m_gerberLayout, m_LayersManager, EDA_DRAW_FRAME::m_toolDispatcher, EDA_BASE_FRAME::m_toolManager, KIGFX::VIEW::RecacheAllItems(), ReCreateMenuBar(), ReCreateOptToolbar(), GERBER_LAYER_WIDGET::ReFill(), GERBER_LAYER_WIDGET::ReFillRender(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::SetEnvironment(), EDA_DRAW_PANEL_GAL::SetEventDispatcher(), KIGFX::GAL::SetGridColor(), SetPageSettings(), EDA_DRAW_PANEL_GAL::StartDrawing(), and SyncToolbars().

◆ AddStandardHelpMenu()

void EDA_BASE_FRAME::AddStandardHelpMenu ( wxMenuBar *  aMenuBar)
inherited

Adds the standard KiCad help menu to the menubar.

Definition at line 397 of file eda_base_frame.cpp.

398 {
399  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
400  ACTION_MENU* helpMenu = new ACTION_MENU( false );
401 
402  helpMenu->SetTool( commonControl );
403 
404  helpMenu->Add( ACTIONS::help );
405  helpMenu->Add( ACTIONS::gettingStarted );
406  helpMenu->Add( ACTIONS::listHotKeys );
407  helpMenu->Add( ACTIONS::getInvolved );
408 
409  helpMenu->AppendSeparator();
410  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
411 
412  aMenuBar->Append( helpMenu, _( "&Help" ) );
413 }
static TOOL_ACTION listHotKeys
Definition: actions.h:171
ACTION_MENU.
Definition: action_menu.h:43
const BITMAP_OPAQUE about_xpm[1]
Definition: about.cpp:84
COMMON_CONTROL.
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION help
Definition: actions.h:170
TOOL_MANAGER * m_toolManager
static TOOL_ACTION getInvolved
Definition: actions.h:172
static TOOL_ACTION gettingStarted
Definition: actions.h:169

References _, about_xpm, ACTIONS::getInvolved, ACTIONS::gettingStarted, TOOL_MANAGER::GetTool(), ACTIONS::help, ACTIONS::listHotKeys, and EDA_BASE_FRAME::m_toolManager.

Referenced by EDA_3D_VIEWER::CreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), LIB_VIEW_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), CVPCB_MAINFRAME::ReCreateMenuBar(), ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), and PCB_EDIT_FRAME::ReCreateMenuBar().

◆ AddStandardSubMenus()

void EDA_DRAW_FRAME::AddStandardSubMenus ( TOOL_MENU aMenu)
inherited

Function CreateBasicMenu.

Construct a "basic" menu for a tool, containing only items that apply to all tools (e.g. zoom and grid)

Definition at line 338 of file eda_draw_frame.cpp.

339 {
340  COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
341  CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
342 
343  aMenu.AddSeparator( 1000 );
345  aMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 );
346  aMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways, 1000 );
348 
349  aMenu.AddSeparator( 1000 );
350 
351  auto zoomMenu = std::make_shared<ZOOM_MENU>( this );
352  zoomMenu->SetTool( commonTools );
353  aToolMenu.AddSubMenu( zoomMenu );
354 
355  auto gridMenu = std::make_shared<GRID_MENU>( this );
356  gridMenu->SetTool( commonTools );
357  aToolMenu.AddSubMenu( gridMenu );
358 
359  aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
360  aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
361 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
COMMON_TOOLS.
Definition: common_tools.h:38
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
static TOOL_ACTION zoomCenter
Definition: actions.h:92
static TOOL_ACTION zoomIn
Definition: actions.h:88
static TOOL_ACTION zoomOut
Definition: actions.h:89
TOOL_MANAGER * m_toolManager

References CONDITIONAL_MENU::AddSeparator(), TOOL_MENU::AddSubMenu(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), EDA_BASE_FRAME::m_toolManager, SELECTION_CONDITIONS::ShowAlways(), ACTIONS::zoomCenter, ACTIONS::zoomFitScreen, ACTIONS::zoomIn, and ACTIONS::zoomOut.

Referenced by PICKER_TOOL::Init(), EE_SELECTION_TOOL::Init(), SELECTION_TOOL::Init(), and EDIT_TOOL::Init().

◆ AppendMsgPanel()

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 518 of file eda_draw_frame.cpp.

520 {
521  if( m_messagePanel )
522  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
523 }
int color
Definition: DXF_plotter.cpp:61
EDA_MSG_PANEL * m_messagePanel
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

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

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_PRINTOUT::OnPrintPage(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ applyDisplaySettingsToGAL()

void GERBVIEW_FRAME::applyDisplaySettingsToGAL ( )
private

Updates the GAL with display settings changes.

Definition at line 432 of file gerbview_frame.cpp.

433 {
434  auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
435  KIGFX::GERBVIEW_RENDER_SETTINGS* settings = painter->GetSettings();
438 
440 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
SETTINGS_MANAGER * GetSettingsManager() const
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
GBR_DISPLAY_OPTIONS m_DisplayOptions
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
GERBVIEW_RENDER_SETTINGS Stores GerbView specific render settings.
void LoadColors(const COLOR_SETTINGS *aSettings) override
virtual COLOR_SETTINGS * GetColorSettings()
Returns a pointer to the active color theme settings.
void LoadDisplayOptions(const GBR_DISPLAY_OPTIONS &aOptions)
Function LoadDisplayOptions Loads settings related to display options.

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetColorSettings(), EDA_BASE_FRAME::GetSettingsManager(), EDA_DRAW_PANEL_GAL::GetView(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadColors(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions(), m_DisplayOptions, KIGFX::VIEW::MarkTargetDirty(), Pgm(), and KIGFX::TARGET_NONCACHED.

Referenced by SetElementVisibility(), SetLayerColor(), and UpdateDisplayOptions().

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS  aUnits)
inlineinherited

Definition at line 225 of file eda_base_frame.h.

226  {
227  SetUserUnits( aUnits );
229  }
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void SetUserUnits(EDA_UNITS aUnits)

References EDA_BASE_FRAME::SetUserUnits(), and EDA_BASE_FRAME::unitsChangeRefresh().

Referenced by COMMON_TOOLS::ImperialUnits(), COMMON_TOOLS::MetricUnits(), and COMMON_TOOLS::ToggleUnits().

◆ CheckForAutoSaveFile()

void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName)
inherited

Check 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.

Definition at line 735 of file eda_base_frame.cpp.

736 {
737  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
738 
739  wxFileName autoSaveFileName = aFileName;
740 
741  // Check for auto save file.
742  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
743 
744  wxLogTrace( traceAutoSave,
745  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
746 
747  if( !autoSaveFileName.FileExists() )
748  return;
749 
750  wxString msg = wxString::Format( _(
751  "Well this is potentially embarrassing!\n"
752  "It appears that the last time you were editing the file\n"
753  "\"%s\"\n"
754  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
755  GetChars( aFileName.GetFullName() )
756  );
757 
758  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
759 
760  // Make a backup of the current file, delete the file, and rename the auto save file to
761  // the file name.
762  if( response == wxYES )
763  {
764  // Get the backup file name.
765  wxFileName backupFileName = aFileName;
766  backupFileName.SetExt( aFileName.GetExt() + GetBackupSuffix() );
767 
768  // If an old backup file exists, delete it. If an old copy of the file exists, rename
769  // it to the backup file name
770  if( aFileName.FileExists() )
771  {
772  // Rename the old file to the backup file name.
773  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath(), true ) )
774  {
775  msg.Printf( _( "Could not create backup file \"%s\"" ),
776  GetChars( backupFileName.GetFullPath() ) );
777  wxMessageBox( msg );
778  }
779  }
780 
781  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
782  {
783  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
784  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
785  }
786  }
787  else
788  {
789  wxLogTrace( traceAutoSave,
790  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
791 
792  // Remove the auto save file when using the previous file as is.
793  wxRemoveFile( autoSaveFileName.GetFullPath() );
794  }
795 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
static wxString GetBackupSuffix()
static wxString GetAutoSaveFilePrefix()
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:101
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), EDA_BASE_FRAME::GetAutoSaveFilePrefix(), EDA_BASE_FRAME::GetBackupSuffix(), GetChars(), Pgm(), and traceAutoSave.

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

◆ Clear_DrawLayers()

bool GERBVIEW_FRAME::Clear_DrawLayers ( bool  query)

Definition at line 39 of file clear_gbr_drawlayers.cpp.

40 {
41  if( GetGerberLayout() == NULL )
42  return false;
43 
44  if( query && GetScreen()->IsModify() )
45  {
46  if( !IsOK( this, _( "Current data will be lost?" ) ) )
47  return false;
48  }
49 
50  if( GetCanvas() )
51  {
52  if( m_toolManager )
54 
55  GetCanvas()->GetView()->Clear();
56 
57  // Reinit the worksheet view, cleared by GetView()->Clear():
59  }
60 
62 
64 
65  SetActiveLayer( 0 );
67  syncLayerBox();
68  return true;
69 }
void DeleteAllImages()
remove all loaded data in list, and delete all images.
Model changes (required full reload)
Definition: tool_base.h:81
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
void SetPageSettings(const PAGE_INFO &aPageSettings) override
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
void SetBoundingBox(const EDA_RECT &aBox)
Definition: gbr_layout.h:88
#define NULL
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1111
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
GBR_LAYOUT * GetGerberLayout() const
const PAGE_INFO & GetPageSettings() const override
#define _(s)
Definition: 3d_actions.cpp:33
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
TOOL_MANAGER * m_toolManager
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...

References _, KIGFX::VIEW::Clear(), GERBER_FILE_IMAGE_LIST::DeleteAllImages(), EDA_DRAW_FRAME::GetCanvas(), GetGerberLayout(), GetImagesList(), GetPageSettings(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_PANEL_GAL::GetView(), IsOK(), EDA_BASE_FRAME::m_toolManager, TOOL_BASE::MODEL_RELOAD, NULL, ReFillLayerWidget(), TOOL_MANAGER::ResetTools(), SetActiveLayer(), GBR_LAYOUT::SetBoundingBox(), SetPageSettings(), and syncLayerBox().

Referenced by Files_io(), and LoadGerberJobFile().

◆ ClearFileHistory()

void EDA_BASE_FRAME::ClearFileHistory ( FILE_HISTORY aFileHistory = NULL)
inherited

Removes all files from the file history.

Parameters
aFileHistoryThe FILE_HISTORY in use. If null, the main application file history is used

Definition at line 643 of file eda_base_frame.cpp.

644 {
645  if( !aFileHistory )
646  aFileHistory = &Kiface().GetFileHistory();
647 
648  aFileHistory->ClearFileHistory();
649 }
void ClearFileHistory()
Clear all entries from the file history.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:125

References FILE_HISTORY::ClearFileHistory(), KIFACE_I::GetFileHistory(), and Kiface().

Referenced by OnClearDrlFileHistory(), KICAD_MANAGER_FRAME::OnClearFileHistory(), PCB_EDIT_FRAME::OnClearFileHistory(), SCH_EDIT_FRAME::OnClearFileHistory(), OnClearGbrFileHistory(), OnClearJobFileHistory(), and OnClearZipFileHistory().

◆ ClearMsgPanel()

◆ CommonSettingsChanged()

void GERBVIEW_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1232 of file gerbview_frame.cpp.

1233 {
1234  EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
1235 
1236  RecreateToolbars();
1237  Layout();
1238  SendSizeEvent();
1239 }
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of ckeck tools.
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.

References EDA_DRAW_FRAME::CommonSettingsChanged(), and EDA_DRAW_FRAME::RecreateToolbars().

◆ config()

APP_SETTINGS_BASE * EDA_BASE_FRAME::config ( )
virtualinherited

Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 572 of file eda_base_frame.cpp.

573 {
574  // KICAD_MANAGER_FRAME overrides this
576  //wxASSERT( ret );
577  return ret;
578 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:75
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), SCH_EDIT_FRAME::SaveProject(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_BASE_FRAME::windowClosing(), and BM2CMP_FRAME::~BM2CMP_FRAME().

◆ ConfigBaseName()

wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited
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, except for frames shown in multiple modes in which case the m_configName must be set to the base name so that a single config can be used.

Definition at line 379 of file eda_base_frame.h.

380  {
381  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
382  return baseCfgName;
383  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by EDA_DRAW_FRAME::LoadSettings(), EDA_BASE_FRAME::SaveWindowSettings(), and ACTION_MANAGER::UpdateHotKeys().

◆ CreateServer()

void EDA_DRAW_FRAME::CreateServer ( int  service,
bool  local = true 
)
inherited

Definition at line 49 of file eda_dde.cpp.

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

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

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

◆ CurrentToolName()

std::string EDA_BASE_FRAME::CurrentToolName ( ) const
inherited

Definition at line 252 of file eda_base_frame.cpp.

253 {
254  if( m_toolStack.empty() )
255  return ACTIONS::selectionTool.GetName();
256  else
257  return m_toolStack.back();
258 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:146

References EDA_BASE_FRAME::m_toolStack, and ACTIONS::selectionTool.

Referenced by TOOL_MANAGER::processEvent().

◆ Destroy()

◆ DismissModal()

void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
inherited

Definition at line 160 of file kiway_player.cpp.

161 {
162  m_modal_ret_val = aRetVal;
163  m_modal_string = aResult;
164 
165  if( m_modal_loop )
166  {
167  m_modal_loop->Exit();
168  m_modal_loop = 0; // this marks it as dismissed.
169  }
170 
171  Show( false );
172 }
bool m_modal_ret_val
Definition: kiway_player.h:192
wxString m_modal_string
Definition: kiway_player.h:191
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:189

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint(), LIB_VIEW_FRAME::FinishModal(), LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

◆ DisplayGridMsg()

void GERBVIEW_FRAME::DisplayGridMsg ( )

Function DisplayGridMsg()

Display the current grid pane on the status bar.

Definition at line 944 of file gerbview_frame.cpp.

945 {
946  wxString line;
947  wxString gridformatter;
948 
949  switch( m_userUnits )
950  {
951  case EDA_UNITS::INCHES:
952  gridformatter = "grid X %.6f Y %.6f";
953  break;
954 
956  gridformatter = "grid X %.6f Y %.6f";
957  break;
958 
959  default:
960  gridformatter = "grid X %f Y %f";
961  break;
962  }
963 
964  BASE_SCREEN* screen = GetScreen();
965  wxArrayString gridsList;
966 
967  int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != EDA_UNITS::INCHES );
968  GRID_TYPE& grid = screen->GetGrid( icurr );
969  double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x );
970  double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y );
971  line.Printf( gridformatter, grid_x, grid_y );
972 
973  SetStatusText( line, 4 );
974 }
double To_User_Unit(EDA_UNITS aUnit, double aValue, bool aUseMils)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:95
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:286
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:74
wxRealPoint m_Size
Definition: base_screen.h:47
GRID_TYPE is for grid arrays.
Definition: base_screen.h:43
EDA_UNITS m_userUnits
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.

References BASE_SCREEN::BuildGridsChoiceList(), BASE_SCREEN::GetGrid(), EDA_DRAW_FRAME::GetScreen(), INCHES, GRID_TYPE::m_Size, EDA_BASE_FRAME::m_userUnits, MILLIMETRES, and To_User_Unit().

Referenced by UpdateStatusBar().

◆ DisplayToolMsg()

void EDA_DRAW_FRAME::DisplayToolMsg ( const wxString &  msg)
overridevirtualinherited

Reimplemented from EDA_BASE_FRAME.

Definition at line 364 of file eda_draw_frame.cpp.

365 {
366  SetStatusText( msg, 6 );
367 }

Referenced by EDIT_TOOL::Duplicate(), and PCBNEW_CONTROL::Paste().

◆ DisplayUnitsMsg()

void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Display current unit pane on the status bar.

Definition at line 401 of file eda_draw_frame.cpp.

402 {
403  wxString msg;
404 
405  switch( m_userUnits )
406  {
407  case EDA_UNITS::INCHES:
408  msg = _( "Inches" );
409  break;
411  msg = _( "mm" );
412  break;
413  default: msg = _( "Units" ); break;
414  }
415 
416  SetStatusText( msg, 5 );
417 }
#define _(s)
Definition: 3d_actions.cpp:33
EDA_UNITS m_userUnits

References _, INCHES, EDA_BASE_FRAME::m_userUnits, and MILLIMETRES.

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

◆ doAutoSave()

bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

This 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 335 of file eda_base_frame.cpp.

336 {
337  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
338 }

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

◆ Erase_Current_DrawLayer()

void GERBVIEW_FRAME::Erase_Current_DrawLayer ( bool  query)

Definition at line 72 of file clear_gbr_drawlayers.cpp.

73 {
74  int layer = GetActiveLayer();
75  wxString msg;
76 
77  msg.Printf( _( "Clear layer %d?" ), layer + 1 );
78 
79  if( query && !IsOK( this, msg ) )
80  return;
81 
82  if( m_toolManager )
84 
85  GetImagesList()->DeleteImage( layer );
86 
88  syncLayerBox();
89  GetCanvas()->Refresh();
90 }
Model changes (required full reload)
Definition: tool_base.h:81
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
#define _(s)
Definition: 3d_actions.cpp:33
void DeleteImage(int aIdx)
delete the loaded data of image aIdx.
TOOL_MANAGER * m_toolManager
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:283
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...

References _, GERBER_FILE_IMAGE_LIST::DeleteImage(), GetActiveLayer(), EDA_DRAW_FRAME::GetCanvas(), GetImagesList(), IsOK(), EDA_BASE_FRAME::m_toolManager, TOOL_BASE::MODEL_RELOAD, ReFillLayerWidget(), EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::ResetTools(), and syncLayerBox().

Referenced by LoadGerberFiles(), OnDrlFileHistory(), OnGbrFileHistory(), OnZipFileHistory(), Read_EXCELLON_File(), and Read_GERBER_File().

◆ EraseMsgBox()

void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 216 of file eda_draw_frame.cpp.

217 {
218  if( m_messagePanel )
220 }
EDA_MSG_PANEL * m_messagePanel
void EraseMsgBox()
Definition: msgpanel.cpp:216

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

Referenced by GERBVIEW_CONTROL::UpdateMessagePanel().

◆ ExecuteRemoteCommand()

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 257 of file eda_draw_frame.h.

257 {}

Referenced by EDA_DRAW_FRAME::OnSockRequest().

◆ ExportDataInPcbnewFormat()

void GERBVIEW_FRAME::ExportDataInPcbnewFormat ( wxCommandEvent &  event)

Definition at line 176 of file export_to_pcbnew.cpp.

177 {
178  int layercount = 0;
179 
181 
182  // Count the Gerber layers which are actually currently used
183  for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
184  {
185  if( images->GetGbrImage( ii ) )
186  layercount++;
187  }
188 
189  if( layercount == 0 )
190  {
191  DisplayInfoMessage( this,
192  _( "None of the Gerber layers contain any data" ) );
193  return;
194  }
195 
196  wxString fileDialogName( wxT( "noname." ) + KiCadPcbFileExtension );
197  wxString path = m_mruPath;
198 
199  wxFileDialog filedlg( this, _( "Board File Name" ),
200  path, fileDialogName, PcbFileWildcard(),
201  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
202 
203  if( filedlg.ShowModal() == wxID_CANCEL )
204  return;
205 
206  wxFileName fileName = filedlg.GetPath();
207 
208  /* Install a dialog frame to choose the mapping
209  * between gerber layers and Pcbnew layers
210  */
211  LAYERS_MAP_DIALOG* layerdlg = new LAYERS_MAP_DIALOG( this );
212  int ok = layerdlg->ShowModal();
213  layerdlg->Destroy();
214 
215  if( ok != wxID_OK )
216  return;
217 
218  // If no extension was entered, then force the extension to be a KiCad PCB file
219  if( !fileName.HasExt() )
220  fileName.SetExt( KiCadPcbFileExtension );
221 
222  m_mruPath = fileName.GetPath();
223 
224  GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName.GetFullPath() );
225 
226  gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), layerdlg->GetCopperLayersCount() );
227 }
wxString m_mruPath
LAYER_NUM * GetLayersLookUpTable()
const std::string KiCadPcbFileExtension
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
static int GetCopperLayersCount()
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
bool ExportPcb(LAYER_NUM *aLayerLookUpTable, int aCopperLayers)
Function ExportPcb saves a board from a set of Gerber images.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
GBR_LAYOUT * GetGerberLayout() const
#define _(s)
Definition: 3d_actions.cpp:33
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:44
wxString PcbFileWildcard()
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:267

References _, DisplayInfoMessage(), GBR_TO_PCB_EXPORTER::ExportPcb(), LAYERS_MAP_DIALOG::GetCopperLayersCount(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GetGerberLayout(), GBR_LAYOUT::GetImagesList(), LAYERS_MAP_DIALOG::GetLayersLookUpTable(), GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), KiCadPcbFileExtension, EDA_BASE_FRAME::m_mruPath, and PcbFileWildcard().

◆ Files_io()

void GERBVIEW_FRAME::Files_io ( wxCommandEvent &  event)

Definition at line 120 of file gerbview/files.cpp.

121 {
122  int id = event.GetId();
123 
124  switch( id )
125  {
126  case wxID_FILE:
127  LoadGerberFiles( wxEmptyString );
128  break;
129 
131  Clear_DrawLayers( false );
132  Zoom_Automatique( false );
133  GetCanvas()->Refresh();
134  ClearMsgPanel();
135  break;
136 
138  {
139  // Store filenames
140  wxArrayString listOfGerberFiles;
141  std::vector<int> fileType;
142 
143  for( unsigned i = 0; i < GetImagesList()->ImagesMaxCount(); i++ )
144  {
145  if( GetImagesList()->GetGbrImage( i ) == nullptr )
146  continue;
147 
148  if( !GetImagesList()->GetGbrImage( i )->m_InUse )
149  continue;
150 
151  auto* drill_file = dynamic_cast<EXCELLON_IMAGE*>( GetImagesList()->GetGbrImage( i ) );
152 
153  if( drill_file )
154  fileType.push_back( 1 );
155  else
156  fileType.push_back( 0 );
157 
158  listOfGerberFiles.Add( GetImagesList()->GetGbrImage( i )->m_FileName );
159  }
160 
161  // Clear all layers
162  Clear_DrawLayers( false );
163  Zoom_Automatique( false );
164  GetCanvas()->Refresh();
165  ClearMsgPanel();
166 
167  // Load the layers from stored paths
168  wxBusyCursor wait;
169  loadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &fileType );
170  }
171  break;
172 
174  LoadExcellonFiles( wxEmptyString );
175  GetCanvas()->Refresh();
176  break;
177 
179  LoadZipArchiveFile( wxEmptyString );
180  GetCanvas()->Refresh();
181  break;
182 
184  LoadGerberJobFile( wxEmptyString );
185  GetCanvas()->Refresh();
186  break;
187 
188  default:
189  wxFAIL_MSG( "File_io: unexpected command id" );
190  break;
191  }
192 }
bool Clear_DrawLayers(bool query)
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
bool loadListOfGerberAndDrillFiles(const wxString &aPath, const wxArrayString &aFilenameList, const std::vector< int > *aFileType=nullptr)
Loads a list of Gerber and NC drill files and updates the view based on them.
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
bool LoadGerberFiles(const wxString &aFileName)
function LoadGerberFiles Load a photoplot (Gerber) file or many files.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
bool LoadZipArchiveFile(const wxString &aFileName)
function LoadZipArchiveFileLoadZipArchiveFile Load a zipped archive file.
FormatType fileType(const char *aFileName)
Definition: loadmodel.cpp:269
virtual void ClearMsgPanel()
Clear all messages from the message panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool LoadExcellonFiles(const wxString &aFileName)
function LoadExcellonFiles Load a drill (EXCELLON) file or many files.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.

References Clear_DrawLayers(), EDA_DRAW_FRAME::ClearMsgPanel(), fileType(), EDA_DRAW_FRAME::GetCanvas(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GetGbrImage(), GetImagesList(), ID_GERBVIEW_ERASE_ALL, ID_GERBVIEW_LOAD_DRILL_FILE, ID_GERBVIEW_LOAD_JOB_FILE, ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, ID_GERBVIEW_RELOAD_ALL, GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), LoadExcellonFiles(), LoadGerberFiles(), LoadGerberJobFile(), loadListOfGerberAndDrillFiles(), LoadZipArchiveFile(), GERBER_FILE_IMAGE::m_InUse, EDA_DRAW_PANEL_GAL::Refresh(), and EDA_DRAW_FRAME::Zoom_Automatique().

◆ FocusOnLocation()

void EDA_DRAW_FRAME::FocusOnLocation ( const wxPoint aPos)
inherited

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

Parameters
aPosis the point to go to.

Definition at line 688 of file eda_draw_frame.cpp.

689 {
690  bool centerView = false;
691  BOX2D r = GetCanvas()->GetView()->GetViewport();
692 
693  // Center if we're off the current view, or within 10% of its edge
694  r.Inflate( - (int) r.GetWidth() / 10 );
695 
696  if( !r.Contains( aPos ) )
697  centerView = true;
698 
699  // Center if we're behind an obscuring dialog, or within 10% of its edge
700  wxWindow* dialog = findDialog( GetChildren() );
701 
702  if( dialog )
703  {
704  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
705  dialog->GetSize() );
706  dialogRect.Inflate( dialogRect.GetWidth() / 10 );
707 
708  if( dialogRect.Contains( (wxPoint) GetCanvas()->GetView()->ToScreen( aPos ) ) )
709  centerView = true;
710  }
711 
712  if( centerView )
713  {
714  // If a dialog partly obscures the window, then center on the uncovered area.
715  if( dialog )
716  {
717  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
718  dialog->GetSize() );
719  GetCanvas()->GetView()->SetCenter( aPos, dialogRect );
720  }
721  else
722  GetCanvas()->GetView()->SetCenter( aPos );
723  }
724 
726 }
BOX2D GetViewport() const
Function GetViewport() Returns the current viewport visible area rectangle.
Definition: view.cpp:538
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
coord_type GetWidth() const
Definition: box2.h:196
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:150
wxWindow * findDialog(wxWindowList &aList)
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301

References BOX2< Vec >::Contains(), findDialog(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::GetWidth(), BOX2< Vec >::Inflate(), KIGFX::VIEW::SetCenter(), and KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition().

Referenced by SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindNext(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), and DIALOG_FIND::search().

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 517 of file eda_base_frame.h.

517 { return m_AboutTitle; }
wxString m_AboutTitle

References EDA_BASE_FRAME::m_AboutTitle.

Referenced by DIALOG_ABOUT::DIALOG_ABOUT().

◆ GetActiveLayer()

◆ GetAutoSaveFilePrefix()

static wxString EDA_BASE_FRAME::GetAutoSaveFilePrefix ( )
inlinestaticprotectedinherited
Returns
the string to prepend to a file name for automatic save.

Definition at line 171 of file eda_base_frame.h.

172  {
173  return wxT( "_autosave-" );
174  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), SCH_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::doAutoSave(), PCB_EDIT_FRAME::Files_io_from_id(), SCH_EDIT_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OnExportSTEP(), SCH_EDIT_FRAME::SaveEEFile(), and PCB_EDIT_FRAME::SavePcbFile().

◆ GetAutoSaveInterval()

int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 303 of file eda_base_frame.h.

303 { return m_autoSaveInterval; }

References EDA_BASE_FRAME::m_autoSaveInterval.

◆ GetAuxOrigin()

const wxPoint & GERBVIEW_FRAME::GetAuxOrigin ( ) const
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 920 of file gerbview_frame.cpp.

921 {
922  wxASSERT( m_gerberLayout );
923  return m_gerberLayout->GetAuxOrigin();
924 }
const wxPoint & GetAuxOrigin() const
Definition: gbr_layout.h:67
GBR_LAYOUT * m_gerberLayout

References GBR_LAYOUT::GetAuxOrigin(), and m_gerberLayout.

◆ GetBackupSuffix()

static wxString EDA_BASE_FRAME::GetBackupSuffix ( )
inlinestaticprotectedinherited
Returns
the suffix to be appended to the file extension on backup

Definition at line 163 of file eda_base_frame.h.

164  {
165  return wxT( "-bak" );
166  }

Referenced by EDA_BASE_FRAME::CheckForAutoSaveFile(), PCB_EDIT_FRAME::createBackupFile(), PCB_EDIT_FRAME::Files_io_from_id(), and SCH_EDIT_FRAME::SaveEEFile().

◆ GetCanvas()

virtual EDA_DRAW_PANEL_GAL* EDA_DRAW_FRAME::GetCanvas ( ) const
inlinevirtualinherited

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

Returns
Pointer to GAL-based canvas.

Reimplemented in PCB_BASE_FRAME, and SCH_BASE_FRAME.

Definition at line 470 of file eda_draw_frame.h.

470 { return m_canvas; }
EDA_DRAW_PANEL_GAL * m_canvas
GAL display options - this is the frame's interface to setting GAL display options.

References EDA_DRAW_FRAME::m_canvas.

Referenced by EDA_DRAW_FRAME::ActivateGalCanvas(), ActivateGalCanvas(), applyDisplaySettingsToGAL(), COMMON_TOOLS::CenterContents(), Clear_DrawLayers(), EDA_DRAW_FRAME::CommonSettingsChanged(), DIALOG_PRINT_GERBVIEW::createPrintout(), TOOL_DISPATCHER::DispatchWxEvent(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), Erase_Current_DrawLayer(), Files_io(), EDA_DRAW_FRAME::FocusOnLocation(), GERBVIEW_FRAME(), SCH_BASE_FRAME::GetCanvas(), PCB_BASE_FRAME::GetCanvas(), GetVisibleLayers(), GERBVIEW_CONTROL::HighlightControl(), loadListOfGerberAndDrillFiles(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::MeasureTool(), STATUS_POPUP::onCharHook(), OnCloseWindow(), GERBER_LAYER_WIDGET::OnLayerColorChange(), GERBER_LAYER_WIDGET::OnLayerSelect(), GERBER_LAYER_WIDGET::OnLayerVisible(), EDA_DRAW_FRAME::OnMove(), GERBER_LAYER_WIDGET::onPopupSelection(), GERBER_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderEnable(), OnSelectActiveDCode(), OnSelectDisplayMode(), OnSelectHighlightChoice(), OnUpdateSelectZoom(), Read_EXCELLON_File(), Read_GERBER_File(), ReCreateMenuBar(), GERBER_LAYER_WIDGET::ReFill(), EDA_DRAW_FRAME::RefreshCanvas(), SaveCanvasImageToFile(), PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme(), ZOOM_TOOL::selectRegion(), SetActiveLayer(), SetElementVisibility(), SetGridColor(), SetPageSettings(), setupTools(), SetVisibleLayers(), SortLayersByX2Attributes(), EDA_DRAW_FRAME::SwitchCanvas(), COMMON_TOOLS::ToggleGrid(), PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), UpdateDisplayOptions(), UpdateStatusBar(), COMMON_TOOLS::ZoomFitScreen(), and ~GERBVIEW_FRAME().

◆ GetColorSettings()

COLOR_SETTINGS * EDA_DRAW_FRAME::GetColorSettings ( )
virtualinherited

Returns a pointer to the active color theme settings.

Reimplemented in SCH_BASE_FRAME, and LIB_EDIT_FRAME.

Definition at line 843 of file eda_draw_frame.cpp.

844 {
845  if( !m_colorSettings )
846  m_colorSettings = Pgm().GetSettingsManager().GetColorSettings();
847 
848  return m_colorSettings;
849 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
COLOR_SETTINGS * m_colorSettings

References EDA_DRAW_FRAME::m_colorSettings, and Pgm().

Referenced by applyDisplaySettingsToGAL(), and DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG().

◆ GetDisplayMode()

int GERBVIEW_FRAME::GetDisplayMode ( )
inline

Function GetDisplayMode.

Returns
0 for fast mode (not fully compatible with negative objects) 1 for exact mode, write mode 2 for exact mode, OR mode (transparency mode)

Definition at line 256 of file gerbview_frame.h.

256 { return m_displayMode; }

References m_displayMode.

Referenced by OnUpdateDrawMode().

◆ GetDisplayOptions()

◆ GetDocumentExtents()

const BOX2I GERBVIEW_FRAME::GetDocumentExtents ( ) const
inlineoverridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 142 of file gerbview_frame.h.

143  {
144  wxASSERT( m_gerberLayout );
145  return m_gerberLayout->ViewBBox();
146  }
GBR_LAYOUT * m_gerberLayout
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.

References m_gerberLayout, and EDA_ITEM::ViewBBox().

◆ GetDoImmediateActions()

bool EDA_BASE_FRAME::GetDoImmediateActions ( ) const
inlineinherited

Indicates that hotkeys should perform an immediate action even if another tool is currently active.

If false, the first hotkey should select the relevant tool.

Definition at line 259 of file eda_base_frame.h.

259 { return m_immediateActions; }

References EDA_BASE_FRAME::m_immediateActions.

◆ GetDragSelects()

bool EDA_BASE_FRAME::GetDragSelects ( ) const
inlineinherited

Indicates that a drag should draw a selection rectangle, even when started over an item.

Definition at line 265 of file eda_base_frame.h.

265 { return m_dragSelects; }

References EDA_BASE_FRAME::m_dragSelects.

Referenced by EE_SELECTION_TOOL::Main().

◆ GetDrawBgColor()

virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited
Returns
the COLOR4D for the canvas background

Definition at line 226 of file eda_draw_frame.h.

226 { return m_drawBgColor; }
COLOR4D m_drawBgColor

References EDA_DRAW_FRAME::m_drawBgColor.

Referenced by GetNegativeItemsColor(), and SCH_PRINTOUT::PrintPage().

◆ GetFileFromHistory()

wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
FILE_HISTORY aFileHistory = NULL 
)
inherited

Fetches the file name from the file history list.

This removes the selected file, if this file does not exist. The menu is also updated, if FILE_HISTORY::UseMenu was called at init time

Parameters
cmdIdThe command ID associated with the aFileHistory object.
typePlease document me!
aFileHistoryThe FILE_HISTORY in use. If null, the main application file history is used
Returns
a wxString containing the selected filename

Definition at line 610 of file eda_base_frame.cpp.

612 {
613  FILE_HISTORY* fileHistory = aFileHistory;
614 
615  if( !fileHistory )
616  fileHistory = &Kiface().GetFileHistory();
617 
618  int baseId = fileHistory->GetBaseId();
619 
620  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
621 
622  unsigned i = cmdId - baseId;
623 
624  if( i < fileHistory->GetCount() )
625  {
626  wxString fn = fileHistory->GetHistoryFile( i );
627 
628  if( wxFileName::FileExists( fn ) )
629  return fn;
630  else
631  {
632  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
633  wxMessageBox( msg );
634 
635  fileHistory->RemoveFileFromHistory( i );
636  }
637  }
638 
639  return wxEmptyString;
640 }
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:42
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:125

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

Referenced by OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), OnGbrFileHistory(), OnJobFileHistory(), SCH_EDIT_FRAME::OnLoadFile(), and OnZipFileHistory().

◆ GetFindHistoryList()

wxArrayString& EDA_DRAW_FRAME::GetFindHistoryList ( )
inlineinherited

Definition at line 176 of file eda_draw_frame.h.

176 { return m_findStringHistoryList; }
wxArrayString m_findStringHistoryList

References EDA_DRAW_FRAME::m_findStringHistoryList.

Referenced by DIALOG_FIND::DIALOG_FIND(), and DIALOG_FIND::search().

◆ GetFindReplaceData()

wxFindReplaceData& EDA_DRAW_FRAME::GetFindReplaceData ( )
inlineinherited

Definition at line 175 of file eda_draw_frame.h.

175 { return *m_findReplaceData; }
wxFindReplaceData * m_findReplaceData

References EDA_DRAW_FRAME::m_findReplaceData.

Referenced by DIALOG_FIND::search().

◆ GetGalDisplayOptions()

◆ GetGbrImage()

◆ GetGerberLayout()

◆ GetGridColor()

virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

◆ GetGridOrigin()

const wxPoint& GERBVIEW_FRAME::GetGridOrigin ( ) const
inlineoverridevirtual

Return the absolute coordinates of the origin of the snap grid.

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

Implements EDA_DRAW_FRAME.

Definition at line 116 of file gerbview_frame.h.

116 { return m_grid_origin; }
wxPoint m_grid_origin

References m_grid_origin.

◆ GetImagesList()

◆ GetLastGridSizeId()

int EDA_DRAW_FRAME::GetLastGridSizeId ( ) const
inlineinherited

Definition at line 207 of file eda_draw_frame.h.

207 { return m_LastGridSizeId; }

References EDA_DRAW_FRAME::m_LastGridSizeId.

◆ GetLayerColor()

COLOR4D GERBVIEW_FRAME::GetLayerColor ( int  aLayer) const

Function GetLayerColor gets a layer color for any valid layer.

Definition at line 828 of file gerbview_frame.cpp.

829 {
830  return Pgm().GetSettingsManager().GetColorSettings()->GetColor( aLayer );
831 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103

References Pgm().

Referenced by ActivateGalCanvas(), GBR_LAYER_BOX_SELECTOR::GetLayerColor(), and GERBER_LAYER_WIDGET::ReFill().

◆ GetMoveWarpsCursor()

bool EDA_BASE_FRAME::GetMoveWarpsCursor ( ) const
inlineinherited

Indicates that a move operation should warp the mouse pointer to the origin of the move object.

This improves snapping, but some users are alergic to mouse warping.

Definition at line 271 of file eda_base_frame.h.

271 { return m_moveWarpsCursor; }

References EDA_BASE_FRAME::m_moveWarpsCursor.

Referenced by SCH_MOVE_TOOL::Main(), and LIB_MOVE_TOOL::Main().

◆ GetMruPath()

◆ GetNearestGridPosition()

wxPoint EDA_DRAW_FRAME::GetNearestGridPosition ( const wxPoint aPosition) const
inherited

Return the nearest aGridSize location to aPosition.

Parameters
aPositionThe position to check.
Returns
The nearst grid position.

Definition at line 651 of file eda_draw_frame.cpp.

652 {
653  return GetScreen()->getNearestGridPosition( aPosition, GetGridOrigin() );
654 }
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
wxPoint getNearestGridPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin) const
Function getNearestGridPosition returns the nearest aGridSize location to aPosition.
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.

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

Referenced by LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), and SCH_DRAWING_TOOLS::sizeSheet().

◆ GetNegativeItemsColor()

COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor ( )

Function GetNegativeItemsColor.

Returns
the color of negative items. This is usually the background color, but can be another color in order to see negative objects

Definition at line 819 of file gerbview_frame.cpp.

820 {
823  else
824  return GetDrawBgColor();
825 }
COLOR4D GetVisibleElementColor(int aLayerID)
Function GetVisibleElementColor returns the color of a gerber visible element.
bool IsElementVisible(int aLayerID) const
Function IsElementVisible tests whether a given element category is visible.
virtual COLOR4D GetDrawBgColor() const

References EDA_DRAW_FRAME::GetDrawBgColor(), GetVisibleElementColor(), IsElementVisible(), and LAYER_NEGATIVE_OBJECTS.

◆ getNextAvailableLayer()

int GERBVIEW_FRAME::getNextAvailableLayer ( int  aLayer = 0) const

Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the caller.

If no empty layers are found, NO_AVAILABLE_LAYERS is return.

Parameters
aLayerThe first layer to search.
Returns
The first empty layer found or NO_AVAILABLE_LAYERS.

Definition at line 443 of file gerbview_frame.cpp.

444 {
445  int layer = aLayer;
446 
447  for( unsigned i = 0; i < ImagesMaxCount(); ++i )
448  {
449  const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
450 
451  if( gerber == NULL ) // this graphic layer is available: use it
452  return layer;
453 
454  ++layer; // try next graphic layer
455 
456  if( layer >= (int)ImagesMaxCount() )
457  layer = 0;
458  }
459 
460  return NO_AVAILABLE_LAYERS;
461 }
GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters (TODO:...
unsigned ImagesMaxCount() const
The max number of file images.
#define NULL
#define NO_AVAILABLE_LAYERS
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const

References GetGbrImage(), ImagesMaxCount(), NO_AVAILABLE_LAYERS, and NULL.

Referenced by hasAvailableLayers(), LoadExcellonFiles(), loadListOfGerberAndDrillFiles(), and unarchiveFiles().

◆ GetPageSettings()

const PAGE_INFO & GERBVIEW_FRAME::GetPageSettings ( ) const
overridevirtual

◆ GetPageSizeIU()

const wxSize GERBVIEW_FRAME::GetPageSizeIU ( ) const
overridevirtual

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 897 of file gerbview_frame.cpp.

898 {
899  // this function is only needed because EDA_DRAW_FRAME is not compiled
900  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
901  // into an application specific source file.
902  return GetPageSettings().GetSizeIU();
903 }
const PAGE_INFO & GetPageSettings() const override

References GetPageSettings().

◆ GetScreen()

◆ GetScreenDesc()

wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

Definition at line 782 of file eda_draw_frame.cpp.

783 {
784  // Virtual function. Base class implementation returns an empty string.
785  return wxEmptyString;
786 }

Referenced by KIGFX::SCH_VIEW::DisplaySheet(), DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG(), and EDA_DRAW_FRAME::PrintWorkSheet().

◆ GetSettingsManager()

SETTINGS_MANAGER* EDA_BASE_FRAME::GetSettingsManager ( ) const
inlineinherited

Definition at line 231 of file eda_base_frame.h.

231 { return m_settingsManager; }
SETTINGS_MANAGER * m_settingsManager

References EDA_BASE_FRAME::m_settingsManager.

Referenced by applyDisplaySettingsToGAL().

◆ GetSeverity()

virtual int EDA_BASE_FRAME::GetSeverity ( int  aErrorCode) const
inlinevirtualinherited

Reimplemented in PCB_EDIT_FRAME.

Definition at line 233 of file eda_base_frame.h.

References RPT_SEVERITY_UNDEFINED.

Referenced by RC_TREE_MODEL::GetValue().

◆ GetShowPolarCoords()

◆ GetTitleBlock()

const TITLE_BLOCK & GERBVIEW_FRAME::GetTitleBlock ( ) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 906 of file gerbview_frame.cpp.

907 {
908  wxASSERT( m_gerberLayout );
909  return m_gerberLayout->GetTitleBlock();
910 }
TITLE_BLOCK & GetTitleBlock()
Definition: gbr_layout.h:70
GBR_LAYOUT * m_gerberLayout

References GBR_LAYOUT::GetTitleBlock(), and m_gerberLayout.

Referenced by SetPageSettings().

◆ GetToolManager()

TOOL_MANAGER* EDA_BASE_FRAME::GetToolManager ( ) const
inlineinherited

Return the MVC controller.

Definition at line 238 of file eda_base_frame.h.

238 { return m_toolManager; }
TOOL_MANAGER * m_toolManager

References EDA_BASE_FRAME::m_toolManager.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), LIB_CONTROL::AddSymbolToSchematic(), BOARD_COMMIT::BOARD_COMMIT(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), EDA_BASE_FRAME::CommonSettingsChanged(), DIALOG_ERC::deleteAllMarkers(), DIALOG_DRC::deleteAllMarkers(), DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), GERBVIEW_FRAME(), FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), KICAD_MANAGER_FRAME::InstallPreferences(), FOOTPRINT_EDIT_FRAME::InstallPreferences(), LIB_EDIT_FRAME::InstallPreferences(), InstallPreferences(), PCB_EDIT_FRAME::InstallPreferences(), SCH_EDIT_FRAME::InstallPreferences(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), SIM_PLOT_FRAME::onClose(), SYMBOL_TREE_PANE::onComponentSelected(), DIALOG_DRC::OnDeleteOneClick(), DIALOG_ERC::OnERCItemSelected(), FOOTPRINTS_LISTBOX::OnLeftDClick(), SIM_PLOT_FRAME::onProbe(), DIALOG_PLOT::onRunDRC(), HIERARCHY_NAVIG_DLG::onSelectSheetPath(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), SIM_PLOT_FRAME::onTune(), DIALOG_PLOT::Plot(), EDA_BASE_FRAME::PopTool(), SCH_EDIT_FRAME::PutDataInPreviousState(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), DIALOG_FIND::search(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), CVPCB_MAINFRAME::setupEventHandlers(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), EDA_DRAW_FRAME::UpdateMsgPanel(), DIALOG_NETLIST::~DIALOG_NETLIST(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

EDA_UNITS EDA_BASE_FRAME::GetUserUnits ( ) const
inlineinherited

Return the user units currently in use.

Definition at line 215 of file eda_base_frame.h.

216  {
217  return m_userUnits;
218  }
EDA_UNITS m_userUnits

References EDA_BASE_FRAME::m_userUnits.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs(), PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth(), PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize(), PCB_EDIT_FRAME::Create_MuWaveComponent(), MWAVE::CreateMicrowaveInductor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), GERBER_FILE_IMAGE::DisplayImageInfo(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), LIB_EDIT_TOOL::editGraphicProperties(), LIB_PIN_TOOL::EditPinProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::GenFootprintsReport(), PANEL_MODEDIT_DEFAULTS::getGridValue(), PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue(), PANEL_SETUP_NETCLASSES::getNetclassValue(), GetUserUnits(), GRID_MENU::GRID_MENU(), PCB_INSPECTION_TOOL::highlightNet(), Liste_D_Codes(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), PANEL_SETUP_BOARD_STACKUP::onThicknessChange(), PANEL_SETUP_BOARD_STACKUP::onUpdateThicknessValue(), PANEL_PREV_3D::PANEL_PREV_3D(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), POSITION_RELATIVE_TOOL::PositionRelative(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), CONNECTION_SUBGRAPH::ResolveDrivers(), DISPLAY_FOOTPRINTS_FRAME::SyncToolbars(), FOOTPRINT_EDIT_FRAME::SyncToolbars(), LIB_EDIT_FRAME::SyncToolbars(), SyncToolbars(), PCB_EDIT_FRAME::SyncToolbars(), SCH_EDIT_FRAME::SyncToolbars(), DRC::testDrilledHoles(), DRC::testUnconnected(), COMMON_TOOLS::ToggleUnits(), PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), PANEL_MODEDIT_SETTINGS::TransferDataToWindow(), PANEL_GERBVIEW_SETTINGS::TransferDataToWindow(), PANEL_PCBNEW_SETTINGS::TransferDataToWindow(), PANEL_SETUP_NETCLASSES::TransferDataToWindow(), UNIT_BINDER::UNIT_BINDER(), GRID_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), updateDCodeSelectBox(), updateGridSelectBox(), PCB_BASE_FRAME::UpdateGridSelectBox(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), UpdateStatusBar(), PCB_EDIT_FRAME::UpdateTrackWidthSelectBox(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), DRC::userUnits(), PANEL_SETUP_TRACKS_AND_VIAS::validateData(), and PANEL_SETUP_NETCLASSES::validateData().

◆ GetVisibleElementColor()

COLOR4D GERBVIEW_FRAME::GetVisibleElementColor ( int  aLayerID)

Function GetVisibleElementColor returns the color of a gerber visible element.

Definition at line 759 of file gerbview_frame.cpp.

760 {
761  COLOR4D color = COLOR4D::UNSPECIFIED;
762 
763  switch( aLayerID )
764  {
766  case LAYER_DCODES:
769  color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( aLayerID );
770  break;
771 
772  case LAYER_GERBVIEW_GRID:
773  color = GetGridColor();
774  break;
775 
776  default:
777  wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID );
778  }
779 
780  return color;
781 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
int color
Definition: DXF_plotter.cpp:61
virtual COLOR4D GetGridColor()
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40

References color, EDA_DRAW_FRAME::GetGridColor(), LAYER_DCODES, LAYER_GERBVIEW_BACKGROUND, LAYER_GERBVIEW_GRID, LAYER_GERBVIEW_WORKSHEET, LAYER_NEGATIVE_OBJECTS, and Pgm().

Referenced by GetNegativeItemsColor(), and GERBER_LAYER_WIDGET::ReFillRender().

◆ GetVisibleLayers()

LSET GERBVIEW_FRAME::GetVisibleLayers ( ) const

Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSettings.

Returns
LSET of the visible layers

Definition at line 723 of file gerbview_frame.cpp.

724 {
725  LSET visible = LSET::AllLayersMask();
726 
727  if( GetCanvas() )
728  {
729  for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
730  visible[i] = GetCanvas()->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) );
731  }
732 
733  return visible;
734 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
LSET is a set of PCB_LAYER_IDs.
#define GERBER_DRAWLAYERS_COUNT
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
static LSET AllLayersMask()
Definition: lset.cpp:723
#define GERBER_DRAW_LAYER(x)
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible() Returns information about visibility of a particular layer.
Definition: view.h:416

References LSET::AllLayersMask(), GERBER_DRAW_LAYER, GERBER_DRAWLAYERS_COUNT, EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), and KIGFX::VIEW::IsLayerVisible().

Referenced by loadListOfGerberAndDrillFiles(), and GERBER_LAYER_WIDGET::OnLayerVisible().

◆ GetWindowSettings()

WINDOW_SETTINGS * EDA_BASE_FRAME::GetWindowSettings ( APP_SETTINGS_BASE aCfg)
virtualinherited

Returns a pointer to the window settings for this frame.

By default, points to aCfg->m_Window for top-level frames.

Parameters
aCfgis this frame's config object

Reimplemented in SIM_PLOT_FRAME, FOOTPRINT_WIZARD_FRAME, FOOTPRINT_VIEWER_FRAME, LIB_VIEW_FRAME, and DISPLAY_FOOTPRINTS_FRAME.

Definition at line 566 of file eda_base_frame.cpp.

567 {
568  return &aCfg->m_Window;
569 }
WINDOW_SETTINGS m_Window
Definition: app_settings.h:132

References APP_SETTINGS_BASE::m_Window.

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

◆ GetZoom()

double EDA_DRAW_FRAME::GetZoom ( )
inherited
Returns
The current zoom level.

Definition at line 315 of file eda_draw_frame.cpp.

316 {
317  return GetScreen()->GetZoom();
318 }
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:240
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.

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

Referenced by FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_BASE_FRAME::updateZoomSelectBox(), and updateZoomSelectBox().

◆ GetZoomLevelCoeff()

double EDA_DRAW_FRAME::GetZoomLevelCoeff ( ) const
inlineinherited

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

Definition at line 272 of file eda_draw_frame.h.

272 { return m_zoomLevelCoeff; }
double m_zoomLevelCoeff

References EDA_DRAW_FRAME::m_zoomLevelCoeff.

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

◆ GetZoomLevelIndicator()

const wxString GERBVIEW_FRAME::GetZoomLevelIndicator ( ) const
overridevirtual

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 1063 of file gerbview_frame.cpp.

1064 {
1066 }
virtual const wxString GetZoomLevelIndicator() const
Return a human readable value which can be displayed as zoom level indicator in dialogs.

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

◆ HardRedraw()

void EDA_DRAW_FRAME::HardRedraw ( )
virtualinherited

Rebuild the GAL and redraws the screen.

Call when something went wrong.

Reimplemented in SCH_EDIT_FRAME, LIB_EDIT_FRAME, SCH_BASE_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 664 of file eda_draw_frame.cpp.

665 {
666  // To be implemented by subclasses.
667 }

Referenced by COMMON_TOOLS::ZoomRedraw().

◆ hasAvailableLayers()

bool GERBVIEW_FRAME::hasAvailableLayers ( ) const
inline

Definition at line 370 of file gerbview_frame.h.

371  {
373  }
#define NO_AVAILABLE_LAYERS
int getNextAvailableLayer(int aLayer=0) const
Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the ca...

References getNextAvailableLayer(), and NO_AVAILABLE_LAYERS.

◆ help_name()

wxString EDA_BASE_FRAME::help_name ( )
virtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 587 of file eda_base_frame.cpp.

588 {
589  return Kiface().GetHelpFileName();
590 }
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:123
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

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

Referenced by COMMON_CONTROL::ShowHelp().

◆ ImagesMaxCount()

unsigned GERBVIEW_FRAME::ImagesMaxCount ( ) const

The max number of file images.

Definition at line 1075 of file gerbview_frame.cpp.

1076 {
1078 }
GBR_LAYOUT * m_gerberLayout
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:44

References GBR_LAYOUT::GetImagesList(), GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), and m_gerberLayout.

Referenced by getNextAvailableLayer(), and Liste_D_Codes().

◆ ImportHotkeyConfigFromFile()

void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( std::map< std::string, TOOL_ACTION * >  aActionMap,
const wxString &  aDefaultShortname 
)
inherited

Prompt the user for a hotkey file to read, and read it.

Parameters
aActionMap= current hotkey map (over which the imported hotkeys will be applied)
aDefaultShortname= a default short name (extension not needed) like eechema, kicad...

◆ InitExitKey()

void EDA_DRAW_FRAME::InitExitKey ( )
protectedinherited

Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id.

This is useful in sub-applications to pass the event up to a non-owning window

Definition at line 288 of file eda_draw_frame.cpp.

289 {
290  wxAcceleratorEntry entries[1];
291  entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
292  wxAcceleratorTable accel( 1, entries );
293  SetAcceleratorTable( accel );
294 }

Referenced by FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME().

◆ InstallPreferences()

void GERBVIEW_FRAME::InstallPreferences ( PAGED_DIALOG aParent,
PANEL_HOTKEYS_EDITOR aHotkeysPanel 
)
overridevirtual

Allows Gerbview to install its preferences panels into the preferences dialog.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1122 of file gerbview_frame.cpp.

1124 {
1125  wxTreebook* book = aParent->GetTreebook();
1126 
1127  book->AddPage( new wxPanel( book ), _( "Gerbview" ) );
1128  book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
1129  book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
1130 
1131  aHotkeysPanel->AddHotKeys( GetToolManager() );
1132 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
void AddHotKeys(TOOL_MANAGER *aToolMgr)
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
#define _(s)
Definition: 3d_actions.cpp:33

References _, PANEL_HOTKEYS_EDITOR::AddHotKeys(), EDA_BASE_FRAME::GetToolManager(), and PAGED_DIALOG::GetTreebook().

◆ isAutoSaveRequired()

virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Return 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 186 of file eda_base_frame.h.

186 { return false; }

Referenced by EDA_BASE_FRAME::ProcessEvent().

◆ IsContentModified()

bool EDA_BASE_FRAME::IsContentModified ( )
virtualinherited

Get if the contents of the frame have been modified since the last save.

Returns
true if the contents of the frame have not been saved

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

Definition at line 798 of file eda_base_frame.cpp.

799 {
800  // This function should be overridden in child classes
801  return false;
802 }

◆ IsCurrentTool()

bool EDA_BASE_FRAME::IsCurrentTool ( const TOOL_ACTION aAction) const
inherited

Definition at line 261 of file eda_base_frame.cpp.

262 {
263  if( m_toolStack.empty() )
264  return &aAction == &ACTIONS::selectionTool;
265  else
266  return m_toolStack.back() == aAction.GetName();
267 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:146
const std::string & GetName() const
Function GetName() Returns name of the action.
Definition: tool_action.h:78

References TOOL_ACTION::GetName(), EDA_BASE_FRAME::m_toolStack, and ACTIONS::selectionTool.

Referenced by PCB_INSPECTION_TOOL::HighlightNetTool(), SCH_EDIT_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), DISPLAY_FOOTPRINTS_FRAME::SyncToolbars(), and LIB_EDIT_FRAME::SyncToolbars().

◆ IsDismissed()

bool KIWAY_PLAYER::IsDismissed ( )
inherited

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 154 of file kiway_player.cpp.

155 {
156  return !m_modal_loop;
157 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:189

References KIWAY_PLAYER::m_modal_loop.

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

◆ IsElementVisible()

bool GERBVIEW_FRAME::IsElementVisible ( int  aLayerID) const

Function IsElementVisible tests whether a given element category is visible.

Keep this as an inline function.

Parameters
aLayerIDis an item id from the enum GERBVIEW_LAYER_ID
Returns
bool - true if the element is visible.

Definition at line 705 of file gerbview_frame.cpp.

706 {
707  switch( aLayerID )
708  {
711  case LAYER_GERBVIEW_GRID: return IsGridVisible();
713  case LAYER_GERBVIEW_BACKGROUND: return true;
714 
715  default:
716  wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID );
717  }
718 
719  return true;
720 }
virtual bool IsGridVisible() const
bool m_DisplayNegativeObjects
Option to draw negative objects in a specific color.
bool m_showBorderAndTitleBlock
GBR_DISPLAY_OPTIONS m_DisplayOptions
bool m_DisplayDCodes
Option to show dcode values on items drawn with a dcode tool.

References EDA_DRAW_FRAME::IsGridVisible(), LAYER_DCODES, LAYER_GERBVIEW_BACKGROUND, LAYER_GERBVIEW_GRID, LAYER_NEGATIVE_OBJECTS, LAYER_WORKSHEET, GBR_DISPLAY_OPTIONS::m_DisplayDCodes, GBR_DISPLAY_OPTIONS::m_DisplayNegativeObjects, m_DisplayOptions, and EDA_DRAW_FRAME::m_showBorderAndTitleBlock.

Referenced by GERBVIEW_CONTROL::DisplayControl(), GetNegativeItemsColor(), ReCreateMenuBar(), GERBER_LAYER_WIDGET::ReFillRender(), SaveSettings(), SyncToolbars(), and PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataToWindow().

◆ IsGridVisible()

◆ IsLayerVisible()

bool GERBVIEW_FRAME::IsLayerVisible ( int  aLayer) const

Function IsLayerVisible tests whether a given layer is visible.

Parameters
aLayer= The layer to be tested (still 0-31!)
Returns
bool - true if the layer is visible.

Definition at line 753 of file gerbview_frame.cpp.

754 {
755  return m_LayersManager->IsLayerVisible( aLayer );
756 }
GERBER_LAYER_WIDGET * m_LayersManager
bool IsLayerVisible(LAYER_NUM aLayer)
Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id.

References LAYER_WIDGET::IsLayerVisible(), and m_LayersManager.

Referenced by GERBER_LAYER_WIDGET::ReFill(), and GERBVIEW_SELECTION_TOOL::selectable().

◆ IsModal()

◆ IsType()

bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited

Definition at line 305 of file eda_base_frame.h.

305 { return m_Ident == aType; }

References EDA_BASE_FRAME::m_Ident.

Referenced by LIB_CONTROL::AddLibrary(), PCBNEW_CONTROL::AddLibrary(), LIB_CONTROL::AddSymbol(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), BOARD_COMMIT::BOARD_COMMIT(), EDA_3D_VIEWER::CreateMenuBar(), LIB_CONTROL::CutCopyDelete(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), KIGFX::SCH_VIEW::DisplaySheet(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), LIB_CONTROL::DuplicateSymbol(), LIB_CONTROL::EditSymbol(), LIB_CONTROL::ExportSymbol(), LIB_CONTROL::Init(), DIALOG_EDIT_ONE_FIELD::init(), SELECTION_TOOL::Init(), DIALOG_PAD_PROPERTIES::initValues(), PICKER_TOOL::Main(), LIB_CONTROL::OnDeMorgan(), PCB_LAYER_WIDGET::OnRenderEnable(), PCBNEW_CONTROL::Paste(), LIB_CONTROL::PinLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), LIB_CONTROL::Revert(), EE_INSPECTION_TOOL::RunERC(), LIB_CONTROL::Save(), PCBNEW_CONTROL::Show3DViewer(), LIB_CONTROL::ShowComponentTree(), EE_INSPECTION_TOOL::ShowDatasheet(), LIB_CONTROL::UnpinLibrary(), and COMMON_TOOLS::ZoomFitScreen().

◆ IsWritable()

bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

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 691 of file eda_base_frame.cpp.

692 {
693  wxString msg;
694  wxFileName fn = aFileName;
695 
696  // Check for absence of a file path with a file name. Unfortunately KiCad
697  // uses paths relative to the current project path without the ./ part which
698  // confuses wxFileName. Making the file name path absolute may be less than
699  // elegant but it solves the problem.
700  if( fn.GetPath().IsEmpty() && fn.HasName() )
701  fn.MakeAbsolute();
702 
703  wxCHECK_MSG( fn.IsOk(), false,
704  wxT( "File name object is invalid. Bad programmer!" ) );
705  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
706  wxT( "File name object path <" ) + fn.GetFullPath() +
707  wxT( "> is not set. Bad programmer!" ) );
708 
709  if( fn.IsDir() && !fn.IsDirWritable() )
710  {
711  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
712  GetChars( fn.GetPath() ) );
713  }
714  else if( !fn.FileExists() && !fn.IsDirWritable() )
715  {
716  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
717  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
718  }
719  else if( fn.FileExists() && !fn.IsFileWritable() )
720  {
721  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
722  GetChars( fn.GetFullPath() ) );
723  }
724 
725  if( !msg.IsEmpty() )
726  {
727  wxMessageBox( msg );
728  return false;
729  }
730 
731  return true;
732 }
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:101
#define _(s)
Definition: 3d_actions.cpp:33

References _, and GetChars().

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

◆ Kiway()

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 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithLibEdit(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::InitSheet(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadSheetFromFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), KIWAY_HOLDER::Prj(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), LIB_MANAGER::UpdatePart(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ kiway_express()

void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 175 of file kiway_player.cpp.

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

References KIWAY_PLAYER::KiwayMailIn().

◆ KiwayMailIn()

void KIWAY_PLAYER::KiwayMailIn ( KIWAY_EXPRESS aEvent)
virtualinherited

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

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

Definition at line 69 of file kiway_player.cpp.

70 {
71  // override this in derived classes.
72 }

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

◆ language_change()

void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

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

Definition at line 182 of file kiway_player.cpp.

183 {
184  int id = event.GetId();
185 
186  // tell all the KIWAY_PLAYERs about the language change.
187  Kiway().SetLanguage( id );
188 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs.
Definition: kiway.cpp:435

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

◆ LibraryFileBrowser()

bool EDA_DRAW_FRAME::LibraryFileBrowser ( bool  doOpen,
wxFileName &  aFilename,
const wxString &  wildcard,
const wxString &  ext,
bool  isDirectory = false 
)
protectedinherited
Parameters
doOpenif true runs an Open Library browser, otherwise New Library
aFilenamefor New may contain a default name; in both cases return the chosen filename.
wildcarda wildcard to filter the displayed files
extthe library file extension
isDirectoryindicates the library files are directories
Returns
true for OK; false for Cancel.

Definition at line 788 of file eda_draw_frame.cpp.

791 {
792  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
793  aFilename.SetExt( ext );
794 
795  if( isDirectory && doOpen )
796  {
797  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
798  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
799 
800  if( dlg.ShowModal() == wxID_CANCEL )
801  return false;
802 
803  aFilename = dlg.GetPath();
804  aFilename.SetExt( ext );
805  }
806  else
807  {
808  wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
809  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
810  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
811 
812  if( dlg.ShowModal() == wxID_CANCEL )
813  return false;
814 
815  aFilename = dlg.GetPath();
816  aFilename.SetExt( ext );
817  }
818 
819  return true;
820 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define _(s)
Definition: 3d_actions.cpp:33

References _, and KIWAY_HOLDER::Prj().

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

◆ Liste_D_Codes()

void GERBVIEW_FRAME::Liste_D_Codes ( )

Set Size Items (Lines, Flashes) from DCodes List.

Definition at line 492 of file gerbview_frame.cpp.

493 {
494  int ii, jj;
495  wxString Line;
496  wxArrayString list;
497  double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
498  int curr_layer = GetActiveLayer();
499 
500  for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
501  {
502  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
503 
504  if( gerber == NULL )
505  continue;
506 
507  if( gerber->GetDcodesCount() == 0 )
508  continue;
509 
510  if( layer == curr_layer )
511  Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
512  else
513  Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
514 
515  list.Add( Line );
516 
517  const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "\"" : "mm";
518 
519  for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
520  {
521  D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE );
522 
523  if( pt_D_code == NULL )
524  continue;
525 
526  if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
527  continue;
528 
529  Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s attribute '%s'" ),
530  jj,
531  pt_D_code->m_Num_Dcode,
532  pt_D_code->m_Size.y / scale, units,
533  pt_D_code->m_Size.x / scale, units,
534  D_CODE::ShowApertureType( pt_D_code->m_Shape ),
535  pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
536  );
537 
538  if( !pt_D_code->m_Defined )
539  Line += wxT( " (not defined)" );
540 
541  if( pt_D_code->m_InUse )
542  Line += wxT( " (in use)" );
543 
544  list.Add( Line );
545  jj++;
546  }
547  }
548 
549  wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
550  wxCHOICEDLG_STYLE & ~wxCANCEL );
551 
552  dlg.ShowModal();
553 }
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters (TODO:...
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
unsigned ImagesMaxCount() const
The max number of file images.
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
static const wxChar * ShowApertureType(APERTURE_T aType)
Function ShowApertureType returns a character string telling what type of aperture type aType is.
Definition: dcode.cpp:93
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE
Definition: dcode.h:105
const int scale
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:101
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define _(s)
Definition: 3d_actions.cpp:33
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
#define IU_PER_MILS
Definition: plotter.cpp:137
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, FIRST_DCODE, GetActiveLayer(), GetChars(), GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::GetDcodesCount(), GetGbrImage(), EDA_BASE_FRAME::GetUserUnits(), ImagesMaxCount(), INCHES, IU_PER_MILS, D_CODE::m_AperFunction, D_CODE::m_Defined, D_CODE::m_InUse, D_CODE::m_Num_Dcode, D_CODE::m_Shape, D_CODE::m_Size, NULL, scale, D_CODE::ShowApertureType(), and TOOLS_MAX_COUNT.

◆ LoadCanvasTypeSetting()

EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting ( )
inherited

Returns the canvas type stored in the application settings.

Definition at line 577 of file eda_draw_frame.cpp.

578 {
581 
582  if( cfg )
583  canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( cfg->m_Graphics.canvas_type );
584 
585  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
586  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
587  {
588  wxASSERT( false );
590  }
591 
592  // Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
593  // the user will be prompted to switch to OpenGL
594  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
595  {
596 #ifdef __WXMAC__
597  // Cairo renderer doesn't handle Retina displays
599 #else
601 #endif
602  }
603 
604  return canvasType;
605 }
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
Sentinel, do not use as a parameter.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:75
GAL not used (the legacy wxDC engine is used)
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.

References APP_SETTINGS_BASE::GRAPHICS::canvas_type, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, Kiface(), KIFACE_I::KifaceSettings(), and APP_SETTINGS_BASE::m_Graphics.

Referenced by SCH_BASE_FRAME::createCanvas(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), and GERBVIEW_FRAME().

◆ LoadExcellonFiles()

bool GERBVIEW_FRAME::LoadExcellonFiles ( const wxString &  aFileName)

function LoadExcellonFiles Load a drill (EXCELLON) file or many files.

Parameters
aFileName- void string or file name with full path to open or empty string to open a new file. In this case one one file is loaded if empty string: user will be prompted for filename(s)
Returns
true if file was opened successfully.

Definition at line 406 of file gerbview/files.cpp.

407 {
408  wxString filetypes;
409  wxArrayString filenamesList;
410  wxFileName filename = aFullFileName;
411  wxString currentPath;
412 
413  if( !filename.IsOk() )
414  {
415  filetypes = DrillFileWildcard();
416  filetypes << wxT( "|" );
417 
418  /* All filetypes */
419  filetypes += AllFilesWildcard();
420 
421  /* Use the current working directory if the file name path does not exist. */
422  if( filename.DirExists() )
423  currentPath = filename.GetPath();
424  else
425  currentPath = m_mruPath;
426 
427  wxFileDialog dlg( this, _( "Open NC (Excellon) Drill File(s)" ),
428  currentPath, filename.GetFullName(), filetypes,
429  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
430 
431  if( dlg.ShowModal() == wxID_CANCEL )
432  return false;
433 
434  dlg.GetPaths( filenamesList );
435  currentPath = wxGetCwd();
436  m_mruPath = currentPath;
437  }
438  else
439  {
440  filenamesList.Add( aFullFileName );
441  currentPath = filename.GetPath();
442  m_mruPath = currentPath;
443  }
444 
445  // Read Excellon drill files: each file is loaded on a new GerbView layer
446  bool success = true;
447  int layer = GetActiveLayer();
448 
449  // Manage errors when loading files
450  wxString msg;
451  WX_STRING_REPORTER reporter( &msg );
452 
453  for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
454  {
455  filename = filenamesList[ii];
456 
457  if( !filename.IsAbsolute() )
458  filename.SetPath( currentPath );
459 
460  m_lastFileName = filename.GetFullPath();
461 
462  SetActiveLayer( layer, false );
463 
464  if( Read_EXCELLON_File( filename.GetFullPath() ) )
465  {
466  // Update the list of recent drill files.
467  UpdateFileHistory( filename.GetFullPath(), &m_drillFileHistory );
468 
469  layer = getNextAvailableLayer( layer );
470 
471  if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
472  {
473  success = false;
474  reporter.Report( MSG_NO_MORE_LAYER, RPT_SEVERITY_ERROR );
475 
476  // Report the name of not loaded files:
477  ii += 1;
478  while( ii < filenamesList.GetCount() )
479  {
480  filename = filenamesList[ii++];
481  wxString txt = wxString::Format( MSG_NOT_LOADED, filename.GetFullName() );
482  reporter.Report( txt, RPT_SEVERITY_ERROR );
483  }
484  break;
485  }
486 
487  SetActiveLayer( layer, false );
488  }
489  }
490 
491  if( !success )
492  {
493  HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
494  mbox.ListSet( msg );
495  mbox.ShowModal();
496  }
497 
498  Zoom_Automatique( false );
499 
500  // Synchronize layers tools with actual active layer:
504  syncLayerBox();
505 
506  return success;
507 }
wxString m_lastFileName
wxString m_mruPath
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
GERBER_LAYER_WIDGET * m_LayersManager
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
wxString AllFilesWildcard()
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
#define MSG_NOT_LOADED
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
#define NO_AVAILABLE_LAYERS
void UpdateLayerIcons()
Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or ...
HTML_MESSAGE_BOX.
FILE_HISTORY m_drillFileHistory
#define MSG_NO_MORE_LAYER
wxString DrillFileWildcard()
WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:154
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
int getNextAvailableLayer(int aLayer=0) const
Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the ca...
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
bool Read_EXCELLON_File(const wxString &aFullFileName)

References _, AllFilesWildcard(), DrillFileWildcard(), Format(), GetActiveLayer(), getNextAvailableLayer(), HTML_MESSAGE_BOX::ListSet(), m_drillFileHistory, m_lastFileName, m_LayersManager, EDA_BASE_FRAME::m_mruPath, MSG_NO_MORE_LAYER, MSG_NOT_LOADED, NO_AVAILABLE_LAYERS, Read_EXCELLON_File(), ReFillLayerWidget(), WX_STRING_REPORTER::Report(), RPT_SEVERITY_ERROR, SetActiveLayer(), syncLayerBox(), EDA_BASE_FRAME::UpdateFileHistory(), LAYER_WIDGET::UpdateLayerIcons(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by Files_io(), loadListOfGerberAndDrillFiles(), OnDrlFileHistory(), and OpenProjectFiles().

◆ LoadGerberFiles()

bool GERBVIEW_FRAME::LoadGerberFiles ( const wxString &  aFileName)

function LoadGerberFiles Load a photoplot (Gerber) file or many files.

Parameters
aFileName- void string or file name with full path to open or empty string to open a new file. In this case one one file is loaded if void string: user will be prompted for filename(s)
Returns
true if file was opened successfully.

Definition at line 195 of file gerbview/files.cpp.

196 {
197  static int lastGerberFileWildcard = 0;
198  wxString filetypes;
199  wxArrayString filenamesList;
200  wxFileName filename = aFullFileName;
201  wxString currentPath;
202 
203  if( !filename.IsOk() )
204  {
205  /* Standard gerber filetypes
206  * (See http://en.wikipedia.org/wiki/Gerber_File)
207  * the .gbr (.pho in legacy files) extension is the default used in Pcbnew
208  * However there are a lot of other extensions used for gerber files
209  * Because the first letter is usually g, we accept g* as extension
210  * (Mainly internal copper layers do not have specific extension,
211  * and filenames are like *.g1, *.g2 *.gb1 ...).
212  * Now (2014) Ucamco (the company which manages the Gerber format) encourages
213  * use of .gbr only and the Gerber X2 file format.
214  */
215  filetypes = _( "Gerber files (.g* .lgr .pho)" );
216  filetypes << wxT("|");
217  filetypes += wxT("*.g*;*.G*;*.pho;*.PHO" );
218  filetypes << wxT("|");
219 
220  /* Special gerber filetypes */
221  filetypes += _( "Top layer (*.GTL)|*.GTL;*.gtl|" );
222  filetypes += _( "Bottom layer (*.GBL)|*.GBL;*.gbl|" );
223  filetypes += _( "Bottom solder resist (*.GBS)|*.GBS;*.gbs|" );
224  filetypes += _( "Top solder resist (*.GTS)|*.GTS;*.gts|" );
225  filetypes += _( "Bottom overlay (*.GBO)|*.GBO;*.gbo|" );
226  filetypes += _( "Top overlay (*.GTO)|*.GTO;*.gto|" );
227  filetypes += _( "Bottom paste (*.GBP)|*.GBP;*.gbp|" );
228  filetypes += _( "Top paste (*.GTP)|*.GTP;*.gtp|" );
229  filetypes += _( "Keep-out layer (*.GKO)|*.GKO;*.gko|" );
230  filetypes += _( "Mechanical layers (*.GMx)|*.GM1;*.gm1;*.GM2;*.gm2;*.GM3;*.gm3|" );
231  filetypes += _( "Top Pad Master (*.GPT)|*.GPT;*.gpt|" );
232  filetypes += _( "Bottom Pad Master (*.GPB)|*.GPB;*.gpb|" );
233 
234  // All filetypes
235  filetypes += AllFilesWildcard();
236 
237  // Use the current working directory if the file name path does not exist.
238  if( filename.DirExists() )
239  currentPath = filename.GetPath();
240  else
241  {
242  currentPath = m_mruPath;
243 
244  // On wxWidgets 3.1 (bug?) the path in wxFileDialog is ignored when
245  // finishing by the dir separator. Remove it if any:
246  if( currentPath.EndsWith( '\\' ) || currentPath.EndsWith( '/' ) )
247  currentPath.RemoveLast();
248  }
249 
250  wxFileDialog dlg( this, _( "Open Gerber File(s)" ),
251  currentPath,
252  filename.GetFullName(),
253  filetypes,
254  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
255  dlg.SetFilterIndex( lastGerberFileWildcard );
256 
257  if( dlg.ShowModal() == wxID_CANCEL )
258  return false;
259 
260  lastGerberFileWildcard = dlg.GetFilterIndex();
261  dlg.GetPaths( filenamesList );
262  m_mruPath = currentPath = dlg.GetDirectory();
263  }
264  else
265  {
266  filenamesList.Add( aFullFileName );
267  m_mruPath = currentPath = filename.GetPath();
268  }
269 
270  Erase_Current_DrawLayer( false );
271 
272  // Set the busy cursor
273  wxBusyCursor wait;
274 
275  return loadListOfGerberAndDrillFiles( currentPath, filenamesList );
276 }
wxString m_mruPath
bool loadListOfGerberAndDrillFiles(const wxString &aPath, const wxArrayString &aFilenameList, const std::vector< int > *aFileType=nullptr)
Loads a list of Gerber and NC drill files and updates the view based on them.
void Erase_Current_DrawLayer(bool query)
wxString AllFilesWildcard()
#define _(s)
Definition: 3d_actions.cpp:33

References _, AllFilesWildcard(), Erase_Current_DrawLayer(), loadListOfGerberAndDrillFiles(), and EDA_BASE_FRAME::m_mruPath.

Referenced by Files_io(), OnGbrFileHistory(), and OpenProjectFiles().

◆ LoadGerberJobFile()

bool GERBVIEW_FRAME::LoadGerberJobFile ( const wxString &  aFileName)

Load a Gerber job file, and load gerber files found in job files.

Parameters
aFileName- void string or file name with full path to open or empty string to open a new file. if empty string: user will be prompted for filename(s)
Returns
true if file(s) was opened successfully.

Definition at line 176 of file job_file_reader.cpp.

177 {
178  wxFileName filename = aFullFileName;
179  wxString currentPath;
180  bool success = true;
181 
182  if( !filename.IsOk() )
183  {
184  // Use the current working directory if the file name path does not exist.
185  if( filename.DirExists() )
186  currentPath = filename.GetPath();
187  else
188  currentPath = m_mruPath;
189 
190  wxFileDialog dlg( this, _( "Open Gerber Job File" ),
191  currentPath,
192  filename.GetFullName(),
194  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
195 
196  if( dlg.ShowModal() == wxID_CANCEL )
197  return false;
198 
199  filename = dlg.GetPath();
200  currentPath = filename.GetPath();
201  m_mruPath = currentPath;
202  }
203  else
204  {
205  currentPath = filename.GetPath();
206  m_mruPath = currentPath;
207  }
208 
209  wxString msg;
210  WX_STRING_REPORTER reporter( &msg );
211 
212  if( filename.IsOk() )
213  {
214  GERBER_JOBFILE_READER gbjReader( filename.GetFullPath(), &reporter );
215 
216  if( gbjReader.ReadGerberJobFile() )
217  {
218  // Update the list of recent drill files.
219  UpdateFileHistory( filename.GetFullPath(), &m_jobFileHistory );
220 
221  Clear_DrawLayers( false );
222  ClearMsgPanel();
223 
224  wxArrayString& gbrfiles = gbjReader.GetGerberFiles();
225 
226  success = loadListOfGerberAndDrillFiles( currentPath, gbrfiles );
227  }
228  }
229 
231 
232  SetActiveLayer( 0 );
233 
234  if( !msg.IsEmpty() )
235  {
236  wxSafeYield(); // Allows slice of time to redraw the screen
237  // to refresh widgets, before displaying messages
238  HTML_MESSAGE_BOX mbox( this, _( "Messages" ) );
239  mbox.ListSet( msg );
240  mbox.ShowModal();
241  }
242 
243  return success;
244 }
void SortLayersByX2Attributes()
bool Clear_DrawLayers(bool query)
wxString m_mruPath
FILE_HISTORY m_jobFileHistory
this class read and parse a Gerber job file to extract useful info for GerbView
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
bool loadListOfGerberAndDrillFiles(const wxString &aPath, const wxArrayString &aFilenameList, const std::vector< int > *aFileType=nullptr)
Loads a list of Gerber and NC drill files and updates the view based on them.
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
HTML_MESSAGE_BOX.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:154
wxString GerberJobFileWildcard()
#define _(s)
Definition: 3d_actions.cpp:33

References _, Clear_DrawLayers(), EDA_DRAW_FRAME::ClearMsgPanel(), GerberJobFileWildcard(), HTML_MESSAGE_BOX::ListSet(), loadListOfGerberAndDrillFiles(), m_jobFileHistory, EDA_BASE_FRAME::m_mruPath, SetActiveLayer(), SortLayersByX2Attributes(), and EDA_BASE_FRAME::UpdateFileHistory().

Referenced by Files_io(), OnJobFileHistory(), and OpenProjectFiles().

◆ loadListOfGerberAndDrillFiles()

bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles ( const wxString &  aPath,
const wxArrayString &  aFilenameList,
const std::vector< int > *  aFileType = nullptr 
)
private

Loads a list of Gerber and NC drill files and updates the view based on them.

Parameters
aPathis the base path for the filenames if they are relative
aFilenameListis a list of filenames to load
aFileTypeis a list of type of files to load (0 = Gerber, 1 = NC drill) if nullptr, files are expected Gerber type.
Returns
true if every file loaded successfully

Definition at line 279 of file gerbview/files.cpp.

282 {
283  wxFileName filename;
284 
285  // Read gerber files: each file is loaded on a new GerbView layer
286  bool success = true;
287  int layer = GetActiveLayer();
288  LSET visibility = GetVisibleLayers();
289 
290  // Manage errors when loading files
291  wxString msg;
292  WX_STRING_REPORTER reporter( &msg );
293 
294  // Create progress dialog (only used if more than 1 file to load
295  std::unique_ptr<WX_PROGRESS_REPORTER> progress = nullptr;
296 
297  for( unsigned ii = 0; ii < aFilenameList.GetCount(); ii++ )
298  {
299  filename = aFilenameList[ii];
300 
301  if( !filename.IsAbsolute() )
302  filename.SetPath( aPath );
303 
304  // Check for non existing files, to avoid creating broken or useless data
305  // and report all in one error list:
306  if( !filename.FileExists() )
307  {
308  wxString warning;
309  warning << "<b>" << _( "File not found:" ) << "</b><br>"
310  << filename.GetFullPath() << "<br>";
311  reporter.Report( warning, RPT_SEVERITY_WARNING );
312  success = false;
313  continue;
314  }
315 
316  m_lastFileName = filename.GetFullPath();
317 
318  if( !progress && ( aFilenameList.GetCount() > 1 ) )
319  {
320  progress = std::make_unique<WX_PROGRESS_REPORTER>( this,
321  _( "Loading Gerber files..." ), 1, false );
322  progress->SetMaxProgress( aFilenameList.GetCount() - 1 );
323  progress->Report( wxString::Format( _("Loading %u/%zu %s" ), ii+1,
324  aFilenameList.GetCount(), m_lastFileName ) );
325  }
326  else if( progress )
327  {
328  progress->Report( wxString::Format( _("Loading %u/%zu %s" ), ii+1,
329  aFilenameList.GetCount(), m_lastFileName ) );
330  progress->KeepRefreshing();
331  }
332 
333  SetActiveLayer( layer, false );
334 
335  visibility[ layer ] = true;
336 
337  if( aFileType && (*aFileType)[ii] == 1 )
338  {
339  LoadExcellonFiles( filename.GetFullPath() );
340  layer = GetActiveLayer(); // Loading NC drill file changes the active layer
341  }
342  else
343  {
344  if( Read_GERBER_File( filename.GetFullPath() ) )
345  {
347 
348  layer = getNextAvailableLayer( layer );
349 
350  if( layer == NO_AVAILABLE_LAYERS && ii < aFilenameList.GetCount()-1 )
351  {
352  success = false;
353  reporter.Report( MSG_NO_MORE_LAYER, RPT_SEVERITY_ERROR );
354 
355  // Report the name of not loaded files:
356  ii += 1;
357  while( ii < aFilenameList.GetCount() )
358  {
359  filename = aFilenameList[ii++];
360  wxString txt = wxString::Format( MSG_NOT_LOADED, filename.GetFullName() );
361  reporter.Report( txt, RPT_SEVERITY_ERROR );
362  }
363  break;
364  }
365 
366  SetActiveLayer( layer, false );
367  }
368  }
369 
370  if( progress )
371  progress->AdvanceProgress();
372  }
373 
374  if( !success )
375  {
376  wxSafeYield(); // Allows slice of time to redraw the screen
377  // to refresh widgets, before displaying messages
378  HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
379  mbox.ListSet( msg );
380  mbox.ShowModal();
381  }
382 
383  SetVisibleLayers( visibility );
384 
385  Zoom_Automatique( false );
386 
387  // Synchronize layers tools with actual active layer:
389 
390  // TODO: it would be nice if we could set the active layer to one of the
391  // ones that was just loaded, but to maintain the previous user experience
392  // we need to set it to a blank layer in case they load another file.
393  // We can't start with the next available layer when loading files because
394  // some users expect the behavior of overwriting the active layer on load.
395  SetActiveLayer( getNextAvailableLayer( layer ), true );
396 
398  syncLayerBox( true );
399 
400  GetCanvas()->Refresh();
401 
402  return success;
403 }
wxString m_lastFileName
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
GERBER_LAYER_WIDGET * m_LayersManager
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
bool Read_GERBER_File(const wxString &GERBER_FullFileName)
Definition: readgerb.cpp:40
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
#define MSG_NOT_LOADED
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
LSET is a set of PCB_LAYER_IDs.
#define NO_AVAILABLE_LAYERS
void UpdateLayerIcons()
Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or ...
HTML_MESSAGE_BOX.
#define MSG_NO_MORE_LAYER
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:154
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
bool LoadExcellonFiles(const wxString &aFileName)
function LoadExcellonFiles Load a drill (EXCELLON) file or many files.
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
int getNextAvailableLayer(int aLayer=0) const
Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the ca...
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...

References _, Format(), GetActiveLayer(), EDA_DRAW_FRAME::GetCanvas(), getNextAvailableLayer(), GetVisibleLayers(), HTML_MESSAGE_BOX::ListSet(), LoadExcellonFiles(), m_lastFileName, m_LayersManager, MSG_NO_MORE_LAYER, MSG_NOT_LOADED, NO_AVAILABLE_LAYERS, Read_GERBER_File(), ReFillLayerWidget(), EDA_DRAW_PANEL_GAL::Refresh(), WX_STRING_REPORTER::Report(), RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, SetActiveLayer(), SetVisibleLayers(), syncLayerBox(), EDA_BASE_FRAME::UpdateFileHistory(), LAYER_WIDGET::UpdateLayerIcons(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by Files_io(), LoadGerberFiles(), and LoadGerberJobFile().

◆ LoadSettings()

void GERBVIEW_FRAME::LoadSettings ( APP_SETTINGS_BASE aCfg)
overridevirtual

Load 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 307 of file gerbview_frame.cpp.

308 {
310 
311  GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg );
312 
314 
315  PAGE_INFO pageInfo( wxT( "GERBER" ) );
316  pageInfo.SetType( cfg->m_Appearance.page_type );
317  SetPageSettings( pageInfo );
318 
321 
325 }
std::vector< wxString > m_JobFileHistory
FILE_HISTORY m_jobFileHistory
void SetPageSettings(const PAGE_INFO &aPageSettings) override
void Load(const APP_SETTINGS_BASE &aSettings)
Loads history from a JSON settings object.
Definition: filehistory.cpp:45
FILE_HISTORY m_zipFileHistory
std::vector< wxString > m_DrillFileHistory
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
FILE_HISTORY m_drillFileHistory
std::vector< wxString > m_ZipFileHistory
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void SetElementVisibility(int aLayerID, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.

References LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, LAYER_WORKSHEET, FILE_HISTORY::Load(), EDA_DRAW_FRAME::LoadSettings(), GERBVIEW_SETTINGS::m_Appearance, GERBVIEW_SETTINGS::m_DrillFileHistory, m_drillFileHistory, GERBVIEW_SETTINGS::m_JobFileHistory, m_jobFileHistory, GERBVIEW_SETTINGS::m_ZipFileHistory, m_zipFileHistory, GERBVIEW_SETTINGS::APPEARANCE::page_type, SetElementVisibility(), SetPageSettings(), PAGE_INFO::SetType(), GERBVIEW_SETTINGS::APPEARANCE::show_border_and_titleblock, GERBVIEW_SETTINGS::APPEARANCE::show_dcodes, and GERBVIEW_SETTINGS::APPEARANCE::show_negative_objects.

Referenced by GERBVIEW_FRAME().

◆ LoadWindowSettings()

void EDA_BASE_FRAME::LoadWindowSettings ( WINDOW_SETTINGS aCfg)
inherited

Loads window settings from the given settings object Normally called by LoadSettings unless the window in question is a child window that stores its settings somewhere other than APP_SETTINGS_BASE::m_Window.

Definition at line 446 of file eda_base_frame.cpp.

447 {
448  m_FramePos.x = aCfg->pos_x;
449  m_FramePos.y = aCfg->pos_y;
450  m_FrameSize.x = aCfg->size_x;
451  m_FrameSize.y = aCfg->size_y;
452 
453  // Ensure minimum size is set if the stored config was zero-initialized
455  {
458  }
459 
460  // Ensure window isn't bigger than can be displayed
461  int displayIndex = wxDisplay::GetFromPoint( m_FramePos );
462 
463  if( displayIndex == wxNOT_FOUND )
464  displayIndex = 0;
465 
466  wxDisplay display( displayIndex );
467  wxRect clientSize = display.GetClientArea();
468 
469  // The window may have been saved on a display that is no longer present.
470  // First, check the window origin and move it if it's off the chosen display
471 
472  if( m_FramePos.x >= clientSize.x + clientSize.width ||
473  m_FramePos.y >= clientSize.y + clientSize.height )
474  m_FramePos = wxDefaultPosition;
475 
476  // Now, fix up the size if needed
477 
478  if( m_FrameSize.x + m_FramePos.x > clientSize.x + clientSize.width )
479  {
480  m_FrameSize.x = clientSize.width;
481  m_FramePos.x = 0;
482  }
483 
484  if( m_FrameSize.y + m_FramePos.y > clientSize.y + clientSize.height )
485  {
486  m_FrameSize.y = clientSize.height;
487  m_FramePos.y = 0;
488  }
489 
490  if( m_hasAutoSave )
491  m_autoSaveInterval = Pgm().GetCommonSettings()->m_System.autosave_interval;
492 
493  // Ensure Window title bar is visible
494 #if defined( __WXMAC__ )
495  // for macOSX, the window must be below system (macOSX) toolbar
496  // Ypos_min = GetMBarHeight(); seems no more exist in new API (subject to change)
497  int Ypos_min = 20;
498 #else
499  int Ypos_min = 0;
500 #endif
501  if( m_FramePos.y < Ypos_min )
502  {
503  if( m_FrameSize.y + ( Ypos_min - m_FramePos.y ) > clientSize.height)
504  m_FrameSize.y = clientSize.height - Ypos_min;
505 
506  m_FramePos.y = Ypos_min;
507  }
508 
509  if( aCfg->maximized )
510  Maximize();
511 
512  m_perspective = aCfg->perspective;
513  m_mruPath = aCfg->mru_path;
514 
515  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
516 
520 }
wxString mru_path
Definition: app_settings.h:55
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
wxString m_mruPath
wxString m_perspective
wxString perspective
Definition: app_settings.h:58
static const int s_minsize_x
static const int s_minsize_y

References COMMON_SETTINGS::INPUT::immediate_actions, EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_dragSelects, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, EDA_BASE_FRAME::m_hasAutoSave, EDA_BASE_FRAME::m_immediateActions, COMMON_SETTINGS::m_Input, EDA_BASE_FRAME::m_moveWarpsCursor, EDA_BASE_FRAME::m_mruPath, EDA_BASE_FRAME::m_perspective, WINDOW_SETTINGS::maximized, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, Pgm(), WINDOW_SETTINGS::pos_x, WINDOW_SETTINGS::pos_y, COMMON_SETTINGS::INPUT::prefer_select_to_drag, s_minsize_x, s_minsize_y, WINDOW_SETTINGS::size_x, WINDOW_SETTINGS::size_y, COMMON_SETTINGS::INPUT::warp_mouse_on_move, wxPoint::x, and wxPoint::y.

Referenced by EDA_BASE_FRAME::LoadSettings().

◆ LoadZipArchiveFile()

bool GERBVIEW_FRAME::LoadZipArchiveFile ( const wxString &  aFileName)

function LoadZipArchiveFileLoadZipArchiveFile Load a zipped archive file.

Parameters
aFileName- void string or file name with full path to open or empty string to open a new file. if empty string: user will be prompted for filename(s)
Returns
true if file was opened successfully.

Definition at line 657 of file gerbview/files.cpp.

658 {
659 #define ZipFileExtension "zip"
660 
661  wxFileName filename = aFullFileName;
662  wxString currentPath;
663 
664  if( !filename.IsOk() )
665  {
666  // Use the current working directory if the file name path does not exist.
667  if( filename.DirExists() )
668  currentPath = filename.GetPath();
669  else
670  currentPath = m_mruPath;
671 
672  wxFileDialog dlg( this,
673  _( "Open Zip File" ),
674  currentPath,
675  filename.GetFullName(),
676  ZipFileWildcard(),
677  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
678 
679  if( dlg.ShowModal() == wxID_CANCEL )
680  return false;
681 
682  filename = dlg.GetPath();
683  currentPath = wxGetCwd();
684  m_mruPath = currentPath;
685  }
686  else
687  {
688  currentPath = filename.GetPath();
689  m_mruPath = currentPath;
690  }
691 
692  wxString msg;
693  WX_STRING_REPORTER reporter( &msg );
694 
695  if( filename.IsOk() )
696  unarchiveFiles( filename.GetFullPath(), &reporter );
697 
698  Zoom_Automatique( false );
699 
700  // Synchronize layers tools with actual active layer:
704  syncLayerBox();
705 
706  if( !msg.IsEmpty() )
707  {
708  wxSafeYield(); // Allows slice of time to redraw the screen
709  // to refresh widgets, before displaying messages
710  HTML_MESSAGE_BOX mbox( this, _( "Messages" ) );
711  mbox.ListSet( msg );
712  mbox.ShowModal();
713  }
714 
715  return true;
716 }
wxString m_mruPath
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
GERBER_LAYER_WIDGET * m_LayersManager
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
wxString ZipFileWildcard()
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
bool unarchiveFiles(const wxString &aFullFileName, REPORTER *aReporter=nullptr)
Extracts gerber and drill files from the zip archive, and load them.
void UpdateLayerIcons()
Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or ...
HTML_MESSAGE_BOX.
WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:154
#define _(s)
Definition: 3d_actions.cpp:33
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...

References _, GetActiveLayer(), HTML_MESSAGE_BOX::ListSet(), m_LayersManager, EDA_BASE_FRAME::m_mruPath, ReFillLayerWidget(), SetActiveLayer(), syncLayerBox(), unarchiveFiles(), LAYER_WIDGET::UpdateLayerIcons(), ZipFileWildcard(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by Files_io(), and OnZipFileHistory().

◆ LockFile()

bool EDA_DRAW_FRAME::LockFile ( const wxString &  aFileName)
inherited

Mark a schematic file as being in use.

Use ReleaseFile() to undo this.

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

Definition at line 181 of file eda_draw_frame.cpp.

182 {
183  m_file_checker = ::LockFile( aFileName );
184 
185  return bool( m_file_checker );
186 }
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.

References EDA_DRAW_FRAME::m_file_checker.

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

◆ onAutoSaveTimer()

void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Handle the auto save timer event.

Definition at line 328 of file eda_base_frame.cpp.

329 {
330  if( !doAutoSave() )
331  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
332 }
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
wxTimer * m_autoSaveTimer

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

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

◆ OnCharHook()

void EDA_BASE_FRAME::OnCharHook ( wxKeyEvent &  event)
virtualinherited

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

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

Reimplemented in FOOTPRINT_VIEWER_FRAME.

Definition at line 341 of file eda_base_frame.cpp.

342 {
343  wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
344  // Key events can be filtered here.
345  // Currently no filtering is made.
346  event.Skip();
347 }
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.

References dump(), and kicadTraceKeyEvent.

◆ OnClearDrlFileHistory()

void GERBVIEW_FRAME::OnClearDrlFileHistory ( wxCommandEvent &  aEvent)
private

Definition at line 80 of file gerbview/files.cpp.

81 {
83 }
void ClearFileHistory(FILE_HISTORY *aFileHistory=NULL)
Removes all files from the file history.
FILE_HISTORY m_drillFileHistory

References EDA_BASE_FRAME::ClearFileHistory(), and m_drillFileHistory.

◆ OnClearGbrFileHistory()

void GERBVIEW_FRAME::OnClearGbrFileHistory ( wxCommandEvent &  aEvent)
private

Definition at line 60 of file gerbview/files.cpp.

61 {
63 }
void ClearFileHistory(FILE_HISTORY *aFileHistory=NULL)
Removes all files from the file history.

References EDA_BASE_FRAME::ClearFileHistory().

◆ OnClearJobFileHistory()

void GERBVIEW_FRAME::OnClearJobFileHistory ( wxCommandEvent &  aEvent)
private

Definition at line 114 of file gerbview/files.cpp.

115 {
117 }
FILE_HISTORY m_jobFileHistory
void ClearFileHistory(FILE_HISTORY *aFileHistory=NULL)
Removes all files from the file history.

References EDA_BASE_FRAME::ClearFileHistory(), and m_jobFileHistory.

◆ OnClearZipFileHistory()

void GERBVIEW_FRAME::OnClearZipFileHistory ( wxCommandEvent &  aEvent)
private

Definition at line 99 of file gerbview/files.cpp.

100 {
102 }
void ClearFileHistory(FILE_HISTORY *aFileHistory=NULL)
Removes all files from the file history.
FILE_HISTORY m_zipFileHistory

References EDA_BASE_FRAME::ClearFileHistory(), and m_zipFileHistory.

◆ OnCloseWindow()

void GERBVIEW_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 234 of file gerbview_frame.cpp.

235 {
236  GetCanvas()->StopDrawing();
237  GetCanvas()->GetView()->Clear();
238 
239  if( m_toolManager )
241 
242  // Be sure any OpenGL event cannot be fired after frame deletion:
243  GetCanvas()->SetEvtHandlerEnabled( false );
244 
245  Destroy();
246 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1111
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
TOOL_MANAGER * m_toolManager
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...

References KIGFX::VIEW::Clear(), TOOL_MANAGER::DeactivateTool(), KIWAY_PLAYER::Destroy(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), EDA_BASE_FRAME::m_toolManager, and EDA_DRAW_PANEL_GAL::StopDrawing().

◆ OnDrlFileHistory()

void GERBVIEW_FRAME::OnDrlFileHistory ( wxCommandEvent &  event)

Function OnDrlFileHistory deletes the current data and load a drill file in Excellon format selected from history list on current layer.

Definition at line 66 of file gerbview/files.cpp.

67 {
68  wxString fn;
69 
70  fn = GetFileFromHistory( event.GetId(), _( "Drill files" ), &m_drillFileHistory );
71 
72  if( !fn.IsEmpty() )
73  {
74  Erase_Current_DrawLayer( false );
75  LoadExcellonFiles( fn );
76  }
77 }
void Erase_Current_DrawLayer(bool query)
FILE_HISTORY m_drillFileHistory
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
Fetches the file name from the file history list.
#define _(s)
Definition: 3d_actions.cpp:33
bool LoadExcellonFiles(const wxString &aFileName)
function LoadExcellonFiles Load a drill (EXCELLON) file or many files.

References _, Erase_Current_DrawLayer(), EDA_BASE_FRAME::GetFileFromHistory(), LoadExcellonFiles(), and m_drillFileHistory.

◆ OnGbrFileHistory()

void GERBVIEW_FRAME::OnGbrFileHistory ( wxCommandEvent &  event)

Function OnGbrFileHistory deletes the current data and loads a Gerber file selected from history list on current layer.

Definition at line 47 of file gerbview/files.cpp.

48 {
49  wxString fn;
50 
51  fn = GetFileFromHistory( event.GetId(), _( "Gerber files" ) );
52 
53  if( !fn.IsEmpty() )
54  {
55  Erase_Current_DrawLayer( false );
56  LoadGerberFiles( fn );
57  }
58 }
void Erase_Current_DrawLayer(bool query)
bool LoadGerberFiles(const wxString &aFileName)
function LoadGerberFiles Load a photoplot (Gerber) file or many files.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
Fetches the file name from the file history list.
#define _(s)
Definition: 3d_actions.cpp:33

References _, Erase_Current_DrawLayer(), EDA_BASE_FRAME::GetFileFromHistory(), and LoadGerberFiles().

◆ OnGridSettings()

virtual void EDA_DRAW_FRAME::OnGridSettings ( wxCommandEvent &  event)
inlinevirtualinherited

Reimplemented in SCH_BASE_FRAME, and PCB_BASE_EDIT_FRAME.

Definition at line 304 of file eda_draw_frame.h.

304 { };

Referenced by EDA_DRAW_FRAME::OnSelectGrid().

◆ OnJobFileHistory()

void GERBVIEW_FRAME::OnJobFileHistory ( wxCommandEvent &  event)

deletes the current data and load a gerber job file selected from the history list.

Definition at line 105 of file gerbview/files.cpp.

106 {
107  wxString filename = GetFileFromHistory( event.GetId(), _( "Job files" ), &m_jobFileHistory );
108 
109  if( !filename.IsEmpty() )
110  LoadGerberJobFile( filename );
111 }
FILE_HISTORY m_jobFileHistory
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=NULL)
Fetches the file name from the file history list.
#define _(s)
Definition: 3d_actions.cpp:33

References _, EDA_BASE_FRAME::GetFileFromHistory(), LoadGerberJobFile(), and m_jobFileHistory.

◆ OnKicadAbout()

void EDA_BASE_FRAME::OnKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 652 of file eda_base_frame.cpp.

653 {
654  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
655  ShowAboutDialog( this );
656 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
The base frame for deriving all KiCad main window classes.

References ShowAboutDialog().

◆ OnMenuOpen()

void EDA_BASE_FRAME::OnMenuOpen ( wxMenuEvent &  event)
inherited

Workaround some issues in wxWidgets where the menu events aren't captured by the menus themselves.

Definition at line 350 of file eda_base_frame.cpp.

351 {
352  //
353  // wxWidgets has several issues that we have to work around:
354  //
355  // 1) wxWidgets 3.0.x Windows has a bug where wxEVT_MENU_OPEN and wxEVT_MENU_HIGHLIGHT
356  // events are not captured by the ACTON_MENU menus. So we forward them here.
357  // (FWIW, this one is fixed in wxWidgets 3.1.x.)
358  //
359  // 2) wxWidgets doesn't pass the menu pointer for wxEVT_MENU_HIGHLIGHT events. So we
360  // store the menu pointer from the wxEVT_MENU_OPEN call.
361  //
362  // 3) wxWidgets has no way to tell whether a command is from a menu selection or a
363  // hotkey. So we keep track of menu highlighting so we can differentiate.
364  //
365 
366  static ACTION_MENU* currentMenu;
367 
368  if( event.GetEventType() == wxEVT_MENU_OPEN )
369  {
370  currentMenu = dynamic_cast<ACTION_MENU*>( event.GetMenu() );
371 
372  if( currentMenu )
373  currentMenu->OnMenuEvent( event );
374  }
375  else if( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
376  {
377  if( currentMenu )
378  currentMenu->OnMenuEvent( event );
379  }
380  else if( event.GetEventType() == wxEVT_MENU_CLOSE )
381  {
382  if( currentMenu )
383  currentMenu->OnMenuEvent( event );
384 
385  currentMenu = nullptr;
386  }
387 
388  event.Skip();
389 }
ACTION_MENU.
Definition: action_menu.h:43
void OnMenuEvent(wxMenuEvent &aEvent)

References ACTION_MENU::OnMenuEvent().

◆ OnMove()

void EDA_DRAW_FRAME::OnMove ( wxMoveEvent &  aEvent)
overridevirtualinherited

Reimplemented from EDA_BASE_FRAME.

Definition at line 321 of file eda_draw_frame.cpp.

322 {
323  // If the window is moved to a different display, the scaling factor may change
324  double oldFactor = m_galDisplayOptions.m_scaleFactor;
326 
327  if( oldFactor != m_galDisplayOptions.m_scaleFactor )
328  {
329  wxSize clientSize = GetClientSize();
330  GetCanvas()->GetGAL()->ResizeScreen( clientSize.x, clientSize.y );
331  GetCanvas()->GetView()->MarkDirty();
332  }
333 
334  aEvent.Skip();
335 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual void ResizeScreen(int aWidth, int aHeight)
Resizes the canvas.
double m_scaleFactor
The pixel scale factor (>1 for hi-DPI scaled displays)
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:610

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_FRAME::m_galDisplayOptions, KIGFX::GAL_DISPLAY_OPTIONS::m_scaleFactor, KIGFX::VIEW::MarkDirty(), KIGFX::GAL::ResizeScreen(), and KIGFX::GAL_DISPLAY_OPTIONS::UpdateScaleFactor().

◆ OnPageSettingsChange()

virtual void EDA_DRAW_FRAME::OnPageSettingsChange ( )
inlinevirtualinherited

Called when modifying the page settings.

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

Reimplemented in SCH_EDIT_FRAME.

Definition at line 379 of file eda_draw_frame.h.

379 {}

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ OnPreferences()

void EDA_BASE_FRAME::OnPreferences ( wxCommandEvent &  event)
inherited

Definition at line 659 of file eda_base_frame.cpp.

660 {
661  PAGED_DIALOG dlg( this, _( "Preferences" ) );
662  wxTreebook* book = dlg.GetTreebook();
663 
664  book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
665 
666  PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
667  book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
668 
669  for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
670  {
671  KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
672 
673  if( frame )
674  frame->InstallPreferences( &dlg, hotkeysPanel );
675  }
676 
677  // The Kicad manager frame is not a player so we have to add it by hand
678  wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
679 
680  if( manager )
681  static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
682 
683  for( int i = 0; i < book->GetPageCount(); ++i )
684  book->GetPage( i )->Layout();
685 
686  if( dlg.ShowModal() == wxID_OK )
687  dlg.Kiway().CommonSettingsChanged( false );
688 }
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:59
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
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:341
#define KICAD_MANAGER_FRAME_NAME
#define _(s)
Definition: 3d_actions.cpp:33
virtual void InstallPreferences(PAGED_DIALOG *, PANEL_HOTKEYS_EDITOR *)
Function InstallPreferences Allow a frame to load its preference panels (if any) into the preferences...

References _, KIWAY::CommonSettingsChanged(), PAGED_DIALOG::GetTreebook(), EDA_BASE_FRAME::InstallPreferences(), KICAD_MANAGER_FRAME_NAME, KIWAY_HOLDER::Kiway(), KIWAY_PLAYER_COUNT, and KIWAY::Player().

◆ OnQuit()

void GERBVIEW_FRAME::OnQuit ( wxCommandEvent &  event)

Function OnQuit called on request of application quit.

Definition at line 274 of file events_called_functions.cpp.

275 {
276  Close( true );
277 }

◆ OnSelectActiveDCode()

void GERBVIEW_FRAME::OnSelectActiveDCode ( wxCommandEvent &  event)

Function OnSelectActiveDCode Selects the active DCode for the current active layer.

Items using this DCode are highlighted.

Definition at line 197 of file events_called_functions.cpp.

198 {
199  GERBER_FILE_IMAGE* gerber_image = GetGbrImage( GetActiveLayer() );
200 
201  if( gerber_image )
202  {
203  int tool = m_DCodeSelector->GetSelectedDCodeId();
204 
205  if( tool != gerber_image->m_Selected_Tool )
206  {
207  gerber_image->m_Selected_Tool = tool;
208  GetCanvas()->Refresh();
209  }
210  }
211 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters (TODO:...
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
int GetSelectedDCodeId()
Function GetSelectedDCodeId.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
DCODE_SELECTION_BOX * m_DCodeSelector

References GetActiveLayer(), EDA_DRAW_FRAME::GetCanvas(), GetGbrImage(), DCODE_SELECTION_BOX::GetSelectedDCodeId(), m_DCodeSelector, GERBER_FILE_IMAGE::m_Selected_Tool, and EDA_DRAW_PANEL_GAL::Refresh().

◆ OnSelectActiveLayer()

void GERBVIEW_FRAME::OnSelectActiveLayer ( wxCommandEvent &  event)

Function OnSelectActiveLayer Selects the active layer:

  • if a file is loaded, it is loaded in this layer _ this layer is displayed on top of other layers

Definition at line 214 of file events_called_functions.cpp.

215 {
216  SetActiveLayer( event.GetSelection(), true );
217 
218  // Rebuild the DCode list in toolbar (but not the Layer Box) after change
219  syncLayerBox( false );
220 }
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...

References SetActiveLayer(), and syncLayerBox().

◆ OnSelectDisplayMode()

void GERBVIEW_FRAME::OnSelectDisplayMode ( wxCommandEvent &  event)

Function OnSelectDisplayMode called on a display mode selection Mode selection can be fast display, or exact mode with stacked images or with transparency.

Definition at line 261 of file events_called_functions.cpp.

262 {
263  switch( event.GetId() )
264  {
268  }
269 
270  GetCanvas()->Refresh();
271 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnToggleShowLayerManager GERBVIEW_FRAME::OnSelectHighlightChoice ID_TB_OPTIONS_SHOW_GBR_MODE_2
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetDisplayMode(int aMode)
Function SetDisplayMode.

References EDA_DRAW_FRAME::GetCanvas(), ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_1, ID_TB_OPTIONS_SHOW_GBR_MODE_2, EDA_DRAW_PANEL_GAL::Refresh(), and SetDisplayMode().

◆ OnSelectGrid()

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 255 of file eda_draw_frame.cpp.

256 {
257  wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
258 
259  int id = m_gridSelectBox->GetCurrentSelection() +