]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/cvarlist.c
fix message
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / cvarlist.c
index ca6b1b2b42de1375889a8f15ff9eaeccf450ff67..03898a3f8b90ef48b11e74de917d8939a1dfe4dc 100644 (file)
@@ -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
@@ -43,7 +46,7 @@ entity makeXonoticCvarList()
        me.configureXonoticCvarList(me);
        return me;
 }
-void configureXonoticCvarListXonoticCvarList(entity me)
+void XonoticCvarList_configureXonoticCvarList(entity me)
 {
        me.configureXonoticListBox(me);
 
@@ -51,11 +54,11 @@ void configureXonoticCvarListXonoticCvarList(entity me)
        buf_cvarlist(me.handle, "", "_");
        me.nItems = buf_getsize(me.handle);
 }
-void destroyXonoticCvarList(entity me)
+void XonoticCvarList_destroy(entity me)
 {
        buf_del(me.handle);
 }
-void setSelectedXonoticCvarList(entity me, float i)
+void XonoticCvarList_setSelected(entity me, float i)
 {
        string s;
 
@@ -79,15 +82,15 @@ void setSelectedXonoticCvarList(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);
@@ -107,7 +110,7 @@ void CvarList_Filter_Change(entity box, entity me)
 
        me.setSelected(me, 0);
 }
-void resizeNotifyXonoticCvarList(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void XonoticCvarList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
        SUPER(XonoticCvarList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 
@@ -122,7 +125,7 @@ void resizeNotifyXonoticCvarList(entity me, vector relOrigin, vector relSize, ve
 
        me.setSelected(me, me.selectedItem);
 }
-void drawListBoxItemXonoticCvarList(entity me, float i, vector absSize, float isSelected)
+void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
 {
        string k, v, d;
        float t;
@@ -155,9 +158,16 @@ void drawListBoxItemXonoticCvarList(entity me, float i, vector absSize, float is
        draw_Text(me.realUpperMargin * eY + me.columnValueOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
 }
 
-float keyDownXonoticCvarList(entity me, float scan, float ascii, float shift)
+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);
+       else if(SUPER(XonoticCvarList).keyDown(me, scan, ascii, shift))
                return 1;
        else if(!me.controlledTextbox)
                return 0;
@@ -165,6 +175,13 @@ float keyDownXonoticCvarList(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 +192,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