Removed apply theme button, now theme changes will be applied automatically

This commit is contained in:
Jaex 2020-05-20 07:04:47 +03:00
parent be7a104d9d
commit 973056270f
3 changed files with 26 additions and 68 deletions

View file

@ -53,12 +53,12 @@ private void InitializeComponent()
this.cbRememberMainFormSize = new System.Windows.Forms.CheckBox();
this.lblLanguage = new System.Windows.Forms.Label();
this.tpTheme = new System.Windows.Forms.TabPage();
this.cbExperimentalCustomTheme = new System.Windows.Forms.CheckBox();
this.btnThemeReset = new System.Windows.Forms.Button();
this.eiTheme = new ShareX.HelpersLib.ExportImportControl();
this.btnThemeRemove = new System.Windows.Forms.Button();
this.btnThemeAdd = new System.Windows.Forms.Button();
this.cbThemes = new System.Windows.Forms.ComboBox();
this.btnApplyTheme = new System.Windows.Forms.Button();
this.pgTheme = new System.Windows.Forms.PropertyGrid();
this.cbUseCustomTheme = new System.Windows.Forms.CheckBox();
this.tpIntegration = new System.Windows.Forms.TabPage();
@ -155,7 +155,6 @@ private void InitializeComponent()
this.tpAdvanced = new System.Windows.Forms.TabPage();
this.pgSettings = new System.Windows.Forms.PropertyGrid();
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
this.cbExperimentalCustomTheme = new System.Windows.Forms.CheckBox();
this.tcSettings.SuspendLayout();
this.tpGeneral.SuspendLayout();
this.tpTheme.SuspendLayout();
@ -361,13 +360,19 @@ private void InitializeComponent()
this.tpTheme.Controls.Add(this.btnThemeRemove);
this.tpTheme.Controls.Add(this.btnThemeAdd);
this.tpTheme.Controls.Add(this.cbThemes);
this.tpTheme.Controls.Add(this.btnApplyTheme);
this.tpTheme.Controls.Add(this.pgTheme);
this.tpTheme.Controls.Add(this.cbUseCustomTheme);
resources.ApplyResources(this.tpTheme, "tpTheme");
this.tpTheme.Name = "tpTheme";
this.tpTheme.UseVisualStyleBackColor = true;
//
// cbExperimentalCustomTheme
//
resources.ApplyResources(this.cbExperimentalCustomTheme, "cbExperimentalCustomTheme");
this.cbExperimentalCustomTheme.Name = "cbExperimentalCustomTheme";
this.cbExperimentalCustomTheme.UseVisualStyleBackColor = true;
this.cbExperimentalCustomTheme.CheckedChanged += new System.EventHandler(this.cbExperimentalCustomTheme_CheckedChanged);
//
// btnThemeReset
//
resources.ApplyResources(this.btnThemeReset, "btnThemeReset");
@ -381,6 +386,7 @@ private void InitializeComponent()
resources.ApplyResources(this.eiTheme, "eiTheme");
this.eiTheme.Name = "eiTheme";
this.eiTheme.ObjectType = null;
this.eiTheme.SerializationBinder = null;
this.eiTheme.ExportRequested += new ShareX.HelpersLib.ExportImportControl.ExportEventHandler(this.EiTheme_ExportRequested);
this.eiTheme.ImportRequested += new ShareX.HelpersLib.ExportImportControl.ImportEventHandler(this.EiTheme_ImportRequested);
//
@ -406,19 +412,13 @@ private void InitializeComponent()
this.cbThemes.Name = "cbThemes";
this.cbThemes.SelectedIndexChanged += new System.EventHandler(this.CbThemes_SelectedIndexChanged);
//
// btnApplyTheme
//
resources.ApplyResources(this.btnApplyTheme, "btnApplyTheme");
this.btnApplyTheme.Name = "btnApplyTheme";
this.btnApplyTheme.UseVisualStyleBackColor = true;
this.btnApplyTheme.Click += new System.EventHandler(this.BtnApplyTheme_Click);
//
// pgTheme
//
resources.ApplyResources(this.pgTheme, "pgTheme");
this.pgTheme.Name = "pgTheme";
this.pgTheme.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.pgTheme.ToolbarVisible = false;
this.pgTheme.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.pgTheme_PropertyValueChanged);
//
// cbUseCustomTheme
//
@ -1156,13 +1156,6 @@ private void InitializeComponent()
this.tttvMain.TreeViewSize = 175;
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
//
// cbExperimentalCustomTheme
//
resources.ApplyResources(this.cbExperimentalCustomTheme, "cbExperimentalCustomTheme");
this.cbExperimentalCustomTheme.Name = "cbExperimentalCustomTheme";
this.cbExperimentalCustomTheme.UseVisualStyleBackColor = true;
this.cbExperimentalCustomTheme.CheckedChanged += new System.EventHandler(this.cbExperimentalCustomTheme_CheckedChanged);
//
// ApplicationSettingsForm
//
resources.ApplyResources(this, "$this");
@ -1339,7 +1332,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox cbUseCustomTheme;
private System.Windows.Forms.CheckBox cbUseWhiteShareXIcon;
private System.Windows.Forms.TabPage tpTheme;
private System.Windows.Forms.Button btnApplyTheme;
private System.Windows.Forms.PropertyGrid pgTheme;
private System.Windows.Forms.ComboBox cbThemes;
private System.Windows.Forms.Button btnThemeRemove;

View file

@ -124,7 +124,7 @@ private void UpdateControls()
// Theme
cbThemes.Items.AddRange(Program.Settings.Themes.ToArray());
cbThemes.SelectedIndex = Program.Settings.SelectedTheme;
pgTheme.SelectedObject = Program.Settings.Themes[Program.Settings.SelectedTheme].Copy();
pgTheme.SelectedObject = Program.Settings.Themes[Program.Settings.SelectedTheme];
UpdateThemeControls();
// Integration
@ -435,7 +435,7 @@ private void btnCheckDevBuild_Click(object sender, EventArgs e)
private void UpdateThemeControls()
{
cbExperimentalCustomTheme.Enabled = btnThemeAdd.Enabled = btnThemeReset.Enabled = pgTheme.Enabled = eiTheme.Enabled = Program.Settings.UseCustomTheme;
cbThemes.Enabled = btnThemeRemove.Enabled = btnApplyTheme.Enabled = Program.Settings.UseCustomTheme && cbThemes.Items.Count > 0;
cbThemes.Enabled = btnThemeRemove.Enabled = Program.Settings.UseCustomTheme && cbThemes.Items.Count > 0;
}
private void ApplySelectedTheme()
@ -477,7 +477,7 @@ private void CbThemes_SelectedIndexChanged(object sender, EventArgs e)
if (cbThemes.SelectedItem != null)
{
pgTheme.SelectedObject = cbThemes.SelectedItem.Copy();
pgTheme.SelectedObject = cbThemes.SelectedItem;
}
else
{
@ -524,20 +524,13 @@ private void BtnThemeReset_Click(object sender, EventArgs e)
cbThemes.Items.Clear();
cbThemes.Items.AddRange(Program.Settings.Themes.ToArray());
cbThemes.SelectedIndex = Program.Settings.SelectedTheme;
pgTheme.SelectedObject = Program.Settings.Themes[Program.Settings.SelectedTheme].Copy();
pgTheme.SelectedObject = Program.Settings.Themes[Program.Settings.SelectedTheme];
}
private void BtnApplyTheme_Click(object sender, EventArgs e)
private void pgTheme_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
int index = cbThemes.SelectedIndex;
if (index > -1)
{
Program.Settings.SelectedTheme = index;
Program.Settings.Themes[index] = (ShareXTheme)pgTheme.SelectedObject;
cbThemes.Items[index] = Program.Settings.Themes[index];
UpdateThemeControls();
ApplySelectedTheme();
}
UpdateThemeControls();
ApplySelectedTheme();
}
private object EiTheme_ExportRequested()

View file

@ -487,7 +487,7 @@
<value>btnLanguages</value>
</data>
<data name="&gt;&gt;btnLanguages.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;btnLanguages.Parent" xml:space="preserve">
<value>tpGeneral</value>
@ -736,7 +736,7 @@
<value>eiTheme</value>
</data>
<data name="&gt;&gt;eiTheme.Type" xml:space="preserve">
<value>ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;eiTheme.Parent" xml:space="preserve">
<value>tpTheme</value>
@ -819,33 +819,6 @@
<data name="&gt;&gt;cbThemes.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="btnApplyTheme.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnApplyTheme.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 352</value>
</data>
<data name="btnApplyTheme.Size" type="System.Drawing.Size, System.Drawing">
<value>184, 24</value>
</data>
<data name="btnApplyTheme.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="btnApplyTheme.Text" xml:space="preserve">
<value>Apply theme</value>
</data>
<data name="&gt;&gt;btnApplyTheme.Name" xml:space="preserve">
<value>btnApplyTheme</value>
</data>
<data name="&gt;&gt;btnApplyTheme.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnApplyTheme.Parent" xml:space="preserve">
<value>tpTheme</value>
</data>
<data name="&gt;&gt;btnApplyTheme.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="pgTheme.HelpVisible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
@ -868,7 +841,7 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;pgTheme.ZOrder" xml:space="preserve">
<value>7</value>
<value>6</value>
</data>
<data name="cbUseCustomTheme.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -898,7 +871,7 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;cbUseCustomTheme.ZOrder" xml:space="preserve">
<value>8</value>
<value>7</value>
</data>
<data name="tpTheme.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value>
@ -2170,7 +2143,7 @@
<value>lvClipboardFormats</value>
</data>
<data name="&gt;&gt;lvClipboardFormats.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvClipboardFormats.Parent" xml:space="preserve">
<value>gbClipboardFormats</value>
@ -2245,7 +2218,7 @@
<value>lvSecondaryFileUploaders</value>
</data>
<data name="&gt;&gt;lvSecondaryFileUploaders.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvSecondaryFileUploaders.Parent" xml:space="preserve">
<value>gbSecondaryFileUploaders</value>
@ -2296,7 +2269,7 @@
<value>lvSecondaryImageUploaders</value>
</data>
<data name="&gt;&gt;lvSecondaryImageUploaders.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvSecondaryImageUploaders.Parent" xml:space="preserve">
<value>gbSecondaryImageUploaders</value>
@ -2347,7 +2320,7 @@
<value>lvSecondaryTextUploaders</value>
</data>
<data name="&gt;&gt;lvSecondaryTextUploaders.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvSecondaryTextUploaders.Parent" xml:space="preserve">
<value>gbSecondaryTextUploaders</value>
@ -3346,7 +3319,7 @@
<value>tttvMain</value>
</data>
<data name="&gt;&gt;tttvMain.Type" xml:space="preserve">
<value>ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=13.1.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;tttvMain.Parent" xml:space="preserve">
<value>$this</value>