Collection of DPF-based plugins for packaging
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
3.2KB

  1. /**
  2. * projectM -- Milkdrop-esque visualisation SDK
  3. * Copyright (C)2003-2007 projectM Team
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. * See 'LICENSE.txt' included within this release
  19. *
  20. */
  21. /** BuiltinParams.hpp :: a class to encapsulate and centralize
  22. * all projectm builtin parameter methods and state. Used primarily
  23. * by preset class
  24. **/
  25. #ifndef _BUILTIN_PARAMS_HPP
  26. #define _BUILTIN_PARAMS_HPP
  27. #include <string>
  28. #include "PresetFrameIO.hpp"
  29. #include "Param.hpp"
  30. #include <map>
  31. #include <cstdio>
  32. class BuiltinParams
  33. {
  34. public:
  35. typedef std::map<std::string, std::string> AliasMap;
  36. /** Default constructor leaves database in an uninitialized state. */
  37. BuiltinParams();
  38. /** Construct a new builtin parameter database with variables references given by
  39. * the preset input and output structures */
  40. BuiltinParams(PresetInputs& presetInputs, PresetOutputs* presetOutputs);
  41. ~BuiltinParams();
  42. int insert_param_alt_name(Param* param, const std::string& salt_name);
  43. Param* find_builtin_param(const std::string& name);
  44. int load_builtin_param_float(const std::string& name, void* engine_val, void* matrix,
  45. short int flags,
  46. float init_val, float upper_bound,
  47. float lower_bound, const std::string& alt_name);
  48. int load_builtin_param_int(const std::string& name, void* engine_val, short int flags,
  49. int init_val, int upper_bound,
  50. int lower_bound, const std::string& alt_name);
  51. int load_builtin_param_bool(const std::string& name, void* engine_val, short int flags,
  52. int init_val, const std::string& alt_name);
  53. int load_builtin_param_string(const std::string& name, std::string* engine_val, short int flags);
  54. int insert_builtin_param(Param* param);
  55. template<class Fun>
  56. void apply(Fun& fun)
  57. {
  58. traverse(builtin_param_tree, fun);
  59. }
  60. protected:
  61. /** Param database initalizer / destructor functions */
  62. int init_builtin_param_db(const PresetInputs& presetInputs, PresetOutputs* presetOutputs);
  63. int load_all_builtin_param(const PresetInputs& presetInputs, PresetOutputs* presetOutputs);
  64. int destroy_builtin_param_db();
  65. private:
  66. static const bool BUILTIN_PARAMS_DEBUG = false;
  67. // Used to associate multiple string names to one parameter
  68. AliasMap aliasMap;
  69. // Internal datastructure to store the parameters
  70. std::map<std::string, Param*> builtin_param_tree;
  71. };
  72. #endif