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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<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>