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.

99 lines
2.9 KiB

  1. /*
  2. * This program source code file is part of KICAD, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2010 jean-pierre.charras
  5. * Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include "bitmap2cmp_gui.h"
  25. #include <kiface_i.h>
  26. #include <kiway.h>
  27. #include <pgm_base.h>
  28. //-----<KIFACE>-----------------------------------------------------------------
  29. namespace BMP2CMP {
  30. static struct IFACE : public KIFACE_I
  31. {
  32. bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
  33. wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
  34. {
  35. return new BM2CMP_FRAME( aKiway, aParent );
  36. }
  37. /**
  38. * Function IfaceOrAddress
  39. * return a pointer to the requested object. The safest way to use this
  40. * is to retrieve a pointer to a static instance of an interface, similar to
  41. * how the KIFACE interface is exported. But if you know what you are doing
  42. * use it to retrieve anything you want.
  43. *
  44. * @param aDataId identifies which object you want the address of.
  45. *
  46. * @return void* - and must be cast into the know type.
  47. */
  48. void* IfaceOrAddress( int aDataId ) override
  49. {
  50. return NULL;
  51. }
  52. IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
  53. KIFACE_I( aDSOname, aType )
  54. {}
  55. } kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
  56. } // namespace BMP2CMP
  57. using namespace BMP2CMP;
  58. static PGM_BASE* process;
  59. KIFACE_I& Kiface()
  60. {
  61. return kiface;
  62. }
  63. // KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
  64. // KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
  65. KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
  66. {
  67. process = (PGM_BASE*) aProgram;
  68. return &kiface;
  69. }
  70. #if defined(BUILD_KIWAY_DLLS)
  71. PGM_BASE& Pgm()
  72. {
  73. wxASSERT( process ); // KIFACE_GETTER has already been called.
  74. return *process;
  75. }
  76. #endif
  77. bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
  78. {
  79. return start_common( aCtlBits );
  80. }