Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: find if the selection comes from the playlist? (Read 2454 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

find if the selection comes from the playlist?

hi,

I have a plugin programming question. I am the author of foo_Delete.

I noticed that in the database search window, etc., Delete appears as an option on the context menu. But if you click it, it doesn't know you didn't click from the playlist, and reshuffles the playlist around, even though it deletes the correct file.

How can I tell what view the right-click was made from?

Or even better, tell whether the clicked song is part of the visible (or any?) playlist or not?

Suggestions on how to best implement this from a user perspective would also be appreciated.

http://pelit.koillismaa.fi/plugins/general.php#68

Thanks

Evan

find if the selection comes from the playlist?

Reply #1
You'll want to pay attention to the caller value passed to your menu item functions.

Of course, at this point, it's not supposed to be possible to actuate the context menu items on any playlist other than the visible one, so you won't be able to prune the deleted tracks from any of the other lists.

find if the selection comes from the playlist?

Reply #2
which parameter is that? i assume it lives in one of the following:

virtual bool context_get_display(unsigned n,const ptr_list_base<metadb_handle> & data,string_base & out,unsigned&,const GUID&) {}
   
virtual void context_command(unsigned n,const ptr_list_base<metadb_handle> & data,const GUID& my_guid) {}

thanks

is it the unsigned int?

find if the selection comes from the playlist?

Reply #3
Code: [Select]
virtual bool context_get_display(unsigned n, const ptr_list_base<metadb_handle> & data, string_base & out, unsigned & displayflags, const GUID & caller);

virtual void context_command(unsigned n, const ptr_list_base<metadb_handle> & data, const GUID & caller);

It's the caller parameter. Check if this is menu_item::caller_playlist.