Skip to content

Commit a4d4e68

Browse files
committed
add hide holding option
1 parent f67d4f0 commit a4d4e68

4 files changed

Lines changed: 58 additions & 42 deletions

File tree

.editorconfig

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ insert_final_newline = true
1111
# XML project files
1212
[*.{csproj,fsproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
1313
indent_size = 2
14-
1514
# XML config files
1615
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
1716
indent_size = 2
@@ -52,36 +51,39 @@ dotnet_style_prefer_conditional_expression_over_return = true:silent
5251

5352
# Style Definitions
5453
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
54+
dotnet_naming_style.pascal_case_style.required_prefix =
55+
5556
dotnet_naming_style.camel_case_style.capitalization = camel_case
57+
dotnet_naming_style.camel_case_style.required_prefix =
5658

5759
# constant case preferences
5860
dotnet_naming_symbols.constant_fields.applicable_kinds = field
5961
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
6062
dotnet_naming_symbols.constant_fields.required_modifiers = const
61-
6263
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
6364
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
6465
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
6566

6667
# fields case preferences
67-
dotnet_naming_symbols.private_field_symbols.applicable_kinds = field
68-
dotnet_naming_symbols.private_field_symbols.applicable_accessibilities = private
68+
dotnet_naming_symbols.private_fields.applicable_kinds = field
69+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
6970

70-
dotnet_naming_rule.private_field_symbols_should_be_camel_case.symbols = private_field_symbols
71+
dotnet_naming_rule.private_field_symbols_should_be_camel_case.symbols = private_fields
7172
dotnet_naming_rule.private_field_symbols_should_be_camel_case.severity = warning
7273
dotnet_naming_rule.private_field_symbols_should_be_camel_case.style = camel_case_style
7374

74-
dotnet_naming_symbols.protected_field_symbols.applicable_kinds = field, property
75-
dotnet_naming_symbols.protected_field_symbols.applicable_accessibilities = protected
76-
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.symbols = protected_field_symbols
75+
76+
dotnet_naming_symbols.protected_fields.applicable_kinds = field
77+
dotnet_naming_symbols.protected_fields.applicable_accessibilities = protected
78+
79+
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.symbols = protected_fields
7780
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.severity = suggestion
7881
dotnet_naming_rule.protected_field_symbols_should_be_camel_case.style = camel_case_style
7982

8083
# var preferences
8184
csharp_style_var_for_built_in_types = true:silent
8285
csharp_style_var_when_type_is_apparent = true:silent
8386
csharp_style_var_elsewhere = true:silent
84-
8587
# Expression-bodied members
8688
csharp_style_expression_bodied_methods = true:suggestion
8789
csharp_style_expression_bodied_constructors = true:suggestion
@@ -91,24 +93,19 @@ csharp_style_expression_bodied_indexers = true:suggestion
9193
csharp_style_expression_bodied_accessors = true:suggestion
9294
csharp_style_expression_bodied_lambdas = true:suggestion
9395
csharp_style_expression_bodied_local_functions = true:suggestion
94-
9596
# Pattern matching preferences
9697
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
9798
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
98-
9999
# Null-checking preferences
100100
csharp_style_throw_expression = true:suggestion
101101
csharp_style_conditional_delegate_call = true:suggestion
102-
103102
# Modifier preferences
104103
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
105-
106104
# Expression-level preferences
107105
csharp_prefer_braces = false
108106
csharp_style_deconstructed_variable_declaration = true:suggestion
109107
csharp_prefer_simple_default_expression = true:suggestion
110108
csharp_style_inlined_variable_declaration = true:suggestion
111-
112109
# New line preferences
113110
csharp_new_line_before_open_brace = all
114111
csharp_new_line_before_else = true
@@ -117,12 +114,10 @@ csharp_new_line_before_finally = true
117114
csharp_new_line_before_members_in_object_initializers = true
118115
csharp_new_line_before_members_in_anonymous_types = true
119116
csharp_new_line_between_query_expression_clauses = true
120-
121117
# Indentation preferences
122118
csharp_indent_case_contents = true
123119
csharp_indent_switch_labels = true
124120
csharp_indent_labels = flush_left
125-
126121
# Space preferences
127122
csharp_space_after_cast = false
128123
csharp_space_after_keywords_in_control_flow_statements = true
@@ -138,36 +133,43 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false
138133
# Wrapping preferences
139134
csharp_preserve_single_line_statements = true
140135
csharp_preserve_single_line_blocks = true
141-
142-
# Analysers
136+
# Analyzers
143137
## dotnet
144138
dotnet_diagnostic.IDE0011.severity = suggestion # require braces
145139
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary.
146-
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary.
147-
dotnet_diagnostic.CA1860.severity = silent # Prefer comparing 'Length' to 0 rather than using 'Any()'
148-
140+
dotnet_diagnostic.IDE0251.severity = warning # member can be readonly
141+
dotnet_diagnostic.CA1860.severity = warning # Prefer comparing 'Length' to 0 rather than using 'Any()'
149142
## Sonar
150143
dotnet_diagnostic.S1481.severity = warning # variable never used
151144
dotnet_diagnostic.S1144.severity = suggestion # Remove the unused private constructor 'AddAuthorizationHeaderOperationFilter'.
152145
dotnet_diagnostic.S1118.severity = suggestion # Add a 'protected' constructor or the 'static' keyword to the class declaration.
153146
dotnet_diagnostic.S1075.severity = suggestion # hardcoded URIs
154147
dotnet_diagnostic.S3459.severity = suggestion # Unassigned members should be removed
155-
dotnet_diagnostic.S1104.severity = suggestion # Make this field 'private' and encapsulate it in a 'public' property.
156-
dotnet_diagnostic.S3878.severity = suggestion # params array creation
157-
dotnet_diagnostic.S3267.severity = suggestion # loops simplified LINQ
158-
dotnet_diagnostic.S2681.severity = suggestion # loops single line
148+
dotnet_diagnostic.S1210.severity = suggestion # When implementing IComparable , you should also override , =, >, and >=.
149+
dotnet_diagnostic.S2344.severity = suggestion # remove Enum suffix
150+
dotnet_diagnostic.S6603.severity = suggestion
151+
dotnet_diagnostic.S6602.severity = suggestion # prefer array exists
159152
dotnet_diagnostic.S3237.severity = silent # Use the 'value' contextual keyword in this property set accessor declaration.
160-
dotnet_diagnostic.S1210.severity = silent # When implementing IComparable , you should also override , =, >, and >=.
161-
dotnet_diagnostic.S2219.severity = silent # runtime type checking should be simplified
162-
dotnet_diagnostic.S2094.severity = silent # empty class (false positive)
163-
dotnet_diagnostic.S3973.severity = silent # braces
164-
dotnet_diagnostic.S2346.severity = silent # enum None flags
165-
153+
dotnet_diagnostic.S1104.severity = silent # encapsulate fields
154+
dotnet_diagnostic.S3877.severity = silent # Remove this 'throw' expression.
155+
dotnet_diagnostic.S2699.severity = silent # add assert to test (not working with FsCheck)
156+
dotnet_diagnostic.S1117.severity = silent # hiding field
157+
## AsyncFixer
158+
dotnet_diagnostic.AsyncFixer01.severity = suggestion # The method dont needs async
166159
# Resharper
167160
resharper_space_within_single_line_array_initializer_braces = true
168161
resharper_keep_existing_attribute_arrangement = true
162+
resharper_csharp_default_private_modifier = implicit
163+
resharper_csharp_default_internal_modifier = implicit
164+
resharper_csharp_object_creation_when_type_not_evident = target_typed
169165
resharper_max_array_initializer_elements_on_line = 10
170166
resharper_max_initializer_elements_on_line = 1
171167
resharper_trailing_comma_in_multiline_lists = true
172168
resharper_wrap_array_initializer_style = chop_if_long
173-
resharper_empty_block_style = together_same_line
169+
resharper_empty_block_style = together_same_line
170+
# FALSE POSITIVES
171+
dotnet_diagnostic.S2094.severity = silent # empty class (false positive)
172+
dotnet_diagnostic.S3925.severity = silent # Update this implementation of 'ISerializable' to conform to the recommended serialization pattern.
173+
174+
[Usings.cs]
175+
dotnet_diagnostic.IDE0005.severity = silent # Using directive is unnecessary.

src/InputDisplay/Config/Settings.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ public record SelectedTheme(
2828

2929
public bool Borderless { get; set; }
3030
public bool ShadowHolding { get; set; } = true;
31+
public bool HideHolding { get; set; }
3132
public bool ShowFrames { get; set; } = true;
3233
public bool ShowNeutralIcon { get; set; } = true;
3334
public bool AutoCorrectMultiple { get; set; } = true;
34-
public bool InvertHistory { get; set; } = false;
35-
public bool FramesAfter { get; set; } = false;
35+
public bool InvertHistory { get; set; }
36+
public bool FramesAfter { get; set; }
3637
public bool HideButtonRelease { get; set; }
3738
public SOCDMode SOCD { get; set; } = SOCDMode.Neutral;
3839
public bool ShortcutsEnabled { get; set; } = true;
@@ -93,6 +94,7 @@ public void CopyFrom(Settings config)
9394
CurrentTheme = config.CurrentTheme;
9495
SpaceBetweenCommands = config.SpaceBetweenCommands;
9596
ShadowHolding = config.ShadowHolding;
97+
HideHolding = config.HideHolding;
9698
ShowFrames = config.ShowFrames;
9799
ShortcutsEnabled = config.ShortcutsEnabled;
98100
ClearColor = config.ClearColor;

src/InputDisplay/Config/Window/SettingsControls.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void SetMacroButton(ButtonName name, (int Row, int Col) pos)
288288
}
289289
}
290290

291-
Widget BuildThemes()
291+
Grid BuildThemes()
292292
{
293293
Grid grid = new()
294294
{
@@ -373,15 +373,15 @@ Widget BuildThemes()
373373

374374

375375
// buttons
376-
Label btnLabal = new()
376+
Label btnLabel = new()
377377
{
378378
Text = "Buttons theme:",
379379
VerticalAlignment = VerticalAlignment.Center,
380380
Margin = new(0, 0, 10, 0),
381381
};
382-
Grid.SetColumn(btnLabal, 0);
383-
Grid.SetRow(btnLabal, 1);
384-
grid.Widgets.Add(btnLabal);
382+
Grid.SetColumn(btnLabel, 0);
383+
Grid.SetRow(btnLabel, 1);
384+
grid.Widgets.Add(btnLabel);
385385

386386
ComboView btnCombo = new()
387387
{
@@ -451,7 +451,7 @@ Widget BuildThemes()
451451
return grid;
452452
}
453453

454-
Widget BuildSettings()
454+
Grid BuildSettings()
455455
{
456456
Grid grid = new()
457457
{
@@ -481,7 +481,8 @@ Widget BuildSettings()
481481
AddCheck(0, 1, "Show frames", config.ShowFrames, check => config.ShowFrames = check);
482482
AddCheck(0, 2, "Show neutral", config.ShowNeutralIcon, check => config.ShowNeutralIcon = check);
483483
AddCheck(0, 3, "Shadow holding", config.ShadowHolding, check => config.ShadowHolding = check);
484-
AddCheck(0, 4, "Auto correct", config.AutoCorrectMultiple, check => config.AutoCorrectMultiple = check);
484+
AddCheck(0, 4, "Hide holding", config.HideHolding, check => config.HideHolding = check);
485+
AddCheck(0, 5, "Auto correct", config.AutoCorrectMultiple, check => config.AutoCorrectMultiple = check);
485486

486487
AddCheck(1, 0, "Invert history", config.InvertHistory, check => config.InvertHistory = check);
487488
AddCheck(1, 1, "Frames after", config.FramesAfter, check => config.FramesAfter = check);

src/InputDisplay/Inputs/Drawable/InputEntry.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ void DrawDirection()
8888

8989
void DrawDirectionComponent(Direction stickDirection)
9090
{
91+
if (State.Stick.Holding && config.HideHolding)
92+
return;
93+
9194
if (theme.GetTexture(stickDirection) is not { } dirTexture)
9295
return;
9396

@@ -138,6 +141,9 @@ void DrawButtons()
138141

139142
if (combined.IsMultiple() && theme.GetTexture(combined) is { } multiTexture)
140143
{
144+
if (State.HasNoPressed && config.HideHolding)
145+
return;
146+
141147
var scale = multiTexture.GetRatioScale(config.IconSize);
142148
var color = State.HasNoPressed && config.ShadowHolding ? Color.Gray : Color.White;
143149
batch.Draw(multiTexture, offset, null, color, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
@@ -154,7 +160,9 @@ void DrawButtons()
154160
texture = ThemeManager.UnknownButton;
155161

156162
var scale = texture.GetRatioScale(config.IconSize);
157-
var color = holding.Contains(btn) && !pressed.Contains(btn) ? Color.Gray : Color.White;
163+
164+
var isHolding = holding.Contains(btn) && !pressed.Contains(btn);
165+
var color = isHolding && config.ShadowHolding ? Color.Gray : Color.White;
158166

159167
batch.Draw(texture, offset, null, color, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
160168
offset += commandDir * ((texture.Width * scale) + config.SpaceBetweenInputs);
@@ -177,6 +185,9 @@ void CheckButton(GameInput.Button button, ButtonName name)
177185
{
178186
var btn = buttons[index];
179187

188+
if (button.Status is GameInput.ButtonStatus.Holding && config.HideHolding)
189+
continue;
190+
180191
if (config.ShadowHolding)
181192
switch (button.Status)
182193
{

0 commit comments

Comments
 (0)