various GUI-fixes and other stuff
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@605 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -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" ),
|
||||
|
||||
@@ -773,7 +773,7 @@ void envelopeAndLFOWidget::paintEvent( QPaintEvent * )
|
||||
static_cast<int>( 255 - 159 * lfo_gray_amount ),
|
||||
static_cast<int>( 128 - 32 *
|
||||
lfo_gray_amount ) ),
|
||||
2 ) );
|
||||
1.5 ) );
|
||||
|
||||
|
||||
float osc_frames = m_lfoOscillationFrames;
|
||||
|
||||
@@ -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() )
|
||||
|
||||
@@ -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<f_cnt_t>( 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<int>( 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<Uint16>(
|
||||
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;
|
||||
|
||||
@@ -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 ) );
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<float>( ( radius - 10 ) / 3.0,
|
||||
0.0 );
|
||||
const float re = tMax<float>( ( 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user