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: Programming Question (Read 3004 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Programming Question

Hi,

i'm not a programmer, but i need a statusbar about playmode (random, imprtend 'Stop after current'). Can me help anybody? Thanks

Programming Question

Reply #1
Hi,

 i'm not a programmer, but i need a statusbar about playmode (random, imprtend 'Stop after current'). Can me help anybody? Thanks
if you are using column UI and WSH Panel Mode you may try this for playmode
Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var PlaybackOrder = {
Default: 0,
RepeatPlaylist: 1,
RepeatTrack: 2,
Random: 3,
ShuffleTracks: 4,
ShuffleAlbums: 5,
ShuffleFolders: 6
}
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;

var PlaybackOrderText = new Array(
"Default", // = 0
"Repeat (Playlist)",
"Repeat (Track)",
"Random",
"Shuffle (tracks)",
"Shuffle (albums)",
"Shuffle (folders)") ;

var g_font = gdi.Font("Tahoma", 10, 1);
var g_drag = 0;
var txt = "";
//var bool;
//var  imgl; var imgr; var imgm;
//var ih=24; var iw=104;
var hofset = 4;
var vofset = 2;

window.MinWidth = 20;
on_playback_order_changed(fb.PlaybackOrder);


function on_paint(gr){


gr.SetTextRenderingHint(2);
gr.SetSmoothingMode(2);



gr.FillGradRect(hofset+1, vofset+1, window.Width - 2*hofset - 2, window.Height - 2*vofset - 1, 45, RGB(240,240,226), RGB(192,192,192));

gr.DrawRoundRect(hofset+1, vofset+1, window.Width - 2*hofset, window.Height - 2*vofset, 3, 3, 1, RGB(255,255,255));
gr.DrawRoundRect(hofset, vofset, window.Width - 2*hofset, window.Height - 2*vofset, 3, 3, 1, RGB(128,128,128));


gr.GdiDrawText(txt, g_font, RGB(255,255,255), hofset+3, vofset+2, window.Width - 2*hofset - 2, window.Height - 2*vofset - 1, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(txt, g_font, RGB(0,0,0), hofset+2, vofset+1, window.Width - 2*hofset - 2, window.Height - 2*vofset - 1, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}

function on_mouse_wheel(delta){
if(delta>0) {if (fb.PlaybackOrder==6) fb.PlaybackOrder=0;
else fb.PlaybackOrder= fb.PlaybackOrder+1;}

else
{if (fb.PlaybackOrder==0) fb.PlaybackOrder=6;
else fb.PlaybackOrder= fb.PlaybackOrder-1;}


}
function on_mouse_lbtn_up(x,y){

if (fb.PlaybackOrder==0) fb.PlaybackOrder=4;
else fb.PlaybackOrder= 0;

// fb.trace("order="+fb.PlaybackOrder)

g_drag = 0;
}
function on_playback_order_changed(new_order_index) {
txt = PlaybackOrderText[fb.PlaybackOrder];

window.Repaint();
}
//EOF
and this for stop after current
Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_drag = 0;
var imgname;
var img;
var g_tooltip = window.CreateTooltip();
function on_init(bool) {
imgname =bool  ?  "sac.png" : "playing.png";
g_tooltip.Text =  bool  ?    "Stop after Current" : "Reset stop";
img = gdi.image(fb.FoobarPath + "Images\\" + imgname);
window.Repaint();
};
window.MinWidth = 25;
on_init(fb.StopAfterCurrent);

function on_paint(gr){

gr.DrawImage(img, 4, 2, 21, 20, 0, 0, 21 , 20);
/*
gr.DrawLine(0, 2, 19, 2, 1, RGB(255,255,255));
gr.DrawLine(0, 2, 0,18, 1, RGB(255,255,255));
gr.DrawLine(1, 20, 12, 20, 1, RGB(128,128,128));
gr.DrawLine(20, 3, 20, 14, 1, RGB(128,128,128));
*/
}

function on_mouse_move(x, y) {

if (g_drag==0) {
on_init(!fb.StopAfterCurrent);
g_drag = 1;
}
g_tooltip.Activate();
}
function on_mouse_leave() {
if (g_drag==1) {

on_init(fb.StopAfterCurrent);
g_drag = 0;
}
g_tooltip.Deactivate();
}
function on_mouse_lbtn_up(x,y){

fb.StopAfterCurrent = !fb.StopAfterCurrent;
window.Repaint();

// g_drag = 0;
}


function on_playlist_stop_after_current_changed(state) {on_init(fb.StopAfterCurrent);}

//EOF
note that you will need sac.png and playing.png to be placed in foobar/images directory

Programming Question

Reply #2
Hi,
thank you for this fast answer. But where i can get the images (sac.png, playing.png)?

Programming Question

Reply #3
Here:
and here ...

Programming Question

Reply #4
Thank You so mutch. I have a last question:
What i do with the script? i have searched and looked and found no help about this...

 

Programming Question

Reply #5
ok, i found it myself and it works fine! Thank you again.
Close.
Knut