Added keyboard handling and shortcut for import file
This commit is contained in:
		@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user