For those who are interested, here is a new version of my components :
Volume bar:Don't forget to place this image in your foobar\images directory : function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;
var ww;
var hofset = 10;
var wh = 5;
var ih=16; var iw=9;
var vofset;
var grad;
function on_paint(gr){
grad = Math.pow((100+fb.Volume)/100,2);
vofset = (window.Height-wh)/2;
ww = window.Width - 2*hofset;
gr.FillGradRect(hofset+1,vofset, ww*grad, wh, 90, (grad<=0) ? RGB(32,32,92) : RGB(32+128*grad,164*(1-grad),32*(1-grad)), RGB(255,255,255));
gr.FillGradRect(hofset+ww*grad+1,vofset, ww*(1-grad)-1,wh, 90, RGB(92,92,92), RGB(255,255,255));
gr.DrawRect(hofset,vofset, ww, wh+1, 1, RGB(192,192,192));
img = gdi.image(fb.FoobarPath + "Images\\Volume.png");
gr.DrawImage(img, hofset+ww*grad-iw/2, (window.Height-ih)/2, iw, ih, 0, 0,iw, ih);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var v = (x-hofset)/ww;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = 100 * (Math.pow(v,1/2) - 1);
fb.Volume = v;
}
}
function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}
function on_volume_change(val){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
//EOF
SeekbarDon't forget to place these images in your foobar\images directory : function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;
//var ww = 340;
var hofset = 12;
var is = 14;
var wh = 4;
var vofset;
var length;
var grad;
var col = RGB(24,24,92);
var img = gdi.image(fb.FoobarPath + "Images\\Cursor.png");
function on_paint(gr){
vofset = (window.Height-wh)/2;
ww = window.Width - 2*hofset;
// fb.trace("ww="+ww);
length = fb.PlaybackLength;
grad = 0;
if (length > 0) grad = fb.PlaybackTime/fb.PlaybackLength;
gr.FillGradRect(hofset+1,vofset, ww*grad, wh, 90, col, RGB(255,255,255));
gr.FillGradRect(hofset+ww*grad+1,vofset, ww*(1-grad)-1,wh, 90, RGB(92,92,92), RGB(255,255,255));
gr.DrawRect(hofset,vofset, ww, wh+1, 1, RGB(192,192,192));
gr.DrawImage(img, hofset+ww*grad-is/2, (window.Height-is)/2, is, is, 0, 0,is, is);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var v = (x-hofset)/ww;
v = (v<0) ? 0 : (v<1) ? v : 1;
fb.PlaybackTime = fb.PlaybackLength * v;
}
}
function on_mouse_wheel(delta){
if(delta>0)
fb.PlaybackTime = fb.PlaybackTime + delta;
else
fb.PlaybackTime = fb.PlaybackTime + delta;
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
img = gdi.image(fb.FoobarPath + "Images\\Cursor" +".png");
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
function on_playback_pause(state) {
img = gdi.image(fb.FoobarPath + "Images\\Cursor" + (state ? "-paused" : "") +".png");
col = state ? RGB(24,24,24) : RGB(24,24,92);
window.Repaint();
}
@TP Wang: Could it be possible to have a function for displayong tooltips ?
[blockquote][blockquote]Many thanks.
[/blockquote][/blockquote]