bugfixes and small improvements

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@99 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-03-07 15:34:27 +00:00
parent aeb46d036c
commit a7b37f44a3
14 changed files with 664 additions and 219 deletions

View File

@@ -809,6 +809,14 @@ bool configManager::loadConfigFile( void )
if( value( "paths", "artwork" ) != "" )
{
m_artworkDir = value( "paths", "artwork" );
if( QDir( m_artworkDir ).exists() == FALSE )
{
m_artworkDir = m_dataDir + DEFAULT_THEME_PATH;
}
if( m_artworkDir.right( 1 ) != QDir::separator() )
{
m_artworkDir += QDir::separator();
}
}
m_workingDir = value( "paths", "workingdir" );
m_vstDir = value( "paths", "vstdir" );

View File

@@ -178,7 +178,7 @@ envelopeTabWidget::envelopeTabWidget( channelTrack * _channel_track ) :
m_filterCutKnob = new knob( knobBright_26, m_filterGroupBox, tr(
"cutoff-frequency" ), eng() );
m_filterCutKnob->setLabel( tr( "CUTOFF" ) );
m_filterCutKnob->setRange( 0.0, 16000.0, 1.0 );
m_filterCutKnob->setRange( 0.0, 10000.0, 1.0 );
m_filterCutKnob->move( 140, 18 );
m_filterCutKnob->setInitValue( 16000.0 );
m_filterCutKnob->setHintText( tr( "cutoff-frequency:" ) + " ", " " +

View File

@@ -44,6 +44,7 @@
#include <qlayout.h>
#include <qcursor.h>
#include <qwhatsthis.h>
#include <qtimer.h>
#endif
@@ -976,6 +977,19 @@ void trackOperationsWidget::cloneTrack( void )
void trackOperationsWidget::removeTrack( void )
{
#ifdef QT3
QTimer::singleShot( 10, this, SLOT( removeTrackTimer() ) );
#else
#warning fixme
removeTrackTimer();
#endif
}
void trackOperationsWidget::removeTrackTimer( void )
{
m_trackWidget->getTrack()->getTrackContainer()->removeTrack(
m_trackWidget->getTrack() );

View File

@@ -862,9 +862,10 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab,
void sampleBuffer::drawWaves( QPainter & _p, QRect _dr, drawMethods _dm )
void sampleBuffer::visualize( QPainter & _p, const QRect & _dr,
const QRect & _clip, drawMethods _dm )
{
// _p.setClipRect( _dr );
// _p.setClipRect( _clip );
// _p.setPen( QColor( 0x22, 0xFF, 0x44 ) );
//_p.setPen( QColor( 64, 224, 160 ) );
#ifdef QT4
@@ -877,9 +878,11 @@ void sampleBuffer::drawWaves( QPainter & _p, QRect _dr, drawMethods _dm )
const Uint16 y_base = h / 2 + _dr.y();
const float y_space = h / 2;
const QRect isect = _dr.intersect( _clip );
if( m_data == NULL || m_frames == 0 )
{
_p.drawLine( _dr.x(), y_base, _dr.x() + w, y_base );
_p.drawLine( isect.x(), y_base, isect.right(), y_base );
return;
}
else if( _dm == LINE_CONNECT )
@@ -890,8 +893,8 @@ void sampleBuffer::drawWaves( QPainter & _p, QRect _dr, drawMethods _dm )
const float fpp = tMax<float>( tMin<float>( m_frames / (float)w,
20.0f ), 1.0f );
for( float frame = 0; frame < m_frames; frame += fpp )
const float fmax = tMin<float>( m_frames, isect.right() * fpp );
for( float frame = fpp * _clip.x(); frame < fmax; frame += fpp )
{
const float x = frame*w / m_frames + _dr.x();
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS;
@@ -906,21 +909,25 @@ void sampleBuffer::drawWaves( QPainter & _p, QRect _dr, drawMethods _dm )
old_x = x;
}
#else
int old_x = _dr.x();
int old_y[DEFAULT_CHANNELS] = { y_base, y_base };
const f_cnt_t fpp = tMax<f_cnt_t>( tMin<f_cnt_t>( m_frames / w,
20 ), 1 );
const f_cnt_t fbase = m_frames * _clip.x() / _clip.width();
const f_cnt_t fmax = tMin<f_cnt_t>( m_frames,
_clip.width() * fpp );
int old_x = _clip.x();
//printf("%d\n", fmax );
for( f_cnt_t frame = 0; frame < m_frames; frame += fpp )
{
const int x = static_cast<int>( frame /
(float) m_frames * w ) +
_dr.x();
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
const int x = _dr.x() + static_cast<int>( frame /
(float) m_frames * _dr.width() );
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS;
++chnl )
{
const Uint16 y = y_base +
static_cast<Uint16>( m_data[frame][chnl] * y_space );
static_cast<Uint16>( m_data[frame][chnl] *
y_space );
_p.drawLine( old_x, old_y[chnl], x, y );
old_y[chnl] = y;
}
@@ -934,7 +941,8 @@ void sampleBuffer::drawWaves( QPainter & _p, QRect _dr, drawMethods _dm )
for( f_cnt_t frame = 0; frame < m_frames; ++frame )
{
const int x = frame * w / m_frames + _dr.x();
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS;
++chnl )
{
_p.drawPoint( x, y_base +
static_cast<Uint16>( m_data[frame][chnl] * y_space ) );

View File

@@ -184,17 +184,18 @@ void sampleTCO::mouseDoubleClickEvent( QMouseEvent * )
void sampleTCO::paintEvent( QPaintEvent * )
void sampleTCO::paintEvent( QPaintEvent * _pe )
{
#ifdef QT4
QPainter p( this );
// TODO: set according brush/pen for gradient!
p.fillRect( rect(), QColor( 64, 64, 64 ) );
p.fillRect( _pe->rect(), QColor( 64, 64, 64 ) );
#else
// create pixmap for whole widget
QPixmap pm( size() );
// create pixmap for our widget
QPixmap pm( _pe->rect().size() );
// and a painter for it
QPainter p( &pm );
p.translate( -_pe->rect().x(), -_pe->rect().y() );
for( int y = 1; y < height() - 1; ++y )
{
@@ -225,14 +226,14 @@ void sampleTCO::paintEvent( QPaintEvent * )
tMax( static_cast<int>( getSampleLength() *
pixelsPerTact() / 64 ), 1 ), height() - 4 );
p.setClipRect( QRect( 1, 1, width() - 2, height() - 2 ) );
m_sampleBuffer.drawWaves( p, r );
m_sampleBuffer.visualize( p, r, _pe->rect() );
if( r.width() < width() - 1 )
{
p.drawLine( r.x() + r.width(), r.y() + r.height() / 2,
width() - 2, r.y() + r.height() / 2 );
}
#ifndef QT4
bitBlt( this, rect().topLeft(), &pm );
bitBlt( this, _pe->rect().topLeft(), &pm );
#endif
}

View File

@@ -288,6 +288,10 @@ float knob::getValue( const QPoint & _p )
}
return( new_value );
}
if( eng()->getMainWindow()->isShiftPressed() )
{
return( ( _p.y() - m_origMousePos.y() ) * step() );
}
return( ( _p.y() - m_origMousePos.y() ) * m_pageSize );
}