Remove unused file VolSurfaceRowControl.cs
This commit is contained in:
1 parent
83e0da446a
commit
abfabe3e21
1 file changed
-372
@@ -1,372 +0,0 @@
|
||||
// using mbts;
|
||||
// using mbts.ui;
|
||||
// using mbts.ui.controls;
|
||||
// using mbts.ui.dpi;
|
||||
// using mbts.ui.utility.text;
|
||||
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Diagnostics;
|
||||
// using System.Globalization;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using System.Windows;
|
||||
// using System.Windows.Controls;
|
||||
// using System.Windows.Input;
|
||||
// using System.Windows.Media;
|
||||
|
||||
// namespace mbts.spark.VolSurface {
|
||||
// class VolSurfaceRowControl : DIYGrid.HighPerformanceRow<VolSurfaceRowContext> {
|
||||
// FormattedText _exp_text;
|
||||
// readonly double _padding = 5.0;
|
||||
// readonly Pen _dirty_pen = new Pen(Brushes.Red, 1.0);
|
||||
// readonly Pen _selection_pen = new Pen(Brushes.Black, 1.0) { DashStyle = DashStyles.Dot };
|
||||
|
||||
// TickUpDown _cell_editor_backing;
|
||||
// TickUpDown _cell_editor => _cell_editor_backing ??= new ();
|
||||
|
||||
// int? _selected_cell;
|
||||
|
||||
// public VolSurfaceRowControl() {
|
||||
// Loaded += (s, e) => ContextMenu = TryFindResource("context_menu") as ContextMenu;
|
||||
// GotKeyboardFocus += (s, e) => {
|
||||
// if (e.OriginalSource is not FrameworkElement el) {
|
||||
// return;
|
||||
// }
|
||||
// var cell_tl = el.TranslatePoint(new Point(0, 0), this);
|
||||
// _on_focus_move(DIYGrid.RowUtils.column_at(_column_layout, cell_tl));
|
||||
// };
|
||||
// }
|
||||
|
||||
// int? _column_index(DIYGrid.ColumnGeometry col) =>
|
||||
// _column_layout.TryGetFirst(c => c.Equals(col), out var _, out var idx) ? idx : null;
|
||||
|
||||
// //private static int _render_count = 0;
|
||||
// protected override void OnRender(DrawingContext dc) {
|
||||
// // Fill with transparent for hit testing
|
||||
// dc.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, new Rect(0, 0, _column_layout.Sum(c => c.width), RenderSize.Height));
|
||||
|
||||
// string last_group = "";
|
||||
// foreach (var cell in _column_layout) {
|
||||
// // Render collapsed columns
|
||||
// if (cell.column.is_collapsed) {
|
||||
// dc.DrawRectangle(BTSColors.AW2.collapsed, null, new Rect(cell.left, 0, cell.width, Height));
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// var column = (VolSurfaceSimplifiedColumn)cell.column;
|
||||
// VolSurfaceCellState celldata;
|
||||
|
||||
// // Get the cell text
|
||||
// if (column.type == VolSurfaceSimplifiedColumnType.RowHeader) {
|
||||
// // Fill in this one
|
||||
// dc.DrawRectangle(BTSColors.header, null, new Rect(cell.left, 0, cell.width, Height));
|
||||
// var exp = _row.expiration;
|
||||
// if (_exp_text == null) {
|
||||
// _exp_text = format_text(exp.ToString(), exp.is_slave ? Brushes.LightGray : Brushes.White);
|
||||
// }
|
||||
// celldata = new VolSurfaceCellState() {
|
||||
// text = _exp_text
|
||||
// };
|
||||
// } else if (column.type == VolSurfaceSimplifiedColumnType.ReadOnly) {
|
||||
// celldata = _row.get_value(column.volsurface_column, format(Brushes.Blue), _ => null);
|
||||
// } else {
|
||||
// celldata = _row.get_value(column.volsurface_column, format(Brushes.Black), format(Brushes.DarkGray));
|
||||
// }
|
||||
|
||||
// // If the cell is partly hidden clip the draw
|
||||
// if (cell.is_partially_obscured) {
|
||||
// dc.PushClip(new RectangleGeometry(
|
||||
// new Rect(cell.left, 0, cell.width, Height)));
|
||||
// }
|
||||
|
||||
// // draw text centered vertially
|
||||
// double total_width = _padding + celldata.text.Width;
|
||||
// double pad_top = (Height - celldata.text.Height) / 2.0;
|
||||
// dc.DrawText(celldata.text, new Point(cell.unclipped_left + _padding, pad_top));
|
||||
// if (celldata.committed_text != null) {
|
||||
// pad_top = (Height - celldata.committed_text.Height) / 2.0;
|
||||
// dc.DrawText(celldata.committed_text, new Point(cell.unclipped_left + total_width, pad_top));
|
||||
// total_width += celldata.committed_text.Width;
|
||||
// }
|
||||
|
||||
// // draw grid lines
|
||||
// double line_width; Brush fill;
|
||||
// if (last_group == cell.group) { line_width = 1; fill = _grid.VerticalGridLineBrush; } else { line_width = 2; fill = _grid.VerticalGroupSeparatorBrush; }
|
||||
// dc.DrawRectangle(fill, null, new Rect(cell.left - line_width, 0, line_width, Height));
|
||||
// Rect cell_border_rect = new Rect(cell.unclipped_left + 1, 0, Math.Max(0, cell.width - (line_width * 2)), Height - 1);
|
||||
// // draw dirty rect
|
||||
// if (celldata.is_dirty) {
|
||||
// dc.DrawRectangle(null, _dirty_pen, cell_border_rect);
|
||||
// }
|
||||
|
||||
// // Draw selection
|
||||
// if (_selected_cell == _column_index(cell) && column.type != VolSurfaceSimplifiedColumnType.ReadWriteTick) {
|
||||
// dc.DrawRectangle(null, _selection_pen, cell_border_rect);
|
||||
// }
|
||||
|
||||
// if (cell.is_partially_obscured) { dc.Pop(); }
|
||||
|
||||
// total_width += _padding;//right padding
|
||||
// if (!celldata.is_dirty && column.type == VolSurfaceSimplifiedColumnType.ReadWriteTick) total_width += 22; // size of buttons on a tickupdown
|
||||
// if (total_width > cell.width) {
|
||||
// Dispatcher.BeginInvoke(((Action)(() => cell.column.Width = total_width)));
|
||||
// }
|
||||
// last_group = cell.group;
|
||||
// }
|
||||
|
||||
// if (_selected_cell != NO_CELL) {
|
||||
// if (_cell_editor.Visibility == Visibility.Visible) {
|
||||
// var position = _column_geometry[_selected_cell];
|
||||
// PositionControlOver(tud, position);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //++_render_count;
|
||||
// //dc.DrawText(
|
||||
// // format_text(_render_count.ToString(), Brushes.Black),
|
||||
// // new Point(0, 0));
|
||||
// }
|
||||
|
||||
// Func<string, FormattedText> format(Brush brush) =>
|
||||
// str => format_text(str, brush);
|
||||
|
||||
// void _on_focus_move(DIYGrid.ColumnGeometry? new_column) {
|
||||
// if (new_column != null) {
|
||||
// enable_edit(new_column.Value);
|
||||
// }
|
||||
// InvalidateVisual();
|
||||
// }
|
||||
|
||||
// private async void enable_edit(DIYGrid.ColumnGeometry column) {
|
||||
// await Task.Yield();
|
||||
// var col = (VolSurfaceSimplifiedColumn)column.column;
|
||||
// var tud = _grid.get_edit_control<TickUpDown>();
|
||||
// if (col.type == VolSurfaceSimplifiedColumnType.ReadWriteTick) {
|
||||
// tud.DataContext = _row.get_edit_context(col.volsurface_column);
|
||||
// PositionControlOver(tud, column);
|
||||
// var fe = tud.Content as TextBox;
|
||||
// if (fe != null) {
|
||||
// await Task.Yield();
|
||||
// fe.Focus();
|
||||
// fe.SelectAll();
|
||||
// }
|
||||
// } else {
|
||||
// tud.DataContext = null;
|
||||
// tud.Visibility = Visibility.Collapsed;
|
||||
// var item = this.find_ancestor_of_type<ListBoxItem>();
|
||||
// if (item != null) {
|
||||
// item.Focus();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// protected override void OnMouseRightButtonUp(MouseButtonEventArgs e) {
|
||||
// // _grid.column
|
||||
// var cell = DIYGrid.RowUtils.column_at(_column_layout, e.GetPosition(this));
|
||||
// if (ContextMenu != null) {
|
||||
// if (cell.HasValue && DIYGrid.RowUtils.column_index(_column_layout, cell.Value) > (_grid.FrozenColumnCount - 1)) {
|
||||
// ContextMenu.DataContext = _row.get_context_menu_context((VolSurfaceSimplifiedColumn)cell.Value.column, cell.Value.super_column);
|
||||
// } else {
|
||||
// e.Handled = true;
|
||||
// ContextMenu.DataContext = null;
|
||||
// }
|
||||
// }
|
||||
// base.OnMouseRightButtonDown(e);
|
||||
// }
|
||||
|
||||
// FormattedText format_text(string content, Brush fg) {
|
||||
// var ft = new FormattedText(content, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
|
||||
// TextUtils.StandardTypeface, FontSizes.Regular, Brushes.Black, HighDpiExtensions.dpi_ratio);
|
||||
// return ft;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// using mbts;
|
||||
// using mbts.ui;
|
||||
// using mbts.ui.controls;
|
||||
// using mbts.ui.dpi;
|
||||
// using mbts.ui.utility.text;
|
||||
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Diagnostics;
|
||||
// using System.Globalization;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using System.Windows;
|
||||
// using System.Windows.Controls;
|
||||
// using System.Windows.Input;
|
||||
// using System.Windows.Media;
|
||||
|
||||
// namespace mbts.spark.VolSurface {
|
||||
// class VolSurfaceRowControl : DIYGrid.RowBase {
|
||||
// VolSurfaceRowContext _row;
|
||||
// FormattedText _exp_text;
|
||||
// readonly double _padding = 5.0;
|
||||
// readonly Pen _dirty_pen = new Pen(Brushes.Red, 1.0);
|
||||
// readonly Pen _selection_pen = new Pen(Brushes.Black, 1.0) { DashStyle = DashStyles.Dot };
|
||||
|
||||
// public VolSurfaceRowControl() {
|
||||
// DataContextChanged += OnDataContextChanged;
|
||||
// Loaded += OnLoaded;
|
||||
// }
|
||||
|
||||
// #region SelectedCell
|
||||
// public static readonly DependencyProperty SelectedCellProperty =
|
||||
// WPFHelper.create_dp<object, VolSurfaceRowControl>(nameof(SelectedCell));
|
||||
|
||||
// public object SelectedCell {
|
||||
// get => GetValue(SelectedCellProperty);
|
||||
// set => SetValue(SelectedCellProperty, value);
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// void OnLoaded(object sender, RoutedEventArgs e) {
|
||||
// ContextMenu = TryFindResource("context_menu") as ContextMenu;
|
||||
// }
|
||||
|
||||
// void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) {
|
||||
// var oldrow = e.OldValue as VolSurfaceRowContext;
|
||||
// if (oldrow != null) {
|
||||
// oldrow.on_invalidate -= InvalidateVisual;
|
||||
// }
|
||||
// _row = DataContext as VolSurfaceRowContext;
|
||||
// _row.on_invalidate += InvalidateVisual;
|
||||
// }
|
||||
|
||||
// //private static int _render_count = 0;
|
||||
// protected override void OnRender(DrawingContext dc) {
|
||||
// if (_grid == null) return;
|
||||
// // Fill with transparent for hit testing
|
||||
// dc.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, new Rect(0, 0, _column_geometry.Sum(g => g.width), RenderSize.Height));
|
||||
|
||||
// string last_group = "";
|
||||
// foreach (var cell in _column_geometry) {
|
||||
// // Render collapsed columns
|
||||
// if (cell.column.is_collapsed) {
|
||||
// dc.DrawRectangle(BTSColors.AW2.collapsed, null, new Rect(cell.left, 0, cell.width, Height));
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// var column = (VolSurfaceSimplifiedColumn)cell.column;
|
||||
// VolSurfaceCellState celldata;
|
||||
|
||||
// // Get the cell text
|
||||
// if (column.type == VolSurfaceSimplifiedColumnType.RowHeader) {
|
||||
// // Fill in this one
|
||||
// dc.DrawRectangle(BTSColors.header, null, new Rect(cell.left, 0, cell.width, Height));
|
||||
// var exp = _row.expiration;
|
||||
// if (_exp_text == null) {
|
||||
// _exp_text = format_text(exp.ToString(), exp.is_slave ? Brushes.LightGray : Brushes.White);
|
||||
// }
|
||||
// celldata = new VolSurfaceCellState() { text = _exp_text };
|
||||
// } else if (column.type == VolSurfaceSimplifiedColumnType.ReadOnly) {
|
||||
// celldata = _row.get_value(column.volsurface_column, format(Brushes.Blue), _ => null);
|
||||
// } else {
|
||||
// celldata = _row.get_value(column.volsurface_column, format(Brushes.Black), format(Brushes.DarkGray));
|
||||
// }
|
||||
|
||||
// // If the cell is partly hidden clip the draw
|
||||
// if (cell.is_partially_obscured) {
|
||||
// dc.PushClip(new RectangleGeometry(
|
||||
// new Rect(cell.left, 0, cell.width, Height)));
|
||||
// }
|
||||
|
||||
// // draw text centered vertially
|
||||
// double total_width = _padding + celldata.text.Width;
|
||||
// double pad_top = (Height - celldata.text.Height) / 2.0;
|
||||
// dc.DrawText(celldata.text, new Point(cell.unclipped_left + _padding, pad_top));
|
||||
// if (celldata.committed_text != null) {
|
||||
// pad_top = (Height - celldata.committed_text.Height) / 2.0;
|
||||
// dc.DrawText(celldata.committed_text, new Point(cell.unclipped_left + total_width, pad_top));
|
||||
// total_width += celldata.committed_text.Width;
|
||||
// }
|
||||
|
||||
// // draw grid lines
|
||||
// double line_width; Brush fill;
|
||||
// if (last_group == cell.group) { line_width = 1; fill = _grid.VerticalGridLineBrush; } else { line_width = 2; fill = _grid.VerticalGroupSeparatorBrush; }
|
||||
// dc.DrawRectangle(fill, null, new Rect(cell.left - line_width, 0, line_width, Height));
|
||||
// Rect cell_border_rect = new Rect(cell.unclipped_left + 1, 0, Math.Max(0, cell.width - (line_width * 2)), Height - 1);
|
||||
// // draw dirty rect
|
||||
// if (celldata.is_dirty) {
|
||||
// dc.DrawRectangle(null, _dirty_pen, cell_border_rect);
|
||||
// }
|
||||
|
||||
// // Draw selection
|
||||
// if (_selected_cell == column_index(cell) && column.type != VolSurfaceSimplifiedColumnType.ReadWriteTick) {
|
||||
// dc.DrawRectangle(null, _selection_pen, cell_border_rect);
|
||||
// }
|
||||
|
||||
// if (cell.is_partially_obscured) { dc.Pop(); }
|
||||
|
||||
// total_width += _padding;//right padding
|
||||
// if (!celldata.is_dirty && column.type == VolSurfaceSimplifiedColumnType.ReadWriteTick) total_width += 22; // size of buttons on a tickupdown
|
||||
// if (total_width > cell.width) {
|
||||
// Dispatcher.BeginInvoke(((Action)(() => cell.column.Width = total_width)));
|
||||
// }
|
||||
// last_group = cell.group;
|
||||
// }
|
||||
|
||||
// //++_render_count;
|
||||
// //dc.DrawText(
|
||||
// // format_text(_render_count.ToString(), Brushes.Black),
|
||||
// // new Point(0, 0));
|
||||
// }
|
||||
// private Func<string, FormattedText> format(Brush brush) {
|
||||
// return str => format_text(str, brush);
|
||||
// }
|
||||
// protected override void OnClick(DIYGrid.ColumnGeometry column) {
|
||||
// }
|
||||
|
||||
// protected override void OnFocusMove(DIYGrid.ColumnGeometry? new_column) {
|
||||
// if (new_column != null) enable_edit(new_column.Value);
|
||||
// InvalidateVisual();
|
||||
// }
|
||||
|
||||
// private async void enable_edit(DIYGrid.ColumnGeometry column) {
|
||||
// await Task.Yield();
|
||||
// var col = (VolSurfaceSimplifiedColumn)column.column;
|
||||
// var tud = _grid.get_edit_control<TickUpDown>();
|
||||
// if (col.type == VolSurfaceSimplifiedColumnType.ReadWriteTick) {
|
||||
// tud.DataContext = _row.get_edit_context(col.volsurface_column);
|
||||
// PositionControlOver(tud, column);
|
||||
// var fe = tud.Content as TextBox;
|
||||
// if (fe != null) {
|
||||
// await Task.Yield();
|
||||
// fe.Focus();
|
||||
// fe.SelectAll();
|
||||
// }
|
||||
// } else {
|
||||
// tud.DataContext = null;
|
||||
// tud.Visibility = Visibility.Collapsed;
|
||||
// var item = this.find_ancestor_of_type<ListBoxItem>();
|
||||
// if (item != null) {
|
||||
// item.Focus();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// protected override void OnMouseRightButtonUp(MouseButtonEventArgs e) {
|
||||
// var cell = column_at(e.GetPosition(this));
|
||||
// if (ContextMenu != null) {
|
||||
// if (cell.HasValue && column_index(cell.Value) > (_grid.FrozenColumnCount - 1)) {
|
||||
// ContextMenu.DataContext = _row.get_context_menu_context((VolSurfaceSimplifiedColumn)cell.Value.column, cell.Value.super_column);
|
||||
// } else {
|
||||
// e.Handled = true;
|
||||
// ContextMenu.DataContext = null;
|
||||
// }
|
||||
// }
|
||||
// base.OnMouseRightButtonDown(e);
|
||||
// }
|
||||
|
||||
// FormattedText format_text(string content, Brush fg) {
|
||||
// var ft = new FormattedText(content, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
|
||||
// TextUtils.StandardTypeface, FontSizes.Regular, Brushes.Black, HighDpiExtensions.dpi_ratio);
|
||||
// return ft;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Reference in new issue
Block a user