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.

283 lines
7.0 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #include <fctsys.h>
  24. #include <pgm_base.h>
  25. #include <kiface_i.h>
  26. #include <confirm.h>
  27. #include <macros.h>
  28. #include <pcb_edit_frame.h>
  29. #include <eda_dde.h>
  30. #include <wx/stdpaths.h>
  31. #include <wx/file.h>
  32. #include <wx/snglinst.h>
  33. #include <wx/dir.h>
  34. #include <gestfich.h>
  35. #include <pcbnew.h>
  36. #include <wildcards_and_files_ext.h>
  37. #include <class_board.h>
  38. #include <fp_lib_table.h>
  39. #include <footprint_edit_frame.h>
  40. #include <footprint_viewer_frame.h>
  41. #include <footprint_wizard_frame.h>
  42. #include <pcb_edit_frame.h>
  43. #include <class_board.h>
  44. #include <class_track.h>
  45. #include <class_drawsegment.h>
  46. #include <class_pcb_text.h>
  47. #include <class_pcb_target.h>
  48. #include <class_module.h>
  49. #include <class_dimension.h>
  50. #include <class_zone.h>
  51. #include <class_edge_mod.h>
  52. #include <tools/pcb_actions.h>
  53. #include <router/router_tool.h>
  54. #include "pcb_tool_base.h"
  55. #include <dialog_find.h>
  56. #include <dialog_block_options.h>
  57. static struct IFACE : public KIFACE_I
  58. {
  59. // Of course all are overloads, implementations of the KIFACE.
  60. IFACE( const char* aName, KIWAY::FACE_T aType ) :
  61. KIFACE_I( aName, aType )
  62. {}
  63. bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override
  64. {
  65. return true;
  66. }
  67. void OnKifaceEnd() override {}
  68. wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
  69. {
  70. assert( false );
  71. return nullptr;
  72. }
  73. /**
  74. * Function IfaceOrAddress
  75. * return a pointer to the requested object. The safest way to use this
  76. * is to retrieve a pointer to a static instance of an interface, similar to
  77. * how the KIFACE interface is exported. But if you know what you are doing
  78. * use it to retrieve anything you want.
  79. *
  80. * @param aDataId identifies which object you want the address of.
  81. *
  82. * @return void* - and must be cast into the know type.
  83. */
  84. void* IfaceOrAddress( int aDataId ) override
  85. {
  86. return NULL;
  87. }
  88. }
  89. kiface( "pcb_test_frame", KIWAY::FACE_PCB );
  90. static struct PGM_TEST_FRAME : public PGM_BASE
  91. {
  92. bool OnPgmInit();
  93. void OnPgmExit()
  94. {
  95. Kiway.OnKiwayEnd();
  96. // Destroy everything in PGM_BASE, especially wxSingleInstanceCheckerImpl
  97. // earlier than wxApp and earlier than static destruction would.
  98. PGM_BASE::Destroy();
  99. }
  100. void MacOpenFile( const wxString& aFileName ) override
  101. {
  102. wxFileName filename( aFileName );
  103. if( filename.FileExists() )
  104. {
  105. #if 0
  106. // this pulls in EDA_DRAW_FRAME type info, which we don't want in
  107. // the single_top link image.
  108. KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( App().GetTopWindow() );
  109. #else
  110. KIWAY_PLAYER* frame = (KIWAY_PLAYER*) App().GetTopWindow();
  111. #endif
  112. if( frame )
  113. frame->OpenProjectFiles( std::vector<wxString>( 1, aFileName ) );
  114. }
  115. }
  116. }
  117. program;
  118. PGM_BASE& Pgm()
  119. {
  120. return program;
  121. }
  122. KIFACE_I& Kiface()
  123. {
  124. return kiface;
  125. }
  126. FP_LIB_TABLE GFootprintTable;
  127. void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
  128. {
  129. }
  130. // Initialize static member variables
  131. wxString DIALOG_FIND::prevSearchString;
  132. bool DIALOG_FIND::warpMouse = true;
  133. DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent )
  134. {
  135. // these members are initialized to avoid warnings about non initialized vars
  136. parent = aParent;
  137. itemCount = markerCount = 0;
  138. foundItem = nullptr;
  139. }
  140. void DIALOG_FIND::OnInitDialog( wxInitDialogEvent& event )
  141. {
  142. }
  143. void DIALOG_FIND::EnableWarp( bool aEnabled )
  144. {
  145. }
  146. void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
  147. {
  148. }
  149. void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
  150. {
  151. }
  152. void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
  153. {
  154. }
  155. void DIALOG_FIND::onClose( wxCloseEvent& aEvent )
  156. {
  157. }
  158. DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent,
  159. wxWindowID id,
  160. const wxString& title,
  161. const wxPoint& pos,
  162. const wxSize& size,
  163. long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
  164. {
  165. // these members are initialized only to avoid warnings about non initialized vars
  166. m_staticText1 = nullptr;
  167. m_SearchTextCtrl = nullptr;
  168. m_NoMouseWarpCheckBox = nullptr;
  169. m_button1 = nullptr;
  170. m_button2 = nullptr;
  171. m_button3 = nullptr;
  172. }
  173. DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
  174. {
  175. }
  176. MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
  177. {
  178. return nullptr;
  179. }
  180. DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent,
  181. wxWindowID id,
  182. const wxString& title,
  183. const wxPoint& pos,
  184. const wxSize& size,
  185. long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
  186. {
  187. // these members are initialized only to avoid warnings about non initialized vars
  188. m_Include_Modules = nullptr;
  189. m_Include_PcbTextes = nullptr;
  190. m_IncludeLockedModules = nullptr;
  191. m_Include_Draw_Items = nullptr;
  192. m_Include_Tracks = nullptr;
  193. m_Include_Vias = nullptr;
  194. m_Include_Edges_Items = nullptr;
  195. m_Include_Zones = nullptr;
  196. m_DrawBlockItems = nullptr;
  197. m_staticline1 = nullptr;
  198. m_checkBoxIncludeInvisible = nullptr;
  199. m_sdbSizer1 = nullptr;
  200. m_sdbSizer1OK = nullptr;
  201. m_sdbSizer1Cancel = nullptr;
  202. }
  203. DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE()
  204. {
  205. }
  206. DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent,
  207. OPTIONS& aOptions, bool aShowLegacyOptions,
  208. const wxString& aTitle ) :
  209. DIALOG_BLOCK_OPTIONS_BASE( aParent, -1, aTitle ),
  210. m_options( aOptions )
  211. {
  212. // silence another compiler warning about m_options not being used
  213. if( m_options.includeModules )
  214. ;
  215. }
  216. void DIALOG_BLOCK_OPTIONS::checkBoxClicked( wxCommandEvent& aEvent )
  217. {
  218. }
  219. void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event )
  220. {
  221. }
  222. void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
  223. {
  224. }
  225. void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I&, GENERAL_COLLECTOR& )
  226. {
  227. }