Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10103 for branches/Breadcrumbs


Ignore:
Timestamp:
11/04/13 10:15:31 (11 years ago)
Author:
jkarder
Message:

#2116:

  • fixed issues within the outermost control detection
  • fixed visible property assignment of the breadcrumb control in ViewHost
Location:
branches/Breadcrumbs
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemCollectionView.Designer.cs

    r9456 r10103  
    180180      this.viewHost.Caption = "View";
    181181      this.viewHost.Content = null;
     182      this.viewHost.IsValidOutermostViewhost = false;
    182183      this.viewHost.Location = new System.Drawing.Point(6, 19);
    183184      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r10093 r10103  
    225225        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    226226        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this, true);
    227         if (!outermostViewHost.HotlinkingEnabled) {
     227        if (outermostViewHost == null || !outermostViewHost.HotlinkingEnabled) {
    228228          if (showDetailsCheckBox.Checked) {
    229229            detailsGroupBox.Enabled = true;
     
    252252        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    253253        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this);
    254         outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    255         outermostViewHost.ActiveView.Locked = Locked;
     254        if (outermostViewHost != null) {
     255          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     256          outermostViewHost.ActiveView.Locked = Locked;
     257        }
    256258      }
    257259    }
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemListView.Designer.cs

    r9456 r10103  
    193193      this.viewHost.Caption = "View";
    194194      this.viewHost.Content = null;
     195      this.viewHost.IsValidOutermostViewhost = false;
    195196      this.viewHost.Location = new System.Drawing.Point(6, 19);
    196197      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r10093 r10103  
    246246        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    247247        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this, true);
    248         if (outermostViewHost.HotlinkingEnabled) {
     248        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
    249249          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    250250          outermostViewHost.ActiveView.Locked = Locked;
     
    275275        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    276276        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this);
    277         outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    278         outermostViewHost.ActiveView.Locked = Locked;
     277        if (outermostViewHost != null) {
     278          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     279          outermostViewHost.ActiveView.Locked = Locked;
     280        }
    279281      }
    280282    }
  • branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ParameterCollectionView.cs

    r10093 r10103  
    154154        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    155155        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this, true);
    156         if (outermostViewHost.HotlinkingEnabled) {
     156        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
    157157          outermostViewHost.ActiveView.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
    158158          outermostViewHost.ActiveView.Locked = Locked;
     
    173173        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    174174        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this);
    175         outermostViewHost.ActiveView.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
    176         outermostViewHost.ActiveView.Locked = Locked;
     175        if (outermostViewHost != null) {
     176          outermostViewHost.ActiveView.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
     177          outermostViewHost.ActiveView.Locked = Locked;
     178        }
    177179      }
    178180    }
  • branches/Breadcrumbs/HeuristicLab.MainForm.WindowsForms/3.3/Controls/BreadcrumbControl.cs

    r10093 r10103  
    129129        breadcrumbs.RemoveLast();
    130130      var mainForm = MainFormManager.GetMainForm<MainForm>();
    131       var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(ViewHost);
     131      var outermostViewHost = mainForm.GetOutermostControlOfType<ViewHost>(ViewHost);
    132132      bool showBreadcrumbs = outermostViewHost.ShowBreadcrumbs;
    133133      outermostViewHost.Content = null;
  • branches/Breadcrumbs/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs

    r10093 r10103  
    2222using System;
    2323using System.Collections.Generic;
     24using System.ComponentModel;
    2425using System.Drawing;
    2526using System.Linq;
     
    4142      viewsLabel.Visible = false;
    4243      viewsLabelVisible = true;
     44      IsValidOutermostViewhost = true;
    4345
    4446      breadcrumbControl.ViewHost = this;
     
    5961
    6062    public bool HotlinkingEnabled { get; set; }
     63
     64    [DefaultValue(true)]
     65    public bool IsValidOutermostViewhost { get; set; }
    6166
    6267    private IContentView cachedView;
     
    132137    }
    133138
    134     private bool isOutermostViewHost;
    135139    public IEnumerable<IContent> Breadcrumbs { get { return breadcrumbControl.Breadcrumbs; } }
    136140
     
    281285
    282286    private void UpdateBreadcrumbControl() {
    283       breadcrumbControl.Visible = ShowBreadcrumbs;
     287      breadcrumbControl.Visible = ShowBreadcrumbs && Content != null;
    284288      if (ShowBreadcrumbs)
    285289        UpdateBreadcrumbTrail(breadcrumbControl.Breadcrumbs, BuildBreadcrumbTrail());
     
    378382
    379383    private void PerformOutermostViewHostDetection() {
     384      if (!IsValidOutermostViewhost) return;
    380385      var mainForm = MainFormManager.GetMainForm<MainForm>();
    381       if (mainForm == null) return;
    382       var outermostViewHost = mainForm.GetOutermostViewOfType<ViewHost>(this);
    383       isOutermostViewHost = outermostViewHost == this;
    384       viewContextMenuStrip.ShowBreadcrumbsToolStripMenuItem.Checked = isOutermostViewHost;
     386      if (mainForm == null) return; // needed for designer
     387      var outermostViewHost = mainForm.GetOutermostControlOfType<ViewHost>(this);
     388      viewContextMenuStrip.ShowBreadcrumbsToolStripMenuItem.Checked = outermostViewHost == this;
    385389    }
    386390    #endregion
  • branches/Breadcrumbs/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r10093 r10103  
    223223    }
    224224
    225     public T GetOutermostViewOfType<T>(Control childControl) where T : class, IView {
     225    public T GetOutermostControlOfType<T>(Control childControl) where T : Control {
    226226      if (childControl == null) throw new ArgumentNullException("childControl", "ChildControl cannot be null.");
    227227
    228       T outermostView = null;
     228      T outermostControl = null;
    229229      for (var control = childControl; control != null; control = control.Parent) {
    230         var vh = control as T;
    231         if (vh != null) outermostView = vh;
    232       }
    233       return outermostView;
     230        var c = control as T;
     231        if (c != null) outermostControl = c;
     232      }
     233      return outermostControl;
    234234    }
    235235
     
    279279      if (childControl == null) throw new ArgumentNullException("childControl", "ChildControl cannot be null.");
    280280
    281       var outermostViewHost = GetOutermostViewOfType<ViewHost>(childControl);
    282       if (outermostViewHost == null)
    283         throw new ArgumentException("No outermost ViewHost could be found for the specified child control.", "childControl");
     281      var outermostViewHost = GetOutermostControlOfType<ViewHost>(childControl);
     282      if (outermostViewHost == null) return null;
    284283
    285284      if (!requireHotlinking || outermostViewHost.HotlinkingEnabled) {
  • branches/Breadcrumbs/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.Designer.cs

    r9456 r10103  
    235235                  | System.Windows.Forms.AnchorStyles.Right)));
    236236      this.detailsViewHost.Content = null;
     237      this.detailsViewHost.IsValidOutermostViewhost = false;
    237238      this.detailsViewHost.Location = new System.Drawing.Point(3, 16);
    238239      this.detailsViewHost.Name = "detailsViewHost";
  • branches/Breadcrumbs/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.cs

    r10093 r10103  
    142142            var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    143143            var outermostViewHost = mainForm.ShowContentInOutermostViewHost(op, this);
    144             outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    145             outermostViewHost.ActiveView.Locked = Locked;
     144            if (outermostViewHost != null) {
     145              outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     146              outermostViewHost.ActiveView.Locked = Locked;
     147            }
    146148            HandledMouseEventArgs eventArgs = e as HandledMouseEventArgs;
    147149            if (eventArgs != null)
     
    196198        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    197199        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(op, this);
    198         outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    199         outermostViewHost.ActiveView.Locked = Locked;
     200        if (outermostViewHost != null) {
     201          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     202          outermostViewHost.ActiveView.Locked = Locked;
     203        }
    200204      }
    201205    }
  • branches/Breadcrumbs/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.Designer.cs

    r9456 r10103  
    216216      this.viewHost.Caption = "View";
    217217      this.viewHost.Content = null;
     218      this.viewHost.IsValidOutermostViewhost = false;
    218219      this.viewHost.Location = new System.Drawing.Point(6, 19);
    219220      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs

    r10093 r10103  
    245245        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    246246        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this, true);
    247         if (outermostViewHost.HotlinkingEnabled) {
     247        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
    248248          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    249249          outermostViewHost.ActiveView.Locked = Locked;
     
    276276        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    277277        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this);
    278         outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    279         outermostViewHost.ActiveView.Locked = Locked;
     278        if (outermostViewHost != null) {
     279          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     280          outermostViewHost.ActiveView.Locked = Locked;
     281        }
    280282      }
    281283    }
  • branches/Breadcrumbs/HeuristicLab.Optimization.Views/3.3/RunView.Designer.cs

    r9456 r10103  
    178178      this.viewHost.Content = null;
    179179      this.viewHost.Enabled = false;
     180      this.viewHost.IsValidOutermostViewhost = false;
    180181      this.viewHost.Location = new System.Drawing.Point(6, 19);
    181182      this.viewHost.Name = "viewHost";
  • branches/Breadcrumbs/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r10093 r10103  
    132132        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    133133        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this, true);
    134         if (outermostViewHost.HotlinkingEnabled) {
     134        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
    135135          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    136136          outermostViewHost.ActiveView.Locked = Locked;
     
    151151        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    152152        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this);
    153         outermostViewHost.ActiveView.ReadOnly = ReadOnly;
    154         outermostViewHost.ActiveView.Locked = Locked;
     153        if (outermostViewHost != null) {
     154          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
     155          outermostViewHost.ActiveView.Locked = Locked;
     156        }
    155157      }
    156158    }
Note: See TracChangeset for help on using the changeset viewer.