Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/27/11 02:37:02 (13 years ago)
Author:
swagner
Message:

Added information icon in VariableValueView and ResultValueView, corrected tooltip update in NamedItemCollectionView and reverted changes of r6631 (#1054).

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultValueView.Designer.cs

    r5875 r7235  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     49      this.infoLabel = new System.Windows.Forms.Label();
     50      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    4851      this.SuspendLayout();
    4952      //
    5053      // viewHost
    5154      //
     55      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     56            | System.Windows.Forms.AnchorStyles.Left)
     57            | System.Windows.Forms.AnchorStyles.Right)));
    5258      this.viewHost.Caption = "View";
    5359      this.viewHost.Content = null;
    54       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    5560      this.viewHost.Enabled = false;
    5661      this.viewHost.Location = new System.Drawing.Point(0, 0);
    5762      this.viewHost.Name = "viewHost";
    5863      this.viewHost.ReadOnly = false;
    59       this.viewHost.Size = new System.Drawing.Size(359, 274);
     64      this.viewHost.Size = new System.Drawing.Size(334, 274);
    6065      this.viewHost.TabIndex = 0;
    6166      this.viewHost.ViewsLabelVisible = true;
    6267      this.viewHost.ViewType = null;
     68      //
     69      // infoLabel
     70      //
     71      this.infoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     72      this.infoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     73      this.infoLabel.Location = new System.Drawing.Point(340, 3);
     74      this.infoLabel.Name = "infoLabel";
     75      this.infoLabel.Size = new System.Drawing.Size(16, 16);
     76      this.infoLabel.TabIndex = 1;
     77      this.toolTip.SetToolTip(this.infoLabel, "Double-click to open description editor.");
     78      this.infoLabel.DoubleClick += new System.EventHandler(this.infoLabel_DoubleClick);
    6379      //
    6480      // ResultValueView
     
    6682      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    6783      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     84      this.Controls.Add(this.infoLabel);
    6885      this.Controls.Add(this.viewHost);
    6986      this.Name = "ResultValueView";
     
    7693
    7794    private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     95    private System.Windows.Forms.Label infoLabel;
     96    private System.Windows.Forms.ToolTip toolTip;
    7897  }
    7998}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultValueView.cs

    r5896 r7235  
    3030  [Content(typeof(IResult), false)]
    3131  public sealed partial class ResultValueView : ItemView {
     32    private const string infoLabelToolTipSuffix = "Double-click to open description editor.";
     33
    3234    public new IResult Content {
    3335      get { return (IResult)base.Content; }
     
    4547
    4648    protected override void DeregisterContentEvents() {
     49      Content.NameChanged -= new EventHandler(Content_NameChanged);
     50      Content.DescriptionChanged -= new EventHandler(Content_DescriptionChanged);
    4751      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    4852      base.DeregisterContentEvents();
     
    5054    protected override void RegisterContentEvents() {
    5155      base.RegisterContentEvents();
     56      Content.NameChanged += new EventHandler(Content_NameChanged);
     57      Content.DescriptionChanged += new EventHandler(Content_DescriptionChanged);
    5258      Content.ValueChanged += new EventHandler(Content_ValueChanged);
    5359    }
     
    5763      if (Content == null) {
    5864        viewHost.Content = null;
     65        toolTip.SetToolTip(infoLabel, string.Empty);
     66        if (ViewAttribute.HasViewAttribute(this.GetType()))
     67          this.Caption = ViewAttribute.GetViewName(this.GetType());
     68        else
     69          this.Caption = "ResultValue View";
    5970      } else {
    6071        viewHost.ViewType = null;
    6172        viewHost.Content = Content.Value;
     73        toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix);
     74        Caption = Content.Name;
    6275      }
    6376    }
     
    6780      viewHost.Enabled = Content != null;
    6881      viewHost.ReadOnly = this.ReadOnly;
     82      infoLabel.Enabled = Content != null;
    6983    }
    7084
     85    private void Content_NameChanged(object sender, EventArgs e) {
     86      if (InvokeRequired)
     87        Invoke(new EventHandler(Content_NameChanged), sender, e);
     88      else
     89        Caption = Content.Name;
     90    }
     91    private void Content_DescriptionChanged(object sender, EventArgs e) {
     92      if (InvokeRequired)
     93        Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
     94      else
     95        toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix);
     96    }
    7197    private void Content_ValueChanged(object sender, EventArgs e) {
    7298      if (InvokeRequired)
     
    76102      }
    77103    }
     104
     105    private void infoLabel_DoubleClick(object sender, System.EventArgs e) {
     106      using (TextDialog dialog = new TextDialog("Description of " + Content.Name, Content.Description, ReadOnly || !Content.CanChangeDescription)) {
     107        if (dialog.ShowDialog(this) == DialogResult.OK)
     108          Content.Description = dialog.Content;
     109      }
     110    }
    78111  }
    79112}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultView.cs

    r5896 r7235  
    2727
    2828namespace HeuristicLab.Optimization.Views {
    29   /// <summary>
    30   /// The visual representation of a <see cref="Variable"/>.
    31   /// </summary>
    3229  [View("Result View")]
    3330  [Content(typeof(Result), false)]
    3431  [Content(typeof(IResult), false)]
    3532  public sealed partial class ResultView : NamedItemView {
    36     /// <summary>
    37     /// Gets or sets the variable to represent visually.
    38     /// </summary>
    39     /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
    40     /// No own data storage present.</remarks>
    4133    public new IResult Content {
    4234      get { return (IResult)base.Content; }
     
    4941    }
    5042
    51     /// <summary>
    52     /// Initializes a new instance of <see cref="VariableView"/> with caption "Variable".
    53     /// </summary>
    5443    public ResultView() {
    5544      InitializeComponent();
    5645    }
    5746
    58     /// <summary>
    59     /// Removes the eventhandlers from the underlying <see cref="Variable"/>.
    60     /// </summary>
    61     /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
    6247    protected override void DeregisterContentEvents() {
    6348      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    6449      base.DeregisterContentEvents();
    6550    }
    66 
    67     /// <summary>
    68     /// Adds eventhandlers to the underlying <see cref="Variable"/>.
    69     /// </summary>
    70     /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
    7151    protected override void RegisterContentEvents() {
    7252      base.RegisterContentEvents();
Note: See TracChangeset for help on using the changeset viewer.