Compare commits

...
2 Commits
Author SHA1 Message Date
John Colvin e9fdbc2acd ui (refactor): Consolidate (Repeat)Button colors to one class
The only difference between a RepeatButton and a regular Button is in
the click-behavior (they should look identical).
2022-12-12 11:47:20 -05:00
John Colvin a50e0cfc26 fix: Add a couple null checks 2022-12-12 11:01:01 -05:00
7 changed files with 35 additions and 32 deletions

No files matched your search

+13 -11
View File
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using mbts.analytics;
using bts.api;
using mbts.ui;
using MathNet.Numerics.Providers.FourierTransform;
using BCG;
using System.Windows.Automation;
using bts.collections;
namespace mbts.spark {
using bts.api;
using System;
using System.Collections.Generic;
using System.Linq;
// A lot of options data (migrated from edge) is not normalized
// on the sec_id, but rather on a combination of symbol, exp, strike.
@@ -20,6 +16,9 @@ namespace mbts.spark {
public static IDictionary<UInt32, DriverMD> normalize_drivers(
OptionDriverPriceMap driver_map, SystemContractData sc_data) {
if (driver_map is null) {
return new Dictionary<uint, DriverMD>(0);
}
Dictionary<UInt32, DriverMD> rv = new Dictionary<uint, DriverMD>();
foreach (var kv in driver_map.get_price_map()) {
var exp = kv.Key;
@@ -40,6 +39,9 @@ namespace mbts.spark {
}
public static IEnumerable<Tuple<SecurityImmutable, TheoPoint>> normalize_interp_theos(
OptionTheoInterpolationData symbol_theos, SystemContractData sc_data) {
if (symbol_theos is null) {
return Enumerable.Empty<Tuple<SecurityImmutable, TheoPoint>>();
}
var rv = new List<Tuple<SecurityImmutable, TheoPoint>>();
foreach (DateTime exp in symbol_theos.get_expirations()) {
Dictionary<double, Dictionary<double, TheoPoint>> exp_data =
@@ -65,4 +67,4 @@ namespace mbts.spark {
return rv;
}
}
}
}
@@ -44,10 +44,11 @@
<Setter Property="Margin" Value="{StaticResource PanelItem.MarginT}" />
</Style>
<Style x:Key="PanelItem.TickUpDown.Parameterless" TargetType="c:TickUpDown">
<Style x:Key="PanelItem.TickUpDown.Parameterless" TargetType="c:TickUpDown" BasedOn="{StaticResource {x:Type c:TickUpDown}}">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Margin" Value="{StaticResource PanelItem.MarginT}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{u:BTSBrush UI.default_text}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="TickUpCommandParameter" Value="{u:True}" />
<Setter Property="TickDownCommandParameter" Value="{u:False}" />
-4
View File
@@ -61,10 +61,6 @@
<Setter Property="Background" Value="{u:BTSBrush UI.ScrollBar.background}"/>
<Setter Property="Foreground" Value="{u:BTSBrush UI.ScrollBar.foreground}"/>
</Style>
<Style TargetType="RepeatButton">
<Setter Property="Background" Value="{u:BTSBrush UI.RepeatButton.background}"/>
<Setter Property="Foreground" Value="{u:BTSBrush UI.RepeatButton.foreground}"/>
</Style>
<Style TargetType="StatusBar">
<Setter Property="Background" Value="{u:BTSBrush UI.StatusBar.background}"/>
</Style>
@@ -904,11 +904,7 @@ namespace mbts.ui {
public static BTSColor background => UI.default_background;
public static BTSColor foreground => thumb_static;//UI.default_text;
}
public static class RepeatButton {
public static BTSColor background => UI.default_background;
public static BTSColor foreground => UI.black;
public static BTSColor border => UI.default_text;
}
public static class StatusBarItem {
public static BTSColor foreground => UI.default_text;
}
@@ -8,6 +8,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/view/Colors.xaml" />
<ResourceDictionary Source="/view/Resources/Converters.xaml" />
<ResourceDictionary Source="/view/Resources/Buttons.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type c:TickUpDown}">
@@ -55,8 +56,8 @@
<Path
HorizontalAlignment="Right"
VerticalAlignment="Center"
Fill="{u:BTSBrush UI.RepeatButton.foreground}"
Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}"
RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<RotateTransform Angle="180" />
@@ -67,7 +68,7 @@
<Path
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{u:BTSBrush UI.RepeatButton.foreground}"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}"
Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" />
</RepeatButton>
</Grid>
@@ -110,16 +111,23 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
/>
<RepeatButton Command="{TemplateBinding TickUpCommand}" CommandParameter="{TemplateBinding TickUpCommandParameter}" BorderThickness="0" Focusable="False" Visibility="Hidden">
<Path Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z"
Fill="{u:BTSBrush UI.RepeatButton.foreground}" HorizontalAlignment="Right" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Path
HorizontalAlignment="Right"
VerticalAlignment="Center"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}"
RenderTransformOrigin="0.5,0.5"
Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z">
<Path.RenderTransform>
<RotateTransform Angle="180" />
</Path.RenderTransform>
</Path>
</RepeatButton>
<RepeatButton Command="{TemplateBinding TickDownCommand}" CommandParameter="{TemplateBinding TickDownCommandParameter}" BorderThickness="0" Focusable="False" Visibility="Hidden">
<Path Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z"
Fill="{u:BTSBrush UI.RepeatButton.foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Path
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}"
Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" />
</RepeatButton>
</Grid>
</Border>
@@ -30,7 +30,7 @@
>
<Path
Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z"
Fill="#FF606060"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
RenderTransformOrigin="0.5,0.5"
@@ -52,7 +52,7 @@
>
<Path
Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z"
Fill="#FF606060"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=RepeatButton}}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
/>
+3 -3
View File
@@ -551,9 +551,9 @@
</Style>
<Style TargetType="RepeatButton">
<Setter Property="Foreground" Value="{u:BTSBrush UI.RepeatButton.foreground}" />
<Setter Property="Background" Value="{u:BTSBrush UI.RepeatButton.background}" />
<Setter Property="BorderBrush" Value="{u:BTSBrush UI.RepeatButton.border}" />
<Setter Property="Foreground" Value="{u:BTSBrush UI.Button.normal_foreground}" />
<Setter Property="Background" Value="{u:BTSBrush UI.Button.normal_background}" />
<Setter Property="BorderBrush" Value="{u:BTSBrush UI.Button.normal_border}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>