-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluginEditor.cs
71 lines (59 loc) · 1.62 KB
/
PluginEditor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Jacobi.Vst.Core;
using Jacobi.Vst.Plugin.Framework;
using Jacobi.Vst.Plugin.Framework.Common;
using System;
using System.Drawing;
using System.Linq;
using Sinora.UI;
namespace Sinora
{
/// <summary>
/// This object manages the custom editor (UI) for your plugin.
/// </summary>
/// <remarks>
/// When you do not implement a custom editor,
/// your Parameters will be displayed in an editor provided by the host.
/// </remarks>
internal sealed class PluginEditor : IVstPluginEditor, IDisposable
{
private readonly PluginParameters _parameters;
private readonly WinFormsControlWrapper<PluginEditorView> _view;
public PluginEditor(PluginParameters parameters)
{
_parameters = parameters ?? throw new ArgumentNullException(nameof(parameters));
_view = new WinFormsControlWrapper<PluginEditorView>();
}
public Rectangle Bounds => _view.Bounds;
public void Close()
{
_view.Close();
}
public bool KeyDown(byte ascii, VstVirtualKey virtualKey, VstModifierKeys modifers)
{
// empty by design
return false;
}
public bool KeyUp(byte ascii, VstVirtualKey virtualKey, VstModifierKeys modifers)
{
// empty by design
return false;
}
public VstKnobMode KnobMode { get; set; }
public void Open(IntPtr hWnd)
{
// make a list of parameters to pass to the dlg.
System.Collections.Generic.List<VstParameterManager>? paramList = _parameters.ParameterInfos
.Where(p => p.ParameterManager != null)
.Select(p => p.ParameterManager!)
.ToList();
_view.Open(hWnd);
}
public void ProcessIdle()
{
}
public void Dispose()
{
throw new NotImplementedException();
}
}
}