<Window x:Class="WpfEngineeringSketch.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:WpfEngineeringSketch"
        xmlns:vm="clr-namespace:WpfEngineeringSketch.ViewModels"
        xmlns:rendering="clr-namespace:WpfEngineeringSketch.Rendering"
        xmlns:dd="clr-namespace:devDept.Eyeshot.Control;assembly=devDept.Eyeshot.Control.Wpf.v2025"
        mc:Ignorable="d"
        Title="WpfEngineeringSketch - Eyeshot Edition"
        Height="600"
        Width="1000">

    <Window.InputBindings>
        <KeyBinding Key="Delete" Command="{Binding DeleteBlockCommand}"/>
    </Window.InputBindings>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- ===================== -->
        <!-- TOOL BAR              -->
        <!-- ===================== -->
        <Border Grid.Row="0"
                Background="#F0F0F0"
                Padding="10"
                BorderBrush="Gray"
                BorderThickness="0,0,0,1">
            <StackPanel Orientation="Horizontal">

                <TextBlock Text="Tools:"
                           VerticalAlignment="Center"
                           Margin="0,0,5,0"
                           FontWeight="Bold"/>

                <Button Content="Select (Gizmo)"
                        Command="{Binding SelectToolCommand}"
                        Padding="10,5"
                        Margin="0,0,5,0">
                    <Button.Style>
                        <Style TargetType="Button">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding CurrentTool.Name}" Value="Select">
                                    <Setter Property="FontWeight" Value="Bold"/>
                                    <Setter Property="Background" Value="LightBlue"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>

                <Button Content="Path Select"
                        Command="{Binding PathToolCommand}"
                        Padding="10,5"
                        Margin="0,0,5,0">
                    <Button.Style>
                        <Style TargetType="Button">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding CurrentTool.Name}" Value="Path Builder">
                                    <Setter Property="FontWeight" Value="Bold"/>
                                    <Setter Property="Background" Value="LightBlue"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>

                <Button Content="Place Block"
                        Command="{Binding PlaceToolCommand}"
                        Padding="10,5"
                        Margin="0,0,5,0">
                    <Button.Style>
                        <Style TargetType="Button">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding CurrentTool.Name}" Value="Place">
                                    <Setter Property="FontWeight" Value="Bold"/>
                                    <Setter Property="Background" Value="LightBlue"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>

                <Button Content="Move"
                        Command="{Binding MoveToolCommand}"
                        Padding="10,5"
                        Margin="0,0,5,0">
                    <Button.Style>
                        <Style TargetType="Button">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding CurrentTool.Name}" Value="Move">
                                    <Setter Property="FontWeight" Value="Bold"/>
                                    <Setter Property="Background" Value="LightBlue"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>

                <Button Content="Delete"
                        Command="{Binding DeleteBlockCommand}"
                        Padding="10,5"
                        Margin="0,0,10,0"
                        Foreground="Red"
                        FontWeight="Bold"/>

                <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
                           Margin="5,0"/>

                <TextBlock Text="Block Type:"
                           VerticalAlignment="Center"
                           Margin="0,0,5,0"/>

                <ComboBox ItemsSource="{Binding BlockTypes}"
                          SelectedItem="{Binding SelectedBlockType}"
                          Width="100"
                          Margin="0,0,10,0"/>

                <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
                           Margin="5,0"/>

                <TextBlock Text="{Binding CurrentTool.Name,
                                  StringFormat='Active Tool: {0}'}"
                           VerticalAlignment="Center"
                           FontStyle="Italic"
                           Foreground="Gray"
                           Margin="0,0,10,0"/>

                <CheckBox Content="Smart Hints"
                          IsChecked="{Binding ShowSmartPlacementHints}"
                          VerticalAlignment="Center"/>

            </StackPanel>
        </Border>

        <!-- ===================== -->
        <!-- 3D VIEWPORT           -->
        <!-- ===================== -->
        <Border Grid.Row="1"
                Background="White">

                        <!-- Eyeshot Design control -->
            <dd:Design x:Name="design1"
                       rendering:SceneBinder.ViewModel="{Binding}"
                       rendering:SceneBinder.Objects="{Binding Objects}"
                       rendering:SceneBinder.SelectedObject="{Binding SelectedObject}">
                <dd:Design.Viewports>
                    <dd:Viewport>
                        <dd:Viewport.Background>
                            <dd:BackgroundSettings TopColor="WhiteSmoke" BottomColor="LightGray"/>
                        </dd:Viewport.Background>
                        <dd:Viewport.CoordinateSystemIcon>
                            <dd:CoordinateSystemIcon Visible="True"/>
                        </dd:Viewport.CoordinateSystemIcon>
                        <dd:Viewport.ViewCubeIcon>
                            <dd:ViewCubeIcon Visible="True"/>
                        </dd:Viewport.ViewCubeIcon>
                    </dd:Viewport>
                </dd:Design.Viewports>
            </dd:Design>
        </Border>

    </Grid>
</Window>
