OSDN Git Service

More work on inventory search RAD-7
authorLatif Khalifa <latifer@streamgrid.net>
Mon, 13 Sep 2010 04:33:55 +0000 (04:33 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Mon, 13 Sep 2010 04:33:55 +0000 (04:33 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@739 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Consoles/Inventory/InventoryConsole.Designer.cs
Radegast/GUI/Consoles/Inventory/InventoryConsole.cs

index 72c9b54..d10d3c4 100644 (file)
@@ -95,6 +95,17 @@ namespace Radegast
             this.tbtbFoldersByName = new System.Windows.Forms.ToolStripMenuItem();
             this.tbtnSystemFoldersFirst = new System.Windows.Forms.ToolStripMenuItem();
             this.tabsInventory = new System.Windows.Forms.TabControl();
+            this.tabSearch = new System.Windows.Forms.TabPage();
+            this.lstInventorySearch = new Radegast.ListViewNoFlicker();
+            this.chResItemName = new System.Windows.Forms.ColumnHeader();
+            this.pnlSearchOptions = new System.Windows.Forms.Panel();
+            this.lblSearchStatus = new System.Windows.Forms.Label();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.cbSrchCreator = new System.Windows.Forms.CheckBox();
+            this.cbSrchDesc = new System.Windows.Forms.CheckBox();
+            this.cbSrchName = new System.Windows.Forms.CheckBox();
+            this.txtSearch = new System.Windows.Forms.TextBox();
+            this.btnInvSearch = new System.Windows.Forms.Button();
             this.tabDetail = new System.Windows.Forms.TabPage();
             this.pnlDetail = new System.Windows.Forms.Panel();
             this.pnlItemProperties = new System.Windows.Forms.Panel();
@@ -107,28 +118,16 @@ namespace Radegast
             this.lblAsset = new System.Windows.Forms.Label();
             this.lblCreator = new System.Windows.Forms.Label();
             this.lblItemName = new System.Windows.Forms.Label();
-            this.tabSearch = new System.Windows.Forms.TabPage();
-            this.lstInventorySearch = new Radegast.ListViewNoFlicker();
-            this.chResIcon = new System.Windows.Forms.ColumnHeader();
-            this.chResItemName = new System.Windows.Forms.ColumnHeader();
-            this.chResItemDesc = new System.Windows.Forms.ColumnHeader();
-            this.pnlSearchOptions = new System.Windows.Forms.Panel();
-            this.groupBox1 = new System.Windows.Forms.GroupBox();
-            this.cbSrchCreator = new System.Windows.Forms.CheckBox();
-            this.cbSrchDesc = new System.Windows.Forms.CheckBox();
-            this.cbSrchName = new System.Windows.Forms.CheckBox();
-            this.txtSearch = new System.Windows.Forms.TextBox();
-            this.btnInvSearch = new System.Windows.Forms.Button();
             this.splitContainer1.Panel1.SuspendLayout();
             this.splitContainer1.Panel2.SuspendLayout();
             this.splitContainer1.SuspendLayout();
             this.tstripInventory.SuspendLayout();
             this.tabsInventory.SuspendLayout();
-            this.tabDetail.SuspendLayout();
-            this.pnlItemProperties.SuspendLayout();
             this.tabSearch.SuspendLayout();
             this.pnlSearchOptions.SuspendLayout();
             this.groupBox1.SuspendLayout();
+            this.tabDetail.SuspendLayout();
+            this.pnlItemProperties.SuspendLayout();
             this.SuspendLayout();
             // 
             // invTree
@@ -284,8 +283,8 @@ namespace Radegast
             // 
             // tabsInventory
             // 
-            this.tabsInventory.Controls.Add(this.tabDetail);
             this.tabsInventory.Controls.Add(this.tabSearch);
+            this.tabsInventory.Controls.Add(this.tabDetail);
             this.tabsInventory.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tabsInventory.Location = new System.Drawing.Point(0, 0);
             this.tabsInventory.Name = "tabsInventory";
@@ -293,6 +292,137 @@ namespace Radegast
             this.tabsInventory.Size = new System.Drawing.Size(421, 483);
             this.tabsInventory.TabIndex = 3;
             // 
+            // tabSearch
+            // 
+            this.tabSearch.BackColor = System.Drawing.SystemColors.Control;
+            this.tabSearch.Controls.Add(this.lstInventorySearch);
+            this.tabSearch.Controls.Add(this.pnlSearchOptions);
+            this.tabSearch.Location = new System.Drawing.Point(4, 22);
+            this.tabSearch.Name = "tabSearch";
+            this.tabSearch.Padding = new System.Windows.Forms.Padding(3);
+            this.tabSearch.Size = new System.Drawing.Size(413, 457);
+            this.tabSearch.TabIndex = 1;
+            this.tabSearch.Text = "Search";
+            // 
+            // lstInventorySearch
+            // 
+            this.lstInventorySearch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+            this.chResItemName});
+            this.lstInventorySearch.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lstInventorySearch.FullRowSelect = true;
+            this.lstInventorySearch.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+            this.lstInventorySearch.HideSelection = false;
+            this.lstInventorySearch.Location = new System.Drawing.Point(3, 91);
+            this.lstInventorySearch.MultiSelect = false;
+            this.lstInventorySearch.Name = "lstInventorySearch";
+            this.lstInventorySearch.OwnerDraw = true;
+            this.lstInventorySearch.ShowGroups = false;
+            this.lstInventorySearch.Size = new System.Drawing.Size(407, 363);
+            this.lstInventorySearch.Sorting = System.Windows.Forms.SortOrder.Ascending;
+            this.lstInventorySearch.TabIndex = 9;
+            this.lstInventorySearch.UseCompatibleStateImageBehavior = false;
+            this.lstInventorySearch.View = System.Windows.Forms.View.Details;
+            this.lstInventorySearch.VirtualMode = true;
+            this.lstInventorySearch.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lstInventorySearch_MouseDoubleClick);
+            this.lstInventorySearch.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lstInventorySearch_MouseClick);
+            this.lstInventorySearch.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.lstInventorySearch_DrawItem);
+            this.lstInventorySearch.SizeChanged += new System.EventHandler(this.lstInventorySearch_SizeChanged);
+            this.lstInventorySearch.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.lstInventorySearch_RetrieveVirtualItem);
+            // 
+            // chResItemName
+            // 
+            this.chResItemName.Text = "Item";
+            this.chResItemName.Width = 382;
+            // 
+            // pnlSearchOptions
+            // 
+            this.pnlSearchOptions.Controls.Add(this.lblSearchStatus);
+            this.pnlSearchOptions.Controls.Add(this.groupBox1);
+            this.pnlSearchOptions.Controls.Add(this.txtSearch);
+            this.pnlSearchOptions.Controls.Add(this.btnInvSearch);
+            this.pnlSearchOptions.Dock = System.Windows.Forms.DockStyle.Top;
+            this.pnlSearchOptions.Location = new System.Drawing.Point(3, 3);
+            this.pnlSearchOptions.Name = "pnlSearchOptions";
+            this.pnlSearchOptions.Size = new System.Drawing.Size(407, 88);
+            this.pnlSearchOptions.TabIndex = 10;
+            // 
+            // lblSearchStatus
+            // 
+            this.lblSearchStatus.AutoSize = true;
+            this.lblSearchStatus.Location = new System.Drawing.Point(256, 52);
+            this.lblSearchStatus.Name = "lblSearchStatus";
+            this.lblSearchStatus.Size = new System.Drawing.Size(46, 13);
+            this.lblSearchStatus.TabIndex = 3;
+            this.lblSearchStatus.Text = "0 results";
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.cbSrchCreator);
+            this.groupBox1.Controls.Add(this.cbSrchDesc);
+            this.groupBox1.Controls.Add(this.cbSrchName);
+            this.groupBox1.Location = new System.Drawing.Point(3, 29);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(247, 49);
+            this.groupBox1.TabIndex = 2;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "Search in";
+            // 
+            // cbSrchCreator
+            // 
+            this.cbSrchCreator.AutoSize = true;
+            this.cbSrchCreator.Location = new System.Drawing.Point(151, 19);
+            this.cbSrchCreator.Name = "cbSrchCreator";
+            this.cbSrchCreator.Size = new System.Drawing.Size(60, 17);
+            this.cbSrchCreator.TabIndex = 2;
+            this.cbSrchCreator.Text = "Creator";
+            this.cbSrchCreator.UseVisualStyleBackColor = true;
+            this.cbSrchCreator.Visible = false;
+            this.cbSrchCreator.CheckedChanged += new System.EventHandler(this.cbSrchName_CheckedChanged);
+            // 
+            // cbSrchDesc
+            // 
+            this.cbSrchDesc.AutoSize = true;
+            this.cbSrchDesc.Location = new System.Drawing.Point(66, 19);
+            this.cbSrchDesc.Name = "cbSrchDesc";
+            this.cbSrchDesc.Size = new System.Drawing.Size(79, 17);
+            this.cbSrchDesc.TabIndex = 1;
+            this.cbSrchDesc.Text = "Description";
+            this.cbSrchDesc.UseVisualStyleBackColor = true;
+            this.cbSrchDesc.CheckedChanged += new System.EventHandler(this.cbSrchName_CheckedChanged);
+            // 
+            // cbSrchName
+            // 
+            this.cbSrchName.AutoSize = true;
+            this.cbSrchName.Checked = true;
+            this.cbSrchName.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.cbSrchName.Location = new System.Drawing.Point(6, 19);
+            this.cbSrchName.Name = "cbSrchName";
+            this.cbSrchName.Size = new System.Drawing.Size(54, 17);
+            this.cbSrchName.TabIndex = 0;
+            this.cbSrchName.Text = "Name";
+            this.cbSrchName.UseVisualStyleBackColor = true;
+            this.cbSrchName.CheckedChanged += new System.EventHandler(this.cbSrchName_CheckedChanged);
+            // 
+            // txtSearch
+            // 
+            this.txtSearch.AccessibleName = "Search input";
+            this.txtSearch.Location = new System.Drawing.Point(3, 3);
+            this.txtSearch.Name = "txtSearch";
+            this.txtSearch.Size = new System.Drawing.Size(247, 20);
+            this.txtSearch.TabIndex = 0;
+            this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged);
+            this.txtSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearch_KeyDown);
+            // 
+            // btnInvSearch
+            // 
+            this.btnInvSearch.Location = new System.Drawing.Point(256, 1);
+            this.btnInvSearch.Name = "btnInvSearch";
+            this.btnInvSearch.Size = new System.Drawing.Size(75, 23);
+            this.btnInvSearch.TabIndex = 1;
+            this.btnInvSearch.Text = "Search";
+            this.btnInvSearch.UseVisualStyleBackColor = true;
+            this.btnInvSearch.Click += new System.EventHandler(this.btnInvSearch_Click);
+            // 
             // tabDetail
             // 
             this.tabDetail.BackColor = System.Drawing.SystemColors.Control;
@@ -410,133 +540,6 @@ namespace Radegast
             this.lblItemName.TabIndex = 0;
             this.lblItemName.Text = "Item";
             // 
-            // tabSearch
-            // 
-            this.tabSearch.BackColor = System.Drawing.SystemColors.Control;
-            this.tabSearch.Controls.Add(this.lstInventorySearch);
-            this.tabSearch.Controls.Add(this.pnlSearchOptions);
-            this.tabSearch.Location = new System.Drawing.Point(4, 22);
-            this.tabSearch.Name = "tabSearch";
-            this.tabSearch.Padding = new System.Windows.Forms.Padding(3);
-            this.tabSearch.Size = new System.Drawing.Size(413, 457);
-            this.tabSearch.TabIndex = 1;
-            this.tabSearch.Text = "Search";
-            // 
-            // lstInventorySearch
-            // 
-            this.lstInventorySearch.AllowColumnReorder = true;
-            this.lstInventorySearch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.chResIcon,
-            this.chResItemName,
-            this.chResItemDesc});
-            this.lstInventorySearch.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.lstInventorySearch.FullRowSelect = true;
-            this.lstInventorySearch.GridLines = true;
-            this.lstInventorySearch.HideSelection = false;
-            this.lstInventorySearch.Location = new System.Drawing.Point(3, 91);
-            this.lstInventorySearch.MultiSelect = false;
-            this.lstInventorySearch.Name = "lstInventorySearch";
-            this.lstInventorySearch.ShowGroups = false;
-            this.lstInventorySearch.Size = new System.Drawing.Size(407, 363);
-            this.lstInventorySearch.Sorting = System.Windows.Forms.SortOrder.Ascending;
-            this.lstInventorySearch.TabIndex = 9;
-            this.lstInventorySearch.UseCompatibleStateImageBehavior = false;
-            this.lstInventorySearch.View = System.Windows.Forms.View.Details;
-            this.lstInventorySearch.VirtualMode = true;
-            this.lstInventorySearch.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.lstInventorySearch_RetrieveVirtualItem);
-            // 
-            // chResIcon
-            // 
-            this.chResIcon.Text = "";
-            this.chResIcon.Width = 28;
-            // 
-            // chResItemName
-            // 
-            this.chResItemName.Text = "Item";
-            this.chResItemName.Width = 172;
-            // 
-            // chResItemDesc
-            // 
-            this.chResItemDesc.Text = "Desciption";
-            this.chResItemDesc.Width = 153;
-            // 
-            // pnlSearchOptions
-            // 
-            this.pnlSearchOptions.Controls.Add(this.groupBox1);
-            this.pnlSearchOptions.Controls.Add(this.txtSearch);
-            this.pnlSearchOptions.Controls.Add(this.btnInvSearch);
-            this.pnlSearchOptions.Dock = System.Windows.Forms.DockStyle.Top;
-            this.pnlSearchOptions.Location = new System.Drawing.Point(3, 3);
-            this.pnlSearchOptions.Name = "pnlSearchOptions";
-            this.pnlSearchOptions.Size = new System.Drawing.Size(407, 88);
-            this.pnlSearchOptions.TabIndex = 10;
-            // 
-            // groupBox1
-            // 
-            this.groupBox1.Controls.Add(this.cbSrchCreator);
-            this.groupBox1.Controls.Add(this.cbSrchDesc);
-            this.groupBox1.Controls.Add(this.cbSrchName);
-            this.groupBox1.Location = new System.Drawing.Point(3, 29);
-            this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(247, 49);
-            this.groupBox1.TabIndex = 2;
-            this.groupBox1.TabStop = false;
-            this.groupBox1.Text = "Search in";
-            // 
-            // cbSrchCreator
-            // 
-            this.cbSrchCreator.AutoSize = true;
-            this.cbSrchCreator.Location = new System.Drawing.Point(151, 19);
-            this.cbSrchCreator.Name = "cbSrchCreator";
-            this.cbSrchCreator.Size = new System.Drawing.Size(60, 17);
-            this.cbSrchCreator.TabIndex = 2;
-            this.cbSrchCreator.Text = "Creator";
-            this.cbSrchCreator.UseVisualStyleBackColor = true;
-            this.cbSrchCreator.CheckedChanged += new System.EventHandler(this.cbSrchName_CheckedChanged);
-            // 
-            // cbSrchDesc
-            // 
-            this.cbSrchDesc.AutoSize = true;
-            this.cbSrchDesc.Location = new System.Drawing.Point(66, 19);
-            this.cbSrchDesc.Name = "cbSrchDesc";
-            this.cbSrchDesc.Size = new System.Drawing.Size(79, 17);
-            this.cbSrchDesc.TabIndex = 1;
-            this.cbSrchDesc.Text = "Description";
-            this.cbSrchDesc.UseVisualStyleBackColor = true;
-            this.cbSrchDesc.CheckedChanged += new System.EventHandler(this.cbSrchName_CheckedChanged);
-            // 
-            // cbSrchName
-            // 
-            this.cbSrchName.AutoSize = true;
-            this.cbSrchName.Checked = true;
-            this.cbSrchName.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.cbSrchName.Location = new System.Drawing.Point(6, 19);
-            this.cbSrchName.Name = "cbSrchName";
-            this.cbSrchName.Size = new System.Drawing.Size(54, 17);
-            this.cbSrchName.TabIndex = 0;
-            this.cbSrchName.Text = "Name";
-            this.cbSrchName.UseVisualStyleBackColor = true;
-            this.cbSrchName.CheckedChanged += new System.EventHandler(this.cbSrchName_CheckedChanged);
-            // 
-            // txtSearch
-            // 
-            this.txtSearch.AccessibleName = "Search input";
-            this.txtSearch.Location = new System.Drawing.Point(3, 3);
-            this.txtSearch.Name = "txtSearch";
-            this.txtSearch.Size = new System.Drawing.Size(247, 20);
-            this.txtSearch.TabIndex = 0;
-            this.txtSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearch_KeyDown);
-            // 
-            // btnInvSearch
-            // 
-            this.btnInvSearch.Location = new System.Drawing.Point(256, 1);
-            this.btnInvSearch.Name = "btnInvSearch";
-            this.btnInvSearch.Size = new System.Drawing.Size(75, 23);
-            this.btnInvSearch.TabIndex = 1;
-            this.btnInvSearch.Text = "Search";
-            this.btnInvSearch.UseVisualStyleBackColor = true;
-            this.btnInvSearch.Click += new System.EventHandler(this.btnInvSearch_Click);
-            // 
             // InventoryConsole
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -551,14 +554,14 @@ namespace Radegast
             this.tstripInventory.ResumeLayout(false);
             this.tstripInventory.PerformLayout();
             this.tabsInventory.ResumeLayout(false);
-            this.tabDetail.ResumeLayout(false);
-            this.pnlItemProperties.ResumeLayout(false);
-            this.pnlItemProperties.PerformLayout();
             this.tabSearch.ResumeLayout(false);
             this.pnlSearchOptions.ResumeLayout(false);
             this.pnlSearchOptions.PerformLayout();
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.PerformLayout();
+            this.tabDetail.ResumeLayout(false);
+            this.pnlItemProperties.ResumeLayout(false);
+            this.pnlItemProperties.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -594,9 +597,7 @@ namespace Radegast
         public System.Windows.Forms.TabPage tabDetail;
         public System.Windows.Forms.TabPage tabSearch;
         public ListViewNoFlicker lstInventorySearch;
-        public System.Windows.Forms.ColumnHeader chResIcon;
         public System.Windows.Forms.ColumnHeader chResItemName;
-        public System.Windows.Forms.ColumnHeader chResItemDesc;
         private System.Windows.Forms.Panel pnlSearchOptions;
         private System.Windows.Forms.Button btnInvSearch;
         private System.Windows.Forms.GroupBox groupBox1;
@@ -604,5 +605,6 @@ namespace Radegast
         private System.Windows.Forms.TextBox txtSearch;
         private System.Windows.Forms.CheckBox cbSrchCreator;
         private System.Windows.Forms.CheckBox cbSrchDesc;
+        private System.Windows.Forms.Label lblSearchStatus;
     }
 }
index b89cf0d..d9d1dcf 100644 (file)
@@ -2015,15 +2015,28 @@ namespace Radegast
 
         #region Search
 
-        List<InventoryBase> searchRes;
+        public class SearchResult
+        {
+            public InventoryBase Inv;
+            public int Level;
+
+            public SearchResult(InventoryBase inv, int level)
+            {
+                this.Inv = inv;
+                this.Level = level;
+            }
+        }
+
+        List<SearchResult> searchRes;
         string searchString;
         Dictionary<int, ListViewItem> searchItemCache = new Dictionary<int, ListViewItem>();
         ListViewItem emptyItem = null;
+        int found;
 
-        void PerformRecursiveSearch(UUID folderID)
+        void PerformRecursiveSearch(int level, UUID folderID)
         {
             var me = Inventory.Items[folderID].Data;
-            searchRes.Add(me);
+            searchRes.Add(new SearchResult(me, level));
             var sorted = Inventory.GetContents(folderID);
 
             sorted.Sort((InventoryBase b1, InventoryBase b2) =>
@@ -2046,43 +2059,52 @@ namespace Radegast
             {
                 if (item is InventoryFolder)
                 {
-                    PerformRecursiveSearch(item.UUID);
+                    PerformRecursiveSearch(level + 1, item.UUID);
                 }
                 else
                 {
                     var it = item as InventoryItem;
                     bool add = false;
-                    if (cbSrchName.Checked && it.Name.Contains(searchString))
+
+                    if (cbSrchName.Checked && it.Name.ToLower().Contains(searchString))
                         add = true;
-                    if (cbSrchDesc.Checked && it.Description.Contains(searchString))
+                    if (cbSrchDesc.Checked && it.Description.ToLower().Contains(searchString))
                         add = true;
                     if (add)
-                        searchRes.Add(item);
+                    {
+                        found++;
+                        searchRes.Add(new SearchResult(it, level + 1));
+                    }
                 }
             }
 
-            if (searchRes[searchRes.Count - 1] == me)
+            if (searchRes[searchRes.Count - 1].Inv == me)
+            {
                 searchRes.RemoveAt(searchRes.Count - 1);
-
+            }
         }
 
         public void UpdateSearch()
         {
+            found = 0;
             searchString = txtSearch.Text.Trim().ToLower();
+            
             if (searchString == string.Empty)
+            {
+                lstInventorySearch.VirtualListSize = 0;
                 return;
+            }
 
             if (emptyItem == null)
             {
                 emptyItem = new ListViewItem(string.Empty);
-                emptyItem.SubItems.Add(string.Empty);
-                emptyItem.SubItems.Add(string.Empty);
             }
-            lstInventorySearch.VirtualListSize = 0;
-            searchRes = new List<InventoryBase>(Inventory.Items.Count);
+
+            searchRes = new List<SearchResult>(Inventory.Items.Count);
             searchItemCache.Clear();
-            PerformRecursiveSearch(Inventory.RootFolder.UUID);
+            PerformRecursiveSearch(0, Inventory.RootFolder.UUID);
             lstInventorySearch.VirtualListSize = searchRes.Count;
+            lblSearchStatus.Text = string.Format("{0} results", found);
         }
 
         private void lstInventorySearch_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
@@ -2093,15 +2115,14 @@ namespace Radegast
             }
             else if (e.ItemIndex < searchRes.Count)
             {
-                InventoryBase inv = searchRes[e.ItemIndex];
-                ListViewItem item = new ListViewItem();
-                item.SubItems.Add(inv.Name);
-                string desc = string.Empty;
+                InventoryBase inv = searchRes[e.ItemIndex].Inv;
+                string desc = inv.Name;
                 if (inv is InventoryItem)
                 {
-                    desc = ((InventoryItem)inv).Description;
+                    desc += string.Format(" - {0}", ((InventoryItem)inv).Description);
                 }
-                item.SubItems.Add(desc);
+                ListViewItem item = new ListViewItem(desc);
+                item.Tag = searchRes[e.ItemIndex];
                 e.Item = item;
                 searchItemCache[e.ItemIndex] = item;
             }
@@ -2131,11 +2152,110 @@ namespace Radegast
                 e.Handled = e.SuppressKeyPress = true;
                 if (txtSearch.Text.Trim().Length > 0)
                 {
-                    btnInvSearch.PerformClick();
+                    UpdateSearch();
+                }
+            }
+        }
+
+        private void lstInventorySearch_DrawItem(object sender, DrawListViewItemEventArgs e)
+        {
+            Graphics g = e.Graphics;
+            e.DrawBackground();
+
+            if (!(e.Item.Tag is SearchResult))
+                return;
+
+            if (e.Item.Selected)
+            {
+                g.FillRectangle(SystemBrushes.Highlight, e.Bounds);
+            }
+
+            SearchResult res = e.Item.Tag as SearchResult;
+            int offset = 20 * (res.Level + 1);
+            Rectangle rec = new Rectangle(e.Bounds.X + offset, e.Bounds.Y, e.Bounds.Width - offset, e.Bounds.Height);
+            
+            Image icon = null;
+            int iconIx = 0;
+            
+            if (res.Inv is InventoryFolder)
+            {
+                iconIx = GetDirImageIndex(((InventoryFolder)res.Inv).PreferredType.ToString().ToLower());
+            }
+            else if (res.Inv is InventoryWearable)
+            {
+                iconIx = GetItemImageIndex(((InventoryWearable)res.Inv).WearableType.ToString().ToLower());
+            }
+            else if (res.Inv is InventoryItem)
+            {
+                iconIx = GetItemImageIndex(((InventoryItem)res.Inv).AssetType.ToString().ToLower());
+            }
+
+            if (iconIx < 0)
+            {
+                iconIx = 0;
+            }
+
+            try
+            {
+                icon = frmMain.ResourceImages.Images[iconIx];
+                g.DrawImageUnscaled(icon, e.Bounds.X + offset - 18, e.Bounds.Y);
+            }
+            catch { }
+
+            using (StringFormat sf = new StringFormat(StringFormatFlags.NoWrap | StringFormatFlags.LineLimit))
+            {
+                e.Graphics.DrawString(e.Item.Text, lstInventorySearch.Font, SystemBrushes.WindowText, rec, sf);
+            }
+
+        }
+
+        private void lstInventorySearch_SizeChanged(object sender, EventArgs e)
+        {
+            chResItemName.Width = lstInventorySearch.Width - 30;
+        }
+
+        private void txtSearch_TextChanged(object sender, EventArgs e)
+        {
+            UpdateSearch();
+        }
+
+        private void lstInventorySearch_MouseClick(object sender, MouseEventArgs e)
+        {
+            if (lstInventorySearch.SelectedIndices.Count != 1)
+                return;
+
+            try
+            {
+                SearchResult res = searchRes[lstInventorySearch.SelectedIndices[0]];
+                TreeNode node = findNodeForItem(res.Inv.UUID);
+                if (node == null)
+                    return;
+                invTree.SelectedNode = node;
+                if (e.Button == MouseButtons.Right)
+                {
+                    ctxInv.Show(lstInventorySearch, e.X, e.Y);
                 }
             }
+            catch { }
         }
 
+        private void lstInventorySearch_MouseDoubleClick(object sender, MouseEventArgs e)
+        {
+            if (lstInventorySearch.SelectedIndices.Count != 1)
+                return;
+
+            try
+            {
+                SearchResult res = searchRes[lstInventorySearch.SelectedIndices[0]];
+                TreeNode node = findNodeForItem(res.Inv.UUID);
+                if (node == null)
+                    return;
+                invTree.SelectedNode = node;
+                invTree_NodeMouseDoubleClick(null, null);
+            }
+            catch { }
+
+        }
         #endregion Search
 
     }