andrewm@41: /* andrewm@41: ============================================================================== andrewm@41: andrewm@41: This is an automatically generated GUI class created by the Introjucer! andrewm@41: andrewm@41: Be careful when adding custom code to these files, as only the code within andrewm@41: the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded andrewm@41: and re-saved. andrewm@41: andrewm@41: Created with Introjucer version: 3.1.0 andrewm@41: andrewm@41: ------------------------------------------------------------------------------ andrewm@41: andrewm@41: The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" andrewm@41: Copyright 2004-13 by Raw Material Software Ltd. andrewm@41: andrewm@41: ============================================================================== andrewm@41: */ andrewm@41: andrewm@41: //[Headers] You can add your own extra header files here... andrewm@50: #ifndef TOUCHKEYS_NO_GUI andrewm@41: #include "../MainApplicationController.h" andrewm@41: //[/Headers] andrewm@41: andrewm@41: #include "PreferencesComponent.h" andrewm@41: andrewm@41: andrewm@41: //[MiscUserDefs] You can add your own user definitions and misc code here... andrewm@41: //[/MiscUserDefs] andrewm@41: andrewm@41: //============================================================================== andrewm@41: PreferencesComponent::PreferencesComponent () andrewm@41: : controller_(0) andrewm@41: { andrewm@41: addAndMakeVisible (startupPresetComboBox = new ComboBox ("Startup preset combo box")); andrewm@41: startupPresetComboBox->setEditableText (false); andrewm@41: startupPresetComboBox->setJustificationType (Justification::centredLeft); andrewm@41: startupPresetComboBox->setTextWhenNothingSelected (String::empty); andrewm@41: startupPresetComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@41: startupPresetComboBox->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (label4 = new Label ("new label", andrewm@41: "Load preset on startup:")); andrewm@41: label4->setFont (Font (15.00f, Font::plain)); andrewm@41: label4->setJustificationType (Justification::centredLeft); andrewm@41: label4->setEditable (false, false, false); andrewm@41: label4->setColour (TextEditor::textColourId, Colours::black); andrewm@41: label4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (startTouchKeysButton = new ToggleButton ("auto start TouchKeys button")); andrewm@41: startTouchKeysButton->setButtonText ("Start TouchKeys on startup"); andrewm@41: startTouchKeysButton->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (autodetectButton = new ToggleButton ("Autodetect button")); andrewm@41: autodetectButton->setButtonText ("Autodetect TouchKeys octave on each start"); andrewm@41: autodetectButton->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (defaultsButton = new TextButton ("new button")); andrewm@41: defaultsButton->setButtonText ("Reset to Defaults..."); andrewm@41: defaultsButton->addListener (this); andrewm@41: andrewm@41: andrewm@41: //[UserPreSize] andrewm@41: //[/UserPreSize] andrewm@41: andrewm@41: setSize (296, 152); andrewm@41: andrewm@41: andrewm@41: //[Constructor] You can add your own custom stuff here.. andrewm@41: andrewm@41: // Initialise the combo box andrewm@41: startupPresetComboBox->addItem("None", kStartupPresetNone); andrewm@41: startupPresetComboBox->addItem("Vibrato and Pitch Bend", kStartupPresetVibratoPitchBend); andrewm@41: startupPresetComboBox->addItem("Last Saved", kStartupPresetLastSaved); andrewm@41: startupPresetComboBox->addItem("Choose...", kStartupPresetChoose); andrewm@41: andrewm@41: //[/Constructor] andrewm@41: } andrewm@41: andrewm@41: PreferencesComponent::~PreferencesComponent() andrewm@41: { andrewm@41: //[Destructor_pre]. You can add your own custom destruction code here.. andrewm@41: //[/Destructor_pre] andrewm@41: andrewm@41: startupPresetComboBox = nullptr; andrewm@41: label4 = nullptr; andrewm@41: startTouchKeysButton = nullptr; andrewm@41: autodetectButton = nullptr; andrewm@41: defaultsButton = nullptr; andrewm@41: andrewm@41: andrewm@41: //[Destructor]. You can add your own custom destruction code here.. andrewm@41: //[/Destructor] andrewm@41: } andrewm@41: andrewm@41: //============================================================================== andrewm@41: void PreferencesComponent::paint (Graphics& g) andrewm@41: { andrewm@41: //[UserPrePaint] Add your own custom painting code here.. andrewm@41: //[/UserPrePaint] andrewm@41: andrewm@41: g.fillAll (Colour (0xffd2d2d2)); andrewm@41: andrewm@41: //[UserPaint] Add your own custom painting code here.. andrewm@41: //[/UserPaint] andrewm@41: } andrewm@41: andrewm@41: void PreferencesComponent::resized() andrewm@41: { andrewm@41: startupPresetComboBox->setBounds (16, 32, 264, 24); andrewm@41: label4->setBounds (16, 8, 160, 24); andrewm@41: startTouchKeysButton->setBounds (16, 64, 208, 24); andrewm@41: autodetectButton->setBounds (16, 88, 272, 24); andrewm@41: defaultsButton->setBounds (16, 120, 144, 24); andrewm@41: //[UserResized] Add your own custom resize handling here.. andrewm@41: //[/UserResized] andrewm@41: } andrewm@41: andrewm@41: void PreferencesComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged) andrewm@41: { andrewm@41: //[UsercomboBoxChanged_Pre] andrewm@41: if(controller_ == 0) andrewm@41: return; andrewm@41: //[/UsercomboBoxChanged_Pre] andrewm@41: andrewm@41: if (comboBoxThatHasChanged == startupPresetComboBox) andrewm@41: { andrewm@41: //[UserComboBoxCode_startupPresetComboBox] -- add your combo box handling code here.. andrewm@41: int selection = startupPresetComboBox->getSelectedId(); andrewm@41: if(selection == kStartupPresetNone) { andrewm@41: controller_->setPrefsStartupPresetNone(); andrewm@41: } andrewm@41: else if(selection == kStartupPresetVibratoPitchBend) { andrewm@41: controller_->setPrefsStartupPresetVibratoPitchBend(); andrewm@41: } andrewm@41: else if(selection == kStartupPresetLastSaved) { andrewm@41: controller_->setPrefsStartupPresetLastSaved(); andrewm@41: } andrewm@41: else if(selection == kStartupPresetChoose) { andrewm@41: // Bring up window to choose a preset andrewm@41: FileChooser myChooser ("Select a preset...", andrewm@41: File::nonexistent, // File::getSpecialLocation (File::userHomeDirectory), andrewm@41: "*.tkpreset"); andrewm@41: if(myChooser.browseForFileToOpen()) { andrewm@41: controller_->setPrefsStartupPreset(myChooser.getResult().getFullPathName()); andrewm@41: } andrewm@41: // Otherwise user clicked cancel and we go back to whatever was there before andrewm@41: } andrewm@41: //[/UserComboBoxCode_startupPresetComboBox] andrewm@41: } andrewm@41: andrewm@41: //[UsercomboBoxChanged_Post] andrewm@41: //[/UsercomboBoxChanged_Post] andrewm@41: } andrewm@41: andrewm@41: void PreferencesComponent::buttonClicked (Button* buttonThatWasClicked) andrewm@41: { andrewm@41: //[UserbuttonClicked_Pre] andrewm@41: if(controller_ == 0) andrewm@41: return; andrewm@41: //[/UserbuttonClicked_Pre] andrewm@41: andrewm@41: if (buttonThatWasClicked == startTouchKeysButton) andrewm@41: { andrewm@41: //[UserButtonCode_startTouchKeysButton] -- add your button handler code here.. andrewm@41: controller_->setPrefsAutoStartTouchKeys(startTouchKeysButton->getToggleState()); andrewm@41: //[/UserButtonCode_startTouchKeysButton] andrewm@41: } andrewm@41: else if (buttonThatWasClicked == autodetectButton) andrewm@41: { andrewm@41: //[UserButtonCode_autodetectButton] -- add your button handler code here.. andrewm@41: controller_->setPrefsAutodetectOctave(autodetectButton->getToggleState()); andrewm@41: //[/UserButtonCode_autodetectButton] andrewm@41: } andrewm@41: else if (buttonThatWasClicked == defaultsButton) andrewm@41: { andrewm@41: //[UserButtonCode_defaultsButton] -- add your button handler code here.. andrewm@41: controller_->resetPreferences(); andrewm@41: //[/UserButtonCode_defaultsButton] andrewm@41: } andrewm@41: andrewm@41: //[UserbuttonClicked_Post] andrewm@41: //[/UserbuttonClicked_Post] andrewm@41: } andrewm@41: andrewm@41: andrewm@41: andrewm@41: //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... andrewm@41: andrewm@41: // Synchronize the UI state with the underlying state of the controller andrewm@41: void PreferencesComponent::synchronize(bool forceUpdates) { andrewm@41: if(controller_ == 0) andrewm@41: return; andrewm@41: andrewm@41: startTouchKeysButton->setToggleState(controller_->getPrefsAutoStartTouchKeys(), dontSendNotification); andrewm@41: autodetectButton->setToggleState(controller_->getPrefsAutodetectOctave(), dontSendNotification); andrewm@41: andrewm@41: if(controller_->getPrefsStartupPresetNone()) andrewm@41: startupPresetComboBox->setSelectedId(kStartupPresetNone); andrewm@41: else if(controller_->getPrefsStartupPresetVibratoPitchBend()) andrewm@41: startupPresetComboBox->setSelectedId(kStartupPresetVibratoPitchBend); andrewm@41: else if(controller_->getPrefsStartupPresetLastSaved()) andrewm@41: startupPresetComboBox->setSelectedId(kStartupPresetLastSaved); andrewm@41: else { andrewm@41: String path = controller_->getPrefsStartupPreset(); andrewm@41: startupPresetComboBox->setText(path); andrewm@41: } andrewm@41: } andrewm@41: andrewm@41: //[/MiscUserCode] andrewm@41: andrewm@41: andrewm@41: //============================================================================== andrewm@41: #if 0 andrewm@41: /* -- Introjucer information section -- andrewm@41: andrewm@41: This is where the Introjucer stores the metadata that describe this GUI layout, so andrewm@41: make changes in here at your peril! andrewm@41: andrewm@41: BEGIN_JUCER_METADATA andrewm@41: andrewm@41: andrewm@41: andrewm@41: andrewm@41: andrewm@41: andrewm@41: END_JUCER_METADATA andrewm@41: */ andrewm@41: #endif andrewm@41: andrewm@41: andrewm@41: //[EndFile] You can add extra defines here... andrewm@50: #endif // TOUCHKEYS_NO_GUI andrewm@41: //[/EndFile]