private void SetupBindingCombos() { if (DeviceList.SelectedIndex > -1 && MapsView.SelectedIndices.Count > 0) { MidiMap midiMap = (MidiMap)DeviceList.SelectedItem; ControlBinding binding = (ControlBinding)MapsView.SelectedItems[0].Tag; TargetTypeCombo.Items.Clear(); TargetTypeCombo.Items.AddRange(UiTools.GetBindingTargetTypeList()); TargetTypeCombo.SelectedIndex = (int)binding.TargetType; BindTypeCombo.Items.Clear(); BindTypeCombo.Items.AddRange(Enum.GetNames(typeof(BindingType))); BindTypeCombo.SelectedIndex = (int)binding.BindingType; RepeatCheckbox.Checked = binding.Parent.AutoRepeat; UpdatePropertyCombo(); DeviceImage.Invalidate(); } else { TargetTypeCombo.Items.Clear(); BindTypeCombo.Items.Clear(); TargetPropertyCombo.ClearText(); } }
private void MapsView_AfterLabelEdit(object sender, LabelEditEventArgs e) { ControlMap cm = ((ControlBinding)MapsView.SelectedItems[0].Tag).Parent; if (!string.IsNullOrEmpty(e.Label)) { cm.Name = e.Label; ((MidiMap)DeviceList.SelectedItem).Dirty = true; DeviceImage.Invalidate(); } else { e.CancelEdit = true; } }
private void DeviceImage_DragDrop(object sender, DragEventArgs e) { string data = e.Data.GetData("Text").ToString(); if (data == MidiControlDataFormat && DragSource != null) { try { MidiMap midiMap = (MidiMap)DeviceList.SelectedItem; DragSource.Mapped = true; PointF pnt = ControlToImage(DeviceImage.PointToClient(new Point(e.X, e.Y))); DragSource.X = pnt.X; DragSource.Y = pnt.Y; DragSource.Width = .1f; DragSource.Height = .1f; DeviceImage.Invalidate(); midiMap.Dirty = true; } catch { } } }