| @@ -210,7 +210,8 @@ public: | |||||
| { | { | ||||
| showAdvancedSettingsButton.reset (new TextButton (TRANS("Show advanced settings..."))); | showAdvancedSettingsButton.reset (new TextButton (TRANS("Show advanced settings..."))); | ||||
| addAndMakeVisible (showAdvancedSettingsButton.get()); | addAndMakeVisible (showAdvancedSettingsButton.get()); | ||||
| showAdvancedSettingsButton->onClick = [this] { showAdvanced(); }; | |||||
| showAdvancedSettingsButton->setClickingTogglesState (true); | |||||
| showAdvancedSettingsButton->onClick = [this] { toggleAdvancedSettings(); }; | |||||
| } | } | ||||
| type.scanForDevices(); | type.scanForDevices(); | ||||
| @@ -276,27 +277,37 @@ public: | |||||
| r.removeFromTop (space * 2); | r.removeFromTop (space * 2); | ||||
| if (showAdvancedSettingsButton != nullptr) | |||||
| if (showAdvancedSettingsButton != nullptr | |||||
| && sampleRateDropDown != nullptr && bufferSizeDropDown != nullptr) | |||||
| { | { | ||||
| showAdvancedSettingsButton->setBounds (r.withHeight (h)); | |||||
| showAdvancedSettingsButton->setBounds (r.removeFromTop (h)); | |||||
| r.removeFromTop (space); | |||||
| showAdvancedSettingsButton->changeWidthToFitText(); | showAdvancedSettingsButton->changeWidthToFitText(); | ||||
| } | } | ||||
| const bool advancedSettingsVisible = showAdvancedSettingsButton == nullptr | |||||
| || ! showAdvancedSettingsButton->isVisible(); | |||||
| auto advancedSettingsVisible = showAdvancedSettingsButton == nullptr | |||||
| || showAdvancedSettingsButton->getToggleState(); | |||||
| if (sampleRateDropDown != nullptr) | if (sampleRateDropDown != nullptr) | ||||
| { | { | ||||
| sampleRateDropDown->setVisible (advancedSettingsVisible); | sampleRateDropDown->setVisible (advancedSettingsVisible); | ||||
| sampleRateDropDown->setBounds (r.removeFromTop (h)); | |||||
| r.removeFromTop (space); | |||||
| if (advancedSettingsVisible) | |||||
| { | |||||
| sampleRateDropDown->setBounds (r.removeFromTop (h)); | |||||
| r.removeFromTop (space); | |||||
| } | |||||
| } | } | ||||
| if (bufferSizeDropDown != nullptr) | if (bufferSizeDropDown != nullptr) | ||||
| { | { | ||||
| bufferSizeDropDown->setVisible (advancedSettingsVisible); | bufferSizeDropDown->setVisible (advancedSettingsVisible); | ||||
| bufferSizeDropDown->setBounds (r.removeFromTop (h)); | |||||
| r.removeFromTop (space); | |||||
| if (advancedSettingsVisible) | |||||
| { | |||||
| bufferSizeDropDown->setBounds (r.removeFromTop (h)); | |||||
| r.removeFromTop (space); | |||||
| } | |||||
| } | } | ||||
| r.removeFromTop (space); | r.removeFromTop (space); | ||||
| @@ -400,9 +411,10 @@ public: | |||||
| return false; | return false; | ||||
| } | } | ||||
| void showAdvanced() | |||||
| void toggleAdvancedSettings() | |||||
| { | { | ||||
| showAdvancedSettingsButton->setVisible (false); | |||||
| showAdvancedSettingsButton->setButtonText ((showAdvancedSettingsButton->getToggleState() ? "Hide " : "Show ") | |||||
| + String ("advanced settings...")); | |||||
| resized(); | resized(); | ||||
| } | } | ||||