diff --git a/GUI/CKAN-GUI.csproj b/GUI/CKAN-GUI.csproj index 708cf48484..8677bccddc 100644 --- a/GUI/CKAN-GUI.csproj +++ b/GUI/CKAN-GUI.csproj @@ -249,6 +249,8 @@ + + diff --git a/GUI/Main.Designer.cs b/GUI/Main.Designer.cs index ff83eceddb..c5a72dc274 100644 --- a/GUI/Main.Designer.cs +++ b/GUI/Main.Designer.cs @@ -100,7 +100,7 @@ private void InitializeComponent() this.reinstallToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.downloadContentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.purgeContentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ModInfoTabControl = new CKAN.MainModInfo(); + this.ModInfo = new CKAN.MainModInfo(); this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.StatusInstanceLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.StatusProgress = new System.Windows.Forms.ToolStripProgressBar(); @@ -115,7 +115,7 @@ private void InitializeComponent() this.ChangesetTabPage = new System.Windows.Forms.TabPage(); this.CancelChangesButton = new System.Windows.Forms.Button(); this.ConfirmChangesButton = new System.Windows.Forms.Button(); - this.ChangesListView = new System.Windows.Forms.ListView(); + this.ChangesListView = new ThemedListView(); this.Mod = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ChangeType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Reason = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -130,7 +130,7 @@ private void InitializeComponent() this.RecommendedModsContinueButton = new System.Windows.Forms.Button(); this.RecommendedModsToggleCheckbox = new System.Windows.Forms.CheckBox(); this.RecommendedDialogLabel = new System.Windows.Forms.Label(); - this.RecommendedModsListView = new System.Windows.Forms.ListView(); + this.RecommendedModsListView = new ThemedListView(); this.RecommendationsGroup = new System.Windows.Forms.ListViewGroup(); this.SuggestionsGroup = new System.Windows.Forms.ListViewGroup(); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -139,7 +139,7 @@ private void InitializeComponent() this.ChooseProvidedModsTabPage = new System.Windows.Forms.TabPage(); this.ChooseProvidedModsCancelButton = new System.Windows.Forms.Button(); this.ChooseProvidedModsContinueButton = new System.Windows.Forms.Button(); - this.ChooseProvidedModsListView = new System.Windows.Forms.ListView(); + this.ChooseProvidedModsListView = new ThemedListView(); this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ChooseProvidedModsLabel = new System.Windows.Forms.Label(); @@ -350,6 +350,8 @@ private void InitializeComponent() // // statusStrip1 // + this.statusStrip1.BackColor = System.Drawing.SystemColors.Control; + this.statusStrip1.ForeColor = System.Drawing.SystemColors.ControlText; this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Location = new System.Drawing.Point(0, 1016); this.statusStrip1.Size = new System.Drawing.Size(1544, 22); @@ -563,7 +565,7 @@ private void InitializeComponent() // // splitContainer1.Panel2 // - this.splitContainer1.Panel2.Controls.Add(this.ModInfoTabControl); + this.splitContainer1.Panel2.Controls.Add(this.ModInfo); this.splitContainer1.Panel2MinSize = 300; this.splitContainer1.Size = new System.Drawing.Size(1544, 981); this.splitContainer1.SplitterDistance = 1156; @@ -579,6 +581,8 @@ private void InitializeComponent() this.ModList.AllowUserToDeleteRows = false; this.ModList.AllowUserToResizeRows = false; this.ModList.BackgroundColor = System.Drawing.SystemColors.Window; + this.ModList.EnableHeadersVisualStyles = false; + this.ModList.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.SystemColors.Control; this.ModList.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.SystemColors.ControlText; this.ModList.DefaultCellStyle.ForeColor = System.Drawing.SystemColors.WindowText; this.ModList.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; @@ -783,14 +787,14 @@ private void InitializeComponent() this.ModListHeaderContextMenuStrip.ShowCheckMargin = true; this.ModListHeaderContextMenuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(ModListHeaderContextMenuStrip_ItemClicked); // - // ModInfoTabControl + // ModInfo // - this.ModInfoTabControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.ModInfoTabControl.Location = new System.Drawing.Point(0, 0); - this.ModInfoTabControl.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.ModInfoTabControl.Name = "ModInfoTabControl"; - this.ModInfoTabControl.Size = new System.Drawing.Size(360, 836); - this.ModInfoTabControl.TabIndex = 34; + this.ModInfo.Dock = System.Windows.Forms.DockStyle.Fill; + this.ModInfo.Location = new System.Drawing.Point(0, 0); + this.ModInfo.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ModInfo.Name = "ModInfo"; + this.ModInfo.Size = new System.Drawing.Size(360, 836); + this.ModInfo.TabIndex = 34; // // StatusLabel // @@ -824,6 +828,7 @@ private void InitializeComponent() // // MainTabControl // + this.MainTabControl.BackColor = System.Drawing.SystemColors.Control; this.MainTabControl.Controls.Add(this.ManageModsTabPage); this.MainTabControl.Controls.Add(this.ChangesetTabPage); this.MainTabControl.Controls.Add(this.WaitTabPage); @@ -932,6 +937,7 @@ private void InitializeComponent() // // ChangesetTabPage // + this.ChangesetTabPage.BackColor = System.Drawing.SystemColors.Control; this.ChangesetTabPage.Controls.Add(this.CancelChangesButton); this.ChangesetTabPage.Controls.Add(this.ConfirmChangesButton); this.ChangesetTabPage.Controls.Add(this.ChangesListView); @@ -941,7 +947,6 @@ private void InitializeComponent() this.ChangesetTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ChangesetTabPage.Size = new System.Drawing.Size(1536, 948); this.ChangesetTabPage.TabIndex = 13; - this.ChangesetTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.ChangesetTabPage, "ChangesetTabPage"); // // CancelChangesButton @@ -953,7 +958,6 @@ private void InitializeComponent() this.CancelChangesButton.Name = "CancelChangesButton"; this.CancelChangesButton.Size = new System.Drawing.Size(112, 35); this.CancelChangesButton.TabIndex = 16; - this.CancelChangesButton.UseVisualStyleBackColor = true; this.CancelChangesButton.Click += new System.EventHandler(this.CancelChangesButton_Click); resources.ApplyResources(this.CancelChangesButton, "CancelChangesButton"); // @@ -966,7 +970,6 @@ private void InitializeComponent() this.ConfirmChangesButton.Name = "ConfirmChangesButton"; this.ConfirmChangesButton.Size = new System.Drawing.Size(112, 35); this.ConfirmChangesButton.TabIndex = 15; - this.ConfirmChangesButton.UseVisualStyleBackColor = true; this.ConfirmChangesButton.Click += new System.EventHandler(this.ConfirmChangesButton_Click); resources.ApplyResources(this.ConfirmChangesButton, "ConfirmChangesButton"); // @@ -1030,7 +1033,6 @@ private void InitializeComponent() this.CancelCurrentActionButton.Name = "CancelCurrentActionButton"; this.CancelCurrentActionButton.Size = new System.Drawing.Size(112, 35); this.CancelCurrentActionButton.TabIndex = 22; - this.CancelCurrentActionButton.UseVisualStyleBackColor = true; this.CancelCurrentActionButton.Click += new System.EventHandler(this.CancelCurrentActionButton_Click); resources.ApplyResources(this.CancelCurrentActionButton, "CancelCurrentActionButton"); // @@ -1043,7 +1045,6 @@ private void InitializeComponent() this.RetryCurrentActionButton.Name = "RetryCurrentActionButton"; this.RetryCurrentActionButton.Size = new System.Drawing.Size(112, 35); this.RetryCurrentActionButton.TabIndex = 21; - this.RetryCurrentActionButton.UseVisualStyleBackColor = true; this.RetryCurrentActionButton.Visible = false; this.RetryCurrentActionButton.Click += new System.EventHandler(this.RetryCurrentActionButton_Click); resources.ApplyResources(this.RetryCurrentActionButton, "RetryCurrentActionButton"); @@ -1094,6 +1095,7 @@ private void InitializeComponent() // // ChooseRecommendedModsTabPage // + this.ChooseRecommendedModsTabPage.BackColor = System.Drawing.SystemColors.Control; this.ChooseRecommendedModsTabPage.Controls.Add(this.RecommendedModsCancelButton); this.ChooseRecommendedModsTabPage.Controls.Add(this.RecommendedModsContinueButton); this.ChooseRecommendedModsTabPage.Controls.Add(this.RecommendedModsToggleCheckbox); @@ -1105,7 +1107,6 @@ private void InitializeComponent() this.ChooseRecommendedModsTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ChooseRecommendedModsTabPage.Size = new System.Drawing.Size(1536, 948); this.ChooseRecommendedModsTabPage.TabIndex = 23; - this.ChooseRecommendedModsTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.ChooseRecommendedModsTabPage, "ChooseRecommendedModsTabPage"); // // RecommendedModsCancelButton @@ -1117,7 +1118,6 @@ private void InitializeComponent() this.RecommendedModsCancelButton.Name = "RecommendedModsCancelButton"; this.RecommendedModsCancelButton.Size = new System.Drawing.Size(112, 35); this.RecommendedModsCancelButton.TabIndex = 27; - this.RecommendedModsCancelButton.UseVisualStyleBackColor = true; this.RecommendedModsCancelButton.Click += new System.EventHandler(this.RecommendedModsCancelButton_Click); resources.ApplyResources(this.RecommendedModsCancelButton, "RecommendedModsCancelButton"); // @@ -1130,7 +1130,6 @@ private void InitializeComponent() this.RecommendedModsContinueButton.Name = "RecommendedModsContinueButton"; this.RecommendedModsContinueButton.Size = new System.Drawing.Size(112, 35); this.RecommendedModsContinueButton.TabIndex = 26; - this.RecommendedModsContinueButton.UseVisualStyleBackColor = true; this.RecommendedModsContinueButton.Click += new System.EventHandler(this.RecommendedModsContinueButton_Click); resources.ApplyResources(this.RecommendedModsContinueButton, "RecommendedModsContinueButton"); // @@ -1144,7 +1143,6 @@ private void InitializeComponent() this.RecommendedModsToggleCheckbox.Name = "RecommendedModsToggleCheckbox"; this.RecommendedModsToggleCheckbox.Size = new System.Drawing.Size(131, 24); this.RecommendedModsToggleCheckbox.TabIndex = 28; - this.RecommendedModsToggleCheckbox.UseVisualStyleBackColor = true; this.RecommendedModsToggleCheckbox.CheckedChanged += new System.EventHandler(this.RecommendedModsToggleCheckbox_CheckedChanged); resources.ApplyResources(this.RecommendedModsToggleCheckbox, "RecommendedModsToggleCheckbox"); // @@ -1210,6 +1208,7 @@ private void InitializeComponent() // // ChooseProvidedModsTabPage // + this.ChooseProvidedModsTabPage.BackColor = System.Drawing.SystemColors.Control; this.ChooseProvidedModsTabPage.Controls.Add(this.ChooseProvidedModsCancelButton); this.ChooseProvidedModsTabPage.Controls.Add(this.ChooseProvidedModsContinueButton); this.ChooseProvidedModsTabPage.Controls.Add(this.ChooseProvidedModsListView); @@ -1220,7 +1219,6 @@ private void InitializeComponent() this.ChooseProvidedModsTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ChooseProvidedModsTabPage.Size = new System.Drawing.Size(1536, 948); this.ChooseProvidedModsTabPage.TabIndex = 29; - this.ChooseProvidedModsTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.ChooseProvidedModsTabPage, "ChooseProvidedModsTabPage"); // // ChooseProvidedModsCancelButton @@ -1232,7 +1230,6 @@ private void InitializeComponent() this.ChooseProvidedModsCancelButton.Name = "ChooseProvidedModsCancelButton"; this.ChooseProvidedModsCancelButton.Size = new System.Drawing.Size(112, 35); this.ChooseProvidedModsCancelButton.TabIndex = 33; - this.ChooseProvidedModsCancelButton.UseVisualStyleBackColor = true; this.ChooseProvidedModsCancelButton.Click += new System.EventHandler(this.ChooseProvidedModsCancelButton_Click); resources.ApplyResources(this.ChooseProvidedModsCancelButton, "ChooseProvidedModsCancelButton"); // @@ -1245,7 +1242,6 @@ private void InitializeComponent() this.ChooseProvidedModsContinueButton.Name = "ChooseProvidedModsContinueButton"; this.ChooseProvidedModsContinueButton.Size = new System.Drawing.Size(112, 35); this.ChooseProvidedModsContinueButton.TabIndex = 32; - this.ChooseProvidedModsContinueButton.UseVisualStyleBackColor = true; this.ChooseProvidedModsContinueButton.Click += new System.EventHandler(this.ChooseProvidedModsContinueButton_Click); resources.ApplyResources(this.ChooseProvidedModsContinueButton, "ChooseProvidedModsContinueButton"); // @@ -1508,7 +1504,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem reinstallToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem downloadContentsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem purgeContentsToolStripMenuItem; - private CKAN.MainModInfo ModInfoTabControl; + private CKAN.MainModInfo ModInfo; private System.Windows.Forms.ToolStripStatusLabel StatusLabel; private System.Windows.Forms.ToolStripStatusLabel StatusInstanceLabel; private System.Windows.Forms.ToolStripProgressBar StatusProgress; diff --git a/GUI/Main.cs b/GUI/Main.cs index f2e51a1fac..68510d4b34 100644 --- a/GUI/Main.cs +++ b/GUI/Main.cs @@ -196,7 +196,7 @@ public Main(string[] cmdlineArgs, KSPManager mgr, GUIUser user, bool showConsole InitializeComponent(); // React when the user clicks a tag or filter link in mod info - ModInfoTabControl.OnChangeFilter += Filter; + ModInfo.OnChangeFilter += Filter; // Replace mono's broken, ugly toolstrip renderer if (Platform.IsMono) @@ -334,7 +334,7 @@ protected override void OnShown(EventArgs e) // SplitContainer is mis-designed to throw exceptions // if the min/max limits are exceeded rather than simply obeying them. } - ModInfoTabControl.ModMetaSplitPosition = configuration.ModInfoPosition; + ModInfo.ModMetaSplitPosition = configuration.ModInfoPosition; base.OnShown(e); } @@ -539,7 +539,7 @@ protected override void OnFormClosing(FormClosingEventArgs e) configuration.PanelPosition = splitContainer1.SplitterDistance; // Copy metadata panel split height to app settings - configuration.ModInfoPosition = ModInfoTabControl.ModMetaSplitPosition; + configuration.ModInfoPosition = ModInfo.ModMetaSplitPosition; // Save the active filter configuration.ActiveFilter = (int)mainModList.ModFilter; @@ -676,7 +676,7 @@ private void MarkAllUpdatesToolButton_Click(object sender, EventArgs e) public void UpdateModContentsTree(CkanModule module, bool force = false) { - ModInfoTabControl.UpdateModContentsTree(module, force); + ModInfo.UpdateModContentsTree(module, force); } private void ApplyToolButton_Click(object sender, EventArgs e) @@ -792,7 +792,7 @@ public async Task UpdateChangeSetAndConflicts(IRegistryQuerier registry) catch (TooManyModsProvideKraken) { // Can be thrown by ComputeChangeSetFromModList if the user cancels out of it. - // We can just rerun it as the ModInfoTabControl has been removed. + // We can just rerun it as the ModInfo has been removed. too_many_provides_thrown = true; } catch (DependencyNotSatisfiedKraken k) @@ -1242,7 +1242,7 @@ private GUIMod ActiveModInfo { splitContainer1.Panel2Collapsed = false; } - ModInfoTabControl.SelectedModule = value; + ModInfo.SelectedModule = value; } } } @@ -1329,7 +1329,7 @@ private void ModList_MouseDown(object sender, MouseEventArgs e) private void reinstallToolStripMenuItem_Click(object sender, EventArgs e) { - GUIMod module = ModInfoTabControl.SelectedModule; + GUIMod module = ModInfo.SelectedModule; if (module == null || !module.IsCKAN) return; @@ -1371,23 +1371,23 @@ private void reinstallToolStripMenuItem_Click(object sender, EventArgs e) private void downloadContentsToolStripMenuItem_Click(object sender, EventArgs e) { - ModInfoTabControl.StartDownload(ModInfoTabControl.SelectedModule); + ModInfo.StartDownload(ModInfo.SelectedModule); } private void purgeContentsToolStripMenuItem_Click(object sender, EventArgs e) { // Purge other versions as well since the user is likely to want that // and has no other way to achieve it - if (ModInfoTabControl.SelectedModule != null) + if (ModInfo.SelectedModule != null) { IRegistryQuerier registry = RegistryManager.Instance(CurrentInstance).registry; - var allAvail = registry.AllAvailable(ModInfoTabControl.SelectedModule.Identifier); + var allAvail = registry.AllAvailable(ModInfo.SelectedModule.Identifier); foreach (CkanModule mod in allAvail) { Manager.Cache.Purge(mod); } - ModInfoTabControl.SelectedModule.UpdateIsCached(); - UpdateModContentsTree(ModInfoTabControl.SelectedModule.ToCkanModule(), true); + ModInfo.SelectedModule.UpdateIsCached(); + UpdateModContentsTree(ModInfo.SelectedModule.ToCkanModule(), true); } } diff --git a/GUI/MainAllModVersions.Designer.cs b/GUI/MainAllModVersions.Designer.cs index 4f9e85cda7..9e9cc0113c 100644 --- a/GUI/MainAllModVersions.Designer.cs +++ b/GUI/MainAllModVersions.Designer.cs @@ -37,7 +37,7 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.ModVersion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.CompatibleKSPVersion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.VersionsListView = new System.Windows.Forms.ListView(); + this.VersionsListView = new ThemedListView(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); diff --git a/GUI/MainModInfo.Designer.cs b/GUI/MainModInfo.Designer.cs index ea70a989d0..69ab20138a 100644 --- a/GUI/MainModInfo.Designer.cs +++ b/GUI/MainModInfo.Designer.cs @@ -30,7 +30,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new SingleAssemblyComponentResourceManager(typeof(MainModInfo)); - this.ModInfoTabControl = new System.Windows.Forms.TabControl(); + this.ModInfoTabControl = new ThemedTabControl(); this.MetadataTabPage = new System.Windows.Forms.TabPage(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.MetaDataUpperLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); @@ -93,6 +93,7 @@ private void InitializeComponent() // ModInfoTabControl // this.ModInfoTabControl.Appearance = System.Windows.Forms.TabAppearance.Normal; + this.ModInfoTabControl.BackColor = System.Drawing.SystemColors.Control; this.ModInfoTabControl.Multiline = true; this.ModInfoTabControl.Controls.Add(this.MetadataTabPage); this.ModInfoTabControl.Controls.Add(this.RelationshipTabPage); @@ -107,13 +108,13 @@ private void InitializeComponent() // // MetadataTabPage // + this.MetadataTabPage.BackColor = System.Drawing.SystemColors.Control; this.MetadataTabPage.Controls.Add(this.MetaDataLowerLayoutPanel); this.MetadataTabPage.Location = new System.Drawing.Point(4, 25); this.MetadataTabPage.Name = "MetadataTabPage"; this.MetadataTabPage.Padding = new System.Windows.Forms.Padding(3); this.MetadataTabPage.Size = new System.Drawing.Size(354, 502); this.MetadataTabPage.TabIndex = 0; - this.MetadataTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.MetadataTabPage, "MetadataTabPage"); // // splitContainer2 @@ -471,6 +472,7 @@ private void InitializeComponent() // // RelationshipTabPage // + this.RelationshipTabPage.BackColor = System.Drawing.SystemColors.Control; this.RelationshipTabPage.Controls.Add(this.DependsGraphTree); this.RelationshipTabPage.Controls.Add(this.LegendDependsImage); this.RelationshipTabPage.Controls.Add(this.LegendRecommendsImage); @@ -487,7 +489,6 @@ private void InitializeComponent() this.RelationshipTabPage.Padding = new System.Windows.Forms.Padding(3); this.RelationshipTabPage.Size = new System.Drawing.Size(354, 502); this.RelationshipTabPage.TabIndex = 1; - this.RelationshipTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.RelationshipTabPage, "RelationshipTabPage"); // // DependsGraphTree @@ -586,6 +587,7 @@ private void InitializeComponent() // // ContentTabPage // + this.ContentTabPage.BackColor = System.Drawing.SystemColors.Control; this.ContentTabPage.Controls.Add(this.ContentsPreviewTree); this.ContentTabPage.Controls.Add(this.ContentsDownloadButton); this.ContentTabPage.Controls.Add(this.ContentsOpenButton); @@ -595,7 +597,6 @@ private void InitializeComponent() this.ContentTabPage.Padding = new System.Windows.Forms.Padding(3); this.ContentTabPage.Size = new System.Drawing.Size(354, 502); this.ContentTabPage.TabIndex = 2; - this.ContentTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.ContentTabPage, "ContentTabPage"); // // ContentsPreviewTree @@ -604,6 +605,9 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ContentsPreviewTree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ContentsPreviewTree.ShowPlusMinus = false; + this.ContentsPreviewTree.ShowRootLines = false; + this.ContentsPreviewTree.Indent = 12; this.ContentsPreviewTree.Enabled = false; this.ContentsPreviewTree.Location = new System.Drawing.Point(6, 65); this.ContentsPreviewTree.Name = "ContentsPreviewTree"; @@ -644,13 +648,13 @@ private void InitializeComponent() // // AllModVersionsTabPage // + this.AllModVersionsTabPage.BackColor = System.Drawing.SystemColors.Control; this.AllModVersionsTabPage.Controls.Add(this.AllModVersions); this.AllModVersionsTabPage.Location = new System.Drawing.Point(4, 25); this.AllModVersionsTabPage.Margin = new System.Windows.Forms.Padding(2); this.AllModVersionsTabPage.Name = "AllModVersionsTabPage"; this.AllModVersionsTabPage.Size = new System.Drawing.Size(354, 502); this.AllModVersionsTabPage.TabIndex = 1; - this.AllModVersionsTabPage.UseVisualStyleBackColor = true; resources.ApplyResources(this.AllModVersionsTabPage, "AllModVersionsTabPage"); // // AllModVersions diff --git a/GUI/MainModInfo.cs b/GUI/MainModInfo.cs index 453d14d2d4..0610052b4a 100644 --- a/GUI/MainModInfo.cs +++ b/GUI/MainModInfo.cs @@ -294,6 +294,8 @@ private void _UpdateModDependencyGraph() CkanModule module = (CkanModule)ModInfoTabControl.Tag; DependsGraphTree.BeginUpdate(); + DependsGraphTree.BackColor = SystemColors.Window; + DependsGraphTree.LineColor = SystemColors.WindowText; DependsGraphTree.Nodes.Clear(); IRegistryQuerier registry = RegistryManager.Instance(manager.CurrentInstance).registry; TreeNode root = new TreeNode($"{module.name} {module.version}", 0, 0) @@ -408,7 +410,7 @@ private TreeNode providesNode(string identifier, RelationshipType relationship, { Name = identifier, ToolTipText = relationship.ToString(), - ForeColor = Color.Gray + ForeColor = SystemColors.GrayText, }; } @@ -422,7 +424,7 @@ private TreeNode indexedNode(IRegistryQuerier registry, CkanModule module, Relat Name = module.identifier, ToolTipText = relationship.ToString(), Tag = module, - ForeColor = compatible ? Color.Empty : Color.Red + ForeColor = compatible ? SystemColors.WindowText : Color.Red, }; } @@ -486,6 +488,8 @@ public void UpdateModContentsTree(CkanModule module, bool force = false) private void _UpdateModContentsTree(bool force = false) { + ContentsPreviewTree.BackColor = SystemColors.Window; + ContentsPreviewTree.LineColor = SystemColors.WindowText; GUIMod guiMod = SelectedModule; if (!guiMod.IsCKAN) { diff --git a/GUI/MainModList.cs b/GUI/MainModList.cs index b37c6de24e..47ce5d6d8b 100644 --- a/GUI/MainModList.cs +++ b/GUI/MainModList.cs @@ -331,7 +331,7 @@ private void ModList_SelectedIndexChanged(object sender, EventArgs e) { // Skip if already disposed (i.e. after the form has been closed). // Needed for TransparentTextBoxes - if (ModInfoTabControl.IsDisposed) + if (ModInfo.IsDisposed) { return; } diff --git a/GUI/MainRecommendations.cs b/GUI/MainRecommendations.cs index 8542686d46..5c39228b6c 100644 --- a/GUI/MainRecommendations.cs +++ b/GUI/MainRecommendations.cs @@ -132,6 +132,7 @@ private void ShowRecSugDialog(IEnumerable rows, HashSet + /// A ListView that obeys system colors to look less awful in a dark theme + /// + public class ThemedListView : ListView + { + public ThemedListView() : base() + { + // Tell the base class that we want to draw things ourselves + OwnerDraw = true; + } + + protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e) + { + // Background + e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds); + // Borders at the bottom and between header cells + Rectangle rect = e.Bounds; + rect.Inflate(1, 0); + rect.Offset(0, -1); + e.Graphics.DrawRectangle(SystemPens.ControlDark, rect); + // Text + e.DrawText(TextFormatFlags.VerticalCenter | TextFormatFlags.Left); + // Alert event subscribers + base.OnDrawColumnHeader(e); + } + + protected override void OnDrawItem(DrawListViewItemEventArgs e) + { + // Tell the base class that we changed our mind, it can draw the data rows + e.DrawDefault = true; + } + + protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e) + { + // Tell the base class that we changed our mind, it can draw the data rows + e.DrawDefault = true; + } + } +} diff --git a/GUI/ThemedTabControl.cs b/GUI/ThemedTabControl.cs new file mode 100644 index 0000000000..10656663f3 --- /dev/null +++ b/GUI/ThemedTabControl.cs @@ -0,0 +1,32 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace CKAN +{ + /// + /// A TabControl that obeys system colors to look less awful in a dark theme + /// + public class ThemedTabControl : TabControl + { + public ThemedTabControl() : base() + { + // Tell the base class that we want to draw things ourselves + DrawMode = TabDrawMode.OwnerDrawFixed; + } + + protected override void OnDrawItem(DrawItemEventArgs e) + { + // Background + e.Graphics.FillRectangle(new SolidBrush(BackColor), e.Bounds); + // Text + var tabPage = TabPages[e.Index]; + Rectangle rect = e.Bounds; + rect.Offset(1, 1); + TextRenderer.DrawText(e.Graphics, tabPage.Text, tabPage.Font, + rect, tabPage.ForeColor); + // Alert event subscribers + base.OnDrawItem(e); + } + } +}