diff --git a/.gitignore b/.gitignore
index 10a357f8b..6896b131c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,5 +32,4 @@ trace_data/
/src/lib/orderman/perf_analysis/last_pretty_log.csv
/src/lib/orderman/perf_analysis/log.csv
/doc/user/public/*
-.ionide/*
-src/web/ui/.ionide/symbolCache.db
+.ionide/*
diff --git a/doc/user/CMakeDeps.cmake b/doc/user/CMakeDeps.cmake
index 636b0797c..59a6b66b9 100644
--- a/doc/user/CMakeDeps.cmake
+++ b/doc/user/CMakeDeps.cmake
@@ -1 +1 @@
-set(sources /home/ppinto/Dropbox/bts/spark/doc/user/build.sh;content/_index.md;content/bts_spark/Algos/_index.md;content/bts_spark/Glossary/index.md;content/bts_spark/Help/about_spark.png;content/bts_spark/Help/image39.png;content/bts_spark/Help/image58.png;content/bts_spark/Help/index.md;content/bts_spark/Launcher/image38.png;content/bts_spark/Launcher/image68.png;content/bts_spark/Launcher/index.md;content/bts_spark/Logging-In-to-the-System/image3.png;content/bts_spark/Logging-In-to-the-System/image64.png;content/bts_spark/Logging-In-to-the-System/index.md;content/bts_spark/Market/change_securities.png;content/bts_spark/Market/image11.png;content/bts_spark/Market/image14.png;content/bts_spark/Market/image20.png;content/bts_spark/Market/image21.png;content/bts_spark/Market/image23.png;content/bts_spark/Market/image24.png;content/bts_spark/Market/image34.png;content/bts_spark/Market/image49.png;content/bts_spark/Market/image53.png;content/bts_spark/Market/image66.png;content/bts_spark/Market/image69.png;content/bts_spark/Market/index.md;content/bts_spark/Market/market_view.png;content/bts_spark/Market/settings_icon.png;content/bts_spark/Market/time_and_sales.png;content/bts_spark/My-Windows/image15.png;content/bts_spark/My-Windows/image16.png;content/bts_spark/My-Windows/image37.png;content/bts_spark/My-Windows/index.md;content/bts_spark/Settings/image51.png;content/bts_spark/Settings/image9.png;content/bts_spark/Settings/index.md;content/bts_spark/Spreader/image10.png;content/bts_spark/Spreader/image13.png;content/bts_spark/Spreader/image18.png;content/bts_spark/Spreader/image19.png;content/bts_spark/Spreader/image28.png;content/bts_spark/Spreader/image29.png;content/bts_spark/Spreader/image31.png;content/bts_spark/Spreader/image35.png;content/bts_spark/Spreader/image40.png;content/bts_spark/Spreader/image43.png;content/bts_spark/Spreader/image54.png;content/bts_spark/Spreader/image55.png;content/bts_spark/Spreader/image56.png;content/bts_spark/Spreader/image6.png;content/bts_spark/Spreader/image7.png;content/bts_spark/Spreader/image70.png;content/bts_spark/Spreader/image72.png;content/bts_spark/Spreader/image8.png;content/bts_spark/Spreader/index.md;content/bts_spark/Trading/algo_studio.png;content/bts_spark/Trading/collapse_all_icon.png;content/bts_spark/Trading/cover_algo_control.png;content/bts_spark/Trading/expand_all_icon.png;content/bts_spark/Trading/image1.png;content/bts_spark/Trading/image17.png;content/bts_spark/Trading/image2.png;content/bts_spark/Trading/image25.png;content/bts_spark/Trading/image27.png;content/bts_spark/Trading/image33.png;content/bts_spark/Trading/image42.png;content/bts_spark/Trading/image44.png;content/bts_spark/Trading/image47.png;content/bts_spark/Trading/image48.png;content/bts_spark/Trading/image5.png;content/bts_spark/Trading/image50.png;content/bts_spark/Trading/image52.png;content/bts_spark/Trading/image57.png;content/bts_spark/Trading/image59.png;content/bts_spark/Trading/image60.png;content/bts_spark/Trading/image61.png;content/bts_spark/Trading/image62.png;content/bts_spark/Trading/image73.png;content/bts_spark/Trading/image74.png;content/bts_spark/Trading/index.md;content/bts_spark/Trading/join_algo_control.png;content/bts_spark/Trading/ladder.png;content/bts_spark/Trading/ladder_badges.png;content/bts_spark/Trading/ladder_main_part.png;content/bts_spark/Trading/lean_algo_control.png;content/bts_spark/Trading/mini_orderbook.png;content/bts_spark/Trading/oco_algo_control.png;content/bts_spark/Trading/offset_algo_control.png;content/bts_spark/Trading/pnl_calculation.png;content/bts_spark/Trading/pnl_window.png;content/bts_spark/Trading/recreate_icon.png;content/bts_spark/Trading/settings_icon.png;content/bts_spark/Trading/spark_menu_order_book.png;content/bts_spark/Trading/top_algo_control.png;content/bts_spark/Trading/trigger_algo_control.png;content/bts_spark/_index.md;content/release_notes/_index.md;content/system_requirements/_index.md;static/book.js;static/favicon.ico;static/image.js;templates/index.html;templates/page.html;templates/section.html;templates/shortcodes/back_button.html)
\ No newline at end of file
+set(sources /home/ppinto/Dropbox/bts/spark/doc/user/build.sh;content/_index.md;content/bts_spark/Glossary/_index.md;content/bts_spark/Help/_index.md;content/bts_spark/Help/about_spark.png;content/bts_spark/Help/image39.png;content/bts_spark/Help/image58.png;content/bts_spark/Launcher/_index.md;content/bts_spark/Launcher/image38.png;content/bts_spark/Launcher/image68.png;content/bts_spark/Logging-In-to-the-System/_index.md;content/bts_spark/Logging-In-to-the-System/image3.png;content/bts_spark/Logging-In-to-the-System/image64.png;content/bts_spark/Market/_index.md;content/bts_spark/Market/change_securities.png;content/bts_spark/Market/image11.png;content/bts_spark/Market/image14.png;content/bts_spark/Market/image20.png;content/bts_spark/Market/image21.png;content/bts_spark/Market/image23.png;content/bts_spark/Market/image24.png;content/bts_spark/Market/image34.png;content/bts_spark/Market/image49.png;content/bts_spark/Market/image53.png;content/bts_spark/Market/image66.png;content/bts_spark/Market/image69.png;content/bts_spark/Market/market_view.png;content/bts_spark/Market/settings_icon.png;content/bts_spark/Market/time_and_sales.png;content/bts_spark/My-Windows/_index.md;content/bts_spark/My-Windows/image15.png;content/bts_spark/My-Windows/image16.png;content/bts_spark/My-Windows/image37.png;content/bts_spark/Settings/_index.md;content/bts_spark/Settings/image51.png;content/bts_spark/Settings/image9.png;content/bts_spark/Spreader/_index.md;content/bts_spark/Spreader/image10.png;content/bts_spark/Spreader/image13.png;content/bts_spark/Spreader/image18.png;content/bts_spark/Spreader/image19.png;content/bts_spark/Spreader/image28.png;content/bts_spark/Spreader/image29.png;content/bts_spark/Spreader/image31.png;content/bts_spark/Spreader/image35.png;content/bts_spark/Spreader/image40.png;content/bts_spark/Spreader/image43.png;content/bts_spark/Spreader/image54.png;content/bts_spark/Spreader/image55.png;content/bts_spark/Spreader/image56.png;content/bts_spark/Spreader/image6.png;content/bts_spark/Spreader/image7.png;content/bts_spark/Spreader/image70.png;content/bts_spark/Spreader/image72.png;content/bts_spark/Spreader/image8.png;content/bts_spark/Trading/OrderTypes/index.md;content/bts_spark/Trading/_index.md;content/bts_spark/Trading/algo_studio.png;content/bts_spark/Trading/collapse_all_icon.png;content/bts_spark/Trading/cover_algo_control.png;content/bts_spark/Trading/expand_all_icon.png;content/bts_spark/Trading/image1.png;content/bts_spark/Trading/image17.png;content/bts_spark/Trading/image2.png;content/bts_spark/Trading/image25.png;content/bts_spark/Trading/image27.png;content/bts_spark/Trading/image33.png;content/bts_spark/Trading/image42.png;content/bts_spark/Trading/image44.png;content/bts_spark/Trading/image47.png;content/bts_spark/Trading/image48.png;content/bts_spark/Trading/image5.png;content/bts_spark/Trading/image50.png;content/bts_spark/Trading/image52.png;content/bts_spark/Trading/image57.png;content/bts_spark/Trading/image59.png;content/bts_spark/Trading/image60.png;content/bts_spark/Trading/image61.png;content/bts_spark/Trading/image62.png;content/bts_spark/Trading/image73.png;content/bts_spark/Trading/image74.png;content/bts_spark/Trading/join_algo_control.png;content/bts_spark/Trading/ladder.png;content/bts_spark/Trading/ladder_badges.png;content/bts_spark/Trading/ladder_main_part.png;content/bts_spark/Trading/lean_algo_control.png;content/bts_spark/Trading/mini_orderbook.png;content/bts_spark/Trading/oco_algo_control.png;content/bts_spark/Trading/offset_algo_control.png;content/bts_spark/Trading/pnl_calculation.png;content/bts_spark/Trading/pnl_window.png;content/bts_spark/Trading/recreate_icon.png;content/bts_spark/Trading/settings_icon.png;content/bts_spark/Trading/spark_menu_order_book.png;content/bts_spark/Trading/top_algo_control.png;content/bts_spark/Trading/trigger_algo_control.png;content/bts_spark/_index.md;content/release_notes/_index.md;content/system_requirements/_index.md;static/book.js;static/favicon.ico;static/image.js;templates/index.html;templates/page.html;templates/section.html;templates/shortcodes/back_button.html)
\ No newline at end of file
diff --git a/doc/user/content/release_notes/_index.md b/doc/user/content/release_notes/_index.md
index 0d865e921..c44b8cd56 100644
--- a/doc/user/content/release_notes/_index.md
+++ b/doc/user/content/release_notes/_index.md
@@ -4,6 +4,36 @@ weight = 3
sort_by = "weight"
insert_anchor_links = "right"
+++
+## 2.9.0
+### User Visible Changes
+ - Improved Workspace management User Interface
+ - Added the ability to change grid background colors
+ - The Spark UI Window group now has a title in the Windows task bar
+ - Added sound alerts for trade events, see Launcher -> Settings -> Alerts
+ - Allowed composite algos that are attached to existing orders to identify fills that were already present prior to attachment
+ - Added import facilities for GMI position files
+ - Added the ability for risk managers to enter manual fills
+### Bug Fixes
+ - Fixed the settings action menu (Load/Save/Reset to Factory)
+ - Fixed the method used to determine if a security is expired to take into account the start of day time
+### API Changes
+ - Fixed an issue in the Client SDK that could lead to occasional failures to connect to the spark server as well as excessive memory usage.
+ - Added the ability for algo orders to distinguish fills existing prior to launch
+### Internal Changes
+ - Changed how we packaged certain third-party components
+ - Added logging of entitlement status
+ - Tagged outgoing orders with sequence number of marketdata or FIX event that triggered them
+## 2.8.3
+### Bug Fixes
+ - Fixed a bug that could cause an OrderBook's Security column filter to be blank
+ - Fixed a bug that could cause a UI failure when clearing a filter selection on a filtering widget
+## 2.8.2
+### Bug Fixes
+ - Added proper display factors for SOM spreads
+ - Fixed a bug that could cause a UI failure when trying to change settings in a synthetic ladder
+## 2.8.1
+### Bug fixes
+ - Fixed an error in the UI grids filtering widget
## 2.8.0
### User Visible Changes
- Added ProRata and Scratch algos
diff --git a/docker/linux b/docker/linux
index e13bb5d8d..b09d4c035 160000
--- a/docker/linux
+++ b/docker/linux
@@ -1 +1 @@
-Subproject commit e13bb5d8df14171a9a5abfdb8b6b4ecbc519032a
+Subproject commit b09d4c035b4c0d0e600c7639cd9cb5edaee98d2e
diff --git a/externals b/externals
index 67a79263b..6b8c745fb 160000
--- a/externals
+++ b/externals
@@ -1 +1 @@
-Subproject commit 67a79263ba116a7646beb8368cef015530bea027
+Subproject commit 6b8c745fb2725ad92fc0292b7836e0838e7e1679
diff --git a/src/client/spark/App.xaml.cs b/src/client/spark/App.xaml.cs
index ea2b1de78..0883bc861 100644
--- a/src/client/spark/App.xaml.cs
+++ b/src/client/spark/App.xaml.cs
@@ -70,7 +70,6 @@ namespace mbts.ui.shell
{
Log.Gen.info("Application.OnExit");
if (_runtime != null) _runtime.Dispose();
- utils.BTSNativeMethods.finit_spark_lib();
base.OnExit(e);
Environment.Exit(0);
}
diff --git a/src/client/spark/Daemons/GlobalAlertsDaemon.cs b/src/client/spark/Daemons/GlobalAlertsDaemon.cs
new file mode 100644
index 000000000..7cc191ea9
--- /dev/null
+++ b/src/client/spark/Daemons/GlobalAlertsDaemon.cs
@@ -0,0 +1,68 @@
+using bts.api;
+using bts.shell;
+using mbts;
+using mbts.persist;
+using mbts.spark;
+using mbts.ui;
+using mbts.ui.spark;
+using mbts.ui.utilities;
+using System;
+using System.ComponentModel.Composition;
+using System.Linq;
+using System.Reactive.Disposables;
+using System.Reactive.Linq;
+using System.Windows;
+using Disposable = mbts.Disposable;
+
+namespace bts {
+ [Export(typeof(IShellDaemon))]
+ class GlobalAlertsDaemon : IShellDaemon, IDisposable {
+ const string
+ // used for logging/diagnostic purposes
+ _window_name = "Global Alerts Dialog",
+ // actual window title
+ _window_title = "Alerts";
+
+ readonly ThreadedWindowLauncher _launcher;
+ readonly UserSettingsHub _hub;
+ readonly IBus _bus;
+ readonly INotificationService _notification_service;
+ IDisposable _dispose;
+
+ [ImportingConstructor]
+ public GlobalAlertsDaemon(IBus bus, UserSettingsHub hub, INotificationService notification_service) {
+ _bus = bus;
+ _hub = hub;
+ _notification_service = notification_service;
+ _launcher = new ThreadedWindowLauncher(_window_name);
+ _dispose = Disposable.Create(
+ bus.subscribe(SparkTags.ShowGlobalAlertsTag)
+ .Subscribe(_ => _launcher.show(_view_factory)),
+ _hub.subscribe_default_settings()
+ .SubscribeEach(s => new CompositeDisposable(
+ s.alerts.trade_alerts.Where(t => t.is_enabled).Select(
+ a => _notification_service.link_to_trades(
+ a.predicate.security_criteria, a.predicate.create(), a.sound)))));
+ }
+
+ Window _view_factory() {
+ var vm = new GlobalAlertsVM();
+ vm.load_from(_hub.current.alerts);
+ vm.request_commit += commit;
+ var sec_sub = _bus.subscribe(SparkTags.SecuritiesTag).OnDispatcher().Subscribe(m => vm.security_map = m);
+ var win = new GlobalAlertsDialog {
+ Title = "Alerts",
+ DataContext = vm
+ };
+ win.Closed += (s, e) => Disposable.dispose(ref sec_sub);
+ return win;
+ void commit() {
+ var s = _hub.current.with(alerts: vm.create());
+ _hub.save_default(s).ignore();
+ }
+ }
+
+ public void Dispose() =>
+ Disposable.dispose(ref _dispose);
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/Images/Icons.cs b/src/client/spark/Images/Icons.cs
index 4efaeaf41..016e8022d 100644
--- a/src/client/spark/Images/Icons.cs
+++ b/src/client/spark/Images/Icons.cs
@@ -40,6 +40,7 @@ namespace mbts.ui {
EditDocumentAltGeometryKey = nameof(EditDocumentAltGeometryKey),
EditDocumentGeometryKey = nameof(EditDocumentGeometryKey),
GearGeometryKey = nameof(GearGeometryKey),
+ HornGeometryKey = nameof(HornGeometryKey),
KeyGeometryKey = nameof(KeyGeometryKey),
LetterAKey = nameof(LetterAKey),
LetterDKey = nameof(LetterDKey),
@@ -50,6 +51,7 @@ namespace mbts.ui {
PlayGeometryKey = nameof(PlayGeometryKey),
ProhibitedGeometryKey = nameof(ProhibitedGeometryKey),
RubberStampGeometryKey = nameof(RubberStampGeometryKey),
+ SpeakerGeometryKey = nameof(SpeakerGeometryKey),
StarGeometryKey = nameof(StarGeometryKey),
ToolsGeometryKey = nameof(ToolsGeometryKey),
TrashGeometryKey = nameof(TrashGeometryKey),
@@ -170,6 +172,7 @@ namespace mbts.ui {
public static ImageSource FilterActive { get { return load_resource_and_freeze("FilterActive"); } }
public static ImageSource FilterError { get { return load_resource_and_freeze("FilterError"); } }
public static ImageSource Gear => create_icon(GearGeometryKey);
+ public static ImageSource Horn => create_icon(HornGeometryKey);
public static ImageSource Import => load_resource_and_freeze("Import");
public static ImageSource Key => create_icon(KeyGeometryKey);
public static ImageSource Knight { get { return load_resource_and_freeze("Knight"); } }
@@ -181,6 +184,7 @@ namespace mbts.ui {
public static ImageSource RubberStamp => create_icon(RubberStampGeometryKey);
public static ImageSource RedoCircular => create_icon(UndoCircularGeometryKey, Brushes.Black, null, new ScaleTransform(-1, 1));
public static ImageSource Spawn { get { return load_resource_and_freeze("Spawn"); } }
+ public static ImageSource Speaker => create_icon(SpeakerGeometryKey);
public static ImageSource Star => create_icon(StarGeometryKey);
public static ImageSource Target { get { return load_resource_and_freeze("Target"); } }
public static ImageSource Tetris { get { return load_resource_and_freeze("Tetris"); } }
diff --git a/src/client/spark/Images/Vector/Icons.xaml b/src/client/spark/Images/Vector/Icons.xaml
index d4edbe407..4becbc715 100644
--- a/src/client/spark/Images/Vector/Icons.xaml
+++ b/src/client/spark/Images/Vector/Icons.xaml
@@ -274,6 +274,10 @@
M16.000015,9.6000061C12.500012,9.6000061 9.5999844,12.5 9.5999844,16 9.5999844,19.5 12.500012,22.399994 16.000015,22.399994 19.500019,22.399994 22.400015,19.5 22.400015,16 22.400015,12.5 19.500019,9.6000061 16.000015,9.6000061z M14.199995,0L17.800005,0C18.199999,0,18.599993,0.29998779,18.599993,0.79998779L18.599993,4.7999878C19.900013,5.1000061,21.000019,5.6000061,22.099997,6.2999878L25.000023,3.3999939C25.099999,3.2999878 25.300011,3.1999817 25.500025,3.1999817 25.700007,3.1999817 25.900019,3.2999878 26.000025,3.3999939L28.600033,6C28.900021,6.2999878,28.900021,6.7999878,28.600033,7.1000061L25.700007,10C26.400019,11.100006,26.900019,12.299988,27.200007,13.5L31.20001,13.5C31.600037,13.5,31.999998,13.799988,31.999998,14.299988L31.999998,17.899994C31.999998,18.299988,31.700012,18.699982,31.20001,18.699982L27.200007,18.699982C26.900019,20,26.400019,21.100006,25.700007,22.199982L28.600033,25.100006C28.700009,25.199982 28.799984,25.399994 28.799984,25.600006 28.799984,25.799988 28.700009,26 28.600033,26.100006L26.000025,28.600006C25.900019,28.699982 25.700007,28.799988 25.500025,28.799988 25.300011,28.799988 25.099999,28.699982 25.000023,28.600006L22.099997,25.699982C21.000019,26.399994,19.800007,26.899994,18.599993,27.199982L18.599993,31.199982C18.599993,31.600006,18.300005,32,17.800005,32L14.199995,32C13.8,32,13.400006,31.699982,13.400006,31.199982L13.400006,27.199982C12.099987,26.899994,11.000011,26.399994,9.9000027,25.699982L7.0000064,28.600006C6.9000003,28.699982 6.6999881,28.799988 6.5000059,28.799988 6.2999937,28.799988 6.099981,28.699982 6.0000054,28.600006L3.3999967,26C3.0999784,25.699982,3.0999784,25.199982,3.3999967,24.899994L6.2999937,22C5.5999805,20.899994,5.0999801,19.699982,4.7999923,18.5L0.79998828,18.5C0.39999409,18.5,-1.933513E-07,18.199982,0,17.699982L0,14.100006C-1.933513E-07,13.699982,0.2999879,13.299988,0.79998828,13.299988L4.7999923,13.299988C5.0999801,12,5.5999805,10.899994,6.2999937,9.7999878L3.3999967,7C3.2999908,6.8999939 3.1999845,6.6999817 3.1999845,6.5 3.1999845,6.2999878 3.2999908,6.1000061 3.3999967,6L6.0000054,3.3999939C6.099981,3.2999878 6.2999937,3.1999817 6.5000059,3.1999817 6.6999881,3.1999817 6.9000003,3.2999878 7.0000064,3.3999939L9.9000027,6.2999878C11.000011,5.6000061,12.199993,5.1000061,13.400006,4.7999878L13.400006,0.79998779C13.400006,0.29998779,13.8,0,14.199995,0z
+
+ M4.0499969,7.0870913C2.9519978,7.0870913 2.0249984,8.4780906 2.0249987,10.125091 2.0249984,11.771091 2.9519978,13.162091 4.0499969,13.162091 5.1479961,13.162091 6.0749954,11.771091 6.0749955,10.125091 6.0749954,8.4780906 5.1479961,7.0870913 4.0499969,7.0870913z M29.975016,3.316155C23.883831,8.2016557,11.829888,8.9691842,8.1184387,9.0896781L8.0151367,9.0928462 8.0175586,9.1059306C8.0716033,9.4352315 8.0999939,9.7760909 8.0999942,10.125091 8.0999939,10.473966 8.0716033,10.814716 8.0175586,11.143921L8.0098858,11.185364 8.193316,11.195448C12.163719,11.420399,23.994581,12.458921,29.975016,17.005057z M31.176758,0.00019051835C31.280359,-0.0022594665 31.391857,0.01889403 31.514975,0.065146674 31.908983,0.21413228 31.999985,0.59114302 31.999985,1.0121596L31.999985,19.236969C31.999985,19.653958 31.913988,20.028956 31.525991,20.179955 31.405998,20.226952 31.450981,20.250023 31.32699,20.250023 31.050991,20.250023 30.778992,20.13601 30.583986,19.925928 25.229074,14.140572 9.6001122,13.269665 7.2865356,13.172559L7.2813506,13.172345 7.1739591,13.343056C6.4304952,14.468533 5.3060585,15.187091 4.0499969,15.187091 1.8169985,15.187091 0,12.916091 0,10.125091 0,7.3330911 1.8169985,5.0620912 4.0499969,5.0620912 5.3060585,5.0620912 6.4304952,5.78065 7.1739591,6.9063042L7.2852713,7.0832756 7.3087114,7.0828188C9.6077337,7.036146 25.141474,6.4939421 30.567997,0.34315929 30.75913,0.12521249 30.948835,0.005580858 31.176758,0.00019051835z
+
+
M22.399981,2.4000006C22.099982,2.4000006 21.899982,2.5 21.599982,2.6999998 21.199983,3.1000004 21.199983,3.8000002 21.599982,4.2000003L26.199979,8.9000001C26.599978,9.3000002 27.299977,9.3000002 27.699977,8.9000001 28.099977,8.5000002 28.099977,7.8000002 27.699977,7.4000006L23.099981,2.6999998C22.899981,2.5,22.699981,2.4000006,22.399981,2.4000006z M21.499982,0C22.299982,0,23.199981,0.30000019,23.79998,0.90000057L29.299976,6.4000001C30.599975,7.7000003,30.599975,9.7000003,29.299976,11L22.599981,17.7C21.299983,19,19.299984,19,17.999985,17.7L17.299985,17 12.699989,21.6 10.399991,20.900001 10.899991,23.400001 8.4999928,22.8 8.9999924,25.5 6.2999945,25.1 6.7999945,27.6 4.2999964,27 4.7999954,29.6 2.4999971,32 0,26.6 13.499989,13.1 16.999986,16.6 12.699989,12.3C11.399991,11,11.399991,9.0000002,12.699989,7.7000003L19.399984,1C19.899983,0.30000019,20.699983,0,21.499982,0z
@@ -335,6 +339,11 @@
M33.5,4h-6v10h6V4z M31.5,12h-2V6h2V12z
+
+
+ M18,12.839666L18,19.159448 18.029955,19.131576C18.848108,18.314159 19.332083,17.192702 19.332083,15.999873 19.332083,14.806357 18.848108,13.684685 18.029955,12.867527z M21.738388,4.748316C21.868353,4.7515661 21.999973,4.7804414 22.126221,4.8376924 26.511095,6.8177201 29.344013,11.199782 29.344013,15.999849 29.344013,20.799915 26.511095,25.181977 22.126221,27.162004 21.992224,27.223004 21.853228,27.251006 21.715233,27.251006 21.333244,27.251006 20.970255,27.032003 20.803259,26.662997 20.575266,26.15899 20.799259,25.566981 21.302244,25.339978 24.973139,23.681956 27.34407,20.015905 27.34407,15.999849 27.34407,11.983792 24.973139,8.3177406 21.302244,6.6597177 20.799259,6.4327146 20.575266,5.8407065 20.803259,5.3366992 20.973503,4.9594442 21.348494,4.7385656 21.738388,4.748316z M16,3.1854247L6.6530151,11.257323C6.4719848,11.414303,6.2399902,11.500301,6,11.500301L1.9999998,11.500301 1.9999998,21.500148 6,21.500148C6.2219848,21.500148,6.4370117,21.573144,6.6110229,21.709129L16,28.964023z M17.000252,1.186163E-08C17.141373,-2.1778678E-05 17.283264,0.02997845 17.416016,0.091477852 17.770996,0.25450047 18,0.60843792 18,1.0004608L18,10.368904 18.170259,10.465408C20.111607,11.612996 21.331976,13.716092 21.331976,15.999873 21.331976,18.282748 20.111607,20.38576 18.170259,21.53334L18,21.629842 18,31.000003C18,31.382016 17.78302,31.728995 17.440002,31.896962 17.301025,31.965991 17.150024,31.99999 17,31.99999 16.78302,31.99999 16.567017,31.929982 16.388977,31.791007L5.65802,23.500117 0.99999966,23.500117C0.44702145,23.500117,-3.9348969E-08,23.053104,3.5527137E-15,22.500133L3.5527137E-15,10.500316C-3.9348969E-08,9.9473459,0.44702145,9.5003311,0.99999966,9.5003311L5.6279907,9.5003311 16.346985,0.24345344C16.531998,0.083467316,16.765053,3.6392792E-05,17.000252,1.186163E-08z
+
+
M1540.22,2082.07L1546.95,2102.78 1568.73,2102.78 1551.11,2115.58 1557.84,2136.29 1540.22,2123.49 1522.6,2136.29 1529.33,2115.58 1511.71,2102.78 1533.49,2102.78 1540.22,2082.07z
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs b/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs
index 73581518c..b8257083e 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewVM.cs
@@ -1,5 +1,6 @@
using bts.api;
using bts.collections;
+using bts.proto;
using bts.utils;
using mbts.persist;
using mbts.spark.filters;
@@ -46,8 +47,8 @@ namespace mbts.spark {
add_col(Columns.BidImpliedSize, implied_size_col_header, r => r.bid_implied_size.ToString(), nameof(Row.bid_implied_size), DefaultColumnWidths.ImpliedDirectMergedSize, bid_implied_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.BidDirectSize, direct_size_col_header, r => r.bid_direct_size.ToString(), nameof(Row.bid_direct_size), DefaultColumnWidths.ImpliedDirectMergedSize, bid_direct_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
add_hl_merged_size_col(Columns.BidMergedSize, merged_size_col_header, nameof(Row.bid_merged_size), nameof(Row.bid_merged_size_text), nameof(Row.bid_merged_size_click), bid_merged_size_filter, BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
- add_hl_price_col(Columns.Bid, "Bid", nameof(Row.bid_price), nameof(Row.bid_price_click), bid_price_filter, BTSColors.header_text, BTSColors.MarketData.bid_brush, h_alignment: System.Windows.HorizontalAlignment.Right);
- add_hl_price_col(Columns.Ask, "Ask", nameof(Row.ask_price), nameof(Row.ask_price_click), ask_price_filter, BTSColors.header_text, BTSColors.MarketData.ask_brush, h_alignment: System.Windows.HorizontalAlignment.Right);
+ add_hl_price_col(Columns.Bid, "Bid", nameof(Row.bid_price), nameof(Row.bid_price_click), bid_price_filter, BTSColors.header_text, BTSColors.MarketData.bid, h_alignment: System.Windows.HorizontalAlignment.Right);
+ add_hl_price_col(Columns.Ask, "Ask", nameof(Row.ask_price), nameof(Row.ask_price_click), ask_price_filter, BTSColors.header_text, BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
add_hl_merged_size_col(Columns.AskMergedSize, merged_size_col_header, nameof(Row.ask_merged_size), nameof(Row.ask_merged_size_text), nameof(Row.ask_merged_size_click), ask_merged_size_filter, BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.AskDirectSize, direct_size_col_header, r => r.ask_direct_size.ToString(), nameof(Row.ask_direct_size), DefaultColumnWidths.ImpliedDirectMergedSize, ask_direct_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
add_col(Columns.AskImpliedSize, implied_size_col_header, r => r.ask_implied_size.ToString(), nameof(Row.ask_implied_size), DefaultColumnWidths.ImpliedDirectMergedSize, ask_implied_size_filter, DataGridFilterKnownTemplates.UIntMinMax, font_color: BTSColors.MarketData.ask, h_alignment: System.Windows.HorizontalAlignment.Right);
@@ -77,18 +78,18 @@ namespace mbts.spark {
horizontal_alignment = h_alignment
});
- void add_hl_price_col(Columns col_key, string header, string prop, string command_prop, IDataGridColumnFilter filter, Color foreground, Brush background, System.Windows.HorizontalAlignment h_alignment) =>
- add_hl_col(col_key, header, price_binding(prop), prop, command_prop, filter, DataGridFilterKnownTemplates.DoubleMinMax, DefaultColumnWidths.MViewPrice, foreground, background, DefaultSelectionHighlight, h_alignment);
+ void add_hl_price_col(Columns col_key, string header, string prop, string command_prop, IDataGridColumnFilter filter, Color foreground, Color? background, System.Windows.HorizontalAlignment h_alignment) =>
+ add_hl_col(col_key, header, price_binding(prop), prop, command_prop, filter, DataGridFilterKnownTemplates.DoubleMinMax, DefaultColumnWidths.MViewPrice, foreground, background, h_alignment);
void add_hl_merged_size_col(Columns col_key, string header, string sort_prop, string text_prop, string command_prop, IDataGridColumnFilter filter, Color foreground, System.Windows.HorizontalAlignment h_alignment) =>
- add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.UIntMinMax, DefaultColumnWidths.ImpliedDirectMergedSize, foreground, null, null, h_alignment);
+ add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.UIntMinMax, DefaultColumnWidths.ImpliedDirectMergedSize, foreground, null, h_alignment);
void add_hl_working_orders_col(Columns col_key, string header, string text_prop, string sort_prop, string command_prop, IDataGridColumnFilter filter, Color foreground, System.Windows.HorizontalAlignment h_alignment) =>
- add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.IntMinMax, working_orders_col_width, foreground, null, null, h_alignment);
+ add_hl_col(col_key, header, new Binding(text_prop), sort_prop, command_prop, filter, DataGridFilterKnownTemplates.IntMinMax, working_orders_col_width, foreground, null, h_alignment);
void add_hl_col(
Columns col_key, string header, BindingBase binding, string prop, string command_prop,
- IDataGridColumnFilter filter, string filter_template, double width, Color foreground, Brush background, Brush background_overlay, System.Windows.HorizontalAlignment h_alignment = System.Windows.HorizontalAlignment.Left) =>
+ IDataGridColumnFilter filter, string filter_template, double width, Color foreground, Color? background, System.Windows.HorizontalAlignment h_alignment = System.Windows.HorizontalAlignment.Left) =>
columns.Add(new HyperlinkElementColumn(
col_key, binding, new Binding(command_prop), filter, filter_template) {
// it's necessary to have this id populated for grid settings
@@ -96,8 +97,7 @@ namespace mbts.spark {
Header = header,
sort_member_path = prop,
font_color_override = foreground,
- background = background,
- background_overlay = background_overlay,
+ background_color_override = background,
Width = DefaultColumnWidths.Price,
horizontal_alignment = h_alignment
});
@@ -111,14 +111,8 @@ namespace mbts.spark {
//
// make font-color immutable for Side, Size, (the font-color rule is hard-coded: MarketData.bid for Buy orders, MarketData.ask for Sells)
var col_settings_flags = new Dictionary {
- { Columns.Bid.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.Ask.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.BidImpliedSize.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.BidDirectSize.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.BidMergedSize.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.AskImpliedSize.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.AskDirectSize.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
- { Columns.AskMergedSize.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
+ { Columns.Bid.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableBackgroundColor },
+ { Columns.Ask.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor | GridColumnSettingsFeatureFlags.ImmutableBackgroundColor},
{ Columns.WorkingAsks.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor },
{ Columns.WorkingBids.ToString(), GridColumnSettingsFeatureFlags.ImmutableFontColor }
};
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewWindow.cs b/src/client/spark/Modules/Market/MarketView/MarketViewWindow.cs
index 35f22e89c..da46e6c8d 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewWindow.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewWindow.cs
@@ -153,7 +153,7 @@ namespace mbts.spark {
s => _vm.grid_settings_manager.create_vm(
// we need to get the most up to date GridSettings when launching b/c users may
// have changed some settings on the grid directly, like column widths.
- s.with(_vm.columns.Select(c => c.create()))
+ MarketViewWindowFactory.StartupData.sanitize(s).with(_vm.columns.Select(c => c.create()))
)
);
vm.SubscribeDisposed(literal_title_source.OnDispatcher().Subscribe(t => vm.title = t));
diff --git a/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs b/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs
index 38931a3eb..c28013d6b 100644
--- a/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs
+++ b/src/client/spark/Modules/Market/MarketView/MarketViewWindowFactory.cs
@@ -1,4 +1,5 @@
using bts.api;
+using bts.proto;
using mbts.persist;
using mbts.spark;
using mbts.spark.filters;
@@ -36,9 +37,9 @@ namespace bts.shell {
_bus.post(SparkTags.ShowWindow, _create(StartupData.Default(criteria)));
IShellWindow _create(StartupData state) {
- var settings_manager = new WindowSettingsManager(_settings_hub,
- state.grid,
- get: us => us.market_view_grid,
+ var settings_manager = new WindowSettingsManager(_settings_hub,
+ StartupData.sanitize(state.grid),
+ get: us => StartupData.sanitize(us.market_view_grid),
set: (us, gs) => us.with(provided_market_view_gridsettings: gs));
return new MarketViewWindow(this, _bus, _orders_model, state, settings_manager);
}
@@ -68,7 +69,29 @@ namespace bts.shell {
_sorting_criteria = sort;
}
- public static GridSettings DefaultGridSettings => GridSettings.Default.with(DefaultColumns.all, DefaultColumns.default_sorting_criterion);
+ public static GridSettings sanitize(GridSettings s) {
+ if (s == null) {
+ return null;
+ }
+
+ // column upgrade
+ var columns = s.columns.ToList();
+ var bid_col_index = columns.FindIndex(x => x.id == col_id(Columns.Bid));
+ var ask_col_index = columns.FindIndex(x => x.id == col_id(Columns.Ask));
+ if (bid_col_index > -1 && ask_col_index > -1) {
+ if (!columns[bid_col_index].background_color_override.HasValue) {
+ columns[bid_col_index] = columns[bid_col_index].with(background_color_override: new NullableColorProto(BTSColors.MarketData.bid.ToUint()));
+ }
+ if (!columns[ask_col_index].background_color_override.HasValue) {
+ columns[ask_col_index] = columns[ask_col_index].with(background_color_override: new NullableColorProto(BTSColors.MarketData.ask.ToUint()));
+ }
+ }
+ // and enable background color upgrade
+ return s.with(columns, enable_background_color: true);
+ }
+
+
+ public static GridSettings DefaultGridSettings => GridSettings.Default.with(DefaultColumns.all, DefaultColumns.default_sorting_criterion, enable_background_color: true);
public IReadOnlyList sorting_criterion => _sorting_criteria ?? (_sorting_criteria = DefaultColumns.default_sorting_criterion.ToList());
@@ -86,8 +109,8 @@ namespace bts.shell {
public static GridColumnSettings bid_implied_size => new GridColumnSettings(col_id(Columns.BidImpliedSize), DefaultColumnHeaders.ImpliedSize, font_color_override: BTSColors.MarketData.bid, width: DefaultColumnWidths.ImpliedDirectMergedSize, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings bid_direct_size => new GridColumnSettings(col_id(Columns.BidDirectSize), DefaultColumnHeaders.DirectSize, font_color_override: BTSColors.MarketData.bid, width: DefaultColumnWidths.ImpliedDirectMergedSize, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings bid_merged_size => new GridColumnSettings(col_id(Columns.BidMergedSize), DefaultColumnHeaders.MergedSize, font_color_override: BTSColors.MarketData.bid, width: DefaultColumnWidths.ImpliedDirectMergedSize, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
- public static GridColumnSettings bid => new GridColumnSettings(col_id(Columns.Bid), DefaultColumnHeaders.Bid, font_color_override: BTSColors.header_text, width:DefaultColumnWidths.MViewPrice, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
- public static GridColumnSettings ask => new GridColumnSettings(col_id(Columns.Ask), DefaultColumnHeaders.Ask, font_color_override: BTSColors.header_text, width: DefaultColumnWidths.MViewPrice, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
+ public static GridColumnSettings bid => new GridColumnSettings(col_id(Columns.Bid), DefaultColumnHeaders.Bid, font_color_override: BTSColors.header_text, width:DefaultColumnWidths.MViewPrice, horizontal_alignment: System.Windows.HorizontalAlignment.Right, background_color_override: BTSColors.MarketData.bid);
+ public static GridColumnSettings ask => new GridColumnSettings(col_id(Columns.Ask), DefaultColumnHeaders.Ask, font_color_override: BTSColors.header_text, width: DefaultColumnWidths.MViewPrice, horizontal_alignment: System.Windows.HorizontalAlignment.Right, background_color_override: BTSColors.MarketData.ask);
public static GridColumnSettings ask_merged_size => new GridColumnSettings(col_id(Columns.AskMergedSize), DefaultColumnHeaders.MergedSize, font_color_override: BTSColors.MarketData.ask, width: DefaultColumnWidths.ImpliedDirectMergedSize, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings ask_direct_size => new GridColumnSettings(col_id(Columns.AskDirectSize), DefaultColumnHeaders.DirectSize, font_color_override: BTSColors.MarketData.ask, width: DefaultColumnWidths.ImpliedDirectMergedSize, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
public static GridColumnSettings ask_implied_size => new GridColumnSettings(col_id(Columns.AskImpliedSize), DefaultColumnHeaders.ImpliedSize, font_color_override: BTSColors.MarketData.ask, width: DefaultColumnWidths.ImpliedDirectMergedSize, horizontal_alignment: System.Windows.HorizontalAlignment.Right);
diff --git a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesModel.cs b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesModel.cs
index 2b17345e6..b0121b166 100644
--- a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesModel.cs
+++ b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesModel.cs
@@ -7,16 +7,6 @@ using System.Linq;
using System.Reactive.Linq;
namespace mbts.spark {
- struct TradeInfo {
- public readonly SecurityImmutable security;
- public readonly TradeMessageImmutable trade;
-
- public TradeInfo(SecurityImmutable security, TradeMessageImmutable trade) {
- this.security = security;
- this.trade = trade;
- }
- }
-
class TimeAndSalesModel : IDisposable {
internal readonly SecurityCriteria security_criteria;
diff --git a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs
index 11a3a44ee..e2b5b8139 100644
--- a/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs
+++ b/src/client/spark/Modules/Market/TimeAndSales/TimeAndSalesVM.cs
@@ -137,7 +137,7 @@ namespace mbts.spark {
public Row(TimeAndSalesVM parent, SecurityImmutable security, TradeMessageImmutable trade) : base(security) {
_trade_key = trade.Key;
time = ((ulong)trade.Time).lldatetime().ToLocalTime();
- price = trade.Mantissa * Math.Pow(10, trade.Exponent);
+ price = trade.price();
size = trade.Size;
aggressor_side = trade.AggressorSide;
show_ladder = new DelegateCommand(() => parent._show_ladder_async(this).ignore());
diff --git a/src/client/spark/Modules/Settings/SettingsShellModule.cs b/src/client/spark/Modules/Settings/SettingsShellModule.cs
index 005dd648b..ce995d025 100644
--- a/src/client/spark/Modules/Settings/SettingsShellModule.cs
+++ b/src/client/spark/Modules/Settings/SettingsShellModule.cs
@@ -26,7 +26,10 @@ namespace bts.ui {
public SettingsShellModule(IBus bus, UserSettingsHub settings_hub, WorkspacesModel ws) {
// todo: settings dialog
ws_model = ws;
- var actions_list = new List(2) { SparkCommands.ShowWorkspaces };
+ var actions_list = new List(2) {
+ SparkCommands.ShowGlobalAlerts,
+ SparkCommands.ShowWorkspaces
+ };
if (Configuration.get().enabled) {
actions_list.Add(SparkCommands.ShowSettings);
}
diff --git a/src/client/spark/Modules/Trading/Ladder/VM/LadderSettingsVM.cs b/src/client/spark/Modules/Trading/Ladder/VM/LadderSettingsVM.cs
index 7a5684d48..8522cedcc 100644
--- a/src/client/spark/Modules/Trading/Ladder/VM/LadderSettingsVM.cs
+++ b/src/client/spark/Modules/Trading/Ladder/VM/LadderSettingsVM.cs
@@ -137,7 +137,7 @@ namespace mbts.spark {
c.PropertyChanged -= on_prop_changed;
}
AccountTuple? account_factory(uint key, string name) => new AccountTuple(key, name);
- AlgoDefinitionVM algo_factory(AlgoData data) => AlgoDefinitionVM.create(_model, data);
+ AlgoDefinitionVM algo_factory(AlgoData data) => AlgoDefinitionVM.create(_model, data, is_synthetic ? AlgoFormats.Spreader : AlgoFormats.Exchange);
}
public event Action result_changed;
diff --git a/src/client/spark/Modules/Trading/PNL/Settings/PNLColumnVM.cs b/src/client/spark/Modules/Trading/PNL/Settings/PNLColumnVM.cs
index 1f755e862..5cf3749c4 100644
--- a/src/client/spark/Modules/Trading/PNL/Settings/PNLColumnVM.cs
+++ b/src/client/spark/Modules/Trading/PNL/Settings/PNLColumnVM.cs
@@ -79,11 +79,11 @@ namespace bts.shell.pnl {
target.with(
font_weight_override: new NullableFontWeightProto(is_font_weight_overridden ? font_weight_override : (FontWeight?)null),
font_color_override: new NullableColorProto(is_font_color_overridden ? font_color_override.color : (Color?)null),
- background_override: new NullableColorProto(is_background_overridden ? background_override.color : (Color?)null));
+ background_color_override: new NullableColorProto(is_background_overridden ? background_override.color : (Color?)null));
public void load(GridColumnSettings settings) {
if (settings != null)
- load(settings.font_weight_override, settings.font_color_override, settings.background_override);
+ load(settings.font_weight_override, settings.font_color_override, settings.background_color_override);
}
public void load(FontParamsProto font_params) {
diff --git a/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs b/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs
index 2d94e0645..0a5fcd5fb 100644
--- a/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs
+++ b/src/client/spark/Modules/Trading/PNL/Settings/PNLSettings.cs
@@ -100,7 +100,11 @@ namespace bts.shell.pnl {
}
};
- public static GridSettings DefaultGridSettings => GridSettings.Default.with(DefaultColumns.all, DefaultColumns.default_sorting_criterion);
+ public static GridSettings DefaultGridSettings =>
+ GridSettings.Default.with(
+ DefaultColumns.all,
+ DefaultColumns.default_sorting_criterion,
+ enable_background_color: true);
public static fills.FillsSettings DefaultAuxiliaryFills {
get {
diff --git a/src/client/spark/Modules/Trading/PNL/Settings/PNLSettingsVM.cs b/src/client/spark/Modules/Trading/PNL/Settings/PNLSettingsVM.cs
index 62bd9f770..eec72cab8 100644
--- a/src/client/spark/Modules/Trading/PNL/Settings/PNLSettingsVM.cs
+++ b/src/client/spark/Modules/Trading/PNL/Settings/PNLSettingsVM.cs
@@ -48,9 +48,7 @@ namespace bts.shell.pnl {
var col_vm = new PNLColumnVM(core_settings_vm, EnumHelper.parse(col_settings.id));
col_vm.load_from(col_settings);
return col_vm;
- }) {
- can_edit_background = true
- };
+ });
core_settings_vm.selection_highlight.bind_opacity_to_alpha = true;
_dispose = Disposable.Create(
anchor_items.Subscribe((s, e) => _sync_anchors.execute()));
diff --git a/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs b/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs
index aa30d61f6..f445a7b92 100644
--- a/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs
+++ b/src/client/spark/Modules/Trading/PNL/VM/PNLVM.cs
@@ -352,7 +352,7 @@ namespace bts.shell.pnl {
var dabd = from.ToBuilder();
foreach (var k in EnumHelper.get_values()) {
if (GridSettingsHelper.try_find_column(col_settings, k, out var match))
- dabd[k] = new PNLCellAppearance(match.font_color_override, match.background_override, match.font_weight_override).merge(fallback_appearance);
+ dabd[k] = new PNLCellAppearance(match.font_color_override, match.background_color_override, match.font_weight_override).merge(fallback_appearance);
}
from = dabd.ToImmutable();
}
diff --git a/src/client/spark/Notifications/INotificationService.cs b/src/client/spark/Notifications/INotificationService.cs
index bb9437610..47e61a63a 100644
--- a/src/client/spark/Notifications/INotificationService.cs
+++ b/src/client/spark/Notifications/INotificationService.cs
@@ -4,6 +4,7 @@ using bts.api.orderman;
using bts.collections;
using bts.spark;
using mbts;
+using mbts.co2;
using mbts.collections;
using mbts.spark;
using mbts.ui;
@@ -13,6 +14,7 @@ using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Reactive.Linq;
+using System.Reactive.Subjects;
namespace bts.shell {
interface INotificationService {
@@ -22,25 +24,48 @@ namespace bts.shell {
IDisposable link_to_activity(INotificationPredicate toast_notification_predicate);
IDisposable link_to_order(IPredicate predicate, SoundNotification sound);
IDisposable link_to_order(INotificationPredicate toast_notification_predicate);
+ // Note: security criteria should not be incorporated in the predicate's 'trigger' impl.
+ // It is easier/cleaner if the INotificationService incorporates the criteria internally.
+ IDisposable link_to_trades(SecurityCriteria security_criteria, IPredicate predicate, SoundNotification sound);
}
[Export(typeof(INotificationService))]
partial class NotificationService : INotificationService, IDisposable {
+ // activity notifications
readonly NotificationProcessor _activity_notifications;
+ // order notifications
readonly NotificationProcessor _order_notifications;
+ // trade notifications
+ readonly NotificationProcessor _trade_notifications;
+ readonly MDConsumer _consumer;
+ readonly Subject> _trade_criteria_subject = new Subject>();
+ readonly RefCountMap _trade_criteria_refs = new RefCountMap();
+ readonly object _trade_lock = new object();
+ //
readonly DataCache _data_cache = new DataCache();
+ readonly LoggerContext _log = new LoggerContext(Log.Ui, "Notification Service ", null);
IDisposable _dispose;
[ImportingConstructor]
- public NotificationService(IBus bus, INotifier notifier, OrdersModel orders_model) {
+ public NotificationService(IBus bus, INotifier notifier, OrdersModel orders_model, MDConsumer consumer) {
this.notifier = notifier;
_activity_notifications = new NotificationProcessor(notifier);
_order_notifications = new NotificationProcessor(notifier);
+ _trade_notifications = new NotificationProcessor(notifier);
+ _consumer = consumer;
_dispose = Disposable.Create(
bus.subscribe(SparkTags.LogActivity).Subscribe(_on_activity),
- orders_model.on_orders.Subscribe(_on_orders)
- );
+ orders_model.on_orders.Subscribe(_on_orders),
+ TradesSource.create(
+ consumer,
+ bus.subscribe(SparkTags.SecuritiesTag).BufferLatest(TimeSpan.FromSeconds(2))
+ .Table(s => s.security.Id)
+ .Where(t => t.has_changes())
+ .Select(m => MappedDictionary.create(m.state, smd => smd.security)),
+ _trade_criteria_subject,
+ TimeSpan.FromSeconds(0.2))
+ .Subscribe(_trade_notifications.process_items));
}
[Export(typeof(INotificationServiceDataCache))]
@@ -51,8 +76,42 @@ namespace bts.shell {
public IDisposable link_to_activity(INotificationPredicate toast_notification_predicate) => _activity_notifications.link(toast_notification_predicate);
public IDisposable link_to_order(IPredicate predicate, SoundNotification sound) => _order_notifications.link(predicate, sound);
public IDisposable link_to_order(INotificationPredicate toast_notification_predicate) => _order_notifications.link(toast_notification_predicate);
+
+ public IDisposable link_to_trades(SecurityCriteria security_criteria, IPredicate predicate, SoundNotification sound) {
+ if (predicate == null) {
+ _log.warn("cannot create trade alert sound because the specified predicate is null.");
+ return Disposable.empty;
+ }
+ if (!security_criteria.is_defined()) {
+ // there are simply too many trades to support universal-product predicates, therefor a product filter must be specified (aka SecrityCriteria).
+ _log.warn("cannot create trade alert sound because the specified security criteria is not defined.");
+ return Disposable.empty;
+ }
+ // This criteria predicate may be redundant, but it safe guards against a case
+ // where the criteria has not been incorporated into the predicate,
+ // as there doesn't seem to be a great way to require this in the interface.
+ // Note: verifying the criteria twice (instead of once) should not hurt on perf at all.
+ predicate = predicate.and(PredicateBuilder.create(t => ContractPickerModel.security_in_criteria(security_criteria, t.security)));
+ var link = _trade_notifications.link(predicate, sound);
+ lock (_trade_lock) {
+ if (_trade_criteria_refs.increment_adds_key(security_criteria))
+ _reset_trade_readers();
+ }
+ return Disposable.Create(() => {
+ Disposable.dispose(ref link);
+ lock (_trade_lock) {
+ if (_trade_criteria_refs.decrement_removes_key(security_criteria))
+ _reset_trade_readers();
+ }
+ });
+ }
+
public void Dispose() => Disposable.dispose(ref _dispose);
+ /// should only call this within a locked scope ()
+ void _reset_trade_readers() =>
+ _trade_criteria_subject.OnNext(_trade_criteria_refs.Keys);
+
void _on_activity(Activity activity) =>
_activity_notifications.process_item(activity);
@@ -128,6 +187,31 @@ namespace bts.shell {
if (sounds.Count > 0 || toast.Count > 0)
_notifier.notify(toast, sounds);
}
+
+ public void process_items(IEnumerable source) {
+ var sounds = new HashSet();
+ var toast = new HashSet();
+ var temp_sound_triggers = _sound_trigger_refs;
+ if (temp_sound_triggers.Count > 0) {
+ foreach (var v in source) {
+ foreach (var trigger_kv in temp_sound_triggers) {
+ if (trigger_kv.Key.trigger(v))
+ sounds.AddRange(trigger_kv.Value.Keys);
+ }
+ }
+ }
+ var temp_toast_triggers = _toast_trigger_refs;
+ if (temp_toast_triggers.Count > 0) {
+ foreach (var v in source) {
+ foreach (var trigger_kv in temp_toast_triggers) {
+ if (trigger_kv.Key.trigger(v) is IToastNotification tn && tn.pass)
+ toast.Add(tn);
+ }
+ }
+ }
+ if (sounds.Count > 0 || toast.Count > 0)
+ _notifier.notify(toast, sounds);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/client/spark/Notifications/SoundNotification.cs b/src/client/spark/Notifications/SoundNotification.cs
index 4125b3d95..b496317c8 100644
--- a/src/client/spark/Notifications/SoundNotification.cs
+++ b/src/client/spark/Notifications/SoundNotification.cs
@@ -1,9 +1,7 @@
-using mbts;
-using mbts.ui.utility;
+using bts.utils;
using ProtoBuf;
using System;
using System.ComponentModel;
-using System.Text;
namespace bts.shell {
enum LicenseType {
@@ -33,7 +31,7 @@ namespace bts.shell {
}
[ProtoContract]
- class SoundNotification {
+ class SoundNotification : IEquatable {
SystemSound? _system_sound;
string _uri_sound;
@@ -81,6 +79,19 @@ namespace bts.shell {
[ProtoMember(2)]
public string uri_sound { get => _uri_sound; set => _set_ref_type(ref _uri_sound, value); }
+ public bool Equals(SoundNotification other) =>
+ other != null &&
+ _system_sound == other._system_sound &&
+ _uri_sound == other._uri_sound;
+
+ public override bool Equals(object obj) =>
+ Equals(obj as SoundNotification);
+
+ public override int GetHashCode() =>
+ EqualityComparer.auto_phase(
+ _system_sound.GetHashCode(),
+ _uri_sound?.GetHashCode() ?? 0);
+
void _set(ref T? field, T? value) where T : struct {
if (value != null) {
_clear_values();
diff --git a/src/client/spark/Orders/OrderUtils.cs b/src/client/spark/Orders/OrderUtils.cs
index 36d2d7e1c..6bc4cc7c6 100644
--- a/src/client/spark/Orders/OrderUtils.cs
+++ b/src/client/spark/Orders/OrderUtils.cs
@@ -1,5 +1,6 @@
using bts.api;
using bts.api.orderman;
+using bts.co2;
using bts.spark;
using bts.utils;
using mbts.spark.utilities;
@@ -339,5 +340,13 @@ namespace mbts.spark {
return string.Empty;
}
}
+
+ public static AggressorSide to_aggressor(this Side side) {
+ switch (side) {
+ case Side.Buy: return AggressorSide.Buy;
+ case Side.Sell: return AggressorSide.Sell;
+ default: return AggressorSide.None;
+ }
+ }
}
}
diff --git a/src/client/spark/Predicates/Data/Primitive/DoublePredicate.cs b/src/client/spark/Predicates/Data/Primitive/DoublePredicate.cs
index 814ba0b54..997e45b85 100644
--- a/src/client/spark/Predicates/Data/Primitive/DoublePredicate.cs
+++ b/src/client/spark/Predicates/Data/Primitive/DoublePredicate.cs
@@ -61,6 +61,17 @@ namespace mbts {
}
}
+ public static DoublePredicate create(PredicateTypeOneofCase type, double min, double max) {
+ var rv = new DoublePredicate();
+ switch (type) {
+ case PredicateTypeOneofCase.GreaterThan: rv.greater_than = min; break;
+ case PredicateTypeOneofCase.LessThan: rv.less_than = max; break;
+ case PredicateTypeOneofCase.InsideRange: rv.inside_range = new DoubleRange(min, max); break;
+ case PredicateTypeOneofCase.OutsideRange: rv.outside_range = new DoubleRange(min, max); break;
+ }
+ return rv;
+ }
+
public IPredicate create() {
switch (predicate_type_case) {
case PredicateTypeOneofCase.GreaterThan: return PredicateBuilder.greater_than(_greater_than.Value);
diff --git a/src/client/spark/Predicates/IPredicate.cs b/src/client/spark/Predicates/IPredicate.cs
index bd881c697..c5ae09899 100644
--- a/src/client/spark/Predicates/IPredicate.cs
+++ b/src/client/spark/Predicates/IPredicate.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Linq;
namespace mbts {
interface IPredicate {
@@ -34,9 +35,15 @@ namespace mbts {
public static IPredicate greater_than(T value) =>
new GreaterThanTrigger(value, Comparer.Default);
+ public static IPredicate greater_than_or_equal_to(T value) =>
+ new GreaterThanOrEqualToTrigger(value, Comparer.Default);
+
public static IPredicate less_than(T value) =>
greater_than(value).negate();
+ public static IPredicate less_than_or_equal_to(T value) =>
+ greater_than_or_equal_to(value).negate();
+
public static IPredicate inside_range(T minimum, T maximum) =>
greater_than(minimum).and(less_than(maximum));
@@ -67,6 +74,14 @@ namespace mbts {
public static IPredicate not_in_set(ISet set) =>
in_set(set).negate();
+ public static IPredicate and_safe(this IPredicate first, IPredicate second) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+ return and(first, second);
+ }
+
public static IPredicate and(this IPredicate first, IPredicate second) =>
new AndTrigger(first, second);
@@ -88,7 +103,7 @@ namespace mbts {
public static IPredicate state_transition(Func predicate) {
// avoid false-positive in the first callback
bool last_result = true;
- return new AnonymousMutableTrigger(v => {
+ return new AnonymousTrigger(v => {
bool curr_result = predicate(v);
if (last_result == curr_result) {
return false;
@@ -97,7 +112,7 @@ namespace mbts {
}
#region Implementation
- class EqualsTrigger : IPredicate {
+ class EqualsTrigger : IPredicate, IEquatable> {
readonly T _value;
readonly IEqualityComparer _eq_comparer;
@@ -106,12 +121,26 @@ namespace mbts {
_eq_comparer = eq_comparer;
}
- public bool trigger(T value) => _eq_comparer.Equals(value, _value);
+ public bool trigger(T value) =>
+ _eq_comparer.Equals(value, _value);
- public override string ToString() => $"EqualsTrigger ({typeof(T)})";
+ public override string ToString() =>
+ $"EqualsTrigger ({typeof(T)})";
+
+ public bool Equals(EqualsTrigger other) =>
+ other != null &&
+ // check equality with both IEqualityComparers
+ _eq_comparer.Equals(_value, other._value) &&
+ other._eq_comparer.Equals(_value, other._value);
+
+ public override bool Equals(object obj) =>
+ Equals(obj as EqualsTrigger);
+
+ public override int GetHashCode() =>
+ _eq_comparer.GetHashCode(_value);
}
- class AndTrigger : IPredicate {
+ class AndTrigger : IPredicate, IEquatable> {
readonly IPredicate _first, _second;
public AndTrigger(IPredicate first, IPredicate second) {
@@ -119,18 +148,28 @@ namespace mbts {
_second = second;
}
- public bool trigger(T value) => _first.trigger(value) && _second.trigger(value);
+ public bool trigger(T value) =>
+ _first.trigger(value) &&
+ _second.trigger(value);
- public override string ToString() => $"AndTrigger ({_first}, {_second})";
+ public bool Equals(AndTrigger other) =>
+ other != null &&
+ _first.Equals(other._first) &&
+ _second.Equals(other._second);
+
+ public override string ToString() =>
+ $"AndTrigger ({_first}, {_second})";
public override bool Equals(object obj) =>
- obj is AndTrigger t && _first.Equals(t._first) && _second.Equals(t._second);
+ Equals(obj as AndTrigger);
public override int GetHashCode() =>
- EqualityComparer.aggregate_hash(_first.GetHashCode(), _second.GetHashCode());
+ EqualityComparer.aggregate_hash(
+ _first.GetHashCode(),
+ _second.GetHashCode());
}
- class AndTrigger : IPredicate<(T1, T2)> {
+ class AndTrigger : IPredicate<(T1, T2)>, IEquatable> {
readonly IPredicate _first;
readonly IPredicate _second;
@@ -139,18 +178,28 @@ namespace mbts {
_second = second;
}
- public bool trigger((T1, T2) value) => _first.trigger(value.Item1) && _second.trigger(value.Item2);
+ public bool trigger((T1, T2) value) =>
+ _first.trigger(value.Item1) &&
+ _second.trigger(value.Item2);
+
+ public bool Equals(AndTrigger other) =>
+ other != null &&
+ _first.Equals(other._first) &&
+ _second.Equals(other._second);
public override bool Equals(object obj) =>
- obj is AndTrigger t && _first.Equals(t._first) && _second.Equals(t._second);
+ Equals(obj as AndTrigger);
public override int GetHashCode() =>
- EqualityComparer.aggregate_hash(_first.GetHashCode(), _second.GetHashCode());
+ EqualityComparer.aggregate_hash(
+ _first.GetHashCode(),
+ _second.GetHashCode());
- public override string ToString() => $"AndTrigger ({_first}, {_second})";
+ public override string ToString() =>
+ $"AndTrigger ({_first}, {_second})";
}
- class OrTrigger : IPredicate {
+ class OrTrigger : IPredicate, IEquatable> {
readonly IPredicate _first, _second;
public OrTrigger(IPredicate first, IPredicate second) {
@@ -160,16 +209,24 @@ namespace mbts {
public bool trigger(T value) => _first.trigger(value) || _second.trigger(value);
+ public bool Equals(OrTrigger other) =>
+ other != null &&
+ _first.Equals(other._first) &&
+ _second.Equals(other._second);
+
public override bool Equals(object obj) =>
- obj is OrTrigger t && _first.Equals(t._first) && _second.Equals(t._second);
+ Equals(obj is OrTrigger);
public override int GetHashCode() =>
- EqualityComparer.aggregate_hash(_first.GetHashCode(), _second.GetHashCode());
+ EqualityComparer.aggregate_hash(
+ _first.GetHashCode(),
+ _second.GetHashCode());
- public override string ToString() => $"OrTrigger ({_first}, {_second})";
+ public override string ToString() =>
+ $"OrTrigger ({_first}, {_second})";
}
- class OrTrigger : IPredicate<(T1, T2)> {
+ class OrTrigger : IPredicate<(T1, T2)>, IEquatable> {
readonly IPredicate _first;
readonly IPredicate _second;
@@ -178,15 +235,25 @@ namespace mbts {
_second = second;
}
- public bool trigger((T1, T2) value) => _first.trigger(value.Item1) || _second.trigger(value.Item2);
+ public bool trigger((T1, T2) value) =>
+ _first.trigger(value.Item1) ||
+ _second.trigger(value.Item2);
+
+ public bool Equals(OrTrigger other) =>
+ other != null &&
+ _first.Equals(other._first) &&
+ _second.Equals(other._second);
public override bool Equals(object obj) =>
- obj is OrTrigger t && _first.Equals(t._first) && _second.Equals(t._second);
+ Equals(obj as OrTrigger);
public override int GetHashCode() =>
- EqualityComparer.aggregate_hash(_first.GetHashCode(), _second.GetHashCode());
+ EqualityComparer.aggregate_hash(
+ _first.GetHashCode(),
+ _second.GetHashCode());
- public override string ToString() => $"OrTrigger ({_first}, {_second})";
+ public override string ToString() =>
+ $"OrTrigger ({_first}, {_second})";
}
class GreaterThanTrigger : IPredicate {
@@ -198,57 +265,109 @@ namespace mbts {
_comparer = comparer;
}
- public bool trigger(T value) => _comparer.Compare(value, _value) > 0;
+ public bool trigger(T value) =>
+ _comparer.Compare(value, _value) > 0;
- public override string ToString() => $"GreaterThanTrigger ({_value})";
+ public override string ToString() =>
+ $"GreaterThanTrigger ({_value})";
}
- class InSetTrigger: IPredicate {
+ class GreaterThanOrEqualToTrigger : IPredicate, IEquatable> {
+ readonly T _value;
+ readonly IComparer _comparer;
+
+ public GreaterThanOrEqualToTrigger(T value, IComparer comparer) {
+ _value = value;
+ _comparer = comparer;
+ }
+
+ public bool trigger(T value) =>
+ _comparer.Compare(value, _value) >= 0;
+
+ public bool Equals(GreaterThanOrEqualToTrigger other) =>
+ other != null &&
+ _comparer.Equals(other._comparer) &&
+ _comparer.Compare(_value, other._value) == 0;
+
+ public override bool Equals(object obj) =>
+ Equals(obj as GreaterThanOrEqualToTrigger);
+
+ public override int GetHashCode() =>
+ _value.GetHashCode();
+
+ public override string ToString() =>
+ $"GreaterThanTrigger ({_value})";
+ }
+
+ class InSetTrigger : IPredicate, IEquatable> {
readonly ISet _set;
public InSetTrigger(ISet set) =>
_set = set;
- public bool trigger(T value) => _set.Contains(value);
+ public bool trigger(T value) =>
+ _set.Contains(value);
+
+ public bool Equals(InSetTrigger other) =>
+ other != null &&
+ // check SetEquals with both sets (IEqualityComparers may differ)
+ _set.SetEquals(other._set) &&
+ other._set.SetEquals(_set);
public override bool Equals(object obj) =>
obj is InSetTrigger t && _set.SetEquals(t._set);
public override int GetHashCode() =>
- _set.GetHashCode();
+ EqualityComparer.auto_phase(_set.Take(8));
- public override string ToString() => $"InSetTrigger (Count: {_set.Count}, type: {typeof(T)})";
+ public override string ToString() =>
+ $"InSetTrigger (Count: {_set.Count}, type: {typeof(T)})";
}
- class WrapperTrigger : IPredicate {
+ class WrapperTrigger : IPredicate, IEquatable> {
readonly IPredicate _inner_trigger;
- readonly Func _selector;
+ readonly Func _selector;
- public WrapperTrigger(IPredicate inner_trigger, Func selector) {
+ public WrapperTrigger(IPredicate inner_trigger, Func selector) {
_inner_trigger = inner_trigger;
_selector = selector;
}
- public bool trigger(TOutter value) => _inner_trigger.trigger(_selector(value));
+ public bool trigger(TOuter value) =>
+ _inner_trigger.trigger(_selector(value));
+
+ public bool Equals(WrapperTrigger other) =>
+ other != null &&
+ _selector.Equals(other._selector) &&
+ _inner_trigger.Equals(other._inner_trigger);
public override bool Equals(object obj) =>
- obj is WrapperTrigger t && _inner_trigger.Equals(t._inner_trigger) && _selector.Equals(t._selector);
+ Equals(obj as WrapperTrigger);
public override int GetHashCode() =>
- EqualityComparer.aggregate_hash(_inner_trigger.GetHashCode(), _selector.GetHashCode());
+ EqualityComparer.aggregate_hash(
+ _inner_trigger.GetHashCode(),
+ _selector.GetHashCode());
- public override string ToString() => $"WrapperTrigger (outter-type {typeof(TOutter)}, inner-trigger: {_inner_trigger})";
+ public override string ToString() =>
+ $"WrapperTrigger (outer-type {typeof(TOuter)}, inner-trigger: {_inner_trigger})";
}
- class NegateTrigger : IPredicate {
+ class NegateTrigger : IPredicate, IEquatable> {
readonly IPredicate _trigger;
+
public NegateTrigger(IPredicate trigger) =>
_trigger = trigger;
- public bool trigger(T value) => !_trigger.trigger(value);
+ public bool trigger(T value) =>
+ !_trigger.trigger(value);
+
+ public bool Equals(NegateTrigger other) =>
+ other != null &&
+ _trigger.Equals(other._trigger);
public override bool Equals(object obj) =>
- obj is NegateTrigger t && _trigger.Equals(t._trigger);
+ Equals(obj as NegateTrigger);
public override int GetHashCode() =>
-_trigger.GetHashCode();
@@ -256,22 +375,22 @@ namespace mbts {
public override string ToString() => $"NegateTrigger ({_trigger})";
}
- class AnonymousTrigger : IPredicate {
+ class AnonymousTrigger : IPredicate, IEquatable> {
readonly Func _trigger;
public AnonymousTrigger(Func trigger) =>
_trigger = trigger;
- public bool trigger(T value) => _trigger(value);
+ public bool Equals(AnonymousTrigger other) =>
+ other != null &&
+ _trigger.Equals(other._trigger);
- public override string ToString() => $"AnonymousTrigger ({typeof(T)})";
- }
+ public bool trigger(T value) =>
+ _trigger(value);
- class AnonymousMutableTrigger : IPredicate {
- public AnonymousMutableTrigger(Func predicate) => this.predicate = predicate;
- public Func predicate { get; set; }
- public bool trigger(T value) => predicate(value);
+ public override string ToString() =>
+ $"AnonymousTrigger ({typeof(T)})";
}
#endregion
}
-}
\ No newline at end of file
+}
diff --git a/src/client/spark/Predicates/VM/DoublePredicateVM.cs b/src/client/spark/Predicates/VM/DoublePredicateVM.cs
new file mode 100644
index 000000000..b386192e8
--- /dev/null
+++ b/src/client/spark/Predicates/VM/DoublePredicateVM.cs
@@ -0,0 +1,33 @@
+using bts.proto;
+using mbts.ui.shell;
+
+namespace mbts.spark {
+ class DoublePredicateVM : ViewModelBase, IValueFactory {
+ double _minimum, _maximum;
+ DoublePredicate.PredicateTypeOneofCase _type;
+
+ public DoublePredicate.PredicateTypeOneofCase type { get => _type; set => Set(ref _type, value); }
+ public double minimum { get => _minimum; set => Set(ref _minimum, value); }
+ public double maximum { get => _maximum; set => Set(ref _maximum, value); }
+
+ public DoublePredicate create() =>
+ DoublePredicate.create(type, minimum, maximum);
+
+ public void load_from(DoublePredicate value) {
+ if (value == null)
+ return;
+ type = value.predicate_type_case;
+ switch (type) {
+ case DoublePredicate.PredicateTypeOneofCase.GreaterThan: minimum = value.greater_than.Value; break;
+ case DoublePredicate.PredicateTypeOneofCase.LessThan: maximum = value.less_than.Value; break;
+ case DoublePredicate.PredicateTypeOneofCase.InsideRange: _load_range(value.inside_range.Value); break;
+ case DoublePredicate.PredicateTypeOneofCase.OutsideRange: _load_range(value.outside_range.Value); break;
+ }
+ }
+
+ void _load_range(DoubleRange range) {
+ minimum = range.minimum;
+ maximum = range.maximum;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/Themes/generic.xaml b/src/client/spark/Themes/generic.xaml
index b6e396a42..78caf3cbf 100644
--- a/src/client/spark/Themes/generic.xaml
+++ b/src/client/spark/Themes/generic.xaml
@@ -339,7 +339,7 @@
-
+
diff --git a/src/client/spark/Trades/TradeInfo.cs b/src/client/spark/Trades/TradeInfo.cs
new file mode 100644
index 000000000..e1ee23f7a
--- /dev/null
+++ b/src/client/spark/Trades/TradeInfo.cs
@@ -0,0 +1,14 @@
+using bts.api;
+using bts.co2;
+
+namespace mbts.spark {
+ struct TradeInfo {
+ public readonly SecurityImmutable security;
+ public readonly TradeMessageImmutable trade;
+
+ public TradeInfo(SecurityImmutable security, TradeMessageImmutable trade) {
+ this.security = security;
+ this.trade = trade;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/Trades/TradeMessageExtensions.cs b/src/client/spark/Trades/TradeMessageExtensions.cs
new file mode 100644
index 000000000..f01a273d9
--- /dev/null
+++ b/src/client/spark/Trades/TradeMessageExtensions.cs
@@ -0,0 +1,9 @@
+using bts.co2;
+using System;
+
+namespace mbts.spark {
+ static class TradeMessageExtensions {
+ public static double price(this TradeMessageImmutable trade) =>
+ trade.Mantissa * Math.Pow(10, trade.Exponent);
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/Trades/TradesSource.cs b/src/client/spark/Trades/TradesSource.cs
new file mode 100644
index 000000000..032fbecfc
--- /dev/null
+++ b/src/client/spark/Trades/TradesSource.cs
@@ -0,0 +1,94 @@
+using bts.api;
+using bts.api.core;
+using bts.co2;
+using bts.utils;
+using mbts.co2;
+using mbts.utils;
+using System;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Reactive.Linq;
+
+namespace mbts.spark {
+ readonly struct Product : IEquatable {
+ public readonly string symbol;
+ public readonly SecurityType type;
+ public readonly Venue exchange;
+
+ public Product(string symbol, SecurityType type, Venue exchange) {
+ this.symbol = symbol;
+ this.type = type;
+ this.exchange = exchange;
+ }
+
+ public static Product from_security(SecurityImmutable security) =>
+ new Product(security.Symbol, security.security_type(), security.Exchange);
+
+ public bool Equals(Product other) =>
+ symbol == other.symbol &&
+ type == other.type &&
+ exchange == other.exchange;
+
+ public override bool Equals(object obj) =>
+ obj is Product other && Equals(other);
+
+ public override int GetHashCode() =>
+ EqualityComparer.auto_phase(
+ symbol?.GetHashCode() ?? 0,
+ type.GetHashCode(),
+ exchange.GetHashCode());
+
+ public static bool operator ==(Product a, Product b) => a.Equals(b);
+ public static bool operator !=(Product a, Product b) => !a.Equals(b);
+ }
+
+ static class TradesSource {
+ public static IEnumerable aggregate_security_criteria(IEnumerable securities, IEnumerable security_criterion) =>
+ securities.Where(s => security_criterion.Any(sc => ContractPickerModel.security_in_criteria(sc, s)))
+ .Select(Product.from_security)
+ .Distinct();
+
+ public static IObservable> create(MDConsumer consumer, IObservable> security_map, IObservable> security_criterion, TimeSpan poll_interval) =>
+ security_criterion.CombineLatest(security_map, (criterion, map) => (criterion, map))
+ .Scan((channels: ImmutableDictionary.Empty, active: new List(0)), (channel_data, data) => {
+ var (criterion, map) = data;
+ var (channels, active) = channel_data;
+ var products = aggregate_security_criteria(map.Values, criterion);
+ active = new List();
+ foreach (var p in products) {
+ if (!channels.TryGetValue(p, out var c)) {
+ c = new ChannelConsumer(consumer.get_channel(p.symbol, p.type, p.exchange), map.Values.Where(s => Product.from_security(s).Equals(p)));
+ channels = channels.Add(p, c);
+ }
+ active.Add(c);
+ }
+ return (channels, active);
+ }).SelectManyInSeries(channel_data => {
+ var (channels, active) = channel_data;
+ return Observable.Interval(poll_interval)
+ .Select(_ => active.SelectMany(c => c.read_trades()).ToList());
+ });
+
+ class ChannelConsumer {
+ readonly MDConsumerChannel _channel;
+ readonly Dictionary _securities;
+ long _cursor = 0;
+
+ public ChannelConsumer(MDConsumerChannel channel) =>
+ _channel = channel;
+
+ public ChannelConsumer(MDConsumerChannel channel, IEnumerable securities) {
+ _channel = channel;
+ _securities = securities.ToDictionaryCrushed(s => s.Id);
+ }
+
+ public IEnumerable read_trades() {
+ foreach (var tm in _channel.read_trades(ref _cursor)) {
+ if (tm != null && _securities.TryGetValue(tm.Key, out SecurityImmutable sec))
+ yield return new TradeInfo(sec, new TradeMessageImmutable(tm));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/core/Bus/SparkCommands.cs b/src/client/spark/core/Bus/SparkCommands.cs
index 23c625221..1c2e0cea5 100644
--- a/src/client/spark/core/Bus/SparkCommands.cs
+++ b/src/client/spark/core/Bus/SparkCommands.cs
@@ -110,6 +110,9 @@ namespace bts.spark {
public static SparkCommand ShowActivityLog =>
SparkCommand.create("Activity Log", Icons.Wrench, SparkTags.ShowActivityLog);
+ public static SparkCommand ShowGlobalAlerts =>
+ SparkCommand.create("Alerts", Icons.Speaker, SparkTags.ShowGlobalAlertsTag);
+
public static PartialCommand ShowReportIssue =>
SparkCommand.create("Report a Problem", Icons.Support, SparkTags.Support);
diff --git a/src/client/spark/core/Bus/SparkTags.cs b/src/client/spark/core/Bus/SparkTags.cs
index 71deddc26..a05477e7f 100644
--- a/src/client/spark/core/Bus/SparkTags.cs
+++ b/src/client/spark/core/Bus/SparkTags.cs
@@ -79,6 +79,8 @@ namespace mbts.spark {
public static ITag SyntheticDeleteTag { get; } = new SparkTag(nameof(SyntheticDeleteTag));
+ public static ITag ShowGlobalAlertsTag { get; } = new SparkTag(nameof(ShowGlobalAlertsTag));
+
public class Nothing { Nothing() { } }
internal class SparkTag : ITag {
diff --git a/src/client/spark/core/ShellInterface/UserSettings/Alerts/GlobalAlertSettings.cs b/src/client/spark/core/ShellInterface/UserSettings/Alerts/GlobalAlertSettings.cs
new file mode 100644
index 000000000..839049584
--- /dev/null
+++ b/src/client/spark/core/ShellInterface/UserSettings/Alerts/GlobalAlertSettings.cs
@@ -0,0 +1,29 @@
+using bts.utils;
+using ProtoBuf;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace mbts.spark {
+ [ProtoContract]
+ class GlobalAlertSettings : IEquatable {
+ [ProtoMember(1)]
+ TradeAlert[] _trade_alerts;
+
+ public GlobalAlertSettings() { }
+ public GlobalAlertSettings(IEnumerable trade_alerts) =>
+ _trade_alerts = trade_alerts.ToArray();
+
+ public IReadOnlyList trade_alerts => _trade_alerts ?? Array.Empty();
+
+ public bool Equals(GlobalAlertSettings other) =>
+ other != null &&
+ trade_alerts.SequenceEqual(other.trade_alerts);
+
+ public override bool Equals(object obj) =>
+ Equals(obj as GlobalAlertSettings);
+
+ public override int GetHashCode() =>
+ EqualityComparer.auto_phase(trade_alerts);
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/core/ShellInterface/UserSettings/Alerts/TradeAlertSettings.cs b/src/client/spark/core/ShellInterface/UserSettings/Alerts/TradeAlertSettings.cs
new file mode 100644
index 000000000..6892fdfa0
--- /dev/null
+++ b/src/client/spark/core/ShellInterface/UserSettings/Alerts/TradeAlertSettings.cs
@@ -0,0 +1,121 @@
+using bts.api;
+using bts.shell;
+using bts.utils;
+using ProtoBuf;
+using System;
+using System.Collections.Generic;
+
+namespace mbts.spark {
+ [ProtoContract]
+ readonly struct TradeAlert : IEquatable {
+ [ProtoMember(1)]
+ public readonly TradeAlertPredicate predicate;
+ [ProtoMember(2)]
+ public readonly SoundNotification sound;
+ [ProtoMember(3)]
+ public readonly bool is_enabled;
+
+ public TradeAlert(
+ TradeAlertPredicate predicate,
+ SoundNotification sound = null,
+ bool is_enabled = false) {
+ this.predicate = predicate;
+ this.sound = sound;
+ this.is_enabled = is_enabled;
+ }
+
+ public TradeAlert with(
+ TradeAlertPredicate? predicate = null,
+ SoundNotification sound = null,
+ bool? is_enabled = null) =>
+ //
+ new TradeAlert(
+ predicate ?? this.predicate,
+ sound ?? this.sound,
+ is_enabled ?? this.is_enabled);
+
+ public bool Equals(TradeAlert other) =>
+ predicate.Equals(other.predicate) &&
+ sound.safe_equals(other.sound) &&
+ is_enabled == other.is_enabled;
+
+ public override bool Equals(object obj) =>
+ obj is TradeAlert other && Equals(other);
+
+ public override int GetHashCode() =>
+ EqualityComparer.auto_phase(
+ predicate.GetHashCode(),
+ sound?.GetHashCode() ?? 0,
+ is_enabled.GetHashCode());
+
+ public static bool operator ==(TradeAlert a, TradeAlert b) => a.Equals(b);
+ public static bool operator !=(TradeAlert a, TradeAlert b) => !a.Equals(b);
+ }
+
+ [ProtoContract]
+ readonly struct TradeAlertPredicate : IEquatable {
+ [ProtoMember(1)]
+ public readonly SecurityCriteria security_criteria;
+ [ProtoMember(2)]
+ public readonly DoublePredicate quantity;
+ [ProtoMember(3)]
+ public readonly DoublePredicate price;
+ [ProtoMember(4)]
+ readonly Side[] _side;
+
+ public TradeAlertPredicate(
+ SecurityCriteria security_criteria = null,
+ DoublePredicate quantity = null,
+ DoublePredicate price = null,
+ Side[] side = null) {
+ this.security_criteria = security_criteria;
+ this.quantity = quantity;
+ this.price = price;
+ this._side = side;
+ }
+
+ public IReadOnlyList side => _side ?? Array.Empty();
+
+ public IPredicate create() {
+ IPredicate p = null;
+ // security criteria
+ var criteria = security_criteria;
+ if (criteria.is_defined()) {
+ p = p.and_safe(PredicateBuilder.create(t => ContractPickerModel.security_in_criteria(criteria, t.security)));
+ }
+ // quantity
+ var qpred = quantity?.create();
+ if (qpred != null)
+ p = p.and_safe(PredicateBuilder.wrap(qpred, t => t.trade.Size));
+ // price
+ var ppred = price?.create();
+ if (ppred != null)
+ p = p.and_safe(PredicateBuilder.wrap(ppred, t => t.trade.price()));
+ // side
+ if (_side != null && _side.Length == 1) {
+ var agg_side = _side[0].to_aggressor();
+ p = p.and_safe(PredicateBuilder.create(t => agg_side == t.trade.AggressorSide));
+ }
+ return p;
+ }
+
+ public bool Equals(TradeAlertPredicate other) =>
+ security_criteria.safe_equals(other.security_criteria) &&
+ quantity == other.quantity &&
+ price == other.price &&
+ EqualityComparer.safe_sequence_equals(_side, other._side);
+
+ public override bool Equals(object obj) =>
+ obj is TradeAlertPredicate other && Equals(other);
+
+ public override int GetHashCode() =>
+ EqualityComparer.auto_phase(
+ security_criteria?.GetHashCode() ?? 0,
+ quantity.GetHashCode(),
+ price.GetHashCode(),
+ _side != null && _side.Length == 1 ? (int)_side[0] : 0);
+
+ public static bool operator ==(TradeAlertPredicate a, TradeAlertPredicate b) => a.Equals(b);
+ public static bool operator !=(TradeAlertPredicate a, TradeAlertPredicate b) => !a.Equals(b);
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs b/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs
index 3415cc6da..4d08ae5db 100644
--- a/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs
+++ b/src/client/spark/core/ShellInterface/UserSettings/UserSettings.cs
@@ -59,6 +59,8 @@ namespace mbts.spark {
bts.shell.orderbook.OrderBookGridSettings _order_book_grid;
[ProtoMember(13)]
PNLSettings _pnl;
+ [ProtoMember(14)]
+ GlobalAlertSettings _alerts;
public UserSettings() { }
@@ -77,6 +79,8 @@ namespace mbts.spark {
public PNLSettings pnl => _pnl ?? (_pnl = PNLSettings.Default);
public bts.shell.orderbook.OrderBookGridSettings order_book_grid => _order_book_grid ?? (_order_book_grid = bts.shell.orderbook.OrderBookStartupData.Default.grid_settings_wrapper());
+ public GlobalAlertSettings alerts => _alerts ?? (_alerts = new GlobalAlertSettings());
+
public UserSettings with(LadderSettings ladder = null,
LadderSettingsProfile[] ladder_profiles = null,
NotificationSettings notification = null,
@@ -86,7 +90,8 @@ namespace mbts.spark {
GridSettings provided_synthetic_management_gridsettings = null,
GridSettings provided_pnl_gridsettings = null,
PNLSettings pnl = null,
- bts.shell.orderbook.OrderBookGridSettings order_book_grid = null) {
+ bts.shell.orderbook.OrderBookGridSettings order_book_grid = null,
+ GlobalAlertSettings alerts = null) {
var us = new UserSettings(ladder_profiles ?? _ladder_profiles) {
_ladder = ladder ?? _ladder,
_notification = notification ?? _notification,
@@ -97,6 +102,7 @@ namespace mbts.spark {
_pnl_grid = provided_pnl_gridsettings ?? _pnl_grid,
_pnl = pnl ?? _pnl,
_order_book_grid = order_book_grid ?? _order_book_grid,
+ _alerts = alerts ?? _alerts
};
us._last_ladder_profile_id = Math.Max(_last_ladder_profile_id, us.ladder_profiles.Select(p => p.id).MaxOrDefault());
return us;
@@ -181,4 +187,4 @@ namespace mbts.spark {
public TimeSpan? duration => _mode == Mode.Flash ? _duration?.ToTimeSpan() ?? TimeSpan.FromSeconds(5) : new TimeSpan?();
public double max_height => _max_height;
}
-}
\ No newline at end of file
+}
diff --git a/src/client/spark/core/Utility/IPropertyWrapperVM.cs b/src/client/spark/core/Utility/IPropertyWrapperVM.cs
index 7db97a542..b8cd8b8da 100644
--- a/src/client/spark/core/Utility/IPropertyWrapperVM.cs
+++ b/src/client/spark/core/Utility/IPropertyWrapperVM.cs
@@ -59,6 +59,22 @@ namespace mbts.spark {
interface ITemplatedPropertyWrapperVM : IPropertyWrapperVM, ITemplateSelectorKey { }
+ static class ValueFactoryUtils {
+ public static void sync_with_models(this IList target, IEnumerable models) where TValueFactory : IValueFactory, new() {
+ target.sync_with_models(
+ models,
+ m => {
+ var vf = new TValueFactory();
+ vf.load_from(m);
+ return vf;
+ },
+ (vf, m) => {
+ vf.load_from(m);
+ return vf;
+ });
+ }
+ }
+
static class PropertyWrapperVMUtils {
public static T create_assigned(this IPropertyWrapperVM vm) where T : new() =>
vm.create_assigned(() => new T());
diff --git a/src/client/spark/core/data/Proto/ColorOpacityProto.cs b/src/client/spark/core/data/Proto/ColorOpacityProto.cs
index c67e51d37..b5d69b2d6 100644
--- a/src/client/spark/core/data/Proto/ColorOpacityProto.cs
+++ b/src/client/spark/core/data/Proto/ColorOpacityProto.cs
@@ -22,6 +22,7 @@ namespace bts.proto {
}
public Color color => _color.rgb_color();
+ public Color argb_color => Color.FromArgb((byte)(MathUtils.within_range(0, 1, _opacity) * 255.0), color.R, color.G, color.B);
public double opacity => _opacity;
public ColorOpacityProto with(uint? color = null, double? opacity = null) =>
diff --git a/src/client/spark/core/data/Proto/NullableColorProto.cs b/src/client/spark/core/data/Proto/NullableColorProto.cs
index 5ffb50953..958f2ebca 100644
--- a/src/client/spark/core/data/Proto/NullableColorProto.cs
+++ b/src/client/spark/core/data/Proto/NullableColorProto.cs
@@ -31,4 +31,4 @@ namespace bts.proto {
public static bool operator ==(NullableColorProto a, NullableColorProto b) => a.Equals(b);
public static bool operator !=(NullableColorProto a, NullableColorProto b) => !a.Equals(b);
}
-}
\ No newline at end of file
+}
diff --git a/src/client/spark/view/Colors.xaml b/src/client/spark/view/Colors.xaml
index e7ebf4f93..c70363e60 100644
--- a/src/client/spark/view/Colors.xaml
+++ b/src/client/spark/view/Colors.xaml
@@ -113,6 +113,9 @@
+
+ #FF4182F6
+
#3D25A0DA
#FF26A0DA
diff --git a/src/client/spark/view/Controls/Adorners/RowSelectionAdorner.cs b/src/client/spark/view/Controls/Adorners/RowSelectionAdorner.cs
new file mode 100644
index 000000000..e6079090d
--- /dev/null
+++ b/src/client/spark/view/Controls/Adorners/RowSelectionAdorner.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using bts.utils;
+using mbts.ui.extensions;
+
+namespace mbts.ui.controls.adorners {
+ public class RowSelectionAdorner : Adorner, DIYGrid.ISelectionHighlightListener, IDisposable {
+ Brush _fill = DIYGrid.DefaultSelectionHighlight;
+ Pen _stroke = DIYGrid.DefaultSelectionStroke;
+
+ DIYGridRowsPresenter _diy_rp;
+ ScrollViewer _diy_scroll;
+ ScrollContentPresenter _diy_scp;
+ List _disposables = new List();
+
+ #region Fill
+ public static readonly DependencyProperty FillProperty =
+ WPFHelper.create_dp(
+ nameof(Fill),
+ FrameworkPropertyMetadataOptions.AffectsRender,
+ (o, v) => o._fill = v,
+ DIYGrid.DefaultSelectionHighlight);
+
+ public SolidColorBrush Fill {
+ get => GetValue(FillProperty) as SolidColorBrush;
+ set => SetValue(FillProperty, value);
+ }
+ #endregion
+ #region Stroke
+ public static readonly DependencyProperty StrokeProperty =
+ WPFHelper.create_dp(
+ nameof(Stroke),
+ FrameworkPropertyMetadataOptions.AffectsRender,
+ (o, v) => o._stroke = v,
+ DIYGrid.DefaultSelectionStroke);
+
+ public Pen Stroke {
+ get => GetValue(StrokeProperty) as Pen;
+ set => SetValue(StrokeProperty, value);
+ }
+ #endregion
+
+ internal RowSelectionAdorner(DIYGridRowsPresenter adorned_element, ScrollViewer scroll_viewer) : base(adorned_element) {
+ // we want our clicks to go through to the underlying grid
+ IsHitTestVisible = false;
+
+ _diy_rp = adorned_element;
+ _diy_scroll = scroll_viewer;
+ _diy_scp = _diy_rp.descendants_of_type().empty_if_null().FirstOrDefault();
+
+ // We actually don't need mouse up/down or key up/down when we can just respond to selection changes
+ _disposables.Add(((System.Windows.Controls.Primitives.Selector)_diy_rp).SubscribeSelectionChanged((s, e) => InvalidateVisual()));
+ // so that we update the highlight as the grid scrolls
+ _disposables.Add(_diy_scroll.SubscribeScrollChanged((s, e) => InvalidateVisual()));
+ }
+
+
+ protected override void OnRender(DrawingContext drawingContext) {
+ base.OnRender(drawingContext);
+ if (AdornedElement is ListBox lb && lb.SelectedItems != null && lb.SelectedItems.Count > 0) {
+ foreach(var lbi in lb.SelectedItems) {
+ if (_diy_rp.ItemContainerGenerator.ContainerFromItem(lbi) is FrameworkElement row && row.IsVisible) {
+ var top_left = lb.GetChildTopLeft(row);
+ var top_is_within_bounds = top_left.Y >= 0;
+
+ // Note that the top of the row can still technically be visible but we wont show
+ // the adorner rectangle b/c the bottom of the row will be obscured by the scrollbar
+ var bottom_is_within_bounds = lb.GetChildBounds(row).BottomRight.Y <= _diy_scroll.ActualHeight;
+ if (top_is_within_bounds && bottom_is_within_bounds) {
+ // we use the scroll content presenter in the X point calculation instead of the row
+ // because of the OB which has a right side panel that takes up some space over
+ // row width
+ drawingContext.DrawRectangle(_fill,
+ _stroke,
+ new Rect(top_left, new Point(top_left.X + _diy_scp.ActualWidth, top_left.Y + row.ActualHeight)));
+ }
+ }
+ }
+ }
+ }
+
+ public void on_selection_fill(SolidColorBrush selection_fill) {
+ Fill = selection_fill;
+ Stroke = new Pen(selection_fill.Color.to_solid_brush(), 1);
+ InvalidateVisual();
+ }
+
+ public void Dispose() {
+ _disposables.DisposeAll();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/client/spark/view/Controls/DIYGrid/CellRender/HyperlinkCell.cs b/src/client/spark/view/Controls/DIYGrid/CellRender/HyperlinkCell.cs
index 4e65114a9..0e8fb5abf 100644
--- a/src/client/spark/view/Controls/DIYGrid/CellRender/HyperlinkCell.cs
+++ b/src/client/spark/view/Controls/DIYGrid/CellRender/HyperlinkCell.cs
@@ -361,11 +361,6 @@ namespace mbts.ui.controls {
}
drawingContext.Pop();
}
- if (bg != null) {
- var bgo = DIYGrid.GetBackgroundOverlay(this);
- if (bgo != null)
- drawingContext.DrawRectangle(bgo, null, rect);
- }
}
static Thickness _underline_padding(Thickness padding) =>
@@ -393,4 +388,4 @@ namespace mbts.ui.controls {
InvalidateVisual();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs b/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs
index 409540b85..eb06ac295 100644
--- a/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Columns/ColumnBase.cs
@@ -217,7 +217,7 @@ namespace mbts.ui.controls {
}
public interface ISelectionHighlightListener {
- void on_selection_fill(Brush selection_fill);
+ void on_selection_fill(SolidColorBrush selection_fill);
}
// To include extra data with your column type you are encouraged to derive from DIYGridColumn
@@ -226,10 +226,12 @@ namespace mbts.ui.controls {
GridColumnSettings _settings;
FontWeight _fallback_font_weight;
Color _fallback_font_color;
+ Color _fallback_background_color;
double _fallback_font_size;
FontFamily _fallback_font_family;
FontWeight? _font_weight_override;
Color? _font_color_override;
+ Color? _background_color_override;
object _header_copy;
bool _is_visible;
@@ -237,6 +239,7 @@ namespace mbts.ui.controls {
var gs = GridSettings.Default;
_fallback_font_weight = gs.font_weight;
_fallback_font_color = gs.font_color.rgb_color();
+ _fallback_background_color = gs.background_color.argb_color();
_fallback_font_size = gs.font_size;
_fallback_font_family = new FontFamily(gs.font_family);
original_width = double.NaN;
@@ -279,6 +282,9 @@ namespace mbts.ui.controls {
public FontWeight font_weight => font_weight_override ?? _fallback_font_weight;
public Color font_color => font_color_override ?? _fallback_font_color;
public Brush font_brush => new SolidColorBrush(font_color);
+ public Color? background_color_override { get => _background_color_override; set => _set_font_param(ref _background_color_override, value); }
+ public Color? background_color => background_color_override ?? _fallback_background_color;
+ public Brush background_brush => background_color?.to_brush();
public GridColumnSettings settings => _settings ?? (_settings = create());
// TODO: find a better way to store the header-property in a thread-safe manner - a value for GridSettings.display_name, more specifically.
// Since save_state is called from a different thread in IShared/SlowWindows, it is not safe to access the DependencyProperty store from that method.
@@ -291,7 +297,7 @@ namespace mbts.ui.controls {
/// important: don't access any dependency props in here.
/// this may be called from a thread other than that of this dispatcher (i.e., when is called).
public GridColumnSettings create() =>
- new GridColumnSettings(id, _header_copy?.ToString(), is_visible, is_collapsed, font_weight_override, font_color_override, ActualWidth, horizontal_alignment, horizontal_offset);
+ new GridColumnSettings(id, _header_copy?.ToString(), is_visible, is_collapsed, font_weight_override, font_color_override, ActualWidth, horizontal_alignment, horizontal_offset, background_color_override);
void _set_font_param(ref T field, T value) {
field = value;
@@ -303,7 +309,7 @@ namespace mbts.ui.controls {
return;
_settings = settings;
using (ReflectionHelper.detect_property_changes(this, raise_prop_changed, nameof(is_visible), nameof(is_collapsed), nameof(font_weight_override), nameof(font_weight),
- nameof(font_color_override), nameof(font_color), nameof(font_brush), nameof(font_family), nameof(font_size), nameof(horizontal_alignment), nameof(horizontal_offset))) {
+ nameof(font_color_override), nameof(font_color), nameof(font_brush), nameof(font_family), nameof(font_size), nameof(horizontal_alignment), nameof(horizontal_offset), nameof(background_color_override), nameof(background_color), nameof(background_brush))) {
//
id = settings.id;
if (!string.IsNullOrEmpty(settings.display_name))
@@ -314,21 +320,22 @@ namespace mbts.ui.controls {
font_color_override = settings.font_color_override;
horizontal_alignment = settings.horizontal_alignment;
horizontal_offset = settings.horizontal_offset;
+ background_color_override = settings.background_color_override;
}
if (original_width != settings.width) {
original_width = settings.width;
Width = original_width;
}
//
- raise_prop_changed(nameof(ColumnBase.settings));
}
// 'fallback' font-params (aka 'grid-level' font-params)
- public void set_fallback_font_params(FontFamily font_family, double font_size, Color font_color, FontWeight font_weight) {
- using (ReflectionHelper.detect_property_changes(this, raise_prop_changed, nameof(font_family), nameof(font_size), nameof(font_color), nameof(font_weight))) {
+ public void set_fallback_font_params(FontFamily font_family, double font_size, Color font_color, FontWeight font_weight, Color background_color) {
+ using (ReflectionHelper.detect_property_changes(this, raise_prop_changed, nameof(font_family), nameof(font_size), nameof(font_color), nameof(font_weight), nameof(background_color), nameof(background_brush))) {
_fallback_font_family = font_family;
_fallback_font_size = font_size;
_fallback_font_color = font_color;
+ _fallback_background_color = background_color;
_fallback_font_weight = font_weight;
}
font_params_changed?.Invoke();
@@ -375,4 +382,4 @@ namespace mbts.ui.controls {
protected virtual void on_key_initialized(TColKey key) { }
}
}
-}
\ No newline at end of file
+}
diff --git a/src/client/spark/view/Controls/DIYGrid/Columns/FrameworkElementColumns/HyperlinkColumn.cs b/src/client/spark/view/Controls/DIYGrid/Columns/FrameworkElementColumns/HyperlinkColumn.cs
index 258740e29..2b6b62bf0 100644
--- a/src/client/spark/view/Controls/DIYGrid/Columns/FrameworkElementColumns/HyperlinkColumn.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Columns/FrameworkElementColumns/HyperlinkColumn.cs
@@ -7,7 +7,7 @@ using System.Windows.Media;
namespace mbts.ui.controls {
partial class DIYGrid {
- internal class HyperlinkElementColumn : FrameworkElementColumnBase, IFrameworkElementColumn, IFilterableColumn, IKeyedColumn, ISelectionHighlightListener {
+ internal class HyperlinkElementColumn : FrameworkElementColumnBase, IFrameworkElementColumn, IFilterableColumn, IKeyedColumn {
static readonly Thickness _default_padding = new Thickness(6, 0, 6, 0);
readonly BindingBase _binding, _command_binding;
@@ -22,27 +22,17 @@ namespace mbts.ui.controls {
public IDataGridColumnFilter filter { get; }
public string filter_template { get; }
public Thickness padding { get; set; } = _default_padding;
- public Brush background { get; set; }
- public Brush background_overlay { get; set; } = DefaultSelectionHighlight;
-
- public void on_selection_fill(Brush selection_fill) =>
- background_overlay = selection_fill;
-
+
public override FrameworkElement view_factory() {
- var hl = new HyperlinkCell { Foreground = font_brush, Background = background, Padding = padding };
+ var hl = new HyperlinkCell { Padding = padding };
+ hl.SetBinding(HyperlinkCell.ForegroundProperty, new Binding(nameof(font_brush)) { Source = this });
hl.SetBinding(HyperlinkCell.TextProperty, _binding);
hl.SetBinding(HyperlinkCell.FontFamilyProperty, new Binding(nameof(font_family)) { Source = this });
hl.SetBinding(HyperlinkCell.FontSizeProperty, new Binding(nameof(font_size)) { Source = this });
hl.SetBinding(HyperlinkCell.HorizontalAlignmentProperty, new Binding(nameof(horizontal_alignment)) { Source = this });
hl.SetBinding(HyperlinkCell.CommandProperty, _command_binding);
hl.SetBinding(HyperlinkCell.WidthProperty, new Binding(nameof(ActualWidth)) { Source = this });
- if (background_overlay != null) {
- hl.SetBinding(BackgroundOverlayProperty, new Binding(nameof(ListBoxItem.IsSelected)) {
- Converter = new AnonymousValueConverter(val => val ? background_overlay : null),
- Mode = BindingMode.OneWay,
- RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ListBoxItem), 1)
- });
- }
+ hl.SetBinding(HyperlinkCell.BackgroundProperty, new Binding(nameof(background_brush)) { Source = this });
return hl;
}
}
diff --git a/src/client/spark/view/Controls/DIYGrid/Columns/RenderColumn.cs b/src/client/spark/view/Controls/DIYGrid/Columns/RenderColumn.cs
index 4c58bc40d..f5779e1e5 100644
--- a/src/client/spark/view/Controls/DIYGrid/Columns/RenderColumn.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Columns/RenderColumn.cs
@@ -30,7 +30,7 @@ namespace mbts.ui.controls {
Func get_brush = null)
: base() {
_get_text = get_text;
- Func get_default_background_brush = (TRowVM _) => this.background;
+ Func get_default_background_brush = (TRowVM _) => this.background_brush;
_get_background_brush = get_brush ?? get_default_background_brush;
this.filter = filter;
this.filter_template = filter_template;
@@ -42,7 +42,6 @@ namespace mbts.ui.controls {
public IDataGridColumnFilter filter { get; }
public string filter_template { get; }
- public Brush background { get; set; }
public VerticalAlignment vertical_alignment { get; set; } = VerticalAlignment.Center;
public Thickness padding { get; set; } = DefaultCellPadding;
public GlyphContext glyph_context { get; private set; }
diff --git a/src/client/spark/view/Controls/DIYGrid/DIYGrid.cs b/src/client/spark/view/Controls/DIYGrid/DIYGrid.cs
index 6f40ba7e0..8bba5af3e 100644
--- a/src/client/spark/view/Controls/DIYGrid/DIYGrid.cs
+++ b/src/client/spark/view/Controls/DIYGrid/DIYGrid.cs
@@ -143,6 +143,7 @@ namespace mbts.ui.controls {
ScrollContentPresenter _content_presenter_backing;
DIYGrid _grid;
DragRectAdorner _drag_rect_adorner;
+ RowSelectionAdorner _rsa;
ScrollViewer _scroll_viewer;
Point? _drag_start;
double _drag_start_vertical_drift;
@@ -169,12 +170,18 @@ namespace mbts.ui.controls {
_drag_rect_adorner.SetResourceReference(DragRectAdorner.StrokeProperty, DIYGrid.SelectionStrokeKey);
_drag_rect_adorner.attach();
}
+ _rsa = new RowSelectionAdorner(this, _scroll_viewer);
+ _rsa.attach();
};
Unloaded += (s, e) => {
if (_drag_rect_adorner != null) {
_drag_rect_adorner.detach();
Disposable.dispose(ref _drag_rect_adorner);
}
+ if (_rsa != null) {
+ _rsa.detach();
+ Disposable.dispose(ref _rsa);
+ }
};
void on_row_height_changed(double v) => _row_height = v;
void on_support_group_items_changed(bool v) => _support_group_items = v;
@@ -355,6 +362,12 @@ namespace mbts.ui.controls {
o.Resources[SelectionStrokeKey] = new Pen(o.SelectionHighlight.Color.to_solid_brush().frozen(), 1).frozen();
foreach (var col in o.Columns.empty_if_null().OfType())
col.on_selection_fill(v);
+ var ad_layer = System.Windows.Documents.AdornerLayer.GetAdornerLayer(o);
+ if (ad_layer != null) {
+ foreach (var ad in ad_layer.descendants_of_type()) {
+ ad.on_selection_fill(v);
+ }
+ }
}, (o, v) => v as SolidColorBrush ?? DefaultSelectionHighlight,
DefaultSelectionHighlight);
diff --git a/src/client/spark/view/Controls/DIYGrid/DIYGridResources.xaml b/src/client/spark/view/Controls/DIYGrid/DIYGridResources.xaml
index 8100030d9..866cfc7c6 100644
--- a/src/client/spark/view/Controls/DIYGrid/DIYGridResources.xaml
+++ b/src/client/spark/view/Controls/DIYGrid/DIYGridResources.xaml
@@ -29,22 +29,6 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -66,6 +50,9 @@
-
\ No newline at end of file
+
diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettings.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettings.cs
index 3276b30a7..49b1667d5 100644
--- a/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettings.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettings.cs
@@ -61,7 +61,7 @@ namespace mbts.ui.settings {
readonly double _horizontal_offset;
[ProtoMember(10)]
- readonly NullableColorProto _background_override;
+ readonly NullableColorProto _background_color_override;
public GridColumnSettings() {
_is_visible = _default_is_visible;
@@ -72,7 +72,7 @@ namespace mbts.ui.settings {
}
public GridColumnSettings(string id, string display_name = null, bool is_visible = _default_is_visible, bool is_collapsed = _default_is_collapsed, FontWeight? font_weight_override = null, Color? font_color_override = null,
- double width = _default_width, HorizontalAlignment horizontal_alignment = _default_horizontal_alignment, double horizontal_offset = _default_horizontal_offset, Color? background_override = null) {
+ double width = _default_width, HorizontalAlignment horizontal_alignment = _default_horizontal_alignment, double horizontal_offset = _default_horizontal_offset, Color? background_color_override = null) {
_id = id;
_display_name = display_name;
_is_visible = is_visible;
@@ -82,7 +82,7 @@ namespace mbts.ui.settings {
_width = width;
_horizontal_alignment = horizontal_alignment;
_horizontal_offset = horizontal_offset;
- _background_override = new NullableColorProto(background_override);
+ _background_color_override = new NullableColorProto(background_color_override);
}
public string id => _id;
@@ -90,7 +90,7 @@ namespace mbts.ui.settings {
public bool is_collapsed => _is_collapsed;
public FontWeight? font_weight_override => _font_weight_override.value;
public Color? font_color_override => _font_color_override.value;
- public Color? background_override => _background_override.argb;
+ public Color? background_color_override => _background_color_override.argb;
public double width => _width;
public HorizontalAlignment horizontal_alignment => _horizontal_alignment;
public double horizontal_offset => _horizontal_offset;
@@ -98,7 +98,7 @@ namespace mbts.ui.settings {
public GridColumnSettings with(
string display_name = null, bool? is_visible = null, bool? is_collapsed = null, NullableFontWeightProto? font_weight_override = null, NullableColorProto? font_color_override = null,
- double? width = null, HorizontalAlignment? horizontal_alignment = null, double? horizontal_offset = null, NullableColorProto? background_override = null) =>
+ double? width = null, HorizontalAlignment? horizontal_alignment = null, double? horizontal_offset = null, NullableColorProto? background_color_override = null) =>
//
new GridColumnSettings(_id,
display_name ?? this.display_name,
@@ -109,7 +109,7 @@ namespace mbts.ui.settings {
width ?? this.width,
horizontal_alignment ?? this.horizontal_alignment,
horizontal_offset ?? this.horizontal_offset,
- (background_override ?? _background_override).argb);
+ (background_color_override ?? _background_color_override).argb);
public bool Equals(GridColumnSettings other) =>
other != null &&
@@ -119,6 +119,7 @@ namespace mbts.ui.settings {
is_collapsed == other.is_collapsed &&
font_weight_override.Equals(other.font_weight_override) &&
font_color_override.Equals(other.font_color_override) &&
+ background_color_override.Equals(other.background_color_override) &&
width == other.width &&
horizontal_alignment == other.horizontal_alignment &&
horizontal_offset == other.horizontal_offset &&
@@ -135,6 +136,7 @@ namespace mbts.ui.settings {
is_collapsed.GetHashCode(),
font_weight_override.GetHashCode(),
font_color_override.GetHashCode(),
+ background_color_override.GetHashCode(),
width.GetHashCode(),
horizontal_alignment.GetHashCode(),
horizontal_offset.GetHashCode(),
@@ -145,4 +147,4 @@ namespace mbts.ui.settings {
return $"id: {id} display_name: {display_name}";
}
}
-}
\ No newline at end of file
+}
diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettingsVM.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettingsVM.cs
index a99ed6612..ea34cf594 100644
--- a/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettingsVM.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridColumnSettingsVM.cs
@@ -22,11 +22,13 @@ namespace mbts.spark {
///
/// For flag behavior implementation, see
///
+ [Flags]
enum GridColumnSettingsFeatureFlags {
None = 0,
ImmutableFontColor = 1,
ImmutableFontWeight = 1 << 1,
- ImmutableHeader = 1 << 2
+ ImmutableHeader = 1 << 2,
+ ImmutableBackgroundColor = 1 << 3
}
partial class GridSettingsVM {
@@ -50,7 +52,9 @@ namespace mbts.spark {
_can_override_font_color = true,
_is_font_color_overridden,
_can_override_font_weight = true,
- _is_font_weight_overridden;
+ _is_font_weight_overridden,
+ _can_override_background_color = true,
+ _is_background_color_overridden;
FontWeight _font_weight_override;
GridColumnSettings _settings;
@@ -78,6 +82,10 @@ namespace mbts.spark {
public bool can_override_font_weight { get => _can_override_font_weight; private set => Set(ref _can_override_font_weight, value); }
public bool is_font_weight_overridden { get => _is_font_weight_overridden; set => Set(ref _is_font_weight_overridden, value); }
public FontWeight font_weight_override { get => _font_weight_override; set => Set(ref _font_weight_override, value); }
+ // background color override
+ public bool can_override_background_color { get => _can_override_background_color; private set => Set(ref _can_override_background_color, value); }
+ public bool is_background_color_overridden { get => _is_background_color_overridden; set => Set(ref _is_background_color_overridden, value); }
+ public ColorPickerPopupVM background_color_override { get; } = new ColorPickerPopupVM() { bind_opacity_to_alpha = true };
// animations
public ObservableEditableCollection predicate_animations { get; }
@@ -89,7 +97,9 @@ namespace mbts.spark {
is_font_weight_overridden ? new NullableFontWeightProto(font_weight_override) : new NullableFontWeightProto(null),
is_font_color_overridden ? new NullableColorProto(font_color_override.color) : new NullableColorProto(null),
width,
- horizontal_alignment);
+ horizontal_alignment,
+ background_color_override: is_background_color_overridden ?
+ new NullableColorProto(background_color_override.color) : default);
var animations_lookup = predicate_animations.ToFlatLookup(pa => pa.predicate.create_assigned(owner._predicate_data_factory), pa => pa.animations.Select(a => a.create()));
return (settings, animations_lookup);
}
@@ -111,6 +121,11 @@ namespace mbts.spark {
if (is_font_weight_overridden) {
_font_weight_override = _settings.font_weight_override.Value;
}
+ // background color
+ is_background_color_overridden = _settings.background_color_override.HasValue;
+ if (is_background_color_overridden) {
+ background_color_override.color = _settings.background_color_override.Value;
+ }
predicate_animations.SetItems(value.animations.empty_if_null().Select(g => {
var vm = new PredicateCellAnimationVM(id, owner._create_column_predicate_vm(id), owner._predicate_data_factory);
vm.load_from((g.Key, g));
@@ -129,6 +144,9 @@ namespace mbts.spark {
// font weight
can_override_font_weight = (flags & GridColumnSettingsFeatureFlags.ImmutableFontWeight) == 0;
is_font_weight_overridden &= can_override_font_weight;
+ // background color
+ can_override_background_color = (flags & GridColumnSettingsFeatureFlags.ImmutableBackgroundColor) == 0;
+ is_background_color_overridden &= can_override_background_color;
}
public override string ToString() => $"{display_name} ({id})";
diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettings.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettings.cs
index d32065edc..ceb9c92ea 100644
--- a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettings.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettings.cs
@@ -17,11 +17,16 @@ namespace mbts.ui.settings {
const double _default_font_size = 11;
const uint
_default_font_color = 0,
- _default_background = 0;
+ _default_background = 0x00FFFFFF;
const ushort _default_font_weight = 400;
+ const uint _default_background_color = 0x00FFFFFF; // Colors.Transparent
+ const bool _default_enable_background_color = false;
public static GridSettings Default =>
- new GridSettings(selection_highlight: new ColorOpacityProto(FallbackValues.selection_highlight.Color, FallbackValues.selection_highlight.Opacity));
+ new GridSettings(
+ selection_highlight: new ColorOpacityProto(FallbackValues.selection_highlight.Color, FallbackValues.selection_highlight.Opacity),
+ background: _default_background_color, //new ColorOpacityProto(FallbackValues.background_color.Color, FallbackValues.background_color.Opacity));
+ enable_background_color: _default_enable_background_color);
// corrects any inappropriate values that would render the grid unusable (usually nulls)
// NOTE: if you add a property to GridSettings that could have such a value, please add a conditional-correction for it below)
@@ -41,6 +46,7 @@ namespace mbts.ui.settings {
public static Color font_color => _default_font_color.rgb_color();
public static FontWeight font_weight => FontWeight.FromOpenTypeWeight(_default_font_weight);
public static SolidColorBrush selection_highlight => DIYGrid.DefaultSelectionHighlight;
+ public static uint background_color => _default_background;
}
public static IValueConverter selection_highlight_converter => ValueConverter.create(gs => gs.selection_highlight.to_brush().frozen());
@@ -77,6 +83,9 @@ namespace mbts.ui.settings {
[ProtoMember(8)]
[DefaultValue(_default_background)]
uint _background;
+ [ProtoMember(9)]
+ [DefaultValue(_default_enable_background_color)]
+ readonly bool _enable_background_color;
public GridSettings() {
_font_family = _default_font_family;
@@ -94,7 +103,8 @@ namespace mbts.ui.settings {
ColorOpacityProto? selection_highlight = null,
IEnumerable columns = null,
IEnumerable sorting_criterion = null,
- uint background = _default_background) {
+ uint background = _default_background,
+ bool enable_background_color = _default_enable_background_color) {
//
_font_family = font_family;
_font_size = font_size;
@@ -104,6 +114,7 @@ namespace mbts.ui.settings {
_columns = new List(columns.empty_if_null());
_sorting_criterion = new List(sorting_criterion.empty_if_null());
_background = background;
+ _enable_background_color = enable_background_color;
}
public string font_family => _font_family;
@@ -112,6 +123,8 @@ namespace mbts.ui.settings {
public FontWeight font_weight => FontWeight.FromOpenTypeWeight(_font_weight);
public Color background => _background.argb_color();
public ColorOpacityProto selection_highlight => _selection_highlight;
+ public uint background_color => _background;
+ public bool enable_background_color => _enable_background_color;
public IReadOnlyList columns => _columns ?? (_columns = new List(0));
[Obsolete] // TODO: remove sorting_criterion from GridSettings entirely. This should be part of IShellWindow's StartupData, since it is an instance-specific setting, and prob not part of the shared defaults
public IReadOnlyList sorting_criterion => _sorting_criterion ?? (_sorting_criterion = new List(0));
@@ -124,8 +137,8 @@ namespace mbts.ui.settings {
IEnumerable sorting_criterion = null,
string font_family = null,
double font_size = double.NaN,
- uint? background = null) =>
- //
+ uint? background = null,
+ bool? enable_background_color = null) =>
new GridSettings(
font_family ?? _font_family,
DoubleHelper.IsNaNOrInfinityOr(font_size, 0) ? _font_size : font_size,
@@ -134,7 +147,8 @@ namespace mbts.ui.settings {
_selection_highlight,
columns ?? _columns,
sorting_criterion ?? _sorting_criterion,
- background ?? _background);
+ background ?? _background,
+ enable_background_color ?? _enable_background_color);
public GridSettings clone() => with();
@@ -146,6 +160,7 @@ namespace mbts.ui.settings {
font_color == other.font_color &&
selection_highlight == other.selection_highlight &&
_background == other._background &&
+ _enable_background_color == other._enable_background_color &&
EqualityComparer.safe_sequence_equals(columns, other.columns) &&
#pragma warning disable CS0612 // Type or member is obsolete
EqualityComparer.safe_sequence_equals(sorting_criterion, other.sorting_criterion);
@@ -162,6 +177,7 @@ namespace mbts.ui.settings {
font_color.GetHashCode(),
selection_highlight.GetHashCode(),
_background.GetHashCode(),
+ _enable_background_color.GetHashCode(),
EqualityComparer.safe_aggregate_hash(columns),
#pragma warning disable CS0612 // Type or member is obsolete
EqualityComparer.safe_aggregate_hash(sorting_criterion));
diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs
index bee5cba63..bab9fc9a5 100644
--- a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsHelper.cs
@@ -31,14 +31,15 @@ namespace mbts.ui.settings {
}
public static void load_column_settings(IEnumerable columns, GridSettings grid_settings) =>
- load_column_settings(columns, grid_settings.columns, new FontFamily(grid_settings.font_family), grid_settings.font_size, grid_settings.font_color.rgb_color(), grid_settings.font_weight);
+ load_column_settings(columns, grid_settings.columns, grid_settings.background, new FontFamily(grid_settings.font_family), grid_settings.font_size, grid_settings.font_color.rgb_color(), grid_settings.font_weight);
- public static void load_column_settings(IEnumerable columns, IEnumerable settings, FontFamily grid_font_family, double grid_font_size, Color grid_font_color, FontWeight grid_font_weight) =>
- load_column_settings(columns, settings, grid_font_family, grid_font_size, grid_font_color, grid_font_weight, (c, s) => c.load_from(s));
+ public static void load_column_settings(IEnumerable columns, IEnumerable settings, Color grid_background, FontFamily grid_font_family, double grid_font_size, Color grid_font_color, FontWeight grid_font_weight) =>
+ load_column_settings(columns, settings, grid_background, grid_font_family, grid_font_size, grid_font_color, grid_font_weight, (c, s) => c.load_from(s));
public static void load_column_settings(
IEnumerable columns,
IEnumerable settings,
+ Color grid_background,
FontFamily grid_font_family,
double grid_font_size,
Color grid_font_color,
@@ -52,7 +53,7 @@ namespace mbts.ui.settings {
select new { col, stg };
foreach (var tup in join) {
load_impl(tup.col, tup.stg);
- tup.col.set_fallback_font_params(grid_font_family, grid_font_size, grid_font_color, grid_font_weight);
+ tup.col.set_fallback_font_params(grid_font_family, grid_font_size, grid_font_color, grid_font_weight, grid_background);
}
}
diff --git a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsManager.cs b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsManager.cs
index 11dc2d487..a006995f0 100644
--- a/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsManager.cs
+++ b/src/client/spark/view/Controls/DIYGrid/Settings/GridSettingsManager.cs
@@ -30,7 +30,7 @@ namespace mbts.ui {
readonly DelegateProperty _font_family;
readonly DelegateProperty _font_weight;
readonly DelegateProperty _font_size;
- readonly DelegateProperty