Список разделов › foobar2000 › Есть вопрос!
// ==PREPROCESSOR==
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var font = gdi.Font("Arial",12,1);
var ww,wh;
ColorTypeCUI = { background: 3,};
var bgcolor = window.GetColorCUI(ColorTypeCUI.background);
DT_LEFT = 0x00000000;
DT_RIGHT = 0x00000002;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_WORD_ELLIPSIS = 0x00040000;
var set_time = 0;
var s_play = 0;
function on_paint(gr){
// !window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, RGB(50,50,50));
gr.FillSolidRect (0, 0, ww, wh, s_play > 0 && s_play <= 3 ? RGB(0,70,0) : RGB(50,50,50));
gr.GdiDrawText(sec2time(s_play), font, RGB(255,255,240), 0, 0, ww, wh, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_WORD_ELLIPSIS );
}
function timer_play() {
window.ClearInterval(timer);
var timer = window.SetInterval(function() {
s_play = s_play - 1;
window.Repaint();
if (s_play <= 0) {
window.ClearInterval(timer); s_play = 0; set_time = 0;
if (!fb.IsPlaying || fb.IsPaused) fb.Play();
};
}, 1000 );
}
function sec2time(sec) {
var h,m,s;
h = Math.floor(sec/3600);
m = Math.floor((sec-h*3600)/60);
s = sec - h*3600 - m*60;
if (m<10 && h!=0) m = "0" + m;
if (s<10) s = "0" + s;
return (h==0 ? "" : h+":") + m + ":" + s;
}
function on_mouse_lbtn_up (x, y){
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
var _menu = window.CreatePopupMenu();
var i = 1;
MF_STATE = set_time == 0 ? MF_GRAYED : MF_ENABLED;
_menu.AppendMenuItem(MF_STATE, i++, sec2time(set_time));
_menu.AppendMenuItem(0x00000800, 0, 0);
_menu.AppendMenuItem(0x00000000, i++, "increase time");
_menu.AppendMenuItem(0x00000000, i++, "decrease time");
_menu.AppendMenuItem(0x00000800, 0, 0);
_menu.AppendMenuItem(0x00000000, i++, "exit");
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
ret = _menu.TrackPopupMenu(x, y);
if (ret == 0) return;
switch (ret) {
case 1:
if (set_time > 0) {s_play = set_time; window.Repaint(); timer_play()};
break;
case 2:
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
set_time = set_time + (ShiftDown ? 10 : 1);
on_mouse_lbtn_up (x, y);
break;
case 3:
ShiftDown = utils.IsKeyPressed(0x10) ? true : false;
set_time = set_time <= 0 ? 0 : set_time - (ShiftDown ? 10 : 1);
on_mouse_lbtn_up(x,y);
break;
case 4:
break;
}
_menu.Dispose();
set_time = 0;
}
function on_mouse_move(x, y) {
on_mouse = true;
window.SetCursor(32649);
window.Repaint();
}
function on_mouse_leave() {
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_size(){
ww = window.Width;
wh = window.Height;
}