<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"  
    xmlns:bgc="clr-namespace:BuzzGUI.Common;assembly=BuzzGUI.Common"             
    xmlns:vsm="clr-namespace:System.Windows;assembly=BuzzGUI.Common"             
    xmlns:local="clr-namespace:BuzzGUI.MachineView;assembly=BuzzGUI.MachineView">

  <!--
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="another.xaml"/>
  </ResourceDictionary.MergedDictionaries>
-->
  
  <Style x:Key="ContainerCanvasStyle" TargetType="{x:Type Canvas}">
    <!--
      <Setter Property="Effect">
        <Setter.Value>
          <DropShadowEffect Opacity="0.8" BlurRadius="10"/>
        </Setter.Value>
      </Setter>
    -->
  </Style>

  <Style x:Key="SelectionRectangleStyle" TargetType="{x:Type Rectangle}">
    <Setter Property="RadiusX" Value="2"/>
    <Setter Property="RadiusY" Value="2"/>
    <Setter Property="Stroke">
      <Setter.Value>
        <SolidColorBrush Color="Black" Opacity="0.5"/>
      </Setter.Value>
    </Setter>
    <Setter Property="Fill">
      <Setter.Value>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
          <GradientStop Offset="0" Color="#10000000"/>
          <GradientStop Offset="1" Color="#20000000"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>
  
  <Style x:Key="BackgroundGridStyle" TargetType="{x:Type Grid}">
    <Setter Property="Background">
      <Setter.Value>
        <SolidColorBrush Color="{Binding Path=Buzz.ThemeColors[MV Background]}"/>
      </Setter.Value>
    </Setter>
  </Style>


  <LinearGradientBrush x:Key="GlassBrush" StartPoint="0,0" EndPoint="1,1" Opacity="0.5" po:Freeze="True">
    <GradientStop Color="WhiteSmoke" Offset="0.2" />
    <GradientStop Color="Transparent" Offset="0.4" />
    <GradientStop Color="WhiteSmoke" Offset="0.5" />
    <GradientStop Color="Transparent" Offset="0.75" />
    <GradientStop Color="WhiteSmoke" Offset="0.9" />
    <GradientStop Color="Transparent" Offset="1" />
  </LinearGradientBrush>

  <LinearGradientBrush x:Key="MouseOverBrush" StartPoint="0,0" EndPoint="0,1">
    <GradientStop Color="White" Offset="0.0"/>
    <GradientStop Color="LightSkyBlue"  Offset="1.0"/>
  </LinearGradientBrush>


  <Style x:Key="MachineConnectionTriangleStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Control}">

          <Polygon Name="polygon" Points="0,-9 -10,9 10,9" Stroke="Black" StrokeThickness="1" Fill="White"/>
          
          <!--
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="polygon" Property="Fill" Value="{StaticResource MouseOverBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
-->
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MachineConnectionPathStyle" TargetType="{x:Type Shape}">
    <Setter Property="IsHitTestVisible" Value="False"/>
    <Setter Property="StrokeThickness" Value="1"/>
    <Setter Property="Stroke" Value="Black"/>
  </Style>

  <Style x:Key="PlugStyle" TargetType="{x:Type Control}">
    <Setter Property="Width" Value="12"/>
    <Setter Property="Height" Value="12"/>
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Control}">
          <Grid>
            <Ellipse Name="ellipse" Fill="White" Stroke="Black" StrokeThickness="1.2"/>
            <TextBlock Visibility="Collapsed" FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Center">1</TextBlock>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="ellipse" Property="Fill" Value="{StaticResource MouseOverBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>


  <Style TargetType="{x:Type local:MachineControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type local:MachineControl}">
          <Grid Name="Root">
            <Border Name="Border" Width="100" Height="50" BorderBrush="Black" BorderThickness="1" CornerRadius="0" SnapsToDevicePixels="True">
              <Grid Name="grid" SnapsToDevicePixels="True">

                <TextBlock Text="{Binding Path=Machine.Name}" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Arial" FontSize="13">
                  <TextBlock.Foreground>
                    <SolidColorBrush Color="{Binding Path=Machine.Graph.Buzz.ThemeColors[MV Machine Text]}"/>
                  </TextBlock.Foreground>
                </TextBlock>

                <!--
                <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center">
                  <bgc:Knob Width="16" Height="16" Margin="0"/>
                  <bgc:Knob Width="16" Height="16" Margin="0"/>
                  <bgc:Knob Width="16" Height="16" Margin="0"/>
                  <bgc:Knob Width="16" Height="16" Margin="0"/>
                  <bgc:Knob Width="16" Height="16" Margin="0"/>
                  <bgc:Knob Width="16" Height="16" Margin="0"/>
                </StackPanel>
                -->
              </Grid>

            </Border>

            <Border Name="SelectionVisual" IsHitTestVisible="False" SnapsToDevicePixels="True" Visibility="Collapsed" CornerRadius="0" Background="{StaticResource GlassBrush}"/>

          </Grid>
          
          <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
              <Setter TargetName="SelectionVisual" Property="Visibility" Value="Visible"/>
            </DataTrigger>

            
            <DataTrigger Binding="{Binding Path=Machine.DLL.Info.Type}" Value="Master">
              <Setter TargetName="Border" Property="Background">
                <Setter.Value>
                  <SolidColorBrush Color="{Binding Path=Machine.Graph.Buzz.ThemeColors[MV Master]}"/>
                </Setter.Value>
              </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=Machine.DLL.Info.Type}" Value="Generator">
              <Setter TargetName="Border" Property="Background">
                <Setter.Value>
                  <SolidColorBrush Color="{Binding Path=Machine.Graph.Buzz.ThemeColors[MV Generator]}"/>
                </Setter.Value>
              </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=Machine.DLL.Info.Type}" Value="Effect">
              <Setter TargetName="Border" Property="Background">
                <Setter.Value>
                  <SolidColorBrush Color="{Binding Path=Machine.Graph.Buzz.ThemeColors[MV Effect]}"/>
                </Setter.Value>
              </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=Machine.IsControlMachine}" Value="True">
              <Setter TargetName="Border" Property="Background">
                <Setter.Value>
                  <SolidColorBrush Color="{Binding Path=Machine.Graph.Buzz.ThemeColors[MV Control]}"/>
                </Setter.Value>
              </Setter>
            </DataTrigger>
          </ControlTemplate.Triggers>
          
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ConnectionAmpControlStyle" TargetType="{x:Type local:AmpControl}">
    <Style.Resources>
      <Style TargetType="{x:Type Border}">
        <Setter Property="Padding" Value="4"/>
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="CornerRadius" Value="0"/>
        <Setter Property="Background">
          <Setter.Value>
            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
              <GradientStop Offset="0" Color="#60000000"/>
              <GradientStop Offset="1" Color="#70000000"/>
<!--
              <GradientStop Offset="0" Color="#DD4682B4"/>
-->
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
      </Style>
      <Style TargetType="{x:Type Grid}">
<!--
        <Setter Property="Effect">
          <Setter.Value>
            <DropShadowEffect BlurRadius="0" ShadowDepth="2"/>
          </Setter.Value>
        </Setter>
-->
      </Style>
      <Style TargetType="{x:Type bgc:Knob}">
        <Setter Property="Width" Value="24"/>
        <Setter Property="Height" Value="24"/>
      </Style>
      <Style TargetType="{x:Type TextBlock}">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="Foreground" Value="White"/>
      </Style>
      <Style TargetType="{x:Type Viewbox}">
        <Setter Property="Width" Value="50"/>
        <Setter Property="MaxHeight" Value="16"/>
      </Style>


    </Style.Resources>    
  </Style>

  <Style x:Key="SimpleButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
  </Style>

  <Style x:Key="InsertButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource SimpleButtonStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Image Name="image" Width="38" Source="mv/InsertButtonOrange.png"/>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="image" Property="Source" Value="mv/InsertButtonOrangeGlow.png"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="DisconnectButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource SimpleButtonStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Image Name="image" Width="38" Source="mv/DisconnectButtonOrange.png"/>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="image" Property="Source" Value="mv/DisconnectButtonOrangeGlow.png"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>


</ResourceDictionary>