Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3795


Ignore:
Timestamp:
05/12/10 14:05:05 (15 years ago)
Author:
mkommend
Message:

fixed enabled state of play button in AntTrailView (ticket #893)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.cs

    r3730 r3795  
    6666          }
    6767          ActiveViewChanged();
    68           OnViewTypeChanged();
    6968        }
    7069      }
     
    109108
    110109        Type defaultViewType = MainFormManager.GetDefaultViewType(Content.GetType());
    111         if (!ViewCanShowContent(viewType, Content) || defaultViewType != this.ViewType) {
     110        if (!ViewCanShowContent(viewType, Content)) {
    112111          cachedViews.Clear();
    113           ViewType = defaultViewType;
    114           if ((viewType == null) && (viewContextMenuStrip.Items.Count > 0))  // create first available view if default view is not available
    115             ViewType = (Type)viewContextMenuStrip.Items[0].Tag;
     112          if (defaultViewType == null) {
     113            if (viewContextMenuStrip.Items.Count > 0)  // create first available view if default view is not available
     114              ViewType = (Type)viewContextMenuStrip.Items[0].Tag;
     115          } else if (defaultViewType != this.ViewType)
     116            ViewType = defaultViewType;
    116117        }
    117118        UpdateActiveMenuItem();
     
    242243
    243244    private void viewsLabel_DoubleClick(object sender, EventArgs e) {
    244       IContentView view = MainFormManager.GetMainForm<MainForm>().ShowContent(this.Content,this.ViewType);
     245      IContentView view = MainFormManager.GetMainForm<MainForm>().ShowContent(this.Content, this.ViewType);
    245246      if (view != null) {
    246247        view.ReadOnly = this.ReadOnly;
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt.Views/3.3/AntTrailView.cs

    r3566 r3795  
    5353    protected override void OnContentChanged() {
    5454      base.OnContentChanged();
    55       if (Content == null) {
    56         pictureBox.Image = null;
    57       } else {
    58         GenerateImage();
    59       }
     55      this.playButton.Enabled = Content != null && !Locked;
     56      GenerateImage();
    6057    }
    6158
    6259    protected override void OnLockedChanged() {
    63       this.playButton.Enabled = !Locked;
     60      this.playButton.Enabled = Content != null && !Locked;
    6461      base.OnLockedChanged();
    6562    }
     
    6764    private void GenerateImage() {
    6865      animationTimer.Stop();
     66      pictureBox.Image = null;
    6967      if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
    70         if (Content == null) {
    71           pictureBox.Image = null;
    72           playButton.Enabled = false;
    73         } else {
     68        if (Content != null) {
    7469          var nodeStack = new Stack<SymbolicExpressionTreeNode>();
    7570          int rows = Content.World.Rows;
Note: See TracChangeset for help on using the changeset viewer.