Changeset 13014


Ignore:
Timestamp:
10/15/15 16:41:12 (4 years ago)
Author:
jkarder
Message:

#2116: added new breadcrumb navigation prototype

Location:
trunk/sources
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r11623 r13014  
    123123  <ItemGroup>
    124124    <None Include="Plugin.cs.frame" />
     125    <Compile Include="BreadcrumbViewHost.cs">
     126      <SubType>UserControl</SubType>
     127    </Compile>
     128    <Compile Include="BreadcrumbViewHost.Designer.cs">
     129      <DependentUpon>BreadcrumbViewHost.cs</DependentUpon>
     130    </Compile>
    125131    <Compile Include="CheckedItemCollectionView.cs">
    126132      <SubType>UserControl</SubType>
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r12618 r13014  
    277277        T item = itemsListView.SelectedItems[0].Tag as T;
    278278        if (item != null) {
    279           IContentView view = MainFormManager.MainForm.ShowContent(item);
    280           if (view != null) {
    281             view.ReadOnly = ReadOnly;
    282             view.Locked = Locked;
     279          Control c = this;
     280          BreadcrumbViewHost bcvh;
     281
     282          do {
     283            c = c.Parent;
     284            bcvh = c as BreadcrumbViewHost;
     285          } while ((bcvh == null || !bcvh.EnableBreadcrumbs) && c != null);
     286
     287          if (bcvh != null) {
     288            bcvh.AddBreadcrumbs(bcvh.Content);
     289            bcvh.AddBreadcrumbs(item);
     290            bcvh.Content = item;
     291            bcvh.ReadOnly = ReadOnly;
     292            bcvh.Locked = Locked;
     293          } else {
     294            IContentView view = MainFormManager.MainForm.ShowContent(item);
     295            if (view != null) {
     296              view.ReadOnly = ReadOnly;
     297              view.Locked = Locked;
     298            }
    283299          }
    284300        }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ParameterCollectionView.cs

    r12012 r13014  
    2727using HeuristicLab.Collections;
    2828using HeuristicLab.MainForm;
     29using HeuristicLab.MainForm.WindowsForms;
    2930
    3031namespace HeuristicLab.Core.Views {
     
    154155        IParameter item = itemsListView.SelectedItems[0].Tag as IParameter;
    155156        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;
     157          Control c = this;
     158          BreadcrumbViewHost bcvh;
     159
     160          do {
     161            c = c.Parent;
     162            bcvh = c as BreadcrumbViewHost;
     163          } while ((bcvh == null || !bcvh.EnableBreadcrumbs) && c != null);
     164
     165          if (bcvh != null) {
     166            bcvh.AddBreadcrumbs(bcvh.Content);
     167            bcvh.AddBreadcrumbs(item);
     168            bcvh.Content = item;
     169            bcvh.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
     170            bcvh.Locked = Locked;
     171          } else {
     172            IContentView view = MainFormManager.MainForm.ShowContent(item);
     173            if (view != null) {
     174              view.ReadOnly = ReadOnly || (item.Hidden && !AllowEditingOfHiddenParameters);
     175              view.Locked = Locked;
     176            }
    160177          }
    161178        }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ParameterizedNamedItemView.Designer.cs

    r12012 r13014  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
     47      this.parameterCollectionView = new HeuristicLab.Core.Views.BreadcrumbViewHost();
    4848      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4949      this.SuspendLayout();
     
    7272      this.parameterCollectionView.Size = new System.Drawing.Size(490, 327);
    7373      this.parameterCollectionView.TabIndex = 3;
     74      this.parameterCollectionView.ViewsLabelVisible = false;
    7475      //
    7576      // ParameterizedNamedItemView
     
    9293    #endregion
    9394
    94     protected ParameterCollectionView parameterCollectionView;
     95    protected HeuristicLab.Core.Views.BreadcrumbViewHost parameterCollectionView;
    9596
    9697  }
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.Designer.cs

    r12012 r13014  
    129129    #endregion
    130130
    131     private System.Windows.Forms.Label viewsLabel;
     131    protected System.Windows.Forms.Label viewsLabel;
    132132    private System.Windows.Forms.Label messageLabel;
    133133    private System.Windows.Forms.ToolTip toolTip;
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs

    r12012 r13014  
    2929namespace HeuristicLab.MainForm.WindowsForms {
    3030  [Content(typeof(IContent))]
    31   public sealed partial class ViewHost : AsynchronousContentView {
     31  public partial class ViewHost : AsynchronousContentView {
    3232    public ViewHost() {
    3333      InitializeComponent();
     
    9393            if (view != null) {
    9494              view.Visible = true;
    95               if (ViewsLabelVisible) {
    96                 view.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
    97                 view.Size = new Size(Width - this.viewsLabel.Width - this.viewsLabel.Margin.Left - this.viewsLabel.Margin.Right, this.Height);
    98               } else view.Dock = DockStyle.Fill;
     95              ConfigureViewLayout(view);
    9996              if (!Controls.Contains((view))) Controls.Add(view);
    10097              view.OnShown(new ViewShownEventArgs(view, false));
     
    108105        }
    109106      }
     107    }
     108
     109    protected virtual void ConfigureViewLayout(View view) {
     110      if (ViewsLabelVisible) {
     111        view.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
     112        view.Size = new Size(Width - viewsLabel.Width - viewsLabel.Margin.Left - viewsLabel.Margin.Right, Height);
     113      } else view.Dock = DockStyle.Fill;
    110114    }
    111115
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.Designer.cs

    r12012 r13014  
    6161      this.selectButton = new System.Windows.Forms.Button();
    6262      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
    63       this.detailsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     63      this.detailsViewHost = new HeuristicLab.Core.Views.BreadcrumbViewHost();
    6464      this.buttonToolTip = new System.Windows.Forms.ToolTip(this.components);
    6565      this.shapeContextMenu.SuspendLayout();
     
    235235                  | System.Windows.Forms.AnchorStyles.Right)));
    236236      this.detailsViewHost.Content = null;
     237      this.detailsViewHost.EnableBreadcrumbs = true;
    237238      this.detailsViewHost.Location = new System.Drawing.Point(3, 16);
    238239      this.detailsViewHost.Name = "detailsViewHost";
     
    270271    private System.Windows.Forms.SplitContainer splitContainer;
    271272    private System.Windows.Forms.GroupBox detailsGroupBox;
    272     private HeuristicLab.MainForm.WindowsForms.ViewHost detailsViewHost;
     273    private HeuristicLab.Core.Views.BreadcrumbViewHost detailsViewHost;
    273274    private System.Windows.Forms.Button selectButton;
    274275    private System.Windows.Forms.Button zoomOutButton;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.cs

    r12012 r13014  
    2525using System.Windows.Forms;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Core.Views;
    2728using HeuristicLab.MainForm;
    2829using HeuristicLab.MainForm.WindowsForms;
     
    140141          if (shapeInfo != null) {
    141142            IOperator op = this.VisualizationInfo.GetOperatorForShapeInfo(shapeInfo);
    142             IContentView view = MainFormManager.MainForm.ShowContent(op);
    143             if (view != null) {
    144               view.ReadOnly = this.ReadOnly;
    145               view.Locked = this.Locked;
     143            AlgorithmOperator algOp = op as AlgorithmOperator;
     144
     145            Control c = this;
     146            BreadcrumbViewHost vh;
     147
     148            do {
     149              c = c.Parent;
     150              vh = c as BreadcrumbViewHost;
     151            } while ((vh == null || !vh.EnableBreadcrumbs) && c != null);
     152
     153            if (algOp != null && vh != null) {
     154              vh.AddBreadcrumbs(vh.Content);
     155              vh.AddBreadcrumb(algOp.Name, algOp.OperatorGraph);
     156              vh.Content = algOp.OperatorGraph;
     157              vh.ReadOnly = ReadOnly;
     158              vh.Locked = Locked;
     159            } else {
     160              IContentView view = MainFormManager.MainForm.ShowContent(op);
     161              if (view != null) {
     162                view.ReadOnly = ReadOnly;
     163                view.Locked = Locked;
     164              }
    146165            }
     166
    147167            HandledMouseEventArgs eventArgs = e as HandledMouseEventArgs;
    148168            if (eventArgs != null)
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/Plugin.cs.frame

    r12753 r13014  
    2929  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3030  [PluginDependency("HeuristicLab.Core", "3.3")]
     31  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
    3132  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3233  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3334  [PluginDependency("HeuristicLab.Netron", "3.0")]
     35  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3436  [PluginDependency("HeuristicLab.Operators.Views.GraphVisualization", "3.3")]
    3537  public class HeuristicLabOperatorsViewsGraphVisualizationViewsPlugin : PluginBase {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs

    r12012 r13014  
    4141      this.newProblemButton = new System.Windows.Forms.Button();
    4242      this.parametersTabPage = new System.Windows.Forms.TabPage();
    43       this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
     43      this.parameterCollectionView = new HeuristicLab.Core.Views.BreadcrumbViewHost();
    4444      this.resultsTabPage = new System.Windows.Forms.TabPage();
    4545      this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();
     
    179179      // parameterCollectionView
    180180      //
    181       this.parameterCollectionView.AllowEditingOfHiddenParameters = true;
    182181      this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    183182            | System.Windows.Forms.AnchorStyles.Left)
     
    185184      this.parameterCollectionView.Caption = "ParameterCollection View";
    186185      this.parameterCollectionView.Content = null;
     186      this.parameterCollectionView.EnableBreadcrumbs = true;
    187187      this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);
    188188      this.parameterCollectionView.Name = "parameterCollectionView";
     
    190190      this.parameterCollectionView.Size = new System.Drawing.Size(659, 388);
    191191      this.parameterCollectionView.TabIndex = 0;
     192      this.parameterCollectionView.ViewsLabelVisible = false;
    192193      //
    193194      // resultsTabPage
     
    297298    protected System.Windows.Forms.TabPage parametersTabPage;
    298299    protected System.Windows.Forms.TabPage problemTabPage;
    299     protected HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
     300    protected HeuristicLab.Core.Views.BreadcrumbViewHost parameterCollectionView;
    300301    protected HeuristicLab.MainForm.WindowsForms.ViewHost problemViewHost;
    301302    protected System.Windows.Forms.Button newProblemButton;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r12012 r13014  
    8888      } else {
    8989        parameterCollectionView.Content = Content.Parameters;
     90        var view = parameterCollectionView.ActiveView as ParameterCollectionView;
     91        if (view != null) view.AllowEditingOfHiddenParameters = true;
    9092        problemViewHost.ViewType = null;
    9193        problemViewHost.Content = Content.Problem;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r12012 r13014  
    5050      this.engineViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5151      this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
    52       this.openOperatorGraphButton = new System.Windows.Forms.Button();
    53       this.newOperatorGraphButton = new System.Windows.Forms.Button();
    54       this.operatorGraphViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     52      this.operatorGraphViewHost = new HeuristicLab.Core.Views.BreadcrumbViewHost();
    5553      this.tabControl.SuspendLayout();
    5654      this.parametersTabPage.SuspendLayout();
     
    219217      // operatorGraphTabPage
    220218      //
    221       this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton);
    222       this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton);
    223219      this.operatorGraphTabPage.Controls.Add(this.operatorGraphViewHost);
    224220      this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22);
     
    229225      this.operatorGraphTabPage.UseVisualStyleBackColor = true;
    230226      //
    231       // openOperatorGraphButton
    232       //
    233       this.openOperatorGraphButton.Enabled = false;
    234       this.openOperatorGraphButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open;
    235       this.openOperatorGraphButton.Location = new System.Drawing.Point(33, 3);
    236       this.openOperatorGraphButton.Name = "openOperatorGraphButton";
    237       this.openOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    238       this.openOperatorGraphButton.TabIndex = 1;
    239       this.toolTip.SetToolTip(this.openOperatorGraphButton, "Open Operator Graph");
    240       this.openOperatorGraphButton.UseVisualStyleBackColor = true;
    241       //
    242       // newOperatorGraphButton
    243       //
    244       this.newOperatorGraphButton.Enabled = false;
    245       this.newOperatorGraphButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument;
    246       this.newOperatorGraphButton.Location = new System.Drawing.Point(3, 3);
    247       this.newOperatorGraphButton.Name = "newOperatorGraphButton";
    248       this.newOperatorGraphButton.Size = new System.Drawing.Size(24, 24);
    249       this.newOperatorGraphButton.TabIndex = 1;
    250       this.toolTip.SetToolTip(this.newOperatorGraphButton, "New Operator Graph");
    251       this.newOperatorGraphButton.UseVisualStyleBackColor = true;
    252       //
    253227      // operatorGraphViewHost
    254228      //
     
    258232      this.operatorGraphViewHost.Caption = "View";
    259233      this.operatorGraphViewHost.Content = null;
     234      this.operatorGraphViewHost.EnableBreadcrumbs = true;
    260235      this.operatorGraphViewHost.Enabled = false;
    261       this.operatorGraphViewHost.Location = new System.Drawing.Point(3, 33);
     236      this.operatorGraphViewHost.Location = new System.Drawing.Point(6, 6);
    262237      this.operatorGraphViewHost.Name = "operatorGraphViewHost";
    263238      this.operatorGraphViewHost.ReadOnly = true;
    264       this.operatorGraphViewHost.Size = new System.Drawing.Size(699, 431);
     239      this.operatorGraphViewHost.ShowSingle = true;
     240      this.operatorGraphViewHost.Size = new System.Drawing.Size(693, 455);
    265241      this.operatorGraphViewHost.TabIndex = 0;
    266242      this.operatorGraphViewHost.ViewsLabelVisible = true;
     
    295271    protected HeuristicLab.MainForm.WindowsForms.ViewHost engineViewHost;
    296272    protected System.Windows.Forms.TabPage operatorGraphTabPage;
    297     protected HeuristicLab.MainForm.WindowsForms.ViewHost operatorGraphViewHost;
    298     protected System.Windows.Forms.Button openOperatorGraphButton;
    299     protected System.Windows.Forms.Button newOperatorGraphButton;
     273    protected HeuristicLab.Core.Views.BreadcrumbViewHost operatorGraphViewHost;
    300274
    301275  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r12012 r13014  
    9595      base.SetEnabledStateOfControls();
    9696      engineViewHost.Enabled = Content != null;
    97       newOperatorGraphButton.Enabled = false;
    98       openOperatorGraphButton.Enabled = false;
    9997      operatorGraphViewHost.Enabled = Content != null;
    10098      operatorGraphViewHost.ReadOnly = true;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ProblemView.Designer.cs

    r12012 r13014  
    5858      // parameterCollectionView
    5959      //
     60      this.parameterCollectionView.EnableBreadcrumbs = true;
    6061      this.parameterCollectionView.Location = new System.Drawing.Point(6, 27);
    6162      this.parameterCollectionView.Size = new System.Drawing.Size(501, 303);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs

    r12012 r13014  
    6565      //
    6666      this.engineViewHost.Size = new System.Drawing.Size(693, 402);
    67       //
    68       // openOperatorGraphButton
    69       //
    70       this.toolTip.SetToolTip(this.openOperatorGraphButton, "Open Operator Graph");
    71       this.openOperatorGraphButton.Click += new System.EventHandler(openOperatorGraphButton_Click);
    72       //
    73       // newOperatorGraphButton
    74       //
    75       this.toolTip.SetToolTip(this.newOperatorGraphButton, "New Operator Graph");
    76       this.newOperatorGraphButton.Click += new System.EventHandler(newOperatorGraphButton_Click);
    7767      //
    7868      // tabControl
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs

    r12012 r13014  
    5757      base.SetEnabledStateOfControls();
    5858      globalScopeView.Enabled = Content != null;
    59       newOperatorGraphButton.Enabled = Content != null && !ReadOnly;
    60       openOperatorGraphButton.Enabled = Content != null && !ReadOnly;
    6159      operatorGraphViewHost.ReadOnly = Content == null || ReadOnly;
    62     }
    63 
    64     private void newOperatorGraphButton_Click(object sender, EventArgs e) {
    65       Content.OperatorGraph = new OperatorGraph();
    66     }
    67     private void openOperatorGraphButton_Click(object sender, EventArgs e) {
    68       openFileDialog.Title = "Open Operator Graph";
    69       if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
    70         newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = false;
    71         operatorGraphViewHost.Enabled = false;
    72 
    73         ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) {
    74           try {
    75             if (error != null) throw error;
    76             OperatorGraph operatorGraph = content as OperatorGraph;
    77             if (operatorGraph == null)
    78               MessageBox.Show(this, "The selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);
    79             else
    80               Content.OperatorGraph = operatorGraph;
    81           }
    82           catch (Exception ex) {
    83             ErrorHandling.ShowErrorDialog(this, ex);
    84           }
    85           finally {
    86             Invoke(new Action(delegate() {
    87               operatorGraphViewHost.Enabled = true;
    88               newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = true;
    89             }));
    90           }
    91         });
    92       }
    9360    }
    9461  }
Note: See TracChangeset for help on using the changeset viewer.