remove NotePropertiesDialog in favor of using SettingsDialog
This commit is contained in:
parent
a0996b9909
commit
8095492aac
@ -1,73 +0,0 @@
|
||||
//
|
||||
// NotePropertiesDialog.cs - provides a UWT Dialog that modifies the properties of a SynthesizedAudioCommandNote
|
||||
//
|
||||
// Author:
|
||||
// Mike Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2019-2020 Mike Becker
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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 MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
using MBS.Framework.UserInterface.Layouts;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
|
||||
|
||||
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a UWT <see cref="ContainerLayoutAttribute" />-based <see cref="CustomDialog" /> that modifies the properties of a
|
||||
/// <see cref="ObjectModels.Multimedia.Audio.Synthesized.SynthesizedAudioCommandNote" />.
|
||||
/// </summary>
|
||||
[ContainerLayout("~/Editors/Multimedia/Synthesized/Dialogs/NotePropertiesDialog.glade")]
|
||||
public class NotePropertiesDialog : CustomDialog
|
||||
{
|
||||
private TextBox txtNoteValue;
|
||||
private TextBox txtLyric;
|
||||
private TextBox txtPhoneme;
|
||||
private NumericTextBox txtNoteOn;
|
||||
private NumericTextBox txtNoteOff;
|
||||
|
||||
private Button cmdOK;
|
||||
|
||||
public string Lyric { get; set; } = null;
|
||||
public string Phoneme { get; set; } = null;
|
||||
public double NoteOn { get; set; } = 0.0;
|
||||
public double NoteOff { get; set; } = 0.0;
|
||||
|
||||
protected override void OnCreated(EventArgs e)
|
||||
{
|
||||
base.OnCreated(e);
|
||||
DefaultButton = cmdOK;
|
||||
|
||||
txtLyric.Text = Lyric;
|
||||
txtPhoneme.Text = Phoneme;
|
||||
txtNoteOn.Value = NoteOn;
|
||||
txtNoteOff.Value = NoteOff;
|
||||
}
|
||||
|
||||
[EventHandler(nameof(cmdOK), "Click")]
|
||||
private void cmdOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
Lyric = txtLyric.Text;
|
||||
Phoneme = txtPhoneme.Text;
|
||||
NoteOn = txtNoteOn.Value;
|
||||
NoteOff = txtNoteOff.Value;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,12 +26,12 @@ using System.Linq;
|
||||
using MBS.Framework.Drawing;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
using MBS.Framework.UserInterface.Dialogs;
|
||||
using MBS.Framework.UserInterface.Drawing;
|
||||
using MBS.Framework.UserInterface.Input.Keyboard;
|
||||
using MBS.Framework.UserInterface.Input.Mouse;
|
||||
using MBS.Framework.UserInterface.Layouts;
|
||||
|
||||
using UniversalEditor.Editors.Multimedia.Audio.Synthesized.Dialogs;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
|
||||
using UniversalEditor.UserInterface;
|
||||
|
||||
@ -739,18 +739,6 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
|
||||
{
|
||||
SynthesizedAudioCommandNote note = (cmd as SynthesizedAudioCommandNote);
|
||||
LyricEditNote(note);
|
||||
|
||||
// ShowNotePropertiesDialog(note);
|
||||
/*
|
||||
txtLyric.Location = rect.Location;
|
||||
txtLyric.Size = rect.Size;
|
||||
txtLyric.Text = note.Lyric;
|
||||
|
||||
txtLyric.Enabled = true;
|
||||
txtLyric.Visible = true;
|
||||
|
||||
txtLyric.Focus();
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -777,20 +765,27 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
|
||||
if (note == null)
|
||||
return;
|
||||
|
||||
// FIXME: ParentWindow is null, probably because this isn't a "normal" parented control but rather it's inside a DockingWindow...
|
||||
NotePropertiesDialog dlg = new NotePropertiesDialog();
|
||||
dlg.Lyric = note.Lyric;
|
||||
dlg.Phoneme = note.Phoneme;
|
||||
dlg.NoteOn = (double)note.Position;
|
||||
dlg.NoteOff = note.Position + note.Length;
|
||||
SettingsDialog dlg = new SettingsDialog(new SettingsProvider[]
|
||||
{
|
||||
new CustomSettingsProvider(new SettingsGroup[]
|
||||
{
|
||||
new SettingsGroup("General", new Setting[]
|
||||
{
|
||||
new TextSetting("Lyric", "_Lyric", note.Lyric),
|
||||
new TextSetting("Phoneme", "_Phoneme", note.Phoneme),
|
||||
new RangeSetting("NoteOn", "Note o_n", note.Position),
|
||||
new RangeSetting("NoteOff", "Note o_ff", (decimal)(note.Position + note.Length))
|
||||
})
|
||||
})
|
||||
});
|
||||
if (dlg.ShowDialog(ParentWindow) == DialogResult.OK)
|
||||
{
|
||||
((Parent as PianoRollView).Parent as Editor).BeginEdit();
|
||||
|
||||
note.Lyric = dlg.Lyric;
|
||||
note.Phoneme = dlg.Phoneme;
|
||||
note.Position = (int)dlg.NoteOn;
|
||||
note.Length = dlg.NoteOff - dlg.NoteOn;
|
||||
note.Lyric = dlg.SettingsProviders[0].SettingsGroups[0].Settings[0].GetValue<string>();
|
||||
note.Phoneme = dlg.SettingsProviders[0].SettingsGroups[0].Settings[1].GetValue<string>();
|
||||
note.Position = (int)dlg.SettingsProviders[0].SettingsGroups[0].Settings[2].GetValue<decimal>();
|
||||
note.Length = (double)(dlg.SettingsProviders[0].SettingsGroups[0].Settings[3].GetValue<decimal>() - dlg.SettingsProviders[0].SettingsGroups[0].Settings[2].GetValue<decimal>());
|
||||
|
||||
((Parent as PianoRollView).Parent as Editor).EndEdit();
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
<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" />
|
||||
<Compile Include="Editors\Multimedia\Audio\Waveform\WaveformAudioEditor.cs" />
|
||||
@ -72,7 +71,6 @@
|
||||
<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\" />
|
||||
<Folder Include="Editors\Multimedia\Audio\Waveform\" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user