mirror of
https://github.com/LMMS/lmms.git
synced 2026-01-29 08:43:18 -05:00
fix alternate shading of pianoroll and automation editor on zooming (#3391)
* fixes alternate shading in piano roll on zooming * fixes alternate shading in automation editor on zooming
This commit is contained in:
committed by
Umcaruje
parent
06e4033cb9
commit
fd74ddfe15
@@ -1199,14 +1199,16 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
|
||||
|
||||
// alternating shades for better contrast
|
||||
// count the bars which disappear on left by scrolling
|
||||
int barCount = m_currentPosition / MidiTime::ticksPerTact();
|
||||
int leftBars = m_currentPosition / m_ppt;
|
||||
|
||||
for( int x = VALUES_WIDTH; x < width() + m_currentPosition; x += m_ppt, ++barCount )
|
||||
float zoomFactor = m_zoomXLevels[m_zoomingXModel.value()];
|
||||
int barCount = m_currentPosition / MidiTime::ticksPerTact();
|
||||
int leftBars = m_currentPosition * zoomFactor / m_ppt;
|
||||
|
||||
for( int x = VALUES_WIDTH; x < width() + m_currentPosition * zoomFactor; x += m_ppt, ++barCount )
|
||||
{
|
||||
if( ( barCount + leftBars ) % 2 != 0 )
|
||||
{
|
||||
p.fillRect( x - m_currentPosition, TOP_MARGIN, m_ppt,
|
||||
p.fillRect( x - m_currentPosition * zoomFactor, TOP_MARGIN, m_ppt,
|
||||
height() - ( SCROLLBAR_SIZE + TOP_MARGIN ), backgroundShade() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2907,14 +2907,16 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
|
||||
|
||||
// Draw alternating shades on bars
|
||||
// count the bars which disappear on left by scrolling
|
||||
int barCount = m_currentPosition / MidiTime::ticksPerTact();
|
||||
int leftBars = m_currentPosition / m_ppt;
|
||||
|
||||
for( int x = WHITE_KEY_WIDTH; x < width() + m_currentPosition; x += m_ppt, ++barCount )
|
||||
float zoomFactor = m_zoomLevels[m_zoomingModel.value()];
|
||||
int barCount = m_currentPosition / MidiTime::ticksPerTact();
|
||||
int leftBars = m_currentPosition * zoomFactor / m_ppt;
|
||||
|
||||
for( int x = WHITE_KEY_WIDTH; x < width() + m_currentPosition * zoomFactor; x += m_ppt, ++barCount )
|
||||
{
|
||||
if( ( barCount + leftBars ) % 2 != 0 )
|
||||
{
|
||||
p.fillRect( x - m_currentPosition, PR_TOP_MARGIN, m_ppt,
|
||||
p.fillRect( x - m_currentPosition * zoomFactor, PR_TOP_MARGIN, m_ppt,
|
||||
height() - ( PR_BOTTOM_MARGIN + PR_TOP_MARGIN ), backgroundShade() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user