/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorService = null; if (provider != null) { editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; } if (editorService == null) { return(value); } bool singleSel = true; TMS5220Timbre tim = context.Instance as TMS5220Timbre; TMS5220Timbre[] tims = value as TMS5220Timbre[]; if (tims != null) { tim = tims[0]; singleSel = false; } TMS5220 inst = null; try { //InstrumentManager.ExclusiveLockObject.EnterReadLock(); inst = InstrumentManager.FindParentInstrument(InstrumentType.TMS5220, tim) as TMS5220; } finally { //InstrumentManager.ExclusiveLockObject.ExitReadLock(); } using (FormLpcEditor frm = new FormLpcEditor(inst, tim, singleSel)) { frm.Tag = context; frm.LpcData = (byte[])value; frm.ValueChanged += Frm_ValueChangedByte; DialogResult dr = frm.ShowDialog(); if (dr == DialogResult.OK) { value = frm.LpcData; } else if (value != null) { value = ((byte[])value).Clone(); } else { value = new byte[] { }; } } return(value); }
/// <summary> /// /// </summary> public FormLpcEditor(TMS5220 inst, TMS5220Timbre timbre, bool singleSelect) { this.inst = inst; this.timbre = timbre; for (int i = 0; i < inst.BaseTimbres.Length; i++) { if (inst.BaseTimbres[i] == timbre) { timbreNo = i; } } InitializeComponent(); Size = Settings.Default.LpcEdSize; setPresets(); }