Browse Source

Added keyboard handling and shortcut for import file

master
xenakios 6 years ago
parent
commit
ce0f06ee03
2 changed files with 17 additions and 4 deletions
  1. +15
    -4
      Source/PluginEditor.cpp
  2. +2
    -0
      Source/PluginEditor.h

+ 15
- 4
Source/PluginEditor.cpp View File

@@ -29,6 +29,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
m_free_filter_component(&p),
m_wavefilter_tab(p.m_cur_tab_index)
{
setWantsKeyboardFocus(true);
m_wave_container = new Component;
m_free_filter_component.getEnvelopeComponent()->set_envelope(processor.m_free_filter_envelope);
m_free_filter_component.getEnvelopeComponent()->XFromNormalized = [this](double x)
@@ -460,18 +461,28 @@ void PaulstretchpluginAudioProcessorEditor::filesDropped(const StringArray & fil
}
}

bool PaulstretchpluginAudioProcessorEditor::keyPressed(const KeyPress & press)
{
if (press == 'I')
{
chooseFile();
return true;
}
return false;
}

void PaulstretchpluginAudioProcessorEditor::chooseFile()
{
String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder",
File::getSpecialLocation(File::userHomeDirectory).getFullPathName());
File initialloc(initiallocfn);
String filterstring = processor.m_afm->getWildcardForAllFormats();
auto prevcomp = std::make_unique<AudioFilePreviewComponent>(&processor);
processor.setAudioPreview(prevcomp.get());
//auto prevcomp = std::make_unique<AudioFilePreviewComponent>(&processor);
//processor.setAudioPreview(prevcomp.get());
FileChooser myChooser("Please select audio file...",
initialloc,
filterstring,false);
if (myChooser.browseForFileToOpen(prevcomp.get()))
filterstring,true);
if (myChooser.browseForFileToOpen())
{
File resu = myChooser.getResult();
String pathname = resu.getFullPathName();


+ 2
- 0
Source/PluginEditor.h View File

@@ -313,6 +313,8 @@ public:
bool isInterestedInFileDrag(const StringArray &files) override;
void filesDropped(const StringArray &files, int x, int y) override;

bool keyPressed(const KeyPress& press) override;

WaveformComponent m_wavecomponent;
void chooseFile();
void showRenderDialog();


Loading…
Cancel
Save