diff --git a/ChangeLog b/ChangeLog index 47133afa88..9ebb29ca03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2007-11-21 Tobias Doerffel + + * src/lib/sample_buffer.cpp: + - duplicate ASCII-string from file.toAscii().constData() in order to not + get corrupted - fixes random problems with loading OGG-files + - sample-visualization now floating-point-based + + * src/widgets/combobox.cpp: + fixed text-drawing + + * src/widgets/led_checkbox.cpp: + * src/widgets/tab_widget.cpp: + added workarounds for obviously non-working font-property + + * src/widgets/knob.cpp: + - knob::drawKnob( ... ) now completely works with floats + - use anti-aliasing when drawing tick + + * src/tracks/sample_track.cpp: + fixed painting of sample-TCO's + + * src/core/arp_and_chords_tab_widget.cpp: + removed obviously non-working comboBox::setFont( ... )-calls + + * src/core/envelope_and_lfo_widget.cpp: + use line-width of 1.5 instead of 2 for drawing LFO + + * src/core/main.cpp: + do not set default font-size + + * data/locale/de.ts: + * data/locale/de.qm: + fixed German localization + 2007-11-20 Javier Serrano Polo * include/drumsynth.h: diff --git a/data/locale/de.qm b/data/locale/de.qm index 38ebda7e3a..b9d637de8c 100644 Binary files a/data/locale/de.qm and b/data/locale/de.qm differ diff --git a/data/locale/de.ts b/data/locale/de.ts index 89452456d7..c73e85e1a3 100644 --- a/data/locale/de.ts +++ b/data/locale/de.ts @@ -1844,7 +1844,7 @@ installiert sind. Soll der Einrichtungsassistent jetzt gestartet werden? MODULATE ENV-AMOUNT - HK.INTENS. MODULIEREN + HÜLLK. MODULIEREN diff --git a/src/core/arp_and_chords_tab_widget.cpp b/src/core/arp_and_chords_tab_widget.cpp index 85198c1fe8..249a5f66df 100644 --- a/src/core/arp_and_chords_tab_widget.cpp +++ b/src/core/arp_and_chords_tab_widget.cpp @@ -190,7 +190,6 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( m_chordsComboBox = new comboBox( m_chordsGroupBox, tr( "Chord type" ), _instrument_track ); - m_chordsComboBox->setFont( pointSize<8>( m_chordsComboBox->font() ) ); m_chordsComboBox->setGeometry( 10, 25, 140, 22 ); for( int i = 0; s_chords[i].interval[0] != -1; ++i ) @@ -233,7 +232,6 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( "possible chords, you can select." ) ); m_arpComboBox = new comboBox( m_arpGroupBox, tr( "Arpeggio type" ), _instrument_track ); - m_arpComboBox->setFont( pointSize<8>( m_arpComboBox->font() ) ); m_arpComboBox->setGeometry( 10, 25, 140, 22 ); for( int i = 0; s_chords[i].interval[0] != -1; ++i ) @@ -345,7 +343,6 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( m_arpModeComboBox = new comboBox( m_arpGroupBox, tr( "Arpeggio mode" ), _instrument_track ); - m_arpModeComboBox->setFont( pointSize<8>( m_arpModeComboBox->font() ) ); m_arpModeComboBox->setGeometry( 10, 118, 128, 22 ); m_arpModeComboBox->addItem( tr( "Free" ), diff --git a/src/core/envelope_and_lfo_widget.cpp b/src/core/envelope_and_lfo_widget.cpp index 9151e71384..c76972115e 100644 --- a/src/core/envelope_and_lfo_widget.cpp +++ b/src/core/envelope_and_lfo_widget.cpp @@ -773,7 +773,7 @@ void envelopeAndLFOWidget::paintEvent( QPaintEvent * ) static_cast( 255 - 159 * lfo_gray_amount ), static_cast( 128 - 32 * lfo_gray_amount ) ), - 2 ) ); + 1.5 ) ); float osc_frames = m_lfoOscillationFrames; diff --git a/src/core/main.cpp b/src/core/main.cpp index 474456728f..18b7e28d1d 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -161,7 +161,7 @@ int main( int argc, char * * argv ) // load actual translation for LMMS loadTranslation( pos ); - app.setFont( pointSize<10>( app.font() ) ); +// app.setFont( pointSize<10>( app.font() ) ); if( !configManager::inst()->loadConfigFile() ) diff --git a/src/lib/sample_buffer.cpp b/src/lib/sample_buffer.cpp index 71d5cfcc6f..6d3a2a69c1 100644 --- a/src/lib/sample_buffer.cpp +++ b/src/lib/sample_buffer.cpp @@ -200,7 +200,7 @@ void sampleBuffer::update( bool _keep_settings ) else if( m_audioFile != "" ) { QString file = tryToMakeAbsolute( m_audioFile ); - const char * f = file.toAscii().constData(); + char * f = qstrdup( file.toAscii().constData() ); int_sample_t * buf = NULL; ch_cnt_t channels = DEFAULT_CHANNELS; sample_rate_t samplerate = SAMPLE_RATES[DEFAULT_QUALITY_LEVEL]; @@ -234,6 +234,8 @@ void sampleBuffer::update( bool _keep_settings ) samplerate ); } + delete[] f; + if( m_frames > 0 && buf != NULL ) { // following code transforms int-samples into @@ -764,24 +766,25 @@ void sampleBuffer::visualize( QPainter & _p, const QRect & _dr, const int w = _dr.width(); const int h = _dr.height(); - const Uint16 y_base = h / 2 + _dr.y(); + const float y_base = h / 2 + _dr.y(); const float y_space = h / 2; const QRect isect = _dr.intersect( _clip ); int old_y[DEFAULT_CHANNELS] = { y_base, y_base }; + _p.setPen( QPen( _p.pen().color(), 0.5 ) ); const f_cnt_t fpp = tLimit( m_frames / w, 1, 20 ); int old_x = _clip.x(); for( f_cnt_t frame = 0; frame < m_frames; frame += fpp ) { - const int x = _dr.x() + static_cast( frame / + const float x = _dr.x() + ( frame / (float) m_frames * _dr.width() ); for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl ) { - const Uint16 y = y_base - static_cast( + const Uint16 y = y_base - ( m_data[frame][chnl] * y_space ); - _p.drawLine( old_x, old_y[chnl], x, y ); + _p.drawLine( QLineF( old_x, old_y[chnl], x, y+0.5 ) ); old_y[chnl] = y; } old_x = x; diff --git a/src/tracks/sample_track.cpp b/src/tracks/sample_track.cpp index d6dbf29b0a..6e27138670 100644 --- a/src/tracks/sample_track.cpp +++ b/src/tracks/sample_track.cpp @@ -164,32 +164,22 @@ void sampleTCO::mouseDoubleClickEvent( QMouseEvent * ) void sampleTCO::paintEvent( QPaintEvent * _pe ) { QPainter p( this ); -#warning TODO: set according brush for gradient! - p.fillRect( _pe->rect(), QColor( 64, 64, 64 ) ); -#if 0 - // 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 ) + QLinearGradient grad( 0, 0, 0, height() ); + if( isSelected() ) { - const int gray = 96 - y * 96 / height(); - if( isSelected() == TRUE ) - { - p.setPen( QColor( 0, 0, 128 + gray ) ); - } - else - { - p.setPen( QColor( gray, gray, gray ) ); - } - p.drawLine( 1, y, width() - 1, y ); + grad.setColorAt( 1, QColor( 0, 0, 224 ) ); + grad.setColorAt( 0, QColor( 0, 0, 128 ) ); } -#endif + else + { + grad.setColorAt( 0, QColor( 96, 96, 96 ) ); + grad.setColorAt( 1, QColor( 16, 16, 16 ) ); + } + p.fillRect( _pe->rect(), grad ); p.setPen( QColor( 0, 0, 0 ) ); - p.drawRect( 0, 0, width(), height() ); + p.drawRect( 0, 0, width()-1, height()-1 ); if( getTrack()->muted() || muted() ) { p.setPen( QColor( 128, 128, 128 ) ); diff --git a/src/widgets/combobox.cpp b/src/widgets/combobox.cpp index 0e30135e35..edfb51ffda 100644 --- a/src/widgets/combobox.cpp +++ b/src/widgets/combobox.cpp @@ -64,7 +64,7 @@ comboBox::comboBox( QWidget * _parent, const QString & _name, track * _track ) : "combobox_arrow" ) ); } - setFont( pointSize<8>( font() ) ); + setFont( pointSize<9>( font() ) ); m_menu.setFont( pointSize<8>( m_menu.font() ) ); connect( &m_menu, SIGNAL( triggered( QAction * ) ), @@ -243,10 +243,10 @@ void comboBox::paintEvent( QPaintEvent * _pe ) tx += item_pm.width() + 2; } p.setPen( QColor( 64, 64, 64 ) ); - p.drawText( tx+1, p.fontMetrics().height()+1, + p.drawText( tx+1, p.fontMetrics().height()-1, m_items[value()].first ); p.setPen( QColor( 224, 224, 224 ) ); - p.drawText( tx, p.fontMetrics().height(), + p.drawText( tx, p.fontMetrics().height()-2, m_items[value()].first ); } } diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index 2028fa3284..1f319690f7 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -159,9 +159,9 @@ void knob::setTotalAngle( float _angle ) void knob::drawKnob( QPainter * _p ) { - const float radius = m_knobPixmap->width() / 2 - 1; - const float xm = m_knobPixmap->width() / 2;//radius + 1; - const float ym = m_knobPixmap->height() / 2;//radius+1; + const float radius = m_knobPixmap->width() / 2.0f - 1; + const float xm = m_knobPixmap->width() / 2.0f;//radius + 1; + const float ym = m_knobPixmap->height() / 2.0f;//radius+1; const float rarc = m_angle * M_PI / 180.0; const float ca = cos( rarc ); @@ -171,21 +171,22 @@ void knob::drawKnob( QPainter * _p ) *m_knobPixmap ); _p->setPen( QPen( QColor( 200, 0, 0 ), 2 ) ); + _p->setRenderHint( QPainter::Antialiasing ); switch( m_knobNum ) { case knobSmall_17: { - _p->drawLine( (int)( xm-sa ), (int)( ym-ca ), - (int)( xm - sa*radius ), - (int)( ym - ca*radius ) ); + _p->drawLine( QLineF( xm-sa, ym-ca, + xm - sa*radius, + ym - ca*radius ) ); break; } case knobBright_26: { - _p->drawLine( (int)( xm-sa ), (int)( ym-ca ), - (int)( xm - sa*( radius-5 ) ), - (int)( ym - ca*( radius-5 ) ) ); + _p->drawLine( QLineF( xm-sa, ym-ca, + xm - sa*( radius-5 ), + ym - ca*( radius-5 ) ) ); break; } case knobDark_28: @@ -193,18 +194,18 @@ void knob::drawKnob( QPainter * _p ) const float rb = tMax( ( radius - 10 ) / 3.0, 0.0 ); const float re = tMax( ( radius - 4 ), 0.0 ); - _p->drawLine( (int)( xm-sa*rb ) + 1, - (int)( ym - ca*rb ) + 1, - (int)( xm - sa*re ) + 1, - (int)( ym - ca*re ) + 1 ); + _p->drawLine( QLineF( xm-sa*rb + 1, + ym - ca*rb + 1, + xm - sa*re + 1, + ym - ca*re + 1 ) ); break; } case knobGreen_17: { _p->setPen( QPen( QColor( 0, 200, 0 ), 2 ) ); - _p->drawLine( (int)( xm-sa ), (int)( ym-ca ), - (int)( xm - sa*radius ), - (int)( ym - ca*radius ) ); + _p->drawLine( QLineF( xm-sa, ym-ca, + xm - sa*radius, + ym - ca*radius ) ); break; } } diff --git a/src/widgets/led_checkbox.cpp b/src/widgets/led_checkbox.cpp index f841bc0a8e..07f42a61ce 100644 --- a/src/widgets/led_checkbox.cpp +++ b/src/widgets/led_checkbox.cpp @@ -59,7 +59,7 @@ ledCheckBox::ledCheckBox( const QString & _text, QWidget * _parent, names[_color].toAscii().constData() ) ); m_ledOffPixmap = new QPixmap( embed::getIconPixmap( "led_off" ) ); - setFont( pointSizeF( font(), 7.5f ) ); + setFont( pointSize<7>( font() ) ); setFixedSize( m_ledOffPixmap->width() + 4 + QFontMetrics( font() ).width( text() ), m_ledOffPixmap->height() ); @@ -80,6 +80,7 @@ ledCheckBox::~ledCheckBox() void ledCheckBox::paintEvent( QPaintEvent * ) { QPainter p( this ); + p.setFont( pointSize<7>( font() ) ); if( isChecked() == TRUE ) { @@ -91,9 +92,9 @@ void ledCheckBox::paintEvent( QPaintEvent * ) } p.setPen( QColor( 64, 64, 64 ) ); - p.drawText( m_ledOffPixmap->width() + 3, 9, text() ); + p.drawText( m_ledOffPixmap->width() + 3, 10, text() ); p.setPen( QColor( 255, 255, 255 ) ); - p.drawText( m_ledOffPixmap->width() + 2, 8, text() ); + p.drawText( m_ledOffPixmap->width() + 2, 9, text() ); } diff --git a/src/widgets/tab_widget.cpp b/src/widgets/tab_widget.cpp index a93af227d6..070ea35104 100644 --- a/src/widgets/tab_widget.cpp +++ b/src/widgets/tab_widget.cpp @@ -64,6 +64,7 @@ tabWidget::~tabWidget() void tabWidget::addTab( QWidget * _w, const QString & _name, int _idx ) { + setFont( pointSize<7>( font() ) ); widgetDesc d = { _w, _name, fontMetrics().width( _name ) + 10 } ; if( _idx < 0/* || m_widgets.contains( _idx ) == TRUE*/ ) { @@ -145,6 +146,7 @@ void tabWidget::resizeEvent( QResizeEvent * ) void tabWidget::paintEvent( QPaintEvent * _pe ) { + setFont( pointSize<7>( font() ) ); QPainter p( this ); p.fillRect( 0, 0, width() - 1, height() - 1, QColor( 96, 96, 96 ) ); @@ -169,7 +171,6 @@ void tabWidget::paintEvent( QPaintEvent * _pe ) if( !big_tab_captions ) { p.setPen( QColor( 255, 255, 255 ) ); - p.setFont( font() ); p.drawText( 5, 10, m_caption ); }