utilzing new argb

This commit is contained in:
Jake Norbut committed 2019-08-14 15:04:40 -05:00
1 parent 9a76d9c857
commit ea2aee5044
5 files changed
+14 -10

No files matched your search

@@ -186,7 +186,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.value;
_fallback_background_color = gs.background_color.argb;
_fallback_font_size = gs.font_size;
_fallback_font_family = new FontFamily(gs.font_family);
original_width = double.NaN;
@@ -77,7 +77,7 @@ namespace mbts.ui {
_font_size = backing(nameof(font_size), () => grid_settings.font_size, nameof(font_size));
_font_color = backing(nameof(font_color), () => grid_settings.font_color.rgb_solid_brush().frozen(), nameof(grid_settings));
_selection_highlight = backing(nameof(selection_highlight), () => grid_settings.selection_highlight.to_brush().frozen(), nameof(grid_settings));
_background_color = backing(nameof(background_color), () => grid_settings.background_color.value?.rgb_color().rgb_solid_brush().frozen(), nameof(grid_settings));
_background_color = backing(nameof(background_color), () => grid_settings.background_color.argb?.to_solid_brush().frozen(), nameof(grid_settings));
}
public void Dispose() =>
@@ -114,7 +114,7 @@ namespace mbts.ui {
var grid = value.general ?? GridSettings.Default;
_grid_settings.set(grid);
foreach (ColumnBase col in _columns)
col.set_fallback_font_params(new FontFamily(grid.font_family), grid.font_size, grid.font_color.rgb_color(), grid.font_weight, grid.background_color.value);
col.set_fallback_font_params(new FontFamily(grid.font_family), grid.font_size, grid.font_color.rgb_color(), grid.font_weight, grid.background_color.argb);
_predicate_animations_data = value.predicate_animations;
_animation_defs.clear();
foreach (var pa in _predicate_animations_data) {
@@ -132,7 +132,9 @@ namespace mbts.spark {
foreach (IGrouping<TPredicateData, CellAnimation> g in animations)
animation_map.AddOrUpdate(g.Key, p => animation_tuple(c: g), (p, t) => t.cell_animations.AddRange(g));
}
return _create_settings_obj(new GridSettings(font_family.name(), font_size, font_weight, font_color.color.rgb_color(), selection_highlight.to_proto(), col_settings, background_color: new NullableColorProto(background_color.color.rgb_color())),
return _create_settings_obj(new GridSettings(font_family.name(), font_size, font_weight, font_color.color.rgb_color(), selection_highlight.to_proto(), col_settings,
background_color: new NullableColorProto(background_color.color
.with((byte)(MathUtils.within_range(0, 1, background_color.opacity) * 255.0)))),
animation_map.Select(kv => PredicateAnimations.create_data<TRowData, TPredicateData>(kv.Key, kv.Value.cell_animations, kv.Value.row_animations, kv.Value.sounds)));
//
(List<RowAnimation> row_animations, List<SoundNotification> sounds, List<CellAnimation> cell_animations) animation_tuple(IEnumerable<RowAnimation> r = null, IEnumerable<SoundNotification> s = null, IGrouping<TPredicateData, CellAnimation> c = null) =>
@@ -145,7 +147,7 @@ namespace mbts.spark {
font_color.load_from(sd.general.font_color.rgb_solid_brush());
selection_highlight.load_from(sd.general.selection_highlight.to_brush());
if (sd.general.background_color.value.HasValue) {
background_color.load_from(sd.general.background_color.value.Value.to_solid_brush());
background_color.load_from(sd.general.background_color.argb.Value.to_solid_brush());
}
_font_size.set(sd.general.font_size);
var col_animations = new Dictionary<string, Dictionary<TPredicateData, List<CellAnimation>>>();
@@ -35,7 +35,7 @@ namespace mbts.ui {
_font_size = backing(nameof(font_size), () => grid_settings.font_size, nameof(font_size));
_font_color = backing(nameof(font_color), () => grid_settings.font_color.rgb_solid_brush().frozen(), nameof(grid_settings));
_selection_highlight = backing(nameof(selection_highlight), () => grid_settings.selection_highlight.to_brush().frozen(), nameof(grid_settings));
_background_color = backing(nameof(background_color), () => grid_settings.background_color.value?.rgb_color().rgb_solid_brush().frozen(), nameof(grid_settings));
_background_color = backing(nameof(background_color), () => grid_settings.background_color.argb?.to_solid_brush().frozen(), nameof(grid_settings));
_row_vms = row_vms;
}
@@ -88,7 +88,7 @@ namespace mbts.ui {
grid = grid ?? GridSettings.Default;
_grid_settings.set(grid);
foreach (ColumnBase col in _columns)
col.set_fallback_font_params(new FontFamily(grid.font_family), grid.font_size, grid.font_color.rgb_color(), grid.font_weight, grid.background_color.value);
col.set_fallback_font_params(new FontFamily(grid.font_family), grid.font_size, grid.font_color.rgb_color(), grid.font_weight, grid.background_color.argb);
// ** in the unfortunate event that we botch backwards compatability, and the columns don't bear a 1:1 relationship with the column-settings
// don't add insult to injury by crashing **
if (grid_settings.columns != null) {
@@ -106,7 +106,9 @@ namespace mbts.spark {
}
public GridSettings create() =>
new GridSettings(font_family.name(), font_size, font_weight, font_color.color.rgb_color(), selection_highlight.to_proto(), columns.Select(c => c.create()), background_color: new NullableColorProto(background_color.color.rgb_color()));
new GridSettings(font_family.name(), font_size, font_weight, font_color.color.rgb_color(), selection_highlight.to_proto(), columns.Select(c => c.create()),
background_color: new NullableColorProto(background_color.color
.with((byte)(MathUtils.within_range(0, 1, background_color.opacity) * 255.0))));
public void load_from(GridSettings value) {
if (value == null)
@@ -116,8 +118,8 @@ namespace mbts.spark {
_font_weight.set(value.font_weight);
font_color.load_from(value.font_color.rgb_solid_brush());
selection_highlight.load_from(value.selection_highlight.to_brush());
if (value.background_color.value.HasValue) {
background_color.load_from(value.background_color.value.Value.to_solid_brush());
if (value.background_color.argb.HasValue) {
background_color.load_from(value.background_color.argb.Value.to_solid_brush());
}
_font_size.set(value.font_size);
var curr_col_id = current_column?.id;