Skip to content

Commit

Permalink
fix Dubler2 PopulatedComboBox
Browse files Browse the repository at this point in the history
  • Loading branch information
Timtam committed Oct 18, 2024
1 parent 886ba39 commit 58ba543
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
16 changes: 7 additions & 9 deletions Includes/Overlays/Dubler2.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ Class PopulatedComboBox extends CustomComboBox {

Values := Array()

__New(Label, OnFocusFunction := "", OnChangeFunction := "") {
__New(Label, PreExecFocusFunction := "", PostExecFocusFunction := "", ChangeFunctions := "") {

Change := Array(ObjBindMethod(This, "OnChange"))
if ChangeFunctions != "" And Not ChangeFunctions Is Array
ChangeFunctions := Array(ChangeFunctions)
Else If ChangeFunctions == ""
ChangeFunctions := Array()

If OnChangeFunction != "" {
If Not OnChangeFunction Is Array
Change.Push(OnChangeFunction)
Else
Change.Push(OnChangeFunction*)
}
ChangeFunctions.Push(ObjBindMethod(This, "OnChange"))

Super.__New(Label, OnFocusFunction, , Change)
Super.__New(Label, PreExecFocusFunction, PostExecFocusFunction, ChangeFunctions)
}

AddItem(Label, Selector := "") {
Expand Down
4 changes: 2 additions & 2 deletions Includes/Overlays/Dubler2/ProfileAssignTab.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ AssignTab.AddControl(Dubler2.HotspotCheckbox("Pitch bend enabled", 131, 446, Dub
AssignTab.AddControl(CustomButton("Stickiness: " . Integer(Dubler2.ProfileLoaded["Current"]["Pitch"]["pitchStickiness"] * 100) . "%", ObjBindMethod(Dubler2, "FocusButton"), , ActivatePitchStickinessButton))
AssignTab.AddControl(CustomButton("Pitch Bend Range: " . Dubler2.ProfileLoaded["Current"]["Pitch"]["pitchBendRange"] . " semitones", ObjBindMethod(Dubler2, "FocusButton"), , ActivatePitchBendRangeButton))

PitchBendTypeCtrl := PopulatedComboBox("Pitch Bend Type", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
PitchBendTypeCtrl := PopulatedComboBox("Pitch Bend Type", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

For Preset In [0, 1] {

Expand All @@ -352,7 +352,7 @@ AssignTab.AddControl(CustomButton("Pitch MIDI Channel: " . Dubler2.ProfileLoaded
AssignTab.AddControl(Dubler2.HotspotCheckbox("Chords bend enabled", 264, 446, Dubler2.ProfileLoaded["Current"]["PitchBendChords"], ObjBindMethod(Dubler2, "FocusCheckbox"), ObjBindMethod(Dubler2, "FocusCheckbox")))
AssignTab.AddControl(CustomButton("Chords MIDI Channel: " . Dubler2.ProfileLoaded["Current"]["ChordsMidiChannel"], , ObjBindMethod(Dubler2, "FocusButton"), ActivateChordsMidiChannelButton))

ChordsPresetCtrl := PopulatedComboBox("Chords Preset", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
ChordsPresetCtrl := PopulatedComboBox("Chords Preset", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

For Preset In ["8 Bit Lead", "Bass Pluck", "Boards", "Pad", "Pure", "Trap Bass", "Trumpet Lead", "Wobble Bass"] {
ChordsPresetCtrl.AddItem(Preset, ClickChordsPreset.Bind(Preset))
Expand Down
4 changes: 2 additions & 2 deletions Includes/Overlays/Dubler2/ProfileChordsTab.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ChordsTab.AddControl(Dubler2.HotspotCheckbox("Root Note Bassline", 575, 566, Dub
ChordsTab.AddControl(Dubler2.HotspotCheckbox("Follow Octaves", 806, 567, Dubler2.ProfileLoaded["Current"]["Chords"]["octaveFollow"], ObjBindMethod(Dubler2, "FocusCheckbox"), ObjBindMethod(Dubler2, "FocusCheckbox")))
ChordsTab.AddControl(CustomButton("Octave shift: " . (Dubler2.ProfileLoaded["Current"]["Chords"]["octaveShift"] >= 0 ? "+" : "") . Dubler2.ProfileLoaded["Current"]["Chords"]["octaveShift"], ObjBindMethod(Dubler2, "FocusButton"), , ActivateChordsOctaveShiftButton))

VoicingPresetCtrl := PopulatedComboBox("Voicing Preset", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
VoicingPresetCtrl := PopulatedComboBox("Voicing Preset", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

For Preset In ["Cluster", "Spread"] {
VoicingPresetCtrl.AddItem(Preset, ClickVoicingPreset.Bind(Preset))
Expand All @@ -78,7 +78,7 @@ For Preset In ["Cluster", "Spread"] {

ChordsTab.AddControl(VoicingPresetCtrl)

ChordPresetCtrl := PopulatedComboBox("Chord Preset", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
ChordPresetCtrl := PopulatedComboBox("Chord Preset", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

Local Presets

Expand Down
6 changes: 3 additions & 3 deletions Includes/Overlays/Dubler2/ProfilePitchTab.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ PitchTab.SetHotkey("^2", "Ctrl + 2")
PitchTab.AddControl(Dubler2.HotspotCheckbox("Pitch enabled", 371, 161, Dubler2.ProfileLoaded["Current"]["Pitch"]["pitchEnabled"], ObjBindMethod(Dubler2, "FocusCheckbox"), ObjBindMethod(Dubler2, "FocusCheckbox")))
PitchTab.AddControl(Dubler2.HotspotCheckbox("Pitch Bend enabled", 354, 501, Dubler2.ProfileLoaded["Current"]["Pitch"]["pitchBendEnabled"], ObjBindMethod(Dubler2, "FocusCheckbox"), ObjBindMethod(Dubler2, "FocusCheckbox")))

SynthPresetCtrl := PopulatedComboBox("Synth Preset", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
SynthPresetCtrl := PopulatedComboBox("Synth Preset", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

For Preset In ["8 Bit Lead", "Bass Pluck", "Boards", "Pad", "Pure", "Trap Bass", "Trumpet Lead", "Wobble Bass"] {
SynthPresetCtrl.AddItem(Preset, ClickSynthPreset.Bind(Preset))
Expand All @@ -243,7 +243,7 @@ PitchTab.AddControl(SynthPresetCtrl)
PitchTab.AddControl(CustomButton("Input Gain: " . Integer(Dubler2.ProfileLoaded["Current"]["Pitch"]["pitchInputGain"] * 100) . "%", ObjBindMethod(Dubler2, "FocusButton"), , ActivatePitchInputGainButton))
PitchTab.AddControl(CustomButton("Octave shift: " . (Dubler2.ProfileLoaded["Current"]["DublerModel"]["octaveShift"] >= 0 ? "+" : "") . Dubler2.ProfileLoaded["Current"]["DublerModel"]["octaveShift"], ObjBindMethod(Dubler2, "FocusButton"), , ActivatePitchOctaveShiftButton))

KeyCtrl := PopulatedComboBox("Key", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
KeyCtrl := PopulatedComboBox("Key", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

For Key In ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"] {
KeyCtrl.AddItem(Key, ClickKey.Bind(Key))
Expand All @@ -254,7 +254,7 @@ For Key In ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"] {

PitchTab.AddControl(KeyCtrl)

ScaleCtrl := PopulatedComboBox("Scale", ObjBindMethod(Dubler2, "FocusComboBox"), ObjBindMethod(Dubler2, "SelectComboBoxItem"))
ScaleCtrl := PopulatedComboBox("Scale", ObjBindMethod(Dubler2, "FocusComboBox"), , ObjBindMethod(Dubler2, "SelectComboBoxItem"))

For Scale In ["Major", "Minor", "Harmonic Minor", "Major Pentatonic", "Minor Pentatonic", "Blues", "Locrian", "Dorian", "Phrygian", "Lydian", "Mixolydian", "Hungarian (Gypsy) Minor", "Whole Tone", "Aeolian Dominant (Hindu)", "Chromatic"] {
ScaleCtrl.AddItem(Scale, ClickScale.Bind(Scale))
Expand Down

0 comments on commit 58ba543

Please sign in to comment.