Author SHA1 Message Date
veroxzik f101b2b1f8 WIP: Fix drawing notes near the edge of linear view 2022-11-20 00:19:51 -05:00
veroxzik c37b538b33 WIP: Linear View
Separate form created, mirrors the notes from the circular view.
2022-11-20 00:17:41 -05:00
10 changed files with 736 additions and 10 deletions
+6 -8
View File
@@ -26,8 +26,6 @@ namespace BAKKA_Editor
public Pen TickMinorPen { get; set; }
public Pen TickMediumPen { get; set; }
public Pen TickMajorPen { get; set; }
public SolidBrush HoldBrush { get; set; } = new SolidBrush(Color.FromArgb(170, Color.Yellow));
public SolidBrush MaskBrush { get; set; } = new SolidBrush(Color.FromArgb(90, Color.Black));
public SolidBrush BackgroundBrush { get; set; }
public Pen HighlightPen { get; set; }
public Pen FlairPen { get; set; }
@@ -182,7 +180,7 @@ namespace BAKKA_Editor
var rem = masks.FirstOrDefault(x => x.NoteType == NoteType.MaskRemove &&
x.Position == mask.Position && x.Size == mask.Size);
if (rem == null || rem.Measure < mask.Measure)
bufGraphics.Graphics.FillPie(MaskBrush, DrawRect.ToInt(), -mask.Position * 6.0f, -mask.Size * 6.0f);
bufGraphics.Graphics.FillPie(PlotBrush.MaskBrush, DrawRect.ToInt(), -mask.Position * 6.0f, -mask.Size * 6.0f);
}
else if (mask.NoteType == NoteType.MaskRemove) // Explicitly draw MaskRemove for edge cases
{
@@ -247,7 +245,7 @@ namespace BAKKA_Editor
ArcInfo currentInfo = GetScaledRect(CurrentMeasure);
ArcInfo endInfo = GetScaledRect(CurrentMeasure + TotalMeasureShowNotes);
// First, draw holes that start before the viewpoint and have nodes that end after
// First, draw holds that start before the viewpoint and have nodes that end after
List<Note> holdNotes = chart.Notes.Where(
x => x.Measure < CurrentMeasure
&& x.NextNote != null
@@ -297,7 +295,7 @@ namespace BAKKA_Editor
GraphicsPath path = new GraphicsPath();
path.AddArc(currentInfo.Rect, startAngle, arcLength);
path.AddArc(endInfo.Rect, startAngle2 + arcLength2, -arcLength2);
bufGraphics.Graphics.FillPath(HoldBrush, path);
bufGraphics.Graphics.FillPath(PlotBrush.HoldBrush, path);
}
// Second, draw all the notes on-screen
@@ -332,7 +330,7 @@ namespace BAKKA_Editor
GraphicsPath path = new GraphicsPath();
path.AddArc(info.Rect, info.StartAngle, info.ArcLength);
path.AddArc(currentInfo.Rect, startAngle + arcLength, -arcLength);
bufGraphics.Graphics.FillPath(HoldBrush, path);
bufGraphics.Graphics.FillPath(PlotBrush.HoldBrush, path);
}
// If the next note is on-screen, this case handles that
@@ -342,7 +340,7 @@ namespace BAKKA_Editor
GraphicsPath path = new GraphicsPath();
path.AddArc(info.Rect, info.StartAngle, info.ArcLength);
path.AddArc(nextInfo.Rect, nextInfo.StartAngle + nextInfo.ArcLength, -nextInfo.ArcLength);
bufGraphics.Graphics.FillPath(HoldBrush, path);
bufGraphics.Graphics.FillPath(PlotBrush.HoldBrush, path);
}
// If the next note is off-screen, this case handles that
@@ -368,7 +366,7 @@ namespace BAKKA_Editor
GraphicsPath path = new GraphicsPath();
path.AddArc(endInfo.Rect, startAngle, arcLength);
path.AddArc(info.Rect, info.StartAngle + info.ArcLength, -info.ArcLength);
bufGraphics.Graphics.FillPath(HoldBrush, path);
bufGraphics.Graphics.FillPath(PlotBrush.HoldBrush, path);
}
// Draw note
+37
View File
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BAKKA_Editor
{
internal class DrawClasses
{
}
internal class NoteInfo
{
public int StartLane { get; }
public int EndLane { get; }
public int? StartLane2 { get; }
public int Size { get; }
public int? Size2 { get; }
public NoteInfo(int position, int size)
{
StartLane = (position - 15) < 0 ? (position - 15) + 60 : position - 15;
Size = size;
EndLane = (StartLane + size >= 60) ? StartLane + size : StartLane + size + 1;
StartLane2 = null;
Size2 = null;
if (EndLane > 60)
{
StartLane2 = StartLane;
StartLane = 0;
Size = EndLane - 60;
Size2 = 60 - StartLane2;
}
}
}
}
+193
View File
@@ -0,0 +1,193 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing.Drawing2D;
namespace BAKKA_Editor
{
internal class LinearView
{
public SizeF PanelSize { get; private set; }
public int LaneWidth { get; private set; }
public int LeftMargin { get; set; }
public int AllLaneWidth { get; private set; }
public int BpmMargin { get; private set; }
public int TimeSigMargin { get; private set; }
public int HiSpeedMargin { get; private set; }
public float StartingMeasure { get; set; } = -0.25f;
public float StartingPoint {
get
{
return (float)Math.Ceiling((Math.Ceiling(StartingMeasure) - StartingMeasure) * QuarterNoteHeight * 4);
}
}
public float SelectedMeasure { get; set; } = 0.0f;
public float EndMeasure
{
get
{
return (float)Math.Ceiling(StartingMeasure + PanelSize.Height / (QuarterNoteHeight * 4));
}
}
public int QuarterNoteHeight { get; set; } = 50;
public int NumLanes { get; } = 60;
public Pen MeasurePen { get; } = new Pen(Color.White, 1.0f);
public Pen MinorLanePen { get; } = new Pen(Color.FromArgb(42, 42, 42), 1.0f);
public Pen MediumLanePen { get; } = new Pen(Color.FromArgb(80, 80, 80), 1.0f);
public Pen MajorLanePen { get; } = new Pen(Color.White, 1.0f);
//public Pen MajorLanePen { get; } = new Pen(Color.FromArgb(100, 100, 100), 1.0f);
//public Brush LabelBrush { get; } = new SolidBrush(Color.FromArgb(204, 204, 204));
public Brush LabelBrush { get; } = new SolidBrush(Color.Black);
public Pen SelectionPen { get; } = new Pen(Color.Red, 1.0f);
public Pen BpmPen { get; } = new Pen(Color.Lime, 1.0f);
public Brush BpmBrush { get; } = new SolidBrush(Color.Lime);
public Pen TimeSigPen { get; } = new Pen(Color.LightBlue, 1.0f);
public Brush TimeSigBrush { get; } = new SolidBrush(Color.LightBlue);
public Pen HiSpeedPen { get; } = new Pen(Color.Salmon, 1.0f);
public Brush HiSpeedBrush { get; } = new SolidBrush(Color.Salmon);
public Font GimmickFont { get; } = new Font("Arial", 10.0f);
public StringFormat RightAlign { get; } = new StringFormat() { Alignment = StringAlignment.Far };
public LinearView(SizeF size)
{
Update(size);
}
public void Update(SizeF size)
{
PanelSize = size;
LeftMargin = (int)(PanelSize.Width * 0.08f);
LaneWidth = (int)Math.Max(8, PanelSize.Width * 0.68f / NumLanes);
AllLaneWidth = LaneWidth * NumLanes;
BpmMargin = TimeSigMargin = HiSpeedMargin = (int)Math.Max(60, PanelSize.Width * 0.08f);
}
public void DrawNote(Graphics g, Note note, float startingPoint)
{
float measureOffset = note.Measure - (float)Math.Ceiling(StartingMeasure);
float notePoint = (float)Math.Ceiling(measureOffset * QuarterNoteHeight * 4);
var noteInfo = new NoteInfo(note.Position, note.Size);
if (note.IsHold && note.NextNote != null)
{
float nextOffset = note.NextNote.Measure - (float)Math.Ceiling(StartingMeasure);
float nextPoint = (float)Math.Ceiling(nextOffset * QuarterNoteHeight * 4);
var nextInfo = new NoteInfo(note.NextNote.Position, note.NextNote.Size);
bool crossedBoundary = noteInfo.StartLane2 != null || nextInfo.StartLane2 != null;
bool bothValid = noteInfo.StartLane2 != null && nextInfo.StartLane2 != null;
if (!crossedBoundary || bothValid)
{
g.FillPolygon(
PlotBrush.HoldBrush,
new PointF[] {
new PointF(LeftMargin + LaneWidth * noteInfo.StartLane + 1.0f, PanelSize.Height - startingPoint - notePoint - 3.0f),
new PointF(LeftMargin + LaneWidth * (noteInfo.StartLane + noteInfo.Size) - 1.0f, PanelSize.Height - startingPoint - notePoint - 3.0f),
new PointF(LeftMargin + LaneWidth * (nextInfo.StartLane + nextInfo.Size) - 1.0f, PanelSize.Height - startingPoint - nextPoint - 3.0f),
new PointF(LeftMargin + LaneWidth * nextInfo.StartLane + 1.0f, PanelSize.Height - startingPoint - nextPoint - 3.0f)
});
if (bothValid)
{
g.FillPolygon(
PlotBrush.HoldBrush,
new PointF[] {
new PointF(LeftMargin + LaneWidth * (float)noteInfo.StartLane2 + 1.0f, PanelSize.Height - startingPoint - notePoint - 3.0f),
new PointF(LeftMargin + LaneWidth * ((float)noteInfo.StartLane2 + (float)noteInfo.Size2) - 1.0f, PanelSize.Height - startingPoint - notePoint - 3.0f),
new PointF(LeftMargin + LaneWidth * ((float)nextInfo.StartLane2 + (float)nextInfo.Size2) - 1.0f, PanelSize.Height - startingPoint - nextPoint - 3.0f),
new PointF(LeftMargin + LaneWidth * (float)nextInfo.StartLane2 + 1.0f, PanelSize.Height - startingPoint - nextPoint - 3.0f)
});
}
}
else
{
}
}
g.FillRectangle(
new SolidBrush(note.Color),
LeftMargin + LaneWidth * noteInfo.StartLane + 1.0f,
PanelSize.Height - startingPoint - notePoint - 3.0f,
LaneWidth * noteInfo.Size - 2.0f,
6.0f);
if (noteInfo.StartLane2 != null && noteInfo.Size2 != null)
{
g.FillPolygon(
new SolidBrush(note.Color),
new PointF[] {
new PointF(LeftMargin - 8.0f, PanelSize.Height - startingPoint - notePoint + 1.0f),
new PointF(LeftMargin - 8.0f, PanelSize.Height - startingPoint - notePoint - 2.0f),
new PointF(LeftMargin + 1.0f, PanelSize.Height - startingPoint - notePoint - 4.0f),
new PointF(LeftMargin + 1.0f, PanelSize.Height - startingPoint - notePoint + 3.0f)
});
g.FillRectangle(
new SolidBrush(note.Color),
LeftMargin + LaneWidth * (int)noteInfo.StartLane2 + 1.0f,
PanelSize.Height - startingPoint - notePoint - 3.0f,
LaneWidth * (int)noteInfo.Size2 - 2.0f,
6.0f);
g.FillPolygon(
new SolidBrush(note.Color),
new PointF[] {
new PointF(LeftMargin + AllLaneWidth + 8.0f, PanelSize.Height - startingPoint - notePoint + 1.0f),
new PointF(LeftMargin + AllLaneWidth + 8.0f, PanelSize.Height - startingPoint - notePoint - 2.0f),
new PointF(LeftMargin + AllLaneWidth - 1.0f, PanelSize.Height - startingPoint - notePoint - 4.0f),
new PointF(LeftMargin + AllLaneWidth - 1.0f, PanelSize.Height - startingPoint - notePoint + 3.0f)
});
}
}
public RectangleF[] GetNoteRect(Note note)
{
List<RectangleF> rects = new List<RectangleF>();
float measureOffset = note.Measure - (float)Math.Ceiling(StartingMeasure);
float notePoint = (float)Math.Ceiling(measureOffset * QuarterNoteHeight * 4);
int endLane = (14 - note.Position) < 0 ? (14 - note.Position) + 60 : (14 - note.Position);
int size = note.Size;
int startLane = (endLane - size + 1);
int? startLane2 = null;
int? size2 = null;
if (startLane < 0)
{
startLane2 = startLane + 60;
startLane = 0;
size = endLane + 1;
size2 = 60 - startLane2;
}
rects.Add(new RectangleF(
LeftMargin + LaneWidth * startLane + 1.0f,
PanelSize.Height - StartingPoint - notePoint - 3.0f,
LaneWidth * size - 2.0f,
6.0f));
if (startLane2 != null && size2 != null)
{
rects.Add(new RectangleF(
LeftMargin + LaneWidth * (int)startLane2 + 1.0f,
PanelSize.Height - StartingPoint - notePoint - 3.0f,
LaneWidth * (int)size2 - 2.0f,
6.0f));
}
return rects.ToArray();
}
}
}
+64
View File
@@ -0,0 +1,64 @@
namespace BAKKA_Editor
{
partial class LinearViewForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.linearPanel = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// linearPanel
//
this.linearPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.linearPanel.Location = new System.Drawing.Point(0, 0);
this.linearPanel.Name = "linearPanel";
this.linearPanel.Size = new System.Drawing.Size(800, 450);
this.linearPanel.TabIndex = 0;
this.linearPanel.Click += new System.EventHandler(this.linearPanel_Click);
this.linearPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.linearPanel_Paint);
this.linearPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.linearPanel_MouseMove);
//
// LinearViewForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.linearPanel);
this.Name = "LinearViewForm";
this.ShowIcon = false;
this.Text = "Linear View";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LinearViewForm_FormClosing);
this.Resize += new System.EventHandler(this.LinearViewForm_Resize);
this.ResumeLayout(false);
}
#endregion
private Panel linearPanel;
}
}
+323
View File
@@ -0,0 +1,323 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BAKKA_Editor
{
public partial class LinearViewForm : Form
{
// Chart
Chart _chart;
internal Chart Chart
{
get => _chart;
set
{
_chart = value;
linearPanel.Invalidate();
}
}
// Graphics
BufferedGraphicsContext gfxContext;
BufferedGraphics bufGraphics;
LinearView linearView;
public LinearViewForm()
{
InitializeComponent();
// Form events
linearPanel.MouseWheel += LinearPanel_MouseWheel;
// Setup graphics
gfxContext = BufferedGraphicsManager.Current;
SetBufferedGraphicsContext();
linearView = new LinearView(linearPanel.Size);
// Force double buffering on linearPanel
Type controlType = linearPanel.GetType();
PropertyInfo pi = controlType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
pi.SetValue(linearPanel, true);
}
private void SetBufferedGraphicsContext()
{
if (linearPanel.Width == 0 || linearPanel.Height == 0)
return;
gfxContext.MaximumBuffer = new Size(linearPanel.Width + 1, linearPanel.Height + 1);
bufGraphics = gfxContext.Allocate(linearPanel.CreateGraphics(),
new Rectangle(0, 0, linearPanel.Width, linearPanel.Height));
}
public void Update()
{
linearPanel.Invalidate(true);
}
private void linearPanel_Paint(object sender, PaintEventArgs e)
{
Rectangle panelRect = new Rectangle(0, 0, linearPanel.Width, linearPanel.Height);
// Set drawing mode
bufGraphics.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
// Draw background
bufGraphics.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(160, 160, 160)), panelRect);
// Ref Points
float startingRemainder = (float)Math.Ceiling(linearView.StartingMeasure) - linearView.StartingMeasure;
float startingPoint = startingRemainder * linearView.QuarterNoteHeight * 4;
// Draw Masks
var masks = Chart.Notes.Where(x => x.IsMask && x.NoteType == NoteType.MaskAdd && x.Measure < linearView.EndMeasure);
foreach (var mask in masks)
{
float measureOffset = mask.Measure - (float)Math.Ceiling(linearView.StartingMeasure);
float maskPoint = measureOffset * linearView.QuarterNoteHeight * 4;
float endPoint = 0;
var addNote = new NoteInfo(mask.Position, mask.Size);
var removeNote = Chart.Notes.FirstOrDefault(x => x.NoteType == NoteType.MaskRemove && x.Measure > mask.Measure && x.Position == mask.Position && x.Size == mask.Size);
if (removeNote != null)
{
endPoint = linearView.PanelSize.Height - startingPoint - (removeNote.Measure - (float)Math.Ceiling(linearView.StartingMeasure)) * linearView.QuarterNoteHeight * 4;
if (endPoint < 0)
endPoint = 0;
}
bufGraphics.Graphics.FillRectangle(
new SolidBrush(mask.Color),
linearView.LeftMargin + linearView.LaneWidth * addNote.StartLane + 1.0f,
endPoint,
linearView.LaneWidth * addNote.Size - 1.0f,
linearView.PanelSize.Height - startingPoint - maskPoint);
if (addNote.StartLane2 != null && addNote.Size2 != null)
{
bufGraphics.Graphics.FillRectangle(
new SolidBrush(mask.Color),
linearView.LeftMargin + linearView.LaneWidth * (int)addNote.StartLane2 + 1.0f,
endPoint,
linearView.LaneWidth * (int)addNote.Size2 - 1.0f,
linearView.PanelSize.Height - startingPoint - maskPoint);
}
}
// Draw Lanes
for (int i = 0; i < (linearView.NumLanes + 1); i++)
{
Pen lanePen;
if (i % 15 == 0)
lanePen = linearView.MajorLanePen;
else if (i % 5 == 0)
lanePen = linearView.MediumLanePen;
else
lanePen = linearView.MinorLanePen;
bufGraphics.Graphics.DrawLine(
lanePen,
linearView.LeftMargin + i * linearView.LaneWidth,
0,
linearView.LeftMargin + i * linearView.LaneWidth,
linearView.PanelSize.Height);
}
// Draw Measure Lines
for (int i = 0; i <= (int)(linearView.EndMeasure - linearView.StartingMeasure); i++)
{
bufGraphics.Graphics.DrawLine(
linearView.MeasurePen,
linearView.LeftMargin,
linearView.PanelSize.Height - startingPoint - i * linearView.QuarterNoteHeight * 4,
linearView.LeftMargin + linearView.AllLaneWidth,
linearView.PanelSize.Height - startingPoint - i * linearView.QuarterNoteHeight * 4);
bufGraphics.Graphics.DrawString(
$"{(Math.Ceiling(linearView.StartingMeasure) + i):F0}",
linearView.GimmickFont,
linearView.LabelBrush,
linearView.LeftMargin - 8.0f,
linearView.PanelSize.Height - startingPoint - i * linearView.QuarterNoteHeight * 4 - 18.0f,
linearView.RightAlign);
}
// Draw Hi-Speed
var hispeed = Chart.Gimmicks.Where(
x => x.GimmickType == GimmickType.HiSpeedChange
&& x.Measure >= linearView.StartingMeasure
&& x.Measure <= linearView.EndMeasure);
foreach (var evt in hispeed)
{
float measureOffset = evt.Measure - (float)Math.Ceiling(linearView.StartingMeasure);
float eventPoint = measureOffset * linearView.QuarterNoteHeight * 4;
bufGraphics.Graphics.DrawLine(
linearView.HiSpeedPen,
linearView.LeftMargin + linearView.AllLaneWidth,
linearView.PanelSize.Height - startingPoint - eventPoint,
linearView.LeftMargin + linearView.AllLaneWidth + linearView.BpmMargin + linearView.TimeSigMargin + linearView.HiSpeedMargin,
linearView.PanelSize.Height - startingPoint - eventPoint);
bufGraphics.Graphics.DrawString(
$"x {evt.HiSpeed:F3}",
linearView.GimmickFont,
linearView.HiSpeedBrush,
linearView.LeftMargin + linearView.AllLaneWidth + linearView.BpmMargin + linearView.TimeSigMargin + 8.0f,
linearView.PanelSize.Height - startingPoint - eventPoint - 18.0f);
}
// Draw Time Signature
var timesig = Chart.Gimmicks.Where(
x => x.GimmickType == GimmickType.TimeSignatureChange
&& x.Measure >= linearView.StartingMeasure
&& x.Measure <= linearView.EndMeasure);
foreach (var evt in timesig)
{
float measureOffset = evt.Measure - (float)Math.Ceiling(linearView.StartingMeasure);
float eventPoint = measureOffset * linearView.QuarterNoteHeight * 4;
bufGraphics.Graphics.DrawLine(
linearView.TimeSigPen,
linearView.LeftMargin + linearView.AllLaneWidth,
linearView.PanelSize.Height - startingPoint - eventPoint,
linearView.LeftMargin + linearView.AllLaneWidth + linearView.BpmMargin + linearView.TimeSigMargin,
linearView.PanelSize.Height - startingPoint - eventPoint);
bufGraphics.Graphics.DrawString(
$"{evt.TimeSig.Upper}/{evt.TimeSig.Lower}",
linearView.GimmickFont,
linearView.TimeSigBrush,
linearView.LeftMargin + linearView.AllLaneWidth + linearView.BpmMargin + 8.0f,
linearView.PanelSize.Height - startingPoint - eventPoint - 18.0f);
}
// Draw BPM
var bpm = Chart.Gimmicks.Where(
x => x.GimmickType == GimmickType.BpmChange
&& x.Measure >= linearView.StartingMeasure
&& x.Measure <= linearView.EndMeasure);
foreach (var evt in bpm)
{
float measureOffset = evt.Measure - (float)Math.Ceiling(linearView.StartingMeasure);
float eventPoint = measureOffset * linearView.QuarterNoteHeight * 4;
bufGraphics.Graphics.DrawLine(
linearView.BpmPen,
linearView.LeftMargin + linearView.AllLaneWidth,
linearView.PanelSize.Height - startingPoint - eventPoint,
linearView.LeftMargin + linearView.AllLaneWidth + linearView.BpmMargin,
linearView.PanelSize.Height - startingPoint - eventPoint);
bufGraphics.Graphics.DrawString(
evt.BPM.ToString("F2"),
linearView.GimmickFont,
linearView.BpmBrush,
linearView.LeftMargin + linearView.AllLaneWidth + 8.0f,
linearView.PanelSize.Height - startingPoint - eventPoint - 18.0f);
}
// Draw Selection Line
float selectionOffset = linearView.SelectedMeasure - (float)Math.Ceiling(linearView.StartingMeasure);
float selectionPoint = selectionOffset * linearView.QuarterNoteHeight * 4;
bufGraphics.Graphics.DrawLine(
linearView.SelectionPen,
linearView.LeftMargin - 10.0f,
linearView.PanelSize.Height - startingPoint - selectionPoint,
linearView.LeftMargin + linearView.AllLaneWidth,
linearView.PanelSize.Height - startingPoint - selectionPoint);
// Draw Holds
// First, draw holds that start before the viewpoint and end after
// Second, draw all notes on-screen
var holdNotes = Chart.Notes.Where(
x => x.Measure >= linearView.StartingMeasure
&& x.Measure <= linearView.EndMeasure
&& x.IsHold).ToList();
foreach (var note in holdNotes)
{
linearView.DrawNote(bufGraphics.Graphics, note, startingPoint);
}
// Draw Notes
var drawNotes = Chart.Notes.Where(
x => x.Measure >= linearView.StartingMeasure
&& x.Measure <= linearView.EndMeasure
&& !x.IsHold
&& !x.IsMask).ToList();
foreach (var note in drawNotes)
{
linearView.DrawNote(bufGraphics.Graphics, note, startingPoint);
}
bufGraphics.Render(e.Graphics);
}
private void LinearViewForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
Hide();
e.Cancel = true;
}
}
private void linearPanel_Click(object sender, EventArgs e)
{
linearPanel.Invalidate();
}
private void LinearViewForm_Resize(object sender, EventArgs e)
{
SetBufferedGraphicsContext();
linearView.Update(linearPanel.Size);
linearPanel.Invalidate();
}
private void LinearPanel_MouseWheel(object? sender, MouseEventArgs e)
{
if (Control.ModifierKeys == Keys.Control)
{
if (e.Delta > 0)
linearView.QuarterNoteHeight += 50;
else if (linearView.QuarterNoteHeight > 50)
linearView.QuarterNoteHeight -= 50;
linearPanel.Invalidate();
}
else if (Control.ModifierKeys == Keys.Alt)
{ }
else if (Control.ModifierKeys == Keys.Shift)
{ }
else
{
if (e.Delta > 0)
{
linearView.StartingMeasure += 0.25f * (50.0f / linearView.QuarterNoteHeight);
}
else
{
if (linearView.StartingMeasure > -0.25f)
linearView.StartingMeasure = Math.Max(-0.25f, linearView.StartingMeasure - 0.25f * ( 50.0f / linearView.QuarterNoteHeight));
}
}
linearPanel.Invalidate();
}
private void linearPanel_MouseMove(object sender, MouseEventArgs e)
{
// Check all notes to determine if we are over one
}
}
}
+60
View File
@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+21 -2
View File
@@ -140,6 +140,8 @@
this.noteNextButton = new System.Windows.Forms.Button();
this.notePrevButton = new System.Windows.Forms.Button();
this.autoSaveTimer = new System.Windows.Forms.Timer(this.components);
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.linearViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.beat2Numeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.beat1Numeric)).BeginInit();
@@ -941,7 +943,9 @@
this.showCursorToolStripMenuItem,
this.showCursorDuringPlaybackToolStripMenuItem,
this.highlightViewedNoteToolStripMenuItem,
this.selectLastInsertedNoteToolStripMenuItem});
this.selectLastInsertedNoteToolStripMenuItem,
this.toolStripSeparator1,
this.linearViewToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
@@ -970,13 +974,14 @@
this.highlightViewedNoteToolStripMenuItem.Name = "highlightViewedNoteToolStripMenuItem";
this.highlightViewedNoteToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
this.highlightViewedNoteToolStripMenuItem.Text = "Highlight Viewed Note";
//
// selectLastInsertedNoteToolStripMenuItem
//
this.selectLastInsertedNoteToolStripMenuItem.Checked = true;
this.selectLastInsertedNoteToolStripMenuItem.CheckOnClick = true;
this.selectLastInsertedNoteToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.selectLastInsertedNoteToolStripMenuItem.Name = "selectLastInsertedNoteToolStripMenuItem";
this.selectLastInsertedNoteToolStripMenuItem.Size = new System.Drawing.Size(285, 26);
this.selectLastInsertedNoteToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
this.selectLastInsertedNoteToolStripMenuItem.Text = "Select Last Inserted Note";
//
// chartToolStripMenuItem
@@ -1389,6 +1394,18 @@
//
this.autoSaveTimer.Tick += new System.EventHandler(this.autoSaveTimer_Tick);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(227, 6);
//
// linearViewToolStripMenuItem
//
this.linearViewToolStripMenuItem.Name = "linearViewToolStripMenuItem";
this.linearViewToolStripMenuItem.Size = new System.Drawing.Size(230, 22);
this.linearViewToolStripMenuItem.Text = "Linear View";
this.linearViewToolStripMenuItem.Click += new System.EventHandler(this.linearViewToolStripMenuItem_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -1561,5 +1578,7 @@
private TrackBar trackBarVolume;
private Label labelSpeed;
private TrackBar trackBarSpeed;
private ToolStripSeparator toolStripSeparator1;
private ToolStripMenuItem linearViewToolStripMenuItem;
}
}
+15
View File
@@ -49,6 +49,9 @@ namespace BAKKA_Editor
GimmickForm gimmickForm;
InitChartSettingsForm initSettingsForm;
// View Forms
LinearViewForm linearForm;
// Program info
string fileVersion = "";
UserSettings userSettings;
@@ -75,6 +78,10 @@ namespace BAKKA_Editor
gimmickForm = new GimmickForm();
initSettingsForm = new InitChartSettingsForm();
// View Forms
linearForm = new();
linearForm.Chart = chart;
//Set Initial Song File :)
SetInitialSong();
@@ -103,6 +110,7 @@ namespace BAKKA_Editor
UpdateGimmickLabels();
SetText();
circlePanel.Invalidate();
linearForm.Update();
};
// Program info
@@ -224,6 +232,7 @@ namespace BAKKA_Editor
SetText();
opManager.Clear();
circlePanel.Invalidate();
linearForm.Chart = chart;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
@@ -270,6 +279,7 @@ namespace BAKKA_Editor
SetText();
}
circlePanel.Invalidate();
linearForm.Chart = chart;
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
@@ -2023,5 +2033,10 @@ namespace BAKKA_Editor
currentSong.PlaybackSpeed = (trackBarSpeed.Value / (float)trackBarSpeed.Maximum);
labelSpeed.Text = $"Speed (x{currentSong.PlaybackSpeed:0.00})";
}
private void linearViewToolStripMenuItem_Click(object sender, EventArgs e)
{
linearForm.Show();
}
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace BAKKA_Editor
{
internal static class PlotBrush
{
public static SolidBrush HoldBrush { get; } = new SolidBrush(Color.FromArgb(170, Color.Yellow));
public static SolidBrush MaskBrush { get; set; } = new SolidBrush(Color.DimGray);
}
}
+2
View File
@@ -53,6 +53,8 @@ namespace BAKKA_Editor
case NoteType.Chain:
case NoteType.ChainBonusFlair:
return Color.FromArgb(204, 190, 45);
case NoteType.MaskAdd:
return Color.DimGray;
case NoteType.EndOfChart:
return Color.Black;
default: