Front View plug-in does not init if no sensor added.
Fixing some format to make strings shorter.
Now trying to start SoundGraphAccess.exe process from same directory.
Packed mode now can display three sensors along with the current time.
2 using System.Collections.Generic;
5 using Aga.Controls.Tree.NodeControls;
7 namespace Aga.Controls.Tree
9 public class AutoRowHeightLayout: IRowLayout
11 private DrawContext _measureContext;
12 private TreeViewAdv _treeView;
13 private List<Rectangle> _rowCache;
15 public AutoRowHeightLayout(TreeViewAdv treeView, int rowHeight)
17 _rowCache = new List<Rectangle>();
19 PreferredRowHeight = rowHeight;
20 _measureContext = new DrawContext();
21 _measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1));
24 private int _rowHeight;
25 public int PreferredRowHeight
27 get { return _rowHeight; }
28 set { _rowHeight = value; }
32 public int PageRowCount
36 if (_treeView.RowCount == 0)
40 int pageHeight = _treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight;
42 for (int i = _treeView.RowCount - 1; i >= 0; i--)
46 return Math.Max(0, _treeView.RowCount - 1 - i);
48 return _treeView.RowCount;
53 public int CurrentPageSize
57 if (_treeView.RowCount == 0)
61 int pageHeight = _treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight;
63 for (int i = _treeView.FirstVisibleRow; i < _treeView.RowCount; i++)
67 return Math.Max(0, i - _treeView.FirstVisibleRow);
69 return Math.Max(0, _treeView.RowCount - _treeView.FirstVisibleRow);
74 public Rectangle GetRowBounds(int rowNo)
76 if (rowNo >= _rowCache.Count)
78 int count = _rowCache.Count;
79 int y = count > 0 ? _rowCache[count - 1].Bottom : 0;
80 for (int i = count; i <= rowNo; i++)
82 int height = GetRowHeight(i);
83 _rowCache.Add(new Rectangle(0, y, 0, height));
86 if (rowNo < _rowCache.Count - 1)
87 return Rectangle.Empty;
89 if (rowNo >= 0 && rowNo < _rowCache.Count)
90 return _rowCache[rowNo];
92 return Rectangle.Empty;
95 private int GetRowHeight(int rowNo)
97 if (rowNo < _treeView.RowMap.Count)
99 TreeNodeAdv node = _treeView.RowMap[rowNo];
100 if (node.Height == null)
103 _measureContext.Font = _treeView.Font;
104 foreach (NodeControl nc in _treeView.NodeControls)
106 int h = nc.GetActualSize(node, _measureContext).Height;
112 return node.Height.Value;
118 public int GetRowAt(Point point)
120 int py = point.Y - _treeView.ColumnHeaderHeight;
122 for (int i = _treeView.FirstVisibleRow; i < _treeView.RowCount; i++)
124 int h = GetRowHeight(i);
125 if (py >= y && py < y + h)
133 public int GetFirstRow(int lastPageRow)
135 int pageHeight = _treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight;
137 for (int i = lastPageRow; i >= 0; i--)
139 y += GetRowHeight(i);
141 return Math.Max(0, i + 1);
146 public void ClearCache()