InstrumentView: added generic DnD support, renamed/splitted files
Added generic drag'n'drop support for all instrument views. All resources supported by the according instrument now can be dropped onto instrument view without any extra code in actual instrument. Additionally renamed some files and classes related to InstrumentView class to match new style. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* dummy_instrument.h - instrument used as fallback if an instrument couldn't
|
||||
* be loaded
|
||||
* DummyInstrument.h - instrument used as fallback if an instrument couldn't
|
||||
* be loaded
|
||||
*
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -23,23 +23,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _DUMMY_INSTRUMENT_H
|
||||
#define _DUMMY_INSTRUMENT_H
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
|
||||
|
||||
class dummyInstrument : public instrument
|
||||
class DummyInstrument : public instrument
|
||||
{
|
||||
public:
|
||||
dummyInstrument( instrumentTrack * _instrument_track ) :
|
||||
DummyInstrument( instrumentTrack * _instrument_track ) :
|
||||
instrument( _instrument_track, NULL )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~dummyInstrument()
|
||||
virtual ~DummyInstrument()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,12 +56,12 @@ public:
|
||||
|
||||
virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "dummyinstrument" );
|
||||
return "dummyinstrument";
|
||||
}
|
||||
|
||||
virtual pluginView * instantiateView( QWidget * _parent )
|
||||
{
|
||||
return( new instrumentView( this, _parent ) );
|
||||
return new InstrumentView( this, _parent );
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* instrument_view.h - definition of instrumentView-class
|
||||
* InstrumentView.h - definition of InstrumentView class
|
||||
*
|
||||
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -32,25 +32,30 @@
|
||||
class instrumentTrackWindow;
|
||||
|
||||
|
||||
class EXPORT instrumentView : public pluginView
|
||||
class EXPORT InstrumentView : public pluginView
|
||||
{
|
||||
public:
|
||||
instrumentView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~instrumentView();
|
||||
InstrumentView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~InstrumentView();
|
||||
|
||||
instrument * model( void )
|
||||
instrument * model()
|
||||
{
|
||||
return( castModel<instrument>() );
|
||||
return castModel<instrument>();
|
||||
}
|
||||
|
||||
const instrument * model( void ) const
|
||||
const instrument * model() const
|
||||
{
|
||||
return( castModel<instrument>() );
|
||||
return castModel<instrument>();
|
||||
}
|
||||
|
||||
virtual void setModel( ::model * _model, bool = FALSE );
|
||||
virtual void setModel( ::model * _model, bool = false );
|
||||
|
||||
instrumentTrackWindow * getInstrumentTrackWindow( void );
|
||||
instrumentTrackWindow * getInstrumentTrackWindow();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
|
||||
} ;
|
||||
|
||||
@@ -394,7 +394,7 @@ private:
|
||||
// test-piano at the bottom of every instrument-settings-window
|
||||
PianoView * m_pianoView;
|
||||
|
||||
friend class instrumentView;
|
||||
friend class InstrumentView;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _instrument_track ) :
|
||||
m_ampModel( 100, 0, 500, 1, this, tr( "Amplify" ) ),
|
||||
m_startPointModel( 0, 0, 1, 0.0000001f, this, tr( "Start of sample") ),
|
||||
m_endPointModel( 1, 0, 1, 0.0000001f, this, tr( "End of sample" ) ),
|
||||
m_reverseModel( FALSE, this, tr( "Reverse sample" ) ),
|
||||
m_loopModel( FALSE, this, tr( "Loop") )
|
||||
m_reverseModel( false, this, tr( "Reverse sample" ) ),
|
||||
m_loopModel( false, this, tr( "Loop") )
|
||||
{
|
||||
connect( &m_reverseModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( reverseModelChanged() ) );
|
||||
@@ -115,7 +115,7 @@ void audioFileProcessor::playNote( notePlayHandle * _n,
|
||||
if( m_sampleBuffer.play( _working_buffer,
|
||||
(handleState *)_n->m_pluginData,
|
||||
frames, _n->frequency(),
|
||||
m_loopModel.value() ) == TRUE )
|
||||
m_loopModel.value() ) == true )
|
||||
{
|
||||
applyRelease( _working_buffer, _n );
|
||||
getInstrumentTrack()->processAudioBuffer( _working_buffer,
|
||||
@@ -158,7 +158,7 @@ void audioFileProcessor::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
if( _this.attribute( "src" ) != "" )
|
||||
{
|
||||
setAudioFile( _this.attribute( "src" ), FALSE );
|
||||
setAudioFile( _this.attribute( "src" ), false );
|
||||
}
|
||||
else if( _this.attribute( "sampledata" ) != "" )
|
||||
{
|
||||
@@ -186,9 +186,9 @@ void audioFileProcessor::loadResource( const ResourceItem * _resourceItem )
|
||||
|
||||
|
||||
|
||||
QString audioFileProcessor::nodeName( void ) const
|
||||
QString audioFileProcessor::nodeName() const
|
||||
{
|
||||
return( audiofileprocessor_plugin_descriptor.name );
|
||||
return audiofileprocessor_plugin_descriptor.name;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,9 +200,9 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
|
||||
engine::getMixer()->processingSampleRate() /
|
||||
engine::getMixer()->baseSampleRate();
|
||||
|
||||
return( static_cast<Uint32>( floorf( ( m_sampleBuffer.endFrame() -
|
||||
return static_cast<Uint32>( floorf( ( m_sampleBuffer.endFrame() -
|
||||
m_sampleBuffer.startFrame() ) *
|
||||
freq_factor ) ) );
|
||||
freq_factor ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
|
||||
|
||||
pluginView * audioFileProcessor::instantiateView( QWidget * _parent )
|
||||
{
|
||||
return( new audioFileProcessorView( this, _parent ) );
|
||||
return new AudioFileProcessorView( this, _parent );
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ void audioFileProcessor::setAudioFile( const QString & _audio_file,
|
||||
|
||||
|
||||
|
||||
void audioFileProcessor::reverseModelChanged( void )
|
||||
void audioFileProcessor::reverseModelChanged()
|
||||
{
|
||||
m_sampleBuffer.setReversed( m_reverseModel.value() );
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void audioFileProcessor::reverseModelChanged( void )
|
||||
|
||||
|
||||
|
||||
void audioFileProcessor::ampModelChanged( void )
|
||||
void audioFileProcessor::ampModelChanged()
|
||||
{
|
||||
m_sampleBuffer.setAmplification( m_ampModel.value() / 100.0f );
|
||||
}
|
||||
@@ -254,7 +254,7 @@ void audioFileProcessor::ampModelChanged( void )
|
||||
|
||||
|
||||
|
||||
void audioFileProcessor::loopPointChanged( void )
|
||||
void audioFileProcessor::loopPointChanged()
|
||||
{
|
||||
const f_cnt_t f1 = static_cast<f_cnt_t>( m_startPointModel.value() *
|
||||
( m_sampleBuffer.frames()-1 ) );
|
||||
@@ -284,12 +284,12 @@ public:
|
||||
|
||||
|
||||
|
||||
QPixmap * audioFileProcessorView::s_artwork = NULL;
|
||||
QPixmap * AudioFileProcessorView::s_artwork = NULL;
|
||||
|
||||
|
||||
audioFileProcessorView::audioFileProcessorView( instrument * _instrument,
|
||||
AudioFileProcessorView::AudioFileProcessorView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
if( s_artwork == NULL )
|
||||
{
|
||||
@@ -316,7 +316,7 @@ audioFileProcessorView::audioFileProcessorView( instrument * _instrument,
|
||||
"sound like the original sample.") );
|
||||
|
||||
m_reverseButton = new pixmapButton( this );
|
||||
m_reverseButton->setCheckable( TRUE );
|
||||
m_reverseButton->setCheckable( true );
|
||||
m_reverseButton->move( 184, 124 );
|
||||
m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"reverse_on" ) );
|
||||
@@ -329,7 +329,7 @@ audioFileProcessorView::audioFileProcessorView( instrument * _instrument,
|
||||
"crash." ) );
|
||||
|
||||
m_loopButton = new pixmapButton( this );
|
||||
m_loopButton->setCheckable( TRUE );
|
||||
m_loopButton->setCheckable( true );
|
||||
m_loopButton->move( 220, 124 );
|
||||
m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"loop_on" ) );
|
||||
@@ -345,7 +345,7 @@ audioFileProcessorView::audioFileProcessorView( instrument * _instrument,
|
||||
"samples." ) );
|
||||
|
||||
m_ampKnob = new knob( knobStyled, this );
|
||||
m_ampKnob->setVolumeKnob( TRUE );
|
||||
m_ampKnob->setVolumeKnob( true );
|
||||
m_ampKnob->move( 17, 108 );
|
||||
m_ampKnob->setFixedSize( 37, 47 );
|
||||
m_ampKnob->setHintText( tr( "Amplify:" )+" ", "%" );
|
||||
@@ -374,75 +374,19 @@ audioFileProcessorView::audioFileProcessorView( instrument * _instrument,
|
||||
"If you enable looping-mode, this is the point where "
|
||||
"AudioFileProcessor returns if a note is longer than "
|
||||
"the sample between the start and end-points." ) );
|
||||
|
||||
setAcceptDrops( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
audioFileProcessorView::~audioFileProcessorView()
|
||||
AudioFileProcessorView::~AudioFileProcessorView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void audioFileProcessorView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
stringPairDrag::mimeType() );
|
||||
if( txt.section( ':', 0, 0 ) == QString( "tco_%1" ).arg(
|
||||
track::SampleTrack ) )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
else if( txt.section( ':', 0, 0 ) == "samplefile" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void audioFileProcessorView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
QString type = stringPairDrag::decodeKey( _de );
|
||||
QString value = stringPairDrag::decodeValue( _de );
|
||||
if( type == "samplefile" )
|
||||
{
|
||||
castModel<audioFileProcessor>()->setAudioFile( value );
|
||||
_de->accept();
|
||||
return;
|
||||
}
|
||||
else if( type == QString( "tco_%1" ).arg( track::SampleTrack ) )
|
||||
{
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
castModel<audioFileProcessor>()->setAudioFile( mmp.content().
|
||||
firstChild().toElement().attribute( "src" ) );
|
||||
_de->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
_de->ignore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void audioFileProcessorView::paintEvent( QPaintEvent * )
|
||||
void AudioFileProcessorView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
|
||||
@@ -497,7 +441,7 @@ void audioFileProcessorView::paintEvent( QPaintEvent * )
|
||||
|
||||
|
||||
|
||||
void audioFileProcessorView::sampleUpdated( void )
|
||||
void AudioFileProcessorView::sampleUpdated()
|
||||
{
|
||||
m_graph = QPixmap( 245, 75 );
|
||||
m_graph.fill( Qt::transparent );
|
||||
@@ -513,7 +457,7 @@ void audioFileProcessorView::sampleUpdated( void )
|
||||
|
||||
|
||||
|
||||
void audioFileProcessorView::openAudioFile( void )
|
||||
void AudioFileProcessorView::openAudioFile()
|
||||
{
|
||||
QString af = castModel<audioFileProcessor>()->m_sampleBuffer.
|
||||
openAudioFile();
|
||||
@@ -527,7 +471,7 @@ void audioFileProcessorView::openAudioFile( void )
|
||||
|
||||
|
||||
|
||||
void audioFileProcessorView::modelChanged( void )
|
||||
void AudioFileProcessorView::modelChanged()
|
||||
{
|
||||
audioFileProcessor * a = castModel<audioFileProcessor>();
|
||||
connect( &a->m_sampleBuffer, SIGNAL( sampleUpdated() ),
|
||||
@@ -550,8 +494,8 @@ extern "C"
|
||||
// neccessary for getting instance out of shared lib
|
||||
plugin * PLUGIN_EXPORT lmms_plugin_main( model *, void * _data )
|
||||
{
|
||||
return( new audioFileProcessor(
|
||||
static_cast<instrumentTrack *>( _data ) ) );
|
||||
return new audioFileProcessor(
|
||||
static_cast<instrumentTrack *>( _data ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "sample_buffer.h"
|
||||
#include "knob.h"
|
||||
#include "pixmap_button.h"
|
||||
@@ -88,18 +88,18 @@ private:
|
||||
boolModel m_loopModel;
|
||||
|
||||
|
||||
friend class audioFileProcessorView;
|
||||
friend class AudioFileProcessorView;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class audioFileProcessorView : public instrumentView
|
||||
class AudioFileProcessorView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
audioFileProcessorView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~audioFileProcessorView();
|
||||
AudioFileProcessorView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~AudioFileProcessorView();
|
||||
|
||||
|
||||
protected slots:
|
||||
@@ -108,8 +108,6 @@ protected slots:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
virtual void paintEvent( QPaintEvent * );
|
||||
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ pluginView * bitInvader::instantiateView( QWidget * _parent )
|
||||
|
||||
bitInvaderView::bitInvaderView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "graph.h"
|
||||
#include "knob.h"
|
||||
#include "pixmap_button.h"
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class bitInvaderView : public instrumentView
|
||||
class bitInvaderView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
|
||||
kickerInstrumentView::kickerInstrumentView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
m_startFreqKnob = new kickerKnob( this );
|
||||
m_startFreqKnob->setHintText( tr( "Start frequency:" ) + " ", "Hz" );
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "knob.h"
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class kickerInstrumentView : public instrumentView
|
||||
class kickerInstrumentView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -803,7 +803,7 @@ pluginView * lb302Synth::instantiateView( QWidget * _parent )
|
||||
|
||||
|
||||
lb302SynthView::lb302SynthView( instrument * _instrument, QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
// GUI
|
||||
m_vcfCutKnob = new knob( knobBright_26, this );
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "effect_lib.h"
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "knob.h"
|
||||
#include "mixer.h"
|
||||
@@ -238,7 +238,7 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
class lb302SynthView : public instrumentView
|
||||
class lb302SynthView : public InstrumentView
|
||||
{
|
||||
public:
|
||||
lb302SynthView( instrument * _instrument,
|
||||
|
||||
@@ -737,7 +737,7 @@ pluginView * lb303Synth::instantiateView( QWidget * _parent )
|
||||
|
||||
|
||||
lb303SynthView::lb303SynthView( instrument * _instrument, QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
// GUI
|
||||
m_vcfCutKnob = new knob( knobBright_26, this );
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "effect_lib.h"
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "knob.h"
|
||||
#include "mixer.h"
|
||||
@@ -239,7 +239,7 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
class lb303SynthView : public instrumentView
|
||||
class lb303SynthView : public InstrumentView
|
||||
{
|
||||
public:
|
||||
lb303SynthView( instrument * _instrument,
|
||||
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
|
||||
organicInstrumentView::organicInstrumentView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
organicInstrument * oi = castModel<organicInstrument>();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "oscillator.h"
|
||||
#include "automatable_model.h"
|
||||
|
||||
@@ -133,7 +133,7 @@ private slots:
|
||||
} ;
|
||||
|
||||
|
||||
class organicInstrumentView : public instrumentView
|
||||
class organicInstrumentView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -445,7 +445,7 @@ public:
|
||||
|
||||
papuInstrumentView::papuInstrumentView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
|
||||
setAutoFillBackground( true );
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "knob.h"
|
||||
#include "graph.h"
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
class papuInstrumentView : public instrumentView
|
||||
class papuInstrumentView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -432,7 +432,7 @@ void patmanInstrument::selectSample( notePlayHandle * _n )
|
||||
|
||||
pluginView * patmanInstrument::instantiateView( QWidget * _parent )
|
||||
{
|
||||
return new patmanView( this, _parent );
|
||||
return new PatmanView( this, _parent );
|
||||
}
|
||||
|
||||
|
||||
@@ -444,8 +444,8 @@ pluginView * patmanInstrument::instantiateView( QWidget * _parent )
|
||||
|
||||
|
||||
|
||||
patmanView::patmanView( instrument * _instrument, QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent ),
|
||||
PatmanView::PatmanView( instrument * _instrument, QWidget * _parent ) :
|
||||
InstrumentView( _instrument, _parent ),
|
||||
m_pi( NULL )
|
||||
{
|
||||
setAutoFillBackground( true );
|
||||
@@ -500,21 +500,19 @@ patmanView::patmanView( instrument * _instrument, QWidget * _parent ) :
|
||||
"frequency." ) );
|
||||
|
||||
m_displayFilename = tr( "No file selected" );
|
||||
|
||||
setAcceptDrops( true );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
patmanView::~patmanView()
|
||||
PatmanView::~PatmanView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void patmanView::openFile()
|
||||
void PatmanView::openFile()
|
||||
{
|
||||
QFileDialog ofd( NULL, tr( "Open patch file" ) );
|
||||
ofd.setFileMode( QFileDialog::ExistingFiles );
|
||||
@@ -566,7 +564,7 @@ void patmanView::openFile()
|
||||
|
||||
|
||||
|
||||
void patmanView::updateFilename()
|
||||
void PatmanView::updateFilename()
|
||||
{
|
||||
m_displayFilename = "";
|
||||
Uint16 idx = m_pi->m_patchFile.length();
|
||||
@@ -593,48 +591,7 @@ void patmanView::updateFilename()
|
||||
|
||||
|
||||
|
||||
void patmanView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
stringPairDrag::mimeType() );
|
||||
if( txt.section( ':', 0, 0 ) == "samplefile" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void patmanView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
QString type = stringPairDrag::decodeKey( _de );
|
||||
QString value = stringPairDrag::decodeValue( _de );
|
||||
if( type == "samplefile" )
|
||||
{
|
||||
m_pi->setFile( value );
|
||||
_de->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
_de->ignore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void patmanView::paintEvent( QPaintEvent * )
|
||||
void PatmanView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
|
||||
@@ -647,7 +604,7 @@ void patmanView::paintEvent( QPaintEvent * )
|
||||
|
||||
|
||||
|
||||
void patmanView::modelChanged()
|
||||
void PatmanView::modelChanged()
|
||||
{
|
||||
m_pi = castModel<patmanInstrument>();
|
||||
m_loopButton->setModel( &m_pi->m_loopedModel );
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define _PATMAN_H_
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "sample_buffer.h"
|
||||
#include "automatable_model.h"
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
void selectSample( notePlayHandle * _n );
|
||||
|
||||
|
||||
friend class patmanView;
|
||||
friend class PatmanView;
|
||||
|
||||
signals:
|
||||
void fileChanged();
|
||||
@@ -115,12 +115,12 @@ signals:
|
||||
|
||||
|
||||
|
||||
class patmanView : public instrumentView
|
||||
class PatmanView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
patmanView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~patmanView();
|
||||
PatmanView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~PatmanView();
|
||||
|
||||
|
||||
public slots:
|
||||
@@ -129,8 +129,6 @@ public slots:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
virtual void paintEvent( QPaintEvent * );
|
||||
|
||||
|
||||
|
||||
@@ -742,7 +742,7 @@ public:
|
||||
|
||||
sf2InstrumentView::sf2InstrumentView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
// QVBoxLayout * vl = new QVBoxLayout( this );
|
||||
// QHBoxLayout * hl = new QHBoxLayout();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "instrument.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "knob.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "led_checkbox.h"
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
|
||||
|
||||
|
||||
class sf2InstrumentView : public instrumentView
|
||||
class sf2InstrumentView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -476,7 +476,7 @@ public:
|
||||
|
||||
sidInstrumentView::sidInstrumentView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
|
||||
setAutoFillBackground( TRUE );
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "knob.h"
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class sidInstrumentView : public instrumentView
|
||||
class sidInstrumentView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -307,7 +307,7 @@ pluginView * malletsInstrument::instantiateView( QWidget * _parent )
|
||||
|
||||
malletsInstrumentView::malletsInstrumentView( malletsInstrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
m_modalBarWidget = setupModalBarControls( this );
|
||||
setWidgetBackground( m_modalBarWidget, "artwork" );
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "combobox.h"
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "knob.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "led_checkbox.h"
|
||||
@@ -177,7 +177,7 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
class malletsInstrumentView: public instrumentView
|
||||
class malletsInstrumentView: public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -482,7 +482,7 @@ public:
|
||||
|
||||
tripleOscillatorView::tripleOscillatorView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "oscillator.h"
|
||||
#include "automatable_model.h"
|
||||
|
||||
@@ -148,7 +148,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class tripleOscillatorView : public instrumentView
|
||||
class tripleOscillatorView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -70,7 +70,7 @@ plugin::descriptor vestige_plugin_descriptor =
|
||||
}
|
||||
|
||||
|
||||
QPixmap * vestigeInstrumentView::s_artwork = NULL;
|
||||
QPixmap * VestigeInstrumentView::s_artwork = NULL;
|
||||
|
||||
|
||||
vestigeInstrument::vestigeInstrument( instrumentTrack * _instrument_track ) :
|
||||
@@ -246,7 +246,7 @@ void vestigeInstrument::loadFile( const QString & _file )
|
||||
|
||||
pluginView * vestigeInstrument::instantiateView( QWidget * _parent )
|
||||
{
|
||||
return new vestigeInstrumentView( this, _parent );
|
||||
return new VestigeInstrumentView( this, _parent );
|
||||
}
|
||||
|
||||
|
||||
@@ -257,9 +257,9 @@ pluginView * vestigeInstrument::instantiateView( QWidget * _parent )
|
||||
|
||||
|
||||
|
||||
vestigeInstrumentView::vestigeInstrumentView( instrument * _instrument,
|
||||
VestigeInstrumentView::VestigeInstrumentView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
if( s_artwork == NULL )
|
||||
{
|
||||
@@ -301,21 +301,19 @@ vestigeInstrumentView::vestigeInstrumentView( instrument * _instrument,
|
||||
note_off_all_btn->setFont( pointSize<8>( note_off_all_btn->font() ) );
|
||||
connect( note_off_all_btn, SIGNAL( clicked() ), this,
|
||||
SLOT( noteOffAll() ) );
|
||||
|
||||
setAcceptDrops( true );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
vestigeInstrumentView::~vestigeInstrumentView()
|
||||
VestigeInstrumentView::~VestigeInstrumentView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::modelChanged()
|
||||
void VestigeInstrumentView::modelChanged()
|
||||
{
|
||||
m_vi = castModel<vestigeInstrument>();
|
||||
}
|
||||
@@ -323,7 +321,7 @@ void vestigeInstrumentView::modelChanged()
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::openPlugin()
|
||||
void VestigeInstrumentView::openPlugin()
|
||||
{
|
||||
QFileDialog ofd( NULL, tr( "Open VST-plugin" ) );
|
||||
|
||||
@@ -367,7 +365,7 @@ void vestigeInstrumentView::openPlugin()
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::toggleGUI()
|
||||
void VestigeInstrumentView::toggleGUI()
|
||||
{
|
||||
QMutexLocker ml( &m_vi->m_pluginMutex );
|
||||
if( m_vi->m_plugin == NULL )
|
||||
@@ -392,7 +390,7 @@ void vestigeInstrumentView::toggleGUI()
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::noteOffAll()
|
||||
void VestigeInstrumentView::noteOffAll()
|
||||
{
|
||||
m_vi->m_pluginMutex.lock();
|
||||
if( m_vi->m_plugin != NULL )
|
||||
@@ -409,47 +407,7 @@ void vestigeInstrumentView::noteOffAll()
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
stringPairDrag::mimeType() );
|
||||
if( txt.section( ':', 0, 0 ) == "vstplugin" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
QString type = stringPairDrag::decodeKey( _de );
|
||||
QString value = stringPairDrag::decodeValue( _de );
|
||||
if( type == "vstplugin" )
|
||||
{
|
||||
m_vi->loadFile( value );
|
||||
_de->accept();
|
||||
return;
|
||||
}
|
||||
_de->ignore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void vestigeInstrumentView::paintEvent( QPaintEvent * )
|
||||
void VestigeInstrumentView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
|
||||
|
||||
@@ -26,12 +26,10 @@
|
||||
#ifndef _VESTIGE_H
|
||||
#define _VESTIGE_H
|
||||
|
||||
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "midi.h"
|
||||
#include "note.h"
|
||||
|
||||
@@ -83,18 +81,18 @@ private:
|
||||
QString m_pluginDLL;
|
||||
|
||||
|
||||
friend class vestigeInstrumentView;
|
||||
friend class VestigeInstrumentView;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class vestigeInstrumentView : public instrumentView
|
||||
class VestigeInstrumentView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
vestigeInstrumentView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~vestigeInstrumentView();
|
||||
VestigeInstrumentView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~VestigeInstrumentView();
|
||||
|
||||
|
||||
protected slots:
|
||||
@@ -104,8 +102,6 @@ protected slots:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ pluginView * vibed::instantiateView( QWidget * _parent )
|
||||
|
||||
vibedView::vibedView( instrument * _instrument,
|
||||
QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define _VIBED_H
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "sample_buffer.h"
|
||||
#include "graph.h"
|
||||
#include "knob.h"
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class vibedView : public instrumentView
|
||||
class vibedView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -248,7 +248,7 @@ void zynAddSubFx::initRemotePlugin( void )
|
||||
|
||||
pluginView * zynAddSubFx::instantiateView( QWidget * _parent )
|
||||
{
|
||||
return new zynAddSubFxView( this, _parent );
|
||||
return new ZynAddSubFxView( this, _parent );
|
||||
}
|
||||
|
||||
|
||||
@@ -257,8 +257,8 @@ pluginView * zynAddSubFx::instantiateView( QWidget * _parent )
|
||||
|
||||
|
||||
|
||||
zynAddSubFxView::zynAddSubFxView( instrument * _instrument, QWidget * _parent ) :
|
||||
instrumentView( _instrument, _parent )
|
||||
ZynAddSubFxView::ZynAddSubFxView( instrument * _instrument, QWidget * _parent ) :
|
||||
InstrumentView( _instrument, _parent )
|
||||
{
|
||||
setAutoFillBackground( true );
|
||||
QPalette pal;
|
||||
@@ -277,62 +277,19 @@ zynAddSubFxView::zynAddSubFxView( instrument * _instrument, QWidget * _parent )
|
||||
m_toggleUIButton->setWhatsThis(
|
||||
tr( "Click here to show or hide the graphical user interface "
|
||||
"(GUI) of ZynAddSubFX." ) );
|
||||
|
||||
setAcceptDrops( true );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
zynAddSubFxView::~zynAddSubFxView()
|
||||
ZynAddSubFxView::~ZynAddSubFxView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void zynAddSubFxView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( _dee->mimeData()->hasFormat( stringPairDrag::mimeType() ) )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
stringPairDrag::mimeType() );
|
||||
if( txt.section( ':', 0, 0 ) == "pluginpresetfile" )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_dee->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void zynAddSubFxView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
const QString type = stringPairDrag::decodeKey( _de );
|
||||
const QString value = stringPairDrag::decodeValue( _de );
|
||||
if( type == "pluginpresetfile" )
|
||||
{
|
||||
// TODO: replace by generic approach
|
||||
// castModel<zynAddSubFx>()->loadFile( value );
|
||||
_de->accept();
|
||||
return;
|
||||
}
|
||||
_de->ignore();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void zynAddSubFxView::modelChanged( void )
|
||||
void ZynAddSubFxView::modelChanged( void )
|
||||
{
|
||||
toggleUI();
|
||||
}
|
||||
@@ -340,7 +297,7 @@ void zynAddSubFxView::modelChanged( void )
|
||||
|
||||
|
||||
|
||||
void zynAddSubFxView::toggleUI( void )
|
||||
void ZynAddSubFxView::toggleUI( void )
|
||||
{
|
||||
if( m_toggleUIButton->isChecked() )
|
||||
{
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "InstrumentView.h"
|
||||
#include "remote_plugin.h"
|
||||
|
||||
|
||||
class QPushButton;
|
||||
|
||||
class zynAddSubFxView;
|
||||
class ZynAddSubFxView;
|
||||
class notePlayHandle;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
QMutex m_pluginMutex;
|
||||
remotePlugin * m_plugin;
|
||||
|
||||
friend class zynAddSubFxView;
|
||||
friend class ZynAddSubFxView;
|
||||
|
||||
|
||||
signals:
|
||||
@@ -88,17 +88,12 @@ signals:
|
||||
|
||||
|
||||
|
||||
class zynAddSubFxView : public instrumentView
|
||||
class ZynAddSubFxView : public InstrumentView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
zynAddSubFxView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~zynAddSubFxView();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
ZynAddSubFxView( instrument * _instrument, QWidget * _parent );
|
||||
virtual ~ZynAddSubFxView();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* instrument.cpp - base-class for all instrument-plugins (synths, samplers etc)
|
||||
*
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -26,9 +24,8 @@
|
||||
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
#include "instrument_track.h"
|
||||
#include "dummy_instrument.h"
|
||||
#include "DummyInstrument.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "embed.h"
|
||||
|
||||
@@ -66,7 +63,7 @@ void instrument::deleteNotePluginData( notePlayHandle * )
|
||||
|
||||
f_cnt_t instrument::beatLen( notePlayHandle * ) const
|
||||
{
|
||||
return( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,12 +78,12 @@ instrument * instrument::instantiate( const QString & _plugin_name,
|
||||
if( dynamic_cast<instrument *>( p ) != NULL )
|
||||
{
|
||||
// everything ok, so return pointer
|
||||
return( dynamic_cast<instrument *>( p ) );
|
||||
return dynamic_cast<instrument *>( p );
|
||||
}
|
||||
|
||||
// not quite... so delete plugin and return dummy instrument
|
||||
delete p;
|
||||
return( new dummyInstrument( _instrument_track ) );
|
||||
return new DummyInstrument( _instrument_track );
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +91,7 @@ instrument * instrument::instantiate( const QString & _plugin_name,
|
||||
|
||||
bool instrument::isFromTrack( const track * _track ) const
|
||||
{
|
||||
return( m_instrumentTrack == _track );
|
||||
return m_instrumentTrack == _track;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,52 +126,3 @@ QString instrument::fullDisplayName( void ) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
instrumentView::instrumentView( instrument * _instrument, QWidget * _parent ) :
|
||||
pluginView( _instrument, _parent )
|
||||
{
|
||||
setModel( _instrument );
|
||||
setFixedSize( 250, 250 );
|
||||
setAttribute( Qt::WA_DeleteOnClose, TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
instrumentView::~instrumentView()
|
||||
{
|
||||
if( getInstrumentTrackWindow() )
|
||||
{
|
||||
getInstrumentTrackWindow()->m_instrumentView = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentView::setModel( ::model * _model, bool )
|
||||
{
|
||||
if( dynamic_cast<instrument *>( _model ) != NULL )
|
||||
{
|
||||
modelView::setModel( _model );
|
||||
getInstrumentTrackWindow()->setWindowIcon(
|
||||
model()->getDescriptor()->logo->pixmap() );
|
||||
connect( model(), SIGNAL( destroyed( QObject * ) ),
|
||||
this, SLOT( close() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
instrumentTrackWindow * instrumentView::getInstrumentTrackWindow( void )
|
||||
{
|
||||
return( dynamic_cast<instrumentTrackWindow *>(
|
||||
parentWidget()->parentWidget() ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
116
src/gui/InstrumentView.cpp
Normal file
116
src/gui/InstrumentView.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* InstrumentView.cpp - base-class for views of all instruments
|
||||
*
|
||||
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "InstrumentView.h"
|
||||
#include "embed.h"
|
||||
#include "instrument.h"
|
||||
#include "instrument_track.h"
|
||||
#include "ResourceDB.h"
|
||||
#include "string_pair_drag.h"
|
||||
#include "UnifiedResourceProvider.h"
|
||||
|
||||
|
||||
InstrumentView::InstrumentView( instrument * _instrument, QWidget * _parent ) :
|
||||
pluginView( _instrument, _parent )
|
||||
{
|
||||
setModel( _instrument );
|
||||
setFixedSize( 250, 250 );
|
||||
setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
setAcceptDrops( true );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
InstrumentView::~InstrumentView()
|
||||
{
|
||||
if( getInstrumentTrackWindow() )
|
||||
{
|
||||
getInstrumentTrackWindow()->m_instrumentView = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentView::setModel( ::model * _model, bool )
|
||||
{
|
||||
if( dynamic_cast<instrument *>( _model ) != NULL )
|
||||
{
|
||||
modelView::setModel( _model );
|
||||
getInstrumentTrackWindow()->setWindowIcon(
|
||||
model()->getDescriptor()->logo->pixmap() );
|
||||
connect( model(), SIGNAL( destroyed( QObject * ) ),
|
||||
this, SLOT( close() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
instrumentTrackWindow * InstrumentView::getInstrumentTrackWindow( void )
|
||||
{
|
||||
return dynamic_cast<instrumentTrackWindow *>(
|
||||
parentWidget()->parentWidget() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
if( stringPairDrag::decodeKey( _dee ) == ResourceItem::mimeKey() )
|
||||
{
|
||||
const ResourceItem * item =
|
||||
engine::resourceProvider()->database()->
|
||||
itemByHash( stringPairDrag::decodeValue( _dee ) );
|
||||
if( item &&
|
||||
model()->getDescriptor()->supportsFileType(
|
||||
item->nameExtension() ) )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
if( stringPairDrag::decodeKey( _de ) == ResourceItem::mimeKey() )
|
||||
{
|
||||
const ResourceItem * item =
|
||||
engine::resourceProvider()->database()->
|
||||
itemByHash( stringPairDrag::decodeValue( _de ) );
|
||||
model()->loadResource( item );
|
||||
_de->accept();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user