From 887850a612ac469ff10c6ba151b38b41308c61d0 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 30 Jul 2019 19:00:27 -0500 Subject: [PATCH 001/165] fix vertical alignments in GridSettingsView --- .../Controls/DIYGrid/Settings/GridSettingsView.xaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml index a9dd99c68..ed431c69d 100644 --- a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml +++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsView.xaml @@ -663,15 +663,22 @@ ItemsSource="{Binding font_family, Converter={StaticResource FontFamilyWeightsConverter}}" SelectedItem="{Binding current_column.font_weight_override}" /> - - Override Font Color + + Override Font Color - + From 3d1de2849ce1c517854aacb33333270058bd7d26 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 30 Jul 2019 19:03:08 -0500 Subject: [PATCH 002/165] added some common DiscreteValuesFilterVM factory fns --- .../Filters/VM/DiscreteValuesFilterVM.cs | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/client/spark/view/Controls/DataGridEx/Filters/VM/DiscreteValuesFilterVM.cs b/src/client/spark/view/Controls/DataGridEx/Filters/VM/DiscreteValuesFilterVM.cs index 861292a4f..bec6942cd 100644 --- a/src/client/spark/view/Controls/DataGridEx/Filters/VM/DiscreteValuesFilterVM.cs +++ b/src/client/spark/view/Controls/DataGridEx/Filters/VM/DiscreteValuesFilterVM.cs @@ -1,4 +1,6 @@ -using bts.api.core; +using bts; +using bts.api; +using bts.api.core; using bts.collections; using bts.utils; using mbts.collections; @@ -339,5 +341,47 @@ namespace mbts.spark.filters { _selected_items.sync_with(_selected_items_snapshot.Intersect(_items)); } } + + public static class Common { + // Account + public static IDataGridColumnPersistentFilter account(OrdersModel model, Func get_row_account, string prop_name) => + account(model.admin_model.on_account_tuples, get_row_account, prop_name); + + public static IDataGridColumnPersistentFilter account(IObservable> source, Func get_row_account, string prop_name) => + Create( + source, + get_row_account, + vals => vals.Select(v => v.id).ToArray(), + vals => { + var id_set = new HashSet(vals.empty_if_null()); + return source.Select(acc => acc.Where(a => id_set.Contains(a.id))); + }, + prop_name); + + public static IDataGridColumnPersistentFilter account(IObservable> source, Func get_row_account, string prop_name) => + Create( + source.Select(t => t.state.Values), + get_row_account, + vals => vals.Select(v => v.id).ToArray(), + vals => { + var id_set = new HashSet(vals.empty_if_null()); + return source.Filter(acc => id_set.Contains(acc.id)).Select(t => t.state.Values); + }, + prop_name); + // Exchange + public static IDataGridColumnPersistentFilter exchange(Func get_row_exchange, string prop_name) => + Create(EnumHelper.get_values_except(Venue.Unset).ToList(), get_row_exchange, prop_name); + // Symbol + public static IDataGridColumnPersistentFilter symbol(Func get_row_symbol, string prop_name) => + Create(co2.UserSymbol.get_all().Select(u => u.symbol).Distinct().ToList(), get_row_symbol, prop_name); + // Security Type + public static IDataGridColumnPersistentFilter security_type(Func get_row_security_type, string prop_name) => + Create(EnumHelper.get_values_except( + Security.ContractOneofCase.None, + Security.ContractOneofCase.Option, + Security.ContractOneofCase.Synthetic).ToList(), + get_row_security_type, + prop_name); + } } } From b5a8098d9e72cf1e1c30ec0bf9741f7c08136bc5 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 30 Jul 2019 19:06:06 -0500 Subject: [PATCH 003/165] IntMinMax (filter) protos impl IEquatable --- .../Filters/VM/IntMinMaxFilterVM.cs | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/client/spark/view/Controls/DataGridEx/Filters/VM/IntMinMaxFilterVM.cs b/src/client/spark/view/Controls/DataGridEx/Filters/VM/IntMinMaxFilterVM.cs index 2a5237ce1..97b4f12f2 100644 --- a/src/client/spark/view/Controls/DataGridEx/Filters/VM/IntMinMaxFilterVM.cs +++ b/src/client/spark/view/Controls/DataGridEx/Filters/VM/IntMinMaxFilterVM.cs @@ -1,4 +1,5 @@ -using ProtoBuf; +using bts.utils; +using ProtoBuf; using System; namespace mbts.spark.filters { @@ -8,7 +9,7 @@ namespace mbts.spark.filters { } [ProtoContract] - class IntStatus : INullableStructProto { + class IntStatus : INullableStructProto, IEquatable { [ProtoMember(1)] bool _active; [ProtoMember(2)] @@ -19,10 +20,23 @@ namespace mbts.spark.filters { get => _active ? new int?(_value) : new int?(); set { if (_active = value.HasValue) _value = value.Value; } } + + public bool Equals(IntStatus other) => + other != null && + _active == other._active && + _value == other._value; + + public override bool Equals(object obj) => + Equals(obj as IntStatus); + + public override int GetHashCode() => + EqualityComparer.aggregate_hash( + _active.GetHashCode(), + _value.GetHashCode()); } [ProtoContract] - class IntMinMaxState : IMinMaxState { + class IntMinMaxState : IMinMaxState, IEquatable { [ProtoMember(1)] readonly IntStatus _minimum; [ProtoMember(2)] @@ -35,5 +49,19 @@ namespace mbts.spark.filters { public INullableStructProto minimum => _minimum; public INullableStructProto maximum => _maximum; + + public bool Equals(IntMinMaxState other) => + other != null && + _minimum.safe_equals(other._minimum) && + _maximum.safe_equals(other._maximum); + + public override bool Equals(object obj) => + Equals(obj as IntMinMaxState); + + public override int GetHashCode() => + + EqualityComparer.aggregate_hash( + _minimum?.GetHashCode() ?? 0, + _maximum?.GetHashCode() ?? 0); } } \ No newline at end of file From b5e751e62595f99b5657318b8360a7d2354eb760 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 30 Jul 2019 19:06:33 -0500 Subject: [PATCH 004/165] remove unused 'hook_filters' fns --- .../DataGridEx/Filters/DataGridFilterHelper.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/client/spark/view/Controls/DataGridEx/Filters/DataGridFilterHelper.cs b/src/client/spark/view/Controls/DataGridEx/Filters/DataGridFilterHelper.cs index 94e077e04..54822a36e 100644 --- a/src/client/spark/view/Controls/DataGridEx/Filters/DataGridFilterHelper.cs +++ b/src/client/spark/view/Controls/DataGridEx/Filters/DataGridFilterHelper.cs @@ -1,26 +1,10 @@ -using bts.collections; -using mbts.ui.utility; -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace mbts.spark.filters { static class DataGridFilterHelper { - public static IDisposable hook_filters(ObservableFilterCollection rows, Action filter_action, params IDataGridColumnFilter[] filters) => - _hook_filters(filter_action, filters); - - public static IDisposable hook_filters(ObservableFilterCollection rows, params IDataGridColumnFilter[] filters) { - return _hook_filters(set_filter, filters); - void set_filter() { - using (rows.defer_refresh()) { - var active_filters = _get_active_filters(filters); - rows.live_filter_properties.SetItems(active_filters.Select(f => f.prop_name)); - rows.filter = r => active_filters.All(f => f.filter(r)); - } - } - } - public static IDisposable hook_filters(ICollectionView rows, params IDataGridColumnFilter[] filters) { var icvls = (ICollectionViewLiveShaping)rows; icvls.IsLiveFiltering = true; From 4590dbc05645e8575d2ed295188f1867ec53b5a3 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 30 Jul 2019 19:07:39 -0500 Subject: [PATCH 005/165] vertically align min/max/close buttons in BTSWindowTitleTemplate --- src/client/spark/view/Resources/WindowStyle.xaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/client/spark/view/Resources/WindowStyle.xaml b/src/client/spark/view/Resources/WindowStyle.xaml index e5cfbeda1..fe1d0a6f4 100644 --- a/src/client/spark/view/Resources/WindowStyle.xaml +++ b/src/client/spark/view/Resources/WindowStyle.xaml @@ -82,12 +82,17 @@ - -