4 #include "../item/checkbox.qh" 5 #include "../item/container.qh" 6 #include "../item/checkbox.qh" 12 me.configureXonoticCvarList(me);
17 me.configureXonoticListBox(me);
26 buf_cvarlist(me.handle, filter,
"_");
27 me.nItems = buf_getsize(me.handle);
31 for (
int i = 0; i < me.nItems; ++i)
33 string k = bufstr_get(me.handle, i);
35 bufstr_add(newbuf, k,
false);
39 me.nItems = buf_getsize(me.handle);
44 bool force_initial_selection =
false;
45 if(me.handle >= 0 && me.nItems <= 0)
46 force_initial_selection =
true;
48 if(force_initial_selection)
49 me.setSelected(me, 0);
68 t = cvar_type(me.cvarName);
73 me.cvarType =
strcat(me.cvarType,
", ", _(
"forced to be saved to config.cfg"));
79 me.cvarType =
strcat(me.cvarType,
", ", _(
"will not be saved"));
84 me.cvarType =
strcat(me.cvarType,
", ", _(
"will be saved to config.cfg"));
89 me.cvarType =
strcat(me.cvarType,
", ", _(
"will not be saved"));
93 me.cvarType =
strcat(me.cvarType,
", ", _(
"private"));
95 me.cvarType =
strcat(me.cvarType,
", ", _(
"engine setting"));
97 me.cvarType =
strcat(me.cvarType,
", ", _(
"read only"));
99 me.cvarTypeBox.setText(me.cvarTypeBox, me.cvarType);
111 strcpy(me.cvarName, bufstr_get(me.handle, me.selectedItem));
112 strcpy(me.cvarDescription, cvar_description(me.cvarName));
114 me.cvarNameBox.setText(me.cvarNameBox, me.cvarName);
115 me.cvarDescriptionBox.setText(me.cvarDescriptionBox, me.cvarDescription);
116 float needsForcing = me.updateCvarType(me);
117 me.cvarDefaultBox.setText(me.cvarDefaultBox, me.cvarDefault);
121 me.cvarNeedsForcing = 0;
122 me.cvarValueBox.setText(me.cvarValueBox, s);
123 me.cvarNeedsForcing = needsForcing;
124 me.cvarValueBox.cursorPos =
strlen(s);
129 me.setSelected(me, 0);
136 me.setSelected(me, 0);
142 me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
143 me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
144 me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
146 me.columnNameOrigin = 0;
147 me.columnValueSize = me.realFontSize.x * 20;
148 me.columnNameSize = 1 - me.columnValueSize - me.realFontSize.x;
149 me.columnValueOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x;
162 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
165 me.focusedItemAlpha =
getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
166 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
169 k = bufstr_get(me.handle, i);
175 theAlpha = SKINALPHA_CVARLIST_SAVED;
177 theAlpha = SKINALPHA_CVARLIST_TEMPORARY;
179 theAlpha = SKINALPHA_CVARLIST_SAVED;
181 theAlpha = SKINALPHA_CVARLIST_TEMPORARY;
183 theColor = SKINCOLOR_CVARLIST_UNCHANGED;
185 theColor = SKINCOLOR_CVARLIST_CHANGED;
188 draw_Text(me.realUpperMargin *
eY + me.columnNameOrigin *
eX, s, me.realFontSize, theColor, theAlpha, 0);
190 draw_Text(me.realUpperMargin *
eY + me.columnValueOrigin *
eX, s, me.realFontSize, theColor, theAlpha, 0);
202 me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox);
207 else if(!me.controlledTextbox)
210 return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift);
216 me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox);
222 cvar_set(me.cvarNameBox.text, box.text);
223 if(me.cvarNeedsForcing)
225 localcmd(sprintf(
"\nseta %1$s \"$%1$s\"\n", me.cvarName));
228 cvar_set(
"menu_forced_saved_cvars", me.cvarName);
231 me.cvarNeedsForcing = 0;
232 me.updateCvarType(me);
238 me.cvarValueBox.setText(me.cvarValueBox, me.cvarDefault);
239 me.cvarValueBox.cursorPos =
strlen(me.cvarDefault);
244 cvar_set(
"menu_reverted_nonsaved_cvars", me.cvarName);
248 me.cvarNeedsForcing = me.updateCvarType(me);
253 box.parent.setFocus(box.parent, me);
void CvarList_Revert_Click(entity btn, entity me)
string autocvar_menu_forced_saved_cvars
void XonoticCvarList_destroy(entity me)
void XonoticCvarList_configureXonoticCvarList(entity me)
void CvarList_Filter_ModifiedCvars(entity box, entity me)
entity makeXonoticCvarList()
void XonoticCvarList_hideNotify(entity me)
void CvarList_Load(entity me, string filter)
void CvarList_End_Editing(entity box, entity me)
void XonoticCvarList_setSelected(entity me, float i)
void CvarList_Filter_Change(entity box, entity me)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
float CVAR_TYPEFLAG_READONLY
void CvarList_Value_Change(entity box, entity me)
float CVAR_TYPEFLAG_PRIVATE
void XonoticCvarList_showNotify(entity me)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float XonoticCvarList_mouseRelease(entity me, vector pos)
float CVAR_TYPEFLAG_ENGINE
string autocvar_menu_reverted_nonsaved_cvars
float XonoticCvarList_updateCvarType(entity me)
float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift)
void XonoticCvarList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
float CVAR_TYPEFLAG_SAVED
float autocvar_menu_cvarlist_onlymodified
void XonoticCvarList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)