Changeset 15281 for branches/Async/HeuristicLab.Data.Views
- Timestamp:
- 07/23/17 11:17:18 (7 years ago)
- Location:
- branches/Async
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Async
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/Async/HeuristicLab.Data.Views
-
branches/Async/HeuristicLab.Data.Views/3.3
-
branches/Async/HeuristicLab.Data.Views/3.3/BoolMatrixView.cs
r12602 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/BoolValueView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/BoolValueView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/ComparisonView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/ComparisonView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/DoubleRangeView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/DoubleRangeView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/EnhancedStringConvertibleMatrixView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/EnhancedStringConvertibleMatrixView.cs
r15280 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/EnumValueView.Designer.cs
r12037 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 47 47 this.valueLabel = new System.Windows.Forms.Label(); 48 48 this.valueComboBox = new System.Windows.Forms.ComboBox(); 49 this.flagsListView = new System.Windows.Forms.ListView(); 50 this.columnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 49 51 this.SuspendLayout(); 50 52 // … … 54 56 this.valueLabel.Location = new System.Drawing.Point(3, 3); 55 57 this.valueLabel.Name = "valueLabel"; 56 this.valueLabel.Size = new System.Drawing.Size( 56, 13);58 this.valueLabel.Size = new System.Drawing.Size(37, 13); 57 59 this.valueLabel.TabIndex = 0; 58 60 this.valueLabel.Text = "&Value:"; … … 60 62 // valueComboBox 61 63 // 62 this.valueComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 64 this.valueComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 63 65 | System.Windows.Forms.AnchorStyles.Right))); 64 66 this.valueComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 71 73 this.valueComboBox.SelectedIndexChanged += new System.EventHandler(this.valueComboBox_SelectedIndexChanged); 72 74 // 75 // flagsListView 76 // 77 this.flagsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 78 | System.Windows.Forms.AnchorStyles.Left) 79 | System.Windows.Forms.AnchorStyles.Right))); 80 this.flagsListView.CheckBoxes = true; 81 this.flagsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 82 this.columnHeader}); 83 this.flagsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; 84 this.flagsListView.Location = new System.Drawing.Point(65, 0); 85 this.flagsListView.Name = "flagsListView"; 86 this.flagsListView.Size = new System.Drawing.Size(212, 21); 87 this.flagsListView.TabIndex = 2; 88 this.flagsListView.UseCompatibleStateImageBehavior = false; 89 this.flagsListView.View = System.Windows.Forms.View.Details; 90 this.flagsListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.flagsListView_ItemChecked); 91 // 92 // columnHeader 93 // 94 this.columnHeader.Width = 100; 95 // 73 96 // EnumValueView 74 97 // 75 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);76 98 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 99 this.Controls.Add(this.flagsListView); 77 100 this.Controls.Add(this.valueComboBox); 78 101 this.Controls.Add(this.valueLabel); … … 81 104 this.ResumeLayout(false); 82 105 this.PerformLayout(); 106 83 107 } 84 108 … … 87 111 private System.Windows.Forms.Label valueLabel; 88 112 private System.Windows.Forms.ComboBox valueComboBox; 113 private System.Windows.Forms.ListView flagsListView; 114 private System.Windows.Forms.ColumnHeader columnHeader; 89 115 } 90 116 } -
branches/Async/HeuristicLab.Data.Views/3.3/EnumValueView.cs
r12037 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Windows.Forms; 23 24 using HeuristicLab.Core.Views; 24 25 using HeuristicLab.MainForm; … … 42 43 } 43 44 45 static EnumValueView() { 46 if (!typeof(T).IsEnum) 47 throw new InvalidOperationException("Generic type " + typeof(T).Name + " is not an enum."); 48 } 49 44 50 public EnumValueView() { 45 51 InitializeComponent(); 52 this.Caption = typeof(T).Name + " View"; 53 46 54 valueComboBox.DataSource = Enum.GetValues(typeof(T)); 47 this.Name = typeof(T).Name + "EnumView"; 55 foreach (T flag in Enum.GetValues(typeof(T))) 56 flagsListView.Items.Add(new ListViewItem(flag.ToString()) { Tag = flag }); 57 columnHeader.Width = -1; 58 59 bool isFlags = Attribute.IsDefined(typeof(T), typeof(FlagsAttribute)); 60 if (isFlags) valueLabel.Text = "Flags:"; 61 valueComboBox.Visible = !isFlags; 62 flagsListView.Visible = isFlags; 48 63 } 49 64 public EnumValueView(EnumValue<T> content) … … 64 79 protected override void OnContentChanged() { 65 80 base.OnContentChanged(); 66 if (Content == null) 67 valueComboBox.Enabled = false; 68 else 81 if (Content == null) { 82 valueComboBox.SelectedIndex = -1; 83 foreach (ListViewItem item in flagsListView.Items) 84 item.Checked = false; 85 } else { 69 86 valueComboBox.SelectedItem = Content.Value; 87 foreach (ListViewItem item in flagsListView.Items) { 88 var flag = (Enum)item.Tag; 89 item.Checked = ((Enum)(object)Content.Value).HasFlag(flag); 90 } 91 } 70 92 } 71 93 72 94 protected override void SetEnabledStateOfControls() { 73 95 base.SetEnabledStateOfControls(); 74 if (Content == null) valueComboBox.Enabled = false; 75 else valueComboBox.Enabled = !ReadOnly; 96 if (Content == null) { 97 valueComboBox.Enabled = false; 98 flagsListView.Enabled = false; 99 } else { 100 valueComboBox.Enabled = !ReadOnly; 101 flagsListView.Enabled = !ReadOnly; 102 } 76 103 } 77 104 … … 79 106 if (InvokeRequired) 80 107 Invoke(new EventHandler(Content_ValueChanged), sender, e); 81 else 108 else { 82 109 valueComboBox.SelectedItem = Content.Value; 110 foreach (ListViewItem item in flagsListView.Items) { 111 var flag = (Enum)item.Tag; 112 item.Checked = ((Enum)(object)Content.Value).HasFlag(flag); 113 } 114 } 83 115 } 84 116 … … 87 119 Content.Value = (T)valueComboBox.SelectedItem; 88 120 } 121 122 private void flagsListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 123 var flag = (T)e.Item.Tag; 124 if ((Content != null) && !Content.ReadOnly) 125 Content.Value = ((Enum)(object)Content.Value).SetFlag(flag, e.Item.Checked); 126 } 127 } 128 129 internal static class EnumHelper { 130 //https://stackoverflow.com/a/21581418 131 public static T SetFlag<T>(this Enum value, T flag, bool set) { 132 var baseType = Enum.GetUnderlyingType(value.GetType()); 133 dynamic valueAsBase = Convert.ChangeType(value, baseType); 134 dynamic flagAsBase = Convert.ChangeType(flag, baseType); 135 if (set) 136 valueAsBase |= flagAsBase; 137 else 138 valueAsBase &= ~flagAsBase; 139 return (T)valueAsBase; 140 } 89 141 } 90 142 } -
branches/Async/HeuristicLab.Data.Views/3.3/HeuristicLab.Data.Views-3.3.csproj
r15280 r15281 105 105 </PropertyGroup> 106 106 <ItemGroup> 107 <Reference Include="Microsoft.CSharp" /> 107 108 <Reference Include="System" /> 108 109 <Reference Include="System.Core"> -
branches/Async/HeuristicLab.Data.Views/3.3/IntRangeView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/IntRangeView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Path Views/DirectoryValueView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Path Views/DirectoryValueView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Path Views/FileValueView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Path Views/FileValueView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Path Views/TextFileView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Path Views/TextFileView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/Plugin.cs.frame
r13321 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 29 29 /// Plugin class for HeuristicLab.Data.Views plugin. 30 30 /// </summary> 31 [Plugin("HeuristicLab.Data.Views", "3.3.1 3.$WCREV$")]31 [Plugin("HeuristicLab.Data.Views", "3.3.14.$WCREV$")] 32 32 [PluginFile("HeuristicLab.Data.Views-3.3.dll", PluginFileType.Assembly)] 33 33 [PluginDependency("HeuristicLab.Common", "3.3")] -
branches/Async/HeuristicLab.Data.Views/3.3/Properties/AssemblyInfo.cs.frame
r13321 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 5HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2016 HEAL")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] … … 54 54 // by using the '*' as shown below: 55 55 [assembly: AssemblyVersion("3.3.0.0")] 56 [assembly: AssemblyFileVersion("3.3.1 3.$WCREV$")]56 [assembly: AssemblyFileVersion("3.3.14.$WCREV$")] -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 65 65 // lengthTextBox 66 66 // 67 this.lengthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 68 67 this.lengthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 68 | System.Windows.Forms.AnchorStyles.Right))); 69 69 this.lengthTextBox.Location = new System.Drawing.Point(52, 0); 70 70 this.lengthTextBox.Name = "lengthTextBox"; … … 79 79 this.dataGridView.AllowUserToAddRows = false; 80 80 this.dataGridView.AllowUserToDeleteRows = false; 81 this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 82 | System.Windows.Forms.AnchorStyles.Left)83 84 this.dataGridView.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode. EnableWithoutHeaderText;81 this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 82 | System.Windows.Forms.AnchorStyles.Left) 83 | System.Windows.Forms.AnchorStyles.Right))); 84 this.dataGridView.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; 85 85 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 86 86 this.dataGridView.ColumnHeadersVisible = false; … … 101 101 // StringConvertibleArrayView 102 102 // 103 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);104 103 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 105 104 this.Controls.Add(this.dataGridView); -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs
r15280 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.ComponentModel; 24 25 using System.Drawing; 26 using System.Linq; 25 27 using System.Text; 26 28 using System.Windows.Forms; … … 199 201 } 200 202 203 var elementNames = Content.ElementNames.ToList(); 201 204 for (int i = minRowIndex; i <= maxRowIndex; i++) { 202 205 DataGridViewColumn column = dataGridView.Columns.GetFirstColumn(DataGridViewElementStates.Visible); 203 206 DataGridViewCell cell = dataGridView[column.Index, i]; 204 207 if (cell.Selected) { 208 if (i < elementNames.Count) { 209 s.Append(elementNames[i]); 210 s.Append("\t"); 211 } else if (elementNames.Count > 0) { 212 s.Append("Index " + i); 213 s.Append("\t"); 214 } 205 215 s.Append(Content.GetValue(i)); 206 216 s.Append(Environment.NewLine); … … 210 220 } 211 221 private void PasteValuesToDataGridView() { 212 string[] values = SplitClipboardString(Clipboard.GetText()); 222 Tuple<string, string>[] values = null; 223 try { 224 values = SplitClipboardString(Clipboard.GetText()).ToArray(); 225 } catch (ArgumentException ex) { 226 MessageBox.Show(this, ex.Message, "Error while parsing clipboard text.", MessageBoxButtons.OK, MessageBoxIcon.Error); 227 return; 228 } 213 229 int rowIndex = 0; 214 230 if (dataGridView.CurrentCell != null) … … 216 232 217 233 if (Content.Length < rowIndex + values.Length) Content.Length = rowIndex + values.Length; 218 for (int row = 0; row < values.Length; row++) 219 Content.SetValue(values[row], row + rowIndex); 220 } 221 private string[] SplitClipboardString(string clipboardText) { 234 for (int row = 0; row < values.Length; row++) { 235 Content.SetValue(values[row].Item2, row + rowIndex); 236 } 237 if (values.Any(x => !string.IsNullOrEmpty(x.Item1))) { 238 var elementNames = Content.ElementNames.ToList(); 239 for (int row = 0; row < values.Length; row++) { 240 if (row + rowIndex < elementNames.Count) 241 elementNames[row + rowIndex] = values[row].Item1; 242 else elementNames.Add(values[row].Item1); 243 } 244 Content.ElementNames = elementNames; 245 } 246 } 247 private IEnumerable<Tuple<string, string>> SplitClipboardString(string clipboardText) { 222 248 if (clipboardText.EndsWith(Environment.NewLine)) 223 249 clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length); //remove last newline constant 224 return clipboardText.Split(new string[] { Environment.NewLine, "\t" }, StringSplitOptions.None); 250 251 var lines = clipboardText.Split(new [] { Environment.NewLine }, StringSplitOptions.None); 252 var tabSep = new[] { '\t' }; 253 if (lines.Length > 2) { 254 // Case 1: Each line contains either "elementName \t value" or just "value" (one or two vertical vectors) 255 foreach (var l in lines) { 256 var row = l.Split(tabSep, StringSplitOptions.RemoveEmptyEntries); 257 if (row.Length > 2) throw new ArgumentException("Clipboard may have either at most two rows or at most two columns."); 258 if (row.Length == 2) yield return Tuple.Create(row[0], row[1]); 259 else if (row.Length == 1) yield return Tuple.Create(string.Empty, row[0]); 260 else yield return Tuple.Create(string.Empty, string.Empty); 261 } 262 } else if (lines.Length == 2) { 263 var firstLine = lines[0].Split(tabSep, StringSplitOptions.None); 264 var secondLine = lines[1].Split(tabSep, StringSplitOptions.None); 265 if (firstLine.Length <= 2 && secondLine.Length <= 2) { 266 // Case 2a: The two lines contain either "elementName \t value" or just "value" (one or two vertical vectors) 267 yield return firstLine.Length >= 2 ? Tuple.Create(firstLine[0], firstLine[1]) : Tuple.Create(string.Empty, firstLine[0]); 268 yield return secondLine.Length >= 2 ? Tuple.Create(secondLine[0], secondLine[1]) : Tuple.Create(string.Empty, secondLine[0]); 269 } else { 270 // Case 2b: The first line contains the elementNames, the second line contains the values (two horizontal vectors) 271 var max = Math.Max(firstLine.Length, secondLine.Length); 272 for (var i = 0; i < max; i++) { 273 var elemName = i < firstLine.Length ? firstLine[i] : string.Empty; 274 var value = i < secondLine.Length ? secondLine[i] : string.Empty; 275 yield return Tuple.Create(elemName, value); 276 } 277 } 278 } else if (lines.Length == 1) { 279 // Case 3: The line contains the values (one horizontal vector) 280 var entries = lines[0].Split(tabSep, StringSplitOptions.None); 281 foreach (var e in entries) { 282 yield return Tuple.Create(string.Empty, e); 283 } 284 } 225 285 } 226 286 #endregion -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixColumnVisibilityDialog.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixColumnVisibilityDialog.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixRowVisibilityDialog.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixRowVisibilityDialog.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r15280 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 131 131 virtualRowIndices = Enumerable.Range(0, Content.Rows).ToArray(); 132 132 133 if (Content.Columns == 0 && dataGridView.ColumnCount != Content.Columns && !Content.ReadOnly) 134 Content.Columns = dataGridView.ColumnCount; 135 else { 136 DataGridViewColumn[] columns = new DataGridViewColumn[Content.Columns]; 137 for (int i = 0; i < columns.Length; ++i) { 138 var column = new DataGridViewTextBoxColumn(); 139 column.FillWeight = 1; 140 columns[i] = column; 141 } 142 dataGridView.Columns.Clear(); 133 134 dataGridView.RowCount = 0; 135 136 DataGridViewColumn[] columns = new DataGridViewColumn[Content.Columns]; 137 for (int i = 0; i < columns.Length; ++i) { 138 var column = new DataGridViewTextBoxColumn(); 139 column.SortMode = DataGridViewColumnSortMode.Programmatic; 140 column.FillWeight = 1; 141 columns[i] = column; 142 } 143 dataGridView.Columns.Clear(); 144 145 if (Content.Columns != 0) { 143 146 dataGridView.Columns.AddRange(columns); 144 }145 146 //DataGridViews with rows but no columns are not allowed !147 if (Content.Rows == 0 && dataGridView.RowCount != Content.Rows && !Content.ReadOnly)148 Content.Rows = dataGridView.RowCount;149 else150 147 dataGridView.RowCount = Content.Rows; 151 148 } 152 149 153 150 ClearSorting(); … … 262 259 263 260 #region DataGridView Events 261 264 262 protected virtual void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { 265 if (!dataGridView.ReadOnly) { 266 string errorMessage; 267 if (Content != null && !Content.Validate(e.FormattedValue.ToString(), out errorMessage)) { 268 e.Cancel = true; 269 dataGridView.Rows[e.RowIndex].ErrorText = errorMessage; 270 } 271 } 272 } 263 if (dataGridView.ReadOnly) return; 264 if (Content == null) return; 265 if (Content.Rows <= e.RowIndex || Content.Columns <= e.ColumnIndex) return; 266 267 string errorMessage; 268 if (!Content.Validate(e.FormattedValue.ToString(), out errorMessage)) { 269 e.Cancel = true; 270 dataGridView.Rows[e.RowIndex].ErrorText = errorMessage; 271 } 272 } 273 273 274 protected virtual void dataGridView_CellParsing(object sender, DataGridViewCellParsingEventArgs e) { 274 275 if (!dataGridView.ReadOnly) { … … 440 441 } else 441 442 if (newSortOrder != SortOrder.None) 442 443 sortedColumnIndices.Add(new KeyValuePair<int, SortOrder>(columnIndex, newSortOrder)); 443 444 Sort(); 444 445 } -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixVisibilityDialog.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixVisibilityDialog.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleValueTupleView.Designer.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleValueTupleView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleValueView.Designer.cs
r15280 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/Async/HeuristicLab.Data.Views/3.3/StringConvertibleValueView.cs
r12012 r15281 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.