- Timestamp:
- 01/28/10 05:19:03 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r2676 r2694 178 178 if ((!ItemCollection.IsReadOnly) && (type != null) && (typeof(T).IsAssignableFrom(type))) { 179 179 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 180 else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Move; // ALT key 181 else e.Effect = DragDropEffects.Link; 180 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 181 else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link; 182 else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy; 183 else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move; 182 184 } 183 185 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
r2676 r2694 209 209 if ((!ItemList.IsReadOnly) && (type != null) && (typeof(T).IsAssignableFrom(type))) { 210 210 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 211 else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Move; // ALT key 212 else e.Effect = DragDropEffects.Link; 211 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 212 else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link; 213 else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy; 214 else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move; 213 215 } 214 216 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemParameterView.cs
r2676 r2694 142 142 if ((type != null) && (Parameter.DataType.IsAssignableFrom(type))) { 143 143 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 144 else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Move; // ALT key 145 else e.Effect = DragDropEffects.Link; 144 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 145 else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link; 146 else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy; 147 else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move; 146 148 } 147 149 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorTreeView.cs
r2676 r2694 101 101 if (!operatorParameterNodeTable.ContainsKey(operatorParameter)) { 102 102 operatorParameterNodeTable.Add(operatorParameter, new List<TreeNode>()); 103 operatorParameter.ActualNameChanged += new EventHandler(operatorParameter_ActualNameChanged);104 103 operatorParameter.ValueChanged += new EventHandler(operatorParameter_ValueChanged); 105 104 } … … 108 107 IOperator op = operatorParameter.Value; 109 108 if (op == null) 110 node.Text += operatorParameter.ActualName;109 node.Text += "-"; 111 110 else 112 111 FillTreeNode(node, op); … … 172 171 operatorParameterNodeTable[opParam].Remove(node); 173 172 if (operatorParameterNodeTable[opParam].Count == 0) { 174 opParam.ActualNameChanged -= new EventHandler(operatorParameter_ActualNameChanged);175 173 opParam.ValueChanged -= new EventHandler(operatorParameter_ValueChanged); 176 174 operatorParameterNodeTable.Remove(opParam); … … 201 199 202 200 #region Parameter and Operator Events 203 private void operatorParameter_ActualNameChanged(object sender, EventArgs e) {204 if (InvokeRequired)205 Invoke(new EventHandler(operatorParameter_ActualNameChanged), sender, e);206 else {207 IOperatorParameter opParam = (IOperatorParameter)sender;208 if (opParam.Value == null) {209 foreach (TreeNode node in operatorParameterNodeTable[opParam])210 node.Text = opParam.Name + ": " + opParam.ActualName;211 }212 }213 }214 201 private void operatorParameter_ValueChanged(object sender, EventArgs e) { 215 202 if (InvokeRequired) … … 222 209 node.Text = opParam.Name + ": "; 223 210 if (opParam.Value == null) 224 node.Text += opParam.ActualName;211 node.Text += "-"; 225 212 else 226 213 FillTreeNode(node, opParam.Value); … … 355 342 if ((type != null) && (typeof(IOperator).IsAssignableFrom(type))) { 356 343 TreeNode node = graphTreeView.GetNodeAt(graphTreeView.PointToClient(new Point(e.X, e.Y))); 344 if ((node != null) && !node.IsExpanded) node.Expand(); 357 345 if ((node != null) && (GetOperatorParameterTag(node) != null)) { 358 346 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 359 else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Move; // ALT key 360 else e.Effect = DragDropEffects.Link; 347 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 348 else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link; 349 else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy; 350 else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move; 361 351 } 362 352 } -
trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs
r2676 r2694 202 202 data.SetData("Type", type); 203 203 data.SetData("Value", o); 204 DoDragDrop(data, DragDropEffects. Link);204 DoDragDrop(data, DragDropEffects.Copy); 205 205 } catch (Exception) { 206 206 } -
trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs
r2687 r2694 133 133 if ((type != null) && (typeof(IItem).IsAssignableFrom(type))) { 134 134 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 135 else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Move; // ALT key 136 else e.Effect = DragDropEffects.Link; 135 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 136 else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link; 137 else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy; 138 else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move; 137 139 } 138 140 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.Designer.cs
r2687 r2694 50 50 this.viewsLabel = new System.Windows.Forms.Label(); 51 51 this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 52 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 52 53 this.SuspendLayout(); 53 54 // … … 60 61 this.viewPanel.Name = "viewPanel"; 61 62 this.viewPanel.Size = new System.Drawing.Size(205, 184); 62 this.viewPanel.TabIndex = 2;63 this.viewPanel.TabIndex = 1; 63 64 // 64 65 // messageLabel … … 68 69 this.messageLabel.Name = "messageLabel"; 69 70 this.messageLabel.Size = new System.Drawing.Size(227, 184); 70 this.messageLabel.TabIndex = 0;71 this.messageLabel.TabIndex = 2; 71 72 this.messageLabel.Text = "No view available."; 72 73 this.messageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; … … 81 82 this.viewsLabel.Size = new System.Drawing.Size(16, 16); 82 83 this.viewsLabel.TabIndex = 0; 84 this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view.\r\nRight-click to change cur" + 85 "rent view."); 86 this.viewsLabel.DoubleClick += new System.EventHandler(this.viewsLabel_DoubleClick); 83 87 // 84 88 // contextMenuStrip … … 109 113 protected System.Windows.Forms.Label messageLabel; 110 114 protected System.Windows.Forms.ContextMenuStrip contextMenuStrip; 115 protected System.Windows.Forms.ToolTip toolTip; 111 116 112 117 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.cs
r2687 r2694 97 97 } 98 98 99 private void viewsLabel_DoubleClick(object sender, EventArgs e) { 100 MainFormManager.MainForm.ShowView(MainFormManager.CreateView(viewPanel.Tag.GetType(), Object)); 101 } 99 102 protected void contextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { 100 103 Type viewType = (Type)e.ClickedItem.Tag; -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleDataView.cs
r2676 r2694 89 89 } 90 90 private void valueTextBox_Validating(object sender, CancelEventArgs e) { 91 if (!StringConvertibleData.Validate(valueTextBox.Text)) { 91 string errorMessage; 92 if (!StringConvertibleData.Validate(valueTextBox.Text, out errorMessage)) { 92 93 e.Cancel = true; 93 errorProvider.SetError(valueTextBox, "Invalid Value");94 errorProvider.SetError(valueTextBox, errorMessage); 94 95 valueTextBox.SelectAll(); 95 96 } -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixDataView.cs
r2677 r2694 127 127 if (!int.TryParse(rowsTextBox.Text, out i) || (i < 0)) { 128 128 e.Cancel = true; 129 errorProvider.SetError(rowsTextBox, "Invalid Number of Rows ");129 errorProvider.SetError(rowsTextBox, "Invalid Number of Rows (Valid Values: Positive Integers Larger or Equal to 0)"); 130 130 rowsTextBox.SelectAll(); 131 131 } … … 147 147 if (!int.TryParse(columnsTextBox.Text, out i) || (i < 0)) { 148 148 e.Cancel = true; 149 errorProvider.SetError(columnsTextBox, "Invalid Number of Columns ");149 errorProvider.SetError(columnsTextBox, "Invalid Number of Columns (Valid Values: Positive Integers Larger or Equal to 0)"); 150 150 columnsTextBox.SelectAll(); 151 151 } … … 167 167 #region DataGridView Events 168 168 private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { 169 if (!StringConvertibleMatrixData.Validate(e.FormattedValue.ToString())) { 169 string errorMessage; 170 if (!StringConvertibleMatrixData.Validate(e.FormattedValue.ToString(), out errorMessage)) { 170 171 e.Cancel = true; 171 dataGridView.Rows[e.RowIndex].ErrorText = "Invalid Value";172 dataGridView.Rows[e.RowIndex].ErrorText = errorMessage; 172 173 } 173 174 } -
trunk/sources/HeuristicLab.Data/3.3/BoolArrayData.cs
r2677 r2694 57 57 } 58 58 59 bool IStringConvertibleMatrixData.Validate(string value) { 60 int i; 61 return int.TryParse(value, out i); 59 bool IStringConvertibleMatrixData.Validate(string value, out string errorMessage) { 60 bool val; 61 bool valid = bool.TryParse(value, out val); 62 errorMessage = string.Empty; 63 if (!valid) { 64 StringBuilder sb = new StringBuilder(); 65 sb.Append("Invalid Value (Valid Value Format: \""); 66 sb.Append(FormatPatterns.GetBoolFormatPattern()); 67 sb.Append("\")"); 68 errorMessage = sb.ToString(); 69 } 70 return valid; 62 71 } 63 72 string IStringConvertibleMatrixData.GetValue(int rowIndex, int columIndex) { … … 65 74 } 66 75 bool IStringConvertibleMatrixData.SetValue(string value, int rowIndex, int columnIndex) { 67 bool b;68 if (bool.TryParse(value, out b)) {69 this[rowIndex] = b;76 bool val; 77 if (bool.TryParse(value, out val)) { 78 this[rowIndex] = val; 70 79 return true; 71 80 } else { -
trunk/sources/HeuristicLab.Data/3.3/BoolData.cs
r2684 r2694 42 42 43 43 #region IStringConvertibleData Members 44 bool IStringConvertibleData.Validate(string value) { 45 bool b; 46 return bool.TryParse(value, out b); 44 bool IStringConvertibleData.Validate(string value, out string errorMessage) { 45 bool val; 46 bool valid = bool.TryParse(value, out val); 47 errorMessage = string.Empty; 48 if (!valid) { 49 StringBuilder sb = new StringBuilder(); 50 sb.Append("Invalid Value (Valid Value Format: \""); 51 sb.Append(FormatPatterns.GetBoolFormatPattern()); 52 sb.Append("\")"); 53 errorMessage = sb.ToString(); 54 } 55 return valid; 47 56 } 48 57 string IStringConvertibleData.GetValue() { … … 50 59 } 51 60 bool IStringConvertibleData.SetValue(string value) { 52 bool b;53 if (bool.TryParse(value, out b)) {54 Value = b;61 bool val; 62 if (bool.TryParse(value, out val)) { 63 Value = val; 55 64 return true; 56 65 } else { -
trunk/sources/HeuristicLab.Data/3.3/DateTimeData.cs
r2684 r2694 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Globalization; 24 25 using System.Text; 25 26 using System.Xml; … … 46 47 47 48 #region IStringConvertibleData Members 48 bool IStringConvertibleData.Validate(string value) { 49 DateTime d; 50 return DateTime.TryParse(value, out d); 49 bool IStringConvertibleData.Validate(string value, out string errorMessage) { 50 DateTime val; 51 bool valid = DateTime.TryParse(value, out val); 52 errorMessage = valid ? string.Empty : "Invalid Value (values must be formatted according to the current culture settings)"; 53 return valid; 51 54 } 52 55 string IStringConvertibleData.GetValue() { … … 54 57 } 55 58 bool IStringConvertibleData.SetValue(string value) { 56 DateTime d;57 if (DateTime.TryParse(value, out d)) {58 Value = d;59 DateTime val; 60 if (DateTime.TryParse(value, out val)) { 61 Value = val; 59 62 return true; 60 63 } else { -
trunk/sources/HeuristicLab.Data/3.3/DoubleData.cs
r2684 r2694 46 46 47 47 #region IStringConvertibleData Members 48 bool IStringConvertibleData.Validate(string value) { 49 double d; 50 return double.TryParse(value, out d); 48 bool IStringConvertibleData.Validate(string value, out string errorMessage) { 49 double val; 50 bool valid = double.TryParse(value, out val); 51 errorMessage = string.Empty; 52 if (!valid) { 53 StringBuilder sb = new StringBuilder(); 54 sb.Append("Invalid Value (Valid Value Format: \""); 55 sb.Append(FormatPatterns.GetDoubleFormatPattern()); 56 sb.Append("\")"); 57 errorMessage = sb.ToString(); 58 } 59 return valid; 51 60 } 52 61 string IStringConvertibleData.GetValue() { … … 54 63 } 55 64 bool IStringConvertibleData.SetValue(string value) { 56 double d;57 if (double.TryParse(value, out d)) {58 Value = d;65 double val; 66 if (double.TryParse(value, out val)) { 67 Value = val; 59 68 return true; 60 69 } else { -
trunk/sources/HeuristicLab.Data/3.3/HeuristicLab.Data-3.3.csproj
r2677 r2694 104 104 </Compile> 105 105 <Compile Include="BoolArrayData.cs" /> 106 <Compile Include="BoolMatrixData.cs" /> 107 <Compile Include="StringMatrixData.cs" /> 108 <Compile Include="StringArrayData.cs" /> 109 <Compile Include="FormatPatterns.cs" /> 110 <Compile Include="DoubleArrayData.cs" /> 111 <Compile Include="DoubleMatrixData.cs" /> 106 112 <Compile Include="IntMatrixData.cs" /> 107 113 <Compile Include="ValueTypeMatrixData.cs" /> -
trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleData.cs
r2676 r2694 28 28 namespace HeuristicLab.Data { 29 29 public interface IStringConvertibleData { 30 bool Validate(string value );30 bool Validate(string value, out string errorMessage); 31 31 string GetValue(); 32 32 bool SetValue(string value); -
trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleMatrixData.cs
r2677 r2694 33 33 int Columns { get; set; } 34 34 35 bool Validate(string value );35 bool Validate(string value, out string errorMessage); 36 36 string GetValue(int rowIndex, int columnIndex); 37 37 bool SetValue(string value, int rowIndex, int columnIndex); -
trunk/sources/HeuristicLab.Data/3.3/IntArrayData.cs
r2677 r2694 57 57 } 58 58 59 bool IStringConvertibleMatrixData.Validate(string value) { 60 int i; 61 return int.TryParse(value, out i); 59 bool IStringConvertibleMatrixData.Validate(string value, out string errorMessage) { 60 int val; 61 bool valid = int.TryParse(value, out val); 62 errorMessage = string.Empty; 63 if (!valid) { 64 StringBuilder sb = new StringBuilder(); 65 sb.Append("Invalid Value (Valid Value Format: \""); 66 sb.Append(FormatPatterns.GetIntFormatPattern()); 67 sb.Append("\")"); 68 errorMessage = sb.ToString(); 69 } 70 return valid; 62 71 } 63 72 string IStringConvertibleMatrixData.GetValue(int rowIndex, int columIndex) { … … 65 74 } 66 75 bool IStringConvertibleMatrixData.SetValue(string value, int rowIndex, int columnIndex) { 67 int i;68 if (int.TryParse(value, out i)) {69 this[rowIndex] = i;76 int val; 77 if (int.TryParse(value, out val)) { 78 this[rowIndex] = val; 70 79 return true; 71 80 } else { -
trunk/sources/HeuristicLab.Data/3.3/IntData.cs
r2684 r2694 42 42 43 43 #region IStringConvertibleData Members 44 bool IStringConvertibleData.Validate(string value) { 45 int i; 46 return int.TryParse(value, out i); 44 bool IStringConvertibleData.Validate(string value, out string errorMessage) { 45 int val; 46 bool valid = int.TryParse(value, out val); 47 errorMessage = string.Empty; 48 if (!valid) { 49 StringBuilder sb = new StringBuilder(); 50 sb.Append("Invalid Value (Valid Value Format: \""); 51 sb.Append(FormatPatterns.GetIntFormatPattern()); 52 sb.Append("\")"); 53 errorMessage = sb.ToString(); 54 } 55 return valid; 47 56 } 48 57 string IStringConvertibleData.GetValue() { … … 50 59 } 51 60 bool IStringConvertibleData.SetValue(string value) { 52 int i;53 if (int.TryParse(value, out i)) {54 Value = i;61 int val; 62 if (int.TryParse(value, out val)) { 63 Value = val; 55 64 return true; 56 65 } else { -
trunk/sources/HeuristicLab.Data/3.3/IntMatrixData.cs
r2677 r2694 57 57 } 58 58 59 bool IStringConvertibleMatrixData.Validate(string value) { 60 int i; 61 return int.TryParse(value, out i); 59 bool IStringConvertibleMatrixData.Validate(string value, out string errorMessage) { 60 int val; 61 bool valid = int.TryParse(value, out val); 62 errorMessage = string.Empty; 63 if (!valid) { 64 StringBuilder sb = new StringBuilder(); 65 sb.Append("Invalid Value (Valid Value Format: \""); 66 sb.Append(FormatPatterns.GetIntFormatPattern()); 67 sb.Append("\")"); 68 errorMessage = sb.ToString(); 69 } 70 return valid; 62 71 } 63 72 string IStringConvertibleMatrixData.GetValue(int rowIndex, int columIndex) { … … 65 74 } 66 75 bool IStringConvertibleMatrixData.SetValue(string value, int rowIndex, int columnIndex) { 67 int i;68 if (int.TryParse(value, out i)) {69 this[rowIndex, columnIndex] = i;76 int val; 77 if (int.TryParse(value, out val)) { 78 this[rowIndex, columnIndex] = val; 70 79 return true; 71 80 } else { -
trunk/sources/HeuristicLab.Data/3.3/StringData.cs
r2684 r2694 64 64 65 65 #region IStringConvertibleData Members 66 bool IStringConvertibleData.Validate(string value) { 67 return true; 66 bool IStringConvertibleData.Validate(string value, out string errorMessage) { 67 if (value == null) { 68 errorMessage = "Invalid Value (string must not be null)"; 69 return false; 70 } else { 71 errorMessage = string.Empty; 72 return true; 73 } 68 74 } 69 75 string IStringConvertibleData.GetValue() { … … 71 77 } 72 78 bool IStringConvertibleData.SetValue(string value) { 73 Value = value != null ? value : string.Empty; 74 return true; 79 if (value != null) { 80 Value = value; 81 return true; 82 } else { 83 return false; 84 } 75 85 } 76 86 #endregion -
trunk/sources/HeuristicLab.Data/3.3/TimeSpanData.cs
r2684 r2694 42 42 43 43 #region IStringConvertibleData Members 44 bool IStringConvertibleData.Validate(string value) { 45 TimeSpan t; 46 return TimeSpan.TryParse(value, out t); 44 bool IStringConvertibleData.Validate(string value, out string errorMessage) { 45 TimeSpan val; 46 bool valid = TimeSpan.TryParse(value, out val); 47 errorMessage = string.Empty; 48 if (!valid) { 49 StringBuilder sb = new StringBuilder(); 50 sb.Append("Invalid Value (Valid Value Format: \""); 51 sb.Append(FormatPatterns.GetTimeSpanFormatPattern()); 52 sb.Append("\")"); 53 errorMessage = sb.ToString(); 54 } 55 return valid; 47 56 } 48 57 string IStringConvertibleData.GetValue() { … … 50 59 } 51 60 bool IStringConvertibleData.SetValue(string value) { 52 TimeSpan t;53 if (TimeSpan.TryParse(value, out t)) {54 Value = t;61 TimeSpan val; 62 if (TimeSpan.TryParse(value, out val)) { 63 Value = val; 55 64 return true; 56 65 } else { -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeArrayData.cs
r2677 r2694 32 32 [Item("ValueTypeArrayData<T>", "A base class for representing arrays of value types.")] 33 33 public class ValueTypeArrayData<T> : Item, IEnumerable where T : struct { 34 [Storable] 34 35 private T[] array; 35 36 -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeData.cs
r2669 r2694 31 31 public class ValueTypeData<T> : Item where T : struct { 32 32 [Storable] 33 pr otectedT value;33 private T value; 34 34 public T Value { 35 35 get { return value; } -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeMatrixData.cs
r2677 r2694 32 32 [Item("ValueTypeMatrixData<T>", "A base class for representing matrices of value types.")] 33 33 public class ValueTypeMatrixData<T> : Item, IEnumerable where T : struct { 34 [Storable] 34 35 private T[,] array; 35 36
Note: See TracChangeset
for help on using the changeset viewer.