]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_misc_cvars.qc
Add a checkbox in the cvar list dialog to show only the modified cvars
[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, 3, e = makeXonoticInputBox(0, string_null));
32                         e.color = e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
33                         e.cb_color = e.cb_colorC = e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
34                         e.onChange = CvarList_Filter_Change;
35                         e.onChangeEntity = cvarlist;
36                         cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
37                 me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "menu_cvarlist_onlymodified", _("Modified cvars only")));
38                         e.color = e.colorC = e.colorF = e.colorD = SKINCOLOR_CVARLIST_CONTROLS;
39                         e.onClickEntity = cvarlist;
40                         e.onClick = CvarList_Filter_ModifiedCvars;
41         me.TR(me);
42                 me.TD(me, me.rows - me.currentRow - 9, me.columns, cvarlist);
43         me.gotoRC(me, me.rows - 8, 0);
44                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Setting:")));
45                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
46                         cvarlist.cvarNameBox = e;
47         me.TR(me);
48                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Type:")));
49                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
50                         cvarlist.cvarTypeBox = e;
51         me.TR(me);
52                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Value:")));
53                 me.TD(me, 1, me.columns - 2, e = makeXonoticInputBox(0, string_null));
54                         cvarlist.cvarValueBox = e;
55                         e.color = e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
56                         e.cb_color = e.cb_colorC = e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
57                         e.onChange = CvarList_Value_Change;
58                         e.onChangeEntity = cvarlist;
59                         e.onEnter = CvarList_End_Editing;
60                         e.onEnterEntity = cvarlist;
61                 me.TD(me, 1, 1, e = makeXonoticButton(string_null, SKINCOLOR_CVARLIST_CONTROLS));
62                         cvarlist.cvarDefaultBox = e;
63                         e.onClick = CvarList_Revert_Click;
64                         e.onClickEntity = cvarlist;
65                         e.allowCut = 1;
66                         e.marginLeft = e.marginRight = 0.5;
67         me.TR(me);
68         me.TR(me);
69                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Description:")));
70                 me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
71                         cvarlist.cvarDescriptionBox = e;
72                         e.allowWrap = 1;
73         me.gotoRC(me, me.rows - 1, 0);
74                 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), SKINCOLOR_CVARLIST_CONTROLS));
75                         e.onClick = Dialog_Close;
76                         e.onClickEntity = me;
77 }