More song editor improvements

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@2016 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2009-02-11 05:52:56 +00:00
parent 9f4ea82a39
commit 78a1c1f802
4 changed files with 38 additions and 41 deletions

View File

@@ -23,8 +23,12 @@
* src/gui/tracks/pattern_item.cpp:
* include/gui/tracks/pattern_item.h:
* include/gui/tracks/bb_tco_item.h:
* src/gui/main_window.cpp:
- Add BB and Pattern subclasses
- Play with some styling, about to move style code into lmmsStyle
- Add Caching support, but will soon expand with manual-QPixmapCache usage
to share common-TCO pixmaps between TCOs.
- Fix tickmarks on BB-TCOs
2009-02-09 Paul Giblock <drfaygo/at/gmail/dot/com>

View File

@@ -41,6 +41,7 @@
#include <QShortcut>
#include <QGraphicsView>
#include <QPixmapCache>
#include "lmmsversion.h"
@@ -207,6 +208,7 @@ mainWindow::mainWindow( void ) :
QSize( 16*4, 32 ),
16 );
QPixmapCache::setCacheLimit( 10240 );
QGraphicsView *view = new QGraphicsView( scene );
view->setRenderHints( QPainter::Antialiasing | QPainter::SmoothPixmapTransform );
view->setDragMode( QGraphicsView::RubberBandDrag );

View File

@@ -8,7 +8,10 @@
#include "gui/tracks/track_content_object_item.h"
#include "gui/tracks/track_container_scene.h"
#include "gui/tracks/track_item.h"
#include "bb_track.h"
#include "bb_track_container.h"
#include "track.h"
#include "engine.h"
// Just some stuff while playing with theming ideas,
// will be moved to lmmsStyle
@@ -126,52 +129,35 @@ void BbTrackContentObjectItem::paint( QPainter * _painter,
drawPath( _painter, path, col, "hah", m_hover );
const float cellW = TrackContainerScene::DEFAULT_CELL_WIDTH;
_painter->setOpacity(0.2);
_painter->setRenderHint( QPainter::Antialiasing, false );
_painter->setPen( QColor(0, 0, 0) );
for( int i = 0; i < m_tco->length().getTact(); ++i )
{
float x = cellW * i;
_painter->drawLine(x, 2, x, rc.height()-4);
bbTCO * bbTco = (bbTCO*)m_tco;
tact t = engine::getBBTrackContainer()->lengthOfBB(
bbTrack::numOfBBTrack( bbTco->getTrack() ) );
if( bbTco->length() > midiTime::ticksPerTact() && t > 0 )
{
_painter->setOpacity(0.2);
_painter->setRenderHint( QPainter::Antialiasing, false );
_painter->setPen( QColor(0, 0, 0) );
for( float x = t * cellW; x < rc.width()-2; x += t * cellW )
{
_painter->drawLine(x, 3, x, rc.height()-5);
}
_painter->translate( 1, 0 );
_painter->setPen( col.lighter(160) );
for( float x = t * cellW; x < rc.width()-2; x += t * cellW )
{
_painter->drawLine(x, 2, x, rc.height()-5);
}
_painter->setRenderHint( QPainter::Antialiasing, true );
}
_painter->translate( 1, 0 );
_painter->setPen( col.lighter(160) );
for( int i = 0; i < m_tco->length().getTact(); ++i )
{
float x = cellW * i;
_painter->drawLine(x, 2, x, rc.height()-4);
}
_painter->setRenderHint( QPainter::Antialiasing, true );
_painter->restore();
return;
QColor col0 = col.light( 130 );
QColor col1 = col.light( 70 );
QColor col2 = col.light( 40 );
QLinearGradient lingrad( 0, 0, 0, rc.height() );
lingrad.setColorAt( 0, col0 );
lingrad.setColorAt( 1, col1 );
QLinearGradient bordergrad( 0, 0, 0, rc.height() );
bordergrad.setColorAt( 1, col2 );
bordergrad.setColorAt( 0, col1 );
rc.adjust( 0, 0, -1, -1 );
_painter->setRenderHint( QPainter::Antialiasing, true );
_painter->setBrush( lingrad );
_painter->setPen( QPen( bordergrad, 1.5 ) ); // QColor( 6, 6, 6 ) );
_painter->drawRoundedRect( rc, 4, 4 );
_painter->setRenderHint( QPainter::Antialiasing, false );
_painter->restore();
}
QVariant BbTrackContentObjectItem::itemChange( GraphicsItemChange _change, const QVariant & _value )

View File

@@ -23,6 +23,10 @@ TrackContentObjectItem::TrackContentObjectItem( TrackItem * _track, trackContent
setAcceptHoverEvents( true );
setCursor( Qt::OpenHandCursor );
// TODO: We will do our own caching to allow common-TCOs to share pixmaps
// But this works for now
setCacheMode( QGraphicsItem::DeviceCoordinateCache );
midiTime startPos = _object->startPosition();
float x = TrackContainerScene::DEFAULT_CELL_WIDTH *
startPos.getTicks() / midiTime::ticksPerTact();
@@ -154,6 +158,7 @@ QVariant TrackContentObjectItem::itemChange( GraphicsItemChange _change, const Q
{
setCursor( Qt::OpenHandCursor );
}
update();
}
return QGraphicsItem::itemChange( _change, _value );