soundList.playlist = playList;
me.TR(me);
- me.TD(me, me.rows - 4, columns_nospacing / 2, soundList);
+ me.TD(me, me.rows - 5, columns_nospacing / 2, soundList);
me.gotoRC(me, me.rows - 4, 0);
me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add")), '0 0 0'));
me.TD(me, 1, columns_nospacing / 4, e = makeXonoticTextLabel(0, _("Playlist:")));
me.TD(me, 1, columns_nospacing / 4, e = makeXonoticCheckBox(0, "music_playlist_random0", _("Random order")));
me.TR(me);
- me.TD(me, me.rows - 3, columns_nospacing / 2, playList);
+ me.TD(me, me.rows - 4, columns_nospacing / 2, playList);
- me.gotoRC(me, me.rows - 2, columns_nospacing / 2 + 0.2);
+ me.gotoRC(me, me.rows - 3, columns_nospacing / 2 + 0.2);
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(_("MUSICPL^Next")), '0 0 0'));
e.onClick = NextSound_Click;
e.onClickEntity = playList;
+ me.TR(me);
+ me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Remove")), '0 0 0'));
+ e.onClick = PlayList_Remove;
+ e.onClickEntity = playList;
+ me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Remove all")), '0 0 0'));
+ e.onClick = PlayList_Remove_All;
+ e.onClickEntity = playList;
}
#endif
METHOD(XonoticPlayList, mouseDrag, float(entity, vector))
METHOD(XonoticPlayList, addToPlayList, void(entity, string))
- METHOD(XonoticPlayList, removeFromPlayList, void(entity, string))
+ METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity))
ATTRIB(XonoticPlayList, playingTrack, string, string_null)
ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
ENDCLASS(XonoticPlayList)
entity makeXonoticPlayList();
+void PlayList_Remove(entity btn, entity me);
+void PlayList_Remove_All(entity btn, entity me);
void StopSound_Click(entity btn, entity me);
void StartSound_Click(entity btn, entity me);
void PauseSound_Click(entity btn, entity me);
cvar_set("music_playlist_list0", strcat(cvar_string("music_playlist_list0"), " ", track));
}
-void XonoticPlayList_removeFromPlayList(entity me, string track)
+void XonoticPlayList_removeSelectedFromPlayList(entity me)
{
float i, cpt = FALSE;
string s = "";
return;
for(i = 0; i < me.nItems; ++i)
{
- if(argv(i) == track)
+ if(i == me.selectedItem)
{
if(i == me.nItems - 1)
me.setSelected(me, me.selectedItem - 1);
me.startSound(me, 0); // stop current playing track otherwise pause/play button will resume from another track
}
+void PlayList_Remove(entity btn, entity me)
+{
+ me.removeSelectedFromPlayList(me);
+}
+
+void PlayList_Remove_All(entity btn, entity me)
+{
+ cvar_set("music_playlist_list0", "");
+ me.stopSound(me);
+ me.selectedItem = 0;
+}
+
float XonoticPlayList_mouseDrag(entity me, vector pos)
{
float f, i;
return 1;
}
else if(scan == K_DEL || scan == K_KP_DEL || scan == K_BACKSPACE || scan == K_MOUSE3) {
- me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
- me.removeFromPlayList(me, argv(me.selectedItem));
+ me.removeSelectedFromPlayList(me);
return 1;
}
else
me.playlist.addToPlayList(me.playlist, me.soundName(me, me.selectedItem));
return 1;
}
- else if(scan == K_DEL || scan == K_KP_DEL) {
- me.playlist.removeFromPlayList(me.playlist, me.soundName(me, me.selectedItem));
- return 1;
- }
else
return SUPER(XonoticSoundList).keyDown(me, scan, ascii, shift);
}