Changeset 7235 for trunk/sources/HeuristicLab.Optimization.Views/3.3
- Timestamp:
- 12/27/11 02:37:02 (13 years ago)
- 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 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.components = new System.ComponentModel.Container(); 47 48 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); 48 51 this.SuspendLayout(); 49 52 // 50 53 // viewHost 51 54 // 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))); 52 58 this.viewHost.Caption = "View"; 53 59 this.viewHost.Content = null; 54 this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;55 60 this.viewHost.Enabled = false; 56 61 this.viewHost.Location = new System.Drawing.Point(0, 0); 57 62 this.viewHost.Name = "viewHost"; 58 63 this.viewHost.ReadOnly = false; 59 this.viewHost.Size = new System.Drawing.Size(3 59, 274);64 this.viewHost.Size = new System.Drawing.Size(334, 274); 60 65 this.viewHost.TabIndex = 0; 61 66 this.viewHost.ViewsLabelVisible = true; 62 67 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); 63 79 // 64 80 // ResultValueView … … 66 82 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 67 83 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 84 this.Controls.Add(this.infoLabel); 68 85 this.Controls.Add(this.viewHost); 69 86 this.Name = "ResultValueView"; … … 76 93 77 94 private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost; 95 private System.Windows.Forms.Label infoLabel; 96 private System.Windows.Forms.ToolTip toolTip; 78 97 } 79 98 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultValueView.cs
r5896 r7235 30 30 [Content(typeof(IResult), false)] 31 31 public sealed partial class ResultValueView : ItemView { 32 private const string infoLabelToolTipSuffix = "Double-click to open description editor."; 33 32 34 public new IResult Content { 33 35 get { return (IResult)base.Content; } … … 45 47 46 48 protected override void DeregisterContentEvents() { 49 Content.NameChanged -= new EventHandler(Content_NameChanged); 50 Content.DescriptionChanged -= new EventHandler(Content_DescriptionChanged); 47 51 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 48 52 base.DeregisterContentEvents(); … … 50 54 protected override void RegisterContentEvents() { 51 55 base.RegisterContentEvents(); 56 Content.NameChanged += new EventHandler(Content_NameChanged); 57 Content.DescriptionChanged += new EventHandler(Content_DescriptionChanged); 52 58 Content.ValueChanged += new EventHandler(Content_ValueChanged); 53 59 } … … 57 63 if (Content == null) { 58 64 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"; 59 70 } else { 60 71 viewHost.ViewType = null; 61 72 viewHost.Content = Content.Value; 73 toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix); 74 Caption = Content.Name; 62 75 } 63 76 } … … 67 80 viewHost.Enabled = Content != null; 68 81 viewHost.ReadOnly = this.ReadOnly; 82 infoLabel.Enabled = Content != null; 69 83 } 70 84 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 } 71 97 private void Content_ValueChanged(object sender, EventArgs e) { 72 98 if (InvokeRequired) … … 76 102 } 77 103 } 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 } 78 111 } 79 112 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultView.cs
r5896 r7235 27 27 28 28 namespace HeuristicLab.Optimization.Views { 29 /// <summary>30 /// The visual representation of a <see cref="Variable"/>.31 /// </summary>32 29 [View("Result View")] 33 30 [Content(typeof(Result), false)] 34 31 [Content(typeof(IResult), false)] 35 32 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>41 33 public new IResult Content { 42 34 get { return (IResult)base.Content; } … … 49 41 } 50 42 51 /// <summary>52 /// Initializes a new instance of <see cref="VariableView"/> with caption "Variable".53 /// </summary>54 43 public ResultView() { 55 44 InitializeComponent(); 56 45 } 57 46 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>62 47 protected override void DeregisterContentEvents() { 63 48 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 64 49 base.DeregisterContentEvents(); 65 50 } 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>71 51 protected override void RegisterContentEvents() { 72 52 base.RegisterContentEvents();
Note: See TracChangeset
for help on using the changeset viewer.