Skip to content

Commit 80fe8fc

Browse files
committed
Rename + consolidate settings
We have merged two similar-but-different features with regard gamepad triggers and repeating. This commit renames and consolidates the variables/settings used for "hold to repeat" behaviour which doesn't make sense (and doesn't work) to distinguish between key and point input, and differentiates the behaviour from the "repeat last key" behaviour
1 parent f8604e9 commit 80fe8fc

File tree

6 files changed

+71
-261
lines changed

6 files changed

+71
-261
lines changed

src/JuliusSweetland.OptiKey.Core/Observables/TriggerSources/DirectInputButtonDownUpSource.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public DirectInputButtonDownUpSource(
4040
this.controllerGuid = controllerGuid;
4141

4242
directInputListener = DirectInputListener.Instance;
43-
// BUG: this prevents us from having a different repeat rule for point selection vs key selection
4443
directInputListener.AllowRepeats(allowRepeats, firstRepeatMs, nextRepeatMs);
4544
}
4645

src/JuliusSweetland.OptiKey.Core/OptiKeyApp.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -808,19 +808,19 @@ protected static IInputService CreateInputService(
808808
keySelectionTriggerSource = new XInputButtonDownUpSource(
809809
Settings.Default.KeySelectionTriggerGamepadXInputController,
810810
Settings.Default.KeySelectionTriggerGamepadXInputButtonDownUpButton,
811-
Settings.Default.KeySelectionTriggerGamepadAllowRepeats,
812-
Settings.Default.KeySelectionTriggerGamepadFirstRepeatMilliseconds,
813-
Settings.Default.KeySelectionTriggerGamepadNextRepeatMilliseconds,
811+
Settings.Default.GamepadTriggerHoldToRepeat,
812+
Settings.Default.GamepadTriggerFirstRepeatMilliseconds,
813+
Settings.Default.GamepadTriggerNextRepeatMilliseconds,
814814
pointSource);
815815
break;
816816

817817
case TriggerSources.DirectInputButtonDownUps:
818818
keySelectionTriggerSource = new DirectInputButtonDownUpSource(
819819
Settings.Default.KeySelectionTriggerGamepadDirectInputController,
820820
Settings.Default.KeySelectionTriggerGamepadDirectInputButtonDownUpButton,
821-
Settings.Default.KeySelectionTriggerGamepadAllowRepeats,
822-
Settings.Default.KeySelectionTriggerGamepadFirstRepeatMilliseconds,
823-
Settings.Default.KeySelectionTriggerGamepadNextRepeatMilliseconds,
821+
Settings.Default.GamepadTriggerHoldToRepeat,
822+
Settings.Default.GamepadTriggerFirstRepeatMilliseconds,
823+
Settings.Default.GamepadTriggerNextRepeatMilliseconds,
824824
pointSource);
825825
break;
826826

@@ -858,19 +858,19 @@ protected static IInputService CreateInputService(
858858
pointSelectionTriggerSource = new XInputButtonDownUpSource(
859859
Settings.Default.PointSelectionTriggerGamepadXInputController,
860860
Settings.Default.PointSelectionTriggerGamepadXInputButtonDownUpButton,
861-
Settings.Default.PointSelectionTriggerGamepadAllowRepeats,
862-
Settings.Default.PointSelectionTriggerGamepadFirstRepeatMilliseconds,
863-
Settings.Default.PointSelectionTriggerGamepadNextRepeatMilliseconds,
861+
Settings.Default.GamepadTriggerHoldToRepeat,
862+
Settings.Default.GamepadTriggerFirstRepeatMilliseconds,
863+
Settings.Default.GamepadTriggerNextRepeatMilliseconds,
864864
pointSource);
865865
break;
866866

867867
case TriggerSources.DirectInputButtonDownUps:
868868
pointSelectionTriggerSource = new DirectInputButtonDownUpSource(
869869
Settings.Default.PointSelectionTriggerGamepadDirectInputController,
870870
Settings.Default.PointSelectionTriggerGamepadDirectInputButtonDownUpButton,
871-
Settings.Default.PointSelectionTriggerGamepadAllowRepeats,
872-
Settings.Default.PointSelectionTriggerGamepadFirstRepeatMilliseconds,
873-
Settings.Default.PointSelectionTriggerGamepadNextRepeatMilliseconds,
871+
Settings.Default.GamepadTriggerHoldToRepeat,
872+
Settings.Default.GamepadTriggerFirstRepeatMilliseconds,
873+
Settings.Default.GamepadTriggerNextRepeatMilliseconds,
874874
pointSource);
875875
break;
876876

src/JuliusSweetland.OptiKey.Core/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,6 +2479,12 @@ Magyar
24792479
<data name="CONTROLLER_NEXT_REPEAT_TIME" xml:space="preserve">
24802480
<value>Time delay for subsequent repeats (ms)</value>
24812481
</data>
2482+
<data name="ALLOW_REPEATS_LABEL" xml:space="preserve">
2483+
<value>Allow key actions to be repeated when pressing trigger away from keyboard</value>
2484+
</data>
2485+
<data name="REPEAT_SOUND_LABEL" xml:space="preserve">
2486+
<value>Repeat last key:</value>
2487+
</data>
24822488
<data name="LIMIT_BACKONE" xml:space="preserve">
24832489
<value>Limit "BackOne" deletion to a single character</value>
24842490
</data>

src/JuliusSweetland.OptiKey.Core/Properties/Settings.cs

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -146,95 +146,47 @@ public int KeySelectionTriggerGamepadDirectInputButtonDownUpButton
146146
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
147147
[global::System.Configuration.DefaultSettingValueAttribute("false")]
148148
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
149-
public bool KeySelectionTriggerGamepadAllowRepeats
149+
public bool GamepadTriggerHoldToRepeat
150150
{
151151
get
152152
{
153-
return ((bool)(this["KeySelectionTriggerGamepadAllowRepeats"]));
153+
return ((bool)(this["GamepadTriggerHoldToRepeat"]));
154154
}
155155
set
156156
{
157-
this["KeySelectionTriggerGamepadAllowRepeats"] = value;
157+
this["GamepadTriggerHoldToRepeat"] = value;
158158
}
159159
}
160160

161161
[global::System.Configuration.UserScopedSettingAttribute()]
162162
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
163163
[global::System.Configuration.DefaultSettingValueAttribute("400")]
164164
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
165-
public int KeySelectionTriggerGamepadFirstRepeatMilliseconds
165+
public int GamepadTriggerFirstRepeatMilliseconds
166166
{
167167
get
168168
{
169-
return ((int)(this["KeySelectionTriggerGamepadFirstRepeatMilliseconds"]));
169+
return ((int)(this["GamepadTriggerFirstRepeatMilliseconds"]));
170170
}
171171
set
172172
{
173-
this["KeySelectionTriggerGamepadFirstRepeatMilliseconds"] = value;
173+
this["GamepadTriggerFirstRepeatMilliseconds"] = value;
174174
}
175175
}
176176

177177
[global::System.Configuration.UserScopedSettingAttribute()]
178178
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
179179
[global::System.Configuration.DefaultSettingValueAttribute("200")]
180180
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
181-
public int KeySelectionTriggerGamepadNextRepeatMilliseconds
181+
public int GamepadTriggerNextRepeatMilliseconds
182182
{
183183
get
184184
{
185-
return ((int)(this["KeySelectionTriggerGamepadNextRepeatMilliseconds"]));
185+
return ((int)(this["GamepadTriggerNextRepeatMilliseconds"]));
186186
}
187187
set
188188
{
189-
this["KeySelectionTriggerGamepadNextRepeatMilliseconds"] = value;
190-
}
191-
}
192-
193-
[global::System.Configuration.UserScopedSettingAttribute()]
194-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
195-
[global::System.Configuration.DefaultSettingValueAttribute("false")]
196-
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
197-
public bool PointSelectionTriggerGamepadAllowRepeats
198-
{
199-
get
200-
{
201-
return ((bool)(this["PointSelectionTriggerGamepadAllowRepeats"]));
202-
}
203-
set
204-
{
205-
this["PointSelectionTriggerGamepadAllowRepeats"] = value;
206-
}
207-
}
208-
209-
[global::System.Configuration.UserScopedSettingAttribute()]
210-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
211-
[global::System.Configuration.DefaultSettingValueAttribute("400")]
212-
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
213-
public int PointSelectionTriggerGamepadFirstRepeatMilliseconds
214-
{
215-
get
216-
{
217-
return ((int)(this["PointSelectionTriggerGamepadFirstRepeatMilliseconds"]));
218-
}
219-
set
220-
{
221-
this["PointSelectionTriggerGamepadFirstRepeatMilliseconds"] = value;
222-
}
223-
}
224-
225-
[global::System.Configuration.UserScopedSettingAttribute()]
226-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
227-
[global::System.Configuration.DefaultSettingValueAttribute("200")]
228-
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
229-
public int PointSelectionTriggerGamepadNextRepeatMilliseconds
230-
{
231-
get
232-
{
233-
return ((int)(this["PointSelectionTriggerGamepadNextRepeatMilliseconds"]));
234-
}
235-
set
236-
{
237-
this["PointSelectionTriggerGamepadNextRepeatMilliseconds"] = value;
189+
this["GamepadTriggerNextRepeatMilliseconds"] = value;
238190
}
239191
}
240192

0 commit comments

Comments
 (0)