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

View file

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

View file

@ -487,7 +487,7 @@
<value>btnLanguages</value> <value>btnLanguages</value>
</data> </data>
<data name="&gt;&gt;btnLanguages.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;btnLanguages.Parent" xml:space="preserve"> <data name="&gt;&gt;btnLanguages.Parent" xml:space="preserve">
<value>tpGeneral</value> <value>tpGeneral</value>
@ -736,7 +736,7 @@
<value>eiTheme</value> <value>eiTheme</value>
</data> </data>
<data name="&gt;&gt;eiTheme.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;eiTheme.Parent" xml:space="preserve"> <data name="&gt;&gt;eiTheme.Parent" xml:space="preserve">
<value>tpTheme</value> <value>tpTheme</value>
@ -819,33 +819,6 @@
<data name="&gt;&gt;cbThemes.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cbThemes.ZOrder" xml:space="preserve">
<value>5</value> <value>5</value>
</data> </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"> <data name="pgTheme.HelpVisible" type="System.Boolean, mscorlib">
<value>False</value> <value>False</value>
</data> </data>
@ -868,7 +841,7 @@
<value>tpTheme</value> <value>tpTheme</value>
</data> </data>
<data name="&gt;&gt;pgTheme.ZOrder" xml:space="preserve"> <data name="&gt;&gt;pgTheme.ZOrder" xml:space="preserve">
<value>7</value> <value>6</value>
</data> </data>
<data name="cbUseCustomTheme.AutoSize" type="System.Boolean, mscorlib"> <data name="cbUseCustomTheme.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -898,7 +871,7 @@
<value>tpTheme</value> <value>tpTheme</value>
</data> </data>
<data name="&gt;&gt;cbUseCustomTheme.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cbUseCustomTheme.ZOrder" xml:space="preserve">
<value>8</value> <value>7</value>
</data> </data>
<data name="tpTheme.Location" type="System.Drawing.Point, System.Drawing"> <data name="tpTheme.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value> <value>4, 22</value>
@ -2170,7 +2143,7 @@
<value>lvClipboardFormats</value> <value>lvClipboardFormats</value>
</data> </data>
<data name="&gt;&gt;lvClipboardFormats.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;lvClipboardFormats.Parent" xml:space="preserve"> <data name="&gt;&gt;lvClipboardFormats.Parent" xml:space="preserve">
<value>gbClipboardFormats</value> <value>gbClipboardFormats</value>
@ -2245,7 +2218,7 @@
<value>lvSecondaryFileUploaders</value> <value>lvSecondaryFileUploaders</value>
</data> </data>
<data name="&gt;&gt;lvSecondaryFileUploaders.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;lvSecondaryFileUploaders.Parent" xml:space="preserve"> <data name="&gt;&gt;lvSecondaryFileUploaders.Parent" xml:space="preserve">
<value>gbSecondaryFileUploaders</value> <value>gbSecondaryFileUploaders</value>
@ -2296,7 +2269,7 @@
<value>lvSecondaryImageUploaders</value> <value>lvSecondaryImageUploaders</value>
</data> </data>
<data name="&gt;&gt;lvSecondaryImageUploaders.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;lvSecondaryImageUploaders.Parent" xml:space="preserve"> <data name="&gt;&gt;lvSecondaryImageUploaders.Parent" xml:space="preserve">
<value>gbSecondaryImageUploaders</value> <value>gbSecondaryImageUploaders</value>
@ -2347,7 +2320,7 @@
<value>lvSecondaryTextUploaders</value> <value>lvSecondaryTextUploaders</value>
</data> </data>
<data name="&gt;&gt;lvSecondaryTextUploaders.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;lvSecondaryTextUploaders.Parent" xml:space="preserve"> <data name="&gt;&gt;lvSecondaryTextUploaders.Parent" xml:space="preserve">
<value>gbSecondaryTextUploaders</value> <value>gbSecondaryTextUploaders</value>
@ -3346,7 +3319,7 @@
<value>tttvMain</value> <value>tttvMain</value>
</data> </data>
<data name="&gt;&gt;tttvMain.Type" xml:space="preserve"> <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>
<data name="&gt;&gt;tttvMain.Parent" xml:space="preserve"> <data name="&gt;&gt;tttvMain.Parent" xml:space="preserve">
<value>$this</value> <value>$this</value>