<!--
// /***************************************************************************
// Aaru Data Preservation Suite
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
// Filename       : MainWindow.xaml
// Author(s)      : Natalia Portillo <claunia@claunia.com>
//
// Component      : GUI windows.
//
// ‐‐[ Description ] ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
//     Main window.
//
// ‐‐[ License ] ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
//     This program is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General public License as
//     published by the Free Software Foundation, either version 3 of the
//     License, or (at your option) any later version.
//
//     This program is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General public License for more details.
//
//     You should have received a copy of the GNU General public License
//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
-->
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:models="clr-namespace:Aaru.Gui.Models;assembly=Aaru.Gui"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:windows="clr-namespace:Aaru.Gui.ViewModels.Windows"
        mc:Ignorable="d"
        d:DesignWidth="800"
        d:DesignHeight="450"
        x:Class="Aaru.Gui.Views.Windows.MainWindow"
        Icon="/Assets/aaru-logo.png"
        Title="Aaru.Gui">
    <Design.DataContext>
        <windows:MainWindowViewModel />
    </Design.DataContext>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{Binding FileLabel}">
                <MenuItem Header="{Binding OpenLabel}"
                          Command="{Binding OpenCommand}" />
                <Separator />
                <MenuItem Header="{Binding SettingsLabel}"
                          IsVisible="{Binding !NativeMenuSupported}"
                          Command="{Binding SettingsCommand}" />
                <Separator />
                <MenuItem Header="{Binding ExitLabel}"
                          IsVisible="{Binding !NativeMenuSupported}"
                          Command="{Binding ExitCommand}" />
            </MenuItem>
            <MenuItem Header="{Binding DevicesLabel}"
                      IsVisible="{Binding DevicesSupported}">
                <MenuItem Header="{Binding RefreshDevicesLabel}"
                          Command="{Binding RefreshDevicesCommand}" />
            </MenuItem>
            <MenuItem Header="{Binding WindowLabel}">
                <MenuItem Header="{Binding ConsoleLabel}"
                          Command="{Binding ConsoleCommand}" />
            </MenuItem>
            <MenuItem Header="{Binding HelpLabel}">
                <MenuItem Header="{Binding EncodingsLabel}"
                          Command="{Binding EncodingsCommand}" />
                <MenuItem Header="{Binding PluginsLabel}"
                          Command="{Binding PluginsCommand}" />
                <MenuItem Header="{Binding StatisticsLabel}"
                          Command="{Binding StatisticsCommand}" />
                <Separator IsVisible="{Binding !NativeMenuSupported}" />
                <MenuItem Header="{Binding AboutLabel}"
                          Name="AboutMenuItem"
                          IsVisible="{Binding !NativeMenuSupported}"
                          Command="{Binding AboutCommand}" />
            </MenuItem>
        </Menu>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" /><ColumnDefinition Width="5" /><ColumnDefinition Width="6*" />
            </Grid.ColumnDefinitions>
            <TreeView ItemsSource="{Binding TreeRoot}"
                      SelectedItem="{Binding TreeViewSelectedItem}">
                <TreeView.DataTemplates>
                    <TreeDataTemplate DataType="models:DevicesRootModel"
                                      ItemsSource="{Binding Devices}">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="{Binding RefreshDevicesFullLabel}"
                                              Command="{Binding RefreshDevicesCommand}" />
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                            <Image Width="24"
                                   Height="24"
                                   Source="/Assets/Icons/oxygen/32x32/computer.png" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:ImagesRootModel"
                                      ItemsSource="{Binding Images}">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="{Binding CloseAllImagesLabel}"
                                              Command="{Binding CloseAllImages}" />
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                            <Image Width="24"
                                   Height="24"
                                   Source="/Assets/Icons/oxygen/32x32/inode-directory.png" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:ImageModel"
                                      ItemsSource="{Binding PartitionSchemesOrFileSystems}">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Command="{Binding CalculateEntropyCommand}"
                                              Header="{Binding CalculateEntropyLabel}" />
                                    <MenuItem Command="{Binding VerifyImageCommand}"
                                              Header="{Binding VerifyImageLabel}" />
                                    <MenuItem Command="{Binding ChecksumImageCommand}"
                                              Header="{Binding ChecksumImageLabel}" />
                                    <MenuItem Command="{Binding ConvertImageCommand}"
                                              Header="{Binding ConvertImageLabel}" />
                                    <MenuItem Command="{Binding CreateSidecarCommand}"
                                              Header="{Binding CreateSidecarLabel}" />
                                    <MenuItem Command="{Binding ViewImageSectorsCommand}"
                                              Header="{Binding ViewImageSectorsLabel}" />
                                    <MenuItem Command="{Binding DecodeImageMediaTagsCommand}"
                                              Header="{Binding DecodeImageMediaTagsLabel}" />
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding FileName}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:PartitionSchemeModel"
                                      ItemsSource="{Binding Partitions}">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:PartitionModel"
                                      ItemsSource="{Binding FileSystems}">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:FileSystemModel"
                                      ItemsSource="{Binding Roots}">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding VolumeName}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:SubdirectoryModel"
                                      ItemsSource="{Binding Subdirectories}">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:DeviceModel"
                                      ItemsSource="{Binding Media}">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                    <TreeDataTemplate DataType="models:MediaModel">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24"
                                   Height="24"
                                   Source="{Binding Icon}" />
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </TreeDataTemplate>
                </TreeView.DataTemplates>
            </TreeView>
            <GridSplitter Grid.Column="1"
                          Width="5"
                          HorizontalAlignment="Stretch" />
            <ContentControl Grid.Column="2"
                            Content="{Binding ContentPanel}"
                            HorizontalAlignment="Stretch"
                            HorizontalContentAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            VerticalContentAlignment="Stretch" />
        </Grid>
    </DockPanel>
</Window>