diff --git a/VASTvaporizer/Source/Plugin/VASTAudioProcessor.cpp b/VASTvaporizer/Source/Plugin/VASTAudioProcessor.cpp index 0aa211a..bd021e1 100644 --- a/VASTvaporizer/Source/Plugin/VASTAudioProcessor.cpp +++ b/VASTvaporizer/Source/Plugin/VASTAudioProcessor.cpp @@ -528,6 +528,12 @@ void VASTAudioProcessor::initializeToDefaults() { m_parameterState.undoManager->beginNewTransaction(); //start new transcation only here? } +void VASTAudioProcessor::loadPresetFile(File presetvvpfile) { + VASTPresetElement lPreset{}; + std::unique_ptr xml(new XmlDocument(presetvvpfile)); + bool success = loadPatchXML(xml.get(), false, &lPreset, lPreset.presetarrayindex, lPreset); +} + void VASTAudioProcessor::setCurrentProgram(int index) { if (index >= getNumPrograms()) { diff --git a/VASTvaporizer/Source/Plugin/VASTAudioProcessor.h b/VASTvaporizer/Source/Plugin/VASTAudioProcessor.h index d58cb51..73c0060 100644 --- a/VASTvaporizer/Source/Plugin/VASTAudioProcessor.h +++ b/VASTvaporizer/Source/Plugin/VASTAudioProcessor.h @@ -239,6 +239,7 @@ class VASTAudioProcessor : public AudioProcessor bool isUserPatch(); String getUserPatchName(); void savePatchXML(File *selectedFile); + void loadPresetFile(File presetvvpfile); bool loadPatchXML(XmlDocument* xmlDoc, bool bNameOnly, const VASTPresetElement* preset, int index, VASTPresetElement& resultPresetData); static String getVSTPath(); static String getVSTPathAlternative(); diff --git a/VASTvaporizer/Source/Plugin/VASTHeaderComponent.cpp b/VASTvaporizer/Source/Plugin/VASTHeaderComponent.cpp index 7c84402..d749fef 100644 --- a/VASTvaporizer/Source/Plugin/VASTHeaderComponent.cpp +++ b/VASTvaporizer/Source/Plugin/VASTHeaderComponent.cpp @@ -449,6 +449,19 @@ void VASTHeaderComponent::buttonClicked (juce::Button* buttonThatWasClicked) //[/UserbuttonClicked_Post] } +void VASTHeaderComponent::filesDropped (const juce::StringArray& filenames, int mouseX, int mouseY) +{ + //[UserCode_filesDropped] -- Add your code here... + if (filenames.size() < 1) + return; + String filename = filenames[0]; + File presetfile = File(filename); + if ((!presetfile.existsAsFile()) || (!presetfile.getFileExtension().equalsIgnoreCase(".vvp"))) + return; + myProcessor->loadPresetFile(presetfile); + //[/UserCode_filesDropped] +} + void VASTHeaderComponent::mouseDown (const juce::MouseEvent& e) { //[UserCode_mouseDown] -- Add your code here... @@ -476,6 +489,16 @@ void VASTHeaderComponent::mouseDown (const juce::MouseEvent& e) //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... +bool VASTHeaderComponent::isInterestedInFileDrag(const juce::StringArray& filenames) +{ + if (filenames.size() < 1) + return false; + String filename = filenames[0]; + File presetfile = File(filename); + if ((!presetfile.existsAsFile()) || (!presetfile.getFileExtension().equalsIgnoreCase(".vvp"))) + return false; + return true; +} //[/MiscUserCode] @@ -489,12 +512,14 @@ void VASTHeaderComponent::mouseDown (const juce::MouseEvent& e) BEGIN_JUCER_METADATA +