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