From fd74e7a36e478edf3c3b25b927d0267abfe8c83c Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Wed, 18 Dec 2019 04:29:56 -0500 Subject: [PATCH] make PianoRollView an actual Universal Editor View --- .../Synthesized/PianoRoll/PianoRollEditor.Designer.cs | 2 +- .../Audio/Synthesized/PianoRoll/Views/PianoRollView.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/PianoRollEditor.Designer.cs b/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/PianoRollEditor.Designer.cs index c740e53f..f814af56 100644 --- a/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/PianoRollEditor.Designer.cs +++ b/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/PianoRollEditor.Designer.cs @@ -67,7 +67,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll { this.Layout = new BoxLayout(Orientation.Vertical); - PianoRoll = new PianoRollView(); + PianoRoll = new PianoRollView(this); this.Controls.Add(PianoRoll, new BoxLayout.Constraints(true, true)); } } diff --git a/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/Views/PianoRollView.cs b/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/Views/PianoRollView.cs index 15a0d593..d8cbc97e 100644 --- a/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/Views/PianoRollView.cs +++ b/CSharp/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/PianoRoll/Views/PianoRollView.cs @@ -27,12 +27,13 @@ using MBS.Framework.UserInterface.Input.Keyboard; using MBS.Framework.UserInterface.Input.Mouse; using UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Dialogs; using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized; +using UniversalEditor.UserInterface; namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Controls { - public class PianoRollView : /*View*/ CustomControl + public class PianoRollView : View { - public PianoRollView() + public PianoRollView(Editor parentEditor) : base(parentEditor) { this.ContextMenuCommandID = "PianoRollEditor_ContextMenu"; @@ -378,6 +379,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Control { Rectangle rectSelection = new Rectangle(cx, cy, dx - cx, dy - cy); SynthesizedAudioCommand[] cmds = HitTest(rectSelection); + mvarSelectedCommands.Clear(); foreach (SynthesizedAudioCommand cmd1 in cmds) { @@ -442,7 +444,10 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Control note.Position = (int)drag_OriginalLocation.X; note.Length = (drag_CurrentLocation.X - drag_OriginalLocation.X); note.Frequency = ValueToFrequency((int)drag_OriginalLocation.Y); + + Editor.BeginEdit(); mvarCommands.Add(note); + Editor.EndEdit(); mvarSelectedCommands.Clear(); mvarSelectedCommands.Add(note);