Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2040 for trunk/sources


Ignore:
Timestamp:
06/10/09 17:14:04 (15 years ago)
Author:
dwagner
Message:

dw: Added new dialog for adding lines using the options dialog. (#478)

Location:
trunk/sources/HeuristicLab.Visualization/3.2
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs

    r1996 r2040  
    33
    44namespace HeuristicLab.Visualization {
    5   public class AvgAggregator : DataRowBase {
     5  public interface IAggregator {
     6    void AddWatch(IDataRow dataRow);
     7    void RemoveWatch(IDataRow dataRow);
     8  }
     9
     10  public class AvgAggregator : DataRowBase, IAggregator {
    611    #region IAggregator Members
    712
     
    5863      curAvgValue = 0;
    5964      count = 0;
     65      this.RowSettings.LineType = DataRowType.SingleValue;
    6066    }
    6167
  • trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs

    r1996 r2040  
    33
    44namespace HeuristicLab.Visualization {
    5   public class AvgLineAggregator : DataRowBase {
     5  public class AvgLineAggregator : DataRowBase, IAggregator {
    66
    77    private readonly List<double> dataRow = new List<double>();
  • trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs

    r2028 r2040  
    224224      }
    225225    }
    226 
    227     public override string ToString() {
    228       return RowSettings.Label;
    229     }
    230226  }
    231227}
  • trunk/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs

    r1996 r2040  
    1717    }
    1818
     19    public string Label{
     20      get { return rowSettings.Label; }
     21    }
     22
    1923    protected DataRowBase() {
    2024      rowSettings = new DataRowSettings();
     25      rowSettings.LineType = DataRowType.Normal; //default value for most lines and aggregators
    2126      rowSettings.DataVisualSettingChanged += value_DataVisualSettingChanged;
    2227    }
  • trunk/sources/HeuristicLab.Visualization/3.2/FloatingAvgAggregator.cs

    r1996 r2040  
    33
    44namespace HeuristicLab.Visualization {
    5   public class FloatingAvgAggregator : DataRowBase {
     5  public class FloatingAvgAggregator : DataRowBase, IAggregator {
    66
    77    private readonly List<double> dataRow = new List<double>();
  • trunk/sources/HeuristicLab.Visualization/3.2/HeuristicLab.Visualization-3.2.csproj

    r1993 r2040  
    116116    <Compile Include="LabelProvider\ContinuousLabelProvider.cs" />
    117117    <Compile Include="LabelProvider\DiscreteLabelProvider.cs" />
     118    <Compile Include="Options\AddLineDialog.cs">
     119      <SubType>Form</SubType>
     120    </Compile>
     121    <Compile Include="Options\AddLineDialog.Designer.cs">
     122      <DependentUpon>AddLineDialog.cs</DependentUpon>
     123    </Compile>
    118124    <Compile Include="Options\ColorSelection.cs">
    119125      <SubType>UserControl</SubType>
     
    205211      <SubType>Designer</SubType>
    206212    </EmbeddedResource>
     213    <EmbeddedResource Include="Options\AddLineDialog.resx">
     214      <DependentUpon>AddLineDialog.cs</DependentUpon>
     215    </EmbeddedResource>
    207216    <EmbeddedResource Include="Options\ColorSelection.resx">
    208217      <DependentUpon>ColorSelection.cs</DependentUpon>
  • trunk/sources/HeuristicLab.Visualization/3.2/IDataRow.cs

    r1996 r2040  
    2323    void RemoveValue(int index);
    2424    void RemoveValues(int index, int count);
    25 
     25   
    2626    int Count { get; }
    2727    double this[int index] { get; set; }
     
    3030    double MaxValue { get; }
    3131
     32    string Label{ get;}
     33
    3234    event ValuesChangedHandler ValuesChanged;
    3335    event ValueChangedHandler ValueChanged;
  • trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs

    r1996 r2040  
    33
    44namespace HeuristicLab.Visualization {
    5   public class MaxAggregator : DataRowBase {
     5  public class MaxAggregator : DataRowBase, IAggregator {
    66    #region IAggregator Members
    77
     
    2323
    2424    #endregion
     25
     26    public MaxAggregator() {
     27      this.RowSettings.LineType = DataRowType.SingleValue;
     28    }
     29
    2530
    2631    List<IDataRow> dataRowWatches = new List<IDataRow>();
  • trunk/sources/HeuristicLab.Visualization/3.2/MinAggregator.cs

    r1996 r2040  
    33
    44namespace HeuristicLab.Visualization {
    5   public class MinAggregator : DataRowBase {
     5  public class MinAggregator : DataRowBase, IAggregator {
    66    #region IAggregator Members
    77
     
    2323
    2424    #endregion
     25
     26    public MinAggregator() {
     27      this.RowSettings.LineType=DataRowType.SingleValue;
     28    }
    2529
    2630    readonly List<IDataRow> dataRowWatches = new List<IDataRow>();
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.Designer.cs

    r1885 r2040  
    2626      this.Optionstabs = new System.Windows.Forms.TabControl();
    2727      this.tabPage1 = new System.Windows.Forms.TabPage();
     28      this.btnAddLine = new System.Windows.Forms.Button();
    2829      this.label2 = new System.Windows.Forms.Label();
    2930      this.LinestyleCB = new System.Windows.Forms.ComboBox();
     
    3132      this.LineSelectCB = new System.Windows.Forms.ComboBox();
    3233      this.groupBox1 = new System.Windows.Forms.GroupBox();
     34      this.selectedLineColorSelection = new HeuristicLab.Visualization.Options.ColorSelection();
    3335      this.MarkercheckBox = new System.Windows.Forms.CheckBox();
    3436      this.label4 = new System.Windows.Forms.Label();
     
    4446      this.btnChangeTitleFont = new System.Windows.Forms.Button();
    4547      this.tpXAxis = new System.Windows.Forms.TabPage();
     48      this.groupBox2 = new System.Windows.Forms.GroupBox();
     49      this.label6 = new System.Windows.Forms.Label();
     50      this.xAxisGridColorSelection = new HeuristicLab.Visualization.Options.ColorSelection();
    4651      this.chkShowXAxisGrid = new System.Windows.Forms.CheckBox();
    4752      this.btnChangeXAxisFont = new System.Windows.Forms.Button();
     
    5257      this.flpShowYAxis = new System.Windows.Forms.FlowLayoutPanel();
    5358      this.fdFont = new System.Windows.Forms.FontDialog();
    54       this.label6 = new System.Windows.Forms.Label();
    55       this.groupBox2 = new System.Windows.Forms.GroupBox();
    56       this.selectedLineColorSelection = new HeuristicLab.Visualization.Options.ColorSelection();
    57       this.xAxisGridColorSelection = new HeuristicLab.Visualization.Options.ColorSelection();
    5859      this.Optionstabs.SuspendLayout();
    5960      this.tabPage1.SuspendLayout();
     
    6263      this.tpTitle.SuspendLayout();
    6364      this.tpXAxis.SuspendLayout();
     65      this.groupBox2.SuspendLayout();
    6466      this.tpYAxes.SuspendLayout();
    6567      this.gbxYAxisClipChangeable.SuspendLayout();
    6668      this.gbxShowYAxis.SuspendLayout();
    67       this.groupBox2.SuspendLayout();
    6869      this.SuspendLayout();
    6970      //
     
    8485      // tabPage1
    8586      //
     87      this.tabPage1.Controls.Add(this.btnAddLine);
    8688      this.tabPage1.Controls.Add(this.label2);
    8789      this.tabPage1.Controls.Add(this.LinestyleCB);
     
    9799      this.tabPage1.UseVisualStyleBackColor = true;
    98100      //
     101      // btnAddLine
     102      //
     103      this.btnAddLine.Location = new System.Drawing.Point(192, 177);
     104      this.btnAddLine.Name = "btnAddLine";
     105      this.btnAddLine.Size = new System.Drawing.Size(75, 23);
     106      this.btnAddLine.TabIndex = 10;
     107      this.btnAddLine.Text = "Add Line";
     108      this.btnAddLine.UseVisualStyleBackColor = true;
     109      this.btnAddLine.Click += new System.EventHandler(this.btnAddLine_Click);
     110      //
    99111      // label2
    100112      //
     
    144156      this.groupBox1.Location = new System.Drawing.Point(4, 54);
    145157      this.groupBox1.Name = "groupBox1";
    146       this.groupBox1.Size = new System.Drawing.Size(274, 129);
     158      this.groupBox1.Size = new System.Drawing.Size(274, 120);
    147159      this.groupBox1.TabIndex = 9;
    148160      this.groupBox1.TabStop = false;
    149161      this.groupBox1.Text = "Details";
    150162      //
     163      // selectedLineColorSelection
     164      //
     165      this.selectedLineColorSelection.Color = System.Drawing.SystemColors.Control;
     166      this.selectedLineColorSelection.Location = new System.Drawing.Point(142, 73);
     167      this.selectedLineColorSelection.Name = "selectedLineColorSelection";
     168      this.selectedLineColorSelection.Size = new System.Drawing.Size(121, 25);
     169      this.selectedLineColorSelection.TabIndex = 10;
     170      this.selectedLineColorSelection.ColorChanged += new HeuristicLab.Visualization.Options.ColorChangedHandler(this.selectedLineColorSelection_ColorChanged);
     171      //
    151172      // MarkercheckBox
    152173      //
    153174      this.MarkercheckBox.AutoSize = true;
    154       this.MarkercheckBox.Location = new System.Drawing.Point(142, 106);
     175      this.MarkercheckBox.Location = new System.Drawing.Point(204, 103);
    155176      this.MarkercheckBox.Name = "MarkercheckBox";
    156177      this.MarkercheckBox.Size = new System.Drawing.Size(59, 17);
     
    280301      this.tpXAxis.UseVisualStyleBackColor = true;
    281302      //
     303      // groupBox2
     304      //
     305      this.groupBox2.Controls.Add(this.label6);
     306      this.groupBox2.Controls.Add(this.xAxisGridColorSelection);
     307      this.groupBox2.Controls.Add(this.chkShowXAxisGrid);
     308      this.groupBox2.Location = new System.Drawing.Point(8, 42);
     309      this.groupBox2.Name = "groupBox2";
     310      this.groupBox2.Size = new System.Drawing.Size(205, 94);
     311      this.groupBox2.TabIndex = 6;
     312      this.groupBox2.TabStop = false;
     313      this.groupBox2.Text = "Grid";
     314      //
     315      // label6
     316      //
     317      this.label6.AutoSize = true;
     318      this.label6.Location = new System.Drawing.Point(20, 55);
     319      this.label6.Name = "label6";
     320      this.label6.Size = new System.Drawing.Size(31, 13);
     321      this.label6.TabIndex = 5;
     322      this.label6.Text = "Color";
     323      //
     324      // xAxisGridColorSelection
     325      //
     326      this.xAxisGridColorSelection.Color = System.Drawing.SystemColors.Control;
     327      this.xAxisGridColorSelection.Location = new System.Drawing.Point(54, 49);
     328      this.xAxisGridColorSelection.Name = "xAxisGridColorSelection";
     329      this.xAxisGridColorSelection.Size = new System.Drawing.Size(126, 25);
     330      this.xAxisGridColorSelection.TabIndex = 4;
     331      this.xAxisGridColorSelection.ColorChanged += new HeuristicLab.Visualization.Options.ColorChangedHandler(this.xAxisGridColorSelection_ColorChanged);
     332      //
    282333      // chkShowXAxisGrid
    283334      //
     
    355406      this.flpShowYAxis.Size = new System.Drawing.Size(275, 57);
    356407      this.flpShowYAxis.TabIndex = 0;
    357       //
    358       // label6
    359       //
    360       this.label6.AutoSize = true;
    361       this.label6.Location = new System.Drawing.Point(20, 55);
    362       this.label6.Name = "label6";
    363       this.label6.Size = new System.Drawing.Size(31, 13);
    364       this.label6.TabIndex = 5;
    365       this.label6.Text = "Color";
    366       //
    367       // groupBox2
    368       //
    369       this.groupBox2.Controls.Add(this.label6);
    370       this.groupBox2.Controls.Add(this.xAxisGridColorSelection);
    371       this.groupBox2.Controls.Add(this.chkShowXAxisGrid);
    372       this.groupBox2.Location = new System.Drawing.Point(8, 42);
    373       this.groupBox2.Name = "groupBox2";
    374       this.groupBox2.Size = new System.Drawing.Size(205, 94);
    375       this.groupBox2.TabIndex = 6;
    376       this.groupBox2.TabStop = false;
    377       this.groupBox2.Text = "Grid";
    378       //
    379       // selectedLineColorSelection
    380       //
    381       this.selectedLineColorSelection.Color = System.Drawing.SystemColors.Control;
    382       this.selectedLineColorSelection.Location = new System.Drawing.Point(142, 73);
    383       this.selectedLineColorSelection.Name = "selectedLineColorSelection";
    384       this.selectedLineColorSelection.Size = new System.Drawing.Size(121, 25);
    385       this.selectedLineColorSelection.TabIndex = 10;
    386       this.selectedLineColorSelection.ColorChanged += new HeuristicLab.Visualization.Options.ColorChangedHandler(this.selectedLineColorSelection_ColorChanged);
    387       //
    388       // xAxisGridColorSelection
    389       //
    390       this.xAxisGridColorSelection.Color = System.Drawing.SystemColors.Control;
    391       this.xAxisGridColorSelection.Location = new System.Drawing.Point(54, 49);
    392       this.xAxisGridColorSelection.Name = "xAxisGridColorSelection";
    393       this.xAxisGridColorSelection.Size = new System.Drawing.Size(126, 25);
    394       this.xAxisGridColorSelection.TabIndex = 4;
    395       this.xAxisGridColorSelection.ColorChanged += new HeuristicLab.Visualization.Options.ColorChangedHandler(this.xAxisGridColorSelection_ColorChanged);
    396408      //
    397409      // Options
     
    413425      this.tpTitle.PerformLayout();
    414426      this.tpXAxis.ResumeLayout(false);
     427      this.groupBox2.ResumeLayout(false);
     428      this.groupBox2.PerformLayout();
    415429      this.tpYAxes.ResumeLayout(false);
    416430      this.tpYAxes.PerformLayout();
     
    419433      this.gbxShowYAxis.ResumeLayout(false);
    420434      this.gbxShowYAxis.PerformLayout();
    421       this.groupBox2.ResumeLayout(false);
    422       this.groupBox2.PerformLayout();
    423435      this.ResumeLayout(false);
    424436
     
    459471    private System.Windows.Forms.Label label6;
    460472    private ColorSelection xAxisGridColorSelection;
     473    private System.Windows.Forms.Button btnAddLine;
     474    private AddLineDialog addLineDialog;
    461475  }
    462476}
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.cs

    r2028 r2040  
    1010    private ViewSettings viewSettings;
    1111    private ViewSettings oldViewSettings;
    12     private LineParams[] oldLineParams;
     12    private List<LineParams> oldLineParams;
    1313    private string oldTitle;
    1414    private Dictionary<CheckBox, bool> ShowYAxisBoxes;
     
    154154
    155155    private void Options_Load(object sender, EventArgs e) {
     156      model.DataRowAdded += model_DataRowAdded;
    156157      oldShowXAxisGrid = model.XAxis.ShowGrid;
    157158      chkShowXAxisGrid.Checked = model.XAxis.ShowGrid;
     
    165166      InitTabPageLines();
    166167      InitTabPageYAxes();
     168    }
     169
     170    void model_DataRowAdded(IDataRow row)
     171    {
     172      LineSelectCB.Items.Add(row);
     173      oldLineParams.Add(new LineParams(row));
    167174    }
    168175
     
    170177      if (model.Rows.Count != 0) {
    171178        int index = 0;
    172         oldLineParams = new LineParams[model.Rows.Count];
     179        oldLineParams = new List<LineParams>();
    173180        foreach (var row in model.Rows) {
    174           oldLineParams[index++] = new LineParams(row);
     181          oldLineParams.Add(new LineParams(row));
     182          LineSelectCB.Items.Add(row);
    175183        }
    176184        LineThicknessCB.DataSource = GetThicknesses();
     
    180188        MarkercheckBox.Checked = model.Rows[0].RowSettings.ShowMarkers;
    181189
    182         LineSelectCB.DataSource = model.Rows;
     190      // LineSelectCB.DataSource = model.Rows;
     191        LineSelectCB.DisplayMember = "RowSettings.Label";
     192
    183193
    184194        LineSelectCB.SelectedIndex = 0;
     
    213223
    214224    private void LineSelectCB_SelectedIndexChanged(object sender, EventArgs e) {
    215       if (LineSelectCB.SelectedValue != null) {
     225      if (LineSelectCB.SelectedItem != null) {
    216226        /*  int index =
    217227            LineThicknessCB.FindStringExact(((IDataRow)LineSelectCB.SelectedValue).Thickness.ToString());
     
    219229          index = LinestyleCB.FindStringExact(((IDataRow)LineSelectCB.SelectedValue).Style.ToString());
    220230          LinestyleCB.SelectedIndex = index;  */
    221         LineThicknessCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedValue).RowSettings.Thickness;
    222         LinestyleCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedValue).RowSettings.Style;
    223         selectedLineColorSelection.Color = ((IDataRow)LineSelectCB.SelectedValue).RowSettings.Color;
    224         MarkercheckBox.Checked = ((IDataRow)LineSelectCB.SelectedValue).RowSettings.ShowMarkers;
     231        LineThicknessCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedItem).RowSettings.Thickness;
     232        LinestyleCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedItem).RowSettings.Style;
     233        selectedLineColorSelection.Color = ((IDataRow)LineSelectCB.SelectedItem).RowSettings.Color;
     234        MarkercheckBox.Checked = ((IDataRow)LineSelectCB.SelectedItem).RowSettings.ShowMarkers;
    225235      }
    226236    }
     
    232242
    233243    private void LinestyleCB_SelectedIndexChanged(object sender, EventArgs e) {
    234       if (LineSelectCB.SelectedValue != null) {
    235         ((IDataRow)LineSelectCB.SelectedValue).RowSettings.Style = (DrawingStyle)LinestyleCB.SelectedItem;
     244      if (LineSelectCB.SelectedItem != null) {
     245        ((IDataRow)LineSelectCB.SelectedItem).RowSettings.Style = (DrawingStyle)LinestyleCB.SelectedItem;
    236246      }
    237247    }
    238248
    239249    private void LineThicknessCB_SelectedIndexChanged(object sender, EventArgs e) {
    240       if (LineSelectCB.SelectedValue != null) {
    241         ((IDataRow)LineSelectCB.SelectedValue).RowSettings.Thickness = (int)LineThicknessCB.SelectedItem;
     250      if (LineSelectCB.SelectedItem != null) {
     251        ((IDataRow)LineSelectCB.SelectedItem).RowSettings.Thickness = (int)LineThicknessCB.SelectedItem;
    242252      }
    243253    }
    244254
    245255    private void MarkercheckBox_CheckedChanged(object sender, EventArgs e) {
    246       if (LineSelectCB.SelectedValue != null) {
    247         ((IDataRow)LineSelectCB.SelectedValue).RowSettings.ShowMarkers = MarkercheckBox.Checked;
     256      if (LineSelectCB.SelectedItem != null) {
     257        ((IDataRow)LineSelectCB.SelectedItem).RowSettings.ShowMarkers = MarkercheckBox.Checked;
    248258      }
    249259    }
     
    259269
    260270    private void selectedLineColorSelection_ColorChanged(ColorSelection sender) {
    261       ((IDataRow)LineSelectCB.SelectedValue).RowSettings.Color = selectedLineColorSelection.Color;
     271      if(LineSelectCB.SelectedItem!=null)
     272      ((IDataRow)LineSelectCB.SelectedItem).RowSettings.Color = selectedLineColorSelection.Color;
    262273    }
    263274
     
    265276      model.XAxis.GridColor = xAxisGridColorSelection.Color;
    266277    }
     278
     279    private void btnAddLine_Click(object sender, EventArgs e) {
     280      addLineDialog = new AddLineDialog(model);
     281      addLineDialog.Show();
     282    }
    267283  }
    268284}
Note: See TracChangeset for help on using the changeset viewer.