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
Copyright (C) 2014 by morkt
Copyright (C) 2014-2015 by morkt
Permission is hereby granted, free of charge, to any person obtaining a copy
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:gr="clr-namespace:GameRes;assembly=GameRes"
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}}"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Window.Resources>
@ -39,71 +39,100 @@ IN THE SOFTWARE.
<scm:SortDescription PropertyName="Tag" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</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>
<Grid>
<Grid DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:AboutBox}}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="180"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<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 Grid.Column="0" Margin="10">
<TextBox Text="{Binding Path=AssemblyTitle, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Margin="0,0,0,10" />
<TextBox Text="{Binding Path=VersionString, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" Margin="0,0,0,10" />
<TextBox Text="{Binding Path=AssemblyCopyright, Mode=OneWay}" IsReadOnly="True" Background="Transparent" BorderThickness="0" />
</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"/>
<Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Margin="10,8,10,6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="{x:Static s:guiStrings.TextAboutSupportedArchives}" Grid.Row="0" Margin="0" />
<Border Grid.Row="1" BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
<ScrollViewer Grid.Row="1" Margin="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"
BorderThickness="1" BorderBrush="Black">
<ItemsControl Name="ArchiveFormats" ItemsSource="{Binding Source={StaticResource FormatsSource}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<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>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
</Grid>
<Grid Grid.Column="1" Grid.Row="2" Grid.RowSpan="2" Margin="10,2,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<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.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Tag}" Margin="3,0,5,0" />
<TextBlock Text="{x:Static s:guiStrings.TextAboutBuiltin}" Margin="0,0,5,0" Visibility="{Binding IsBuiltin, Converter={StaticResource guiBoolToVisibilityConverter}}"/>
<TextBlock Text="{Binding Description}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
<Grid Grid.Column="1" Margin="10">
<TabControl>
<TabItem Header="{x:Static s:guiStrings.TextAboutArchives}">
<Border BorderThickness="1" BorderBrush="Black" VerticalAlignment="Stretch" Margin="0" SnapsToDevicePixels="True">
<ListView Name="ArchiveFormats" ItemsSource="{Binding Source={StaticResource FormatsSource}}"
ItemContainerStyle="{StaticResource DisableSelectionStyle}" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.CanContentScroll="False">
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource HiddenHeaderStyle}">
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Tag}" Margin="0"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<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>
</TabItem>
<TabItem Header="{x:Static s:guiStrings.TextAboutImages}">
<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="ImageFormats" ItemsSource="{Binding Source={x:Static gr:FormatCatalog.Instance}, Path=ImageFormats, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Tag}" Margin="3,0,5,0" />
<TextBlock Text="{x:Static s:guiStrings.TextAboutBuiltin}" Margin="0,0,5,0" Visibility="{Binding IsBuiltin, Converter={StaticResource guiBoolToVisibilityConverter}}"/>
<TextBlock Text="{Binding Description}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</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>
</w:ModalWindow>

View File

@ -1,6 +1,6 @@
/// 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
// of this software and associated documentation files (the "Software"), to
@ -22,9 +22,11 @@
//
using System;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Data;
using System.Windows.Documents;
using GARbro.GUI.Properties;
using GARbro.GUI.Strings;
@ -38,6 +40,7 @@ namespace GARbro.GUI
public AboutBox()
{
InitializeComponent();
LicenseTabText.Document = GetLicenseDoc();
}
private void Button_Click(object sender, RoutedEventArgs e)
@ -45,6 +48,47 @@ namespace GARbro.GUI
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
public string AssemblyTitle

View File

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

View File

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

View File

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

View File

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

View File

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