Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/17/13 10:05:34 (11 years ago)
Author:
ascheibe
Message:

#2100 merged r9915-r9916, r9920-r9921, r9935 into stable branch

Location:
stable
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.Designer.cs

    r9456 r9977  
    5151      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5252      this.configurationLabel = new System.Windows.Forms.Label();
     53      this.helpLabel = new System.Windows.Forms.Label();
    5354      this.SuspendLayout();
    5455      //
     
    7374      this.viewsLabel.Size = new System.Drawing.Size(16, 16);
    7475      this.viewsLabel.TabIndex = 0;
    75       this.toolTip.SetToolTip(this.viewsLabel,
    76         "Double-click to open a new window of the current view." + System.Environment.NewLine +
    77         "Right-click to change current view." + System.Environment.NewLine +
    78         "Drag icon to copy or link content to another view.");
     76      this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view.\r\nRight-click to change cur" +
     77        "rent view.\r\nDrag icon to copy or link content to another view.");
    7978      this.viewsLabel.DoubleClick += new System.EventHandler(this.viewsLabel_DoubleClick);
    8079      this.viewsLabel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.viewsLabel_MouseDown);
     
    102101      this.configurationLabel.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.configurationLabel_DoubleClick);
    103102      //
     103      // helpLabel
     104      //
     105      this.helpLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     106      this.helpLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Help;
     107      this.helpLabel.Location = new System.Drawing.Point(211, 44);
     108      this.helpLabel.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
     109      this.helpLabel.Name = "helpLabel";
     110      this.helpLabel.Size = new System.Drawing.Size(16, 16);
     111      this.helpLabel.TabIndex = 3;
     112      this.toolTip.SetToolTip(this.helpLabel, "Double-click to open help.");
     113      this.helpLabel.Visible = false;
     114      this.helpLabel.DoubleClick += new System.EventHandler(this.helpLabel_DoubleClick);
     115      //
    104116      // ViewHost
    105117      //
    106118      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    107119      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     120      this.Controls.Add(this.helpLabel);
    108121      this.Controls.Add(this.viewsLabel);
    109122      this.Controls.Add(this.configurationLabel);
     
    121134    private HeuristicLab.MainForm.WindowsForms.ViewContextMenuStrip viewContextMenuStrip;
    122135    private System.Windows.Forms.Label configurationLabel;
     136    private System.Windows.Forms.Label helpLabel;
    123137
    124138  }
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs

    r9456 r9977  
    103103          configurationLabel.Visible = activeView is IConfigureableView;
    104104          configurationLabel.Enabled = activeView != null && !activeView.Locked;
     105
     106          helpLabel.Visible = activeView != null && ViewAttribute.HasHelpResourcePath(activeView.GetType());
     107          helpLabel.Top = CalculateHelpLabelPosY();
    105108        }
    106109      }
     
    210213      viewsLabel.Location = new Point(Width - viewsLabel.Margin.Right - viewsLabel.Width, viewsLabel.Margin.Top);
    211214      configurationLabel.Location = new Point(Width - configurationLabel.Margin.Right - configurationLabel.Width, viewsLabel.Bottom + viewsLabel.Margin.Bottom + configurationLabel.Margin.Top);
    212 
     215      helpLabel.Location = new Point(Width - helpLabel.Margin.Right - helpLabel.Width, CalculateHelpLabelPosY());
     216    }
     217
     218    private int CalculateHelpLabelPosY() {
     219      if (activeView != null && ViewAttribute.HasHelpResourcePath(activeView.GetType()) && !configurationLabel.Visible) {
     220        return configurationLabel.Top;
     221      }
     222      return configurationLabel.Bottom + configurationLabel.Margin.Bottom + helpLabel.Margin.Top;
    213223    }
    214224
     
    302312      ((IConfigureableView)ActiveView).ShowConfiguration();
    303313    }
     314
     315    private void helpLabel_DoubleClick(object sender, EventArgs e) {
     316      using (InfoBox dialog = new InfoBox("Help for " + ViewAttribute.GetViewName(ActiveView.GetType()), ViewAttribute.GetHelpResourcePath(ActiveView.GetType()), ActiveView)) {
     317        dialog.ShowDialog(this);
     318      }
     319    }
    304320    #endregion
    305321  }
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/InfoBox.Designer.cs

    r9916 r9977  
    5959      this.okButton.Text = "&OK";
    6060      this.okButton.UseVisualStyleBackColor = true;
    61       this.okButton.Click += new System.EventHandler(this.okButton_Click);
    6261      //
    6362      // infoRichTextBox
     
    7877      // InfoBox
    7978      //
     79      this.AcceptButton = this.okButton;
    8080      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    8181      this.ClientSize = new System.Drawing.Size(636, 494);
     
    8989      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    9090      this.Text = "Info Box";
     91      this.Load += new System.EventHandler(this.InfoBox_Load);
    9192      this.ResumeLayout(false);
    9293
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/InfoBox.cs

    r9916 r9977  
    2727namespace HeuristicLab.MainForm.WindowsForms {
    2828  public partial class InfoBox : Form {
    29     public string Caption {
    30       get { return this.Text; }
    31       set {
    32         if (InvokeRequired)
    33           Invoke(new Action<string>(x => this.Text = x), value);
    34         else
    35           this.Text = value;
    36       }
     29    protected string embeddedResourceName;
     30    protected IView parentView;
     31
     32    public InfoBox(string caption, string embeddedResourceName, IView parentView) {
     33      InitializeComponent();
     34      this.Text = caption;
     35      this.parentView = parentView;
     36      this.embeddedResourceName = embeddedResourceName;
    3737    }
    3838
    39     protected string embeddedResourceName;
    40     public string EmbeddedResourceName {
    41       get { return embeddedResourceName; }
    42       set {
    43         if (InvokeRequired)
    44           Invoke(new Action<string>(x => this.EmbeddedResourceName = x), value);
    45         else {
    46           embeddedResourceName = value;
    47           LoadEmbeddedResource(embeddedResourceName);
    48         }
    49       }
    50     }
    51 
    52     public IView ParentView { get; set; }
    53 
    54     public InfoBox() {
    55       InitializeComponent();
    56     }
    57 
    58     public InfoBox(string caption, string embeddedResourceName, IView parentView)
    59       : this() {
    60       Caption = caption;
    61       ParentView = parentView;
    62       EmbeddedResourceName = embeddedResourceName;
    63     }
    64 
    65     protected virtual void LoadEmbeddedResource(string resourceName) {
    66       string extension = Path.GetExtension(resourceName);
    67       Assembly assembly = Assembly.GetAssembly(ParentView.GetType());
     39    protected virtual void LoadEmbeddedResource() {
     40      string extension = Path.GetExtension(embeddedResourceName);
     41      Assembly assembly = Assembly.GetAssembly(parentView.GetType());
    6842      try {
    69         using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
     43        using (Stream stream = assembly.GetManifestResourceStream(embeddedResourceName)) {
    7044          if (extension == ".rtf") {
    7145            infoRichTextBox.LoadFile(stream, RichTextBoxStreamType.RichText);
     
    8256    }
    8357
    84     protected virtual void okButton_Click(object sender, EventArgs e) {
    85       Close();
     58    private void InfoBox_Load(object sender, EventArgs e) {
     59      LoadEmbeddedResource();
    8660    }
    8761  }
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/HeuristicLab.MainForm.WindowsForms-3.3.csproj

    r9079 r9977  
    138138      <DependentUpon>DefineArithmeticProgressionDialog.cs</DependentUpon>
    139139    </Compile>
     140    <Compile Include="Dialogs\InfoBox.cs">
     141      <SubType>Form</SubType>
     142    </Compile>
     143    <Compile Include="Dialogs\InfoBox.Designer.cs">
     144      <DependentUpon>InfoBox.cs</DependentUpon>
     145    </Compile>
    140146    <Compile Include="Plugin.cs" />
    141147    <Compile Include="Views\AsynchronousContentView.cs">
     
    266272    </BootstrapperPackage>
    267273  </ItemGroup>
    268   <ItemGroup />
    269274  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    270275  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset for help on using the changeset viewer.