Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/18/08 15:55:32 (16 years ago)
Author:
gkronber
Message:

implemented #259 (BakedFunctionTree should provide an appropriate ToString() method)

Location:
trunk/sources/HeuristicLab.Functions
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/BakedFunctionTree.cs

    r483 r519  
    344344      return new FunctionTreeView(this);
    345345    }
     346
     347    public override string ToString() {
     348      SymbolicExpressionExporter exporter = new SymbolicExpressionExporter();
     349      exporter.Visit(this);
     350      return exporter.GetStringRepresentation();
     351    }
    346352  }
    347353}
  • trunk/sources/HeuristicLab.Functions/FunctionView.Designer.cs

    r427 r519  
    6060      this.treeNodeContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
    6161      this.copyToClipboardMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     62      this.copyToClipboardSExpressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    6263      this.splitContainer.Panel1.SuspendLayout();
    6364      this.splitContainer.Panel2.SuspendLayout();
     
    167168      //
    168169      this.treeNodeContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    169             this.copyToClipboardMenuItem});
     170            this.copyToClipboardMenuItem,
     171            this.copyToClipboardSExpressionToolStripMenuItem});
    170172      this.treeNodeContextMenu.Name = "treeNodeContextMenu";
    171       this.treeNodeContextMenu.Size = new System.Drawing.Size(248, 26);
     173      this.treeNodeContextMenu.Size = new System.Drawing.Size(259, 70);
    172174      //
    173175      // copyToClipboardMenuItem
    174176      //
    175177      this.copyToClipboardMenuItem.Name = "copyToClipboardMenuItem";
    176       this.copyToClipboardMenuItem.Size = new System.Drawing.Size(247, 22);
     178      this.copyToClipboardMenuItem.Size = new System.Drawing.Size(258, 22);
    177179      this.copyToClipboardMenuItem.Text = "Copy to clip-board (Model-Analyzer)";
    178180      this.copyToClipboardMenuItem.Click += new System.EventHandler(this.copyToClipboardMenuItem_Click);
     181      //
     182      // copyToClipboardSExpressionToolStripMenuItem
     183      //
     184      this.copyToClipboardSExpressionToolStripMenuItem.Name = "copyToClipboardSExpressionToolStripMenuItem";
     185      this.copyToClipboardSExpressionToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
     186      this.copyToClipboardSExpressionToolStripMenuItem.Text = "Copy to clip-board (S-Expression)";
     187      this.copyToClipboardSExpressionToolStripMenuItem.Click += new System.EventHandler(this.copyToClipboardSExpressionToolStripMenuItem_Click);
    179188      //
    180189      // FunctionTreeView
     
    209218    private System.Windows.Forms.ContextMenuStrip treeNodeContextMenu;
    210219    private System.Windows.Forms.ToolStripMenuItem copyToClipboardMenuItem;
     220    private System.Windows.Forms.ToolStripMenuItem copyToClipboardSExpressionToolStripMenuItem;
    211221
    212222  }
  • trunk/sources/HeuristicLab.Functions/FunctionView.cs

    r410 r519  
    139139      Clipboard.SetText(visitor.ModelAnalyzerPrefix);
    140140    }
     141
     142    private void copyToClipboardSExpressionToolStripMenuItem_Click(object sender, EventArgs e) {
     143      TreeNode node = funTreeView.SelectedNode;
     144      if(node == null || node.Tag == null) return;
     145
     146      string sexp = ((IFunctionTree)node.Tag).ToString();
     147      Clipboard.SetText(sexp);
     148    }
     149
    141150    private void funTreeView_MouseUp(object sender, MouseEventArgs e) {
    142151      if(e.Button == MouseButtons.Right) {
  • trunk/sources/HeuristicLab.Functions/HeuristicLab.Functions.csproj

    r425 r519  
    7878    <Compile Include="LessThan.cs" />
    7979    <Compile Include="Not.cs" />
     80    <Compile Include="SymbolicExpressionExporter.cs" />
    8081    <Compile Include="Signum.cs" />
    8182    <Compile Include="Logarithm.cs" />
Note: See TracChangeset for help on using the changeset viewer.