From: terencehill Date: Fri, 27 Nov 2015 14:40:43 +0000 (+0100) Subject: Add an input box near the "Save current skin" button to insert a custom filename X-Git-Tag: xonotic-v0.8.2~1467^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=81c1459fba6efd813025edc0c2416654b4a93c27;p=xonotic%2Fxonotic-data.pk3dir.git Add an input box near the "Save current skin" button to insert a custom filename --- diff --git a/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc b/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc index 63c5e42ec..bb24a1994 100644 --- a/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc +++ b/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc @@ -40,10 +40,12 @@ void XonoticHUDExitDialog_fill(entity me) 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:"))); diff --git a/qcsrc/menu/xonotic/hudskinlist.qc b/qcsrc/menu/xonotic/hudskinlist.qc index ddb5acd9d..65bdba128 100644 --- a/qcsrc/menu/xonotic/hudskinlist.qc +++ b/qcsrc/menu/xonotic/hudskinlist.qc @@ -28,6 +28,7 @@ CLASS(XonoticHUDSkinList, XonoticListBox) ATTRIB(XonoticHUDSkinList, filterString, string, string_null) ATTRIB(XonoticHUDSkinList, delayedRefreshTime, float, 0) + ATTRIB(XonoticHUDSkinList, savedName, string, string_null) ENDCLASS(XonoticHUDSkinList) #ifndef IMPLEMENTATION @@ -39,6 +40,7 @@ void SetHUDSkin_Click(entity btn, entity me); #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 @@ -189,6 +191,17 @@ void HUDSkinList_Refresh_Click(entity btn, entity me) 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) @@ -209,7 +222,10 @@ void HUDSkinList_Filter_Change(entity box, entity me) 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; }