PadSelection.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef PADSELECTION_H
  2. #define PADSELECTION_H
  3. #include <vector>
  4. #include <json/json.h>
  5. #include "InputAction.h"
  6. class PadConfiguration;
  7. class AbsInput;
  8. class MidiMessage;
  9. class InputOperation;
  10. class InputInit
  11. {
  12. public:
  13. InputInit(int i,int j){x=i; y=j;}
  14. virtual ~InputInit();
  15. int x;
  16. int y;
  17. std::vector<InputAction*> actions;
  18. };
  19. class PadSelection
  20. {
  21. public:
  22. PadSelection(const std::string&, Json::Value&, PadConfiguration*);
  23. virtual ~PadSelection();
  24. void add(int, int);
  25. void add(AbsInput*);
  26. void remove(int, int);
  27. void remove(AbsInput*);
  28. AbsInput* at(int,int);
  29. bool has(int, int) const;
  30. bool has(AbsInput*) const;
  31. MidiMessage* execute(AbsInput*, MidiMessage* m) const;
  32. const std::string& get_name() const {return m_name;}
  33. int count() const {return m_list.size();}
  34. int count_x(int x) const;
  35. int count_y(int y) const;
  36. int index_at_x(int absindex) const;
  37. int index_at_y(int absindex) const;
  38. AbsInput* get_child_from_rel_index(int i){return m_list[i];}
  39. void send_init();
  40. protected:
  41. void _update_matrix();
  42. //le pad de la sélection
  43. PadConfiguration* m_pad;
  44. std::string m_name;
  45. int m_width;
  46. int m_height;
  47. std::vector<AbsInput*> m_matrix;
  48. std::vector<AbsInput*> m_list;
  49. //la configuration
  50. std::vector<InputOperation*> m_operations;
  51. // les commande d'initialisation pour toute la sélection
  52. InputActionList m_init;
  53. friend class PadConfiguration;
  54. };
  55. #endif // PADSELECTION_H