From 58ba543a3c12ef338b40faab5dfb9c3fddd28e42 Mon Sep 17 00:00:00 2001 From: Toni Barth Date: Fri, 18 Oct 2024 15:04:28 +0200 Subject: [PATCH] fix Dubler2 PopulatedComboBox --- Includes/Overlays/Dubler2.ahk | 16 +++++++--------- Includes/Overlays/Dubler2/ProfileAssignTab.ahk | 4 ++-- Includes/Overlays/Dubler2/ProfileChordsTab.ahk | 4 ++-- Includes/Overlays/Dubler2/ProfilePitchTab.ahk | 6 +++--- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Includes/Overlays/Dubler2.ahk b/Includes/Overlays/Dubler2.ahk index 86ed744..758b9ae 100644 --- a/Includes/Overlays/Dubler2.ahk +++ b/Includes/Overlays/Dubler2.ahk @@ -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 := "") { diff --git a/Includes/Overlays/Dubler2/ProfileAssignTab.ahk b/Includes/Overlays/Dubler2/ProfileAssignTab.ahk index f00274b..2423fd3 100644 --- a/Includes/Overlays/Dubler2/ProfileAssignTab.ahk +++ b/Includes/Overlays/Dubler2/ProfileAssignTab.ahk @@ -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] { @@ -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)) diff --git a/Includes/Overlays/Dubler2/ProfileChordsTab.ahk b/Includes/Overlays/Dubler2/ProfileChordsTab.ahk index 3dbaeb2..eabec0e 100644 --- a/Includes/Overlays/Dubler2/ProfileChordsTab.ahk +++ b/Includes/Overlays/Dubler2/ProfileChordsTab.ahk @@ -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)) @@ -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 diff --git a/Includes/Overlays/Dubler2/ProfilePitchTab.ahk b/Includes/Overlays/Dubler2/ProfilePitchTab.ahk index f223ad7..6e5b511 100644 --- a/Includes/Overlays/Dubler2/ProfilePitchTab.ahk +++ b/Includes/Overlays/Dubler2/ProfilePitchTab.ahk @@ -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)) @@ -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)) @@ -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))