From 08e55996385ee21948d76313c5cb216c9acdf5b1 Mon Sep 17 00:00:00 2001 From: MaxED Date: Sat, 7 Mar 2015 21:38:58 +0000 Subject: [PATCH] Fixed, Texture Browser form: "All" texture set was always selected when opening the form after closing it with this set selected. Changed, Texture Browser form: texture groups list can now be resized. Changed, Texture Browser form: selected group in texture groups list is now highlighted using highlight color even when not focused. Changed, Linedef Info panel cosmetic: changed vertical position of texture name labels to match with the ones in the Sector Info panel. --- .../Controls/LinedefInfoPanel.Designer.cs | 28 +++++----- Source/Core/Geometry/Triangulation.cs | 4 +- .../Windows/TextureBrowserForm.Designer.cs | 53 ++++++++++++++----- Source/Core/Windows/TextureBrowserForm.cs | 21 +++++--- 4 files changed, 72 insertions(+), 34 deletions(-) diff --git a/Source/Core/Controls/LinedefInfoPanel.Designer.cs b/Source/Core/Controls/LinedefInfoPanel.Designer.cs index 9c5d0fc5..af51b425 100644 --- a/Source/Core/Controls/LinedefInfoPanel.Designer.cs +++ b/Source/Core/Controls/LinedefInfoPanel.Designer.cs @@ -445,7 +445,7 @@ namespace CodeImp.DoomBuilder.Controls this.flowLayoutPanelFront.Location = new System.Drawing.Point(6, 14); this.flowLayoutPanelFront.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanelFront.Name = "flowLayoutPanelFront"; - this.flowLayoutPanelFront.Size = new System.Drawing.Size(484, 80); + this.flowLayoutPanelFront.Size = new System.Drawing.Size(484, 82); this.flowLayoutPanelFront.TabIndex = 13; this.flowLayoutPanelFront.WrapContents = false; // @@ -460,7 +460,7 @@ namespace CodeImp.DoomBuilder.Controls this.panelFrontTop.Location = new System.Drawing.Point(0, 0); this.panelFrontTop.Margin = new System.Windows.Forms.Padding(0); this.panelFrontTop.Name = "panelFrontTop"; - this.panelFrontTop.Size = new System.Drawing.Size(160, 79); + this.panelFrontTop.Size = new System.Drawing.Size(160, 82); this.panelFrontTop.TabIndex = 5; // // frontTopUDMFOffsetLabel @@ -527,7 +527,7 @@ namespace CodeImp.DoomBuilder.Controls // this.fronthighname.AutoSize = true; this.fronthighname.BackColor = System.Drawing.SystemColors.Control; - this.fronthighname.Location = new System.Drawing.Point(3, 64); + this.fronthighname.Location = new System.Drawing.Point(3, 67); this.fronthighname.Name = "fronthighname"; this.fronthighname.Size = new System.Drawing.Size(73, 13); this.fronthighname.TabIndex = 1; @@ -545,7 +545,7 @@ namespace CodeImp.DoomBuilder.Controls this.panelFrontMid.Location = new System.Drawing.Point(160, 0); this.panelFrontMid.Margin = new System.Windows.Forms.Padding(0); this.panelFrontMid.Name = "panelFrontMid"; - this.panelFrontMid.Size = new System.Drawing.Size(160, 79); + this.panelFrontMid.Size = new System.Drawing.Size(160, 82); this.panelFrontMid.TabIndex = 7; // // frontMidUDMFOffsetLabel @@ -612,7 +612,7 @@ namespace CodeImp.DoomBuilder.Controls // this.frontmidname.AutoSize = true; this.frontmidname.BackColor = System.Drawing.SystemColors.Control; - this.frontmidname.Location = new System.Drawing.Point(3, 64); + this.frontmidname.Location = new System.Drawing.Point(3, 67); this.frontmidname.Name = "frontmidname"; this.frontmidname.Size = new System.Drawing.Size(73, 13); this.frontmidname.TabIndex = 3; @@ -630,7 +630,7 @@ namespace CodeImp.DoomBuilder.Controls this.panelFrontLow.Location = new System.Drawing.Point(320, 0); this.panelFrontLow.Margin = new System.Windows.Forms.Padding(0); this.panelFrontLow.Name = "panelFrontLow"; - this.panelFrontLow.Size = new System.Drawing.Size(160, 78); + this.panelFrontLow.Size = new System.Drawing.Size(160, 82); this.panelFrontLow.TabIndex = 12; // // frontBottomUDMFOffsetLabel @@ -697,7 +697,7 @@ namespace CodeImp.DoomBuilder.Controls // this.frontlowname.AutoSize = true; this.frontlowname.BackColor = System.Drawing.SystemColors.Control; - this.frontlowname.Location = new System.Drawing.Point(3, 64); + this.frontlowname.Location = new System.Drawing.Point(3, 67); this.frontlowname.Name = "frontlowname"; this.frontlowname.Size = new System.Drawing.Size(73, 13); this.frontlowname.TabIndex = 5; @@ -723,7 +723,7 @@ namespace CodeImp.DoomBuilder.Controls this.flowLayoutPanelBack.Controls.Add(this.panelBackLow); this.flowLayoutPanelBack.Location = new System.Drawing.Point(6, 14); this.flowLayoutPanelBack.Name = "flowLayoutPanelBack"; - this.flowLayoutPanelBack.Size = new System.Drawing.Size(484, 80); + this.flowLayoutPanelBack.Size = new System.Drawing.Size(484, 82); this.flowLayoutPanelBack.TabIndex = 4; this.flowLayoutPanelBack.WrapContents = false; // @@ -738,7 +738,7 @@ namespace CodeImp.DoomBuilder.Controls this.panelBackTop.Location = new System.Drawing.Point(0, 0); this.panelBackTop.Margin = new System.Windows.Forms.Padding(0); this.panelBackTop.Name = "panelBackTop"; - this.panelBackTop.Size = new System.Drawing.Size(160, 78); + this.panelBackTop.Size = new System.Drawing.Size(160, 82); this.panelBackTop.TabIndex = 5; // // backTopUDMFOffsetLabel @@ -805,7 +805,7 @@ namespace CodeImp.DoomBuilder.Controls // this.backhighname.AutoSize = true; this.backhighname.BackColor = System.Drawing.SystemColors.Control; - this.backhighname.Location = new System.Drawing.Point(3, 64); + this.backhighname.Location = new System.Drawing.Point(3, 67); this.backhighname.Name = "backhighname"; this.backhighname.Size = new System.Drawing.Size(73, 13); this.backhighname.TabIndex = 1; @@ -823,7 +823,7 @@ namespace CodeImp.DoomBuilder.Controls this.panelBackMid.Location = new System.Drawing.Point(160, 0); this.panelBackMid.Margin = new System.Windows.Forms.Padding(0); this.panelBackMid.Name = "panelBackMid"; - this.panelBackMid.Size = new System.Drawing.Size(160, 78); + this.panelBackMid.Size = new System.Drawing.Size(160, 82); this.panelBackMid.TabIndex = 7; // // backMidUDMFOffsetLabel @@ -890,7 +890,7 @@ namespace CodeImp.DoomBuilder.Controls // this.backmidname.AutoSize = true; this.backmidname.BackColor = System.Drawing.SystemColors.Control; - this.backmidname.Location = new System.Drawing.Point(3, 64); + this.backmidname.Location = new System.Drawing.Point(3, 67); this.backmidname.Name = "backmidname"; this.backmidname.Size = new System.Drawing.Size(73, 13); this.backmidname.TabIndex = 3; @@ -908,7 +908,7 @@ namespace CodeImp.DoomBuilder.Controls this.panelBackLow.Location = new System.Drawing.Point(320, 0); this.panelBackLow.Margin = new System.Windows.Forms.Padding(0); this.panelBackLow.Name = "panelBackLow"; - this.panelBackLow.Size = new System.Drawing.Size(160, 78); + this.panelBackLow.Size = new System.Drawing.Size(160, 82); this.panelBackLow.TabIndex = 12; // // backBottomUDMFOffsetLabel @@ -975,7 +975,7 @@ namespace CodeImp.DoomBuilder.Controls // this.backlowname.AutoSize = true; this.backlowname.BackColor = System.Drawing.SystemColors.Control; - this.backlowname.Location = new System.Drawing.Point(3, 64); + this.backlowname.Location = new System.Drawing.Point(3, 67); this.backlowname.Name = "backlowname"; this.backlowname.Size = new System.Drawing.Size(73, 13); this.backlowname.TabIndex = 5; diff --git a/Source/Core/Geometry/Triangulation.cs b/Source/Core/Geometry/Triangulation.cs index a9a3614d..9f47a460 100644 --- a/Source/Core/Geometry/Triangulation.cs +++ b/Source/Core/Geometry/Triangulation.cs @@ -146,7 +146,7 @@ namespace CodeImp.DoomBuilder.Geometry #region ================== Serialization // Serialize / deserialize - internal void ReadWrite(IReadWriteStream s) + /*internal void ReadWrite(IReadWriteStream s) { if(s.IsWriting) { @@ -183,7 +183,7 @@ namespace CodeImp.DoomBuilder.Geometry sidedefindices = new int[c]; for(int i = 0; i < c; i++) s.rInt(out sidedefindices[i]); } - } + }*/ // After deserialization we need to find the actual sidedefs back internal void PostDeserialize(MapSet map) diff --git a/Source/Core/Windows/TextureBrowserForm.Designer.cs b/Source/Core/Windows/TextureBrowserForm.Designer.cs index 0563ca30..ee28541f 100644 --- a/Source/Core/Windows/TextureBrowserForm.Designer.cs +++ b/Source/Core/Windows/TextureBrowserForm.Designer.cs @@ -33,8 +33,12 @@ namespace CodeImp.DoomBuilder.Windows this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.smallimages = new System.Windows.Forms.ImageList(this.components); - this.tvTextureSets = new System.Windows.Forms.TreeView(); + this.tvTextureSets = new CodeImp.DoomBuilder.GZBuilder.Controls.MultiSelectTreeview(); this.browser = new CodeImp.DoomBuilder.Controls.ImageBrowserControl(); + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); this.SuspendLayout(); // // cancel @@ -77,16 +81,20 @@ namespace CodeImp.DoomBuilder.Windows // // tvTextureSets // - this.tvTextureSets.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.tvTextureSets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tvTextureSets.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.tvTextureSets.HideSelection = false; this.tvTextureSets.ImageIndex = 0; this.tvTextureSets.ImageList = this.smallimages; - this.tvTextureSets.Location = new System.Drawing.Point(572, 12); + this.tvTextureSets.Location = new System.Drawing.Point(0, 0); + this.tvTextureSets.Margin = new System.Windows.Forms.Padding(0); this.tvTextureSets.Name = "tvTextureSets"; this.tvTextureSets.SelectedImageIndex = 0; - this.tvTextureSets.Size = new System.Drawing.Size(200, 390); + this.tvTextureSets.SelectionBackColor = System.Drawing.SystemColors.Highlight; + this.tvTextureSets.SelectionMode = CodeImp.DoomBuilder.GZBuilder.Controls.TreeViewSelectionMode.SingleSelect; + this.tvTextureSets.Size = new System.Drawing.Size(199, 390); this.tvTextureSets.TabIndex = 4; this.tvTextureSets.TabStop = false; this.tvTextureSets.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tvTextureSets_KeyUp); @@ -94,20 +102,38 @@ namespace CodeImp.DoomBuilder.Windows // // browser // - this.browser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.browser.BrowseFlats = false; + this.browser.Dock = System.Windows.Forms.DockStyle.Fill; this.browser.HideInputBox = false; - this.browser.Location = new System.Drawing.Point(12, 12); + this.browser.Location = new System.Drawing.Point(0, 0); this.browser.Name = "browser"; this.browser.PreventSelection = false; - this.browser.Size = new System.Drawing.Size(554, 424); + this.browser.Size = new System.Drawing.Size(557, 424); this.browser.TabIndex = 1; this.browser.TabStop = false; this.browser.SelectedItemDoubleClicked += new CodeImp.DoomBuilder.Controls.ImageBrowserControl.SelectedItemDoubleClickDelegate(this.browser_SelectedItemDoubleClicked); this.browser.SelectedItemChanged += new CodeImp.DoomBuilder.Controls.ImageBrowserControl.SelectedItemChangedDelegate(this.browser_SelectedItemChanged); // + // splitContainer + // + this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer.Location = new System.Drawing.Point(12, 12); + this.splitContainer.Name = "splitContainer"; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.Controls.Add(this.browser); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.Controls.Add(this.tvTextureSets); + this.splitContainer.Size = new System.Drawing.Size(760, 424); + this.splitContainer.SplitterDistance = 557; + this.splitContainer.TabIndex = 5; + // // TextureBrowserForm // this.AcceptButton = this.apply; @@ -115,10 +141,9 @@ namespace CodeImp.DoomBuilder.Windows this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.CancelButton = this.cancel; this.ClientSize = new System.Drawing.Size(784, 442); - this.Controls.Add(this.tvTextureSets); this.Controls.Add(this.cancel); this.Controls.Add(this.apply); - this.Controls.Add(this.browser); + this.Controls.Add(this.splitContainer); this.MinimizeBox = false; this.Name = "TextureBrowserForm"; this.Opacity = 1; @@ -133,6 +158,9 @@ namespace CodeImp.DoomBuilder.Windows this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TextureBrowserForm_FormClosing); this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.TextureBrowserForm_HelpRequested); this.ResizeEnd += new System.EventHandler(this.TextureBrowserForm_ResizeEnd); + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + this.splitContainer.ResumeLayout(false); this.ResumeLayout(false); } @@ -143,6 +171,7 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Button cancel; private System.Windows.Forms.Button apply; private System.Windows.Forms.ImageList smallimages; - private System.Windows.Forms.TreeView tvTextureSets; + private CodeImp.DoomBuilder.GZBuilder.Controls.MultiSelectTreeview tvTextureSets; + private System.Windows.Forms.SplitContainer splitContainer; } } \ No newline at end of file diff --git a/Source/Core/Windows/TextureBrowserForm.cs b/Source/Core/Windows/TextureBrowserForm.cs index adb419c6..9225c5ff 100644 --- a/Source/Core/Windows/TextureBrowserForm.cs +++ b/Source/Core/Windows/TextureBrowserForm.cs @@ -169,7 +169,9 @@ namespace CodeImp.DoomBuilder.Windows if (tvTextureSets.Nodes.Count > 0) { if (selectedset == null) selectedset = tvTextureSets.Nodes[tvTextureSets.Nodes.Count - 1]; - tvTextureSets.SelectedNode = selectedset; + tvTextureSets.SelectedNodes.Clear(); + tvTextureSets.SelectedNodes.Add(selectedset); + selectedset.EnsureVisible(); } tvTextureSets.EndUpdate();//mxd @@ -184,6 +186,12 @@ namespace CodeImp.DoomBuilder.Windows this.Size = new Size(General.Settings.ReadSetting("browserwindow.sizewidth", this.Size.Width), General.Settings.ReadSetting("browserwindow.sizeheight", this.Size.Height)); this.WindowState = (FormWindowState)General.Settings.ReadSetting("browserwindow.windowstate", (int)FormWindowState.Normal); + + //mxd. Set SplitterDistance + int splitterdistance = splitContainer.Width - General.Settings.ReadSetting("browserwindow.splitterdistance", 203); + if(splitterdistance < splitContainer.Panel1MinSize || splitterdistance > splitContainer.Width - splitContainer.Panel2MinSize) + splitterdistance = splitContainer.Width - splitContainer.Width / 4; + splitContainer.SplitterDistance = splitterdistance; //mxd if (this.WindowState == FormWindowState.Normal) @@ -444,10 +452,11 @@ namespace CodeImp.DoomBuilder.Windows General.Settings.WriteSetting("browserwindow.sizewidth", lastsize.Width); General.Settings.WriteSetting("browserwindow.sizeheight", lastsize.Height); General.Settings.WriteSetting("browserwindow.windowstate", windowstate); + General.Settings.WriteSetting("browserwindow.splitterdistance", splitContainer.Width - splitContainer.SplitterDistance); //mxd - //mxd. Save last selected texture set - if(this.DialogResult == DialogResult.OK && tvTextureSets.SelectedNode != null) - General.Settings.WriteSetting("browserwindow.textureset", tvTextureSets.SelectedNode.Name); + //mxd. Save last selected texture set, if it's not "All" (it will be selected anyway if search for initial texture set fails) + if(this.DialogResult == DialogResult.OK && tvTextureSets.SelectedNodes.Count > 0 && !(tvTextureSets.SelectedNodes[0].Tag is AllTextureSet)) + General.Settings.WriteSetting("browserwindow.textureset", tvTextureSets.SelectedNodes[0].Name); //mxd. Save ImageBrowserControl settings General.Settings.WriteSetting("browserwindow.showtexturesizes", ImageBrowserControl.ShowTextureSizes); @@ -541,9 +550,9 @@ namespace CodeImp.DoomBuilder.Windows //mxd private void tvTextureSets_KeyUp(object sender, KeyEventArgs e) { - if(tvTextureSets.SelectedNode != selectedset) + if(tvTextureSets.SelectedNodes.Count > 0 && tvTextureSets.SelectedNodes[0] != selectedset) { - selectedset = tvTextureSets.SelectedNode; + selectedset = tvTextureSets.SelectedNodes[0]; FillImagesList(); } }