-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluginEditor.cs
83 lines (68 loc) · 2.16 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
72
73
74
75
76
77
78
79
80
81
82
83
/* This is the basic view. It instantiates the visible control(s) and
*
*/
using System.Collections.Generic;
namespace NixMidiTransposer
{
using System;
using Jacobi.Vst.Core;
using Jacobi.Vst.Framework;
using Jacobi.Vst.Framework.Common;
/// <summary>
/// Implements the custom UI editor for the plugin.
/// </summary>
class PluginEditor : IVstPluginEditor
{
private Plugin _plugin;
private WinFormsControlWrapper<MidiNoteMapperUI> _view;
/// <summary>
/// Constructs a new instance.
/// </summary>
/// <param name="plugin">Must not be null.</param>
public PluginEditor(Plugin plugin)
{
_plugin = plugin;
_view = new WinFormsControlWrapper<MidiNoteMapperUI>();
}
#region IVstPluginEditor Members
public System.Drawing.Rectangle Bounds
{
get { return _view.Bounds; }
}
public void Close()
{
_view.Close();
}
public bool KeyDown(byte ascii, VstVirtualKey virtualKey, VstModifierKeys modifers)
{
return false;
}
public bool KeyUp(byte ascii, VstVirtualKey virtualKey, VstModifierKeys modifers)
{
return false;
}
public VstKnobMode KnobMode { get; set; }
public void Open(IntPtr hWnd)
{
// passed transpose object to view.... this is older code before parameters.
_view.SafeInstance.Transpose = _plugin.Transpose;
_view.Open(hWnd);
_plugin.Transpose.SemitonesManager.PropertyChanged += _view.SafeInstance.SemitonesParameterChanged;
if (_plugin.Host != null)
_plugin.Transpose.ConnectHost();
}
public void ProcessIdle()
{
_view.SafeInstance.ProcessIdle();
}
void IVstPluginEditor.KeyDown(byte ascii, VstVirtualKey virtualKey, VstModifierKeys modifers)
{
return;
}
void IVstPluginEditor.KeyUp(byte ascii, VstVirtualKey virtualKey, VstModifierKeys modifers)
{
return;
}
#endregion
}
}