<Window x:Name="Dependencies" x:Class="Dependencies.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:Dependencies"
        xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
        xmlns:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz"
        xmlns:properties="clr-namespace:Dependencies.Properties"
        mc:Ignorable="d"
        
        Title="Dependencies" 
        Icon="Images/Dependencies_32px-no-blur.png"
        HorizontalContentAlignment="Stretch" 
        VerticalContentAlignment="Bottom"
        VerticalAlignment="Bottom"
        Height="521" Width="791" 
        AllowDrop="True"
        Drop="MainWindow_Drop"
        >

    <Window.CommandBindings>
        <!--<CommandBinding Command="Exit" Executed="ExitCommandBinding_Executed"></CommandBinding>-->
        <CommandBinding Command="Open" Executed="OpenCommandBinding_Executed"></CommandBinding>
        <CommandBinding Command="Close" Executed="ExitCommandBinding_Executed"></CommandBinding>
        <CommandBinding Command="local:MainWindow.OpenAboutCommand" Executed="OpenAboutCommandBinding_Executed" />
        <CommandBinding Command="local:MainWindow.OpenUserSettingsCommand" Executed="OpenUserSettingsCommandBinding_Executed" />
        <CommandBinding Command="local:MainWindow.OpenCustomizeSearchFolderCommand" Executed="OpenCustomizeSearchFolderCommand_Executed" />
        <CommandBinding Command="Refresh" Executed="RefreshCommandBinding_Executed" />
    </Window.CommandBindings>

    <Window.InputBindings>
        <KeyBinding Key="O" Modifiers="Control" Command="Open"></KeyBinding>
        <KeyBinding Key="Q" Modifiers="Control" Command="Close"></KeyBinding>
    </Window.InputBindings>

    <Window.Resources>

        <ResourceDictionary>

            <!-- Hide/Show the status bar based on a global switch -->
            <local:BooleanToVisibilityConverter x:Key="BooleanToVisibility"/>

            <!-- CustomHeader with middle click to close tab -->
            <DataTemplate DataType="{x:Type local:CustomHeaderViewModel }">
                <local:DragablzCustomHeader />
            </DataTemplate>

            <dragablz:InterTabController  x:Key="DependenciesInterTabController" x:Shared="False"  Partition="2AE89D18-F236-4D20-9605-6C03319038E6"/>

            <Style TargetType="{x:Type dragablz:TabablzControl}" x:Key="DependenciesTabControlStyle">
                <Setter Property="ShowDefaultCloseButton" Value="True" />
                <Setter Property="ItemContainerStyle" Value="{StaticResource TrapezoidDragableTabItemStyle}" />
                <Setter Property="HeaderMemberPath" Value="Header" />
                <Setter Property="HeaderMemberPath" Value="Header" />
                <Setter Property="InterTabController" Value="{StaticResource InterTabController}" />
                <Setter Property="Margin" Value="0 0 0 0" />
                <Setter Property="AdjacentHeaderItemOffset" Value="-10" />
                <Setter Property="FixedHeaderCount" Value="0" />
                <Setter Property="Background" Value="#FF5C8F88"/>
            </Style>
        </ResourceDictionary>

    </Window.Resources>

    <Grid x:Name="MainGrid" Margin="0,0,0,0" Background="#FF5C8F88">
        <Grid.RowDefinitions>
            <RowDefinition Height="26"/>
            <RowDefinition Height="785*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Menu x:Name="MainMenu"  HorizontalContentAlignment="Stretch" MinHeight="26" Panel.ZIndex="1" Grid.Row="0" VerticalContentAlignment="Top" VerticalAlignment="Top">
            
            
            <MenuItem x:Name="FileItem" Header="_File" Height="25" Width="39" VerticalAlignment="Top" >
                <MenuItem x:Name="OpenItem" Header="_Open" Height="25" Command="Open" InputGestureText="Ctrl+O" />
                <Separator Height="3"/>
                <MenuItem x:Name="RecentItems" Header="Recent Items" HorizontalAlignment="Left" ItemsSource="{Binding  Path=RecentsItems}">
                    <MenuItem.ItemTemplate>
                        <HierarchicalDataTemplate DataType="{x:Type local:RecentMenuItem}" ItemsSource="{Binding  Path=RecentsItems}">
                            <TextBlock Text="{Binding Path=HeaderTitle}"/>
                        </HierarchicalDataTemplate>
                    </MenuItem.ItemTemplate>
                    <MenuItem.ItemContainerStyle>
                        <Style TargetType="MenuItem">
                            <EventSetter Event="Click" Handler="RecentFileCommandBinding_Clicked"/>
                        </Style>
                    </MenuItem.ItemContainerStyle>
                </MenuItem>

                <Separator Height="3" Margin="-1,0,0,0" />
                <MenuItem x:Name="ExitItem" Header="E_xit" Height="25"  InputGestureText="Ctrl+Q" Command="Close" />
            </MenuItem>
            <MenuItem x:Name="ViewItem" Header="_View"  Height="25" Width="42">
                <MenuItem x:Name="_SystemInformation" Header="System Information ..." Height="25"  IsEnabled="False" Margin="0" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" />
                <Separator Height="3" Margin="0"/>
                <MenuItem x:Name="_FullPathItem" Header="Full Paths" Height="25" InputGestureText="F9" IsCheckable="True" IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=FullPath, Mode=TwoWay}" Margin="0,0,0.2,0"/>
                <MenuItem Header="_Undecorate C++ Functions" Height="26" InputGestureText="F10" IsCheckable="True" IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=Undecorate, Mode=TwoWay }"/>
                <Separator Height="3" Margin="0"/>
                <MenuItem x:Name="_RefreshItem" Header="_Refresh" Height="25" InputGestureText="F5" IsEnabled="False"/>
                <Separator Height="3" Margin="0"/>
                <MenuItem x:Name="_StatusBarItem" Header="Status Bar" Height="25" IsCheckable="True" Margin="0" IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=ShowStatusBar, Mode=TwoWay}"/>
            </MenuItem>
            <MenuItem x:Name="OptionsItem" Header="_Options" Height="25" Width="54">
                <MenuItem x:Name="CustomizeSearchFoldersItem" Header="_Customize search folders" Height="25" Margin="0" Command="local:MainWindow.OpenCustomizeSearchFolderCommand" IsEnabled="{Binding Path=DataContext.EnableSearchFolderCustomization, Source=OneWay}"/>
                <Separator Height="3" Margin="0"/>
                <MenuItem x:Name="UserSettingsItem" Header="_Properties" Height="25" Margin="0" Command="local:MainWindow.OpenUserSettingsCommand"/>
            </MenuItem>
            <MenuItem x:Name="HelpIem" Header="_Help" Height="25" Width="49">
                <MenuItem x:Name="HelpAboutItem" Header="About Dependencies" Height="25" Command="local:MainWindow.OpenAboutCommand"/>
            </MenuItem>
        </Menu>

        <Grid   Name="DefaultMessage"
                Grid.Row="1" 
                Panel.ZIndex="1"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
              >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="48"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>

            <Image Source="Images/Dependencies_48px-no-blur.png" Height="48" Width="48" Grid.Column="0"/>
            
            
            
            <TextBlock Grid.Column="2" 
                       TextWrapping="Wrap"
                       VerticalAlignment="Center"
                       Name="TextContent"
                       FontFamily="Courrier New"
                       FontSize="18"
                       Margin="20 0 0 00"
                       >
                Analyze a new binary via "File -> Open" (Ctrl+O) <LineBreak/>
                or simply by dragging it into the application.
            </TextBlock>
        </Grid>
               
        
        <!-- dockablz:Layout is part of the main grid =>  Grid.Row="1" -->
        <!-- DependencyWindow does not support being a floating window => IsFloatDropZoneEnabled="False" -->
        <!-- all dragablz controls need to reference  Partition="2AE89D18-F236-4D20-9605-6C03319038E6" in order to dock correctly -->
        <dockablz:Layout Partition="2AE89D18-F236-4D20-9605-6C03319038E6" Name="DependencyRootLayout"
                    IsFloatDropZoneEnabled="False"
                    FloatingItemHeaderMemberPath="Header"
                    Grid.Row="1" d:IsHidden="True">

            <!-- branch template lets dragablz create a new tab control after a window is split via docking -->
            <dockablz:Layout.BranchTemplate>
                <DataTemplate>
                    <dragablz:TabablzControl Style="{StaticResource DependenciesTabControlStyle}" InterTabController="{StaticResource DependenciesInterTabController}">
                    </dragablz:TabablzControl>
                </DataTemplate>
            </dockablz:Layout.BranchTemplate>
            
            <!-- a root, named tab control is needed, so when a tab is torn and a new window is created, the new target tab control can be identified -->
            <dragablz:TabablzControl x:Name="TabControl"
                                 Style="{StaticResource DependenciesTabControlStyle}"
                                 InterTabController="{StaticResource DependenciesInterTabController}">
        
                
                <!--<dragablz:TabablzControl.HeaderSuffixContent>
                    <Grid x:Name="CustomHeaderContainerGrid" 
                          Margin="0,2,2,0">
                        <Grid.Resources>
                            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource StandardEmbeddedButtonStyle}"></Style>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        --><!-- a root, named tab control is needed, so when a tab is torn and a new window is created, the new target tab control can be identified --><!--
                        <Button Style="{StaticResource AddItemCommandButtonStyle}"
                                    x:Name="AddButton"
                                    Grid.Column="0"
                                    Command="Open"
                                    />
                    </Grid>
                </dragablz:TabablzControl.HeaderSuffixContent>-->            
           </dragablz:TabablzControl>


        </dockablz:Layout>

        <StatusBar x:Name="AppStatusBar" 
                   HorizontalContentAlignment="Stretch" 
                   VerticalContentAlignment="Bottom" 
                   Grid.Row="2" 
                   MinHeight="20" 
                   Panel.ZIndex="1" 
                   Margin="0" 
                   VerticalAlignment="Bottom" 
                   Visibility="{Binding Source={x:Static properties:Settings.Default}, Path=ShowStatusBar, Mode=OneWay, Converter={StaticResource BooleanToVisibility}}"
                   >
            <StatusBarItem 
                x:Name="AppStatusBarMessage">
                "Welcome to Dependencies !"
            </StatusBarItem>
        </StatusBar>


    </Grid>
</Window>
