From: Severin Meyer Date: Fri, 23 Jan 2015 19:31:59 +0000 (+0100) Subject: Play CLEAR sound when using inputbox clearbutton, also remove unnecessary InputBox_Cl... X-Git-Tag: xonotic-v0.8.1~147^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d62c7e77eb0ed02ef3640c5fb0477486c7cc8750;p=xonotic%2Fxonotic-data.pk3dir.git Play CLEAR sound when using inputbox clearbutton, also remove unnecessary InputBox_Clear_Click function --- 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";