|
1 |
| -<Window x:Class="FloatingPointPlayground.MainWindow" |
| 1 | +<!-- |
| 2 | +Copyright (C) 2019 Dwscdv3 <[email protected]> |
| 3 | +
|
| 4 | +This program is free software: you can redistribute it and/or modify |
| 5 | +it under the terms of the GNU General Public License as published by |
| 6 | +the Free Software Foundation, either version 3 of the License, or |
| 7 | +(at your option) any later version. |
| 8 | +
|
| 9 | +This program is distributed in the hope that it will be useful, |
| 10 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +GNU General Public License for more details. |
| 13 | +
|
| 14 | +You should have received a copy of the GNU General Public License |
| 15 | +along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | +--> |
| 17 | + |
| 18 | +<Window x:Class="FloatingPointPlayground.MainWindow" |
2 | 19 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
3 | 20 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
4 |
| - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
5 |
| - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
6 |
| - xmlns:local="clr-namespace:FloatingPointPlayground" |
7 |
| - mc:Ignorable="d" |
8 |
| - Title="MainWindow" Height="450" Width="800"> |
9 |
| - <Grid> |
10 |
| - |
11 |
| - </Grid> |
| 21 | + xmlns:user="clr-namespace:FloatingPointPlayground.UserControls" |
| 22 | + xmlns:shape="clr-namespace:FloatingPointPlayground.Shapes" |
| 23 | + Title="Floating-point playground" |
| 24 | + Width="800" MinWidth="800" MinHeight="300" SizeToContent="Height"> |
| 25 | + <StackPanel x:Name="layoutRoot" Margin="10"> |
| 26 | + <VisualStateManager.VisualStateGroups> |
| 27 | + <VisualStateGroup x:Name="FloatInputGroup"> |
| 28 | + <VisualStateGroup.Transitions> |
| 29 | + <VisualTransition GeneratedDuration="0:0:0.1" To="ParseError"/> |
| 30 | + <VisualTransition From="ParseError" GeneratedDuration="0:0:0.1"/> |
| 31 | + </VisualStateGroup.Transitions> |
| 32 | + <VisualState x:Name="Default"/> |
| 33 | + <VisualState x:Name="ParseError"> |
| 34 | + <Storyboard> |
| 35 | + <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="txtFloat"> |
| 36 | + <EasingColorKeyFrame KeyTime="0" Value="#FFFF7F7F"/> |
| 37 | + </ColorAnimationUsingKeyFrames> |
| 38 | + </Storyboard> |
| 39 | + </VisualState> |
| 40 | + </VisualStateGroup> |
| 41 | + </VisualStateManager.VisualStateGroups> |
| 42 | + <StackPanel HorizontalAlignment="Left" Margin="10,0"> |
| 43 | + <TextBlock Text="Single-Precision" FontSize="36" Foreground="CadetBlue"/> |
| 44 | + <Rectangle StrokeThickness="3" Stroke="CadetBlue" Margin="0,5,0,0"/> |
| 45 | + </StackPanel> |
| 46 | + <StackPanel Margin="10,10"> |
| 47 | + <Viewbox VerticalAlignment="Center"> |
| 48 | + <StackPanel x:Name="flippersContainer" Orientation="Horizontal" user:BitFlipper.Click="OnBitFlipperClick"> |
| 49 | + <user:BitFlipper/> |
| 50 | + <user:BitFlipper/> |
| 51 | + <user:BitFlipper/> |
| 52 | + <user:BitFlipper/> |
| 53 | + <user:BitFlipper/> |
| 54 | + <user:BitFlipper/> |
| 55 | + <user:BitFlipper/> |
| 56 | + <user:BitFlipper/> |
| 57 | + <user:BitFlipper/> |
| 58 | + <user:BitFlipper/> |
| 59 | + <user:BitFlipper/> |
| 60 | + <user:BitFlipper/> |
| 61 | + <user:BitFlipper/> |
| 62 | + <user:BitFlipper/> |
| 63 | + <user:BitFlipper/> |
| 64 | + <user:BitFlipper/> |
| 65 | + <user:BitFlipper/> |
| 66 | + <user:BitFlipper/> |
| 67 | + <user:BitFlipper/> |
| 68 | + <user:BitFlipper/> |
| 69 | + <user:BitFlipper/> |
| 70 | + <user:BitFlipper/> |
| 71 | + <user:BitFlipper/> |
| 72 | + <user:BitFlipper/> |
| 73 | + <user:BitFlipper/> |
| 74 | + <user:BitFlipper/> |
| 75 | + <user:BitFlipper/> |
| 76 | + <user:BitFlipper/> |
| 77 | + <user:BitFlipper/> |
| 78 | + <user:BitFlipper/> |
| 79 | + <user:BitFlipper/> |
| 80 | + <user:BitFlipper/> |
| 81 | + </StackPanel> |
| 82 | + </Viewbox> |
| 83 | + <Grid Height="40"> |
| 84 | + <Grid.RowDefinitions> |
| 85 | + <RowDefinition/> |
| 86 | + <RowDefinition/> |
| 87 | + </Grid.RowDefinitions> |
| 88 | + <Grid.ColumnDefinitions> |
| 89 | + <ColumnDefinition Width="0.5*"/> |
| 90 | + <ColumnDefinition Width="0.5*"/> |
| 91 | + <ColumnDefinition Width="0.5*"/> |
| 92 | + <ColumnDefinition Width="7*"/> |
| 93 | + <ColumnDefinition Width="1*"/> |
| 94 | + <ColumnDefinition Width="22*"/> |
| 95 | + <ColumnDefinition Width="0.5*"/> |
| 96 | + </Grid.ColumnDefinitions> |
| 97 | + <Grid.Resources> |
| 98 | + <Style TargetType="TextBlock"> |
| 99 | + <Setter Property="HorizontalAlignment" Value="Center"/> |
| 100 | + </Style> |
| 101 | + </Grid.Resources> |
| 102 | + <Rectangle Grid.Column="1" HorizontalAlignment="Left" Stroke="Black"/> |
| 103 | + <shape:Bracket Grid.Column="3"/> |
| 104 | + <shape:Bracket Grid.Column="5"/> |
| 105 | + <TextBlock Text="Sign" Grid.Row="1" Grid.ColumnSpan="2"/> |
| 106 | + <TextBlock Text="Exponent" Grid.Row="1" Grid.Column="3"/> |
| 107 | + <TextBlock Text="Fraction" Grid.Row="1" Grid.Column="5"/> |
| 108 | + </Grid> |
| 109 | + </StackPanel> |
| 110 | + <Grid HorizontalAlignment="Center" Margin="0,0,0,10"> |
| 111 | + <Grid.RowDefinitions> |
| 112 | + <RowDefinition/> |
| 113 | + <RowDefinition/> |
| 114 | + <RowDefinition/> |
| 115 | + </Grid.RowDefinitions> |
| 116 | + <Grid.ColumnDefinitions> |
| 117 | + <ColumnDefinition MinWidth="130"/> |
| 118 | + <ColumnDefinition/> |
| 119 | + </Grid.ColumnDefinitions> |
| 120 | + <Grid.Resources> |
| 121 | + <Style TargetType="TextBlock"> |
| 122 | + <Style.Triggers> |
| 123 | + <Trigger Property="Grid.Row" Value="0"> |
| 124 | + <Setter Property="FontSize" Value="18"/> |
| 125 | + </Trigger> |
| 126 | + <Trigger Property="Grid.Column" Value="0"> |
| 127 | + <Setter Property="HorizontalAlignment" Value="Right"/> |
| 128 | + </Trigger> |
| 129 | + <Trigger Property="Grid.Column" Value="1"> |
| 130 | + <Setter Property="Opacity" Value="0.75"/> |
| 131 | + <Setter Property="Margin" Value="5,0,0,0"/> |
| 132 | + </Trigger> |
| 133 | + </Style.Triggers> |
| 134 | + </Style> |
| 135 | + </Grid.Resources> |
| 136 | + <TextBox x:Name="txtFloat" Grid.Row="0" |
| 137 | + HorizontalContentAlignment="Right" |
| 138 | + FontSize="18" |
| 139 | + Margin="0,0,0,5" BorderThickness="0,0,0,2" Background="#00FF7F7F" |
| 140 | + TextChanged="OnFloatInput"/> |
| 141 | + <TextBlock x:Name="txtInt" Grid.Row="1"/> |
| 142 | + <TextBlock x:Name="txtIntHex" Grid.Row="2"/> |
| 143 | + <TextBlock Grid.Row="0" Grid.Column="1" Text="(as float)"/> |
| 144 | + <TextBlock Grid.Row="1" Grid.Column="1" Text="(as integer in decimal)"/> |
| 145 | + <TextBlock Grid.Row="2" Grid.Column="1" Text="(as integer in hex)"/> |
| 146 | + </Grid> |
| 147 | + </StackPanel> |
12 | 148 | </Window>
|
0 commit comments