GUI-improvements, zooming-selectboxes in piano-roll and song-editor and more
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@12 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -183,9 +183,9 @@ arpAndChordsTabWidget::chord arpAndChordsTabWidget::s_chords[] =
|
||||
} ;
|
||||
|
||||
|
||||
const int CHORDS_GROUPBOX_X = 5;
|
||||
const int CHORDS_GROUPBOX_X = 4;
|
||||
const int CHORDS_GROUPBOX_Y = 5;
|
||||
const int CHORDS_GROUPBOX_WIDTH = 240;
|
||||
const int CHORDS_GROUPBOX_WIDTH = 238;
|
||||
const int CHORDS_GROUPBOX_HEIGHT = 65;
|
||||
const int ARP_GROUPBOX_X = CHORDS_GROUPBOX_X;
|
||||
const int ARP_GROUPBOX_Y = 10 + CHORDS_GROUPBOX_Y + CHORDS_GROUPBOX_HEIGHT;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "debug.h"
|
||||
#include "tooltip.h"
|
||||
#include "gui_templates.h"
|
||||
#include "led_checkbox.h"
|
||||
|
||||
|
||||
// how long should be each envelope-segment maximal (e.g. attack)?
|
||||
@@ -66,8 +67,8 @@ const float SECS_PER_ENV_SEGMENT = 5.0f;
|
||||
const float SECS_PER_LFO_OSCILLATION = 20.0f;
|
||||
|
||||
|
||||
const int env_graph_x = 8;
|
||||
const int env_graph_y = 8;
|
||||
const int env_graph_x = 6;
|
||||
const int env_graph_y = 6;
|
||||
|
||||
const int env_knobs_y = 43;
|
||||
const int env_knobs_lbl_y = env_knobs_y+35;
|
||||
@@ -83,7 +84,7 @@ const int amount_knob_x = release_knob_x+knob_x_spacing;
|
||||
const float time_unit_width = 36.0;
|
||||
|
||||
|
||||
const int lfo_graph_x = 8;
|
||||
const int lfo_graph_x = 6;
|
||||
const int lfo_graph_y = env_knobs_lbl_y+14;
|
||||
const int lfo_knob_y = lfo_graph_y-2;
|
||||
const int lfo_knobs_lbl_y = lfo_knob_y+35;
|
||||
@@ -409,54 +410,34 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount,
|
||||
lfo_shapes_algo_group->hide();
|
||||
#endif
|
||||
|
||||
m_x100Btn = new pixmapButton( this );
|
||||
m_x100Btn->move( lfo_predelay_knob_x, lfo_graph_y + 36 );
|
||||
m_x100Btn->setBgGraphic( specialBgHandlingWidget::getBackground(
|
||||
m_x100Btn ) );
|
||||
|
||||
/* m_x100Btn->setActiveGraphic( embed::getIconPixmap( "x100_active" ) );
|
||||
m_x100Btn->setInactiveGraphic( embed::getIconPixmap(
|
||||
"x100_inactive" ) );*/
|
||||
m_x100Btn->setBgGraphic(
|
||||
specialBgHandlingWidget::getBackground( m_x100Btn ) );
|
||||
m_x100Cb = new ledCheckBox( tr( "FREQ x 100" ), this );
|
||||
m_x100Cb->setFont( pointSize<6>( m_x100Cb->font() ) );
|
||||
m_x100Cb->move( lfo_predelay_knob_x, lfo_graph_y + 36 );
|
||||
#ifdef QT4
|
||||
m_x100Btn->setWhatsThis(
|
||||
m_x100Cb->setWhatsThis(
|
||||
#else
|
||||
QWhatsThis::add( m_x100Btn,
|
||||
QWhatsThis::add( m_x100Cb,
|
||||
#endif
|
||||
tr( "Click here if the frequency of this LFO should be "
|
||||
"multiplied with 100." ) );
|
||||
toolTip::add( m_x100Btn, tr( "multiply LFO-frequency with 100" ) );
|
||||
connect( m_x100Btn, SIGNAL( toggled( bool ) ), this,
|
||||
toolTip::add( m_x100Cb, tr( "multiply LFO-frequency with 100" ) );
|
||||
connect( m_x100Cb, SIGNAL( toggled( bool ) ), this,
|
||||
SLOT( x100Toggled( bool ) ) );
|
||||
|
||||
QLabel * x100_lbl = new QLabel( tr( "FREQ x 100" ), this );
|
||||
x100_lbl->setFont( pointSize<6>( x100_lbl->font() ) );
|
||||
x100_lbl->move( m_x100Btn->x() + 16, m_x100Btn->y() );
|
||||
x100_lbl->setFixedHeight( 10 );
|
||||
|
||||
m_controlEnvAmountBtn = new pixmapButton( this );
|
||||
m_controlEnvAmountBtn->move( lfo_predelay_knob_x, lfo_graph_y + 54 );
|
||||
m_controlEnvAmountBtn->setBgGraphic(
|
||||
specialBgHandlingWidget::getBackground(
|
||||
m_controlEnvAmountBtn ) );
|
||||
/* m_controlEnvAmountBtn->setActiveGraphic( embed::getIconPixmap(
|
||||
"control_env_amount_active" ) );
|
||||
m_controlEnvAmountBtn->setInactiveGraphic( embed::getIconPixmap(
|
||||
"control_env_amount_inactive" ) );*/
|
||||
m_controlEnvAmountCb = new ledCheckBox( tr( "MODULATE ENV-AMOUNT" ),
|
||||
this );
|
||||
m_controlEnvAmountCb->move( lfo_predelay_knob_x, lfo_graph_y + 54 );
|
||||
m_controlEnvAmountCb->setFont( pointSize<6>(
|
||||
m_controlEnvAmountCb->font() ) );
|
||||
#ifdef QT4
|
||||
m_controlEnvAmountBtn ->setWhatsThis(
|
||||
m_controlEnvAmountCb ->setWhatsThis(
|
||||
#else
|
||||
QWhatsThis::add( m_controlEnvAmountBtn,
|
||||
QWhatsThis::add( m_controlEnvAmountCb,
|
||||
#endif
|
||||
tr( "Click here to make the envelope-amount controlled by this "
|
||||
"LFO." ) );
|
||||
QLabel * cea_lbl = new QLabel( tr( "MODULATE ENV-AMOUNT" ), this );
|
||||
cea_lbl->setFont( pointSize<6>( cea_lbl->font() ) );
|
||||
cea_lbl->move( m_controlEnvAmountBtn->x() + 16,
|
||||
m_controlEnvAmountBtn->y() );
|
||||
cea_lbl->setFixedSize( 110, 10 );
|
||||
toolTip::add( m_controlEnvAmountBtn,
|
||||
toolTip::add( m_controlEnvAmountCb,
|
||||
tr( "control envelope-amount by this LFO" ) );
|
||||
|
||||
|
||||
@@ -534,7 +515,7 @@ float FASTCALL envelopeAndLFOWidget::level( Uint32 _frame,
|
||||
}
|
||||
if( _frame < m_pahdFrames )
|
||||
{
|
||||
if( m_controlEnvAmountBtn->isChecked() )
|
||||
if( m_controlEnvAmountCb->isChecked() )
|
||||
{
|
||||
return( m_pahdEnv[_frame] * ( 0.5f +
|
||||
lfoLevel( _frame, _frame_offset ) ) );
|
||||
@@ -550,7 +531,7 @@ float FASTCALL envelopeAndLFOWidget::level( Uint32 _frame,
|
||||
_frame -= _release_begin;
|
||||
if( _frame < m_rFrames )
|
||||
{
|
||||
if( m_controlEnvAmountBtn->isChecked() )
|
||||
if( m_controlEnvAmountCb->isChecked() )
|
||||
{
|
||||
return( m_rEnv[_frame] * ( 0.5f +
|
||||
lfoLevel( _frame, _frame_offset ) ) );
|
||||
@@ -566,7 +547,7 @@ float FASTCALL envelopeAndLFOWidget::level( Uint32 _frame,
|
||||
return( 0.0f );
|
||||
}
|
||||
}
|
||||
if( m_controlEnvAmountBtn->isChecked() )
|
||||
if( m_controlEnvAmountCb->isChecked() )
|
||||
{
|
||||
return( m_sustainLevel * ( 0.5f +
|
||||
lfoLevel( _frame, _frame_offset ) ) );
|
||||
@@ -600,9 +581,9 @@ void envelopeAndLFOWidget::saveSettings( QDomDocument & ,
|
||||
_parent.setAttribute( "lamt", QString::number(
|
||||
m_lfoAmountKnob->value() ) );
|
||||
_parent.setAttribute( "x100", QString::number(
|
||||
m_x100Btn->isChecked() ) );
|
||||
m_x100Cb->isChecked() ) );
|
||||
_parent.setAttribute( "ctlenvamt", QString::number(
|
||||
m_controlEnvAmountBtn->isChecked() ) );
|
||||
m_controlEnvAmountCb->isChecked() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -625,8 +606,8 @@ void envelopeAndLFOWidget::loadSettings( const QDomElement & _this )
|
||||
m_lfoAttackKnob->setValue( _this.attribute( "latt" ).toFloat() );
|
||||
m_lfoSpeedKnob->setValue( _this.attribute( "lspd" ).toFloat() );
|
||||
m_lfoAmountKnob->setValue( _this.attribute( "lamt" ).toFloat() );
|
||||
m_x100Btn->setChecked( _this.attribute( "x100" ).toInt() );
|
||||
m_controlEnvAmountBtn->setChecked( _this.attribute(
|
||||
m_x100Cb->setChecked( _this.attribute( "x100" ).toInt() );
|
||||
m_controlEnvAmountCb->setChecked( _this.attribute(
|
||||
"ctlenvamt" ).toInt() );
|
||||
|
||||
switch( m_lfoShape )
|
||||
@@ -760,7 +741,7 @@ void envelopeAndLFOWidget::paintEvent( QPaintEvent * )
|
||||
|
||||
float osc_frames = m_lfoOscillationFrames;
|
||||
|
||||
if( m_x100Btn->isChecked() )
|
||||
if( m_x100Cb->isChecked() )
|
||||
{
|
||||
osc_frames *= 100.0f;
|
||||
}
|
||||
@@ -972,7 +953,7 @@ void envelopeAndLFOWidget::updateSampleVars( void )
|
||||
m_lfoOscillationFrames = static_cast<Uint32>(
|
||||
frames_per_lfo_oscillation *
|
||||
m_lfoSpeedKnob->value() );
|
||||
if( m_x100Btn->isChecked() )
|
||||
if( m_x100Cb->isChecked() )
|
||||
{
|
||||
m_lfoOscillationFrames /= 100;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
const int TARGETS_TABWIDGET_X = 4;
|
||||
const int TARGETS_TABWIDGET_Y = 5;
|
||||
const int TARGETS_TABWIDGET_WIDTH = 240;
|
||||
const int TARGETS_TABWIDGET_WIDTH = 238;
|
||||
const int TARGETS_TABWIDGET_HEIGTH = 175;
|
||||
|
||||
const int FILTER_GROUPBOX_X = TARGETS_TABWIDGET_X;
|
||||
|
||||
@@ -32,12 +32,14 @@
|
||||
#include <QPainter>
|
||||
#include <QKeyEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QComboBox>
|
||||
|
||||
#else
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qpainter.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#define setChecked setOn
|
||||
|
||||
@@ -111,6 +113,8 @@ pianoRoll::pianoRollKeyTypes pianoRoll::prKeyOrder[] =
|
||||
} ;
|
||||
|
||||
|
||||
const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * MAX_BEATS_PER_TACT;
|
||||
|
||||
|
||||
pianoRoll::pianoRoll( void ) :
|
||||
QWidget( lmmsMainWin::inst()->workspace() ),
|
||||
@@ -122,7 +126,7 @@ pianoRoll::pianoRoll( void ) :
|
||||
m_moveStartKey( 0 ),
|
||||
m_moveStartTact64th( 0 ),
|
||||
m_notesEditHeight( 100 ),
|
||||
m_ppt( KEY_LINE_HEIGHT * MAX_BEATS_PER_TACT ),
|
||||
m_ppt( DEFAULT_PR_PPT ),
|
||||
m_lenOfNewNotes( midiTime( 0, 16 ) ),
|
||||
m_shiftPressed( FALSE ),
|
||||
m_controlPressed( FALSE ),
|
||||
@@ -413,6 +417,21 @@ pianoRoll::pianoRoll( void ) :
|
||||
"pasted at the first visible tact." ) );
|
||||
|
||||
|
||||
|
||||
// setup zooming-stuff
|
||||
m_zoomingComboBox = new QComboBox( this );
|
||||
m_zoomingComboBox->setGeometry( 580, 10, 60, 20 );
|
||||
for( int i = 0; i < 6; ++i )
|
||||
{
|
||||
m_zoomingComboBox->insertItem( QString::number( 25 *
|
||||
static_cast<int>( powf( 2.0f, i ) ) ) +
|
||||
"%" );
|
||||
}
|
||||
m_zoomingComboBox->setCurrentText( "100%" );
|
||||
connect( m_zoomingComboBox, SIGNAL( activated( const QString & ) ),
|
||||
this, SLOT( zoomingChanged( const QString & ) ) );
|
||||
|
||||
|
||||
// setup our actual window
|
||||
setWindowIcon( embed::getIconPixmap( "piano" ) );
|
||||
resize( INITIAL_PIANOROLL_WIDTH, INITIAL_PIANOROLL_HEIGHT );
|
||||
@@ -1910,6 +1929,11 @@ void pianoRoll::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
m_ppt /= 2;
|
||||
}
|
||||
// update combobox with zooming-factor
|
||||
m_zoomingComboBox->setCurrentText( QString::number(
|
||||
static_cast<int>( m_ppt * 100 /
|
||||
DEFAULT_PR_PPT ) ) +"%" );
|
||||
// update timeline
|
||||
m_timeLine->setPixelsPerTact( m_ppt );
|
||||
update();
|
||||
}
|
||||
@@ -2343,6 +2367,20 @@ void pianoRoll::updatePosition( const midiTime & _t )
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::zoomingChanged( const QString & _zfac )
|
||||
{
|
||||
m_ppt = _zfac.left( _zfac.length() - 1 ).toInt() * DEFAULT_PR_PPT / 100;
|
||||
#ifdef LMMS_DEBUG
|
||||
assert( m_ppt > 0 );
|
||||
#endif
|
||||
m_timeLine->setPixelsPerTact( m_ppt );
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#undef setChecked
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <QStatusBar>
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
#include <QComboBox>
|
||||
|
||||
#else
|
||||
|
||||
@@ -58,6 +59,7 @@
|
||||
#include <qlabel.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <qstatusbar.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -116,13 +118,13 @@ songEditor::songEditor() :
|
||||
m_controlPressed( FALSE )
|
||||
{
|
||||
// hack, because code called out of this function uses
|
||||
// songEditor::inst(), which assigns s_instanceOfMe after return
|
||||
// of this function...
|
||||
// songEditor::inst(), which assigns s_instanceOfMe this function
|
||||
// returns...
|
||||
s_instanceOfMe = this;
|
||||
|
||||
setWindowTitle( tr( "Song-Editor" ) );
|
||||
setWindowIcon( embed::getIconPixmap( "songeditor" ) );
|
||||
setGeometry( 10, 10, 640, 300 );
|
||||
setGeometry( 10, 10, 680, 300 );
|
||||
show();
|
||||
|
||||
#ifdef QT4
|
||||
@@ -442,9 +444,26 @@ songEditor::songEditor() :
|
||||
"removed." ) );
|
||||
#endif
|
||||
|
||||
edit_tb->addSeparator();
|
||||
|
||||
// setup zooming-stuff
|
||||
m_zoomingComboBox = new QComboBox( edit_tb );
|
||||
m_zoomingComboBox->setGeometry( 580, 10, 60, 20 );
|
||||
for( int i = 0; i < 7; ++i )
|
||||
{
|
||||
m_zoomingComboBox->insertItem( QString::number( 25 *
|
||||
static_cast<int>( powf( 2.0f, i ) ) ) +
|
||||
"%" );
|
||||
}
|
||||
m_zoomingComboBox->setCurrentText( "100%" );
|
||||
connect( m_zoomingComboBox, SIGNAL( activated( const QString & ) ),
|
||||
this, SLOT( zoomingChanged( const QString & ) ) );
|
||||
|
||||
|
||||
|
||||
m_projectNotes = new projectNotes();
|
||||
m_projectNotes->resize( 300, 200 );
|
||||
m_projectNotes->move( 640, 10 );
|
||||
m_projectNotes->move( 700, 10 );
|
||||
m_projectNotes->show();
|
||||
|
||||
|
||||
@@ -601,8 +620,14 @@ void songEditor::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
setPixelsPerTact( (int) pixelsPerTact() / 2 );
|
||||
}
|
||||
// update combobox with zooming-factor
|
||||
m_zoomingComboBox->setCurrentText( QString::number(
|
||||
static_cast<int>( pixelsPerTact() *
|
||||
100 / DEFAULT_PIXELS_PER_TACT ) ) +"%" );
|
||||
// update timeline
|
||||
m_playPos[PLAY_SONG].m_timeLine->setPixelsPerTact(
|
||||
pixelsPerTact() );
|
||||
// and make sure, all TCO's are resized and relocated
|
||||
realignTracks( TRUE );
|
||||
}
|
||||
else if( m_shiftPressed )
|
||||
@@ -717,6 +742,17 @@ void songEditor::updatePosition( const midiTime & _t )
|
||||
|
||||
|
||||
|
||||
void songEditor::zoomingChanged( const QString & _zfac )
|
||||
{
|
||||
setPixelsPerTact( _zfac.left( _zfac.length() - 1 ).toInt() *
|
||||
DEFAULT_PIXELS_PER_TACT / 100 );
|
||||
m_playPos[PLAY_SONG].m_timeLine->setPixelsPerTact( pixelsPerTact() );
|
||||
realignTracks( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void songEditor::setBPM( int _new_bpm )
|
||||
{
|
||||
m_bpmSpinBox->setValue( tLimit( _new_bpm, MIN_BPM, MAX_BPM ) );
|
||||
|
||||
@@ -54,8 +54,6 @@
|
||||
|
||||
|
||||
|
||||
const Uint16 DEFAULT_PIXELS_PER_TACT = 16;
|
||||
|
||||
|
||||
trackContainer::trackContainer() :
|
||||
QMainWindow( lmmsMainWin::inst()->workspace()
|
||||
|
||||
@@ -35,9 +35,6 @@
|
||||
#include <qfontmetrics.h>
|
||||
#include <qpainter.h>
|
||||
|
||||
#define setChecked setOn
|
||||
#define isChecked isOn
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -103,11 +100,7 @@ void ledCheckBox::paintEvent( QPaintEvent * )
|
||||
#endif
|
||||
p.drawPixmap( 0, 0, specialBgHandlingWidget::getBackground( this ) );
|
||||
|
||||
#ifdef QT4
|
||||
if( checkState() == Qt::Checked )
|
||||
#else
|
||||
if( state() == On )
|
||||
#endif
|
||||
if( isChecked() == TRUE )
|
||||
{
|
||||
p.drawPixmap( 0, 0, *m_ledOnPixmap );
|
||||
}
|
||||
@@ -125,6 +118,3 @@ void ledCheckBox::paintEvent( QPaintEvent * )
|
||||
}
|
||||
|
||||
|
||||
#undef setChecked
|
||||
#undef isChecked
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#else
|
||||
|
||||
@@ -45,7 +46,10 @@
|
||||
|
||||
tabWidget::tabWidget( const QString & _caption, QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_curWidget( 0 ),
|
||||
#ifndef QT4
|
||||
specialBgHandlingWidget( QColor( 96, 96, 96 ) ),
|
||||
#endif
|
||||
m_activeTab( 0 ),
|
||||
m_caption( _caption )
|
||||
{
|
||||
setFont( pointSize<7>( font() ) );
|
||||
@@ -55,7 +59,7 @@ tabWidget::tabWidget( const QString & _caption, QWidget * _parent ) :
|
||||
setPalette( pal );
|
||||
#else
|
||||
setPaletteBackgroundColor( QColor( 96, 96, 96 ) );
|
||||
//setBackgroundMode( Qt::NoBackground );
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -68,14 +72,25 @@ tabWidget::~tabWidget()
|
||||
|
||||
|
||||
|
||||
void tabWidget::addTab( QWidget * _w, const QString & _name )
|
||||
|
||||
void tabWidget::addTab( QWidget * _w, const QString & _name, int _idx )
|
||||
{
|
||||
widgetDesc d = { _w, _name, fontMetrics().width( _name ) + 10 } ;
|
||||
m_widgets.push_back( d );
|
||||
// make sure new tab doesn't overlap current widget
|
||||
m_widgets[m_curWidget].w->raise();
|
||||
widgetDesc d = { _w, _name, fontMetrics().width( _name ) + 10 } ;
|
||||
if( _idx < 0 || m_widgets.contains( _idx ) == TRUE )
|
||||
{
|
||||
while( m_widgets.contains( ++_idx ) == TRUE )
|
||||
{
|
||||
}
|
||||
}
|
||||
m_widgets[_idx] = d;
|
||||
_w->setFixedSize( width() - 4, height() - 14 );
|
||||
_w->move( 2, 12 );
|
||||
|
||||
if( m_widgets.contains( m_activeTab ) )
|
||||
{
|
||||
// make sure new tab doesn't overlap current widget
|
||||
m_widgets[m_activeTab].w->raise();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,18 +100,20 @@ void tabWidget::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->y() > 1 && _me->y() < 13 )
|
||||
{
|
||||
int cx = 14 + fontMetrics().width( m_caption );
|
||||
int cx = ( ( m_caption == "" ) ? 4 : 14 ) +
|
||||
fontMetrics().width( m_caption );
|
||||
for( widgetStack::iterator it = m_widgets.begin();
|
||||
it != m_widgets.end(); ++it )
|
||||
{
|
||||
if( _me->x() >= cx && _me->x() <= cx + it->nwidth )
|
||||
if( _me->x() >= cx &&
|
||||
_me->x() <= cx + ( *it ).nwidth )
|
||||
{
|
||||
it->w->raise();
|
||||
m_curWidget = it - m_widgets.begin();
|
||||
( *it ).w->raise();
|
||||
m_activeTab = it.key();
|
||||
update();
|
||||
return;
|
||||
}
|
||||
cx += it->nwidth;
|
||||
cx += ( *it ).nwidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +126,7 @@ void tabWidget::resizeEvent( QResizeEvent * )
|
||||
for( widgetStack::iterator it = m_widgets.begin();
|
||||
it != m_widgets.end(); ++it )
|
||||
{
|
||||
it->w->setFixedSize( width() - 4, height() - 14 );
|
||||
( *it ).w->setFixedSize( width() - 4, height() - 14 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +144,8 @@ void tabWidget::paintEvent( QPaintEvent * _pe )
|
||||
|
||||
QPainter p( &pm );
|
||||
#endif
|
||||
bool big_tab_captions = ( m_caption == "" );
|
||||
int add = big_tab_captions ? 1 : 0;
|
||||
|
||||
p.setPen( QColor( 64, 64, 64 ) );
|
||||
p.drawRect( 0, 0, width(), height() );
|
||||
@@ -138,31 +157,43 @@ void tabWidget::paintEvent( QPaintEvent * _pe )
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawRect( 1, 1, width() - 2, height() - 2 );
|
||||
|
||||
p.fillRect( 2, 2, width() - 4, 9, QColor( 30, 45, 60 ) );
|
||||
p.drawLine( 2, 11, width() - 3, 11 );
|
||||
p.fillRect( 2, 2, width() - 4, 9 + add, QColor( 30, 45, 60 ) );
|
||||
p.drawLine( 2, 11 + add, width() - 3, 11 + add );
|
||||
|
||||
p.setPen( QColor( 255, 255, 255 ) );
|
||||
p.setFont( font() );
|
||||
p.drawText( 5, 10, m_caption );
|
||||
if( !big_tab_captions )
|
||||
{
|
||||
p.setPen( QColor( 255, 255, 255 ) );
|
||||
p.setFont( font() );
|
||||
p.drawText( 5, 10, m_caption );
|
||||
}
|
||||
|
||||
int cx = 14 + fontMetrics().width( m_caption );
|
||||
int cx = ( big_tab_captions ? 4 : 14 ) +
|
||||
fontMetrics().width( m_caption );
|
||||
|
||||
p.setFont( pointSize<6>( p.font() ) );
|
||||
QColor cap_col( 160, 160, 160 );
|
||||
if( big_tab_captions )
|
||||
{
|
||||
p.setFont( pointSize<7>( p.font() ) );
|
||||
cap_col = QColor( 224, 224, 224 );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.setFont( pointSize<6>( p.font() ) );
|
||||
}
|
||||
p.setPen( cap_col );
|
||||
|
||||
p.setPen( QColor( 160, 160, 160 ) );
|
||||
|
||||
for( widgetStack::iterator it = m_widgets.begin();
|
||||
it != m_widgets.end(); ++it )
|
||||
{
|
||||
if( it - m_widgets.begin() == m_curWidget )
|
||||
if( it.key() == m_activeTab )
|
||||
{
|
||||
p.setPen( QColor( 32, 48, 64 ) );
|
||||
p.fillRect( cx, 2, it->nwidth - 6, 9,
|
||||
QColor( 160, 160, 160 ) );
|
||||
p.fillRect( cx, 2, ( *it ).nwidth - 6, 9, cap_col );
|
||||
}
|
||||
p.drawText( cx + 3, 9, it->name );
|
||||
p.setPen( QColor( 160, 160, 160 ) );
|
||||
cx += it->nwidth;
|
||||
p.drawText( cx + 3, 9 + add, ( *it ).name );
|
||||
p.setPen( cap_col );
|
||||
cx += ( *it ).nwidth;
|
||||
}
|
||||
|
||||
#ifndef QT4
|
||||
@@ -173,5 +204,23 @@ void tabWidget::paintEvent( QPaintEvent * _pe )
|
||||
|
||||
|
||||
|
||||
void tabWidget::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
int dir = ( _we->delta() > 0 ) ? 1 : -1;
|
||||
int tab = m_activeTab;
|
||||
while( tab > -1 && static_cast<csize>( tab ) < m_widgets.count() )
|
||||
{
|
||||
tab += dir;
|
||||
if( m_widgets.contains( tab ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
setActiveTab( tab );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "tab_widget.moc"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user