e.onClick = SetHUDSkin_Click;
e.onClickEntity = hudskinlist;
me.gotoRC(me, me.rows - 2.5, 0);
- me.TDempty(me, 0.75);
- me.TD(me, 1, 2.5, e = makeXonoticButton(_("Save current skin"), '0 0 0'));
+ me.TD(me, 1, 2, e = makeXonoticButton(_("Save current skin"), '0 0 0'));
e.onClick = SaveHUDSkin_Click;
e.onClickEntity = hudskinlist;
+ me.TD(me, 1, 2, e = makeXonoticInputBox(0, string_null));
+ e.onChange = HUDSkinList_SavedName_Change;
+ e.onChangeEntity = hudskinlist;
me.gotoRC(me, 0, 4.2); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Panel background defaults:")));
ATTRIB(XonoticHUDSkinList, filterString, string, string_null)
ATTRIB(XonoticHUDSkinList, delayedRefreshTime, float, 0)
+ ATTRIB(XonoticHUDSkinList, savedName, string, string_null)
ENDCLASS(XonoticHUDSkinList)
#ifndef IMPLEMENTATION
#endif
void HUDSkinList_Refresh_Click(entity btn, entity me);
void HUDSkinList_Filter_Change(entity box, entity me);
+void HUDSkinList_SavedName_Change(entity box, entity me);
#endif
#ifdef IMPLEMENTATION
me.setSelected(me, 0); //always select the first element after a list update
}
+void HUDSkinList_SavedName_Change(entity box, entity me)
+{
+ if(me.savedName)
+ strunzone(me.savedName);
+
+ if(box.text != "")
+ me.savedName = strzone(box.text);
+ else
+ me.savedName = string_null;
+}
+
void HUDSkinList_Filter_Change(entity box, entity me)
{
if(me.filterString)
void SaveHUDSkin_Click(entity btn, entity me)
{
- localcmd("hud save myconfig\n");
+ string s = me.savedName;
+ if(s == "")
+ s = "myconfig";
+ localcmd(sprintf("hud save \"%s\"\n", s));
me.delayedRefreshTime = time + 1;
}