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.

324 lines
8.3 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. /**
  24. * @file mocks.cpp
  25. * @brief Pcbnew main program for qa test.
  26. */
  27. #include <fctsys.h>
  28. #include <pgm_base.h>
  29. #include <kiface_i.h>
  30. #include <confirm.h>
  31. #include <macros.h>
  32. #include <pcb_edit_frame.h>
  33. #include <eda_dde.h>
  34. #include <wx/stdpaths.h>
  35. #include <wx/file.h>
  36. #include <wx/snglinst.h>
  37. #include <wx/dir.h>
  38. #include <gestfich.h>
  39. #include <pcbnew.h>
  40. #include <hotkeys.h>
  41. #include <wildcards_and_files_ext.h>
  42. #include <class_board.h>
  43. #include <fp_lib_table.h>
  44. #include <footprint_edit_frame.h>
  45. #include <footprint_viewer_frame.h>
  46. #include <footprint_wizard_frame.h>
  47. #include <pcb_edit_frame.h>
  48. #include <class_board.h>
  49. #include <class_track.h>
  50. #include <class_drawsegment.h>
  51. #include <class_pcb_text.h>
  52. #include <class_pcb_target.h>
  53. #include <class_module.h>
  54. #include <class_dimension.h>
  55. #include <class_zone.h>
  56. #include <class_edge_mod.h>
  57. #include <tools/pcb_actions.h>
  58. #include <router/router_tool.h>
  59. #include "pcb_tool_base.h"
  60. #include <dialog_find.h>
  61. #include <dialog_block_options.h>
  62. static struct IFACE : public KIFACE_I
  63. {
  64. // Of course all are overloads, implementations of the KIFACE.
  65. IFACE( const char* aName, KIWAY::FACE_T aType ) :
  66. KIFACE_I( aName, aType )
  67. {}
  68. bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override
  69. {
  70. return true;
  71. }
  72. void OnKifaceEnd() override {}
  73. wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
  74. {
  75. assert( false );
  76. return nullptr;
  77. }
  78. /**
  79. * Function IfaceOrAddress
  80. * return a pointer to the requested object. The safest way to use this
  81. * is to retrieve a pointer to a static instance of an interface, similar to
  82. * how the KIFACE interface is exported. But if you know what you are doing
  83. * use it to retrieve anything you want.
  84. *
  85. * @param aDataId identifies which object you want the address of.
  86. *
  87. * @return void* - and must be cast into the know type.
  88. */
  89. void* IfaceOrAddress( int aDataId ) override
  90. {
  91. return NULL;
  92. }
  93. }
  94. kiface( "pcb_test_frame", KIWAY::FACE_PCB );
  95. static struct PGM_TEST_FRAME : public PGM_BASE
  96. {
  97. bool OnPgmInit();
  98. void OnPgmExit()
  99. {
  100. Kiway.OnKiwayEnd();
  101. // Destroy everything in PGM_BASE, especially wxSingleInstanceCheckerImpl
  102. // earlier than wxApp and earlier than static destruction would.
  103. PGM_BASE::Destroy();
  104. }
  105. void MacOpenFile( const wxString& aFileName ) override
  106. {
  107. wxFileName filename( aFileName );
  108. if( filename.FileExists() )
  109. {
  110. #if 0
  111. // this pulls in EDA_DRAW_FRAME type info, which we don't want in
  112. // the single_top link image.
  113. KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( App().GetTopWindow() );
  114. #else
  115. KIWAY_PLAYER* frame = (KIWAY_PLAYER*) App().GetTopWindow();
  116. #endif
  117. if( frame )
  118. frame->OpenProjectFiles( std::vector<wxString>( 1, aFileName ) );
  119. }
  120. }
  121. }
  122. program;
  123. PGM_BASE& Pgm()
  124. {
  125. return program;
  126. }
  127. KIFACE_I& Kiface()
  128. {
  129. return kiface;
  130. }
  131. FP_LIB_TABLE GFootprintTable;
  132. void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset )
  133. {
  134. }
  135. // Initialize static member variables
  136. wxString DIALOG_FIND::prevSearchString;
  137. bool DIALOG_FIND::warpMouse = true;
  138. DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent )
  139. {
  140. // these members are initialized to avoid warnings about non initialized vars
  141. parent = aParent;
  142. itemCount = markerCount = 0;
  143. foundItem = nullptr;
  144. }
  145. void DIALOG_FIND::OnInitDialog( wxInitDialogEvent& event )
  146. {
  147. }
  148. void DIALOG_FIND::EnableWarp( bool aEnabled )
  149. {
  150. }
  151. void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
  152. {
  153. }
  154. void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
  155. {
  156. }
  157. void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
  158. {
  159. }
  160. void DIALOG_FIND::onClose( wxCloseEvent& aEvent )
  161. {
  162. }
  163. DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent,
  164. wxWindowID id,
  165. const wxString& title,
  166. const wxPoint& pos,
  167. const wxSize& size,
  168. long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
  169. {
  170. // these members are initialized only to avoid warnings about non initialized vars
  171. m_staticText1 = nullptr;
  172. m_SearchTextCtrl = nullptr;
  173. m_NoMouseWarpCheckBox = nullptr;
  174. m_button1 = nullptr;
  175. m_button2 = nullptr;
  176. m_button3 = nullptr;
  177. }
  178. DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
  179. {
  180. }
  181. MODULE* PCB_BASE_FRAME::GetFootprintFromBoardByReference()
  182. {
  183. return nullptr;
  184. }
  185. TOOL_ACTION PCB_ACTIONS::hideLocalRatsnest( "pcbnew.Control.hideLocalRatsnest",
  186. AS_GLOBAL, 0,
  187. "", "" );
  188. TOOL_ACTION PCB_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
  189. AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),
  190. _( "Flip" ), _( "Flips selected item(s)" ), nullptr );
  191. TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
  192. AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
  193. _( "Properties..." ), _( "Displays item properties dialog" ), nullptr );
  194. TOOL_ACTION PCB_ACTIONS::highlightNet( "pcbnew.EditorControl.highlightNet",
  195. AS_GLOBAL, 0,
  196. "", "" );
  197. TOOL_ACTION PCB_ACTIONS::clearHighlight( "pcbnew.EditorControl.clearHighlight",
  198. AS_GLOBAL, 0,
  199. "", "" );
  200. DIALOG_BLOCK_OPTIONS_BASE::DIALOG_BLOCK_OPTIONS_BASE( wxWindow* parent,
  201. wxWindowID id,
  202. const wxString& title,
  203. const wxPoint& pos,
  204. const wxSize& size,
  205. long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
  206. {
  207. // these members are initialized only to avoid warnings about non initialized vars
  208. m_Include_Modules = nullptr;
  209. m_Include_PcbTextes = nullptr;
  210. m_IncludeLockedModules = nullptr;
  211. m_Include_Draw_Items = nullptr;
  212. m_Include_Tracks = nullptr;
  213. m_Include_Vias = nullptr;
  214. m_Include_Edges_Items = nullptr;
  215. m_Include_Zones = nullptr;
  216. m_DrawBlockItems = nullptr;
  217. m_staticline1 = nullptr;
  218. m_checkBoxIncludeInvisible = nullptr;
  219. m_sdbSizer1 = nullptr;
  220. m_sdbSizer1OK = nullptr;
  221. m_sdbSizer1Cancel = nullptr;
  222. }
  223. DIALOG_BLOCK_OPTIONS_BASE::~DIALOG_BLOCK_OPTIONS_BASE()
  224. {
  225. }
  226. TOOL_ACTION PCB_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw",
  227. AS_GLOBAL, MD_SHIFT + 'R',
  228. _( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
  229. nullptr, AF_NONE, (void*) -1 );
  230. TOOL_ACTION PCB_ACTIONS::rotateCcw( "pcbnew.InteractiveEdit.rotateCcw",
  231. AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM ),
  232. _( "Rotate Counterclockwise" ), _( "Rotates selected item(s) counterclockwise" ),
  233. nullptr, AF_NONE, (void*) 1 );
  234. DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent,
  235. OPTIONS& aOptions, bool aShowLegacyOptions,
  236. const wxString& aTitle ) :
  237. DIALOG_BLOCK_OPTIONS_BASE( aParent, -1, aTitle ),
  238. m_options( aOptions )
  239. {
  240. // silence another compiler warning about m_options not being used
  241. if( m_options.includeModules )
  242. ;
  243. }
  244. void DIALOG_BLOCK_OPTIONS::checkBoxClicked( wxCommandEvent& aEvent )
  245. {
  246. }
  247. void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event )
  248. {
  249. }
  250. void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount )
  251. {
  252. }
  253. void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I&, GENERAL_COLLECTOR& )
  254. {
  255. }