Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3432 for trunk


Ignore:
Timestamp:
04/20/10 03:55:36 (14 years ago)
Author:
swagner
Message:

Prevented drag operations in locked content views (#982)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs

    r3423 r3432  
    241241
    242242    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
    243       ListViewItem listViewItem = (ListViewItem)e.Item;
    244       T item = listViewItem.Tag as T;
    245       if (item != null) {
    246         DataObject data = new DataObject();
    247         data.SetData("Type", item.GetType());
    248         data.SetData("Value", item);
    249         if (Content.IsReadOnly || ReadOnly) {
    250           DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    251         } else {
    252           DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    253           if ((result & DragDropEffects.Move) == DragDropEffects.Move)
    254             Content[listViewItem.Index] = null;
     243      if (!Locked) {
     244        ListViewItem listViewItem = (ListViewItem)e.Item;
     245        T item = listViewItem.Tag as T;
     246        if (item != null) {
     247          DataObject data = new DataObject();
     248          data.SetData("Type", item.GetType());
     249          data.SetData("Value", item);
     250          if (Content.IsReadOnly || ReadOnly) {
     251            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     252          } else {
     253            DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     254            if ((result & DragDropEffects.Move) == DragDropEffects.Move)
     255              Content[listViewItem.Index] = null;
     256          }
    255257        }
    256258      }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r3423 r3432  
    199199    }
    200200    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
    201       ListViewItem listViewItem = (ListViewItem)e.Item;
    202       T item = (T)listViewItem.Tag;
    203       DataObject data = new DataObject();
    204       data.SetData("Type", item.GetType());
    205       data.SetData("Value", item);
    206       if (Content.IsReadOnly || ReadOnly) {
    207         DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    208       } else {
    209         DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    210         if ((result & DragDropEffects.Move) == DragDropEffects.Move)
    211           Content.Remove(item);
     201      if (!Locked) {
     202        ListViewItem listViewItem = (ListViewItem)e.Item;
     203        T item = (T)listViewItem.Tag;
     204        DataObject data = new DataObject();
     205        data.SetData("Type", item.GetType());
     206        data.SetData("Value", item);
     207        if (Content.IsReadOnly || ReadOnly) {
     208          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     209        } else {
     210          DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     211          if ((result & DragDropEffects.Move) == DragDropEffects.Move)
     212            Content.Remove(item);
     213        }
    212214      }
    213215    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r3423 r3432  
    234234
    235235    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
    236       ListViewItem listViewItem = (ListViewItem)e.Item;
    237       T item = (T)listViewItem.Tag;
    238       DataObject data = new DataObject();
    239       data.SetData("Type", item.GetType());
    240       data.SetData("Value", item);
    241       if (Content.IsReadOnly || ReadOnly) {
    242         DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    243       } else {
    244         DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    245         if ((result & DragDropEffects.Move) == DragDropEffects.Move)
    246           Content.RemoveAt(listViewItem.Index);
     236      if (!Locked) {
     237        ListViewItem listViewItem = (ListViewItem)e.Item;
     238        T item = (T)listViewItem.Tag;
     239        DataObject data = new DataObject();
     240        data.SetData("Type", item.GetType());
     241        data.SetData("Value", item);
     242        if (Content.IsReadOnly || ReadOnly) {
     243          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     244        } else {
     245          DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     246          if ((result & DragDropEffects.Move) == DragDropEffects.Move)
     247            Content.RemoveAt(listViewItem.Index);
     248        }
    247249      }
    248250    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorTreeView.cs

    r3423 r3432  
    370370    }
    371371    private void graphTreeView_ItemDrag(object sender, ItemDragEventArgs e) {
    372       TreeNode node = (TreeNode)e.Item;
    373       IValueParameter opParam = GetOperatorParameterTag(node);
    374       IOperator op = GetOperatorTag(node);
    375       DataObject data = new DataObject();
    376       data.SetData("Type", op.GetType());
    377       data.SetData("Value", op);
    378       if (ReadOnly || (opParam == null)) {
    379         DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    380       } else {
    381         DragDropEffects action = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    382         if ((action & DragDropEffects.Move) == DragDropEffects.Move)
    383           opParam.Value = null;
     372      if (!Locked) {
     373        TreeNode node = (TreeNode)e.Item;
     374        IValueParameter opParam = GetOperatorParameterTag(node);
     375        IOperator op = GetOperatorTag(node);
     376        DataObject data = new DataObject();
     377        data.SetData("Type", op.GetType());
     378        data.SetData("Value", op);
     379        if (ReadOnly || (opParam == null)) {
     380          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     381        } else {
     382          DragDropEffects action = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     383          if ((action & DragDropEffects.Move) == DragDropEffects.Move)
     384            opParam.Value = null;
     385        }
    384386      }
    385387    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs

    r3362 r3432  
    165165    }
    166166    private void scopesTreeView_ItemDrag(object sender, ItemDragEventArgs e) {
    167       TreeNode node = (TreeNode)e.Item;
    168       IScope scope = node.Tag as IScope;
    169       if (scope != null) {
    170         DataObject data = new DataObject();
    171         data.SetData("Type", scope.GetType());
    172         data.SetData("Value", scope);
    173         DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     167      if (!Locked) {
     168        TreeNode node = (TreeNode)e.Item;
     169        IScope scope = node.Tag as IScope;
     170        if (scope != null) {
     171          DataObject data = new DataObject();
     172          data.SetData("Type", scope.GetType());
     173          data.SetData("Value", scope);
     174          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     175        }
    174176      }
    175177    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r3428 r3432  
    288288
    289289    private void chart_MouseMove(object sender, MouseEventArgs e) {
    290       HitTestResult h = this.chart.HitTest(e.X, e.Y);
    291       if (this.draggedRun != null && h.ChartElementType != ChartElementType.DataPoint) {
    292         //this.isDragOperationInProgress = true;
    293         DataObject data = new DataObject();
    294         data.SetData("Type", draggedRun.GetType());
    295         data.SetData("Value", draggedRun);
    296         if (ReadOnly) {
    297           DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    298         } else {
    299           DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    300           if ((result & DragDropEffects.Move) == DragDropEffects.Move)
    301             Content.Remove(draggedRun);
    302         }
    303         this.draggedRun = null;
     290      if (!Locked) {
     291        HitTestResult h = this.chart.HitTest(e.X, e.Y);
     292        if (this.draggedRun != null && h.ChartElementType != ChartElementType.DataPoint) {
     293          //this.isDragOperationInProgress = true;
     294          DataObject data = new DataObject();
     295          data.SetData("Type", draggedRun.GetType());
     296          data.SetData("Value", draggedRun);
     297          if (ReadOnly) {
     298            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     299          } else {
     300            DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     301            if ((result & DragDropEffects.Move) == DragDropEffects.Move)
     302              Content.Remove(draggedRun);
     303          }
     304          this.draggedRun = null;
     305        }
    304306      }
    305307    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3423 r3432  
    175175    }
    176176    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
    177       ListViewItem listViewItem = (ListViewItem)e.Item;
    178       IRun item = (IRun)listViewItem.Tag;
    179       DataObject data = new DataObject();
    180       data.SetData("Type", item.GetType());
    181       data.SetData("Value", item);
    182       if (Content.IsReadOnly || ReadOnly) {
    183         DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    184       } else {
    185         DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
    186         if ((result & DragDropEffects.Move) == DragDropEffects.Move)
    187           Content.Remove(item);
     177      if (!Locked) {
     178        ListViewItem listViewItem = (ListViewItem)e.Item;
     179        IRun item = (IRun)listViewItem.Tag;
     180        DataObject data = new DataObject();
     181        data.SetData("Type", item.GetType());
     182        data.SetData("Value", item);
     183        if (Content.IsReadOnly || ReadOnly) {
     184          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     185        } else {
     186          DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     187          if ((result & DragDropEffects.Move) == DragDropEffects.Move)
     188            Content.Remove(item);
     189        }
    188190      }
    189191    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3423 r3432  
    137137    }
    138138    private void listView_ItemDrag(object sender, ItemDragEventArgs e) {
    139       ListViewItem listViewItem = (ListViewItem)e.Item;
    140       IItem item = (IItem)listViewItem.Tag;
    141       DataObject data = new DataObject();
    142       data.SetData("Type", item.GetType());
    143       data.SetData("Value", item);
    144       DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy);
     139      if (!Locked) {
     140        ListViewItem listViewItem = (ListViewItem)e.Item;
     141        IItem item = (IItem)listViewItem.Tag;
     142        DataObject data = new DataObject();
     143        data.SetData("Type", item.GetType());
     144        data.SetData("Value", item);
     145        DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy);
     146      }
    145147    }
    146148    private void showAlgorithmButton_Click(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.