From 2a516ac22b2ee4381404870950492be83d7ebe5e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 6 Aug 2016 23:31:53 +0200 Subject: [PATCH] Add seperate button for resetting search --- README.md | 5 +++-- callbacks.lua | 8 +++++++- internal.lua | 8 +++++++- textures/ui_reset_icon.png | Bin 0 -> 11310 bytes 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 textures/ui_reset_icon.png diff --git a/README.md b/README.md index 6f5e2d4..489ebab 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,10 @@ Unified inventory code is licensed under the GNU LGPLv2+. Licenses for textures: VanessaE: (WTFPL) - * ui\_group.png + * `ui_group.png` RealBadAngel: (WTFPL) * Everything else. - +Tango Project: (WTFPL) + * `ui_reset_icon.png diff --git a/callbacks.lua b/callbacks.lua index e86cac6..be5c055 100644 --- a/callbacks.lua +++ b/callbacks.lua @@ -153,11 +153,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if fields.searchbutton then unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange") - unified_inventory.current_searchbox[player_name] = "" unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0}) + elseif fields.searchresetbutton then + unified_inventory.apply_filter(player, "", "nochange") + unified_inventory.current_searchbox[player_name] = "" + unified_inventory.set_inventory_formspec(player, + unified_inventory.current_page[player_name]) + minetest.sound_play("click", + {to_player=player_name, gain = 0.1}) end -- alternate buttons diff --git a/internal.lua b/internal.lua index 8319191..42ab722 100644 --- a/internal.lua +++ b/internal.lua @@ -179,13 +179,19 @@ function unified_inventory.get_formspec(player, page) .. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]" formspec[n+1] = "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]" .. "tooltip[searchbutton;" ..F("Search") .. "]" + formspec[n+2] = "image_button[12.9,8.1;.8,.8;ui_reset_icon.png;searchresetbutton;]" + .. "tooltip[searchbutton;" ..F("Search") .. "]" + .. "tooltip[searchresetbutton;" ..F("Reset search and display everything") .. "]" else formspec[n] = "field[8.5,5.225;2.2,1;searchbox;;" .. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]" formspec[n+1] = "image_button[10.3,5;.8,.8;ui_search_icon.png;searchbutton;]" .. "tooltip[searchbutton;" ..F("Search") .. "]" + formspec[n+2] = "image_button[11,5;.8,.8;ui_reset_icon.png;searchresetbutton;]" + .. "tooltip[searchbutton;" ..F("Search") .. "]" + .. "tooltip[searchresetbutton;" ..F("Reset search and display everything") .. "]" end - n = n+2 + n = n+3 local no_matches = "No matching items" if draw_lite_mode then diff --git a/textures/ui_reset_icon.png b/textures/ui_reset_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ec9ef629dd099f0ffdf4e3ebf2001c355efda526 GIT binary patch literal 11310 zcmV+}EYZ`6P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01ejw01ejxLMWSf00007bV*G`2jB<> z6&y2+!T9e003ZNKL_t(|+U=croTOEG@4x4~ORe42d(ZSt_iW6747iK-$PrY4L{Z`fc{Lb%L&U2mvEon(hTGEo1w4^01X-P|3(vnw@ zh@<@h*I!P%3OT_DYZ*dRjSTbI0-HW~E0xyme;EVdi|?{7LFx~KxEOF2yc}S}g92_& zmDM*}V0ak;;4iPH&8^7m5nOqM|1yCQzxUs6QD1MV<2VPvx8I4i&k;WnM!XR~3h3$S zW?=a#WIOtiZkizQ$xn?kymKps>5<0&8q9YK3GMza6huiNB1wGas6Zulo*uOEoW!STC6Jf0M<+h+6L;7czqeF# zoB`mHljSFkU<1I}8{ST~vmX`uJb35-WBZl|DdZ<97G{{9*w4Ow~FW`OQRE9mMQ1mLlIZ)I|9I6|6}Aerp~ zKx@ro58ch=?neM{Q#npQ=Z%f;B!v8UOEt$40KRx79l&V-1IteWpi-J)|L`sV7Oy#< z-}>9VeCUR8e))r60U^-Fuw%>52uc$GbPb$H-=Zb;OI~*U05p#0Oe{(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