Skip to content

Commit

Permalink
Enable zoom on world analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzmatazzz committed Aug 3, 2023
1 parent 0baa812 commit a7ebcd7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions RemnantSaveGuardian/Views/Pages/WorldAnalyzerPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
<ui:SymbolIcon Symbol="ArrowExportUp24"/>
</Button>
</WrapPanel>
<WrapPanel Grid.Column="2" VerticalAlignment="Center" Visibility="Collapsed">
<WrapPanel Grid.Column="2" VerticalAlignment="Center" Visibility="Visible">
<TextBlock FontWeight="Medium" Text="{lex:Loc Zoom}" VerticalAlignment="Center" Margin="0,0,5,0"/>
<ui:SymbolIcon Symbol="ZoomOut24"/>
<Slider Name="FontSizeSlider" HorizontalAlignment="Left" VerticalAlignment="Center" Width="200" Minimum="6" Value="18" Maximum="30" SmallChange="6" LargeChange="6" TickFrequency="6" TickPlacement="BottomRight" IsSnapToTickEnabled="True"/>
<Slider Name="FontSizeSlider" HorizontalAlignment="Left" VerticalAlignment="Center" Width="200" Minimum="6" Value="14" Maximum="30" SmallChange="4" LargeChange="4" TickFrequency="4" TickPlacement="BottomRight" IsSnapToTickEnabled="True"/>
<ui:SymbolIcon Symbol="ZoomIn24"/>
</WrapPanel>
</Grid>
Expand Down
22 changes: 19 additions & 3 deletions RemnantSaveGuardian/Views/Pages/WorldAnalyzerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using Wpf.Ui.Common.Interfaces;

namespace RemnantSaveGuardian.Views.Pages
Expand All @@ -21,6 +22,7 @@ public ViewModels.WorldAnalyzerViewModel ViewModel
get;
}
private RemnantSave Save;
private double midFontSize = 14;
public WorldAnalyzerPage(ViewModels.WorldAnalyzerViewModel viewModel, string? pathToSaveFiles = null)
{
ViewModel = viewModel;
Expand Down Expand Up @@ -64,6 +66,13 @@ public WorldAnalyzerPage(ViewModels.WorldAnalyzerViewModel viewModel, string? pa
}
CharacterControl.ItemsSource = Save.Characters;
Save.UpdateCharacters();

//FontSizeSlider.Value = AdventureData.FontSize;
//FontSizeSlider.Minimum = 2.0;
//FontSizeSlider.Maximum = AdventureData.FontSize * 2;
FontSizeSlider.Value = Properties.Settings.Default.AnalyzerFontSize;
FontSizeSlider.ValueChanged += FontSizeSlider_ValueChanged;

CharacterControl.SelectedIndex = 0;
checkAdventureTab();
} catch (Exception ex) {
Expand All @@ -74,7 +83,13 @@ public WorldAnalyzerPage(ViewModels.WorldAnalyzerViewModel viewModel, string? pa

public WorldAnalyzerPage(ViewModels.WorldAnalyzerViewModel viewModel) : this(viewModel, null)
{

}

private void FontSizeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Properties.Settings.Default.AnalyzerFontSize = (int)Math.Round(FontSizeSlider.Value);
reloadEventGrids();
}

private void GameType_CollapsedExpanded(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -135,16 +150,16 @@ private void Data_AutoGeneratingColumn(object? sender, DataGridAutoGeneratingCol
e.Cancel = true;
return;
}
var cellStyle = new Style(typeof(DataGridCell));
cellStyle.Setters.Add(new Setter(FontSizeProperty, FontSizeSlider.Value));
if (e.Column.Header.Equals("MissingItems"))
{
e.Column.Header = "Missing Items";

if (Properties.Settings.Default.MissingItemColor == "Highlight")
{
var colorStyle = new Style(typeof(DataGridCell));
var highlight = System.Drawing.SystemColors.Highlight;
colorStyle.Setters.Add(new Setter(ForegroundProperty, new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(highlight.R, highlight.G, highlight.B))));
e.Column.CellStyle = colorStyle;
cellStyle.Setters.Add(new Setter(ForegroundProperty, new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(highlight.R, highlight.G, highlight.B))));
}
}
else if (e.Column.Header.Equals("PossibleItems"))
Expand All @@ -155,6 +170,7 @@ private void Data_AutoGeneratingColumn(object? sender, DataGridAutoGeneratingCol
return;
}
}
e.Column.CellStyle = cellStyle;
e.Column.Header = Loc.T(e.Column.Header.ToString());
}

Expand Down

0 comments on commit a7ebcd7

Please sign in to comment.