Collection of tools useful for audio production
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.

68 lines
1.8KB

  1. /*
  2. * Patchbay Canvas engine using QGraphicsView/Scene
  3. * Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * any later version.
  9. *
  10. * This program 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
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the COPYING file
  16. */
  17. #ifndef PATCHSCENE_H
  18. #define PATCHSCENE_H
  19. #include <QtGui/QGraphicsScene>
  20. class QKeyEvent;
  21. class QGraphicsRectItem;
  22. class QGraphicsSceneMouseEvent;
  23. class QGraphicsSceneWheelEvent;
  24. class QGraphicsView;
  25. class PatchScene : public QGraphicsScene
  26. {
  27. Q_OBJECT
  28. public:
  29. PatchScene(QObject* parent, QGraphicsView* view);
  30. void fixScaleFactor();
  31. void updateTheme();
  32. void zoom_fit();
  33. void zoom_in();
  34. void zoom_out();
  35. void zoom_reset();
  36. signals:
  37. void scaleChanged(double);
  38. void sceneGroupMoved(int, int, QPointF);
  39. private:
  40. bool m_ctrl_down;
  41. bool m_mouse_down_init;
  42. bool m_mouse_rubberband;
  43. QGraphicsRectItem* m_rubberband;
  44. bool m_rubberband_selection;
  45. QPointF m_rubberband_orig_point;
  46. QGraphicsView* m_view;
  47. virtual void keyPressEvent(QKeyEvent* event);
  48. virtual void keyReleaseEvent(QKeyEvent* event);
  49. virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
  50. virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
  51. virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
  52. virtual void wheelEvent(QGraphicsSceneWheelEvent* event);
  53. };
  54. #endif // PATCHSCENE_H