redesigned About dialog box.

This commit is contained in:
morkt 2015-05-14 19:48:30 +04:00
parent 465b79ce5c
commit b14e666e42
8 changed files with 184 additions and 79 deletions

View File

@ -1,6 +1,6 @@
<!-- Game Resource browser <!-- Game Resource browser
Copyright (C) 2014 by morkt Copyright (C) 2014-2015 by morkt
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to of this software and associated documentation files (the "Software"), to
@ -28,7 +28,7 @@ IN THE SOFTWARE.
xmlns:s="clr-namespace:GARbro.GUI.Strings" xmlns:s="clr-namespace:GARbro.GUI.Strings"
xmlns:gr="clr-namespace:GameRes;assembly=GameRes" xmlns:gr="clr-namespace:GameRes;assembly=GameRes"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
Title="{x:Static s:guiStrings.TextAboutTitle}" Height="306" Width="500" ResizeMode="NoResize" Title="{x:Static s:guiStrings.TextAboutTitle}" Height="306" Width="550" ResizeMode="NoResize"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"> ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Window.Resources> <Window.Resources>
@ -39,58 +39,64 @@ IN THE SOFTWARE.
<scm:SortDescription PropertyName="Tag" Direction="Ascending"/> <scm:SortDescription PropertyName="Tag" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions> </CollectionViewSource.SortDescriptions>
</CollectionViewSource> </CollectionViewSource>
<Style x:Key="HiddenHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
<Style x:Key="DisableSelectionStyle" TargetType="{x:Type ListViewItem}">
<Setter Property="Focusable" Value="false"/>
<Setter Property="Margin" Value="-5,-1,-5,-1"/>
<Setter Property="Padding" Value="0"/>
</Style>
</Window.Resources> </Window.Resources>
<Grid> <Grid DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:AboutBox}}}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" /> <ColumnDefinition Width="180"/>
<ColumnDefinition Width="7*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <StackPanel Grid.Column="0" Margin="10">
<RowDefinition /> <TextBox Text="{Binding Path=AssemblyTitle, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Margin="0,0,0,10" />
<RowDefinition /> <TextBox Text="{Binding Path=VersionString, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Margin="0,0,0,10" />
<RowDefinition /> <TextBox Text="{Binding Path=AssemblyCopyright, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Margin="10"
DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:AboutBox}}}">
<Label Content="{Binding Path=AssemblyTitle, Mode=OneWay}" />
<Label Content="{Binding Path=VersionString, Mode=OneWay}" />
<Label Content="{Binding Path=AssemblyCopyright, Mode=OneWay}" />
</StackPanel> </StackPanel>
<Button Grid.Row="3" VerticalAlignment="Bottom" HorizontalAlignment="Left" VerticalContentAlignment="Center" IsDefault="true" <Button Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Left" VerticalContentAlignment="Center" IsDefault="true"
Content="{x:Static s:guiStrings.ButtonOK}" Margin="10,0,0,10" Width="70" Height="25" Click="Button_Click" IsCancel="True"/> Content="{x:Static s:guiStrings.ButtonOK}" Margin="10,0,0,10" Width="70" Height="25" Click="Button_Click" IsCancel="True"/>
<Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Margin="10,8,10,6"> <Grid Grid.Column="1" Margin="10">
<Grid.RowDefinitions> <TabControl>
<RowDefinition Height="Auto"/> <TabItem Header="{x:Static s:guiStrings.TextAboutArchives}">
<RowDefinition Height="*"/> <Border BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
</Grid.RowDefinitions> <ListView Name="ArchiveFormats" ItemsSource="{Binding Source={StaticResource FormatsSource}}"
<TextBlock Text="{x:Static s:guiStrings.TextAboutSupportedArchives}" Grid.Row="0" Margin="0" /> ItemContainerStyle="{StaticResource DisableSelectionStyle}" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.CanContentScroll="False">
<Border Grid.Row="1" BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True"> <ListView.View>
<ScrollViewer Grid.Row="1" Margin="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" <GridView ColumnHeaderContainerStyle="{StaticResource HiddenHeaderStyle}">
Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" <GridViewColumn>
BorderThickness="1" BorderBrush="Black"> <GridViewColumn.CellTemplate>
<ItemsControl Name="ArchiveFormats" ItemsSource="{Binding Source={StaticResource FormatsSource}}">
<ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Tag}" Margin="0"/>
<TextBlock Text="{Binding Tag}" Margin="3,0,5,0" />
<TextBlock Text="{Binding Path=CanCreate, Converter={StaticResource guiCanCreateConverter}}" Margin="0,0,5,0"/>
<TextBlock Text="{Binding Description}" />
</StackPanel>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </GridViewColumn.CellTemplate>
</ItemsControl> </GridViewColumn>
</ScrollViewer> <GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=CanCreate, Converter={StaticResource guiCanCreateConverter}}" Margin="-6,0,-6,0"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Description}" Margin="0"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Border> </Border>
</Grid> </TabItem>
<Grid Grid.Column="1" Grid.Row="2" Grid.RowSpan="2" Margin="10,2,10,10"> <TabItem Header="{x:Static s:guiStrings.TextAboutImages}">
<Grid.RowDefinitions> <Border BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
<RowDefinition Height="Auto"/> <ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0" Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}">
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{x:Static s:guiStrings.TextAboutSupportedImages}" Margin="0" />
<Border Grid.Row="1" BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0" Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" BorderThickness="1" BorderBrush="Black">
<ItemsControl Name="ImageFormats" ItemsSource="{Binding Source={x:Static gr:FormatCatalog.Instance}, Path=ImageFormats, Mode=OneWay}"> <ItemsControl Name="ImageFormats" ItemsSource="{Binding Source={x:Static gr:FormatCatalog.Instance}, Path=ImageFormats, Mode=OneWay}">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
@ -104,6 +110,29 @@ IN THE SOFTWARE.
</ItemsControl> </ItemsControl>
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</TabItem>
<TabItem Header="{x:Static s:guiStrings.TextAboutAudio}">
<Border BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="0" Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}">
<ItemsControl Name="AudioFormats" ItemsSource="{Binding Source={x:Static gr:FormatCatalog.Instance}, Path=AudioFormats, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Tag}" Margin="3,0,7,0" />
<TextBlock Text="{Binding Description}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
</TabItem>
<TabItem Header="{x:Static s:guiStrings.TextAboutLicense}">
<ScrollViewer>
<RichTextBox Name="LicenseTabText" IsReadOnly="True"/>
</ScrollViewer>
</TabItem>
</TabControl>
</Grid> </Grid>
</Grid> </Grid>
</w:ModalWindow> </w:ModalWindow>

View File

@ -1,6 +1,6 @@
/// Game Resource browser /// Game Resource browser
// //
// Copyright (C) 2014 by morkt // Copyright (C) 2014-2015 by morkt
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
@ -22,9 +22,11 @@
// //
using System; using System;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents;
using GARbro.GUI.Properties; using GARbro.GUI.Properties;
using GARbro.GUI.Strings; using GARbro.GUI.Strings;
@ -38,6 +40,7 @@ namespace GARbro.GUI
public AboutBox() public AboutBox()
{ {
InitializeComponent(); InitializeComponent();
LicenseTabText.Document = GetLicenseDoc();
} }
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
@ -45,6 +48,47 @@ namespace GARbro.GUI
this.Close(); this.Close();
} }
#region License text backend
static FlowDocument GetLicenseDoc ()
{
var assembly = Assembly.GetExecutingAssembly();
using (var stream = assembly.GetManifestResourceStream ("GARbro.GUI.LICENSE"))
{
if (null == stream)
return new FlowDocument();
using (var reader = new StreamReader (stream))
{
var doc = new FlowDocument();
var para = new Paragraph();
for (;;)
{
var line = reader.ReadLine();
if (null == line)
break;
if (line.Length > 0)
{
if (para.Inlines.Count > 0)
para.Inlines.Add (" ");
para.Inlines.Add (line);
}
else
{
if (0 == para.Inlines.Count)
para.Inlines.Add (new LineBreak());
doc.Blocks.Add (para);
para = new Paragraph();
}
}
if (para.Inlines.Count > 0)
doc.Blocks.Add (para);
return doc;
}
}
}
#endregion
#region Assembly Attribute Accessors #region Assembly Attribute Accessors
public string AssemblyTitle public string AssemblyTitle

View File

@ -225,6 +225,7 @@
<LastGenOutput>guiStrings.Designer.cs</LastGenOutput> <LastGenOutput>guiStrings.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Strings\guiStrings.ru-RU.resx" /> <EmbeddedResource Include="Strings\guiStrings.ru-RU.resx" />
<EmbeddedResource Include="LICENSE" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\app.manifest" /> <None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 morkt Copyright (c) 2014-2015 morkt
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -675,6 +675,24 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to Archives.
/// </summary>
public static string TextAboutArchives {
get {
return ResourceManager.GetString("TextAboutArchives", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Audio.
/// </summary>
public static string TextAboutAudio {
get {
return ResourceManager.GetString("TextAboutAudio", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to [builtin]. /// Looks up a localized string similar to [builtin].
/// </summary> /// </summary>
@ -685,20 +703,20 @@ namespace GARbro.GUI.Strings {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Supported archives:. /// Looks up a localized string similar to Images.
/// </summary> /// </summary>
public static string TextAboutSupportedArchives { public static string TextAboutImages {
get { get {
return ResourceManager.GetString("TextAboutSupportedArchives", resourceCulture); return ResourceManager.GetString("TextAboutImages", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Supported image formats:. /// Looks up a localized string similar to License.
/// </summary> /// </summary>
public static string TextAboutSupportedImages { public static string TextAboutLicense {
get { get {
return ResourceManager.GetString("TextAboutSupportedImages", resourceCulture); return ResourceManager.GetString("TextAboutLicense", resourceCulture);
} }
} }

View File

@ -252,11 +252,11 @@
<data name="TextAboutBuiltin" xml:space="preserve"> <data name="TextAboutBuiltin" xml:space="preserve">
<value>[builtin]</value> <value>[builtin]</value>
</data> </data>
<data name="TextAboutSupportedArchives" xml:space="preserve"> <data name="TextAboutArchives" xml:space="preserve">
<value>Supported archives:</value> <value>Archives</value>
</data> </data>
<data name="TextAboutSupportedImages" xml:space="preserve"> <data name="TextAboutImages" xml:space="preserve">
<value>Supported image formats:</value> <value>Images</value>
</data> </data>
<data name="TextAboutTitle" xml:space="preserve"> <data name="TextAboutTitle" xml:space="preserve">
<value>About Game Resource browser</value> <value>About Game Resource browser</value>
@ -408,4 +408,10 @@ Overwrite?</value>
<data name="TooltipAudioFormats" xml:space="preserve"> <data name="TooltipAudioFormats" xml:space="preserve">
<value>Either WAV, MP3 or OGG</value> <value>Either WAV, MP3 or OGG</value>
</data> </data>
<data name="TextAboutAudio" xml:space="preserve">
<value>Audio</value>
</data>
<data name="TextAboutLicense" xml:space="preserve">
<value>License</value>
</data>
</root> </root>

View File

@ -246,11 +246,11 @@
<data name="TextAboutBuiltin" xml:space="preserve"> <data name="TextAboutBuiltin" xml:space="preserve">
<value>[встроен]</value> <value>[встроен]</value>
</data> </data>
<data name="TextAboutSupportedArchives" xml:space="preserve"> <data name="TextAboutArchives" xml:space="preserve">
<value>Поддерживаемые архивы:</value> <value>Архивы</value>
</data> </data>
<data name="TextAboutSupportedImages" xml:space="preserve"> <data name="TextAboutImages" xml:space="preserve">
<value>Поддерживаемые форматы изображений:</value> <value>Изображения</value>
</data> </data>
<data name="TextAboutTitle" xml:space="preserve"> <data name="TextAboutTitle" xml:space="preserve">
<value>Об обозревателе игровых ресурсов</value> <value>Об обозревателе игровых ресурсов</value>
@ -423,4 +423,10 @@
<data name="TooltipAudioFormats" xml:space="preserve"> <data name="TooltipAudioFormats" xml:space="preserve">
<value>WAV, MP3, либо OGG</value> <value>WAV, MP3, либо OGG</value>
</data> </data>
<data name="TextAboutAudio" xml:space="preserve">
<value>Аудио</value>
</data>
<data name="TextAboutLicense" xml:space="preserve">
<value>Лицензия</value>
</data>
</root> </root>

View File

@ -106,6 +106,7 @@ Fate/stay night<br/>
Fate/hollow ataraxia<br/> Fate/hollow ataraxia<br/>
G-senjou no Maou<br/> G-senjou no Maou<br/>
Imouto Style<br/> Imouto Style<br/>
Nuki Doki!<br/>
Okiba ga Nai!<br/> Okiba ga Nai!<br/>
Ore no Saimin Fantasia<br/> Ore no Saimin Fantasia<br/>
Seirei Tenshou<br/> Seirei Tenshou<br/>