Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12610


Ignore:
Timestamp:
07/06/15 15:52:06 (9 years ago)
Author:
ascheibe
Message:

#2358 merged r12181 and r12182 into stable

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r12275 r12610  
    3232using HeuristicLab.MainForm.WindowsForms;
    3333using HeuristicLab.Persistence.Core;
     34using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3435using HeuristicLab.Persistence.Default.Xml;
    3536using HeuristicLab.PluginInfrastructure;
     
    236237      if (!(item.Value is IDeepCloneable)) return;
    237238      var data = new DataObject(HeuristicLab.Common.Constants.DragDropDataFormat, item);
    238       DoDragDrop(data, DragDropEffects.Copy);
     239      DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    239240    }
    240241    protected virtual void variableListView_DragEnter(object sender, DragEventArgs e) {
     
    252253      e.Effect = DragDropEffects.None;
    253254      if (validDragOperation) {
    254         if (e.AllowedEffect.HasFlag(DragDropEffects.Copy))
    255           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;
    256258      }
    257259    }
    258260    protected virtual void variableListView_DragDrop(object sender, DragEventArgs e) {
    259       if (e.Effect != DragDropEffects.Copy) return;
     261      if (e.Effect == DragDropEffects.None) return;
     262
    260263      object item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    261264
     
    278281      if (cloneable == null) return;
    279282
    280       var clonedItem = cloneable.Clone();
    281       Content.Add(variableName, clonedItem);
     283      Content.Add(variableName, e.Effect.HasFlag(DragDropEffects.Copy) ? cloneable.Clone() : cloneable);
    282284
    283285      var listViewItem = variableListView.FindItemWithText(variableName);
     
    474476      if (variable.Value != null) {
    475477        type = variable.Value.GetType();
    476         if (serializableLookup.TryGetValue(type, out serializable))
    477           return serializable;
     478        if (serializableLookup.TryGetValue(type, out serializable)) return serializable;
     479        if (StorableClassAttribute.IsStorableClass(type)) return serializableLookup[type] = true;
    478480      }
    479481
Note: See TracChangeset for help on using the changeset viewer.