123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- namespace OINA.Extender.Testharness
- {
- using System;
- using System.Drawing;
- using System.Windows;
- using System.Windows.Forms;
- using OINA.Extender.Controls.Styles;
- using Media = System.Windows.Media;
-
- /// <summary>
- /// The PeriodicTable Visual settings form
- /// </summary>
- public partial class BCDialogVisualSettings : Form
- {
- /// <summary>
- /// Gets or sets the color of the header font.
- /// </summary>
- private static Color HeaderFontColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.HeaderFontColor); }
- set { BrightnessContrastDialogStyle.HeaderFontColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the family of the header font.
- /// </summary>
- private static Media.FontFamily HeaderFontFamily
- {
- get { return BrightnessContrastDialogStyle.HeaderFontFamily; }
- set { BrightnessContrastDialogStyle.HeaderFontFamily = value; }
- }
- /// <summary>
- /// Gets or sets the size of the header font.
- /// </summary>
- private static double HeaderFontSize
- {
- get { return BrightnessContrastDialogStyle.HeaderFontSize; }
- set { BrightnessContrastDialogStyle.HeaderFontSize = value; }
- }
- /// <summary>
- /// Gets or sets the style of the header font.
- /// </summary>
- private static System.Windows.FontStyle HeaderFontStyle
- {
- get { return BrightnessContrastDialogStyle.HeaderFontStyle; }
- set { BrightnessContrastDialogStyle.HeaderFontStyle = value; }
- }
- /// <summary>
- /// Gets or sets the color of the background
- /// </summary>
- private static Color BackgroundColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.BrightnessContrastDialogBackgroundColor); }
- set { BrightnessContrastDialogStyle.BrightnessContrastDialogBackgroundColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the generic control background
- /// </summary>
- private static Color ControlBackgroundColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.GenericControlBackgroundColor); }
- set { BrightnessContrastDialogStyle.GenericControlBackgroundColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the plotter/combo background
- /// </summary>
- private static Color PlotterBackgroundColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.PlotterBackgroundColor); }
- set { BrightnessContrastDialogStyle.PlotterBackgroundColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the combo line color.
- /// </summary>
- private static Color ComboLineColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.ComboLineColor); }
- set { BrightnessContrastDialogStyle.ComboLineColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the plotter axis markers
- /// </summary>
- private static Color AxisMarkersColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.AxisMarkersColor); }
- set { BrightnessContrastDialogStyle.AxisMarkersColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the plotter axis markers
- /// </summary>
- private static Color AxisTicksColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.AxisTicksColor); }
- set { BrightnessContrastDialogStyle.AxisTicksColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the combo line color.
- /// </summary>
- private static Color PlotterLineColor
- {
- get { return ColorConverter.Convert(BrightnessContrastDialogStyle.PlotterLineColor); }
- set { BrightnessContrastDialogStyle.PlotterLineColor = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="PeriodicTableVisualSettings"/> class.
- /// </summary>
- public BCDialogVisualSettings()
- {
- this.InitializeComponent();
- this.UpdatePanelColors();
- this.InitializeCombos();
- this.UpdateCombos();
- this.HeaderFontColorComboBox.SelectedValueChanged += this.HeaderFontColorComboBox_SelectedValueChanged;
- this.HeaderFontSizeComboBox.SelectedValueChanged += this.HeaderFontSizeComboBoxComboBox_SelectedValueChanged;
- this.HeaderFontFamilyComboBox.SelectedValueChanged += this.HeaderFontFamilyComboBox_SelectedValueChanged;
- this.HeaderFontStyleComboBox.SelectedValueChanged += this.HeaderFontStyleComboBox_SelectedValueChanged;
- this.BackgroundColorComboBox.SelectedValueChanged += this.BackgroundColorComboBox_SelectedValueChanged;
- this.ControlBackgroundColorComboBox.SelectedValueChanged += this.ControlBackgroundColorComboBox_SelectedValueChanged;
- this.PlotterBackgroundColorComboBox.SelectedValueChanged += this.PlotterBackgroundColorComboBox_SelectedValueChanged;
- this.PlotterAxisColorComboBox.SelectedValueChanged += this.PlotterAxisColorComboBox_SelectedValueChanged;
- this.ComboLineColorComboBox.SelectedValueChanged += this.ComboLineColorComboBox_SelectedValueChanged;
- this.PlotterAxisTicksColorComboBox.SelectedValueChanged += this.PlotterAxisTicksColorComboBox_SelectedValueChanged;
- this.PlotterLineColorComboBox.SelectedValueChanged += this.PlotterLineColorComboBox_SelectedValueChanged;
- }
-
- /// <summary>
- /// Fills the combos with items
- /// </summary>
- private void InitializeCombos()
- {
- this.HeaderFontColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.HeaderFontFamilyComboBox.DataSource = Media.Fonts.SystemFontFamilies;
- this.HeaderFontStyleComboBox.DataSource = new[] { FontStyles.Normal, FontStyles.Italic, FontStyles.Oblique };
- this.BackgroundColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.ControlBackgroundColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.PlotterBackgroundColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.ComboLineColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.PlotterAxisColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.PlotterAxisTicksColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
- this.PlotterLineColorComboBox.DataSource = ColorConverter.GetSystemDrawingColors();
-
- this.HeaderFontSizeComboBox.DataSource = new[] { 8d, 10d, 12d, 14d, 16d, 18d };
- }
- /// <summary>
- /// Updates the combos selected items on load and after resetting styles
- /// </summary>
- private void UpdateCombos()
- {
- ColorConverter.PickColourComboItem(this.HeaderFontColorComboBox, HeaderFontColor);
- this.HeaderFontSizeComboBox.SelectedItem = BrightnessContrastDialogStyle.HeaderFontSize;
- this.HeaderFontFamilyComboBox.SelectedItem = BrightnessContrastDialogStyle.HeaderFontFamily;
- this.HeaderFontStyleComboBox.SelectedItem = BrightnessContrastDialogStyle.HeaderFontStyle;
-
- ColorConverter.PickColourComboItem(this.BackgroundColorComboBox, BackgroundColor);
- ColorConverter.PickColourComboItem(this.ControlBackgroundColorComboBox, ControlBackgroundColor);
- ColorConverter.PickColourComboItem(this.PlotterBackgroundColorComboBox, PlotterBackgroundColor);
- ColorConverter.PickColourComboItem(this.ComboLineColorComboBox, ComboLineColor);
- ColorConverter.PickColourComboItem(this.PlotterAxisColorComboBox, AxisMarkersColor);
- ColorConverter.PickColourComboItem(this.PlotterAxisTicksColorComboBox, AxisTicksColor);
- ColorConverter.PickColourComboItem(this.PlotterLineColorComboBox, PlotterLineColor);
- }
- /// <summary>
- /// Updates the panel colors.
- /// </summary>
- private void UpdatePanelColors()
- {
- this.HeaderFontColorPanel.BackColor = HeaderFontColor;
- this.BackgroundColorPanel.BackColor = BackgroundColor;
- this.ControlBackgroundColorPanel.BackColor = ControlBackgroundColor;
- this.PlotterBackgroundColorPanel.BackColor = PlotterBackgroundColor;
- this.PlotterAxisColorPanel.BackColor = AxisMarkersColor;
- this.ComboLineColorPanel.BackColor = ComboLineColor;
- this.PlotterAxisTicksColorPanel.BackColor = AxisTicksColor;
- this.PlotterLineColorPanel.BackColor = PlotterLineColor;
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the HeaderFontColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void HeaderFontColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.HeaderFontColorComboBox.SelectedValue != null)
- {
- HeaderFontColor = (Color)this.HeaderFontColorComboBox.SelectedValue;
- this.HeaderFontColorPanel.BackColor = HeaderFontColor;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the HeaderFontSizeComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void HeaderFontSizeComboBoxComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.HeaderFontSizeComboBox.SelectedValue != null)
- {
- HeaderFontSize = (double)this.HeaderFontSizeComboBox.SelectedValue;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the HeaderFontFamilyComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void HeaderFontFamilyComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.HeaderFontFamilyComboBox.SelectedValue != null)
- {
- HeaderFontFamily = (Media.FontFamily)this.HeaderFontFamilyComboBox.SelectedValue;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the HeaderFontStyleComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void HeaderFontStyleComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.HeaderFontStyleComboBox.SelectedValue != null)
- {
- HeaderFontStyle = (System.Windows.FontStyle)this.HeaderFontStyleComboBox.SelectedValue;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the BackgroundColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void BackgroundColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.BackgroundColorComboBox.SelectedValue != null)
- {
- BackgroundColor = (Color)this.BackgroundColorComboBox.SelectedValue;
- this.BackgroundColorPanel.BackColor = BackgroundColor;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the ControlBackgroundColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void ControlBackgroundColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.ControlBackgroundColorComboBox.SelectedValue != null)
- {
- ControlBackgroundColor = (Color)this.ControlBackgroundColorComboBox.SelectedValue;
- this.ControlBackgroundColorPanel.BackColor = ControlBackgroundColor;
- }
- }
-
- /// <summary>
- /// Handles the SelectedValueChanged event of the PlotterBackgroundColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void PlotterBackgroundColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.PlotterBackgroundColorComboBox.SelectedValue != null)
- {
- PlotterBackgroundColor = (Color)this.PlotterBackgroundColorComboBox.SelectedValue;
- this.PlotterBackgroundColorPanel.BackColor = PlotterBackgroundColor;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the ComboLineColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void ComboLineColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.ComboLineColorComboBox.SelectedValue != null)
- {
- ComboLineColor = (Color)this.ComboLineColorComboBox.SelectedValue;
- this.ComboLineColorPanel.BackColor = ComboLineColor;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the PlotterAxisColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void PlotterAxisColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.PlotterAxisColorComboBox.SelectedValue != null)
- {
- AxisMarkersColor = (Color)this.PlotterAxisColorComboBox.SelectedValue;
- this.PlotterAxisColorPanel.BackColor = AxisMarkersColor;
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the PlotterAxisTicksColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void PlotterAxisTicksColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.PlotterAxisTicksColorComboBox.SelectedValue != null)
- {
- AxisTicksColor = (Color)this.PlotterAxisTicksColorComboBox.SelectedValue;
- this.PlotterAxisTicksColorPanel.BackColor = AxisTicksColor;
- }
- }
-
- /// <summary>
- /// Handles the SelectedValueChanged event of the PlotterLineColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void PlotterLineColorComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.PlotterLineColorComboBox.SelectedValue != null)
- {
- PlotterLineColor = (Color)this.PlotterLineColorComboBox.SelectedValue;
- this.PlotterLineColorPanel.BackColor = PlotterLineColor;
- }
- }
- /// <summary>
- /// Handles the Click event of the ResetStyleButton control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void ResetStyleButton_Click(object sender, EventArgs e)
- {
- BrightnessContrastDialogStyle.ResetStyles();
- this.UpdatePanelColors();
- this.UpdateCombos();
- }
- }
- }
|