Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2817-BinPackingSpeedup/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.cs @ 18242

Last change on this file since 18242 was 16140, checked in by abeham, 6 years ago

#2817: updated to trunk r15680

File size: 24.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Drawing;
24using System.Windows.Forms;
25using HeuristicLab.MainForm;
26using HeuristicLab.MainForm.WindowsForms;
27
28namespace HeuristicLab.Analysis.Views {
29  [View("DataTable Visual Properties")]
30  public partial class DataTableVisualPropertiesControl : UserControl {
31    protected bool SuppressEvents { get; set; }
32
33    private DataTableVisualProperties content;
34    public DataTableVisualProperties Content {
35      get { return content; }
36      set {
37        bool changed = (value != content);
38        content = value;
39        if (changed) OnContentChanged();
40      }
41    }
42
43    public DataTableVisualPropertiesControl() {
44      InitializeComponent();
45      errorProvider.SetIconAlignment(xAxisPrimaryMinimumFixedTextBox, ErrorIconAlignment.MiddleLeft);
46      errorProvider.SetIconAlignment(xAxisPrimaryMaximumFixedTextBox, ErrorIconAlignment.MiddleLeft);
47      errorProvider.SetIconAlignment(xAxisSecondaryMinimumFixedTextBox, ErrorIconAlignment.MiddleLeft);
48      errorProvider.SetIconAlignment(xAxisSecondaryMaximumFixedTextBox, ErrorIconAlignment.MiddleLeft);
49      errorProvider.SetIconAlignment(yAxisPrimaryMinimumFixedTextBox, ErrorIconAlignment.MiddleLeft);
50      errorProvider.SetIconAlignment(yAxisPrimaryMaximumFixedTextBox, ErrorIconAlignment.MiddleLeft);
51      errorProvider.SetIconAlignment(yAxisSecondaryMinimumFixedTextBox, ErrorIconAlignment.MiddleLeft);
52      errorProvider.SetIconAlignment(yAxisSecondaryMaximumFixedTextBox, ErrorIconAlignment.MiddleLeft);
53      errorProvider.SetIconPadding(xAxisPrimaryMinimumFixedTextBox, 2);
54      errorProvider.SetIconPadding(xAxisPrimaryMaximumFixedTextBox, 2);
55      errorProvider.SetIconPadding(xAxisSecondaryMinimumFixedTextBox, 2);
56      errorProvider.SetIconPadding(xAxisSecondaryMaximumFixedTextBox, 2);
57      errorProvider.SetIconPadding(yAxisPrimaryMinimumFixedTextBox, 2);
58      errorProvider.SetIconPadding(yAxisPrimaryMaximumFixedTextBox, 2);
59      errorProvider.SetIconPadding(yAxisSecondaryMinimumFixedTextBox, 2);
60      errorProvider.SetIconPadding(yAxisSecondaryMaximumFixedTextBox, 2);
61      histogramAggregationComboBox.DataSource = Enum.GetValues(typeof(DataTableVisualProperties.DataTableHistogramAggregation));
62    }
63
64    protected virtual void OnContentChanged() {
65      SuppressEvents = true;
66      try {
67        if (Content == null) {
68          titleFontLabel.Text = "( none )";
69          axisFontLabel.Text = "( none )";
70          titleTextBox.Text = string.Empty;
71
72          xAxisPrimaryTitleTextBox.Text = string.Empty;
73          xAxisPrimaryMinimumAutoRadioButton.Checked = false;
74          xAxisPrimaryMinimumFixedRadioButton.Checked = false;
75          xAxisPrimaryMinimumFixedTextBox.Text = string.Empty;
76          xAxisPrimaryMaximumAutoRadioButton.Checked = false;
77          xAxisPrimaryMaximumFixedRadioButton.Checked = false;
78          xAxisPrimaryMaximumFixedTextBox.Text = string.Empty;
79          xAxisPrimaryLogScaleCheckBox.Checked = false;
80          xAxisSecondaryTitleTextBox.Text = string.Empty;
81          xAxisSecondaryMinimumAutoRadioButton.Checked = false;
82          xAxisSecondaryMinimumFixedRadioButton.Checked = false;
83          xAxisSecondaryMinimumFixedTextBox.Text = string.Empty;
84          xAxisSecondaryMaximumAutoRadioButton.Checked = false;
85          xAxisSecondaryMaximumFixedRadioButton.Checked = false;
86          xAxisSecondaryMaximumFixedTextBox.Text = string.Empty;
87          xAxisSecondaryLogScaleCheckBox.Checked = false;
88
89          yAxisPrimaryTitleTextBox.Text = string.Empty;
90          yAxisPrimaryMinimumAutoRadioButton.Checked = false;
91          yAxisPrimaryMinimumFixedRadioButton.Checked = false;
92          yAxisPrimaryMinimumFixedTextBox.Text = string.Empty;
93          yAxisPrimaryMaximumAutoRadioButton.Checked = false;
94          yAxisPrimaryMaximumFixedRadioButton.Checked = false;
95          yAxisPrimaryMaximumFixedTextBox.Text = string.Empty;
96          yAxisPrimaryLogScaleCheckBox.Checked = false;
97          yAxisSecondaryTitleTextBox.Text = string.Empty;
98          yAxisSecondaryMinimumAutoRadioButton.Checked = false;
99          yAxisSecondaryMinimumFixedRadioButton.Checked = false;
100          yAxisSecondaryMinimumFixedTextBox.Text = string.Empty;
101          yAxisSecondaryMaximumAutoRadioButton.Checked = false;
102          yAxisSecondaryMaximumFixedRadioButton.Checked = false;
103          yAxisSecondaryMaximumFixedTextBox.Text = string.Empty;
104          yAxisSecondaryLogScaleCheckBox.Checked = false;
105
106          histogramBinsNumericUpDown.Value = 1;
107          histogramBinsApproximatelyRadioButton.Checked = false;
108          histogramBinsExactRadioButton.Checked = false;
109          histogramAggregationComboBox.SelectedIndex = -1;
110        } else {
111          titleFontLabel.Text = "( " + FormatFont(Content.TitleFont) + " )";
112          axisFontLabel.Text = "( " + FormatFont(Content.AxisTitleFont) + " )";
113          titleTextBox.Text = Content.Title;
114
115          xAxisPrimaryTitleTextBox.Text = Content.XAxisTitle;
116          xAxisPrimaryMinimumAutoRadioButton.Checked = Content.XAxisMinimumAuto;
117          xAxisPrimaryMinimumFixedRadioButton.Checked = !Content.XAxisMinimumAuto;
118          xAxisPrimaryMinimumFixedTextBox.Text = Content.XAxisMinimumFixedValue.ToString();
119          xAxisPrimaryMaximumAutoRadioButton.Checked = Content.XAxisMaximumAuto;
120          xAxisPrimaryMaximumFixedRadioButton.Checked = !Content.XAxisMaximumAuto;
121          xAxisPrimaryMaximumFixedTextBox.Text = Content.XAxisMaximumFixedValue.ToString();
122          xAxisPrimaryLogScaleCheckBox.Checked = Content.XAxisLogScale;
123          xAxisSecondaryTitleTextBox.Text = Content.SecondXAxisTitle;
124          xAxisSecondaryMinimumAutoRadioButton.Checked = Content.SecondXAxisMinimumAuto;
125          xAxisSecondaryMinimumFixedRadioButton.Checked = !Content.SecondXAxisMinimumAuto;
126          xAxisSecondaryMinimumFixedTextBox.Text = Content.SecondXAxisMinimumFixedValue.ToString();
127          xAxisSecondaryMaximumAutoRadioButton.Checked = Content.SecondXAxisMaximumAuto;
128          xAxisSecondaryMaximumFixedRadioButton.Checked = !Content.SecondXAxisMaximumAuto;
129          xAxisSecondaryMaximumFixedTextBox.Text = Content.SecondXAxisMaximumFixedValue.ToString();
130          xAxisSecondaryLogScaleCheckBox.Checked = Content.SecondXAxisLogScale;
131
132          yAxisPrimaryTitleTextBox.Text = Content.YAxisTitle;
133          yAxisPrimaryMinimumAutoRadioButton.Checked = Content.YAxisMinimumAuto;
134          yAxisPrimaryMinimumFixedRadioButton.Checked = !Content.YAxisMinimumAuto;
135          yAxisPrimaryMinimumFixedTextBox.Text = Content.YAxisMinimumFixedValue.ToString();
136          yAxisPrimaryMaximumAutoRadioButton.Checked = Content.YAxisMaximumAuto;
137          yAxisPrimaryMaximumFixedRadioButton.Checked = !Content.YAxisMaximumAuto;
138          yAxisPrimaryMaximumFixedTextBox.Text = Content.YAxisMaximumFixedValue.ToString();
139          yAxisPrimaryLogScaleCheckBox.Checked = Content.YAxisLogScale;
140          yAxisSecondaryTitleTextBox.Text = Content.SecondYAxisTitle;
141          yAxisSecondaryMinimumAutoRadioButton.Checked = Content.SecondYAxisMinimumAuto;
142          yAxisSecondaryMinimumFixedRadioButton.Checked = !Content.SecondYAxisMinimumAuto;
143          yAxisSecondaryMinimumFixedTextBox.Text = Content.SecondYAxisMinimumFixedValue.ToString();
144          yAxisSecondaryMaximumAutoRadioButton.Checked = Content.SecondYAxisMaximumAuto;
145          yAxisSecondaryMaximumFixedRadioButton.Checked = !Content.SecondYAxisMaximumAuto;
146          yAxisSecondaryMaximumFixedTextBox.Text = Content.SecondYAxisMaximumFixedValue.ToString();
147          yAxisSecondaryLogScaleCheckBox.Checked = Content.SecondYAxisLogScale;
148
149          if (Content.HistogramBins < histogramBinsNumericUpDown.Minimum)
150            histogramBinsNumericUpDown.Value = histogramBinsNumericUpDown.Minimum;
151          else if (Content.HistogramBins > histogramBinsNumericUpDown.Maximum)
152            histogramBinsNumericUpDown.Value = histogramBinsNumericUpDown.Maximum;
153          else histogramBinsNumericUpDown.Value = Content.HistogramBins;
154          histogramBinsApproximatelyRadioButton.Checked = !Content.HistogramExactBins;
155          histogramBinsExactRadioButton.Checked = Content.HistogramExactBins;
156          histogramAggregationComboBox.SelectedItem = Content.HistogramAggregation;
157        }
158      } finally { SuppressEvents = false; }
159      SetEnabledStateOfControls();
160    }
161
162    protected virtual void SetEnabledStateOfControls() {
163      axisTabControl.Enabled = Content != null;
164      xAxisPrimaryMinimumFixedTextBox.Enabled = xAxisPrimaryMinimumFixedRadioButton.Checked;
165      xAxisPrimaryMaximumFixedTextBox.Enabled = xAxisPrimaryMaximumFixedRadioButton.Checked;
166      xAxisSecondaryMinimumFixedTextBox.Enabled = xAxisSecondaryMinimumFixedRadioButton.Checked;
167      xAxisSecondaryMaximumFixedTextBox.Enabled = xAxisSecondaryMaximumFixedRadioButton.Checked;
168
169      yAxisPrimaryMinimumFixedTextBox.Enabled = yAxisPrimaryMinimumFixedRadioButton.Checked;
170      yAxisPrimaryMaximumFixedTextBox.Enabled = yAxisPrimaryMaximumFixedRadioButton.Checked;
171      yAxisSecondaryMinimumFixedTextBox.Enabled = yAxisSecondaryMinimumFixedRadioButton.Checked;
172      yAxisSecondaryMaximumFixedTextBox.Enabled = yAxisSecondaryMaximumFixedRadioButton.Checked;
173    }
174
175    #region Event Handlers
176    private void yPrimaryTitleTextBox_Validated(object sender, System.EventArgs e) {
177      if (!SuppressEvents && Content != null) {
178        Content.YAxisTitle = yAxisPrimaryTitleTextBox.Text;
179      }
180    }
181
182    private void ySecondaryTitleTextBox_Validated(object sender, System.EventArgs e) {
183      if (!SuppressEvents && Content != null) {
184        Content.SecondYAxisTitle = yAxisSecondaryTitleTextBox.Text;
185      }
186    }
187
188    private void xPrimaryTitleTextBox_Validated(object sender, System.EventArgs e) {
189      if (!SuppressEvents && Content != null) {
190        Content.XAxisTitle = xAxisPrimaryTitleTextBox.Text;
191      }
192    }
193
194    private void xSecondaryTitleTextBox_Validated(object sender, System.EventArgs e) {
195      if (!SuppressEvents && Content != null) {
196        Content.SecondXAxisTitle = xAxisSecondaryTitleTextBox.Text;
197      }
198    }
199
200    private void xAxisPrimaryMinimumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
201      if (!SuppressEvents && Content != null) {
202        TextBox tb = (TextBox)sender;
203        double val;
204        if (double.TryParse(tb.Text, out val)) {
205          if (val >= Content.XAxisMaximumFixedValue) {
206            errorProvider.SetError(tb, "Number must be smaller than maximum.");
207            e.Cancel = true;
208          } else {
209            Content.XAxisMinimumFixedValue = val;
210            errorProvider.SetError(tb, string.Empty);
211          }
212        } else {
213          errorProvider.SetError(tb, "Not a valid number.");
214          e.Cancel = true;
215        }
216      }
217    }
218
219    private void xAxisPrimaryMaximumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
220      if (!SuppressEvents && Content != null) {
221        TextBox tb = (TextBox)sender;
222        double val;
223        if (double.TryParse(tb.Text, out val)) {
224          if (val <= Content.XAxisMinimumFixedValue) {
225            errorProvider.SetError(tb, "Number must be greater than minimum.");
226            e.Cancel = true;
227          } else {
228            Content.XAxisMaximumFixedValue = val;
229            errorProvider.SetError(tb, string.Empty);
230          }
231        } else {
232          errorProvider.SetError(tb, "Not a valid number.");
233          e.Cancel = true;
234        }
235      }
236    }
237
238    private void xAxisSecondaryMinimumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
239      if (!SuppressEvents && Content != null) {
240        TextBox tb = (TextBox)sender;
241        double val;
242        if (double.TryParse(tb.Text, out val)) {
243          if (val >= Content.SecondXAxisMaximumFixedValue) {
244            errorProvider.SetError(tb, "Number must be smaller than maximum.");
245            e.Cancel = true;
246          } else {
247            Content.SecondXAxisMinimumFixedValue = val;
248            errorProvider.SetError(tb, string.Empty);
249          }
250        } else {
251          errorProvider.SetError(tb, "Not a valid number.");
252          e.Cancel = true;
253        }
254      }
255    }
256
257    private void xAxisSecondaryMaximumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
258      if (!SuppressEvents && Content != null) {
259        TextBox tb = (TextBox)sender;
260        double val;
261        if (double.TryParse(tb.Text, out val)) {
262          if (val <= Content.SecondXAxisMinimumFixedValue) {
263            errorProvider.SetError(tb, "Number must be greater than minimum.");
264            e.Cancel = true;
265          } else {
266            Content.SecondXAxisMaximumFixedValue = val;
267            errorProvider.SetError(tb, string.Empty);
268          }
269        } else {
270          errorProvider.SetError(tb, "Not a valid number.");
271          e.Cancel = true;
272        }
273      }
274    }
275
276    private void yAxisPrimaryMinimumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
277      if (!SuppressEvents && Content != null) {
278        TextBox tb = (TextBox)sender;
279        double val;
280        if (double.TryParse(tb.Text, out val)) {
281          if (val >= Content.YAxisMaximumFixedValue) {
282            errorProvider.SetError(tb, "Number must be smaller than maximum.");
283            e.Cancel = true;
284          } else {
285            Content.YAxisMinimumFixedValue = val;
286            errorProvider.SetError(tb, string.Empty);
287          }
288        } else {
289          errorProvider.SetError(tb, "Not a valid number.");
290          e.Cancel = true;
291        }
292      }
293    }
294
295    private void yAxisPrimaryMaximumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
296      if (!SuppressEvents && Content != null) {
297        TextBox tb = (TextBox)sender;
298        double val;
299        if (double.TryParse(tb.Text, out val)) {
300          if (val <= Content.YAxisMinimumFixedValue) {
301            errorProvider.SetError(tb, "Number must be greater than minimum.");
302            e.Cancel = true;
303          } else {
304            Content.YAxisMaximumFixedValue = val;
305            errorProvider.SetError(tb, string.Empty);
306          }
307        } else {
308          errorProvider.SetError(tb, "Not a valid number.");
309          e.Cancel = true;
310        }
311      }
312    }
313
314    private void yAxisSecondaryMinimumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
315      if (!SuppressEvents && Content != null) {
316        TextBox tb = (TextBox)sender;
317        double val;
318        if (double.TryParse(tb.Text, out val)) {
319          if (val >= Content.SecondYAxisMaximumFixedValue) {
320            errorProvider.SetError(tb, "Number must be smaller than maximum.");
321            e.Cancel = true;
322          } else {
323            Content.SecondYAxisMinimumFixedValue = val;
324            errorProvider.SetError(tb, string.Empty);
325          }
326        } else {
327          errorProvider.SetError(tb, "Not a valid number.");
328          e.Cancel = true;
329        }
330      }
331    }
332
333    private void yAxisSecondaryMaximumFixedTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
334      if (!SuppressEvents && Content != null) {
335        TextBox tb = (TextBox)sender;
336        double val;
337        if (double.TryParse(tb.Text, out val)) {
338          if (val <= Content.SecondYAxisMinimumFixedValue) {
339            errorProvider.SetError(tb, "Number must be greater than minimum.");
340            e.Cancel = true;
341          } else {
342            Content.SecondYAxisMaximumFixedValue = val;
343            errorProvider.SetError(tb, string.Empty);
344          }
345        } else {
346          errorProvider.SetError(tb, "Not a valid number.");
347          e.Cancel = true;
348        }
349      }
350    }
351
352    private void xAxisPrimaryMinimumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
353      if (!SuppressEvents && Content != null) {
354        SuppressEvents = true;
355        try {
356          Content.XAxisMinimumAuto = xAxisPrimaryMinimumAutoRadioButton.Checked;
357          if (Content.XAxisMinimumAuto) xAxisPrimaryMinimumFixedTextBox.Text = double.NaN.ToString();
358        } finally { SuppressEvents = false; }
359        SetEnabledStateOfControls();
360      }
361    }
362
363    private void xAxisPrimaryMaximumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
364      if (!SuppressEvents && Content != null) {
365        SuppressEvents = true;
366        try {
367          Content.XAxisMaximumAuto = xAxisPrimaryMaximumAutoRadioButton.Checked;
368          if (Content.XAxisMaximumAuto) xAxisPrimaryMaximumFixedTextBox.Text = double.NaN.ToString();
369        } finally { SuppressEvents = false; }
370        SetEnabledStateOfControls();
371      }
372    }
373
374    private void xAxisSecondaryMinimumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
375      if (!SuppressEvents && Content != null) {
376        SuppressEvents = true;
377        try {
378          Content.SecondXAxisMinimumAuto = xAxisSecondaryMinimumAutoRadioButton.Checked;
379          if (Content.SecondXAxisMinimumAuto) xAxisSecondaryMinimumFixedTextBox.Text = double.NaN.ToString();
380        } finally { SuppressEvents = false; }
381        SetEnabledStateOfControls();
382      }
383    }
384
385    private void xAxisSecondaryMaximumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
386      if (!SuppressEvents && Content != null) {
387        SuppressEvents = true;
388        try {
389          Content.SecondXAxisMaximumAuto = xAxisSecondaryMaximumAutoRadioButton.Checked;
390          if (Content.SecondXAxisMaximumAuto) xAxisSecondaryMaximumFixedTextBox.Text = double.NaN.ToString();
391        } finally { SuppressEvents = false; }
392        SetEnabledStateOfControls();
393      }
394    }
395
396    private void yAxisPrimaryMinimumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
397      if (!SuppressEvents && Content != null) {
398        SuppressEvents = true;
399        try {
400          Content.YAxisMinimumAuto = yAxisPrimaryMinimumAutoRadioButton.Checked;
401          if (Content.YAxisMinimumAuto) yAxisPrimaryMinimumFixedTextBox.Text = double.NaN.ToString();
402        } finally { SuppressEvents = false; }
403        SetEnabledStateOfControls();
404      }
405    }
406
407    private void yAxisPrimaryMaximumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
408      if (!SuppressEvents && Content != null) {
409        SuppressEvents = true;
410        try {
411          Content.YAxisMaximumAuto = yAxisPrimaryMaximumAutoRadioButton.Checked;
412          if (Content.YAxisMaximumAuto) yAxisPrimaryMaximumFixedTextBox.Text = double.NaN.ToString();
413        } finally { SuppressEvents = false; }
414        SetEnabledStateOfControls();
415      }
416    }
417
418    private void yAxisSecondaryMinimumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
419      if (!SuppressEvents && Content != null) {
420        SuppressEvents = true;
421        try {
422          Content.SecondYAxisMinimumAuto = yAxisSecondaryMinimumAutoRadioButton.Checked;
423          if (Content.SecondYAxisMinimumAuto) yAxisSecondaryMinimumFixedTextBox.Text = double.NaN.ToString();
424        } finally { SuppressEvents = false; }
425        SetEnabledStateOfControls();
426      }
427    }
428
429    private void yAxisSecondaryMaximumRadioButton_CheckedChanged(object sender, System.EventArgs e) {
430      if (!SuppressEvents && Content != null) {
431        SuppressEvents = true;
432        try {
433          Content.SecondYAxisMaximumAuto = yAxisSecondaryMaximumAutoRadioButton.Checked;
434          if (Content.SecondYAxisMaximumAuto) yAxisSecondaryMaximumFixedTextBox.Text = double.NaN.ToString();
435        } finally { SuppressEvents = false; }
436        SetEnabledStateOfControls();
437      }
438    }
439
440    private void xAxisPrimaryLogScaleCheckBox_CheckedChanged(object sender, System.EventArgs e) {
441      if (!SuppressEvents && Content != null) {
442        SuppressEvents = true;
443        try {
444          Content.XAxisLogScale = xAxisPrimaryLogScaleCheckBox.Checked;
445        } finally { SuppressEvents = false; }
446      }
447    }
448
449    private void xAxisSecondaryLogScaleCheckBox_CheckedChanged(object sender, System.EventArgs e) {
450      if (!SuppressEvents && Content != null) {
451        SuppressEvents = true;
452        try {
453          Content.SecondXAxisLogScale = xAxisSecondaryLogScaleCheckBox.Checked;
454        } finally { SuppressEvents = false; }
455      }
456    }
457
458    private void yAxisPrimaryLogScaleCheckBox_CheckedChanged(object sender, System.EventArgs e) {
459      if (!SuppressEvents && Content != null) {
460        SuppressEvents = true;
461        try {
462          Content.YAxisLogScale = yAxisPrimaryLogScaleCheckBox.Checked;
463        } finally { SuppressEvents = false; }
464      }
465    }
466
467    private void yAxisSecondaryLogScaleCheckBox_CheckedChanged(object sender, System.EventArgs e) {
468      if (!SuppressEvents && Content != null) {
469        SuppressEvents = true;
470        try {
471          Content.SecondYAxisLogScale = yAxisSecondaryLogScaleCheckBox.Checked;
472        } finally { SuppressEvents = false; }
473      }
474    }
475
476    private void titleFontButton_Click(object sender, System.EventArgs e) {
477      titleFontDialog.Font = Content.TitleFont;
478      titleFontDialog.Color = Content.TitleColor;
479      if (titleFontDialog.ShowDialog() == DialogResult.OK) {
480        Content.TitleFont = titleFontDialog.Font;
481        Content.TitleColor = titleFontDialog.Color;
482        titleFontLabel.Text = "( " + FormatFont(Content.TitleFont) + " )";
483      }
484    }
485
486    private void axisFontButton_Click(object sender, System.EventArgs e) {
487      axisFontDialog.Font = Content.AxisTitleFont;
488      axisFontDialog.Color = Content.AxisTitleColor;
489      if (axisFontDialog.ShowDialog() == DialogResult.OK) {
490        Content.AxisTitleFont = axisFontDialog.Font;
491        Content.AxisTitleColor = axisFontDialog.Color;
492        axisFontLabel.Text = "( " + FormatFont(Content.AxisTitleFont) + " )";
493      }
494    }
495
496    private void titleTextBox_Validated(object sender, System.EventArgs e) {
497      if (!SuppressEvents && Content != null) {
498        Content.Title = titleTextBox.Text;
499      }
500    }
501
502    private void histogramBinsNumericUpDown_ValueChanged(object sender, System.EventArgs e) {
503      if (!SuppressEvents && Content != null) {
504        Content.HistogramBins = (int)histogramBinsNumericUpDown.Value;
505      }
506    }
507
508    private void histogramBinsExactRadioButton_CheckedChanged(object sender, System.EventArgs e) {
509      if (!SuppressEvents && Content != null) {
510        SuppressEvents = true;
511        try {
512          Content.HistogramExactBins = histogramBinsExactRadioButton.Checked;
513        } finally { SuppressEvents = false; }
514      }
515    }
516
517    private void histogramAggregationComboBox_SelectedValueChanged(object sender, System.EventArgs e) {
518      if (!SuppressEvents && Content != null) {
519        SuppressEvents = true;
520        try {
521          Content.HistogramAggregation = (DataTableVisualProperties.DataTableHistogramAggregation)histogramAggregationComboBox.SelectedValue;
522        } finally { SuppressEvents = false; }
523      }
524    }
525    #endregion
526
527    private string FormatFont(Font f) {
528      if (f == null) return "default";
529      else return f.Name + ", " + f.SizeInPoints.ToString() + "pt, " + f.Style.ToString();
530    }
531  }
532}
Note: See TracBrowser for help on using the repository browser.