Skip to content

Commit

Permalink
Fixed duplicate entries in the extender settings, and made sure CTRL …
Browse files Browse the repository at this point in the history
…+ S works

Also made the Osiris Debugger Flags be a textbox since the integer up/down is aligned weird
  • Loading branch information
LaughingLeader committed Oct 7, 2021
1 parent 1401a76 commit 0c4f46f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions GUI/Views/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<Button
Command="{Binding SaveSettingsCommand}"
Style="{StaticResource IconButtonStyle}"
ToolTip="Save Settings">
ToolTip="Save Settings (CTRL + S)">
<controls:AutoGrayableImage Source="{StaticResource SaveImage}" />
</Button>
<Rectangle
Expand Down Expand Up @@ -329,7 +329,7 @@
HorizontalAlignment="Center"
Command="{Binding ExportExtenderSettingsCommand}"
Content="Save OsirisExtenderSettings.json"
ToolTip="Export Settings to DefEd\bin\OsirisExtenderSettings.json"
ToolTip="Export Settings to DefEd\bin\OsirisExtenderSettings.json (CTRL + S)"
Visibility="{Binding ExtenderTabIsVisible, Converter={StaticResource BoolToVisibilityConverter}, FallbackValue=Collapsed}" />
<Button
x:Name="ResetKeybindingsButton"
Expand Down
21 changes: 20 additions & 1 deletion GUI/Views/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ private void CreateExtenderSettings()
int count = ExtenderSettingsAutoGrid.RowCount + props.Count();
int row = ExtenderSettingsAutoGrid.RowCount + 1;

ExtenderSettingsAutoGrid.Children.Clear();

ExtenderSettingsAutoGrid.RowCount = count;
ExtenderSettingsAutoGrid.Rows = String.Join(",", Enumerable.Repeat("auto", count));
DivinityApp.Log($"{count} = {ExtenderSettingsAutoGrid.Rows}");
Expand All @@ -75,7 +77,14 @@ private void CreateExtenderSettings()
});
}

switch (Type.GetTypeCode(prop.Property.PropertyType))
var propType = Type.GetTypeCode(prop.Property.PropertyType);

if (prop.Attribute.DisplayName == "Osiris Debugger Flags")
{
propType = TypeCode.String;
}

switch (propType)
{
case TypeCode.Boolean:
CheckBox cb = new CheckBox();
Expand Down Expand Up @@ -133,6 +142,7 @@ private void CreateExtenderSettings()
ud.ToolTip = prop.Attribute.Tooltip;
ud.VerticalAlignment = VerticalAlignment.Center;
ud.HorizontalAlignment = HorizontalAlignment.Left;
ud.Padding = new Thickness(4, 2, 4, 2);
ud.AllowTextInput = true;
ud.SetBinding(IntegerUpDown.ValueProperty, new Binding(prop.Property.Name)
{
Expand Down Expand Up @@ -224,6 +234,15 @@ private void SettingsWindow_KeyDown(object sender, KeyEventArgs e)
{
return;
}
else if(e.Key == Key.S && (Keyboard.Modifiers & ModifierKeys.Control) != 0)
{
ViewModel.SaveSettingsCommand.Execute(null);
if(ViewModel.ExtenderTabIsVisible)
{
ViewModel.ExportExtenderSettingsCommand.Execute(null);
}
e.Handled = true;
}
else if(e.Key == Key.Left && (Keyboard.Modifiers & ModifierKeys.Control) != 0)
{
int current = PreferencesTabControl.SelectedIndex;
Expand Down

0 comments on commit 0c4f46f

Please sign in to comment.