2013-04-29 15:31:22 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2013 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
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENSE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __EXAMPLEVIEW_H__
|
|
|
|
#define __EXAMPLEVIEW_H__
|
|
|
|
|
|
|
|
#include "libmscore/mscoreview.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2013-04-29 15:31:22 +02:00
|
|
|
class Element;
|
|
|
|
class Score;
|
|
|
|
class Note;
|
2017-02-18 14:52:10 +01:00
|
|
|
class Chord;
|
|
|
|
class Icon;
|
2016-11-15 16:33:27 +01:00
|
|
|
enum class Grip : int;
|
2013-04-29 15:31:22 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ExampleView
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ExampleView : public QFrame, public MuseScoreView {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QTransform _matrix, imatrix;
|
|
|
|
QColor _fgColor;
|
2016-11-25 13:20:17 +01:00
|
|
|
QPixmap* _fgPixmap;
|
2013-04-29 15:31:22 +02:00
|
|
|
Element* dragElement = 0;
|
|
|
|
const Element* dropTarget = 0; ///< current drop target during dragMove
|
|
|
|
QRectF dropRectangle; ///< current drop rectangle during dragMove
|
|
|
|
QLineF dropAnchor; ///< line to current anchor point during dragMove
|
|
|
|
|
2015-11-12 14:59:19 +01:00
|
|
|
QStateMachine* sm;
|
|
|
|
QPointF startMove;
|
|
|
|
|
2013-04-29 15:31:22 +02:00
|
|
|
void drawElements(QPainter& painter, const QList<Element*>& el);
|
|
|
|
void setDropTarget(const Element* el);
|
|
|
|
|
|
|
|
virtual void paintEvent(QPaintEvent*);
|
|
|
|
virtual void dragEnterEvent(QDragEnterEvent*);
|
|
|
|
virtual void dragLeaveEvent(QDragLeaveEvent*);
|
|
|
|
virtual void dragMoveEvent(QDragMoveEvent*);
|
2017-02-24 12:04:22 +01:00
|
|
|
virtual void wheelEvent(QWheelEvent*);
|
2013-04-29 15:31:22 +02:00
|
|
|
virtual void dropEvent(QDropEvent*);
|
2013-05-03 10:11:50 +02:00
|
|
|
virtual void mousePressEvent(QMouseEvent*);
|
2017-02-24 12:04:22 +01:00
|
|
|
void constraintCanvas(int *dxx);
|
2015-01-07 18:28:57 +01:00
|
|
|
virtual QSize sizeHint() const;
|
2013-05-03 10:11:50 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void noteClicked(Note*);
|
2017-02-18 14:52:10 +01:00
|
|
|
void beamPropertyDropped(Chord*, Icon*);
|
2013-04-29 15:31:22 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
ExampleView(QWidget* parent = 0);
|
2016-11-25 13:20:17 +01:00
|
|
|
~ExampleView();
|
2017-02-19 03:03:57 +01:00
|
|
|
void resetMatrix();
|
2013-04-29 15:31:22 +02:00
|
|
|
virtual void layoutChanged();
|
|
|
|
virtual void dataChanged(const QRectF&);
|
|
|
|
virtual void updateAll();
|
|
|
|
virtual void adjustCanvasPosition(const Element* el, bool playBack);
|
|
|
|
virtual void setScore(Score*);
|
|
|
|
virtual void removeScore();
|
|
|
|
|
|
|
|
virtual void changeEditElement(Element*);
|
|
|
|
virtual QCursor cursor() const;
|
|
|
|
virtual void setCursor(const QCursor&);
|
|
|
|
virtual void setDropRectangle(const QRectF&);
|
|
|
|
virtual void cmdAddSlur(Note* firstNote, Note* lastNote);
|
|
|
|
virtual Element* elementNear(QPointF);
|
|
|
|
virtual void drawBackground(QPainter*, const QRectF&) const;
|
2015-11-12 14:59:19 +01:00
|
|
|
void dragExampleView(QMouseEvent* ev);
|
2017-06-19 12:59:53 +02:00
|
|
|
virtual const QRect geometry() const override { return QFrame::geometry(); }
|
2013-04-29 15:31:22 +02:00
|
|
|
};
|
|
|
|
|
2015-11-12 14:59:19 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// DragTransitionExampleView
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class DragTransitionExampleView : public QEventTransition
|
|
|
|
{
|
|
|
|
ExampleView* canvas;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void onTransition(QEvent* e);
|
|
|
|
|
|
|
|
public:
|
|
|
|
DragTransitionExampleView(ExampleView* c)
|
|
|
|
: QEventTransition(c, QEvent::MouseMove), canvas(c) {}
|
|
|
|
};
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
2013-04-29 15:31:22 +02:00
|
|
|
#endif
|
|
|
|
|