Changeset 5901


Ignore:
Timestamp:
03/31/11 03:05:47 (11 years ago)
Author:
swagner
Message:

Added flag in ParameterCollectionView to define whether hidden parameters can be edited or not (#1377)

File:
1 edited

Legend:

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

    r5783 r5901  
    3535    protected CreateParameterDialog createParameterDialog;
    3636
     37    protected bool allowEditingOfHiddenParameters;
     38    public virtual bool AllowEditingOfHiddenParameters {
     39      get { return allowEditingOfHiddenParameters; }
     40      set {
     41        if (value != allowEditingOfHiddenParameters) {
     42          allowEditingOfHiddenParameters = value;
     43          SetEnabledStateOfControls();
     44        }
     45      }
     46    }
     47
    3748    public ParameterCollectionView() {
    3849      InitializeComponent();
    3950      itemsGroupBox.Text = "Parameters";
     51      allowEditingOfHiddenParameters = true;
    4052    }
    4153
     
    6678      base.SetEnabledStateOfControls();
    6779      showHiddenParametersCheckBox.Enabled = (Content != null) && Content.Any(x => x.Hidden);
     80      viewHost.ReadOnly = ReadOnly || ((viewHost.Content is IParameter) && (((IParameter)viewHost.Content).Hidden) && !AllowEditingOfHiddenParameters);
    6881    }
    6982
     
    133146      }
    134147    }
     148    protected override void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
     149      base.itemsListView_SelectedIndexChanged(sender, e);
     150      SetEnabledStateOfControls();
     151    }
     152    protected override void itemsListView_DoubleClick(object sender, EventArgs e) {
     153      if (itemsListView.SelectedItems.Count == 1) {
     154        IParameter item = itemsListView.SelectedItems[0].Tag as IParameter;
     155        if (item != null) {
     156          IContentView view = MainFormManager.MainForm.ShowContent(item);
     157          if (view != null) {
     158            view.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
     159            view.Locked = Locked;
     160          }
     161        }
     162      }
     163    }
    135164    protected virtual void itemsListViewContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
    136165      showHideParametersToolStripMenuItem.Text = "Show/Hide Parameters";
    137166      showHideParametersToolStripMenuItem.Enabled = false;
    138       if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly && !Locked) {
     167      if ((itemsListView.SelectedItems.Count > 0) && !ReadOnly && !Locked && AllowEditingOfHiddenParameters) {
    139168        List<IParameter> parameters = new List<IParameter>();
    140169        foreach (ListViewItem listViewItem in itemsListView.SelectedItems) {
     
    151180      foreach (IParameter parameter in (IEnumerable<IParameter>)showHideParametersToolStripMenuItem.Tag)
    152181        parameter.Hidden = !parameter.Hidden;
     182    }
     183    protected override void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
     184      base.showDetailsCheckBox_CheckedChanged(sender, e);
     185      SetEnabledStateOfControls();
    153186    }
    154187    #endregion
Note: See TracChangeset for help on using the changeset viewer.