From d62c7e77eb0ed02ef3640c5fb0477486c7cc8750 Mon Sep 17 00:00:00 2001
From: Severin Meyer <sev.ch@web.de>
Date: Fri, 23 Jan 2015 20:31:59 +0100
Subject: [PATCH] Play CLEAR sound when using inputbox clearbutton, also remove
 unnecessary InputBox_Clear_Click function

---
 qcsrc/menu/item/inputbox.c | 12 +++++-------
 qcsrc/menu/menu.qh         |  1 +
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/qcsrc/menu/item/inputbox.c b/qcsrc/menu/item/inputbox.c
index e4ad0ef27..7b74ade9b 100644
--- a/qcsrc/menu/item/inputbox.c
+++ b/qcsrc/menu/item/inputbox.c
@@ -39,7 +39,6 @@ CLASS(InputBox) EXTENDS(Label)
 	ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
 	ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
 ENDCLASS(InputBox)
-void InputBox_Clear_Click(entity btn, entity me);
 #endif
 
 #ifdef IMPLEMENTATION
@@ -67,11 +66,6 @@ void InputBox_setText(entity me, string txt)
 	SUPER(InputBox).setText(me, strzone(txt));
 }
 
-void InputBox_Clear_Click(entity btn, entity me)
-{
-	me.setText(me, "");
-}
-
 float over_ClearButton(entity me, vector pos)
 {
 	if (pos_x >= 1 + me.cb_offset - me.cb_width)
@@ -136,8 +130,9 @@ float InputBox_mouseRelease(entity me, vector pos)
 	if(me.cb_pressed)
 	if (over_ClearButton(me, pos))
 	{
+		m_play_click_sound(MENU_SOUND_CLEAR);
+		me.setText(me, "");
 		me.cb_pressed = 0;
-		InputBox_Clear_Click(world, me);
 		return 1;
 	}
 	float r = InputBox_mouseDrag(me, pos);
@@ -205,7 +200,10 @@ float InputBox_keyDown(entity me, float key, float ascii, float shift)
 		case K_KP_DEL:
 		case K_DEL:
 			if(shift & S_CTRL)
+			{
+				m_play_click_sound(MENU_SOUND_CLEAR);
 				me.setText(me, "");
+			}
 			else
 				me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1)));
 			return 1;
diff --git a/qcsrc/menu/menu.qh b/qcsrc/menu/menu.qh
index 4f6ba4f0e..f336198a3 100644
--- a/qcsrc/menu/menu.qh
+++ b/qcsrc/menu/menu.qh
@@ -41,6 +41,7 @@ void m_sync();
 
 // sounds
 
+const string MENU_SOUND_CLEAR   = "sound/menu/clear.wav";
 const string MENU_SOUND_EXECUTE = "sound/menu/execute.wav";
 const string MENU_SOUND_SELECT  = "sound/menu/select.wav";
 const string MENU_SOUND_SLIDE   = "sound/menu/slide.wav";
-- 
2.39.5