reorganization: rename PianoRollEditor to SynthesizedAudioEditor; the piano roll is supposed to be one of several switchable EditorViews for the SynthesizedAudioEditor

This commit is contained in:
Michael Becker 2020-05-20 18:20:58 -04:00
parent 186a157438
commit 5f056f0432
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7
11 changed files with 79 additions and 59 deletions

View File

@ -1,6 +1,6 @@
<UniversalEditor Version="5.0">
<Editors>
<Editor TypeName="UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.PianoRollEditor">
<Editor TypeName="UniversalEditor.Editors.Multimedia.Audio.Synthesized.SynthesizedAudioEditor">
<Commands>
<Command ID="View">
<Items>

View File

@ -1,6 +1,6 @@
<UniversalEditor Version="5.0">
<Editors>
<Editor TypeName="UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.PianoRollEditor">
<Editor TypeName="UniversalEditor.Editors.Multimedia.Audio.Synthesized.SynthesizedAudioEditor">
<Toolbox>
<Group ID="ToolboxGroup_General" Title="General">
<Item ID="ToolboxItem_Select" Title="Select" />

View File

@ -606,7 +606,6 @@
<Content Include="Extensions\GraphicDesigner\Associations\Picture\PCX.uexml" />
<Content Include="Extensions\GraphicDesigner\Associations\Picture\PSD.uexml" />
<Content Include="Editors\FileSystem\Commands.uexml" />
<Content Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\MenuBar.uexml" />
<Content Include="splash.bmp" />
<Content Include="Editors\Executable\Commands.uexml" />
<Content Include="Extensions\GraphicDesigner\Associations\Palette\NewWorldComputingPAL.uexml" />
@ -736,6 +735,8 @@
<Content Include="Extensions\Amiga\Associations\FileSystem\ADFDiskImage.uexml" />
<Content Include="Editors\Designer\DesignerEditor.glade" />
<Content Include="Editors\Executable\ExecutableEditor.glade" />
<Content Include="Editors\Multimedia\Audio\Synthesized\MenuBar.uexml" />
<Content Include="Editors\Multimedia\Audio\Synthesized\Toolbox.uexml" />
</ItemGroup>
<ItemGroup>
<Content Include="Configuration\Application.upl" />
@ -754,7 +755,6 @@
<Folder Include="Editors\Multimedia\" />
<Folder Include="Editors\Multimedia\Audio\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\" />
<Folder Include="Editors\Executable\" />
<Folder Include="Panels\SolutionExplorer\" />
<Folder Include="Panels\SolutionExplorer\Languages\" />
@ -837,7 +837,6 @@
<None Include="Accessors\File.uexml" />
<None Include="Images\SplashScreen.png" />
<None Include="Images\SplashScreen.xcf" />
<None Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\Toolbox.uexml" />
<None Include="Extensions\SoftwareDeveloper\Associations\BinaryGrammar\SynalysisBinaryGrammarDataFormat.uexml" />
<None Include="Documentation\Executable\DataFormats\Executable\Microsoft\ExecutableFormats.txt" />
</ItemGroup>

View File

@ -25,7 +25,7 @@ using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Layouts;
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Dialogs
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Dialogs
{
/// <summary>
/// Provides a UWT <see cref="ContainerLayoutAttribute" />-based <see cref="CustomDialog" /> that modifies the properties of a

View File

@ -19,7 +19,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized
{
public enum QuantizationMode
{

View File

@ -26,13 +26,11 @@ using UniversalEditor.UserInterface;
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
using UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized
{
partial class PianoRollEditor : Editor
partial class SynthesizedAudioEditor : Editor
{
public PianoRollEditor()
public SynthesizedAudioEditor()
{
InitializeComponent();
}
@ -51,10 +49,10 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
return _er;
}
private PianoRollView PianoRoll = null;
private Views.PianoRoll.PianoRollView PianoRoll = null;
/// <summary>
/// UWT designer initialization for <see cref="PianoRollEditor" />.
/// UWT designer initialization for <see cref="SynthesizedAudioEditor" />.
/// </summary>
/// <remarks>
/// UWT designer initialization in code is deprecated; continue improving the cross-platform Glade XML parser for <see cref="ContainerLayoutAttribute" />!
@ -63,7 +61,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
{
this.Layout = new BoxLayout(Orientation.Vertical);
PianoRoll = new PianoRollView(this);
PianoRoll = new Views.PianoRoll.PianoRollView(this);
this.Controls.Add(PianoRoll, new BoxLayout.Constraints(true, true));
}
}

View File

@ -23,19 +23,19 @@ using System;
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
using UniversalEditor.UserInterface;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized
{
/// <summary>
/// Provides a UWT-based piano roll-style <see cref="Editor" /> for a <see cref="SynthesizedAudioObjectModel" />.
/// </summary>
public partial class PianoRollEditor
public partial class SynthesizedAudioEditor
{
public override void UpdateSelections()
{
Selections.Clear();
if (PianoRoll.SelectedCommands.Count > 0)
{
PianoRollEditorSelection sel = new PianoRollEditorSelection(this, PianoRoll);
SynthesizedAudioEditorSelection sel = new SynthesizedAudioEditorSelection(this, PianoRoll);
for (int i = 0; i < PianoRoll.SelectedCommands.Count; i++)
{
sel.Commands.Add(PianoRoll.SelectedCommands[i]);
@ -103,12 +103,12 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
{
case "ToolboxItem_Select":
{
PianoRoll.SelectionMode = PianoRollSelectionMode.Select;
PianoRoll.SelectionMode = Views.PianoRoll.PianoRollViewSelectionMode.Select;
break;
}
case "ToolboxItem_Insert":
{
PianoRoll.SelectionMode = PianoRollSelectionMode.Insert;
PianoRoll.SelectionMode = Views.PianoRoll.PianoRollViewSelectionMode.Insert;
break;
}
}

View File

@ -18,17 +18,16 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll;
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
using UniversalEditor.UserInterface;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized
{
public class PianoRollEditorSelection : EditorSelection
public class SynthesizedAudioEditorSelection : EditorSelection
{
private PianoRoll.Views.PianoRollView _parent = null;
internal PianoRollEditorSelection(Editor editor, PianoRoll.Views.PianoRollView parent) : base(editor)
private Views.PianoRoll.PianoRollView _parent = null;
internal SynthesizedAudioEditorSelection(Editor editor, Views.PianoRoll.PianoRollView parent) : base(editor)
{
_parent = parent;
}

View File

@ -31,11 +31,11 @@ using MBS.Framework.UserInterface.Input.Keyboard;
using MBS.Framework.UserInterface.Input.Mouse;
using MBS.Framework.UserInterface.Layouts;
using UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Dialogs;
using UniversalEditor.Editors.Multimedia.Audio.Synthesized.Dialogs;
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
using UniversalEditor.UserInterface;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
{
/// <summary>
/// Provides a UWT-based <see cref="View" /> for manipulating <see cref="SynthesizedAudioCommand" />s in a piano roll style.
@ -45,6 +45,8 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
private TextBox txt = null;
private SynthesizedAudioCommandNote _EditingNote = null;
private const double MAXSCROLLHEIGHT = 4096;
public PianoRollView(Editor parentEditor) : base(parentEditor)
{
Layout = new AbsoluteLayout();
@ -335,15 +337,15 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
private void ContextMenuArrow_Click(object sender, EventArgs e)
{
SelectionMode = PianoRollSelectionMode.Select;
SelectionMode = PianoRollViewSelectionMode.Select;
}
private void ContextMenuPencil_Click(object sender, EventArgs e)
{
SelectionMode = PianoRollSelectionMode.Insert;
SelectionMode = PianoRollViewSelectionMode.Insert;
}
private void ContextMenuErase_Click(object sender, EventArgs e)
{
SelectionMode = PianoRollSelectionMode.Delete;
SelectionMode = PianoRollViewSelectionMode.Delete;
}
private void ContextMenuToggleGridLines_Click(object sender, EventArgs e)
{
@ -353,8 +355,8 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
private bool _ShowGridLines = false;
public bool ShowGridLines { get { return _ShowGridLines; } set { _ShowGridLines = value; Refresh(); } }
private PianoRollSelectionMode _SelectionMode;
public PianoRollSelectionMode SelectionMode
private PianoRollViewSelectionMode _SelectionMode;
public PianoRollViewSelectionMode SelectionMode
{
get { return _SelectionMode; }
set
@ -362,17 +364,17 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
_SelectionMode = value;
switch (_SelectionMode)
{
case PianoRollSelectionMode.Insert:
case PianoRollViewSelectionMode.Insert:
{
Cursor = Cursors.Pencil;
break;
}
case PianoRollSelectionMode.Select:
case PianoRollViewSelectionMode.Select:
{
Cursor = Cursors.Default;
break;
}
case PianoRollSelectionMode.Delete:
case PianoRollViewSelectionMode.Delete:
{
Cursor = Cursors.Eraser;
break;
@ -414,7 +416,26 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
public SynthesizedAudioTrack SelectedTrack
{
get { return _SelectedTrack; }
set { _SelectedTrack = value; Refresh(); }
set
{
_SelectedTrack = value;
if (IsCreated)
{
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(GetMaxWidth(), MAXSCROLLHEIGHT);
VerticalAdjustment.Value = MAXSCROLLHEIGHT / 2;
}
Refresh();
}
}
protected override void OnCreated(EventArgs e)
{
base.OnCreated(e);
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(GetMaxWidth(), MAXSCROLLHEIGHT);
VerticalAdjustment.Value = MAXSCROLLHEIGHT / 2;
}
public Dimension2D NoteSize { get; set; } = new Dimension2D(12, 16);
@ -565,7 +586,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
{
Cursor = Cursors.Default;
}
else if (SelectionMode == PianoRollSelectionMode.Insert)
else if (SelectionMode == PianoRollViewSelectionMode.Insert)
{
Cursor = Cursors.Pencil;
}
@ -579,10 +600,10 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
if (ShowKeyboard && dx < KeyboardWidth)
dx = KeyboardWidth;
if (draggingCommand == null && (SelectionMode == PianoRollSelectionMode.Select || SelectionMode == PianoRollSelectionMode.Insert))
if (draggingCommand == null && (SelectionMode == PianoRollViewSelectionMode.Select || SelectionMode == PianoRollViewSelectionMode.Insert))
{
drag_CurrentLocation = Quantize(new Vector2D(dx, drag_OriginalLocation.Y), QuantizationMode.Length);
if (SelectionMode == PianoRollSelectionMode.Select)
if (SelectionMode == PianoRollViewSelectionMode.Select)
{
Rectangle rectSelection = new Rectangle(cx, cy, dx - cx, dy - cy);
SynthesizedAudioCommand[] cmds = HitTest(rectSelection);
@ -662,7 +683,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
*/
draggingCommand = null;
}
else if (SelectionMode == PianoRollSelectionMode.Insert)
else if (SelectionMode == PianoRollViewSelectionMode.Insert)
{
if (drag_CurrentLocation.X - drag_OriginalLocation.X > 0)
{
@ -808,13 +829,12 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
private Rectangle GetKeyboardRect()
{
Rectangle keyboardRect = new Rectangle(0, 0, Size.Width, Size.Height); // ClientRectangle
keyboardRect.Width = mvarKeyboardWidth;
Rectangle keyboardRect = new Rectangle(0, 0, mvarKeyboardWidth, ScrollBounds.Height); // ClientRectangle
return keyboardRect;
}
private Rectangle GetGridRect()
{
Rectangle gridRect = new Rectangle(0, 0, Size.Width + HorizontalAdjustment.Value, Size.Height); // ClientRectangle;
Rectangle gridRect = new Rectangle(0, 0, Size.Width + HorizontalAdjustment.Value, ScrollBounds.Height); // ClientRectangle;
if (mvarShowKeyboard)
{
Rectangle keyboardRect = GetKeyboardRect();
@ -858,6 +878,10 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
if (cx > width)
width += cx + cw;
}
if (width < HorizontalAdjustment.Value + Size.Width)
{
width = (int)(HorizontalAdjustment.Value + (Size.Width * 2));
}
return width;
}
@ -892,7 +916,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
SolidBrush sbScaleHighlight = new SolidBrush(SystemColors.HighlightBackground.Alpha(0.25));
SolidBrush sbBlackKeyHighlight = new SolidBrush(Colors.Gray.Alpha(0.125));
for (int i = 0; i < Size.Height; i += gridHeight)
for (int i = 0; i < ScrollBounds.Height; i += gridHeight)
{
int noteValue = (int)(((double)i / gridHeight) % 12);
string noteName = noteNames[noteValue];
@ -988,12 +1012,12 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
}
else if (m_selecting)
{
if (SelectionMode == PianoRollSelectionMode.Select)
if (SelectionMode == PianoRollViewSelectionMode.Select)
{
e.Graphics.DrawRectangle(pSelectionBorder, new Rectangle(cx, cy, dx - cx, dy - cy));
e.Graphics.FillRectangle(bSelectionFill, new Rectangle(cx, cy, dx - cx, dy - cy));
}
else if (SelectionMode == PianoRollSelectionMode.Insert)
else if (SelectionMode == PianoRollViewSelectionMode.Insert)
{
Rectangle dragrect = new Rectangle(drag_OriginalLocation.X * PositionQuantization, drag_OriginalLocation.Y * NoteHeight, (drag_CurrentLocation.X * GetLengthQuantization()) - (drag_OriginalLocation.X * GetLengthQuantization()), NoteHeight);
if (mvarShowKeyboard)
@ -1006,7 +1030,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll.Views
}
}
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(GetMaxWidth(), 0);
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(GetMaxWidth(), MAXSCROLLHEIGHT);
/*
// draw grids
for (int i = 0; i < Size.Width; i += (int) NoteSize.Width)

View File

@ -19,12 +19,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.PianoRoll
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
{
/// <summary>
/// Indicates the current selection mode for a <see cref="Controls.PianoRollView" />.
/// </summary>
public enum PianoRollSelectionMode
public enum PianoRollViewSelectionMode
{
Select,
Insert,

View File

@ -35,11 +35,6 @@
<Compile Include="Editors\Multimedia\Picture\PictureEditor.Designer.cs" />
<Compile Include="Controls\DrawingArea\DrawingAreaControl.cs" />
<Compile Include="SettingsProviders\SingingStyleDefaultsSettingsProvider.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\PianoRollEditor.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\PianoRollEditor.Designer.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\Views\PianoRollView.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\PianoRollSelectionMode.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\Dialogs\NotePropertiesDialog.cs" />
<Compile Include="PictureObjectModelExtensions.cs" />
<Compile Include="Editors\Multimedia\Palette\PaletteEditor.cs" />
<Compile Include="Editors\Multimedia\Palette\PaletteEditor.Designer.cs" />
@ -48,8 +43,13 @@
<Compile Include="Editors\Multimedia\Palette\PaletteEntrySelection.cs" />
<Compile Include="Editors\Multimedia\Audio\Voicebank\VoicebankEditor.cs" />
<Compile Include="Editors\Multimedia\PictureCollection\PictureCollectionEditor.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\QuantizationMode.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\PianoRollEditorSelection.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\SynthesizedAudioEditorSelection.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\SynthesizedAudioEditor.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\SynthesizedAudioEditor.Designer.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\QuantizationMode.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\Dialogs\NotePropertiesDialog.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\Views\PianoRoll\PianoRollView.cs" />
<Compile Include="Editors\Multimedia\Audio\Synthesized\Views\PianoRoll\PianoRollViewSelectionMode.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Editors\" />
@ -60,13 +60,13 @@
<Folder Include="SettingsProviders\" />
<Folder Include="Editors\Multimedia\Audio\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\Views\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\PianoRoll\Dialogs\" />
<Folder Include="Editors\Multimedia\Palette\" />
<Folder Include="Editors\Multimedia\Playlist\" />
<Folder Include="Editors\Multimedia\Audio\Voicebank\" />
<Folder Include="Editors\Multimedia\PictureCollection\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\Dialogs\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\Views\" />
<Folder Include="Editors\Multimedia\Audio\Synthesized\Views\PianoRoll\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">