added a vertical position line
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1685 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
2008-09-22 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* include/song_editor.h:
|
||||
* include/timeline.h:
|
||||
* src/core/timeline.cpp:
|
||||
* src/gui/song_editor.cpp:
|
||||
added a vertical position line
|
||||
|
||||
* src/core/midi/midi_winmm.cpp:
|
||||
added support for MIDI out in WinMM MIDI client
|
||||
|
||||
|
||||
@@ -38,8 +38,18 @@ class lcdSpinBox;
|
||||
class meterDialog;
|
||||
class song;
|
||||
class textFloat;
|
||||
class timeLine;
|
||||
class toolButton;
|
||||
|
||||
class positionLine : public QWidget
|
||||
{
|
||||
public:
|
||||
positionLine( QWidget * _parent );
|
||||
|
||||
private:
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
class songEditor : public trackContainerView
|
||||
@@ -112,6 +122,7 @@ private:
|
||||
|
||||
comboBox * m_zoomingComboBox;
|
||||
|
||||
positionLine * m_positionLine;
|
||||
|
||||
bool m_scrollBack;
|
||||
|
||||
|
||||
@@ -116,6 +116,12 @@ public:
|
||||
return( "timeline" );
|
||||
}
|
||||
|
||||
inline int markerX( const midiTime & _t ) const
|
||||
{
|
||||
return( m_xOffset + static_cast<int>( ( _t - m_begin ) *
|
||||
m_ppt / midiTime::ticksPerTact() ) );
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void updatePosition( const midiTime & );
|
||||
@@ -136,13 +142,6 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
inline int markerX( const midiTime & _t ) const
|
||||
{
|
||||
return( m_xOffset + static_cast<int>( ( _t - m_begin ) *
|
||||
m_ppt / midiTime::ticksPerTact() ) );
|
||||
}
|
||||
|
||||
|
||||
static QPixmap * s_timeLinePixmap;
|
||||
static QPixmap * s_posMarkerPixmap;
|
||||
static QPixmap * s_loopPointPixmap;
|
||||
|
||||
@@ -227,7 +227,6 @@ void timeLine::paintEvent( QPaintEvent * )
|
||||
QColor bg_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Background );
|
||||
QLinearGradient g( 0, 0, 0, height() );
|
||||
// g.setColorAt( 0, bg_color.darker( 250 ) );
|
||||
g.setColorAt( 0, bg_color.lighter( 150 ) );
|
||||
g.setColorAt( 1, bg_color.darker( 150 ) );
|
||||
p.fillRect( 0, 0, width(), height(), g );
|
||||
@@ -235,11 +234,9 @@ void timeLine::paintEvent( QPaintEvent * )
|
||||
p.setClipRect( m_xOffset, 0, width() - m_xOffset, height() );
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
|
||||
const QPixmap & lpoint = *s_loopPointPixmap;
|
||||
|
||||
p.setOpacity( loopPointsEnabled() ? 0.9 : 0.2 );
|
||||
p.drawPixmap( markerX( loopBegin() )+2, 2, lpoint );
|
||||
p.drawPixmap( markerX( loopEnd() )+2, 2, lpoint );
|
||||
p.drawPixmap( markerX( loopBegin() )+2, 2, *s_loopPointPixmap );
|
||||
p.drawPixmap( markerX( loopEnd() )+2, 2, *s_loopPointPixmap );
|
||||
p.setOpacity( 1.0 );
|
||||
|
||||
|
||||
@@ -256,8 +253,8 @@ void timeLine::paintEvent( QPaintEvent * )
|
||||
p.drawLine( cx, 5, cx, height() - 6 );
|
||||
++tact_num;
|
||||
if( ( tact_num - 1 ) %
|
||||
tMax( 1, qRound( 1.0f / 3.0f * midiTime::ticksPerTact() /
|
||||
m_ppt ) ) == 0 )
|
||||
tMax( 1, qRound( 1.0f / 3.0f *
|
||||
midiTime::ticksPerTact() / m_ppt ) ) == 0 )
|
||||
{
|
||||
const QString s = QString::number( tact_num );
|
||||
p.drawText( cx + qRound( ( m_ppt - p.fontMetrics().
|
||||
@@ -266,9 +263,9 @@ void timeLine::paintEvent( QPaintEvent * )
|
||||
}
|
||||
}
|
||||
|
||||
p.setOpacity( 0.75 );
|
||||
p.drawImage( m_posMarkerX, height() - s_posMarkerPixmap->height(),
|
||||
s_posMarkerPixmap->toImage() );
|
||||
p.setOpacity( 0.6 );
|
||||
p.drawPixmap( m_posMarkerX, height() - s_posMarkerPixmap->height(),
|
||||
*s_posMarkerPixmap );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QScrollBar>
|
||||
|
||||
#include <math.h>
|
||||
@@ -53,6 +54,24 @@
|
||||
|
||||
|
||||
|
||||
positionLine::positionLine( QWidget * _parent ) :
|
||||
QWidget( _parent )
|
||||
{
|
||||
setFixedWidth( 3 );
|
||||
setAttribute( Qt::WA_NoSystemBackground, true );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void positionLine::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
QPainter p( this );
|
||||
p.fillRect( rect(), QColor( 0, 0, 0, 153 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
trackContainerView( _song ),
|
||||
@@ -79,6 +98,8 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
connect( tl, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
this, SLOT( updatePosition( const midiTime & ) ) );
|
||||
|
||||
m_positionLine = new positionLine( this );
|
||||
|
||||
|
||||
// add some essential widgets to global tool-bar
|
||||
QWidget * tb = engine::getMainWindow()->toolBar();
|
||||
@@ -228,8 +249,9 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
this, SLOT( record() ), m_toolBar );
|
||||
m_recordAccompanyButton = new toolButton(
|
||||
embed::getIconPixmap( "record_accompany" ),
|
||||
tr( "Record samples from Audio-device while playing song or BB track" ),
|
||||
this, SLOT( recordAccompany() ), m_toolBar );
|
||||
tr( "Record samples from Audio-device while playing "
|
||||
"song or BB track" ),
|
||||
this, SLOT( recordAccompany() ), m_toolBar );
|
||||
|
||||
// FIXME: disable record button while it is not implemented
|
||||
m_recordButton->setDisabled( true );
|
||||
@@ -643,6 +665,20 @@ void songEditor::updatePosition( const midiTime & _t )
|
||||
}
|
||||
m_scrollBack = FALSE;
|
||||
}
|
||||
|
||||
const int x = m_s->m_playPos[song::Mode_PlaySong].m_timeLine->
|
||||
markerX( _t ) + 7;
|
||||
if( x >= TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH-1 )
|
||||
{
|
||||
m_positionLine->show();
|
||||
m_positionLine->move( x, 50 );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_positionLine->hide();
|
||||
}
|
||||
|
||||
m_positionLine->setFixedHeight( height() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user