Would someone with win32 building add this option to that option menu
as well?
Index: base/include/playlist.h
===================================================================
RCS file: /src/repository/freeamp/base/include/playlist.h,v
retrieving revision 1.62
diff -u -r1.62 playlist.h
--- base/include/playlist.h     2000/09/24 19:26:24     1.62
+++ base/include/playlist.h     2000/10/03 16:38:07
@@ -341,8 +341,10 @@
     bool            IsEmpty();
     uint32          CountItems();
     PlaylistItem*   ItemAt(uint32 index);
-       uint32          IndexOf(const PlaylistItem* item);
+    uint32          IndexOf(const PlaylistItem* item);
     bool            HasItem(const PlaylistItem* item);
+    uint32          IndexOfURL(const string& url);
+    
 
     void RetrieveMetaData(PlaylistItem* item);
     void RetrieveMetaData(vector<PlaylistItem*>* list);
Index: base/src/playlist.cpp
===================================================================
RCS file: /src/repository/freeamp/base/src/playlist.cpp,v
retrieving revision 1.113
diff -u -r1.113 playlist.cpp
--- base/src/playlist.cpp       2000/09/28 08:08:00     1.113
+++ base/src/playlist.cpp       2000/10/03 16:38:08
@@ -2350,6 +2350,33 @@
     return (IndexOf(item) != kInvalidIndex);
 }
 
+uint32 PlaylistManager::IndexOfURL(const string& url)
+{
+    // Added by [EMAIL PROTECTED]
+    vector<PlaylistItem*>* alist=m_activeList;
+    uint32 result = kInvalidIndex;
+    uint32 index = 0;
+    uint32 size = 0;
+
+    assert(alist);
+
+    if(alist)
+    {
+        vector<PlaylistItem*>::iterator i = alist->begin();
+        size = alist->size();
+
+        for(index = 0; i != alist->end();i++,  index++)
+        {
+            if(url == (*i)->URL())
+            {
+                result = index;
+                break;
+            }
+        }
+    }
+    
+    return result;
+}
 
 bool PlaylistManager::CanUndo()
 {
Index: ui/musicbrowser/unix/include/gtkmusicbrowser.h
===================================================================
RCS file: /src/repository/freeamp/ui/musicbrowser/unix/include/gtkmusicbrowser.h,v
retrieving revision 1.56
diff -u -r1.56 gtkmusicbrowser.h
--- ui/musicbrowser/unix/include/gtkmusicbrowser.h      2000/09/25 08:41:42     1.56
+++ ui/musicbrowser/unix/include/gtkmusicbrowser.h      2000/10/03 16:38:15
@@ -325,6 +325,8 @@
     void AddTracksPlaylistEvent(vector<PlaylistItem *> *newlist, 
                                 bool end = false, bool forcePlay = false,
                                 bool forceNoPlay = false);
+    /// Added by [EMAIL PROTECTED]
+    void PlayInListEvent(vector<PlaylistItem *> *newlist);
     void AddTracksDoubleClick(vector<PlaylistItem *> *newlist);
     void PlayEvent();
     void StartMusicSearch(bool runMain = true, bool intro = false);
Index: ui/musicbrowser/unix/src/browsertree.cpp
===================================================================
RCS file: /src/repository/freeamp/ui/musicbrowser/unix/src/browsertree.cpp,v
retrieving revision 1.32
diff -u -r1.32 browsertree.cpp
--- ui/musicbrowser/unix/src/browsertree.cpp    2000/10/02 08:03:45     1.32
+++ ui/musicbrowser/unix/src/browsertree.cpp    2000/10/03 16:38:16
@@ -1529,6 +1529,12 @@
     p->AddTracksPlaylistEvent(newlist, true, true, false);
 }
 
+static void play_in_list_pop(GTKMusicBrowser *p, guint action, GtkWidget *w)
+{
+    vector<PlaylistItem *> *newlist = p->GetTreeSelection();
+    p->PlayInListEvent(newlist);
+}
+
 static void remove_pop(GTKMusicBrowser *p, guint action, GtkWidget *w)
 {
     p->DeleteEvent();
@@ -1636,6 +1642,7 @@
     GtkItemFactoryEntry track_items[] = {
      {"/Add to Playlist",NULL,  (void(*)(...))add_pop,  0, 0 },
      {"/Add and Play Now",NULL, (void(*)(...))add_play_pop,   0, 0 },
+     {"/Play in Playlist",NULL, (void(*)(...))play_in_list_pop, 0, 0 },
      {"/sep1",         NULL,    0,                        0, "<Separator>" },
      {"/Remove",       NULL,    (void(*)(...))remove_pop,     0, 0 },
      {"/sep2",         NULL,    0,                        0, "<Separator>" },
Index: ui/musicbrowser/unix/src/gtkmusicbrowser.cpp
===================================================================
RCS file: /src/repository/freeamp/ui/musicbrowser/unix/src/gtkmusicbrowser.cpp,v
retrieving revision 1.118
diff -u -r1.118 gtkmusicbrowser.cpp
--- ui/musicbrowser/unix/src/gtkmusicbrowser.cpp        2000/10/02 08:17:46     1.118
+++ ui/musicbrowser/unix/src/gtkmusicbrowser.cpp        2000/10/03 16:38:17
@@ -1335,6 +1335,45 @@
     }
 }
 
+void GTKMusicBrowser::PlayInListEvent(vector<PlaylistItem *> *newlist)
+{
+    if (!newlist)
+        return;
+    if (0<=newlist->size())
+    {
+        // save the first song that was passed
+        vector<PlaylistItem *>::iterator item=newlist->begin();
+        string firsturl;
+        if (*item)
+        {
+            firsturl=(*item)->URL();
+        }
+        // remove items in newlist that exist in the playlist
+        for (; item != newlist->end(); )
+        {
+            if (*item)
+            {
+                if (kInvalidIndex != m_plm->IndexOfURL((*item)->URL()))
+                {
+                    item=newlist->erase(item);
+                }
+                else
+                {
+                    ++item;
+                }
+            }
+        }
+        // add remaining items in newlist to the end of the playlist
+        if (0<=newlist->size())
+        {
+            AddTracksPlaylistEvent(newlist, true, false, true);
+        }
+        // play first song that was passed
+        m_lastindex=m_plm->IndexOfURL(firsturl);
+        PlayEvent();
+    }
+}
+
 void GTKMusicBrowser::AddTracksDoubleClick(vector<PlaylistItem *> *newlist)
 {
     bool playNow = false;

Reply via email to