public AddIrtSpectralLibrary(IEnumerable <LibrarySpec> librarySpecs) { InitializeComponent(); comboLibrary.Items.AddRange(librarySpecs.Cast <object>().ToArray()); ComboHelper.AutoSizeDropDown(comboLibrary); }
public AddIrtCalculatorDlg(IEnumerable <RCalcIrt> calculators) { InitializeComponent(); comboLibrary.Items.AddRange(calculators.Cast <object>().ToArray()); ComboHelper.AutoSizeDropDown(comboLibrary); }
public DefineAnnotationDlg(IEnumerable <AnnotationDef> existing) { InitializeComponent(); Icon = Resources.Skyline; checkedListBoxAppliesTo.Items.Clear(); comboAppliesTo.Items.Clear(); foreach (var annotationTarget in new[] { AnnotationDef.AnnotationTarget.protein, AnnotationDef.AnnotationTarget.peptide, AnnotationDef.AnnotationTarget.precursor, AnnotationDef.AnnotationTarget.transition, AnnotationDef.AnnotationTarget.replicate, AnnotationDef.AnnotationTarget.precursor_result, AnnotationDef.AnnotationTarget.transition_result, }) { var item = new AnnotationTargetItem(annotationTarget, ModeUI); checkedListBoxAppliesTo.Items.Add(item); comboAppliesTo.Items.Add(item); } comboType.Items.AddRange(ListPropertyType.ListPropertyTypes().ToArray()); comboType.SelectedIndex = 0; ComboHelper.AutoSizeDropDown(comboType); _existing = existing; _dataSchema = BrowsingDataSchema.GetBrowsingDataSchema(); availableFieldsTree1.RootColumn = NullRootColumn; }
public AddOptimizationLibraryDlg(IEnumerable <OptimizationLibrary> libraries) { InitializeComponent(); comboLibrary.Items.AddRange(libraries.Cast <object>().ToArray()); ComboHelper.AutoSizeDropDown(comboLibrary); if (comboLibrary.Items.Count > 0) { comboLibrary.SelectedIndex = 0; } }
private int ResetResultsCombo(List <string> listNames, ToolStripComboBox combo) { object selected = combo.SelectedItem; combo.Items.Clear(); foreach (string name in listNames) { combo.Items.Add(name); } ComboHelper.AutoSizeDropDown(combo); return(selected != null?combo.Items.IndexOf(selected) : -1); }
public ImportIonMobilityFromSpectralLibraryDlg(IEnumerable <LibrarySpec> librarySpecs, CollisionalCrossSectionGridViewDriver gridViewDriver) { InitializeComponent(); comboLibrary.Items.AddRange(librarySpecs.Cast <object>().ToArray()); if ((comboLibrary.Items.Count == 1) && (Source == SpectralLibrarySource.settings)) { comboLibrary.SelectedIndex = 0; // The obvious choice } ComboHelper.AutoSizeDropDown(comboLibrary); _gridViewDriver = gridViewDriver; }
private void UpdateCombo() { var documentRetentionTimes = Document.Settings.DocumentRetentionTimes; var newItems = documentRetentionTimes.RetentionTimeSources.Values.Select(retentionTimeSource => new DataFileKey(retentionTimeSource)).ToArray(); if (newItems.SequenceEqual(comboAlignAgainst.Items.Cast <DataFileKey>())) { return; } var selectedIndex = comboAlignAgainst.SelectedIndex; comboAlignAgainst.Items.Clear(); comboAlignAgainst.Items.AddRange(newItems.Cast <object>().ToArray()); ComboHelper.AutoSizeDropDown(comboAlignAgainst); bool updateRows = true; if (comboAlignAgainst.Items.Count > 0) { if (selectedIndex < 0) { if (SkylineWindow.SelectedResultsIndex >= 0 && Document.Settings.HasResults) { var chromatogramSet = Document.Settings.MeasuredResults.Chromatograms[SkylineWindow.SelectedResultsIndex]; foreach (var msDataFileInfo in chromatogramSet.MSDataFileInfos) { var retentionTimeSource = documentRetentionTimes.RetentionTimeSources.Find(msDataFileInfo); if (retentionTimeSource == null) { continue; } selectedIndex = newItems.IndexOf( dataFileKey => Equals(retentionTimeSource, dataFileKey.RetentionTimeSource)); break; } } } selectedIndex = Math.Min(comboAlignAgainst.Items.Count - 1, Math.Max(0, selectedIndex)); if (comboAlignAgainst.SelectedIndex != selectedIndex) { comboAlignAgainst.SelectedIndex = selectedIndex; updateRows = false; // because the selection change will cause an update } } if (updateRows) { UpdateRows(); } }
private void UpdateToolbar() { if (_spectra == null || _spectra.Count < 2) { toolBar.Visible = false; } else { // Check to see if the list of files has changed. var listNames = _spectra.Select(spectrum => spectrum.Identity).ToArray(); var listExisting = new List <string>(); foreach (var item in comboSpectrum.Items) { listExisting.Add(item.ToString()); } if (!ArrayUtil.EqualsDeep(listNames, listExisting)) { // If it has, update the list, trying to maintain selection, if possible. object selected = comboSpectrum.SelectedItem; // Unless the current selected index is the one matching the one currently // in use by the precursor (zero), then try to stay viewing the in-use spectrum (zero) int selectedIndex = comboSpectrum.SelectedIndex; _inToolbarUpdate = true; comboSpectrum.Items.Clear(); foreach (string name in listNames) { comboSpectrum.Items.Add(name); } if (selectedIndex == 0 || selected == null || comboSpectrum.Items.IndexOf(selected) == -1) { comboSpectrum.SelectedIndex = 0; } else { comboSpectrum.SelectedItem = selected; } _inToolbarUpdate = false; ComboHelper.AutoSizeDropDown(comboSpectrum); } // Show the toolbar after updating the spectra if (!toolBar.Visible) { toolBar.Visible = true; } } FireSelectedSpectrumChanged(false); }
public SchedulingOptionsDlg(SrmDocument document, Func<int, bool> canTriggerReplicate) { InitializeComponent(); Icon = Resources.Skyline; _document = document; _canTriggerReplicate = canTriggerReplicate; foreach (var chromatogramSet in document.Settings.MeasuredResults.Chromatograms) { comboReplicateNames.Items.Add(chromatogramSet); } ComboHelper.AutoSizeDropDown(comboReplicateNames); radioSingleDataSet.Checked = !Settings.Default.ScheduleAvergeRT; }
public void LoadList(string selectedItemLast) { try { Combo.BeginUpdate(); Combo.Items.Clear(); foreach (TItem item in List.ToArrayStd()) { string name = List.GetDisplayName(item); int i = Combo.Items.Add(name); if (Equals(Combo.Items[i].ToString(), selectedItemLast)) { Combo.SelectedIndex = i; } } // If nothing was added, add a blank to avoid starting with "Add..." selected. if (Combo.Items.Count == 0) { Combo.Items.Add(string.Empty); } if (IsVisibleEditting) { if (List is IItemEditor <TItem> ) { Combo.Items.Add(Resources.SettingsListComboDriver_Add); Combo.Items.Add(Resources.SettingsListComboDriver_Edit_current); } Combo.Items.Add(Resources.SettingsListComboDriver_Edit_list); } if (Combo.SelectedIndex < 0) { Combo.SelectedIndex = 0; } ComboHelper.AutoSizeDropDown(Combo); } finally { Combo.EndUpdate(); } }
public DefineAnnotationDlg(IEnumerable <AnnotationDef> existing) { InitializeComponent(); Icon = Resources.Skyline; checkedListBoxAppliesTo.Items.Clear(); foreach (var annotationTarget in new[] { AnnotationDef.AnnotationTarget.protein, AnnotationDef.AnnotationTarget.peptide, AnnotationDef.AnnotationTarget.precursor, AnnotationDef.AnnotationTarget.transition, AnnotationDef.AnnotationTarget.replicate, AnnotationDef.AnnotationTarget.precursor_result, AnnotationDef.AnnotationTarget.transition_result, }) { checkedListBoxAppliesTo.Items.Add(new AnnotationTargetItem(annotationTarget, GetModeUIHelper().ModeUI)); } comboType.Items.AddRange(ListPropertyType.ListPropertyTypes().ToArray()); comboType.SelectedIndex = 0; ComboHelper.AutoSizeDropDown(comboType); _existing = existing; }
private void LoadFragmentIonEntries() { cbFragmentIons.Items.AddRange(ImportPeptideSearch.SearchEngine.FragmentIons); ComboHelper.AutoSizeDropDown(cbFragmentIons); cbFragmentIons.SelectedIndex = 0; }
public void UpdateResultsUI(SrmSettings settingsNew, SrmSettings settingsOld) { if (_updateLockCountDoc > 0) { return; } var results = settingsNew.MeasuredResults; if (settingsOld == null || !ReferenceEquals(results, settingsOld.MeasuredResults)) { if (results == null || results.Chromatograms.Count < 2) { if (toolBarResults.Visible) { toolBarResults.Visible = false; } // Make sure the combo contains the results name, if one is // available, because graph handling depends on this. if (results != null && results.Chromatograms.Count > 0) { string resultsName = results.Chromatograms[0].Name; if (ComboResults.Items.Count != 1 || !Equals(ComboResults.SelectedItem, resultsName)) { ComboResults.Items.Clear(); ComboResults.Items.Add(resultsName); ComboResults.SelectedIndex = 0; } } } else { // Check to see if the list of files has changed. var listNames = new List <string>(); foreach (var chromSet in results.Chromatograms) { listNames.Add(chromSet.Name); } var listExisting = new List <string>(); foreach (var item in ComboResults.Items) { listExisting.Add(item.ToString()); } if (!ArrayUtil.EqualsDeep(listNames, listExisting)) { // If it has, update the list, trying to maintain selection, if possible. object selected = ComboResults.SelectedItem; ComboResults.Items.Clear(); foreach (string name in listNames) { ComboResults.Items.Add(name); } if (selected == null || ComboResults.Items.IndexOf(selected) == -1) { ComboResults.SelectedIndex = 0; } else { ComboResults.SelectedItem = selected; } ComboHelper.AutoSizeDropDown(ComboResults); } // Show the toolbar after updating the files if (!toolBarResults.Visible) { toolBarResults.Visible = true; EnsureResultsComboSize(); } } } }
private int UpdateComboItems(ComboBox combo, IEnumerable <StaticMod> listSettingsMods, IList <ExplicitMod> listExplicitMods, IList <StaticMod> listDocMods, int indexAA, bool selectEither, bool select) { string seq = NodePeptide.Peptide.Target.Sequence; char aa = seq[indexAA]; int iSelected = -1; string explicitName = null; if (listExplicitMods != null) { int indexMod = listExplicitMods.IndexOf(mod => mod.IndexAA == indexAA); if (indexMod != -1) { explicitName = listExplicitMods[indexMod].Modification.Name; } } List <string> listItems = new List <string> { string.Empty }; foreach (StaticMod mod in listSettingsMods) { if (!mod.IsMod(aa, indexAA, seq.Length)) { continue; } listItems.Add(mod.Name); // If the peptide is explicitly modified, then the explicit modifications // indicate the combo selections. if (listExplicitMods != null) { if (Equals(explicitName, mod.Name)) { iSelected = listItems.Count - 1; } } // If it is not explicitly modified, or no modification was found in the // explicit set, and using the implicit modifications is allowed (variable mods) // check the implicit modifications for an applicable mod if (listExplicitMods == null || (selectEither && iSelected == -1)) { // If the modification is present in the document, then it should be selected by default. StaticMod modCurrent = mod; if (listDocMods != null && listDocMods.IndexOf(modDoc => !modDoc.IsExplicit && Equals(modDoc.Name, modCurrent.Name)) != -1) { iSelected = listItems.Count - 1; } } } listItems.Add(Resources.SettingsListComboDriver_Add); listItems.Add(Resources.SettingsListComboDriver_Edit_list); if (!EqualsItems(combo, listItems)) { combo.Items.Clear(); listItems.ForEach(item => combo.Items.Add(item)); // If not just the blank, add and edit items, make sure the drop-down is wid enough if (listItems.Count > 3) { ComboHelper.AutoSizeDropDown(combo); } } if (select) { combo.SelectedIndex = iSelected; } return(iSelected); }
private void PopulateComboBoxes() { foreach (var comboBox in ComboBoxes) { comboBox.Text = string.Empty; comboBox.Items.AddRange(new object[] { Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Ignore_Column, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Decoy, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_iRT, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Label_Type, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Library_Intensity, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Peptide_Modified_Sequence, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Precursor_m_z, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Product_m_z, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Protein_Name, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Fragment_Name, // Commented out for consistency because there is no product charge column // Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Precursor_Charge }); comboBox.SelectedIndex = 0; comboBox.SelectedIndexChanged += ComboChanged; ComboHelper.AutoSizeDropDown(comboBox); } var columns = Importer.RowReader.Indices; // It's not unusual to see lines like "744.8 858.39 10 APR.AGLCQTFVYGGCR.y7.light 105 40" where protein, peptide, and label are all stuck together, // so that all three lay claim to a single column. In such cases, prioritize peptide. columns.PrioritizePeptideColumn(); var headers = Importer.RowReader.Indices.Headers; // Checks if the headers of the current list are the same as the headers of the previous list, // because if they are then we want to prioritize user headers bool sameHeaders = false; if (headers != null) { sameHeaders = (headers.ToList().SequenceEqual(Settings.Default.CustomImportTransitionListHeaders)); } // If there are items on our saved column list and the file does not contain headers (or the headers are the same as the previous file), // and the number of columns matches the saved column count then the combo box text is set using that list if ((Settings.Default.CustomImportTransitionListColumnsList.Count != 0) && ((headers == null) || (sameHeaders)) && Importer.RowReader.Lines[0].ParseDsvFields(Importer.Separator).Length == Settings.Default.CustomImportTransitionListColumnCount) { for (int i = 0; i < Settings.Default.CustomImportTransitionListColumnsList.Count; i++) { // The method is called for every tuplet on the list. Item 1 is the index position and item 2 is the name SetComboBoxText(Settings.Default.CustomImportTransitionListColumnsList[i].Item1, Settings.Default.CustomImportTransitionListColumnsList[i].Item2); ComboChanged(ComboBoxes[i], new EventArgs()); } } else { SetComboBoxText(columns.DecoyColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Decoy); SetComboBoxText(columns.IrtColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_iRT); SetComboBoxText(columns.LabelTypeColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Label_Type); SetComboBoxText(columns.LibraryColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Library_Intensity); SetComboBoxText(columns.PeptideColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Peptide_Modified_Sequence); SetComboBoxText(columns.PrecursorColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Precursor_m_z); SetComboBoxText(columns.ProductColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Product_m_z); SetComboBoxText(columns.ProteinColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Protein_Name); SetComboBoxText(columns.FragmentNameColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Fragment_Name); // Commented out for consistency because there is no product charge column // SetComboBoxText(columns.PrecursorChargeColumn, Resources.ImportTransitionListColumnSelectDlg_PopulateComboBoxes_Precursor_Charge); } }
private void EnsureResultsComboSize() { comboResults.Width = toolBarResults.Width - labelResults.Width - 6; ComboHelper.AutoSizeDropDown(comboResults); }
public override void UpdateUI() { var document = _graphSummary.DocumentUIContainer.DocumentUI; if (!document.Settings.HasResults) { return; } var groupsVisible = AreaGraphController.GroupByGroup != null; toolStripLabel1.Visible = toolStripComboGroup.Visible = groupsVisible; var detectionsVisiblePrev = toolStripLabel2.Visible && toolStripNumericDetections.Visible && toolStripLabel3.Visible; var detectionsVisible = AreaGraphController.ShouldUseQValues(document); toolStripLabel2.Visible = toolStripNumericDetections.Visible = toolStripLabel3.Visible = detectionsVisible; if (detectionsVisible) { toolStripNumericDetections.NumericUpDownControl.Minimum = 2; if (AreaGraphController.GroupByGroup == null || AreaGraphController.GroupByAnnotation == null) { toolStripNumericDetections.NumericUpDownControl.Maximum = document.MeasuredResults.Chromatograms.Count; } else { toolStripNumericDetections.NumericUpDownControl.Maximum = AnnotationHelper.GetReplicateIndices(document, ReplicateValue.FromPersistedString(document.Settings, AreaGraphController.GroupByGroup), AreaGraphController.GroupByAnnotation).Length; } if (!detectionsVisiblePrev) { toolStripNumericDetections.NumericUpDownControl.Value = 2; } } if (groupsVisible) { var annotations = new[] { Resources.GraphSummary_UpdateToolbar_All }.Concat( AnnotationHelper.GetPossibleAnnotations(document, ReplicateValue.FromPersistedString(document.Settings, AreaGraphController.GroupByGroup)) .Except(new object[] { null })).ToArray(); toolStripComboGroup.Items.Clear(); // ReSharper disable once CoVariantArrayConversion toolStripComboGroup.Items.AddRange(annotations); if (AreaGraphController.GroupByAnnotation != null) { toolStripComboGroup.SelectedItem = AreaGraphController.GroupByAnnotation; } else { toolStripComboGroup.SelectedIndex = 0; } ComboHelper.AutoSizeDropDown(toolStripComboGroup); } toolStripComboNormalizedTo.Items.Clear(); _normalizationMethods.Clear(); _normalizationMethods.Add(NormalizeOption.DEFAULT); _normalizationMethods.AddRange(NormalizeOption.AvailableNormalizeOptions(_graphSummary.DocumentUIContainer.DocumentUI)); _normalizationMethods.Add(NormalizeOption.NONE); toolStripComboNormalizedTo.Items.AddRange(_normalizationMethods.Select(item => item.Caption).ToArray()); toolStripComboNormalizedTo.SelectedIndex = _normalizationMethods.IndexOf(AreaGraphController.AreaCVNormalizeOption); ComboHelper.AutoSizeDropDown(toolStripComboNormalizedTo); }