X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fcvarlist.c;h=722917f553c8e7876f03ee0a0b4b0799f1bd4890;hp=387396bbaf050b0001950d589d8ecdf24d2a276d;hb=8e3b8efa99f2620f1665252ce41eeb87a1483e32;hpb=1d02a7ca9ba75edf897d843e7dfb5635ad7dd23f diff --git a/qcsrc/menu/xonotic/cvarlist.c b/qcsrc/menu/xonotic/cvarlist.c index 387396bba..722917f55 100644 --- a/qcsrc/menu/xonotic/cvarlist.c +++ b/qcsrc/menu/xonotic/cvarlist.c @@ -15,7 +15,9 @@ CLASS(XonoticCvarList) EXTENDS(XonoticListBox) ATTRIB(XonoticCvarList, columnValueOrigin, float, 0) ATTRIB(XonoticCvarList, columnValueSize, float, 0) + METHOD(XonoticCvarList, mouseRelease, float(entity, vector)) METHOD(XonoticCvarList, setSelected, void(entity, float)) + ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL) ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL) ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL) @@ -33,6 +35,7 @@ entity makeXonoticCvarList(); void CvarList_Filter_Change(entity box, entity me); void CvarList_Value_Change(entity box, entity me); void CvarList_Revert_Click(entity btn, entity me); +void CvarList_End_Editing(entity box, entity me); #endif #ifdef IMPLEMENTATION @@ -62,7 +65,7 @@ void XonoticCvarList_setSelected(entity me, float i) SUPER(XonoticCvarList).setSelected(me, i); if(me.nItems == 0) return; - + if(me.cvarName) strunzone(me.cvarName); if(me.cvarDescription) @@ -79,15 +82,15 @@ void XonoticCvarList_setSelected(entity me, float i) t = cvar_type(me.cvarName); me.cvarType = ""; if(t & CVAR_TYPEFLAG_SAVED) - me.cvarType = strcat(me.cvarType, ", will be saved to config.cfg"); + me.cvarType = strcat(me.cvarType, ", ", _("will be saved to config.cfg")); else - me.cvarType = strcat(me.cvarType, ", will not be saved"); + me.cvarType = strcat(me.cvarType, ", ", _("will not be saved")); if(t & CVAR_TYPEFLAG_PRIVATE) - me.cvarType = strcat(me.cvarType, ", private"); + me.cvarType = strcat(me.cvarType, ", ", _("private")); if(t & CVAR_TYPEFLAG_ENGINE) - me.cvarType = strcat(me.cvarType, ", engine setting"); + me.cvarType = strcat(me.cvarType, ", ", _("engine setting")); if(t & CVAR_TYPEFLAG_READONLY) - me.cvarType = strcat(me.cvarType, ", read only"); + me.cvarType = strcat(me.cvarType, ", ", _("read only")); me.cvarType = strzone(substring(me.cvarType, 2, strlen(me.cvarType) - 2)); me.cvarNameBox.setText(me.cvarNameBox, me.cvarName); @@ -134,7 +137,7 @@ void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float i if(isSelected) draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED); - + k = bufstr_get(me.handle, i); v = cvar_string(k); @@ -157,7 +160,17 @@ void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float i float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift) { - if(SUPER(XonoticCvarList).keyDown(me, scan, ascii, shift)) + if (scan == K_MOUSE3 || ((shift & S_CTRL) && scan == K_SPACE)) + { + CvarList_Revert_Click(world, me); + return 1; + } + else if(scan == K_ENTER) + { + me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox); + return 1; + } + else if(SUPER(XonoticCvarList).keyDown(me, scan, ascii, shift)) return 1; else if(!me.controlledTextbox) return 0; @@ -165,6 +178,13 @@ float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift) return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift); } +float XonoticCvarList_mouseRelease(entity me, vector pos) +{ + if(me.pressed == 2) + me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox); + return SUPER(XonoticCvarList).mouseRelease(me, pos); +} + void CvarList_Value_Change(entity box, entity me) { cvar_set(me.cvarNameBox.text, box.text); @@ -175,4 +195,10 @@ void CvarList_Revert_Click(entity btn, entity me) me.cvarValueBox.setText(me.cvarValueBox, me.cvarDefault); me.cvarValueBox.cursorPos = strlen(me.cvarDefault); } + +void CvarList_End_Editing(entity box, entity me) +{ + box.parent.setFocus(box.parent, me); +} + #endif