Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3454


Ignore:
Timestamp:
04/21/10 06:14:03 (14 years ago)
Author:
swagner
Message:

Adapted views according the new read-only property (#973)

Location:
trunk/sources
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r3080 r3454  
    9595      chart.Titles.Clear();
    9696      chart.Series.Clear();
    97       if (Content == null) {
    98         Caption = "DataTable";
    99         chart.Enabled = false;
    100       } else {
     97      Caption = "DataTable";
     98      if (Content != null) {
    10199        Caption = Content.Name + " (" + Content.GetType().Name + ")";
    102         chart.Enabled = true;
    103100        chart.Titles.Add(new Title(Content.Name, Docking.Top));
    104101        foreach (DataRow row in Content.Rows)
    105102          AddDataRow(row);
    106103      }
     104      SetEnabledStateOfControls();
     105    }
     106
     107    protected override void OnReadOnlyChanged() {
     108      base.OnReadOnlyChanged();
     109      SetEnabledStateOfControls();
     110    }
     111
     112    private void SetEnabledStateOfControls() {
     113      chart.Enabled = Content != null;
    107114    }
    108115
  • trunk/sources/HeuristicLab.CodeEditor/3.2/CodeViewer.Designer.cs

    r2659 r3454  
    6262      this.Controls.Add(this.textEditorControl1);
    6363      this.Controls.Add(this.button1);
     64      this.Icon = HeuristicLab.Common.Resources.Resources.HeuristicLabIcon;
    6465      this.Name = "CodeViewer";
    6566      this.Text = "GeneratedCode";
  • trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs

    r3396 r3454  
    6565      if (Content == null) {
    6666        Caption = "NamedItem";
    67         nameTextBox.Text = "-";
    68         descriptionTextBox.Text = "";
     67        nameTextBox.Text = string.Empty;
     68        descriptionTextBox.Text = string.Empty;
    6969        toolTip.SetToolTip(descriptionTextBox, string.Empty);
    7070      } else {
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r3431 r3454  
    8686    }
    8787    private void SetEnabledStateOfControls() {
    88       if (Content == null) {
    89         lengthTextBox.Enabled = false;
    90         dataGridView.Enabled = false;
    91       } else {
    92         lengthTextBox.Enabled = true;
    93         dataGridView.Enabled = true;
    94         lengthTextBox.ReadOnly = ReadOnly;
    95         dataGridView.ReadOnly = ReadOnly;
    96       }
     88      lengthTextBox.Enabled = Content != null;
     89      dataGridView.Enabled = Content != null;
     90      lengthTextBox.ReadOnly = ReadOnly;
     91      dataGridView.ReadOnly = ReadOnly;
    9792    }
    9893
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r3448 r3454  
    101101    }
    102102    private void SetEnabledStateOfControls() {
    103       if (Content == null) {
    104         rowsTextBox.Enabled = false;
    105         columnsTextBox.Enabled = false;
    106         dataGridView.Enabled = false;
    107       } else {
    108         rowsTextBox.Enabled = true;
    109         columnsTextBox.Enabled = true;
    110         dataGridView.Enabled = true;
    111         rowsTextBox.ReadOnly = ReadOnly;
    112         columnsTextBox.ReadOnly = ReadOnly;
    113         dataGridView.ReadOnly = ReadOnly;
    114       }
     103      rowsTextBox.Enabled = Content != null;
     104      columnsTextBox.Enabled = Content != null;
     105      dataGridView.Enabled = Content != null;
     106      rowsTextBox.ReadOnly = ReadOnly;
     107      columnsTextBox.ReadOnly = ReadOnly;
     108      dataGridView.ReadOnly = ReadOnly;
    115109    }
    116110
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleValueView.cs

    r3430 r3454  
    8080    }
    8181    private void SetEnabledStateOfControls() {
    82       if (Content == null) valueTextBox.Enabled = false;
    83       else {
    84         valueTextBox.Enabled = true;
    85         valueTextBox.ReadOnly = ReadOnly;
    86       }
     82      valueTextBox.Enabled = Content != null;
     83      valueTextBox.ReadOnly = ReadOnly;
    8784    }
    8885
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.cs

    r3294 r3454  
    6060        symbolicExpressionTreeChart.Tree = Content;
    6161      }
     62      SetEnabledStateOfControls();
     63    }
     64
     65    protected override void OnReadOnlyChanged() {
     66      base.OnReadOnlyChanged();
     67      SetEnabledStateOfControls();
     68    }
     69
     70    private void SetEnabledStateOfControls() {
     71      symbolicExpressionTreeChart.Enabled = Content != null;
    6272    }
    6373  }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs

    r3442 r3454  
    3535        Caption = "SymbolicExpression View";
    3636        textBox.Text = string.Empty;
    37         textBox.Enabled = false;
    3837      } else {
    3938        textBox.Text = SymbolicExpression(Content.Root, 0);
    40         textBox.Enabled = true;
    4139      }
     40      SetEnabledStateOfControls();
     41    }
     42
     43    protected override void OnReadOnlyChanged() {
     44      base.OnReadOnlyChanged();
     45      SetEnabledStateOfControls();
     46    }
     47
     48    private void SetEnabledStateOfControls() {
     49      textBox.Enabled = Content != null;
     50      textBox.ReadOnly = ReadOnly;
    4251    }
    4352
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs

    r3376 r3454  
    132132    }
    133133
    134     public void SetDescription(string description) {
    135       if (description == null)
    136         throw new NullReferenceException("description must not be null");
    137       Description = description;
    138     }
    139 
    140134    public IEnumerable<string> GetAllNamespaces(bool selectedAssembliesOnly) {
    141135      var namespaces = new HashSet<string>();
     
    223217      typeof(System.Text.StringBuilder).Assembly,
    224218      typeof(System.Data.Linq.DataContext).Assembly,
     219      typeof(HeuristicLab.Common.IDeepCloneable).Assembly,
    225220      typeof(HeuristicLab.Core.Item).Assembly,
    226221      typeof(HeuristicLab.Data.IntValue).Assembly,
     
    258253        "System.Linq",
    259254        "System.Data.Linq",
     255        "HeuristicLab.Common",
    260256        "HeuristicLab.Core",
    261257        "HeuristicLab.Data",
     
    419415    public override IDeepCloneable Clone(Cloner cloner) {
    420416      ProgrammableOperator clone = (ProgrammableOperator)base.Clone(cloner);
    421       clone.description = description;
    422417      clone.code = Code;
    423418      clone.executeMethod = executeMethod;
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.Designer.cs

    r3014 r3454  
    7878      //
    7979      this.descriptionTextBox.Size = new System.Drawing.Size(913, 20);
    80       this.descriptionTextBox.TextChanged += new System.EventHandler(this.descriptionTextBox_TextChanged);
    8180      //
    8281      // tabPage2
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.cs

    r3376 r3454  
    6060      base.RegisterContentEvents();
    6161      ProgrammableOperator.CodeChanged += ProgrammableOperator_CodeChanged;
    62       ProgrammableOperator.DescriptionChanged += ProgrammableOperator_DescriptionChanged;
    6362      ProgrammableOperator.SignatureChanged += ProgrammableOperator_SignatureChanged;
    6463    }
     
    6665    protected override void DeregisterContentEvents() {
    6766      ProgrammableOperator.CodeChanged -= ProgrammableOperator_CodeChanged;
    68       ProgrammableOperator.DescriptionChanged -= ProgrammableOperator_DescriptionChanged;
    6967      ProgrammableOperator.SignatureChanged -= ProgrammableOperator_SignatureChanged;
    7068      base.DeregisterContentEvents();
     
    7573      if (ProgrammableOperator == null) {
    7674        codeEditor.Text = "";
    77         codeEditor.Enabled = false;
    78         descriptionTextBox.Text = "";
    79         descriptionTextBox.Enabled = false;
    8075        assembliesTreeView.Nodes.Clear();
    8176        parameterCollectionView.Content = null;
    8277      } else {
    83         codeEditor.Enabled = true;
    84         descriptionTextBox.Text = ProgrammableOperator.Description;
    85         descriptionTextBox.Enabled = true;
    8678        codeEditor.Prefix = GetGeneratedPrefix();
    8779        codeEditor.Suffix = @"
     
    10496        parameterCollectionView.Content = ProgrammableOperator.Parameters;
    10597      }
     98      SetEnabledStateOfControls();
     99    }
     100
     101    protected override void OnReadOnlyChanged() {
     102      base.OnReadOnlyChanged();
     103      SetEnabledStateOfControls();
     104    }
     105
     106    private void SetEnabledStateOfControls() {
     107      parameterCollectionView.Enabled = Content != null;
     108      parameterCollectionView.ReadOnly = ReadOnly;
     109      assembliesTreeView.Enabled = Content != null && !ReadOnly;
     110      namespacesTreeView.Enabled = Content != null && !ReadOnly;
     111      compileButton.Enabled = Content != null && !ReadOnly;
     112      codeEditor.Enabled = Content != null && !ReadOnly;
    106113    }
    107114
     
    141148    private void ProgrammableOperator_CodeChanged(object sender, EventArgs e) {
    142149      codeEditor.Text = ProgrammableOperator.Code;
    143     }
    144     private void ProgrammableOperator_DescriptionChanged(object sender, EventArgs e) {
    145       descriptionTextBox.Text = ProgrammableOperator.Description;
    146150    }
    147151    private void ProgrammableOperator_SignatureChanged(object sender, EventArgs args) {
     
    279283      new CodeViewer(ProgrammableOperator.CompilationUnitCode).ShowDialog(this);
    280284    }
    281 
    282     private void descriptionTextBox_TextChanged(object sender, EventArgs e) {
    283       ProgrammableOperator.SetDescription(descriptionTextBox.Text);
    284     }
    285 
    286 
    287285  }
    288286}
  • trunk/sources/HeuristicLab.Operators.Views/3.3/AlgorithmOperatorView.cs

    r3376 r3454  
    7575      if (Content == null) {
    7676        breakpointCheckBox.Checked = false;
    77         breakpointCheckBox.Enabled = false;
    7877        parameterCollectionView.Content = null;
    7978        operatorGraphViewHost.Content = null;
    80         tabControl.Enabled = false;
    8179      } else {
    8280        breakpointCheckBox.Checked = Content.Breakpoint;
    83         breakpointCheckBox.Enabled = true;
    8481        parameterCollectionView.Content = ((IOperator)Content).Parameters;
    8582        operatorGraphViewHost.ViewType = null;
    8683        operatorGraphViewHost.Content = Content.OperatorGraph;
    87         tabControl.Enabled = true;
    8884      }
     85      SetEnabledStateOfControls();
     86    }
     87
     88    protected override void OnReadOnlyChanged() {
     89      base.OnReadOnlyChanged();
     90      SetEnabledStateOfControls();
     91    }
     92
     93    private void SetEnabledStateOfControls() {
     94      breakpointCheckBox.Enabled = Content != null && !ReadOnly;
     95      parameterCollectionView.Enabled = Content != null;
     96      parameterCollectionView.ReadOnly = ReadOnly;
     97      operatorGraphViewHost.Enabled = Content != null;
     98      operatorGraphViewHost.ReadOnly = ReadOnly;
    8999    }
    90100
  • trunk/sources/HeuristicLab.Operators.Views/3.3/MultiOperatorView.cs

    r3407 r3454  
    7575      if (Content == null) {
    7676        breakpointCheckBox.Checked = false;
    77         breakpointCheckBox.Enabled = false;
    7877        operatorListView.Content = null;
    7978        parameterCollectionView.Content = null;
    80         tabControl.Enabled = false;
    8179      } else {
    8280        breakpointCheckBox.Checked = Content.Breakpoint;
    83         breakpointCheckBox.Enabled = true;
    8481        operatorListView.Content = Content.Operators;
    8582        parameterCollectionView.Content = ((IOperator)Content).Parameters;
    86         tabControl.Enabled = true;
    8783      }
     84      SetEnabledStateOfControls();
     85    }
     86
     87    protected override void OnReadOnlyChanged() {
     88      base.OnReadOnlyChanged();
     89      SetEnabledStateOfControls();
     90    }
     91
     92    private void SetEnabledStateOfControls() {
     93      breakpointCheckBox.Enabled = Content != null && !ReadOnly;
     94      operatorListView.Enabled = Content != null;
     95      operatorListView.ReadOnly = ReadOnly;
     96      parameterCollectionView.Enabled = Content != null;
     97      parameterCollectionView.ReadOnly = ReadOnly;
    8898    }
    8999
  • trunk/sources/HeuristicLab.Operators.Views/3.3/OperatorView.cs

    r3376 r3454  
    7676      if (Content == null) {
    7777        breakpointCheckBox.Checked = false;
    78         breakpointCheckBox.Enabled = false;
    7978      } else {
    8079        breakpointCheckBox.Checked = Content.Breakpoint;
    81         breakpointCheckBox.Enabled = true;
    8280      }
     81      SetEnabledStateOfControls();
     82    }
     83
     84    protected override void OnReadOnlyChanged() {
     85      base.OnReadOnlyChanged();
     86      SetEnabledStateOfControls();
     87    }
     88
     89    private void SetEnabledStateOfControls() {
     90      breakpointCheckBox.Enabled = Content != null && !ReadOnly;
    8391    }
    8492
  • trunk/sources/HeuristicLab.Operators.Views/3.3/ValuesCollectorView.cs

    r3376 r3454  
    7575      if (Content == null) {
    7676        breakpointCheckBox.Checked = false;
    77         breakpointCheckBox.Enabled = false;
    7877        collectedValuesView.Content = null;
    7978        parameterCollectionView.Content = null;
    80         tabControl.Enabled = false;
    8179      } else {
    8280        breakpointCheckBox.Checked = Content.Breakpoint;
    83         breakpointCheckBox.Enabled = true;
    8481        collectedValuesView.Content = Content.CollectedValues;
    8582        parameterCollectionView.Content = ((IOperator)Content).Parameters;
    86         tabControl.Enabled = true;
    8783      }
     84      SetEnabledStateOfControls();
     85    }
     86
     87    protected override void OnReadOnlyChanged() {
     88      base.OnReadOnlyChanged();
     89      SetEnabledStateOfControls();
     90    }
     91
     92    private void SetEnabledStateOfControls() {
     93      breakpointCheckBox.Enabled = Content != null && !ReadOnly;
     94      collectedValuesView.Enabled = Content != null;
     95      collectedValuesView.ReadOnly = ReadOnly;
     96      parameterCollectionView.Enabled = Content != null;
     97      parameterCollectionView.ReadOnly = ReadOnly;
    8898    }
    8999
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs

    r3299 r3454  
    5252      this.problemPanel = new System.Windows.Forms.Panel();
    5353      this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    54       this.saveProblemButton = new System.Windows.Forms.Button();
    5554      this.openProblemButton = new System.Windows.Forms.Button();
    5655      this.newProblemButton = new System.Windows.Forms.Button();
     
    6564      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    6665      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    67       this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    6866      this.stopButton = new System.Windows.Forms.Button();
    6967      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     
    127125      //
    128126      this.problemTabPage.Controls.Add(this.problemPanel);
    129       this.problemTabPage.Controls.Add(this.saveProblemButton);
    130127      this.problemTabPage.Controls.Add(this.openProblemButton);
    131128      this.problemTabPage.Controls.Add(this.newProblemButton);
     
    163160      this.problemViewHost.ViewType = null;
    164161      //
    165       // saveProblemButton
    166       //
    167       this.saveProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    168       this.saveProblemButton.Location = new System.Drawing.Point(66, 6);
    169       this.saveProblemButton.Name = "saveProblemButton";
    170       this.saveProblemButton.Size = new System.Drawing.Size(24, 24);
    171       this.saveProblemButton.TabIndex = 2;
    172       this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
    173       this.saveProblemButton.UseVisualStyleBackColor = true;
    174       this.saveProblemButton.Click += new System.EventHandler(this.saveProblemButton_Click);
    175       //
    176162      // openProblemButton
    177163      //
     
    303289      this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";
    304290      this.openFileDialog.Title = "Open Problem";
    305       //
    306       // saveFileDialog
    307       //
    308       this.saveFileDialog.DefaultExt = "hl";
    309       this.saveFileDialog.FileName = "Problem";
    310       this.saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";
    311       this.saveFileDialog.FilterIndex = 2;
    312       this.saveFileDialog.Title = "Save Problem";
    313291      //
    314292      // stopButton
     
    368346    protected HeuristicLab.MainForm.WindowsForms.ViewHost problemViewHost;
    369347    protected System.Windows.Forms.Button newProblemButton;
    370     protected System.Windows.Forms.Button saveProblemButton;
    371348    protected System.Windows.Forms.Button openProblemButton;
    372349    protected System.Windows.Forms.Button startButton;
     
    376353    protected System.Windows.Forms.TextBox executionTimeTextBox;
    377354    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    378     protected System.Windows.Forms.SaveFileDialog saveFileDialog;
    379355    protected System.Windows.Forms.TabPage resultsTabPage;
    380356    protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r3416 r3454  
    9797        resultsView.Content = null;
    9898        runsView.Content = null;
    99         tabControl.Enabled = false;
    100         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    10199        executionTimeTextBox.Text = "-";
    102         executionTimeTextBox.Enabled = false;
    103100      } else {
    104101        parameterCollectionView.Content = Content.Parameters;
    105         saveProblemButton.Enabled = Content.Problem != null;
    106102        problemViewHost.ViewType = null;
    107103        problemViewHost.Content = Content.Problem;
    108104        resultsView.Content = Content.Results.AsReadOnly();
    109105        runsView.Content = Content.Runs;
    110         tabControl.Enabled = true;
    111         EnableDisableButtons();
    112106        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    113         executionTimeTextBox.Enabled = true;
    114107      }
    115108      SetEnableStateOfControls();
     
    121114    }
    122115    private void SetEnableStateOfControls() {
     116      parameterCollectionView.Enabled = Content != null;
    123117      parameterCollectionView.ReadOnly = ReadOnly;
     118      newProblemButton.Enabled = Content != null && !ReadOnly;
     119      openProblemButton.Enabled = Content != null && !ReadOnly;
     120      problemViewHost.Enabled = Content != null;
    124121      problemViewHost.ReadOnly = ReadOnly;
     122      resultsView.Enabled = Content != null;
    125123      resultsView.ReadOnly = ReadOnly;
     124      runsView.Enabled = Content != null;
    126125      runsView.ReadOnly = ReadOnly;
     126      executionTimeTextBox.Enabled = Content != null;
     127      SetEnabledStateOfExecutableButtons();
    127128    }
    128129
     
    139140        problemViewHost.ViewType = null;
    140141        problemViewHost.Content = Content.Problem;
    141         saveProblemButton.Enabled = Content.Problem != null;
    142142      }
    143143    }
     
    152152        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    153153      else {
    154         this.ReadOnly = Content.ExecutionState == ExecutionState.Started;
     154        ReadOnly = Content.ExecutionState == ExecutionState.Started;
    155155        Locked = Content.ExecutionState == ExecutionState.Started;
    156         EnableDisableButtons();
     156        SetEnabledStateOfExecutableButtons();
    157157      }
    158158    }
     
    192192      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    193193        this.Cursor = Cursors.AppStarting;
    194         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;
     194        newProblemButton.Enabled = openProblemButton.Enabled = false;
    195195        problemViewHost.Enabled = false;
    196196
     
    211211              Content.Problem = problem;
    212212            problemViewHost.Enabled = true;
    213             newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = true;
    214             this.Cursor = Cursors.Default;
    215           }));
    216         }, null);
    217       }
    218     }
    219     protected virtual void saveProblemButton_Click(object sender, EventArgs e) {
    220       saveFileDialog.Title = "Save Problem";
    221       if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    222         this.Cursor = Cursors.AppStarting;
    223         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false;
    224         problemViewHost.Enabled = false;
    225 
    226         var call = new Action<IProblem, string, int>(XmlGenerator.Serialize);
    227         int compression = 9;
    228         if (saveFileDialog.FilterIndex == 1) compression = 0;
    229         call.BeginInvoke(Content.Problem, saveFileDialog.FileName, compression, delegate(IAsyncResult a) {
    230           try {
    231             call.EndInvoke(a);
    232           }
    233           catch (Exception ex) {
    234             Auxiliary.ShowErrorMessageBox(ex);
    235           }
    236           Invoke(new Action(delegate() {
    237             problemViewHost.Enabled = true;
    238             newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = true;
     213            newProblemButton.Enabled = openProblemButton.Enabled = true;
    239214            this.Cursor = Cursors.Default;
    240215          }));
     
    282257
    283258    #region Helpers
    284     private void EnableDisableButtons() {
    285       startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
    286       pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
    287       stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    288       resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     259    private void SetEnabledStateOfExecutableButtons() {
     260      if (Content == null) {
     261        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
     262      } else {
     263        startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
     264        pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
     265        stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
     266        resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     267      }
    289268    }
    290269    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.Designer.cs

    r3299 r3454  
    5050      this.algorithmPanel = new System.Windows.Forms.Panel();
    5151      this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    52       this.saveAlgorithmButton = new System.Windows.Forms.Button();
    5352      this.openAlgorithmButton = new System.Windows.Forms.Button();
    5453      this.newAlgorithmButton = new System.Windows.Forms.Button();
     
    6160      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    6261      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    63       this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    6462      this.repetitionsLabel = new System.Windows.Forms.Label();
    6563      this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown();
     
    9997      //
    10098      this.algorithmTabPage.Controls.Add(this.algorithmPanel);
    101       this.algorithmTabPage.Controls.Add(this.saveAlgorithmButton);
    10299      this.algorithmTabPage.Controls.Add(this.openAlgorithmButton);
    103100      this.algorithmTabPage.Controls.Add(this.newAlgorithmButton);
     
    135132      this.algorithmViewHost.ViewType = null;
    136133      //
    137       // saveAlgorithmButton
    138       //
    139       this.saveAlgorithmButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    140       this.saveAlgorithmButton.Location = new System.Drawing.Point(66, 6);
    141       this.saveAlgorithmButton.Name = "saveAlgorithmButton";
    142       this.saveAlgorithmButton.Size = new System.Drawing.Size(24, 24);
    143       this.saveAlgorithmButton.TabIndex = 2;
    144       this.toolTip.SetToolTip(this.saveAlgorithmButton, "Save Problem");
    145       this.saveAlgorithmButton.UseVisualStyleBackColor = true;
    146       this.saveAlgorithmButton.Click += new System.EventHandler(this.saveAlgorithmButton_Click);
    147       //
    148134      // openAlgorithmButton
    149135      //
     
    252238      this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";
    253239      this.openFileDialog.Title = "Open Algorithm";
    254       //
    255       // saveFileDialog
    256       //
    257       this.saveFileDialog.DefaultExt = "hl";
    258       this.saveFileDialog.FileName = "Algorithm";
    259       this.saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";
    260       this.saveFileDialog.FilterIndex = 2;
    261       this.saveFileDialog.Title = "Save Algorithm";
    262240      //
    263241      // repetitionsLabel
     
    353331    private HeuristicLab.MainForm.WindowsForms.ViewHost algorithmViewHost;
    354332    private System.Windows.Forms.Button newAlgorithmButton;
    355     private System.Windows.Forms.Button saveAlgorithmButton;
    356333    private System.Windows.Forms.Button openAlgorithmButton;
    357334    private System.Windows.Forms.Button startButton;
     
    361338    private System.Windows.Forms.TextBox executionTimeTextBox;
    362339    private System.Windows.Forms.OpenFileDialog openFileDialog;
    363     private System.Windows.Forms.SaveFileDialog saveFileDialog;
    364340    private System.Windows.Forms.TabPage runsTabPage;
    365341    private System.Windows.Forms.Label repetitionsLabel;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r3416 r3454  
    7878      if (Content == null) {
    7979        repetitionsNumericUpDown.Value = 1;
    80         repetitionsNumericUpDown.Enabled = false;
    8180        algorithmViewHost.Content = null;
    8281        runsView.Content = null;
    83         tabControl.Enabled = false;
    84         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    8582        executionTimeTextBox.Text = "-";
    86         executionTimeTextBox.Enabled = false;
    8783      } else {
    8884        repetitionsNumericUpDown.Value = Content.Repetitions;
    89         repetitionsNumericUpDown.Enabled = true;
    90         saveAlgorithmButton.Enabled = Content.Algorithm != null;
    9185        algorithmViewHost.ViewType = null;
    9286        algorithmViewHost.Content = Content.Algorithm;
    9387        runsView.Content = Content.Runs;
    94         tabControl.Enabled = true;
    95         EnableDisableButtons();
    9688        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    97         executionTimeTextBox.Enabled = true;
    9889      }
    9990      SetEnableStateOfControls();
     
    10495    }
    10596    private void SetEnableStateOfControls() {
    106       repetitionsNumericUpDown.ReadOnly = ReadOnly;
     97      repetitionsNumericUpDown.Enabled = Content != null && !ReadOnly;
     98      newAlgorithmButton.Enabled = Content != null && !ReadOnly;
     99      openAlgorithmButton.Enabled = Content != null && !ReadOnly;
     100      algorithmViewHost.Enabled = Content != null;
    107101      algorithmViewHost.ReadOnly = ReadOnly;
     102      runsView.Enabled = Content != null;
    108103      runsView.ReadOnly = ReadOnly;
     104      executionTimeTextBox.Enabled = Content != null;
     105      SetEnabledStateOfExecutableButtons();
    109106    }
    110107
     
    121118        this.ReadOnly = Content.ExecutionState == ExecutionState.Started;
    122119        Locked = Content.ExecutionState == ExecutionState.Started;
    123         newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    124         EnableDisableButtons();
     120        SetEnabledStateOfExecutableButtons();
    125121      }
    126122    }
     
    143139        algorithmViewHost.ViewType = null;
    144140        algorithmViewHost.Content = Content.Algorithm;
    145         saveAlgorithmButton.Enabled = Content.Algorithm != null;
    146141      }
    147142    }
     
    182177      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    183178        this.Cursor = Cursors.AppStarting;
    184         newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = false;
     179        newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = false;
    185180        algorithmViewHost.Enabled = false;
    186181
     
    199194              Content.Algorithm = algorithm;
    200195            algorithmViewHost.Enabled = true;
    201             newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = true;
    202             this.Cursor = Cursors.Default;
    203           }));
    204         }, null);
    205       }
    206     }
    207     private void saveAlgorithmButton_Click(object sender, EventArgs e) {
    208       saveFileDialog.Title = "Save Algorithm";
    209       if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    210         this.Cursor = Cursors.AppStarting;
    211         newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = false;
    212         algorithmViewHost.Enabled = false;
    213 
    214         var call = new Action<IAlgorithm, string, int>(XmlGenerator.Serialize);
    215         int compression = 9;
    216         if (saveFileDialog.FilterIndex == 1) compression = 0;
    217         call.BeginInvoke(Content.Algorithm, saveFileDialog.FileName, compression, delegate(IAsyncResult a) {
    218           try {
    219             call.EndInvoke(a);
    220           }
    221           catch (Exception ex) {
    222             Auxiliary.ShowErrorMessageBox(ex);
    223           }
    224           Invoke(new Action(delegate() {
    225             algorithmViewHost.Enabled = true;
    226             newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = true;
     196            newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = true;
    227197            this.Cursor = Cursors.Default;
    228198          }));
     
    272242
    273243    #region Helpers
    274     private void EnableDisableButtons() {
    275       startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
    276       pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
    277       stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    278       resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     244    private void SetEnabledStateOfExecutableButtons() {
     245      if (Content == null) {
     246        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
     247      } else {
     248        startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
     249        pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
     250        stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
     251        resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     252      }
    279253    }
    280254    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r3361 r3454  
    5252      this.engineViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5353      this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
    54       this.saveOperatorGraphButton = new System.Windows.Forms.Button();
    5554      this.openOperatorGraphButton = new System.Windows.Forms.Button();
    5655      this.newOperatorGraphButton = new System.Windows.Forms.Button();
     
    9998      this.toolTip.SetToolTip(this.newProblemButton, "New Problem");
    10099      //
    101       // saveProblemButton
    102       //
    103       this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
    104       //
    105100      // openProblemButton
    106101      //
     
    228223      // operatorGraphTabPage
    229224      //
    230       this.operatorGraphTabPage.Controls.Add(this.saveOperatorGraphButton);
    231225      this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton);
    232226      this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton);
     
    238232      this.operatorGraphTabPage.Text = "Operator Graph";
    239233      this.operatorGraphTabPage.UseVisualStyleBackColor = true;
    240       //
    241       // saveOperatorGraphButton
    242       //
    243       this.saveOperatorGraphButton.Enabled = false;
    244       this.saveOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;
    245       this.saveOperatorGraphButton.Location = new System.Drawing.Point(63, 3);
    246       this.saveOperatorGraphButton.Name = "saveOperatorGraphButton";
    247       this.saveOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    248       this.saveOperatorGraphButton.TabIndex = 1;
    249       this.toolTip.SetToolTip(this.saveOperatorGraphButton, "Save Operator Graph");
    250       this.saveOperatorGraphButton.UseVisualStyleBackColor = true;
    251234      //
    252235      // openOperatorGraphButton
     
    328311    protected System.Windows.Forms.TabPage operatorGraphTabPage;
    329312    protected HeuristicLab.MainForm.WindowsForms.ViewHost operatorGraphViewHost;
    330     protected System.Windows.Forms.Button saveOperatorGraphButton;
    331313    protected System.Windows.Forms.Button openOperatorGraphButton;
    332314    protected System.Windows.Forms.Button newOperatorGraphButton;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r3423 r3454  
    8888      if (Content == null) {
    8989        engineViewHost.Content = null;
    90         createUserDefinedAlgorithmButton.Enabled = false;
    9190        operatorGraphViewHost.Content = null;
    9291      } else {
     
    9998        operatorGraphViewHost.ViewType = null;
    10099        operatorGraphViewHost.Content = Content.OperatorGraph;
    101         createUserDefinedAlgorithmButton.Enabled = true;
    102100      }
    103101      SetEnableStateOfControls();
     
    108106      SetEnableStateOfControls();
    109107    }
     108    protected override void OnLockedChanged() {
     109      base.OnLockedChanged();
     110      SetEnableStateOfControls();
     111    }
    110112    private void SetEnableStateOfControls() {
     113      engineViewHost.Enabled = Content != null;
    111114      engineViewHost.ReadOnly = ReadOnly;
    112       if (Content == null)
    113         engineComboBox.Enabled = false;
    114       else
    115         engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started;
     115      newOperatorGraphButton.Enabled = false;
     116      openOperatorGraphButton.Enabled = false;
     117      operatorGraphViewHost.Enabled = Content != null;
     118      engineComboBox.Enabled = Content != null && !ReadOnly;
     119      createUserDefinedAlgorithmButton.Enabled = Content != null && !Locked;
    116120    }
    117121
    118     protected override void Content_ExecutionStateChanged(object sender, EventArgs e) {
    119       if (InvokeRequired)
    120         Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    121       else {
    122         createUserDefinedAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    123         base.Content_ExecutionStateChanged(sender, e);
    124       }
    125     }
    126122    protected virtual void Content_EngineChanged(object sender, System.EventArgs e) {
    127123      if (InvokeRequired)
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs

    r3416 r3454  
    7272        optimizerListView.Content = null;
    7373        runsViewHost.Content = null;
    74         tabControl.Enabled = false;
    75         startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
    7674        executionTimeTextBox.Text = "-";
    77         executionTimeTextBox.Enabled = false;
    7875      } else {
    7976        optimizerListView.Content = Content.Optimizers;
    8077        runsViewHost.Content = Content.Runs;
    81         tabControl.Enabled = true;
    82         EnableDisableButtons();
    8378        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    84         executionTimeTextBox.Enabled = true;
    8579      }
    8680      SetEnableStateOfControls();
     
    9286    }
    9387    private void SetEnableStateOfControls() {
     88      optimizerListView.Enabled = Content != null;
    9489      optimizerListView.ReadOnly = ReadOnly;
     90      runsViewHost.Enabled = Content != null;
     91      runsViewHost.ReadOnly = ReadOnly;
     92      executionTimeTextBox.Enabled = Content != null;
     93      SetEnabledStateOfExecutableButtons();
    9594    }
    9695
     
    108107        descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    109108        Locked = Content.ExecutionState == ExecutionState.Started;
    110         EnableDisableButtons();
     109        SetEnabledStateOfExecutableButtons();
    111110      }
    112111    }
     
    148147
    149148    #region Helpers
    150     private void EnableDisableButtons() {
    151       startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
    152       pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
    153       stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    154       resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     149    private void SetEnabledStateOfExecutableButtons() {
     150      if (Content == null) {
     151        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
     152      } else {
     153        startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused);
     154        pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started;
     155        stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
     156        resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     157      }
    155158    }
    156159    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultView.cs

    r3362 r3454  
    104104    }
    105105    private void SetEnabledStateOfControls() {
    106       if (Content == null) {
    107         dataTypeTextBox.Enabled = false;
    108         valueGroupBox.Enabled = false;
    109         viewHost.Enabled = false;
    110       } else {
    111         dataTypeTextBox.Enabled = true;
    112         valueGroupBox.Enabled = true;
    113         viewHost.Enabled = true;
    114         viewHost.ReadOnly = ReadOnly;
    115       }
     106      dataTypeTextBox.Enabled = Content != null;
     107      viewHost.Enabled = Content != null;
     108      viewHost.ReadOnly = ReadOnly;
    116109    }
    117110
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r3449 r3454  
    6969      this.chart.ChartAreas[0].CursorX.Interval = 0;
    7070      this.chart.ChartAreas[0].CursorY.Interval = 0;
    71 
    72       base.ReadOnly = true;
    7371    }
    7472
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3432 r3454  
    8282      SetEnabledStateOfControls();
    8383    }
     84    protected override void OnLockedChanged() {
     85      base.OnLockedChanged();
     86      SetEnabledStateOfControls();
     87    }
    8488    private void SetEnabledStateOfControls() {
    85       if (Content == null) {
    86         parametersResultsGroupBox.Enabled = false;
    87         viewHost.Enabled = false;
    88       } else {
    89         parametersResultsGroupBox.Enabled = true;
    90         viewHost.Enabled = true;
    91         viewHost.ReadOnly = ReadOnly;
    92       }
     89      listView.Enabled = Content != null;
     90      viewHost.Enabled = Content != null;
     91      viewHost.ReadOnly = ReadOnly;
     92      showAlgorithmButton.Enabled = Content != null && !Locked;
    9393    }
    9494
     
    147147    }
    148148    private void showAlgorithmButton_Click(object sender, EventArgs e) {
    149       IContentView view = MainFormManager.CreateDefaultView(Content.Algorithm.Clone());
    150       if (view != null) {
    151         view.ReadOnly = ReadOnly;
    152         view.Locked = Locked;
    153         view.Show();
     149      if (!Locked) {
     150        IContentView view = MainFormManager.CreateDefaultView(Content.Algorithm.Clone());
     151        if (view != null) {
     152          view.ReadOnly = ReadOnly;
     153          view.Locked = Locked;
     154          view.Show();
     155        }
    154156      }
    155157    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs

    r3361 r3454  
    7979      this.toolTip.SetToolTip(this.newProblemButton, "New Problem");
    8080      //
    81       // saveProblemButton
    82       //
    83       this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");
    84       //
    8581      // openProblemButton
    8682      //
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs

    r3376 r3454  
    6969    }
    7070    private void SetEnableStateOfControls() {
     71      globalScopeView.Enabled = Content != null;
    7172      globalScopeView.ReadOnly = ReadOnly;
     73      newOperatorGraphButton.Enabled = Content != null && !ReadOnly;
     74      openOperatorGraphButton.Enabled = Content != null && !ReadOnly;
    7275      operatorGraphViewHost.ReadOnly = ReadOnly;
    73       if (Content == null)
    74         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
    75       else
    76         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    7776    }
    7877
     
    8483      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    8584        this.Cursor = Cursors.AppStarting;
    86         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
     85        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = false;
    8786        operatorGraphViewHost.Enabled = false;
    8887
     
    102101              Content.OperatorGraph = operatorGraph;
    103102            operatorGraphViewHost.Enabled = true;
    104             newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;
    105             this.Cursor = Cursors.Default;
    106           }));
    107         }, null);
    108       }
    109     }
    110     private void saveOperatorGraphButton_Click(object sender, EventArgs e) {
    111       saveFileDialog.Title = "Save Operator Graph";
    112       if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    113         this.Cursor = Cursors.AppStarting;
    114         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
    115         operatorGraphViewHost.Enabled = false;
    116 
    117         var call = new Action<OperatorGraph, string, int>(XmlGenerator.Serialize);
    118         int compression = 9;
    119         if (saveFileDialog.FilterIndex == 1) compression = 0;
    120         call.BeginInvoke(Content.OperatorGraph, saveFileDialog.FileName, compression, delegate(IAsyncResult a) {
    121           try {
    122             call.EndInvoke(a);
    123           }
    124           catch (Exception ex) {
    125             Auxiliary.ShowErrorMessageBox(ex);
    126           }
    127           Invoke(new Action(delegate() {
    128             operatorGraphViewHost.Enabled = true;
    129             newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;
     103            newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = true;
    130104            this.Cursor = Cursors.Default;
    131105          }));
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt.Views/3.3/AntTrailView.cs

    r3239 r3454  
    6060      if (Content == null) {
    6161        pictureBox.Image = null;
    62         pictureBox.Enabled = false;
    6362      } else {
    64         pictureBox.Enabled = true;
    6563        GenerateImage();
    6664      }
     65      SetEnabledStateOfControls();
     66    }
     67
     68    protected override void OnReadOnlyChanged() {
     69      base.OnReadOnlyChanged();
     70      SetEnabledStateOfControls();
     71    }
     72
     73    private void SetEnabledStateOfControls() {
     74      pictureBox.Enabled = Content != null;
     75      playButton.Enabled = Content != null && !ReadOnly;
    6776    }
    6877
    6978    private void GenerateImage() {
    70       playButton.Enabled = this.Enabled;
     79      playButton.Enabled = this.Enabled && !ReadOnly;
    7180      animationTimer.Stop();
    7281      if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
     
    219228        } else {
    220229          animationTimer.Stop();
    221           playButton.Enabled = this.Enabled;
     230          playButton.Enabled = this.Enabled && !ReadOnly;
    222231        }
    223232      }
     
    226235
    227236    private void AntTrailView_EnabledChanged(object sender, EventArgs e) {
    228       if (this.Enabled) playButton.Enabled = true;
     237      if (this.Enabled) playButton.Enabled = !ReadOnly;
    229238      else playButton.Enabled = false;
    230239    }
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/PathTSPTourView.cs

    r3213 r3454  
    7070      if (Content == null) {
    7171        pictureBox.Image = null;
    72         pictureBox.Enabled = false;
    7372      } else {
    74         pictureBox.Enabled = true;
    7573        GenerateImage();
    7674      }
     75      SetEnabledStateOfControls();
     76    }
     77
     78    protected override void OnReadOnlyChanged() {
     79      base.OnReadOnlyChanged();
     80      SetEnabledStateOfControls();
     81    }
     82
     83    private void SetEnabledStateOfControls() {
     84      pictureBox.Enabled = Content != null;
    7785    }
    7886
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs

    r3376 r3454  
    7171      if (Content == null) {
    7272        parameterCollectionView.Content = null;
    73         parameterCollectionView.Enabled = false;
    7473        pathTSPTourView.Content = null;
    75         pathTSPTourView.Enabled = false;
    76         importButton.Enabled = false;
    7774      } else {
    7875        parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
    79         parameterCollectionView.Enabled = true;
    8076        pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution);
    81         pathTSPTourView.Enabled = true;
    82         importButton.Enabled = true;
    8377      }
     78      SetEnabledStateOfControls();
     79    }
     80
     81    protected override void OnReadOnlyChanged() {
     82      base.OnReadOnlyChanged();
     83      SetEnabledStateOfControls();
     84    }
     85
     86    private void SetEnabledStateOfControls() {
     87      parameterCollectionView.Enabled = Content != null;
     88      parameterCollectionView.ReadOnly = ReadOnly;
     89      pathTSPTourView.Enabled = Content != null;
     90      pathTSPTourView.ReadOnly = ReadOnly;
     91      importButton.Enabled = Content != null && !ReadOnly;
    8492    }
    8593
Note: See TracChangeset for help on using the changeset viewer.