annotate Source/Mappings/KeyDivision/TouchkeyKeyDivisionMappingShortEditor.cpp @ 56:b4a2d2ae43cf tip

merge
author Andrew McPherson <andrewm@eecs.qmul.ac.uk>
date Fri, 23 Nov 2018 15:48:14 +0000
parents 003236a1e29b
children
rev   line source
andrewm@51 1 /*
andrewm@51 2 ==============================================================================
andrewm@51 3
andrewm@51 4 This is an automatically generated GUI class created by the Introjucer!
andrewm@51 5
andrewm@51 6 Be careful when adding custom code to these files, as only the code within
andrewm@51 7 the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
andrewm@51 8 and re-saved.
andrewm@51 9
andrewm@51 10 Created with Introjucer version: 3.1.1
andrewm@51 11
andrewm@51 12 ------------------------------------------------------------------------------
andrewm@51 13
andrewm@51 14 The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
andrewm@51 15 Copyright 2004-13 by Raw Material Software Ltd.
andrewm@51 16
andrewm@51 17 ==============================================================================
andrewm@51 18 */
andrewm@51 19
andrewm@51 20 //[Headers] You can add your own extra header files here...
andrewm@51 21 #ifndef TOUCHKEYS_NO_GUI
andrewm@51 22 //[/Headers]
andrewm@51 23
andrewm@51 24 #include "TouchkeyKeyDivisionMappingShortEditor.h"
andrewm@51 25
andrewm@51 26
andrewm@51 27 //[MiscUserDefs] You can add your own user definitions and misc code here...
andrewm@51 28 //[/MiscUserDefs]
andrewm@51 29
andrewm@51 30 //==============================================================================
andrewm@51 31 TouchkeyKeyDivisionMappingShortEditor::TouchkeyKeyDivisionMappingShortEditor (TouchkeyKeyDivisionMappingFactory& factory)
andrewm@51 32 : factory_(factory)
andrewm@51 33 {
andrewm@51 34 addAndMakeVisible (tuningComboBox = new ComboBox ("tuning combo box"));
andrewm@51 35 tuningComboBox->setEditableText (false);
andrewm@51 36 tuningComboBox->setJustificationType (Justification::centredLeft);
andrewm@51 37 tuningComboBox->setTextWhenNothingSelected (String::empty);
andrewm@51 38 tuningComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
andrewm@51 39 tuningComboBox->addListener (this);
andrewm@51 40
andrewm@51 41 addAndMakeVisible (tuningLabel = new Label ("tuning label",
andrewm@51 42 TRANS("Tuning:")));
andrewm@51 43 tuningLabel->setFont (Font (15.00f, Font::plain));
andrewm@51 44 tuningLabel->setJustificationType (Justification::centredLeft);
andrewm@51 45 tuningLabel->setEditable (false, false, false);
andrewm@51 46 tuningLabel->setColour (TextEditor::textColourId, Colours::black);
andrewm@51 47 tuningLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
andrewm@51 48
andrewm@51 49 addAndMakeVisible (controlLabel = new Label ("control label",
andrewm@51 50 TRANS("Control:")));
andrewm@51 51 controlLabel->setFont (Font (15.00f, Font::plain));
andrewm@51 52 controlLabel->setJustificationType (Justification::centredLeft);
andrewm@51 53 controlLabel->setEditable (false, false, false);
andrewm@51 54 controlLabel->setColour (TextEditor::textColourId, Colours::black);
andrewm@51 55 controlLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
andrewm@51 56
andrewm@51 57 addAndMakeVisible (controlComboBox = new ComboBox ("control combo box"));
andrewm@51 58 controlComboBox->setEditableText (false);
andrewm@51 59 controlComboBox->setJustificationType (Justification::centredLeft);
andrewm@51 60 controlComboBox->setTextWhenNothingSelected (String::empty);
andrewm@51 61 controlComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
andrewm@51 62 controlComboBox->addListener (this);
andrewm@51 63
andrewm@51 64 addAndMakeVisible (retriggerButton = new ToggleButton ("retrigger button"));
andrewm@51 65 retriggerButton->setButtonText (TRANS("Retriggerable"));
andrewm@51 66 retriggerButton->addListener (this);
andrewm@51 67
andrewm@51 68
andrewm@51 69 //[UserPreSize]
andrewm@51 70 controlComboBox->addItem("Position", TouchkeyKeyDivisionMapping::kDetectionParameterYPosition);
andrewm@51 71 controlComboBox->addItem("Number of Touches", TouchkeyKeyDivisionMapping::kDetectionParameterNumberOfTouches);
andrewm@51 72 controlComboBox->addItem("Both", TouchkeyKeyDivisionMapping::kDetectionParameterYPositionAndNumberOfTouches);
andrewm@51 73
andrewm@51 74 tuningComboBox->addItem("19-tone Equal Temperament", TouchkeyKeyDivisionMappingFactory::kTuningPreset19TET + 1);
andrewm@51 75 tuningComboBox->addItem("24-tone Equal Temperament", TouchkeyKeyDivisionMappingFactory::kTuningPreset24TET + 1);
andrewm@51 76 tuningComboBox->addItem("31-tone Equal Temperament", TouchkeyKeyDivisionMappingFactory::kTuningPreset31TET + 1);
andrewm@51 77 tuningComboBox->addItem("36-tone Equal Temperament", TouchkeyKeyDivisionMappingFactory::kTuningPreset36TET + 1);
andrewm@51 78 tuningComboBox->addItem("Yarman-24c Maqam Tuning", TouchkeyKeyDivisionMappingFactory::kTuningPresetYarman24c + 1);
andrewm@51 79 //[/UserPreSize]
andrewm@51 80
andrewm@51 81 setSize (328, 71);
andrewm@51 82
andrewm@51 83
andrewm@51 84 //[Constructor] You can add your own custom stuff here..
andrewm@51 85 //[/Constructor]
andrewm@51 86 }
andrewm@51 87
andrewm@51 88 TouchkeyKeyDivisionMappingShortEditor::~TouchkeyKeyDivisionMappingShortEditor()
andrewm@51 89 {
andrewm@51 90 //[Destructor_pre]. You can add your own custom destruction code here..
andrewm@51 91 //[/Destructor_pre]
andrewm@51 92
andrewm@51 93 tuningComboBox = nullptr;
andrewm@51 94 tuningLabel = nullptr;
andrewm@51 95 controlLabel = nullptr;
andrewm@51 96 controlComboBox = nullptr;
andrewm@51 97 retriggerButton = nullptr;
andrewm@51 98
andrewm@51 99
andrewm@51 100 //[Destructor]. You can add your own custom destruction code here..
andrewm@51 101 //[/Destructor]
andrewm@51 102 }
andrewm@51 103
andrewm@51 104 //==============================================================================
andrewm@51 105 void TouchkeyKeyDivisionMappingShortEditor::paint (Graphics& g)
andrewm@51 106 {
andrewm@51 107 //[UserPrePaint] Add your own custom painting code here..
andrewm@51 108 //[/UserPrePaint]
andrewm@51 109
andrewm@51 110 g.fillAll (Colours::white);
andrewm@51 111
andrewm@51 112 //[UserPaint] Add your own custom painting code here..
andrewm@51 113 //[/UserPaint]
andrewm@51 114 }
andrewm@51 115
andrewm@51 116 void TouchkeyKeyDivisionMappingShortEditor::resized()
andrewm@51 117 {
andrewm@51 118 //[UserPreResize] Add your own custom resize code here..
andrewm@51 119 //[/UserPreResize]
andrewm@51 120
andrewm@51 121 tuningComboBox->setBounds (72, 8, 248, 24);
andrewm@51 122 tuningLabel->setBounds (8, 8, 72, 24);
andrewm@51 123 controlLabel->setBounds (8, 40, 72, 24);
andrewm@51 124 controlComboBox->setBounds (72, 40, 88, 24);
andrewm@51 125 retriggerButton->setBounds (176, 40, 136, 24);
andrewm@51 126 //[UserResized] Add your own custom resize handling here..
andrewm@51 127 //[/UserResized]
andrewm@51 128 }
andrewm@51 129
andrewm@51 130 void TouchkeyKeyDivisionMappingShortEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
andrewm@51 131 {
andrewm@51 132 //[UsercomboBoxChanged_Pre]
andrewm@51 133 //[/UsercomboBoxChanged_Pre]
andrewm@51 134
andrewm@51 135 if (comboBoxThatHasChanged == tuningComboBox)
andrewm@51 136 {
andrewm@51 137 //[UserComboBoxCode_tuningComboBox] -- add your combo box handling code here..
andrewm@51 138 // Offset the value by 1 since preset numbering starts from 0 but combo box IDs start from 1...
andrewm@51 139 factory_.setTuningPreset(tuningComboBox->getSelectedId() - 1);
andrewm@51 140 //[/UserComboBoxCode_tuningComboBox]
andrewm@51 141 }
andrewm@51 142 else if (comboBoxThatHasChanged == controlComboBox)
andrewm@51 143 {
andrewm@51 144 //[UserComboBoxCode_controlComboBox] -- add your combo box handling code here..
andrewm@51 145 factory_.setDetectionParameter(controlComboBox->getSelectedId());
andrewm@51 146 //[/UserComboBoxCode_controlComboBox]
andrewm@51 147 }
andrewm@51 148
andrewm@51 149 //[UsercomboBoxChanged_Post]
andrewm@51 150 //[/UsercomboBoxChanged_Post]
andrewm@51 151 }
andrewm@51 152
andrewm@51 153 void TouchkeyKeyDivisionMappingShortEditor::buttonClicked (Button* buttonThatWasClicked)
andrewm@51 154 {
andrewm@51 155 //[UserbuttonClicked_Pre]
andrewm@51 156 //[/UserbuttonClicked_Pre]
andrewm@51 157
andrewm@51 158 if (buttonThatWasClicked == retriggerButton)
andrewm@51 159 {
andrewm@51 160 //[UserButtonCode_retriggerButton] -- add your button handler code here..
andrewm@51 161 factory_.setRetriggerable(retriggerButton->getToggleState());
andrewm@51 162 //[/UserButtonCode_retriggerButton]
andrewm@51 163 }
andrewm@51 164
andrewm@51 165 //[UserbuttonClicked_Post]
andrewm@51 166 //[/UserbuttonClicked_Post]
andrewm@51 167 }
andrewm@51 168
andrewm@51 169
andrewm@51 170
andrewm@51 171 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
andrewm@51 172 void TouchkeyKeyDivisionMappingShortEditor::synchronize()
andrewm@51 173 {
andrewm@51 174 retriggerButton->setToggleState(factory_.getRetriggerable(), dontSendNotification);
andrewm@51 175 controlComboBox->setSelectedId(factory_.getDetectionParameter());
andrewm@51 176 tuningComboBox->setSelectedId(factory_.getTuningPreset() + 1);
andrewm@51 177 }
andrewm@51 178 //[/MiscUserCode]
andrewm@51 179
andrewm@51 180
andrewm@51 181 //==============================================================================
andrewm@51 182 #if 0
andrewm@51 183 /* -- Introjucer information section --
andrewm@51 184
andrewm@51 185 This is where the Introjucer stores the metadata that describe this GUI layout, so
andrewm@51 186 make changes in here at your peril!
andrewm@51 187
andrewm@51 188 BEGIN_JUCER_METADATA
andrewm@51 189
andrewm@51 190 <JUCER_COMPONENT documentType="Component" className="TouchkeyKeyDivisionMappingShortEditor"
andrewm@51 191 componentName="" parentClasses="public MappingEditorComponent, public TextEditor::Listener"
andrewm@51 192 constructorParams="TouchkeyKeyDivisionMappingFactory&amp; factory"
andrewm@51 193 variableInitialisers="factory_(factory)" snapPixels="8" snapActive="1"
andrewm@51 194 snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="328"
andrewm@51 195 initialHeight="71">
andrewm@51 196 <BACKGROUND backgroundColour="ffffffff"/>
andrewm@51 197 <COMBOBOX name="tuning combo box" id="11460b0e135fe122" memberName="tuningComboBox"
andrewm@51 198 virtualName="" explicitFocusOrder="0" pos="72 8 248 24" editable="0"
andrewm@51 199 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
andrewm@51 200 <LABEL name="tuning label" id="864de4f55b5481ee" memberName="tuningLabel"
andrewm@51 201 virtualName="" explicitFocusOrder="0" pos="8 8 72 24" edTextCol="ff000000"
andrewm@51 202 edBkgCol="0" labelText="Tuning:" editableSingleClick="0" editableDoubleClick="0"
andrewm@51 203 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
andrewm@51 204 bold="0" italic="0" justification="33"/>
andrewm@51 205 <LABEL name="control label" id="163b8236fad72f38" memberName="controlLabel"
andrewm@51 206 virtualName="" explicitFocusOrder="0" pos="8 40 72 24" edTextCol="ff000000"
andrewm@51 207 edBkgCol="0" labelText="Control:" editableSingleClick="0" editableDoubleClick="0"
andrewm@51 208 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
andrewm@51 209 bold="0" italic="0" justification="33"/>
andrewm@51 210 <COMBOBOX name="control combo box" id="597816425fbf42ce" memberName="controlComboBox"
andrewm@51 211 virtualName="" explicitFocusOrder="0" pos="72 40 88 24" editable="0"
andrewm@51 212 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
andrewm@51 213 <TOGGLEBUTTON name="retrigger button" id="1b86153e19e7aa57" memberName="retriggerButton"
andrewm@51 214 virtualName="" explicitFocusOrder="0" pos="176 40 136 24" buttonText="Retriggerable"
andrewm@51 215 connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
andrewm@51 216 </JUCER_COMPONENT>
andrewm@51 217
andrewm@51 218 END_JUCER_METADATA
andrewm@51 219 */
andrewm@51 220 #endif
andrewm@51 221
andrewm@51 222
andrewm@51 223 //[EndFile] You can add extra defines here...
andrewm@51 224 #endif // TOUCHKEYS_NO_GUI
andrewm@51 225 //[/EndFile]