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.

97 lines
2.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  5. * Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <kiway.h>
  25. #include <config.h>
  26. #include <wx/debug.h>
  27. #include <string.h>
  28. // one for each FACE_T
  29. wxDynamicLibrary KIWAY::s_sch_dso;
  30. wxDynamicLibrary KIWAY::s_pcb_dso;
  31. KIWAY::KIWAY()
  32. {
  33. memset( &m_dso_players, 0, sizeof( m_dso_players ) );
  34. }
  35. const wxString KIWAY::dso_name( FACE_T aFaceId )
  36. {
  37. switch( aFaceId )
  38. {
  39. case FACE_SCH: return KIFACE_PREFIX wxT( "eeschema" ) KIFACE_SUFFIX;
  40. case FACE_PCB: return KIFACE_PREFIX wxT( "pcbnew" ) KIFACE_SUFFIX;
  41. default:
  42. wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
  43. return wxEmptyString;
  44. }
  45. }
  46. PROJECT& KIWAY::Project()
  47. {
  48. return m_project;
  49. }
  50. KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
  51. {
  52. switch( aFaceId )
  53. {
  54. case FACE_SCH:
  55. case FACE_PCB:
  56. //case FACE_LIB:
  57. //case FACE_MOD:
  58. if( m_dso_players[aFaceId] )
  59. return m_dso_players[aFaceId];
  60. default:
  61. wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
  62. return NULL;
  63. }
  64. // DSO with KIFACE has not been loaded yet, does user want to load it?
  65. if( doLoad )
  66. {
  67. switch( aFaceId )
  68. {
  69. case FACE_SCH:
  70. break;
  71. case FACE_PCB:
  72. break;
  73. //case FACE_LIB:
  74. //case FACE_MOD:
  75. default:
  76. ;
  77. }
  78. }
  79. return NULL;
  80. }