Changeset 12182


Ignore:
Timestamp:
03/10/15 15:43:15 (3 years ago)
Author:
jkarder
Message:

#2358: added drag & drop linking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r12181 r12182  
    237237      if (!(item.Value is IDeepCloneable)) return;
    238238      var data = new DataObject(HeuristicLab.Common.Constants.DragDropDataFormat, item);
    239       DoDragDrop(data, DragDropEffects.Copy);
     239      DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    240240    }
    241241    protected virtual void variableListView_DragEnter(object sender, DragEventArgs e) {
     
    253253      e.Effect = DragDropEffects.None;
    254254      if (validDragOperation) {
    255         if (e.AllowedEffect.HasFlag(DragDropEffects.Copy))
    256           e.Effect = DragDropEffects.Copy;
     255        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
     256        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     257        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
    257258      }
    258259    }
    259260    protected virtual void variableListView_DragDrop(object sender, DragEventArgs e) {
    260       if (e.Effect != DragDropEffects.Copy) return;
     261      if (e.Effect == DragDropEffects.None) return;
     262
    261263      object item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    262264
     
    279281      if (cloneable == null) return;
    280282
    281       var clonedItem = cloneable.Clone();
    282       Content.Add(variableName, clonedItem);
     283      Content.Add(variableName, e.Effect.HasFlag(DragDropEffects.Copy) ? cloneable.Clone() : cloneable);
    283284
    284285      var listViewItem = variableListView.FindItemWithText(variableName);
Note: See TracChangeset for help on using the changeset viewer.