From 0d4e7ba4ae467fbda9cc908d86c77807cca3d12a Mon Sep 17 00:00:00 2001 From: VaDiM Date: Sun, 17 Nov 2024 08:32:18 +0300 Subject: [PATCH] [GUI] Add Dark mode support for .NET 9 (wip). Close #9 Dark mode support for winforms was added with .net9, but the feature is still not finished. It should become better in future versions. --- AssetStudioGUI/AboutForm.Designer.cs | 25 +-- AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 80 +++++++-- AssetStudioGUI/AssetStudioGUIForm.cs | 86 +++++++++- AssetStudioGUI/AssetStudioGUIForm.resx | 3 + AssetStudioGUI/ExportOptions.Designer.cs | 154 +++++++++--------- AssetStudioGUI/ExportOptions.resx | 3 - .../Properties/Settings.Designer.cs | 14 +- AssetStudioGUI/Properties/Settings.settings | 3 + AssetStudioGUI/Studio.cs | 7 + 9 files changed, 272 insertions(+), 103 deletions(-) diff --git a/AssetStudioGUI/AboutForm.Designer.cs b/AssetStudioGUI/AboutForm.Designer.cs index 5e80bbb..f1c9cbe 100644 --- a/AssetStudioGUI/AboutForm.Designer.cs +++ b/AssetStudioGUI/AboutForm.Designer.cs @@ -84,7 +84,7 @@ // // tabPage1 // - this.tabPage1.BackColor = System.Drawing.Color.White; + this.tabPage1.BackColor = System.Drawing.SystemColors.Window; this.tabPage1.Controls.Add(this.panel1); this.tabPage1.Controls.Add(this.textBox2); this.tabPage1.Controls.Add(this.label11); @@ -111,6 +111,7 @@ // // label2 // + this.label2.BackColor = System.Drawing.SystemColors.Window; this.label2.Dock = System.Windows.Forms.DockStyle.Fill; this.label2.Location = new System.Drawing.Point(0, 0); this.label2.Name = "label2"; @@ -160,11 +161,11 @@ // // tableLayoutPanel2 // - this.tableLayoutPanel2.BackColor = System.Drawing.Color.WhiteSmoke; + this.tableLayoutPanel2.BackColor = System.Drawing.SystemColors.Menu; this.tableLayoutPanel2.ColumnCount = 3; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41.37931F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 58.62069F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 112F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 113F)); this.tableLayoutPanel2.Controls.Add(this.label16, 0, 0); this.tableLayoutPanel2.Controls.Add(this.label17, 1, 0); this.tableLayoutPanel2.Controls.Add(this.gitPerfareLinkLabel, 2, 0); @@ -204,7 +205,8 @@ // this.gitPerfareLinkLabel.AutoSize = true; this.gitPerfareLinkLabel.BackColor = System.Drawing.Color.Transparent; - this.gitPerfareLinkLabel.Location = new System.Drawing.Point(238, 2); + this.gitPerfareLinkLabel.LinkColor = System.Drawing.SystemColors.MenuHighlight; + this.gitPerfareLinkLabel.Location = new System.Drawing.Point(237, 2); this.gitPerfareLinkLabel.Name = "gitPerfareLinkLabel"; this.gitPerfareLinkLabel.Size = new System.Drawing.Size(67, 13); this.gitPerfareLinkLabel.TabIndex = 11; @@ -236,7 +238,8 @@ // this.gitAelurumLinkLabel.AutoSize = true; this.gitAelurumLinkLabel.BackColor = System.Drawing.Color.Transparent; - this.gitAelurumLinkLabel.Location = new System.Drawing.Point(238, 20); + this.gitAelurumLinkLabel.LinkColor = System.Drawing.SystemColors.MenuHighlight; + this.gitAelurumLinkLabel.Location = new System.Drawing.Point(237, 20); this.gitAelurumLinkLabel.Name = "gitAelurumLinkLabel"; this.gitAelurumLinkLabel.Size = new System.Drawing.Size(67, 13); this.gitAelurumLinkLabel.TabIndex = 14; @@ -246,11 +249,11 @@ // // tableLayoutPanel1 // - this.tableLayoutPanel1.BackColor = System.Drawing.Color.WhiteSmoke; + this.tableLayoutPanel1.BackColor = System.Drawing.SystemColors.Menu; this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41.37931F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 58.62069F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 112F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 113F)); this.tableLayoutPanel1.Controls.Add(this.label5, 0, 0); this.tableLayoutPanel1.Controls.Add(this.productNamelabel, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label7, 0, 1); @@ -337,7 +340,8 @@ // this.checkUpdatesLinkLabel.AutoSize = true; this.checkUpdatesLinkLabel.BackColor = System.Drawing.Color.Transparent; - this.checkUpdatesLinkLabel.Location = new System.Drawing.Point(238, 20); + this.checkUpdatesLinkLabel.LinkColor = System.Drawing.SystemColors.MenuHighlight; + this.checkUpdatesLinkLabel.Location = new System.Drawing.Point(237, 20); this.checkUpdatesLinkLabel.Name = "checkUpdatesLinkLabel"; this.checkUpdatesLinkLabel.Size = new System.Drawing.Size(96, 13); this.checkUpdatesLinkLabel.TabIndex = 6; @@ -358,7 +362,7 @@ // // licenseRichTextBox // - this.licenseRichTextBox.BackColor = System.Drawing.Color.White; + this.licenseRichTextBox.BackColor = System.Drawing.SystemColors.Window; this.licenseRichTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.licenseRichTextBox.DetectUrls = false; this.licenseRichTextBox.Dock = System.Windows.Forms.DockStyle.Fill; @@ -396,6 +400,7 @@ // // CloseButton // + this.CloseButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CloseButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.CloseButton.Dock = System.Windows.Forms.DockStyle.Bottom; this.CloseButton.Location = new System.Drawing.Point(0, 422); @@ -403,7 +408,7 @@ this.CloseButton.Size = new System.Drawing.Size(384, 39); this.CloseButton.TabIndex = 1; this.CloseButton.Text = "Close"; - this.CloseButton.UseVisualStyleBackColor = true; + this.CloseButton.UseVisualStyleBackColor = false; // // productVersionLabel // diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index ca2db88..a325b29 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -92,6 +92,10 @@ this.writeLogToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportClassStructuresMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.colorThemeToolStripMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.colorThemeAutoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.colorThemeLightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.colorThemeDarkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); @@ -184,6 +188,7 @@ // // menuStrip1 // + this.menuStrip1.BackColor = System.Drawing.SystemColors.MenuBar; this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.optionsToolStripMenuItem, @@ -191,7 +196,8 @@ this.exportToolStripMenuItem, this.filterTypeToolStripMenuItem, this.debugMenuItem, - this.aboutToolStripMenuItem}); + this.aboutToolStripMenuItem, + this.colorThemeToolStripMenu}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(1264, 24); @@ -705,6 +711,39 @@ this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // + // colorThemeToolStripMenu + // + this.colorThemeToolStripMenu.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.colorThemeToolStripMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.colorThemeAutoToolStripMenuItem, + this.colorThemeLightToolStripMenuItem, + this.colorThemeDarkToolStripMenuItem}); + this.colorThemeToolStripMenu.Name = "colorThemeToolStripMenu"; + this.colorThemeToolStripMenu.Size = new System.Drawing.Size(87, 20); + this.colorThemeToolStripMenu.Text = "Color Theme"; + this.colorThemeToolStripMenu.Visible = false; + // + // colorThemeAutoToolStripMenuItem + // + this.colorThemeAutoToolStripMenuItem.Name = "colorThemeAutoToolStripMenuItem"; + this.colorThemeAutoToolStripMenuItem.Size = new System.Drawing.Size(172, 22); + this.colorThemeAutoToolStripMenuItem.Text = "Use system setting"; + this.colorThemeAutoToolStripMenuItem.Click += new System.EventHandler(this.colorThemeAutoToolStripMenuItem_Click); + // + // colorThemeLightToolStripMenuItem + // + this.colorThemeLightToolStripMenuItem.Name = "colorThemeLightToolStripMenuItem"; + this.colorThemeLightToolStripMenuItem.Size = new System.Drawing.Size(172, 22); + this.colorThemeLightToolStripMenuItem.Text = "Light"; + this.colorThemeLightToolStripMenuItem.Click += new System.EventHandler(this.colorThemeLightToolStripMenuItem_Click); + // + // colorThemeDarkToolStripMenuItem + // + this.colorThemeDarkToolStripMenuItem.Name = "colorThemeDarkToolStripMenuItem"; + this.colorThemeDarkToolStripMenuItem.Size = new System.Drawing.Size(172, 22); + this.colorThemeDarkToolStripMenuItem.Text = "Dark"; + this.colorThemeDarkToolStripMenuItem.Click += new System.EventHandler(this.colorThemeDarkToolStripMenuItem_Click); + // // splitContainer1 // this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -756,6 +795,8 @@ // // sceneTreeView // + this.sceneTreeView.BackColor = System.Drawing.SystemColors.Window; + this.sceneTreeView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.sceneTreeView.CheckBoxes = true; this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill; this.sceneTreeView.HideSelection = false; @@ -793,6 +834,7 @@ // // assetListView // + this.assetListView.BackColor = System.Drawing.SystemColors.Window; this.assetListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeaderName, this.columnHeaderContainer, @@ -955,6 +997,7 @@ // progressBar1 // this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.progressBar1.ForeColor = System.Drawing.SystemColors.MenuHighlight; this.progressBar1.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.progressBar1.Location = new System.Drawing.Point(1, 3); this.progressBar1.Name = "progressBar1"; @@ -1038,7 +1081,8 @@ // this.FMODcopyright.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODcopyright.AutoSize = true; - this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight; + this.FMODcopyright.BackColor = System.Drawing.Color.Transparent; + this.FMODcopyright.ForeColor = System.Drawing.Color.White; this.FMODcopyright.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODcopyright.Location = new System.Drawing.Point(214, 365); this.FMODcopyright.Name = "FMODcopyright"; @@ -1050,7 +1094,8 @@ // this.FMODinfoLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODinfoLabel.AutoSize = true; - this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.HighlightText; + this.FMODinfoLabel.BackColor = System.Drawing.Color.Transparent; + this.FMODinfoLabel.ForeColor = System.Drawing.Color.White; this.FMODinfoLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODinfoLabel.Location = new System.Drawing.Point(275, 255); this.FMODinfoLabel.Name = "FMODinfoLabel"; @@ -1061,7 +1106,8 @@ // this.FMODtimerLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODtimerLabel.AutoSize = true; - this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.HighlightText; + this.FMODtimerLabel.BackColor = System.Drawing.Color.Transparent; + this.FMODtimerLabel.ForeColor = System.Drawing.Color.White; this.FMODtimerLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODtimerLabel.Location = new System.Drawing.Point(457, 253); this.FMODtimerLabel.Name = "FMODtimerLabel"; @@ -1073,7 +1119,8 @@ // this.FMODstatusLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODstatusLabel.AutoSize = true; - this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.HighlightText; + this.FMODstatusLabel.BackColor = System.Drawing.Color.Transparent; + this.FMODstatusLabel.ForeColor = System.Drawing.Color.White; this.FMODstatusLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODstatusLabel.Location = new System.Drawing.Point(214, 255); this.FMODstatusLabel.Name = "FMODstatusLabel"; @@ -1113,6 +1160,7 @@ // this.FMODloopButton.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODloopButton.Appearance = System.Windows.Forms.Appearance.Button; + this.FMODloopButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.FMODloopButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODloopButton.Location = new System.Drawing.Point(399, 303); this.FMODloopButton.Name = "FMODloopButton"; @@ -1120,48 +1168,51 @@ this.FMODloopButton.TabIndex = 3; this.FMODloopButton.Text = "Loop"; this.FMODloopButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.FMODloopButton.UseVisualStyleBackColor = true; + this.FMODloopButton.UseVisualStyleBackColor = false; this.FMODloopButton.CheckedChanged += new System.EventHandler(this.FMODloopButton_CheckedChanged); // // FMODstopButton // this.FMODstopButton.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.FMODstopButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.FMODstopButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODstopButton.Location = new System.Drawing.Point(338, 303); this.FMODstopButton.Name = "FMODstopButton"; this.FMODstopButton.Size = new System.Drawing.Size(55, 46); this.FMODstopButton.TabIndex = 2; this.FMODstopButton.Text = "Stop"; - this.FMODstopButton.UseVisualStyleBackColor = true; + this.FMODstopButton.UseVisualStyleBackColor = false; this.FMODstopButton.Click += new System.EventHandler(this.FMODstopButton_Click); // // FMODpauseButton // this.FMODpauseButton.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.FMODpauseButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.FMODpauseButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODpauseButton.Location = new System.Drawing.Point(277, 303); this.FMODpauseButton.Name = "FMODpauseButton"; this.FMODpauseButton.Size = new System.Drawing.Size(55, 46); this.FMODpauseButton.TabIndex = 1; this.FMODpauseButton.Text = "Pause"; - this.FMODpauseButton.UseVisualStyleBackColor = true; + this.FMODpauseButton.UseVisualStyleBackColor = false; this.FMODpauseButton.Click += new System.EventHandler(this.FMODpauseButton_Click); // // FMODplayButton // this.FMODplayButton.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.FMODplayButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.FMODplayButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.FMODplayButton.Location = new System.Drawing.Point(216, 303); this.FMODplayButton.Name = "FMODplayButton"; this.FMODplayButton.Size = new System.Drawing.Size(55, 46); this.FMODplayButton.TabIndex = 0; this.FMODplayButton.Text = "Play"; - this.FMODplayButton.UseVisualStyleBackColor = true; + this.FMODplayButton.UseVisualStyleBackColor = false; this.FMODplayButton.Click += new System.EventHandler(this.FMODplayButton_Click); // // fontPreviewBox // - this.fontPreviewBox.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.fontPreviewBox.BackColor = System.Drawing.SystemColors.Window; this.fontPreviewBox.Dock = System.Windows.Forms.DockStyle.Fill; this.fontPreviewBox.Location = new System.Drawing.Point(0, 0); this.fontPreviewBox.Name = "fontPreviewBox"; @@ -1191,6 +1242,7 @@ // // textPreviewBox // + this.textPreviewBox.BackColor = System.Drawing.SystemColors.Window; this.textPreviewBox.Dock = System.Windows.Forms.DockStyle.Fill; this.textPreviewBox.Font = new System.Drawing.Font("Consolas", 9.75F); this.textPreviewBox.Location = new System.Drawing.Point(0, 0); @@ -1205,6 +1257,7 @@ // // classTextBox // + this.classTextBox.BackColor = System.Drawing.SystemColors.Window; this.classTextBox.Dock = System.Windows.Forms.DockStyle.Fill; this.classTextBox.Location = new System.Drawing.Point(0, 0); this.classTextBox.Multiline = true; @@ -1228,6 +1281,7 @@ // // dumpTextBox // + this.dumpTextBox.BackColor = System.Drawing.SystemColors.Window; this.dumpTextBox.Dock = System.Windows.Forms.DockStyle.Fill; this.dumpTextBox.Location = new System.Drawing.Point(0, 0); this.dumpTextBox.Multiline = true; @@ -1240,6 +1294,7 @@ // // statusStrip1 // + this.statusStrip1.BackColor = System.Drawing.SystemColors.MenuBar; this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1}); this.statusStrip1.Location = new System.Drawing.Point(0, 633); @@ -1250,6 +1305,7 @@ // // toolStripStatusLabel1 // + this.toolStripStatusLabel1.BackColor = System.Drawing.Color.Transparent; this.toolStripStatusLabel1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(761, 17); @@ -1603,6 +1659,10 @@ private System.Windows.Forms.ToolStripMenuItem customCompressionLZ4ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem useAssetLoadingViaTypetreeToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator assetLoadingToolStripSeparator; + private System.Windows.Forms.ToolStripMenuItem colorThemeToolStripMenu; + private System.Windows.Forms.ToolStripMenuItem colorThemeAutoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem colorThemeLightToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem colorThemeDarkToolStripMenuItem; } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index d77f38f..4b62e0a 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -118,13 +118,14 @@ namespace AssetStudioGUI [DllImport("gdi32.dll")] private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts); - private string guiTitle = string.Empty; + private string guiTitle; public AssetStudioGUIForm() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); ConsoleWindow.RunConsole(Properties.Settings.Default.showConsole); InitializeComponent(); + ApplyColorTheme(); var appAssembly = typeof(Program).Assembly.GetName(); guiTitle = $"{appAssembly.Name} v{appAssembly.Version}"; @@ -262,8 +263,8 @@ namespace AssetStudioGUI return; } - var (productName, treeNodeCollection) = await Task.Run(() => BuildAssetData()); - var typeMap = await Task.Run(() => BuildClassStructure()); + var (productName, treeNodeCollection) = await Task.Run(BuildAssetData); + var typeMap = await Task.Run(BuildClassStructure); productName = string.IsNullOrEmpty(productName) ? "no productName" : productName; Text = $"{guiTitle} - {productName} - {assetsManager.assetsFileList[0].version} - {assetsManager.assetsFileList[0].targetPlatformString}"; @@ -2364,6 +2365,85 @@ namespace AssetStudioGUI Properties.Settings.Default.Save(); } + private void ApplyColorTheme() + { +#if NET9_0_OR_GREATER +#pragma warning disable WFO5001 //for evaluation purposes only + var currentTheme = Properties.Settings.Default.guiColorTheme; + colorThemeToolStripMenu.Visible = true; + try + { + switch (currentTheme) + { + case GuiColorTheme.System: + Application.SetColorMode(SystemColorMode.System); + colorThemeAutoToolStripMenuItem.Checked = true; + break; + case GuiColorTheme.Light: + colorThemeLightToolStripMenuItem.Checked = true; + break; + case GuiColorTheme.Dark: + Application.SetColorMode(SystemColorMode.Dark); + colorThemeDarkToolStripMenuItem.Checked = true; + assetListView.GridLines = false; + break; + } + } + catch (Exception) + { + //skip + } +#pragma warning restore WFO5001 +#endif + } + + private void colorThemeAutoToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!colorThemeAutoToolStripMenuItem.Checked) + { + colorThemeAutoToolStripMenuItem.Checked = true; + colorThemeLightToolStripMenuItem.Checked = false; + colorThemeDarkToolStripMenuItem.Checked = false; + Properties.Settings.Default.guiColorTheme = GuiColorTheme.System; + Properties.Settings.Default.Save(); + ShowThemeChangingMsg(); + } + } + + private void colorThemeLightToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!colorThemeLightToolStripMenuItem.Checked) + { + colorThemeAutoToolStripMenuItem.Checked = false; + colorThemeLightToolStripMenuItem.Checked = true; + colorThemeDarkToolStripMenuItem.Checked = false; + Properties.Settings.Default.guiColorTheme = GuiColorTheme.Light; + Properties.Settings.Default.Save(); + ShowThemeChangingMsg(); + } + } + + private void colorThemeDarkToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!colorThemeDarkToolStripMenuItem.Checked) + { + colorThemeAutoToolStripMenuItem.Checked = false; + colorThemeLightToolStripMenuItem.Checked = false; + colorThemeDarkToolStripMenuItem.Checked = true; + Properties.Settings.Default.guiColorTheme = GuiColorTheme.Dark; + Properties.Settings.Default.Save(); + ShowThemeChangingMsg(); + } + } + + private static void ShowThemeChangingMsg() + { + var msg = "Color theme will be changed after restarting the application.\n\n" + + "Dark theme support for WinForms is not yet fully implemented and is for evaluation purposes only.\n" + + "Better Dark theme support should be added in future .NET versions."; + MessageBox.Show(msg, "Info", MessageBoxButtons.OK); + } + #region FMOD private void FMODinit() { diff --git a/AssetStudioGUI/AssetStudioGUIForm.resx b/AssetStudioGUI/AssetStudioGUIForm.resx index 095950b..4c9e06c 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.resx +++ b/AssetStudioGUI/AssetStudioGUIForm.resx @@ -153,6 +153,9 @@ The quick brown fox jumps over the lazy dog. 1234567890 147, 17 + + 930, 21 + 67 diff --git a/AssetStudioGUI/ExportOptions.Designer.cs b/AssetStudioGUI/ExportOptions.Designer.cs index cdd6a89..cd858a9 100644 --- a/AssetStudioGUI/ExportOptions.Designer.cs +++ b/AssetStudioGUI/ExportOptions.Designer.cs @@ -32,6 +32,9 @@ this.OKbutton = new System.Windows.Forms.Button(); this.Cancel = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.parallelExportMaxLabel = new System.Windows.Forms.Label(); + this.parallelExportCheckBox = new System.Windows.Forms.CheckBox(); + this.parallelExportUpDown = new System.Windows.Forms.NumericUpDown(); this.filenameFormatLabel = new System.Windows.Forms.Label(); this.filenameFormatComboBox = new System.Windows.Forms.ComboBox(); this.exportSpriteWithAlphaMask = new System.Windows.Forms.CheckBox(); @@ -72,10 +75,8 @@ this.exportAllNodes = new System.Windows.Forms.CheckBox(); this.eulerFilter = new System.Windows.Forms.CheckBox(); this.optionTooltip = new System.Windows.Forms.ToolTip(this.components); - this.parallelExportUpDown = new System.Windows.Forms.NumericUpDown(); - this.parallelExportCheckBox = new System.Windows.Forms.CheckBox(); - this.parallelExportMaxLabel = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.parallelExportUpDown)).BeginInit(); this.panel1.SuspendLayout(); this.l2dGroupBox.SuspendLayout(); this.l2dMotionExportMethodPanel.SuspendLayout(); @@ -83,28 +84,29 @@ ((System.ComponentModel.ISupportInitialize)(this.scaleFactor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boneSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.parallelExportUpDown)).BeginInit(); this.SuspendLayout(); // // OKbutton // - this.OKbutton.Location = new System.Drawing.Point(381, 380); + this.OKbutton.BackColor = System.Drawing.SystemColors.ButtonFace; + this.OKbutton.Location = new System.Drawing.Point(396, 380); this.OKbutton.Name = "OKbutton"; this.OKbutton.Size = new System.Drawing.Size(75, 23); this.OKbutton.TabIndex = 4; this.OKbutton.Text = "OK"; - this.OKbutton.UseVisualStyleBackColor = true; + this.OKbutton.UseVisualStyleBackColor = false; this.OKbutton.Click += new System.EventHandler(this.OKbutton_Click); // // Cancel // + this.Cancel.BackColor = System.Drawing.SystemColors.ButtonFace; this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(462, 380); + this.Cancel.Location = new System.Drawing.Point(477, 380); this.Cancel.Name = "Cancel"; this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.TabIndex = 5; this.Cancel.Text = "Cancel"; - this.Cancel.UseVisualStyleBackColor = true; + this.Cancel.UseVisualStyleBackColor = false; this.Cancel.Click += new System.EventHandler(this.Cancel_Click); // // groupBox1 @@ -125,18 +127,65 @@ this.groupBox1.Controls.Add(this.converttexture); this.groupBox1.Location = new System.Drawing.Point(12, 13); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(301, 272); + this.groupBox1.Size = new System.Drawing.Size(316, 272); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Export"; // + // parallelExportMaxLabel + // + this.parallelExportMaxLabel.AutoSize = true; + this.parallelExportMaxLabel.ForeColor = System.Drawing.SystemColors.ControlDark; + this.parallelExportMaxLabel.Location = new System.Drawing.Point(260, 221); + this.parallelExportMaxLabel.Name = "parallelExportMaxLabel"; + this.parallelExportMaxLabel.Size = new System.Drawing.Size(33, 13); + this.parallelExportMaxLabel.TabIndex = 13; + this.parallelExportMaxLabel.Text = "Max: "; + this.optionTooltip.SetToolTip(this.parallelExportMaxLabel, "*The maximum number matches the number of CPU cores"); + // + // parallelExportCheckBox + // + this.parallelExportCheckBox.AutoSize = true; + this.parallelExportCheckBox.Checked = true; + this.parallelExportCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.parallelExportCheckBox.Location = new System.Drawing.Point(6, 219); + this.parallelExportCheckBox.Name = "parallelExportCheckBox"; + this.parallelExportCheckBox.Size = new System.Drawing.Size(203, 17); + this.parallelExportCheckBox.TabIndex = 11; + this.parallelExportCheckBox.Text = "Export in parallel with number of tasks"; + this.optionTooltip.SetToolTip(this.parallelExportCheckBox, "*Requires slightly more RAM than in single-task mode"); + this.parallelExportCheckBox.UseVisualStyleBackColor = true; + this.parallelExportCheckBox.CheckedChanged += new System.EventHandler(this.parallelExportCheckBox_CheckedChanged); + // + // parallelExportUpDown + // + this.parallelExportUpDown.Location = new System.Drawing.Point(211, 218); + this.parallelExportUpDown.Maximum = new decimal(new int[] { + 8, + 0, + 0, + 0}); + this.parallelExportUpDown.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.parallelExportUpDown.Name = "parallelExportUpDown"; + this.parallelExportUpDown.Size = new System.Drawing.Size(42, 20); + this.parallelExportUpDown.TabIndex = 12; + this.parallelExportUpDown.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // // filenameFormatLabel // this.filenameFormatLabel.AutoSize = true; this.filenameFormatLabel.Location = new System.Drawing.Point(177, 18); this.filenameFormatLabel.Name = "filenameFormatLabel"; this.filenameFormatLabel.Size = new System.Drawing.Size(84, 13); - this.filenameFormatLabel.TabIndex = 10; + this.filenameFormatLabel.TabIndex = 3; this.filenameFormatLabel.Text = "File name format"; // // filenameFormatComboBox @@ -149,8 +198,8 @@ "pathID"}); this.filenameFormatComboBox.Location = new System.Drawing.Point(177, 35); this.filenameFormatComboBox.Name = "filenameFormatComboBox"; - this.filenameFormatComboBox.Size = new System.Drawing.Size(118, 21); - this.filenameFormatComboBox.TabIndex = 9; + this.filenameFormatComboBox.Size = new System.Drawing.Size(120, 21); + this.filenameFormatComboBox.TabIndex = 4; // // exportSpriteWithAlphaMask // @@ -160,7 +209,7 @@ this.exportSpriteWithAlphaMask.Location = new System.Drawing.Point(6, 150); this.exportSpriteWithAlphaMask.Name = "exportSpriteWithAlphaMask"; this.exportSpriteWithAlphaMask.Size = new System.Drawing.Size(205, 17); - this.exportSpriteWithAlphaMask.TabIndex = 6; + this.exportSpriteWithAlphaMask.TabIndex = 8; this.exportSpriteWithAlphaMask.Text = "Export sprites with alpha mask applied"; this.exportSpriteWithAlphaMask.UseVisualStyleBackColor = true; // @@ -172,7 +221,7 @@ this.openAfterExport.Location = new System.Drawing.Point(6, 196); this.openAfterExport.Name = "openAfterExport"; this.openAfterExport.Size = new System.Drawing.Size(137, 17); - this.openAfterExport.TabIndex = 8; + this.openAfterExport.TabIndex = 10; this.openAfterExport.Text = "Open folder after export"; this.openAfterExport.UseVisualStyleBackColor = true; // @@ -184,7 +233,7 @@ this.restoreExtensionName.Location = new System.Drawing.Point(6, 63); this.restoreExtensionName.Name = "restoreExtensionName"; this.restoreExtensionName.Size = new System.Drawing.Size(275, 17); - this.restoreExtensionName.TabIndex = 3; + this.restoreExtensionName.TabIndex = 5; this.restoreExtensionName.Text = "Try to restore/Use original TextAsset extension name"; this.optionTooltip.SetToolTip(this.restoreExtensionName, "If not checked, AssetStudio will export all TextAssets with the \".txt\" extension"); this.restoreExtensionName.UseVisualStyleBackColor = true; @@ -222,7 +271,7 @@ this.convertAudio.Location = new System.Drawing.Point(6, 173); this.convertAudio.Name = "convertAudio"; this.convertAudio.Size = new System.Drawing.Size(213, 17); - this.convertAudio.TabIndex = 7; + this.convertAudio.TabIndex = 9; this.convertAudio.Text = "Convert FMOD AudioClip to WAV(PCM)"; this.convertAudio.UseVisualStyleBackColor = true; // @@ -235,13 +284,13 @@ this.panel1.Controls.Add(this.tobmp); this.panel1.Location = new System.Drawing.Point(18, 111); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(260, 33); - this.panel1.TabIndex = 5; + this.panel1.Size = new System.Drawing.Size(279, 33); + this.panel1.TabIndex = 7; // // towebp // this.towebp.AutoSize = true; - this.towebp.Location = new System.Drawing.Point(201, 7); + this.towebp.Location = new System.Drawing.Point(207, 7); this.towebp.Name = "towebp"; this.towebp.Size = new System.Drawing.Size(54, 17); this.towebp.TabIndex = 4; @@ -251,7 +300,7 @@ // totga // this.totga.AutoSize = true; - this.totga.Location = new System.Drawing.Point(150, 7); + this.totga.Location = new System.Drawing.Point(154, 7); this.totga.Name = "totga"; this.totga.Size = new System.Drawing.Size(44, 17); this.totga.TabIndex = 3; @@ -261,7 +310,7 @@ // tojpg // this.tojpg.AutoSize = true; - this.tojpg.Location = new System.Drawing.Point(97, 7); + this.tojpg.Location = new System.Drawing.Point(99, 7); this.tojpg.Name = "tojpg"; this.tojpg.Size = new System.Drawing.Size(48, 17); this.tojpg.TabIndex = 2; @@ -272,7 +321,7 @@ // this.topng.AutoSize = true; this.topng.Checked = true; - this.topng.Location = new System.Drawing.Point(50, 7); + this.topng.Location = new System.Drawing.Point(52, 7); this.topng.Name = "topng"; this.topng.Size = new System.Drawing.Size(44, 17); this.topng.TabIndex = 1; @@ -298,7 +347,7 @@ this.converttexture.Location = new System.Drawing.Point(6, 87); this.converttexture.Name = "converttexture"; this.converttexture.Size = new System.Drawing.Size(116, 17); - this.converttexture.TabIndex = 4; + this.converttexture.TabIndex = 6; this.converttexture.Text = "Convert Texture2D"; this.converttexture.UseVisualStyleBackColor = true; // @@ -309,7 +358,7 @@ this.l2dGroupBox.Controls.Add(this.l2dForceBezierCheckBox); this.l2dGroupBox.Location = new System.Drawing.Point(12, 275); this.l2dGroupBox.Name = "l2dGroupBox"; - this.l2dGroupBox.Size = new System.Drawing.Size(301, 100); + this.l2dGroupBox.Size = new System.Drawing.Size(316, 100); this.l2dGroupBox.TabIndex = 2; this.l2dGroupBox.TabStop = false; this.l2dGroupBox.Text = "Cubism Live2D"; @@ -320,7 +369,7 @@ this.l2dMotionExportMethodPanel.Controls.Add(this.l2dAnimationClipRadioButton); this.l2dMotionExportMethodPanel.Location = new System.Drawing.Point(18, 40); this.l2dMotionExportMethodPanel.Name = "l2dMotionExportMethodPanel"; - this.l2dMotionExportMethodPanel.Size = new System.Drawing.Size(263, 27); + this.l2dMotionExportMethodPanel.Size = new System.Drawing.Size(279, 27); this.l2dMotionExportMethodPanel.TabIndex = 2; // // l2dMonoBehaviourRadioButton @@ -341,7 +390,7 @@ // this.l2dAnimationClipRadioButton.AccessibleName = "AnimationClipV2"; this.l2dAnimationClipRadioButton.AutoSize = true; - this.l2dAnimationClipRadioButton.Location = new System.Drawing.Point(172, 5); + this.l2dAnimationClipRadioButton.Location = new System.Drawing.Point(178, 5); this.l2dAnimationClipRadioButton.Name = "l2dAnimationClipRadioButton"; this.l2dAnimationClipRadioButton.Size = new System.Drawing.Size(88, 17); this.l2dAnimationClipRadioButton.TabIndex = 1; @@ -388,7 +437,7 @@ this.groupBox2.Controls.Add(this.castToBone); this.groupBox2.Controls.Add(this.exportAllNodes); this.groupBox2.Controls.Add(this.eulerFilter); - this.groupBox2.Location = new System.Drawing.Point(313, 13); + this.groupBox2.Location = new System.Drawing.Point(328, 13); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(224, 362); this.groupBox2.TabIndex = 3; @@ -600,60 +649,13 @@ this.eulerFilter.Text = "EulerFilter"; this.eulerFilter.UseVisualStyleBackColor = true; // - // parallelExportUpDown - // - this.parallelExportUpDown.Location = new System.Drawing.Point(209, 218); - this.parallelExportUpDown.Maximum = new decimal(new int[] { - 8, - 0, - 0, - 0}); - this.parallelExportUpDown.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.parallelExportUpDown.Name = "parallelExportUpDown"; - this.parallelExportUpDown.Size = new System.Drawing.Size(42, 20); - this.parallelExportUpDown.TabIndex = 13; - this.parallelExportUpDown.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // parallelExportCheckBox - // - this.parallelExportCheckBox.AutoSize = true; - this.parallelExportCheckBox.Checked = true; - this.parallelExportCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.parallelExportCheckBox.Location = new System.Drawing.Point(6, 219); - this.parallelExportCheckBox.Name = "parallelExportCheckBox"; - this.parallelExportCheckBox.Size = new System.Drawing.Size(203, 17); - this.parallelExportCheckBox.TabIndex = 15; - this.parallelExportCheckBox.Text = "Export in parallel with number of tasks"; - this.optionTooltip.SetToolTip(this.parallelExportCheckBox, "*Requires slightly more RAM than in single-task mode"); - this.parallelExportCheckBox.UseVisualStyleBackColor = true; - this.parallelExportCheckBox.CheckedChanged += new System.EventHandler(this.parallelExportCheckBox_CheckedChanged); - // - // parallelExportMaxLabel - // - this.parallelExportMaxLabel.AutoSize = true; - this.parallelExportMaxLabel.ForeColor = System.Drawing.SystemColors.ControlDark; - this.parallelExportMaxLabel.Location = new System.Drawing.Point(256, 221); - this.parallelExportMaxLabel.Name = "parallelExportMaxLabel"; - this.parallelExportMaxLabel.Size = new System.Drawing.Size(33, 13); - this.parallelExportMaxLabel.TabIndex = 16; - this.parallelExportMaxLabel.Text = "Max: "; - this.optionTooltip.SetToolTip(this.parallelExportMaxLabel, "*The maximum number matches the number of CPU cores"); - // // ExportOptions // this.AcceptButton = this.OKbutton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(549, 416); + this.ClientSize = new System.Drawing.Size(564, 416); this.Controls.Add(this.l2dGroupBox); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -669,6 +671,7 @@ this.TopMost = true; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.parallelExportUpDown)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.l2dGroupBox.ResumeLayout(false); @@ -680,7 +683,6 @@ ((System.ComponentModel.ISupportInitialize)(this.scaleFactor)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boneSize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.parallelExportUpDown)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/AssetStudioGUI/ExportOptions.resx b/AssetStudioGUI/ExportOptions.resx index ef2cd3d..ea45d2d 100644 --- a/AssetStudioGUI/ExportOptions.resx +++ b/AssetStudioGUI/ExportOptions.resx @@ -123,7 +123,4 @@ 17, 17 - - 17, 17 - \ No newline at end of file diff --git a/AssetStudioGUI/Properties/Settings.Designer.cs b/AssetStudioGUI/Properties/Settings.Designer.cs index d031210..1302be9 100644 --- a/AssetStudioGUI/Properties/Settings.Designer.cs +++ b/AssetStudioGUI/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace AssetStudioGUI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -394,5 +394,17 @@ namespace AssetStudioGUI.Properties { this["useTypetreeLoading"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Light")] + public global::AssetStudioGUI.GuiColorTheme guiColorTheme { + get { + return ((global::AssetStudioGUI.GuiColorTheme)(this["guiColorTheme"])); + } + set { + this["guiColorTheme"] = value; + } + } } } diff --git a/AssetStudioGUI/Properties/Settings.settings b/AssetStudioGUI/Properties/Settings.settings index 4ecc1de..b271543 100644 --- a/AssetStudioGUI/Properties/Settings.settings +++ b/AssetStudioGUI/Properties/Settings.settings @@ -95,5 +95,8 @@ True + + Light + \ No newline at end of file diff --git a/AssetStudioGUI/Studio.cs b/AssetStudioGUI/Studio.cs index bd6ee48..b32874b 100644 --- a/AssetStudioGUI/Studio.cs +++ b/AssetStudioGUI/Studio.cs @@ -16,6 +16,13 @@ using Object = AssetStudio.Object; namespace AssetStudioGUI { + internal enum GuiColorTheme + { + System, + Light, + Dark + } + internal enum ExportType { Convert,