Changeset 3433
- Timestamp:
- 04/20/10 04:24:19 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs
r3432 r3433 48 48 } 49 49 50 public override bool ReadOnly { 51 get { 52 if ((Content != null) && Content.IsReadOnly) return true; 53 else return base.ReadOnly; 54 } 55 set { base.ReadOnly = value; } 56 } 57 50 58 public ListView ItemsListView { 51 59 get { return itemsListView; } … … 114 122 } else { 115 123 addButton.Enabled = itemsListView.SelectedItems.Count > 0 && 116 ! Content.IsReadOnly && !ReadOnly;124 !ReadOnly; 117 125 moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 && 118 126 itemsListView.SelectedIndices[0] != 0 && 119 ! Content.IsReadOnly && !ReadOnly;127 !ReadOnly; 120 128 moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 && 121 129 itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 && 122 ! Content.IsReadOnly && !ReadOnly;130 !ReadOnly; 123 131 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && 124 ! Content.IsReadOnly && !ReadOnly;132 !ReadOnly; 125 133 itemsListView.Enabled = true; 126 134 detailsGroupBox.Enabled = true; … … 197 205 #region ListView Events 198 206 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 199 addButton.Enabled = itemsListView.SelectedItems.Count > 0 && ! Content.IsReadOnly && !ReadOnly;207 addButton.Enabled = itemsListView.SelectedItems.Count > 0 && !ReadOnly; 200 208 moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 && 201 209 itemsListView.SelectedIndices[0] != 0 && 202 ! Content.IsReadOnly && !ReadOnly;210 !ReadOnly; 203 211 moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 && 204 212 itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 && 205 ! Content.IsReadOnly && !ReadOnly;206 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && ! Content.IsReadOnly && !ReadOnly;213 !ReadOnly; 214 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !ReadOnly; 207 215 208 216 if (itemsListView.SelectedItems.Count == 1) { … … 219 227 protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) { 220 228 if (e.KeyCode == Keys.Delete) { 221 if ((itemsListView.SelectedItems.Count > 0) && ! Content.IsReadOnly && !ReadOnly) {229 if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly) { 222 230 foreach (ListViewItem item in itemsListView.SelectedItems) 223 231 Content[item.Index] = null; … … 248 256 data.SetData("Type", item.GetType()); 249 257 data.SetData("Value", item); 250 if ( Content.IsReadOnly ||ReadOnly) {258 if (ReadOnly) { 251 259 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 252 260 } else { … … 261 269 e.Effect = DragDropEffects.None; 262 270 Type type = e.Data.GetData("Type") as Type; 263 if (! Content.IsReadOnly && !ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) {271 if (!ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) { 264 272 Point p = itemsListView.PointToClient(new Point(e.X, e.Y)); 265 273 ListViewItem listViewItem = itemsListView.GetItemAt(p.X, p.Y); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r3432 r3433 40 40 } 41 41 42 public override bool ReadOnly { 43 get { 44 if ((Content != null) && Content.IsReadOnly) return true; 45 else return base.ReadOnly; 46 } 47 set { base.ReadOnly = value; } 48 } 49 42 50 public ListView ItemsListView { 43 51 get { return itemsListView; } … … 94 102 detailsGroupBox.Enabled = false; 95 103 } else { 96 addButton.Enabled = ! Content.IsReadOnly && !ReadOnly;104 addButton.Enabled = !ReadOnly; 97 105 sortAscendingButton.Enabled = itemsListView.Items.Count > 1; 98 106 sortDescendingButton.Enabled = itemsListView.Items.Count > 1; 99 removeButton.Enabled = ! Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;107 removeButton.Enabled = !ReadOnly && itemsListView.SelectedItems.Count > 0; 100 108 itemsListView.Enabled = true; 101 109 detailsGroupBox.Enabled = true; … … 168 176 #region ListView Events 169 177 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 170 removeButton.Enabled = ! Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;178 removeButton.Enabled = !ReadOnly && itemsListView.SelectedItems.Count > 0; 171 179 if (itemsListView.SelectedItems.Count == 1) { 172 180 T item = (T)itemsListView.SelectedItems[0].Tag; … … 181 189 protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) { 182 190 if (e.KeyCode == Keys.Delete) { 183 if ((itemsListView.SelectedItems.Count > 0) && ! Content.IsReadOnly && !ReadOnly) {191 if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly) { 184 192 foreach (ListViewItem item in itemsListView.SelectedItems) 185 193 Content.Remove((T)item.Tag); … … 205 213 data.SetData("Type", item.GetType()); 206 214 data.SetData("Value", item); 207 if ( Content.IsReadOnly ||ReadOnly) {215 if (ReadOnly) { 208 216 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 209 217 } else { … … 217 225 e.Effect = DragDropEffects.None; 218 226 Type type = e.Data.GetData("Type") as Type; 219 if (! Content.IsReadOnly && !ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) {227 if (!ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) { 220 228 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 221 229 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
r3432 r3433 48 48 } 49 49 50 public override bool ReadOnly { 51 get { 52 if ((Content != null) && Content.IsReadOnly) return true; 53 else return base.ReadOnly; 54 } 55 set { base.ReadOnly = value; } 56 } 57 50 58 public ListView ItemsListView { 51 59 get { return itemsListView; } … … 117 125 detailsGroupBox.Enabled = false; 118 126 } else { 119 addButton.Enabled = ! Content.IsReadOnly && !ReadOnly;127 addButton.Enabled = !ReadOnly; 120 128 moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 && 121 129 itemsListView.SelectedIndices[0] != 0 && 122 ! Content.IsReadOnly && !ReadOnly;130 !ReadOnly; 123 131 moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 && 124 132 itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 && 125 ! Content.IsReadOnly && !ReadOnly;133 !ReadOnly; 126 134 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && 127 ! Content.IsReadOnly && !ReadOnly;135 !ReadOnly; 128 136 itemsListView.Enabled = true; 129 137 detailsGroupBox.Enabled = true; … … 194 202 moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 && 195 203 itemsListView.SelectedIndices[0] != 0 && 196 ! Content.IsReadOnly && !ReadOnly;204 !ReadOnly; 197 205 moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 && 198 206 itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 && 199 ! Content.IsReadOnly && !ReadOnly;207 !ReadOnly; 200 208 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && 201 ! Content.IsReadOnly && !ReadOnly;209 !ReadOnly; 202 210 203 211 if (itemsListView.SelectedItems.Count == 1) { … … 214 222 protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) { 215 223 if (e.KeyCode == Keys.Delete) { 216 if ((itemsListView.SelectedItems.Count > 0) && ! Content.IsReadOnly && !ReadOnly) {224 if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly) { 217 225 foreach (ListViewItem item in itemsListView.SelectedItems) 218 226 Content.RemoveAt(item.Index); … … 240 248 data.SetData("Type", item.GetType()); 241 249 data.SetData("Value", item); 242 if ( Content.IsReadOnly ||ReadOnly) {250 if (ReadOnly) { 243 251 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 244 252 } else { … … 252 260 e.Effect = DragDropEffects.None; 253 261 Type type = e.Data.GetData("Type") as Type; 254 if (! Content.IsReadOnly && !ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) {262 if (!ReadOnly && (type != null) && (typeof(T).IsAssignableFrom(type))) { 255 263 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 256 264 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r3432 r3433 37 37 get { return (IItemCollection<IRun>)base.Content; } 38 38 set { base.Content = value; } 39 } 40 41 public override bool ReadOnly { 42 get { 43 if ((Content != null) && Content.IsReadOnly) return true; 44 else return base.ReadOnly; 45 } 46 set { base.ReadOnly = value; } 39 47 } 40 48 … … 140 148 #region ListView Events 141 149 protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) { 142 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && ! Content.IsReadOnly;150 removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !ReadOnly; 143 151 if (itemsListView.SelectedItems.Count == 1) { 144 152 IRun item = (IRun)itemsListView.SelectedItems[0].Tag; … … 157 165 protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) { 158 166 if (e.KeyCode == Keys.Delete) { 159 if ((itemsListView.SelectedItems.Count > 0) && ! Content.IsReadOnly) {167 if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly) { 160 168 foreach (ListViewItem item in itemsListView.SelectedItems) 161 169 Content.Remove((IRun)item.Tag); … … 181 189 data.SetData("Type", item.GetType()); 182 190 data.SetData("Value", item); 183 if ( Content.IsReadOnly ||ReadOnly) {191 if (ReadOnly) { 184 192 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 185 193 } else { … … 194 202 if (ReadOnly) return; 195 203 Type type = e.Data.GetData("Type") as Type; 196 if ((! Content.IsReadOnly) && (type != null) && (typeof(IRun).IsAssignableFrom(type))) {204 if ((!ReadOnly) && (type != null) && (typeof(IRun).IsAssignableFrom(type))) { 197 205 if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy; // CTRL key 198 206 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key
Note: See TracChangeset
for help on using the changeset viewer.