Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions CustomDataGridViewCell.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NSFW.TimingEditor
{
class CustomDataGridViewCell : DataGridViewTextBoxCell
{
private DataGridViewAdvancedBorderStyle _style;

public CustomDataGridViewCell() : base()
{

_style = new DataGridViewAdvancedBorderStyle();

_style.Bottom = DataGridViewAdvancedCellBorderStyle.None;
_style.Top = DataGridViewAdvancedCellBorderStyle.None;
_style.Left = DataGridViewAdvancedCellBorderStyle.None;
_style.Right = DataGridViewAdvancedCellBorderStyle.None;

}

public DataGridViewAdvancedBorderStyle AdvancedBorderStyle
{
get { return _style; }
set
{
_style.Bottom = value.Bottom;
_style.Top = value.Top;
_style.Left = value.Left;
_style.Right = value.Right;
}
}

protected override void PaintBorder(Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle)
{
base.PaintBorder(graphics, clipBounds, bounds, cellStyle, _style);
using (Pen p = new Pen(Color.Navy, 5))
{
Rectangle rect = bounds;
rect.X = rect.X + 1;
rect.Y = rect.Y + 1;
rect.Width -= 4;
rect.Height -= 4;
graphics.DrawRectangle(p, rect);
}
}

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)
{
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, _style, paintParts);
using (Pen p = new Pen(Color.Navy, 2))
{
Rectangle rect = cellBounds;
rect.Width -= 1;
rect.Height -= 1;
graphics.DrawRectangle(p, rect);
}
}
}
}
144 changes: 144 additions & 0 deletions LogOverlay.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions LogOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace NSFW.TimingEditor
{
public partial class LogOverlay : Form
{
public LogOverlay()
{
InitializeComponent();
}

public String[] LogParameters
{
get
{
if (this.headerListBox.SelectedItems.Count > 0)
{
int i = 0;
String[] s = new String[this.headerListBox.CheckedItems.Count];
foreach (Object o in this.headerListBox.CheckedItems)
s[i++] = o.ToString();
return s;
}
else
return new String[0];
}
set
{
if (value.Length > 0)
{
this.headerListBox.Items.Clear();
this.xAxisComboBox.Items.Clear();
this.yAxisComboBox.Items.Clear();
String engLoad = null;
String engSpeed = null;
foreach (String s in value)
{
this.headerListBox.Items.Add(s);
this.xAxisComboBox.Items.Add(s);
this.yAxisComboBox.Items.Add(s);
if (Regex.IsMatch(s, ".*\\bengine[_\\s]load\\b.*", RegexOptions.IgnoreCase))
engLoad = s;
else if (Regex.IsMatch(s, ".*\\b(engine[_\\s]speed|rpm)\\b.*", RegexOptions.IgnoreCase))
engSpeed = s;
}
if (engLoad != null)
this.xAxisComboBox.SelectedItem = engLoad;
else
this.xAxisComboBox.SelectedIndex = 0;
if (engSpeed != null)
this.yAxisComboBox.SelectedItem = engSpeed;
else
this.yAxisComboBox.SelectedIndex = 0;
}
}
}

public String XAxis
{
get { return this.xAxisComboBox.SelectedItem.ToString(); }
}

public String YAxis
{
get { return this.yAxisComboBox.SelectedItem.ToString(); }
}
}
}
Loading