Skip to content

Commit 1e79a0a

Browse files
committed
Added log overlay and linear interpolation
1 parent fd4e518 commit 1e79a0a

9 files changed

+966
-137
lines changed

CustomDataGridViewCell.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Drawing;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Windows.Forms;
7+
8+
namespace NSFW.TimingEditor
9+
{
10+
class CustomDataGridViewCell : DataGridViewTextBoxCell
11+
{
12+
private DataGridViewAdvancedBorderStyle _style;
13+
14+
public CustomDataGridViewCell() : base()
15+
{
16+
17+
_style = new DataGridViewAdvancedBorderStyle();
18+
19+
_style.Bottom = DataGridViewAdvancedCellBorderStyle.None;
20+
_style.Top = DataGridViewAdvancedCellBorderStyle.None;
21+
_style.Left = DataGridViewAdvancedCellBorderStyle.None;
22+
_style.Right = DataGridViewAdvancedCellBorderStyle.None;
23+
24+
}
25+
26+
public DataGridViewAdvancedBorderStyle AdvancedBorderStyle
27+
{
28+
get { return _style; }
29+
set
30+
{
31+
_style.Bottom = value.Bottom;
32+
_style.Top = value.Top;
33+
_style.Left = value.Left;
34+
_style.Right = value.Right;
35+
}
36+
}
37+
38+
protected override void PaintBorder(Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle)
39+
{
40+
base.PaintBorder(graphics, clipBounds, bounds, cellStyle, _style);
41+
using (Pen p = new Pen(Color.Navy, 5))
42+
{
43+
Rectangle rect = bounds;
44+
rect.X = rect.X + 1;
45+
rect.Y = rect.Y + 1;
46+
rect.Width -= 4;
47+
rect.Height -= 4;
48+
graphics.DrawRectangle(p, rect);
49+
}
50+
}
51+
52+
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
53+
{
54+
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, _style, paintParts);
55+
using (Pen p = new Pen(Color.Navy, 2))
56+
{
57+
Rectangle rect = cellBounds;
58+
rect.Width -= 1;
59+
rect.Height -= 1;
60+
graphics.DrawRectangle(p, rect);
61+
}
62+
}
63+
}
64+
}

LogOverlay.Designer.cs

Lines changed: 144 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LogOverlay.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Text.RegularExpressions;
9+
using System.Windows.Forms;
10+
11+
namespace NSFW.TimingEditor
12+
{
13+
public partial class LogOverlay : Form
14+
{
15+
public LogOverlay()
16+
{
17+
InitializeComponent();
18+
}
19+
20+
public String[] LogParameters
21+
{
22+
get
23+
{
24+
if (this.headerListBox.SelectedItems.Count > 0)
25+
{
26+
int i = 0;
27+
String[] s = new String[this.headerListBox.CheckedItems.Count];
28+
foreach (Object o in this.headerListBox.CheckedItems)
29+
s[i++] = o.ToString();
30+
return s;
31+
}
32+
else
33+
return new String[0];
34+
}
35+
set
36+
{
37+
if (value.Length > 0)
38+
{
39+
this.headerListBox.Items.Clear();
40+
this.xAxisComboBox.Items.Clear();
41+
this.yAxisComboBox.Items.Clear();
42+
String engLoad = null;
43+
String engSpeed = null;
44+
foreach (String s in value)
45+
{
46+
this.headerListBox.Items.Add(s);
47+
this.xAxisComboBox.Items.Add(s);
48+
this.yAxisComboBox.Items.Add(s);
49+
if (Regex.IsMatch(s, ".*\\bengine[_\\s]load\\b.*", RegexOptions.IgnoreCase))
50+
engLoad = s;
51+
else if (Regex.IsMatch(s, ".*\\b(engine[_\\s]speed|rpm)\\b.*", RegexOptions.IgnoreCase))
52+
engSpeed = s;
53+
}
54+
if (engLoad != null)
55+
this.xAxisComboBox.SelectedItem = engLoad;
56+
else
57+
this.xAxisComboBox.SelectedIndex = 0;
58+
if (engSpeed != null)
59+
this.yAxisComboBox.SelectedItem = engSpeed;
60+
else
61+
this.yAxisComboBox.SelectedIndex = 0;
62+
}
63+
}
64+
}
65+
66+
public String XAxis
67+
{
68+
get { return this.xAxisComboBox.SelectedItem.ToString(); }
69+
}
70+
71+
public String YAxis
72+
{
73+
get { return this.yAxisComboBox.SelectedItem.ToString(); }
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)