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.

96 lines
3.0 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
  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 3d_plugin_manager.h
  25. * manages 3D model plugins
  26. */
  27. #ifndef PLUGIN_MANAGER_3D_H
  28. #define PLUGIN_MANAGER_3D_H
  29. #include <map>
  30. #include <list>
  31. #include <wx/string.h>
  32. class wxWindow;
  33. class KICAD_PLUGIN_LDR_3D;
  34. struct S3D_INFO;
  35. class SCENEGRAPH;
  36. class S3D_PLUGIN_MANAGER
  37. {
  38. private:
  39. /// list of discovered plugins
  40. std::list< KICAD_PLUGIN_LDR_3D* > m_Plugins;
  41. /// mapping of extensions to available plugins
  42. std::multimap< const wxString, KICAD_PLUGIN_LDR_3D* > m_ExtMap;
  43. /// list of file filters
  44. std::list< wxString > m_FileFilters;
  45. /// load plugins
  46. void loadPlugins( void );
  47. /// list potential plugins
  48. void listPlugins( const wxString& aPath, std::list< wxString >& aPluginList );
  49. /// check the existence of a plugin name and add it to the list
  50. void checkPluginName( const wxString& aPath, std::list< wxString >& aPluginList );
  51. /// check the existence of a path and add it to the path search list
  52. void checkPluginPath( const wxString& aPath, std::list< wxString >& aSearchList );
  53. /// add an entry to the file filter list
  54. void addFilterString( const wxString& aFilterString );
  55. /// add entries to the extension map
  56. void addExtensionMap( KICAD_PLUGIN_LDR_3D* aPlugin );
  57. public:
  58. S3D_PLUGIN_MANAGER();
  59. virtual ~S3D_PLUGIN_MANAGER();
  60. /**
  61. * Function GetFileFilters
  62. * returns the list of file filters; this will contain at least
  63. * the default "All Files (*.*)|*.*" and the file filters supported
  64. * by any available plugins
  65. *
  66. * @return a pointer to the internal filter list
  67. */
  68. std::list< wxString > const* GetFileFilters( void ) const;
  69. SCENEGRAPH* Load3DModel( const wxString& aFileName );
  70. /**
  71. * Function ClosePlugins
  72. * iterates through all discovered plugins and closes them to
  73. * reclaim memory. The individual plugins will be automatically
  74. * reloaded as calls are made to load specific models.
  75. */
  76. void ClosePlugins( void );
  77. };
  78. #endif // PLUGIN_MANAGER_3D_H