Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/10 05:02:52 (15 years ago)
Author:
swagner
Message:

Reverted r3433 and corrected read-only handling in RunCollectionView (#973)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3433 r3435  
    3737      get { return (IItemCollection<IRun>)base.Content; }
    3838      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; }
    4739    }
    4840
     
    10193        itemsListView.Enabled = true;
    10294        detailsGroupBox.Enabled = true;
    103         removeButton.Enabled = !ReadOnly;
     95        removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly && !ReadOnly;
    10496        viewHost.Enabled = true;
    10597        viewHost.ReadOnly = ReadOnly;
     
    148140    #region ListView Events
    149141    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;
    151143      if (itemsListView.SelectedItems.Count == 1) {
    152144        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
     
    165157    protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
    166158      if (e.KeyCode == Keys.Delete) {
    167         if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly) {
     159        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
    168160          foreach (ListViewItem item in itemsListView.SelectedItems)
    169161            Content.Remove((IRun)item.Tag);
     
    189181        data.SetData("Type", item.GetType());
    190182        data.SetData("Value", item);
    191         if (ReadOnly) {
     183        if (Content.IsReadOnly || ReadOnly) {
    192184          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    193185        } else {
     
    200192    protected virtual void itemsListView_DragEnterOver(object sender, DragEventArgs e) {
    201193      e.Effect = DragDropEffects.None;
    202       if (ReadOnly) return;
    203194      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))) {
    205196        if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
    206197        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
Note: See TracChangeset for help on using the changeset viewer.