unified track-view appearence and behaviour

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1303 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-07-12 12:47:34 +00:00
parent 3d0a8e95a2
commit c08cc778fd
31 changed files with 242 additions and 300 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -102,13 +102,16 @@ QToolButton, toolButton {
padding: 2px 1px 1px 2px;
border-radius: 2px;
border: 1px solid rgba(0,0,0,64);
background: rgba(172,176,188,32);
background: rgba(172,176,188,32);
font-size:10px;
color: white;
}
QToolButton:hover {
background: rgba(255,255,255,128);
background: rgba(255,255,255,96);
border-radius: 3px;
border: 1px solid rgba(0,0,0,128);
border: 1px solid rgba(0,0,0,255);
color: black;
}
QToolButton:pressed {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -31,9 +31,6 @@
#include "track.h"
class nameLabel;
class automationTrack : public track
{
public:
@@ -72,14 +69,7 @@ public:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private:
bbTrack * m_bbTrack;
nameLabel * m_trackLabel;
} ;
#endif

View File

@@ -32,7 +32,7 @@
#include "track.h"
class nameLabel;
class trackLabelButton;
class trackContainer;
@@ -165,11 +165,6 @@ public:
bbTrackView( bbTrack * _bbt, trackContainerView * _tcv );
virtual ~bbTrackView();
inline nameLabel * trackLabel( void )
{
return( m_trackLabel );
}
virtual bool close( void );
const bbTrack * getBBTrack( void ) const
@@ -184,7 +179,7 @@ public slots:
private:
bbTrack * m_bbTrack;
nameLabel * m_trackLabel;
trackLabelButton * m_trackLabel;
} ;

View File

@@ -43,7 +43,7 @@ class effectRackView : public QWidget, public modelView
{
Q_OBJECT
public:
effectRackView( effectChain * _model, QWidget * _parent );
effectRackView( effectChain * _model, QWidget * _parent = NULL );
virtual ~effectRackView();
void clear( void );

View File

@@ -46,7 +46,6 @@ class effectRackView;
class instrumentSoundShapingView;
class fadeButton;
class instrument;
class instrumentTrackButton;
class instrumentTrackWindow;
class instrumentMidiIOView;
class lcdSpinBox;
@@ -55,6 +54,7 @@ class notePlayHandle;
class pluginView;
class presetPreviewPlayHandle;
class tabWidget;
class trackLabelButton;
class EXPORT instrumentTrack : public track, public midiEventProcessor
@@ -225,13 +225,23 @@ public:
}
QMenu * midiMenu( void )
{
return( m_midiMenu );
}
void freeInstrumentTrackWindow( void );
static void cleanupWindowPool( void );
protected:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private slots:
void toggledInstrumentTrackButton( bool _on );
void toggleInstrumentWindow( bool _on );
void activityIndicatorPressed( void );
void activityIndicatorReleased( void );
@@ -246,18 +256,17 @@ private:
static QQueue<instrumentTrackWindow *> s_windows;
// widgets in track-settings-widget
knob * m_tswVolumeKnob;
knob * m_tswPanningKnob;
fadeButton * m_tswActivityIndicator;
instrumentTrackButton * m_tswInstrumentTrackButton;
trackLabelButton * m_tlb;
knob * m_volumeKnob;
knob * m_panningKnob;
fadeButton * m_activityIndicator;
QMenu * m_tswMidiMenu;
QMenu * m_midiMenu;
QAction * m_midiInputAction;
QAction * m_midiOutputAction;
friend class instrumentTrackButton;
friend class instrumentTrackWindow;
} ;
@@ -294,10 +303,13 @@ public:
m_itv = _tv;
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
public slots:
void textChanged( const QString & _new_name );
void toggledInstrumentTrackButton( bool _on );
void toggleVisibility( bool _on );
void updateName( void );
void updateInstrumentView( void );
@@ -305,8 +317,6 @@ public slots:
protected:
// capture close-events for toggling instrument-track-button
virtual void closeEvent( QCloseEvent * _ce );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void focusInEvent( QFocusEvent * _fe );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
@@ -345,36 +355,10 @@ private:
// test-piano at the bottom of every instrument-settings-window
pianoView * m_pianoView;
friend class instrumentTrackButton;
friend class instrumentView;
} ;
class instrumentTrackButton : public QPushButton
{
public:
instrumentTrackButton( instrumentTrackView * _instrument_track_view );
virtual ~instrumentTrackButton();
protected:
// since we want to draw a special label (instrument- and instrument-
// name) on our button, we have to re-implement this for doing so
virtual void paintEvent( QPaintEvent * _pe );
// allow drops on this button - we simply forward them to
// instrument-track
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private:
instrumentTrackView * m_instrumentTrackView;
} ;
#endif

View File

@@ -1,6 +1,5 @@
/*
* name_label.h - class nameLabel, a label which is renamable by
* double-clicking it
* name_label.h - class trackLabelButton
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -27,16 +26,18 @@
#ifndef _NAME_LABEL_H
#define _NAME_LABEL_H
#include <QtGui/QLabel>
#include <QtGui/QPixmap>
#include <QtGui/QToolButton>
class nameLabel : public QLabel
class trackView;
class trackLabelButton : public QToolButton
{
Q_OBJECT
public:
nameLabel( const QString & _initial_name, QWidget * _parent );
virtual ~nameLabel();
trackLabelButton( trackView * _tv, QWidget * _parent );
virtual ~trackLabelButton();
const QPixmap & pixmap( void ) const
{
@@ -52,23 +53,25 @@ public:
public slots:
void setPixmap( const QPixmap & _pixmap );
void setPixmapFile( const QString & _file );
void rename( void );
void selectPixmap( void );
void rename( void );
void updateName( void );
signals:
void clicked( void );
void nameChanged( const QString & _new_name );
void nameChanged( void );
void pixmapChanged( void );
protected:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
private:
trackView * m_trackView;
QPixmap m_pixmap;
QString m_pixmapFile;

View File

@@ -32,9 +32,9 @@
#include "audio_port.h"
#include "track.h"
class effectLabel;
class sampleBuffer;
class effectRackView;
class knob;
class sampleBuffer;
class sampleTCO : public trackContentObject
@@ -152,14 +152,19 @@ private:
class sampleTrackView : public trackView
{
Q_OBJECT
public:
sampleTrackView( sampleTrack * _track, trackContainerView * _tcv );
virtual ~sampleTrackView();
private:
effectLabel * m_trackLabel;
public slots:
void showEffects( void );
private:
effectRackView * m_effectRack;
QWidget * m_effWindow;
knob * m_volumeKnob;
} ;

View File

@@ -553,6 +553,9 @@ private:
Actions m_action;
friend class trackLabelButton;
private slots:
void createTCOView( trackContentObject * _tco );

View File

@@ -1501,9 +1501,8 @@ void trackOperationsWidget::removeTrack( void )
/*! \brief Update the trackOperationsWidget context menu
*
* If we're in the Beat+Bassline Editor, we can supply the enable or
* disable automation options. For all track types, we have the Clone
* and Remove options as well.
* For all track types, we have the Clone and Remove options.
* For instrument-tracks we also offer the MIDI-control-menu
*/
void trackOperationsWidget::updateMenu( void )
{
@@ -1515,6 +1514,13 @@ void trackOperationsWidget::updateMenu( void )
to_menu->addAction( embed::getIconPixmap( "cancel", 16, 16 ),
tr( "Remove this track" ),
this, SLOT( removeTrack() ) );
if( dynamic_cast<instrumentTrackView *>( m_trackView ) )
{
to_menu->addSeparator();
to_menu->addMenu( dynamic_cast<instrumentTrackView *>(
m_trackView )->midiMenu() );
}
}

View File

@@ -65,6 +65,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
setModel( new boolModel( FALSE, NULL, _caption, TRUE ) );
setAutoFillBackground( TRUE );
unsetCursor();
}

View File

@@ -1,7 +1,7 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* name_label.cpp - implementation of class nameLabel, a label which
* name_label.cpp - implementation of class trackLabelButton, a label which
* is renamable by double-clicking it
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
@@ -29,6 +29,7 @@
#include <QtGui/QFileDialog>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <QtGui/QToolButton>
#include "name_label.h"
@@ -39,35 +40,46 @@
#include "gui_templates.h"
#include "config_mgr.h"
#include "engine.h"
#include <QtGui/QHBoxLayout>
nameLabel::nameLabel( const QString & _initial_name, QWidget * _parent ) :
QLabel( _initial_name, _parent ),
trackLabelButton::trackLabelButton( trackView * _tv, QWidget * _parent ) :
QToolButton( _parent ),
m_trackView( _tv ),
m_pixmap(),
m_pixmapFile( "" )
{
setAcceptDrops( TRUE );
setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) );
setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
setFixedSize( 160, 29 );
updateName();
connect( m_trackView->getTrack(), SIGNAL( dataChanged() ),
this, SLOT( updateName() ) );
}
nameLabel::~nameLabel()
trackLabelButton::~trackLabelButton()
{
}
void nameLabel::setPixmap( const QPixmap & _pixmap )
void trackLabelButton::setPixmap( const QPixmap & _pixmap )
{
m_pixmap = _pixmap;
setIcon( m_pixmap );
}
void nameLabel::setPixmapFile( const QString & _file )
void trackLabelButton::setPixmapFile( const QString & _file )
{
QPixmap new_pixmap;
if( QFileInfo( _file ).isRelative() )
@@ -83,7 +95,7 @@ void nameLabel::setPixmapFile( const QString & _file )
{
return;
}
m_pixmap = new_pixmap;
setPixmap( new_pixmap );
m_pixmapFile = _file;
emit( pixmapChanged() );
update();
@@ -92,7 +104,7 @@ void nameLabel::setPixmapFile( const QString & _file )
void nameLabel::selectPixmap( void )
void trackLabelButton::selectPixmap( void )
{
QFileDialog ofd( NULL, tr( "Select icon" ) );
@@ -141,24 +153,31 @@ void nameLabel::selectPixmap( void )
void nameLabel::rename( void )
void trackLabelButton::rename( void )
{
QString txt = text();
QString txt = m_trackView->getTrack()->name();
renameDialog rename_dlg( txt );
rename_dlg.exec();
if( txt != text() )
{
setText( txt );
emit nameChanged( txt );
m_trackView->getTrack()->setName( txt );
updateName();
}
}
void nameLabel::mousePressEvent( QMouseEvent * _me )
void trackLabelButton::updateName( void )
{
setText( m_trackView->getTrack()->name() );
}
void trackLabelButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::RightButton )
{
QSize s( m_pixmap.width(), m_pixmap.height() );
@@ -174,14 +193,14 @@ void nameLabel::mousePressEvent( QMouseEvent * _me )
}
else
{
emit clicked();
QToolButton::mousePressEvent( _me );
}
}
void nameLabel::mouseDoubleClickEvent( QMouseEvent * _me )
void trackLabelButton::mouseDoubleClickEvent( QMouseEvent * _me )
{
QSize s( m_pixmap.width(), m_pixmap.height() );
s.scale( width(), height(), Qt::KeepAspectRatio );
@@ -198,45 +217,22 @@ void nameLabel::mouseDoubleClickEvent( QMouseEvent * _me )
void nameLabel::paintEvent( QPaintEvent * )
void trackLabelButton::dragEnterEvent( QDragEnterEvent * _dee )
{
QPainter p( this );
p.fillRect( rect(),
parentWidget()->palette().color( backgroundRole() ) );
int x = 4;
if( m_pixmap.isNull() == FALSE )
{
QPixmap pm = m_pixmap;
if( pm.height() > height() )
{
pm = pm.scaledToHeight( height(),
Qt::SmoothTransformation );
}
p.drawPixmap( x, ( height() - pm.height() ) / 2, pm );
x += 4 + pm.width();
}
p.setPen( QColor( 160, 160, 160 ) );
bbTrack * bbt = bbTrack::findBBTrack(
engine::getBBTrackContainer()->currentBB() );
trackSettingsWidget * w = dynamic_cast<trackSettingsWidget *>( parentWidget() );
if( bbt != NULL && w != NULL )
{
bbTrackView * bbtv = dynamic_cast<bbTrackView *>( w->parentWidget() );
if( bbtv != NULL && bbtv->getBBTrack() == bbt )
{
p.setPen( QColor( 255, 255, 255 ) );
}
}
p.drawText( x, height() / 2 + p.fontMetrics().height() / 2 - 4,
text() );
m_trackView->dragEnterEvent( _dee );
}
void trackLabelButton::dropEvent( QDropEvent * _de )
{
m_trackView->dropEvent( _de );
setChecked( TRUE );
}
#include "name_label.moc"

View File

@@ -116,13 +116,11 @@ automationTrackView::automationTrackView( automationTrack * _at,
trackView( _at, _tcv )
{
setFixedHeight( 32 );
m_trackLabel = new nameLabel( _at->name(), getTrackSettingsWidget() );
m_trackLabel->setPixmap( embed::getIconPixmap( "automation" ) );
m_trackLabel->setGeometry( 1, 1, DEFAULT_SETTINGS_WIDGET_WIDTH - 2,
29 );
m_trackLabel->show();
connect( m_trackLabel, SIGNAL( nameChanged( const QString & ) ),
_at, SLOT( setName( const QString & ) ) );
trackLabelButton * tlb = new trackLabelButton( this,
getTrackSettingsWidget() );
tlb->setPixmap( embed::getIconPixmap( "automation_track" ) );
tlb->move( 3, 1 );
tlb->show();
setModel( _at );
}

View File

@@ -238,12 +238,7 @@ void bbTCOView::openInBBEditor( void )
void bbTCOView::resetName( void )
{
if( dynamic_cast<bbTrackView *>( getTrackView() ) != NULL )
{
m_bbTCO->setName(
dynamic_cast<bbTrackView *>( getTrackView() )->
trackLabel()->text() );
}
m_bbTCO->setName( m_bbTCO->getTrack()->name() );
}
@@ -529,22 +524,16 @@ bbTrackView::bbTrackView( bbTrack * _bbt, trackContainerView * _tcv ) :
// too), so disable it
setAcceptDrops( FALSE );
m_trackLabel = new nameLabel( _bbt->name(),
getTrackSettingsWidget() );
m_trackLabel = new trackLabelButton( this, getTrackSettingsWidget() );
m_trackLabel->setPixmap( embed::getIconPixmap( "bb_track" ) );
m_trackLabel->setGeometry( 1, 1, DEFAULT_SETTINGS_WIDGET_WIDTH - 2,
29 );
m_trackLabel->move( 3, 1 );
m_trackLabel->show();
connect( m_trackLabel, SIGNAL( clicked() ),
connect( m_trackLabel, SIGNAL( clicked( bool ) ),
this, SLOT( clickedTrackLabel() ) );
connect( m_trackLabel, SIGNAL( nameChanged( const QString & ) ),
_bbt, SLOT( setName( const QString & ) ) );
connect( m_trackLabel, SIGNAL( nameChanged( const QString & ) ),
connect( m_trackLabel, SIGNAL( nameChanged() ),
engine::getBBTrackContainer(), SLOT( updateComboBox() ) );
connect( m_trackLabel, SIGNAL( pixmapChanged() ),
engine::getBBTrackContainer(), SLOT( updateComboBox() ) );
connect( _bbt, SIGNAL( dataChanged() ),
m_trackLabel, SLOT( update() ) );
setModel( _bbt );
}
@@ -573,11 +562,11 @@ void bbTrackView::clickedTrackLabel( void )
engine::getBBTrackContainer()->setCurrentBB(
bbTrack::numOfBBTrack( m_bbTrack ) );
engine::getBBEditor()->show();
foreach( bbTrackView * tv,
/* foreach( bbTrackView * tv,
getTrackContainerView()->findChildren<bbTrackView *>() )
{
tv->m_trackLabel->update();
}
}*/
}

View File

@@ -54,6 +54,7 @@
#include "effect_rack_view.h"
#include "embed.h"
#include "engine.h"
#include "fx_mixer.h"
#include "fx_mixer_view.h"
#include "instrument_sound_shaping.h"
#include "instrument_sound_shaping_view.h"
@@ -66,7 +67,7 @@
#include "main_window.h"
#include "midi_client.h"
#include "midi_port_menu.h"
#include "fx_mixer.h"
#include "name_label.h"
#include "mmp.h"
#include "note_play_handle.h"
#include "pattern.h"
@@ -84,15 +85,6 @@ const char * volume_help = QT_TRANSLATE_NOOP( "instrumentTrack",
"With this knob you can set "
"the volume of the opened "
"channel.");
const char * surroundarea_help = QT_TRANSLATE_NOOP( "instrumentTrack",
"Within this rectangle you can "
"set the position where the "
"channel should be audible. "
"You should have a soundcard "
"supporting at least surround "
"4.0 for enjoying this "
"feature." );
const int INSTRUMENT_WIDTH = 254;
const int INSTRUMENT_HEIGHT = INSTRUMENT_WIDTH;
@@ -772,34 +764,39 @@ instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
setAcceptDrops( TRUE );
setFixedHeight( 32 );
m_tlb = new trackLabelButton( this, getTrackSettingsWidget() );
m_tlb->setCheckable( TRUE );
m_tlb->setPixmap( embed::getIconPixmap( "instrument_track" ) );
m_tlb->move( 3, 1 );
m_tlb->show();
connect( m_tlb, SIGNAL( toggled( bool ) ),
this, SLOT( toggleInstrumentWindow( bool ) ) );
connect( _it, SIGNAL( nameChanged() ),
m_tlb, SLOT( updateName() ) );
// creation of widgets for track-settings-widget
m_tswVolumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
tr( "Volume" ) );
m_tswVolumeKnob->setVolumeKnob( TRUE );
m_tswVolumeKnob->setModel( &_it->m_volumeModel );
m_tswVolumeKnob->setHintText( tr( "Volume:" ) + " ", "%" );
m_tswVolumeKnob->move( 4, 4 );
m_tswVolumeKnob->setLabel( tr( "VOL" ) );
m_tswVolumeKnob->show();
m_tswVolumeKnob->setWhatsThis( tr( volume_help ) );
m_volumeKnob->setVolumeKnob( TRUE );
m_volumeKnob->setModel( &_it->m_volumeModel );
m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" );
m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-24*2, 4 );
m_volumeKnob->setLabel( tr( "VOL" ) );
m_volumeKnob->show();
m_volumeKnob->setWhatsThis( tr( volume_help ) );
m_tswPanningKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
m_panningKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
tr( "Panning" ) );
m_tswPanningKnob->setModel( &_it->m_panningModel );
m_tswPanningKnob->setHintText( tr( "Panning:" ) + " ", "%" );
m_tswPanningKnob->move( 24, 4 );
m_tswPanningKnob->setLabel( tr( "PAN" ) );
m_tswPanningKnob->show();
m_panningKnob->setModel( &_it->m_panningModel );
m_panningKnob->setHintText( tr( "Panning:" ) + " ", "%" );
m_panningKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-24, 4 );
m_panningKnob->setLabel( tr( "PAN" ) );
m_panningKnob->show();
QPushButton * tsw_midi = new QPushButton(
embed::getIconPixmap( "piano" ), QString::null,
getTrackSettingsWidget() );
tsw_midi->setGeometry( 50, 2, 28, 28 );
tsw_midi->show();
toolTip::add( tsw_midi, tr( "MIDI input/output" ) );
m_tswMidiMenu = new QMenu( tsw_midi );
tsw_midi->setMenu( m_tswMidiMenu );
m_midiMenu = new QMenu( tr( "MIDI" ), this );
// sequenced MIDI?
if( !engine::getMixer()->getMIDIClient()->isRaw() )
@@ -812,15 +809,15 @@ instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
&_it->m_midiPort );
_it->m_midiPort.m_writablePortsMenu->setModel(
&_it->m_midiPort );
m_midiInputAction = m_tswMidiMenu->addMenu(
m_midiInputAction = m_midiMenu->addMenu(
_it->m_midiPort.m_readablePortsMenu );
m_midiOutputAction = m_tswMidiMenu->addMenu(
m_midiOutputAction = m_midiMenu->addMenu(
_it->m_midiPort.m_writablePortsMenu );
}
else
{
m_midiInputAction = m_tswMidiMenu->addAction( "" );
m_midiOutputAction = m_tswMidiMenu->addAction( "" );
m_midiInputAction = m_midiMenu->addAction( "" );
m_midiOutputAction = m_midiMenu->addAction( "" );
m_midiInputAction->setCheckable( TRUE );
m_midiOutputAction->setCheckable( TRUE );
connect( m_midiInputAction, SIGNAL( changed() ), this,
@@ -831,34 +828,24 @@ instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
this, SLOT( midiConfigChanged() ) );
}
m_midiInputAction->setText( tr( "MIDI input" ) );
m_midiOutputAction->setText( tr( "MIDI output" ) );
m_midiInputAction->setText( tr( "Input" ) );
m_midiOutputAction->setText( tr( "Output" ) );
m_tswActivityIndicator = new fadeButton( QColor( 56, 60, 72 ),
m_activityIndicator = new fadeButton( QColor( 56, 60, 72 ),
QColor( 64, 255, 16 ),
getTrackSettingsWidget() );
m_tswActivityIndicator->setGeometry( 212, 2, 8, 28 );
m_tswActivityIndicator->show();
connect( m_tswActivityIndicator, SIGNAL( pressed( void ) ),
m_activityIndicator->setGeometry(
DEFAULT_SETTINGS_WIDGET_WIDTH-2*24-11, 2, 8, 28 );
m_activityIndicator->show();
connect( m_activityIndicator, SIGNAL( pressed( void ) ),
this, SLOT( activityIndicatorPressed() ) );
connect( m_tswActivityIndicator, SIGNAL( released( void ) ),
connect( m_activityIndicator, SIGNAL( released( void ) ),
this, SLOT( activityIndicatorReleased() ) );
connect( _it, SIGNAL( newNote() ),
m_tswActivityIndicator, SLOT( activate() ) );
m_activityIndicator, SLOT( activate() ) );
m_tswInstrumentTrackButton = new instrumentTrackButton( this );
m_tswInstrumentTrackButton->setCheckable( TRUE );
m_tswInstrumentTrackButton->setGeometry( 82, 2, 126, 28 );
m_tswInstrumentTrackButton->show();
setModel( _it );
connect( m_tswInstrumentTrackButton, SIGNAL( toggled( bool ) ),
this, SLOT( toggledInstrumentTrackButton( bool ) ) );
connect( _it, SIGNAL( nameChanged() ),
m_tswInstrumentTrackButton, SLOT( update() ) );
}
@@ -938,9 +925,27 @@ instrumentTrackWindow * instrumentTrackView::getInstrumentTrackWindow( void )
void instrumentTrackView::toggledInstrumentTrackButton( bool _on )
void instrumentTrackView::dragEnterEvent( QDragEnterEvent * _dee )
{
getInstrumentTrackWindow()->toggledInstrumentTrackButton( _on );
getInstrumentTrackWindow()->dragEnterEvent( _dee );
trackView::dragEnterEvent( _dee );
}
void instrumentTrackView::dropEvent( QDropEvent * _de )
{
getInstrumentTrackWindow()->dropEvent( _de );
trackView::dropEvent( _de );
}
void instrumentTrackView::toggleInstrumentWindow( bool _on )
{
getInstrumentTrackWindow()->toggleVisibility( _on );
if( !_on )
{
@@ -1069,7 +1074,6 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
m_volumeKnob->width() + 16, 44 );
m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" );
m_panningKnob->setLabel( tr( "PAN" ) );
//// m_surroundArea->setWhatsThis( tr( surroundarea_help ) );
m_pitchKnob = new knob( knobBright_26, m_generalSettingsWidget,
@@ -1133,30 +1137,20 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
setModel( _itv->model() );
// set window-icon
setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
updateInstrumentView();
setFixedWidth( INSTRUMENT_WIDTH );
resize( sizeHint() );
if( engine::getMainWindow()->workspace() )
{
QMdiSubWindow * subWin =
QMdiSubWindow * subWin =
engine::getMainWindow()->workspace()->addSubWindow( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
subWin->setFixedSize( subWin->size() );
parentWidget()->hide();
}
else
{
hide();
}
Qt::WindowFlags flags = subWin->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
subWin->setFixedSize( subWin->size() );
subWin->hide();
}
@@ -1267,8 +1261,6 @@ void instrumentTrackWindow::updateInstrumentView( void )
m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), 0 );
m_tabWidget->setActiveTab( 0 );
}
// m_tswInstrumentTrackButton->update();
}
@@ -1283,33 +1275,18 @@ void instrumentTrackWindow::textChanged( const QString & _new_name )
void instrumentTrackWindow::toggledInstrumentTrackButton( bool _on )
void instrumentTrackWindow::toggleVisibility( bool _on )
{
if( _on )
{
if( engine::getMainWindow()->workspace() )
{
show();
parentWidget()->show();
parentWidget()->raise();
}
else
{
show();
raise();
}
show();
parentWidget()->show();
parentWidget()->raise();
}
else
{
if( engine::getMainWindow()->workspace() )
{
parentWidget()->hide();
}
else
{
hide();
}
parentWidget()->hide();
}
}
@@ -1327,7 +1304,7 @@ void instrumentTrackWindow::closeEvent( QCloseEvent * _ce )
{
hide();
}
m_itv->m_tswInstrumentTrackButton->setChecked( FALSE );
m_itv->m_tlb->setChecked( FALSE );
}
@@ -1388,7 +1365,7 @@ void instrumentTrackWindow::loadSettings( const QDomElement & _this )
mainWindow::restoreWidgetState( this, _this );
if( isVisible() )
{
m_itv->m_tswInstrumentTrackButton->setChecked( TRUE );
m_itv->m_tlb->setChecked( TRUE );
}
}
@@ -1397,28 +1374,7 @@ void instrumentTrackWindow::loadSettings( const QDomElement & _this )
instrumentTrackButton::instrumentTrackButton( instrumentTrackView * _itv ) :
QPushButton( _itv->getTrackSettingsWidget() ),
m_instrumentTrackView( _itv )
{
setAcceptDrops( TRUE );
setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) );
}
instrumentTrackButton::~instrumentTrackButton()
{
}
void instrumentTrackButton::paintEvent( QPaintEvent * _pe )
/*void instrumentTrackButton::paintEvent( QPaintEvent * _pe )
{
QPushButton::paintEvent( _pe );
QPainter p( this );
@@ -1434,28 +1390,11 @@ void instrumentTrackButton::paintEvent( QPaintEvent * _pe )
p.drawText( ( width() - QFontMetrics( p.font() ).width( n ) ) /
2 + extra, height() / 2 - 2 +
QFontMetrics( p.font() ).height() + extra, n );
}
}*/
void instrumentTrackButton::dragEnterEvent( QDragEnterEvent * _dee )
{
m_instrumentTrackView->getInstrumentTrackWindow()->
dragEnterEvent( _dee );
}
void instrumentTrackButton::dropEvent( QDropEvent * _de )
{
m_instrumentTrackView->getInstrumentTrackWindow()->dropEvent( _de );
setChecked( TRUE );
}
#include "instrument_track.moc"

View File

@@ -28,10 +28,12 @@
#include <Qt/QtXml>
#include <QtGui/QDropEvent>
#include <QtGui/QLayout>
#include <QtGui/QMdiArea>
#include <QtGui/QPainter>
#include <QtGui/QPushButton>
#include "effect_label.h"
#include "name_label.h"
#include "sample_track.h"
#include "song.h"
#include "embed.h"
@@ -43,6 +45,8 @@
#include "sample_play_handle.h"
#include "string_pair_drag.h"
#include "knob.h"
#include "main_window.h"
#include "effect_rack_view.h"
@@ -378,7 +382,7 @@ void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc,
{
m_audioPort.getEffects()->saveState( _doc, _this );
#if 0
_this.setAttribute( "icon", m_trackLabel->pixmapFile() );
_this.setAttribute( "icon", tlb->pixmapFile() );
#endif
m_volumeModel.saveSettings( _doc, _this, "vol" );
}
@@ -406,7 +410,7 @@ void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
#if 0
if( _this.attribute( "icon" ) != "" )
{
m_trackLabel->setPixmapFile( _this.attribute( "icon" ) );
tlb->setPixmapFile( _this.attribute( "icon" ) );
}
#endif
m_volumeModel.loadSettings( _this, "vol" );
@@ -422,23 +426,32 @@ sampleTrackView::sampleTrackView( sampleTrack * _t, trackContainerView * _tcv )
{
setFixedHeight( 32 );
m_trackLabel = new effectLabel( getTrackSettingsWidget(), _t );
#if 0
m_trackLabel = new nameLabel( tr( "Sample track" ),
trackLabelButton * tlb = new trackLabelButton( this,
getTrackSettingsWidget() );
m_trackLabel->setPixmap( embed::getIconPixmap( "sample_track" ) );
#endif
m_trackLabel->setGeometry( 26, 1, DEFAULT_SETTINGS_WIDGET_WIDTH-2, 29 );
m_trackLabel->show();
connect( tlb, SIGNAL( clicked( bool ) ),
this, SLOT( showEffects() ) );
tlb->setPixmap( embed::getIconPixmap( "sample_track" ) );
tlb->move( 3, 1 );
tlb->show();
m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
tr( "Track volume" ) );
m_volumeKnob->setVolumeKnob( TRUE );
m_volumeKnob->setModel( &_t->m_volumeModel );
m_volumeKnob->setHintText( tr( "Channel volume:" ) + " ", "%" );
m_volumeKnob->move( 4, 4 );
m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-2*24, 4 );
m_volumeKnob->setLabel( tr( "VOL" ) );
m_volumeKnob->show();
m_effectRack = new effectRackView( _t->getAudioPort()->getEffects() );
m_effectRack->setFixedSize( 240, 242 );
engine::getMainWindow()->workspace()->addSubWindow( m_effectRack );
m_effWindow = m_effectRack->parentWidget();
m_effWindow->setAttribute( Qt::WA_DeleteOnClose, FALSE );
m_effWindow->layout()->setSizeConstraint( QLayout::SetFixedSize );
m_effWindow->setWindowTitle( _t->name() );
m_effWindow->hide();
}
@@ -446,6 +459,23 @@ sampleTrackView::sampleTrackView( sampleTrack * _t, trackContainerView * _tcv )
sampleTrackView::~sampleTrackView()
{
m_effWindow->deleteLater();
}
void sampleTrackView::showEffects( void )
{
if( m_effWindow->isHidden() )
{
m_effWindow->show();
m_effWindow->raise();
}
else
{
m_effWindow->hide();
}
}