Files
lmms/include/MidiClipView.h
Alex 9705c31773 Transpose midi clips in song editor (#6409)
* Transpose midi clips in song editor

* Fix undo stupidity

* Check boundries when transposing clips

and move transpose function to NoteVector

* Avoid update if nothing has changed

* Make getNoteBounds a separate function

* Rename getNoteBounds to boundsForNotes

* bool operator instead of optional + qobject_cast

* Revert "bool operator instead of optional + qobject_cast"

This reverts commit 98c56a96cf.

* qobject_cast and nullopt
2022-07-04 10:16:22 +09:00

112 lines
3.0 KiB
C++

/*
* MidiClipView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef MIDI_CLIP_VIEW_H
#define MIDI_CLIP_VIEW_H
#include <QStaticText>
#include "ClipView.h"
namespace lmms
{
class MidiClip;
namespace gui
{
class MidiClipView : public ClipView
{
Q_OBJECT
public:
MidiClipView( MidiClip* clip, TrackView* parent );
~MidiClipView() override = default;
Q_PROPERTY(QColor noteFillColor READ getNoteFillColor WRITE setNoteFillColor)
Q_PROPERTY(QColor noteBorderColor READ getNoteBorderColor WRITE setNoteBorderColor)
Q_PROPERTY(QColor mutedNoteFillColor READ getMutedNoteFillColor WRITE setMutedNoteFillColor)
Q_PROPERTY(QColor mutedNoteBorderColor READ getMutedNoteBorderColor WRITE setMutedNoteBorderColor)
QColor const & getNoteFillColor() const { return m_noteFillColor; }
void setNoteFillColor(QColor const & color) { m_noteFillColor = color; }
QColor const & getNoteBorderColor() const { return m_noteBorderColor; }
void setNoteBorderColor(QColor const & color) { m_noteBorderColor = color; }
QColor const & getMutedNoteFillColor() const { return m_mutedNoteFillColor; }
void setMutedNoteFillColor(QColor const & color) { m_mutedNoteFillColor = color; }
QColor const & getMutedNoteBorderColor() const { return m_mutedNoteBorderColor; }
void setMutedNoteBorderColor(QColor const & color) { m_mutedNoteBorderColor = color; }
public slots:
lmms::MidiClip* getMidiClip();
void update() override;
protected slots:
void openInPianoRoll();
void setGhostInPianoRoll();
void resetName();
void changeName();
void transposeSelection();
protected:
void constructContextMenu( QMenu * ) override;
void mousePressEvent( QMouseEvent * _me ) override;
void mouseDoubleClickEvent( QMouseEvent * _me ) override;
void paintEvent( QPaintEvent * pe ) override;
void wheelEvent( QWheelEvent * _we ) override;
private:
static QPixmap * s_stepBtnOn0;
static QPixmap * s_stepBtnOn200;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;
MidiClip* m_clip;
QPixmap m_paintPixmap;
QColor m_noteFillColor;
QColor m_noteBorderColor;
QColor m_mutedNoteFillColor;
QColor m_mutedNoteBorderColor;
QStaticText m_staticTextName;
bool m_legacySEPattern;
} ;
} // namespace gui
} // namespace lmms
#endif