- Timestamp:
- 05/26/14 16:38:08 (11 years ago)
- Location:
- stable
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/branches/HLScript (added) merged: 10331-10332,10358 /trunk/sources merged: 10359,10391,10401,10506
- Property svn:mergeinfo changed
-
stable/HeuristicLab.HLScript.Views/3.3
-
Property
svn:global-ignores
set to
bin
obj
Plugin.cs
-
Property
svn:global-ignores
set to
-
stable/HeuristicLab.HLScript.Views/3.3/VariableStoreView.cs
r10358 r10891 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 using System.Drawing; 26 26 using System.Linq; 27 using System.Text.RegularExpressions; 27 28 using System.Windows.Forms; 28 29 using HeuristicLab.Collections; … … 36 37 using HeuristicLab.PluginInfrastructure; 37 38 38 namespace HeuristicLab. HLScript.Views {39 namespace HeuristicLab.Scripting.Views { 39 40 [View("ItemCollection View")] 40 41 [Content(typeof(VariableStore), true)] … … 114 115 removeButton.Enabled = !Locked && !ReadOnly && variableListView.SelectedItems.Count > 0; 115 116 variableListView.Enabled = true; 117 variableListView.LabelEdit = !Locked && !ReadOnly; 116 118 } 117 119 } … … 287 289 } 288 290 291 private readonly Regex SafeVariableNameRegex = new Regex("^[@]?[_a-zA-Z][_a-zA-Z0-9]*$"); 289 292 private void variableListView_AfterLabelEdit(object sender, LabelEditEventArgs e) { 290 if (!string.IsNullOrEmpty(e.Label)) { 293 string name = e.Label; 294 if (!string.IsNullOrEmpty(name) && SafeVariableNameRegex.IsMatch(name)) { 291 295 var variable = (KeyValuePair<string, object>)variableListView.Items[e.Item].Tag; 292 if (!Content.ContainsKey( e.Label)) {296 if (!Content.ContainsKey(name)) { 293 297 Content.Remove(variable.Key); 294 Content.Add( e.Label, variable.Value);298 Content.Add(name, variable.Value); 295 299 } 296 300 } … … 389 393 } 390 394 protected virtual void AdjustListViewColumnSizes() { 391 if (variableListView.Items.Count > 0) { 392 for (int i = 0; i < variableListView.Columns.Count; i++) 393 variableListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 394 } 395 foreach (ColumnHeader ch in variableListView.Columns) 396 ch.Width = -2; 395 397 } 396 398 protected virtual void RebuildImageList() {
Note: See TracChangeset
for help on using the changeset viewer.