Changeset 5837
- Timestamp:
- 03/28/11 14:53:01 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs
r5744 r5837 317 317 private void algorithmTabPage_DragEnterOver(object sender, DragEventArgs e) { 318 318 e.Effect = DragDropEffects.None; 319 IAlgorithm algorithm = e.Data.GetData( "HeuristicLab") as IAlgorithm;319 IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm; 320 320 if (!ReadOnly && (algorithm != null) && Content.ProblemType.IsAssignableFrom(algorithm.Problem.GetType())) { 321 321 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key … … 328 328 private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) { 329 329 if (e.Effect != DragDropEffects.None) { 330 IAlgorithm algorithm = e.Data.GetData( "HeuristicLab") as IAlgorithm;330 IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm; 331 331 if (e.Effect.HasFlag(DragDropEffects.Copy)) algorithm = (IAlgorithm)algorithm.Clone(); 332 332 Content.Algorithm = algorithm; … … 336 336 private void algorithmProblemTabPage_DragEnterOver(object sender, DragEventArgs e) { 337 337 e.Effect = DragDropEffects.None; 338 Type type = e.Data.GetData( "HeuristicLab") != null ? e.Data.GetData("HeuristicLab").GetType() : null;338 Type type = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null ? e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType() : null; 339 339 if (!ReadOnly && (type != null) && Content.ProblemType.IsAssignableFrom(type) && Content.Algorithm.ProblemType.IsAssignableFrom(type)) { 340 340 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key … … 347 347 private void algorithmProblemTabPage_DragDrop(object sender, DragEventArgs e) { 348 348 if (e.Effect != DragDropEffects.None) { 349 ISingleObjectiveDataAnalysisProblem problem = e.Data.GetData( "HeuristicLab") as ISingleObjectiveDataAnalysisProblem;349 ISingleObjectiveDataAnalysisProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ISingleObjectiveDataAnalysisProblem; 350 350 if (e.Effect.HasFlag(DragDropEffects.Copy)) problem = (ISingleObjectiveDataAnalysisProblem)problem.Clone(); 351 351 Content.Problem = problem; -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs
r5834 r5837 317 317 private void algorithmTabPage_DragEnterOver(object sender, DragEventArgs e) { 318 318 e.Effect = DragDropEffects.None; 319 IAlgorithm algorithm = e.Data.GetData( "HeuristicLab") as IAlgorithm;319 IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm; 320 320 if (!ReadOnly && algorithm != null && 321 321 (algorithm.ProblemType != null || Content.ProblemType.IsAssignableFrom(algorithm.Problem.GetType()))) { … … 329 329 private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) { 330 330 if (e.Effect != DragDropEffects.None) { 331 IAlgorithm algorithm = e.Data.GetData( "HeuristicLab") as IAlgorithm;331 IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm; 332 332 if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) algorithm = (IAlgorithm)algorithm.Clone(); 333 333 Content.Algorithm = algorithm; … … 338 338 e.Effect = DragDropEffects.None; 339 339 if (ReadOnly) return; 340 IProblem problem = e.Data.GetData( "HeuristicLab") as IProblem;340 IProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IProblem; 341 341 if (problem != null && Content.ProblemType.IsAssignableFrom(problem.GetType()) && 342 342 Content.Algorithm.ProblemType.IsAssignableFrom(problem.GetType())) { … … 350 350 private void algorithmProblemTabPage_DragDrop(object sender, DragEventArgs e) { 351 351 if (e.Effect != DragDropEffects.None) { 352 IDataAnalysisProblem problem = e.Data.GetData( "HeuristicLab") as IDataAnalysisProblem;352 IDataAnalysisProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IDataAnalysisProblem; 353 353 if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (IDataAnalysisProblem)problem.Clone(); 354 354 Content.Problem = problem; -
trunk/sources/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj
r5193 r5837 120 120 <Compile Include="Content\ContentManager.cs" /> 121 121 <Compile Include="Content\IStorableContent.cs" /> 122 <Compile Include="Constants.cs" /> 122 123 <Compile Include="DeepCloneable.cs" /> 123 124 <Compile Include="Content\IContent.cs" /> -
trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs
r5744 r5837 275 275 if (items.Count > 0) { 276 276 DataObject data = new DataObject(); 277 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);278 else data.SetData( "HeuristicLab", items);277 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 278 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 279 279 if (ReadOnly) { 280 280 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 291 291 validDragOperation = false; 292 292 draggedItemsAlreadyContained = false; 293 if ( e.Data.GetData("HeuristicLab") is T) {293 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) { 294 294 validDragOperation = true; 295 draggedItemsAlreadyContained = itemListViewItemMapping.ContainsKey((T)e.Data.GetData( "HeuristicLab"));296 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {295 draggedItemsAlreadyContained = itemListViewItemMapping.ContainsKey((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)); 296 } else if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 297 297 validDragOperation = true; 298 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");298 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 299 299 foreach (object item in items) { 300 300 validDragOperation = validDragOperation && (item is T); … … 302 302 } 303 303 } 304 validDragOperation = validDragOperation && !ReadOnly;305 304 } 306 305 private void listView_DragOver(object sender, DragEventArgs e) { … … 317 316 if (e.Effect != DragDropEffects.None) { 318 317 try { 319 if (e.Data.GetData( "HeuristicLab") is T) {320 T item = (T)e.Data.GetData( "HeuristicLab");318 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 319 T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 321 320 AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); 322 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {323 IEnumerable<T> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<T>();321 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 322 IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>(); 324 323 foreach (T item in items) 325 324 AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs
r5744 r5837 283 283 if (items.Count > 0) { 284 284 DataObject data = new DataObject(); 285 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);286 else data.SetData( "HeuristicLab", items);285 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 286 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 287 287 if (Content.IsReadOnly || ReadOnly) { 288 288 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 298 298 } 299 299 protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) { 300 validDragOperation = !Content.IsReadOnly && !ReadOnly && e.Data.GetData( "HeuristicLab") is T;300 validDragOperation = !Content.IsReadOnly && !ReadOnly && e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T; 301 301 } 302 302 protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) { … … 318 318 Point p = itemsListView.PointToClient(new Point(e.X, e.Y)); 319 319 ListViewItem listViewItem = itemsListView.GetItemAt(p.X, p.Y); 320 T item = e.Data.GetData( "HeuristicLab") as T;320 T item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T; 321 321 Content[listViewItem.Index] = e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item; 322 322 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r5744 r5837 253 253 if (items.Count > 0) { 254 254 DataObject data = new DataObject(); 255 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);256 else data.SetData( "HeuristicLab", items);255 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 256 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 257 257 if (Content.IsReadOnly || ReadOnly) { 258 258 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 268 268 protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) { 269 269 validDragOperation = false; 270 if ( e.Data.GetData("HeuristicLab") is T) {270 if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) { 271 271 validDragOperation = true; 272 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {272 } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 273 273 validDragOperation = true; 274 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");274 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 275 275 foreach (object item in items) 276 276 validDragOperation = validDragOperation && (item is T); 277 277 } 278 validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;279 278 } 280 279 protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) { … … 290 289 protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) { 291 290 if (e.Effect != DragDropEffects.None) { 292 if (e.Data.GetData( "HeuristicLab") is T) {293 T item = (T)e.Data.GetData( "HeuristicLab");291 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 292 T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 294 293 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); 295 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {296 IEnumerable<T> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<T>();294 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 295 IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>(); 297 296 foreach (T item in items) 298 297 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
r5744 r5837 287 287 if (items.Count > 0) { 288 288 DataObject data = new DataObject(); 289 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);290 else data.SetData( "HeuristicLab", items);289 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 290 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 291 291 if (Content.IsReadOnly || ReadOnly) { 292 292 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 304 304 protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) { 305 305 validDragOperation = false; 306 if ( e.Data.GetData("HeuristicLab") is T) {306 if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) { 307 307 validDragOperation = true; 308 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {308 } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 309 309 validDragOperation = true; 310 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");310 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 311 311 foreach (object item in items) 312 312 validDragOperation = validDragOperation && (item is T); 313 313 } 314 validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;315 314 } 316 315 protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) { … … 329 328 ListViewItem listViewItem = itemsListView.GetItemAt(p.X, p.Y); 330 329 331 if (e.Data.GetData( "HeuristicLab") is T) {332 T item = (T)e.Data.GetData( "HeuristicLab");330 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 331 T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 333 332 if (listViewItem != null) Content.Insert(listViewItem.Index, e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); 334 333 else Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); 335 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {336 IEnumerable<T> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<T>();334 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 335 IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>(); 337 336 foreach (T item in items) { 338 337 if (listViewItem != null) Content.Insert(listViewItem.Index, e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemSetView.cs
r5744 r5837 44 44 draggedItemsAlreadyContained = false; 45 45 if (validDragOperation) { 46 if (e.Data.GetData( "HeuristicLab") is T) {47 draggedItemsAlreadyContained = Content.Contains((T)e.Data.GetData( "HeuristicLab"));48 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {49 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");46 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 47 draggedItemsAlreadyContained = Content.Contains((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)); 48 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 49 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 50 50 foreach (object item in items) 51 51 draggedItemsAlreadyContained = draggedItemsAlreadyContained || Content.Contains((T)item); -
trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemCollectionView.cs
r5829 r5837 82 82 base.itemsListView_DragEnter(sender, e); 83 83 if (validDragOperation) { 84 if (e.Data.GetData( "HeuristicLab") is T) {85 validDragOperation = validDragOperation && !Content.ContainsKey(((T)e.Data.GetData( "HeuristicLab")).Name);86 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {87 IEnumerable<T> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<T>();84 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 85 validDragOperation = validDragOperation && !Content.ContainsKey(((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Name); 86 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 87 IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>(); 88 88 foreach (T item in items) 89 89 validDragOperation = validDragOperation && !Content.ContainsKey(item.Name); -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorTreeView.cs
r5744 r5837 353 353 IOperator op = GetOperatorTag(node); 354 354 DataObject data = new DataObject(); 355 data.SetData( "HeuristicLab", op);355 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, op); 356 356 if (ReadOnly || (opParam == null)) { 357 357 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 365 365 private void graphTreeView_DragEnterOver(object sender, DragEventArgs e) { 366 366 e.Effect = DragDropEffects.None; 367 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") is IOperator)) {367 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOperator)) { 368 368 TreeNode node = graphTreeView.GetNodeAt(graphTreeView.PointToClient(new Point(e.X, e.Y))); 369 369 if ((node != null) && !node.IsExpanded) node.Expand(); … … 379 379 private void graphTreeView_DragDrop(object sender, DragEventArgs e) { 380 380 if (e.Effect != DragDropEffects.None) { 381 IOperator op = e.Data.GetData( "HeuristicLab") as IOperator;381 IOperator op = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOperator; 382 382 if (e.Effect.HasFlag(DragDropEffects.Copy)) op = (IOperator)op.Clone(); 383 383 TreeNode node = graphTreeView.GetNodeAt(graphTreeView.PointToClient(new Point(e.X, e.Y))); -
trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs
r5744 r5837 168 168 if (scope != null) { 169 169 DataObject data = new DataObject(); 170 data.SetData( "HeuristicLab", scope);170 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, scope); 171 171 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 172 172 } -
trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs
r5744 r5837 318 318 object o = Activator.CreateInstance(type); 319 319 DataObject data = new DataObject(); 320 data.SetData( "HeuristicLab", o);320 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, o); 321 321 DoDragDrop(data, DragDropEffects.Copy); 322 322 } -
trunk/sources/HeuristicLab.Core.Views/3.3/VariableValueView.cs
r5744 r5837 88 88 protected virtual void VariableValueView_DragEnterOver(object sender, DragEventArgs e) { 89 89 e.Effect = DragDropEffects.None; 90 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") is IItem)) {90 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IItem)) { 91 91 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 92 92 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 98 98 protected virtual void VariableValueView_DragDrop(object sender, DragEventArgs e) { 99 99 if (e.Effect != DragDropEffects.None) { 100 IItem item = e.Data.GetData( "HeuristicLab") as IItem;100 IItem item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IItem; 101 101 if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone(); 102 102 Content.Value = item; -
trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs
r5744 r5837 135 135 protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) { 136 136 e.Effect = DragDropEffects.None; 137 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") is IItem)) {137 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IItem)) { 138 138 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 139 139 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 145 145 protected virtual void valuePanel_DragDrop(object sender, DragEventArgs e) { 146 146 if (e.Effect != DragDropEffects.None) { 147 IItem item = e.Data.GetData( "HeuristicLab") as IItem;147 IItem item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IItem; 148 148 if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone(); 149 149 Content.Value = item; -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs
r5744 r5837 281 281 if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left && startDragAndDrop) { 282 282 DataObject data = new DataObject(); 283 data.SetData( "HeuristicLab", Content);283 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, Content); 284 284 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); 285 285 } else -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorGraphView.cs
r5744 r5837 204 204 private void OperatorGraphView_DragEnterOver(object sender, DragEventArgs e) { 205 205 e.Effect = DragDropEffects.None; 206 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") is IOperator)) {206 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOperator)) { 207 207 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 208 208 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 215 215 private void OperatorGraphView_DragDrop(object sender, DragEventArgs e) { 216 216 if (e.Effect != DragDropEffects.None) { 217 IOperator op = e.Data.GetData( "HeuristicLab") as IOperator;217 IOperator op = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOperator; 218 218 if (e.Effect.HasFlag(DragDropEffects.Copy)) op = (IOperator)op.Clone(); 219 219 IOperatorShapeInfo shapeInfo = OperatorShapeInfoFactory.CreateOperatorShapeInfo(op); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r5809 r5837 278 278 protected virtual void problemTabPage_DragEnterOver(object sender, DragEventArgs e) { 279 279 e.Effect = DragDropEffects.None; 280 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {280 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) { 281 281 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 282 282 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 288 288 protected virtual void problemTabPage_DragDrop(object sender, DragEventArgs e) { 289 289 if (e.Effect != DragDropEffects.None) { 290 IProblem problem = e.Data.GetData( "HeuristicLab") as IProblem;290 IProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IProblem; 291 291 if (e.Effect.HasFlag(DragDropEffects.Copy)) problem = (IProblem)problem.Clone(); 292 292 Content.Problem = problem; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r5744 r5837 253 253 private void optimizerTabPage_DragEnterOver(object sender, DragEventArgs e) { 254 254 e.Effect = DragDropEffects.None; 255 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") is IOptimizer)) {255 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOptimizer)) { 256 256 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 257 257 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 263 263 private void optimizerTabPage_DragDrop(object sender, DragEventArgs e) { 264 264 if (e.Effect != DragDropEffects.None) { 265 IOptimizer optimizer = e.Data.GetData( "HeuristicLab") as IOptimizer;265 IOptimizer optimizer = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOptimizer; 266 266 if (e.Effect.HasFlag(DragDropEffects.Copy)) optimizer = (IOptimizer)optimizer.Clone(); 267 267 Content.Optimizer = optimizer; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r5824 r5837 493 493 if (this.draggedRun != null && h.ChartElementType != ChartElementType.DataPoint) { 494 494 DataObject data = new DataObject(); 495 data.SetData( "HeuristicLab", draggedRun);495 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, draggedRun); 496 496 if (ReadOnly) 497 497 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r5744 r5837 273 273 if (items.Count > 0) { 274 274 DataObject data = new DataObject(); 275 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);276 else data.SetData( "HeuristicLab", items);275 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 276 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 277 277 if (Content.IsReadOnly || ReadOnly) { 278 278 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 288 288 private void itemsListView_DragEnter(object sender, DragEventArgs e) { 289 289 validDragOperation = false; 290 if ( e.Data.GetData("HeuristicLab") is IRun) {290 if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun)) { 291 291 validDragOperation = true; 292 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {292 } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 293 293 validDragOperation = true; 294 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");294 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 295 295 foreach (object item in items) 296 296 validDragOperation = validDragOperation && (item is IRun); 297 297 } 298 validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;299 298 } 300 299 private void itemsListView_DragOver(object sender, DragEventArgs e) { … … 310 309 private void itemsListView_DragDrop(object sender, DragEventArgs e) { 311 310 if (e.Effect != DragDropEffects.None) { 312 if (e.Data.GetData( "HeuristicLab") is IRun) {313 IRun item = (IRun)e.Data.GetData( "HeuristicLab");311 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun) { 312 IRun item = (IRun)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 314 313 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item); 315 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {316 IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<IRun>();314 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 315 IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<IRun>(); 317 316 foreach (IRun item in items) 318 317 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs
r5744 r5837 149 149 if (item != null) { 150 150 DataObject data = new DataObject(); 151 data.SetData( "HeuristicLab", item);151 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, item); 152 152 DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy); 153 153 } -
trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs
r5744 r5837 122 122 IItem item = (IItem)listViewItem.Tag; 123 123 DataObject data = new DataObject(); 124 data.SetData( "HeuristicLab", item);124 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, item); 125 125 DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy); 126 126 } -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs
r5744 r5837 162 162 protected virtual void valueGroupBox_DragEnterOver(object sender, DragEventArgs e) { 163 163 e.Effect = DragDropEffects.None; 164 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") != null) && Content.DataType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {164 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.DataType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) { 165 165 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 166 166 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 172 172 protected virtual void valueGroupBox_DragDrop(object sender, DragEventArgs e) { 173 173 if (e.Effect != DragDropEffects.None) { 174 T value = e.Data.GetData( "HeuristicLab") as T;174 T value = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T; 175 175 if (e.Effect.HasFlag(DragDropEffects.Copy)) value = (T)value.Clone(); 176 176 Content.Value = value; -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs
r5809 r5837 150 150 e.Effect = DragDropEffects.None; 151 151 if (Content is IFixedValueParameter) return; 152 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") != null) && Content.DataType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {152 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.DataType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) { 153 153 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 154 154 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 160 160 protected virtual void valueGroupBox_DragDrop(object sender, DragEventArgs e) { 161 161 if (e.Effect != DragDropEffects.None) { 162 T value = e.Data.GetData( "HeuristicLab") as T;162 T value = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T; 163 163 if (e.Effect.HasFlag(DragDropEffects.Copy)) value = (T)value.Clone(); 164 164 Content.Value = value;
Note: See TracChangeset
for help on using the changeset viewer.