aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.Protobuf.UI/MainWindow.xaml
blob: ad16e8e3ee4a096fe653e0152e4df1e14750420e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: b
<mahapps:MetroWindow x:Class="Tango.Protobuf.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Tango.Protobuf.UI"
        xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:proto="clr-namespace:Tango.Protobuf;assembly=Tango.Protobuf"
        xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
        xmlns:fa="http://schemas.fontawesome.io/icons/"
        mc:Ignorable="d"
        Title="Tango Protobuf Compilation Utility" Height="600" Width="1000" TitleCaps="False" BorderBrush="Gray" BorderThickness="1" WindowStartupLocation="CenterScreen" Background="#202020" Foreground="Gainsboro" DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <Window.Resources>

        <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"></converters:EnumToDescriptionConverter>
        
        <ObjectDataProvider x:Key="languages" MethodName="GetValues"
                            ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="proto:CompilerLanguage"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="80" />
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>

        <Grid>
            <Polygon Fill="#151515" HorizontalAlignment="Right" VerticalAlignment="Top" Points="80,0 400,0 400,80 0,80"></Polygon>

            <Polygon Fill="#151515" HorizontalAlignment="Left" VerticalAlignment="Top" Points="0,0 100,0 200,80 0,80"></Polygon>
        </Grid>

        <Grid Margin="15 0 15 0" VerticalAlignment="Center">
            <StackPanel Orientation="Horizontal">
                <Menu HorizontalAlignment="Left" Width="100" VerticalAlignment="Center" Background="Transparent">
                    <MenuItem Header="File" Background="Transparent">
                        <MenuItem Header="Load File"/>
                        <MenuItem Header="Load Folder" Command="{Binding LoadFolderCommand}" />
                    </MenuItem>
                </Menu>
            </StackPanel>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <TextBox Width="100" Margin="0 0 10 0" BorderThickness="1" BorderBrush="DimGray" Height="28" x:Name="txtIncludes"></TextBox>
                <Button Margin="5" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding CompileCommand}">
                    <StackPanel Orientation="Horizontal">
                        <fa:ImageAwesome Icon="Code" Width="16"></fa:ImageAwesome>
                        <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">Compile</TextBlock>
                    </StackPanel>
                </Button>
                <ComboBox Margin="5" Width="80" BorderThickness="0" ItemsSource="{Binding Source={StaticResource languages}}" SelectedItem="{Binding CompilerLanguage,Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <Button Margin="30 5 5 5" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding SaveCommand}">
                    <StackPanel Orientation="Horizontal">
                        <fa:ImageAwesome Icon="Save" Width="16"></fa:ImageAwesome>
                        <TextBlock VerticalAlignment="Center" Margin="20 0 20 0">Save</TextBlock>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Grid>

        <Grid Grid.Row="1" Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="224*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="195*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="100*"/>
            </Grid.ColumnDefinitions>

            <Grid>
                <GroupBox Header="Proto Files">
                    <TreeView Background="Transparent">
                        <TreeView.Resources>
                            <HierarchicalDataTemplate DataType="{x:Type local:DirectoryItem}"
                                  ItemsSource="{Binding Items}">
                                <StackPanel Orientation="Horizontal">
                                    <fa:ImageAwesome Icon="Folder" Foreground="Orange" Width="16" Height="16"></fa:ImageAwesome>
                                    <TextBlock Margin="5 0 0 0" Text="{Binding Path=Name}" ToolTip="{Binding Path=Path}" />
                                </StackPanel>
                            </HierarchicalDataTemplate>

                            <DataTemplate DataType="{x:Type local:FileItem}">
                                <StackPanel Orientation="Horizontal">
                                    <fa:ImageAwesome Icon="File" Foreground="Gainsboro" Width="16" Height="16"></fa:ImageAwesome>
                                    <TextBlock Margin="5 0 0 0" Text="{Binding Path=Name}" ToolTip="{Binding Path=Path}" />
                                </StackPanel>
                            </DataTemplate>
                        </TreeView.Resources>

                        <TreeView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Left" ItemsSource="{Binding SourceItems}" SelectedItemChanged="Source_TreeView_SelectedItemChanged" />
                    </TreeView>
                </GroupBox>
            </Grid>

            <GridSplitter Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="5" Background="#151515"></GridSplitter>

            <Grid Grid.Column="2">
                <GroupBox Header="Compiled Files">
                    <TreeView Background="Transparent">
                        <TreeView.Resources>
                            <HierarchicalDataTemplate DataType="{x:Type proto:CompilerFolderResult}"
                                  ItemsSource="{Binding Results}">
                                <StackPanel Orientation="Horizontal">
                                    <fa:ImageAwesome Icon="Folder" Foreground="Orange" Width="16" Height="16"></fa:ImageAwesome>
                                    <TextBlock Margin="5 0 0 0" Text="{Binding Path=Name}" ToolTip="{Binding Path=RelativePath}" />
                                </StackPanel>
                            </HierarchicalDataTemplate>

                            <DataTemplate DataType="{x:Type proto:CompilerFileResult}">
                                <StackPanel Orientation="Horizontal">
                                    <fa:ImageAwesome Icon="Code" Foreground="Gainsboro" Width="16" Height="16"></fa:ImageAwesome>
                                    <TextBlock Margin="5 0 0 0" Text="{Binding Path=Name}" />
                                </StackPanel>
                            </DataTemplate>
                        </TreeView.Resources>

                        <TreeView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Left" ItemsSource="{Binding TargetItems}" SelectedItemChanged="Source_TreeView_SelectedItemChanged" />
                    </TreeView>
                </GroupBox>
            </Grid>

            <GridSplitter Grid.Row="1" Grid.ColumnSpan="3" Height="5" Background="#151515" VerticalAlignment="Center" HorizontalAlignment="Stretch"></GridSplitter>

            <Grid Grid.Row="2" Grid.ColumnSpan="3">
                <GroupBox Header="Preview">
                    <TextBox Text="{Binding CurrentContent}" Background="#101010" FontFamily="Lucida Console" BorderThickness="0" Padding="5" AcceptsReturn="True" TextWrapping="NoWrap" IsReadOnly="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"></TextBox>
                </GroupBox>
            </Grid>
        </Grid>
    </Grid>
</mahapps:MetroWindow>