From: BuddyFriendGuy Date: Tue, 4 Aug 2015 02:22:20 +0000 (-0400) Subject: add add all button in the UI X-Git-Tag: xonotic-v0.8.1~23^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9db197b49a9fef321f71e6fd8bce845f03ce2326;p=xonotic%2Fxonotic-data.pk3dir.git add add all button in the UI --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc index 04526d3f0..7b96944b5 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc @@ -159,9 +159,9 @@ void XonoticServerCreateTab_fill(entity me) makeCallback(e, me.mapListBox, me.mapListBox.refilterCallback); me.TR(me); // we use 5.8 here to visually match the bottom line of the component on the left (Bot Skill) - me.TD(me, me.rows - 5.8, 3, me.mapListBox); + me.TD(me, me.rows - 6.8, 3, me.mapListBox); - me.gotoRC(me, me.rows - 3.8, me.firstColumn); + me.gotoRC(me, me.rows - 4.5, me.firstColumn); // string filter label and box me.TD(me, 1, 0.35, e = makeXonoticTextLabel(1, _("Filter:"))); me.mapListBox.stringFilterBox = makeXonoticMapListStringFilterBox(me, 0, string_null); @@ -172,17 +172,21 @@ void XonoticServerCreateTab_fill(entity me) e.onChangeEntity = me.mapListBox; me.mapListBox.controlledTextbox = e; - // here we use the following line instead of me.TR(me) for better visual spacing; - // this decision was made in this poll: http://forums.xonotic.org/showthread.php?tid=5445 - me.gotoRC(me, me.rows - 2.5, me.firstColumn); + me.gotoRC(me, me.rows - 3.5, me.firstColumn); // the selection buttons - me.TD(me, 1, 1, e = makeXonoticButton(_("Add shown"), '0 0 0')); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.3, e = makeXonoticButton(_("Add shown"), '0 0 0')); e.onClick = MapList_Add_Shown; e.onClickEntity = me.mapListBox; - me.TD(me, 1, 1, e = makeXonoticButton(_("Remove shown"), '0 0 0')); + me.TD(me, 1, 1.3, e = makeXonoticButton(_("Remove shown"), '0 0 0')); e.onClick = MapList_Remove_Shown; e.onClickEntity = me.mapListBox; - me.TD(me, 1, 1, e = makeXonoticButton(_("Remove all"), '0 0 0')); + me.gotoRC(me, me.rows - 2.5, me.firstColumn); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.3, e = makeXonoticButton(_("Add all"), '0 0 0')); + e.onClick = MapList_Add_All; + e.onClickEntity = me.mapListBox; + me.TD(me, 1, 1.3, e = makeXonoticButton(_("Remove all"), '0 0 0')); e.onClick = MapList_Remove_All; e.onClickEntity = me.mapListBox; diff --git a/qcsrc/menu/xonotic/maplist.qc b/qcsrc/menu/xonotic/maplist.qc index f7da84362..03431ba31 100644 --- a/qcsrc/menu/xonotic/maplist.qc +++ b/qcsrc/menu/xonotic/maplist.qc @@ -295,6 +295,19 @@ void MapList_Remove_Shown(entity btn, entity me) me.refilter(me); } +void MapList_Add_All(entity btn, entity me) +{ + // TODO make it work + float i, n; + n = strlen(me.g_maplistCache); + for (i = 0 ; i < n; i++) + { + if (!me.g_maplistCacheQuery(me, i)) + me.g_maplistCacheToggle(me, i); + } + me.refilter(me); +} + void MapList_Remove_All(entity btn, entity me) { cvar_set("g_maplist", "");