Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9890


Ignore:
Timestamp:
08/21/13 15:21:04 (11 years ago)
Author:
ascheibe
Message:

#2069

  • changed Solution from NamedItem to Item
  • adapted views to be only ItemViews
  • some more minor improvements
Location:
branches/Robocode.TrunkInt
Files:
3 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/CodeNodeView.Designer.cs

    r9889 r9890  
    1 namespace HeuristicLab.Problems.Robocode
    2 {
    3     partial class CodeNodeView
    4     {
    5         /// <summary>
    6         /// Required designer variable.
    7         /// </summary>
    8         private System.ComponentModel.IContainer components = null;
     1namespace HeuristicLab.Problems.Robocode {
     2  partial class CodeNodeView {
     3    /// <summary>
     4    /// Required designer variable.
     5    /// </summary>
     6    private System.ComponentModel.IContainer components = null;
    97
    10         /// <summary>
    11         /// Clean up any resources being used.
    12         /// </summary>
    13         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    14         protected override void Dispose(bool disposing)
    15         {
    16             if (disposing && (components != null))
    17             {
    18                 components.Dispose();
    19             }
    20             base.Dispose(disposing);
    21         }
     8    /// <summary>
     9    /// Clean up any resources being used.
     10    /// </summary>
     11    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     12    protected override void Dispose(bool disposing) {
     13      if (disposing && (components != null)) {
     14        components.Dispose();
     15      }
     16      base.Dispose(disposing);
     17    }
    2218
    23         #region Component Designer generated code
     19    #region Component Designer generated code
    2420
    25         /// <summary>
    26         /// Required method for Designer support - do not modify
    27         /// the contents of this method with the code editor.
    28         /// </summary>
    29         private void InitializeComponent()
    30         {
     21    /// <summary>
     22    /// Required method for Designer support - do not modify
     23    /// the contents of this method with the code editor.
     24    /// </summary>
     25    private void InitializeComponent() {
    3126      this.prefixCode = new System.Windows.Forms.TextBox();
    3227      this.prefixLabel = new System.Windows.Forms.Label();
     
    3429      this.suffixCode = new System.Windows.Forms.TextBox();
    3530      this.splitContainer = new System.Windows.Forms.SplitContainer();
    36       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    3731      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    3832      this.splitContainer.Panel1.SuspendLayout();
     
    4034      this.splitContainer.SuspendLayout();
    4135      this.SuspendLayout();
    42       //
    43       // nameTextBox
    44       //
    45       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    46       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    47       this.nameTextBox.Size = new System.Drawing.Size(508, 20);
    48       this.nameTextBox.Visible = false;
    49       //
    50       // nameLabel
    51       //
    52       this.nameLabel.Visible = false;
    53       //
    54       // infoLabel
    55       //
    56       this.infoLabel.Location = new System.Drawing.Point(572, 3);
    57       this.infoLabel.Visible = false;
    5836      //
    5937      // prefixCode
     
    6745      this.prefixCode.Name = "prefixCode";
    6846      this.prefixCode.ScrollBars = System.Windows.Forms.ScrollBars.Both;
    69       this.prefixCode.Size = new System.Drawing.Size(573, 100);
     47      this.prefixCode.Size = new System.Drawing.Size(573, 111);
    7048      this.prefixCode.TabIndex = 3;
    7149      this.prefixCode.Validated += new System.EventHandler(this.prefixCode_Validated);
     
    9876      this.suffixCode.Name = "suffixCode";
    9977      this.suffixCode.ScrollBars = System.Windows.Forms.ScrollBars.Both;
    100       this.suffixCode.Size = new System.Drawing.Size(573, 96);
     78      this.suffixCode.Size = new System.Drawing.Size(573, 108);
    10179      this.suffixCode.TabIndex = 6;
    10280      this.suffixCode.Validated += new System.EventHandler(this.suffixCode_Validated);
     
    10785            | System.Windows.Forms.AnchorStyles.Left)
    10886            | System.Windows.Forms.AnchorStyles.Right)));
    109       this.splitContainer.Location = new System.Drawing.Point(6, 26);
     87      this.splitContainer.Location = new System.Drawing.Point(6, 3);
    11088      this.splitContainer.Name = "splitContainer";
    11189      this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
     
    12098      this.splitContainer.Panel2.Controls.Add(this.suffixLabel);
    12199      this.splitContainer.Panel2.Controls.Add(this.suffixCode);
    122       this.splitContainer.Size = new System.Drawing.Size(582, 238);
    123       this.splitContainer.SplitterDistance = 119;
     100      this.splitContainer.Size = new System.Drawing.Size(582, 261);
     101      this.splitContainer.SplitterDistance = 130;
    124102      this.splitContainer.TabIndex = 7;
    125103      //
     
    130108      this.Name = "CodeNodeView";
    131109      this.Size = new System.Drawing.Size(591, 267);
    132       this.Controls.SetChildIndex(this.nameLabel, 0);
    133       this.Controls.SetChildIndex(this.nameTextBox, 0);
    134       this.Controls.SetChildIndex(this.infoLabel, 0);
    135       this.Controls.SetChildIndex(this.splitContainer, 0);
    136       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    137110      this.splitContainer.Panel1.ResumeLayout(false);
    138111      this.splitContainer.Panel1.PerformLayout();
     
    142115      this.splitContainer.ResumeLayout(false);
    143116      this.ResumeLayout(false);
    144       this.PerformLayout();
    145117
    146         }
     118    }
    147119
    148         #endregion
     120    #endregion
    149121
    150         private System.Windows.Forms.TextBox prefixCode;
    151         private System.Windows.Forms.Label prefixLabel;
    152         private System.Windows.Forms.Label suffixLabel;
    153         private System.Windows.Forms.TextBox suffixCode;
    154         private System.Windows.Forms.SplitContainer splitContainer;
    155     }
     122    private System.Windows.Forms.TextBox prefixCode;
     123    private System.Windows.Forms.Label prefixLabel;
     124    private System.Windows.Forms.Label suffixLabel;
     125    private System.Windows.Forms.TextBox suffixCode;
     126    private System.Windows.Forms.SplitContainer splitContainer;
     127  }
    156128}
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/CodeNodeView.cs

    r9889 r9890  
    2727  [View("CodeNode View")]
    2828  [Content(typeof(CodeNode), IsDefaultView = true)]
    29   public partial class CodeNodeView : NamedItemView {
     29  public partial class CodeNodeView : ItemView {
    3030    public new CodeNode Content {
    3131      get { return (CodeNode)base.Content; }
     
    4141      base.OnContentChanged();
    4242      if (Content == null) {
    43         this.prefixCode.Text = string.Empty;
    44         this.suffixCode.Text = string.Empty;
     43        prefixCode.Text = string.Empty;
     44        suffixCode.Text = string.Empty;
    4545      } else {
    46         this.prefixCode.Text = Content.Prefix;
    47         this.suffixCode.Text = Content.Suffix;
     46        prefixCode.Text = Content.Prefix;
     47        suffixCode.Text = Content.Suffix;
    4848      }
    4949    }
    5050
    5151    private void suffixCode_Validated(object sender, EventArgs e) {
    52       Content.Suffix = this.suffixCode.Text;
     52      Content.Suffix = suffixCode.Text;
    5353    }
    5454
    5555    private void prefixCode_Validated(object sender, EventArgs e) {
    56       Content.Prefix = this.prefixCode.Text;
     56      Content.Prefix = prefixCode.Text;
     57    }
     58
     59    protected override void SetEnabledStateOfControls() {
     60      base.SetEnabledStateOfControls();
     61
     62      prefixCode.Enabled = Content != null && !Locked && !ReadOnly;
     63      suffixCode.Enabled = Content != null && !Locked && !ReadOnly;
    5764    }
    5865  }
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/HeuristicLab.Problems.Robocode.Views-3.3.csproj

    r9889 r9890  
    125125  </ItemGroup>
    126126  <ItemGroup>
    127     <EmbeddedResource Include="CodeNodeView.resx">
    128       <DependentUpon>CodeNodeView.cs</DependentUpon>
    129     </EmbeddedResource>
    130     <EmbeddedResource Include="SolutionCodeView.resx">
    131       <DependentUpon>SolutionCodeView.cs</DependentUpon>
    132     </EmbeddedResource>
    133     <EmbeddedResource Include="SolutionProgramView.resx">
    134       <DependentUpon>SolutionProgramView.cs</DependentUpon>
    135     </EmbeddedResource>
    136   </ItemGroup>
    137   <ItemGroup>
    138127    <ProjectReference Include="..\..\HeuristicLab.Problems.Robocode\3.3\HeuristicLab.Problems.Robocode-3.3.csproj">
    139128      <Project>{50776649-f3cf-459a-ae8c-146d1bfa64e4}</Project>
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionCodeView.Designer.cs

    r9781 r9890  
    1 namespace HeuristicLab.Problems.Robocode
    2 {
    3     partial class SolutionCodeView
    4     {
    5         /// <summary>
    6         /// Required designer variable.
    7         /// </summary>
    8         private System.ComponentModel.IContainer components = null;
     1namespace HeuristicLab.Problems.Robocode {
     2  partial class SolutionCodeView {
     3    /// <summary>
     4    /// Required designer variable.
     5    /// </summary>
     6    private System.ComponentModel.IContainer components = null;
    97
    10         /// <summary>
    11         /// Clean up any resources being used.
    12         /// </summary>
    13         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    14         protected override void Dispose(bool disposing)
    15         {
    16             if (disposing && (components != null))
    17             {
    18                 components.Dispose();
    19             }
    20             base.Dispose(disposing);
    21         }
     8    /// <summary>
     9    /// Clean up any resources being used.
     10    /// </summary>
     11    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     12    protected override void Dispose(bool disposing) {
     13      if (disposing && (components != null)) {
     14        components.Dispose();
     15      }
     16      base.Dispose(disposing);
     17    }
    2218
    23         #region Component Designer generated code
     19    #region Component Designer generated code
    2420
    25         /// <summary>
    26         /// Required method for Designer support - do not modify
    27         /// the contents of this method with the code editor.
    28         /// </summary>
    29         private void InitializeComponent()
    30         {
    31             this.programCode = new System.Windows.Forms.TextBox();
    32             this.btnRunInRobocode = new System.Windows.Forms.Button();
    33             ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    34             this.SuspendLayout();
    35             //
    36             // nameTextBox
    37             //
    38             this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    39             this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    40             //
    41             // programCode
    42             //
    43             this.programCode.Dock = System.Windows.Forms.DockStyle.Fill;
    44             this.programCode.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    45             this.programCode.Location = new System.Drawing.Point(0, 0);
    46             this.programCode.Multiline = true;
    47             this.programCode.Name = "programCode";
    48             this.programCode.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
    49             this.programCode.Size = new System.Drawing.Size(351, 238);
    50             this.programCode.TabIndex = 3;
    51             //
    52             // btnRunInRobocode
    53             //
    54             this.btnRunInRobocode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    55             this.btnRunInRobocode.AutoSize = true;
    56             this.btnRunInRobocode.Location = new System.Drawing.Point(228, 3);
    57             this.btnRunInRobocode.Name = "btnRunInRobocode";
    58             this.btnRunInRobocode.Size = new System.Drawing.Size(98, 23);
    59             this.btnRunInRobocode.TabIndex = 4;
    60             this.btnRunInRobocode.Text = "Run in Robocode";
    61             this.btnRunInRobocode.UseVisualStyleBackColor = true;
    62             this.btnRunInRobocode.Click += new System.EventHandler(this.btnRunInRobocode_Click);
    63             //
    64             // SolutionCodeView
    65             //
    66             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    67             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    68             this.Controls.Add(this.btnRunInRobocode);
    69             this.Controls.Add(this.programCode);
    70             this.Name = "SolutionCodeView";
    71             this.Size = new System.Drawing.Size(351, 238);
    72             this.Controls.SetChildIndex(this.nameLabel, 0);
    73             this.Controls.SetChildIndex(this.nameTextBox, 0);
    74             this.Controls.SetChildIndex(this.infoLabel, 0);
    75             this.Controls.SetChildIndex(this.programCode, 0);
    76             this.Controls.SetChildIndex(this.btnRunInRobocode, 0);
    77             ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    78             this.ResumeLayout(false);
    79             this.PerformLayout();
     21    /// <summary>
     22    /// Required method for Designer support - do not modify
     23    /// the contents of this method with the code editor.
     24    /// </summary>
     25    private void InitializeComponent() {
     26      this.programCode = new System.Windows.Forms.TextBox();
     27      this.btnRunInRobocode = new System.Windows.Forms.Button();
     28      this.SuspendLayout();
     29      //
     30      // programCode
     31      //
     32      this.programCode.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     33            | System.Windows.Forms.AnchorStyles.Left)
     34            | System.Windows.Forms.AnchorStyles.Right)));
     35      this.programCode.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     36      this.programCode.Location = new System.Drawing.Point(3, 3);
     37      this.programCode.Multiline = true;
     38      this.programCode.Name = "programCode";
     39      this.programCode.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
     40      this.programCode.Size = new System.Drawing.Size(345, 203);
     41      this.programCode.TabIndex = 3;
     42      //
     43      // btnRunInRobocode
     44      //
     45      this.btnRunInRobocode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     46      this.btnRunInRobocode.AutoSize = true;
     47      this.btnRunInRobocode.Location = new System.Drawing.Point(247, 212);
     48      this.btnRunInRobocode.Name = "btnRunInRobocode";
     49      this.btnRunInRobocode.Size = new System.Drawing.Size(101, 23);
     50      this.btnRunInRobocode.TabIndex = 4;
     51      this.btnRunInRobocode.Text = "Run in Robocode";
     52      this.btnRunInRobocode.UseVisualStyleBackColor = true;
     53      this.btnRunInRobocode.Click += new System.EventHandler(this.btnRunInRobocode_Click);
     54      //
     55      // SolutionCodeView
     56      //
     57      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     58      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     59      this.Controls.Add(this.btnRunInRobocode);
     60      this.Controls.Add(this.programCode);
     61      this.Name = "SolutionCodeView";
     62      this.Size = new System.Drawing.Size(351, 238);
     63      this.ResumeLayout(false);
     64      this.PerformLayout();
    8065
    81         }
     66    }
    8267
    83         #endregion
     68    #endregion
    8469
    85         private System.Windows.Forms.TextBox programCode;
    86         private System.Windows.Forms.Button btnRunInRobocode;
    87     }
     70    private System.Windows.Forms.TextBox programCode;
     71    private System.Windows.Forms.Button btnRunInRobocode;
     72  }
    8873}
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionCodeView.cs

    r9889 r9890  
    2727  [View("Robocode Tank Code View")]
    2828  [Content(typeof(Solution), IsDefaultView = true)]
    29   public partial class SolutionCodeView : NamedItemView {
     29  public partial class SolutionCodeView : ItemView {
     30    private const string programName = "BestSolution";
     31
    3032    public new Solution Content {
    3133      get { return (Solution)base.Content; }
     
    4143      base.OnContentChanged();
    4244      if (Content == null) {
    43         this.programCode.Text = string.Empty;
     45        programCode.Text = string.Empty;
    4446      } else {
    45         this.programCode.Text = Interpreter.InterpretProgramTree(Content.Tree.Root, "BestSolution");
     47        programCode.Text = Interpreter.InterpretProgramTree(Content.Tree.Root, programName);
    4648      }
    4749    }
    4850
    4951    private void btnRunInRobocode_Click(object sender, EventArgs e) {
    50       Interpreter.EvaluateTankProgram(Content.Tree, Content.Path, "BestSolution", true);
     52      Interpreter.EvaluateTankProgram(Content.Tree, Content.Path, programName, true);
    5153    }
    5254  }
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionProgramView.Designer.cs

    r9889 r9890  
    2626    private void InitializeComponent() {
    2727      this.graphTreeView = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.GraphicalSymbolicExpressionTreeView();
    28       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    2928      this.SuspendLayout();
    30       //
    31       // nameTextBox
    32       //
    33       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    34       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    3529      //
    3630      // graphTreeView
    3731      //
    3832      this.graphTreeView.AllowDrop = true;
    39       this.graphTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    40             | System.Windows.Forms.AnchorStyles.Left)
     33      this.graphTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     34            | System.Windows.Forms.AnchorStyles.Left) 
    4135            | System.Windows.Forms.AnchorStyles.Right)));
    4236      this.graphTreeView.Caption = "Graphical SymbolicExpressionTree View";
    4337      this.graphTreeView.Content = null;
    44       this.graphTreeView.Location = new System.Drawing.Point(6, 26);
     38      this.graphTreeView.Location = new System.Drawing.Point(6, 3);
    4539      this.graphTreeView.Name = "graphTreeView";
    4640      this.graphTreeView.ReadOnly = false;
    47       this.graphTreeView.Size = new System.Drawing.Size(342, 190);
     41      this.graphTreeView.Size = new System.Drawing.Size(342, 213);
    4842      this.graphTreeView.TabIndex = 0;
    4943      //
     
    5347      this.Name = "SolutionProgramView";
    5448      this.Size = new System.Drawing.Size(351, 219);
    55       this.Controls.SetChildIndex(this.nameLabel, 0);
    56       this.Controls.SetChildIndex(this.nameTextBox, 0);
    57       this.Controls.SetChildIndex(this.infoLabel, 0);
    58       this.Controls.SetChildIndex(this.graphTreeView, 0);
    59       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    6049      this.ResumeLayout(false);
    61       this.PerformLayout();
    6250
    6351    }
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionProgramView.cs

    r9889 r9890  
    2020#endregion
    2121
    22 using System.Windows.Forms;
    2322using HeuristicLab.Core.Views;
    2423using HeuristicLab.MainForm;
     
    2726  [View("Robocode Tank Program Tree View")]
    2827  [Content(typeof(Solution), IsDefaultView = false)]
    29   public sealed partial class SolutionProgramView : NamedItemView {
     28  public sealed partial class SolutionProgramView : ItemView {
    3029    public new Solution Content {
    3130      get { return (Solution)base.Content; }
  • branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Solution.cs

    r9879 r9890  
    2727namespace HeuristicLab.Problems.Robocode {
    2828  [StorableClass]
    29   public sealed class Solution : NamedItem {
     29  [Item("Solution", "A Robocode program.")]
     30  public sealed class Solution : Item {
    3031    [Storable]
    3132    public ISymbolicExpressionTree Tree { get; set; }
     
    3940      : base(original, cloner) {
    4041      Tree = cloner.Clone(original.Tree);
    41       Path = original.Path;
     42      Path = (string)original.Path.Clone();
    4243    }
    4344
    4445    public Solution(ISymbolicExpressionTree tree, string path)
    45       : base("Solution", "A Robocode program.") {
     46      : base() {
    4647      this.Tree = tree;
    4748      this.Path = path;
Note: See TracChangeset for help on using the changeset viewer.