Most likely the error is somewhere in foo_uie_trackinfo.cpp in void uie_trackinfo::on_item_focus_change, but I cannot tell exactly. I'm not into c and pointers...
I took a look at the code, and at album art's code. It seems that foo_uie_albumart has additional handlers for actions like playlist changed, but also adding/removing items in current playlist. I guess it could be a good idea to put this code in separate file and share between plugins.
Anyway, for starters I tried implementing playlist change handler. I (think I) did it, but then noticed that Visual Studio 2003 is not enough to compile, and I can't really upgrade to 2005 now...
So if someone has VS2005 and too much free time, this patch should work (but there may be some "spelling" mistakes - I had no chance to check):
diff -x ps.diff -u ..\src_trackinfo.orig/foo_uie_trackinfo.cpp ./foo_uie_trackinfo.cpp
--- ..\src_trackinfo.orig/foo_uie_trackinfo.cpp 2006-05-03 17:21:32.000000000 +0200
+++ ./foo_uie_trackinfo.cpp 2006-06-16 23:48:21.656250000 +0200
@@ -485,7 +485,7 @@
static_api_ptr_t<play_callback_manager>()->register_callback(this, flag_on_playback_new_track|
flag_on_playback_stop|flag_on_playback_pause|flag_on_playback_dynamic_info_track|flag_on_playback_ti
me, true);
- static_api_ptr_t<playlist_manager>()->register_callback(this, flag_on_item_focus_change);
+ static_api_ptr_t<playlist_manager>()->register_callback(this, flag_on_item_focus_change|flag_on_playlist_switch);
// Can't just call reset_scroll_timer here, dialog is not set yet. :/
scroll_pos = -1.0;
@@ -684,6 +684,26 @@
}
}
+void uie_trackinfo::on_playlist_switch()
+{
+ static_api_ptr_t<playlist_manager> t;
+ t_size focus_track = t->activeplaylist_get_focus_item();
+ if (focus_track == infinite)
+ focus_track = 0;
+
+ metadb_handle_ptr f;
+ if (t->activeplaylist_get_item_handle(f, focus_track))
+ {
+ set_handle(focused,f);
+ if (config.displaymode == DISPLAYMODE_FOCUSED)
+ {
+ display_top = 0;
+ reset_scroll_timer();
+ redraw();
+ }
+ }
+}
+
void uie_trackinfo::on_playback_new_track(metadb_handle_ptr p_track)
{
set_handle(now_playing,p_track);
diff -x ps.diff -u ..\src_trackinfo.orig/foo_uie_trackinfo.h ./foo_uie_trackinfo.h
--- ..\src_trackinfo.orig/foo_uie_trackinfo.h 2006-04-29 22:35:28.000000000 +0200
+++ ./foo_uie_trackinfo.h 2006-06-16 00:03:55.609375000 +0200
@@ -145,7 +145,7 @@
virtual void on_items_modified_fromplayback(const bit_array & p_mask,play_control::t_display_level p_level) {}
virtual void on_items_replaced(const bit_array & p_mask,const pfc::list_base_const_t<playlist_callback::t_on_items_replaced_entry> & p_data) {}
virtual void on_item_ensure_visible(t_size p_idx) {}
- virtual void on_playlist_switch() {}
+ virtual void on_playlist_switch();
virtual void on_playlist_renamed(const char * p_new_name,t_size p_new_name_len) {}
virtual void on_playlist_locked(bool p_locked) {}
virtual void on_default_format_changed() {}