]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_misc_cvars.c
dbf0e4a65b149703d4818fd4fbc6547083feb89e
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_misc_cvars.c
1 #ifdef INTERFACE
2 CLASS(XonoticCvarsDialog) EXTENDS(XonoticDialog)
3         METHOD(XonoticCvarsDialog, fill, void(entity))
4         METHOD(XonoticCvarsDialog, showNotify, void(entity))
5         ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
6         ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
7         ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
8         ATTRIB(XonoticCvarsDialog, rows, float, 25)
9         ATTRIB(XonoticCvarsDialog, columns, float, 6)
10 ENDCLASS(XonoticCvarsDialog)
11 #endif
12
13 #ifdef IMPLEMENTATION
14 void XonoticCvarsDialog_showNotify(entity me)
15 {
16         loadAllCvars(me);
17 }
18 void XonoticCvarsDialog_fill(entity me)
19 {
20         entity e, cvarlist;
21         cvarlist = makeXonoticCvarList();
22         me.TR(me);
23                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Cvar filter:")));
24                 me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
25                         e.onChange = CvarList_Filter_Change;
26                         e.onChangeEntity = cvarlist;
27                         cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
28         me.TR(me);
29                 me.TD(me, me.rows - me.currentRow - 7, me.columns, cvarlist);
30         me.gotoRC(me, me.rows - 7, 0);
31                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Setting:")));
32                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
33                         cvarlist.cvarNameBox = e;
34         me.TR(me);
35                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Type:")));
36                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
37                         cvarlist.cvarTypeBox = e;
38         me.TR(me);
39                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Value:")));
40                 me.TD(me, 1, me.columns - 2, e = makeXonoticInputBox(0, string_null));
41                         cvarlist.cvarValueBox = e;
42                         e.onChange = CvarList_Value_Change;
43                         e.onChangeEntity = cvarlist;
44                         e.onEnter = CvarList_End_Editing;
45                         e.onEnterEntity = cvarlist;
46                 me.TD(me, 1, 1, e = makeXonoticButton(string_null, SKINCOLOR_CVARLIST_REVERTBUTTON));
47                         cvarlist.cvarDefaultBox = e;
48                         e.onClick = CvarList_Revert_Click;
49                         e.onClickEntity = cvarlist;
50                         e.allowCut = 1;
51                         e.marginLeft = e.marginRight = 0.5;
52         me.TR(me);
53                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Description:")));
54                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
55                         cvarlist.cvarDescriptionBox = e;
56                         e.allowWrap = 1;
57         me.gotoRC(me, me.rows - 1, 0);
58                 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
59                         e.onClick = Dialog_Close;
60                         e.onClickEntity = me;
61 }
62
63 #endif