diff --git a/App.config b/App.config index 45843ad..0ce7d78 100644 --- a/App.config +++ b/App.config @@ -199,6 +199,9 @@ Blue + + Windows + \ No newline at end of file diff --git a/CodeWalker.WinForms/FormUtils.cs b/CodeWalker.WinForms/FormUtils.cs index 1fa9a93..b508093 100644 --- a/CodeWalker.WinForms/FormUtils.cs +++ b/CodeWalker.WinForms/FormUtils.cs @@ -1,7 +1,10 @@ using System; +using System.Collections.Generic; using System.ComponentModel; +using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; using Point = System.Drawing.Point; namespace CodeWalker @@ -261,6 +264,78 @@ namespace CodeWalker + public static class FormTheme + { + public static void SetTheme(Control form, ThemeBase theme) + { + form.BackColor = SystemColors.Control; + form.ForeColor = SystemColors.ControlText; + var txtback = SystemColors.Window; + var wndback = SystemColors.Window; + var disback = SystemColors.Control; + var disfore = form.ForeColor; + var btnback = Color.Transparent; + + if (theme is VS2015DarkTheme) + { + form.BackColor = theme.ColorPalette.MainWindowActive.Background; + form.ForeColor = Color.White; + txtback = Color.FromArgb(40, 40, 40);// form.BackColor; + wndback = theme.ColorPalette.MainWindowActive.Background; + disback = form.BackColor;// Color.FromArgb(32,32,32); + disfore = Color.DarkGray; + btnback = form.BackColor; + } + + var allcontrols = new List(); + RecurseControls(form, allcontrols); + + foreach (var c in allcontrols) + { + if (c is TabPage) + { + c.ForeColor = form.ForeColor; + c.BackColor = wndback; + } + else if ((c is CheckedListBox) || (c is ListBox) || (c is ListView)) + { + c.ForeColor = form.ForeColor; + c.BackColor = wndback; + } + else if ((c is TextBox)) + { + var txtbox = c as TextBox; + c.ForeColor = txtbox.ReadOnly ? disfore : form.ForeColor; + c.BackColor = txtbox.ReadOnly ? disback : txtback; + } + else if ((c is Button) || (c is GroupBox)) + { + c.ForeColor = form.ForeColor; + c.BackColor = btnback; + } + else if (c is TreeView) + { + c.ForeColor = form.ForeColor; + c.BackColor = wndback; + (c as TreeView).LineColor = form.ForeColor; + } + + } + + } + private static void RecurseControls(Control c, List l) + { + foreach (Control cc in c.Controls) + { + l.Add(cc); + RecurseControls(cc, l); + } + } + + } + + + //unused //public class AccurateTimer //{ diff --git a/CodeWalker.WinForms/ProjectPanel.cs b/CodeWalker.WinForms/ProjectPanel.cs index d6e0e7f..42be18d 100644 --- a/CodeWalker.WinForms/ProjectPanel.cs +++ b/CodeWalker.WinForms/ProjectPanel.cs @@ -12,58 +12,9 @@ namespace CodeWalker.Project public class ProjectPanel : DockContent { - public virtual void SetTheme(ThemeBase theme) { - BackColor = SystemColors.Control; - ForeColor = SystemColors.ControlText; - var txtback = SystemColors.Window; - var disback = SystemColors.Control; - var disfore = ForeColor; - var btnback = Color.Transparent; - - if (theme is VS2015DarkTheme) - { - BackColor = theme.ColorPalette.MainWindowActive.Background; - ForeColor = Color.White; - txtback = BackColor; - disback = BackColor;// Color.FromArgb(32,32,32); - disfore = Color.DarkGray; - btnback = BackColor; - } - - var allcontrols = new List(); - RecurseControls(this, allcontrols); - - foreach (var c in allcontrols) - { - if ((c is TabPage) || (c is CheckedListBox) || (c is ListBox)) - { - c.ForeColor = ForeColor; - c.BackColor = txtback; - } - else if ((c is TextBox)) - { - var txtbox = c as TextBox; - c.ForeColor = txtbox.ReadOnly ? disfore : ForeColor; - c.BackColor = txtbox.ReadOnly ? disback : txtback; - } - else if ((c is Button) || (c is GroupBox)) - { - c.ForeColor = ForeColor; - c.BackColor = btnback; - } - } - - } - - private void RecurseControls(Control c, List l) - { - foreach (Control cc in c.Controls) - { - l.Add(cc); - RecurseControls(cc, l); - } + FormTheme.SetTheme(this, theme); } } diff --git a/ExploreForm.Designer.cs b/ExploreForm.Designer.cs index 2fff1c0..d3da7e2 100644 --- a/ExploreForm.Designer.cs +++ b/ExploreForm.Designer.cs @@ -58,6 +58,12 @@ this.ViewSmallIconsMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ViewListMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ViewDetailsMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); + this.ViewThemeMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ViewThemeWindowsMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ViewThemeBlueMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ViewThemeLightMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ViewThemeDarkMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ToolsMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ToolsBinSearchMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ToolsRpfBrowserMenu = new System.Windows.Forms.ToolStripMenuItem(); @@ -80,7 +86,7 @@ this.SearchButton = new System.Windows.Forms.ToolStripSplitButton(); this.SearchGlobalButton = new System.Windows.Forms.ToolStripMenuItem(); this.SearchFilterButton = new System.Windows.Forms.ToolStripMenuItem(); - this.StatusBar = new System.Windows.Forms.StatusStrip(); + this.MainStatusBar = new System.Windows.Forms.StatusStrip(); this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.FileImageList16 = new System.Windows.Forms.ImageList(this.components); this.MainSplitContainer = new System.Windows.Forms.SplitContainer(); @@ -135,9 +141,10 @@ this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog(); this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); + this.VSExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components); this.MainMenu.SuspendLayout(); this.MainToolbar.SuspendLayout(); - this.StatusBar.SuspendLayout(); + this.MainStatusBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.MainSplitContainer)).BeginInit(); this.MainSplitContainer.Panel1.SuspendLayout(); this.MainSplitContainer.Panel2.SuspendLayout(); @@ -366,7 +373,9 @@ this.ViewLargeIconsMenu, this.ViewSmallIconsMenu, this.ViewListMenu, - this.ViewDetailsMenu}); + this.ViewDetailsMenu, + this.toolStripSeparator11, + this.ViewThemeMenu}); this.ViewMenu.Name = "ViewMenu"; this.ViewMenu.Size = new System.Drawing.Size(44, 20); this.ViewMenu.Text = "View"; @@ -374,21 +383,21 @@ // ViewLargeIconsMenu // this.ViewLargeIconsMenu.Name = "ViewLargeIconsMenu"; - this.ViewLargeIconsMenu.Size = new System.Drawing.Size(134, 22); + this.ViewLargeIconsMenu.Size = new System.Drawing.Size(152, 22); this.ViewLargeIconsMenu.Text = "Large Icons"; this.ViewLargeIconsMenu.Click += new System.EventHandler(this.ViewLargeIconsMenu_Click); // // ViewSmallIconsMenu // this.ViewSmallIconsMenu.Name = "ViewSmallIconsMenu"; - this.ViewSmallIconsMenu.Size = new System.Drawing.Size(134, 22); + this.ViewSmallIconsMenu.Size = new System.Drawing.Size(152, 22); this.ViewSmallIconsMenu.Text = "Small Icons"; this.ViewSmallIconsMenu.Click += new System.EventHandler(this.ViewSmallIconsMenu_Click); // // ViewListMenu // this.ViewListMenu.Name = "ViewListMenu"; - this.ViewListMenu.Size = new System.Drawing.Size(134, 22); + this.ViewListMenu.Size = new System.Drawing.Size(152, 22); this.ViewListMenu.Text = "List"; this.ViewListMenu.Click += new System.EventHandler(this.ViewListMenu_Click); // @@ -397,10 +406,56 @@ this.ViewDetailsMenu.Checked = true; this.ViewDetailsMenu.CheckState = System.Windows.Forms.CheckState.Checked; this.ViewDetailsMenu.Name = "ViewDetailsMenu"; - this.ViewDetailsMenu.Size = new System.Drawing.Size(134, 22); + this.ViewDetailsMenu.Size = new System.Drawing.Size(152, 22); this.ViewDetailsMenu.Text = "Details"; this.ViewDetailsMenu.Click += new System.EventHandler(this.ViewDetailsMenu_Click); // + // toolStripSeparator11 + // + this.toolStripSeparator11.Name = "toolStripSeparator11"; + this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6); + // + // ViewThemeMenu + // + this.ViewThemeMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ViewThemeWindowsMenu, + this.ViewThemeBlueMenu, + this.ViewThemeLightMenu, + this.ViewThemeDarkMenu}); + this.ViewThemeMenu.Name = "ViewThemeMenu"; + this.ViewThemeMenu.Size = new System.Drawing.Size(152, 22); + this.ViewThemeMenu.Text = "Theme"; + // + // ViewThemeWindowsMenu + // + this.ViewThemeWindowsMenu.Checked = true; + this.ViewThemeWindowsMenu.CheckState = System.Windows.Forms.CheckState.Checked; + this.ViewThemeWindowsMenu.Name = "ViewThemeWindowsMenu"; + this.ViewThemeWindowsMenu.Size = new System.Drawing.Size(152, 22); + this.ViewThemeWindowsMenu.Text = "Windows"; + this.ViewThemeWindowsMenu.Click += new System.EventHandler(this.ViewThemeWindowsMenu_Click); + // + // ViewThemeBlueMenu + // + this.ViewThemeBlueMenu.Name = "ViewThemeBlueMenu"; + this.ViewThemeBlueMenu.Size = new System.Drawing.Size(152, 22); + this.ViewThemeBlueMenu.Text = "Blue"; + this.ViewThemeBlueMenu.Click += new System.EventHandler(this.ViewThemeBlueMenu_Click); + // + // ViewThemeLightMenu + // + this.ViewThemeLightMenu.Name = "ViewThemeLightMenu"; + this.ViewThemeLightMenu.Size = new System.Drawing.Size(152, 22); + this.ViewThemeLightMenu.Text = "Light"; + this.ViewThemeLightMenu.Click += new System.EventHandler(this.ViewThemeLightMenu_Click); + // + // ViewThemeDarkMenu + // + this.ViewThemeDarkMenu.Name = "ViewThemeDarkMenu"; + this.ViewThemeDarkMenu.Size = new System.Drawing.Size(152, 22); + this.ViewThemeDarkMenu.Text = "Dark"; + this.ViewThemeDarkMenu.Click += new System.EventHandler(this.ViewThemeDarkMenu_Click); + // // ToolsMenu // this.ToolsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -609,15 +664,15 @@ this.SearchFilterButton.Text = "Filter"; this.SearchFilterButton.Click += new System.EventHandler(this.SearchFilterButton_Click); // - // StatusBar + // MainStatusBar // - this.StatusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.MainStatusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.StatusLabel}); - this.StatusBar.Location = new System.Drawing.Point(0, 565); - this.StatusBar.Name = "StatusBar"; - this.StatusBar.Size = new System.Drawing.Size(876, 22); - this.StatusBar.TabIndex = 2; - this.StatusBar.Text = "statusStrip1"; + this.MainStatusBar.Location = new System.Drawing.Point(0, 565); + this.MainStatusBar.Name = "MainStatusBar"; + this.MainStatusBar.Size = new System.Drawing.Size(876, 22); + this.MainStatusBar.TabIndex = 2; + this.MainStatusBar.Text = "MainStatusBar"; // // StatusLabel // @@ -1115,13 +1170,17 @@ // this.OpenFileDialog.Multiselect = true; // + // VSExtender + // + this.VSExtender.DefaultRenderer = null; + // // ExploreForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(876, 587); this.Controls.Add(this.MainSplitContainer); - this.Controls.Add(this.StatusBar); + this.Controls.Add(this.MainStatusBar); this.Controls.Add(this.MainToolbar); this.Controls.Add(this.MainMenu); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -1134,8 +1193,8 @@ this.MainMenu.PerformLayout(); this.MainToolbar.ResumeLayout(false); this.MainToolbar.PerformLayout(); - this.StatusBar.ResumeLayout(false); - this.StatusBar.PerformLayout(); + this.MainStatusBar.ResumeLayout(false); + this.MainStatusBar.PerformLayout(); this.MainSplitContainer.Panel1.ResumeLayout(false); this.MainSplitContainer.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.MainSplitContainer)).EndInit(); @@ -1160,7 +1219,7 @@ private System.Windows.Forms.ToolStripMenuItem EditMenu; private System.Windows.Forms.ToolStripMenuItem ViewMenu; private System.Windows.Forms.ToolStrip MainToolbar; - private System.Windows.Forms.StatusStrip StatusBar; + private System.Windows.Forms.StatusStrip MainStatusBar; private System.Windows.Forms.ToolStripStatusLabel StatusLabel; private System.Windows.Forms.ImageList FileImageList16; private System.Windows.Forms.ToolStripSplitButton BackButton; @@ -1260,5 +1319,12 @@ private System.Windows.Forms.Label label2; private System.Windows.Forms.ToolStripMenuItem ListContextDefragmentMenu; private System.Windows.Forms.ToolStripSeparator ListContextDefragmentSeparator; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; + private System.Windows.Forms.ToolStripMenuItem ViewThemeMenu; + private System.Windows.Forms.ToolStripMenuItem ViewThemeBlueMenu; + private System.Windows.Forms.ToolStripMenuItem ViewThemeLightMenu; + private System.Windows.Forms.ToolStripMenuItem ViewThemeDarkMenu; + private WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender VSExtender; + private System.Windows.Forms.ToolStripMenuItem ViewThemeWindowsMenu; } } \ No newline at end of file diff --git a/ExploreForm.cs b/ExploreForm.cs index cb409a9..bfea49d 100644 --- a/ExploreForm.cs +++ b/ExploreForm.cs @@ -15,6 +15,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml; +using WeifenLuo.WinFormsUI.Docking; namespace CodeWalker { @@ -45,14 +46,84 @@ namespace CodeWalker private bool EditMode = false; + public ThemeBase Theme { get; private set; } + public ExploreForm() { InitializeComponent(); + SetTheme(Settings.Default.ExplorerWindowTheme, false); + ShowMainListViewPathColumn(false); } + private void SetTheme(string themestr, bool changing = true) + { + //string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.temp.config"); + //MainDockPanel.SaveAsXml(configFile); + //CloseAllContents(); + + foreach (ToolStripMenuItem menu in ViewThemeMenu.DropDownItems) + { + menu.Checked = false; + } + + Theme = null; + var version = VisualStudioToolStripExtender.VsVersion.Vs2015; + + switch (themestr) + { + default: + case "Windows": + //Theme = new VS2005Theme(); + ViewThemeWindowsMenu.Checked = true; + version = VisualStudioToolStripExtender.VsVersion.Unknown; + if (changing) + { + MessageBox.Show("Please reopen RPF Explorer to change back to Windows theme."); + } + break; + case "Blue": + Theme = new VS2015BlueTheme(); + ViewThemeBlueMenu.Checked = true; + break; + case "Light": + Theme = new VS2015LightTheme(); + ViewThemeLightMenu.Checked = true; + break; + case "Dark": + Theme = new VS2015DarkTheme(); + ViewThemeDarkMenu.Checked = true; + break; + } + + if (changing) + { + Settings.Default.ExplorerWindowTheme = themestr; + Settings.Default.Save(); + } + + + //Theme.Extender.FloatWindowFactory = new ExplorerFloatWindowFactory(); + //MainDockPanel.Theme = Theme; + + if (Theme != null) + { + VSExtender.SetStyle(MainMenu, version, Theme); + VSExtender.SetStyle(MainToolbar, version, Theme); + VSExtender.SetStyle(MainStatusBar, version, Theme); + + FormTheme.SetTheme(this, Theme); + + MainSplitContainer.BackColor = Theme.ColorPalette.MainWindowActive.Background; + } + + + //if (File.Exists(configFile)) MainDockPanel.LoadFromXml(configFile, m_deserializeDockContent); + } + + private void Init() { //called from ExploreForm_Load @@ -3404,6 +3475,26 @@ namespace CodeWalker SetView(System.Windows.Forms.View.Details); } + private void ViewThemeWindowsMenu_Click(object sender, EventArgs e) + { + SetTheme("Windows"); + } + + private void ViewThemeBlueMenu_Click(object sender, EventArgs e) + { + SetTheme("Blue"); + } + + private void ViewThemeLightMenu_Click(object sender, EventArgs e) + { + SetTheme("Light"); + } + + private void ViewThemeDarkMenu_Click(object sender, EventArgs e) + { + SetTheme("Dark"); + } + private void ToolsOptionsMenu_Click(object sender, EventArgs e) { MessageBox.Show("Options TODO!"); diff --git a/ExploreForm.resx b/ExploreForm.resx index 168121f..704ffb8 100644 --- a/ExploreForm.resx +++ b/ExploreForm.resx @@ -302,7 +302,7 @@ NQar60zqQI0AAAAASUVORK5CYII= - + 253, 17 @@ -313,7 +313,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo - HwAAAk1TRnQBSQFMAgEBGAEAAfgBAAH4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + HwAAAk1TRnQBSQFMAgEBGAEAARgBAQEYAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAXADAAEBAQABCAYAARwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -592,6 +592,9 @@ 152, 56 + + 317, 56 + 126 diff --git a/Project/Panels/ProjectExplorerPanel.cs b/Project/Panels/ProjectExplorerPanel.cs index a838f57..683a777 100644 --- a/Project/Panels/ProjectExplorerPanel.cs +++ b/Project/Panels/ProjectExplorerPanel.cs @@ -27,24 +27,6 @@ namespace CodeWalker.Project.Panels InitializeComponent(); } - public override void SetTheme(ThemeBase theme) - { - base.SetTheme(theme); - if (theme is VS2015DarkTheme) - { - ProjectTreeView.BackColor = theme.ColorPalette.MainWindowActive.Background; - ProjectTreeView.ForeColor = Color.White; - ProjectTreeView.LineColor = Color.White; - } - else - { - ProjectTreeView.BackColor = SystemColors.Window; - ProjectTreeView.ForeColor = SystemColors.WindowText; - ProjectTreeView.LineColor = Color.Black; - } - } - - public void LoadProjectTree(ProjectFile projectFile) { diff --git a/Project/ProjectForm.cs b/Project/ProjectForm.cs index ca0e872..62b8aa0 100644 --- a/Project/ProjectForm.cs +++ b/Project/ProjectForm.cs @@ -178,8 +178,11 @@ namespace CodeWalker.Project break; } - Settings.Default.ProjectWindowTheme = themestr; - Settings.Default.Save(); + if (changing) + { + Settings.Default.ProjectWindowTheme = themestr; + Settings.Default.Save(); + } Theme.Extender.FloatWindowFactory = new ProjectFloatWindowFactory(); diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 1872fc0..96d1489 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -722,5 +722,17 @@ namespace CodeWalker.Properties { this["ProjectWindowTheme"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Windows")] + public string ExplorerWindowTheme { + get { + return ((string)(this["ExplorerWindowTheme"])); + } + set { + this["ExplorerWindowTheme"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index d8b1065..8ce42d8 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -189,5 +189,8 @@ Blue + + Windows + \ No newline at end of file