]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_misc_cvars.qc
menu: #undef IMPLEMENTATION
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_misc_cvars.qc
1 #include "dialog_settings_misc_cvars.qh"
2
3 #include "cvarlist.qh"
4 #include "textlabel.qh"
5 #include "inputbox.qh"
6 #include "button.qh"
7
8 void XonoticCvarsDialog_showNotify(entity me)
9 {
10         SUPER(XonoticCvarsDialog).showNotify(me);
11         loadAllCvars(me);
12 }
13 void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIST_CONTROLS to color ALL controls
14 {
15
16         entity e, cvarlist;
17
18         cvarlist = makeXonoticCvarList();
19
20         cvarlist.color =
21                 cvarlist.colorF =
22                 cvarlist.color2 =
23                 cvarlist.colorC =
24                 SKINCOLOR_CVARLIST_CONTROLS;
25
26         // todo:
27         // add button which does cvar_resettodefaults_saveonly
28
29         me.TR(me);
30                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Cvar filter:")));
31                 me.TD(me, 1, me.columns - 1, e = makeXonoticInputBox(0, string_null));
32                         e.color = SKINCOLOR_CVARLIST_CONTROLS;
33                         e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
34                         e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
35                         e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
36                         e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
37                         e.onChange = CvarList_Filter_Change;
38                         e.onChangeEntity = cvarlist;
39                         cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
40         me.TR(me);
41                 me.TD(me, me.rows - me.currentRow - 9, me.columns, cvarlist);
42         me.gotoRC(me, me.rows - 8, 0);
43                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Setting:")));
44                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
45                         cvarlist.cvarNameBox = e;
46         me.TR(me);
47                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Type:")));
48                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
49                         cvarlist.cvarTypeBox = e;
50         me.TR(me);
51                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Value:")));
52                 me.TD(me, 1, me.columns - 2, e = makeXonoticInputBox(0, string_null));
53                         cvarlist.cvarValueBox = e;
54                         e.color = SKINCOLOR_CVARLIST_CONTROLS;
55                         e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
56                         e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
57                         e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
58                         e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
59                         e.onChange = CvarList_Value_Change;
60                         e.onChangeEntity = cvarlist;
61                         e.onEnter = CvarList_End_Editing;
62                         e.onEnterEntity = cvarlist;
63                 me.TD(me, 1, 1, e = makeXonoticButton(string_null, SKINCOLOR_CVARLIST_CONTROLS));
64                         cvarlist.cvarDefaultBox = e;
65                         e.onClick = CvarList_Revert_Click;
66                         e.onClickEntity = cvarlist;
67                         e.allowCut = 1;
68                         e.marginLeft = e.marginRight = 0.5;
69         me.TR(me);
70         me.TR(me);
71                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Description:")));
72                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
73                         cvarlist.cvarDescriptionBox = e;
74                         e.allowWrap = 1;
75         me.gotoRC(me, me.rows - 1, 0);
76                 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), SKINCOLOR_CVARLIST_CONTROLS));
77                         e.onClick = Dialog_Close;
78                         e.onClickEntity = me;
79 }