KiCad PCB EDA Suite
GERBVIEW_FRAME Class Reference

#include <gerbview_frame.h>

Inheritance diagram for GERBVIEW_FRAME:
EDA_DRAW_FRAME KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

Public Member Functions

const GBR_DISPLAY_OPTIONSGetDisplayOptions () const
 Function GetDisplayOptions returns the display options current in use. More...
 
void SetDisplayOptions (const GBR_DISPLAY_OPTIONS &aOptions)
 
void SetLayout (GBR_LAYOUT *aLayout)
 Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous GBR_LAYOUT. More...
 
GBR_LAYOUTGetGerberLayout () const
 
GERBER_FILE_IMAGE_LISTGetImagesList () const
 Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data. More...
 
GERBER_FILE_IMAGEGetGbrImage (int aIdx) const
 
unsigned ImagesMaxCount () const
 The max number of file images. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const 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)
 
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, FILE_HISTORY *aFileHistory=NULL)
 Fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, FILE_HISTORY *aFileHistory=NULL)
 Update the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
void AddStandardHelpMenu (wxMenuBar *aMenuBar)
 Adds the standard KiCad help menu to the menubar. More...
 
bool IsWritable (const wxFileName &aFileName)
 Checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName)
 Check if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
const wxString & GetAboutTitle () const
 
HOLDER_TYPE GetType ()
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Public Attributes

wxChoice * m_SelComponentBox
 
wxChoice * m_SelNetnameBox
 
wxChoice * m_SelAperAttributesBox
 
GBR_LAYER_BOX_SELECTORm_SelLayerBox
 
DCODE_SELECTION_BOXm_DCodeSelector
 
wxTextCtrl * m_TextInfo
 
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
 
GBR_DISPLAY_OPTIONS m_DisplayOptions
 
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 
136  setupTools();
137  ReCreateMenuBar();
141 
142  m_auimgr.SetManagedWindow( this );
143 
144  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
145  m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) );
146  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
147 
148  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
149  m_auimgr.AddPane( m_LayersManager, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
150  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
151  .MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) );
152 
153  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
154 
155  ReFillLayerWidget(); // this is near end because contents establish size
156  m_auimgr.Update();
157 
158  SetActiveLayer( 0, true );
160 
162 
163  // Nudge user to switch to OpenGL if they are on legacy or Cairo
164  if( m_firstRunDialogSetting < 1 )
165  {
166  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
167  {
168  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
169  "and faster experience. This option is turned off by "
170  "default since it is not compatible with all computers.\n\n"
171  "Would you like to try enabling graphics acceleration?\n\n"
172  "If you'd like to choose later, select Accelerated Graphics "
173  "in the Preferences menu." );
174 
175  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
176 
177  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
178 
179  if( dlg.ShowModal() == wxID_YES )
180  {
181  // Save Cairo as default in case OpenGL crashes
183 
184  // Switch to OpenGL, which will save the new setting if successful
186 
187  // Switch back to Cairo if OpenGL is not supported
188  if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
190  }
191  else
192  {
193  // If they were on legacy, switch to Cairo
195  }
196  }
197 
199  SaveSettings( config() );
200  }
201 
202  SwitchCanvas( canvasType );
203 
204  // Enable the axes to match legacy draw style
205  auto& galOptions = GetGalDisplayOptions();
206  galOptions.m_axesEnabled = true;
207  galOptions.NotifyChanged();
208 
210  m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
211 
214 
215  if( GetCanvas() )
217 
218  // Update the checked state of tools
219  SyncToolbars();
220 }
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
virtual bool IsGridVisible() const
GERBER_LAYER_WIDGET * m_LayersManager
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h: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:66
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
static TOOL_ACTION gridPreset
Definition: actions.h:131
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:53
GBR_LAYOUT * m_gerberLayout
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
static LSET AllLayersMask()
Definition: lset.cpp: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:194
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)
Update the number of files that will be contained inside the file history.
Definition: filehistory.cpp:42
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
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
wxChoice * m_SelComponentBox
void SetVisibleLayers(LSET aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void ReFillRender()
Function ReFillRender Rebuild Render for instance after the config is read.
bool m_show_layer_manager_tools
void ReCreateMenuBar() override
Recreates the menu bar.
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
void SetLayout(GBR_LAYOUT *aLayout)
Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous G...
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
long m_firstRunDialogSetting
void ReCreateOptToolbar() override
Create or update the left vertical toolbar (option toolbar.

References _, ACTIONS::acceleratedGraphics, LSET::AllLayersMask(), PCAD2KICAD::Center, 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_PANEL_GAL::GetGAL(), EDA_DRAW_FRAME::GetGalDisplayOptions(), GetPageSettings(), EDA_BASE_FRAME::GetToolManager(), ACTIONS::gridPreset, ID_POPUP_GRID_LEVEL_0_0_1MM, ID_POPUP_GRID_LEVEL_1000, EDA_DRAW_FRAME::IsGridVisible(), KiBitmap(), PCAD2KICAD::Left, EDA_DRAW_FRAME::LoadCanvasTypeSetting(), LoadSettings(), EDA_BASE_FRAME::m_AboutTitle, EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_auxiliaryToolBar, m_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(), KIGFX::GAL::SetGridVisibility(), 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 223 of file gerbview_frame.cpp.

224 {
225  GetCanvas()->GetView()->Clear();
226 
228  delete m_gerberLayout;
229 
230  // Since the file menu contains file history menus, we must ensure that the menu
231  // destructor is called before the file history objects are deleted since their destructor
232  // unregisters the menu from the history.
233  wxMenu* fileMenu = GetMenuBar()->Remove( 0 );
234  delete fileMenu;
235 }
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 1116 of file gerbview_frame.cpp.

1117 {
1119 
1120  EDA_DRAW_PANEL_GAL* galCanvas = GetCanvas();
1121 
1122  if( m_toolManager )
1123  {
1125  GetCanvas()->GetViewControls(), this );
1127  }
1128 
1130 
1132 
1133  galCanvas->GetView()->RecacheAllItems();
1134  galCanvas->SetEventDispatcher( m_toolDispatcher );
1135  galCanvas->StartDrawing();
1136 
1139 
1141  ReCreateMenuBar();
1142 
1143  // Update the checked state of tools
1144  SyncToolbars();
1145 }
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 366 of file eda_base_frame.cpp.

367 {
368  COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
369  ACTION_MENU* helpMenu = new ACTION_MENU( false );
370 
371  helpMenu->SetTool( commonControl );
372 
373  helpMenu->Add( ACTIONS::help );
374  helpMenu->Add( ACTIONS::gettingStarted );
375  helpMenu->Add( ACTIONS::listHotKeys );
376  helpMenu->Add( ACTIONS::getInvolved );
377 
378  helpMenu->AppendSeparator();
379  helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
380 
381  aMenuBar->Append( helpMenu, _( "&Help" ) );
382 }
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 350 of file eda_draw_frame.cpp.

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

557 {
558  if( m_messagePanel )
559  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
560 }
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 467 of file gerbview_frame.cpp.

468 {
469  auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
470  KIGFX::GERBVIEW_RENDER_SETTINGS* settings = painter->GetSettings();
472 
474 
476 }
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
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 LoadDisplayOptions(const GBR_DISPLAY_OPTIONS &aOptions)
Function LoadDisplayOptions Loads settings related to display options.
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 214 of file eda_base_frame.h.

215  {
216  SetUserUnits( aUnits );
218  }
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 689 of file eda_base_frame.cpp.

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

1245 {
1246  EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
1247 
1248  RecreateToolbars();
1249  Layout();
1250  SendSizeEvent();
1251 }
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 538 of file eda_base_frame.cpp.

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

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

339  {
340  wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
341  return baseCfgName;
342  }
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 221 of file eda_base_frame.cpp.

222 {
223  if( m_toolStack.empty() )
224  return ACTIONS::selectionTool.GetName();
225  else
226  return m_toolStack.back();
227 }
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 976 of file gerbview_frame.cpp.

977 {
978  wxString line;
979  wxString gridformatter;
980 
981  switch( m_userUnits )
982  {
983  case INCHES:
984  gridformatter = "grid X %.6f Y %.6f";
985  break;
986 
987  case MILLIMETRES:
988  gridformatter = "grid X %.6f Y %.6f";
989  break;
990 
991  default:
992  gridformatter = "grid X %f Y %f";
993  break;
994  }
995 
996  BASE_SCREEN* screen = GetScreen();
997  wxArrayString gridsList;
998 
999  int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES );
1000  GRID_TYPE& grid = screen->GetGrid( icurr );
1001  double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x );
1002  double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y );
1003  line.Printf( gridformatter, grid_x, grid_y );
1004 
1005  SetStatusText( line, 4 );
1006 }
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 376 of file eda_draw_frame.cpp.

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

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

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

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

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:280
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 245 of file eda_draw_frame.cpp.

246 {
247  if( m_messagePanel )
249 }
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 176 of file export_to_pcbnew.cpp.

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

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:649
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 728 of file eda_draw_frame.cpp.

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

◆ GetAboutTitle()

const wxString& EDA_BASE_FRAME::GetAboutTitle ( ) const
inlineinherited

Definition at line 468 of file eda_base_frame.h.

468 { 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 167 of file eda_base_frame.h.

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

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

283 { 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 952 of file gerbview_frame.cpp.

953 {
954  wxASSERT( m_gerberLayout );
955  return m_gerberLayout->GetAuxOrigin();
956 }
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 159 of file eda_base_frame.h.

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

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:649
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 257 of file gerbview_frame.h.

257 { return m_displayMode; }

References m_displayMode.

Referenced by OnUpdateDrawMode().

◆ GetDisplayOptions()

◆ GetDocumentExtents()

const BOX2I GERBVIEW_FRAME::GetDocumentExtents ( ) const
inlineoverridevirtual

Reimplemented from EDA_DRAW_FRAME.

Definition at line 145 of file gerbview_frame.h.

146  {
147  wxASSERT( m_gerberLayout );
148  return m_gerberLayout->ViewBBox();
149  }
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 244 of file eda_base_frame.h.

244 { 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 250 of file eda_base_frame.h.

250 { 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,
FILE_HISTORY aFileHistory = NULL 
)
inherited

Fetches the file name from the file history list.

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

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

Definition at line 576 of file eda_base_frame.cpp.

578 {
579  FILE_HISTORY* fileHistory = aFileHistory;
580 
581  if( !fileHistory )
582  fileHistory = &Kiface().GetFileHistory();
583 
584  int baseId = fileHistory->GetBaseId();
585 
586  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
587 
588  unsigned i = cmdId - baseId;
589 
590  if( i < fileHistory->GetCount() )
591  {
592  wxString fn = fileHistory->GetHistoryFile( i );
593 
594  if( wxFileName::FileExists( fn ) )
595  return fn;
596  else
597  {
598  wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
599  wxMessageBox( msg );
600 
601  fileHistory->RemoveFileFromHistory( i );
602  }
603  }
604 
605  return wxEmptyString;
606 }
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: filehistory.h:40
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
#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:649

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

Definition at line 196 of file eda_draw_frame.h.

196 { return m_findStringHistoryList; }
wxArrayString m_findStringHistoryList

References EDA_DRAW_FRAME::m_findStringHistoryList.

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

◆ GetFindReplaceData()

wxFindReplaceData& EDA_DRAW_FRAME::GetFindReplaceData ( )
inlineinherited

Definition at line 195 of file eda_draw_frame.h.

195 { return *m_findReplaceData; }
wxFindReplaceData * m_findReplaceData

References EDA_DRAW_FRAME::m_findReplaceData.

Referenced by DIALOG_FIND::search().

◆ GetGalDisplayOptions()

◆ GetGbrImage()

◆ GetGerberLayout()

◆ GetGridColor()

virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

◆ GetGridOrigin()

const wxPoint& GERBVIEW_FRAME::GetGridOrigin ( ) const
inlineoverridevirtual

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

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

Implements EDA_DRAW_FRAME.

Definition at line 119 of file gerbview_frame.h.

119 { 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 862 of file gerbview_frame.cpp.

863 {
864  return m_colorsSettings->GetLayerColor( aLayer );
865 }
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 256 of file eda_base_frame.h.

256 { return m_moveWarpsCursor; }

References EDA_BASE_FRAME::m_moveWarpsCursor.

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

◆ GetMruPath()

◆ GetNearestGridPosition()

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

Return the nearest aGridSize location to aPosition.

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

Definition at line 691 of file eda_draw_frame.cpp.

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

854 {
857  else
858  return GetDrawBgColor();
859 }
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 479 of file gerbview_frame.cpp.

480 {
481  int layer = aLayer;
482 
483  for( unsigned i = 0; i < ImagesMaxCount(); ++i )
484  {
485  const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
486 
487  if( gerber == NULL ) // this graphic layer is available: use it
488  return layer;
489 
490  ++layer; // try next graphic layer
491 
492  if( layer >= (int)ImagesMaxCount() )
493  layer = 0;
494  }
495 
496  return NO_AVAILABLE_LAYERS;
497 }
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:649

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

930 {
931  // this function is only needed because EDA_DRAW_FRAME is not compiled
932  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
933  // into an application specific source file.
934  return GetPageSettings().GetSizeIU();
935 }
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 802 of file eda_draw_frame.cpp.

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

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

939 {
940  wxASSERT( m_gerberLayout );
941  return m_gerberLayout->GetTitleBlock();
942 }
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 223 of file eda_base_frame.h.

223 { 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(), 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_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(), SCH_EDIT_FRAME::PutDataInPreviousState(), PL_EDITOR_FRAME::RollbackFromUndo(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), DIALOG_FIND::search(), 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 211 of file eda_base_frame.h.

211 { 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(), 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_SETUP_BOARD_STACKUP::onUpdateThicknessValue(), PANEL_PREV_3D::PANEL_PREV_3D(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), POSITION_RELATIVE_TOOL::PositionRelative(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), LIB_EDIT_FRAME::ReCreateMenuBar(), ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), 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_BOARD_STACKUP::transferDataFromUIToStackup(), PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), PANEL_EESCHEMA_SETTINGS::TransferDataToWindow(), PANEL_MODEDIT_SETTINGS::TransferDataToWindow(), PANEL_GERBVIEW_SETTINGS::TransferDataToWindow(), PANEL_PCBNEW_SETTINGS::TransferDataToWindow(), PANEL_SETUP_NETCLASSES::TransferDataToWindow(), UNIT_BINDER::UNIT_BINDER(), GRID_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), updateDCodeSelectBox(), updateGridSelectBox(), PCB_BASE_FRAME::UpdateGridSelectBox(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), 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 795 of file gerbview_frame.cpp.

796 {
797  COLOR4D color = COLOR4D::UNSPECIFIED;
798 
799  switch( aLayerID )
800  {
802  case LAYER_DCODES:
803  case LAYER_WORKSHEET:
805  color = m_colorsSettings->GetItemColor( aLayerID );
806  break;
807 
808  case LAYER_GERBVIEW_GRID:
809  color = GetGridColor();
810  break;
811 
812  default:
813  wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID );
814  }
815 
816  return color;
817 }
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 759 of file gerbview_frame.cpp.

760 {
761  LSET visible = LSET::AllLayersMask();
762 
763  if( GetCanvas() )
764  {
765  for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
766  visible[i] = GetCanvas()->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) );
767  }
768 
769  return visible;
770 }
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:649
#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 344 of file eda_draw_frame.cpp.

345 {
346  return GetScreen()->GetZoom();
347 }
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 1089 of file gerbview_frame.cpp.

1090 {
1092 }
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 704 of file eda_draw_frame.cpp.

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

Referenced by COMMON_TOOLS::ZoomRedraw().

◆ hasAvailableLayers()

bool GERBVIEW_FRAME::hasAvailableLayers ( ) const
inline

Definition at line 371 of file gerbview_frame.h.

372  {
374  }
#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 553 of file eda_base_frame.cpp.

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

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

1102 {
1104 }
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 317 of file eda_draw_frame.cpp.

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

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

182 { return false; }

Referenced by EDA_BASE_FRAME::ProcessEvent().

◆ IsCurrentTool()

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

Definition at line 230 of file eda_base_frame.cpp.

231 {
232  if( m_toolStack.empty() )
233  return &aAction == &ACTIONS::selectionTool;
234  else
235  return m_toolStack.back() == aAction.GetName();
236 }
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 741 of file gerbview_frame.cpp.

742 {
743  switch( aLayerID )
744  {
747  case LAYER_GERBVIEW_GRID: return IsGridVisible();
749  case LAYER_PCB_BACKGROUND: return true;
750 
751  default:
752  wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID );
753  }
754 
755  return true;
756 }
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 789 of file gerbview_frame.cpp.

790 {
791  return m_LayersManager->IsLayerVisible( aLayer );
792 }
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 285 of file eda_base_frame.h.

285 { 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_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), KIGFX::SCH_VIEW::DisplaySheet(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), LIB_CONTROL::DuplicateSymbol(), LIB_CONTROL::EditSymbol(), LIB_CONTROL::ExportSymbol(), LIB_CONTROL::Init(), DIALOG_EDIT_ONE_FIELD::init(), SELECTION_TOOL::Init(), DIALOG_PAD_PROPERTIES::initValues(), PICKER_TOOL::Main(), LIB_CONTROL::OnDeMorgan(), PCB_LAYER_WIDGET::OnRenderEnable(), PCBNEW_CONTROL::Paste(), 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 645 of file eda_base_frame.cpp.

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

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

◆ LibraryFileBrowser()

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

Definition at line 808 of file eda_draw_frame.cpp.

811 {
812  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
813  aFilename.SetExt( ext );
814 
815  if( isDirectory && doOpen )
816  {
817  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
818  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
819 
820  if( dlg.ShowModal() == wxID_CANCEL )
821  return false;
822 
823  aFilename = dlg.GetPath();
824  aFilename.SetExt( ext );
825  }
826  else
827  {
828  wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
829  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
830  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
831 
832  if( dlg.ShowModal() == wxID_CANCEL )
833  return false;
834 
835  aFilename = dlg.GetPath();
836  aFilename.SetExt( ext );
837  }
838 
839  return true;
840 }
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 528 of file gerbview_frame.cpp.

529 {
530  int ii, jj;
531  wxString Line;
532  wxArrayString list;
533  double scale = GetUserUnits() == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
534  int curr_layer = GetActiveLayer();
535 
536  for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
537  {
538  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
539 
540  if( gerber == NULL )
541  continue;
542 
543  if( gerber->GetDcodesCount() == 0 )
544  continue;
545 
546  if( layer == curr_layer )
547  Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
548  else
549  Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
550 
551  list.Add( Line );
552 
553  const char* units = GetUserUnits() == INCHES ? "\"" : "mm";
554 
555  for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
556  {
557  D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE );
558 
559  if( pt_D_code == NULL )
560  continue;
561 
562  if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
563  continue;
564 
565  Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s attribute '%s'" ),
566  jj,
567  pt_D_code->m_Num_Dcode,
568  pt_D_code->m_Size.y / scale, units,
569  pt_D_code->m_Size.x / scale, units,
570  D_CODE::ShowApertureType( pt_D_code->m_Shape ),
571  pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
572  );
573 
574  if( !pt_D_code->m_Defined )
575  Line += wxT( " (not defined)" );
576 
577  if( pt_D_code->m_InUse )
578  Line += wxT( " (in use)" );
579 
580  list.Add( Line );
581  jj++;
582  }
583  }
584 
585  wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
586  wxCHOICEDLG_STYLE & ~wxCANCEL );
587 
588  dlg.ShowModal();
589 }
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:136

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

615 {
617  wxConfigBase* cfg = Kiface().KifaceSettings();
618 
619  if( cfg )
620  {
621  canvasType = (EDA_DRAW_PANEL_GAL::GAL_TYPE)
623  }
624 
625  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
626  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
627  {
628  wxASSERT( false );
630  }
631 
632  // Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
633  // the user will be prompted to switch to OpenGL
634  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
635  {
636 #ifdef __WXMAC__
637  // Cairo renderer doesn't handle Retina displays
639 #else
641 #endif
642  }
643 
644  return canvasType;
645 }
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:52
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, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
#define MSG_NOT_LOADED
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
#define NO_AVAILABLE_LAYERS
void UpdateLayerIcons()
Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or ...
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, FILE_HISTORY *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 %u/%lu %s" ), ii+1,
302  aFilenameList.GetCount(), m_lastFileName ) );
303  }
304  else if( progress )
305  {
306  progress->Report( wxString::Format( _("Loading %u/%lu %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, FILE_HISTORY *aFileHistory=NULL)
Update the list of recently opened files.
#define MSG_NOT_LOADED
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
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 311 of file gerbview_frame.cpp.

312 {
314 
315  // was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
317 
318  bool tmp;
319  aCfg->Read( cfgShowBorderAndTitleBlock, &tmp, false );
321 
322  PAGE_INFO pageInfo( wxT( "GERBER" ) );
323  wxString pageType;
324 
325  aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
326  pageInfo.SetType( pageType );
327  SetPageSettings( pageInfo );
328 
329  aCfg->Read( cfgShowDCodes, &tmp, true );
331  aCfg->Read( cfgShowNegativeObjects, &tmp, false );
333 
334  // because we have more than one file history, we must read this one
335  // using a specific path
336  aCfg->SetPath( wxT( "drl_files" ) );
337  m_drillFileHistory.Load( *aCfg );
338  aCfg->SetPath( wxT( ".." ) );
339 
340  // because we have more than one file history, we must read this one
341  // using a specific path
342  aCfg->SetPath( wxT( "zip_files" ) );
343  m_zipFileHistory.Load( *aCfg );
344  aCfg->SetPath( wxT( ".." ) );
345 
346  // because we have more than one file history, we must read this one
347  // using a specific path
348  aCfg->SetPath( "job_files" );
349  m_jobFileHistory.Load( *aCfg );
350  aCfg->SetPath( wxT( ".." ) );
351 }
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 201 of file eda_draw_frame.cpp.

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

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

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

239 {
240  GetCanvas()->StopDrawing();
241  GetCanvas()->GetView()->Clear();
242 
243  if( m_toolManager )
245 
246  // Be sure any OpenGL event cannot be fired after frame deletion:
247  GetCanvas()->SetEvtHandlerEnabled( false );
248 
249  Destroy();
250 }
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, FILE_HISTORY *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, FILE_HISTORY *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 SCH_BASE_FRAME, and PCB_BASE_EDIT_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, FILE_HISTORY *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 609 of file eda_base_frame.cpp.

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

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

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

285 {
286  wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
287 
288  int id = m_gridSelectBox->GetCurrentSelection() + ID_POPUP_GRID_FIRST;
289 
290  if( id == ID_POPUP_GRID_SEPARATOR )
291  {
292  // wxWidgets will check the separator, which we don't want.
293  // Re-check the current grid.
294  wxUpdateUIEvent dummy;
296  }
297  else if( id == ID_POPUP_GRID_SETTINGS )
298  {
299  // wxWidgets will check the Grid Settings... entry, which we don't want.
300  // R-check the current grid.
301  wxUpdateUIEvent dummy;
303  // Now run the Grid Settings... dialog
304  wxCommandEvent dummy2;
305  OnGridSettings( dummy2 );
306  }
307  else if( id >= ID_POPUP_GRID_FIRST && id < ID_POPUP_GRID_SEPARATOR )
308  {
310  }
311 
312  UpdateStatusBar();
313  m_canvas->Refresh();
314 }
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