mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Texture browser form: Tab key behavior was broken when the window was opened in maximized state.
Texture browser form: last window location is now restored when the window is opened.
This commit is contained in:
parent
0654cec075
commit
aa4fbd8b43
3 changed files with 88 additions and 100 deletions
112
Source/Core/Controls/ImageBrowserControl.Designer.cs
generated
112
Source/Core/Controls/ImageBrowserControl.Designer.cs
generated
|
@ -33,17 +33,17 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.labelMixMode = new System.Windows.Forms.Label();
|
||||
this.label = new System.Windows.Forms.Label();
|
||||
this.splitter = new System.Windows.Forms.SplitContainer();
|
||||
this.list = new CodeImp.DoomBuilder.Controls.OptimizedListView();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.filterHeight = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.filterWidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.cbMixMode = new System.Windows.Forms.ComboBox();
|
||||
this.texturesize = new System.Windows.Forms.Label();
|
||||
this.texturesizelabel = new System.Windows.Forms.Label();
|
||||
this.objectname = new System.Windows.Forms.TextBox();
|
||||
this.refreshtimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.texturesizetimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.list = new CodeImp.DoomBuilder.Controls.OptimizedListView();
|
||||
this.filterHeight = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.filterWidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.splitter.Panel1.SuspendLayout();
|
||||
this.splitter.Panel2.SuspendLayout();
|
||||
this.splitter.SuspendLayout();
|
||||
|
@ -55,7 +55,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.labelMixMode.Location = new System.Drawing.Point(3, 9);
|
||||
this.labelMixMode.Name = "labelMixMode";
|
||||
this.labelMixMode.Size = new System.Drawing.Size(39, 14);
|
||||
this.labelMixMode.TabIndex = 3;
|
||||
this.labelMixMode.TabIndex = 0;
|
||||
this.labelMixMode.Text = "Show:";
|
||||
//
|
||||
// label
|
||||
|
@ -97,24 +97,73 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.splitter.TabIndex = 0;
|
||||
this.splitter.TabStop = false;
|
||||
//
|
||||
// list
|
||||
//
|
||||
this.list.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.list.HideSelection = false;
|
||||
this.list.Location = new System.Drawing.Point(0, 0);
|
||||
this.list.MultiSelect = false;
|
||||
this.list.Name = "list";
|
||||
this.list.OwnerDraw = true;
|
||||
this.list.Size = new System.Drawing.Size(639, 312);
|
||||
this.list.TabIndex = 1;
|
||||
this.list.TabStop = false;
|
||||
this.list.TileSize = new System.Drawing.Size(90, 90);
|
||||
this.list.UseCompatibleStateImageBehavior = false;
|
||||
this.list.View = System.Windows.Forms.View.Tile;
|
||||
this.list.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.list_DrawItem);
|
||||
this.list.DoubleClick += new System.EventHandler(this.list_DoubleClick);
|
||||
this.list.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.list_ItemSelectionChanged);
|
||||
this.list.KeyDown += new System.Windows.Forms.KeyEventHandler(this.list_KeyDown);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(336, 9);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(40, 14);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Height:";
|
||||
//
|
||||
// filterHeight
|
||||
//
|
||||
this.filterHeight.AllowDecimal = false;
|
||||
this.filterHeight.AllowNegative = false;
|
||||
this.filterHeight.AllowRelative = false;
|
||||
this.filterHeight.ButtonStep = 1;
|
||||
this.filterHeight.ButtonStepFloat = 1F;
|
||||
this.filterHeight.Location = new System.Drawing.Point(380, 4);
|
||||
this.filterHeight.Name = "filterHeight";
|
||||
this.filterHeight.Size = new System.Drawing.Size(54, 24);
|
||||
this.filterHeight.StepValues = null;
|
||||
this.filterHeight.TabIndex = 0;
|
||||
this.filterHeight.TabStop = false;
|
||||
this.filterHeight.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(237, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(37, 14);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Width:";
|
||||
//
|
||||
// filterWidth
|
||||
//
|
||||
this.filterWidth.AllowDecimal = false;
|
||||
this.filterWidth.AllowNegative = false;
|
||||
this.filterWidth.AllowRelative = false;
|
||||
this.filterWidth.ButtonStep = 1;
|
||||
this.filterWidth.ButtonStepFloat = 1F;
|
||||
this.filterWidth.Location = new System.Drawing.Point(278, 4);
|
||||
this.filterWidth.Name = "filterWidth";
|
||||
this.filterWidth.Size = new System.Drawing.Size(54, 24);
|
||||
this.filterWidth.StepValues = null;
|
||||
this.filterWidth.TabIndex = 0;
|
||||
this.filterWidth.TabStop = false;
|
||||
this.filterWidth.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
|
||||
//
|
||||
// cbMixMode
|
||||
//
|
||||
this.cbMixMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
|
@ -136,7 +185,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.texturesize.Location = new System.Drawing.Point(479, 9);
|
||||
this.texturesize.Name = "texturesize";
|
||||
this.texturesize.Size = new System.Drawing.Size(100, 14);
|
||||
this.texturesize.TabIndex = 2;
|
||||
this.texturesize.TabIndex = 0;
|
||||
this.texturesize.Text = "1024 x 1024";
|
||||
this.texturesize.Visible = false;
|
||||
//
|
||||
|
@ -146,7 +195,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.texturesizelabel.Location = new System.Drawing.Point(442, 9);
|
||||
this.texturesizelabel.Name = "texturesizelabel";
|
||||
this.texturesizelabel.Size = new System.Drawing.Size(31, 14);
|
||||
this.texturesizelabel.TabIndex = 1;
|
||||
this.texturesizelabel.TabIndex = 0;
|
||||
this.texturesizelabel.Text = "Size:";
|
||||
this.texturesizelabel.Visible = false;
|
||||
//
|
||||
|
@ -172,53 +221,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.texturesizetimer.Interval = 3;
|
||||
this.texturesizetimer.Tick += new System.EventHandler(this.texturesizetimer_Tick);
|
||||
//
|
||||
// list
|
||||
//
|
||||
this.list.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.list.HideSelection = false;
|
||||
this.list.Location = new System.Drawing.Point(0, 0);
|
||||
this.list.MultiSelect = false;
|
||||
this.list.Name = "list";
|
||||
this.list.OwnerDraw = true;
|
||||
this.list.Size = new System.Drawing.Size(639, 312);
|
||||
this.list.TabIndex = 1;
|
||||
this.list.TabStop = false;
|
||||
this.list.TileSize = new System.Drawing.Size(90, 90);
|
||||
this.list.UseCompatibleStateImageBehavior = false;
|
||||
this.list.View = System.Windows.Forms.View.Tile;
|
||||
this.list.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.list_DrawItem);
|
||||
this.list.DoubleClick += new System.EventHandler(this.list_DoubleClick);
|
||||
this.list.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.list_ItemSelectionChanged);
|
||||
this.list.KeyDown += new System.Windows.Forms.KeyEventHandler(this.list_KeyDown);
|
||||
//
|
||||
// filterHeight
|
||||
//
|
||||
this.filterHeight.AllowDecimal = false;
|
||||
this.filterHeight.AllowNegative = false;
|
||||
this.filterHeight.AllowRelative = false;
|
||||
this.filterHeight.ButtonStep = 1;
|
||||
this.filterHeight.ButtonStepFloat = 1F;
|
||||
this.filterHeight.Location = new System.Drawing.Point(380, 4);
|
||||
this.filterHeight.Name = "filterHeight";
|
||||
this.filterHeight.Size = new System.Drawing.Size(54, 24);
|
||||
this.filterHeight.StepValues = null;
|
||||
this.filterHeight.TabIndex = 0;
|
||||
this.filterHeight.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
|
||||
//
|
||||
// filterWidth
|
||||
//
|
||||
this.filterWidth.AllowDecimal = false;
|
||||
this.filterWidth.AllowNegative = false;
|
||||
this.filterWidth.AllowRelative = false;
|
||||
this.filterWidth.ButtonStep = 1;
|
||||
this.filterWidth.ButtonStepFloat = 1F;
|
||||
this.filterWidth.Location = new System.Drawing.Point(278, 4);
|
||||
this.filterWidth.Name = "filterWidth";
|
||||
this.filterWidth.Size = new System.Drawing.Size(54, 24);
|
||||
this.filterWidth.StepValues = null;
|
||||
this.filterWidth.TabIndex = 0;
|
||||
this.filterWidth.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
|
||||
//
|
||||
// ImageBrowserControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
|
|
|
@ -543,11 +543,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
objectname.Focus();
|
||||
}
|
||||
|
||||
//mxd. This sends the focus to the list
|
||||
public void FocusList() {
|
||||
list.Focus();
|
||||
}
|
||||
|
||||
// This updates the texture size label
|
||||
private void UpdateTextureSizeLabel()
|
||||
|
|
|
@ -148,7 +148,18 @@ 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);
|
||||
if(this.WindowState == FormWindowState.Normal) this.StartPosition = FormStartPosition.CenterParent;
|
||||
|
||||
//mxd
|
||||
if (this.WindowState == FormWindowState.Normal) {
|
||||
Point location = new Point(General.Settings.ReadSetting("browserwindow.positionx", int.MaxValue), General.Settings.ReadSetting("browserwindow.positiony", int.MaxValue));
|
||||
|
||||
if (location.X < int.MaxValue && location.Y < int.MaxValue) {
|
||||
this.Location = location;
|
||||
} else {
|
||||
this.StartPosition = FormStartPosition.CenterParent;
|
||||
}
|
||||
}
|
||||
|
||||
this.ResumeLayout(true);
|
||||
}
|
||||
|
||||
|
@ -160,23 +171,18 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd
|
||||
private TreeNode findTextureByLongName(TreeNode node, long longname) {
|
||||
//first search in child nodes
|
||||
if (node.Nodes != null) {
|
||||
TreeNode match = null;
|
||||
TreeNode match = null;
|
||||
|
||||
foreach (TreeNode n in node.Nodes) {
|
||||
match = findTextureByLongName(n, longname);
|
||||
if (match != null)
|
||||
return match;
|
||||
}
|
||||
foreach(TreeNode n in node.Nodes) {
|
||||
match = findTextureByLongName(n, longname);
|
||||
if(match != null) return match;
|
||||
}
|
||||
|
||||
//then - in current node
|
||||
IFilledTextureSet set = (node.Tag as IFilledTextureSet);
|
||||
|
||||
foreach (ImageData img in set.Textures) {
|
||||
if (img.LongName == longname)
|
||||
return node;
|
||||
}
|
||||
foreach (ImageData img in set.Textures)
|
||||
if (img.LongName == longname) return node;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -184,14 +190,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd
|
||||
private TreeNode findNodeByName(TreeNodeCollection nodes, string selectname) {
|
||||
foreach (TreeNode n in nodes) {
|
||||
if (n.Name == selectname)
|
||||
return n;
|
||||
if (n.Name == selectname) return n;
|
||||
|
||||
if (n.Nodes != null) {
|
||||
TreeNode match = findNodeByName(n.Nodes, selectname);
|
||||
if (match != null)
|
||||
return match;
|
||||
}
|
||||
TreeNode match = findNodeByName(n.Nodes, selectname);
|
||||
if(match != null) return match;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -205,7 +207,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
int imageIndex = set.Location.type + 4;
|
||||
string[] separator = new string[]{ Path.DirectorySeparatorChar.ToString() };
|
||||
string[] separator = new[] { Path.DirectorySeparatorChar.ToString() };
|
||||
|
||||
ImageData[] textures = new ImageData[set.Textures.Count];
|
||||
set.Textures.CopyTo(textures, 0);
|
||||
|
@ -226,10 +228,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
curNode = curNode.Nodes[category];
|
||||
|
||||
} else { //create a new one
|
||||
TreeNode n = new TreeNode(category);
|
||||
n.Name = category;
|
||||
n.ImageIndex = imageIndex;
|
||||
n.SelectedImageIndex = imageIndex;
|
||||
TreeNode n = new TreeNode(category) {Name = category, ImageIndex = imageIndex, SelectedImageIndex = imageIndex};
|
||||
|
||||
curNode.Nodes.Add(n);
|
||||
curNode = n;
|
||||
|
@ -257,10 +256,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
root.Nodes.AddRange(children);
|
||||
}
|
||||
|
||||
if (root.Nodes != null) {
|
||||
foreach (TreeNode n in root.Nodes)
|
||||
SetItemsCount(n);
|
||||
}
|
||||
foreach (TreeNode n in root.Nodes) SetItemsCount(n);
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -272,7 +268,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if (General.Map.Config.MixTexturesFlats)
|
||||
ts.MixTexturesAndFlats();
|
||||
|
||||
if(node.Nodes == null) return;
|
||||
foreach (TreeNode child in node.Nodes) SetItemsCount(child);
|
||||
}
|
||||
|
||||
|
@ -311,8 +306,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Activated
|
||||
private void TextureBrowserForm_Activated(object sender, EventArgs e)
|
||||
{
|
||||
// Focus the textbox
|
||||
browser.FocusTextbox();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
|
@ -384,15 +377,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
TextureBrowserForm browser = new TextureBrowserForm(select, browseFlats);
|
||||
if(browser.ShowDialog(parent) == DialogResult.OK)
|
||||
{
|
||||
// Return result
|
||||
return browser.SelectedName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cancelled
|
||||
return select;
|
||||
}
|
||||
return browser.SelectedName; // Return result
|
||||
|
||||
// Cancelled
|
||||
return select;
|
||||
}
|
||||
|
||||
// Item double clicked
|
||||
|
@ -450,6 +438,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
browser.SelectItem(selecttextureonfill, usedgroup);
|
||||
selecttextureonfill = null;
|
||||
}
|
||||
|
||||
//mxd. Focus the textbox. Calling this from TextureBrowserForm_Activated (like it's done in DB2) fails when the form is maximized. Again, I've no idea why...
|
||||
browser.FocusTextbox();
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
|
Loading…
Reference in a new issue