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...
 
 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) const
 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 () const
 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 getActiveLayer 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 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 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 OnUpdateLinesDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdatePolygonsDrawMode (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowDCodes (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowNegativeItems (wxUpdateUIEvent &aEvent)
 
void OnUpdateShowLayerManager (wxUpdateUIEvent &aEvent)
 
void OnUpdateSelectDCode (wxUpdateUIEvent &aEvent)
 
void OnUpdateLayerSelectBox (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...
 
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 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 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...
 
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
 
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 () const
 Function GetGridColor() , virtual. More...
 
virtual void SetGridColor (COLOR4D aColor)
 Function SetGridColor() , virtual. More...
 
wxPoint GetGridPosition (const wxPoint &aPosition) const
 Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and snap to grid is enabled. More...
 
virtual void SetNextGrid ()
 Function SetNextGrid() changes the grid size settings to the next one available. More...
 
virtual void SetPrevGrid ()
 Function SetPrevGrid() changes the grid size settings to the previous one available. More...
 
void SetPresetGrid (int aIndex)
 Function SetPresetGrid() changes the grid size to one of the preset values. More...
 
virtual void OnSelectGrid (wxCommandEvent &event)
 Command event handler for selecting grid sizes. More...
 
virtual void OnSelectZoom (wxCommandEvent &event)
 Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar. More...
 
void OnToggleGridState (wxCommandEvent &aEvent)
 
void OnSelectUnits (wxCommandEvent &aEvent)
 
void OnToggleCrossHairStyle (wxCommandEvent &aEvent)
 
void OnUpdateUndo (wxUpdateUIEvent &aEvent)
 
void OnUpdateRedo (wxUpdateUIEvent &aEvent)
 
void OnUpdateGrid (wxUpdateUIEvent &aEvent)
 
void OnUpdateUnits (wxUpdateUIEvent &aEvent)
 
void OnUpdateCrossHairStyle (wxUpdateUIEvent &aEvent)
 
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)
 Function OnZoom Called from any zoom event (toolbar , hotkey or popup ) More...
 
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)
 Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window screen. More...
 
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 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 void UseGalCanvas (bool aEnable)
 Function UseGalCanvas used to switch between standard and GAL-based canvas. 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...
 
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...
 
bool Enable (bool enable) override
 
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
 

Protected Member Functions

void SetScreen (BASE_SCREEN *aScreen)
 
void 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)
 
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
 
wxString m_lastFileName
 The last filename chosen to be proposed to the user. 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...
 
wxChoice * m_gridSelectBox
 Choice box to choose the grid size. More...
 
wxChoice * m_zoomSelectBox
 Choice box to choose the zoom value. 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_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...
 

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

Private Attributes

GBR_LAYOUTm_gerberLayout
 
wxPoint m_grid_origin
 
PAGE_INFO m_paper
 
wxAuiToolBar * m_auxiliaryToolBar
 Auxiliary tool bar typically shown below the main tool bar at the top of the main window. More...
 
PARAM_CFG_ARRAY m_configSettings
 
COLORS_DESIGN_SETTINGSm_colorsSettings
 
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 60 of file gerbview_frame.cpp.

References EDA_BASE_FRAME::config(), g_ColorsSettings, GerbviewHokeysDescr, LAYER_WIDGET::GetBestSize(), GetPageSettings(), EDA_DRAW_FRAME::GetScreen(), EDA_PANEINFO::HorizontalToolbarPane(), ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_ZIP_FILE1, ID_POPUP_GRID_LEVEL_0_0_1MM, ID_POPUP_GRID_LEVEL_1000, KiBitmap(), EDA_PANEINFO::LayersToolbarPane(), PCAD2KICAD::Left, LoadSettings(), EDA_BASE_FRAME::m_auimgr, m_auxiliaryToolBar, EDA_DRAW_FRAME::m_canvas, m_colorsSettings, m_DCodeSelector, m_displayMode, EDA_DRAW_FRAME::m_drawToolBar, m_drillFileHistory, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_gerberLayout, EDA_DRAW_FRAME::m_hotkeysDescrList, EDA_DRAW_FRAME::m_LastGridSizeId, m_LayersManager, EDA_BASE_FRAME::m_mainToolBar, EDA_DRAW_FRAME::m_messagePanel, EDA_DRAW_FRAME::m_optionsToolBar, m_SelLayerBox, 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(), ReCreateAuxiliaryToolbar(), ReCreateHToolbar(), ReCreateMenuBar(), ReCreateOptToolbar(), ReFillLayerWidget(), GERBER_LAYER_WIDGET::ReFillRender(), PCAD2KICAD::Right, setActiveLayer(), EDA_DRAW_PANEL::SetEnableBlockCommands(), BASE_SCREEN::SetGrid(), SetLayout(), SetPageSettings(), EDA_DRAW_FRAME::SetScreen(), SetVisibleLayers(), UpdateTitleAndInfo(), EDA_PANEINFO::VerticalToolbarPane(), wxPoint::x, wxPoint::y, EDA_DRAW_FRAME::Zoom_Automatique(), and ZOOM_FACTOR.

60  :
61  EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
62  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
63 {
64  m_auxiliaryToolBar = NULL;
66  m_gerberLayout = NULL;
67  m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1
68  // when the screen shows a 1:1 image
69  // obviously depends on the monitor,
70  // but this is an acceptable value
71 
72  PAGE_INFO pageInfo( wxT( "GERBER" ) );
73  SetPageSettings( pageInfo );
74 
76 
77  m_showAxis = true; // true to show X and Y axis on screen
78  m_showBorderAndTitleBlock = false; // true for reference drawings.
80  m_SelLayerBox = NULL;
81  m_DCodeSelector = NULL;
82  m_displayMode = 0;
85 
86  if( m_canvas )
88 
89  // Give an icon
90  wxIcon icon;
91  icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
92  SetIcon( icon );
93 
94  SetLayout( new GBR_LAYOUT() );
95 
96  SetVisibleLayers( -1 ); // All draw layers visible.
97 
98  SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
99 
100  // Create the PCB_LAYER_WIDGET *after* SetLayout():
101  wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
102  int pointSize = font.GetPointSize();
103  int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
104 
105  if( screenHeight <= 900 )
106  pointSize = (pointSize * 8) / 10;
107 
108  m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );
109 
110  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
111  // initialize parameters in m_LayersManager
112  LoadSettings( config() );
113 
114  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
115 
116  if( m_LastGridSizeId < 0 )
117  m_LastGridSizeId = 0;
120  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
121 
122  ReCreateMenuBar();
126 
127  m_auimgr.SetManagedWindow( this );
128 
129  EDA_PANEINFO horiz;
130  horiz.HorizontalToolbarPane();
131 
132  EDA_PANEINFO vert;
133  vert.VerticalToolbarPane();
134 
135  EDA_PANEINFO mesg;
136  mesg.MessageToolbarPane();
137 
138  // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
139  // the Layers Manager is floatable, but initially docked at far right
140  EDA_PANEINFO lyrs;
141  lyrs.LayersToolbarPane();
142  lyrs.MinSize( m_LayersManager->GetBestSize() );
143  lyrs.BestSize( m_LayersManager->GetBestSize() );
144  lyrs.Caption( _( "Visibles" ) );
145  lyrs.TopDockable( false ).BottomDockable( false );
146 
147 
148  if( m_mainToolBar )
149  m_auimgr.AddPane( m_mainToolBar,
150  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
151 
152  if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows component and netname lists
153  {
154  m_auimgr.AddPane( m_auxiliaryToolBar,
155  wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );
156  }
157 
158  if( m_drawToolBar )
159  m_auimgr.AddPane( m_drawToolBar,
160  wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
161 
162  m_auimgr.AddPane( m_LayersManager,
163  lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );
164 
165  if( m_optionsToolBar )
166  m_auimgr.AddPane( m_optionsToolBar,
167  wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
168 
169  if( m_canvas )
170  m_auimgr.AddPane( m_canvas,
171  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
172 
173  if( m_messagePanel )
174  m_auimgr.AddPane( m_messagePanel,
175  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
176 
177  ReFillLayerWidget(); // this is near end because contents establish size
178  m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
179  m_auimgr.Update();
180 
181  setActiveLayer( 0, true );
182  Zoom_Automatique( false ); // Gives a default zoom value
184 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:475
Class GBR_LAYOUT holds list of GERBER_DRAW_ITEM currently loaded.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
bool m_showAxis
True shows the X and Y axis indicators.
Definition: draw_frame.h:102
void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:140
void SetPageSettings(const PAGE_INFO &aPageSettings) override
GERBER_LAYER_WIDGET * m_LayersManager
#define ZOOM_FACTOR(x)
Definition: classpcb.cpp:48
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
Definition: basicframe.cpp:361
wxAuiManager m_auimgr
Definition: wxstruct.h:140
wxFileHistory m_drillFileHistory
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.
Definition: wxstruct.h:527
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.
Definition: wxstruct.h:466
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:36
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:77
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:493
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
void ReCreateAuxiliaryToolbar() override
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:112
COLORS_DESIGN_SETTINGS * m_colorsSettings
GBR_LAYOUT * m_gerberLayout
wxPoint m_FramePos
Definition: wxstruct.h:130
Class GERBER_LAYER_WIDGET is here to implement the abtract functions of LAYER_WIDGET so they may be t...
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
int m_LastGridSizeId
Definition: draw_frame.h:77
COLORS_DESIGN_SETTINGS g_ColorsSettings
Definition: pcbnew.cpp:68
#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:122
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:136
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:126
void ReCreateOptToolbar()
Create or update the left vertical toolbar (option toolbar.
void setActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function setActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
DCODE_SELECTION_BOX * m_DCodeSelector
wxAuiToolBar * m_auxiliaryToolBar
Auxiliary tool bar typically shown below the main tool bar at the top of the main window...
wxFileHistory m_zipFileHistory
const PAGE_INFO & GetPageSettings() const override
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:512
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[]
void SetEnableBlockCommands(bool aEnable)
wxSize m_FrameSize
Definition: wxstruct.h:131
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.
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 ...
void UpdateTitleAndInfo()
Function UpdateTitleAndInfo displays the short filename (if exists) of the selected layer on the capt...
GERBVIEW_FRAME::~GERBVIEW_FRAME ( )

Definition at line 187 of file gerbview_frame.cpp.

188 {
189 }

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 671 of file basicframe.cpp.

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

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

672 {
673  wxMenu* menu = NULL;
674  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
675 
676  if( item ) // This menu exists, do nothing
677  return;
678 
679  menu = new wxMenu;
680 
681  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
682  _( "Icons in Menus" ), wxEmptyString,
683  wxITEM_CHECK ) );
684  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
685 
686  AddMenuItem( MasterMenu, menu,
688  _( "Icons Options" ),
689  _( "Select show icons in menus and icons sizes" ),
690  KiBitmap( icon_xpm ) );
691 }
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:55
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:36
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 239 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, 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().

240 {
241  int maxZoomIds;
242  double zoom;
243  wxString msg;
244  BASE_SCREEN* screen = m_canvas->GetScreen();
245 
246  msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
247  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
248  msg = AddHotkeyName( _( "Zoom in" ), m_hotkeysDescrList, HK_ZOOM_IN );
249  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
250  msg = AddHotkeyName( _( "Zoom out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
251  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
252  msg = AddHotkeyName( _( "Redraw view" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
253  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
254  msg = AddHotkeyName( _( "Zoom auto" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
255  AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
256 
257 
258  wxMenu* zoom_choice = new wxMenu;
259  AddMenuItem( MasterMenu, zoom_choice,
260  ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ),
261  KiBitmap( zoom_selection_xpm ) );
262 
263  zoom = screen->GetZoom();
265  maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
266  maxZoomIds : screen->m_ZoomList.size();
267 
268  // Populate zoom submenu.
269  for( int i = 0; i < maxZoomIds; i++ )
270  {
271  msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
272 
273  zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
274  wxEmptyString, wxITEM_CHECK );
275  if( zoom == screen->m_ZoomList[i] )
276  zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
277  }
278 
279  // Create grid submenu as required.
280  if( screen->GetGridCount() )
281  {
282  wxMenu* gridMenu = new wxMenu;
283  AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
284  _( "Grid Select" ), KiBitmap( grid_select_xpm ) );
285 
286  wxArrayString gridsList;
287  int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
288 
289  for( unsigned i = 0; i < gridsList.GetCount(); i++ )
290  {
291  GRID_TYPE& grid = screen->GetGrid( i );
292  gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
293 
294  if( (int)i == icurr )
295  gridMenu->Check( grid.m_CmdId, true );
296  }
297  }
298 
299  MasterMenu->AppendSeparator();
300  AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
301 }
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:55
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
size_t GetGridCount() const
Function GetGridCount().
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:36
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
const GRID_TYPE & GetGrid() const
Return the grid object of the currently selected grid.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
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.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
void EDA_DRAW_FRAME::AdjustScrollBars ( const wxPoint aCenterPosition)
inherited

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

912 {
913  BASE_SCREEN* screen = GetScreen();
914 
915  if( !screen || !m_canvas )
916  return;
917 
918  double scale = screen->GetScalingFactor();
919 
920  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
921  aCenterPositionIU.x, aCenterPositionIU.y, scale );
922 
923  // Calculate the portion of the drawing that can be displayed in the
924  // client area at the current zoom level.
925 
926  // visible viewport in device units ~ pixels
927  wxSize clientSizeDU = m_canvas->GetClientSize();
928 
929  // Size of the client window in IU
930  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
931 
932  // Full drawing or "page" rectangle in internal units
933  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
934 
935  // Account for scrollbars
936  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
937  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
938  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
939 
940  // The upper left corner of the client rectangle in internal units.
941  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
942  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
943 
944  // If drawn around the center, adjust the client rectangle accordingly.
945  if( screen->m_Center )
946  {
947  // half page offset.
948  xIU += pageRectIU.GetWidth() / 2.0;
949  yIU += pageRectIU.GetHeight() / 2.0;
950  }
951 
952  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
953  wxPoint centerPositionIU;
954 
955  // put "int" limits on the clientRect
956  if( clientRectIU.GetLeft() < VIRT_MIN )
957  clientRectIU.MoveLeftTo( VIRT_MIN );
958  if( clientRectIU.GetTop() < VIRT_MIN )
959  clientRectIU.MoveTopTo( VIRT_MIN );
960  if( clientRectIU.GetRight() > VIRT_MAX )
961  clientRectIU.MoveRightTo( VIRT_MAX );
962  if( clientRectIU.GetBottom() > VIRT_MAX )
963  clientRectIU.MoveBottomTo( VIRT_MAX );
964 
965  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
966  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
967 
968  if( screen->m_Center )
969  {
970  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
971  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
972  }
973 
974  DSIZE virtualSizeIU;
975 
976  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
977  {
978  virtualSizeIU.x = pageRectIU.GetSize().x;
979  }
980  else
981  {
982  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
983  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
984 
985  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
986  {
987  if( pageCenterX > clientCenterX )
988  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
989  else if( pageCenterX < clientCenterX )
990  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
991  else
992  virtualSizeIU.x = clientRectIU.GetWidth();
993  }
994  else
995  {
996  if( pageCenterX > clientCenterX )
997  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
998  else if( pageCenterX < clientCenterX )
999  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
1000  else
1001  virtualSizeIU.x = pageRectIU.GetWidth();
1002  }
1003  }
1004 
1005  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
1006  {
1007  virtualSizeIU.y = pageRectIU.GetSize().y;
1008  }
1009  else
1010  {
1011  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
1012  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
1013 
1014  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
1015  {
1016  if( pageCenterY > clientCenterY )
1017  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
1018  else if( pageCenterY < clientCenterY )
1019  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
1020  else
1021  virtualSizeIU.y = clientRectIU.GetHeight();
1022  }
1023  else
1024  {
1025  if( pageCenterY > clientCenterY )
1026  virtualSizeIU.y = pageRectIU.GetHeight() +
1027  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1028  else if( pageCenterY < clientCenterY )
1029  virtualSizeIU.y = pageRectIU.GetHeight() +
1030  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1031  else
1032  virtualSizeIU.y = pageRectIU.GetHeight();
1033  }
1034  }
1035 
1036  // put "int" limits on the virtualSizeIU
1037  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1038  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1039 
1040  if( screen->m_Center )
1041  {
1042  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1043  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1044  }
1045  else
1046  {
1047  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1048  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1049  }
1050 
1051  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1052  * around cursor to jump around. This reported problem occurs when the
1053  * zoom point is not on a pixel per unit increment. If you set the
1054  * pixels per unit to 10, you have potential for the zoom point to
1055  * jump around +/-5 pixels from the nearest grid point.
1056  */
1057  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1058 
1059  // Number of scroll bar units for the given zoom level in device units.
1060  double unitsX = virtualSizeIU.x * scale;
1061  double unitsY = virtualSizeIU.y * scale;
1062 
1063  // Store the requested center position for later use
1064  SetScrollCenterPosition( aCenterPositionIU );
1065 
1066  // Calculate the scroll bar position in internal units to place the
1067  // center position at the center of client rectangle.
1068  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1069  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1070 
1071  // Convert scroll bar position to device units.
1072  posX = KiROUND( posX * scale );
1073  posY = KiROUND( posY * scale );
1074 
1075  if( posX < 0 )
1076  {
1077  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1078  posX = 0;
1079  }
1080 
1081  if( posX > unitsX )
1082  {
1083  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1084  posX = unitsX;
1085  }
1086 
1087  if( posY < 0 )
1088  {
1089  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1090  posY = 0;
1091  }
1092 
1093  if( posY > unitsY )
1094  {
1095  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1096  posY = unitsY;
1097  }
1098 
1099  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1100  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1101 
1102  wxLogTrace( traceScrollSettings,
1103  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1104  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1105  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1107  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1108  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1109 
1110  bool noRefresh = true;
1111 
1112  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1113  screen->m_ScrollPixelsPerUnitY,
1114  screen->m_ScrollbarNumber.x,
1115  screen->m_ScrollbarNumber.y,
1116  screen->m_ScrollbarPos.x,
1117  screen->m_ScrollbarPos.y, noRefresh );
1118 }
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:908
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
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:907
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:309
bool m_Center
Center on screen.
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
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:92
static const double MAX_AXIS
Definition: draw_frame.cpp:905
const int scale
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
#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 753 of file draw_frame.cpp.

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

Referenced by PCB_BASE_FRAME::Compile_Ratsnest(), LIB_EDIT_FRAME::DisplayCmpDoc(), GERBER_FILE_IMAGE::DisplayImageInfo(), PCB_EDIT_FRAME::Fill_Zone(), SCH_PRINTOUT::OnPrintPage(), SCH_EDIT_FRAME::OpenProjectFiles(), LIB_VIEW_FRAME::RedrawActiveWindow(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), PCB_EDIT_FRAME::SavePcbFile(), ShowNewTrackWhenMovingCursor(), and PCB_EDIT_FRAME::Solve().

756 {
757  if( m_messagePanel == NULL )
758  return;
759 
760  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
761 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110
double GERBVIEW_FRAME::BestZoom ( )
overridevirtual

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

Implements EDA_DRAW_FRAME.

Definition at line 249 of file gerbview_frame.cpp.

References EDA_RECT::Centre(), GBR_LAYOUT::ComputeBoundingBox(), GetGerberLayout(), EDA_RECT::GetHeight(), GetPageSettings(), PAGE_INFO::GetSizeMils(), EDA_RECT::GetWidth(), EDA_DRAW_FRAME::m_canvas, max, EDA_DRAW_FRAME::SetScrollCenterPosition(), and EDA_RECT::SetSize().

250 {
252 
253  // gives a size to bbox (current page size), if no item in list
254  if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
255  {
256  wxSize pagesize = GetPageSettings().GetSizeMils();
257  bbox.SetSize( wxSize( Mils2iu( pagesize.x ), Mils2iu( pagesize.y ) ) );
258  }
259 
260  // Compute best zoom:
261  wxSize size = m_canvas->GetClientSize();
262  double x = (double) bbox.GetWidth() / (double) size.x;
263  double y = (double) bbox.GetHeight() / (double) size.y;
264  double best_zoom = std::max( x, y ) * 1.1;
265 
267 
268  return best_zoom;
269 }
void SetScrollCenterPosition(const wxPoint &aPoint)
int GetHeight() const
EDA_RECT ComputeBoundingBox()
Function ComputeBoundingBox calculates the bounding box containing all Gerber items.
const wxSize & GetSizeMils() const
GBR_LAYOUT * GetGerberLayout() const
wxPoint Centre() const
const PAGE_INFO & GetPageSettings() const override
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void SetSize(const wxSize &size)
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
int GetWidth() const
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().

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 }
GERBER_FILE_IMAGE_LIST * GetImagesList()
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void MoveAB(const wxPoint &aMoveVector)
Function MoveAB move this object.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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:348
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:309
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:92
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
bool HitTest(const wxPoint &aRefPos) const override
Function HitTest tests if the given wxPoint is within the bounds of this object.
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.

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 576 of file basicframe.cpp.

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

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

578 {
579  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
580  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
581 
582  wxFileName autoSaveFileName = aFileName;
583 
584  // Check for auto save file.
585  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
586 
587  wxLogTrace( traceAutoSave,
588  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
589 
590  if( !autoSaveFileName.FileExists() )
591  return;
592 
593  wxString msg = wxString::Format( _(
594  "Well this is potentially embarrassing!\n"
595  "It appears that the last time you were editing the file\n"
596  "'%s'\n"
597  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
598  GetChars( aFileName.GetFullName() )
599  );
600 
601  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
602 
603  // Make a backup of the current file, delete the file, and rename the auto save file to
604  // the file name.
605  if( response == wxYES )
606  {
607  // Get the backup file name.
608  wxFileName backupFileName = aFileName;
609  backupFileName.SetExt( aBackupFileExtension );
610 
611  // If an old backup file exists, delete it. If an old copy of the file exists, rename
612  // it to the backup file name
613  if( aFileName.FileExists() )
614  {
615  // Remove the old file backup file.
616  if( backupFileName.FileExists() )
617  wxRemoveFile( backupFileName.GetFullPath() );
618 
619  // Rename the old file to the backup file name.
620  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
621  {
622  msg.Printf( _( "Could not create backup file <%s>" ),
623  GetChars( backupFileName.GetFullPath() ) );
624  wxMessageBox( msg );
625  }
626  }
627 
628  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
629  {
630  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
631  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
632  }
633  }
634  else
635  {
636  wxLogTrace( traceAutoSave,
637  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
638 
639  // Remove the auto save file when using the previous file as is.
640  wxRemoveFile( autoSaveFileName.GetFullPath() );
641  }
642 }
const wxChar traceAutoSave[]
Custom trace mask to enable and disable auto save tracing.
Definition: basicframe.cpp:53
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
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
#define AUTOSAVE_PREFIX_FILENAME
Prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash...
Definition: wxstruct.h:71
bool GERBVIEW_FRAME::Clear_DrawLayers ( bool  query)

Definition at line 39 of file clear_gbr_drawlayers.cpp.

References GERBER_FILE_IMAGE_LIST::DeleteAllImages(), GetGerberLayout(), GetImagesList(), EDA_DRAW_FRAME::GetScreen(), IsOK(), ReFillLayerWidget(), setActiveLayer(), GBR_LAYOUT::SetBoundingBox(), and syncLayerBox().

Referenced by Files_io().

40 {
41  if( GetGerberLayout() == NULL )
42  return false;
43 
44  if( query && GetScreen()->IsModify() )
45  {
46  if( !IsOK( this, _( "Current data will be lost?" ) ) )
47  return false;
48  }
49 
51 
53 
54  setActiveLayer( 0 );
56  syncLayerBox();
57  return true;
58 }
void DeleteAllImages()
remove all loaded data in list, and delete all images.
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
void SetBoundingBox(const EDA_RECT &aBox)
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
GBR_LAYOUT * GetGerberLayout() const
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
void setActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function setActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
Class EDA_RECT handles the component boundary box.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:111
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 264 of file gerbview_frame.h.

265  {
266  m_Messages.Clear();
267  }
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 256 of file wxstruct.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().

257  {
258  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
259  return baseCfgName;
260  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
Definition: wxstruct.h:133
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 812 of file draw_frame.cpp.

References CoordinateToString().

813 {
814  return ::CoordinateToString( aValue, aConvertToMils );
815 }
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:117
void EDA_DRAW_FRAME::CopyToClipboard ( wxCommandEvent &  event)
inherited

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

Definition at line 43 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.

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

References GBR_DISPLAY_OPTIONS::m_DisplayFlashedItemsFill.

388  {
390  }
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 367 of file gerbview_frame.h.

References GBR_DISPLAY_OPTIONS::m_DisplayLinesFill.

368  {
370  }
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 377 of file gerbview_frame.h.

References GBR_DISPLAY_OPTIONS::m_DisplayPolygonsFill.

378  {
380  }
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
GBR_DISPLAY_OPTIONS m_DisplayOptions
void EDA_DRAW_FRAME::DisplayUnitsMsg ( )
inherited

Function DisplayUnitsMsg displays current unit pane on the status bar.

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

504 {
505  wxString msg;
506 
507  switch( g_UserUnit )
508  {
509  case INCHES:
510  msg = _( "Inches" );
511  break;
512 
513  case MILLIMETRES:
514  msg = _( "mm" );
515  break;
516 
517  default:
518  msg = _( "Units" );
519  break;
520  }
521 
522  SetStatusText( msg, 4 );
523 }
Definition: common.h:145
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
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 231 of file basicframe.cpp.

Referenced by EDA_BASE_FRAME::onAutoSaveTimer().

232 {
233  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
234 }
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 77 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().

80 {
82  return;
83 
84  const PAGE_INFO& pageInfo = GetPageSettings();
85  wxSize pageSize = pageInfo.GetSizeMils();
86 
87  // if not printing, draw the page limits:
88  if( !aScreen->m_IsPrinting && m_showPageLimits )
89  {
90  GRSetDrawMode( aDC, GR_COPY );
91  GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
92  pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
94  }
95 
96  TITLE_BLOCK t_block = GetTitleBlock();
97  COLOR4D color = COLOR4D( RED );
98 
99  wxPoint origin = aDC->GetDeviceOrigin();
100 
101  if( aScreen->m_IsPrinting && origin.y > 0 )
102  {
103  aDC->SetDeviceOrigin( 0, 0 );
104  aDC->SetAxisOrientation( true, false );
105  }
106 
107  DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
108  GetScreenDesc(), aFilename, t_block,
109  aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
110  aLineWidth, aScalar, color, color, aSheetLayer );
111 
112  if( aScreen->m_IsPrinting && origin.y > 0 )
113  {
114  aDC->SetDeviceOrigin( origin.x, origin.y );
115  aDC->SetAxisOrientation( true, true );
116  }
117 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
virtual const TITLE_BLOCK & GetTitleBlock() const =0
COLOR4D m_drawBgColor
the background color of the draw canvas BLACK for Pcbnew, BLACK or WHITE for eeschema ...
Definition: draw_frame.h:83
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
const wxSize & GetSizeMils() const
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:1077
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:120
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool m_showBorderAndTitleBlock
True shows the drawing border and title block.
Definition: draw_frame.h:112
EDA_RECT * GetClipBox()
Definition: colors.h:60
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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:49
bool m_showPageLimits
true to display the page limits
Definition: draw_frame.h:81
Definition: colors.h:49
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool EDA_BASE_FRAME::Enable ( bool  enable)
overrideinherited

Definition at line 192 of file basicframe.cpp.

Referenced by FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), and KIWAY_PLAYER::ShowModal().

193 {
194  // so we can do logging of this state change:
195 
196 #if defined(DEBUG)
197  const char* type_id = typeid( *this ).name();
198  printf( "wxFrame %-28s: %s\n", type_id, enable ? "enabled" : "disabled" );
199 #endif
200 
201  return wxFrame::Enable( enable );
202 }
void GERBVIEW_FRAME::Erase_Current_DrawLayer ( bool  query)

Definition at line 61 of file clear_gbr_drawlayers.cpp.

References GERBER_FILE_IMAGE_LIST::DeleteImage(), getActiveLayer(), GetImagesList(), IsOK(), EDA_DRAW_FRAME::m_canvas, ReFillLayerWidget(), EDA_DRAW_PANEL::Refresh(), SetCurItem(), and syncLayerBox().

Referenced by Files_io(), OnDrlFileHistory(), OnGbrFileHistory(), and OnZipFileHistory().

62 {
63  int layer = getActiveLayer();
64  wxString msg;
65 
66  msg.Printf( _( "Clear layer %d?" ), layer + 1 );
67 
68  if( query && !IsOK( this, msg ) )
69  return;
70 
71  SetCurItem( NULL );
72 
73  GetImagesList()->DeleteImage( layer );
74 
76  syncLayerBox();
77  m_canvas->Refresh();
78 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
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.
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:92
int getActiveLayer()
Function getActiveLayer returns the active layer.
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:111
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 250 of file draw_frame.cpp.

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

Referenced by SetCurItem(), and PCB_EDIT_FRAME::Solve().

251 {
252  if( m_messagePanel )
254 }
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
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 320 of file draw_frame.h.

Referenced by EDA_DRAW_FRAME::OnSockRequest().

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

Definition at line 155 of file export_to_pcbnew.cpp.

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

156 {
157  int layercount = 0;
158 
160  // Count the Gerber layers which are actually currently used
161  for( LAYER_NUM ii = 0; ii < (LAYER_NUM)images->ImagesMaxCount(); ++ii )
162  {
163  if( images->GetGbrImage( ii ) )
164  layercount++;
165  }
166 
167  if( layercount == 0 )
168  {
169  DisplayInfoMessage( this,
170  _( "None of the Gerber layers contain any data" ) );
171  return;
172  }
173 
174  wxString fileName;
175  wxString path = m_mruPath;
176 
177  wxFileDialog filedlg( this, _( "Board file name:" ),
178  path, fileName, PcbFileWildcard,
179  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
180 
181  if( filedlg.ShowModal() == wxID_CANCEL )
182  return;
183 
184  fileName = filedlg.GetPath();
185 
186  /* Install a dialog frame to choose the mapping
187  * between gerber layers and Pcbnew layers
188  */
189  LAYERS_MAP_DIALOG* layerdlg = new LAYERS_MAP_DIALOG( this );
190  int ok = layerdlg->ShowModal();
191  layerdlg->Destroy();
192 
193  if( ok != wxID_OK )
194  return;
195 
196  m_mruPath = wxFileName( fileName ).GetPath();
197 
198  GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
199 
200  gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), layerdlg->GetCopperLayersCount() );
201 }
GERBER_FILE_IMAGE_LIST * GetImagesList()
wxString m_mruPath
Most recently used path.
Definition: wxstruct.h:156
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.
void DisplayInfoMessage(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:89
const wxString PcbFileWildcard
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 768 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), EDA_BASE_FRAME::GetMruPath(), Prj(), EDA_BASE_FRAME::SetMruPath(), and EDA_BASE_FRAME::WriteHotkeyConfig().

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(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

770 {
771  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
772  wxString mask = wxT( "*." ) + ext;
773 
774 #if 0
775  wxString path = wxPathOnly( Prj().GetProjectFullName() );
776 #else
777  wxString path = GetMruPath();
778 #endif
779  wxFileName fn( aDefaultShortname );
780  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
781 
782  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
783  path,
784  fn.GetFullPath(),
785  ext,
786  mask,
787  this,
788  wxFD_SAVE,
789  true );
790 
791  if( filename.IsEmpty() )
792  return;
793 
794  WriteHotkeyConfig( aDescList, &filename );
795  SetMruPath( wxFileName( filename ).GetPath() );
796 }
void SetMruPath(const wxString &aPath)
Definition: wxstruct.h:357
PROJECT & Prj()
Definition: kicad.cpp:293
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
Definition: wxstruct.h:359
void GERBVIEW_FRAME::Files_io ( wxCommandEvent &  event)

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

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

92 {
93  int id = event.GetId();
94 
95  switch( id )
96  {
97  case wxID_FILE:
98  Erase_Current_DrawLayer( false );
99  LoadGerberFiles( wxEmptyString );
100  break;
101 
103  Clear_DrawLayers( false );
104  Zoom_Automatique( false );
105  m_canvas->Refresh();
106  ClearMsgPanel();
107  break;
108 
110  LoadExcellonFiles( wxEmptyString );
111  m_canvas->Refresh();
112  break;
113 
115  LoadZipArchiveFile( wxEmptyString );
116  m_canvas->Refresh();
117  break;
118 
119  default:
120  wxFAIL_MSG( wxT( "File_io: unexpected command id" ) );
121  break;
122  }
123 }
bool Clear_DrawLayers(bool query)
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void Erase_Current_DrawLayer(bool query)
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:77
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:92
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:764
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.

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

35 {
36  bool eventHandled = true;
37 
38  // Filter out the 'fake' mouse motion after a keyboard movement
39  if( !aHotKey && m_movingCursorWithKeyboard )
40  {
42  return false;
43  }
44 
45  wxPoint pos = aPosition;
46  wxPoint oldpos = GetCrossHairPosition();
47  GeneralControlKeyMovement( aHotKey, &pos, true );
48 
49  SetCrossHairPosition( pos );
50  RefreshCrossHair( oldpos, aPosition, aDC );
51 
52  if( aHotKey )
53  {
54  eventHandled = OnHotKey( aDC, aHotKey, aPosition );
55  }
56 
58 
59  return eventHandled;
60 }
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
void GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
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:138
bool OnHotKey(wxDC *aDC, int aHotkeyCode, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey.
void 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)

Definition at line 1281 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_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), GeneralControl(), and PCB_EDIT_FRAME::GeneralControl().

1283 {
1284 
1285  // If requested snap the current position to the grid
1286  if( aSnapToGrid )
1287  *aPos = GetNearestGridPosition( *aPos );
1288 
1289  switch( aHotKey )
1290  {
1291  // All these keys have almost the same treatment
1292  case GR_KB_CTRL | WXK_NUMPAD8:
1293  case GR_KB_CTRL | WXK_UP:
1294  case GR_KB_CTRL | WXK_NUMPAD2:
1295  case GR_KB_CTRL | WXK_DOWN:
1296  case GR_KB_CTRL | WXK_NUMPAD4:
1297  case GR_KB_CTRL | WXK_LEFT:
1298  case GR_KB_CTRL | WXK_NUMPAD6:
1299  case GR_KB_CTRL | WXK_RIGHT:
1300  case WXK_NUMPAD8:
1301  case WXK_UP:
1302  case WXK_NUMPAD2:
1303  case WXK_DOWN:
1304  case WXK_NUMPAD4:
1305  case WXK_LEFT:
1306  case WXK_NUMPAD6:
1307  case WXK_RIGHT:
1308  {
1309  /* Here's a tricky part: when doing cursor key movement, the
1310  * 'previous' point should be taken from memory, *not* from the
1311  * freshly computed position in the event. Otherwise you can't do
1312  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1313  * the automatic motion event generated by cursor warping */
1314  wxRealPoint gridSize = GetScreen()->GetGridSize();
1315  *aPos = GetCrossHairPosition();
1316 
1317  // Bonus: ^key moves faster (x10)
1318  switch( aHotKey )
1319  {
1320  case GR_KB_CTRL|WXK_NUMPAD8:
1321  case GR_KB_CTRL|WXK_UP:
1322  aPos->y -= KiROUND( 10 * gridSize.y );
1323  break;
1324 
1325  case GR_KB_CTRL|WXK_NUMPAD2:
1326  case GR_KB_CTRL|WXK_DOWN:
1327  aPos->y += KiROUND( 10 * gridSize.y );
1328  break;
1329 
1330  case GR_KB_CTRL|WXK_NUMPAD4:
1331  case GR_KB_CTRL|WXK_LEFT:
1332  aPos->x -= KiROUND( 10 * gridSize.x );
1333  break;
1334 
1335  case GR_KB_CTRL|WXK_NUMPAD6:
1336  case GR_KB_CTRL|WXK_RIGHT:
1337  aPos->x += KiROUND( 10 * gridSize.x );
1338  break;
1339 
1340  case WXK_NUMPAD8:
1341  case WXK_UP:
1342  aPos->y -= KiROUND( gridSize.y );
1343  break;
1344 
1345  case WXK_NUMPAD2:
1346  case WXK_DOWN:
1347  aPos->y += KiROUND( gridSize.y );
1348  break;
1349 
1350  case WXK_NUMPAD4:
1351  case WXK_LEFT:
1352  aPos->x -= KiROUND( gridSize.x );
1353  break;
1354 
1355  case WXK_NUMPAD6:
1356  case WXK_RIGHT:
1357  aPos->x += KiROUND( gridSize.x );
1358  break;
1359 
1360  default: /* Can't happen since we entered the statement */
1361  break;
1362  }
1363  m_canvas->MoveCursor( *aPos );
1365  }
1366  break;
1367 
1368  default:
1369  break;
1370  }
1371 }
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:354
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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.
#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:138
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 215 of file wxstruct.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

215 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
Definition: wxstruct.h:149
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 736 of file gerbview_frame.cpp.

References GBR_LAYOUT::GetAuxOrigin(), and m_gerberLayout.

737 {
738  wxASSERT( m_gerberLayout );
739  return m_gerberLayout->GetAuxOrigin();
740 }
const wxPoint & GetAuxOrigin() const
GBR_LAYOUT * m_gerberLayout
EDA_DRAW_PANEL* EDA_DRAW_FRAME::GetCanvas ( )
inlineinherited

Definition at line 299 of file draw_frame.h.

References EDA_DRAW_FRAME::m_canvas.

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(), LEGACY_ARRAY_CREATOR::finalise(), getOptimalModulePlacement(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::InstallConfigFrame(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::MirrorSheet(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_ANNOTATE::OnApplyClick(), SCH_EDIT_FRAME::OnAutoplaceFields(), 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_EXCHANGE_MODULE::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(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_UPDATE_PCB::PerformUpdate(), SCH_FIELD::Place(), DIALOG_DRC_CONTROL::RedrawDrawPanel(), Refresh(), PCB_BASE_FRAME::ResetModuleTextSizes(), 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(), DIALOG_ERC::TestErc(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings().

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

References BLUE, BROWN, CYAN, DARKCYAN, DARKGRAY, DARKGREEN, DIM, g_ColorsSettings, g_UserUnit, GREEN, LAYER_DCODES, 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 LoadSettings(), and SaveSettings().

81 {
82  if( !m_configSettings.empty() )
83  return m_configSettings;
84 
85  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
86  (int*) &g_UserUnit, 0, 0, 1 ) );
87 
88  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
89  &m_displayMode, 2, 0, 2 ) );
90  m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
91  wxT( "DCodeColorEx" ),
93  LAYER_DCODES],
94  WHITE ) );
95  m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
96  wxT( "NegativeObjectsColorEx" ),
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.
COLORS_DESIGN_SETTINGS g_ColorsSettings
Definition: pcbnew.cpp:68
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
Definition: colors.h:58
Definition: colors.h:49
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 1174 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::CreateTarget(), 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(), PCB_EDIT_FRAME::EditDimension(), LIB_EDIT_FRAME::EndDrawGraphicItem(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_VIEWER_FRAME::GeneralControl(), FOOTPRINT_WIZARD_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), PL_EDITOR_FRAME::GeneralControl(), LIB_EDIT_FRAME::GeneralControl(), GeneralControl(), PCB_EDIT_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), LIB_EDIT_FRAME::GraphicItemBeginDraw(), SCH_EDIT_FRAME::ImportSheetPin(), InstallBlockCmdFrame(), SCH_EDIT_FRAME::Load_Component(), PL_EDITOR_FRAME::Locate(), Move_Segment(), Move_Texte_Pcb(), moveBitmap(), MoveDimensionText(), MoveFootprint(), moveItem(), PL_EDITOR_FRAME::MoveItem(), moveItemWithMouseCursor(), SCH_EDIT_FRAME::OnDragItem(), DIALOG_MODULE_MODULE_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_MODULE_EDITOR::OnEditValue(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), LIB_VIEW_FRAME::OnHotKey(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PL_EDITOR_FRAME::OnHotKey(), LIB_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), 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(), SCH_BASE_FRAME::UpdateStatusBar(), PL_EDITOR_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and UpdateStatusBar().

1175 {
1176  // subject to change, borrow from old BASE_SCREEN for now.
1177  if( IsGalCanvasActive() )
1178  {
1180 
1181  return wxPoint( cursor.x, cursor.y );
1182  }
1183  else
1184  {
1185  BASE_SCREEN* screen = GetScreen(); // virtual call
1186  return screen->getCrossHairPosition( aInvertY );
1187  }
1188 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
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:809
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:817
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 1212 of file draw_frame.cpp.

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

1213 {
1214  BASE_SCREEN* screen = GetScreen(); // virtual call
1215  return screen->getCrossHairScreenPosition();
1216 }
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:309
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
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 1198 of file draw_frame.cpp.

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

1199 {
1200  BASE_SCREEN* screen = GetScreen(); // virtual call
1201  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1202 }
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:309
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
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 275 of file gerbview_frame.h.

References m_displayMode.

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

275 { 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 832 of file draw_frame.h.

Referenced by EDA_DRAW_PANEL::GetDisplayOptions(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

832 { return NULL; }
virtual COLOR4D EDA_DRAW_FRAME::GetDrawBgColor ( ) const
inlinevirtualinherited
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 400 of file basicframe.cpp.

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

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

402 {
403  wxFileHistory* fileHistory = aFileHistory;
404 
405  if( !fileHistory )
406  fileHistory = &Kiface().GetFileHistory();
407 
408  int baseId = fileHistory->GetBaseId();
409 
410  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
411 
412  unsigned i = cmdId - baseId;
413 
414  if( i < fileHistory->GetCount() )
415  {
416  wxString fn = fileHistory->GetHistoryFile( i );
417 
418  if( wxFileName::FileExists( fn ) )
419  return fn;
420  else
421  {
422  wxString msg = wxString::Format(
423  wxT( "file '%s' was not found." ),
424  GetChars( fn ) );
425 
426  wxMessageBox( msg );
427 
428  fileHistory->RemoveFileFromHistory( i );
429  }
430  }
431 
432  return wxEmptyString;
433 }
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
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 817 of file draw_frame.h.

References EDA_DRAW_FRAME::m_galCanvas.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), GRID_HELPER::BestDragOrigin(), GRID_HELPER::BestSnapAnchor(), PCBNEW_CONTROL::CursorControl(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_EDIT_FRAME::Edit_Zone_Params(), MODULE_EDITOR_TOOLS::EnumeratePads(), EVT_TOOL(), EVT_UPDATE_UI(), SELECTION_TOOL::findCallback(), EDA_DRAW_FRAME::GetCrossHairPosition(), PCBNEW_CONTROL::HighContrastMode(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), PCB_EDIT_FRAME::ListNetsAndSelect(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerVisible(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnMarkerSelectionEvent(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), DIALOG_DRC_CONTROL::OnPopupMenu(), PCB_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnTogglePadDrawMode(), DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), PCBNEW_CONTROL::PadDisplayMode(), PCB_EDIT_FRAME::Process_Config(), TOOL_MANAGER::ProcessEvent(), GRID_HELPER::queryVisible(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_PANEL::Refresh(), ZOOM_TOOL::selectRegion(), PCB_BASE_EDIT_FRAME::SetBoard(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), EDA_DRAW_PANEL::SetEnableMousewheelPan(), EDA_DRAW_PANEL::SetEnableZoomNoCenter(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), FOOTPRINT_EDIT_FRAME::setupTools(), PCB_BASE_FRAME::SwitchCanvas(), SELECTION_TOOL::toggleSelection(), PCBNEW_CONTROL::TrackDisplayMode(), DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow(), 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(), EDA_DRAW_FRAME::UseGalCanvas(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), COMMON_TOOLS::ZoomInOut(), and COMMON_TOOLS::ZoomPreset().

817 { return m_galCanvas; }
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:67
KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_FRAME::GetGalDisplayOptions ( )
inlineinherited
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 770 of file gerbview_frame.cpp.

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

771 {
773  return GetGerberLayout()->GetBoundingBox();
774 }
EDA_RECT ComputeBoundingBox()
Function ComputeBoundingBox calculates the bounding box containing all Gerber items.
GBR_LAYOUT * GetGerberLayout() const
EDA_RECT GetBoundingBox() const
Function GetBoundingBox may be called soon after ComputeBoundingBox() to return the same EDA_RECT...
virtual COLOR4D EDA_DRAW_FRAME::GetGridColor ( ) const
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 448 of file draw_frame.h.

References EDA_DRAW_FRAME::m_gridColor.

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

449  {
450  return m_gridColor;
451  }
COLOR4D m_gridColor
Grid color.
Definition: draw_frame.h:82
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 575 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().

576 {
577  wxPoint pos = aPosition;
578 
579  if( m_currentScreen != NULL && m_snapToGrid )
580  pos = GetNearestGridPosition( aPosition );
581 
582  return pos;
583 }
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:62
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:64
EDA_HOTKEY_CONFIG* EDA_DRAW_FRAME::GetHotkeyConfig ( ) const
inlineinherited

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

Definition at line 345 of file draw_frame.h.

References EDA_DRAW_FRAME::m_hotkeysDescrList.

Referenced by PCBNEW_CONTROL::ShowHelp().

345 { return m_hotkeysDescrList; }
EDA_HOTKEY_CONFIG * m_hotkeysDescrList
Definition: draw_frame.h:76
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 114 of file gerbview/hotkeys.cpp.

References GetDescriptorFromCommand().

115 {
116  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, gerbviewHotkeyList );
117 
118  return HK_Descr;
119 }
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.
GERBER_FILE_IMAGE_LIST* GERBVIEW_FRAME::GetImagesList ( ) const
inline
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 525 of file basicframe.cpp.

References ShowAboutDialog().

526 {
527  bool ShowAboutDialog(wxWindow * parent);
528  ShowAboutDialog( this );
529 }
bool ShowAboutDialog(wxWindow *parent)
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 514 of file basicframe.cpp.

References URL_GET_INVOLVED.

515 {
516  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
517  {
518  wxString msg = _( "Could not launch the default browser. For information on how to help the KiCad project, visit " );
519  msg.Append( URL_GET_INVOLVED );
520  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
521  }
522 }
#define URL_GET_INVOLVED
Definition: basicframe.cpp:51
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 436 of file basicframe.cpp.

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

437 {
438  const SEARCH_STACK& search = sys_search();
439 
440  /* We have to get document for beginners,
441  * or the full specific doc
442  * if event id is wxID_INDEX, we want the document for beginners.
443  * else the specific doc file (its name is in Kiface().GetHelpFileName())
444  * The document for beginners is the same for all KiCad utilities
445  */
446  if( event.GetId() == wxID_INDEX )
447  {
448  // List of possible names for Getting Started in KiCad
449  const wxChar* names[2] = {
450  wxT( "getting_started_in_kicad" ),
451  wxT( "Getting_Started_in_KiCad" )
452  };
453 
454  wxString helpFile;
455  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
456  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
457  for( unsigned ii = 0; ii < DIM( names ); ii++ )
458  {
459  helpFile = SearchHelpFileFullPath( search, names[ii] );
460 
461  if( !helpFile.IsEmpty() )
462  break;
463  }
464 
465  if( !helpFile )
466  {
467  wxString msg = wxString::Format( _(
468  "Html or pdf help file \n'%s'\n or\n'%s' could not be found." ), names[0], names[1] );
469  wxMessageBox( msg );
470  }
471  else
472  {
473  GetAssociatedDocument( this, helpFile );
474  }
475 
476  return;
477  }
478 
479  wxString base_name = help_name();
480  wxString helpFile = SearchHelpFileFullPath( search, base_name );
481 
482  if( !helpFile )
483  {
484  wxString msg = wxString::Format( _(
485  "Help file '%s' could not be found." ),
486  GetChars( base_name )
487  );
488  wxMessageBox( msg );
489  }
490  else
491  {
492  GetAssociatedDocument( this, helpFile );
493  }
494 }
#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:86
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...
Definition: basicframe.cpp:370
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSStack, const wxString &aBaseName)
Function SearchHelpFileFullPath returns the help file'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()
Definition: basicframe.cpp:376
COLOR4D GERBVIEW_FRAME::GetLayerColor ( int  aLayer) const

Function GetLayerColor gets a layer color for any valid layer.

Definition at line 671 of file gerbview_frame.cpp.

References COLORS_DESIGN_SETTINGS::GetLayerColor(), and m_colorsSettings.

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

672 {
673  return m_colorsSettings->GetLayerColor( aLayer );
674 }
COLORS_DESIGN_SETTINGS * m_colorsSettings
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
wxAuiToolBar* EDA_DRAW_FRAME::GetMainToolBar ( ) const
inlineinherited

Definition at line 393 of file draw_frame.h.

References EDA_BASE_FRAME::m_mainToolBar.

Referenced by ZOOM_TOOL::Main().

393 { return m_mainToolBar; }
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:136
wxString EDA_BASE_FRAME::GetMruPath ( ) const
inlineinherited

Definition at line 359 of file wxstruct.h.

References EDA_BASE_FRAME::m_mruPath.

Referenced by EDA_BASE_FRAME::ExportHotkeyConfigToFile(), EDA_BASE_FRAME::ImportHotkeyConfigFromFile(), and KICAD_MANAGER_FRAME::OnLoadProject().

359 { return m_mruPath; }
wxString m_mruPath
Most recently used path.
Definition: wxstruct.h:156
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 1205 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(), and resizeSheetWithMouseCursor().

1206 {
1207  BASE_SCREEN* screen = GetScreen(); // virtual call
1208  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1209 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
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 ...)
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor ( ) const

Function GetNegativeItemsColor.

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

Definition at line 662 of file gerbview_frame.cpp.

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

Referenced by RedrawActiveWindow().

663 {
666  else
667  return GetDrawBgColor();
668 }
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:286
COLOR4D GetVisibleElementColor(GERBVIEW_LAYER_ID aItemIdVisible) const
Function GetVisibleElementColor returns the color of a gerber visible element.
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 390 of file gerbview_frame.cpp.

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

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

391 {
392  int layer = aLayer;
393 
394  for( unsigned i = 0; i < ImagesMaxCount(); ++i )
395  {
396  const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
397 
398  if( gerber == NULL ) // this graphic layer is available: use it
399  return layer;
400 
401  ++layer; // try next graphic layer
402 
403  if( layer >= (int)ImagesMaxCount() )
404  layer = 0;
405  }
406 
407  return NO_AVAILABLE_LAYERS;
408 }
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
unsigned ImagesMaxCount() const
The max number of file images.
#define NO_AVAILABLE_LAYERS
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
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 713 of file gerbview_frame.cpp.

References GetPageSettings().

714 {
715  // this function is only needed because EDA_DRAW_FRAME is not compiled
716  // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
717  // into an application specific source file.
718  return GetPageSettings().GetSizeIU();
719 }
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 309 of file draw_frame.h.

References EDA_DRAW_FRAME::m_currentScreen.

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(), LoadSettings(), OnHotKey(), OnLeftClick(), EDA_DRAW_PANEL::OnMouseEvent(), 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(), 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(), ZOOM_MENU::update(), GRID_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().

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

Reimplemented in SCH_EDIT_FRAME.

Definition at line 120 of file worksheet.cpp.

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

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

Definition at line 1233 of file draw_frame.cpp.

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

Referenced by SCH_EDIT_FRAME::DisplayCurrentSheet(), EDA_DRAW_PANEL::OnMouseEvent(), 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().

1234 {
1235  BASE_SCREEN* screen = GetScreen(); // virtual call
1236  return screen->getScrollCenterPosition();
1237 }
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
const wxPoint & getScrollCenterPosition() const
bool EDA_DRAW_FRAME::GetShowBorderAndTitleBlock ( ) const
inlineinherited

Definition at line 293 of file draw_frame.h.

References EDA_DRAW_FRAME::m_showBorderAndTitleBlock.

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

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

Implements EDA_DRAW_FRAME.

Definition at line 722 of file gerbview_frame.cpp.

References GBR_LAYOUT::GetTitleBlock(), and m_gerberLayout.

723 {
724  wxASSERT( m_gerberLayout );
725  return m_gerberLayout->GetTitleBlock();
726 }
TITLE_BLOCK & GetTitleBlock()
GBR_LAYOUT * m_gerberLayout
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 419 of file draw_frame.h.

References EDA_DRAW_FRAME::m_toolId.

Referenced by PCB_EDIT_FRAME::Begin_Zone(), LIB_EDIT_FRAME::CreateGraphicItem(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::Draw(), LIB_EDIT_FRAME::EndDrawGraphicItem(), 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_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().

419 { return m_toolId; }
COLOR4D GERBVIEW_FRAME::GetVisibleElementColor ( GERBVIEW_LAYER_ID  aItemIdVisible) const

Function GetVisibleElementColor returns the color of a gerber visible element.

Definition at line 610 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(), and GERBER_LAYER_WIDGET::ReFillRender().

611 {
612  COLOR4D color = COLOR4D::UNSPECIFIED;
613 
614  switch( aItemIdVisible )
615  {
617  case LAYER_DCODES:
618  color = m_colorsSettings->GetItemColor( aItemIdVisible );
619  break;
620 
621  case LAYER_GERBVIEW_GRID:
622  color = GetGridColor();
623  break;
624 
625  default:
626  wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
627  (int)aItemIdVisible );
628  }
629 
630  return color;
631 }
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
COLORS_DESIGN_SETTINGS * m_colorsSettings
virtual COLOR4D GetGridColor() const
Function GetGridColor() , virtual.
Definition: draw_frame.h:448
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 589 of file gerbview_frame.cpp.

Referenced by GERBER_LAYER_WIDGET::OnLayerVisible().

590 {
591  return -1; // TODO
592 }
double EDA_DRAW_FRAME::GetZoom ( )
inherited

Function GetZoom.

Returns
The current zoom level.

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

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

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

Definition at line 382 of file draw_frame.h.

References EDA_DRAW_FRAME::m_zoomLevelCoeff.

Referenced by ZOOM_MENU::ZOOM_MENU().

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

References EDA_DRAW_FRAME::GetZoomLevelIndicator().

875 {
877 }
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:680
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 823 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(), and SCH_EDIT_FRAME::Process_Special_Functions().

825 {
827 
828  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
829  return false;
830 
831  if( aExplicitCommand == 0 )
832  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
833  else
834  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
835 
836  if( block->GetCommand() == 0 )
837  return false;
838 
839  switch( block->GetCommand() )
840  {
841  case BLOCK_IDLE:
842  break;
843 
844  case BLOCK_MOVE: // Move
845  case BLOCK_DRAG: // Drag (block defined)
846  case BLOCK_DRAG_ITEM: // Drag from a drag item command
847  case BLOCK_DUPLICATE: // Duplicate
848  case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
849  case BLOCK_DELETE: // Delete
850  case BLOCK_COPY: // Copy
851  case BLOCK_ROTATE: // Rotate 90 deg
852  case BLOCK_FLIP: // Flip
853  case BLOCK_ZOOM: // Window Zoom
854  case BLOCK_MIRROR_X:
855  case BLOCK_MIRROR_Y: // mirror
856  case BLOCK_PRESELECT_MOVE: // Move with preselection list
857  block->InitData( m_canvas, aPosition );
858  break;
859 
860  case BLOCK_PASTE:
861  block->InitData( m_canvas, aPosition );
862  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
864 
865  if( block->GetCount() == 0 ) // No data to paste
866  {
867  DisplayError( this, wxT( "No block to paste" ), 20 );
870  block->SetState( STATE_NO_BLOCK );
871  block->SetMessageBlock( this );
872  return true;
873  }
874 
875  if( !m_canvas->IsMouseCaptured() )
876  {
877  block->ClearItemsList();
878  DisplayError( this,
879  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
880  block->SetState( STATE_NO_BLOCK );
881  block->SetMessageBlock( this );
882  return true;
883  }
884 
885  block->SetState( STATE_BLOCK_MOVE );
886  m_canvas->CallMouseCapture( aDC, aPosition, false );
887  break;
888 
889  default:
890  {
891  wxString msg;
892  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
893  block->GetCommand();
894  DisplayError( this, msg );
895  }
896  break;
897  }
898 
899  block->SetMessageBlock( this );
900  return true;
901 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:645
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:651
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:309
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:92
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:69
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().

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.
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()
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:309
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:92
int GetToolId() const
Definition: draw_frame.h:419
void Window_Zoom(EDA_RECT &Rect)
Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window scree...
Definition: zoom.cpp:103
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.

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.
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()
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:309
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:92
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:497
int GetToolId() const
Definition: draw_frame.h:419
bool GERBVIEW_FRAME::hasAvailableLayers ( ) const
inline

Definition at line 421 of file gerbview_frame.h.

References getNextAvailableLayer(), and NO_AVAILABLE_LAYERS.

422  {
424  }
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 376 of file basicframe.cpp.

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

Referenced by EDA_BASE_FRAME::GetKicadHelp().

377 {
378  return Kiface().GetHelpFileName();
379 }
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 884 of file gerbview_frame.cpp.

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

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

885 {
887 }
GERBER_FILE_IMAGE_LIST * GetImagesList()
GBR_LAYOUT * m_gerberLayout
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 737 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), EDA_BASE_FRAME::GetMruPath(), Prj(), EDA_BASE_FRAME::ReadHotkeyConfigFile(), and EDA_BASE_FRAME::SetMruPath().

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(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

739 {
740  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
741  wxString mask = wxT( "*." ) + ext;
742 
743 #if 0 // pass in the project dir as an argument
744  wxString path = wxPathOnly( Prj().GetProjectFullName() );
745 #else
746  wxString path = GetMruPath();
747 #endif
748  wxFileName fn( aDefaultShortname );
749  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
750 
751  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
752  path,
753  fn.GetFullPath(),
754  ext,
755  mask,
756  this,
757  wxFD_OPEN,
758  true );
759 
760  if( filename.IsEmpty() )
761  return;
762 
763  ReadHotkeyConfigFile( filename, aDescList );
764  SetMruPath( wxFileName( filename ).GetPath() );
765 }
void SetMruPath(const wxString &aPath)
Definition: wxstruct.h:357
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfigFile Read an old configuration file (<file>.key) and fill the current ho...
PROJECT & Prj()
Definition: kicad.cpp:293
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
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
Definition: wxstruct.h:359
void EDA_DRAW_FRAME::InitBlockPasteInfos ( )
virtualinherited

Reimplemented in SCH_EDIT_FRAME.

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

652 {
655 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
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:309
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void GERBVIEW_FRAME::InstallGerberOptionsDialog ( wxCommandEvent &  event)

Definition at line 61 of file gerbview_dialog_display_options_frame.cpp.

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

62 {
63  DIALOG_DISPLAY_OPTIONS dlg( this );
64  int opt = dlg.ShowModal();
65 
66  if( opt > 0 )
67  m_canvas->Refresh();
68 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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 169 of file wxstruct.h.

Referenced by EDA_BASE_FRAME::ProcessEvent().

169 { return false; }
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 163 of file kiway_player.cpp.

References DBG, and KIWAY_PLAYER::m_modal_loop.

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

164 {
165  bool ret = !m_modal_loop;
166 
167  DBG(printf( "%s: ret:%d\n", __func__, ret );)
168 
169  return ret;
170 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:247
#define DBG(x)
Definition: fctsys.h:33
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 565 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 GetNegativeItemsColor(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), OnHotKey(), OnUpdateShowDCodes(), OnUpdateShowNegativeItems(), GERBER_LAYER_WIDGET::ReFillRender(), and SaveSettings().

566 {
567  switch( aItemIdVisible )
568  {
569  case LAYER_DCODES:
571  break;
572 
575  break;
576 
577  case LAYER_GERBVIEW_GRID:
578  return IsGridVisible();
579  break;
580 
581  default:
582  wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aItemIdVisible );
583  }
584 
585  return true;
586 }
bool m_DisplayNegativeObjects
Option to draw negative objects in a specific color.
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:429
GBR_DISPLAY_OPTIONS m_DisplayOptions
bool m_DisplayDCodes
Option to show dcode values on items drawn with a dcode tool.
bool EDA_DRAW_FRAME::IsGalCanvasActive ( ) const
inlineinherited

Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.

Returns
True for GAL-based canvas, false for standard canvas.

Definition at line 809 of file draw_frame.h.

References EDA_DRAW_FRAME::m_galCanvasActive.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), PCB_LAYER_WIDGET::AreArbitraryColorsAllowed(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_EDIT_FRAME::Edit_Zone_Params(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), FOOTPRINT_EDIT_FRAME::Import_Module(), PCB_EDIT_FRAME::ListNetsAndSelect(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), PCB_LAYER_WIDGET::OnLayerColorChange(), PCB_BASE_FRAME::OnModify(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_LAYER_WIDGET::OnRenderColorChange(), PCB_LAYER_WIDGET::OnRenderEnable(), EDA_DRAW_FRAME::OnSelectGrid(), EDA_DRAW_FRAME::OnSelectZoom(), EDA_DRAW_FRAME::OnToggleGridState(), PCB_BASE_FRAME::OnUpdateSelectZoom(), PCB_BASE_FRAME::OnUpdateSwitchCanvas(), DIALOG_UPDATE_PCB::PerformUpdate(), PCB_EDIT_FRAME::Process_Config(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_FRAME::RedrawScreen(), EDA_DRAW_FRAME::RedrawScreen2(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), EDA_DRAW_FRAME::SetNoToolSelected(), EDA_DRAW_FRAME::SetToolID(), DIALOG_SET_GRID::TransferDataFromWindow(), PCB_BASE_FRAME::UpdateMsgPanel(), FOOTPRINT_VIEWER_FRAME::updateView(), EDA_DRAW_FRAME::WriteHotkeyConfig(), and EDA_DRAW_FRAME::Zoom_Automatique().

809 { return m_galCanvasActive; }
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:65
bool GERBVIEW_FRAME::IsLayerVisible ( int  aLayer) const

Function IsLayerVisible tests whether a given layer is visible.

Parameters
aLayer= The layer to be tested
Returns
bool - true if the layer is visible.

Definition at line 601 of file gerbview_frame.cpp.

References GetGerberLayout(), GBR_LAYOUT::IsLayerPrintable(), LAYER_WIDGET::IsLayerVisible(), m_DisplayOptions, GBR_DISPLAY_OPTIONS::m_IsPrinting, and m_LayersManager.

Referenced by GBR_LAYOUT::Draw(), and Locate().

602 {
604  return m_LayersManager->IsLayerVisible( aLayer );
605  else
606  return GetGerberLayout()->IsLayerPrintable( aLayer );
607 }
bool IsLayerPrintable(int aLayer) const
Function IsLayerPrintable tests whether a given layer is visible.
GERBER_LAYER_WIDGET * m_LayersManager
GBR_DISPLAY_OPTIONS m_DisplayOptions
GBR_LAYOUT * GetGerberLayout() const
bool IsLayerVisible(LAYER_NUM aLayer)
Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id...
bool m_IsPrinting
true when printing a page, false when drawing on screen
bool EDA_BASE_FRAME::IsType ( FRAME_T  aType) const
inlineinherited
bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

Function IsWritable checks if aFileName can be written.

The function performs a number of tests on aFileName to verify that it can be saved. If aFileName defines a path with no file name, them the path is tested for user write permission. If aFileName defines a file name that does not exist in the path, the path is tested for user write permission. If aFileName defines a file that already exits, the file name is tested for user write permissions.

Note
The file name path must be set or an assertion will be raised on debug builds and return false on release builds.
Parameters
aFileNameThe full path and/or file name of the file to test.
Returns
False if aFileName cannot be written.

Definition at line 532 of file basicframe.cpp.

References GetChars().

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

533 {
534  wxString msg;
535  wxFileName fn = aFileName;
536 
537  // Check for absence of a file path with a file name. Unfortunately KiCad
538  // uses paths relative to the current project path without the ./ part which
539  // confuses wxFileName. Making the file name path absolute may be less than
540  // elegant but it solves the problem.
541  if( fn.GetPath().IsEmpty() && fn.HasName() )
542  fn.MakeAbsolute();
543 
544  wxCHECK_MSG( fn.IsOk(), false,
545  wxT( "File name object is invalid. Bad programmer!" ) );
546  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
547  wxT( "File name object path <" ) + fn.GetFullPath() +
548  wxT( "> is not set. Bad programmer!" ) );
549 
550  if( fn.IsDir() && !fn.IsDirWritable() )
551  {
552  msg.Printf( _( "You do not have write permissions to folder <%s>." ),
553  GetChars( fn.GetPath() ) );
554  }
555  else if( !fn.FileExists() && !fn.IsDirWritable() )
556  {
557  msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ),
558  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
559  }
560  else if( fn.FileExists() && !fn.IsFileWritable() )
561  {
562  msg.Printf( _( "You do not have write permissions to save file <%s>." ),
563  GetChars( fn.GetFullPath() ) );
564  }
565 
566  if( !msg.IsEmpty() )
567  {
568  wxMessageBox( msg );
569  return false;
570  }
571 
572  return true;
573 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), LIB_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), SCH_SHEET::Load(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 188 of file kiway_player.cpp.

References KIWAY_EXPRESS::Command(), KIWAY_EXPRESS::GetPayload(), KIWAY_PLAYER::KiwayMailIn(), and name.

189 {
190  // logging support
191 #if defined(DEBUG)
192  const char* class_name = typeid( this ).name();
193 
194  printf( "%s: received cmd:%d pay:'%s'\n", class_name,
195  aEvent.Command(), aEvent.GetPayload().c_str() );
196 #endif
197 
198  KiwayMailIn( aEvent ); // call the virtual, override in derived.
199 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
const std::string & GetPayload()
Function Payload returns the payload, which can be any text but it typicall self identifying s-expres...
Definition: kiway_express.h:62
const char * name
MAIL_T Command()
Function Command returns the MAIL_T associated with this mail.
Definition: kiway_express.h:52
void KIWAY_PLAYER::KiwayMailIn ( KIWAY_EXPRESS aEvent)
virtualinherited

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

Reimplemented in SCH_EDIT_FRAME, PCB_EDIT_FRAME, and CVPCB_MAINFRAME.

Definition at line 75 of file kiway_player.cpp.

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

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

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

Definition at line 202 of file kiway_player.cpp.

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

203 {
204  int id = event.GetId();
205 
206  // tell all the KIWAY_PLAYERs about the language change.
207  Kiway().SetLanguage( id );
208 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs...
Definition: kiway.cpp:396
wxString EDA_DRAW_FRAME::LengthDoubleToString ( double  aValue,
bool  aConvertToMils = false 
) const
inherited

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

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

Definition at line 817 of file draw_frame.cpp.

References LengthDoubleToString().

Referenced by ShowNewTrackWhenMovingCursor().

818 {
819  return ::LengthDoubleToString( aValue, aConvertToMils );
820 }
wxString LengthDoubleToString(double aValue, bool aConvertToMils)
Function LengthDoubleToString is a helper to convert the double length aValue to a string in inches...
Definition: base_units.cpp:122
void GERBVIEW_FRAME::Liste_D_Codes ( )

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

Definition at line 442 of file gerbview_frame.cpp.

References FIRST_DCODE, g_UserUnit, getActiveLayer(), GetChars(), GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::GetDcodesCount(), GetGbrImage(), ImagesMaxCount(), INCHES, D_CODE::m_AperFunction, D_CODE::m_Defined, D_CODE::m_InUse, D_CODE::m_Num_Dcode, D_CODE::m_Shape, D_CODE::m_Size, scale, D_CODE::ShowApertureType(), and TOOLS_MAX_COUNT.

443 {
444  int ii, jj;
445  wxString Line;
446  wxArrayString list;
447  double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
448  int curr_layer = getActiveLayer();
449 
450  for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
451  {
452  GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
453 
454  if( gerber == NULL )
455  continue;
456 
457  if( gerber->GetDcodesCount() == 0 )
458  continue;
459 
460  if( layer == curr_layer )
461  Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
462  else
463  Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
464 
465  list.Add( Line );
466 
467  const char* units = g_UserUnit == INCHES ? "\"" : "mm";
468 
469  for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
470  {
471  D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false );
472 
473  if( pt_D_code == NULL )
474  continue;
475 
476  if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
477  continue;
478 
479  Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s attribute '%s'" ),
480  jj,
481  pt_D_code->m_Num_Dcode,
482  pt_D_code->m_Size.y / scale, units,
483  pt_D_code->m_Size.x / scale, units,
484  D_CODE::ShowApertureType( pt_D_code->m_Shape ),
485  pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
486  );
487 
488  if( !pt_D_code->m_Defined )
489  Line += wxT( " (not defined)" );
490 
491  if( pt_D_code->m_InUse )
492  Line += wxT( " (in use)" );
493 
494  list.Add( Line );
495  jj++;
496  }
497  }
498 
499  wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
500  wxCHOICEDLG_STYLE & ~wxCANCEL );
501 
502  dlg.ShowModal();
503 }
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:98
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:106
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
D_CODE * GetDCODE(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:108
unsigned ImagesMaxCount() const
The max number of file images.
#define FIRST_DCODE
Definition: dcode.h:70
Definition: common.h:145
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:100
static const wxChar * ShowApertureType(APERTURE_T aType)
Function ShowApertureType returns a character string telling what type of aperture type aType is...
Definition: dcode.cpp:94
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE ...
Definition: dcode.h:109
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
const int scale
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:81
int getActiveLayer()
Function getActiveLayer returns the active layer.
#define TOOLS_MAX_COUNT
Definition: dcode.h:72
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
bool GERBVIEW_FRAME::LoadExcellonFiles ( const wxString &  aFileName)

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

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

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

References AllFilesWildcard, DrillFileWildcard, getActiveLayer(), GetChars(), getNextAvailableLayer(), HTML_MESSAGE_BOX::ListSet(), m_drillFileHistory, m_lastFileName, m_LayersManager, EDA_BASE_FRAME::m_mruPath, MSG_NO_MORE_LAYER, MSG_NOT_LOADED, NO_AVAILABLE_LAYERS, Read_EXCELLON_File(), ReFillLayerWidget(), WX_STRING_REPORTER::Report(), REPORTER::RPT_ERROR, setActiveLayer(), syncLayerBox(), EDA_BASE_FRAME::UpdateFileHistory(), LAYER_WIDGET::UpdateLayerIcons(), and EDA_DRAW_FRAME::Zoom_Automatique().

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

271 {
272  wxString filetypes;
273  wxArrayString filenamesList;
274  wxFileName filename = aFullFileName;
275  wxString currentPath;
276 
277  if( !filename.IsOk() )
278  {
279  filetypes = wxGetTranslation( DrillFileWildcard );
280  filetypes << wxT("|");
281  /* All filetypes */
282  filetypes += wxGetTranslation( AllFilesWildcard );
283 
284  /* Use the current working directory if the file name path does not exist. */
285  if( filename.DirExists() )
286  currentPath = filename.GetPath();
287  else
288  currentPath = m_mruPath;
289 
290  wxFileDialog dlg( this, _( "Open Drill File" ),
291  currentPath, filename.GetFullName(), filetypes,
292  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
293 
294  if( dlg.ShowModal() == wxID_CANCEL )
295  return false;
296 
297  dlg.GetPaths( filenamesList );
298  currentPath = wxGetCwd();
299  m_mruPath = currentPath;
300  }
301  else
302  {
303  filenamesList.Add( aFullFileName );
304  currentPath = filename.GetPath();
305  m_mruPath = currentPath;
306  }
307 
308  // Read Excellon drill files: each file is loaded on a new GerbView layer
309  bool success = true;
310  int layer = getActiveLayer();
311 
312  // Manage errors when loading files
313  wxString msg;
314  WX_STRING_REPORTER reporter( &msg );
315 
316  for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
317  {
318  filename = filenamesList[ii];
319 
320  if( !filename.IsAbsolute() )
321  filename.SetPath( currentPath );
322 
323  m_lastFileName = filename.GetFullPath();
324 
325  setActiveLayer( layer, false );
326 
327  if( Read_EXCELLON_File( filename.GetFullPath() ) )
328  {
329  // Update the list of recent drill files.
330  UpdateFileHistory( filename.GetFullPath(), &m_drillFileHistory );
331 
332  layer = getNextAvailableLayer( layer );
333 
334  if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
335  {
336  success = false;
337  reporter.Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
338 
339  // Report the name of not loaded files:
340  ii += 1;
341  while( ii < filenamesList.GetCount() )
342  {
343  filename = filenamesList[ii++];
344  wxString txt;
345  txt.Printf( MSG_NOT_LOADED,
346  GetChars( filename.GetFullName() ) );
347  reporter.Report( txt, REPORTER::RPT_ERROR );
348  }
349  break;
350  }
351 
352  setActiveLayer( layer, false );
353  }
354  }
355 
356  if( !success )
357  {
358  HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
359  mbox.ListSet( msg );
360  mbox.ShowModal();
361  }
362 
363  Zoom_Automatique( false );
364 
365  // Synchronize layers tools with actual active layer:
369  syncLayerBox();
370 
371  return success;
372 }
wxString m_lastFileName
The last filename chosen to be proposed to the user.
wxString m_mruPath
Most recently used path.
Definition: wxstruct.h:156
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
const wxString AllFilesWildcard
GERBER_LAYER_WIDGET * m_LayersManager
wxFileHistory m_drillFileHistory
void UpdateFileHistory(const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
Function UpdateFileHistory Updates the list of recently opened files.
Definition: basicframe.cpp:388
int getNextAvailableLayer(int aLayer=0) const
Function getNextAvailableLayer finds the next empty layer starting at aLayer and returns it to the ca...
const wxString DrillFileWildcard
#define MSG_NOT_LOADED
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:77
#define NO_AVAILABLE_LAYERS
void UpdateLayerIcons()
Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or ...
Class HTML_MESSAGE_BOX.
#define MSG_NO_MORE_LAYER
void setActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function setActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
Class WX_STRING_REPORTER is a wrapper for reporting to a wxString object.
Definition: reporter.h:116
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
int getActiveLayer()
Function getActiveLayer returns the active layer.
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
bool Read_EXCELLON_File(const wxString &aFullFileName)
bool GERBVIEW_FRAME::LoadGerberFiles ( const wxString &  aFileName)

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

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

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

References AllFilesWildcard, getActiveLayer(), GetChars(), getNextAvailableLayer(), HTML_MESSAGE_BOX::ListSet(), m_lastFileName, m_LayersManager, EDA_BASE_FRAME::m_mruPath, MSG_NO_MORE_LAYER, MSG_NOT_LOADED, NO_AVAILABLE_LAYERS, Read_GERBER_File(), ReFillLayerWidget(), WX_STRING_REPORTER::Report(), REPORTER::RPT_ERROR, setActiveLayer(), syncLayerBox(), EDA_BASE_FRAME::UpdateFileHistory(), LAYER_WIDGET::UpdateLayerIcons(), and EDA_DRAW_FRAME::Zoom_Automatique().

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

127 {
128  wxString filetypes;
129  wxArrayString filenamesList;
130  wxFileName filename = aFullFileName;
131  wxString currentPath;
132 
133  if( !filename.IsOk() )
134  {
135  /* Standard gerber filetypes
136  * (See http://en.wikipedia.org/wiki/Gerber_File)
137  * the .gbr (.pho in legacy files) extension is the default used in Pcbnew
138  * However there are a lot of other extensions used for gerber files
139  * Because the first letter is usually g, we accept g* as extension
140  * (Mainly internal copper layers do not have specific extension,
141  * and filenames are like *.g1, *.g2 *.gb1 ...).
142  * Now (2014) Ucamco (the company which manages the Gerber format) encourages
143  * use of .gbr only and the Gerber X2 file format.
144  */
145  filetypes = _( "Gerber files (.g* .lgr .pho)" );
146  filetypes << wxT("|");
147  filetypes += wxT("*.g*;*.G*;*.pho;*.PHO" );
148  filetypes << wxT("|");
149 
150  /* Special gerber filetypes */
151  filetypes += _( "Top layer (*.GTL)|*.GTL;*.gtl|" );
152  filetypes += _( "Bottom layer (*.GBL)|*.GBL;*.gbl|" );
153  filetypes += _( "Bottom solder resist (*.GBS)|*.GBS;*.gbs|" );
154  filetypes += _( "Top solder resist (*.GTS)|*.GTS;*.gts|" );
155  filetypes += _( "Bottom overlay (*.GBO)|*.GBO;*.gbo|" );
156  filetypes += _( "Top overlay (*.GTO)|*.GTO;*.gto|" );
157  filetypes += _( "Bottom paste (*.GBP)|*.GBP;*.gbp|" );
158  filetypes += _( "Top paste (*.GTP)|*.GTP;*.gtp|" );
159  filetypes += _( "Keep-out layer (*.GKO)|*.GKO;*.gko|" );
160  filetypes += _( "Mechanical layers (*.GMx)|*.GM1;*.gm1;*.GM2;*.gm2;*.GM3;*.gm3|" );
161  filetypes += _( "Top Pad Master (*.GPT)|*.GPT;*.gpt|" );
162  filetypes += _( "Bottom Pad Master (*.GPB)|*.GPB;*.gpb|" );
163 
164  // All filetypes
165  filetypes += AllFilesWildcard;
166 
167  // Use the current working directory if the file name path does not exist.
168  if( filename.DirExists() )
169  currentPath = filename.GetPath();
170  else
171  {
172  currentPath = m_mruPath;
173 
174  // On wxWidgets 3.1 (bug?) the path in wxFileDialog is ignored when
175  // finishing by the dir separator. Remove it if any:
176  if( currentPath.EndsWith( '\\' ) || currentPath.EndsWith( '/' ) )
177  currentPath.RemoveLast();
178  }
179 
180  wxFileDialog dlg( this, _( "Open Gerber File" ),
181  currentPath,
182  filename.GetFullName(),
183  filetypes,
184  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
185 
186  if( dlg.ShowModal() == wxID_CANCEL )
187  return false;
188 
189  dlg.GetPaths( filenamesList );
190 
191  // @todo Take a closer look at the CWD switching here. The current working directory
192  // gets changed by wxFileDialog because the wxFD_CHANGE_DIR flag is set. Is this the
193  // appropriate behavior? The current working directory is not returned to the previous
194  // value so this may be an issue elsewhere.
195  currentPath = wxGetCwd();
196  m_mruPath = currentPath;
197  }
198  else
199  {
200  filenamesList.Add( aFullFileName );
201  currentPath = filename.GetPath();
202  m_mruPath = currentPath;
203  }
204 
205  // Read gerber files: each file is loaded on a new GerbView layer
206  bool success = true;
207  int layer = getActiveLayer();
208 
209  // Manage errors when loading files
210  wxString msg;
211  WX_STRING_REPORTER reporter( &msg );
212 
213  for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
214  {
215  filename = filenamesList[ii];
216 
217  if( !filename.IsAbsolute() )
218  filename.SetPath( currentPath );
219 
220  m_lastFileName = filename.GetFullPath();
221 
222  setActiveLayer( layer, false );
223 
224  if( Read_GERBER_File( filename.GetFullPath() ) )
225  {
227 
228  layer = getNextAvailableLayer( layer );
229 
230  if( layer == NO_AVAILABLE_LAYERS && ii < filenamesList.GetCount()-1 )
231  {
232  success = false;
233  reporter.Report( MSG_NO_MORE_LAYER, REPORTER::RPT_ERROR );
234 
235  // Report the name of not loaded files:
236  ii += 1;
237  while( ii < filenamesList.GetCount() )
238  {
239  filename = filenamesList[ii++];
240  wxString txt;
241  txt.Printf( MSG_NOT_LOADED,
242  GetChars( filename.GetFullName() ) );
243  reporter.Report( txt, REPORTER::RPT_ERROR );
244  }
245  break;
246  }
247 
248  setActiveLayer( layer, false );
249  }
250  }
251 
252  if( !success )
253  {
254  HTML_MESSAGE_BOX mbox( this, _( "Errors" ) );
255  mbox.ListSet( msg );
256  mbox.ShowModal();
257  }
258 
259  Zoom_Automatique( false );
260 
261  // Synchronize layers tools with actual active layer:
265  syncLayerBox();
266  return success;
267 }
wxString m_lastFileName
The last filename chosen to be proposed to the user.
wxString m_mruPath
Most recently used path.
Definition: wxstruct.h:156