]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add buttons to add tracks to the playlist
authorterencehill <piuntn@gmail.com>
Sun, 4 Aug 2013 11:22:15 +0000 (13:22 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 4 Aug 2013 11:22:15 +0000 (13:22 +0200)
qcsrc/menu/xonotic/dialog_multiplayer_musicplayer.c
qcsrc/menu/xonotic/soundlist.c

index 4ff4579127e46c989943dba40aa526de8f9792be..9ac0be8f860188d53c36bd4184eee119d5caa0a0 100644 (file)
@@ -37,7 +37,14 @@ void XonoticMusicPlayerTab_fill(entity me)
        me.TR(me);
                me.TD(me, me.rows - 4, columns_nospacing / 2, soundList);
 
-       me.gotoRC(me, me.rows - 3, 0);
+       me.gotoRC(me, me.rows - 4, 0);
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add")), '0 0 0'));
+                       e.onClick = SoundList_Add;
+                       e.onClickEntity = soundList;
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add all")), '0 0 0'));
+                       e.onClick = SoundList_Add_All;
+                       e.onClickEntity = soundList;
+       me.TR(me);
                me.TD(me, 1, columns_nospacing / 2, e = makeXonoticButton(_("Set as menu track"), '0 0 0'));
                        e.onClick = SoundList_Menu_Track_Change;
                        e.onClickEntity = soundList;
@@ -54,19 +61,19 @@ void XonoticMusicPlayerTab_fill(entity me)
                me.TD(me, me.rows - 3, columns_nospacing / 2, playList);
 
        me.gotoRC(me, me.rows - 2, columns_nospacing / 2 + 0.2);
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MP^Stop")), '0 0 0'));
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Stop")), '0 0 0'));
                        e.onClick = StopSound_Click;
                        e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MP^Play")), '0 0 0'));
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Play")), '0 0 0'));
                        e.onClick = StartSound_Click;
                        e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MP^Pause/Play")), '0 0 0'));
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Pause/Play")), '0 0 0'));
                        e.onClick = PauseSound_Click;
                        e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MP^Prev")), '0 0 0'));
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Prev")), '0 0 0'));
                        e.onClick = PrevSound_Click;
                        e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MP^Next")), '0 0 0'));
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Next")), '0 0 0'));
                        e.onClick = NextSound_Click;
                        e.onClickEntity = playList;
 }
index 2aa8c379dc882a63fa8467f27b23d7b29f07bf2c..126b017218f1c9fcc37117443ebf8c17a270644e 100644 (file)
@@ -29,6 +29,8 @@ ENDCLASS(XonoticSoundList)
 
 entity makeXonoticSoundList();
 void SoundList_Filter_Change(entity box, entity me);
+void SoundList_Add(entity box, entity me);
+void SoundList_Add_All(entity box, entity me);
 void SoundList_Menu_Track_Change(entity box, entity me);
 void SoundList_Menu_Track_Reset(entity box, entity me);
 #endif
@@ -144,6 +146,18 @@ void SoundList_Filter_Change(entity box, entity me)
        me.getSounds(me);
 }
 
+void SoundList_Add(entity box, entity me)
+{
+       me.playlist.addToPlayList(me.playlist, me.soundName(me, me.selectedItem));
+}
+
+void SoundList_Add_All(entity box, entity me)
+{
+       float i;
+       for(i = 0; i < me.nItems; ++i)
+               me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
+}
+
 void XonoticSoundList_clickListBoxItem(entity me, float i, vector where)
 {
        if(i == me.lastClickedSound)