Adding configuration GUI and sphinx documentation to repository.

This commit is contained in:
emb
2015-01-03 22:47:53 -06:00
parent 44745f0fd2
commit 9f6ddde34c
69 changed files with 5572 additions and 2 deletions

View File

@@ -0,0 +1,75 @@
<UserControl x:Class="Configuration.View.AddRemoveList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ImageSource x:Key="AddIcon">/Assets/Icons/Add.png</ImageSource>
<ImageSource x:Key="DeleteIcon">/Assets/Icons/Delete.png</ImageSource>
<Style x:Key="AddButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Padding" Value="1" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Content">
<Setter.Value>
<Image Source="{StaticResource AddIcon}" Height="15"/>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Padding" Value="1" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Content">
<Setter.Value>
<Image Source="{StaticResource DeleteIcon}" Height="15"/>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0"
SelectionMode="Single"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ListItemsSource, Mode=TwoWay}"
DisplayMemberPath="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ListDisplayMemberPath}"
SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=SelectedItem,Mode=TwoWay}"
Name="List" />
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Popup Name="AddPopup" IsOpen="{Binding IsChecked, ElementName=AddButton, Mode=TwoWay}">
<Border Background="White" BorderThickness="1" BorderBrush="Black">
<StackPanel Orientation="Horizontal">
<TextBlock>Name</TextBlock>
<TextBox Width="100" Name="AddName"/>
<Button Content="Add"
Click="HideAddPopup"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=AddListItemCommand}"
CommandParameter="{Binding Text, ElementName=AddName}">
</Button>
</StackPanel>
</Border>
</Popup>
<ToggleButton Name="AddButton" Style="{StaticResource AddButtonStyle}"/>
<Button Style="{StaticResource DeleteButtonStyle}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=RemoveListItemCommand}" />
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Configuration.ViewModel;
namespace Configuration.View
{
/// <summary>
/// Interaction logic for AddRemoveList.xaml
/// </summary>
public partial class AddRemoveList : UserControl
{
public ICommand AddListItemCommand
{
get { return (ICommand)GetValue(AddListItemCommandProperty); }
set { SetValue(ListItemsSourceProperty, value); }
}
public static DependencyProperty AddListItemCommandProperty = DependencyProperty.Register("AddListItemCommand", typeof(ICommand), typeof(AddRemoveList));
public ICommand RemoveListItemCommand
{
get { return (ICommand)GetValue(RemoveListItemCommandProperty); }
set { SetValue(ListItemsSourceProperty, value); }
}
public static DependencyProperty RemoveListItemCommandProperty = DependencyProperty.Register("RemoveListItemCommand", typeof(ICommand), typeof(AddRemoveList));
public System.Collections.IEnumerable ListItemsSource
{
get { return (ObservableCollection<System.Collections.IEnumerable>)GetValue(ListItemsSourceProperty); }
set { SetValue(ListItemsSourceProperty, value); }
}
public static DependencyProperty ListItemsSourceProperty = DependencyProperty.Register("ListItemsSource", typeof(System.Collections.IEnumerable), typeof(AddRemoveList));
public object SelectedItem
{
get { return (object)GetValue(SelectedItemProperty); }
set { SetValue(SelectedItemProperty, value); }
}
public static DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(object), typeof(AddRemoveList));
public String ListDisplayMemberPath
{
get { return (String)GetValue(ListDisplayMemberPathProperty); }
set { SetValue(ListDisplayMemberPathProperty, value); }
}
public static DependencyProperty ListDisplayMemberPathProperty = DependencyProperty.Register("ListDisplayMemberPath", typeof(String), typeof(AddRemoveList));
public AddRemoveList()
{
InitializeComponent();
}
private void HideAddPopup(object sender, RoutedEventArgs e)
{
AddPopup.IsOpen = false;
// AddName.Text = "";
}
}
}

View File

@@ -0,0 +1,161 @@
<UserControl x:Class="Configuration.View.Collection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:c="clr-namespace:Configuration.Converter"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<c:InverseBooleanConverter x:Key="InverseBoolConverter"/>
<BooleanToVisibilityConverter x:Key="BoolVisibilityConverter"/>
<c:InverseBooleanToVisibilityConverter x:Key="InverseBoolVisibilityConverter"/>
<c:CollectionExistsConverter x:Key="CollectionExistsConvert"/>
<ImageSource x:Key="AddIcon">/Assets/Icons/Add.png</ImageSource>
<ImageSource x:Key="DeleteIcon">/Assets/Icons/Delete.png</ImageSource>
<Style x:Key="AddButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Padding" Value="1" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Content">
<Setter.Value>
<Image Source="{StaticResource AddIcon}" Height="15"/>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Padding" Value="1" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Content">
<Setter.Value>
<Image Source="{StaticResource DeleteIcon}" Height="15"/>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<StackPanel Orientation="Vertical">
<GroupBox Header="Execution">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Item (ROM) Folder" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.ListPath}"/>
<Button Grid.Row="0" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Item" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="File Extensions" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.FileExtensions}"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="(comma separated)" VerticalAlignment="Center"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Launcher" VerticalAlignment="Center"/>
<ComboBox Grid.Row="2" Grid.Column="1"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=LauncherCollection}"
DisplayMemberPath="Name"
SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Launcher}"
/>
</Grid>
</GroupBox>
<GroupBox Header="Graphics">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Layout" VerticalAlignment="Center"/>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
<ComboBox
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Layouts}"
SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Layout}"
IsEnabled="{Binding ElementName=DefaultLayout, Path=IsChecked, Converter={StaticResource InverseBoolConverter}}"
Visibility="{Binding ElementName=DefaultLayout, Path=IsChecked, Converter={StaticResource InverseBoolVisibilityConverter}}"/>
<CheckBox Content="Use default layout"
VerticalAlignment="Center"
Name="DefaultLayout"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsDefaultLayout}"/>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Video" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.MediaPathVideo}"/>
<Button Grid.Row="1" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Video" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="Title" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.MediaPathTitle}"/>
<Button Grid.Row="2" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Title" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="Logo" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.MediaPathLogo}"/>
<Button Grid.Row="3" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Logo" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="Box" VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.MediaPathBox}"/>
<Button Grid.Row="4" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Box" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="Cart" VerticalAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.MediaPathCart}"/>
<Button Grid.Row="5" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Cart" />
<TextBlock Grid.Row="6" Grid.Column="0" Text="Snap" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.MediaPathSnap}"/>
<Button Grid.Row="6" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFolderCommand}" CommandParameter="Snap" />
</Grid>
</GroupBox>
<GroupBox Header="Submenus">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource AddButtonStyle}" HorizontalAlignment="Left"/>
<Button Style="{StaticResource DeleteButtonStyle}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.RemoveSubmenuCommand}" />
</StackPanel>
<DataGrid DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" ItemsSource="{Binding Data.Submenus}"
AutoGenerateColumns="False" CanUserAddRows="True" Margin="0,0,0,90" IsEnabled="True" ScrollViewer.CanContentScroll="True">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Collection">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Collections}"
SelectedValuePath="Name"
SelectedValue="{Binding .}"
DisplayMemberPath="Name"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Flatten">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</GroupBox>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Configuration.ViewModel;
namespace Configuration.View
{
/// <summary>
/// Interaction logic for Collection.xaml
/// </summary>
public partial class Collection : UserControl
{
public CollectionVM Data
{
get { return (CollectionVM)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
public static DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(CollectionVM), typeof(Collection));
public System.Collections.IEnumerable LauncherCollection
{
get { return (System.Collections.IEnumerable)GetValue(LauncherCollectionProperty); }
set { SetValue(LauncherCollectionProperty, value); }
}
public static DependencyProperty LauncherCollectionProperty = DependencyProperty.Register("LauncherCollection", typeof(System.Collections.IEnumerable), typeof(Collection));
public System.Collections.IEnumerable Layouts
{
get { return (System.Collections.IEnumerable)GetValue(LayoutsProperty); }
set { SetValue(LayoutsProperty, value); }
}
public static DependencyProperty LayoutsProperty = DependencyProperty.Register("Layouts", typeof(System.Collections.IEnumerable), typeof(Collection));
public System.Collections.IEnumerable Collections
{
get { return (System.Collections.IEnumerable)GetValue(CollectionsProperty); }
set { SetValue(CollectionsProperty, value); }
}
public static DependencyProperty CollectionsProperty = DependencyProperty.Register("Collections", typeof(System.Collections.IEnumerable), typeof(Collection));
public Collection()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,39 @@
<UserControl x:Class="Configuration.View.ControlInput"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.ScrollPrevious}"/>
<TextBlock Text="Scroll Previous" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.ScrollNext}"/>
<TextBlock Text="Scroll Next" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.PageUp}"/>
<TextBlock Text="Page Up" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.PageDown}"/>
<TextBlock Text="Page Down" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.SelectItem}"/>
<TextBlock Text="Select Item" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Back}"/>
<TextBlock Text="Back" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Width="100" PreviewKeyDown="TextBlock_PreviewKeyDown" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Quit}" />
<TextBlock Text="Quit" />
</StackPanel>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Configuration.ViewModel;
namespace Configuration.View
{
/// <summary>
/// Interaction logic for ControlInput.xaml
/// </summary>
public partial class ControlInput : UserControl
{
Dictionary<int, string> SDLAsciiDescMap = new Dictionary<int, string>();
public ControlInput()
{
InitializeComponent();
SDLAsciiDescMap[0x8] = "Backspace";
SDLAsciiDescMap[0x9] = "Tab";
SDLAsciiDescMap[0x0C] = "Clear";
SDLAsciiDescMap[0x0D] = "Return";
SDLAsciiDescMap[0x13] = "Pause";
SDLAsciiDescMap[0x14] = "CapsLock";
SDLAsciiDescMap[0x1B] = "Escape";
SDLAsciiDescMap[0x20] = "Space";
SDLAsciiDescMap[0x21] = "PageUp";
SDLAsciiDescMap[0x22] = "PageDown";
SDLAsciiDescMap[0x23] = "End";
SDLAsciiDescMap[0x24] = "Home";
SDLAsciiDescMap[0x25] = "Left";
SDLAsciiDescMap[0x26] = "Up";
SDLAsciiDescMap[0x27] = "Right";
SDLAsciiDescMap[0x28] = "Down";
SDLAsciiDescMap[0x29] = "Select";
SDLAsciiDescMap[0x2B] = "Execute";
SDLAsciiDescMap[0x2C] = "PrintScreen";
SDLAsciiDescMap[0x2D] = "Insert";
SDLAsciiDescMap[0x2E] = "Delete";
SDLAsciiDescMap[0x2F] = "Help";
SDLAsciiDescMap[0x30] = "0";
SDLAsciiDescMap[0x31] = "1";
SDLAsciiDescMap[0x32] = "2";
SDLAsciiDescMap[0x33] = "3";
SDLAsciiDescMap[0x34] = "4";
SDLAsciiDescMap[0x35] = "5";
SDLAsciiDescMap[0x36] = "6";
SDLAsciiDescMap[0x37] = "7";
SDLAsciiDescMap[0x38] = "8";
SDLAsciiDescMap[0x39] = "9";
SDLAsciiDescMap[0x41] = "A";
SDLAsciiDescMap[0x42] = "B";
SDLAsciiDescMap[0x43] = "C";
SDLAsciiDescMap[0x44] = "D";
SDLAsciiDescMap[0x45] = "E";
SDLAsciiDescMap[0x46] = "F";
SDLAsciiDescMap[0x47] = "G";
SDLAsciiDescMap[0x48] = "H";
SDLAsciiDescMap[0x49] = "I";
SDLAsciiDescMap[0x4A] = "J";
SDLAsciiDescMap[0x4B] = "K";
SDLAsciiDescMap[0x4C] = "L";
SDLAsciiDescMap[0x4D] = "M";
SDLAsciiDescMap[0x4E] = "N";
SDLAsciiDescMap[0x4F] = "O";
SDLAsciiDescMap[0x50] = "P";
SDLAsciiDescMap[0x51] = "Q";
SDLAsciiDescMap[0x52] = "R";
SDLAsciiDescMap[0x53] = "S";
SDLAsciiDescMap[0x54] = "T";
SDLAsciiDescMap[0x55] = "U";
SDLAsciiDescMap[0x56] = "V";
SDLAsciiDescMap[0x57] = "W";
SDLAsciiDescMap[0x58] = "X";
SDLAsciiDescMap[0x59] = "Y";
SDLAsciiDescMap[0x5A] = "Z";
SDLAsciiDescMap[0x5B] = "Left GUI";
SDLAsciiDescMap[0x5C] = "Right GUI";
SDLAsciiDescMap[0x5D] = "Application";
SDLAsciiDescMap[0x5F] = "Sleep";
SDLAsciiDescMap[0x60] = "Keypad 0";
SDLAsciiDescMap[0x61] = "Keypad 1";
SDLAsciiDescMap[0x62] = "Keypad 2";
SDLAsciiDescMap[0x63] = "Keypad 3";
SDLAsciiDescMap[0x64] = "Keypad 4";
SDLAsciiDescMap[0x65] = "Keypad 5";
SDLAsciiDescMap[0x66] = "Keypad 6";
SDLAsciiDescMap[0x67] = "Keypad 7";
SDLAsciiDescMap[0x68] = "Keypad 8";
SDLAsciiDescMap[0x69] = "Keypad 9";
SDLAsciiDescMap[0x6A] = "*";
SDLAsciiDescMap[0x6B] = "+";
SDLAsciiDescMap[0x6C] = "Separator";
SDLAsciiDescMap[0x6D] = "-";
SDLAsciiDescMap[0x6E] = ".";
SDLAsciiDescMap[0x6F] = "/";
SDLAsciiDescMap[0x70] = "F1";
SDLAsciiDescMap[0x71] = "F2";
SDLAsciiDescMap[0x72] = "F3";
SDLAsciiDescMap[0x73] = "F4";
SDLAsciiDescMap[0x74] = "F5";
SDLAsciiDescMap[0x75] = "F6";
SDLAsciiDescMap[0x76] = "F7";
SDLAsciiDescMap[0x77] = "F8";
SDLAsciiDescMap[0x78] = "F9";
SDLAsciiDescMap[0x79] = "F10";
SDLAsciiDescMap[0x7A] = "F11";
SDLAsciiDescMap[0x7B] = "F12";
SDLAsciiDescMap[0x7C] = "F13";
SDLAsciiDescMap[0x7D] = "F14";
SDLAsciiDescMap[0x7E] = "F15";
SDLAsciiDescMap[0x7F] = "F16";
SDLAsciiDescMap[0x80] = "F17";
SDLAsciiDescMap[0x81] = "F18";
SDLAsciiDescMap[0x82] = "F19";
SDLAsciiDescMap[0x83] = "F20";
SDLAsciiDescMap[0x84] = "F21";
SDLAsciiDescMap[0x85] = "F22";
SDLAsciiDescMap[0x86] = "F23";
SDLAsciiDescMap[0x87] = "F24";
SDLAsciiDescMap[0x90] = "Numlock";
SDLAsciiDescMap[0x91] = "ScrollLock";
SDLAsciiDescMap[0xA0] = "Left Shift";
SDLAsciiDescMap[0xA1] = "Right Shift";
SDLAsciiDescMap[0xA2] = "Left Ctrl";
SDLAsciiDescMap[0xA3] = "Right Ctrl";
SDLAsciiDescMap[0xA4] = "Left Menu";
SDLAsciiDescMap[0xA5] = "Right Menu";
SDLAsciiDescMap[0xC0] = "`";
}
public ControllerVM Data
{
get { return (ControllerVM)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
public static DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(ControllerVM), typeof(ControlInput));
private void TextBlock_PreviewKeyDown(object sender, KeyEventArgs e)
{
TextBox tb = sender as TextBox;
System.Windows.Forms.KeysConverter kc = new System.Windows.Forms.KeysConverter();
int key = System.Windows.Input.KeyInterop.VirtualKeyFromKey(e.Key);
int systemKey = System.Windows.Input.KeyInterop.VirtualKeyFromKey(e.SystemKey);
if (SDLAsciiDescMap.ContainsKey(key))
{
tb.Text = SDLAsciiDescMap[key];
}
else
if (SDLAsciiDescMap.ContainsKey(systemKey))
{
tb.Text = SDLAsciiDescMap[systemKey];
}
else
{
tb.Text = key + " " + e.SystemKey + " (none)";
}
//todo, implement a map
e.Handled = true;
}
}
}

View File

@@ -0,0 +1,24 @@
<UserControl x:Class="Configuration.View.Launcher"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Executable Path" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.ExecutablePath}"/>
<Button Grid.Row="0" Grid.Column="2" Content="Browse" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.BrowseFileCommand}" CommandParameter="Item" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Arguments" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Arguments}"/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Configuration.ViewModel;
namespace Configuration.View
{
/// <summary>
/// Interaction logic for Launcher.xaml
/// </summary>
public partial class Launcher : UserControl
{
public Launcher()
{
InitializeComponent();
}
public LauncherVM Data
{
get { return (LauncherVM)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
public static DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(LauncherVM), typeof(Launcher));
}
}

View File

@@ -0,0 +1,109 @@
<UserControl x:Class="Configuration.View.MainSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:c="clr-namespace:Configuration.Converter"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<c:InverseBooleanConverter x:Key="InverseBoolConverter"/>
<BooleanToVisibilityConverter x:Key="BoolVisibilityConverter"/>
<c:InverseBooleanToVisibilityConverter x:Key="InverseBoolVisibilityConverter"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<GroupBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Header="Display">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Horizontal resolution" />
<TextBox Grid.Row="0" Grid.Column="1" Width="50"
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.HorizontalResolution}"
IsEnabled="{Binding ElementName=HorizontalStretch, Path=IsChecked, Converter={StaticResource InverseBoolConverter}}"
/>
<CheckBox Grid.Row="0" Grid.Column="2" Name="HorizontalStretch" Content="Stretch (use OS defaults)" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsHorizontalStretch}"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Vertical resolution" />
<TextBox Grid.Row="2" Grid.Column="1" Width="50"
Text ="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.VerticalResolution}"
IsEnabled="{Binding ElementName=VerticalStretch, Path=IsChecked, Converter={StaticResource InverseBoolConverter}}"
/>
<CheckBox Grid.Row="2" Grid.Column="2" Name="VerticalStretch" Content="Stretch (use OS defaults)" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsVerticalStretch}"/>
<CheckBox Grid.Row="4" Grid.Column="0" Content="Fullscreen" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsFullscreen}"/>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="0" Header="Navigation and Layout">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<ComboBox ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Layouts}" SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.Layout}"/>
<TextBlock Text="Default layout" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ComboBox DisplayMemberPath="Name" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Collections}" SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.FirstCollection}"/>
<TextBlock Text="First collection to show on startup" />
</StackPanel>
<CheckBox Content="Exit if 'back' key is pressed on first menu" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsExitOnFirstBack}"/>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="1" Header="Video">
<StackPanel Orientation="Vertical">
<CheckBox Content="Enable video playback" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsVideoEnabled}"/>
<StackPanel Orientation="Horizontal">
<TextBox Width="40" IsEnabled="{Binding ElementName=VideoLoopInfinite, Path=IsChecked, Converter={StaticResource InverseBoolConverter}}" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.VideoLoop}"/>
<TextBlock Text="# Times to play" />
</StackPanel>
<CheckBox Name="VideoLoopInfinite" Content="Loop Infinite" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsInfiniteLoop}" />
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="0" Header="Attract Mode">
<StackPanel Orientation="Vertical">
<CheckBox Name="EnableAttractMode" Content="Enable attract mode" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsAttractModeEnabled}"/>
<StackPanel Orientation="Horizontal">
<TextBox Width="40"
Text ="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.AttractModeTime}"
IsEnabled="{Binding ElementName=EnableAttractMode, Path=IsChecked}"
/>
<TextBlock Text="Idle time" />
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="1" Header="Hiding">
<StackPanel Orientation="Vertical">
<CheckBox Content="Hide mouse" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsMouseHidden}"/>
<CheckBox Content="Hide parenthesis '()' in titles" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsParenthesisVisible}"/>
<CheckBox Content="Hide braces '[]' in titles" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Data.IsBracesVisible}"/>
</StackPanel>
</GroupBox>
</Grid>
</UserControl>

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Configuration.ViewModel;
namespace Configuration.View
{
/// <summary>
/// Interaction logic for MainSettings.xaml
/// </summary>
public partial class MainSettings : UserControl
{
public MainVM Data
{
get { return (MainVM)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
public static DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(MainVM), typeof(MainSettings));
public System.Collections.IEnumerable Launchers
{
get { return (System.Collections.IEnumerable)GetValue(LaunchersProperty); }
set { SetValue(LaunchersProperty, value); }
}
public static DependencyProperty LaunchersProperty = DependencyProperty.Register("Launchers", typeof(System.Collections.IEnumerable), typeof(MainSettings));
public System.Collections.IEnumerable Collections
{
get { return (System.Collections.IEnumerable)GetValue(CollectionsProperty); }
set { SetValue(CollectionsProperty, value); }
}
public static DependencyProperty CollectionsProperty = DependencyProperty.Register("Collections", typeof(System.Collections.IEnumerable), typeof(MainSettings));
public MainSettings()
{
InitializeComponent();
}
}
}