Hi, i was wondering if it was possible to have in a single WSH panel, multiple buttons which a different right click menu for each one?
Anyway i have modified a code found on this thread to suit my need but i have a problem with it. When starting foobar, it doesnt paint itself, i have to go into its onfiguraiton and hit apply. Any idea why?
Thanks
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
// Flags, used by Menu
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;
// Window
var hofset=8;
var ww = window.Width - 2*hofset;
var wh = window.Height;
// Track info
var g_metadb;
var txt_firstline = "%title%";
var txt_secondline = "%album%";
var txt_thirdline = "%artist%";
var g_font_title = gdi.Font("Segoe UI", 17, 0);
var g_font_other = gdi.Font("Segoe UI", 14, 0);
var lineheight = 24
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;
var tcol=RGB(0,0,0); //text color
var t2col=RGB(60,60,60); //text color 2
var pcol=RGB(40,40,40); //text(Paused) Color
var scol=RGB(255,255,255);//shadow color
on_playback_new_track();
function on_paint(gr){
//gr.FillSolidRect(0,0, window.Width, window.Height, bcol);
if (g_metadb) {
gr.GdiDrawText(fb.TitleFormat(txt_firstline).EvalWithMetadb(g_metadb), g_font_title, (fb.IsPaused ? pcol : tcol), 2, 0, ww- 2, lineheight, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
gr.GdiDrawText(fb.TitleFormat(txt_secondline).EvalWithMetadb(g_metadb), g_font_other, (fb.IsPaused ? pcol : t2col), 2, lineheight, ww- 2, lineheight, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
gr.GdiDrawText(fb.TitleFormat(txt_thirdline).EvalWithMetadb(g_metadb), g_font_other, (fb.IsPaused ? pcol : t2col), 2, lineheight*2, ww- 2, lineheight, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
}
}
function on_size() {
// ww = window.Width - 2*hofset;
// wh = window.Height;
}
function on_mouse_wheel(delta){
}
function on_mouse_lbtn_up(x,y){
}
function on_playback_new_track(metadb) {
//zidx = 0;
g_metadb = fb.GetNowPlaying();
//if (g_metadb) {txt = fb.TitleFormat(z_txt[zidx]).EvalWithMetadb(g_metadb);}
window.Repaint();
}
// state = true when paused, false when resumed
function on_playback_pause(state) {
window.Repaint();
}
// reason: (integer, begin with 0): user, eof, starting_another, shutting_down
function on_playback_stop(reason) {
//txt = "";
window.Repaint();
}
// cmd: (integer, begin with 0): default, play, next, prev, settrack, rand, resume
function on_playback_starting(cmd, is_paused) {g_metadb = fb.GetNowPlaying();}
//EOF