Make playhead red when recording (#7847)
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com> Co-authored-by: Fawn <rubiefawn@gmail.com> Co-authored-by: Andrew Wiltshire <AW1534@users.noreply.github.com>
This commit is contained in:
BIN
data/themes/classic/recording_playpos_marker.png
Normal file
BIN
data/themes/classic/recording_playpos_marker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 261 B |
@@ -141,6 +141,7 @@ lmms--gui--FileBrowser QCheckBox
|
||||
lmms--gui--PositionLine {
|
||||
qproperty-tailGradient: false;
|
||||
qproperty-lineColor: rgb(255, 255, 255);
|
||||
qproperty-recordingColor: rgb(255, 71, 87);
|
||||
}
|
||||
|
||||
lmms--gui--PianoRoll {
|
||||
|
||||
BIN
data/themes/default/recording_playpos_marker.png
Normal file
BIN
data/themes/default/recording_playpos_marker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 263 B |
@@ -171,6 +171,7 @@ QMenu::indicator:selected {
|
||||
lmms--gui--PositionLine {
|
||||
qproperty-tailGradient: true;
|
||||
qproperty-lineColor: rgb(255, 255, 255);
|
||||
qproperty-recordingColor: rgb(255, 71, 87);
|
||||
}
|
||||
|
||||
lmms--gui--PianoRoll {
|
||||
|
||||
@@ -38,9 +38,14 @@ class PositionLine : public QWidget
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool tailGradient MEMBER m_hasTailGradient)
|
||||
Q_PROPERTY(QColor lineColor MEMBER m_lineColor)
|
||||
Q_PROPERTY(QColor recordingColor MEMBER m_recordingColor)
|
||||
public:
|
||||
PositionLine(QWidget* parent, Song::PlayMode playMode);
|
||||
|
||||
bool isRecording() const { return m_isRecording; }
|
||||
|
||||
void setRecording(bool recording);
|
||||
|
||||
public slots:
|
||||
void zoomChange(float zoom);
|
||||
|
||||
@@ -48,9 +53,11 @@ private:
|
||||
void paintEvent(QPaintEvent* pe) override;
|
||||
|
||||
Song::PlayMode m_playMode;
|
||||
bool m_isRecording = false;
|
||||
|
||||
bool m_hasTailGradient;
|
||||
QColor m_lineColor;
|
||||
QColor m_recordingColor;
|
||||
};
|
||||
|
||||
} // namespace lmms::gui
|
||||
|
||||
@@ -70,10 +70,13 @@ public:
|
||||
void saveSettings( QDomDocument& doc, QDomElement& element ) override;
|
||||
void loadSettings( const QDomElement& element ) override;
|
||||
|
||||
ComboBoxModel *snappingModel() const;
|
||||
ComboBoxModel* snappingModel() const;
|
||||
float getSnapSize() const;
|
||||
QString getSnapSizeString() const;
|
||||
|
||||
TimeLineWidget* timeLine() const { return m_timeLine; }
|
||||
PositionLine* positionLine() const { return m_positionLine; }
|
||||
|
||||
public slots:
|
||||
void scrolled( int new_pos );
|
||||
void selectRegionFromPixels(int xStart, int xEnd);
|
||||
@@ -132,7 +135,8 @@ private:
|
||||
|
||||
LcdSpinBox * m_tempoSpinBox;
|
||||
|
||||
TimeLineWidget * m_timeLine;
|
||||
TimeLineWidget* m_timeLine;
|
||||
PositionLine* m_positionLine;
|
||||
|
||||
MeterDialog * m_timeSigDisplay;
|
||||
AutomatableSlider * m_masterVolumeSlider;
|
||||
@@ -141,7 +145,6 @@ private:
|
||||
TextFloat * m_mvsStatus;
|
||||
TextFloat * m_mpsStatus;
|
||||
|
||||
PositionLine * m_positionLine;
|
||||
|
||||
IntModel* m_zoomingModel;
|
||||
ComboBoxModel* m_snappingModel;
|
||||
|
||||
@@ -138,6 +138,7 @@ public:
|
||||
return( m_pos );
|
||||
}
|
||||
|
||||
static AutoScrollState defaultAutoScrollState();
|
||||
AutoScrollState autoScroll() const { return m_autoScroll; }
|
||||
void setAutoScroll(AutoScrollState state) { m_autoScroll = state; }
|
||||
|
||||
@@ -157,7 +158,11 @@ public:
|
||||
m_ppb / TimePos::ticksPerBar() );
|
||||
}
|
||||
|
||||
static AutoScrollState defaultAutoScrollState();
|
||||
bool isRecording() const { return m_isRecording; }
|
||||
void setRecording(bool recording) { m_isRecording = recording; }
|
||||
|
||||
bool isPlayheadVisible() const { return m_isPlayheadVisible; }
|
||||
void setPlayheadVisible(bool visible) { m_isPlayheadVisible = visible; }
|
||||
|
||||
signals:
|
||||
void positionChanged(const lmms::TimePos& postion);
|
||||
@@ -195,6 +200,7 @@ private:
|
||||
auto actionCursor(Action action) const -> QCursor;
|
||||
|
||||
QPixmap m_posMarkerPixmap = embed::getIconPixmap("playpos_marker");
|
||||
QPixmap m_recordingPosMarkerPixmap = embed::getIconPixmap("recording_playpos_marker");
|
||||
|
||||
QColor m_inactiveLoopColor = QColor{52, 63, 53, 64};
|
||||
QBrush m_inactiveLoopBrush = QColor{255, 255, 255, 32};
|
||||
@@ -232,6 +238,9 @@ private:
|
||||
std::array<TimePos, 2> m_oldLoopPos;
|
||||
TimePos m_dragStartPos;
|
||||
|
||||
bool m_isRecording = false;
|
||||
bool m_isPlayheadVisible = true;
|
||||
|
||||
TextFloat* m_hint = nullptr;
|
||||
int m_initalXSelect;
|
||||
|
||||
|
||||
@@ -4149,6 +4149,9 @@ void PianoRoll::record()
|
||||
m_recording = true;
|
||||
|
||||
Engine::getSong()->playMidiClip( m_midiClip, false );
|
||||
|
||||
m_timeLine->setRecording(true);
|
||||
m_positionLine->setRecording(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -4176,6 +4179,11 @@ void PianoRoll::recordAccompany()
|
||||
{
|
||||
Engine::getSong()->playPattern();
|
||||
}
|
||||
|
||||
auto* songEditor = GuiApplication::instance()->songEditor()->m_editor;
|
||||
|
||||
songEditor->timeLine()->setRecording(true);
|
||||
songEditor->positionLine()->setRecording(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -4204,7 +4212,7 @@ bool PianoRoll::toggleStepRecording()
|
||||
}
|
||||
}
|
||||
|
||||
return m_stepRecorder.isRecording();;
|
||||
return m_stepRecorder.isRecording();
|
||||
}
|
||||
|
||||
|
||||
@@ -4215,6 +4223,13 @@ void PianoRoll::stop()
|
||||
Engine::getSong()->stop();
|
||||
m_recording = false;
|
||||
m_scrollBack = m_timeLine->autoScroll() != TimeLineWidget::AutoScrollState::Disabled;
|
||||
|
||||
auto* songEditor = GuiApplication::instance()->songEditor()->m_editor;
|
||||
|
||||
songEditor->timeLine()->setRecording(false);
|
||||
songEditor->positionLine()->setRecording(false);
|
||||
m_timeLine->setRecording(false);
|
||||
m_positionLine->setRecording(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ PositionLine::PositionLine(QWidget* parent, Song::PlayMode playMode) :
|
||||
QWidget(parent),
|
||||
m_playMode(playMode),
|
||||
m_hasTailGradient(false),
|
||||
m_lineColor(0, 0, 0, 0)
|
||||
m_lineColor(0, 0, 0, 0),
|
||||
m_recordingColor(255, 71, 87)
|
||||
{
|
||||
resize(8, height());
|
||||
|
||||
@@ -42,10 +43,19 @@ PositionLine::PositionLine(QWidget* parent, Song::PlayMode playMode) :
|
||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
}
|
||||
|
||||
void PositionLine::setRecording(bool recording)
|
||||
{
|
||||
if (m_isRecording != recording)
|
||||
{
|
||||
m_isRecording = recording;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void PositionLine::paintEvent(QPaintEvent* pe)
|
||||
{
|
||||
QPainter p(this);
|
||||
auto c = QColor(m_lineColor);
|
||||
auto c = !m_isRecording ? m_lineColor : m_recordingColor;
|
||||
|
||||
// If width is 1, we don't need a gradient
|
||||
if (width() == 1)
|
||||
|
||||
@@ -1098,6 +1098,8 @@ void SongEditorWindow::play()
|
||||
void SongEditorWindow::record()
|
||||
{
|
||||
m_editor->m_song->record();
|
||||
m_editor->m_timeLine->setRecording(true);
|
||||
m_editor->m_positionLine->setRecording(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1106,6 +1108,8 @@ void SongEditorWindow::record()
|
||||
void SongEditorWindow::recordAccompany()
|
||||
{
|
||||
m_editor->m_song->playAndRecord();
|
||||
m_editor->m_timeLine->setRecording(true);
|
||||
m_editor->m_positionLine->setRecording(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,6 +1119,8 @@ void SongEditorWindow::stop()
|
||||
{
|
||||
m_editor->m_song->stop();
|
||||
getGUI()->pianoRoll()->stopRecording();
|
||||
m_editor->m_timeLine->setRecording(false);
|
||||
m_editor->m_positionLine->setRecording(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "TimeLineWidget.h"
|
||||
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
@@ -221,14 +220,16 @@ void TimeLineWidget::paintEvent( QPaintEvent * )
|
||||
p.fillRect(rightHandle, color);
|
||||
}
|
||||
|
||||
const QPixmap& marker = !m_isRecording ? m_posMarkerPixmap : m_recordingPosMarkerPixmap;
|
||||
|
||||
// Only draw the position marker if the position line is in view
|
||||
if (markerX(m_pos) >= m_xOffset && markerX(m_pos) < width() - m_posMarkerPixmap.width() / 2)
|
||||
if (m_isPlayheadVisible && markerX(m_pos) >= m_xOffset && markerX(m_pos) < width() - marker.width() / 2)
|
||||
{
|
||||
// Let the position marker extrude to the left
|
||||
p.setClipping(false);
|
||||
p.setOpacity(0.6);
|
||||
p.drawPixmap(markerX(m_pos) - (m_posMarkerPixmap.width() / 2),
|
||||
height() - m_posMarkerPixmap.height(), m_posMarkerPixmap);
|
||||
p.drawPixmap(markerX(m_pos) - (marker.width() / 2),
|
||||
height() - marker.height(), marker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user