<!--
// /***************************************************************************
// 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"
        xmlns:localization="clr-namespace:Aaru.Localization;assembly=Aaru.Localization"
        mc:Ignorable="d"
        d:DesignWidth="800"
        d:DesignHeight="450"
        x:Class="Aaru.Gui.Views.Windows.OldMainWindow"
        Icon="/Assets/aaru-logo.png"
        Title="Aaru.Gui">
    <Design.DataContext>
        <windows:OldMainWindowViewModel />
    </Design.DataContext>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{x:Static localization:UI.Menu_File}">
                <MenuItem Header="{x:Static localization:UI.Menu_Open}"
                          Command="{Binding OpenCommand}" />
                <Separator />
                <MenuItem Header="{x:Static localization:UI.Menu_Settings}"
                          IsVisible="{Binding !NativeMenuSupported}"
                          Command="{Binding SettingsCommand}" />
                <Separator />
                <MenuItem Header="{x:Static localization:UI.Menu_Exit}"
                          IsVisible="{Binding !NativeMenuSupported}"
                          Command="{Binding ExitCommand}" />
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Devices}"
                      IsVisible="{Binding DevicesSupported}">
                <MenuItem Header="{x:Static localization:UI.Menu_Refresh}"
                          Command="{Binding RefreshDevicesCommand}" />
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Window}">
                <MenuItem Header="{x:Static localization:UI.Menu_Console}"
                          Command="{Binding ConsoleCommand}" />
            </MenuItem>
            <MenuItem Header="{x:Static localization:UI.Menu_Help}">
                <MenuItem Header="{x:Static localization:UI.Menu_Encodings}"
                          Command="{Binding EncodingsCommand}" />
                <MenuItem Header="{x:Static localization:UI.Menu_Plugins}"
                          Command="{Binding PluginsCommand}" />
                <MenuItem Header="{x:Static localization:UI.Menu_Statistics}"
                          Command="{Binding StatisticsCommand}" />
                <Separator IsVisible="{Binding !NativeMenuSupported}" />
                <MenuItem Header="{x:Static localization:UI.Menu_About}"
                          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="{x:Static localization:UI.Menu_Refresh_devices}"
                                              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="{x:Static localization:UI.Menu_Close_all_images}"
                                              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="{x:Static localization:UI.ButtonLabel_Calculate_entropy}" />
                                    <MenuItem Command="{Binding VerifyImageCommand}"
                                              Header="{x:Static localization:UI.ButtonLabel_Verify}" />
                                    <MenuItem Command="{Binding ChecksumImageCommand}"
                                              Header="{x:Static localization:UI.ButtonLabel_Checksum}" />
                                    <MenuItem Command="{Binding ConvertImageCommand}"
                                              Header="{x:Static localization:UI.ButtonLabel_Convert_to}" />
                                    <MenuItem Command="{Binding CreateSidecarCommand}"
                                              Header="{x:Static localization:UI.ButtonLabel_Create_Aaru_Metadata_sidecar}" />
                                    <MenuItem Command="{Binding ViewImageSectorsCommand}"
                                              Header="{x:Static localization:UI.ButtonLabel_View_sectors}" />
                                    <MenuItem Command="{Binding DecodeImageMediaTagsCommand}"
                                              Header="{x:Static localization:UI.ButtonLabel_Decode_media_tags}" />
                                </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>