diff options
author | Robert Jonsson <spamatica@gmail.com> | 2009-12-27 11:30:35 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2009-12-27 11:30:35 +0000 |
commit | b703eab295330e6f81564fbb39a10a1a2fdd2f54 (patch) | |
tree | e46b5c9a6bc22fd661c15d1d2123f5bf631cef80 /muse_qt4_evolution/muse/canvas.h | |
parent | 5d5fa0fdf913907edbc3d2d29a7548f0cb658c94 (diff) |
moved old qt4 branch
Diffstat (limited to 'muse_qt4_evolution/muse/canvas.h')
-rw-r--r-- | muse_qt4_evolution/muse/canvas.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/muse_qt4_evolution/muse/canvas.h b/muse_qt4_evolution/muse/canvas.h new file mode 100644 index 00000000..911936c2 --- /dev/null +++ b/muse_qt4_evolution/muse/canvas.h @@ -0,0 +1,124 @@ +//============================================================================= +// MusE +// Linux Music Editor +// $Id:$ +// +// Copyright (C) 2002-2006 by Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//============================================================================= + +#ifndef __CANVAS_H__ +#define __CANVAS_H__ + +#include "awl/tcanvas.h" +#include "widgets/tools.h" + +class CanvasWidget; +class Part; +class Track; +class ArrangerTrack; + +static const int HANDLE1 = 6; +static const int HANDLE2 = 3; + +//--------------------------------------------------------- +// PartCanvas +//--------------------------------------------------------- + +class PartCanvas : public TimeCanvas { + Q_OBJECT + + // DRAG1 drag part head + // DRAG2 drag part tail + // DRAG3 drag whole part + // DRAG4 Drag&Drop drag + // DRAG5 draw part with pencil tool + + enum { S_NORMAL, S_START_DRAG1, S_START_DRAG2, S_START_DRAG3, + S_DRAG1, S_DRAG2, S_DRAG3, + S_DRAG4, + S_START_DRAG5, S_DRAG5, // draw new Part + S_SUBTRACK + }; + int state; + QPoint startDrag; + int _dragOffset; + QRect drag; + QTime startDragTime; + unsigned ppos, psize; + + // values set by searchPart(): + Track* track; + Part* part; + ArrangerTrack* at; + + Part* srcPart; // src part of a drag/drop operation + + bool _drawBackground; + int selected; + int lselected; // in local coordinates + int starty; + int dragy; + + virtual void paint(QPainter&, QRect); + void drawWavePart(QPainter& p, Part* part, int, int, int, int); + void drawMidiPart(QPainter& p, Part* mp, int, int, int, int); + virtual void mousePress(QMouseEvent*); + virtual void mouseMove(QPoint); + virtual void mouseRelease(QMouseEvent*); + virtual void mouseDoubleClick(QMouseEvent*); + + virtual void dragEnter(QDragEnterEvent*); + virtual void drop(QDropEvent*); + virtual void dragMove(QDragMoveEvent*); + virtual void dragLeave(QDragLeaveEvent*); + + virtual void keyboardNavigate(QKeyEvent *e); + + + int searchPart(const QPoint& p); + + void declonePart(Part* part); + void renamePart(Part*); + void splitPart(Part*, const QPoint&); + void cutPart(Part*); + void copyPart(Part*); + + void setCursor(); + int dragOffset() const { return _dragOffset; } + void drawHandle(QPainter& p, int x, int y) { + p.fillRect(x-HANDLE2, y-HANDLE2, HANDLE1, HANDLE1, x == lselected ? Qt::red : Qt::yellow); + } + void contextMenu(const QPoint&); + + QRubberBand *rubberBand; + QPoint rubberBandStartPos; + + private slots: + void markerChanged(int); + + signals: + void kbdMovementUpdate(Track* t, Part* p); + void startEditor(Part*, int); + void createLRPart(Track*); + void partChanged(Part*, unsigned, unsigned); + void doubleClickPart(Part*); + + public: + PartCanvas(); + void setDrawBackground(bool val) { _drawBackground = val; } + }; + +#endif + |