Changeset 3829 for trunk/sources
- Timestamp:
- 05/18/10 02:03:24 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/CreateParameterDialog.Designer.cs
r3306 r3829 33 33 protected override void Dispose(bool disposing) { 34 34 if (disposing) { 35 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();36 35 if (components != null) components.Dispose(); 37 36 } … … 46 45 /// </summary> 47 46 private void InitializeComponent() { 48 this.components = new System.ComponentModel.Container();49 47 this.cancelButton = new System.Windows.Forms.Button(); 50 48 this.okButton = new System.Windows.Forms.Button(); … … 53 51 this.descriptionLabel = new System.Windows.Forms.Label(); 54 52 this.descriptionTextBox = new System.Windows.Forms.TextBox(); 55 this.dataTypeLabel = new System.Windows.Forms.Label();56 this.dataTypeTextBox = new System.Windows.Forms.TextBox();57 this.setDataTypeButton = new System.Windows.Forms.Button();58 53 this.parameterTypeSelector = new HeuristicLab.Core.Views.TypeSelector(); 59 this.toolTip = new System.Windows.Forms.ToolTip(this.components);60 54 this.SuspendLayout(); 61 55 // … … 64 58 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 65 59 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 66 this.cancelButton.Location = new System.Drawing.Point(455, 450);60 this.cancelButton.Location = new System.Drawing.Point(455, 527); 67 61 this.cancelButton.Name = "cancelButton"; 68 62 this.cancelButton.Size = new System.Drawing.Size(75, 23); 69 this.cancelButton.TabIndex = 9;63 this.cancelButton.TabIndex = 6; 70 64 this.cancelButton.Text = "&Cancel"; 71 65 this.cancelButton.UseVisualStyleBackColor = true; … … 76 70 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 77 71 this.okButton.Enabled = false; 78 this.okButton.Location = new System.Drawing.Point(374, 450);72 this.okButton.Location = new System.Drawing.Point(374, 527); 79 73 this.okButton.Name = "okButton"; 80 74 this.okButton.Size = new System.Drawing.Size(75, 23); 81 this.okButton.TabIndex = 8;75 this.okButton.TabIndex = 5; 82 76 this.okButton.Text = "&OK"; 83 77 this.okButton.UseVisualStyleBackColor = true; … … 87 81 this.nameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 88 82 this.nameLabel.AutoSize = true; 89 this.nameLabel.Location = new System.Drawing.Point(9, 289);83 this.nameLabel.Location = new System.Drawing.Point(9, 396); 90 84 this.nameLabel.Name = "nameLabel"; 91 85 this.nameLabel.Size = new System.Drawing.Size(38, 13); … … 97 91 this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 98 92 | System.Windows.Forms.AnchorStyles.Right))); 99 this.nameTextBox.Location = new System.Drawing.Point(78, 286);93 this.nameTextBox.Location = new System.Drawing.Point(78, 393); 100 94 this.nameTextBox.Name = "nameTextBox"; 101 95 this.nameTextBox.Size = new System.Drawing.Size(452, 20); … … 106 100 this.descriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 107 101 this.descriptionLabel.AutoSize = true; 108 this.descriptionLabel.Location = new System.Drawing.Point(9, 315);102 this.descriptionLabel.Location = new System.Drawing.Point(9, 422); 109 103 this.descriptionLabel.Name = "descriptionLabel"; 110 104 this.descriptionLabel.Size = new System.Drawing.Size(63, 13); … … 116 110 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 117 111 | System.Windows.Forms.AnchorStyles.Right))); 118 this.descriptionTextBox.Location = new System.Drawing.Point(78, 312);112 this.descriptionTextBox.Location = new System.Drawing.Point(78, 419); 119 113 this.descriptionTextBox.Multiline = true; 120 114 this.descriptionTextBox.Name = "descriptionTextBox"; … … 122 116 this.descriptionTextBox.Size = new System.Drawing.Size(452, 102); 123 117 this.descriptionTextBox.TabIndex = 4; 124 //125 // dataTypeLabel126 //127 this.dataTypeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));128 this.dataTypeLabel.AutoSize = true;129 this.dataTypeLabel.Location = new System.Drawing.Point(12, 425);130 this.dataTypeLabel.Name = "dataTypeLabel";131 this.dataTypeLabel.Size = new System.Drawing.Size(60, 13);132 this.dataTypeLabel.TabIndex = 5;133 this.dataTypeLabel.Text = "Data &Type:";134 //135 // dataTypeTextBox136 //137 this.dataTypeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)138 | System.Windows.Forms.AnchorStyles.Right)));139 this.dataTypeTextBox.Enabled = false;140 this.dataTypeTextBox.Location = new System.Drawing.Point(78, 422);141 this.dataTypeTextBox.Name = "dataTypeTextBox";142 this.dataTypeTextBox.ReadOnly = true;143 this.dataTypeTextBox.Size = new System.Drawing.Size(422, 20);144 this.dataTypeTextBox.TabIndex = 6;145 //146 // setDataTypeButton147 //148 this.setDataTypeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));149 this.setDataTypeButton.Enabled = false;150 this.setDataTypeButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Edit;151 this.setDataTypeButton.Location = new System.Drawing.Point(506, 420);152 this.setDataTypeButton.Name = "setDataTypeButton";153 this.setDataTypeButton.Size = new System.Drawing.Size(24, 24);154 this.setDataTypeButton.TabIndex = 7;155 this.toolTip.SetToolTip(this.setDataTypeButton, "Set Data Type");156 this.setDataTypeButton.UseVisualStyleBackColor = true;157 this.setDataTypeButton.Click += new System.EventHandler(this.setDataTypeButton_Click);158 118 // 159 119 // parameterTypeSelector … … 165 125 this.parameterTypeSelector.Location = new System.Drawing.Point(12, 12); 166 126 this.parameterTypeSelector.Name = "parameterTypeSelector"; 167 this.parameterTypeSelector.Size = new System.Drawing.Size(518, 268);127 this.parameterTypeSelector.Size = new System.Drawing.Size(518, 375); 168 128 this.parameterTypeSelector.TabIndex = 0; 169 129 this.parameterTypeSelector.SelectedTypeChanged += new System.EventHandler(this.parameterTypeSelector_SelectedTypeChanged); … … 175 135 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 176 136 this.CancelButton = this.cancelButton; 177 this.ClientSize = new System.Drawing.Size(542, 485); 178 this.Controls.Add(this.setDataTypeButton); 137 this.ClientSize = new System.Drawing.Size(542, 562); 179 138 this.Controls.Add(this.parameterTypeSelector); 180 139 this.Controls.Add(this.descriptionTextBox); 181 this.Controls.Add(this.dataTypeTextBox);182 140 this.Controls.Add(this.nameTextBox); 183 this.Controls.Add(this.dataTypeLabel);184 141 this.Controls.Add(this.descriptionLabel); 185 142 this.Controls.Add(this.nameLabel); … … 207 164 protected System.Windows.Forms.TextBox descriptionTextBox; 208 165 protected TypeSelector parameterTypeSelector; 209 protected System.Windows.Forms.Label dataTypeLabel;210 protected System.Windows.Forms.TextBox dataTypeTextBox;211 protected System.Windows.Forms.Button setDataTypeButton;212 protected System.Windows.Forms.ToolTip toolTip;213 166 } 214 167 } -
trunk/sources/HeuristicLab.Core.Views/3.3/CreateParameterDialog.cs
r3758 r3829 26 26 namespace HeuristicLab.Core.Views { 27 27 public partial class CreateParameterDialog : Form { 28 protected TypeSelectorDialog typeSelectorDialog;29 30 28 public TypeSelector ParameterTypeSelector { 31 29 get { return parameterTypeSelector; } … … 34 32 get { 35 33 try { 36 Type type = parameterTypeSelector.SelectedType; 37 if (type.ContainsGenericParameters) { 38 type = type.MakeGenericType((Type)dataTypeTextBox.Tag); 39 } 40 return (IParameter)Activator.CreateInstance(type, nameTextBox.Text, descriptionTextBox.Text); 34 return (IParameter)Activator.CreateInstance(parameterTypeSelector.SelectedType, nameTextBox.Text, descriptionTextBox.Text); 41 35 } 42 36 catch (Exception ex) { … … 55 49 } 56 50 57 protected virtual void setDataTypeButton_Click(object sender, EventArgs e) {58 if (typeSelectorDialog == null) {59 typeSelectorDialog = new TypeSelectorDialog();60 typeSelectorDialog.Caption = "Select Data Type";61 typeSelectorDialog.TypeSelector.Configure(typeof(IItem), true, true);62 }63 64 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {65 dataTypeTextBox.Text = typeSelectorDialog.TypeSelector.SelectedType.FullName;66 dataTypeTextBox.Tag = typeSelectorDialog.TypeSelector.SelectedType;67 }68 okButton.Enabled = dataTypeTextBox.Tag != null;69 }70 71 51 protected virtual void parameterTypeSelector_SelectedTypeChanged(object sender, EventArgs e) { 72 dataTypeTextBox.Text = "-"; 73 dataTypeTextBox.Tag = null; 74 dataTypeTextBox.Enabled = false; 75 setDataTypeButton.Enabled = false; 76 okButton.Enabled = false; 77 78 if (parameterTypeSelector.SelectedType != null) { 79 if (parameterTypeSelector.SelectedType.ContainsGenericParameters) { 80 dataTypeTextBox.Enabled = true; 81 setDataTypeButton.Enabled = true; 82 } else { 83 okButton.Enabled = true; 84 } 85 } 52 okButton.Enabled = (parameterTypeSelector.SelectedType != null) && !parameterTypeSelector.SelectedType.ContainsGenericParameters; 86 53 } 87 54 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs
r3775 r3829 205 205 (Content != null) && !Content.IsReadOnly && !ReadOnly; 206 206 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly; 207 AdjustListViewColumnSizes(); 207 208 208 209 if (itemsListView.SelectedItems.Count == 1) { … … 391 392 UpdateListViewItemText(listViewItem); 392 393 } 393 AdjustListViewColumnSizes();394 394 } 395 395 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r3764 r3829 163 163 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 164 164 removeButton.Enabled = (Content != null) && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0; 165 AdjustListViewColumnSizes(); 165 166 if (itemsListView.SelectedItems.Count == 1) { 166 167 T item = (T)itemsListView.SelectedItems[0].Tag; … … 300 301 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) 301 302 UpdateListViewItemText(listViewItem); 302 AdjustListViewColumnSizes();303 303 } 304 304 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
r3775 r3829 199 199 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && 200 200 (Content != null) && !Content.IsReadOnly && !ReadOnly; 201 AdjustListViewColumnSizes(); 201 202 202 203 if (itemsListView.SelectedItems.Count == 1) { … … 392 393 UpdateListViewItemText(listViewItem); 393 394 } 394 AdjustListViewColumnSizes();395 395 } 396 396 } -
trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs
r3588 r3829 123 123 else if (type.ContainsGenericParameters) typeNode.ImageIndex = 3; 124 124 else if (imageList.Images.ContainsKey(type.FullName)) typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName); 125 else if (typeof(IItem).IsAssignableFrom(type) ) {125 else if (typeof(IItem).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract) { 126 126 try { 127 127 IItem item = (IItem)Activator.CreateInstance(type); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs
r3797 r3829 146 146 this.itemsListView.View = System.Windows.Forms.View.Details; 147 147 this.itemsListView.SelectedIndexChanged += new System.EventHandler(this.itemsListView_SelectedIndexChanged); 148 this.itemsListView.SizeChanged += new System.EventHandler(this.itemsListView_SizeChanged);149 148 this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick); 150 149 this.itemsListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragDrop); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r3796 r3829 161 161 ((IRun)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged); 162 162 ((IRun)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged); 163 AdjustListViewColumnSizes(); 163 164 } 164 165 protected virtual void RemoveListViewItem(ListViewItem listViewItem) { … … 190 191 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 191 192 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly; 193 AdjustListViewColumnSizes(); 192 194 if (itemsListView.SelectedItems.Count == 1) { 193 195 IRun item = (IRun)itemsListView.SelectedItems[0].Tag; … … 198 200 detailsGroupBox.Enabled = false; 199 201 } 200 }201 protected virtual void itemsListView_SizeChanged(object sender, EventArgs e) {202 if (itemsListView.Columns.Count > 0)203 itemsListView.Columns[0].Width = Math.Max(0, itemsListView.Width - 25);204 202 } 205 203 protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) { … … 346 344 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) 347 345 UpdateListViewItemText(listViewItem); 346 AdjustListViewColumnSizes(); 348 347 } 349 348 } … … 370 369 #endregion 371 370 371 #region Helpers 372 protected virtual void AdjustListViewColumnSizes() { 373 if (itemsListView.Items.Count > 0) { 374 for (int i = 0; i < itemsListView.Columns.Count; i++) { 375 itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 376 } 377 } 378 } 379 #endregion 372 380 } 373 381 }
Note: See TracChangeset
for help on using the changeset viewer.