Add products grid scaling setting

- Add Grid Scaling Settings
- Add WinForms DPI migration to remove stored form sizes
- Add textbox clear button
This commit is contained in:
Mbucari 2023-07-11 20:52:43 -06:00
parent 1fa415628f
commit d1df10d060
32 changed files with 1043 additions and 427 deletions

View File

@ -131,6 +131,35 @@ namespace FileManager
writeFile(propertyName, parsedNewValue); writeFile(propertyName, parsedNewValue);
} }
public bool RemoveProperty(string propertyName)
{
if (IsReadOnly)
return false;
var success = false;
try
{
lock (locker)
{
var jObject = readFile();
if (!jObject.ContainsKey(propertyName))
return false;
jObject.Remove(propertyName);
var endContents = JsonConvert.SerializeObject(jObject, Formatting.Indented);
File.WriteAllText(Filepath, endContents);
success = true;
}
Serilog.Log.Logger.Information("Removed property. {@DebugInfo}", propertyName);
}
catch { }
return success;
}
private void writeFile(string propertyName, JToken newValue) private void writeFile(string propertyName, JToken newValue)
{ {
if (IsReadOnly) if (IsReadOnly)

View File

@ -8,9 +8,6 @@
<Panel Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Panel Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="ratingsGrid" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="3,0,0,0" ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto"> <Grid Name="ratingsGrid" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="3,0,0,0" ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto">
<Grid.Styles> <Grid.Styles>
<Style Selector="TextBlock">
<Setter Property="FontSize" Value="11" />
</Style>
<Style Selector="StackPanel > TextBlock"> <Style Selector="StackPanel > TextBlock">
<Setter Property="Padding" Value="0,0,-2,0" /> <Setter Property="Padding" Value="0,0,-2,0" />
</Style> </Style>

View File

@ -2,13 +2,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="700" d:DesignHeight="600"
xmlns:controls="clr-namespace:LibationAvalonia.Controls" xmlns:controls="clr-namespace:LibationAvalonia.Controls"
xmlns:vm="clr-namespace:LibationAvalonia.ViewModels.Settings" xmlns:vm="clr-namespace:LibationAvalonia.ViewModels.Settings"
x:DataType="vm:ImportantSettingsVM" x:DataType="vm:ImportantSettingsVM"
x:Class="LibationAvalonia.Controls.Settings.Important"> x:Class="LibationAvalonia.Controls.Settings.Important">
<Grid RowDefinitions="Auto,Auto,*"> <Grid RowDefinitions="Auto,Auto,Auto,*">
<controls:GroupBox <controls:GroupBox
Grid.Row="0" Grid.Row="0"
Margin="5" Margin="5"
@ -95,8 +95,62 @@
</StackPanel> </StackPanel>
<Grid <controls:GroupBox
Grid.Row="2" Grid.Row="2"
Margin="5">
<Grid
RowDefinitions="Auto,Auto"
ColumnDefinitions="Auto,Auto,*">
<TextBlock
Margin="0,0,10,0"
VerticalAlignment="Center"
Text="{CompiledBinding GridScaleFactorText}"/>
<Slider
Grid.Column="1"
Width="200"
Value="{CompiledBinding GridScaleFactor, Mode=TwoWay}"
VerticalAlignment="Center"
Minimum="-100"
Maximum="100"
IsSnapToTickEnabled="False"
TickFrequency="25"
TickPlacement="BottomRight">
</Slider>
<TextBlock
Margin="0,0,10,0"
Grid.Row="1"
VerticalAlignment="Center"
Text="{CompiledBinding GridFontScaleFactorText}"/>
<Slider
Grid.Column="1"
Grid.Row="1"
Width="200"
Value="{CompiledBinding GridFontScaleFactor, Mode=TwoWay}"
VerticalAlignment="Center"
Minimum="-100"
Maximum="100"
IsSnapToTickEnabled="False"
TickFrequency="25"
TickPlacement="BottomRight">
</Slider>
<Button
Grid.Column="2"
Grid.Row="1"
HorizontalAlignment="Right"
Margin="0,5"
Padding="20,0"
VerticalAlignment="Stretch"
Content="Apply Display Settings"
Command="{CompiledBinding ApplyDisplaySettings}"/>
</Grid>
</controls:GroupBox>
<Grid
Grid.Row="3"
ColumnDefinitions="Auto,Auto,*" ColumnDefinitions="Auto,Auto,*"
Margin="10" Margin="10"
VerticalAlignment="Bottom"> VerticalAlignment="Bottom">

View File

@ -13,9 +13,11 @@ namespace LibationAvalonia.ViewModels.Settings
{ {
private string themeVariant; private string themeVariant;
private string initialThemeVariant; private string initialThemeVariant;
private readonly Configuration config;
public ImportantSettingsVM(Configuration config) public ImportantSettingsVM(Configuration config)
{ {
this.config = config;
LoadSettings(config); LoadSettings(config);
} }
@ -27,6 +29,8 @@ namespace LibationAvalonia.ViewModels.Settings
CreationTime = DateTimeSources.SingleOrDefault(v => v.Value == config.CreationTime) ?? DateTimeSources[0]; CreationTime = DateTimeSources.SingleOrDefault(v => v.Value == config.CreationTime) ?? DateTimeSources[0];
LastWriteTime = DateTimeSources.SingleOrDefault(v => v.Value == config.LastWriteTime) ?? DateTimeSources[0]; LastWriteTime = DateTimeSources.SingleOrDefault(v => v.Value == config.LastWriteTime) ?? DateTimeSources[0];
LoggingLevel = config.LogLevel; LoggingLevel = config.LogLevel;
GridScaleFactor = scaleFactorToLinearRange(config.GridScaleFactor);
GridFontScaleFactor = scaleFactorToLinearRange(config.GridFontScaleFactor);
ThemeVariant = initialThemeVariant ThemeVariant = initialThemeVariant
= Configuration.Instance.GetString(propertyName: nameof(ThemeVariant)) is nameof(Avalonia.Styling.ThemeVariant.Dark) = Configuration.Instance.GetString(propertyName: nameof(ThemeVariant)) is nameof(Avalonia.Styling.ThemeVariant.Dark)
? nameof(Avalonia.Styling.ThemeVariant.Dark) ? nameof(Avalonia.Styling.ThemeVariant.Dark)
@ -47,6 +51,16 @@ namespace LibationAvalonia.ViewModels.Settings
Configuration.Instance.SetString(ThemeVariant, nameof(ThemeVariant)); Configuration.Instance.SetString(ThemeVariant, nameof(ThemeVariant));
} }
private static float scaleFactorToLinearRange(float scaleFactor)
=> float.Round(100 * MathF.Log2(scaleFactor));
private static float linearRangeToScaleFactor(float value)
=> MathF.Pow(2, value / 100f);
public void ApplyDisplaySettings()
{
config.GridFontScaleFactor = linearRangeToScaleFactor(GridFontScaleFactor);
config.GridScaleFactor = linearRangeToScaleFactor(GridScaleFactor);
}
public void OpenLogFolderButton() => Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName); public void OpenLogFolderButton() => Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName);
public List<Configuration.KnownDirectories> KnownDirectories { get; } = new() public List<Configuration.KnownDirectories> KnownDirectories { get; } = new()
@ -66,12 +80,16 @@ namespace LibationAvalonia.ViewModels.Settings
.Select(v => new EnumDiaplay<Configuration.DateTimeSource>(v)) .Select(v => new EnumDiaplay<Configuration.DateTimeSource>(v))
.ToArray(); .ToArray();
public Serilog.Events.LogEventLevel[] LoggingLevels { get; } = Enum.GetValues<Serilog.Events.LogEventLevel>(); public Serilog.Events.LogEventLevel[] LoggingLevels { get; } = Enum.GetValues<Serilog.Events.LogEventLevel>();
public string GridScaleFactorText { get; } = Configuration.GetDescription(nameof(Configuration.GridScaleFactor));
public string GridFontScaleFactorText { get; } = Configuration.GetDescription(nameof(Configuration.GridFontScaleFactor));
public string BetaOptInText { get; } = Configuration.GetDescription(nameof(Configuration.BetaOptIn)); public string BetaOptInText { get; } = Configuration.GetDescription(nameof(Configuration.BetaOptIn));
public string[] Themes { get; } = { nameof(Avalonia.Styling.ThemeVariant.Light), nameof(Avalonia.Styling.ThemeVariant.Dark) }; public string[] Themes { get; } = { nameof(Avalonia.Styling.ThemeVariant.Light), nameof(Avalonia.Styling.ThemeVariant.Dark) };
public string BooksDirectory { get; set; } public string BooksDirectory { get; set; }
public bool SavePodcastsToParentFolder { get; set; } public bool SavePodcastsToParentFolder { get; set; }
public bool OverwriteExisting { get; set; } public bool OverwriteExisting { get; set; }
public float GridScaleFactor { get; set; }
public float GridFontScaleFactor { get; set; }
public EnumDiaplay<Configuration.DateTimeSource> CreationTime { get; set; } public EnumDiaplay<Configuration.DateTimeSource> CreationTime { get; set; }
public EnumDiaplay<Configuration.DateTimeSource> LastWriteTime { get; set; } public EnumDiaplay<Configuration.DateTimeSource> LastWriteTime { get; set; }
public Serilog.Events.LogEventLevel LoggingLevel { get; set; } public Serilog.Events.LogEventLevel LoggingLevel { get; set; }

View File

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:LibationAvalonia.ViewModels" xmlns:vm="clr-namespace:LibationAvalonia.ViewModels"
mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="200" MinWidth="64" MinHeight="64" mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="200" MinWidth="37" MinHeight="40"
Background="Transparent" Background="Transparent"
x:DataType="vm:LiberateStatusButtonViewModel" x:DataType="vm:LiberateStatusButtonViewModel"
x:Class="LibationAvalonia.Views.LiberateStatusButton"> x:Class="LibationAvalonia.Views.LiberateStatusButton">
@ -35,12 +35,17 @@
Name="button" Name="button"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsEnabled="{CompiledBinding IsButtonEnabled}" Padding="0" Click="Button_Click" > Padding="0"
<Panel> IsEnabled="{CompiledBinding IsButtonEnabled}" Click="Button_Click" >
<Panel <Grid RowDefinitions="*,8*,*">
Width="64" Height="64" <Viewbox
IsVisible="{CompiledBinding !IsError}"> Grid.Row="1"
Stretch="Uniform"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Panel>
<Panel IsVisible="{CompiledBinding !IsError}">
<Panel IsVisible="{CompiledBinding IsSeries}"> <Panel IsVisible="{CompiledBinding IsSeries}">
<Path IsVisible="{CompiledBinding Expanded}" Data="{StaticResource CollapseIcon}" /> <Path IsVisible="{CompiledBinding Expanded}" Data="{StaticResource CollapseIcon}" />
@ -51,18 +56,15 @@
IsVisible="{CompiledBinding !IsSeries}" IsVisible="{CompiledBinding !IsSeries}"
HorizontalAlignment="Center" HorizontalAlignment="Center"
ColumnDefinitions="Auto,Auto"> ColumnDefinitions="Auto,Auto">
<Canvas Width="29.44" Height="64"> <Canvas Width="29.44" Height="64">
<Rectangle Canvas.Left="5" Canvas.Top="5" IsVisible="{CompiledBinding RedVisible}" Fill="{DynamicResource StoplightRed}" /> <Rectangle Canvas.Left="5" Canvas.Top="5" IsVisible="{CompiledBinding RedVisible}" Fill="{DynamicResource StoplightRed}" />
<Rectangle Canvas.Left="5" Canvas.Top="23" IsVisible="{CompiledBinding YellowVisible}" Fill="{DynamicResource StoplightYellow}" /> <Rectangle Canvas.Left="5" Canvas.Top="23" IsVisible="{CompiledBinding YellowVisible}" Fill="{DynamicResource StoplightYellow}" />
<Rectangle Canvas.Left="5" Canvas.Top="42" IsVisible="{CompiledBinding GreenVisible}" Fill="{DynamicResource StoplightGreen}" /> <Rectangle Canvas.Left="5" Canvas.Top="42" IsVisible="{CompiledBinding GreenVisible}" Fill="{DynamicResource StoplightGreen}" />
<Path Height="64" Stretch="Uniform" Data="{StaticResource StoplightBodyIcon}"/> <Path Height="64" Stretch="Uniform" Data="{StaticResource StoplightBodyIcon}"/>
</Canvas> </Canvas>
<Path Grid.Column="1" IsVisible="{CompiledBinding PdfDownloadedVisible}" Data="{StaticResource PdfDownloadedIcon}"/> <Path Grid.Column="1" IsVisible="{CompiledBinding PdfDownloadedVisible}" Data="{StaticResource PdfDownloadedIcon}"/>
<Path Grid.Column="1" IsVisible="{CompiledBinding PdfNotDownloadedVisible}" Data="{StaticResource PdfNotDownloadedIcon}"/> <Path Grid.Column="1" IsVisible="{CompiledBinding PdfNotDownloadedVisible}" Data="{StaticResource PdfNotDownloadedIcon}"/>
</Grid> </Grid>
</Panel> </Panel>
<Path <Path
@ -77,6 +79,7 @@
Fill="{DynamicResource DisabledGrayBrush}" Fill="{DynamicResource DisabledGrayBrush}"
Data="M0,0 H1 V1 H0" /> Data="M0,0 H1 V1 H0" />
</Panel> </Panel>
</Viewbox>
</Grid>
</Button> </Button>
</UserControl> </UserControl>

View File

@ -20,9 +20,6 @@
CanUserReorderColumns="True"> CanUserReorderColumns="True">
<DataGrid.Styles> <DataGrid.Styles>
<Style Selector="DataGridCell">
<Setter Property="Height" Value="80"/>
</Style>
<Style Selector="DataGridCell > Panel"> <Style Selector="DataGridCell > Panel">
<Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="VerticalAlignment" Value="Stretch"/>
</Style> </Style>
@ -31,7 +28,6 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4"/>
<Setter Property="FontSize" Value="12"/>
</Style> </Style>
<Style Selector="DataGridCell Path"> <Style Selector="DataGridCell Path">
<Setter Property="Stretch" Value="Uniform" /> <Setter Property="Stretch" Value="Uniform" />
@ -69,7 +65,7 @@
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<controls:DataGridTemplateColumnExt CanUserSort="True" Width="75" Header="Liberate" SortMemberPath="Liberate" ClipboardContentBinding="{Binding Liberate.ToolTip}"> <controls:DataGridTemplateColumnExt CanUserSort="True" Header="Liberate" SortMemberPath="Liberate" ClipboardContentBinding="{Binding Liberate.ToolTip}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<views:LiberateStatusButton <views:LiberateStatusButton
@ -84,10 +80,10 @@
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</controls:DataGridTemplateColumnExt> </controls:DataGridTemplateColumnExt>
<controls:DataGridTemplateColumnExt CanUserSort="False" Width="80" Header="Cover" SortMemberPath="Cover" ClipboardContentBinding="{Binding LibraryBook.Book.PictureLarge}"> <controls:DataGridTemplateColumnExt CanUserSort="False" Header="Cover" SortMemberPath="Cover" ClipboardContentBinding="{Binding LibraryBook.Book.PictureLarge}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<Image Opacity="{CompiledBinding Liberate.Opacity}" Tapped="Cover_Click" Height="80" Source="{CompiledBinding Cover}" ToolTip.Tip="Click to see full size" /> <Image Opacity="{CompiledBinding Liberate.Opacity}" Tapped="Cover_Click" Source="{CompiledBinding Cover}" ToolTip.Tip="Click to see full size" />
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</controls:DataGridTemplateColumnExt> </controls:DataGridTemplateColumnExt>
@ -96,7 +92,7 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}"> <Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}">
<TextBlock FontSize="14" Text="{CompiledBinding Title}" /> <TextBlock Classes="h1" Text="{CompiledBinding Title}" />
</Panel> </Panel>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -156,7 +152,7 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}" Tapped="Description_Click" ToolTip.Tip="Click to see full description" > <Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}" Tapped="Description_Click" ToolTip.Tip="Click to see full description" >
<TextBlock Text="{CompiledBinding Description}" FontSize="11" VerticalAlignment="Top" /> <TextBlock Text="{CompiledBinding Description}" VerticalAlignment="Top" />
</Panel> </Panel>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -208,7 +204,7 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}"> <Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}">
<TextBlock Text="{CompiledBinding Misc}" TextWrapping="WrapWithOverflow" FontSize="10" /> <TextBlock Text="{CompiledBinding Misc}" TextWrapping="WrapWithOverflow" />
</Panel> </Panel>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -218,7 +214,7 @@
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}" ToolTip.Tip="{CompiledBinding LastDownload.ToolTipText}" DoubleTapped="Version_DoubleClick"> <Panel Opacity="{CompiledBinding Liberate.Opacity}" Background="{CompiledBinding Liberate.BackgroundBrush}" ToolTip.Tip="{CompiledBinding LastDownload.ToolTipText}" DoubleTapped="Version_DoubleClick">
<TextBlock Text="{CompiledBinding LastDownload}" TextWrapping="WrapWithOverflow" FontSize="10" /> <TextBlock Text="{CompiledBinding LastDownload}" TextWrapping="WrapWithOverflow" />
</Panel> </Panel>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -227,13 +223,30 @@
<controls:DataGridTemplateColumnExt CanUserSort="True" Width="100" Header="Tags" SortMemberPath="BookTags" ClipboardContentBinding="{Binding BookTags}"> <controls:DataGridTemplateColumnExt CanUserSort="True" Width="100" Header="Tags" SortMemberPath="BookTags" ClipboardContentBinding="{Binding BookTags}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate x:DataType="uibase:IGridEntry"> <DataTemplate x:DataType="uibase:IGridEntry">
<Button IsVisible="{CompiledBinding !Liberate.IsSeries}" Width="100" Height="80" Click="OnTagsButtonClick" ToolTip.Tip="Click to edit tags" > <Button
<Panel Opacity="{CompiledBinding Liberate.Opacity}"> IsVisible="{CompiledBinding !Liberate.IsSeries}"
<Panel Width="24" Height="24" IsVisible="{CompiledBinding BookTags, Converter={x:Static StringConverters.IsNullOrEmpty}}"> VerticalAlignment="Stretch"
<Path Stretch="Uniform" Fill="{DynamicResource IconFill}" Data="{StaticResource EditTagsIcon}" /> HorizontalAlignment="Stretch"
</Panel> VerticalContentAlignment="Stretch"
<TextBlock IsVisible="{CompiledBinding BookTags, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" FontSize="12" TextWrapping="WrapWithOverflow" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{CompiledBinding BookTags}"/> HorizontalContentAlignment="Stretch"
</Panel> Click="OnTagsButtonClick"
ToolTip.Tip="Click to edit tags">
<Grid
RowDefinitions="*,*,*"
Opacity="{CompiledBinding Liberate.Opacity}">
<Viewbox
Grid.Row="1"
Stretch="Uniform"
IsVisible="{CompiledBinding BookTags, Converter={x:Static StringConverters.IsNullOrEmpty}}">
<Path Fill="{DynamicResource IconFill}" Data="{StaticResource EditTagsIcon}" />
</Viewbox>
<TextBlock
Classes="h2"
Grid.RowSpan="3"
IsVisible="{CompiledBinding BookTags, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" TextWrapping="WrapWithOverflow" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{CompiledBinding BookTags}"/>
</Grid>
</Button> </Button>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>

View File

@ -2,7 +2,9 @@ using ApplicationServices;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using Avalonia.Styling;
using DataLayer; using DataLayer;
using Dinah.Core;
using FileLiberator; using FileLiberator;
using LibationAvalonia.Controls; using LibationAvalonia.Controls;
using LibationAvalonia.Dialogs; using LibationAvalonia.Dialogs;
@ -30,6 +32,25 @@ namespace LibationAvalonia.Views
InitializeComponent(); InitializeComponent();
DataGridContextMenus.CellContextMenuStripNeeded += ProductsGrid_CellContextMenuStripNeeded; DataGridContextMenus.CellContextMenuStripNeeded += ProductsGrid_CellContextMenuStripNeeded;
var cellSelector = Selectors.Is<DataGridCell>(null);
rowHeightStyle = new Style(_ => cellSelector);
rowHeightStyle.Setters.Add(rowHeightSetter);
var tboxSelector = cellSelector.Descendant().Is<TextBlock>();
fontSizeStyle = new Style(_ => tboxSelector);
fontSizeStyle.Setters.Add(fontSizeSetter);
var tboxH1Selector = cellSelector.Child().Is<Panel>().Child().Is<TextBlock>().Class("h1");
fontSizeH1Style = new Style(_ => tboxH1Selector);
fontSizeH1Style.Setters.Add(fontSizeH1Setter);
var tboxH2Selector = cellSelector.Child().Is<Panel>().Child().Is<TextBlock>().Class("h2");
fontSizeH2Style = new Style(_ => tboxH2Selector);
fontSizeH2Style.Setters.Add(fontSizeH2Setter);
Configuration.Instance.PropertyChanged += Configuration_GridScaleChanged;
Configuration.Instance.PropertyChanged += Configuration_FontChanged;
if (Design.IsDesignMode) if (Design.IsDesignMode)
{ {
using var context = DbContexts.GetContext(); using var context = DbContexts.GetContext();
@ -54,9 +75,13 @@ namespace LibationAvalonia.Views
_ = pdvm.BindToGridAsync(sampleEntries); _ = pdvm.BindToGridAsync(sampleEntries);
DataContext = pdvm; DataContext = pdvm;
setGridScale(1);
setFontScale(1);
return; return;
} }
setGridScale(Configuration.Instance.GridScaleFactor);
setFontScale(Configuration.Instance.GridFontScaleFactor);
Configure_ColumnCustomization(); Configure_ColumnCustomization();
foreach (var column in productsGrid.Columns) foreach (var column in productsGrid.Columns)
@ -67,13 +92,82 @@ namespace LibationAvalonia.Views
private void RemoveColumn_PropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) private void RemoveColumn_PropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
{ {
if (sender is DataGridColumn col && e.Property.Name == nameof(DataGridColumn.IsVisible)) if (sender is DataGridColumn col && e.Property == DataGridColumn.IsVisibleProperty)
{ {
col.DisplayIndex = 0; col.DisplayIndex = 0;
col.CanUserReorder = false; col.CanUserReorder = false;
} }
} }
#region Scaling
[PropertyChangeFilter(nameof(Configuration.GridScaleFactor))]
private void Configuration_GridScaleChanged(object sender, Dinah.Core.PropertyChangedEventArgsEx e)
{
setGridScale((float)e.NewValue);
}
[PropertyChangeFilter(nameof(Configuration.GridFontScaleFactor))]
private void Configuration_FontChanged(object sender, Dinah.Core.PropertyChangedEventArgsEx e)
{
setFontScale((float)e.NewValue);
}
private readonly Style rowHeightStyle;
private readonly Setter rowHeightSetter = new() { Property = DataGridCell.HeightProperty };
private readonly Style fontSizeStyle;
private readonly Setter fontSizeSetter = new() { Property = TextBlock.FontSizeProperty };
private readonly Style fontSizeH1Style;
private readonly Setter fontSizeH1Setter = new() { Property = TextBlock.FontSizeProperty };
private readonly Style fontSizeH2Style;
private readonly Setter fontSizeH2Setter = new() { Property = TextBlock.FontSizeProperty };
private void setFontScale(double scaleFactor)
{
const double TextBlockFontSize = 11;
const double H1FontSize = 14;
const double H2FontSize = 12;
fontSizeSetter.Value = TextBlockFontSize * scaleFactor;
fontSizeH1Setter.Value = H1FontSize * scaleFactor;
fontSizeH2Setter.Value = H2FontSize * scaleFactor;
productsGrid.Styles.Remove(fontSizeStyle);
productsGrid.Styles.Remove(fontSizeH1Style);
productsGrid.Styles.Remove(fontSizeH2Style);
productsGrid.Styles.Add(fontSizeStyle);
productsGrid.Styles.Add(fontSizeH1Style);
productsGrid.Styles.Add(fontSizeH2Style);
}
private void setGridScale(double scaleFactor)
{
const float BaseRowHeight = 80;
const float BaseLiberateWidth = 75;
const float BaseCoverWidth = 80;
foreach (var column in productsGrid.Columns)
{
switch (column.SortMemberPath)
{
case nameof(IGridEntry.Liberate):
column.Width = new DataGridLength(BaseLiberateWidth * scaleFactor);
break;
case nameof(IGridEntry.Cover):
column.Width = new DataGridLength(BaseCoverWidth * scaleFactor);
break;
}
}
rowHeightSetter.Value = BaseRowHeight * scaleFactor;
productsGrid.Styles.Remove(rowHeightStyle);
productsGrid.Styles.Add(rowHeightStyle);
}
#endregion
#region Cell Context Menu #region Cell Context Menu
public void ProductsGrid_CellContextMenuStripNeeded(object sender, DataGridCellContextMenuStripNeededEventArgs args) public void ProductsGrid_CellContextMenuStripNeeded(object sender, DataGridCellContextMenuStripNeededEventArgs args)

View File

@ -20,6 +20,8 @@ namespace LibationFileManager
private PersistentDictionary persistentDictionary; private PersistentDictionary persistentDictionary;
public bool RemoveProperty(string propertyName) => persistentDictionary.RemoveProperty(propertyName);
public T GetNonString<T>(T defaultValue, [CallerMemberName] string propertyName = "") => persistentDictionary.GetNonString(propertyName, defaultValue); public T GetNonString<T>(T defaultValue, [CallerMemberName] string propertyName = "") => persistentDictionary.GetNonString(propertyName, defaultValue);
public object GetObject([CallerMemberName] string propertyName = "") => persistentDictionary.GetObject(propertyName); public object GetObject([CallerMemberName] string propertyName = "") => persistentDictionary.GetObject(propertyName);
public string GetString(string defaultValue = null, [CallerMemberName] string propertyName = "") => persistentDictionary.GetString(propertyName, defaultValue); public string GetString(string defaultValue = null, [CallerMemberName] string propertyName = "") => persistentDictionary.GetString(propertyName, defaultValue);
@ -79,6 +81,12 @@ namespace LibationFileManager
[Description("Save audiobook metadata to metadata.json")] [Description("Save audiobook metadata to metadata.json")]
public bool SaveMetadataToFile { get => GetNonString(defaultValue: false); set => SetNonString(value); } public bool SaveMetadataToFile { get => GetNonString(defaultValue: false); set => SetNonString(value); }
[Description("Book display grid size")]
public float GridScaleFactor { get => float.Min(2, float.Max(0.5f, GetNonString(defaultValue: 1f))); set => SetNonString(value); }
[Description("Book display font size")]
public float GridFontScaleFactor { get => float.Min(2, float.Max(0.5f, GetNonString(defaultValue: 1f))); set => SetNonString(value); }
[Description("Use the beta version of Libation\r\nNew and experimental features, but probably buggy.\r\n(requires restart to take effect)")] [Description("Use the beta version of Libation\r\nNew and experimental features, but probably buggy.\r\n(requires restart to take effect)")]
public bool BetaOptIn { get => GetNonString(defaultValue: false); set => SetNonString(value); } public bool BetaOptIn { get => GetNonString(defaultValue: false); set => SetNonString(value); }

View File

@ -120,7 +120,7 @@ namespace LibationUiBase.GridView
Misc = GetMiscDisplay(libraryBook); Misc = GetMiscDisplay(libraryBook);
LastDownload = new(Book.UserDefinedItem); LastDownload = new(Book.UserDefinedItem);
LongDescription = GetDescriptionDisplay(Book); LongDescription = GetDescriptionDisplay(Book);
Description = TrimTextToWord(LongDescription, 62); Description = LongDescription;// TrimTextToWord(LongDescription, 62);
SeriesIndex = Book.SeriesLink.FirstOrDefault()?.Index ?? 0; SeriesIndex = Book.SeriesLink.FirstOrDefault()?.Index ?? 0;
BookTags = GetBookTags(); BookTags = GetBookTags();

View File

@ -0,0 +1,73 @@
namespace LibationWinForms
{
partial class ClearableTextBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
textBox1 = new System.Windows.Forms.TextBox();
button1 = new System.Windows.Forms.Button();
SuspendLayout();
//
// textBox1
//
textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
textBox1.Location = new System.Drawing.Point(0, 0);
textBox1.Margin = new System.Windows.Forms.Padding(0);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(625, 23);
textBox1.TabIndex = 0;
//
// button1
//
button1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
button1.Location = new System.Drawing.Point(623, 0);
button1.Margin = new System.Windows.Forms.Padding(0);
button1.Name = "button1";
button1.Size = new System.Drawing.Size(20, 20);
button1.TabIndex = 1;
button1.Text = "X";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// ClearableTextBox
//
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
Controls.Add(button1);
Controls.Add(textBox1);
Name = "ClearableTextBox";
Size = new System.Drawing.Size(642, 20);
ResumeLayout(false);
PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace LibationWinForms
{
public partial class ClearableTextBox : UserControl
{
public event EventHandler TextCleared;
public override string Text { get => textBox1.Text; set => textBox1.Text = value; }
public override Font Font
{
get => textBox1.Font;
set
{
base.Font = textBox1.Font = button1.Font = value;
OnSizeChanged(EventArgs.Empty);
}
}
public ClearableTextBox()
{
InitializeComponent();
textBox1.KeyDown += (_, e) => OnKeyDown(e);
textBox1.KeyUp += (_, e) => OnKeyUp(e);
textBox1.KeyPress += (_, e) => OnKeyPress(e);
textBox1.TextChanged += (_, e) => OnTextChanged(e);
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
Height = button1.Width = button1.Height = textBox1.Height;
textBox1.Width = Width - button1.Width;
button1.Location = new Point(textBox1.Width, 0);
}
private void button1_Click(object sender, System.EventArgs e)
{
textBox1.Clear();
TextCleared?.Invoke(this, EventArgs.Empty);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -39,10 +39,9 @@ namespace LibationWinForms.Dialogs
// knownDirectoryRb // knownDirectoryRb
// //
knownDirectoryRb.AutoSize = true; knownDirectoryRb.AutoSize = true;
knownDirectoryRb.Location = new System.Drawing.Point(6, 6); knownDirectoryRb.Location = new System.Drawing.Point(3, 3);
knownDirectoryRb.Margin = new System.Windows.Forms.Padding(6);
knownDirectoryRb.Name = "knownDirectoryRb"; knownDirectoryRb.Name = "knownDirectoryRb";
knownDirectoryRb.Size = new System.Drawing.Size(27, 26); knownDirectoryRb.Size = new System.Drawing.Size(14, 13);
knownDirectoryRb.TabIndex = 0; knownDirectoryRb.TabIndex = 0;
knownDirectoryRb.UseVisualStyleBackColor = true; knownDirectoryRb.UseVisualStyleBackColor = true;
knownDirectoryRb.CheckedChanged += radioButton_CheckedChanged; knownDirectoryRb.CheckedChanged += radioButton_CheckedChanged;
@ -50,10 +49,9 @@ namespace LibationWinForms.Dialogs
// customDirectoryRb // customDirectoryRb
// //
customDirectoryRb.AutoSize = true; customDirectoryRb.AutoSize = true;
customDirectoryRb.Location = new System.Drawing.Point(4, 124); customDirectoryRb.Location = new System.Drawing.Point(2, 62);
customDirectoryRb.Margin = new System.Windows.Forms.Padding(6);
customDirectoryRb.Name = "customDirectoryRb"; customDirectoryRb.Name = "customDirectoryRb";
customDirectoryRb.Size = new System.Drawing.Size(27, 26); customDirectoryRb.Size = new System.Drawing.Size(14, 13);
customDirectoryRb.TabIndex = 2; customDirectoryRb.TabIndex = 2;
customDirectoryRb.UseVisualStyleBackColor = true; customDirectoryRb.UseVisualStyleBackColor = true;
customDirectoryRb.CheckedChanged += radioButton_CheckedChanged; customDirectoryRb.CheckedChanged += radioButton_CheckedChanged;
@ -61,19 +59,17 @@ namespace LibationWinForms.Dialogs
// customTb // customTb
// //
customTb.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; customTb.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
customTb.Location = new System.Drawing.Point(44, 116); customTb.Location = new System.Drawing.Point(22, 58);
customTb.Margin = new System.Windows.Forms.Padding(6);
customTb.Name = "customTb"; customTb.Name = "customTb";
customTb.Size = new System.Drawing.Size(1172, 39); customTb.Size = new System.Drawing.Size(588, 23);
customTb.TabIndex = 3; customTb.TabIndex = 3;
// //
// customBtn // customBtn
// //
customBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; customBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
customBtn.Location = new System.Drawing.Point(1232, 116); customBtn.Location = new System.Drawing.Point(616, 58);
customBtn.Margin = new System.Windows.Forms.Padding(6);
customBtn.Name = "customBtn"; customBtn.Name = "customBtn";
customBtn.Size = new System.Drawing.Size(82, 54); customBtn.Size = new System.Drawing.Size(41, 27);
customBtn.TabIndex = 4; customBtn.TabIndex = 4;
customBtn.Text = "..."; customBtn.Text = "...";
customBtn.UseVisualStyleBackColor = true; customBtn.UseVisualStyleBackColor = true;
@ -83,24 +79,23 @@ namespace LibationWinForms.Dialogs
// //
directorySelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; directorySelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
directorySelectControl.AutoSize = true; directorySelectControl.AutoSize = true;
directorySelectControl.Location = new System.Drawing.Point(46, 0); directorySelectControl.Location = new System.Drawing.Point(23, 0);
directorySelectControl.Margin = new System.Windows.Forms.Padding(12); directorySelectControl.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
directorySelectControl.Name = "directorySelectControl"; directorySelectControl.Name = "directorySelectControl";
directorySelectControl.Size = new System.Drawing.Size(1270, 104); directorySelectControl.Size = new System.Drawing.Size(635, 55);
directorySelectControl.TabIndex = 5; directorySelectControl.TabIndex = 5;
// //
// DirectoryOrCustomSelectControl // DirectoryOrCustomSelectControl
// //
AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F); AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
Controls.Add(directorySelectControl); Controls.Add(directorySelectControl);
Controls.Add(customBtn); Controls.Add(customBtn);
Controls.Add(customTb); Controls.Add(customTb);
Controls.Add(customDirectoryRb); Controls.Add(customDirectoryRb);
Controls.Add(knownDirectoryRb); Controls.Add(knownDirectoryRb);
Margin = new System.Windows.Forms.Padding(6);
Name = "DirectoryOrCustomSelectControl"; Name = "DirectoryOrCustomSelectControl";
Size = new System.Drawing.Size(1320, 176); Size = new System.Drawing.Size(660, 88);
Load += DirectoryOrCustomSelectControl_Load; Load += DirectoryOrCustomSelectControl_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -37,6 +37,12 @@ namespace LibationWinForms.Dialogs
if (directory != Configuration.KnownDirectories.None) if (directory != Configuration.KnownDirectories.None)
selectDir(directory, null); selectDir(directory, null);
} }
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
//For some reason anchors don't work when the parent form scales up, even with AutoScale
directorySelectControl.Width = customTb.Width = Width;
}
/// <summary>set selection</summary> /// <summary>set selection</summary>
public void SelectDirectory(string directory) public void SelectDirectory(string directory)

View File

@ -39,32 +39,29 @@ namespace LibationWinForms.Dialogs
directoryComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; directoryComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
directoryComboBox.FormattingEnabled = true; directoryComboBox.FormattingEnabled = true;
directoryComboBox.Location = new System.Drawing.Point(0, 0); directoryComboBox.Location = new System.Drawing.Point(0, 0);
directoryComboBox.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
directoryComboBox.Name = "directoryComboBox"; directoryComboBox.Name = "directoryComboBox";
directoryComboBox.Size = new System.Drawing.Size(810, 40); directoryComboBox.Size = new System.Drawing.Size(814, 23);
directoryComboBox.TabIndex = 0; directoryComboBox.TabIndex = 0;
directoryComboBox.SelectedIndexChanged += directoryComboBox_SelectedIndexChanged; directoryComboBox.SelectedIndexChanged += directoryComboBox_SelectedIndexChanged;
// //
// textBox1 // textBox1
// //
textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
textBox1.Location = new System.Drawing.Point(0, 58); textBox1.Location = new System.Drawing.Point(0, 29);
textBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
textBox1.Name = "textBox1"; textBox1.Name = "textBox1";
textBox1.ReadOnly = true; textBox1.ReadOnly = true;
textBox1.Size = new System.Drawing.Size(810, 39); textBox1.Size = new System.Drawing.Size(814, 23);
textBox1.TabIndex = 1; textBox1.TabIndex = 1;
// //
// DirectorySelectControl // DirectorySelectControl
// //
AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F); AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
AutoSize = true; AutoSize = true;
Controls.Add(textBox1); Controls.Add(textBox1);
Controls.Add(directoryComboBox); Controls.Add(directoryComboBox);
Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
Name = "DirectorySelectControl"; Name = "DirectorySelectControl";
Size = new System.Drawing.Size(814, 104); Size = new System.Drawing.Size(814, 55);
Load += DirectorySelectControl_Load; Load += DirectorySelectControl_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -50,6 +50,12 @@ namespace LibationWinForms.Dialogs
return path; return path;
} }
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
//For some reason anchors don't work when the parent form scales up, even with AutoScale
directoryComboBox.Width = textBox1.Width = Width;
}
private DirectoryComboBoxItem selectedItem => (DirectoryComboBoxItem)this.directoryComboBox.SelectedItem; private DirectoryComboBoxItem selectedItem => (DirectoryComboBoxItem)this.directoryComboBox.SelectedItem;

View File

@ -37,10 +37,10 @@
// libationFilesDescLbl // libationFilesDescLbl
// //
libationFilesDescLbl.AutoSize = true; libationFilesDescLbl.AutoSize = true;
libationFilesDescLbl.Location = new System.Drawing.Point(28, 20); libationFilesDescLbl.Location = new System.Drawing.Point(14, 10);
libationFilesDescLbl.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0); libationFilesDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
libationFilesDescLbl.Name = "libationFilesDescLbl"; libationFilesDescLbl.Name = "libationFilesDescLbl";
libationFilesDescLbl.Size = new System.Drawing.Size(76, 32); libationFilesDescLbl.Size = new System.Drawing.Size(39, 15);
libationFilesDescLbl.TabIndex = 0; libationFilesDescLbl.TabIndex = 0;
libationFilesDescLbl.Text = "[desc]"; libationFilesDescLbl.Text = "[desc]";
// //
@ -48,10 +48,10 @@
// //
cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
cancelBtn.Location = new System.Drawing.Point(1664, 236); cancelBtn.Location = new System.Drawing.Point(832, 118);
cancelBtn.Margin = new System.Windows.Forms.Padding(8, 6, 8, 6); cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cancelBtn.Name = "cancelBtn"; cancelBtn.Name = "cancelBtn";
cancelBtn.Size = new System.Drawing.Size(176, 54); cancelBtn.Size = new System.Drawing.Size(88, 27);
cancelBtn.TabIndex = 3; cancelBtn.TabIndex = 3;
cancelBtn.Text = "Cancel"; cancelBtn.Text = "Cancel";
cancelBtn.UseVisualStyleBackColor = true; cancelBtn.UseVisualStyleBackColor = true;
@ -60,10 +60,10 @@
// saveBtn // saveBtn
// //
saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
saveBtn.Location = new System.Drawing.Point(1428, 236); saveBtn.Location = new System.Drawing.Point(714, 118);
saveBtn.Margin = new System.Windows.Forms.Padding(8, 6, 8, 6); saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
saveBtn.Name = "saveBtn"; saveBtn.Name = "saveBtn";
saveBtn.Size = new System.Drawing.Size(176, 54); saveBtn.Size = new System.Drawing.Size(88, 27);
saveBtn.TabIndex = 2; saveBtn.TabIndex = 2;
saveBtn.Text = "Save"; saveBtn.Text = "Save";
saveBtn.UseVisualStyleBackColor = true; saveBtn.UseVisualStyleBackColor = true;
@ -72,24 +72,24 @@
// libationFilesSelectControl // libationFilesSelectControl
// //
libationFilesSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; libationFilesSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
libationFilesSelectControl.Location = new System.Drawing.Point(28, 56); libationFilesSelectControl.Location = new System.Drawing.Point(14, 28);
libationFilesSelectControl.Margin = new System.Windows.Forms.Padding(12); libationFilesSelectControl.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
libationFilesSelectControl.Name = "libationFilesSelectControl"; libationFilesSelectControl.Name = "libationFilesSelectControl";
libationFilesSelectControl.Size = new System.Drawing.Size(1818, 176); libationFilesSelectControl.Size = new System.Drawing.Size(906, 88);
libationFilesSelectControl.TabIndex = 1; libationFilesSelectControl.TabIndex = 1;
// //
// LibationFilesDialog // LibationFilesDialog
// //
AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F); AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
AutoSize = true; AutoSize = true;
ClientSize = new System.Drawing.Size(1866, 328); ClientSize = new System.Drawing.Size(933, 164);
Controls.Add(libationFilesSelectControl); Controls.Add(libationFilesSelectControl);
Controls.Add(cancelBtn); Controls.Add(cancelBtn);
Controls.Add(saveBtn); Controls.Add(saveBtn);
Controls.Add(libationFilesDescLbl); Controls.Add(libationFilesDescLbl);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
Margin = new System.Windows.Forms.Padding(8, 6, 8, 6); Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
Name = "LibationFilesDialog"; Name = "LibationFilesDialog";
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
Text = "Libation Files location"; Text = "Libation Files location";

View File

@ -51,7 +51,12 @@
loggingLevelCb = new System.Windows.Forms.ComboBox(); loggingLevelCb = new System.Windows.Forms.ComboBox();
tabControl = new System.Windows.Forms.TabControl(); tabControl = new System.Windows.Forms.TabControl();
tab1ImportantSettings = new System.Windows.Forms.TabPage(); tab1ImportantSettings = new System.Windows.Forms.TabPage();
betaOptInCbox = new System.Windows.Forms.CheckBox(); groupBox1 = new System.Windows.Forms.GroupBox();
applyDisplaySettingsBtn = new System.Windows.Forms.Button();
gridScaleFactorLbl = new System.Windows.Forms.Label();
gridScaleFactorTbar = new System.Windows.Forms.TrackBar();
gridFontScaleFactorLbl = new System.Windows.Forms.Label();
gridFontScaleFactorTbar = new System.Windows.Forms.TrackBar();
booksGb = new System.Windows.Forms.GroupBox(); booksGb = new System.Windows.Forms.GroupBox();
lastWriteTimeCb = new System.Windows.Forms.ComboBox(); lastWriteTimeCb = new System.Windows.Forms.ComboBox();
creationTimeCb = new System.Windows.Forms.ComboBox(); creationTimeCb = new System.Windows.Forms.ComboBox();
@ -131,6 +136,9 @@
badBookGb.SuspendLayout(); badBookGb.SuspendLayout();
tabControl.SuspendLayout(); tabControl.SuspendLayout();
tab1ImportantSettings.SuspendLayout(); tab1ImportantSettings.SuspendLayout();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)gridScaleFactorTbar).BeginInit();
((System.ComponentModel.ISupportInitialize)gridFontScaleFactorTbar).BeginInit();
booksGb.SuspendLayout(); booksGb.SuspendLayout();
tab2ImportLibrary.SuspendLayout(); tab2ImportLibrary.SuspendLayout();
tab3DownloadDecrypt.SuspendLayout(); tab3DownloadDecrypt.SuspendLayout();
@ -340,7 +348,7 @@
// //
// logsBtn // logsBtn
// //
logsBtn.Location = new System.Drawing.Point(256, 261); logsBtn.Location = new System.Drawing.Point(256, 424);
logsBtn.Name = "logsBtn"; logsBtn.Name = "logsBtn";
logsBtn.Size = new System.Drawing.Size(132, 23); logsBtn.Size = new System.Drawing.Size(132, 23);
logsBtn.TabIndex = 5; logsBtn.TabIndex = 5;
@ -351,6 +359,7 @@
// booksSelectControl // booksSelectControl
// //
booksSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; booksSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
booksSelectControl.AutoSize = true;
booksSelectControl.Location = new System.Drawing.Point(7, 23); booksSelectControl.Location = new System.Drawing.Point(7, 23);
booksSelectControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); booksSelectControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
booksSelectControl.Name = "booksSelectControl"; booksSelectControl.Name = "booksSelectControl";
@ -360,7 +369,7 @@
// loggingLevelLbl // loggingLevelLbl
// //
loggingLevelLbl.AutoSize = true; loggingLevelLbl.AutoSize = true;
loggingLevelLbl.Location = new System.Drawing.Point(6, 264); loggingLevelLbl.Location = new System.Drawing.Point(6, 427);
loggingLevelLbl.Name = "loggingLevelLbl"; loggingLevelLbl.Name = "loggingLevelLbl";
loggingLevelLbl.Size = new System.Drawing.Size(78, 15); loggingLevelLbl.Size = new System.Drawing.Size(78, 15);
loggingLevelLbl.TabIndex = 3; loggingLevelLbl.TabIndex = 3;
@ -370,7 +379,7 @@
// //
loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
loggingLevelCb.FormattingEnabled = true; loggingLevelCb.FormattingEnabled = true;
loggingLevelCb.Location = new System.Drawing.Point(90, 261); loggingLevelCb.Location = new System.Drawing.Point(90, 424);
loggingLevelCb.Name = "loggingLevelCb"; loggingLevelCb.Name = "loggingLevelCb";
loggingLevelCb.Size = new System.Drawing.Size(129, 23); loggingLevelCb.Size = new System.Drawing.Size(129, 23);
loggingLevelCb.TabIndex = 4; loggingLevelCb.TabIndex = 4;
@ -390,30 +399,84 @@
// //
// tab1ImportantSettings // tab1ImportantSettings
// //
tab1ImportantSettings.Controls.Add(betaOptInCbox); tab1ImportantSettings.Controls.Add(groupBox1);
tab1ImportantSettings.Controls.Add(booksGb); tab1ImportantSettings.Controls.Add(booksGb);
tab1ImportantSettings.Controls.Add(logsBtn); tab1ImportantSettings.Controls.Add(logsBtn);
tab1ImportantSettings.Controls.Add(loggingLevelCb); tab1ImportantSettings.Controls.Add(loggingLevelCb);
tab1ImportantSettings.Controls.Add(loggingLevelLbl); tab1ImportantSettings.Controls.Add(loggingLevelLbl);
tab1ImportantSettings.Location = new System.Drawing.Point(4, 24); tab1ImportantSettings.Location = new System.Drawing.Point(4, 24);
tab1ImportantSettings.Name = "tab1ImportantSettings"; tab1ImportantSettings.Name = "tab1ImportantSettings";
tab1ImportantSettings.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); tab1ImportantSettings.Padding = new System.Windows.Forms.Padding(3);
tab1ImportantSettings.Size = new System.Drawing.Size(856, 453); tab1ImportantSettings.Size = new System.Drawing.Size(856, 453);
tab1ImportantSettings.TabIndex = 0; tab1ImportantSettings.TabIndex = 0;
tab1ImportantSettings.Text = "Important settings"; tab1ImportantSettings.Text = "Important settings";
tab1ImportantSettings.UseVisualStyleBackColor = true; tab1ImportantSettings.UseVisualStyleBackColor = true;
// //
// betaOptInCbox // groupBox1
// //
betaOptInCbox.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; groupBox1.Controls.Add(applyDisplaySettingsBtn);
betaOptInCbox.AutoSize = true; groupBox1.Controls.Add(gridScaleFactorLbl);
betaOptInCbox.Enabled = false; groupBox1.Controls.Add(gridScaleFactorTbar);
betaOptInCbox.Location = new System.Drawing.Point(13, 421); groupBox1.Controls.Add(gridFontScaleFactorLbl);
betaOptInCbox.Name = "betaOptInCbox"; groupBox1.Controls.Add(gridFontScaleFactorTbar);
betaOptInCbox.Size = new System.Drawing.Size(107, 19); groupBox1.Location = new System.Drawing.Point(6, 261);
betaOptInCbox.TabIndex = 6; groupBox1.Name = "groupBox1";
betaOptInCbox.Text = "[Opt in to Beta]"; groupBox1.Size = new System.Drawing.Size(844, 83);
betaOptInCbox.UseVisualStyleBackColor = true; groupBox1.TabIndex = 9;
groupBox1.TabStop = false;
groupBox1.Text = "Display Settings";
//
// applyDisplaySettingsBtn
//
applyDisplaySettingsBtn.Location = new System.Drawing.Point(698, 34);
applyDisplaySettingsBtn.Name = "applyDisplaySettingsBtn";
applyDisplaySettingsBtn.Size = new System.Drawing.Size(140, 23);
applyDisplaySettingsBtn.TabIndex = 9;
applyDisplaySettingsBtn.Text = "Apply Display Settings";
applyDisplaySettingsBtn.UseVisualStyleBackColor = true;
applyDisplaySettingsBtn.Click += applyDisplaySettingsBtn_Click;
//
// gridScaleFactorLbl
//
gridScaleFactorLbl.AutoSize = true;
gridScaleFactorLbl.Location = new System.Drawing.Point(6, 36);
gridScaleFactorLbl.Name = "gridScaleFactorLbl";
gridScaleFactorLbl.Size = new System.Drawing.Size(124, 15);
gridScaleFactorLbl.TabIndex = 8;
gridScaleFactorLbl.Text = "[GridScaleFactor desc]";
//
// gridScaleFactorTbar
//
gridScaleFactorTbar.AutoSize = false;
gridScaleFactorTbar.LargeChange = 25;
gridScaleFactorTbar.Location = new System.Drawing.Point(136, 36);
gridScaleFactorTbar.Maximum = 100;
gridScaleFactorTbar.Minimum = -100;
gridScaleFactorTbar.Name = "gridScaleFactorTbar";
gridScaleFactorTbar.Size = new System.Drawing.Size(160, 20);
gridScaleFactorTbar.TabIndex = 7;
gridScaleFactorTbar.TickFrequency = 25;
//
// gridFontScaleFactorLbl
//
gridFontScaleFactorLbl.AutoSize = true;
gridFontScaleFactorLbl.Location = new System.Drawing.Point(320, 36);
gridFontScaleFactorLbl.Name = "gridFontScaleFactorLbl";
gridFontScaleFactorLbl.Size = new System.Drawing.Size(124, 15);
gridFontScaleFactorLbl.TabIndex = 8;
gridFontScaleFactorLbl.Text = "[GridScaleFactor desc]";
//
// gridFontScaleFactorTbar
//
gridFontScaleFactorTbar.AutoSize = false;
gridFontScaleFactorTbar.LargeChange = 25;
gridFontScaleFactorTbar.Location = new System.Drawing.Point(450, 36);
gridFontScaleFactorTbar.Maximum = 100;
gridFontScaleFactorTbar.Minimum = -100;
gridFontScaleFactorTbar.Name = "gridFontScaleFactorTbar";
gridFontScaleFactorTbar.Size = new System.Drawing.Size(160, 20);
gridFontScaleFactorTbar.TabIndex = 7;
gridFontScaleFactorTbar.TickFrequency = 25;
// //
// booksGb // booksGb
// //
@ -500,7 +563,7 @@
tab2ImportLibrary.Controls.Add(downloadEpisodesCb); tab2ImportLibrary.Controls.Add(downloadEpisodesCb);
tab2ImportLibrary.Location = new System.Drawing.Point(4, 24); tab2ImportLibrary.Location = new System.Drawing.Point(4, 24);
tab2ImportLibrary.Name = "tab2ImportLibrary"; tab2ImportLibrary.Name = "tab2ImportLibrary";
tab2ImportLibrary.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); tab2ImportLibrary.Padding = new System.Windows.Forms.Padding(3);
tab2ImportLibrary.Size = new System.Drawing.Size(856, 453); tab2ImportLibrary.Size = new System.Drawing.Size(856, 453);
tab2ImportLibrary.TabIndex = 1; tab2ImportLibrary.TabIndex = 1;
tab2ImportLibrary.Text = "Import library"; tab2ImportLibrary.Text = "Import library";
@ -545,7 +608,7 @@
tab3DownloadDecrypt.Controls.Add(badBookGb); tab3DownloadDecrypt.Controls.Add(badBookGb);
tab3DownloadDecrypt.Location = new System.Drawing.Point(4, 24); tab3DownloadDecrypt.Location = new System.Drawing.Point(4, 24);
tab3DownloadDecrypt.Name = "tab3DownloadDecrypt"; tab3DownloadDecrypt.Name = "tab3DownloadDecrypt";
tab3DownloadDecrypt.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); tab3DownloadDecrypt.Padding = new System.Windows.Forms.Padding(3);
tab3DownloadDecrypt.Size = new System.Drawing.Size(856, 453); tab3DownloadDecrypt.Size = new System.Drawing.Size(856, 453);
tab3DownloadDecrypt.TabIndex = 2; tab3DownloadDecrypt.TabIndex = 2;
tab3DownloadDecrypt.Text = "Download/Decrypt"; tab3DownloadDecrypt.Text = "Download/Decrypt";
@ -718,7 +781,7 @@
tab4AudioFileOptions.Controls.Add(allowLibationFixupCbox); tab4AudioFileOptions.Controls.Add(allowLibationFixupCbox);
tab4AudioFileOptions.Location = new System.Drawing.Point(4, 24); tab4AudioFileOptions.Location = new System.Drawing.Point(4, 24);
tab4AudioFileOptions.Name = "tab4AudioFileOptions"; tab4AudioFileOptions.Name = "tab4AudioFileOptions";
tab4AudioFileOptions.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); tab4AudioFileOptions.Padding = new System.Windows.Forms.Padding(3);
tab4AudioFileOptions.Size = new System.Drawing.Size(856, 453); tab4AudioFileOptions.Size = new System.Drawing.Size(856, 453);
tab4AudioFileOptions.TabIndex = 3; tab4AudioFileOptions.TabIndex = 3;
tab4AudioFileOptions.Text = "Audio File Options"; tab4AudioFileOptions.Text = "Audio File Options";
@ -1273,6 +1336,10 @@
tabControl.ResumeLayout(false); tabControl.ResumeLayout(false);
tab1ImportantSettings.ResumeLayout(false); tab1ImportantSettings.ResumeLayout(false);
tab1ImportantSettings.PerformLayout(); tab1ImportantSettings.PerformLayout();
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)gridScaleFactorTbar).EndInit();
((System.ComponentModel.ISupportInitialize)gridFontScaleFactorTbar).EndInit();
booksGb.ResumeLayout(false); booksGb.ResumeLayout(false);
booksGb.PerformLayout(); booksGb.PerformLayout();
tab2ImportLibrary.ResumeLayout(false); tab2ImportLibrary.ResumeLayout(false);
@ -1385,7 +1452,6 @@
private System.Windows.Forms.Button editCharreplacementBtn; private System.Windows.Forms.Button editCharreplacementBtn;
private System.Windows.Forms.CheckBox mergeOpeningEndCreditsCbox; private System.Windows.Forms.CheckBox mergeOpeningEndCreditsCbox;
private System.Windows.Forms.GroupBox audiobookFixupsGb; private System.Windows.Forms.GroupBox audiobookFixupsGb;
private System.Windows.Forms.CheckBox betaOptInCbox;
private System.Windows.Forms.CheckBox useCoverAsFolderIconCb; private System.Windows.Forms.CheckBox useCoverAsFolderIconCb;
private System.Windows.Forms.ComboBox clipsBookmarksFormatCb; private System.Windows.Forms.ComboBox clipsBookmarksFormatCb;
private System.Windows.Forms.CheckBox downloadClipsBookmarksCbox; private System.Windows.Forms.CheckBox downloadClipsBookmarksCbox;
@ -1403,5 +1469,11 @@
private System.Windows.Forms.Label fileDownloadQualityLbl; private System.Windows.Forms.Label fileDownloadQualityLbl;
private System.Windows.Forms.CheckBox combineNestedChapterTitlesCbox; private System.Windows.Forms.CheckBox combineNestedChapterTitlesCbox;
private System.Windows.Forms.CheckBox saveMetadataToFileCbox; private System.Windows.Forms.CheckBox saveMetadataToFileCbox;
private System.Windows.Forms.TrackBar gridScaleFactorTbar;
private System.Windows.Forms.TrackBar gridFontScaleFactorTbar;
private System.Windows.Forms.Label gridScaleFactorLbl;
private System.Windows.Forms.Label gridFontScaleFactorLbl;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button applyDisplaySettingsBtn;
} }
} }

View File

@ -23,11 +23,12 @@ namespace LibationWinForms.Dialogs
} }
booksLocationDescLbl.Text = desc(nameof(config.Books)); booksLocationDescLbl.Text = desc(nameof(config.Books));
betaOptInCbox.Text = desc(nameof(config.BetaOptIn));
saveEpisodesToSeriesFolderCbox.Text = desc(nameof(config.SavePodcastsToParentFolder)); saveEpisodesToSeriesFolderCbox.Text = desc(nameof(config.SavePodcastsToParentFolder));
overwriteExistingCbox.Text = desc(nameof(config.OverwriteExisting)); overwriteExistingCbox.Text = desc(nameof(config.OverwriteExisting));
creationTimeLbl.Text = desc(nameof(config.CreationTime)); creationTimeLbl.Text = desc(nameof(config.CreationTime));
lastWriteTimeLbl.Text = desc(nameof(config.LastWriteTime)); lastWriteTimeLbl.Text = desc(nameof(config.LastWriteTime));
gridScaleFactorLbl.Text = desc(nameof(config.GridScaleFactor));
gridFontScaleFactorLbl.Text = desc(nameof(config.GridFontScaleFactor));
var dateTimeSources = Enum.GetValues<Configuration.DateTimeSource>().Select(v => new EnumDiaplay<Configuration.DateTimeSource>(v)).ToArray(); var dateTimeSources = Enum.GetValues<Configuration.DateTimeSource>().Select(v => new EnumDiaplay<Configuration.DateTimeSource>(v)).ToArray();
creationTimeCb.Items.AddRange(dateTimeSources); creationTimeCb.Items.AddRange(dateTimeSources);
@ -51,11 +52,8 @@ namespace LibationWinForms.Dialogs
saveEpisodesToSeriesFolderCbox.Checked = config.SavePodcastsToParentFolder; saveEpisodesToSeriesFolderCbox.Checked = config.SavePodcastsToParentFolder;
overwriteExistingCbox.Checked = config.OverwriteExisting; overwriteExistingCbox.Checked = config.OverwriteExisting;
gridScaleFactorTbar.Value = scaleFactorToLinearRange(config.GridScaleFactor);
betaOptInCbox.Checked = config.BetaOptIn; gridFontScaleFactorTbar.Value = scaleFactorToLinearRange(config.GridFontScaleFactor);
if (!betaOptInCbox.Checked)
betaOptInCbox.CheckedChanged += betaOptInCbox_CheckedChanged;
} }
private void Save_Important(Configuration config) private void Save_Important(Configuration config)
@ -92,39 +90,20 @@ namespace LibationWinForms.Dialogs
config.SavePodcastsToParentFolder = saveEpisodesToSeriesFolderCbox.Checked; config.SavePodcastsToParentFolder = saveEpisodesToSeriesFolderCbox.Checked;
config.OverwriteExisting = overwriteExistingCbox.Checked; config.OverwriteExisting = overwriteExistingCbox.Checked;
config.BetaOptIn = betaOptInCbox.Checked;
config.CreationTime = ((EnumDiaplay<Configuration.DateTimeSource>)creationTimeCb.SelectedItem).Value; config.CreationTime = ((EnumDiaplay<Configuration.DateTimeSource>)creationTimeCb.SelectedItem).Value;
config.LastWriteTime = ((EnumDiaplay<Configuration.DateTimeSource>)lastWriteTimeCb.SelectedItem).Value; config.LastWriteTime = ((EnumDiaplay<Configuration.DateTimeSource>)lastWriteTimeCb.SelectedItem).Value;
} }
private static int scaleFactorToLinearRange(float scaleFactor)
=> (int)float.Round(100 * MathF.Log2(scaleFactor));
private static float linearRangeToScaleFactor(int value)
=> MathF.Pow(2, value / 100f);
private void betaOptInCbox_CheckedChanged(object sender, EventArgs e) private void applyDisplaySettingsBtn_Click(object sender, EventArgs e)
{ {
if (!betaOptInCbox.Checked) config.GridFontScaleFactor = linearRangeToScaleFactor(gridFontScaleFactorTbar.Value);
return; config.GridScaleFactor = linearRangeToScaleFactor(gridScaleFactorTbar.Value);
var result = MessageBox.Show(this, @"
You've chosen to opt-in to Libation's beta releases. Thank you! We need all the testers we can get.
These features are works in progress and potentially very buggy. Libation may crash unexpectedly, and your library database may even be corruted. We suggest you back up your LibationContext.db file before proceding.
If bad/weird things happen, please report them at getlibation.com.
".Trim(), "A word of warning...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
if (result == DialogResult.Yes)
{
betaOptInCbox.CheckedChanged -= betaOptInCbox_CheckedChanged;
}
else
{
betaOptInCbox.Checked = false;
}
} }
} }
} }

View File

@ -31,7 +31,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.filterHelpBtn = new System.Windows.Forms.Button(); this.filterHelpBtn = new System.Windows.Forms.Button();
this.filterBtn = new System.Windows.Forms.Button(); this.filterBtn = new System.Windows.Forms.Button();
this.filterSearchTb = new System.Windows.Forms.TextBox(); this.filterSearchTb = new ClearableTextBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -129,6 +129,7 @@
this.filterSearchTb.Size = new System.Drawing.Size(681, 25); this.filterSearchTb.Size = new System.Drawing.Size(681, 25);
this.filterSearchTb.TabIndex = 1; this.filterSearchTb.TabIndex = 1;
this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress); this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress);
this.filterSearchTb.TextCleared += filterSearchTb_TextCleared;
// //
// menuStrip1 // menuStrip1
// //
@ -651,7 +652,7 @@
private System.Windows.Forms.ToolStripStatusLabel backupsCountsLbl; private System.Windows.Forms.ToolStripStatusLabel backupsCountsLbl;
private LibationWinForms.FormattableToolStripMenuItem beginBookBackupsToolStripMenuItem; private LibationWinForms.FormattableToolStripMenuItem beginBookBackupsToolStripMenuItem;
private LibationWinForms.FormattableToolStripMenuItem beginPdfBackupsToolStripMenuItem; private LibationWinForms.FormattableToolStripMenuItem beginPdfBackupsToolStripMenuItem;
public System.Windows.Forms.TextBox filterSearchTb; public ClearableTextBox filterSearchTb;
public System.Windows.Forms.Button filterBtn; public System.Windows.Forms.Button filterBtn;
public System.Windows.Forms.Button filterHelpBtn; public System.Windows.Forms.Button filterHelpBtn;
public System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; public System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;

View File

@ -10,6 +10,10 @@ namespace LibationWinForms
private void filterHelpBtn_Click(object sender, EventArgs e) => new SearchSyntaxDialog().ShowDialog(); private void filterHelpBtn_Click(object sender, EventArgs e) => new SearchSyntaxDialog().ShowDialog();
private void filterSearchTb_TextCleared(object sender, EventArgs e)
{
performFilter(string.Empty);
}
private void filterSearchTb_KeyPress(object sender, KeyPressEventArgs e) private void filterSearchTb_KeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == (char)Keys.Return) if (e.KeyChar == (char)Keys.Return)

View File

@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LibationWinForms.GridView
{
internal class CoverGridViewColumn : DataGridViewImageColumn
{
public CoverGridViewColumn()
{
CellTemplate = new CoverGridViewCell();
}
}
public class CoverGridViewCell : DataGridViewImageCell
{
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, null, null, null, cellStyle, advancedBorderStyle, paintParts);
if (value is Image image)
{
var w = graphics.ScaleX(image.Width);
var h = graphics.ScaleY(image.Height);
var x = cellBounds.Left + (cellBounds.Width - w) / 2;
var y = cellBounds.Top + (cellBounds.Height - h) / 2;
graphics.DrawImage(image, new Rectangle(x, y, w, h));
}
}
}
}

View File

@ -7,8 +7,10 @@ namespace LibationWinForms.GridView
{ {
protected void DrawButtonImage(Graphics graphics, Image image, Rectangle cellBounds) protected void DrawButtonImage(Graphics graphics, Image image, Rectangle cellBounds)
{ {
var w = graphics.ScaleX(image.Width); var scaleFactor = OwningColumn is IDataGridScaleColumn scCol ? scCol.ScaleFactor : 1f;
var h = graphics.ScaleY(image.Height);
var w = (int)float.Round(graphics.ScaleX(image.Width) * scaleFactor);
var h = (int)float.Round(graphics.ScaleY(image.Height) * scaleFactor);
var x = cellBounds.Left + (cellBounds.Width - w) / 2; var x = cellBounds.Left + (cellBounds.Width - w) / 2;
var y = cellBounds.Top + (cellBounds.Height - h) / 2; var y = cellBounds.Top + (cellBounds.Height - h) / 2;

View File

@ -5,12 +5,18 @@ using LibationUiBase.GridView;
namespace LibationWinForms.GridView namespace LibationWinForms.GridView
{ {
public class EditTagsDataGridViewImageButtonColumn : DataGridViewButtonColumn public interface IDataGridScaleColumn
{
float ScaleFactor { get; set; }
}
public class EditTagsDataGridViewImageButtonColumn : DataGridViewButtonColumn, IDataGridScaleColumn
{ {
public EditTagsDataGridViewImageButtonColumn() public EditTagsDataGridViewImageButtonColumn()
{ {
CellTemplate = new EditTagsDataGridViewImageButtonCell(); CellTemplate = new EditTagsDataGridViewImageButtonCell();
} }
public float ScaleFactor { get; set; }
} }
internal class EditTagsDataGridViewImageButtonCell : DataGridViewImageButtonCell internal class EditTagsDataGridViewImageButtonCell : DataGridViewImageButtonCell

View File

@ -4,12 +4,14 @@ using System.Windows.Forms;
namespace LibationWinForms.GridView namespace LibationWinForms.GridView
{ {
public class LiberateDataGridViewImageButtonColumn : DataGridViewButtonColumn public class LiberateDataGridViewImageButtonColumn : DataGridViewButtonColumn, IDataGridScaleColumn
{ {
public LiberateDataGridViewImageButtonColumn() public LiberateDataGridViewImageButtonColumn()
{ {
CellTemplate = new LiberateDataGridViewImageButtonCell(); CellTemplate = new LiberateDataGridViewImageButtonCell();
} }
public float ScaleFactor { get; set; }
} }
internal class LiberateDataGridViewImageButtonCell : DataGridViewImageButtonCell internal class LiberateDataGridViewImageButtonCell : DataGridViewImageButtonCell

View File

@ -69,7 +69,6 @@
// //
this.lblPerform.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblPerform.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblPerform.AutoSize = true; this.lblPerform.AutoSize = true;
this.lblPerform.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.lblPerform.Location = new System.Drawing.Point(0, 16); this.lblPerform.Location = new System.Drawing.Point(0, 16);
this.lblPerform.Margin = new System.Windows.Forms.Padding(0); this.lblPerform.Margin = new System.Windows.Forms.Padding(0);
this.lblPerform.Name = "lblPerform"; this.lblPerform.Name = "lblPerform";
@ -103,7 +102,6 @@
// //
// noBorderLabel1 // noBorderLabel1
// //
this.noBorderLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel1.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel1.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel1.Location = new System.Drawing.Point(0, 0); this.noBorderLabel1.Location = new System.Drawing.Point(0, 0);
this.noBorderLabel1.Name = "noBorderLabel1"; this.noBorderLabel1.Name = "noBorderLabel1";
@ -116,7 +114,6 @@
// //
// noBorderLabel2 // noBorderLabel2
// //
this.noBorderLabel2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel2.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel2.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel2.Location = new System.Drawing.Point(10, 0); this.noBorderLabel2.Location = new System.Drawing.Point(10, 0);
this.noBorderLabel2.Name = "noBorderLabel2"; this.noBorderLabel2.Name = "noBorderLabel2";
@ -129,7 +126,6 @@
// //
// noBorderLabel3 // noBorderLabel3
// //
this.noBorderLabel3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel3.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel3.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel3.Location = new System.Drawing.Point(20, 0); this.noBorderLabel3.Location = new System.Drawing.Point(20, 0);
this.noBorderLabel3.Name = "noBorderLabel3"; this.noBorderLabel3.Name = "noBorderLabel3";
@ -142,7 +138,6 @@
// //
// noBorderLabel4 // noBorderLabel4
// //
this.noBorderLabel4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel4.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel4.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel4.Location = new System.Drawing.Point(30, 0); this.noBorderLabel4.Location = new System.Drawing.Point(30, 0);
this.noBorderLabel4.Name = "noBorderLabel4"; this.noBorderLabel4.Name = "noBorderLabel4";
@ -155,7 +150,6 @@
// //
// noBorderLabel5 // noBorderLabel5
// //
this.noBorderLabel5.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel5.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel5.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel5.Location = new System.Drawing.Point(40, 0); this.noBorderLabel5.Location = new System.Drawing.Point(40, 0);
this.noBorderLabel5.Name = "noBorderLabel5"; this.noBorderLabel5.Name = "noBorderLabel5";
@ -181,7 +175,6 @@
// //
// noBorderLabel6 // noBorderLabel6
// //
this.noBorderLabel6.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel6.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel6.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel6.Location = new System.Drawing.Point(0, 0); this.noBorderLabel6.Location = new System.Drawing.Point(0, 0);
this.noBorderLabel6.Name = "noBorderLabel6"; this.noBorderLabel6.Name = "noBorderLabel6";
@ -194,7 +187,6 @@
// //
// noBorderLabel7 // noBorderLabel7
// //
this.noBorderLabel7.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel7.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel7.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel7.Location = new System.Drawing.Point(10, 0); this.noBorderLabel7.Location = new System.Drawing.Point(10, 0);
this.noBorderLabel7.Name = "noBorderLabel7"; this.noBorderLabel7.Name = "noBorderLabel7";
@ -207,7 +199,6 @@
// //
// noBorderLabel8 // noBorderLabel8
// //
this.noBorderLabel8.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel8.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel8.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel8.Location = new System.Drawing.Point(20, 0); this.noBorderLabel8.Location = new System.Drawing.Point(20, 0);
this.noBorderLabel8.Name = "noBorderLabel8"; this.noBorderLabel8.Name = "noBorderLabel8";
@ -220,7 +211,6 @@
// //
// noBorderLabel9 // noBorderLabel9
// //
this.noBorderLabel9.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel9.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel9.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel9.Location = new System.Drawing.Point(30, 0); this.noBorderLabel9.Location = new System.Drawing.Point(30, 0);
this.noBorderLabel9.Name = "noBorderLabel9"; this.noBorderLabel9.Name = "noBorderLabel9";
@ -233,7 +223,6 @@
// //
// noBorderLabel10 // noBorderLabel10
// //
this.noBorderLabel10.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel10.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel10.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel10.Location = new System.Drawing.Point(40, 0); this.noBorderLabel10.Location = new System.Drawing.Point(40, 0);
this.noBorderLabel10.Name = "noBorderLabel10"; this.noBorderLabel10.Name = "noBorderLabel10";
@ -259,7 +248,6 @@
// //
// noBorderLabel11 // noBorderLabel11
// //
this.noBorderLabel11.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel11.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel11.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel11.Location = new System.Drawing.Point(0, 0); this.noBorderLabel11.Location = new System.Drawing.Point(0, 0);
this.noBorderLabel11.Name = "noBorderLabel11"; this.noBorderLabel11.Name = "noBorderLabel11";
@ -272,7 +260,6 @@
// //
// noBorderLabel12 // noBorderLabel12
// //
this.noBorderLabel12.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel12.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel12.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel12.Location = new System.Drawing.Point(10, 0); this.noBorderLabel12.Location = new System.Drawing.Point(10, 0);
this.noBorderLabel12.Name = "noBorderLabel12"; this.noBorderLabel12.Name = "noBorderLabel12";
@ -285,7 +272,6 @@
// //
// noBorderLabel13 // noBorderLabel13
// //
this.noBorderLabel13.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel13.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel13.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel13.Location = new System.Drawing.Point(20, 0); this.noBorderLabel13.Location = new System.Drawing.Point(20, 0);
this.noBorderLabel13.Name = "noBorderLabel13"; this.noBorderLabel13.Name = "noBorderLabel13";
@ -298,7 +284,6 @@
// //
// noBorderLabel14 // noBorderLabel14
// //
this.noBorderLabel14.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel14.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel14.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel14.Location = new System.Drawing.Point(30, 0); this.noBorderLabel14.Location = new System.Drawing.Point(30, 0);
this.noBorderLabel14.Name = "noBorderLabel14"; this.noBorderLabel14.Name = "noBorderLabel14";
@ -311,7 +296,6 @@
// //
// noBorderLabel15 // noBorderLabel15
// //
this.noBorderLabel15.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.noBorderLabel15.LabelOffset = new System.Drawing.Point(-3, -3); this.noBorderLabel15.LabelOffset = new System.Drawing.Point(-3, -3);
this.noBorderLabel15.Location = new System.Drawing.Point(40, 0); this.noBorderLabel15.Location = new System.Drawing.Point(40, 0);
this.noBorderLabel15.Name = "noBorderLabel15"; this.noBorderLabel15.Name = "noBorderLabel15";

View File

@ -37,6 +37,13 @@ namespace LibationWinForms.GridView
public MyRatingCellEditor() public MyRatingCellEditor()
{ {
InitializeComponent(); InitializeComponent();
this.FontChanged += MyRatingCellEditor_FontChanged;
}
private void MyRatingCellEditor_FontChanged(object sender, EventArgs e)
{
var scale = Font.Size / 9;
Scale(new SizeF(scale, scale));
} }
private void Star_MouseEnter(object sender, EventArgs e) private void Star_MouseEnter(object sender, EventArgs e)

View File

@ -30,254 +30,260 @@ namespace LibationWinForms.GridView
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.gridEntryDataGridView = new System.Windows.Forms.DataGridView(); gridEntryDataGridView = new System.Windows.Forms.DataGridView();
this.removeGVColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); removeGVColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.liberateGVColumn = new LibationWinForms.GridView.LiberateDataGridViewImageButtonColumn(); liberateGVColumn = new LiberateDataGridViewImageButtonColumn();
this.coverGVColumn = new CoverGridViewColumn(); coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn();
this.titleGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); titleGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.authorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); authorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.narratorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); narratorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lengthGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); lengthGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.seriesGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); seriesGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.seriesOrderGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); seriesOrderGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.descriptionGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); descriptionGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.categoryGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); categoryGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.productRatingGVColumn = new LibationWinForms.GridView.MyRatingGridViewColumn(); productRatingGVColumn = new MyRatingGridViewColumn();
this.purchaseDateGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); purchaseDateGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.myRatingGVColumn = new LibationWinForms.GridView.MyRatingGridViewColumn(); myRatingGVColumn = new MyRatingGridViewColumn();
this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lastDownloadedGVColumn = new LastDownloadedGridViewColumn(); lastDownloadedGVColumn = new LastDownloadedGridViewColumn();
this.tagAndDetailsGVColumn = new LibationWinForms.GridView.EditTagsDataGridViewImageButtonColumn(); tagAndDetailsGVColumn = new EditTagsDataGridViewImageButtonColumn();
this.showHideColumnsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); showHideColumnsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components);
this.syncBindingSource = new LibationWinForms.GridView.SyncBindingSource(this.components); syncBindingSource = new SyncBindingSource(components);
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)gridEntryDataGridView).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.syncBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)syncBindingSource).BeginInit();
this.SuspendLayout(); SuspendLayout();
// //
// gridEntryDataGridView // gridEntryDataGridView
// //
this.gridEntryDataGridView.AllowUserToAddRows = false; gridEntryDataGridView.AllowUserToAddRows = false;
this.gridEntryDataGridView.AllowUserToDeleteRows = false; gridEntryDataGridView.AllowUserToDeleteRows = false;
this.gridEntryDataGridView.AllowUserToOrderColumns = true; gridEntryDataGridView.AllowUserToOrderColumns = true;
this.gridEntryDataGridView.AllowUserToResizeRows = false; gridEntryDataGridView.AllowUserToResizeRows = false;
this.gridEntryDataGridView.AutoGenerateColumns = false; gridEntryDataGridView.AutoGenerateColumns = false;
this.gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { removeGVColumn, liberateGVColumn, coverGVColumn, titleGVColumn, authorsGVColumn, narratorsGVColumn, lengthGVColumn, seriesGVColumn, seriesOrderGVColumn, descriptionGVColumn, categoryGVColumn, productRatingGVColumn, purchaseDateGVColumn, myRatingGVColumn, miscGVColumn, lastDownloadedGVColumn, tagAndDetailsGVColumn });
this.removeGVColumn, gridEntryDataGridView.ContextMenuStrip = showHideColumnsContextMenuStrip;
this.liberateGVColumn, gridEntryDataGridView.DataSource = syncBindingSource;
this.coverGVColumn, dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
this.titleGVColumn, dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
this.authorsGVColumn, dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.narratorsGVColumn, dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
this.lengthGVColumn, dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
this.seriesGVColumn, dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.seriesOrderGVColumn, dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.descriptionGVColumn, gridEntryDataGridView.DefaultCellStyle = dataGridViewCellStyle2;
this.categoryGVColumn, gridEntryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.productRatingGVColumn, gridEntryDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
this.purchaseDateGVColumn, gridEntryDataGridView.Location = new System.Drawing.Point(0, 0);
this.myRatingGVColumn, gridEntryDataGridView.Margin = new System.Windows.Forms.Padding(6);
this.miscGVColumn, gridEntryDataGridView.Name = "gridEntryDataGridView";
this.lastDownloadedGVColumn, gridEntryDataGridView.RowHeadersVisible = false;
this.tagAndDetailsGVColumn}); gridEntryDataGridView.RowHeadersWidth = 82;
this.gridEntryDataGridView.ContextMenuStrip = this.showHideColumnsContextMenuStrip; gridEntryDataGridView.RowTemplate.Height = 82;
this.gridEntryDataGridView.DataSource = this.syncBindingSource; gridEntryDataGridView.Size = new System.Drawing.Size(3140, 760);
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; gridEntryDataGridView.TabIndex = 0;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; gridEntryDataGridView.CellContentClick += DataGridView_CellContentClick;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); gridEntryDataGridView.CellToolTipTextNeeded += gridEntryDataGridView_CellToolTipTextNeeded;
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.gridEntryDataGridView.DefaultCellStyle = dataGridViewCellStyle1;
this.gridEntryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridEntryDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
this.gridEntryDataGridView.Location = new System.Drawing.Point(0, 0);
this.gridEntryDataGridView.Name = "gridEntryDataGridView";
this.gridEntryDataGridView.RowHeadersVisible = false;
this.gridEntryDataGridView.RowTemplate.Height = 82;
this.gridEntryDataGridView.Size = new System.Drawing.Size(1570, 380);
this.gridEntryDataGridView.TabIndex = 0;
this.gridEntryDataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellContentClick);
this.gridEntryDataGridView.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this.gridEntryDataGridView_CellToolTipTextNeeded);
// //
// removeGVColumn // removeGVColumn
// //
this.removeGVColumn.DataPropertyName = "Remove"; removeGVColumn.DataPropertyName = "Remove";
this.removeGVColumn.FalseValue = ""; removeGVColumn.FalseValue = "";
this.removeGVColumn.Frozen = true; removeGVColumn.Frozen = true;
this.removeGVColumn.HeaderText = "Remove"; removeGVColumn.HeaderText = "Remove";
this.removeGVColumn.IndeterminateValue = ""; removeGVColumn.IndeterminateValue = "";
this.removeGVColumn.MinimumWidth = 60; removeGVColumn.MinimumWidth = 60;
this.removeGVColumn.Name = "removeGVColumn"; removeGVColumn.Name = "removeGVColumn";
this.removeGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; removeGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.removeGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; removeGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.removeGVColumn.ThreeState = true; removeGVColumn.ThreeState = true;
this.removeGVColumn.TrueValue = ""; removeGVColumn.TrueValue = "";
this.removeGVColumn.Width = 60; removeGVColumn.Width = 60;
// //
// liberateGVColumn // liberateGVColumn
// //
this.liberateGVColumn.DataPropertyName = "Liberate"; liberateGVColumn.DataPropertyName = "Liberate";
this.liberateGVColumn.HeaderText = "Liberate"; liberateGVColumn.HeaderText = "Liberate";
this.liberateGVColumn.Name = "liberateGVColumn"; liberateGVColumn.MinimumWidth = 10;
this.liberateGVColumn.ReadOnly = true; liberateGVColumn.Name = "liberateGVColumn";
this.liberateGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; liberateGVColumn.ReadOnly = true;
this.liberateGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; liberateGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.liberateGVColumn.Width = 75; liberateGVColumn.ScaleFactor = 0F;
liberateGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
liberateGVColumn.Width = 75;
// //
// coverGVColumn // coverGVColumn
// //
this.coverGVColumn.DataPropertyName = "Cover"; coverGVColumn.DataPropertyName = "Cover";
this.coverGVColumn.HeaderText = "Cover"; coverGVColumn.HeaderText = "Cover";
this.coverGVColumn.Name = "coverGVColumn"; coverGVColumn.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.coverGVColumn.ReadOnly = true; coverGVColumn.MinimumWidth = 10;
this.coverGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; coverGVColumn.Name = "coverGVColumn";
this.coverGVColumn.ToolTipText = "Cover Art"; coverGVColumn.ReadOnly = true;
this.coverGVColumn.Width = 80; coverGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
coverGVColumn.ToolTipText = "Cover Art";
coverGVColumn.Width = 80;
// //
// titleGVColumn // titleGVColumn
// //
this.titleGVColumn.DataPropertyName = "Title"; titleGVColumn.DataPropertyName = "Title";
this.titleGVColumn.HeaderText = "Title"; titleGVColumn.HeaderText = "Title";
this.titleGVColumn.Name = "titleGVColumn"; titleGVColumn.MinimumWidth = 10;
this.titleGVColumn.ReadOnly = true; titleGVColumn.Name = "titleGVColumn";
this.titleGVColumn.Width = 200; titleGVColumn.ReadOnly = true;
titleGVColumn.Width = 200;
// //
// authorsGVColumn // authorsGVColumn
// //
this.authorsGVColumn.DataPropertyName = "Authors"; authorsGVColumn.DataPropertyName = "Authors";
this.authorsGVColumn.HeaderText = "Authors"; authorsGVColumn.HeaderText = "Authors";
this.authorsGVColumn.Name = "authorsGVColumn"; authorsGVColumn.MinimumWidth = 10;
this.authorsGVColumn.ReadOnly = true; authorsGVColumn.Name = "authorsGVColumn";
this.authorsGVColumn.Width = 100; authorsGVColumn.ReadOnly = true;
authorsGVColumn.Width = 100;
// //
// narratorsGVColumn // narratorsGVColumn
// //
this.narratorsGVColumn.DataPropertyName = "Narrators"; narratorsGVColumn.DataPropertyName = "Narrators";
this.narratorsGVColumn.HeaderText = "Narrators"; narratorsGVColumn.HeaderText = "Narrators";
this.narratorsGVColumn.Name = "narratorsGVColumn"; narratorsGVColumn.MinimumWidth = 10;
this.narratorsGVColumn.ReadOnly = true; narratorsGVColumn.Name = "narratorsGVColumn";
this.narratorsGVColumn.Width = 100; narratorsGVColumn.ReadOnly = true;
narratorsGVColumn.Width = 100;
// //
// lengthGVColumn // lengthGVColumn
// //
this.lengthGVColumn.DataPropertyName = "Length"; lengthGVColumn.DataPropertyName = "Length";
this.lengthGVColumn.HeaderText = "Length"; lengthGVColumn.HeaderText = "Length";
this.lengthGVColumn.Name = "lengthGVColumn"; lengthGVColumn.MinimumWidth = 10;
this.lengthGVColumn.ReadOnly = true; lengthGVColumn.Name = "lengthGVColumn";
this.lengthGVColumn.Width = 100; lengthGVColumn.ReadOnly = true;
this.lengthGVColumn.ToolTipText = "Recording Length"; lengthGVColumn.ToolTipText = "Recording Length";
lengthGVColumn.Width = 100;
// //
// seriesGVColumn // seriesGVColumn
// //
this.seriesGVColumn.DataPropertyName = "Series"; seriesGVColumn.DataPropertyName = "Series";
this.seriesGVColumn.HeaderText = "Series"; seriesGVColumn.HeaderText = "Series";
this.seriesGVColumn.Name = "seriesGVColumn"; seriesGVColumn.MinimumWidth = 10;
this.seriesGVColumn.ReadOnly = true; seriesGVColumn.Name = "seriesGVColumn";
this.seriesGVColumn.Width = 100; seriesGVColumn.ReadOnly = true;
seriesGVColumn.Width = 100;
// //
// seriesOrderGVColumn // seriesOrderGVColumn
// //
this.seriesOrderGVColumn.DataPropertyName = "SeriesOrder"; seriesOrderGVColumn.DataPropertyName = "SeriesOrder";
this.seriesOrderGVColumn.HeaderText = "Series\r\nOrder"; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.seriesOrderGVColumn.Name = "seriesOrderGVColumn"; seriesOrderGVColumn.DefaultCellStyle = dataGridViewCellStyle1;
this.seriesOrderGVColumn.Width = 60; seriesOrderGVColumn.HeaderText = "Series\r\nOrder";
this.seriesOrderGVColumn.ReadOnly = true; seriesOrderGVColumn.MinimumWidth = 10;
this.seriesOrderGVColumn.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; seriesOrderGVColumn.Name = "seriesOrderGVColumn";
seriesOrderGVColumn.ReadOnly = true;
seriesOrderGVColumn.Width = 60;
// //
// descriptionGVColumn // descriptionGVColumn
// //
this.descriptionGVColumn.DataPropertyName = "Description"; descriptionGVColumn.DataPropertyName = "Description";
this.descriptionGVColumn.HeaderText = "Description"; descriptionGVColumn.HeaderText = "Description";
this.descriptionGVColumn.Name = "descriptionGVColumn"; descriptionGVColumn.MinimumWidth = 10;
this.descriptionGVColumn.ReadOnly = true; descriptionGVColumn.Name = "descriptionGVColumn";
this.descriptionGVColumn.Width = 100; descriptionGVColumn.ReadOnly = true;
this.descriptionGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; descriptionGVColumn.Width = 100;
// //
// categoryGVColumn // categoryGVColumn
// //
this.categoryGVColumn.DataPropertyName = "Category"; categoryGVColumn.DataPropertyName = "Category";
this.categoryGVColumn.HeaderText = "Category"; categoryGVColumn.HeaderText = "Category";
this.categoryGVColumn.Name = "categoryGVColumn"; categoryGVColumn.MinimumWidth = 10;
this.categoryGVColumn.ReadOnly = true; categoryGVColumn.Name = "categoryGVColumn";
this.categoryGVColumn.Width = 100; categoryGVColumn.ReadOnly = true;
categoryGVColumn.Width = 100;
// //
// productRatingGVColumn // productRatingGVColumn
// //
this.productRatingGVColumn.DataPropertyName = "ProductRating"; productRatingGVColumn.DataPropertyName = "ProductRating";
this.productRatingGVColumn.HeaderText = "Product Rating"; productRatingGVColumn.HeaderText = "Product Rating";
this.productRatingGVColumn.Name = "productRatingGVColumn"; productRatingGVColumn.MinimumWidth = 10;
this.productRatingGVColumn.ReadOnly = true; productRatingGVColumn.Name = "productRatingGVColumn";
this.productRatingGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; productRatingGVColumn.ReadOnly = true;
this.productRatingGVColumn.Width = 112; productRatingGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
productRatingGVColumn.Width = 112;
// //
// purchaseDateGVColumn // purchaseDateGVColumn
// //
this.purchaseDateGVColumn.DataPropertyName = "PurchaseDate"; purchaseDateGVColumn.DataPropertyName = "PurchaseDate";
this.purchaseDateGVColumn.HeaderText = "Purchase Date"; purchaseDateGVColumn.HeaderText = "Purchase Date";
this.purchaseDateGVColumn.Name = "purchaseDateGVColumn"; purchaseDateGVColumn.MinimumWidth = 10;
this.purchaseDateGVColumn.ReadOnly = true; purchaseDateGVColumn.Name = "purchaseDateGVColumn";
this.purchaseDateGVColumn.Width = 100; purchaseDateGVColumn.ReadOnly = true;
purchaseDateGVColumn.Width = 100;
// //
// myRatingGVColumn // myRatingGVColumn
// //
this.myRatingGVColumn.DataPropertyName = "MyRating"; myRatingGVColumn.DataPropertyName = "MyRating";
this.myRatingGVColumn.HeaderText = "My Rating"; myRatingGVColumn.HeaderText = "My Rating";
this.myRatingGVColumn.Name = "myRatingGVColumn"; myRatingGVColumn.MinimumWidth = 10;
this.myRatingGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; myRatingGVColumn.Name = "myRatingGVColumn";
this.myRatingGVColumn.Width = 112; myRatingGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
myRatingGVColumn.Width = 112;
// //
// miscGVColumn // miscGVColumn
// //
this.miscGVColumn.DataPropertyName = "Misc"; miscGVColumn.DataPropertyName = "Misc";
this.miscGVColumn.HeaderText = "Misc"; miscGVColumn.HeaderText = "Misc";
this.miscGVColumn.Name = "miscGVColumn"; miscGVColumn.MinimumWidth = 10;
this.miscGVColumn.ReadOnly = true; miscGVColumn.Name = "miscGVColumn";
this.miscGVColumn.Width = 140; miscGVColumn.ReadOnly = true;
miscGVColumn.Width = 140;
// //
// lastDownloadedGVColumn // lastDownloadedGVColumn
// //
this.lastDownloadedGVColumn.DataPropertyName = "LastDownload"; lastDownloadedGVColumn.DataPropertyName = "LastDownload";
this.lastDownloadedGVColumn.HeaderText = "Last Download"; lastDownloadedGVColumn.HeaderText = "Last Download";
this.lastDownloadedGVColumn.Name = "lastDownloadedGVColumn"; lastDownloadedGVColumn.MinimumWidth = 10;
this.lastDownloadedGVColumn.ReadOnly = true; lastDownloadedGVColumn.Name = "lastDownloadedGVColumn";
this.lastDownloadedGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; lastDownloadedGVColumn.ReadOnly = true;
this.lastDownloadedGVColumn.Width = 108; lastDownloadedGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
lastDownloadedGVColumn.Width = 108;
// //
// tagAndDetailsGVColumn // tagAndDetailsGVColumn
// //
this.tagAndDetailsGVColumn.DataPropertyName = "BookTags"; tagAndDetailsGVColumn.DataPropertyName = "BookTags";
this.tagAndDetailsGVColumn.HeaderText = "Tags and Details"; tagAndDetailsGVColumn.HeaderText = "Tags and Details";
this.tagAndDetailsGVColumn.Name = "tagAndDetailsGVColumn"; tagAndDetailsGVColumn.MinimumWidth = 10;
this.tagAndDetailsGVColumn.ReadOnly = true; tagAndDetailsGVColumn.Name = "tagAndDetailsGVColumn";
this.tagAndDetailsGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; tagAndDetailsGVColumn.ReadOnly = true;
this.tagAndDetailsGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; tagAndDetailsGVColumn.ScaleFactor = 0F;
this.tagAndDetailsGVColumn.Width = 100; tagAndDetailsGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
tagAndDetailsGVColumn.Width = 100;
// //
// showHideColumnsContextMenuStrip // showHideColumnsContextMenuStrip
// //
this.showHideColumnsContextMenuStrip.Name = "contextMenuStrip1"; showHideColumnsContextMenuStrip.ImageScalingSize = new System.Drawing.Size(32, 32);
this.showHideColumnsContextMenuStrip.Size = new System.Drawing.Size(61, 4); showHideColumnsContextMenuStrip.Name = "contextMenuStrip1";
showHideColumnsContextMenuStrip.ShowCheckMargin = true;
showHideColumnsContextMenuStrip.Size = new System.Drawing.Size(83, 4);
// //
// syncBindingSource // syncBindingSource
// //
this.syncBindingSource.DataSource = typeof(IGridEntry); syncBindingSource.DataSource = typeof(IGridEntry);
// //
// ProductsGrid // ProductsGrid
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoScroll = true; AutoScroll = true;
this.Controls.Add(this.gridEntryDataGridView); Controls.Add(gridEntryDataGridView);
this.Name = "ProductsGrid"; Name = "ProductsGrid";
this.Size = new System.Drawing.Size(1570, 380); Size = new System.Drawing.Size(1570, 380);
this.Load += new System.EventHandler(this.ProductsGrid_Load); Load += new System.EventHandler(ProductsGrid_Load);
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(gridEntryDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.syncBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(syncBindingSource)).EndInit();
this.ResumeLayout(false); ResumeLayout(false);
} }
@ -288,7 +294,7 @@ namespace LibationWinForms.GridView
private SyncBindingSource syncBindingSource; private SyncBindingSource syncBindingSource;
private System.Windows.Forms.DataGridViewCheckBoxColumn removeGVColumn; private System.Windows.Forms.DataGridViewCheckBoxColumn removeGVColumn;
private LiberateDataGridViewImageButtonColumn liberateGVColumn; private LiberateDataGridViewImageButtonColumn liberateGVColumn;
private CoverGridViewColumn coverGVColumn; private System.Windows.Forms.DataGridViewImageColumn coverGVColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn titleGVColumn; private System.Windows.Forms.DataGridViewTextBoxColumn titleGVColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn authorsGVColumn; private System.Windows.Forms.DataGridViewTextBoxColumn authorsGVColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn narratorsGVColumn; private System.Windows.Forms.DataGridViewTextBoxColumn narratorsGVColumn;

View File

@ -1,14 +1,14 @@
using DataLayer; using DataLayer;
using Dinah.Core;
using Dinah.Core.WindowsDesktop.Forms; using Dinah.Core.WindowsDesktop.Forms;
using LibationFileManager; using LibationFileManager;
using LibationUiBase.GridView; using LibationUiBase.GridView;
using NPOI.SS.Formula.Functions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -47,9 +47,65 @@ namespace LibationWinForms.GridView
gridEntryDataGridView.CellContextMenuStripNeeded += GridEntryDataGridView_CellContextMenuStripNeeded; gridEntryDataGridView.CellContextMenuStripNeeded += GridEntryDataGridView_CellContextMenuStripNeeded;
removeGVColumn.Frozen = false; removeGVColumn.Frozen = false;
gridEntryDataGridView.RowTemplate.Height = this.DpiScale(gridEntryDataGridView.RowTemplate.Height); defaultFont = gridEntryDataGridView.DefaultCellStyle.Font;
setGridFontScale(Configuration.Instance.GridFontScaleFactor);
setGridScale(Configuration.Instance.GridScaleFactor);
Configuration.Instance.PropertyChanged += Configuration_ScaleChanged;
Configuration.Instance.PropertyChanged += Configuration_FontScaleChanged;
gridEntryDataGridView.Disposed += (_, _) =>
{
Configuration.Instance.PropertyChanged -= Configuration_ScaleChanged;
Configuration.Instance.PropertyChanged -= Configuration_FontScaleChanged;
};
} }
#region Scaling
[PropertyChangeFilter(nameof(Configuration.GridFontScaleFactor))]
private void Configuration_FontScaleChanged(object sender, PropertyChangedEventArgsEx e)
=> setGridFontScale((float)e.NewValue);
[PropertyChangeFilter(nameof(Configuration.GridScaleFactor))]
private void Configuration_ScaleChanged(object sender, PropertyChangedEventArgsEx e)
=> setGridScale((float)e.NewValue);
/// <summary>
/// Keep track of the original dimensions for rescaling
/// </summary>
private static readonly Dictionary<DataGridViewElement, int> originalDims = new();
private readonly Font defaultFont;
private void setGridScale(float scale)
{
foreach (var col in gridEntryDataGridView.Columns.Cast<DataGridViewColumn>())
{
//Only resize fixed-width columns. The rest can be adjusted by users.
if (col.Resizable is DataGridViewTriState.False)
{
if (!originalDims.ContainsKey(col))
originalDims[col] = col.Width;
col.Width = this.DpiScale(originalDims[col], scale);
}
if (col is IDataGridScaleColumn scCol)
scCol.ScaleFactor = scale;
}
if (!originalDims.ContainsKey(gridEntryDataGridView.RowTemplate))
originalDims[gridEntryDataGridView.RowTemplate] = gridEntryDataGridView.RowTemplate.Height;
var height = gridEntryDataGridView.RowTemplate.Height = this.DpiScale(originalDims[gridEntryDataGridView.RowTemplate], scale);
foreach (var row in gridEntryDataGridView.Rows.Cast<DataGridViewRow>())
row.Height = height;
}
private void setGridFontScale(float scale)
=> gridEntryDataGridView.DefaultCellStyle.Font = new Font(defaultFont.FontFamily, defaultFont.Size * scale);
#endregion
private void GridEntryDataGridView_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) private void GridEntryDataGridView_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e)
{ {
// header // header
@ -326,6 +382,8 @@ namespace LibationWinForms.GridView
public void Filter(string searchString) public void Filter(string searchString)
{ {
if (bindingList is null) return;
int visibleCount = bindingList.Count; int visibleCount = bindingList.Count;
if (string.IsNullOrEmpty(searchString)) if (string.IsNullOrEmpty(searchString))
@ -365,16 +423,19 @@ namespace LibationWinForms.GridView
var itemName = column.DataPropertyName; var itemName = column.DataPropertyName;
var visible = gridColumnsVisibilities.GetValueOrDefault(itemName, true); var visible = gridColumnsVisibilities.GetValueOrDefault(itemName, true);
var menuItem = new ToolStripMenuItem() var menuItem = new ToolStripMenuItem(column.HeaderText)
{ {
Text = column.HeaderText,
Checked = visible, Checked = visible,
Tag = itemName Tag = itemName
}; };
menuItem.Click += HideMenuItem_Click; menuItem.Click += HideMenuItem_Click;
showHideColumnsContextMenuStrip.Items.Add(menuItem); showHideColumnsContextMenuStrip.Items.Add(menuItem);
//Only set column widths for user resizable columns.
//Fixed column widths are set by setGridScale()
if (column.Resizable is not DataGridViewTriState.False)
column.Width = gridColumnsWidths.GetValueOrDefault(itemName, this.DpiScale(column.Width)); column.Width = gridColumnsWidths.GetValueOrDefault(itemName, this.DpiScale(column.Width));
column.MinimumWidth = 10; column.MinimumWidth = 10;
column.HeaderCell.ContextMenuStrip = showHideColumnsContextMenuStrip; column.HeaderCell.ContextMenuStrip = showHideColumnsContextMenuStrip;
column.Visible = visible; column.Visible = visible;

View File

@ -1,4 +1,64 @@
<root> <?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">

View File

@ -168,6 +168,17 @@ namespace LibationWinForms
// examples: // examples:
// - only supported in winforms. don't move to app scaffolding // - only supported in winforms. don't move to app scaffolding
// - long running. won't get a chance to finish in cli. don't move to app scaffolding // - long running. won't get a chance to finish in cli. don't move to app scaffolding
const string hasMigratedKey = "hasMigratedToHighDPI";
if (!config.GetNonString(defaultValue: false, hasMigratedKey))
{
config.RemoveProperty(nameof(config.GridColumnsWidths));
foreach (var form in typeof(Program).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Form))))
config.RemoveProperty(form.Name);
config.SetNonString(true, hasMigratedKey);
}
} }
private static void postLoggingGlobalExceptionHandling() private static void postLoggingGlobalExceptionHandling()

View File

@ -23,15 +23,15 @@ namespace LibationWinForms
} }
} }
public static int DpiScale(this Control control, int value) public static int DpiScale(this Control control, int value, float additionalScaleFactor = 1)
=> (int)(control.DeviceDpi / BaseDpi * value); => (int)float.Round(control.DeviceDpi / BaseDpi * value * additionalScaleFactor);
public static int DpiUnscale(this Control control, int value) public static int DpiUnscale(this Control control, int value)
=> (int)(BaseDpi / control.DeviceDpi * value); => (int)float.Round(BaseDpi / control.DeviceDpi * value);
public static int ScaleX(this Graphics control, int value) public static int ScaleX(this Graphics control, int value)
=> (int)(control.DpiX / BaseDpi * value); => (int)float.Round(control.DpiX / BaseDpi * value);
public static int ScaleY(this Graphics control, int value) public static int ScaleY(this Graphics control, int value)
=> (int)(control.DpiY / BaseDpi * value); => (int)float.Round(control.DpiY / BaseDpi * value);
} }
} }