quartic-movement when dragging TCOs, Colorize TCOs
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@2061 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -16,6 +16,14 @@
|
||||
* src/gui/cusis_style.cpp:
|
||||
Fix cache collision bug
|
||||
|
||||
* src/gui/tracks/pattern_item.cpp:
|
||||
Place marks once-per-tact
|
||||
|
||||
* src/gui/tracks/bb_tco_item.cpp:
|
||||
* src/gui/tracks/track_content_object_item.cpp:
|
||||
* src/gui/cusis_style.cpp:
|
||||
Add per-TCO coloring and non-linear motion when dragging
|
||||
|
||||
2009-02-19 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* include/track.h:
|
||||
|
||||
@@ -147,7 +147,7 @@ QLinearGradient darken( const QLinearGradient & _gradient )
|
||||
QGradientStops stops = _gradient.stops();
|
||||
for (int i = 0; i < stops.size(); ++i) {
|
||||
QColor color = stops.at(i).second;
|
||||
stops[i].second = color.lighter(150);
|
||||
stops[i].second = color.lighter(133);
|
||||
}
|
||||
|
||||
QLinearGradient g = _gradient;
|
||||
@@ -195,7 +195,7 @@ void drawPath( QPainter *p, const QPainterPath &path,
|
||||
|
||||
// highlight (bb)
|
||||
if (dark)
|
||||
p->strokePath(path, QPen(borderCol.lighter(150), 2));
|
||||
p->strokePath(path, QPen(borderCol.lighter(133), 2));
|
||||
else
|
||||
p->strokePath(path, QPen(borderCol, 2));
|
||||
}
|
||||
@@ -919,22 +919,23 @@ void CusisStyle::drawTrackContentObject( QPainter * _painter,
|
||||
cache.fill( Qt::transparent );
|
||||
QPainter painter( &cache );
|
||||
|
||||
QColor col;
|
||||
if( !_option->selected )
|
||||
{
|
||||
col = QColor( 0x00, 0x33, 0x99 );
|
||||
}
|
||||
else
|
||||
{
|
||||
col = QColor( 0x00, 0x99, 0x33 );
|
||||
}
|
||||
|
||||
QColor colBorder = col.lighter(160);
|
||||
QColor col = _option->userColor;
|
||||
QColor colBorder;
|
||||
QColor col0;
|
||||
if( _option->type == LmmsStyleOptionTCO::BbTco )
|
||||
col0 = col;
|
||||
{
|
||||
colBorder = col;
|
||||
col0 = _option->selected ?
|
||||
QColor( 0x33, 0x00, 0x99 ) :
|
||||
col.darker(140);
|
||||
}
|
||||
else
|
||||
col0 = col.darker(400);
|
||||
{
|
||||
colBorder = QColor( 0x00, 0x33, 0x99 );
|
||||
col0 = _option->selected ?
|
||||
QColor( 0x33, 0x00, 0x99 ).darker(180) :
|
||||
colBorder.darker(420);
|
||||
}
|
||||
|
||||
painter.setRenderHint( QPainter::Antialiasing, true );
|
||||
|
||||
@@ -957,7 +958,12 @@ void CusisStyle::drawTrackContentObject( QPainter * _painter,
|
||||
}
|
||||
|
||||
painter.translate( 1, 0 );
|
||||
painter.setPen( col.lighter(160) );
|
||||
QColor faint = QColor::fromHsv(
|
||||
colBorder.hue(),
|
||||
colBorder.saturation()/2,
|
||||
colBorder.value() );
|
||||
|
||||
painter.setPen( faint );
|
||||
for( float x = t * cellW; x < rc.width()-2; x += t * cellW )
|
||||
{
|
||||
painter.drawLine(x, 2, x, rc.height()-5);
|
||||
|
||||
@@ -62,14 +62,16 @@ void BbTrackContentObjectItem::paint(
|
||||
_painter->scale( 1.0f/xscale, 1.0f );
|
||||
rc.setWidth( rc.width() * xscale );
|
||||
|
||||
bbTCO * bbTco = (bbTCO*)m_tco;
|
||||
|
||||
// TODO: Use a proxy class
|
||||
LmmsStyleOptionTCO * options = new LmmsStyleOptionTCO();
|
||||
options->type = LmmsStyleOptionTCO::BbTco;
|
||||
options->rect = rc;
|
||||
options->selected = isSelected();
|
||||
options->hovered = m_hover;
|
||||
options->userColor = bbTco->color();
|
||||
|
||||
bbTCO * bbTco = (bbTCO*)m_tco;
|
||||
int trackNum = bbTrack::numOfBBTrack( bbTco->getTrack() );
|
||||
options->duration = engine::getBBTrackContainer()->lengthOfBB( trackNum );
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void PatternItem::paint(
|
||||
options->rect = rc;
|
||||
options->selected = isSelected();
|
||||
options->hovered = m_hover;
|
||||
options->duration = 0;
|
||||
options->duration = 1;
|
||||
|
||||
engine::getLmmsStyle()->drawTrackContentObject( _painter, m_tco, options );
|
||||
|
||||
|
||||
@@ -123,6 +123,29 @@ void TrackContentObjectItem::paint( QPainter * _painter,
|
||||
|
||||
|
||||
|
||||
float easeInOutQuad(float t, float b, float c, float d)
|
||||
{
|
||||
float t_adj = 2.0f * (float)t / (float)d;
|
||||
if (t_adj < 1) {
|
||||
return c/2*t_adj*t_adj + b;
|
||||
} else {
|
||||
--t_adj;
|
||||
return -c/2 * ((t_adj)*(t_adj-2) - 1) + b;
|
||||
}
|
||||
}
|
||||
|
||||
// I think this was the best from Cubic thru Quint
|
||||
float easeInOutQuart(float t, float b, float c, float d)
|
||||
{
|
||||
float t_adj = 2.0f * (float)t / (float)d;
|
||||
if (t_adj < 1) return c/2*t_adj*t_adj*t_adj*t_adj + b;
|
||||
else {
|
||||
t_adj -= 2.0f;
|
||||
return -c/2 * (t_adj*t_adj*t_adj*t_adj - 2) + b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QVariant TrackContentObjectItem::itemChange( GraphicsItemChange _change,
|
||||
const QVariant & _value )
|
||||
{
|
||||
@@ -149,6 +172,11 @@ QVariant TrackContentObjectItem::itemChange( GraphicsItemChange _change,
|
||||
} */
|
||||
newPos.setY( m_trackItem->y() );
|
||||
|
||||
float cellW = 16.0f;
|
||||
float xmod = fmod( newPos.x(), cellW);
|
||||
|
||||
newPos.setX( easeInOutQuart( xmod, newPos.x() - xmod, cellW, cellW ) );
|
||||
|
||||
/*
|
||||
if( fmod( newPos.x(), 16 ) != 0 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user