You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

576 lines
21 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
8 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software: you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation, either version 3 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef WX_GERBER_STRUCT_H
  22. #define WX_GERBER_STRUCT_H
  23. #include <filehistory.h>
  24. #include <pgm_base.h>
  25. #include <config_params.h>
  26. #include <eda_draw_frame.h>
  27. #include <layers_id_colors_and_visibility.h>
  28. #include <gerbview.h>
  29. #include <convert_to_biu.h>
  30. #include <gbr_layout.h>
  31. #include <page_info.h>
  32. #include <gbr_display_options.h>
  33. #include <undo_redo_container.h>
  34. #define NO_AVAILABLE_LAYERS UNDEFINED_LAYER
  35. class DCODE_SELECTION_BOX;
  36. class GERBER_LAYER_WIDGET;
  37. class GBR_LAYER_BOX_SELECTOR;
  38. class GERBER_DRAW_ITEM;
  39. class GERBER_FILE_IMAGE;
  40. class GERBER_FILE_IMAGE_LIST;
  41. class REPORTER;
  42. class SELECTION;
  43. /**
  44. * GERBVIEW_FRAME
  45. * is the main window used in GerbView.
  46. */
  47. #define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
  48. class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
  49. {
  50. GBR_LAYOUT* m_gerberLayout;
  51. int m_activeLayer;
  52. wxPoint m_grid_origin;
  53. PAGE_INFO m_paper; // used only to show paper limits to screen
  54. GBR_DISPLAY_OPTIONS m_DisplayOptions;
  55. wxStaticText* m_cmpText; // a message on the auxiliary toolbar,
  56. // relative to the m_SelComponentBox
  57. wxStaticText* m_netText; // a message on the auxiliary toolbar,
  58. // relative to the m_SelNetnameBox
  59. wxStaticText* m_apertText; // a message on the auxiliary toolbar,
  60. // relative to the m_SelAperAttributesBox
  61. wxStaticText* m_dcodeText; // a message on the auxiliary toolbar,
  62. // relative to the m_DCodeSelector
  63. public:
  64. const GBR_DISPLAY_OPTIONS& GetDisplayOptions() const { return m_DisplayOptions; }
  65. void SetDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ) { m_DisplayOptions = aOptions; }
  66. /**
  67. * Function SetLayout
  68. * sets the m_gerberLayout member in such as way as to ensure deleting any previous
  69. * GBR_LAYOUT.
  70. * @param aLayout The GBR_LAYOUT to put into the frame.
  71. */
  72. void SetLayout( GBR_LAYOUT* aLayout )
  73. {
  74. delete m_gerberLayout;
  75. m_gerberLayout = aLayout;
  76. }
  77. GBR_LAYOUT* GetGerberLayout() const
  78. {
  79. wxASSERT( m_gerberLayout );
  80. return m_gerberLayout;
  81. }
  82. /**
  83. * Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data
  84. */
  85. GERBER_FILE_IMAGE_LIST* GetImagesList() const
  86. {
  87. return m_gerberLayout->GetImagesList();
  88. }
  89. GERBER_FILE_IMAGE* GetGbrImage( int aIdx ) const;
  90. unsigned ImagesMaxCount() const; ///< The max number of file images
  91. void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
  92. const PAGE_INFO& GetPageSettings() const override;
  93. const wxSize GetPageSizeIU() const override;
  94. const wxPoint& GetGridOrigin() const override { return m_grid_origin; }
  95. void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; }
  96. const TITLE_BLOCK& GetTitleBlock() const override;
  97. void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
  98. /** Install the dialog box for layer selection
  99. * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
  100. * @param aCopperLayerCount = number of copper layers
  101. * @param aGerberName = Name of Gerber file to select KiCad layer for
  102. * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
  103. * or -1 if canceled
  104. *
  105. * Providing the option to also display a "(Deselect)" radiobutton makes the
  106. * GerbView's "Export to Pcbnew" command) more "user friendly",
  107. * by permitting any layer to be "deselected" immediately after its
  108. * corresponding radiobutton has been clicked on. (It would otherwise be
  109. * necessary to first cancel the "Select Layer:" dialog box (invoked after a
  110. * different radiobutton is clicked on) prior to then clicking on the "Deselect"
  111. * button provided within the "Layer selection:" dialog box).
  112. */
  113. int SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, wxString aGerberName );
  114. /**
  115. * @return the color of the grid
  116. */
  117. COLOR4D GetGridColor() override;
  118. ///> @copydoc EDA_DRAW_FRAME::SetGridColor()
  119. virtual void SetGridColor( COLOR4D aColor ) override;
  120. const BOX2I GetDocumentExtents() const override
  121. {
  122. wxASSERT( m_gerberLayout );
  123. return m_gerberLayout->ViewBBox();
  124. }
  125. protected:
  126. GERBER_LAYER_WIDGET* m_LayersManager;
  127. FILE_HISTORY m_zipFileHistory;
  128. FILE_HISTORY m_drillFileHistory;
  129. FILE_HISTORY m_jobFileHistory;
  130. wxString m_lastFileName; // The last filename chosen to be proposed to the user
  131. void setupUIConditions() override;
  132. public:
  133. wxChoice* m_SelComponentBox; // a choice box to display and highlight component graphic items
  134. wxChoice* m_SelNetnameBox; // a choice box to display and highlight netlist graphic items
  135. wxChoice* m_SelAperAttributesBox; // a choice box to display aperture attributes and highlight items
  136. GBR_LAYER_BOX_SELECTOR* m_SelLayerBox; // The combobox to select the current active graphic layer
  137. // (which is drawn on top on the other layers
  138. DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight.
  139. wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
  140. // gerber data (format..)
  141. private:
  142. int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
  143. // - in fast mode (write mode) but if there are negative
  144. // items only the last image is correctly drawn (no
  145. // problem to see only one image or when no negative items)
  146. // - in "exact" mode (but slower) in write mode:
  147. // last image covers previous images
  148. // - in "exact" mode (also slower) in OR mode
  149. // (transparency mode)
  150. // m_displayMode = 0, 1 or 2
  151. bool m_show_layer_manager_tools;
  152. void updateComponentListSelectBox();
  153. void updateNetnameListSelectBox();
  154. void updateAperAttributesSelectBox();
  155. void updateDCodeSelectBox();
  156. void unitsChangeRefresh() override; // See class EDA_DRAW_FRAME
  157. void OnClearJobFileHistory( wxCommandEvent& aEvent );
  158. void OnClearZipFileHistory( wxCommandEvent& aEvent );
  159. void OnClearDrlFileHistory( wxCommandEvent& aEvent );
  160. void OnClearGbrFileHistory( wxCommandEvent& aEvent );
  161. // The Tool Framework initalization
  162. void setupTools();
  163. /// Updates the GAL with display settings changes
  164. void applyDisplaySettingsToGAL();
  165. /**
  166. * Loads a list of Gerber and NC drill files and updates the view based on them
  167. * @param aPath is the base path for the filenames if they are relative
  168. * @param aFilenameList is a list of filenames to load
  169. * @param aFileType is a list of type of files to load (0 = Gerber, 1 = NC drill)
  170. * if nullptr, files are expected Gerber type.
  171. * @return true if every file loaded successfully
  172. */
  173. bool loadListOfGerberAndDrillFiles( const wxString& aPath,
  174. const wxArrayString& aFilenameList,
  175. const std::vector<int>* aFileType = nullptr );
  176. public:
  177. GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent );
  178. ~GERBVIEW_FRAME();
  179. void doCloseWindow() override;
  180. bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
  181. // Virtual basic functions:
  182. void ReCreateHToolbar() override;
  183. void ReCreateAuxiliaryToolbar() override;
  184. /**
  185. * Function ReCreateVToolbar
  186. * creates or updates the right vertical toolbar.
  187. */
  188. void ReCreateVToolbar() override;
  189. /**
  190. * Create or update the left vertical toolbar (option toolbar)
  191. */
  192. void ReCreateOptToolbar() override;
  193. void ReCreateMenuBar() override;
  194. void UpdateStatusBar() override;
  195. /**
  196. * Function GetDisplayMode
  197. * @return 0 for fast mode (not fully compatible with negative objects)
  198. * 1 for exact mode, write mode
  199. * 2 for exact mode, OR mode (transparency mode)
  200. */
  201. int GetDisplayMode() { return m_displayMode; }
  202. /**
  203. * Function SetDisplayMode
  204. * @param aMode = 0 for fast mode
  205. * 1 for exact mode, write mode
  206. * 2 for exact mode, OR mode (transparency mode)
  207. */
  208. void SetDisplayMode( int aMode ) { m_displayMode = aMode; }
  209. /**
  210. * Function IsElementVisible
  211. * tests whether a given element category is visible. Keep this as an
  212. * inline function.
  213. * @param aLayerID is an item id from the enum GERBVIEW_LAYER_ID
  214. * @return bool - true if the element is visible.
  215. */
  216. bool IsElementVisible( int aLayerID ) const;
  217. /**
  218. * Function SetElementVisibility
  219. * changes the visibility of an element category
  220. * @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID
  221. * @param aNewState = The new visibility state of the element category
  222. * (see enum PCB)
  223. */
  224. void SetElementVisibility( int aLayerID, bool aNewState );
  225. /**
  226. * Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
  227. * It may be overloaded by derived classes
  228. * @param aVisible = true if the grid must be shown
  229. */
  230. void SetGridVisibility( bool aVisible ) override;
  231. /**
  232. * Function GetVisibleLayers
  233. * is a proxy function that calls the correspondent function in m_BoardSettings
  234. * @return LSET of the visible layers
  235. */
  236. LSET GetVisibleLayers() const;
  237. /**
  238. * Function SetVisibleLayers
  239. * is a proxy function that calls the correspondent function in m_BoardSettings
  240. * @param aLayerMask = The new set of visible layers
  241. */
  242. void SetVisibleLayers( LSET aLayerMask );
  243. /**
  244. * Function IsLayerVisible
  245. * tests whether a given layer is visible
  246. * @param aLayer = The layer to be tested (still 0-31!)
  247. * @return bool - true if the layer is visible.
  248. */
  249. bool IsLayerVisible( int aLayer ) const;
  250. /**
  251. * Function GetVisibleElementColor
  252. * returns the color of a gerber visible element.
  253. */
  254. COLOR4D GetVisibleElementColor( int aLayerID );
  255. void SetVisibleElementColor( int aLayerID, COLOR4D aColor );
  256. COLOR4D GetLayerColor( int aLayer ) const;
  257. void SetLayerColor( int aLayer, COLOR4D aColor );
  258. /**
  259. * Function GetNegativeItemsColor
  260. * @return the color of negative items.
  261. * This is usually the background color, but can be another color in order to see
  262. * negative objects
  263. */
  264. COLOR4D GetNegativeItemsColor();
  265. /**
  266. * Function ReFillLayerWidget
  267. * changes out all the layers in m_Layers; called upon loading new gerber files.
  268. */
  269. void ReFillLayerWidget();
  270. /**
  271. * Function SetActiveLayer
  272. * will change the currently active layer to \a aLayer and update the GERBER_LAYER_WIDGET.
  273. */
  274. void SetActiveLayer( int aLayer, bool doLayerWidgetUpdate = true );
  275. /**
  276. * Function SetActiveLayer
  277. * returns the active layer
  278. */
  279. int GetActiveLayer() const { return m_activeLayer; }
  280. /**
  281. * Function getNextAvailableLayer
  282. * finds the next empty layer starting at \a aLayer and returns it to the caller. If no
  283. * empty layers are found, NO_AVAILABLE_LAYERS is return.
  284. * @param aLayer The first layer to search.
  285. * @return The first empty layer found or NO_AVAILABLE_LAYERS.
  286. */
  287. int getNextAvailableLayer( int aLayer = 0 ) const;
  288. /**
  289. * Function syncLayerWidget
  290. * updates the currently "selected" layer within the GERBER_LAYER_WIDGET.
  291. * The currently active layer is defined by the return value of GetActiveLayer().
  292. * <p>
  293. * This function cannot be inline without including layer_widget.h in here and we do not
  294. * want to do that.
  295. */
  296. void syncLayerWidget();
  297. /**
  298. * Function syncLayerBox
  299. * updates the currently "selected" layer within m_SelLayerBox
  300. * The currently active layer, as defined by the return value of GetActiveLayer().
  301. * @param aRebuildLayerBox = true to rebuild the layer box
  302. * false to just updates the selection.
  303. */
  304. void syncLayerBox( bool aRebuildLayerBox = false );
  305. /**
  306. * Function UpdateTitleAndInfo
  307. * displays the short filename (if exists) of the selected layer on the caption of the main
  308. * GerbView window and some other parameters
  309. * Name of the layer (found in the gerber file: LN &ltname&gt command) in the status bar
  310. * Name of the Image (found in the gerber file: IN &ltname&gt command) in the status bar
  311. * and other data in toolbar
  312. */
  313. void UpdateTitleAndInfo();
  314. /**
  315. * Function DisplayGridMsg()
  316. *
  317. * Display the current grid pane on the status bar.
  318. */
  319. void DisplayGridMsg() override;
  320. void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
  321. void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
  322. void OnToggleShowLayerManager( wxCommandEvent& aEvent );
  323. void ShowChangedLanguage() override;
  324. void Process_Special_Functions( wxCommandEvent& event );
  325. /// Handles the changing of the highlighted component/net/attribute
  326. void OnSelectHighlightChoice( wxCommandEvent& event );
  327. /**
  328. * Function OnSelectActiveDCode
  329. * Selects the active DCode for the current active layer.
  330. * Items using this DCode are highlighted.
  331. */
  332. void OnSelectActiveDCode( wxCommandEvent& event );
  333. /**
  334. * Function OnSelectActiveLayer
  335. * Selects the active layer:
  336. * - if a file is loaded, it is loaded in this layer
  337. * _ this layer is displayed on top of other layers
  338. */
  339. void OnSelectActiveLayer( wxCommandEvent& event );
  340. /**
  341. * Function OnShowGerberSourceFile
  342. * Call the preferred editor to show (and edit) the gerber source file
  343. * loaded in the active layer
  344. */
  345. void OnShowGerberSourceFile( wxCommandEvent& event );
  346. /**
  347. * Function OnSelectDisplayMode
  348. * called on a display mode selection
  349. * Mode selection can be fast display,
  350. * or exact mode with stacked images or with transparency
  351. */
  352. void OnSelectDisplayMode( wxCommandEvent& event );
  353. /**
  354. * Function OnQuit
  355. * called on request of application quit
  356. */
  357. void OnQuit( wxCommandEvent& event );
  358. void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
  359. void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
  360. void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
  361. void Files_io( wxCommandEvent& event );
  362. /**
  363. * Function OnGbrFileHistory
  364. * deletes the current data and loads a Gerber file selected from history list on
  365. * current layer.
  366. */
  367. void OnGbrFileHistory( wxCommandEvent& event );
  368. /**
  369. * Function OnDrlFileHistory
  370. * deletes the current data and load a drill file in Excellon format selected from
  371. * history list on current layer.
  372. */
  373. void OnDrlFileHistory( wxCommandEvent& event );
  374. /**
  375. * Function OnZipFileHistory
  376. * deletes the current data and load a zip archive file selected from the
  377. * history list. The archive is expected coantaining a set of gerber and drill file
  378. */
  379. void OnZipFileHistory( wxCommandEvent& event );
  380. /**
  381. * deletes the current data and load a gerber job file selected from the
  382. * history list.
  383. */
  384. void OnJobFileHistory( wxCommandEvent& event );
  385. /**
  386. * Extracts gerber and drill files from the zip archive, and load them
  387. * @param aFullFileName is the full filename of the zip archive
  388. * @param aReporter a REPORTER to collect warning and error messages
  389. * @return true if OK, false if a file cannot be readable
  390. */
  391. bool unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter = nullptr );
  392. /**
  393. * function LoadGerberFiles
  394. * Load a photoplot (Gerber) file or many files.
  395. * @param aFileName - void string or file name with full path to open or empty string to
  396. * open a new file. In this case one one file is loaded
  397. * if void string: user will be prompted for filename(s)
  398. * @return true if file was opened successfully.
  399. */
  400. bool LoadGerberFiles( const wxString& aFileName );
  401. bool Read_GERBER_File( const wxString& GERBER_FullFileName );
  402. /**
  403. * function LoadExcellonFiles
  404. * Load a drill (EXCELLON) file or many files.
  405. * @param aFileName - void string or file name with full path to open or empty string to
  406. * open a new file. In this case one one file is loaded
  407. * if empty string: user will be prompted for filename(s)
  408. * @return true if file was opened successfully.
  409. */
  410. bool LoadExcellonFiles( const wxString& aFileName );
  411. bool Read_EXCELLON_File( const wxString& aFullFileName );
  412. /**
  413. * function LoadZipArchiveFileLoadZipArchiveFile
  414. * Load a zipped archive file.
  415. * @param aFileName - void string or file name with full path to open or empty string to
  416. * open a new file.
  417. * if empty string: user will be prompted for filename(s)
  418. * @return true if file was opened successfully.
  419. */
  420. bool LoadZipArchiveFile( const wxString& aFileName );
  421. /**
  422. * Load a Gerber job file, and load gerber files found in job files.
  423. * @param aFileName - void string or file name with full path to open or empty string to
  424. * open a new file.
  425. * if empty string: user will be prompted for filename(s)
  426. * @return true if file(s) was opened successfully.
  427. */
  428. bool LoadGerberJobFile( const wxString& aFileName );
  429. /**
  430. * Set Size Items (Lines, Flashes) from DCodes List
  431. */
  432. void Liste_D_Codes();
  433. // PCB handling
  434. bool Clear_DrawLayers( bool query );
  435. void Erase_Current_DrawLayer( bool query );
  436. void SortLayersByX2Attributes();
  437. /**
  438. * Updates the display options and refreshes the view as needed
  439. * @param aOptions is the new options to apply
  440. */
  441. void UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions );
  442. // Conversion function
  443. void ExportDataInPcbnewFormat( wxCommandEvent& event );
  444. /* SaveCopyInUndoList() virtual
  445. * currently: do nothing in GerbView.
  446. */
  447. void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy,
  448. UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED,
  449. const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { }
  450. /**
  451. * Function SaveCopyInUndoList (overloaded).
  452. * Creates a new entry in undo list of commands.
  453. * add a list of pickers to handle a list of items
  454. * @param aItemsList = the list of items modified by the command to undo
  455. * @param aTypeCommand = command type (see enum UNDO_REDO)
  456. * @param aTransformPoint = the reference point of the transformation,
  457. * for commands like move
  458. */
  459. void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
  460. UNDO_REDO aTypeCommand,
  461. const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
  462. {
  463. // currently: do nothing in GerbView.
  464. }
  465. ///> @copydoc EDA_DRAW_FRAME::ActivateGalCanvas
  466. void ActivateGalCanvas() override;
  467. /**
  468. * Allows Gerbview to install its preferences panels into the preferences dialog.
  469. */
  470. void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
  471. /**
  472. * Called after the preferences dialog is run.
  473. */
  474. void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
  475. SELECTION& GetCurrentSelection() override;
  476. DECLARE_EVENT_TABLE()
  477. };
  478. #endif /* WX_GERBER_STRUCT_H */