Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1237


Ignore:
Timestamp:
03/02/09 17:12:35 (15 years ago)
Author:
dwagner
Message:

Use DataRowChanged event instead of ApplyChangesToRow Method.
Moved OptionsDialog files to Options subfolder. (#497)

Location:
trunk/sources/HeuristicLab.Visualization
Files:
3 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/LineChart.cs

    r1233 r1237  
    152152      row.ValueChanged += OnRowValueChanged;
    153153      row.ValuesChanged += OnRowValuesChanged;
     154      row.DataRowChanged += OnDataRowChanged;
     155
    154156      if (row.Count > maxDataRowCount) {
    155157        maxDataRowCount = row.Count;
     
    225227      row.ValueChanged -= OnRowValueChanged;
    226228      row.ValuesChanged -= OnRowValuesChanged;
     229      row.DataRowChanged -= OnDataRowChanged;
    227230    }
    228231
     
    328331    private void canvasUI1_MouseDown(object sender, MouseEventArgs e) {
    329332      Focus();
    330       if (e.Button == System.Windows.Forms.MouseButtons.Right) {
    331         if (this.ParentForm != null)
    332           this.contextMenuStrip1.Show(e.Location.X + this.ParentForm.Location.X,
    333                                       e.Location.Y + this.ParentForm.Location.Y + 50);
    334         else {
    335           this.contextMenuStrip1.Show(e.Location.X, e.Location.Y);
    336         }
     333      if (e.Button == MouseButtons.Right) {
     334     
     335          this.contextMenuStrip1.Show(PointToScreen(e.Location));
     336     
    337337      }
    338338      else {
     
    416416    }
    417417
    418     public void ApplyChangesToRow(IDataRow row) {
     418    public void OnDataRowChanged(IDataRow row) {
    419419      foreach (LineShape ls in rowToLineShapes[row]) {
    420420        ls.LSColor = row.Color;
  • trunk/sources/HeuristicLab.Visualization/Options

    • Property svn:ignore set to
      *.bak
  • trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.Designer.cs

    r1195 r1237  
    3737      this.label3 = new System.Windows.Forms.Label();
    3838      this.tabPage2 = new System.Windows.Forms.TabPage();
     39      this.labelposition = new System.Windows.Forms.Label();
    3940      this.cbLabelPosition = new System.Windows.Forms.ComboBox();
    4041      this.OptionsDialogCancelButton = new System.Windows.Forms.Button();
    4142      this.OptionsDialogOkButton = new System.Windows.Forms.Button();
    42       this.labelposition = new System.Windows.Forms.Label();
     43      this.OptionsDialogApplyBtn = new System.Windows.Forms.Button();
    4344      this.Optionstabs.SuspendLayout();
    4445      this.tabPage1.SuspendLayout();
     
    8283      this.OptionsDialogSelectColorBt.Text = "Select";
    8384      this.OptionsDialogSelectColorBt.UseVisualStyleBackColor = true;
    84       this.OptionsDialogSelectColorBt.Click += new System.EventHandler(this.button1_Click);
     85      this.OptionsDialogSelectColorBt.Click += new System.EventHandler(this.OptionsDialogSelectColorBtn_Click);
    8586      //
    8687      // ColorPreviewTB
     
    103104      // LinestyleCB
    104105      //
     106      this.LinestyleCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    105107      this.LinestyleCB.FormattingEnabled = true;
    106108      this.LinestyleCB.Location = new System.Drawing.Point(146, 73);
     
    120122      // LineSelectCB
    121123      //
     124      this.LineSelectCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    122125      this.LineSelectCB.FormattingEnabled = true;
    123126      this.LineSelectCB.Location = new System.Drawing.Point(146, 30);
     
    150153      // LineThicknessCB
    151154      //
     155      this.LineThicknessCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    152156      this.LineThicknessCB.FormattingEnabled = true;
    153157      this.LineThicknessCB.Location = new System.Drawing.Point(142, 46);
     
    177181      this.tabPage2.UseVisualStyleBackColor = true;
    178182      //
     183      // labelposition
     184      //
     185      this.labelposition.AutoSize = true;
     186      this.labelposition.Location = new System.Drawing.Point(8, 38);
     187      this.labelposition.Name = "labelposition";
     188      this.labelposition.Size = new System.Drawing.Size(72, 13);
     189      this.labelposition.TabIndex = 1;
     190      this.labelposition.Text = "Labelposition:";
     191      //
    179192      // cbLabelPosition
    180193      //
     194      this.cbLabelPosition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    181195      this.cbLabelPosition.FormattingEnabled = true;
    182196      this.cbLabelPosition.Items.AddRange(new object[] {
     
    202216      // OptionsDialogOkButton
    203217      //
    204       this.OptionsDialogOkButton.Location = new System.Drawing.Point(132, 232);
     218      this.OptionsDialogOkButton.Location = new System.Drawing.Point(43, 232);
    205219      this.OptionsDialogOkButton.Name = "OptionsDialogOkButton";
    206220      this.OptionsDialogOkButton.Size = new System.Drawing.Size(75, 23);
     
    210224      this.OptionsDialogOkButton.Click += new System.EventHandler(this.OptionsDialogOkButton_Click);
    211225      //
    212       // labelposition
    213       //
    214       this.labelposition.AutoSize = true;
    215       this.labelposition.Location = new System.Drawing.Point(8, 38);
    216       this.labelposition.Name = "labelposition";
    217       this.labelposition.Size = new System.Drawing.Size(72, 13);
    218       this.labelposition.TabIndex = 1;
    219       this.labelposition.Text = "Labelposition:";
     226      // OptionsDialogApplyBtn
     227      //
     228      this.OptionsDialogApplyBtn.Location = new System.Drawing.Point(128, 231);
     229      this.OptionsDialogApplyBtn.Name = "OptionsDialogApplyBtn";
     230      this.OptionsDialogApplyBtn.Size = new System.Drawing.Size(75, 23);
     231      this.OptionsDialogApplyBtn.TabIndex = 3;
     232      this.OptionsDialogApplyBtn.Text = "Apply";
     233      this.OptionsDialogApplyBtn.UseVisualStyleBackColor = true;
     234      this.OptionsDialogApplyBtn.Click += new System.EventHandler(this.OptionsDialogApplyBtn_Click);
    220235      //
    221236      // OptionsDialog
     
    224239      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    225240      this.ClientSize = new System.Drawing.Size(292, 266);
     241      this.Controls.Add(this.OptionsDialogApplyBtn);
    226242      this.Controls.Add(this.OptionsDialogOkButton);
    227243      this.Controls.Add(this.OptionsDialogCancelButton);
     
    262278    private System.Windows.Forms.ComboBox cbLabelPosition;
    263279    private System.Windows.Forms.Label labelposition;
     280    private System.Windows.Forms.Button OptionsDialogApplyBtn;
    264281  }
    265282}
  • trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs

    r1233 r1237  
    55namespace HeuristicLab.Visualization.Options {
    66  public partial class OptionsDialog : Form {
    7     private LineChart lc;
     7    private readonly LineChart lc;
    88
    99    public OptionsDialog(LineChart lc) {
     
    1212    }
    1313
    14     private void button1_Click(object sender, EventArgs e) {
     14    private void OptionsDialogSelectColorBtn_Click(object sender, EventArgs e) {
    1515      ColorDialog dlg = new ColorDialog();
    1616      dlg.ShowDialog();
    17       this.ColorPreviewTB.BackColor = dlg.Color;
     17      ColorPreviewTB.BackColor = dlg.Color;
    1818    }
    1919
    2020    public IList<int> GetThicknesses() {
    21       return new List<int>() {0, 1, 2, 3, 4, 5, 6, 7, 8};
     21      return new List<int> {0, 1, 2, 3, 4, 5, 6, 7, 8};
    2222    }
    2323
    2424    public IList<DrawingStyle> GetStyles() {
    25       return new List<DrawingStyle>() {DrawingStyle.Solid, DrawingStyle.Dashed};
     25      return new List<DrawingStyle> {DrawingStyle.Solid, DrawingStyle.Dashed};
    2626    }
    2727
    2828    private void OptionsDialog_Load(object sender, EventArgs e) {
    29       this.LineSelectCB.DataSource = lc.GetRows();
    30       this.LineSelectCB.DisplayMember = "Label";
     29      if (lc.GetRows().Count != 0) {
     30        LineSelectCB.DataSource = lc.GetRows();
     31        LineSelectCB.DisplayMember = "Label";
    3132
    32       LineThicknessCB.DataSource = GetThicknesses();
    33       LinestyleCB.DataSource = GetStyles();
    34       LineSelectCB.SelectedIndex = 0;
    35       LineSelectCB_SelectedIndexChanged(this, null);
     33        LineThicknessCB.DataSource = GetThicknesses();
     34        LinestyleCB.DataSource = GetStyles();
     35        LineSelectCB.SelectedIndex = 0;
     36        LineSelectCB_SelectedIndexChanged(this, null);
     37      }
    3638    }
    3739
    3840    private void LineSelectCB_SelectedIndexChanged(object sender, EventArgs e) {
    39       IDataRow datarow = (IDataRow)this.LineSelectCB.SelectedValue;
    40 
    41       int index = this.LineThicknessCB.FindStringExact(datarow.Thickness.ToString());
    42       this.LineThicknessCB.SelectedIndex = index;
    43       index = this.LinestyleCB.FindStringExact(datarow.Style.ToString());
    44       LinestyleCB.SelectedIndex = index;
    45       this.ColorPreviewTB.BackColor = datarow.Color;
     41      if (LineSelectCB.SelectedValue != null) {
     42        int index =
     43          LineThicknessCB.FindStringExact(((IDataRow) LineSelectCB.SelectedValue).Thickness.ToString());
     44        LineThicknessCB.SelectedIndex = index;
     45        index = LinestyleCB.FindStringExact(((IDataRow) LineSelectCB.SelectedValue).Style.ToString());
     46        LinestyleCB.SelectedIndex = index;
     47        ColorPreviewTB.BackColor = ((IDataRow) LineSelectCB.SelectedValue).Color;
     48      }
    4649    }
    4750
    4851    private void OptionsDialogCancelButton_Click(object sender, EventArgs e) {
    49       this.Close();
     52      Close();
    5053    }
    5154
    5255    private void OptionsDialogOkButton_Click(object sender, EventArgs e) {
    53       IDataRow datarow = (IDataRow)this.LineSelectCB.SelectedValue;
     56      if (LineSelectCB.SelectedValue != null) {
     57        ((IDataRow) LineSelectCB.SelectedValue).Thickness = (int) LineThicknessCB.SelectedItem;
     58        ((IDataRow) LineSelectCB.SelectedValue).Color = ColorPreviewTB.BackColor;
     59        ((IDataRow) LineSelectCB.SelectedValue).Style = (DrawingStyle) LinestyleCB.SelectedItem;
     60      }
     61      Close();
     62    }
    5463
    55       datarow.Thickness = (int)this.LineThicknessCB.SelectedItem;
    56       datarow.Color = this.ColorPreviewTB.BackColor;
    57       datarow.Style = (DrawingStyle)this.LineThicknessCB.SelectedItem;
    58 
    59       this.lc.ApplyChangesToRow(datarow);
    60       this.Close();
     64    private void OptionsDialogApplyBtn_Click(object sender, EventArgs e) {
     65      if (LineSelectCB.SelectedValue != null) {
     66        ((IDataRow) LineSelectCB.SelectedValue).Thickness = (int) LineThicknessCB.SelectedItem;
     67        ((IDataRow) LineSelectCB.SelectedValue).Color = ColorPreviewTB.BackColor;
     68        ((IDataRow) LineSelectCB.SelectedValue).Style = (DrawingStyle) LinestyleCB.SelectedItem;
     69      }
    6170    }
    6271  }
Note: See TracChangeset for help on using the changeset viewer.