Changeset 5416
- Timestamp:
- 02/03/11 17:16:31 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 1 deleted
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.Designer.cs
r3742 r5416 46 46 private void InitializeComponent() { 47 47 this.textBox = new System.Windows.Forms.TextBox(); 48 this.formattersComboBox = new System.Windows.Forms.ComboBox(); 49 this.formatterLabel = new System.Windows.Forms.Label(); 48 50 this.SuspendLayout(); 49 51 // 50 52 // textBox 51 53 // 52 this.textBox.Dock = System.Windows.Forms.DockStyle.Fill; 53 this.textBox.Location = new System.Drawing.Point(0, 0); 54 this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 55 | System.Windows.Forms.AnchorStyles.Left) 56 | System.Windows.Forms.AnchorStyles.Right))); 57 this.textBox.BackColor = System.Drawing.Color.White; 58 this.textBox.Location = new System.Drawing.Point(3, 30); 54 59 this.textBox.Multiline = true; 55 60 this.textBox.Name = "textBox"; 56 this.textBox.Size = new System.Drawing.Size(150, 150); 61 this.textBox.ReadOnly = true; 62 this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 63 this.textBox.Size = new System.Drawing.Size(475, 282); 57 64 this.textBox.TabIndex = 0; 58 65 // 59 // SymbolicExpressionTreeView 66 // formattersComboBox 67 // 68 this.formattersComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 69 | System.Windows.Forms.AnchorStyles.Right))); 70 this.formattersComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 71 this.formattersComboBox.FormattingEnabled = true; 72 this.formattersComboBox.Location = new System.Drawing.Point(72, 3); 73 this.formattersComboBox.Name = "formattersComboBox"; 74 this.formattersComboBox.Size = new System.Drawing.Size(406, 21); 75 this.formattersComboBox.TabIndex = 1; 76 this.formattersComboBox.SelectedIndexChanged += new System.EventHandler(this.formattersComboBox_SelectedIndexChanged); 77 // 78 // formatterLabel 79 // 80 this.formatterLabel.AutoSize = true; 81 this.formatterLabel.Location = new System.Drawing.Point(3, 6); 82 this.formatterLabel.Name = "formatterLabel"; 83 this.formatterLabel.Size = new System.Drawing.Size(54, 13); 84 this.formatterLabel.TabIndex = 2; 85 this.formatterLabel.Text = "Formatter:"; 86 // 87 // SymbolicExpressionView 60 88 // 61 89 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 62 90 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 91 this.Controls.Add(this.formatterLabel); 92 this.Controls.Add(this.formattersComboBox); 63 93 this.Controls.Add(this.textBox); 64 this.Name = "SymbolicExpressionTreeView"; 94 this.Name = "SymbolicExpressionView"; 95 this.Size = new System.Drawing.Size(481, 315); 65 96 this.ResumeLayout(false); 66 97 this.PerformLayout(); … … 71 102 72 103 private System.Windows.Forms.TextBox textBox; 104 private System.Windows.Forms.ComboBox formattersComboBox; 105 private System.Windows.Forms.Label formatterLabel; 73 106 } 74 107 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs
r4068 r5416 23 23 using HeuristicLab.MainForm; 24 24 using HeuristicLab.MainForm.WindowsForms; 25 using HeuristicLab.PluginInfrastructure; 26 using System.Collections.Generic; 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Formatters; 25 28 26 29 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { … … 28 31 [Content(typeof(SymbolicExpressionTree), false)] 29 32 public partial class SymbolicExpressionView : AsynchronousContentView { 30 private SymbolicExpressionTreeStringFormatter treeFormatter; 33 34 List<ISymbolicExpressionTreeStringFormatter> treeFormattersList = new List<ISymbolicExpressionTreeStringFormatter>(); 31 35 32 36 public new SymbolicExpressionTree Content { … … 37 41 public SymbolicExpressionView() { 38 42 InitializeComponent(); 39 treeFormatter = new SymbolicExpressionTreeStringFormatter(); 43 IEnumerable<ISymbolicExpressionTreeStringFormatter> formatters = ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeStringFormatter>(); 44 treeFormattersList = new List<ISymbolicExpressionTreeStringFormatter>(); 45 int selectedIndex = -1; 46 foreach (ISymbolicExpressionTreeStringFormatter formatter in formatters) { 47 if (formatter is SymbolicExpressionTreeStringFormatter) 48 selectedIndex = treeFormattersList.Count; 49 treeFormattersList.Add(formatter); 50 formattersComboBox.Items.Add(formatter.Name); 51 } 52 formattersComboBox.SelectedIndex = selectedIndex; 40 53 } 41 54 42 55 protected override void OnContentChanged() { 43 56 base.OnContentChanged(); 44 if (Content == null) 57 UpdateTextbox(); 58 } 59 60 private void UpdateTextbox() { 61 if (Content == null || formattersComboBox.SelectedIndex < 0) 45 62 textBox.Text = string.Empty; 46 63 else 47 textBox.Text = treeFormatter .Format(Content);64 textBox.Text = treeFormattersList[formattersComboBox.SelectedIndex].Format(Content); 48 65 } 49 66 … … 53 70 textBox.ReadOnly = ReadOnly; 54 71 } 72 73 private void formattersComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 74 UpdateTextbox(); 75 } 55 76 } 56 77 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj
r5386 r5416 126 126 <Compile Include="Crossovers\CrossoverPoint.cs" /> 127 127 <Compile Include="Crossovers\SymbolicExpressionTreeCrossover.cs" /> 128 <Compile Include="Formatters\SymbolicExpressionTreeStringFormatter.cs" /> 128 129 <Compile Include="Interfaces\ISymbolicExpressionTreeAnalyzer.cs" /> 129 130 <Compile Include="Interfaces\ISymbolicExpressionTreeArchitectureManipulator.cs" /> … … 131 132 <Compile Include="Interfaces\ISymbolicExpressionTreeCrossover.cs" /> 132 133 <Compile Include="Interfaces\ISymbolicExpressionTreeNode.cs" /> 134 <Compile Include="Interfaces\ISymbolicExpressionTreeStringFormatter.cs" /> 133 135 <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" /> 134 136 <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" /> … … 139 141 <Compile Include="Manipulators\SymbolicExpressionTreeManipulator.cs" /> 140 142 <Compile Include="SymbolicExpressionTreeGrammar.cs" /> 141 <Compile Include="SymbolicExpressionTreeStringFormatter.cs" />142 143 <Compile Include="SymbolicExpressionTreeTopLevelNode.cs" /> 143 144 <Compile Include="Crossovers\SubtreeCrossover.cs"> -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeStringConverter.cs
r4916 r5416 25 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Formatters; 27 28 28 29 namespace HeuristicLab.Problems.ExternalEvaluation.GP {
Note: See TracChangeset
for help on using the changeset viewer.