mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Added Tab key in images browser to jump between the same image in "Used textures" and "Available textures" areas.
This commit is contained in:
parent
4976459396
commit
88449b7c01
6 changed files with 79 additions and 8 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
<div id="contents">
|
||||
<p>
|
||||
Use this browser to look for textures or flats. On the left you have the list with your Texture Sets. The list also contains a set named "All" which, obviously, contains all textures or flats. A Texture Set for each loaded resource has also been added. This is useful if you know in which resource the image resides. Once you have chosen your Texture Set, you can use the text field at the bottom to enter the texture name. You only have to enter the name partly and the list of images will adjust to show only the images that match with the entered name. Select an image to view its dimensions at the bottom. Doubleclick the image or click <b>OK</b> to make your selection or <b>Cancel</b> to close the list.<br />
|
||||
Use this browser to look for textures or flats. On the left you have the list with your Texture Sets. The list also contains a set named "All" which, obviously, contains all textures or flats. A Texture Set for each loaded resource has also been added. This is useful if you know in which resource the image resides. Once you have chosen your Texture Set, you can use the text field at the bottom to enter the texture name. You only have to enter the name partly and the list of images will adjust to show only the images that match with the entered name. Select an image to view its dimensions at the bottom. When the focus is on the images list, you can press the <b>Tab</b> key to jump between the same image in the "Used textures" and "Available textures" areas. Doubleclick the image or click <b>OK</b> to make your selection or <b>Cancel</b> to close the list.<br />
|
||||
<br />
|
||||
To make your own Texture Sets, see the Textures tab on the <a href="w_gameconfigurations.html">Game Configurations Window</a>.
|
||||
</p>
|
||||
|
|
|
@ -77,14 +77,15 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.list.OwnerDraw = true;
|
||||
this.list.ShowItemToolTips = true;
|
||||
this.list.Size = new System.Drawing.Size(518, 312);
|
||||
this.list.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
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);
|
||||
//
|
||||
// texturesize
|
||||
//
|
||||
|
@ -112,6 +113,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.objectname.Name = "objectname";
|
||||
this.objectname.Size = new System.Drawing.Size(122, 20);
|
||||
this.objectname.TabIndex = 0;
|
||||
this.objectname.TabStop = false;
|
||||
this.objectname.TextChanged += new System.EventHandler(this.objectname_TextChanged);
|
||||
this.objectname.KeyDown += new System.Windows.Forms.KeyEventHandler(this.objectname_KeyDown);
|
||||
//
|
||||
|
|
|
@ -63,6 +63,9 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// All items
|
||||
private List<ImageBrowserItem> items;
|
||||
|
||||
// Items visible in the list
|
||||
private List<ImageBrowserItem> visibleitems;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -163,7 +166,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
}
|
||||
|
||||
// Key pressed
|
||||
// Key pressed in textbox
|
||||
private void objectname_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Check what key is pressed
|
||||
|
@ -174,6 +177,19 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
case Keys.Right: SelectNextItem(SearchDirectionHint.Right); e.SuppressKeyPress = true; break;
|
||||
case Keys.Up: SelectNextItem(SearchDirectionHint.Up); e.SuppressKeyPress = true; break;
|
||||
case Keys.Down: SelectNextItem(SearchDirectionHint.Down); e.SuppressKeyPress = true; break;
|
||||
|
||||
// Tab
|
||||
case Keys.Tab: GoToNextSameTexture(); e.SuppressKeyPress = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
// Key pressed in list
|
||||
private void list_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyData == Keys.Tab)
|
||||
{
|
||||
GoToNextSameTexture();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,6 +235,41 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This selects the next texture with the same name as the selected texture
|
||||
public void GoToNextSameTexture()
|
||||
{
|
||||
if(list.SelectedItems.Count > 0)
|
||||
{
|
||||
ListViewItem selected = list.SelectedItems[0];
|
||||
bool foundselected = false;
|
||||
foreach(ListViewItem n in visibleitems)
|
||||
{
|
||||
if((n.Text == selected.Text) && foundselected)
|
||||
{
|
||||
// This is the next item
|
||||
n.Selected = true;
|
||||
n.EnsureVisible();
|
||||
return;
|
||||
}
|
||||
|
||||
if(n == selected)
|
||||
foundselected = true;
|
||||
}
|
||||
|
||||
// Start from the top
|
||||
foreach(ListViewItem n in visibleitems)
|
||||
{
|
||||
if((n.Text == selected.Text) && foundselected)
|
||||
{
|
||||
// This is the next item
|
||||
n.Selected = true;
|
||||
n.EnsureVisible();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This selects an item by name
|
||||
public void SelectItem(string name, ListViewGroup preferredgroup)
|
||||
{
|
||||
|
@ -382,7 +433,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// This fills the list based on the objectname filter
|
||||
private void RefillList(bool selectfirst)
|
||||
{
|
||||
List<ListViewItem> showitems = new List<ListViewItem>();
|
||||
visibleitems = new List<ImageBrowserItem>();
|
||||
|
||||
// Begin updating list
|
||||
updating = true;
|
||||
|
@ -401,12 +452,15 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
i.Group = i.ListGroup;
|
||||
i.Selected = false;
|
||||
showitems.Add(i);
|
||||
visibleitems.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill list
|
||||
list.Items.AddRange(showitems.ToArray());
|
||||
visibleitems.Sort();
|
||||
ListViewItem[] array = new ListViewItem[visibleitems.Count];
|
||||
for(int i = 0; i < visibleitems.Count; i++) array[i] = visibleitems[i];
|
||||
list.Items.AddRange(array);
|
||||
|
||||
// Done updating list
|
||||
updating = false;
|
||||
|
|
|
@ -37,7 +37,7 @@ using SlimDX;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
internal class ImageBrowserItem : ListViewItem
|
||||
internal class ImageBrowserItem : ListViewItem, IComparable<ImageBrowserItem>
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
@ -143,7 +143,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
if(v < 0f) return 0f; else if(v > 1f) return 1f; else return v;
|
||||
}
|
||||
|
||||
|
||||
// Comparer
|
||||
public int CompareTo(ImageBrowserItem other)
|
||||
{
|
||||
return this.Text.CompareTo(other.Text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
4
Source/Core/Windows/FlatBrowserForm.Designer.cs
generated
4
Source/Core/Windows/FlatBrowserForm.Designer.cs
generated
|
@ -47,6 +47,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(100, 25);
|
||||
this.cancel.TabIndex = 3;
|
||||
this.cancel.TabStop = false;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
this.cancel.Click += new System.EventHandler(this.cancel_Click);
|
||||
|
@ -58,6 +59,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(100, 25);
|
||||
this.apply.TabIndex = 2;
|
||||
this.apply.TabStop = false;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
this.apply.Click += new System.EventHandler(this.apply_Click);
|
||||
|
@ -79,6 +81,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.texturesets.Size = new System.Drawing.Size(200, 576);
|
||||
this.texturesets.SmallImageList = this.smallimages;
|
||||
this.texturesets.TabIndex = 0;
|
||||
this.texturesets.TabStop = false;
|
||||
this.texturesets.UseCompatibleStateImageBehavior = false;
|
||||
this.texturesets.View = System.Windows.Forms.View.Details;
|
||||
this.texturesets.SelectedIndexChanged += new System.EventHandler(this.texturesets_SelectedIndexChanged);
|
||||
|
@ -117,6 +120,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.browser.PreventSelection = false;
|
||||
this.browser.Size = new System.Drawing.Size(663, 610);
|
||||
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);
|
||||
//
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(100, 25);
|
||||
this.cancel.TabIndex = 3;
|
||||
this.cancel.TabStop = false;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
this.cancel.Click += new System.EventHandler(this.cancel_Click);
|
||||
|
@ -58,6 +59,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(100, 25);
|
||||
this.apply.TabIndex = 2;
|
||||
this.apply.TabStop = false;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
this.apply.Click += new System.EventHandler(this.apply_Click);
|
||||
|
@ -79,6 +81,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.texturesets.Size = new System.Drawing.Size(200, 576);
|
||||
this.texturesets.SmallImageList = this.smallimages;
|
||||
this.texturesets.TabIndex = 0;
|
||||
this.texturesets.TabStop = false;
|
||||
this.texturesets.UseCompatibleStateImageBehavior = false;
|
||||
this.texturesets.View = System.Windows.Forms.View.Details;
|
||||
this.texturesets.SelectedIndexChanged += new System.EventHandler(this.texturesets_SelectedIndexChanged);
|
||||
|
@ -117,6 +120,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.browser.PreventSelection = false;
|
||||
this.browser.Size = new System.Drawing.Size(663, 610);
|
||||
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);
|
||||
//
|
||||
|
@ -132,6 +136,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(this.browser);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.KeyPreview = true;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "TextureBrowserForm";
|
||||
this.ShowIcon = false;
|
||||
|
|
Loading…
Reference in a new issue