Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Overhauled version
Browse files Browse the repository at this point in the history
  • Loading branch information
carlthome committed Aug 31, 2014
1 parent f825eed commit 440f9d5
Show file tree
Hide file tree
Showing 26 changed files with 870 additions and 499 deletions.
22 changes: 20 additions & 2 deletions EyePaint/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="EyePaint.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="EyePaint.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
Expand All @@ -26,14 +26,32 @@
<value>10</value>
</setting>
<setting name="Stability" serializeAs="String">
<value>30</value>
<value>10</value>
</setting>
<setting name="Blink" serializeAs="String">
<value>30</value>
</setting>
<setting name="Inertia" serializeAs="String">
<value>100</value>
</setting>
<setting name="ConnectionAttempts" serializeAs="String">
<value>10</value>
</setting>
<setting name="FlickrVerificationCode" serializeAs="String">
<value />
</setting>
<setting name="FlickrPhotoset" serializeAs="String">
<value>Måla med ögonen</value>
</setting>
<setting name="FlickrTitle" serializeAs="String">
<value>Målning med ögonen</value>
</setting>
<setting name="FlickrDescription" serializeAs="String">
<value>En målning gjord med ögonen.</value>
</setting>
<setting name="FlickrTags" serializeAs="String">
<value />
</setting>
</EyePaint.Properties.Settings>
</userSettings>
</configuration>
99 changes: 56 additions & 43 deletions EyePaint/App.xaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
<Application x:Class="EyePaint.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="onStartup">
Startup="onStartup"
ShutdownMode="OnExplicitShutdown">
<Application.Resources>
<Storyboard x:Key="GazeWindowVisibleStoryboard">
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.1" To="1" Duration="0:0:2">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
<Style x:Key="GazeWindow" TargetType="Window">
<Setter Property="Background" Value="Black" />
<Setter Property="Cursor" Value="None" />
<Setter Property="ResizeMode" Value="NoResize" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="WindowState" Value="Maximized" />
<Setter Property="IsEnabled" Value="False"/>
<!--TODO <Setter Property="IsEnabled" Value="{Binding Path=Tracking, Source={StaticResource AppProperties}}" />-->
<Setter Property="Cursor" Value="None"/>
<Setter Property="ResizeMode" Value="NoResize"/>
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="WindowState" Value="Maximized"/>
<Setter Property="Topmost" Value="True"/>
<Setter Property="IsEnabled" Value="{Binding Path=Globals.Tracking, Mode=OneWay, Source={x:Static Application.Current}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Window">
<ControlTemplate.Triggers>
<Trigger Property="Window.IsEnabled" Value="False">
<Setter Property="Window.Effect">
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<StaticResource ResourceKey="GazeWindowVisibleStoryboard"/>
</BeginStoryboard>
</EventTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Effect">
<Setter.Value>
<BlurEffect Radius="5" KernelType="Box"/>
</Setter.Value>
</Setter>
<Trigger.EnterActions>
<BeginStoryboard Name="InactivityAnimation">
<Storyboard Completed="onInactivity"><!-- TODO -->
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:15">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="InactivityAnimation"/>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
<Grid Background="{TemplateBinding Background}">
Expand All @@ -44,57 +42,72 @@
</Setter.Value>
</Setter>
</Style>
<Storyboard x:Key="GazeClickStoryboard" CurrentTimeInvalidated="onGazeClick" RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY" To="0" Duration="0:0:2">
<Storyboard x:Key="GazeButtonFocusedStoryboard" CurrentTimeInvalidated="onGazeButtonFocused" RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX" To="0" Duration="0:0:2">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX" To="0" Duration="0:0:2">
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY" To="0" Duration="0:0:2">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="CancelGazeClickStoryboard">
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY" To="1" />
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX" To="1" />
<Storyboard x:Key="GazeButtonBlurredStoryboard">
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX" To="1"/>
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY" To="1"/>
</Storyboard>
<Storyboard x:Key="GazeButtonTouchedStoryboard" Completed="onGazeButtonTouched">
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX" To="0"/>
<DoubleAnimation Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY" To="0"/>
</Storyboard>
<ControlTemplate x:Key="GazeButton" TargetType="Button">
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.9" />
<Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}" />
<Setter Property="Opacity" Value="0.9"/>
<Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Opacity" Value="0.5" />
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard Name="GazeButtonAnimation">
<StaticResource ResourceKey="GazeClickStoryboard"/>
<BeginStoryboard Name="GazeButtonFocusedBeginStoryboard">
<StaticResource ResourceKey="GazeButtonFocusedStoryboard"/>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Button.Click">
<StopStoryboard BeginStoryboardName="GazeButtonAnimation" />
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<StaticResource ResourceKey="CancelGazeClickStoryboard"/>
<StaticResource ResourceKey="GazeButtonBlurredStoryboard"/>
</BeginStoryboard>
<StopStoryboard BeginStoryboardName="GazeButtonFocusedBeginStoryboard"/>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseDown">
<StopStoryboard BeginStoryboardName="GazeButtonFocusedBeginStoryboard"/>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewTouchDown">
<BeginStoryboard>
<StaticResource ResourceKey="GazeButtonTouchedStoryboard"/>
</BeginStoryboard>
<StopStoryboard BeginStoryboardName="GazeButtonAnimation" />
<StopStoryboard BeginStoryboardName="GazeButtonFocusedBeginStoryboard"/>
</EventTrigger>
</ControlTemplate.Triggers>
<Grid Background="Transparent">
<Grid RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<ScaleTransform x:Name="ScaleTransform" ScaleY="1" ScaleX="1" />
<ScaleTransform x:Name="ScaleTransform" ScaleY="1" ScaleX="1"/>
</Grid.RenderTransform>
<Grid.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="5"/>
<DropShadowEffect ShadowDepth="1" BlurRadius="0"/>
</Grid.Effect>
<Border CornerRadius="9999" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Foreground}" BorderThickness="10">
<Ellipse Name="Mask" Fill="{TemplateBinding Foreground}"/>
<Border Background="{TemplateBinding Background}" ClipToBounds="True">
<Border.OpacityMask>
<VisualBrush Visual="{Binding ElementName=Mask}"/>
</Border.OpacityMask>
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<Ellipse Stroke="{TemplateBinding Foreground}" StrokeThickness="10"/>
</Grid>
</Grid>
</ControlTemplate>
Expand Down
Loading

0 comments on commit 440f9d5

Please sign in to comment.