diff --git a/plugins/zynaddsubfx/zynaddsubfx.cpp b/plugins/zynaddsubfx/zynaddsubfx.cpp index ed77c7583..9b952af70 100644 --- a/plugins/zynaddsubfx/zynaddsubfx.cpp +++ b/plugins/zynaddsubfx/zynaddsubfx.cpp @@ -291,7 +291,7 @@ void zynAddSubFxView::dragEnterEvent( QDragEnterEvent * _dee ) { QString txt = _dee->mimeData()->data( stringPairDrag::mimeType() ); - if( txt.section( ':', 0, 0 ) == "presetfile" ) + if( txt.section( ':', 0, 0 ) == "pluginpresetfile" ) { _dee->acceptProposedAction(); } @@ -313,7 +313,7 @@ void zynAddSubFxView::dropEvent( QDropEvent * _de ) { const QString type = stringPairDrag::decodeKey( _de ); const QString value = stringPairDrag::decodeValue( _de ); - if( type == "presetfile" ) + if( type == "pluginpresetfile" ) { castModel()->loadFile( value ); _de->accept(); diff --git a/src/gui/file_browser.cpp b/src/gui/file_browser.cpp index d98a5cbf5..19f935683 100644 --- a/src/gui/file_browser.cpp +++ b/src/gui/file_browser.cpp @@ -2,7 +2,7 @@ * file_browser.cpp - implementation of the project-, preset- and * sample-file-browser * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -474,38 +474,28 @@ void fileBrowserTreeWidget::mouseMoveEvent( QMouseEvent * _me ) switch( f->type() ) { case fileItem::PresetFile: - new stringPairDrag( "presetfile", - f->fullName(), - embed::getIconPixmap( - "preset_file" ), - this ); + new stringPairDrag( f->handling() == fileItem::LoadAsPreset ? + "presetfile" : "pluginpresetfile", + f->fullName(), + embed::getIconPixmap( "preset_file" ), this ); break; case fileItem::SampleFile: - new stringPairDrag( "samplefile", - f->fullName(), - embed::getIconPixmap( - "sample_file" ), - this ); + new stringPairDrag( "samplefile", f->fullName(), + embed::getIconPixmap( "sample_file" ), this ); break; case fileItem::MidiFile: // don't allow dragging FLP-files as FLP import filter clears project // without asking // case fileItem::FlpFile: - new stringPairDrag( "importedproject", - f->fullName(), - embed::getIconPixmap( - "midi_file" ), - this ); + new stringPairDrag( "importedproject", f->fullName(), + embed::getIconPixmap( "midi_file" ), this ); break; case fileItem::VstPluginFile: - new stringPairDrag( "vstplugin", - f->fullName(), - embed::getIconPixmap( - "sample_file" ), - this ); + new stringPairDrag( "vstplugin", f->fullName(), + embed::getIconPixmap( "sample_file" ), this ); break; default: diff --git a/src/gui/track_container_view.cpp b/src/gui/track_container_view.cpp index f90f200a9..43bf73fcf 100644 --- a/src/gui/track_container_view.cpp +++ b/src/gui/track_container_view.cpp @@ -1,7 +1,7 @@ /* * track_container_view.cpp - view-component for trackContainer * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -363,7 +363,7 @@ void trackContainerView::redoStep( journalEntry & _je ) void trackContainerView::dragEnterEvent( QDragEnterEvent * _dee ) { stringPairDrag::processDragEnterEvent( _dee, - QString( "presetfile,sampledata,samplefile,instrument," + QString( "presetfile,pluginpresetfile,samplefile,instrument," "importedproject,track_%1,track_%2" ). arg( track::InstrumentTrack ). arg( track::SampleTrack ) ); @@ -386,16 +386,14 @@ void trackContainerView::dropEvent( QDropEvent * _de ) //it->toggledInstrumentTrackButton( true ); _de->accept(); } - else if( /*type == "sampledata" || */type == "samplefile" ) + else if( type == "samplefile" || type == "pluginpresetfile" ) { instrumentTrack * it = dynamic_cast( track::create( track::InstrumentTrack, m_tc ) ); - const QString iname = /*( type == "sampledata" ) ? - "audiofileprocessor" :*/ + instrument * i = it->loadInstrument( engine::pluginFileHandling()[fileItem::extension( - value )]; - instrument * i = it->loadInstrument( iname ); + value )]); i->loadFile( value ); //it->toggledInstrumentTrackButton( true ); _de->accept(); diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index ea84bf7bc..5f7033f1a 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -49,6 +49,7 @@ #include "effect_rack_view.h" #include "embed.h" #include "engine.h" +#include "file_browser.h" #include "fx_mixer.h" #include "fx_mixer_view.h" #include "instrument_sound_shaping.h" @@ -1447,7 +1448,8 @@ void instrumentTrackWindow::focusInEvent( QFocusEvent * ) void instrumentTrackWindow::dragEnterEventGeneric( QDragEnterEvent * _dee ) { - stringPairDrag::processDragEnterEvent( _dee, "instrument,presetfile" ); + stringPairDrag::processDragEnterEvent( _dee, "instrument,presetfile," + "pluginpresetfile" ); } @@ -1480,6 +1482,18 @@ void instrumentTrackWindow::dropEvent( QDropEvent * _de ) engine::getSong()->setModified(); _de->accept(); } + else if( type == "pluginpresetfile" ) + { + const QString ext = fileItem::extension( value ); + instrument * i = m_track->getInstrument(); + if( !i->getDescriptor()->supportsFileType( ext ) ) + { + i = m_track->loadInstrument( + engine::pluginFileHandling()[ext] ); + } + i->loadFile( value ); + _de->accept(); + } }