コード例 #1
0
        private void lbMappingPatches_DoubleClick(object sender, EventArgs e)
        {
            ListBox lb = (ListBox)sender;

            if (lb.SelectedItem == null)
            {
                return;
            }

            // Unselect the other listboxes.
            lbMappingDevice1LowerPatches.SelectedIndex = (lb == lbMappingDevice1LowerPatches) ? lb.SelectedIndex : -1;
            lbMappingDevice1UpperPatches.SelectedIndex = (lb == lbMappingDevice1UpperPatches) ? lb.SelectedIndex : -1;
            lbMappingDevice2LowerPatches.SelectedIndex = (lb == lbMappingDevice2LowerPatches) ? lb.SelectedIndex : -1;
            lbMappingDevice2UpperPatches.SelectedIndex = (lb == lbMappingDevice2UpperPatches) ? lb.SelectedIndex : -1;

            SimpleMapping.SimpleMappingDefinition mappingDef = (SimpleMapping.SimpleMappingDefinition)lb.SelectedItem;
            simpleMappingDefBeingEdited = mappingDef;

            tbPBScale.Value = (int)(mappingDef.pbScale * 12.0F);
            nudMappingDefTransposeOct.Value   = mappingDef.transpose / 12;
            nudMappingDefTransposeSemis.Value = mappingDef.transpose % 12;

            cbMappingDefModWheelEna.Checked  = mappingDef.bEnaModControl;
            cbMappingDefVolEna.Checked       = mappingDef.bEnaVolControl;
            cbMappingDefDamperEna.Checked    = mappingDef.bEnaDamperControl;
            tbMappingDefIniVol.Value         = mappingDef.initialVolume;
            nudMappingDefDamperRemap.Value   = (mappingDef.damperRemap >= 0) ? mappingDef.damperRemap : 64;
            cbMappingDefDamperToggle.Checked = mappingDef.bDamplerToggle;

            showSimpleMappingDefEditorControls(true);
        }
コード例 #2
0
        private void lbMappingDevicePatches_DragDrop(object sender, DragEventArgs e)
        {
            Console.WriteLine("btnRandAccessCol DragDrop: " + e);
            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                TreeNode droppedNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                if (droppedNode.Tag is SoundGeneratorPatch)
                {
                    SoundGeneratorPatch soundGeneratorPatch = (SoundGeneratorPatch)droppedNode.Tag;

                    if (sender is ListBox)
                    {
                        ListBox receivingListBox = (ListBox)sender;

                        // The list boxes are not populated with SoundGeneratorPatches, but with SimpleMappingDefinitions derived from them.
                        SimpleMapping.SimpleMappingDefinition mappingDefinition = new SimpleMapping.SimpleMappingDefinition();
                        mappingDefinition.programName        = soundGeneratorPatch.name;
                        mappingDefinition.soundGeneratorName = soundGeneratorPatch.soundGenerator.name;
                        mappingDefinition.transpose          = 0;
                        mappingDefinition.pbScale            = 1.0F;
                        mappingDefinition.bLower             = receivingListBox.Name.Contains("Lower");
                        receivingListBox.Items.Add(mappingDefinition);
                    }
                }
            }
        }