Skip to content

Commit

Permalink
Fixed #3226. Beat velocity fixes for both themes. (#3229)
Browse files Browse the repository at this point in the history
* Fixed #3226. Fixed beat velocity on classic theme. Fixed visual difference between 0 velocity and no step.

* Render step_btn_on_0.png always.

* Removed useless if.
  • Loading branch information
karmux authored and zonkmachine committed Feb 3, 2017
1 parent 6f3a7ea commit 995b14f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
Binary file removed data/themes/classic/step_btn_on.png
Binary file not shown.
File renamed without changes
Binary file added data/themes/classic/step_btn_on_200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed data/themes/classic/step_btn_on_yellow.png
Binary file not shown.
Binary file added data/themes/default/step_btn_on_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
6 changes: 3 additions & 3 deletions include/Pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ protected slots:


private:
static QPixmap * s_stepBtnOn;
static QPixmap * s_stepBtnOverlay;
static QPixmap * s_stepBtnOn0;
static QPixmap * s_stepBtnOn200;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;

Pattern* m_pat;
QPixmap m_paintPixmap;

QStaticText m_staticTextName;
} ;

Expand Down
29 changes: 21 additions & 8 deletions src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
#include "MainWindow.h"


QPixmap * PatternView::s_stepBtnOn = NULL;
QPixmap * PatternView::s_stepBtnOn0 = NULL;
QPixmap * PatternView::s_stepBtnOn200 = NULL;
QPixmap * PatternView::s_stepBtnOff = NULL;
QPixmap * PatternView::s_stepBtnOffLight = NULL;

Expand Down Expand Up @@ -608,10 +609,16 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) :
connect( gui->pianoRoll(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );

if( s_stepBtnOn == NULL )
if( s_stepBtnOn0 == NULL )
{
s_stepBtnOn = new QPixmap( embed::getIconPixmap(
"step_btn_on_100" ) );
s_stepBtnOn0 = new QPixmap( embed::getIconPixmap(
"step_btn_on_0" ) );
}

if( s_stepBtnOn200 == NULL )
{
s_stepBtnOn200 = new QPixmap( embed::getIconPixmap(
"step_btn_on_200" ) );
}

if( s_stepBtnOff == NULL )
Expand Down Expand Up @@ -992,16 +999,21 @@ void PatternView::paintEvent( QPaintEvent * )
else if( beatPattern && ( fixedTCOs() || ppt >= 96
|| m_pat->m_steps != MidiTime::stepsPerTact() ) )
{
QPixmap stepon;
QPixmap stepon0;
QPixmap stepon200;
QPixmap stepoff;
QPixmap stepoffl;
const int steps = qMax( 1,
m_pat->m_steps );
const int w = width() - 2 * TCO_BORDER_WIDTH;

// scale step graphics to fit the beat pattern length
stepon = s_stepBtnOn->scaled( w / steps,
s_stepBtnOn->height(),
stepon0 = s_stepBtnOn0->scaled( w / steps,
s_stepBtnOn0->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepon200 = s_stepBtnOn200->scaled( w / steps,
s_stepBtnOn200->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoff = s_stepBtnOff->scaled( w / steps,
Expand All @@ -1025,8 +1037,9 @@ void PatternView::paintEvent( QPaintEvent * )
{
const int vol = n->getVolume();
p.drawPixmap( x, y, stepoffl );
p.drawPixmap( x, y, stepon0 );
p.setOpacity( sqrt( vol / 200.0 ) );
p.drawPixmap( x, y, stepon );
p.drawPixmap( x, y, stepon200 );
p.setOpacity( 1 );
}
else if( ( it / 4 ) % 2 )
Expand Down

0 comments on commit 995b14f

Please sign in to comment.