Example #1
0
        public EditFragmentLossDlg(IEnumerable <FragmentLoss> existing)
        {
            InitializeComponent();

            _existing   = existing;
            _formulaBox = new FormulaBox(Resources.EditFragmentLossDlg_EditFragmentLossDlg_Neutral_loss__chemical_formula_, Resources.EditFragmentLossDlg_EditFragmentLossDlg__Monoisotopic_loss_, Resources.EditFragmentLossDlg_EditFragmentLossDlg_A_verage_loss_)
            {
                Location = new Point(12, 9)
            };
            Controls.Add(_formulaBox);

            comboIncludeLoss.Items.Add(LossInclusion.Never.GetLocalizedString());
            _libraryInclusionIndex = comboIncludeLoss.Items.Count;
            comboIncludeLoss.Items.Add(LossInclusion.Library.GetLocalizedString());
            comboIncludeLoss.Items.Add(LossInclusion.Always.GetLocalizedString());
            comboIncludeLoss.SelectedIndex = _libraryInclusionIndex;
        }
        public EditFragmentLossDlg(IEnumerable<FragmentLoss> existing)
        {
            InitializeComponent();

            _existing = existing;
            _formulaBox = new FormulaBox(Resources.EditFragmentLossDlg_EditFragmentLossDlg_Neutral_loss__chemical_formula_,Resources.EditFragmentLossDlg_EditFragmentLossDlg__Monoisotopic_loss_,Resources.EditFragmentLossDlg_EditFragmentLossDlg_A_verage_loss_)
            {
                Location = new Point(12,9)
            };
            Controls.Add(_formulaBox);

            comboIncludeLoss.Items.Add(LossInclusion.Never.GetLocalizedString());
            _libraryInclusionIndex = comboIncludeLoss.Items.Count;
            comboIncludeLoss.Items.Add(LossInclusion.Library.GetLocalizedString());
            comboIncludeLoss.Items.Add(LossInclusion.Always.GetLocalizedString());
            comboIncludeLoss.SelectedIndex = _libraryInclusionIndex;
        }
Example #3
0
        public EditMeasuredIonDlg(IEnumerable <MeasuredIon> existing)
        {
            _existing = existing;

            InitializeComponent();

            _formulaBox =
                new FormulaBox(Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_Ion__chemical_formula_,
                               Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_m_z_,
                               Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_m_z_)
            {
                Location = new Point(textFragment.Left, radioReporter.Top + 30),
                Anchor   = AnchorStyles.Left | AnchorStyles.Bottom,
            };

            Controls.Add(_formulaBox);

            // Seems like there should be a way to set this in the properties.
            comboDirection.SelectedIndex = 0;
        }
        public EditMeasuredIonDlg(IEnumerable<MeasuredIon> existing)
        {
            _existing = existing;

            InitializeComponent();

            _formulaBox =
                new FormulaBox(Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_Ion__chemical_formula_,
                    Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_m_z_,
                    Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_m_z_)
                {
                    Location = new Point(textFragment.Left, radioReporter.Top + 30),
                    Anchor = AnchorStyles.Left | AnchorStyles.Bottom,
                };

            Controls.Add(_formulaBox);

            // Seems like there should be a way to set this in the properties.
            comboDirection.SelectedIndex = 0;
        }
        /// <summary>
        /// For creating at the Molecule level (create molecule and first transition group) or modifying at the transition level
        /// Null values imply "don't ask user for this"
        /// </summary>
        public EditCustomMoleculeDlg(SkylineWindow parent, string title, Identity initialId, IEnumerable <Identity> existingIds, int minCharge, int maxCharge,
                                     SrmSettings settings, string defaultName, string defaultFormula, int?defaultCharge, ExplicitTransitionGroupValues explicitAttributes,
                                     ExplicitRetentionTimeInfo explicitRetentionTime,
                                     IsotopeLabelType defaultIsotopeLabelType, bool enableFormulaEditing = true)
        {
            Text                = title;
            _parent             = parent;
            _initialId          = initialId;
            _existingIds        = existingIds;
            _minCharge          = minCharge;
            _maxCharge          = maxCharge;
            _transitionSettings = settings != null ? settings.TransitionSettings : null;
            _peptideSettings    = settings != null ? settings.PeptideSettings : null;

            InitializeComponent();

            NameText = defaultName;
            var needOptionalValuesBox = explicitRetentionTime != null || explicitAttributes != null;
            var heightDelta           = 0;

            if (explicitAttributes == null)
            {
                ResultExplicitTransitionGroupValues = null;
                labelCollisionEnergy.Visible        = false;
                textCollisionEnergy.Visible         = false;
                labelSLens.Visible = false;
                textSLens.Visible  = false;
                labelCompensationVoltage.Visible           = false;
                textCompensationVoltage.Visible            = false;
                labelConeVoltage.Visible                   = false;
                textConeVoltage.Visible                    = false;
                labelDriftTimeHighEnergyOffsetMsec.Visible = false;
                textDriftTimeHighEnergyOffsetMsec.Visible  = false;
                labelDriftTimeMsec.Visible                 = false;
                textDriftTimeMsec.Visible                  = false;
                if (needOptionalValuesBox)
                {
                    // We blanked out everything but the retention time
                    var vmargin   = labelRetentionTime.Location.Y;
                    var newHeight = textRetentionTime.Location.Y + textRetentionTime.Height + vmargin;
                    heightDelta = groupBoxOptionalValues.Height - newHeight;
                    groupBoxOptionalValues.Height = newHeight;
                }
            }
            else
            {
                ResultExplicitTransitionGroupValues = new ExplicitTransitionGroupValues(explicitAttributes);
            }

            string labelAverage = defaultCharge.HasValue
                ? Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_m_z_
                : Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_mass_;
            string labelMono = defaultCharge.HasValue
                ? Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_m_z_
                : Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_mass_;

            _formulaBox =
                new FormulaBox(Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_Ion__chemical_formula_,
                               labelAverage,
                               labelMono,
                               defaultCharge)
            {
                Formula  = defaultFormula,
                Location = new Point(textName.Left, textName.Bottom + 12)
            };
            Controls.Add(_formulaBox);
            _formulaBox.TabIndex = 2;
            _formulaBox.Enabled  = enableFormulaEditing;
            bool needCharge = defaultCharge.HasValue;

            textCharge.Visible = labelCharge.Visible = needCharge;
            Charge             = defaultCharge ?? 0;
            if (needOptionalValuesBox && !needCharge)
            {
                heightDelta += groupBoxOptionalValues.Location.Y - labelCharge.Location.Y;
                groupBoxOptionalValues.Location = new Point(groupBoxOptionalValues.Location.X, labelCharge.Location.Y);
            }
            if (explicitRetentionTime == null)
            {
                // Don't ask user for retetention times
                RetentionTime                    = null;
                RetentionTimeWindow              = null;
                labelRetentionTime.Visible       = false;
                labelRetentionTimeWindow.Visible = false;
                textRetentionTime.Visible        = false;
                textRetentionTimeWindow.Visible  = false;
                if (needOptionalValuesBox)
                {
                    var rtHeight = labelCollisionEnergy.Location.Y - labelRetentionTimeWindow.Location.Y;
                    groupBoxOptionalValues.Height -= rtHeight;
                    heightDelta += rtHeight;
                }
            }
            else
            {
                RetentionTime       = explicitRetentionTime.RetentionTime;
                RetentionTimeWindow = explicitRetentionTime.RetentionTimeWindow;
            }
            if (!needOptionalValuesBox)
            {
                groupBoxOptionalValues.Visible = false;
                heightDelta = groupBoxOptionalValues.Height;
            }
            // Initialize label
            if (settings != null && defaultIsotopeLabelType != null)
            {
                _driverLabelType = new PeptideSettingsUI.LabelTypeComboDriver(comboIsotopeLabelType,
                                                                              settings.PeptideSettings.Modifications, null, null, null, null)
                {
                    SelectedName = defaultIsotopeLabelType.Name
                };
            }
            else
            {
                comboIsotopeLabelType.Visible = false;
                labelIsotopeLabelType.Visible = false;
            }
            Height -= heightDelta;
        }
Example #6
0
        public EditStaticModDlg(StaticMod modEditing, IEnumerable <StaticMod> existing, bool heavy)
        {
            _existing = existing;
            _editing  = modEditing != null;
            _heavy    = heavy;

            InitializeComponent();

            // Amino acid characters and termini should not be localized
            comboAA.Items.Add(string.Empty);
            foreach (char aa in AminoAcid.All)
            {
                comboAA.Items.Add(aa.ToString(CultureInfo.InvariantCulture));
            }
            comboTerm.Items.Add(string.Empty);
            comboTerm.Items.Add(ModTerminus.N.ToString());
            comboTerm.Items.Add(ModTerminus.C.ToString());

            //Formula Box
            var location = heavy
                ? new Point(panelAtoms.Location.X + cb13C.Location.X, panelAtoms.Location.Y + cb13C.Location.Y)
                : cbChemicalFormula.Location;

            _formulaBox = new FormulaBox(Resources.EditStaticModDlg_EditStaticModDlg_Chemical_formula_,
                                         Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_A_verage_mass_,
                                         Resources.EditMeasuredIonDlg_EditMeasuredIonDlg__Monoisotopic_mass_)
            {
                Location = location
            };
            Controls.Add(_formulaBox);

            ComboNameVisible = !_editing;
            TextNameVisible  = _editing;

            UpdateListAvailableMods();

            cbVariableMod.Visible      = !heavy;
            _formulaBox.FormulaVisible = !heavy;
            cbChemicalFormula.Visible  = heavy;
            cbChemicalFormula.Checked  = !heavy || Settings.Default.ShowHeavyFormula;

            if (heavy)
            {
                labelRelativeRT.Left = labelAA.Left;
                comboRelativeRT.Left = comboAA.Left;
                comboRelativeRT.Items.Add(RelativeRT.Matching.GetLocalizedString());
                comboRelativeRT.Items.Add(RelativeRT.Overlapping.GetLocalizedString());
                comboRelativeRT.Items.Add(RelativeRT.Preceding.GetLocalizedString());
                comboRelativeRT.Items.Add(RelativeRT.Unknown.GetLocalizedString());
                comboRelativeRT.SelectedIndex = 0;
            }
            else
            {
                labelRelativeRT.Visible = false;
                comboRelativeRT.Visible = false;
            }

            ShowLoss = false;
            if (heavy)
            {
                btnLoss.Visible = false;
            }


            Modification = _originalModification = modEditing;
        }
Example #7
0
        private bool _showLoss = true; // Design mode with loss UI showing

        #endregion Fields

        #region Constructors

        public EditStaticModDlg(StaticMod modEditing, IEnumerable<StaticMod> existing, bool heavy)
        {
            _existing = existing;
            _editing = modEditing != null;
            _heavy = heavy;

            InitializeComponent();

            // Amino acid characters and termini should not be localized
            comboAA.Items.Add(string.Empty);
            foreach (char aa in AminoAcid.All)
                comboAA.Items.Add(aa.ToString(CultureInfo.InvariantCulture));
            comboTerm.Items.Add(string.Empty);
            comboTerm.Items.Add(ModTerminus.N.ToString());
            comboTerm.Items.Add(ModTerminus.C.ToString());

            //Formula Box
            var location = heavy
                ? new Point(panelAtoms.Location.X + cb13C.Location.X, panelAtoms.Location.Y + cb13C.Location.Y)
                : cbChemicalFormula.Location;
            _formulaBox = new FormulaBox(Resources.EditStaticModDlg_EditStaticModDlg_Chemical_formula_,
                Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_A_verage_mass_,
                Resources.EditMeasuredIonDlg_EditMeasuredIonDlg__Monoisotopic_mass_)
            {
                Location = location
            };
            Controls.Add(_formulaBox);

            ComboNameVisible = !_editing;
            TextNameVisible = _editing;

            UpdateListAvailableMods();

            cbVariableMod.Visible = !heavy;
            _formulaBox.FormulaVisible = !heavy;
            cbChemicalFormula.Visible = heavy;
            cbChemicalFormula.Checked = !heavy || Settings.Default.ShowHeavyFormula;

            if (heavy)
            {
                labelRelativeRT.Left = labelAA.Left;
                comboRelativeRT.Left = comboAA.Left;
                comboRelativeRT.Items.Add(RelativeRT.Matching.GetLocalizedString());
                comboRelativeRT.Items.Add(RelativeRT.Overlapping.GetLocalizedString());
                comboRelativeRT.Items.Add(RelativeRT.Preceding.GetLocalizedString());
                comboRelativeRT.Items.Add(RelativeRT.Unknown.GetLocalizedString());
                comboRelativeRT.SelectedIndex = 0;
            }
            else
            {
                labelRelativeRT.Visible = false;
                comboRelativeRT.Visible = false;
            }

            ShowLoss = false;
            if (heavy)
                btnLoss.Visible = false;

            Modification = _originalModification = modEditing;
        }
Example #8
0
        /// <summary>
        /// For creating at the Molecule level (create molecule and first transition group) or modifying at the transition level
        /// Null values imply "don't ask user for this"
        /// </summary>
        public EditCustomMoleculeDlg(SkylineWindow parent, UsageMode usageMode, string title, Identity initialId,
                                     IEnumerable <Identity> existingIds, int minCharge, int maxCharge,
                                     SrmSettings settings, CustomMolecule molecule, Adduct defaultCharge,
                                     ExplicitTransitionGroupValues explicitTransitionGroupAttributes,
                                     ExplicitTransitionValues explicitTransitionAttributes,
                                     ExplicitRetentionTimeInfo explicitRetentionTime,
                                     IsotopeLabelType defaultIsotopeLabelType)
        {
            Text                  = title;
            _parent               = parent;
            _initialId            = initialId;
            _existingIds          = existingIds;
            _minCharge            = minCharge;
            _maxCharge            = maxCharge;
            _transitionSettings   = settings != null ? settings.TransitionSettings : null;
            _peptideSettings      = settings != null ? settings.PeptideSettings : null;
            _resultAdduct         = Adduct.EMPTY;
            _resultCustomMolecule = molecule;
            _usageMode            = usageMode;

            var enableFormulaEditing = usageMode == UsageMode.moleculeNew || usageMode == UsageMode.moleculeEdit ||
                                       usageMode == UsageMode.fragment;
            var enableAdductEditing = usageMode == UsageMode.moleculeNew || usageMode == UsageMode.precursor ||
                                      usageMode == UsageMode.fragment;
            var suggestOnlyAdductsWithMass        = usageMode != UsageMode.fragment;
            var needExplicitTransitionValues      = usageMode == UsageMode.fragment;
            var needExplicitTransitionGroupValues = usageMode == UsageMode.moleculeNew || usageMode == UsageMode.precursor;

            InitializeComponent();

            NameText         = molecule == null ? String.Empty : molecule.Name;
            textName.Enabled = usageMode == UsageMode.moleculeNew || usageMode == UsageMode.moleculeEdit ||
                               usageMode == UsageMode.fragment; // Can user edit name?

            var needOptionalValuesBox = explicitRetentionTime != null || explicitTransitionGroupAttributes != null || explicitTransitionAttributes != null;

            if (!needExplicitTransitionValues)
            {
                labelCollisionEnergy.Visible             = false;
                textCollisionEnergy.Visible              = false;
                labelSLens.Visible                       = false;
                textSLens.Visible                        = false;
                labelConeVoltage.Visible                 = false;
                textConeVoltage.Visible                  = false;
                labelIonMobilityHighEnergyOffset.Visible = false;
                textIonMobilityHighEnergyOffset.Visible  = false;
                labelDeclusteringPotential.Visible       = false;
                textDeclusteringPotential.Visible        = false;
            }

            if (!needExplicitTransitionGroupValues)
            {
                labelCCS.Visible                 = false;
                textBoxCCS.Visible               = false;
                labelIonMobility.Visible         = false;
                textIonMobility.Visible          = false;
                labelIonMobilityUnits.Visible    = false;
                comboBoxIonMobilityUnits.Visible = false;
            }

            var heightDelta = 0;

            // Initialise the ion mobility units dropdown with L10N values
            foreach (eIonMobilityUnits t in Enum.GetValues(typeof(eIonMobilityUnits)))
            {
                comboBoxIonMobilityUnits.Items.Add(IonMobilityFilter.IonMobilityUnitsL10NString(t));
            }

            if (needOptionalValuesBox)
            {
                var newHeight = groupBoxOptionalValues.Height;
                var movers    = new List <Control>();
                int offset    = 0;
                if (!needExplicitTransitionGroupValues && !needExplicitTransitionValues)
                {
                    // We blanked out everything but the retention time
                    newHeight = labelCollisionEnergy.Location.Y;
                }
                else if (!needExplicitTransitionGroupValues)
                {
                    // We need to shift transition-level items up to where retention time was
                    movers.AddRange(new Control[] {
                        textCollisionEnergy, labelCollisionEnergy, textDeclusteringPotential, labelDeclusteringPotential, textSLens,
                        labelSLens, textConeVoltage, labelConeVoltage, textIonMobilityHighEnergyOffset, labelIonMobilityHighEnergyOffset
                    });
                    labelIonMobilityHighEnergyOffset.Location = labelIonMobility.Location;
                    textIonMobilityHighEnergyOffset.Location  = textIonMobility.Location;
                    offset    = labelCollisionEnergy.Location.Y - labelRetentionTime.Location.Y;
                    newHeight = textBoxCCS.Location.Y;
                }
                else if (!needExplicitTransitionValues)
                {
                    // We need to shift precursor-level items up to where retention time was
                    movers.AddRange(new Control[] { textBoxCCS, labelCCS, textIonMobility,
                                                    labelIonMobility, comboBoxIonMobilityUnits, labelIonMobilityUnits });
                    offset    = labelIonMobility.Location.Y - (explicitRetentionTime == null ? labelRetentionTime.Location.Y : labelCollisionEnergy.Location.Y);
                    newHeight = explicitRetentionTime == null ? textSLens.Location.Y : textIonMobility.Location.Y;
                }

                foreach (var mover in movers)
                {
                    mover.Anchor   = AnchorStyles.Left | AnchorStyles.Top;
                    mover.Location = new Point(mover.Location.X, mover.Location.Y - offset);
                }

                heightDelta = groupBoxOptionalValues.Height - newHeight;
                groupBoxOptionalValues.Height = newHeight;
            }

            ResultExplicitTransitionGroupValues = new ExplicitTransitionGroupValues(explicitTransitionGroupAttributes);
            ResultExplicitTransitionValues      = new ExplicitTransitionValues(explicitTransitionAttributes);

            string labelAverage = !defaultCharge.IsEmpty
                ? Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_m_z_
                : Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_mass_;
            string labelMono = !defaultCharge.IsEmpty
                ? Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_m_z_
                : Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_mass_;
            var defaultFormula = molecule == null ? string.Empty : molecule.Formula;
            var transition     = initialId as Transition;

            FormulaBox.EditMode editMode;
            if (enableAdductEditing && !enableFormulaEditing)
            {
                editMode = FormulaBox.EditMode.adduct_only;
            }
            else if (!enableAdductEditing && enableFormulaEditing)
            {
                editMode = FormulaBox.EditMode.formula_only;
            }
            else
            {
                editMode = FormulaBox.EditMode.formula_and_adduct;
            }
            string formulaBoxLabel;

            if (defaultCharge.IsEmpty)
            {
                formulaBoxLabel = Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_Chemi_cal_formula_;
            }
            else if (editMode == FormulaBox.EditMode.adduct_only)
            {
                var prompt = defaultFormula;
                if (string.IsNullOrEmpty(defaultFormula) && molecule != null)
                {
                    // Defined by mass only
                    prompt = molecule.ToString();
                }
                formulaBoxLabel = string.Format(Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_Addu_ct_for__0__,
                                                prompt);
            }
            else
            {
                formulaBoxLabel = Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_Ion__chemical_formula_;
            }

            double?averageMass = null;
            double?monoMass    = null;

            if (transition != null && string.IsNullOrEmpty(defaultFormula) && transition.IsCustom())
            {
                averageMass = transition.CustomIon.AverageMass;
                monoMass    = transition.CustomIon.MonoisotopicMass;
            }
            else if (molecule != null)
            {
                averageMass = molecule.AverageMass;
                monoMass    = molecule.MonoisotopicMass;
            }

            _formulaBox =
                new FormulaBox(false, // Not proteomic, so offer Cl and Br in atoms popup
                               formulaBoxLabel,
                               labelAverage,
                               labelMono,
                               defaultCharge,
                               editMode,
                               suggestOnlyAdductsWithMass)
            {
                NeutralFormula = defaultFormula,
                AverageMass    = averageMass,
                MonoMass       = monoMass,
                Location       = new Point(textName.Left, textName.Bottom + 12)
            };
            _formulaBox.ChargeChange += (sender, args) =>
            {
                if (!_formulaBox.Adduct.IsEmpty)
                {
                    Adduct = _formulaBox.Adduct;
                    var revisedFormula = _formulaBox.NeutralFormula + Adduct.AdductFormula;
                    if (!Equals(revisedFormula, _formulaBox.Formula))
                    {
                        _formulaBox.Formula = revisedFormula;
                    }
                    if (string.IsNullOrEmpty(_formulaBox.NeutralFormula) && averageMass.HasValue)
                    {
                        _formulaBox.AverageMass = averageMass;
                        _formulaBox.MonoMass    = monoMass;
                    }
                }
            };
            Controls.Add(_formulaBox);
            _formulaBox.TabIndex = 2;
            _formulaBox.Enabled  = enableFormulaEditing || enableAdductEditing;
            Adduct = defaultCharge;
            var needCharge = !Adduct.IsEmpty;

            textCharge.Visible = labelCharge.Visible = needCharge;
            if (needOptionalValuesBox && !needCharge)
            {
                heightDelta += groupBoxOptionalValues.Location.Y - labelCharge.Location.Y;
                groupBoxOptionalValues.Location = new Point(groupBoxOptionalValues.Location.X, labelCharge.Location.Y);
            }
            if (explicitRetentionTime == null)
            {
                // Don't ask user for retetention times
                RetentionTime                    = null;
                RetentionTimeWindow              = null;
                labelRetentionTime.Visible       = false;
                labelRetentionTimeWindow.Visible = false;
                textRetentionTime.Visible        = false;
                textRetentionTimeWindow.Visible  = false;
            }
            else
            {
                RetentionTime       = explicitRetentionTime.RetentionTime;
                RetentionTimeWindow = explicitRetentionTime.RetentionTimeWindow;
            }
            if (!needOptionalValuesBox)
            {
                groupBoxOptionalValues.Visible = false;
                heightDelta = groupBoxOptionalValues.Height;
            }
            // Initialize label
            if (settings != null && defaultIsotopeLabelType != null)
            {
                _driverLabelType = new PeptideSettingsUI.LabelTypeComboDriver(PeptideSettingsUI.LabelTypeComboDriver.UsageType.InternalStandardPicker, comboIsotopeLabelType,
                                                                              settings.PeptideSettings.Modifications, null, null, null, null)
                {
                    SelectedName = defaultIsotopeLabelType.Name
                };
            }
            else
            {
                comboIsotopeLabelType.Visible = false;
                labelIsotopeLabelType.Visible = false;
            }
            Height -= heightDelta;
        }
        /// <summary>
        /// For creating at the Molecule level (create molecule and first transition group) or modifying at the transition level
        /// Null values imply "don't ask user for this"
        /// </summary>
        public EditCustomMoleculeDlg(SkylineWindow parent, string title, Identity initialId, IEnumerable<Identity> existingIds, int minCharge, int maxCharge,
            SrmSettings settings, string defaultName, string defaultFormula, int? defaultCharge, ExplicitTransitionGroupValues explicitAttributes,
            ExplicitRetentionTimeInfo explicitRetentionTime,
            IsotopeLabelType defaultIsotopeLabelType, bool enableFormulaEditing = true)
        {
            Text = title;
            _parent = parent;
            _initialId = initialId;
            _existingIds = existingIds;
            _minCharge = minCharge;
            _maxCharge = maxCharge;
            _transitionSettings = settings != null ? settings.TransitionSettings : null;
            _peptideSettings = settings != null ? settings.PeptideSettings : null;

            InitializeComponent();

            NameText = defaultName;
            var needOptionalValuesBox = explicitRetentionTime != null || explicitAttributes != null;
            var heightDelta = 0;

            if (explicitAttributes == null)
            {
                ResultExplicitTransitionGroupValues = null;
                labelCollisionEnergy.Visible = false;
                textCollisionEnergy.Visible = false;
                labelSLens.Visible = false;
                textSLens.Visible = false;
                labelCompensationVoltage.Visible = false;
                textCompensationVoltage.Visible = false;
                labelConeVoltage.Visible = false;
                textConeVoltage.Visible = false;
                labelDriftTimeHighEnergyOffsetMsec.Visible = false;
                textDriftTimeHighEnergyOffsetMsec.Visible = false;
                labelDriftTimeMsec.Visible = false;
                textDriftTimeMsec.Visible = false;
                if (needOptionalValuesBox)
                {
                    // We blanked out everything but the retention time
                    var vmargin = labelRetentionTime.Location.Y;
                    var newHeight = textRetentionTime.Location.Y + textRetentionTime.Height +  vmargin;
                    heightDelta = groupBoxOptionalValues.Height - newHeight;
                    groupBoxOptionalValues.Height = newHeight;
                }
            }
            else
            {
                ResultExplicitTransitionGroupValues = new ExplicitTransitionGroupValues(explicitAttributes);
            }

            string labelAverage = defaultCharge.HasValue
                ? Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_m_z_
                : Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg_A_verage_mass_;
            string labelMono = defaultCharge.HasValue
                ? Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_m_z_
                : Resources.EditCustomMoleculeDlg_EditCustomMoleculeDlg__Monoisotopic_mass_;

            _formulaBox =
                new FormulaBox(Resources.EditMeasuredIonDlg_EditMeasuredIonDlg_Ion__chemical_formula_,
                    labelAverage,
                    labelMono,
                    defaultCharge)
                {
                    Formula = defaultFormula,
                    Location = new Point(textName.Left, textName.Bottom + 12)
                };
            Controls.Add(_formulaBox);
            _formulaBox.TabIndex = 2;
            _formulaBox.Enabled = enableFormulaEditing;
            bool needCharge = defaultCharge.HasValue;
            textCharge.Visible = labelCharge.Visible = needCharge;
            Charge = defaultCharge ?? 0;
            if (needOptionalValuesBox && !needCharge)
            {
                heightDelta += groupBoxOptionalValues.Location.Y - labelCharge.Location.Y;
                groupBoxOptionalValues.Location = new Point(groupBoxOptionalValues.Location.X, labelCharge.Location.Y);
            }
            if (explicitRetentionTime == null)
            {
                // Don't ask user for retetention times
                RetentionTime = null;
                RetentionTimeWindow = null;
                labelRetentionTime.Visible = false;
                labelRetentionTimeWindow.Visible = false;
                textRetentionTime.Visible = false;
                textRetentionTimeWindow.Visible = false;
                if (needOptionalValuesBox)
                {
                    var rtHeight = labelCollisionEnergy.Location.Y - labelRetentionTimeWindow.Location.Y;
                    groupBoxOptionalValues.Height -= rtHeight;
                    heightDelta += rtHeight;
                }
            }
            else
            {
                RetentionTime = explicitRetentionTime.RetentionTime;
                RetentionTimeWindow = explicitRetentionTime.RetentionTimeWindow;
            }
            if (!needOptionalValuesBox)
            {
                groupBoxOptionalValues.Visible = false;
                heightDelta = groupBoxOptionalValues.Height;
            }
            // Initialize label
            if (settings != null && defaultIsotopeLabelType != null)
            {
                _driverLabelType = new PeptideSettingsUI.LabelTypeComboDriver(comboIsotopeLabelType,
                    settings.PeptideSettings.Modifications, null, null, null, null)
                {
                    SelectedName = defaultIsotopeLabelType.Name
                };
            }
            else
            {
                comboIsotopeLabelType.Visible = false;
                labelIsotopeLabelType.Visible = false;
            }
            Height -= heightDelta;
        }