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.

75 lines
2.5 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
  5. * Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
  6. * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software: you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation, either version 3 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef SYMBOL_TREE_MODEL_ADAPTER_H
  22. #define SYMBOL_TREE_MODEL_ADAPTER_H
  23. #include <lib_tree_model_adapter.h>
  24. class LIB_TABLE;
  25. class SYMBOL_LIB_TABLE;
  26. class SYMBOL_TREE_MODEL_ADAPTER : public LIB_TREE_MODEL_ADAPTER
  27. {
  28. public:
  29. /**
  30. * Destructor. Do NOT delete this class manually; it is reference-counted by wxObject.
  31. */
  32. ~SYMBOL_TREE_MODEL_ADAPTER();
  33. /**
  34. * Factory function: create a model adapter in a reference-counting container.
  35. *
  36. * @param aLibs library set from which parts will be loaded
  37. */
  38. static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( EDA_BASE_FRAME* aParent,
  39. LIB_TABLE* aLibs );
  40. /**
  41. * Add all the libraries in a SYMBOL_LIB_TABLE to the model.
  42. * Displays a progress dialog attached to the parent frame the first time it is run.
  43. *
  44. * @param aNicknames is the list of library nicknames
  45. * @param aParent is the parent window to display the progress dialog
  46. */
  47. void AddLibraries( const std::vector<wxString>& aNicknames, wxWindow* aParent );
  48. void AddLibrary( wxString const& aLibNickname );
  49. wxString GenerateInfo( LIB_ID const& aLibId, int aUnit ) override;
  50. protected:
  51. /**
  52. * Constructor; takes a set of libraries to be included in the search.
  53. */
  54. SYMBOL_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs );
  55. private:
  56. friend class SYMBOL_ASYNC_LOADER;
  57. /**
  58. * Flag to only show the symbol library table load progress dialog the first time.
  59. */
  60. static bool m_show_progress;
  61. SYMBOL_LIB_TABLE* m_libs;
  62. };
  63. #endif // SYMBOL_TREE_MODEL_ADAPTER_H