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 Member Functions

void SetLayout (GBR_LAYOUT *aLayout)
 Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous GBR_LAYOUT. More...
 
GBR_LAYOUTGetGerberLayout () const
 
GERBER_FILE_IMAGE_LISTGetImagesList () const
 Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data. More...
 
GERBER_FILE_IMAGEGetGbrImage (int aIdx) const
 
unsigned ImagesMaxCount () const
 The max number of file images. More...
 
EDA_RECT GetGerberLayoutBoundingBox ()
 Function GetGerberLayoutBoundingBox calculates the bounding box containing all gerber items. More...
 
void SetPageSettings (const PAGE_INFO &aPageSettings) override
 
const PAGE_INFOGetPageSettings () const override
 
const wxSize GetPageSizeIU () const override
 Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the internal units of this particular view. More...
 
const wxPointGetAuxOrigin () const override
 Function GetAuxOrigin returns the origin of the axis used for plotting and various exports. More...
 
void SetAuxOrigin (const wxPoint &aPoint) override
 
const wxPointGetGridOrigin () const override
 Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid. More...
 
void SetGridOrigin (const wxPoint &aPoint) override
 
const TITLE_BLOCKGetTitleBlock () const override
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock) override
 
void SetCurItem (GERBER_DRAW_ITEM *aItem, bool aDisplayInfo=true)
 Function SetCurItem sets the currently selected item and displays it in the MsgPanel. More...
 
int SelectPCBLayer (int aDefaultLayer, int aOpperLayerCount, bool aNullLayer=false)
 Install the dialog box for layer selection. More...
 
virtual void SetGridColor (COLOR4D aColor) override
 > More...
 
 GERBVIEW_FRAME (KIWAY *aKiway, wxWindow *aParent)
 
 ~GERBVIEW_FRAME ()
 
void OnCloseWindow (wxCloseEvent &Event)
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl) override
 
void RedrawActiveWindow (wxDC *DC, bool EraseBg) override
 
void ReCreateHToolbar () override
 
void ReCreateAuxiliaryToolbar () override
 
void ReCreateVToolbar () override
 Function ReCreateVToolbar creates or updates the right vertical toolbar. More...
 
void ReCreateOptToolbar ()
 Create or update the left vertical toolbar (option toolbar. More...
 
void ReCreateMenuBar () override
 Function ReCreateMenuBar Creates recreates the menu bar. More...
 
void OnLeftClick (wxDC *aDC, const wxPoint &aMousePos) override
 
void OnLeftDClick (wxDC *aDC, const wxPoint &aMousePos) override
 
bool OnRightClick (const wxPoint &aMousePos, wxMenu *aPopMenu) override
 
void OnUpdateSelectTool (wxUpdateUIEvent &aEvent)
 
double BestZoom () override
 Return the zoom level which displays the full page on screen. More...
 
void UpdateStatusBar () override
 Function UpdateStatusBar updates 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...
 
void ReportMessage (const wxString aMessage)
 Function ReportMessage Add a message (a string) in message list for instance when reading a Gerber file. More...
 
void ClearMessageList ()
 Function ClearMessageList Clear the message list Call it before reading a Gerber file. More...
 
int GetDisplayMode ()
 Function GetDisplayMode. More...
 
void SetDisplayMode (int aMode)
 Function SetDisplayMode. More...
 
bool IsElementVisible (GERBVIEW_LAYER_ID aItemIdVisible) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (GERBVIEW_LAYER_ID aItemIdVisible, 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...
 
long GetVisibleLayers () const
 Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all the layers that are visible. More...
 
void SetVisibleLayers (long aLayerMask)
 Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of visible layers. More...
 
bool IsLayerVisible (int aLayer) const
 Function IsLayerVisible tests whether a given layer is visible. More...
 
COLOR4D GetVisibleElementColor (GERBVIEW_LAYER_ID aItemIdVisible)
 Function GetVisibleElementColor returns the color of a gerber visible element. More...
 
void SetVisibleElementColor (GERBVIEW_LAYER_ID aItemIdVisible, 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...
 
bool DisplayLinesSolidMode ()
 Function DisplayLinesSolidMode. More...
 
bool DisplayPolygonsSolidMode ()
 Function DisplayPolygonsSolidMode. More...
 
bool DisplayFlashedItemsSolidMode ()
 Function DisplayFlashedItemsSolidMode. 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...
 
PARAM_CFG_ARRAYGetConfigurationSettings (void)
 Function GetConfigurationSettings Populates the GerbView applications settings list. More...
 
void LoadSettings (wxConfigBase *aCfg) override
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
void OnToggleCoordType (wxCommandEvent &aEvent)
 
void OnToggleFlashItemDrawMode (wxCommandEvent &aEvent)
 
void OnToggleLineDrawMode (wxCommandEvent &aEvent)
 
void OnTogglePolygonDrawMode (wxCommandEvent &aEvent)
 
void OnToggleShowLayerManager (wxCommandEvent &aEvent)
 
void ShowChangedLanguage () override
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
void Process_Special_Functions (wxCommandEvent &event)
 
void OnSelectOptionToolbar (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...
 
EDA_HOTKEYGetHotKeyDescription (int aCommand) const override
 > More...
 
bool OnHotKey (wxDC *aDC, int aHotkeyCode, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
 Function OnHotKey. More...
 
GERBER_DRAW_ITEMLocate (const wxPoint &aPosition, int typeloc)
 
void Process_Config (wxCommandEvent &event)
 
void InstallGerberOptionsDialog (wxCommandEvent &event)
 
void OnUpdateDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateCoordType (wxUpdateUIEvent &aEvent)
 
void OnUpdateFlashedItemsDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateLineDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdatePolygonDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowDCodes (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowNegativeItems (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowLayerManager (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectDCode (wxUpdateUIEvent &aEvent)
 
void OnUpdateLayerSelectBox (wxUpdateUIEvent &aEvent)
 
void OnUpdateDiffMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateHighContrastMode (wxUpdateUIEvent &aEvent)
 
virtual int BlockCommand (EDA_KEY key) override
 Function BlockCommand returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to the aKey (ALT, SHIFT ALT ..) More...
 
virtual void HandleBlockPlace (wxDC *DC) override
 Function HandleBlockPlace handles the block place command. More...
 
virtual bool HandleBlockEnd (wxDC *DC) override
 Function HandleBlockEnd handles the end of a block command, It is called at the end of the definition of the area of a block. More...
 
void Block_Move ()
 Function Block_Move moves all tracks and segments within the selected block. More...
 
void ToPrinter (wxCommandEvent &event)
 Function ToPrinter Open a dialog frame to print layers. More...
 
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...
 
bool GeneralControl (wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
 Function GeneralControl performs application specific control using aDC at aPosition in logical units. More...
 
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...
 
virtual void PrintPage (wxDC *aDC, LSET aPrintMasklayer, bool aPrintMirrorMode, void *aData=NULL) override
 Virtual function PrintPage used to print a page. More...
 
virtual void UseGalCanvas (bool aEnable) override
 > More...
 
void OnSwitchCanvas (wxCommandEvent &aEvent)
 switches currently used canvas (default / Cairo / OpenGL). More...
 
void OnUpdateSwitchCanvas (wxUpdateUIEvent &aEvent)
 Update UI called when switches currently used canvas (default / Cairo / OpenGL). More...
 
int GetIconScale () override
 Function GetIconScale. More...
 
void SetIconScale (int aScale) override
 Function SetIconScale. More...
 
virtual void OnCharHook (wxKeyEvent &event)
 this function capture the key event before it is sent to the GUI. More...
 
bool LockFile (const wxString &aFileName)
 Function LockFile marks a schematic file as being in use. More...
 
void ReleaseFile ()
 Function ReleaseFile Release the current file marked in use. More...
 
wxPoint GetCrossHairPosition (bool aInvertY=false) const
 Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates. More...
 
void SetCrossHairPosition (const wxPoint &aPosition, bool aSnapToGrid=true)
 Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) units. More...
 
wxPoint GetCursorPosition (bool aOnGrid, wxRealPoint *aGridSize=NULL) const
 Function GetCursorPosition returns the current cursor position in logical (drawing) units. More...
 
wxPoint GetNearestGridPosition (const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
 Function GetNearestGridPosition returns the nearest aGridSize location to aPosition. More...
 
wxPoint GetCrossHairScreenPosition () const
 Function GetCursorScreenPosition returns the cross hair position in device (display) units.b. More...
 
void SetMousePosition (const wxPoint &aPosition)
 
wxPoint RefPos (bool useMouse) const
 Function RefPos Return the reference position, coming from either the mouse position or the cursor position. More...
 
const wxPointGetScrollCenterPosition () const
 
void SetScrollCenterPosition (const wxPoint &aPoint)
 
virtual COLOR4D GetDrawBgColor () const
 
virtual void SetDrawBgColor (COLOR4D aColor)
 
bool GetShowBorderAndTitleBlock () const
 
void SetShowBorderAndTitleBlock (bool aShow)
 
bool ShowPageLimits () const
 
void SetShowPageLimits (bool aShow)
 
EDA_DRAW_PANELGetCanvas ()
 
virtual wxString GetScreenDesc () const
 
virtual BASE_SCREENGetScreen () const
 Function GetScreen returns 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...
 
void OnMenuOpen (wxMenuEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void SkipNextLeftButtonReleaseEvent ()
 function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down, the next left mouse button release event will be ignored. More...
 
int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
 > More...
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Function GetHotkeyConfig() Returns a structure containing currently used hotkey mapping. More...
 
virtual void AddMenuZoomAndGrid (wxMenu *aMasterMenu)
 Function AddMenuZoomAndGrid (virtual) Add standard zoom commands and submenu zoom and grid selection to a popup menu uses zoom hotkeys info base to add hotkeys info to menu commands. More...
 
double GetZoomLevelCoeff () const
 Function GetZoomLevelCoeff returns the coefficient to convert internal display scale factor to zoom level. More...
 
void EraseMsgBox ()
 
void Process_PageSettings (wxCommandEvent &event)
 
wxAuiToolBar * GetMainToolBar () const
 
wxAuiToolBar * GetOptionsToolBar () const
 
wxAuiToolBar * GetDrawToolBar () const
 
wxAuiToolBar * GetAuxiliaryToolBar () const
 
bool GetToolToggled (int aToolId)
 Checks all the toolbars and returns true if the given tool id is toggled. More...
 
wxAuiToolBarItem * GetToolbarTool (int aToolId)
 Checks all the toolbars and returns a reference to the given tool id or nullptr if not found. More...
 
virtual void SetToolID (int aId, int aCursor, const wxString &aToolMsg)
 Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor. More...
 
virtual void SetNoToolSelected ()
 Select the ID_NO_TOOL_SELECTED id tool (Idle tool) More...
 
int GetToolId () const
 
virtual bool IsGridVisible () const
 Function IsGridVisible() , virtual. More...
 
virtual COLOR4D GetGridColor ()
 Function GetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
virtual void OnSize (wxSizeEvent &event)
 Function OnSize recalculates the size of toolbars and display panel when the frame size changes. More...
 
void OnEraseBackground (wxEraseEvent &SizeEvent)
 
virtual void OnZoom (wxCommandEvent &event)
 
void SetNextZoom ()
 Function SetNextZoom() changes the zoom to the next one available. More...
 
void SetPrevZoom ()
 Function SetPrevZoom() changes the zoom to the previous one available. More...
 
void SetPresetZoom (int aIndex)
 Function SetPresetZoom() changes zoom to one of the preset values. More...
 
void RedrawScreen (const wxPoint &aCenterPoint, bool aWarpPointer)
 Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterPoint at the center of the screen. More...
 
void RedrawScreen2 (const wxPoint &posBefore)
 Function RedrawScreen2 puts the crosshair back to the screen position it had before zooming. More...
 
void Zoom_Automatique (bool aWarpPointer)
 Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows all the page or the board. More...
 
void Window_Zoom (EDA_RECT &Rect)
 
double GetZoom ()
 Function GetZoom. More...
 
void DrawWorkSheet (wxDC *aDC, BASE_SCREEN *aScreen, int aLineWidth, double aScale, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
 Function DrawWorkSheet Draws on screen the page layout with the frame and the basic inscriptions. More...
 
void DisplayToolMsg (const wxString &msg)
 
virtual void ToolOnRightClick (wxCommandEvent &event)
 
void AdjustScrollBars (const wxPoint &aCenterPosition)
 
virtual void OnActivate (wxActivateEvent &event)
 Function OnActivate (virtual) is called when activating the frame. More...
 
void DisplayUnitsMsg ()
 Function DisplayUnitsMsg displays current unit pane on the status bar. More...
 
virtual void InitBlockPasteInfos ()
 
virtual bool HandleBlockBegin (wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
 Initialize a block command. More...
 
void CopyToClipboard (wxCommandEvent &event)
 Function CopyToClipboard copies the current page or the current block to the clipboard. More...
 
void CreateServer (int service, bool local=true)
 
void OnSockRequest (wxSocketEvent &evt)
 
void OnSockRequestServer (wxSocketEvent &evt)
 
void AppendMsgPanel (const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
 Append a message to the message panel. More...
 
void ClearMsgPanel (void)
 Clear all messages from the message panel. More...
 
void SetMsgPanel (const std::vector< MSG_PANEL_ITEM > &aList)
 Function SetMsgPanel clears the message panel and populates it with the contents of aList. More...
 
void SetMsgPanel (EDA_ITEM *aItem)
 
virtual void UpdateMsgPanel ()
 Function UpdateMsgPanel redraws the message panel. More...
 
void PushPreferences (const EDA_DRAW_PANEL *aParentCanvas)
 Function PushPreferences Pushes a few preferences from a parent window to a child window. More...
 
wxString CoordinateToString (int aValue, bool aConvertToMils=false) const
 Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inches or mm according to the current user units setting. More...
 
wxString LengthDoubleToString (double aValue, bool aConvertToMils=false) const
 Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or mm according to the current user units setting. More...
 
virtual bool SwitchCanvas (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Changes the current rendering backend. More...
 
bool IsGalCanvasActive () const
 Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use. More...
 
EDA_DRAW_PANEL_GALGetGalCanvas () const
 Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame. More...
 
void SetGalCanvas (EDA_DRAW_PANEL_GAL *aPanel)
 
TOOL_MANAGERGetToolManager () const
 Function GetToolManager returns the tool manager instance, if any. More...
 
virtual void * GetDisplayOptions ()
 Function GetDisplayOptions A way to pass info to draw functions. More...
 
KIGFX::GAL_DISPLAY_OPTIONSGetGalDisplayOptions ()
 Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering. More...
 
virtual void SyncMenusAndToolbars (wxEvent &aEvent)
 Function SyncMenusAndToolbars Updates the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller state. More...
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
virtual void KiwayMailIn (KIWAY_EXPRESS &aEvent)
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Public Attributes

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

Protected Member Functions

void SetScreen (BASE_SCREEN *aScreen)
 
double bestZoom (double sizeX, double sizeY, double scaleFactor, wxPoint centre)
 
bool GeneralControlKeyMovement (int aHotKey, wxPoint *aPos, bool aSnapToGrid)
 Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global cursor keys (i.e. More...
 
void RefreshCrossHair (const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
 Move and refresh the crosshair after movement and call the mouse capture function. More...
 
bool isBusy () const
 
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting () const
 Returns the canvas type stored in the application settings. More...
 
bool saveCanvasTypeSetting (EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
 Stores the canvas type in the application settings. More...
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

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

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

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

Key in KifaceSettings to store the canvas type.

More...
 

Private Member Functions

void updateComponentListSelectBox ()
 
void updateNetnameListSelectBox ()
 
void updateAperAttributesSelectBox ()
 
void updateDCodeSelectBox ()
 
virtual void unitsChangeRefresh () override
 Function unitsChangeRefresh is called when when the units setting has changed to allow for any derived classes to handle refreshing and controls that have units based measurements in them. More...
 
void setupTools ()
 
void applyDisplaySettingsToGAL ()
 Updates the GAL with display settings changes. More...
 
bool loadListOfGerberFiles (const wxString &aPath, const wxArrayString &aFilenameList)
 Loads a list of Gerber files and updates the view based on them. More...
 

Private Attributes

GBR_LAYOUTm_gerberLayout
 
wxPoint m_grid_origin
 
PAGE_INFO m_paper
 
PARAM_CFG_ARRAY m_configSettings
 
int m_displayMode
 
bool m_show_layer_manager_tools
 
wxArrayString m_Messages
 

Detailed Description

Definition at line 62 of file gerbview_frame.h.

Constructor & Destructor Documentation

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

Definition at line 67 of file gerbview_frame.cpp.

References EDA_BASE_FRAME::config(), g_ColorsSettings, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, GerbviewHokeysDescr, LAYER_WIDGET::GetBestSize(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_FRAME::GetGalDisplayOptions(), GetPageSettings(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_PANEL_GAL::GetView(), EDA_PANEINFO::HorizontalToolbarPane(), ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_JOB_FILE1, ID_GERBVIEW_ZIP_FILE1, ID_MENU_CANVAS_CAIRO, ID_MENU_CANVAS_OPENGL, ID_POPUP_GRID_LEVEL_0_0_1MM, ID_POPUP_GRID_LEVEL_1000, KiBitmap(), EDA_PANEINFO::LayersToolbarPane(), PCAD2KICAD::Left, EDA_DRAW_FRAME::loadCanvasTypeSetting(), LoadSettings(), EDA_BASE_FRAME::m_auimgr, EDA_DRAW_FRAME::m_auxiliaryToolBar, EDA_DRAW_FRAME::m_canvas, m_colorsSettings, m_DCodeSelector, m_displayMode, EDA_DRAW_FRAME::m_drawToolBar, m_drillFileHistory, EDA_DRAW_FRAME::m_firstRunDialogSetting, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_gerberLayout, EDA_DRAW_FRAME::m_hotkeysDescrList, m_jobFileHistory, EDA_DRAW_FRAME::m_LastGridSizeId, m_LayersManager, EDA_BASE_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_showAxis, EDA_DRAW_FRAME::m_showBorderAndTitleBlock, m_zipFileHistory, EDA_DRAW_FRAME::m_zoomLevelCoeff, EDA_PANEINFO::MessageToolbarPane(), OnUpdateSwitchCanvas(), ReCreateAuxiliaryToolbar(), ReCreateHToolbar(), ReCreateMenuBar(), ReCreateOptToolbar(), GERBER_LAYER_WIDGET::ReFill(), ReFillLayerWidget(), GERBER_LAYER_WIDGET::ReFillRender(), EDA_DRAW_PANEL::Refresh(), PCAD2KICAD::Right, EDA_DRAW_FRAME::saveCanvasTypeSetting(), SaveSettings(), SetActiveLayer(), EDA_DRAW_PANEL::SetEnableBlockCommands(), EDA_DRAW_FRAME::SetGalCanvas(), BASE_SCREEN::SetGrid(), SetLayout(), COLORS_DESIGN_SETTINGS::SetLegacyMode(), SetPageSettings(), EDA_DRAW_FRAME::SetScreen(), setupTools(), SetVisibleLayers(), KIGFX::VIEW::UseDrawPriority(), UseGalCanvas(), EDA_PANEINFO::VerticalToolbarPane(), wxPoint::x, wxPoint::y, EDA_DRAW_FRAME::Zoom_Automatique(), and ZOOM_FACTOR.

67  :
68  EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
69  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
70 {
72  m_gerberLayout = NULL;
73  m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1
74  // when the screen shows a 1:1 image
75  // obviously depends on the monitor,
76  // but this is an acceptable value
77 
78  PAGE_INFO pageInfo( wxT( "GERBER" ) );
79  SetPageSettings( pageInfo );
80 
82 
83  m_showAxis = true; // true to show X and Y axis on screen
84  m_showBorderAndTitleBlock = false; // true for reference drawings.
86  m_SelLayerBox = NULL;
87  m_DCodeSelector = NULL;
88  m_SelComponentBox = nullptr;
89  m_SelNetnameBox = nullptr;
90  m_SelAperAttributesBox = nullptr;
91  m_displayMode = 0;
95 
96  EDA_DRAW_PANEL_GAL* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
100 
101  SetGalCanvas( galCanvas );
102 
103  // GerbView requires draw priority for rendering negative objects
104  galCanvas->GetView()->UseDrawPriority( true );
105 
106  if( m_canvas )
108 
109  // Give an icon
110  wxIcon icon;
111  icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
112  SetIcon( icon );
113 
114  SetLayout( new GBR_LAYOUT() );
115 
116  SetVisibleLayers( -1 ); // All draw layers visible.
117 
118  SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
119 
120  // Create the PCB_LAYER_WIDGET *after* SetLayout():
121  wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
122  int pointSize = font.GetPointSize();
123  int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
124 
125  if( screenHeight <= 900 )
126  pointSize = (pointSize * 8) / 10;
127 
128  m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );
129 
130  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
131  // initialize parameters in m_LayersManager
132  LoadSettings( config() );
133 
134  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
135 
136  if( m_LastGridSizeId < 0 )
137  m_LastGridSizeId = 0;
138 
141 
142  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
143 
144  m_auimgr.SetManagedWindow( this );
145 
146  ReCreateMenuBar();
150 
151  EDA_PANEINFO horiz;
152  horiz.HorizontalToolbarPane();
153 
154  EDA_PANEINFO vert;
155  vert.VerticalToolbarPane();
156 
157  EDA_PANEINFO mesg;
158  mesg.MessageToolbarPane();
159 
160  // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
161  // the Layers Manager is floatable, but initially docked at far right
162  EDA_PANEINFO lyrs;
163  lyrs.LayersToolbarPane();
164  lyrs.MinSize( m_LayersManager->GetBestSize() );
165  lyrs.BestSize( m_LayersManager->GetBestSize() );
166  lyrs.Caption( _( "Visibles" ) );
167  lyrs.TopDockable( false ).BottomDockable( false );
168 
169 
170  if( m_mainToolBar )
171  m_auimgr.AddPane( m_mainToolBar,
172  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
173 
174  if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows component and netname lists
175  {
176  m_auimgr.AddPane( m_auxiliaryToolBar,
177  wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );
178  }
179 
180  if( m_drawToolBar )
181  m_auimgr.AddPane( m_drawToolBar,
182  wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
183 
184  m_auimgr.AddPane( m_LayersManager,
185  lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );
186 
187  if( m_optionsToolBar )
188  m_auimgr.AddPane( m_optionsToolBar,
189  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
190 
191  if( m_canvas )
192  m_auimgr.AddPane( m_canvas,
193  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
194 
195  if( GetGalCanvas() )
196  m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
197  wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
198 
199  if( m_messagePanel )
200  m_auimgr.AddPane( m_messagePanel,
201  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
202 
203  ReFillLayerWidget(); // this is near end because contents establish size
204  m_auimgr.Update();
205 
206  setupTools();
207 
208  SetActiveLayer( 0, true );
209  Zoom_Automatique( false ); // Gives a default zoom value
210 
212 
213  // Nudge user to switch to OpenGL if they are on legacy or Cairo
214  if( m_firstRunDialogSetting < 1 )
215  {
216  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
217  {
218  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
219  "and faster experience. This option is turned off by "
220  "default since it is not compatible with all computers.\n\n"
221  "Would you like to try enabling graphics acceleration?\n\n"
222  "If you'd like to choose later, select Modern Toolset "
223  "(Accelerated) in the Preferences menu." );
224 
225  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ),
226  wxYES_NO );
227 
228  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
229 
230  if( dlg.ShowModal() == wxID_YES )
231  {
232  // Save Cairo as default in case OpenGL crashes
234 
235  // Switch to OpenGL, which will save the new setting if successful
236  wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
237  auto handler = GetEventHandler();
238  handler->ProcessEvent( evt );
239  }
240  else
241  {
242  // If they were on legacy, switch them to Cairo
243 
244  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
245  {
246  wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
247  auto handler = GetEventHandler();
248  handler->ProcessEvent( evt );
249  }
250  }
251  }
252 
254  SaveSettings( config() );
255  }
256 
257  // Canvas may have been updated by the dialog
258  canvasType = loadCanvasTypeSetting();
259 
260  if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
261  {
262  if( GetGalCanvas()->SwitchBackend( canvasType ) )
263  UseGalCanvas( true );
264 
265  wxUpdateUIEvent e;
267  }
268  else
269  {
271  m_canvas->Refresh();
272  }
273 
274  // Enable the axes to match legacy draw style
275  auto& galOptions = GetGalDisplayOptions();
276  galOptions.m_axesEnabled = true;
277  galOptions.NotifyChanged();
278 
280  m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
281 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Class GBR_LAYOUT holds list of GERBER_DRAW_ITEM currently loaded.
Definition: gbr_layout.h:53
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_GERBER)
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:916
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:108
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:159
void SetPageSettings(const PAGE_INFO &aPageSettings) override
GERBER_LAYER_WIDGET * m_LayersManager
void UseDrawPriority(bool aFlag)
Function UseDrawPriority()
Definition: view.h:651
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
void SetGalCanvas(EDA_DRAW_PANEL_GAL *aPanel)
Definition: draw_frame.h:896
wxAuiManager m_auimgr
wxFileHistory m_drillFileHistory
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
wxSize GetBestSize() const
Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic conten...
EDA_PANEINFO & LayersToolbarPane()
Function LayersToolbarPane Change *this to a layers toolbar for KiCad.
void SetVisibleLayers(long aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxChoice * m_SelNetnameBox
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
void ReCreateHToolbar() override
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:102
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:131
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:138
void ReCreateAuxiliaryToolbar() override
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:81
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:141
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:49
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:118
COLORS_DESIGN_SETTINGS * m_colorsSettings
GBR_LAYOUT * m_gerberLayout
wxFileHistory m_jobFileHistory
virtual void UseGalCanvas(bool aEnable) override
>
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
Function LoadSettings loads common frame parameters from a configuration file.
int m_LastGridSizeId
Definition: draw_frame.h:83
#define GERBVIEW_FRAME_NAME
Class GERBVIEW_FRAME is the main window used in GerbView.
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:135
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
Definition: draw_frame.cpp:128
#define ZOOM_FACTOR(x)
Definition: pcb_screen.cpp:42
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting() const
Returns the canvas type stored in the application settings.
void ReCreateOptToolbar()
Create or update the left vertical toolbar (option toolbar.
DCODE_SELECTION_BOX * m_DCodeSelector
wxFileHistory m_zipFileHistory
const PAGE_INFO & GetPageSettings() const override
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:91
wxChoice * m_SelAperAttributesBox
void OnUpdateSwitchCanvas(wxUpdateUIEvent &aEvent)
Update UI called when switches currently used canvas (default / Cairo / OpenGL).
struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[]
void SetEnableBlockCommands(bool aEnable)
wxChoice * m_SelComponentBox
void SetLegacyMode(bool aMode)
Enables or disables legacy color mode.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:895
void ReFillRender()
Function ReFillRender Rebuild Render for instance after the config is read.
bool m_show_layer_manager_tools
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
void SetLayout(GBR_LAYOUT *aLayout)
Function SetLayout sets the m_gerberLayout member in such as way as to ensure deleting any previous G...
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
long m_firstRunDialogSetting
Key to control whether first run dialog is shown on startup.
Definition: draw_frame.h:121
GERBVIEW_FRAME::~GERBVIEW_FRAME ( )

Definition at line 284 of file gerbview_frame.cpp.

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

285 {
286  GetGalCanvas()->GetView()->Clear();
287 
289  delete m_gerberLayout;
290 }
void DeleteAllImages()
remove all loaded data in list, and delete all images.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1051
GBR_LAYOUT * m_gerberLayout
GBR_LAYOUT * GetGerberLayout() const
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:50
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:895

Member Function Documentation

void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

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

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

Definition at line 693 of file eda_base_frame.cpp.

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

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

694 {
695  wxMenu* menu = NULL;
696  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
697 
698  if( item ) // This menu exists, do nothing
699  return;
700 
701  menu = new wxMenu;
702 
703  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
704  _( "Icons in Menus" ), wxEmptyString,
705  wxITEM_CHECK ) );
706  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
707 
708  AddMenuItem( MasterMenu, menu,
710  _( "Icons Options" ),
711  _( "Select show icons in menus and icons sizes" ),
712  KiBitmap( icon_xpm ) );
713 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void EDA_DRAW_FRAME::AddMenuZoomAndGrid ( wxMenu *  aMasterMenu)
virtualinherited

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

Parameters
aMasterMenu= the menu to populate.

Definition at line 266 of file zoom.cpp.

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

Referenced by EDA_DRAW_PANEL::OnRightClick().

267 {
268  int maxZoomIds;
269  double zoom;
270  wxString msg;
271  BASE_SCREEN* screen = m_canvas->GetScreen();
272 
273  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
274  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
275  msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
276  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
277  msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
278  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
279  msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
280  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
281  msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
282  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
283 
284 
285  wxMenu* zoom_choice = new wxMenu;
286  AddMenuItem( MasterMenu, zoom_choice,
287  ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
288  KiBitmap( zoom_selection_xpm ) );
289 
290  zoom = screen->GetZoom();
292  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
293  maxZoomIds : screen->m_ZoomList.size();
294 
295  // Populate zoom submenu.
296  for( int i = 0; i < maxZoomIds; i++ )
297  {
298  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
299 
300  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
301  wxEmptyString, wxITEM_CHECK );
302  if( zoom == screen->m_ZoomList[i] )
303  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
304  }
305 
306  // Create grid submenu as required.
307  if( screen->GetGridCount() )
308  {
309  wxMenu* gridMenu = new wxMenu;
310  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
311  _( "Grid" ), KiBitmap( grid_select_xpm ) );
312 
313  wxArrayString gridsList;
314  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
315 
316  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
317  {
318  GRID_TYPE& grid = screen->GetGrid( i );
319  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
320 
321  if( (int)i == icurr )
322  gridMenu->Check( grid.m_CmdId, true );
323  }
324  }
325 
326  MasterMenu->AppendSeparator();
327  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
328 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
size_t GetGridCount() const
Function GetGridCount().
Definition: base_screen.h:457
int BuildGridsChoiceList(wxArrayString &aGridsList, bool aMmFirst) const
Function BuildGridsChoiceList().
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:81
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Definition: base_screen.h:417
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:91
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class GRID_TYPE is for grid arrays.
Definition: base_screen.h:45
size_t i
Definition: json11.cpp:597
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:193
int m_CmdId
Definition: base_screen.h:48
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
Definition: base_screen.h:219
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

Definition at line 970 of file draw_frame.cpp.

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

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

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

Append a message to the message panel.

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

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

Definition at line 812 of file draw_frame.cpp.

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

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

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

Updates the GAL with display settings changes.

Definition at line 542 of file gerbview_frame.cpp.

References EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_PANEL_GAL::GetView(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions(), m_colorsSettings, m_DisplayOptions, and KIGFX::TARGET_NONCACHED.

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

543 {
544  auto view = GetGalCanvas()->GetView();
545  auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
546  auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
547  settings->LoadDisplayOptions( &m_DisplayOptions );
548 
549  settings->ImportLegacyColors( m_colorsSettings );
550 
551  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
552 }
void LoadDisplayOptions(const GBR_DISPLAY_OPTIONS *aOptions)
Function LoadDisplayOptions Loads settings related to display options.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Auxiliary rendering target (noncached)
Definition: definitions.h:42
Class GERBVIEW_PAINTER Contains methods for drawing GerbView-specific items.
COLORS_DESIGN_SETTINGS * m_colorsSettings
GBR_DISPLAY_OPTIONS m_DisplayOptions
Class GERBVIEW_RENDER_SETTINGS Stores GerbView specific render settings.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:895
double EDA_DRAW_FRAME::bestZoom ( double  sizeX,
double  sizeY,
double  scaleFactor,
wxPoint  centre 
)
protectedinherited

Definition at line 86 of file zoom.cpp.

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

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

87 {
88  double bestzoom = std::max( sizeX * scaleFactor / (double) m_canvas->GetClientSize().x,
89  sizeY * scaleFactor / (double) m_canvas->GetClientSize().y );
90 
91  // Take scrollbars into account
92  DSIZE scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize();
93  centre.x -= int( bestzoom * scrollbarSize.x / 2.0 );
94  centre.y -= int( bestzoom * scrollbarSize.y / 2.0 );
95 
96  SetScrollCenterPosition( centre );
97 
98  return bestzoom;
99 }
void SetScrollCenterPosition(const wxPoint &aPoint)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
#define max(a, b)
Definition: auxiliary.h:86
double GERBVIEW_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 362 of file gerbview_frame.cpp.

References EDA_DRAW_FRAME::bestZoom(), EDA_RECT::Centre(), GBR_LAYOUT::ComputeBoundingBox(), GetGerberLayout(), EDA_RECT::GetHeight(), EDA_RECT::GetWidth(), and EDA_DRAW_FRAME::SetScrollCenterPosition().

363 {
364  double defaultGerberZoom = 1.0;
366 
367  if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
368  {
369  SetScrollCenterPosition( wxPoint( 0, 0 ) );
370  return defaultGerberZoom;
371  }
372 
373  double sizeX = (double) bbox.GetWidth();
374  double sizeY = (double) bbox.GetHeight();
375  wxPoint centre = bbox.Centre();
376 
377  // Reserve no margin because GetGerberLayout()->ComputeBoundingBox() builds one in.
378  double margin_scale_factor = 1.0;
379 
380  return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
381 }
double bestZoom(double sizeX, double sizeY, double scaleFactor, wxPoint centre)
Definition: zoom.cpp:86
void SetScrollCenterPosition(const wxPoint &aPoint)
int GetHeight() const
Definition: eda_rect.h:118
EDA_RECT ComputeBoundingBox() const
Function ComputeBoundingBox calculates the bounding box containing all Gerber items.
Definition: gbr_layout.cpp:68
GBR_LAYOUT * GetGerberLayout() const
wxPoint Centre() const
Definition: eda_rect.h:60
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
void GERBVIEW_FRAME::Block_Move ( )

Function Block_Move moves all tracks and segments within the selected block.

New location is determined by the current offset from the selected block's original location.

Definition at line 187 of file gerbview/block.cpp.

References delta, EDA_DRAW_FRAME::GetCrossHairPosition(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GetGerberLayout(), GBR_LAYOUT::GetImagesList(), GERBER_FILE_IMAGE::GetItemsList(), BLOCK_SELECTOR::GetMoveVector(), EDA_DRAW_FRAME::GetScreen(), GERBER_DRAW_ITEM::HitTest(), GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, GERBER_DRAW_ITEM::MoveAB(), EDA_DRAW_PANEL::MoveCursorToCrossHair(), GERBER_DRAW_ITEM::Next(), EDA_RECT::Normalize(), EDA_DRAW_PANEL::Refresh(), EDA_DRAW_FRAME::SetCrossHairPosition(), BASE_SCREEN::SetModify(), and EDA_DRAW_PANEL::SetMouseCaptureCallback().

Referenced by HandleBlockPlace(), and hasAvailableLayers().

188 {
189  wxPoint delta;
190  wxPoint oldpos;
191 
192  oldpos = GetCrossHairPosition();
194 
195  SetCrossHairPosition( oldpos );
197  GetScreen()->SetModify();
199 
200  /* Calculate displacement vectors. */
203 
204  for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
205  {
206  GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
207 
208  if( gerber == NULL ) // Graphic layer not yet used
209  continue;
210 
211  /* Move items in block */
212  for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item; item = item->Next() )
213  {
214  GERBER_DRAW_ITEM* gerb_item = item;
215 
216  if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
217  gerb_item->MoveAB( delta );
218  }
219  }
220 
221  m_canvas->Refresh( true );
222 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void MoveAB(const wxPoint &aMoveVector)
Function MoveAB move this object.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:360
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
static const int delta[8][2]
Definition: solve.cpp:112
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
GERBER_DRAW_ITEM * Next() const
GBR_LAYOUT * GetGerberLayout() const
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:50
bool HitTest(const wxPoint &aRefPos) const override
Function HitTest tests if the given wxPoint is within the bounds of this object.
void SetModify()
Definition: base_screen.h:324
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
wxPoint GetMoveVector() const
int GERBVIEW_FRAME::BlockCommand ( EDA_KEY  key)
overridevirtual

Function BlockCommand returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to the aKey (ALT, SHIFT ALT ..)

Reimplemented from EDA_DRAW_FRAME.

Definition at line 44 of file gerbview/block.cpp.

References BLOCK_MOVE, BLOCK_ZOOM, GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, GR_KB_SHIFTCTRL, and MOUSE_MIDDLE.

Referenced by hasAvailableLayers().

45 {
46  int cmd = 0;
47 
48  switch( key )
49  {
50  default:
51  cmd = key & 0x255;
52  break;
53 
54  case 0:
55  cmd = BLOCK_MOVE;
56  break;
57 
58  case GR_KB_SHIFT:
59  case GR_KB_CTRL:
60  case GR_KB_SHIFTCTRL:
61  case GR_KB_ALT:
62  break;
63 
64  case MOUSE_MIDDLE:
65  cmd = BLOCK_ZOOM;
66  break;
67  }
68 
69  return cmd;
70 }
#define GR_KB_ALT
Definition: common.h:65
#define GR_KB_SHIFT
Definition: common.h:66
#define GR_KB_SHIFTCTRL
Definition: common.h:67
#define MOUSE_MIDDLE
Definition: common.h:68
#define GR_KB_CTRL
Definition: common.h:64
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input.

If an auto save file exists for aFileName, the user is prompted if they wish to replace file aFileName with the auto saved file. If the user chooses to replace the file, the backup file of aFileName is removed, aFileName is renamed to the backup file name, and the auto save file is renamed to aFileName. If user chooses to keep the existing version of aFileName, the auto save file is removed.

Parameters
aFileNameA wxFileName object containing the file name to check.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 598 of file eda_base_frame.cpp.

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

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

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

Definition at line 41 of file clear_gbr_drawlayers.cpp.

References GERBER_FILE_IMAGE_LIST::DeleteAllImages(), EDA_DRAW_FRAME::GetGalCanvas(), GetGerberLayout(), GetImagesList(), EDA_DRAW_FRAME::GetScreen(), IsOK(), EDA_DRAW_FRAME::m_toolManager, TOOL_BASE::MODEL_RELOAD, ReFillLayerWidget(), TOOL_MANAGER::ResetTools(), SetActiveLayer(), GBR_LAYOUT::SetBoundingBox(), and syncLayerBox().

Referenced by Files_io(), and hasAvailableLayers().

42 {
43  if( GetGerberLayout() == NULL )
44  return false;
45 
46  if( query && GetScreen()->IsModify() )
47  {
48  if( !IsOK( this, _( "Current data will be lost?" ) ) )
49  return false;
50  }
51 
52  if( auto canvas = GetGalCanvas() )
53  {
54  if( m_toolManager )
56 
57  canvas->GetView()->Clear();
58  }
59 
61 
63 
64  SetActiveLayer( 0 );
66  syncLayerBox();
67  return true;
68 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:100
void DeleteAllImages()
remove all loaded data in list, and delete all images.
Model changes (required full reload)
Definition: tool_base.h:83
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...
void SetBoundingBox(const EDA_RECT &aBox)
Definition: gbr_layout.h:110
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
GBR_LAYOUT * GetGerberLayout() const
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:895
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
void GERBVIEW_FRAME::ClearMessageList ( )
inline

Function ClearMessageList Clear the message list Call it before reading a Gerber file.

Definition at line 281 of file gerbview_frame.h.

Referenced by EXCELLON_IMAGE::LoadFile(), and GERBER_FILE_IMAGE::LoadGerberFile().

282  {
283  m_Messages.Clear();
284  }
wxArrayString m_Messages
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, unless m_configFrameName contains a base name. this is the case of frames which can be shown in normal or modal mode. This is needed because we want only one base name prefix, regardless the mode used.

Definition at line 260 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

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

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

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

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

Definition at line 871 of file draw_frame.cpp.

References CoordinateToString().

Referenced by getOptimalModulePlacement().

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

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

Definition at line 42 of file copy_to_clipboard.cpp.

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

Referenced by add_search_paths().

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

Definition at line 49 of file eda_dde.cpp.

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

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

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

Function DisplayFlashedItemsSolidMode.

Returns
true to draw flashed items in solid (filled) mode, false to draw draw flashed in sketch mode

Definition at line 404 of file gerbview_frame.h.

References GetActiveLayer(), getNextAvailableLayer(), GBR_DISPLAY_OPTIONS::m_DisplayFlashedItemsFill, ReFillLayerWidget(), and SetActiveLayer().

405  {
407  }
GBR_DISPLAY_OPTIONS m_DisplayOptions
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool GERBVIEW_FRAME::DisplayLinesSolidMode ( )
inline

Function DisplayLinesSolidMode.

Returns
true to draw gerber lines in solid (filled) mode, false to draw gerber lines in sketch mode

Definition at line 384 of file gerbview_frame.h.

References GBR_DISPLAY_OPTIONS::m_DisplayLinesFill.

385  {
387  }
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
GBR_DISPLAY_OPTIONS m_DisplayOptions
bool GERBVIEW_FRAME::DisplayPolygonsSolidMode ( )
inline

Function DisplayPolygonsSolidMode.

Returns
true to draw polygon in solid (filled) mode, false to draw polygon outlines only

Definition at line 394 of file gerbview_frame.h.

References GBR_DISPLAY_OPTIONS::m_DisplayPolygonsFill.

395  {
397  }
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
GBR_DISPLAY_OPTIONS m_DisplayOptions
void EDA_DRAW_FRAME::DisplayToolMsg ( const wxString &  msg)
inherited
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

Definition at line 559 of file draw_frame.cpp.

References g_UserUnit, INCHES, and MILLIMETRES.

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

560 {
561  wxString msg;
562 
563  switch( g_UserUnit )
564  {
565  case INCHES:
566  msg = _( "Inches" );
567  break;
568 
569  case MILLIMETRES:
570  msg = _( "mm" );
571  break;
572 
573  default:
574  msg = _( "Units" );
575  break;
576  }
577 
578  SetStatusText( msg, 4 );
579 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

Function doAutoSave should be overridden by the derived class to handle the auto save feature.

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 251 of file eda_base_frame.cpp.

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

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

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

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

Definition at line 76 of file worksheet.cpp.

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

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

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

Definition at line 71 of file clear_gbr_drawlayers.cpp.

References GERBER_FILE_IMAGE_LIST::DeleteImage(), GetActiveLayer(), GetImagesList(), IsOK(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_FRAME::m_toolManager, TOOL_BASE::MODEL_RELOAD, ReFillLayerWidget(), EDA_DRAW_PANEL::Refresh(), TOOL_MANAGER::ResetTools(), SetCurItem(), and syncLayerBox().

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

72 {
73  int layer = GetActiveLayer();
74  wxString msg;
75 
76  msg.Printf( _( "Clear layer %d?" ), layer + 1 );
77 
78  if( query && !IsOK( this, msg ) )
79  return;
80 
81  SetCurItem( NULL );
82 
83  if( m_toolManager )
85 
86  GetImagesList()->DeleteImage( layer );
87 
89  syncLayerBox();
90  m_canvas->Refresh();
91 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:100
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
Model changes (required full reload)
Definition: tool_base.h:83
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
void SetCurItem(GERBER_DRAW_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void DeleteImage(int aIdx)
delete the loaded data of image aIdx.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
void EDA_DRAW_FRAME::EraseMsgBox ( )
inherited

Definition at line 275 of file draw_frame.cpp.

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

Referenced by SetCurItem().

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

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

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

Parameters
cmdline= received command from socket

Reimplemented in SCH_EDIT_FRAME, and PCB_EDIT_FRAME.

Definition at line 372 of file draw_frame.h.

References EDA_DRAW_PANEL::OnMouseEvent().

Referenced by EDA_DRAW_FRAME::OnSockRequest().

372 {}
void GERBVIEW_FRAME::ExportDataInPcbnewFormat ( wxCommandEvent &  event)

Definition at line 160 of file export_to_pcbnew.cpp.

References DisplayInfoMessage(), GBR_TO_PCB_EXPORTER::ExportPcb(), LAYERS_MAP_DIALOG::GetCopperLayersCount(), GERBER_FILE_IMAGE_LIST::GetGbrImage(), GERBER_FILE_IMAGE_LIST::GetImagesList(), LAYERS_MAP_DIALOG::GetLayersLookUpTable(), GERBER_FILE_IMAGE_LIST::ImagesMaxCount(), and PcbFileWildcard().

Referenced by hasAvailableLayers().

161 {
162  int layercount = 0;
163 
165 
166  // Count the Gerber layers which are actually currently used
167  for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
168  {
169  if( images->GetGbrImage( ii ) )
170  layercount++;
171  }
172 
173  if( layercount == 0 )
174  {
175  DisplayInfoMessage( this,
176  _( "None of the Gerber layers contain any data" ) );
177  return;
178  }
179 
180  wxString fileName;
181  wxString path = m_mruPath;
182 
183  wxFileDialog filedlg( this, _( "Board File Name" ),
184  path, fileName, PcbFileWildcard(),
185  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
186 
187  if( filedlg.ShowModal() == wxID_CANCEL )
188  return;
189 
190  fileName = filedlg.GetPath();
191 
192  /* Install a dialog frame to choose the mapping
193  * between gerber layers and Pcbnew layers
194  */
195  LAYERS_MAP_DIALOG* layerdlg = new LAYERS_MAP_DIALOG( this );
196  int ok = layerdlg->ShowModal();
197  layerdlg->Destroy();
198 
199  if( ok != wxID_OK )
200  return;
201 
202  m_mruPath = wxFileName( fileName ).GetPath();
203 
204  GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
205 
206  gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), layerdlg->GetCopperLayersCount() );
207 }
wxString m_mruPath
Most recently used path.
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)
GBR_LAYOUT * GetGerberLayout() const
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:50
wxString PcbFileWildcard()
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:216
void EDA_BASE_FRAME::ExportHotkeyConfigToFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 757 of file hotkeys_basic.cpp.

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

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

759 {
760  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
761  wxString mask = wxT( "*." ) + ext;
762 
763 #if 0
764  wxString path = wxPathOnly( Prj().GetProjectFullName() );
765 #else
766  wxString path = GetMruPath();
767 #endif
768  wxFileName fn( aDefaultShortname );
769  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
770 
771  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
772  path,
773  fn.GetFullPath(),
774  ext,
775  mask,
776  this,
777  wxFD_SAVE,
778  true );
779 
780  if( filename.IsEmpty() )
781  return;
782 
783  WriteHotkeyConfig( aDescList, &filename );
784  SetMruPath( wxFileName( filename ).GetPath() );
785 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:270
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
void GERBVIEW_FRAME::Files_io ( wxCommandEvent &  event)

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

References Clear_DrawLayers(), EDA_DRAW_FRAME::ClearMsgPanel(), ID_GERBVIEW_ERASE_ALL, ID_GERBVIEW_LOAD_DRILL_FILE, ID_GERBVIEW_LOAD_JOB_FILE, ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, LoadExcellonFiles(), LoadGerberFiles(), LoadGerberJobFile(), LoadZipArchiveFile(), EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::Refresh(), and EDA_DRAW_FRAME::Zoom_Automatique().

Referenced by hasAvailableLayers().

107 {
108  int id = event.GetId();
109 
110  switch( id )
111  {
112  case wxID_FILE:
113  LoadGerberFiles( wxEmptyString );
114  break;
115 
117  Clear_DrawLayers( false );
118  Zoom_Automatique( false );
119  m_canvas->Refresh();
120  ClearMsgPanel();
121  break;
122 
124  LoadExcellonFiles( wxEmptyString );
125  m_canvas->Refresh();
126  break;
127 
129  LoadZipArchiveFile( wxEmptyString );
130  m_canvas->Refresh();
131  break;
132 
134  LoadGerberJobFile( wxEmptyString );
135  m_canvas->Refresh();
136  break;
137 
138  default:
139  wxFAIL_MSG( wxT( "File_io: unexpected command id" ) );
140  break;
141  }
142 }
bool Clear_DrawLayers(bool query)
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:102
bool LoadGerberFiles(const wxString &aFileName)
function LoadGerberFiles Load a photoplot (Gerber) file or many files.
bool LoadZipArchiveFile(const wxString &aFileName)
function LoadZipArchiveFileLoadZipArchiveFile Load a zipped archive file.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
bool LoadExcellonFiles(const wxString &aFileName)
function LoadExcellonFiles Load a drill (EXCELLON) file or many files.
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:823
bool GERBVIEW_FRAME::GeneralControl ( wxDC *  aDC,
const wxPoint aPosition,
EDA_KEY  aHotKey = 0 
)
overridevirtual

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

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

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 34 of file gerbview/controle.cpp.

References EDA_DRAW_FRAME::GeneralControlKeyMovement(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_FRAME::m_movingCursorWithKeyboard, OnHotKey(), EDA_DRAW_FRAME::RefreshCrossHair(), EDA_DRAW_FRAME::SetCrossHairPosition(), and UpdateStatusBar().

Referenced by hasAvailableLayers().

35 {
36  // Filter out the 'fake' mouse motion after a keyboard movement
37  if( !aHotKey && m_movingCursorWithKeyboard )
38  {
40  return false;
41  }
42 
43  wxPoint pos = aPosition;
44  wxPoint oldpos = GetCrossHairPosition();
45  bool eventHandled = GeneralControlKeyMovement( aHotKey, &pos, true );
46 
47  SetCrossHairPosition( pos );
48  RefreshCrossHair( oldpos, aPosition, aDC );
49 
50  if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
51  {
52  eventHandled = true;
53  }
54 
56 
57  return eventHandled;
58 }
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:151
bool OnHotKey(wxDC *aDC, int aHotkeyCode, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey.
bool EDA_DRAW_FRAME::GeneralControlKeyMovement ( int  aHotKey,
wxPoint aPos,
bool  aSnapToGrid 
)
protectedinherited

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

cursor movement by keyboard)

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

Definition at line 1393 of file draw_frame.cpp.

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

Referenced by DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), and GeneralControl().

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

Definition at line 219 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

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

Definition at line 448 of file draw_frame.h.

448 { return m_auxiliaryToolBar; }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:131
const wxPoint & GERBVIEW_FRAME::GetAuxOrigin ( ) const
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 1029 of file gerbview_frame.cpp.

References GBR_LAYOUT::GetAuxOrigin(), and m_gerberLayout.

Referenced by GetImagesList().

1030 {
1031  wxASSERT( m_gerberLayout );
1032  return m_gerberLayout->GetAuxOrigin();
1033 }
const wxPoint & GetAuxOrigin() const
Definition: gbr_layout.h:75
GBR_LAYOUT * m_gerberLayout
EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( )
inlineinherited

Definition at line 351 of file draw_frame.h.

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

351 { return m_canvas; }
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
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 75 of file gerbview_config.cpp.

References BLUE, BROWN, CYAN, DARKCYAN, DARKGRAY, DARKGREEN, DIM, g_ColorsSettings, g_UserUnit, GERBER_DRAW_LAYER, GREEN, i, LAYER_DCODES, LAYER_GERBVIEW_GRID, LAYER_NEGATIVE_OBJECTS, LIGHTCYAN, LIGHTGRAY, LIGHTMAGENTA, LIGHTRED, m_configSettings, m_displayMode, m_DisplayOptions, GBR_DISPLAY_OPTIONS::m_DisplayPolarCood, COLORS_DESIGN_SETTINGS::m_LayersColors, MAGENTA, RED, WHITE, and YELLOW.

Referenced by hasAvailableLayers(), LoadSettings(), and SaveSettings().

76 {
77  if( !m_configSettings.empty() )
78  return m_configSettings;
79 
80  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
81  (int*) &g_UserUnit, 0, 0, 1 ) );
82 
83  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
84  &m_displayMode, 2, 0, 2 ) );
85  m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
86  wxT( "DCodeColorEx" ),
88  LAYER_DCODES],
89  WHITE ) );
90  m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
91  wxT( "NegativeObjectsColorEx" ),
94  DARKGRAY ) );
95  m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
96  wxT( "GridColorEx" ),
99  DARKGRAY ) );
100  m_configSettings.push_back( new PARAM_CFG_BOOL( true,
101  wxT( "DisplayPolarCoordinates" ),
103  false ) );
104 
105  // Default colors for layers 0 to 31
106  static const COLOR4D color_default[] = {
115  };
116 
117  // List of keywords used as identifiers in config.
118  // They *must* be static const and not temporarily created,
119  // because the parameter list that use these keywords does not store them,
120  // just points to them.
121  static const wxChar* keys[] = {
122  wxT("ColorLayer0Ex"), wxT("ColorLayer1Ex"), wxT("ColorLayer2Ex"), wxT("ColorLayer3Ex"),
123  wxT("ColorLayer4Ex"), wxT("ColorLayer5Ex"), wxT("ColorLayer6Ex"), wxT("ColorLayer7Ex"),
124  wxT("ColorLayer8Ex"), wxT("ColorLayer9Ex"), wxT("ColorLayer10Ex"), wxT("ColorLayer11Ex"),
125  wxT("ColorLayer12Ex"), wxT("ColorLayer13Ex"), wxT("ColorLayer14Ex"), wxT("ColorLayer15Ex"),
126  wxT("ColorLayer16Ex"), wxT("ColorLayer17Ex"), wxT("ColorLayer18Ex"), wxT("ColorLayer19Ex"),
127  wxT("ColorLayer20Ex"), wxT("ColorLayer21Ex"), wxT("ColorLayer22Ex"), wxT("ColorLayer23Ex"),
128  wxT("ColorLayer24Ex"), wxT("ColorLayer25Ex"), wxT("ColorLayer26Ex"), wxT("ColorLayer27Ex"),
129  wxT("ColorLayer28Ex"), wxT("ColorLayer29Ex"), wxT("ColorLayer30Ex"), wxT("ColorLayer31Ex"),
130  };
131 
132  wxASSERT( DIM(keys) == DIM(color_default) );
133  wxASSERT( DIM(keys) <= DIM(g_ColorsSettings.m_LayersColors) && DIM(keys) <= DIM(color_default) );
134 
135  for( unsigned i = 0; i < DIM(keys); ++i )
136  {
138 
139  PARAM_CFG_SETCOLOR* prm_entry =
140  new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
141 
142  m_configSettings.push_back( prm_entry );
143  }
144 
145  return m_configSettings;
146 }
Definition: colors.h:57
#define DIM(x)
of elements in an array
Definition: macros.h:98
Definition: colors.h:61
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
PARAM_CFG_ARRAY m_configSettings
Configuration parameter - SetColor Class.
GBR_DISPLAY_OPTIONS m_DisplayOptions
Configuration parameter - Integer Class.
Definition: colors.h:59
Configuration parameter - Boolean Class.
Definition: colors.h:60
bool m_DisplayPolarCood
Option to display coordinates in status bar in X,Y or Polar coords.
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
Definition: colors.h:58
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_CVPCB_DISPLAY)
size_t i
Definition: json11.cpp:597
Definition: colors.h:49
#define GERBER_DRAW_LAYER(x)
Definition: colors.h:68
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition ( bool  aInvertY = false) const
inherited

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

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

Definition at line 1286 of file draw_frame.cpp.

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

Referenced by Abort_EditEdge(), AbortSymbolTraceOn(), AddMenusForBus(), AddMenusForWire(), PCB_BASE_FRAME::AddPad(), PCB_EDIT_FRAME::AutoPlaceModule(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Self(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PL_EDITOR_FRAME::Block_Move(), Block_Move(), BuildDimension(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), LIB_EDIT_FRAME::CreateGraphicItem(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopupMenuForTracks(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteConnection(), SCH_EDIT_FRAME::DeleteItemAtCrossHair(), DrawAndSizingBlockOutlines(), EDA_DRAW_PANEL::DrawCrossHair(), DrawMovePin(), drawMovingBlock(), DrawMovingBlockOutlines(), DrawSegment(), PCB_BASE_EDIT_FRAME::duplicateItem(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), moveBitmap(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnDragItem(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_FP_EDITOR::OnEditValue(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), LIB_EDIT_FRAME::OnOrient(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_EDIT_FRAME::OnRightClick(), LIB_VIEW_FRAME::OnSetRelativeOffset(), FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset(), FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset(), EDA_DRAW_FRAME::OnZoom(), DIALOG_UPDATE_PCB::PerformUpdate(), LIB_EDIT_FRAME::PlaceAnchor(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_BASE_FRAME::PlaceTexteModule(), SCH_EDIT_FRAME::PrepareMoveItem(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), EDA_DRAW_FRAME::RedrawScreen2(), RedrawWhileMovingCursor(), EDA_DRAW_FRAME::RefreshCrossHair(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), resizeSheetWithMouseCursor(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), Show_MoveTexte_Module(), Show_New_Edge_While_Move_Mouse(), Show_Pad_Move(), Show_Zone_Corner_Or_Outline_While_Move_Mouse(), ShowBoundingBoxMicroWaveInductor(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), ShowNewTrackWhenMovingCursor(), ShowTargetShapeWhileMovingMouse(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SymbolDisplayDraw(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and UpdateStatusBar().

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

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

Returns
The current cross hair position.

Definition at line 1324 of file draw_frame.cpp.

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

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

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

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

Definition at line 1310 of file draw_frame.cpp.

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

Referenced by EDA_DRAW_PANEL::OnMouseWheel().

1311 {
1312  BASE_SCREEN* screen = GetScreen(); // virtual call
1313  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1314 }
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
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 292 of file gerbview_frame.h.

References m_displayMode.

Referenced by OnSelectDisplayMode(), OnUpdateDrawMode(), and RedrawActiveWindow().

292 { return m_displayMode; }
virtual void* EDA_DRAW_FRAME::GetDisplayOptions ( )
inlinevirtualinherited

Function GetDisplayOptions A way to pass info to draw functions.

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

Reimplemented in PCB_BASE_FRAME.

Definition at line 910 of file draw_frame.h.

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

910 { return NULL; }
wxAuiToolBar* EDA_DRAW_FRAME::GetDrawToolBar ( ) const
inlineinherited

Definition at line 447 of file draw_frame.h.

447 { return m_drawToolBar; }
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:135
wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function GetFileFromHistory fetches the file name from the file history list.

and removes the selected file, if this file does not exists Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

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

Definition at line 420 of file eda_base_frame.cpp.

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

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

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

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

Returns
Pointer to GAL-based canvas.

Definition at line 895 of file draw_frame.h.

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

895 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame&#39;s interface to setting GAL display options.
Definition: draw_frame.h:69
KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_FRAME::GetGalDisplayOptions ( )
inlineinherited

Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for rendering.

Definition at line 916 of file draw_frame.h.

Referenced by DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS(), EVT_TOOL(), GERBVIEW_FRAME(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), EDA_DRAW_FRAME::OnToggleCrossHairStyle(), EDA_DRAW_FRAME::OnUpdateCrossHairStyle(), PCBNEW_CONTROL::SwitchCursor(), and COMMON_TOOLS::ToggleCursor().

916 { return *m_galDisplayOptions; }
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:72
EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox ( )

Function GetGerberLayoutBoundingBox calculates the bounding box containing all gerber items.

Returns
EDA_RECT - the items bounding box

Definition at line 1074 of file gerbview_frame.cpp.

References GBR_LAYOUT::ComputeBoundingBox(), GBR_LAYOUT::GetBoundingBox(), and GetGerberLayout().

Referenced by GetImagesList().

1075 {
1077  return GetGerberLayout()->GetBoundingBox();
1078 }
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox.
Definition: gbr_layout.h:105
EDA_RECT ComputeBoundingBox() const
Function ComputeBoundingBox calculates the bounding box containing all Gerber items.
Definition: gbr_layout.cpp:68
GBR_LAYOUT * GetGerberLayout() const
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( )
inlinevirtualinherited

Function GetGridColor() , virtual.

Returns
the color of the grid

Reimplemented in FOOTPRINT_EDIT_FRAME, PCB_EDIT_FRAME, DISPLAY_FOOTPRINTS_FRAME, and FOOTPRINT_VIEWER_FRAME.

Definition at line 517 of file draw_frame.h.

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

518  {
519  return m_gridColor;
520  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:88
const wxPoint& GERBVIEW_FRAME::GetGridOrigin ( ) const
inlineoverridevirtual

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

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

Implements EDA_DRAW_FRAME.

Definition at line 116 of file gerbview_frame.h.

References m_grid_origin.

116 { return m_grid_origin; }
wxPoint m_grid_origin
wxPoint EDA_DRAW_FRAME::GetGridPosition ( const wxPoint aPosition) const
inherited

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

Otherwise, the original positions is returned.

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

Definition at line 631 of file draw_frame.cpp.

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

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

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

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

Definition at line 397 of file draw_frame.h.

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

397 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:81
EDA_HOTKEY * GERBVIEW_FRAME::GetHotKeyDescription ( int  aCommand) const
overridevirtual

>

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

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

Implements EDA_DRAW_FRAME.

Definition at line 140 of file gerbview/hotkeys.cpp.

References GetDescriptorFromCommand().

Referenced by hasAvailableLayers().

141 {
142  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, gerbviewHotkeyList );
143 
144  return HK_Descr;
145 }
EDA_HOTKEY * gerbviewHotkeyList[]
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
int GERBVIEW_FRAME::GetIconScale ( )
overridevirtual

Function GetIconScale.

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

Reimplemented from EDA_BASE_FRAME.

Definition at line 1267 of file gerbview_frame.cpp.

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

Referenced by DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), and SaveCopyInUndoList().

1268 {
1269  int scale = 0;
1270  Kiface().KifaceSettings()->Read( IconScaleEntry, &scale, 0 );
1271  return scale;
1272 }
static const wxString IconScaleEntry
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
const int scale
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 547 of file eda_base_frame.cpp.

References ShowAboutDialog().

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

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

Definition at line 534 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

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

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

Definition at line 456 of file eda_base_frame.cpp.

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

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

457 {
458  const SEARCH_STACK& search = sys_search();
459 
460  /* We have to get document for beginners,
461  * or the full specific doc
462  * if event id is wxID_INDEX, we want the document for beginners.
463  * else the specific doc file (its name is in Kiface().GetHelpFileName())
464  * The document for beginners is the same for all KiCad utilities
465  */
466  if( event.GetId() == wxID_INDEX )
467  {
468  // List of possible names for Getting Started in KiCad
469  const wxChar* names[2] = {
470  wxT( "getting_started_in_kicad" ),
471  wxT( "Getting_Started_in_KiCad" )
472  };
473 
474  wxString helpFile;
475  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
476  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
477  for( unsigned ii = 0; ii < DIM( names ); ii++ )
478  {
479  helpFile = SearchHelpFileFullPath( search, names[ii] );
480 
481  if( !helpFile.IsEmpty() )
482  break;
483  }
484 
485  if( !helpFile )
486  {
487  wxString msg = wxString::Format( _(
488  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
489  wxMessageBox( msg );
490  }
491  else
492  {
493  GetAssociatedDocument( this, helpFile );
494  }
495 
496  return;
497  }
498 
499  wxString base_name = help_name();
500  wxString helpFile = SearchHelpFileFullPath( search, base_name );
501 
502  if( !helpFile )
503  {
504  wxString msg = wxString::Format( _(
505  "Help file \"%s\" could not be found." ),
506  GetChars( base_name )
507  );
508  wxMessageBox( msg );
509  }
510  else
511  {
512  GetAssociatedDocument( this, helpFile );
513  }
514 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:87
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
virtual const SEARCH_STACK & sys_search()
Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_M...
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSStack, const wxString &aBaseName)
Function SearchHelpFileFullPath returns the help file&#39;s full path.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual wxString help_name()
COLOR4D GERBVIEW_FRAME::GetLayerColor ( int  aLayer) const

Function GetLayerColor gets a layer color for any valid layer.

Definition at line 951 of file gerbview_frame.cpp.

References COLORS_DESIGN_SETTINGS::GetLayerColor(), and m_colorsSettings.

Referenced by GBR_LAYOUT::Draw(), GBR_LAYER_BOX_SELECTOR::GetLayerColor(), GERBER_LAYER_WIDGET::ReFill(), SetDisplayMode(), and UseGalCanvas().

952 {
953  return m_colorsSettings->GetLayerColor( aLayer );
954 }
COLORS_DESIGN_SETTINGS * m_colorsSettings
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
wxAuiToolBar* EDA_DRAW_FRAME::GetMainToolBar ( ) const
inlineinherited

Definition at line 445 of file draw_frame.h.

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

Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.

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

Definition at line 1317 of file draw_frame.cpp.

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

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

1318 {
1319  BASE_SCREEN* screen = GetScreen(); // virtual call
1320  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1321 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
wxPoint getNearestGridPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getNearestGridPosition returns the nearest aGridSize location to aPosition.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
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 942 of file gerbview_frame.cpp.

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

Referenced by RedrawActiveWindow(), and SetDisplayMode().

943 {
946  else
947  return GetDrawBgColor();
948 }
COLOR4D GetVisibleElementColor(GERBVIEW_LAYER_ID aItemIdVisible)
Function GetVisibleElementColor returns the color of a gerber visible element.
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:338
bool IsElementVisible(GERBVIEW_LAYER_ID aItemIdVisible) const
Function IsElementVisible tests whether a given element category is visible.
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 555 of file gerbview_frame.cpp.

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

Referenced by DisplayFlashedItemsSolidMode(), hasAvailableLayers(), LoadExcellonFiles(), loadListOfGerberFiles(), and unarchiveFiles().

556 {
557  int layer = aLayer;
558 
559  for( unsigned i = 0; i < ImagesMaxCount(); ++i )
560  {
561  const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
562 
563  if( gerber == NULL ) // this graphic layer is available: use it
564  return layer;
565 
566  ++layer; // try next graphic layer
567 
568  if( layer >= (int)ImagesMaxCount() )
569  layer = 0;
570  }
571 
572  return NO_AVAILABLE_LAYERS;
573 }
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
size_t i
Definition: json11.cpp:597
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
wxAuiToolBar* EDA_DRAW_FRAME::GetOptionsToolBar ( ) const
inlineinherited

Definition at line 446 of file draw_frame.h.

446 { return m_optionsToolBar; }
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:138
const PAGE_INFO & GERBVIEW_FRAME::GetPageSettings ( ) const
overridevirtual
const wxSize GERBVIEW_FRAME::GetPageSizeIU ( ) const
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 1006 of file gerbview_frame.cpp.

References GetPageSettings().

Referenced by GetImagesList().

1007 {
1008  // this function is only needed because EDA_DRAW_FRAME is not compiled
1009  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
1010  // into an application specific source file.
1011  return GetPageSettings().GetSizeIU();
1012 }
const PAGE_INFO & GetPageSettings() const override
virtual BASE_SCREEN* EDA_DRAW_FRAME::GetScreen ( ) const
inlinevirtualinherited

Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.

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

Reimplemented in SCH_EDIT_FRAME, PCB_BASE_FRAME, PL_EDITOR_FRAME, and SCH_BASE_FRAME.

Definition at line 361 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::AdjustScrollBars(), Block_Move(), Clear_DrawLayers(), EDA_DRAW_FRAME::CopyToClipboard(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), GERBVIEW_FRAME(), GetActiveLayer(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_FRAME::GetCrossHairScreenPosition(), EDA_DRAW_FRAME::GetCursorPosition(), EDA_DRAW_FRAME::GetNearestGridPosition(), SCH_BASE_FRAME::GetScreen(), PL_EDITOR_FRAME::GetScreen(), EDA_DRAW_PANEL::GetScreen(), PCB_BASE_FRAME::GetScreen(), EDA_DRAW_FRAME::GetScrollCenterPosition(), EDA_DRAW_FRAME::GetZoom(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), GRID_MENU::GRID_MENU(), EDA_DRAW_FRAME::HandleBlockBegin(), HandleBlockEnd(), HandleBlockPlace(), EDA_DRAW_FRAME::InitBlockPasteInfos(), EDA_DRAW_FRAME::isBusy(), LoadSettings(), OnHotKey(), OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseWheel(), EDA_DRAW_PANEL::OnPan(), OnRightClick(), EDA_DRAW_PANEL::OnScroll(), EDA_DRAW_FRAME::OnSelectZoom(), EDA_DRAW_FRAME::OnUpdateRedo(), EDA_DRAW_FRAME::OnUpdateUndo(), EDA_DRAW_FRAME::OnZoom(), PushTrack(), RedrawActiveWindow(), EDA_DRAW_FRAME::RefPos(), GERBVIEW_CONTROL::ResetCoords(), EDA_DRAW_FRAME::SaveSettings(), SetActiveLayer(), EDA_DRAW_FRAME::SetCrossHairPosition(), SetCurItem(), EDA_DRAW_FRAME::SetMousePosition(), EDA_DRAW_FRAME::SetNextGrid(), EDA_DRAW_FRAME::SetNextZoom(), SetPageSettings(), EDA_DRAW_FRAME::SetPresetGrid(), EDA_DRAW_FRAME::SetPresetZoom(), EDA_DRAW_FRAME::SetPrevGrid(), EDA_DRAW_FRAME::SetPrevZoom(), EDA_DRAW_FRAME::SetScrollCenterPosition(), GRID_MENU::update(), ZOOM_MENU::update(), COMMON_TOOLS::updateGrid(), EDA_DRAW_FRAME::UpdateMsgPanel(), UpdateStatusBar(), EDA_DRAW_FRAME::UseGalCanvas(), EDA_DRAW_FRAME::Window_Zoom(), EDA_DRAW_FRAME::Zoom_Automatique(), ZOOM_MENU::ZOOM_MENU(), and COMMON_TOOLS::ZoomPreset().

361 { return m_currentScreen; }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:64
wxString EDA_DRAW_FRAME::GetScreenDesc ( ) const
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

Definition at line 119 of file worksheet.cpp.

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

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

Definition at line 1345 of file draw_frame.cpp.

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

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

1346 {
1347  BASE_SCREEN* screen = GetScreen(); // virtual call
1348  return screen->getScrollCenterPosition();
1349 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
const wxPoint & getScrollCenterPosition() const
Definition: base_screen.h:173
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inlineinherited

Definition at line 345 of file draw_frame.h.

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

345 { return m_showBorderAndTitleBlock; }
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:118
const TITLE_BLOCK & GERBVIEW_FRAME::GetTitleBlock ( ) const
overridevirtual

Implements EDA_DRAW_FRAME.

Definition at line 1015 of file gerbview_frame.cpp.

References GBR_LAYOUT::GetTitleBlock(), and m_gerberLayout.

Referenced by SetGridOrigin().

1016 {
1017  wxASSERT( m_gerberLayout );
1018  return m_gerberLayout->GetTitleBlock();
1019 }
TITLE_BLOCK & GetTitleBlock()
Definition: gbr_layout.h:85
GBR_LAYOUT * m_gerberLayout
wxAuiToolBarItem * EDA_DRAW_FRAME::GetToolbarTool ( int  aToolId)
inherited

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

Definition at line 330 of file draw_frame.cpp.

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

331 {
332  // Checks all the toolbars and returns a reference to the given tool id
333  // (or the first tool found, but only one or 0 tool is expected, because on
334  // Windows, when different tools have the same ID, it creates issues)
335  if( m_mainToolBar && m_mainToolBar->FindTool( aToolId ) )
336  return m_mainToolBar->FindTool( aToolId );
337 
338  if( m_optionsToolBar && m_optionsToolBar->FindTool( aToolId ) )
339  return m_optionsToolBar->FindTool( aToolId );
340 
341  if( m_drawToolBar && m_drawToolBar->FindTool( aToolId ) )
342  return m_drawToolBar->FindTool( aToolId );
343 
344  if( m_auxiliaryToolBar && m_auxiliaryToolBar->FindTool( aToolId ) )
345  return m_auxiliaryToolBar->FindTool( aToolId );
346 
347  return nullptr;
348 }
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
Definition: draw_frame.h:131
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:138
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:135
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
int EDA_DRAW_FRAME::GetToolId ( ) const
inlineinherited
Returns
the current tool ID when there is no active tool, the ID_NO_TOOL_SELECTED is returned (the id of the default Tool (idle tool) of the right vertical toolbar)

Definition at line 488 of file draw_frame.h.

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

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

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

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

Definition at line 319 of file draw_frame.cpp.

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

Referenced by ZOOM_TOOL::Main().

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

Function GetVisibleElementColor returns the color of a gerber visible element.

Definition at line 888 of file gerbview_frame.cpp.

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

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

889 {
890  COLOR4D color = COLOR4D::UNSPECIFIED;
891 
892  switch( aItemIdVisible )
893  {
895  case LAYER_DCODES:
896  color = m_colorsSettings->GetItemColor( aItemIdVisible );
897  break;
898 
899  case LAYER_GERBVIEW_GRID:
900  color = GetGridColor();
901  break;
902 
903  default:
904  wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
905  (int)aItemIdVisible );
906  }
907 
908  return color;
909 }
int color
Definition: DXF_plotter.cpp:62
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
COLORS_DESIGN_SETTINGS * m_colorsSettings
virtual COLOR4D GetGridColor()
Function GetGridColor() , virtual.
Definition: draw_frame.h:517
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
long GERBVIEW_FRAME::GetVisibleLayers ( ) const

Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all the layers that are visible.

Returns
long - the visible layers in bit-mapped form.

Definition at line 840 of file gerbview_frame.cpp.

References GERBER_DRAW_LAYER, GERBER_DRAWLAYERS_COUNT, EDA_DRAW_FRAME::GetGalCanvas(), and i.

Referenced by loadListOfGerberFiles(), GERBER_LAYER_WIDGET::OnLayerVisible(), and SetDisplayMode().

841 {
842  long layerMask = 0;
843 
844  if( auto canvas = GetGalCanvas() )
845  {
846  // NOTE: This assumes max 32 drawlayers!
847  for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
848  {
849  if( canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) )
850  layerMask |= ( 1 << i );
851  }
852 
853  return layerMask;
854  }
855  else
856  {
857  return -1;
858  }
859 }
#define GERBER_DRAWLAYERS_COUNT
size_t i
Definition: json11.cpp:597
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:895
#define GERBER_DRAW_LAYER(x)
double EDA_DRAW_FRAME::GetZoom ( )
inherited

Function GetZoom.

Returns
The current zoom level.

Definition at line 536 of file draw_frame.cpp.

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

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

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

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

Definition at line 434 of file draw_frame.h.

Referenced by ZOOM_MENU::ZOOM_MENU().

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

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

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

Initialize a block command.

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

Definition at line 882 of file draw_frame.cpp.

References BLOCK_COPY, BLOCK_DELETE, BLOCK_DRAG, BLOCK_DRAG_ITEM, BLOCK_DUPLICATE, BLOCK_DUPLICATE_AND_INCREMENT, BLOCK_FLIP, BLOCK_IDLE, BLOCK_MIRROR_X, BLOCK_MIRROR_Y, BLOCK_MOVE, BLOCK_PASTE, BLOCK_PRESELECT_MOVE, BLOCK_ROTATE, BLOCK_ZOOM, EDA_DRAW_FRAME::BlockCommand(), EDA_DRAW_PANEL::CallMouseCapture(), BLOCK_SELECTOR::ClearItemsList(), DisplayError(), BLOCK_SELECTOR::GetCommand(), BLOCK_SELECTOR::GetCount(), EDA_DRAW_FRAME::GetScreen(), BLOCK_SELECTOR::GetState(), EDA_DRAW_FRAME::InitBlockPasteInfos(), BLOCK_SELECTOR::InitData(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, BLOCK_SELECTOR::SetCommand(), BLOCK_SELECTOR::SetLastCursorPosition(), BLOCK_SELECTOR::SetMessageBlock(), EDA_DRAW_PANEL::SetMouseCaptureCallback(), BLOCK_SELECTOR::SetState(), STATE_BLOCK_MOVE, and STATE_NO_BLOCK.

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

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

Function HandleBlockEnd handles the end of a block command, It is called at the end of the definition of the area of a block.

Depending on the current block command, this command is executed or parameters are initialized to prepare a call to HandleBlockPlace in GetScreen()->m_BlockLocate

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

Reimplemented from EDA_DRAW_FRAME.

Definition at line 104 of file gerbview/block.cpp.

References BLOCK_MOVE, BLOCK_ZOOM, EDA_DRAW_PANEL::CallMouseCapture(), BASE_SCREEN::ClearBlockCommand(), DrawMovingBlockOutlines(), EDA_DRAW_PANEL::EndMouseCapture(), BLOCK_SELECTOR::GetCommand(), EDA_DRAW_PANEL::GetCurrentCursor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetToolId(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, EDA_DRAW_PANEL::SetMouseCaptureCallback(), BLOCK_SELECTOR::SetState(), STATE_BLOCK_MOVE, and EDA_DRAW_FRAME::Window_Zoom().

Referenced by hasAvailableLayers().

105 {
106  bool nextcmd = false;
107  bool zoom_command = false;
108 
109  if( m_canvas->IsMouseCaptured() )
110 
111  switch( GetScreen()->m_BlockLocate.GetCommand() )
112  {
113  case BLOCK_MOVE: /* Move */
115  nextcmd = true;
116  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
118  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
119  break;
120 
121  case BLOCK_ZOOM: /* Window Zoom */
122  zoom_command = true;
123  break;
124 
125  default:
126  wxFAIL_MSG( wxT("HandleBlockEnd: Unexpected block command") );
127  break;
128  }
129 
130  if( ! nextcmd )
131  {
134  false );
135  }
136 
137  if( zoom_command )
138  Window_Zoom( GetScreen()->m_BlockLocate );
139 
140  return nextcmd ;
141 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
int GetCurrentCursor() const
Function GetCurrentCursor.
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void ClearBlockCommand()
Definition: base_screen.h:501
void SetState(BLOCK_STATE_T aState)
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static void DrawMovingBlockOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool erase)
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
int GetToolId() const
Definition: draw_frame.h:488
void Window_Zoom(EDA_RECT &Rect)
Definition: zoom.cpp:124
BLOCK_COMMAND_T GetCommand() const
void GERBVIEW_FRAME::HandleBlockPlace ( wxDC *  DC)
overridevirtual

Function HandleBlockPlace handles the block place command.

Reimplemented from EDA_DRAW_FRAME.

Definition at line 73 of file gerbview/block.cpp.

References BLOCK_MOVE, Block_Move(), EDA_DRAW_PANEL::CallMouseCapture(), BASE_SCREEN::ClearBlockCommand(), BLOCK_SELECTOR::ClearItemsList(), EDA_DRAW_FRAME::DisplayToolMsg(), EDA_DRAW_PANEL::EndMouseCapture(), EDA_DRAW_PANEL::GetCurrentCursor(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetToolId(), EDA_DRAW_PANEL::IsMouseCaptured(), BASE_SCREEN::m_BlockLocate, EDA_DRAW_FRAME::m_canvas, BASE_SCREEN::SetModify(), BLOCK_SELECTOR::SetState(), and STATE_BLOCK_STOP.

Referenced by hasAvailableLayers().

74 {
75  wxASSERT( m_canvas->IsMouseCaptured() );
76 
78 
79  switch( GetScreen()->m_BlockLocate.GetCommand() )
80  {
81  case BLOCK_MOVE: /* Move */
82  if( m_canvas->IsMouseCaptured() )
83  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
84 
85  Block_Move();
87  break;
88 
89  default:
90  wxFAIL_MSG( wxT("HandleBlockPlace: Unexpected block command") );
91  break;
92  }
93 
94  m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
95  GetScreen()->SetModify();
97 
98  wxASSERT( GetScreen()->m_BlockLocate.GetCount() == 0 );
99 
100  DisplayToolMsg( wxEmptyString );
101 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void Block_Move()
Function Block_Move moves all tracks and segments within the selected block.
int GetCurrentCursor() const
Function GetCurrentCursor.
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
void ClearBlockCommand()
Definition: base_screen.h:501
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
void SetState(BLOCK_STATE_T aState)
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
bool IsMouseCaptured() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:553
int GetToolId() const
Definition: draw_frame.h:488
void SetModify()
Definition: base_screen.h:324
bool GERBVIEW_FRAME::hasAvailableLayers ( ) const
inline

Definition at line 438 of file gerbview_frame.h.

References Block_Move(), BlockCommand(), Clear_DrawLayers(), Erase_Current_DrawLayer(), ExportDataInPcbnewFormat(), Files_io(), GeneralControl(), GetConfigurationSettings(), GetHotKeyDescription(), getNextAvailableLayer(), HandleBlockEnd(), HandleBlockPlace(), InstallGerberOptionsDialog(), Liste_D_Codes(), LoadExcellonFiles(), LoadGerberFiles(), LoadGerberJobFile(), LoadSettings(), LoadZipArchiveFile(), Locate(), NO_AVAILABLE_LAYERS, OnDrlFileHistory(), OnGbrFileHistory(), OnHotKey(), OnJobFileHistory(), OnQuit(), OnSelectActiveDCode(), OnSelectActiveLayer(), OnSelectDisplayMode(), OnSelectHighlightChoice(), OnSelectOptionToolbar(), OnShowGerberSourceFile(), OnToggleCoordType(), OnToggleFlashItemDrawMode(), OnToggleLineDrawMode(), OnTogglePolygonDrawMode(), OnToggleShowLayerManager(), OnUpdateCoordType(), OnUpdateDiffMode(), OnUpdateDrawMode(), OnUpdateFlashedItemsDrawMode(), OnUpdateHighContrastMode(), OnUpdateLayerSelectBox(), OnUpdateLineDrawMode(), OnUpdatePolygonDrawMode(), OnUpdateSelectDCode(), OnUpdateShowDCodes(), OnUpdateShowLayerManager(), OnUpdateShowNegativeItems(), OnZipFileHistory(), Process_Config(), Process_Special_Functions(), Read_EXCELLON_File(), Read_GERBER_File(), SaveSettings(), ShowChangedLanguage(), SortLayersByX2Attributes(), syncLayerBox(), syncLayerWidget(), ToPrinter(), unarchiveFiles(), UpdateDisplayOptions(), and UpdateTitleAndInfo().

439  {
441  }
int getNextAvailableLayer(int aLayer=0) const
Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the ca...
#define NO_AVAILABLE_LAYERS
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 396 of file eda_base_frame.cpp.

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

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

397 {
398  return Kiface().GetHelpFileName();
399 }
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
unsigned GERBVIEW_FRAME::ImagesMaxCount ( ) const

The max number of file images.

Definition at line 1191 of file gerbview_frame.cpp.

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

Referenced by GetImagesList(), getNextAvailableLayer(), Liste_D_Codes(), and Locate().

1192 {
1194 }
GBR_LAYOUT * m_gerberLayout
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:50
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 728 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and EDA_FILE_SELECTOR().

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

730 {
731  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
732  wxString mask = wxT( "*." ) + ext;
733 
734 
735  wxString path = GetMruPath();
736  wxFileName fn( aDefaultShortname );
737  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
738 
739  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
740  path,
741  fn.GetFullPath(),
742  ext,
743  mask,
744  this,
745  wxFD_OPEN,
746  true );
747 
748  if( filename.IsEmpty() )
749  return;
750 
751  ReadHotkeyConfigFile( filename, aDescList );
752  WriteHotkeyConfig( aDescList );
753  SetMruPath( wxFileName( filename ).GetPath() );
754 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current ho...
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
void EDA_DRAW_FRAME::InitBlockPasteInfos ( )
virtualinherited

Reimplemented in SCH_EDIT_FRAME, and LIB_EDIT_FRAME.

Definition at line 707 of file draw_frame.cpp.

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

Referenced by EDA_DRAW_FRAME::HandleBlockBegin().

708 {
711 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
void GERBVIEW_FRAME::InstallGerberOptionsDialog ( wxCommandEvent &  event)

Definition at line 72 of file gerbview_dialog_display_options_frame.cpp.

Referenced by hasAvailableLayers().

73 {
74  DIALOG_DISPLAY_OPTIONS dlg( this );
75  int opt = dlg.ShowModal();
76 
77  if( opt > 0 )
78  m_canvas->Refresh();
79 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:98
virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Function autoSaveRequired returns the auto save status of the application.

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

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 175 of file eda_base_frame.h.

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

Referenced by EDA_BASE_FRAME::ProcessEvent().

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

Definition at line 1491 of file draw_frame.cpp.

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

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

1492 {
1493  const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
1494 
1495  if( !screen )
1496  return false;
1497 
1498  return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
1499  || ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
1500 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:361
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
BLOCK_STATE_T GetState() const
bool KIWAY_PLAYER::IsDismissed ( )
protectedinherited

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

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

Definition at line 158 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop.

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

159 {
160  return !m_modal_loop;
161 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:248
bool GERBVIEW_FRAME::IsElementVisible ( GERBVIEW_LAYER_ID  aItemIdVisible) const

Function IsElementVisible tests whether a given element category is visible.

Keep this as an inline function.

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

Definition at line 816 of file gerbview_frame.cpp.

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

Referenced by GERBVIEW_CONTROL::DisplayControl(), GetNegativeItemsColor(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), OnHotKey(), OnSelectOptionToolbar(), OnUpdateShowDCodes(), OnUpdateShowNegativeItems(), GERBER_LAYER_WIDGET::ReFillRender(), SaveSettings(), and SetDisplayMode().

817 {
818  switch( aItemIdVisible )
819  {
820  case LAYER_DCODES:
822  break;
823 
826  break;
827 
828  case LAYER_GERBVIEW_GRID:
829  return IsGridVisible();
830  break;
831 
832  default:
833  wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aItemIdVisible );
834  }
835 
836  return true;
837 }
bool m_DisplayNegativeObjects
Option to draw negative objects in a specific color.