math-suite/Source/Calculator/MainWindow.xaml

299 lines
15 KiB
Plaintext
Raw Permalink Normal View History

2018-02-05 23:24:46 +00:00
<Window x:Class="Calculator.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Calculator" Height="330" Width="555"
MinHeight="290" MinWidth="455"
MaxHeight="360" MaxWidth="700"
WindowStyle="SingleBorderWindow" KeyDown="Window_KeyDown"
Icon="/Calculator;component/Images/calculator-logo.png">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="Calc2ndF" TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="0,2,0,0" />
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="Gray" />
</Style>
</ResourceDictionary>
<ResourceDictionary Source="Styles\Buttons.xaml" />
<ResourceDictionary Source="Styles\Display.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Window.Background>
<RadialGradientBrush GradientOrigin=".5, 1"
Center=".5, .6">
<GradientStop Color="#606060" Offset="0" />
<GradientStop Color="#333" Offset="1" />
</RadialGradientBrush>
</Window.Background>
<Grid Margin="2">
<Grid.RowDefinitions>
<RowDefinition Tag="Input" Height="Auto" />
<RowDefinition Tag="Mods" Height="Auto" />
<RowDefinition Tag="Secondf" Height="Auto" />
<RowDefinition Tag="Buttons" />
<RowDefinition Tag="Secondf" Height="Auto" />
<RowDefinition Tag="Buttons" />
<RowDefinition Tag="Secondf" Height="Auto" />
<RowDefinition Tag="Buttons" />
<RowDefinition Tag="Secondf" Height="Auto" />
<RowDefinition Tag="Buttons" />
<RowDefinition Tag="Secondf" Height="Auto" />
<RowDefinition Tag="Buttons" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="10" Tag="Separator"/>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- Menu strip -->
<!-- Display -->
<TextBox Name="Display" Grid.Column="0"
Grid.ColumnSpan="100"
Height="44" Text="0"
Focusable="False"
Style="{StaticResource DisplayStyle}" />
<StackPanel HorizontalAlignment="Left" Width="30"
Margin="2">
<Border Style="{StaticResource DisplayIndicatorStyle}" Margin="1"
Name="Indicator2ndf">
<TextBlock HorizontalAlignment="Center" Foreground="#555" FontSize="9">2ndf</TextBlock>
</Border>
<Border Style="{StaticResource DisplayIndicatorStyle}" Margin="1,0,1,1"
Name="IndicatorMem">
<TextBlock HorizontalAlignment="Center" Foreground="#555" FontSize="9">Mem</TextBlock>
</Border>
<Border Style="{StaticResource DisplayIndicatorStyle}" Margin="1,0,1,1"
Name="IndicatorError">
<TextBlock HorizontalAlignment="Center" Foreground="#555" FontSize="9">Error</TextBlock>
</Border>
</StackPanel>
<!-- Column 1 (scientific) functionality -->
<Button Name="B2ndf" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="0"
ToolTip="Activates second function.">2ndf
</Button>
<TextBlock Grid.Row="4" Grid.Column="0"
Style="{StaticResource Calc2ndF}">{x}</TextBlock>
<Button Name="BInt" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="5" Grid.Column="0"
ToolTip="Integral portion&#x0a;2ndf: Fractional portion">[x]</Button>
<TextBlock Grid.Row="6" Grid.Column="0"
Style="{StaticResource Calc2ndF}">arcsin</TextBlock>
<Button Name="BSin" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="7" Grid.Column="0"
ToolTip="Sine&#x0a;2ndf: arcsin">sin</Button>
<TextBlock Grid.Row="8" Grid.Column="0"
Style="{StaticResource Calc2ndF}">arcsinh</TextBlock>
<Button Name="BSinh" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="9" Grid.Column="0"
ToolTip="Hyperbolic sine&#x0a;2ndf: Hyperbolic arcsin">sinh</Button>
<TextBlock Grid.Row="10" Grid.Column="0"
Style="{StaticResource Calc2ndF}">2π</TextBlock>
<Button Name="BPi" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="11" Grid.Column="0"
ToolTip="Pi constant&#x0a;2ndf: 2Pi constant">π</Button>
<!-- Column 2 (scientific) functionality -->
<TextBlock Grid.Row="2" Grid.Column="1"
Style="{StaticResource Calc2ndF}">eⁿ</TextBlock>
<Button Name="BLn" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="1"
ToolTip="Natural logarithm&#x0a;2ndf: e at nth power">ln</Button>
<TextBlock Grid.Row="4" Grid.Column="1"
Style="{StaticResource Calc2ndF}">-Abs</TextBlock>
<Button Name="BAbs" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="5" Grid.Column="1"
ToolTip="Absolute&#x0a;2ndf: Reverse absolute">Abs</Button>
<TextBlock Grid.Row="6" Grid.Column="1"
Style="{StaticResource Calc2ndF}">arccos</TextBlock>
<Button Name="BCos" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="7" Grid.Column="1"
ToolTip="Cosine&#x0a;2ndf: arccos">cos</Button>
<TextBlock Grid.Row="8" Grid.Column="1"
Style="{StaticResource Calc2ndF}">arccosh</TextBlock>
<Button Name="BCosh" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="9" Grid.Column="1"
ToolTip="Hyperbolic cosine&#x0a;2ndf: Hyperbolic arccos">cosh</Button>
<Button Name="BE" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="11" Grid.Column="1"
ToolTip="e constant">e</Button>
<!-- Column 3 (scientific) functionality -->
<TextBlock Grid.Row="2" Grid.Column="2"
Style="{StaticResource Calc2ndF}">10ⁿ</TextBlock>
<Button Name="BLog" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="2"
ToolTip="Decimal logarithm&#x0a;2ndf: 10 at nth power">log</Button>
<Button Name="BInverse" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="5" Grid.Column="2"
ToolTip="Inverse">1/x</Button>
<TextBlock Grid.Row="6" Grid.Column="2"
Style="{StaticResource Calc2ndF}">arctan</TextBlock>
<Button Name="BTan" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="7" Grid.Column="2"
ToolTip="Tangent&#x0a;2ndf: arctan">tan</Button>
<TextBlock Grid.Row="8" Grid.Column="2"
Style="{StaticResource Calc2ndF}">arctanh</TextBlock>
<Button Name="BTanh" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="9" Grid.Column="2"
ToolTip="Hyperbolic tangent&#x0a;2ndf: Hyperbolic arctan">tanh</Button>
<TextBlock Grid.Row="10" Grid.Column="2"
Style="{StaticResource Calc2ndF}">xPy</TextBlock>
<Button Name="BCombinations" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="11" Grid.Column="2"
ToolTip="Combinations of y items from x&#x0a;2ndf: Permutations of y items from x">xCy</Button>
<!-- Column 4 (scientific) functionality -->
<Button Name="BLogn" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="3"
ToolTip="Logarithm with base n">
<TextBlock>log<Run BaselineAlignment="Subscript">n</Run> x</TextBlock>
</Button>
<TextBlock Grid.Row="4" Grid.Column="3"
Style="{StaticResource Calc2ndF}">ⁿ√x</TextBlock>
<Button Name="BPown" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="5" Grid.Column="3"
ToolTip="nth power&#x0a;2ndf: nth root">xⁿ</Button>
<TextBlock Grid.Row="6" Grid.Column="3"
Style="{StaticResource Calc2ndF}">√x</TextBlock>
<Button Name="BSquare" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="7" Grid.Column="3"
ToolTip="Square&#x0a;2ndf: Square root">x²</Button>
<TextBlock Grid.Row="8" Grid.Column="3"
Style="{StaticResource Calc2ndF}">∛x</TextBlock>
<Button Name="BCube" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="9" Grid.Column="3"
ToolTip="Cube&#x0a;2ndf: Cube root">x³</Button>
<Button Name="BFact" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="11" Grid.Column="3"
ToolTip="Factorial">x!</Button>
<!-- Column 5 (Memory ops) -->
<TextBlock Grid.Row="2" Grid.Column="5" Style="{StaticResource Calc2ndF}">Add</TextBlock>
<Button Name="BMemAdd" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="5"
ToolTip="Adds to memory">M+</Button>
<TextBlock Grid.Row="4" Grid.Column="5" Style="{StaticResource Calc2ndF}">Subtract</TextBlock>
<Button Name="BMemSub" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="5" Grid.Column="5"
ToolTip="Subtracts from memory">M-</Button>
<TextBlock Grid.Row="6" Grid.Column="5" Style="{StaticResource Calc2ndF}">Clear</TextBlock>
<Button Name="BMemClear" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="7" Grid.Column="5"
ToolTip="Clears the memory">MC</Button>
<TextBlock Grid.Row="8" Grid.Column="5" Style="{StaticResource Calc2ndF}">Set</TextBlock>
<Button Name="BMemSet" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="9" Grid.Column="5"
ToolTip="Replace the memory content">MS</Button>
<TextBlock Grid.Row="10" Grid.Column="5" Style="{StaticResource Calc2ndF}">Recall</TextBlock>
<Button Name="BMemRecall" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="11" Grid.Column="5"
ToolTip="Displays number from memory">MR</Button>
<!-- Column 6 (Numbers) -->
<Button Name="BNum7" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="4" Grid.Column="6" Grid.RowSpan="2"
Style="{StaticResource BigButton}">7</Button>
<Button Name="BNum4" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="6" Grid.Column="6" Grid.RowSpan="2"
Style="{StaticResource BigButton}">4</Button>
<Button Name="BNum1" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="8" Grid.Column="6" Grid.RowSpan="2"
Style="{StaticResource BigButton}">1</Button>
<Button Name="BNum0" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="10" Grid.Column="6" Grid.RowSpan="2" Grid.ColumnSpan="2"
Style="{StaticResource BigButton}">0</Button>
<!-- Column 7 (Numbers) -->
<Button Name="BHelp" Grid.Row="3" Grid.Column="7"
Margin="6,4,6,4"
Style="{StaticResource BigButton}"
FontSize="11" Click="BHelp_Click"
ToolTip="Get help using the application. (Keyboard shortcut: F1)">Help</Button>
<Button Name="BNum8" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="4" Grid.Column="7" Grid.RowSpan="2"
Style="{StaticResource BigButton}">8</Button>
<Button Name="BNum5" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="6" Grid.Column="7" Grid.RowSpan="2"
Style="{StaticResource BigButton}">5</Button>
<Button Name="BNum2" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="8" Grid.Column="7" Grid.RowSpan="2"
Style="{StaticResource BigButton}">2</Button>
<!-- Column 8 (Numbers) -->
<Button Name="BBackspace" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="8"
ToolTip="Backspace" >Back</Button>
<Button Name="BNum9" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="4" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">9</Button>
<Button Name="BNum6" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="6" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">6</Button>
<Button Name="BNum3" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="8" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">3</Button>
<Button Name="BPeriod" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="10" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">.</Button>
<!-- Column 9 (Operations) -->
<Button Name="BClear" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="9"
ToolTip="Clears the current number">Clear</Button>
<Button Name="BOpDivide" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="4" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">/</Button>
<Button Name="BOpMultiply" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="6" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">*</Button>
<Button Name="BOpSub" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="8" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">-</Button>
<Button Name="BOpAdd" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="10" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">+</Button>
<!-- Column 10 (Operations) -->
<Button Name="BClearAC" MouseUp="Button_MouseUp" Click="Button_Click"
Grid.Row="3" Grid.Column="10"
ToolTip="Clears the entire calculation">AC</Button>
<Button Name="BOpMod" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="4" Grid.RowSpan="2" Grid.Column="10" Style="{StaticResource BigButton}">MOD</Button>
<Button Name="BOpSign" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="6" Grid.RowSpan="2" Grid.Column="10" Style="{StaticResource BigButton}">±</Button>
<Button Name="BEqual" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="8" Grid.Column="10" Grid.RowSpan="4" Style="{StaticResource BigButton}">=</Button>
</Grid>
</Window>