Added keyboard handling and shortcut for import file

This commit is contained in:
xenakios 2018-10-07 14:29:50 +03:00
parent 08d80338bd
commit ce0f06ee03
2 changed files with 17 additions and 4 deletions

View File

@ -29,6 +29,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
m_free_filter_component(&p), m_free_filter_component(&p),
m_wavefilter_tab(p.m_cur_tab_index) m_wavefilter_tab(p.m_cur_tab_index)
{ {
setWantsKeyboardFocus(true);
m_wave_container = new Component; m_wave_container = new Component;
m_free_filter_component.getEnvelopeComponent()->set_envelope(processor.m_free_filter_envelope); m_free_filter_component.getEnvelopeComponent()->set_envelope(processor.m_free_filter_envelope);
m_free_filter_component.getEnvelopeComponent()->XFromNormalized = [this](double x) 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() void PaulstretchpluginAudioProcessorEditor::chooseFile()
{ {
String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder", String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder",
File::getSpecialLocation(File::userHomeDirectory).getFullPathName()); File::getSpecialLocation(File::userHomeDirectory).getFullPathName());
File initialloc(initiallocfn); File initialloc(initiallocfn);
String filterstring = processor.m_afm->getWildcardForAllFormats(); String filterstring = processor.m_afm->getWildcardForAllFormats();
auto prevcomp = std::make_unique<AudioFilePreviewComponent>(&processor); //auto prevcomp = std::make_unique<AudioFilePreviewComponent>(&processor);
processor.setAudioPreview(prevcomp.get()); //processor.setAudioPreview(prevcomp.get());
FileChooser myChooser("Please select audio file...", FileChooser myChooser("Please select audio file...",
initialloc, initialloc,
filterstring,false); filterstring,true);
if (myChooser.browseForFileToOpen(prevcomp.get())) if (myChooser.browseForFileToOpen())
{ {
File resu = myChooser.getResult(); File resu = myChooser.getResult();
String pathname = resu.getFullPathName(); String pathname = resu.getFullPathName();

View File

@ -313,6 +313,8 @@ public:
bool isInterestedInFileDrag(const StringArray &files) override; bool isInterestedInFileDrag(const StringArray &files) override;
void filesDropped(const StringArray &files, int x, int y) override; void filesDropped(const StringArray &files, int x, int y) override;
bool keyPressed(const KeyPress& press) override;
WaveformComponent m_wavecomponent; WaveformComponent m_wavecomponent;
void chooseFile(); void chooseFile();
void showRenderDialog(); void showRenderDialog();