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:
Andrew Wiltshire
2025-12-12 15:02:25 +00:00
committed by GitHub
parent f0cb32ff08
commit 8627616175
11 changed files with 64 additions and 11 deletions

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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);
}
}