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

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 wxPoint & GetAuxOrigin () const override
 Return the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPoint & GetGridOrigin () 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...
 
PARAM_CFG_ARRAYGetConfigurationSettings (void)
 Function GetConfigurationSettings Populates the GerbView applications settings list. More...
 
void LoadSettings (wxConfigBase *aCfg) override
 Load common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *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...
 
GERBER_DRAW_ITEMLocate (const wxPoint &aPosition, int typeloc)
 
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)
 
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...
 
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, bool aCenterView=false)
 Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor) at a given coordinate and reframes the drawing if the requested point is out of view or if center on location is requested. More...
 
double GetZoom ()
 
void 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)
 
virtual void * GetDisplayOptions ()
 A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Return a reference to the gal rendering options used by GAL for rendering. More...
 
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_T GetUserUnits () const
 Return the user units currently in use. More...
 
void SetUserUnits (EDA_UNITS_T aUnits)
 
void ChangeUserUnits (EDA_UNITS_T aUnits)
 
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 wxConfigBase * config ()
 Returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
wxString ConfigBaseName ()
 
virtual void SaveProjectSettings (bool aAskForSave)
 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, wxFileHistory *aFileHistory=NULL)
 Fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *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
 
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

GBR_DISPLAY_OPTIONS m_DisplayOptions
 
wxChoice * m_SelComponentBox
 
wxChoice * m_SelNetnameBox
 
wxChoice * m_SelAperAttributesBox
 
GBR_LAYER_BOX_SELECTORm_SelLayerBox
 
DCODE_SELECTION_BOXm_DCodeSelector
 
wxTextCtrl * m_TextInfo
 
COLORS_DESIGN_SETTINGSm_colorsSettings
 

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...
 
virtual wxString GetCanvasTypeKey ()
 
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
 
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
 
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_T 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 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
 
PARAM_CFG_ARRAY m_configSettings
 
int m_displayMode
 
bool m_show_layer_manager_tools
 

Detailed Description

Definition at line 58 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 63 of file gerbview_frame.cpp.

63  :
64  EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
65  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME ),
69 {
71  m_gerberLayout = NULL;
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.
80  m_SelLayerBox = NULL;
81  m_DCodeSelector = NULL;
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;
92  Pgm().CommonSettings()->Read( FILE_HISTORY_SIZE_KEY, &fileHistorySize,
94  m_drillFileHistory.SetMaxFiles( fileHistorySize );
95  m_zipFileHistory.SetMaxFiles( fileHistorySize );
96  m_jobFileHistory.SetMaxFiles( fileHistorySize );
97 
98  auto* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
101 
102  SetCanvas( galCanvas );
103 
104  // GerbView requires draw priority for rendering negative objects
105  galCanvas->GetView()->UseDrawPriority( true );
106 
107  // Give an icon
108  wxIcon icon;
109  icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
110  SetIcon( icon );
111 
112  // Be sure a page info is set. this default value will be overwritten later.
113  PAGE_INFO pageInfo( wxT( "GERBER" ) );
114  SetLayout( new GBR_LAYOUT() );
115  SetPageSettings( pageInfo );
116 
117  SetVisibleLayers( LSET::AllLayersMask() ); // All draw layers visible.
118 
119  SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
120 
121  // Create the PCB_LAYER_WIDGET *after* SetLayout():
123 
124  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
125  // initialize parameters in m_LayersManager
126  LoadSettings( config() );
127 
128  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
129 
130  if( m_LastGridSizeId < 0 )
131  m_LastGridSizeId = 0;
132 
135 
137 
138  setupTools();
139  ReCreateMenuBar();
143 
144  m_auimgr.SetManagedWindow( this );
145 
146  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
147  m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) );
148  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
149 
150  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
151  m_auimgr.AddPane( m_LayersManager, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
152  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
153  .MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) );
154 
155  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
156 
157  ReFillLayerWidget(); // this is near end because contents establish size
158  m_auimgr.Update();
159 
160  SetActiveLayer( 0, true );
162 
164 
165  // Nudge user to switch to OpenGL if they are on legacy or Cairo
166  if( m_firstRunDialogSetting < 1 )
167  {
168  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
169  {
170  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
171  "and faster experience. This option is turned off by "
172  "default since it is not compatible with all computers.\n\n"
173  "Would you like to try enabling graphics acceleration?\n\n"
174  "If you'd like to choose later, select Accelerated Graphics "
175  "in the Preferences menu." );
176 
177  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
178 
179  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
180 
181  if( dlg.ShowModal() == wxID_YES )
182  {
183  // Save Cairo as default in case OpenGL crashes
185 
186  // Switch to OpenGL, which will save the new setting if successful
188 
189  // Switch back to Cairo if OpenGL is not supported
190  if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
192  }
193  else
194  {
195  // If they were on legacy, switch to Cairo
197  }
198  }
199 
201  SaveSettings( config() );
202  }
203 
204  SwitchCanvas( canvasType );
205 
206  // Enable the axes to match legacy draw style
207  auto& galOptions = GetGalDisplayOptions();
208  galOptions.m_axesEnabled = true;
209  galOptions.NotifyChanged();
210 
212  m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
213 
214  // Update the checked state of tools
215  SyncToolbars();
216 }
Class GBR_LAYOUT holds list of GERBER_DRAW_ITEM currently loaded.
Definition: gbr_layout.h:53
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_GERBER)
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
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:109
static TOOL_ACTION standardGraphics
Definition: actions.h:155
wxString m_AboutTitle
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
virtual wxConfigBase * config()
Returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_mainToolBar
wxChoice * m_SelNetnameBox
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
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:79
void ReCreateAuxiliaryToolbar() override
Class SHAPE_POLY_SET.
EDA_MSG_PANEL * m_messagePanel
GAL not used (the legacy wxDC engine is used)
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
COLORS_DESIGN_SETTINGS * m_colorsSettings
#define FILE_HISTORY_SIZE_KEY
Definition: pgm_base.h:54
GBR_LAYOUT * m_gerberLayout
static LSET AllLayersMask()
Definition: lset.cpp:713
Class GERBER_LAYER_WIDGET is here to implement the abtract functions of LAYER_WIDGET so they may be t...
#define KICAD_DEFAULT_DRAWFRAME_STYLE
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
FILE_HISTORY m_drillFileHistory
#define GERBVIEW_FRAME_NAME
Class GERBVIEW_FRAME is the main window used in GerbView.
#define _(s)
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:204
Specialization of the wxAuiPaneInfo class for KiCad panels.
#define ZOOM_FACTOR(x)
Definition: pcb_screen.cpp:42
DCODE_SELECTION_BOX * m_DCodeSelector
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
const PAGE_INFO & GetPageSettings() const override
void SetMaxFiles(size_t aMaxFiles)
Definition: pgm_base.cpp:120
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 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:154
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.
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
void SetLayout(GBR_LAYOUT *aLayout)
Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous G...
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 ...
long m_firstRunDialogSetting
void ReCreateOptToolbar() override
Create or update the left vertical toolbar (option toolbar.

References _, ACTIONS::acceleratedGraphics, LSET::AllLayersMask(), PCAD2KICAD::Center, PGM_BASE::CommonSettings(), EDA_BASE_FRAME::config(), DEFAULT_FILE_HISTORY_SIZE, dummy(), FILE_HISTORY_SIZE_KEY, g_ColorsSettings, 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_FRAME::GetGalDisplayOptions(), GetPageSettings(), EDA_DRAW_FRAME::GetScreen(), EDA_BASE_FRAME::GetToolManager(), ID_POPUP_GRID_LEVEL_0_0_1MM, ID_POPUP_GRID_LEVEL_1000, KiBitmap(), PCAD2KICAD::Left, EDA_DRAW_FRAME::LoadCanvasTypeSetting(), LoadSettings(), EDA_BASE_FRAME::m_AboutTitle, EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_auxiliaryToolBar, m_colorsSettings, 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, 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(), BASE_SCREEN::SetGrid(), SetLayout(), FILE_HISTORY::SetMaxFiles(), SetPageSettings(), EDA_DRAW_FRAME::SetScreen(), setupTools(), SetVisibleLayers(), ACTIONS::standardGraphics, EDA_DRAW_FRAME::SwitchCanvas(), SyncToolbars(), ZOOM_FACTOR, and ACTIONS::zoomFitScreen.

◆ ~GERBVIEW_FRAME()

GERBVIEW_FRAME::~GERBVIEW_FRAME ( )

Definition at line 219 of file gerbview_frame.cpp.

220 {
221  GetCanvas()->GetView()->Clear();
222 
224  delete m_gerberLayout;
225 }
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

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

Member Function Documentation

◆ ActivateGalCanvas()

void GERBVIEW_FRAME::ActivateGalCanvas ( )
overridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 1106 of file gerbview_frame.cpp.

1107 {
1109 
1110  EDA_DRAW_PANEL_GAL* galCanvas = GetCanvas();
1111 
1112  if( m_toolManager )
1113  {
1115  GetCanvas()->GetViewControls(), this );
1117  }
1118 
1120 
1122 
1123  galCanvas->GetView()->RecacheAllItems();
1124  galCanvas->SetEventDispatcher( m_toolDispatcher );
1125  galCanvas->StartDrawing();
1126 
1129 
1131  ReCreateMenuBar();
1132 
1133  // Update the checked state of tools
1134  SyncToolbars();
1135 }
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:83
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 365 of file eda_base_frame.cpp.

366 {
367  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
368  ACTION_MENU* helpMenu = new ACTION_MENU( false );
369 
370  helpMenu->SetTool( commonControl );
371 
372  helpMenu->Add( ACTIONS::help );
373  helpMenu->Add( ACTIONS::gettingStarted );
374  helpMenu->Add( ACTIONS::listHotKeys );
375  helpMenu->Add( ACTIONS::getInvolved );
376 
377  helpMenu->AppendSeparator();
378  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
379 
380  aMenuBar->Append( helpMenu, _( "&Help" ) );
381 }
static TOOL_ACTION listHotKeys
Definition: actions.h:167
Class ACTION_MENU.
Definition: action_menu.h:43
Class COMMON_CONTROL.
#define _(s)
static TOOL_ACTION help
Definition: actions.h:166
TOOL_MANAGER * m_toolManager
static TOOL_ACTION getInvolved
Definition: actions.h:168
static TOOL_ACTION gettingStarted
Definition: actions.h:165

References _, 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(), PL_EDITOR_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 349 of file eda_draw_frame.cpp.

350 {
351  COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
352  CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
353 
354  aMenu.AddSeparator( 1000 );
356  aMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways, 1000 );
357  aMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways, 1000 );
359 
360  aMenu.AddSeparator( 1000 );
361 
362  auto zoomMenu = std::make_shared<ZOOM_MENU>( this );
363  zoomMenu->SetTool( commonTools );
364  aToolMenu.AddSubMenu( zoomMenu );
365 
366  auto gridMenu = std::make_shared<GRID_MENU>( this );
367  gridMenu->SetTool( commonTools );
368  aToolMenu.AddSubMenu( gridMenu );
369 
370  aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
371  aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
372 }
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
Class 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(), PL_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_SELECTION_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 554 of file eda_draw_frame.cpp.

556 {
557  if( m_messagePanel )
558  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
559 }
int color
Definition: DXF_plotter.cpp:62
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::EditSheet(), 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(), and LIB_VIEW_FRAME::updatePreviewSymbol().

◆ applyDisplaySettingsToGAL()

void GERBVIEW_FRAME::applyDisplaySettingsToGAL ( )
private

Updates the GAL with display settings changes.

Definition at line 457 of file gerbview_frame.cpp.

458 {
459  auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
460  KIGFX::GERBVIEW_RENDER_SETTINGS* settings = painter->GetSettings();
461  settings->LoadDisplayOptions( &m_DisplayOptions );
462 
464 
466 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void LoadDisplayOptions(const GBR_DISPLAY_OPTIONS *aOptions)
Function LoadDisplayOptions Loads settings related to display options.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
COLORS_DESIGN_SETTINGS * m_colorsSettings
GBR_DISPLAY_OPTIONS m_DisplayOptions
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Class GERBVIEW_RENDER_SETTINGS Stores GerbView specific render settings.
void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings) override
Function ImportLegacyColors Loads a list of color settings for layers.

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), KIGFX::GERBVIEW_RENDER_SETTINGS::ImportLegacyColors(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions(), m_colorsSettings, m_DisplayOptions, KIGFX::VIEW::MarkTargetDirty(), and KIGFX::TARGET_NONCACHED.

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

◆ ChangeUserUnits()

void EDA_BASE_FRAME::ChangeUserUnits ( EDA_UNITS_T  aUnits)
inlineinherited

Definition at line 213 of file eda_base_frame.h.

214  {
215  SetUserUnits( aUnits );
217  }
void SetUserUnits(EDA_UNITS_T aUnits)
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...

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

689 {
690  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
691 
692  wxFileName autoSaveFileName = aFileName;
693 
694  // Check for auto save file.
695  autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
696 
697  wxLogTrace( traceAutoSave,
698  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
699 
700  if( !autoSaveFileName.FileExists() )
701  return;
702 
703  wxString msg = wxString::Format( _(
704  "Well this is potentially embarrassing!\n"
705  "It appears that the last time you were editing the file\n"
706  "\"%s\"\n"
707  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
708  GetChars( aFileName.GetFullName() )
709  );
710 
711  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
712 
713  // Make a backup of the current file, delete the file, and rename the auto save file to
714  // the file name.
715  if( response == wxYES )
716  {
717  // Get the backup file name.
718  wxFileName backupFileName = aFileName;
719  backupFileName.SetExt( aFileName.GetExt() + GetBackupSuffix() );
720 
721  // If an old backup file exists, delete it. If an old copy of the file exists, rename
722  // it to the backup file name
723  if( aFileName.FileExists() )
724  {
725  // Rename the old file to the backup file name.
726  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath(), true ) )
727  {
728  msg.Printf( _( "Could not create backup file \"%s\"" ),
729  GetChars( backupFileName.GetFullPath() ) );
730  wxMessageBox( msg );
731  }
732  }
733 
734  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
735  {
736  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
737  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
738  }
739  }
740  else
741  {
742  wxLogTrace( traceAutoSave,
743  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
744 
745  // Remove the auto save file when using the previous file as is.
746  wxRemoveFile( autoSaveFileName.GetFullPath() );
747  }
748 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
static wxString GetBackupSuffix()
#define _(s)
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

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:82
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:94
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.
#define _(s)
GBR_LAYOUT * GetGerberLayout() const
const PAGE_INFO & GetPageSettings() const override
Class 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:281
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, ReFillLayerWidget(), TOOL_MANAGER::ResetTools(), SetActiveLayer(), GBR_LAYOUT::SetBoundingBox(), SetPageSettings(), and syncLayerBox().

Referenced by Files_io(), and LoadGerberJobFile().

◆ ClearMsgPanel()

◆ CommonSettingsChanged()

void GERBVIEW_FRAME::CommonSettingsChanged ( bool  aEnvVarsChanged)
overridevirtual

Called after the preferences dialog is run.

Reimplemented from EDA_BASE_FRAME.

Definition at line 1234 of file gerbview_frame.cpp.

1235 {
1236  EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
1237 
1238  RecreateToolbars();
1239  Layout();
1240  SendSizeEvent();
1241 }
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()

wxConfigBase * EDA_BASE_FRAME::config ( )
virtualinherited

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

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 536 of file eda_base_frame.cpp.

537 {
538  // KICAD_MANAGER_FRAME overrides this
539  wxConfigBase* ret = Kiface().KifaceSettings();
540  //wxASSERT( ret );
541  return ret;
542 }
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:51

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

Referenced by CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME(), PCB_EDIT_FRAME::GetSettings(), LIB_VIEW_FRAME::LIB_VIEW_FRAME(), SIM_PLOT_FRAME::onClose(), FOOTPRINT_WIZARD_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OpenProjectFiles(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and EDA_BASE_FRAME::windowClosing().

◆ 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 337 of file eda_base_frame.h.

338  {
339  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
340  return baseCfgName;
341  }
wxString m_configName

References EDA_BASE_FRAME::m_configName.

Referenced by DISPLAY_FOOTPRINTS_FRAME::LoadSettings(), FOOTPRINT_VIEWER_FRAME::LoadSettings(), EDA_BASE_FRAME::LoadSettings(), EDA_DRAW_FRAME::LoadSettings(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), EDA_BASE_FRAME::SaveSettings(), EDA_DRAW_FRAME::SaveSettings(), 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 220 of file eda_base_frame.cpp.

221 {
222  if( m_toolStack.empty() )
223  return ACTIONS::selectionTool.GetName();
224  else
225  return m_toolStack.back();
226 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:143

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

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

967 {
968  wxString line;
969  wxString gridformatter;
970 
971  switch( m_userUnits )
972  {
973  case INCHES:
974  gridformatter = "grid X %.6f Y %.6f";
975  break;
976 
977  case MILLIMETRES:
978  gridformatter = "grid X %.6f Y %.6f";
979  break;
980 
981  default:
982  gridformatter = "grid X %f Y %f";
983  break;
984  }
985 
986  BASE_SCREEN* screen = GetScreen();
987  wxArrayString gridsList;
988 
989  int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES );
990  GRID_TYPE& grid = screen->GetGrid( icurr );
991  double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x );
992  double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y );
993  line.Printf( gridformatter, grid_x, grid_y );
994 
995  SetStatusText( line, 4 );
996 }
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
double To_User_Unit(EDA_UNITS_T 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:93
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:74
Definition: common.h:134
wxRealPoint m_Size
Definition: base_screen.h:47
EDA_UNITS_T m_userUnits
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:43
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 375 of file eda_draw_frame.cpp.

376 {
377  SetStatusText( msg, 6 );
378 }

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

413 {
414  wxString msg;
415 
416  switch( m_userUnits )
417  {
418  case INCHES: msg = _( "Inches" ); break;
419  case MILLIMETRES: msg = _( "mm" ); break;
420  default: msg = _( "Units" ); break;
421  }
422 
423  SetStatusText( msg, 5 );
424 }
Definition: common.h:134
#define _(s)
EDA_UNITS_T 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 303 of file eda_base_frame.cpp.

304 {
305  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
306 }

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:82
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.
#define _(s)
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 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:281
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 244 of file eda_draw_frame.cpp.

245 {
246  if( m_messagePanel )
248 }
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 PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 274 of file eda_draw_frame.h.

274 {}

Referenced by EDA_DRAW_FRAME::OnSockRequest().

◆ ExportDataInPcbnewFormat()

void GERBVIEW_FRAME::ExportDataInPcbnewFormat ( wxCommandEvent &  event)

Definition at line 168 of file export_to_pcbnew.cpp.

169 {
170  int layercount = 0;
171 
173 
174  // Count the Gerber layers which are actually currently used
175  for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
176  {
177  if( images->GetGbrImage( ii ) )
178  layercount++;
179  }
180 
181  if( layercount == 0 )
182  {
183  DisplayInfoMessage( this,
184  _( "None of the Gerber layers contain any data" ) );
185  return;
186  }
187 
188  wxString fileName;
189  wxString path = m_mruPath;
190 
191  wxFileDialog filedlg( this, _( "Board File Name" ),
192  path, fileName, PcbFileWildcard(),
193  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
194 
195  if( filedlg.ShowModal() == wxID_CANCEL )
196  return;
197 
198  fileName = filedlg.GetPath();
199 
200  /* Install a dialog frame to choose the mapping
201  * between gerber layers and Pcbnew layers
202  */
203  LAYERS_MAP_DIALOG* layerdlg = new LAYERS_MAP_DIALOG( this );
204  int ok = layerdlg->ShowModal();
205  layerdlg->Destroy();
206 
207  if( ok != wxID_OK )
208  return;
209 
210  m_mruPath = wxFileName( fileName ).GetPath();
211 
212  GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
213 
214  gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), layerdlg->GetCopperLayersCount() );
215 }
wxString m_mruPath
LAYER_NUM * GetLayersLookUpTable()
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)
#define _(s)
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
GBR_LAYOUT * GetGerberLayout() const
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:265

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(), EDA_BASE_FRAME::m_mruPath, and PcbFileWildcard().

◆ Files_io()

void GERBVIEW_FRAME::Files_io ( wxCommandEvent &  event)

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

99 {
100  int id = event.GetId();
101 
102  switch( id )
103  {
104  case wxID_FILE:
105  LoadGerberFiles( wxEmptyString );
106  break;
107 
109  Clear_DrawLayers( false );
110  Zoom_Automatique( false );
111  GetCanvas()->Refresh();
112  ClearMsgPanel();
113  break;
114 
116  {
117  // Store filenames
118  wxArrayString listOfGerberFiles;
119  std::vector<int> fileType;
120 
121  for( unsigned i = 0; i < GetImagesList()->ImagesMaxCount(); i++ )
122  {
123  if( GetImagesList()->GetGbrImage( i ) == nullptr )
124  continue;
125 
126  if( !GetImagesList()->GetGbrImage( i )->m_InUse )
127  continue;
128 
129  auto* drill_file = dynamic_cast<EXCELLON_IMAGE*>( GetImagesList()->GetGbrImage( i ) );
130 
131  if( drill_file )
132  fileType.push_back( 1 );
133  else
134  fileType.push_back( 0 );
135 
136  listOfGerberFiles.Add( GetImagesList()->GetGbrImage( i )->m_FileName );
137  }
138 
139  // Clear all layers
140  Clear_DrawLayers( false );
141  Zoom_Automatique( false );
142  GetCanvas()->Refresh();
143  ClearMsgPanel();
144 
145  // Load the layers from stored paths
146  wxBusyCursor wait;
147  loadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &fileType );
148  }
149  break;
150 
152  LoadExcellonFiles( wxEmptyString );
153  GetCanvas()->Refresh();
154  break;
155 
157  LoadZipArchiveFile( wxEmptyString );
158  GetCanvas()->Refresh();
159  break;
160 
162  LoadGerberJobFile( wxEmptyString );
163  GetCanvas()->Refresh();
164  break;
165 
166  default:
167  wxFAIL_MSG( "File_io: unexpected command id" );
168  break;
169  }
170 }
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.
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...
size_t i
Definition: json11.cpp:597
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(), EDA_DRAW_FRAME::GetCanvas(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GetGbrImage(), GetImagesList(), i, 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,
bool  aCenterView = false 
)
inherited

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

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

Definition at line 727 of file eda_draw_frame.cpp.

728 {
729  if( aCenterView )
730  {
731  wxWindow* dialog = findDialog( GetChildren() );
732 
733  // If a dialog partly obscures the window, then center on the uncovered area.
734  if( dialog )
735  {
736  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
737  dialog->GetSize() );
738  GetCanvas()->GetView()->SetCenter( aPos, dialogRect );
739  }
740  else
741  GetCanvas()->GetView()->SetCenter( aPos );
742  }
743 
745 }
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
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.

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

Referenced by DIALOG_DRC_CONTROL::doSelectionMenu(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindNext(), DIALOG_DRC_CONTROL::focusOnItem(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_ERC::OnLeftClickMarkersList(), DIALOG_ERC::OnLeftDblClickMarkersList(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), and DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem().

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 467 of file eda_base_frame.h.

467 { 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 166 of file eda_base_frame.h.

167  {
168  return wxT( "_autosave-" );
169  }

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

282 { 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 942 of file gerbview_frame.cpp.

943 {
944  wxASSERT( m_gerberLayout );
945  return m_gerberLayout->GetAuxOrigin();
946 }
const wxPoint & GetAuxOrigin() const
Definition: gbr_layout.h:73
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 158 of file eda_base_frame.h.

159  {
160  return wxT( "-bak" );
161  }

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, PL_EDITOR_FRAME, and SCH_BASE_FRAME.

Definition at line 486 of file eda_draw_frame.h.

486 { 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(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), Erase_Current_DrawLayer(), Files_io(), EDA_DRAW_FRAME::FocusOnLocation(), GERBVIEW_FRAME(), SCH_BASE_FRAME::GetCanvas(), PL_EDITOR_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(), 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(), 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().

◆ GetCanvasTypeKey()

virtual wxString EDA_DRAW_FRAME::GetCanvasTypeKey ( )
inlineprotectedvirtualinherited
Returns
the key in KifaceSettings to store the canvas type. the base version returns only CanvasTypeKeyBase. Can be overriden to return a key specific of a frame name

Definition at line 170 of file eda_draw_frame.h.

170 { return CanvasTypeKeyBase; }
#define CanvasTypeKeyBase
The key to store the canvas type in config.

References CanvasTypeKeyBase.

Referenced by EDA_DRAW_FRAME::LoadCanvasTypeSetting(), and EDA_DRAW_FRAME::saveCanvasTypeSetting().

◆ GetConfigurationSettings()

PARAM_CFG_ARRAY & GERBVIEW_FRAME::GetConfigurationSettings ( void  )

Function GetConfigurationSettings Populates the GerbView applications settings list.

(list of parameters that must be saved in GerbView parameters) Currently, only the settings that are needed at start up by the main window are defined here. There are other locally used settings scattered throughout the GerbView source code (mainly in dialogs). If you need to define a configuration setting that need to be loaded at run time, this is the place to define it.

Definition at line 50 of file gerbview_config.cpp.

51 {
52  if( !m_configSettings.empty() )
53  return m_configSettings;
54 
55  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
56  &m_displayMode, 2, 0, 2 ) );
57  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
58  true, wxT( "DCodeColorEx" ),
60  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
61  true, wxT( "NegativeObjectsColorEx" ),
63  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
64  true, wxT( "GridColorEx" ),
66  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
67  true, wxT( "WorksheetColorEx" ),
69  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
70  true, wxT( "BackgroundColorEx" ),
72  m_configSettings.push_back( new PARAM_CFG_BOOL(
73  true, wxT( "DisplayPolarCoordinates" ),
74  &m_PolarCoords, false ) );
75 
76  // Default colors for layers 0 to 31
77  static const COLOR4D color_default[] = {
86  };
87 
88  // List of keywords used as identifiers in config.
89  // They *must* be static const and not temporarily created,
90  // because the parameter list that use these keywords does not store them,
91  // just points to them.
92  static const wxChar* keys[] = {
93  wxT("ColorLayer0Ex"), wxT("ColorLayer1Ex"), wxT("ColorLayer2Ex"), wxT("ColorLayer3Ex"),
94  wxT("ColorLayer4Ex"), wxT("ColorLayer5Ex"), wxT("ColorLayer6Ex"), wxT("ColorLayer7Ex"),
95  wxT("ColorLayer8Ex"), wxT("ColorLayer9Ex"), wxT("ColorLayer10Ex"), wxT("ColorLayer11Ex"),
96  wxT("ColorLayer12Ex"), wxT("ColorLayer13Ex"), wxT("ColorLayer14Ex"), wxT("ColorLayer15Ex"),
97  wxT("ColorLayer16Ex"), wxT("ColorLayer17Ex"), wxT("ColorLayer18Ex"), wxT("ColorLayer19Ex"),
98  wxT("ColorLayer20Ex"), wxT("ColorLayer21Ex"), wxT("ColorLayer22Ex"), wxT("ColorLayer23Ex"),
99  wxT("ColorLayer24Ex"), wxT("ColorLayer25Ex"), wxT("ColorLayer26Ex"), wxT("ColorLayer27Ex"),
100  wxT("ColorLayer28Ex"), wxT("ColorLayer29Ex"), wxT("ColorLayer30Ex"), wxT("ColorLayer31Ex"),
101  };
102 
103  wxASSERT( arrayDim(keys) == arrayDim(color_default) );
104  wxASSERT( arrayDim(keys) <= arrayDim(g_ColorsSettings.m_LayersColors) && arrayDim(keys) <= arrayDim(color_default) );
105 
106  for( unsigned i = 0; i < arrayDim(keys); ++i )
107  {
109 
110  PARAM_CFG_SETCOLOR* prm_entry =
111  new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
112 
113  m_configSettings.push_back( prm_entry );
114  }
115 
116  return m_configSettings;
117 }
Definition: colors.h:57
Definition: colors.h:61
Definition: colors.h:54
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
PARAM_CFG_ARRAY m_configSettings
Configuration parameter - SetColor Class.
Configuration parameter - Integer Class.
Definition: colors.h:59
Configuration parameter - Boolean Class.
Definition: colors.h:60
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
Definition: colors.h:58
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_CVPCB_DISPLAY)
size_t i
Definition: json11.cpp:597
Definition: colors.h:49
#define GERBER_DRAW_LAYER(x)
Definition: colors.h:45
Definition: colors.h:68
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62

References arrayDim(), BLACK, BLUE, BROWN, CYAN, DARKCYAN, DARKGRAY, DARKGREEN, DARKRED, g_ColorsSettings, GERBER_DRAW_LAYER, GREEN, i, LAYER_DCODES, LAYER_GERBVIEW_GRID, LAYER_NEGATIVE_OBJECTS, LAYER_PCB_BACKGROUND, LAYER_WORKSHEET, LIGHTCYAN, LIGHTGRAY, LIGHTMAGENTA, LIGHTRED, m_configSettings, m_displayMode, COLORS_DESIGN_SETTINGS::m_LayersColors, EDA_DRAW_FRAME::m_PolarCoords, MAGENTA, RED, WHITE, and YELLOW.

Referenced by LoadSettings(), and SaveSettings().

◆ 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 243 of file gerbview_frame.h.

243 { return m_displayMode; }

References m_displayMode.

Referenced by OnUpdateDrawMode().

◆ GetDisplayOptions()

virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

A way to pass info to draw functions.

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

Reimplemented in PCB_BASE_FRAME.

Definition at line 494 of file eda_draw_frame.h.

494 { return NULL; }

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

◆ GetDocumentExtents()

const BOX2I GERBVIEW_FRAME::GetDocumentExtents ( ) const
inlineoverridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 131 of file gerbview_frame.h.

132  {
133  wxASSERT( m_gerberLayout );
134  return m_gerberLayout->ViewBBox();
135  }
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 243 of file eda_base_frame.h.

243 { 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 249 of file eda_base_frame.h.

249 { return m_dragSelects; }

References EDA_BASE_FRAME::m_dragSelects.

Referenced by EE_SELECTION_TOOL::Main().

◆ GetDrawBgColor()

virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited

◆ GetFileFromHistory()

wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  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 wxFileHistory::UseMenu was called at init time

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

Definition at line 575 of file eda_base_frame.cpp.

577 {
578  wxFileHistory* fileHistory = aFileHistory;
579 
580  if( !fileHistory )
581  fileHistory = &Kiface().GetFileHistory();
582 
583  int baseId = fileHistory->GetBaseId();
584 
585  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
586 
587  unsigned i = cmdId - baseId;
588 
589  if( i < fileHistory->GetCount() )
590  {
591  wxString fn = fileHistory->GetHistoryFile( i );
592 
593  if( wxFileName::FileExists( fn ) )
594  return fn;
595  else
596  {
597  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
598  wxMessageBox( msg );
599 
600  fileHistory->RemoveFileFromHistory( i );
601  }
602  }
603 
604  return wxEmptyString;
605 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:51
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
FILE_HISTORY & GetFileHistory()
Definition: kiface_i.h:123
size_t i
Definition: json11.cpp:597

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

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

◆ GetFindHistoryList()

wxArrayString& EDA_DRAW_FRAME::GetFindHistoryList ( )
inlineinherited

◆ GetFindReplaceData()

wxFindReplaceData& EDA_DRAW_FRAME::GetFindReplaceData ( )
inlineinherited

◆ 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 105 of file gerbview_frame.h.

105 { return m_grid_origin; }
wxPoint m_grid_origin

References m_grid_origin.

◆ GetImagesList()

◆ GetLastGridSizeId()

int EDA_DRAW_FRAME::GetLastGridSizeId ( ) const
inlineinherited

Definition at line 227 of file eda_draw_frame.h.

227 { 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 852 of file gerbview_frame.cpp.

853 {
854  return m_colorsSettings->GetLayerColor( aLayer );
855 }
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
COLORS_DESIGN_SETTINGS * m_colorsSettings

References COLORS_DESIGN_SETTINGS::GetLayerColor(), and m_colorsSettings.

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

255 { return m_moveWarpsCursor; }

References EDA_BASE_FRAME::m_moveWarpsCursor.

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

◆ GetMruPath()

wxString EDA_BASE_FRAME::GetMruPath ( ) const
inlineinherited

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

691 {
692  return GetScreen()->getNearestGridPosition( aPosition, GetGridOrigin() );
693 }
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 Locate(), 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 843 of file gerbview_frame.cpp.

844 {
847  else
848  return GetDrawBgColor();
849 }
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 469 of file gerbview_frame.cpp.

470 {
471  int layer = aLayer;
472 
473  for( unsigned i = 0; i < ImagesMaxCount(); ++i )
474  {
475  const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
476 
477  if( gerber == NULL ) // this graphic layer is available: use it
478  return layer;
479 
480  ++layer; // try next graphic layer
481 
482  if( layer >= (int)ImagesMaxCount() )
483  layer = 0;
484  }
485 
486  return NO_AVAILABLE_LAYERS;
487 }
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
unsigned ImagesMaxCount() const
The max number of file images.
#define NO_AVAILABLE_LAYERS
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
size_t i
Definition: json11.cpp:597

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

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

920 {
921  // this function is only needed because EDA_DRAW_FRAME is not compiled
922  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
923  // into an application specific source file.
924  return GetPageSettings().GetSizeIU();
925 }
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 801 of file eda_draw_frame.cpp.

802 {
803  // Virtual function. Base class implementation returns an empty string.
804  return wxEmptyString;
805 }

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

◆ GetShowPolarCoords()

◆ GetTitleBlock()

const TITLE_BLOCK & GERBVIEW_FRAME::GetTitleBlock ( ) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 928 of file gerbview_frame.cpp.

929 {
930  wxASSERT( m_gerberLayout );
931  return m_gerberLayout->GetTitleBlock();
932 }
TITLE_BLOCK & GetTitleBlock()
Definition: gbr_layout.h:76
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 222 of file eda_base_frame.h.

222 { 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_DRC_CONTROL::DelDRCMarkers(), DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES(), SCH_EDIT_FRAME::DisplayCurrentSheet(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), DIALOG_DRC_CONTROL::doSelectionMenu(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), DIALOG_DRC_CONTROL::focusOnItem(), GERBVIEW_FRAME(), FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), KICAD_MANAGER_FRAME::InstallPreferences(), PL_EDITOR_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(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), DIALOG_INSPECTOR::onCellClicked(), SIM_PLOT_FRAME::onClose(), SYMBOL_TREE_PANE::onComponentSelected(), DIALOG_DRC_CONTROL::OnDeleteOneClick(), DIALOG_ERC::OnLeftClickMarkersList(), FOOTPRINTS_LISTBOX::OnLeftDClick(), SIM_PLOT_FRAME::onProbe(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnRightUpItem(), DIALOG_PLOT::onRunDRC(), HIERARCHY_NAVIG_DLG::onSelectSheetPath(), DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick(), SIM_PLOT_FRAME::onTune(), DIALOG_PLOT::Plot(), EDA_BASE_FRAME::PopTool(), BOARD_COMMIT::Push(), SCH_EDIT_FRAME::PutDataInPreviousState(), PL_EDITOR_FRAME::RollbackFromUndo(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), PCB_BASE_FRAME::SetFastGrid1(), PCB_BASE_FRAME::SetFastGrid2(), CVPCB_MAINFRAME::setupEventHandlers(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), DIALOG_SET_GRID::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::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(), PL_EDITOR_FRAME::SaveSettings(), and SaveSettings().

◆ GetUserUnits()

EDA_UNITS_T EDA_BASE_FRAME::GetUserUnits ( ) const
inlineinherited

Return the user units currently in use.

Definition at line 210 of file eda_base_frame.h.

210 { return m_userUnits; }
EDA_UNITS_T 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(), MARKER_BASE::DisplayMarkerInfo(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), LIB_EDIT_TOOL::editGraphicProperties(), LIB_PIN_TOOL::EditPinProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), 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_PREV_3D::PANEL_PREV_3D(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), DRC::Reset(), 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_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(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), DRC::updatePointers(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), UpdateStatusBar(), PCB_EDIT_FRAME::UpdateTrackWidthSelectBox(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), 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 785 of file gerbview_frame.cpp.

786 {
787  COLOR4D color = COLOR4D::UNSPECIFIED;
788 
789  switch( aLayerID )
790  {
792  case LAYER_DCODES:
793  case LAYER_WORKSHEET:
795  color = m_colorsSettings->GetItemColor( aLayerID );
796  break;
797 
798  case LAYER_GERBVIEW_GRID:
799  color = GetGridColor();
800  break;
801 
802  default:
803  wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID );
804  }
805 
806  return color;
807 }
int color
Definition: DXF_plotter.cpp:62
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
COLORS_DESIGN_SETTINGS * m_colorsSettings
virtual COLOR4D GetGridColor()
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References color, EDA_DRAW_FRAME::GetGridColor(), COLORS_DESIGN_SETTINGS::GetItemColor(), LAYER_DCODES, LAYER_GERBVIEW_GRID, LAYER_NEGATIVE_OBJECTS, LAYER_PCB_BACKGROUND, LAYER_WORKSHEET, and m_colorsSettings.

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

750 {
751  LSET visible = LSET::AllLayersMask();
752 
753  if( GetCanvas() )
754  {
755  for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
756  visible[i] = GetCanvas()->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) );
757  }
758 
759  return visible;
760 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Class 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:713
size_t i
Definition: json11.cpp:597
#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(), i, and KIGFX::VIEW::IsLayerVisible().

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

◆ GetZoom()

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

Definition at line 343 of file eda_draw_frame.cpp.

344 {
345  return GetScreen()->GetZoom();
346 }
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 289 of file eda_draw_frame.h.

289 { 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 1079 of file gerbview_frame.cpp.

1080 {
1082 }
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, PL_EDITOR_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 703 of file eda_draw_frame.cpp.

704 {
705  // To be implemented by subclasses.
706 }

Referenced by COMMON_TOOLS::ZoomRedraw().

◆ hasAvailableLayers()

bool GERBVIEW_FRAME::hasAvailableLayers ( ) const
inline

Definition at line 357 of file gerbview_frame.h.

358  {
360  }
#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 551 of file eda_base_frame.cpp.

552 {
553  return Kiface().GetHelpFileName();
554 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:51
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:121

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

1092 {
1094 }
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(), Liste_D_Codes(), and Locate().

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

317 {
318  wxAcceleratorEntry entries[1];
319  entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
320  wxAcceleratorTable accel( 1, entries );
321  SetAcceleratorTable( accel );
322 }

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 37 of file gerbview_config.cpp.

39 {
40  wxTreebook* book = aParent->GetTreebook();
41 
42  book->AddPage( new wxPanel( book ), _( "Gerbview" ) );
43  book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
44  book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
45 
46  aHotkeysPanel->AddHotKeys( GetToolManager() );
47 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
void AddHotKeys(TOOL_MANAGER *aToolMgr)
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
#define _(s)

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

181 { return false; }

Referenced by EDA_BASE_FRAME::ProcessEvent().

◆ IsCurrentTool()

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

Definition at line 229 of file eda_base_frame.cpp.

230 {
231  if( m_toolStack.empty() )
232  return &aAction == &ACTIONS::selectionTool;
233  else
234  return m_toolStack.back() == aAction.GetName();
235 }
std::vector< std::string > m_toolStack
static TOOL_ACTION selectionTool
Definition: actions.h:143
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 731 of file gerbview_frame.cpp.

732 {
733  switch( aLayerID )
734  {
737  case LAYER_GERBVIEW_GRID: return IsGridVisible();
739  case LAYER_PCB_BACKGROUND: return true;
740 
741  default:
742  wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID );
743  }
744 
745  return true;
746 }
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_GRID, LAYER_NEGATIVE_OBJECTS, LAYER_PCB_BACKGROUND, 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 779 of file gerbview_frame.cpp.

780 {
781  return m_LayersManager->IsLayerVisible( aLayer );
782 }
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 284 of file eda_base_frame.h.

284 { 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(), LIB_CONTROL::CutCopyDelete(), 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(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), LIB_CONTROL::Revert(), EE_INSPECTION_TOOL::RunERC(), LIB_CONTROL::Save(), PCBNEW_CONTROL::Show3DViewer(), LIB_CONTROL::ShowComponentTree(), EE_INSPECTION_TOOL::ShowDatasheet(), 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 644 of file eda_base_frame.cpp.

645 {
646  wxString msg;
647  wxFileName fn = aFileName;
648 
649  // Check for absence of a file path with a file name. Unfortunately KiCad
650  // uses paths relative to the current project path without the ./ part which
651  // confuses wxFileName. Making the file name path absolute may be less than
652  // elegant but it solves the problem.
653  if( fn.GetPath().IsEmpty() && fn.HasName() )
654  fn.MakeAbsolute();
655 
656  wxCHECK_MSG( fn.IsOk(), false,
657  wxT( "File name object is invalid. Bad programmer!" ) );
658  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
659  wxT( "File name object path <" ) + fn.GetFullPath() +
660  wxT( "> is not set. Bad programmer!" ) );
661 
662  if( fn.IsDir() && !fn.IsDirWritable() )
663  {
664  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
665  GetChars( fn.GetPath() ) );
666  }
667  else if( !fn.FileExists() && !fn.IsDirWritable() )
668  {
669  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
670  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
671  }
672  else if( fn.FileExists() && !fn.IsFileWritable() )
673  {
674  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
675  GetChars( fn.GetFullPath() ) );
676  }
677 
678  if( !msg.IsEmpty() )
679  {
680  wxMessageBox( msg );
681  return false;
682  }
683 
684  return true;
685 }
#define _(s)
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

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(), and SCH_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_EDIT_FRAME::EditSheet(), SCH_EDITOR_CONTROL::EditWithLibEdit(), 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(), 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(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), 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(), 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(), 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(), LIB_MANAGER::UpdatePart(), 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, PCB_EDIT_FRAME, SCH_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:415

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

810 {
811  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
812  aFilename.SetExt( ext );
813 
814  if( isDirectory && doOpen )
815  {
816  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
817  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
818 
819  if( dlg.ShowModal() == wxID_CANCEL )
820  return false;
821 
822  aFilename = dlg.GetPath();
823  aFilename.SetExt( ext );
824  }
825  else
826  {
827  wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
828  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
829  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
830 
831  if( dlg.ShowModal() == wxID_CANCEL )
832  return false;
833 
834  aFilename = dlg.GetPath();
835  aFilename.SetExt( ext );
836  }
837 
838  return true;
839 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define _(s)

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

519 {
520  int ii, jj;
521  wxString Line;
522  wxArrayString list;
523  double scale = GetUserUnits() == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
524  int curr_layer = GetActiveLayer();
525 
526  for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
527  {
528  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
529 
530  if( gerber == NULL )
531  continue;
532 
533  if( gerber->GetDcodesCount() == 0 )
534  continue;
535 
536  if( layer == curr_layer )
537  Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
538  else
539  Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
540 
541  list.Add( Line );
542 
543  const char* units = GetUserUnits() == INCHES ? "\"" : "mm";
544 
545  for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
546  {
547  D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE );
548 
549  if( pt_D_code == NULL )
550  continue;
551 
552  if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
553  continue;
554 
555  Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s attribute '%s'" ),
556  jj,
557  pt_D_code->m_Num_Dcode,
558  pt_D_code->m_Size.y / scale, units,
559  pt_D_code->m_Size.x / scale, units,
560  D_CODE::ShowApertureType( pt_D_code->m_Shape ),
561  pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
562  );
563 
564  if( !pt_D_code->m_Defined )
565  Line += wxT( " (not defined)" );
566 
567  if( pt_D_code->m_InUse )
568  Line += wxT( " (in use)" );
569 
570  list.Add( Line );
571  jj++;
572  }
573  }
574 
575  wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
576  wxCHOICEDLG_STYLE & ~wxCANCEL );
577 
578  dlg.ShowModal();
579 }
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.
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
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 FIRST_DCODE
Definition: dcode.h:71
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
Definition: common.h:134
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
#define _(s)
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
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
#define IU_PER_MILS
Definition: plotter.cpp:135

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

614 {
616  wxConfigBase* cfg = Kiface().KifaceSettings();
617 
618  if( cfg )
619  {
620  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
622  }
623 
624  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
625  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
626  {
627  wxASSERT( false );
629  }
630 
631  // Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
632  // the user will be prompted to switch to OpenGL
633  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
634  {
635 #ifdef __WXMAC__
636  // Cairo renderer doesn't handle Retina displays
638 #else
640 #endif
641  }
642 
643  return canvasType;
644 }
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
virtual wxString GetCanvasTypeKey()
Sentinel, do not use as a parameter.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:51
GAL not used (the legacy wxDC engine is used)

References 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, EDA_DRAW_FRAME::GetCanvasTypeKey(), Kiface(), and KIFACE_I::KifaceSettings().

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 384 of file gerbview/files.cpp.

385 {
386  wxString filetypes;
387  wxArrayString filenamesList;
388  wxFileName filename = aFullFileName;
389  wxString currentPath;
390 
391  if( !filename.IsOk() )
392  {
393  filetypes = DrillFileWildcard();
394  filetypes << wxT( "|" );
395 
396  /* All filetypes */
397  filetypes += AllFilesWildcard();
398 
399  /* Use the current working directory if the file name path does not exist. */
400  if( filename.DirExists() )
401  currentPath = filename.GetPath();
402  else
403  currentPath = m_mruPath;
404 
405  wxFileDialog dlg( this, _( "Open NC (Excellon) Drill File(s)" ),
406  currentPath, filename.GetFullName(), filetypes,
407  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
408 
409  if( dlg.ShowModal() == wxID_CANCEL )
410  return false;
411 
412  dlg.GetPaths( filenamesList );
413  currentPath = wxGetCwd();
414  m_mruPath = currentPath;
415  }
416  else
417  {
418  filenamesList.Add( aFullFileName );
419  currentPath = filename.GetPath();
420  m_mruPath = currentPath;
421  }
422 
423  // Read Excellon drill files: each file is loaded on a new GerbView layer
424  bool success = true;
425  int layer = GetActiveLayer();
426 
427  // Manage errors when loading files
428  wxString msg;
429  WX_STRING_REPORTER reporter( &msg );
430 
431  for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
432  {
433  filename = filenamesList[ii];
434 
435  if( !filename.IsAbsolute() )
436  filename.SetPath( currentPath );
437 
438  m_lastFileName = filename.GetFullPath();
439 
440  SetActiveLayer( layer, false );
441 
442  if( Read_EXCELLON_File( filename.GetFullPath() ) )
443  {
444  // Update the list of recent drill files.
445  UpdateFileHistory( filename.GetFullPath(), &m_drillFileHistory );
446 
447  layer = getNextAvailableLayer( layer );
448 
449  if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
450  {
451  success = false;
452  reporter.Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
453 
454  // Report the name of not loaded files:
455  ii += 1;
456  while( ii < filenamesList.GetCount() )
457  {
458  filename = filenamesList[ii++];
459  wxString txt = wxString::Format( MSG_NOT_LOADED, filename.GetFullName() );
460  reporter.Report( txt, REPORTER::RPT_ERROR );
461  }
462  break;
463  }
464 
465  SetActiveLayer( layer, false );
466  }
467  }
468 
469  if( !success )
470  {
471  HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
472  mbox.ListSet( msg );
473  mbox.ShowModal();
474  }
475 
476  Zoom_Automatique( false );
477 
478  // Synchronize layers tools with actual active layer:
482  syncLayerBox();
483 
484  return success;
485 }
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, wxFileHistory *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 ...
Class HTML_MESSAGE_BOX.
FILE_HISTORY m_drillFileHistory
#define MSG_NO_MORE_LAYER
#define _(s)
wxString DrillFileWildcard()
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:165
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
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(), REPORTER::RPT_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 173 of file gerbview/files.cpp.

174 {
175  static int lastGerberFileWildcard = 0;
176  wxString filetypes;
177  wxArrayString filenamesList;
178  wxFileName filename = aFullFileName;
179  wxString currentPath;
180 
181  if( !filename.IsOk() )
182  {
183  /* Standard gerber filetypes
184  * (See http://en.wikipedia.org/wiki/Gerber_File)
185  * the .gbr (.pho in legacy files) extension is the default used in Pcbnew
186  * However there are a lot of other extensions used for gerber files
187  * Because the first letter is usually g, we accept g* as extension
188  * (Mainly internal copper layers do not have specific extension,
189  * and filenames are like *.g1, *.g2 *.gb1 ...).
190  * Now (2014) Ucamco (the company which manages the Gerber format) encourages
191  * use of .gbr only and the Gerber X2 file format.
192  */
193  filetypes = _( "Gerber files (.g* .lgr .pho)" );
194  filetypes << wxT("|");
195  filetypes += wxT("*.g*;*.G*;*.pho;*.PHO" );
196  filetypes << wxT("|");
197 
198  /* Special gerber filetypes */
199  filetypes += _( "Top layer (*.GTL)|*.GTL;*.gtl|" );
200  filetypes += _( "Bottom layer (*.GBL)|*.GBL;*.gbl|" );
201  filetypes += _( "Bottom solder resist (*.GBS)|*.GBS;*.gbs|" );
202  filetypes += _( "Top solder resist (*.GTS)|*.GTS;*.gts|" );
203  filetypes += _( "Bottom overlay (*.GBO)|*.GBO;*.gbo|" );
204  filetypes += _( "Top overlay (*.GTO)|*.GTO;*.gto|" );
205  filetypes += _( "Bottom paste (*.GBP)|*.GBP;*.gbp|" );
206  filetypes += _( "Top paste (*.GTP)|*.GTP;*.gtp|" );
207  filetypes += _( "Keep-out layer (*.GKO)|*.GKO;*.gko|" );
208  filetypes += _( "Mechanical layers (*.GMx)|*.GM1;*.gm1;*.GM2;*.gm2;*.GM3;*.gm3|" );
209  filetypes += _( "Top Pad Master (*.GPT)|*.GPT;*.gpt|" );
210  filetypes += _( "Bottom Pad Master (*.GPB)|*.GPB;*.gpb|" );
211 
212  // All filetypes
213  filetypes += AllFilesWildcard();
214 
215  // Use the current working directory if the file name path does not exist.
216  if( filename.DirExists() )
217  currentPath = filename.GetPath();
218  else
219  {
220  currentPath = m_mruPath;
221 
222  // On wxWidgets 3.1 (bug?) the path in wxFileDialog is ignored when
223  // finishing by the dir separator. Remove it if any:
224  if( currentPath.EndsWith( '\\' ) || currentPath.EndsWith( '/' ) )
225  currentPath.RemoveLast();
226  }
227 
228  wxFileDialog dlg( this, _( "Open Gerber File(s)" ),
229  currentPath,
230  filename.GetFullName(),
231  filetypes,
232  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
233  dlg.SetFilterIndex( lastGerberFileWildcard );
234 
235  if( dlg.ShowModal() == wxID_CANCEL )
236  return false;
237 
238  lastGerberFileWildcard = dlg.GetFilterIndex();
239  dlg.GetPaths( filenamesList );
240  m_mruPath = currentPath = dlg.GetDirectory();
241  }
242  else
243  {
244  filenamesList.Add( aFullFileName );
245  m_mruPath = currentPath = filename.GetPath();
246  }
247 
248  Erase_Current_DrawLayer( false );
249 
250  // Set the busy cursor
251  wxBusyCursor wait;
252 
253  return loadListOfGerberAndDrillFiles( currentPath, filenamesList );
254 }
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)

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 170 of file job_file_reader.cpp.

171 {
172  wxFileName filename = aFullFileName;
173  wxString currentPath;
174  bool success = true;
175 
176  if( !filename.IsOk() )
177  {
178  // Use the current working directory if the file name path does not exist.
179  if( filename.DirExists() )
180  currentPath = filename.GetPath();
181  else
182  currentPath = m_mruPath;
183 
184  wxFileDialog dlg( this, _( "Open Gerber Job File" ),
185  currentPath,
186  filename.GetFullName(),
188  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
189 
190  if( dlg.ShowModal() == wxID_CANCEL )
191  return false;
192 
193  filename = dlg.GetPath();
194  currentPath = filename.GetPath();
195  m_mruPath = currentPath;
196  }
197  else
198  {
199  currentPath = filename.GetPath();
200  m_mruPath = currentPath;
201  }
202 
203  wxString msg;
204  WX_STRING_REPORTER reporter( &msg );
205 
206  if( filename.IsOk() )
207  {
208  GERBER_JOBFILE_READER gbjReader( filename.GetFullPath(), &reporter );
209 
210  if( gbjReader.ReadGerberJobFile() )
211  {
212  // Update the list of recent drill files.
213  UpdateFileHistory( filename.GetFullPath(), &m_jobFileHistory );
214 
215  Clear_DrawLayers( false );
216  ClearMsgPanel();
217 
218  wxArrayString& gbrfiles = gbjReader.GetGerberFiles();
219 
220  success = loadListOfGerberAndDrillFiles( currentPath, gbrfiles );
221  }
222  }
223 
225 
226  SetActiveLayer( 0 );
227 
228  if( !msg.IsEmpty() )
229  {
230  wxSafeYield(); // Allows slice of time to redraw the screen
231  // to refresh widgets, before displaying messages
232  HTML_MESSAGE_BOX mbox( this, _( "Messages" ) );
233  mbox.ListSet( msg );
234  mbox.ShowModal();
235  }
236 
237  return success;
238 }
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, wxFileHistory *aFileHistory=NULL)
Update the list of recently opened files.
Class HTML_MESSAGE_BOX.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
#define _(s)
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:165
wxString GerberJobFileWildcard()

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 257 of file gerbview/files.cpp.

260 {
261  wxFileName filename;
262 
263  // Read gerber files: each file is loaded on a new GerbView layer
264  bool success = true;
265  int layer = GetActiveLayer();
266  LSET visibility = GetVisibleLayers();
267 
268  // Manage errors when loading files
269  wxString msg;
270  WX_STRING_REPORTER reporter( &msg );
271 
272  // Create progress dialog (only used if more than 1 file to load
273  std::unique_ptr<WX_PROGRESS_REPORTER> progress = nullptr;
274 
275  for( unsigned ii = 0; ii < aFilenameList.GetCount(); ii++ )
276  {
277  filename = aFilenameList[ii];
278 
279  if( !filename.IsAbsolute() )
280  filename.SetPath( aPath );
281 
282  // Check for non existing files, to avoid creating broken or useless data
283  // and report all in one error list:
284  if( !filename.FileExists() )
285  {
286  wxString warning;
287  warning << "<b>" << _( "File not found:" ) << "</b><br>"
288  << filename.GetFullPath() << "<br>";
289  reporter.Report( warning, REPORTER::RPT_WARNING );
290  success = false;
291  continue;
292  }
293 
294  m_lastFileName = filename.GetFullPath();
295 
296  if( !progress && ( aFilenameList.GetCount() > 1 ) )
297  {
298  progress = std::make_unique<WX_PROGRESS_REPORTER>( this,
299  _( "Loading Gerber files..." ), 1, false );
300  progress->SetMaxProgress( aFilenameList.GetCount() - 1 );
301  progress->Report( wxString::Format( _("Loading %d/%d %s" ), ii+1,
302  aFilenameList.GetCount(), m_lastFileName ) );
303  }
304  else if( progress )
305  {
306  progress->Report( wxString::Format( _("Loading %d/%d %s" ), ii+1,
307  aFilenameList.GetCount(), m_lastFileName ) );
308  progress->KeepRefreshing();
309  }
310 
311  SetActiveLayer( layer, false );
312 
313  visibility[ layer ] = true;
314 
315  if( aFileType && (*aFileType)[ii] == 1 )
316  {
317  LoadExcellonFiles( filename.GetFullPath() );
318  layer = GetActiveLayer(); // Loading NC drill file changes the active layer
319  }
320  else
321  {
322  if( Read_GERBER_File( filename.GetFullPath() ) )
323  {
325 
326  layer = getNextAvailableLayer( layer );
327 
328  if( layer == NO_AVAILABLE_LAYERS && ii < aFilenameList.GetCount()-1 )
329  {
330  success = false;
331  reporter.Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
332 
333  // Report the name of not loaded files:
334  ii += 1;
335  while( ii < aFilenameList.GetCount() )
336  {
337  filename = aFilenameList[ii++];
338  wxString txt = wxString::Format( MSG_NOT_LOADED, filename.GetFullName() );
339  reporter.Report( txt, REPORTER::RPT_ERROR );
340  }
341  break;
342  }
343 
344  SetActiveLayer( layer, false );
345  }
346  }
347 
348  if( progress )
349  progress->AdvanceProgress();
350  }
351 
352  if( !success )
353  {
354  wxSafeYield(); // Allows slice of time to redraw the screen
355  // to refresh widgets, before displaying messages
356  HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
357  mbox.ListSet( msg );
358  mbox.ShowModal();
359  }
360 
361  SetVisibleLayers( visibility );
362 
363  Zoom_Automatique( false );
364 
365  // Synchronize layers tools with actual active layer:
367 
368  // TODO: it would be nice if we could set the active layer to one of the
369  // ones that was just loaded, but to maintain the previous user experience
370  // we need to set it to a blank layer in case they load another file.
371  // We can't start with the next available layer when loading files because
372  // some users expect the behavior of overwriting the active layer on load.
373  SetActiveLayer( getNextAvailableLayer( layer ), true );
374 
376  syncLayerBox( true );
377 
378  GetCanvas()->Refresh();
379 
380  return success;
381 }
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, wxFileHistory *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.
Class 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 ...
Class HTML_MESSAGE_BOX.
#define MSG_NO_MORE_LAYER
#define _(s)
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...
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:165
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool 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(), REPORTER::RPT_ERROR, REPORTER::RPT_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 ( wxConfigBase *  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 301 of file gerbview_frame.cpp.

302 {
304 
305  // was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
307 
308  bool tmp;
309  aCfg->Read( cfgShowBorderAndTitleBlock, &tmp, false );
311 
312  PAGE_INFO pageInfo( wxT( "GERBER" ) );
313  wxString pageType;
314 
315  aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
316  pageInfo.SetType( pageType );
317  SetPageSettings( pageInfo );
318 
319  aCfg->Read( cfgShowDCodes, &tmp, true );
321  aCfg->Read( cfgShowNegativeObjects, &tmp, false );
323 
324  // because we have more than one file history, we must read this one
325  // using a specific path
326  aCfg->SetPath( wxT( "drl_files" ) );
327  m_drillFileHistory.Load( *aCfg );
328  aCfg->SetPath( wxT( ".." ) );
329 
330  // because we have more than one file history, we must read this one
331  // using a specific path
332  aCfg->SetPath( wxT( "zip_files" ) );
333  m_zipFileHistory.Load( *aCfg );
334  aCfg->SetPath( wxT( ".." ) );
335 
336  // because we have more than one file history, we must read this one
337  // using a specific path
338  aCfg->SetPath( "job_files" );
339  m_jobFileHistory.Load( *aCfg );
340  aCfg->SetPath( wxT( ".." ) );
341 }
static const wxString cfgShowBorderAndTitleBlock(wxT("ShowBorderAndTitleBlock"))
FILE_HISTORY m_jobFileHistory
void SetPageSettings(const PAGE_INFO &aPageSettings) override
static const wxString cfgShowNegativeObjects(wxT("ShowNegativeObjectsOpt"))
static const wxString cfgShowDCodes(wxT("ShowDCodesOpt"))
FILE_HISTORY m_zipFileHistory
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
FILE_HISTORY m_drillFileHistory
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
PARAM_CFG_ARRAY & GetConfigurationSettings(void)
Function GetConfigurationSettings Populates the GerbView applications settings list.
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
void SetElementVisibility(int aLayerID, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
static const wxString cfgShowPageSizeOption(wxT("PageSizeOpt"))

References cfgShowBorderAndTitleBlock(), cfgShowDCodes(), cfgShowNegativeObjects(), cfgShowPageSizeOption(), GetConfigurationSettings(), LAYER_DCODES, LAYER_NEGATIVE_OBJECTS, LAYER_WORKSHEET, EDA_DRAW_FRAME::LoadSettings(), m_drillFileHistory, m_jobFileHistory, m_zipFileHistory, SetElementVisibility(), SetPageSettings(), PAGE_INFO::SetType(), and wxConfigLoadSetups().

Referenced by GERBVIEW_FRAME().

◆ 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 637 of file gerbview/files.cpp.

638 {
639 #define ZipFileExtension "zip"
640 
641  wxFileName filename = aFullFileName;
642  wxString currentPath;
643 
644  if( !filename.IsOk() )
645  {
646  // Use the current working directory if the file name path does not exist.
647  if( filename.DirExists() )
648  currentPath = filename.GetPath();
649  else
650  currentPath = m_mruPath;
651 
652  wxFileDialog dlg( this,
653  _( "Open Zip File" ),
654  currentPath,
655  filename.GetFullName(),
656  ZipFileWildcard(),
657  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
658 
659  if( dlg.ShowModal() == wxID_CANCEL )
660  return false;
661 
662  filename = dlg.GetPath();
663  currentPath = wxGetCwd();
664  m_mruPath = currentPath;
665  }
666  else
667  {
668  currentPath = filename.GetPath();
669  m_mruPath = currentPath;
670  }
671 
672  wxString msg;
673  WX_STRING_REPORTER reporter( &msg );
674 
675  if( filename.IsOk() )
676  unarchiveFiles( filename.GetFullPath(), &reporter );
677 
678  Zoom_Automatique( false );
679 
680  // Synchronize layers tools with actual active layer:
684  syncLayerBox();
685 
686  if( !msg.IsEmpty() )
687  {
688  wxSafeYield(); // Allows slice of time to redraw the screen
689  // to refresh widgets, before displaying messages
690  HTML_MESSAGE_BOX mbox( this, _( "Messages" ) );
691  mbox.ListSet( msg );
692  mbox.ShowModal();
693  }
694 
695  return true;
696 }
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 ...
Class HTML_MESSAGE_BOX.
#define _(s)
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:165
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().

◆ Locate()

GERBER_DRAW_ITEM * GERBVIEW_FRAME::Locate ( const wxPoint &  aPosition,
int  typeloc 
)

Definition at line 43 of file locate.cpp.

44 {
46  wxPoint ref = aPosition;
47 
48  if( aTypeloc == CURSEUR_ON_GRILLE )
49  ref = GetNearestGridPosition( ref );
50 
51  int layer = GetActiveLayer();
52  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
53 
54  GERBER_DRAW_ITEM* gerb_item = nullptr;
55 
56  // Search first on active layer
57  // A not used graphic layer can be selected. So gerber can be NULL
58  if( gerber && gerber->m_IsVisible )
59  {
60  for( auto item = gerber->GetItemsList(); item; item = item->Next() )
61  {
62  if( item->HitTest( ref ) )
63  {
64  gerb_item = item;
65  break;
66  }
67  }
68  }
69 
70  if( gerb_item == nullptr ) // Search on all layers
71  {
72  for( layer = 0; layer < (int)ImagesMaxCount(); ++layer )
73  {
74  gerber = GetGbrImage( layer );
75 
76  if( gerber == nullptr ) // Graphic layer not yet used
77  continue;
78 
79  if( !gerber->m_IsVisible )
80  continue;
81 
82  if( layer == GetActiveLayer() )
83  continue;
84 
85  for( auto item = gerber->GetItemsList(); item; item = item->Next() )
86  {
87  if( item->HitTest( ref ) )
88  {
89  gerb_item = item;
90  break;
91  }
92  }
93 
94  if( gerb_item )
95  break;
96  }
97  }
98 
99  if( gerb_item )
100  {
101  MSG_PANEL_ITEMS items;
102  gerb_item->GetMsgPanelInfo( m_userUnits, items );
103  SetMsgPanel( items );
104  }
105 
106  return gerb_item;
107 }
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
#define CURSEUR_ON_GRILLE
Definition: gerbview.h:32
unsigned ImagesMaxCount() const
The max number of file images.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
EDA_MSG_PANEL * m_messagePanel
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
void EraseMsgBox()
Definition: msgpanel.cpp:216
GERBER_DRAW_ITEM * Next() const
EDA_UNITS_T m_userUnits
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102

References CURSEUR_ON_GRILLE, EDA_MSG_PANEL::EraseMsgBox(), GetActiveLayer(), GetGbrImage(), GERBER_FILE_IMAGE::GetItemsList(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), EDA_DRAW_FRAME::GetNearestGridPosition(), ImagesMaxCount(), GERBER_FILE_IMAGE::m_IsVisible, EDA_DRAW_FRAME::m_messagePanel, EDA_BASE_FRAME::m_userUnits, GERBER_DRAW_ITEM::Next(), and EDA_DRAW_FRAME::SetMsgPanel().

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

201 {
202  m_file_checker = ::LockFile( aFileName );
203 
204  return bool( m_file_checker );
205 }
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 296 of file eda_base_frame.cpp.

297 {
298  if( !doAutoSave() )
299  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
300 }
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 309 of file eda_base_frame.cpp.

310 {
311  wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
312  // Key events can be filtered here.
313  // Currently no filtering is made.
314  event.Skip();
315 }
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.

◆ OnCloseWindow()

void GERBVIEW_FRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 228 of file gerbview_frame.cpp.

229 {
230  GetCanvas()->StopDrawing();
231  GetCanvas()->GetView()->Clear();
232 
233  if( m_toolManager )
235 
236  // Be sure any OpenGL event cannot be fired after frame deletion:
237  GetCanvas()->SetEvtHandlerEnabled( false );
238 
239  Destroy();
240 }
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 61 of file gerbview/files.cpp.

62 {
63  wxString fn;
64 
65  fn = GetFileFromHistory( event.GetId(), _( "Drill files" ), &m_drillFileHistory );
66 
67  if( !fn.IsEmpty() )
68  {
69  Erase_Current_DrawLayer( false );
70  LoadExcellonFiles( fn );
71  }
72 }
void Erase_Current_DrawLayer(bool query)
FILE_HISTORY m_drillFileHistory
#define _(s)
wxString GetFileFromHistory(int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
Fetches the file name from the file history list.
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.
#define _(s)
wxString GetFileFromHistory(int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
Fetches the file name from the file history list.

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

◆ OnGridSettings()

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

Reimplemented in PCB_BASE_EDIT_FRAME, and SCH_BASE_FRAME.

Definition at line 321 of file eda_draw_frame.h.

321 { };

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 88 of file gerbview/files.cpp.

89 {
90  wxString filename = GetFileFromHistory( event.GetId(), _( "Job files" ), &m_jobFileHistory );
91 
92  if( !filename.IsEmpty() )
93  LoadGerberJobFile( filename );
94 }
FILE_HISTORY m_jobFileHistory
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
#define _(s)
wxString GetFileFromHistory(int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
Fetches the file name from the file history list.

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

◆ OnKicadAbout()

void EDA_BASE_FRAME::OnKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 608 of file eda_base_frame.cpp.

609 {
610  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
611  ShowAboutDialog( this );
612 }
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 318 of file eda_base_frame.cpp.

319 {
320  //
321  // wxWidgets has several issues that we have to work around:
322  //
323  // 1) wxWidgets 3.0.x Windows has a bug where wxEVT_MENU_OPEN and wxEVT_MENU_HIGHLIGHT
324  // events are not captured by the ACTON_MENU menus. So we forward them here.
325  // (FWIW, this one is fixed in wxWidgets 3.1.x.)
326  //
327  // 2) wxWidgets doesn't pass the menu pointer for wxEVT_MENU_HIGHLIGHT events. So we
328  // store the menu pointer from the wxEVT_MENU_OPEN call.
329  //
330  // 3) wxWidgets has no way to tell whether a command is from a menu selection or a
331  // hotkey. So we keep track of menu highlighting so we can differentiate.
332  //
333 
334  static ACTION_MENU* currentMenu;
335 
336  if( event.GetEventType() == wxEVT_MENU_OPEN )
337  {
338  currentMenu = dynamic_cast<ACTION_MENU*>( event.GetMenu() );
339 
340  if( currentMenu )
341  currentMenu->OnMenuEvent( event );
342  }
343  else if( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
344  {
345  if( currentMenu )
346  currentMenu->OnMenuEvent( event );
347  }
348  else if( event.GetEventType() == wxEVT_MENU_CLOSE )
349  {
350  if( currentMenu )
351  currentMenu->OnMenuEvent( event );
352 
353  currentMenu = nullptr;
354  }
355 
356  event.Skip();
357 }
Class ACTION_MENU.
Definition: action_menu.h:43
void OnMenuEvent(wxMenuEvent &aEvent)

References ACTION_MENU::OnMenuEvent().

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

395 {}

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick().

◆ OnPreferences()

void EDA_BASE_FRAME::OnPreferences ( wxCommandEvent &  event)
inherited

Definition at line 615 of file eda_base_frame.cpp.

616 {
617  PAGED_DIALOG dlg( this, _( "Preferences" ) );
618  wxTreebook* book = dlg.GetTreebook();
619 
620  book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
621 
622  PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
623  book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
624 
625  for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
626  {
627  KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
628 
629  if( frame )
630  frame->InstallPreferences( &dlg, hotkeysPanel );
631  }
632 
633  // The Kicad manager frame is not a player so we have to add it by hand
634  wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
635 
636  if( manager )
637  static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
638 
639  if( dlg.ShowModal() == wxID_OK )
640  dlg.Kiway().CommonSettingsChanged( false );
641 }
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
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:321
#define _(s)
#define KICAD_MANAGER_FRAME_NAME
size_t i
Definition: json11.cpp:597
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(), i, 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 270 of file events_called_functions.cpp.

271 {
272  Close( true );
273 }

◆ 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 193 of file events_called_functions.cpp.

194 {
195  GERBER_FILE_IMAGE* gerber_image = GetGbrImage( GetActiveLayer() );
196 
197  if( gerber_image )
198  {
199  int tool = m_DCodeSelector->GetSelectedDCodeId();
200 
201  if( tool != gerber_image->m_Selected_Tool )
202  {
203  gerber_image->m_Selected_Tool = tool;
204  GetCanvas()->Refresh();
205  }
206  }
207 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
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 210 of file events_called_functions.cpp.

211 {
212  SetActiveLayer( event.GetSelection(), true );
213 
214  // Rebuild the DCode list in toolbar (but not the Layer Box) after change
215  syncLayerBox( false );
216 }
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 257 of file events_called_functions.cpp.

258 {
259  switch( event.GetId() )
260  {
264  }
265 
266  GetCanvas()->Refresh();
267 }
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 283 of file eda_draw_frame.cpp.

284 {
285  wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
286 
287  int id = m_gridSelectBox->GetCurrentSelection() + ID_POPUP_GRID_FIRST;
288 
289  if( id == ID_POPUP_GRID_SEPARATOR )
290  {
291  // wxWidgets will check the separator, which we don't want.
292  // Re-check the current grid.
293  wxUpdateUIEvent dummy;
295  }
296  else if( id == ID_POPUP_GRID_SETTINGS )
297  {
298  // wxWidgets will check the Grid Settings... entry, which we don't want.
299  // R-check the current grid.
300  wxUpdateUIEvent dummy;
302  // Now run the Grid Settings... dialog
303  wxCommandEvent dummy2;
304  OnGridSettings( dummy2 );
305  }
306  else if( id >= ID_POPUP_GRID_FIRST && id < ID_POPUP_GRID_SEPARATOR )
307  {
309  }
310 
311  UpdateStatusBar();
312  m_canvas->Refresh();
313 }
virtual void OnGridSettings(wxCommandEvent &event)
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
wxChoice * m_gridSelectBox
EDA_DRAW_PANEL_GAL * m_canvas
GAL display options - this is the frame's interface to setting GAL display options.
static TOOL_ACTION gridPreset
Definition: actions.h:131
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
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...
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
TOOL_MANAGER * m_toolManager
void UpdateStatusBar() override
Update the status bar information.

References dummy(), ACTIONS::gridPreset, ID_POPUP_GRID_FIRST, ID_POPUP_GRID_SEPARATOR, ID_POPUP_GRID_SETTINGS, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_gridSelectBox, EDA_BASE_FRAME::m_toolManager, EDA_DRAW_FRAME::OnGridSettings(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), EDA_DRAW_PANEL_GAL::Refresh(), TOOL_MANAGER::RunAction(), and EDA_DRAW_FRAME::UpdateStatusBar().

◆ OnSelectHighlightChoice()

void GERBVIEW_FRAME::OnSelectHighlightChoice ( wxCommandEvent &  event)

Handles the changing of the highlighted component/net/attribute.

Definition at line 168 of file events_called_functions.cpp.

169 {
170  auto settings = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() )->GetSettings();
171 
172  switch( event.GetId() )
173  {
175  settings->m_componentHighlightString = m_SelComponentBox->GetStringSelection();
176  break;
177 
179  settings->m_netHighlightString = m_SelNetnameBox->GetStringSelection();
180  break;
181 
183  settings->m_attributeHighlightString = m_SelAperAttributesBox->GetStringSelection();
184  break;
185 
186  }
187 
189  GetCanvas()->Refresh();
190 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1444
Visibility flag has changed.
Definition: view_item.h:56
wxChoice * m_SelNetnameBox
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the 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...
wxChoice * m_SelAperAttributesBox
wxChoice * m_SelComponentBox

References KIGFX::COLOR, EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetView(), ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE, m_SelAperAttributesBox, m_SelComponentBox, m_SelNetnameBox, EDA_DRAW_PANEL_GAL::Refresh(), and KIGFX::VIEW::UpdateAllItems().

◆ OnSelectZoom()

void EDA_DRAW_FRAME::OnSelectZoom ( wxCommandEvent &  event)
virtualinherited

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

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

Definition at line 328 of file eda_draw_frame.cpp.

329 {
330  wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" );
331 
332  int id = m_zoomSelectBox->GetCurrentSelection();
333 
334  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
335  return;
336 
337  m_toolManager->RunAction( "common.Control.zoomPreset", true, id );
338  UpdateStatusBar();
339