From 5c900ee9b6ebfeb6ffc156ab6ea7bed6930c0301 Mon Sep 17 00:00:00 2001 From: xenakios Date: Fri, 29 Jun 2018 15:13:49 +0300 Subject: [PATCH] Attempt to store and recall current GUI tab index but not working... --- Source/PluginEditor.cpp | 4 +++- Source/PluginEditor.h | 14 +++++++++++++- Source/PluginProcessor.cpp | 2 ++ Source/PluginProcessor.h | 2 +- readme.txt | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 651ad12..d7497b7 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -26,7 +26,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau : AudioProcessorEditor(&p), m_wavecomponent(p.m_afm,p.m_thumb.get()), processor(p), m_perfmeter(&p), - m_wavefilter_tab(TabbedButtonBar::TabsAtTop), + m_wavefilter_tab(p.m_cur_tab_index), m_free_filter_component(&p) { m_wave_container = new Component; @@ -443,6 +443,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) processor.m_free_filter_envelope->updateMinMaxValues(); m_free_filter_component.repaint(); m_spec_order_ed.repaint(); + //if (m_wavefilter_tab.getCurrentTabIndex() != processor.m_cur_tab_index) + // m_wavefilter_tab.setCurrentTabIndex(processor.m_cur_tab_index, false); } } diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index dd1bc89..eb0abe9 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -246,6 +246,18 @@ private: int m_slidwidth = 400; }; +class MyTabComponent : public TabbedComponent +{ +public: + MyTabComponent(int& curtab) : TabbedComponent(TabbedButtonBar::TabsAtTop), m_cur_tab(curtab) {} + void currentTabChanged(int newCurrentTabIndex, const String&) override + { + m_cur_tab = newCurrentTabIndex; + } +private: + int& m_cur_tab; +}; + class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor, public MultiTimer, public FileDragAndDropTarget, public DragAndDropContainer { @@ -280,7 +292,7 @@ private: zoom_scrollbar m_zs; RatioMixerEditor m_ratiomixeditor{ 8 }; FreeFilterComponent m_free_filter_component; - TabbedComponent m_wavefilter_tab; + MyTabComponent m_wavefilter_tab; Component* m_wave_container=nullptr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index c9eda04..b6ef0cb 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -246,6 +246,7 @@ ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool storeToTreeProperties(paramtree, nullptr, "playwhenhostrunning", m_play_when_host_plays, "capturewhenhostrunning", m_capture_when_host_plays); storeToTreeProperties(paramtree, nullptr, "mutewhilecapturing", m_mute_while_capturing); } + storeToTreeProperties(paramtree, nullptr, "tabaindex", m_cur_tab_index); storeToTreeProperties(paramtree, nullptr, "waveviewrange", m_wave_view_range); ValueTree freefilterstate = m_free_filter_envelope->saveState(Identifier("freefilter_envelope")); paramtree.addChild(freefilterstate, -1, nullptr); @@ -263,6 +264,7 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree) m_load_file_with_state = tree.getProperty("loadfilewithstate", true); getFromTreeProperties(tree, "playwhenhostrunning", m_play_when_host_plays, "capturewhenhostrunning", m_capture_when_host_plays,"mutewhilecapturing",m_mute_while_capturing); + getFromTreeProperties(tree, "tabaindex", m_cur_tab_index); if (tree.hasProperty("numspectralstagesb")) { std::vector old_order = m_stretch_source->getSpectrumProcessOrder(); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 3a62012..00c3f88 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -213,7 +213,7 @@ public: pointer_sized_int value, void* ptr, float opt) override; - + int m_cur_tab_index = 0; private: diff --git a/readme.txt b/readme.txt index cf38221..5df5dae 100644 --- a/readme.txt +++ b/readme.txt @@ -20,7 +20,7 @@ History : -Changed "Octaves" module to "Ratios". The Ratios module has more shifters than the previous Octaves module and allows changing the pitch ratios (and the shifters mix) in a separate tabbed page in the GUI. - -Spectral module enabled parameters changed to target named modules instead of chain slots + -Spectral module enabled parameters changed to target particular modules instead of chain slots -Save and restore some additional settings 04-01-2018 1.1.2 -Rebuilt with latest JUCE to fix parameter automation issue for example in Ableton Live