Это не сложно. Жаль нет времени.Воронин:В папке должен быть один аудиофайл и несколько картинок. Картинки назывались 0-00, скажем 0-35, 1-20 , то есть минуты, секунды
Список разделов › foobar2000 › Секреты foobar2000
Это не сложно. Жаль нет времени.Воронин:В папке должен быть один аудиофайл и несколько картинок. Картинки назывались 0-00, скажем 0-35, 1-20 , то есть минуты, секунды
//WSH Seekbar
// For DarkOne v3.1
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
MF_SEPARATOR = 0x00000800;
MF_STRING = 0x00000000;
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("DarkOne", 19, 0);
var g_font1 = gdi.Font("Arial Black", 7, 0);
var ui_type = window.InstanceType;
var g_drag = 0;
var g_drag_seek = 0;
var v_change = false;
var v_timer = null;
var percent = fb.TitleFormat("$max(0,$left($muldiv(%playback_time_seconds%,1000,%length_seconds%),$sub($len($muldiv(%playback_time_seconds%,1000,%length_seconds%)),1)))'.'$right($muldiv(%playback_time_seconds%,1000,%length_seconds%),1)'%' $if(%ispaused%,\u258c,\u25ba)");
var playtime = fb.TitleFormat("%playback_time%");
var length = fb.TitleFormat("%length%");
var timeremain = fb.TitleFormat("%playback_time_remaining%");
get_color();
function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var txt;
var txt1;
var txt2;
var txt3;
var txt4;
var pos = 0;
var color_rgb = fb.PlaybackLength <= 0 ? back_rgb : ui_btntxtcol;
// var color2_rgb = fb.PlaybackLength <= 0 ? back_rgb : back2_rgb;
// var color3_rgb = fb.PlaybackLength <= 0 ? back2_rgb : font_rgb;
if(fb.PlaybackTime > 0){
if(g_drag){
pos = ww * g_drag_seek;
txt4 = "<< " + TimeFmt(g_drag_seek * fb.PlaybackLength) + " / " + TimeFmt(fb.PlaybackLength) + " >>";
}
else{
pos = ww * (fb.PlaybackTime / fb.PlaybackLength);
txt = percent.Eval();
txt1 = playtime.Eval();
txt2 = length.Eval();
txt3 = timeremain.Eval();
}
}else
{
txt4 = " PLAYBACK STOPPED ";
}
String.prototype.repeat = function(n) {return new Array(n + 1).join(this);}
gr.FillSolidRect (0, 0, ww, wh, ui_backcol);
gr.GdiDrawText("\u2598".repeat(30), g_font, back_rgb, 0, 0, ww, wh);
gr.GdiDrawText("\u2589".repeat(30), g_font, back_rgb, 0, 12, ww, wh);
gr.GdiDrawText("|".repeat(110), g_font, back2_rgb, 0, -14, ww, wh);
gr.GdiDrawText("|".repeat(110), g_font, font_rgb, 0, -14, pos, wh);
// gr.GdiDrawText("\u2589".repeat(30), g_font, font_rgb, 0, 12, pos, wh);
// gr.GdiDrawText("———".repeat(20), g_font, font_rgb, -30, 4, pos, wh);
gr.GdiDrawText("—", g_font, peak_rgb, pos - 10, 0, ww + pos, wh);
// ======SYMBOL======= // \u25CF , \u25A1 , \u25A0 //
// gr.GdiDrawText("\u25A0".repeat(66), g_font, back2_rgb, 0, -6, ww, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, back2_rgb, 0, 4, ww, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, back2_rgb, 0, 14, ww, wh);
// gr.GdiDrawText("\u25A0".repeat(66), g_font, font_rgb, 0, -6, pos, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, font_rgb, 0, 4, pos, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, font_rgb, 0, 14, pos, wh);
gr.GdiDrawText( "PERCENT", g_font1, color_rgb, 0, 30, ww, wh, DT_LEFT | DT_SINGLELINE);
gr.GdiDrawText( "ELAPSED", g_font1, v_change ? back_rgb : color_rgb, -ww/7.5, 30, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( "TIME", g_font1, v_change ? back_rgb : color_rgb, ww/7, 30, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( "REMAIN", g_font1, v_change ? back_rgb : color_rgb, 0, 30, ww, wh, DT_RIGHT | DT_SINGLELINE);
gr.GdiDrawText("\u2589".repeat(30), g_font, back_rgb, 0, 37, ww, wh);
gr.GdiDrawText( txt, g_font, font_rgb, 0, 37, ww, wh, DT_LEFT | DT_SINGLELINE);
if (v_change) gr.GdiDrawText("Volume " + fb.Volume.toFixed(2) + " dB", g_font, font_rgb, 0, 37, ww, wh, DT_RIGHT | DT_SINGLELINE);
else {
gr.GdiDrawText( txt1, g_font, font_rgb, -ww/7.5, 37, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( txt2, g_font, font_rgb, ww/7.5, 37, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( txt3, g_font, font_rgb, 0, 37, ww, wh, DT_RIGHT | DT_SINGLELINE);
gr.GdiDrawText( txt4, g_font, font_rgb, 0, 37, ww, wh, DT_CENTER | DT_SINGLELINE);
}
}
// ========MENU======== //
function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
_menu.AppendMenuItem(MF_STRING, 1, "Default");
_menu.AppendMenuItem(MF_STRING, 2, "Blue");
_menu.AppendMenuItem(MF_STRING, 3, "Green");
_menu.AppendMenuItem(MF_STRING, 4, "Red");
_menu.AppendMenuItem(MF_STRING, 5, "White");
_menu.AppendMenuItem(MF_STRING, 6, "Yellow")
_menu.AppendMenuItem(MF_STRING, 7, "Grey")
_menu.CheckMenuRadioItem(1, 7, window.GetProperty("Color", 1));
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0)
_menu.AppendMenuItem(MF_STRING, 8, "Properties...");
_menu.AppendMenuItem(MF_STRING, 9, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch (idx) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
ch_color(idx);
break;
case 8:
window.ShowProperties();
break;
case 9:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true
}
//=======================//
var font_rgb, back_rgb, back2_rgb, peak_rgb;
function get_color() {
ui_backcol = ui_type == 0 ? window.GetColorCUI(3) : window.GetColorDUI(1);
ui_textcol = ui_type == 0 ? window.GetColorCUI(0) : window.GetColorDUI(0);
ui_btntxtcol = ui_type == 0 ? window.GetColorCUI(2) : window.GetColorDUI(0);
if (window.GetProperty("Color") == 1) font_rgb = RGB(191,228,255), back_rgb = RGB(31,44,53), back2_rgb = RGB(57,68,76), peak_rgb = RGB(255,0,0); //Default
if (window.GetProperty("Color") == 2) font_rgb = RGB(115,173,229), back_rgb = RGB(28,44,55), back2_rgb = RGB(40,60,79), peak_rgb = RGB(255,0,0); //Blue = RGB(128,192,255) ; Blue2 = RGB(115,173,229)
if (window.GetProperty("Color") == 3) font_rgb = RGB(0,255,0), back_rgb = RGB(18,46,35), back2_rgb = RGB(5,80,5), peak_rgb = RGB(255,0,0); //Green
if (window.GetProperty("Color") == 4) font_rgb = RGB(255,0,0), back_rgb = RGB(40,27,35), back2_rgb = RGB(95,5,5), peak_rgb = RGB(255,255,255); //Red
if (window.GetProperty("Color") == 5) font_rgb = RGB(255,255,255), back_rgb = RGB(36,46,53), back2_rgb = RGB(91,91,91), peak_rgb = RGB(255,0,0); //White
if (window.GetProperty("Color") == 6) font_rgb = RGB(255,255,0), back_rgb = RGB(36,46,35), back2_rgb = RGB(95,95,5), peak_rgb = RGB(255,0,0); //Yellow
if (window.GetProperty("Color") == 7) font_rgb = RGB(63,100,127), back_rgb = RGB(28,44,55), back2_rgb = RGB(38,61,76), peak_rgb = RGB(255,0,0); //Grey
}
function getRed(color) {
return ((color >> 16) & 0xff);
}
function getGreen(color) {
return ((color >> 8) & 0xff);
}
function getBlue(color) {
return (color & 0xff);
}
var g_timer;
function ch_color(idx) {
get_color();
old_R = getRed(font_rgb);
old_G = getGreen(font_rgb);
old_B = getBlue(font_rgb);
window.SetProperty("Color", idx);
get_color();
new_R = getRed(font_rgb);
new_G = getGreen(font_rgb);
new_B = getBlue(font_rgb);
step_R = (new_R - old_R)/255; step_G = (new_G - old_G)/255; step_B = (new_B - old_B)/255;
g_timer = window.SetInterval(function() {
old_R = old_R + step_R; old_G = old_G + step_G; old_B = old_B + step_B;
R = old_R; G = old_G; B = old_B;
font_rgb = RGB(R,G,B)
window.Repaint();
if (
step_R < 0 && R <= new_R || step_G < 0 && G <= new_G || step_B < 0 && B <= new_B ||
step_R > 0 && R >= new_R || step_G > 0 && G >= new_G || step_B > 0 && B >= new_B
) {window.ClearInterval(g_timer); R = new_R; G = new_G; B = new_B; font_rgb = RGB(R,G,B)};
}, 5);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
if(g_drag){
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
}
function on_mouse_move(x,y){
if(g_drag){
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
}
function on_mouse_wheel(step) {
fb.PlaybackTime += step;
}
function on_playback_seek(time) {
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
var seek_timer;
function on_playback_time(time){
seek_timer && window.ClearInterval(seek_timer);
seek_timer = window.SetInterval(function() {
window.Repaint();
}, 50 );
}
function on_playback_stop() {
window.ClearInterval(seek_timer);
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_starting(cmd, paused){
window.Repaint();
}
function on_playback_new_track(info){
window.Repaint();
}
function on_volume_change(val) {
var ww = window.Width;
var wh = window.Height;
if (v_timer) {
window.ClearTimeout(v_timer);
v_timer = null;
}
v_timer = window.SetTimeout(
function () {
window.RepaintRect(0, 0, ww, wh, DT_CENTER | DT_SINGLELINE);
window.ClearTimeout(v_timer);
v_timer = null;
v_change = false;
}, 1000);
v_change = true;
window.RepaintRect(0, 0, ww, wh, DT_CENTER | DT_SINGLELINE);
}
//EOF
По большей части копировать и передвигать строки, заниматься дизайном. Нудная, занимающая много времени работа. Приблизительно всё что я привёл ниже(со скрипта своей сборки):TaoZuiyin:Что делать
gr.GdiDrawText("\u2598".repeat(30), g_font, back_rgb, 0, 0, ww, wh);
gr.GdiDrawText("\u2589".repeat(30), g_font, back_rgb, 0, 12, ww, wh);
gr.GdiDrawText("|".repeat(110), g_font, back2_rgb, 0, -14, ww, wh);
gr.GdiDrawText("|".repeat(110), g_font, font_rgb, 0, -14, pos, wh);
// gr.GdiDrawText("\u2589".repeat(30), g_font, font_rgb, 0, 12, pos, wh);
// gr.GdiDrawText("———".repeat(20), g_font, font_rgb, -30, 4, pos, wh);
gr.GdiDrawText("—", g_font, peak_rgb, pos - 10, 0, ww + pos, wh);
// ======SYMBOL======= // \u25CF , \u25A1 , \u25A0 //
// gr.GdiDrawText("\u25A0".repeat(66), g_font, back2_rgb, 0, -6, ww, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, back2_rgb, 0, 4, ww, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, back2_rgb, 0, 14, ww, wh);
// gr.GdiDrawText("\u25A0".repeat(66), g_font, font_rgb, 0, -6, pos, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, font_rgb, 0, 4, pos, wh);
gr.GdiDrawText("\u25A0".repeat(66), g_font, font_rgb, 0, 14, pos, wh);
gr.GdiDrawText( "PERCENT", g_font1, g_drag? back_rgb : color_rgb, 0, 30, ww, wh, DT_LEFT | DT_SINGLELINE);
gr.GdiDrawText( "ELAPSED", g_font1, v_change ? back_rgb : color_rgb, - Math.round(ww/7.5), 30, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( "TIME", g_font1, v_change ? back_rgb : color_rgb, Math.round(ww/7.5), 30, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( "REMAIN", g_font1, v_change || g_drag ? back_rgb : color_rgb, 0, 30, ww, wh, DT_RIGHT | DT_SINGLELINE);
gr.GdiDrawText("\u2589".repeat(30), g_font, back_rgb, 0, 38, ww, wh);
gr.GdiDrawText( txt, g_font, font_rgb, 0, 38, ww, wh, DT_LEFT | DT_SINGLELINE);
if (v_change) gr.GdiDrawText("Volume " + fb.Volume.toFixed(2) + " dB", g_font, font_rgb, 0, 38, ww, wh, DT_RIGHT | DT_SINGLELINE);
else {
gr.GdiDrawText( txt1, g_font, font_rgb, - Math.round(ww/7.5), 38, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( txt2, g_font, font_rgb, Math.round(ww/7.5), 38, ww, wh, DT_CENTER | DT_SINGLELINE);
gr.GdiDrawText( txt3, g_font, font_rgb, 0, 38, ww, wh, DT_RIGHT | DT_SINGLELINE);
gr.GdiDrawText( txt4, g_font, font_rgb, 0, 38, ww, wh, DT_CENTER | DT_SINGLELINE);
}
gr.GdiDrawText("|".repeat(110), g_font, back2_rgb, 0, -14, ww, wh);
gr.GdiDrawText("|".repeat(110), g_font, font_rgb, 0, -14, pos, wh);
sw = gr.CalcTextWidth("|", g_font);
s_per_ww = Math.round(ww / sw);
gr.GdiDrawText("|".repeat(s_per_ww), g_font, back2_rgb, 0, -14, ww, wh);
gr.GdiDrawText("|".repeat(s_per_ww), g_font, font_rgb, 0, -14, pos, wh);
Нет. В смысле без него.SergPuh.68:Можно ли как то ограничить изменение размеров проигрывателя например до минимальных 640х320 пикселей при помощи JScript как это может делать компонент foo_ui_hacks ?
Есть библиотеки, которые позволяют менять размеры окна с помощью JScript, но и они требуют наличие foo_ui_hacksSergPuh.68:при помощи JScript как это может делать компонент foo_ui_hacks ?
var im = fb.ProfilePath + "images\\";
function RGBA(r,g,b,a) {
return ((a<<24)|(r<<16)|(g<<8)|(b));
}
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}
function on_paint(gr) {
ww = window.Width;
wh = window.Height;
gr.FillSolidRect(0, 0, ww, wh, RGB(101, 101, 101));
gr.FillSolidRect(1, 1, ww-2, wh-2, RGB(31, 31, 31));
}
function on_size() {
ww = window.Width;
wh = window.Height;
move_buttons();
}
window.HandOnButtons = true;
var ButtonRating1 = window.CreateButton(0, 0, [im+"rating.png", im+"rating_push.png"], [im+"rating_push.png", im+"rating_push.png"]);
ButtonRating1.Width = 24;
ButtonRating1.Height = 24;
var ButtonRating2 = window.CreateButton(0, 0, [im+"rating.png", im+"rating_push.png"], [im+"rating_push.png", im+"rating_push.png"]);
ButtonRating2.Width = 24;
ButtonRating2.Height = 24;
var ButtonRating3 = window.CreateButton(0, 0, [im+"rating.png", im+"rating_push.png"], [im+"rating_push.png", im+"rating_push.png"]);
ButtonRating3.Width = 24;
ButtonRating3.Height = 24;
var ButtonRating4 = window.CreateButton(0, 0, [im+"rating.png", im+"rating_push.png"], [im+"rating_push.png", im+"rating_push.png"]);
ButtonRating4.Width = 24;
ButtonRating4.Height = 24;
var ButtonRating5 = window.CreateButton(0, 0, [im+"rating.png", im+"rating_push.png"], [im+"rating_push.png", im+"rating_push.png"]);
ButtonRating5.Width = 24;
ButtonRating5.Height = 24;
function move_buttons() {
ww = window.Width;
wh = window.Height;
ButtonRating1.Move(ww/2-60, wh/2-12);
ButtonRating2.Move(ww/2-36, wh/2-12);
ButtonRating3.Move(ww/2-12, wh/2-12);
ButtonRating4.Move(ww/2+12, wh/2-12);
ButtonRating5.Move(ww/2+36, wh/2-12);
}
function on_button_click(id) {
switch(id)
{
case ButtonRating1.ID:
if(ButtonRating1.State == 1) {
fb.RunContextCommand("Playback Statistics/Rating/1");
ButtonRating1.State = 1;
} else {
fb.RunContextCommand("Playback Statistics/Rating/<not set>");
ButtonRating1.State = 0;
}
ButtonRating2.State = 0;
ButtonRating3.State = 0;
ButtonRating4.State = 0;
ButtonRating5.State = 0;
break;
case ButtonRating2.ID:
fb.RunContextCommand("Playback Statistics/Rating/2");
ButtonRating1.State = 1;
ButtonRating2.State = 1;
ButtonRating3.State = 0;
ButtonRating4.State = 0;
ButtonRating5.State = 0;
break;
case ButtonRating3.ID:
fb.RunContextCommand("Playback Statistics/Rating/3");
ButtonRating1.State = 1;
ButtonRating2.State = 1;
ButtonRating3.State = 1;
ButtonRating4.State = 0;
ButtonRating5.State = 0;
break;
case ButtonRating4.ID:
fb.RunContextCommand("Playback Statistics/Rating/4");
ButtonRating1.State = 1;
ButtonRating2.State = 1;
ButtonRating3.State = 1;
ButtonRating4.State = 1;
ButtonRating5.State = 0;
break;
case ButtonRating5.ID:
fb.RunContextCommand("Playback Statistics/Rating/5");
ButtonRating1.State = 1;
ButtonRating2.State = 1;
ButtonRating3.State = 1;
ButtonRating4.State = 1;
ButtonRating5.State = 1;
break;
default:
break;
}
}
function on_item_focus_change() {
ButtonRating1.State = 0;
ButtonRating2.State = 0;
ButtonRating3.State = 0;
ButtonRating4.State = 0;
ButtonRating5.State = 0;
window.Repaint();
}
function on_playback_new_track() {
ButtonRating1.State = 0;
ButtonRating2.State = 0;
ButtonRating3.State = 0;
ButtonRating4.State = 0;
ButtonRating5.State = 0;
window.Repaint();
}
function on_playback_stop(reason) {
ButtonRating1.State = 0;
ButtonRating2.State = 0;
ButtonRating3.State = 0;
ButtonRating4.State = 0;
ButtonRating5.State = 0;
window.Repaint();
}
Ну как бы решаемо. Надо подумать на эту тему... К сожалению без программирования своего компонента тут не обойтись.SergPuh.68:Прям камень преткновения какой то
В смысле библиотеки?) Это и есть foo_uie_wsh_panel_mod, foo_jscript_panel и foo_spider_monkey_panel... у UI Hacks есть апи для этого и они могут его дергать, если речь идет именно о том, о чем говорит SergPuh.68. А на лету положение и размеры это немного другое.kgena_ua:Есть библиотеки, которые позволяют менять размеры окна с помощью JScript
//Additional libraries initialisation script by Zin-Uru, 2010
//Version 1.5.2, 15.01.2011
var lib_path = fb.FoobarPath + "assemblies\\";
var autoItX3, dynwrapx;
var libs_exist = utils.FileTest(lib_path + "AutoItX3.dll","e") && utils.FileTest(lib_path + "dynwrapx.dll","e");
var loaded = true;
function init_special_libraries(force) { //Use force=true if not need to patch foobar2000.exe
var WshShell = new ActiveXObject("WScript.Shell");
var pressed = -1;
if(!libs_exist) {
loaded = false;
return;
}
try {
autoItX3 = new ActiveXObject("AutoItX3.Control");
dynwrapx = new ActiveXObject("DynamicWrapperX");
} catch (e) {
if(force || !window.GetProperty("Show message", true)) {
loaded = false;
return;
} else {
pressed = WshShell.Popup("It seems like libraries not found or you use not patched foobar2000.exe. Do you want to patch it now (recommended)? You can also do that manually with patch.cmd from the foobar2000 folder. Now press OK to go or Cancel to skip (be carefull - this message showed only once).",0,"Notice",33);
if(pressed==1) {
WshShell.run('"' + fb.FoobarPath + 'patch.cmd" run_foo');
fb.RunMainMenuCommand("File/Exit");
} else {
window.SetProperty("Show message", false);
}
loaded = false;
return;
}
}
//Dynwrapx commands registration
dynwrapx.Register("user32.dll", "ReleaseCapture");
dynwrapx.Register("user32.dll", "SendMessage", "i=hlul", "r=l");
dynwrapx.Register("user32.dll", "GetWindowLong", "i=hl", "r=l");
dynwrapx.Register("user32.dll", "SetWindowLong", "i=hll", "r=l");
dynwrapx.Register("user32.dll", "SetLayeredWindowAttributes", "i=hlbu", "r=b");
dynwrapx.Register("user32.dll", "RedrawWindow", "i=huhu", "r=l");
}
//Helper functions
function get_hwnd(interface_name) {
var hwnd;
if(!libs_exist || !loaded) return;
switch (interface_name) {
case "CUI":
hwnd = ("0x" + autoItX3.WinGetHandle("[CLASS:{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}]"))*1;
break;
case "FUI":
hwnd = ("0x" + autoItX3.WinGetHandle("[CLASS:foo_ui_func_window_class]"))*1;
break;
case "DUI":
hwnd = ("0x" + autoItX3.WinGetHandle("[CLASS:{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]"))*1;
break;
default:
hwnd = ("0x" + autoItX3.WinGetHandle(interface_name))*1;
break;
}
return hwnd;
}
function get_pss_hwnd(instance) { //CUI only
if(!libs_exist || !loaded) return;
return ("0x" + autoItX3.ControlGetHandle("[CLASS:{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}]", "", "[CLASS:PSSWindowContainer; INSTANCE:" + instance + "]"))*1;
}
function get_class(interface_name) {
var wclass;
if(!libs_exist || !loaded) return;
switch (interface_name) {
case "CUI":
wclass = "[CLASS:{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}]";
break;
case "FUI":
wclass = "[CLASS:foo_ui_func_window_class]";
break;
case "DUI":
wclass = "[CLASS:{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]";
break;
default:
wclass = interface_name;
break;
}
return wclass;
}
function GDI_RGB(b, g, r) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
function LParam(LoWord, HiWord){
return ((HiWord << 16) | (LoWord & 0xffff));
}
var messages = {
WM_NULL: 0x00,
WM_CREATE: 0x01,
WM_DESTROY: 0x02,
WM_MOVE: 0x03,
WM_SIZE: 0x05,
WM_ACTIVATE: 0x06,
WM_SETFOCUS: 0x07,
WM_KILLFOCUS: 0x08,
WM_ENABLE: 0x0A,
WM_SETREDRAW: 0x0B,
WM_SETTEXT: 0x0C,
WM_GETTEXT: 0x0D,
WM_GETTEXTLENGTH: 0x0E,
WM_PAINT: 0x0F,
WM_CLOSE: 0x10,
WM_QUERYENDSESSION: 0x11,
WM_QUIT: 0x12,
WM_QUERYOPEN: 0x13,
WM_ERASEBKGND: 0x14,
WM_SYSCOLORCHANGE: 0x15,
WM_ENDSESSION: 0x16,
WM_SYSTEMERROR: 0x17,
WM_SHOWWINDOW: 0x18,
WM_CTLCOLOR: 0x19,
WM_WININICHANGE: 0x1A,
WM_SETTINGCHANGE: 0x1A,
WM_DEVMODECHANGE: 0x1B,
WM_ACTIVATEAPP: 0x1C,
WM_FONTCHANGE: 0x1D,
WM_TIMECHANGE: 0x1E,
WM_CANCELMODE: 0x1F,
WM_SETCURSOR: 0x20,
WM_MOUSEACTIVATE: 0x21,
WM_CHILDACTIVATE: 0x22,
WM_QUEUESYNC: 0x23,
WM_GETMINMAXINFO: 0x24,
WM_PAINTICON: 0x26,
WM_ICONERASEBKGND: 0x27,
WM_NEXTDLGCTL: 0x28,
WM_SPOOLERSTATUS: 0x2A,
WM_DRAWITEM: 0x2B,
WM_MEASUREITEM: 0x2C,
WM_DELETEITEM: 0x2D,
WM_VKEYTOITEM: 0x2E,
WM_CHARTOITEM: 0x2F,
WM_SETFONT: 0x30,
WM_GETFONT: 0x31,
WM_SETHOTKEY: 0x32,
WM_GETHOTKEY: 0x33,
WM_QUERYDRAGICON: 0x37,
WM_COMPAREITEM: 0x39,
WM_COMPACTING: 0x41,
WM_WINDOWPOSCHANGING: 0x46,
WM_WINDOWPOSCHANGED: 0x47,
WM_POWER: 0x48,
WM_COPYDATA: 0x4A,
WM_CANCELJOURNAL: 0x4B,
WM_NOTIFY: 0x4E,
WM_INPUTLANGCHANGEREQUEST: 0x50,
WM_INPUTLANGCHANGE: 0x51,
WM_TCARD: 0x52,
WM_HELP: 0x53,
WM_USERCHANGED: 0x54,
WM_NOTIFYFORMAT: 0x55,
WM_CONTEXTMENU: 0x7B,
WM_STYLECHANGING: 0x7C,
WM_STYLECHANGED: 0x7D,
WM_DISPLAYCHANGE: 0x7E,
WM_GETICON: 0x7F,
WM_SETICON: 0x80,
WM_NCCREATE: 0x81,
WM_NCDESTROY: 0x82,
WM_NCCALCSIZE: 0x83,
WM_NCHITTEST: 0x84,
WM_NCPAINT: 0x85,
WM_NCACTIVATE: 0x86,
WM_GETDLGCODE: 0x87,
WM_NCMOUSEMOVE: 0xA0,
WM_NCLBUTTONDOWN: 0xA1,
WM_NCLBUTTONUP: 0xA2,
WM_NCLBUTTONDBLCLK: 0xA3,
WM_NCRBUTTONDOWN: 0xA4,
WM_NCRBUTTONUP: 0xA5,
WM_NCRBUTTONDBLCLK: 0xA6,
WM_NCMBUTTONDOWN: 0xA7,
WM_NCMBUTTONUP: 0xA8,
WM_NCMBUTTONDBLCLK: 0xA9,
WM_KEYFIRST: 0x100,
WM_KEYDOWN: 0x100,
WM_KEYUP: 0x101,
WM_CHAR: 0x102,
WM_DEADCHAR: 0x103,
WM_SYSKEYDOWN: 0x104,
WM_SYSKEYUP: 0x105,
WM_SYSCHAR: 0x106,
WM_SYSDEADCHAR: 0x107,
WM_KEYLAST: 0x108,
WM_IME_STARTCOMPOSITION: 0x10D,
WM_IME_ENDCOMPOSITION: 0x10E,
WM_IME_COMPOSITION: 0x10F,
WM_IME_KEYLAST: 0x10F,
WM_INITDIALOG: 0x110,
WM_COMMAND: 0x111,
WM_SYSCOMMAND: 0x112,
WM_TIMER: 0x113,
WM_HSCROLL: 0x114,
WM_VSCROLL: 0x115,
WM_INITMENU: 0x116,
WM_INITMENUPOPUP: 0x117,
WM_MENUSELECT: 0x11F,
WM_MENUCHAR: 0x120,
WM_ENTERIDLE: 0x121,
WM_CTLCOLORMSGBOX: 0x132,
WM_CTLCOLOREDIT: 0x133,
WM_CTLCOLORLISTBOX: 0x134,
WM_CTLCOLORBTN: 0x135,
WM_CTLCOLORDLG: 0x136,
WM_CTLCOLORSCROLLBAR: 0x137,
WM_CTLCOLORSTATIC: 0x138,
WM_MOUSEFIRST: 0x200,
WM_MOUSEMOVE: 0x200,
WM_LBUTTONDOWN: 0x201,
WM_LBUTTONUP: 0x202,
WM_LBUTTONDBLCLK: 0x203,
WM_RBUTTONDOWN: 0x204,
WM_RBUTTONUP: 0x205,
WM_RBUTTONDBLCLK: 0x206,
WM_MBUTTONDOWN: 0x207,
WM_MBUTTONUP: 0x208,
WM_MBUTTONDBLCLK: 0x209,
WM_MOUSEWHEEL: 0x20A,
WM_MOUSEHWHEEL: 0x20E,
WM_PARENTNOTIFY: 0x210,
WM_ENTERMENULOOP: 0x211,
WM_EXITMENULOOP: 0x212,
WM_NEXTMENU: 0x213,
WM_SIZING: 0x214,
WM_CAPTURECHANGED: 0x215,
WM_MOVING: 0x216,
WM_POWERBROADCAST: 0x218,
WM_DEVICECHANGE: 0x219,
WM_MDICREATE: 0x220,
WM_MDIDESTROY: 0x221,
WM_MDIACTIVATE: 0x222,
WM_MDIRESTORE: 0x223,
WM_MDINEXT: 0x224,
WM_MDIMAXIMIZE: 0x225,
WM_MDITILE: 0x226,
WM_MDICASCADE: 0x227,
WM_MDIICONARRANGE: 0x228,
WM_MDIGETACTIVE: 0x229,
WM_MDISETMENU: 0x230,
WM_ENTERSIZEMOVE: 0x231,
WM_EXITSIZEMOVE: 0x232,
WM_DROPFILES: 0x233,
WM_MDIREFRESHMENU: 0x234,
WM_IME_SETCONTEXT: 0x281,
WM_IME_NOTIFY: 0x282,
WM_IME_CONTROL: 0x283,
WM_IME_COMPOSITIONFULL: 0x284,
WM_IME_SELECT: 0x285,
WM_IME_CHAR: 0x286,
WM_IME_KEYDOWN: 0x290,
WM_IME_KEYUP: 0x291,
WM_MOUSEHOVER: 0x2A1,
WM_NCMOUSELEAVE: 0x2A2,
WM_MOUSELEAVE: 0x2A3,
WM_CUT: 0x300,
WM_COPY: 0x301,
WM_PASTE: 0x302,
WM_CLEAR: 0x303,
WM_UNDO: 0x304,
WM_RENDERFORMAT: 0x305,
WM_RENDERALLFORMATS: 0x306,
WM_DESTROYCLIPBOARD: 0x307,
WM_DRAWCLIPBOARD: 0x308,
WM_PAINTCLIPBOARD: 0x309,
WM_VSCROLLCLIPBOARD: 0x30A,
WM_SIZECLIPBOARD: 0x30B,
WM_ASKCBFORMATNAME: 0x30C,
WM_CHANGECBCHAIN: 0x30D,
WM_HSCROLLCLIPBOARD: 0x30E,
WM_QUERYNEWPALETTE: 0x30F,
WM_PALETTEISCHANGING: 0x310,
WM_PALETTECHANGED: 0x311,
WM_HOTKEY: 0x312,
WM_PRINT: 0x317,
WM_PRINTCLIENT: 0x318,
WM_HANDHELDFIRST: 0x358,
WM_HANDHELDLAST: 0x35F,
WM_PENWINFIRST: 0x380,
WM_PENWINLAST: 0x38F,
WM_COALESCE_FIRST: 0x390,
WM_COALESCE_LAST: 0x39F,
WM_DDE_FIRST: 0x3E0,
WM_DDE_INITIATE: 0x3E0,
WM_DDE_TERMINATE: 0x3E1,
WM_DDE_ADVISE: 0x3E2,
WM_DDE_UNADVISE: 0x3E3,
WM_DDE_ACK: 0x3E4,
WM_DDE_DATA: 0x3E5,
WM_DDE_REQUEST: 0x3E6,
WM_DDE_POKE: 0x3E7,
WM_DDE_EXECUTE: 0x3E8,
WM_DDE_LAST: 0x3E8,
WM_USER: 0x400,
WM_APP: 0x8000
}
function drag_window(interface_name) { //For use in on_mouse_lbtn_down
if(!libs_exist || !loaded) return;
dynwrapx.ReleaseCapture();
dynwrapx.SendMessage(get_hwnd(interface_name), 0xA1, 2, 1);
}
function move_window(interface_name, x, y, w, h) {
if(!libs_exist || !loaded) return;
autoItX3.WinMove(get_class(interface_name), "", x, y, w, h);
}
function get_window_states(interface_name) { //Returned array gives: exists, visible, enabled, active, minimized, maximized
var result = Array(false, false, false, false, false, false);
var state;
if(!libs_exist || !loaded) return result;
state = autoItX3.WinGetState(get_class(interface_name));
if((state & 1)==1) result[0] = true;
if((state & 2)==2) result[1] = true;
if((state & 4)==4) result[2] = true;
if((state & 8)==8) result[3] = true;
if((state & 16)==16) result[4] = true;
if((state & 32)==32) result[5] = true;
return result;
}
function window_opacity(interface_name, opacity) {
if(!libs_exist || !loaded) return;
autoItX3.WinSetTrans(get_class(interface_name), "", Math.round(opacity*2.55));
if(get_window_states(interface_name)[1]==true) dynwrapx.RedrawWindow(get_hwnd(interface_name), 0, 0, 0x400 | 0x80 | 0x4 | 0x1);
}
function get_window_dimensions(interface_name) { //Returned array gives: x, y, width, height (of the window)
var title;
if(!libs_exist || !loaded) return Array(0,0,0,0);
title = get_class(interface_name);
return Array(autoItX3.WinGetPosX(title),autoItX3.WinGetPosY(title),autoItX3.WinGetPosWidth(title),autoItX3.WinGetPosHeight(title));
}
function set_window_on_top(interface_name, state) {
if(!libs_exist || !loaded) return;
autoItX3.WinSetOnTop(get_class(interface_name),"",state==false ? 0 : 1);
}
function set_transparent_color(interface_name, color, alpha) { //Use only GDI_RGB(r, g, b) to set up color
var handle;
if(!libs_exist || !loaded) return;
handle = get_hwnd(interface_name);
dynwrapx.SetWindowLong(handle, -20, dynwrapx.GetWindowLong(handle, -20) | 0x00080000);
dynwrapx.SetLayeredWindowAttributes(handle, color, alpha, 0x00000001 | 0x00000002);
if(get_window_states(interface_name)[1]==true) dynwrapx.RedrawWindow(handle, 0, 0, 0x400 | 0x80 | 0x4 | 0x1);
}
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var font = gdi.Font("arial",12,0);
var color = RGB(40, 40, 40);
var ww = 0, wh = 0;
DT_LEFT = 0x00000000;
DT_NOPREFIX = 0x00000800;
var lib_path = fb.FoobarPath + "assemblies\\";
var libs_exist = utils.FileTest(lib_path + "AutoItX3.dll","e");
var loaded = true;
var window_x, window_y, window_w, window_h;
var autoItX3;
if (libs_exist) autoItX3 = new ActiveXObject("AutoItX3.Control");
function get_xywh(){
class_name = "[CLASS:{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}]";
window_x = autoItX3.WinGetPosX(class_name);
window_y = autoItX3.WinGetPosY(class_name);
window_w = autoItX3.WinGetPosWidth(class_name);
window_h = autoItX3.WinGetPosHeight(class_name);
}
function move_window(interface_name, x, y, w, h) {
class_name = "[CLASS:{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}]";
autoItX3.WinMove(class_name, "", x, y, w, h);
}
function on_size(){
ww = window.Width;
wh = window.Height;
libs_exist && get_xywh();
}
function on_paint(gr) {
gr.GdiDrawText( "window_x " + window_x, font, color, 10, 10, ww, wh, DT_LEFT | DT_NOPREFIX );
gr.GdiDrawText( "window_y " + window_y, font, color, 10, 30, ww, wh, DT_LEFT | DT_NOPREFIX );
gr.GdiDrawText( "window_w " + window_w, font, color, 10, 50, ww, wh, DT_LEFT | DT_NOPREFIX );
gr.GdiDrawText( "window_h " + window_h, font, color, 10, 70, ww, wh, DT_LEFT | DT_NOPREFIX );
}
var step = 10;
function on_mouse_wheel(delta) {
if (!libs_exist) return;
if (delta > 0){
window_x = window_x - step;
window_y = window_y - step;
window_w = window_w + step * 2;
window_h = window_h + step * 2;
}
if (delta < 0){
window_x = window_x + step;
window_y = window_y + step;
window_w = window_w - step * 2;
window_h = window_h - step * 2;
}
move_window("CUI", window_x, window_y, window_w, window_h);
get_xywh();
window.Repaint();
}
function on_mouse_move(x, y) {
window.SetCursor(32649);
window.Repaint();
}
function on_mouse_leave() {
window.SetCursor(32512);
window.Repaint();
}
LUR, вы сомневались???По моему ответ очевиденLUR:Я конечно сомневался, что стоит вводить элементы управления главным окном плеера для панели
Это называется желанием держать под своим контролем) Хотя говорить о контроле иногда сложно)SergPuh.68:LUR, вы сомневались???По моему ответ очевиден
Я давно уже их использую для перемещения и изменения размеров главного окна, при условии что в UI Hacks отключены рамки главного окна и подключены библиотеки. Но с новыми версия плагин не работает корректно((kgena_ua:Если интересно кому
Вижу появилось в вашем сплиттере возможность менять размеры и положение главного окна, этим можно заменить UI Hacks и не использовать доп. библиотеки? Может кто маленький пример кода скинет по изменению размера главного окна при наведении мыши допустим на угол окна?)LUR:неудобно "форсить" свой сплиттер, но пока там нет окон
///resize main window
function on_mouse_lbtn_down(x, y, mask) {
if(x >=ww-8 && x <= ww+1 && y >= 5 && y <= wh-5){drag_r_side = true;}//right
}
function on_mouse_move(x, y, mask) {
if(x >=ww-8 && x <= ww+1 && y >= 5 && y <= wh-5){window.SetCursor(IDC_SIZEWE);}//right
if(drag_r_side) {
dimensions = get_window_dimensions("CUI");
mouse_x = autoItX3.MouseGetPosX();
mouse_y = autoItX3.MouseGetPosY();
}
if(drag_r_side) {
move_window("CUI",dimensions[0],dimensions[1],mouse_x-dimensions[0],dimensions[3]);
}
}
dimensions0=window.FoobarWindowX;
dimensions1=window.FoobarWindowY;
dimensions2=window.FoobarWindowWidth;
dimensions3=window.FoobarWindowHeight;
нельзя, вроде он сам этого не умеет. ну из того, что я в сплиттер добавил.Aum:этим можно заменить UI Hacks
никак. если мышь над другой панелью, то это не предусмотрено.Aum:получить положение мышки по Х на главным окном
Спасибо. Понял, придется выкручиваться без UI Hacks в будущем.LUR:если мышь над другой панелью, то это не предусмотрено.
//Maxim Terpilovsky's script Artwork (http://terpilovsky.ru))\\\
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
function RGBA(r,g,b,a){ return ((a<<24)|(r<<16)|(g<<8)|(b)); }
var WshShell = new ActiveXObject("WScript.Shell");
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var g_font = gdi.Font("Tahoma", 11);
function CoverShow( metadb ) {
this.CachedPath = 0;
// Search for files
this.Search = function( array, dir) {
var e = new Enumerator( dir.Files );
while( !e.atEnd() ) {
var name = e.item().Name;
if( name.match(/\.(jpg|jpeg|png|gif|tif|bmp)$/i) ) {
array.push( e.item().Path );
}
e.moveNext();
}
}
// Find all covers in the folder
this.GetExternalCovers = function( path ) {
var files = [];
var covers = [];
try {
var dir = FSO.GetFile( path ).ParentFolder;
this.Search(files, dir);
var e = new Enumerator( dir.SubFolders );
for(; !e.atEnd(); e.moveNext() ) {
this.Search(files, e.item() );
}
} catch(e) { fb.trace( 'this.GetExternalCovers / path: ' + e.message ); }
if ( files.length > 0 ) {
for ( key in files ) {
var name = files[key];
if ( name.match(/.*(cover|front|folder).*\.(jpg|jpeg|gif|png)$/i) ) {
covers.push( name );
files[key] = null;
}
}
overall = covers;
for ( key in files ) {
if ( typeof( files[key] ) == 'string' ) overall.push( files[key] );
}
return overall;
}
else return new Array();
}
this.GetCovers = function( path ) {
var embedded = this.GetEmbeddedCovers();
var external = this.GetExternalCovers( path );
var allcovers = new Array();
if ( 2== 1 ) allcovers = allcovers.concat(embedded, external);
else allcovers = allcovers.concat(external, embedded);
this.Covers = allcovers;
if ( this.Covers.length > 0 ) {
try {
if ( typeof this.Covers[0] == 'object' ) return this.Covers[0];
else return gdi.Image( this.Covers[0] );
}
catch(e) { fb.trace( 'return this.Covers: ' + e.message ); return null; }
}
else {
this.Covers = null;
return null;
}
}
this.GetEmbeddedCovers = function() {
var embedded = [];
for ( c = 0; c < 5; c++) {
if ( c == 3 ) continue;
if ( utils.GetAlbumArtEmbedded( this.Metadb.RawPath, c ) )
embedded.push( utils.GetAlbumArtEmbedded( this.Metadb.RawPath, c ) );
}
return embedded;
}
this.FindEmbeddedCover = function() {
return utils.GetAlbumArtEmbedded( this.Metadb.RawPath, art_id = 0);
}
this.DrawCover = function(gr) {
gr.FillGradRect(0,0,window.Width/2,window.Height, -60,RGB(0,0,0),RGB(0,0,0));
gr.FillGradRect(window.Width/2,0,window.Width/2,window.Height,60,RGB(0,0,0),RGB(0,0,0));
if ( this.Covers != undefined && !this.CurrentCover ) {
if ( typeof this.Covers[ this.CurrentCoverNumber ] == 'object' ) {
this.CurrentCover = this.Covers[ this.CurrentCoverNumber ].Clone(0, 0, this.Covers[ this.CurrentCoverNumber ].Width, this.Covers[ this.CurrentCoverNumber ].Height);
}
else {
this.CurrentCover = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
}
}
if ( !this.CurrentCover ) {
var img = gdi.Image( fb.ProfilePath + "images\\htpc\\nocover.png" );
if ( img.Width > window.Width || img.Height > window.Height ) {
if ( img.Width / img.Height > window.Width / window.Height ) {
var iw = window.Width;
var ih = img.Height / ( img.Width / window.Width );
img = img.Resize( iw, ih);
}
else {
var ih = window.Height;
var iw = img.Width / ( img.Height / window.Height );
img = img.Resize( iw, ih);
}
}
}
else {
var img = this.CurrentCover;
if ( img.Width > window.Width || img.Height > window.Height ) {
if ( img.Width / img.Height > window.Width / window.Height ) {
var iw = window.Width;
var ih = img.Height / ( img.Width / window.Width );
img = img.Resize( iw, ih);
}
else {
var ih = window.Height;
var iw = img.Width / ( img.Height / window.Height );
img = img.Resize( iw, ih);
}
}
}
var iw = ( img.Width > window.Width ) ? window.Width : img.Width;
var ih = ( img.Height > window.Height ) ? window.Height : img.Height;
img = img.Resize( iw, ih);
gr.DrawImage( img,
(iw < ih) ? ((iw < window.Width) ? ((window.Width - iw)/2) : 0 ) : ((iw >= window.Width) ? 0 : ((window.Width - iw)/2)),
(iw > ih) ? ((ih < window.Height) ? ((window.Height - ih)/2) : 0 ) : ((ih >= window.Height) ? 0 : ((window.Height - ih)/2)),
img.Width, img.Height, 0,0, img.Width, img.Height );
}
this.ChangeImage = function( val ) {
this.CurrentCover = val;
}
this.NextCover = function() {
if ( this.Covers != null && this.Covers.length > 1 ) {
this.CurrentCoverNumber++;
if ( this.CurrentCoverNumber == this.Covers.length ) {
this.CurrentCoverNumber = 0;
}
try {
if ( typeof this.Covers[ this.CurrentCoverNumber ] == 'object' ) var temp = this.Covers[ this.CurrentCoverNumber ];
else var temp = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
if ( temp ) {
this.ChangeImage( temp );
window.Repaint();
}
else this.NextCover();
} catch (e) {
this.NextCover();
}
}
}
this.PrevCover = function() {
if ( this.Covers != null && this.Covers.length > 1 ) {
this.CurrentCoverNumber--;
if ( this.CurrentCoverNumber < 0 ) {
this.CurrentCoverNumber = this.Covers.length;
}
try {
if ( typeof this.Covers[ this.CurrentCoverNumber ] == 'object' ) var temp = this.Covers[ this.CurrentCoverNumber ];
else var temp = gdi.Image( this.Covers[ this.CurrentCoverNumber ] );
if ( temp ) {
this.ChangeImage( temp );
window.Repaint();
}
else this.PrevCover();
} catch (e) {
this.PrevCover();
}
}
}
this.StopTimer = function() {
this.CycleTimer ? window.KillTimer( this.CycleTimer ) : '';
}
this.StartTimer = function() {
this.CycleTimer = window.CreateTimerInterval( 17000 );
}
this.OutputMetadb = function() {
return ( fb.IsPlaying ? fb.GetNowPlaying() : ( fb.GetFocusItem(true) ? fb.GetFocusItem(true) : false ));
}
this.Update = function( metadb ) {
this.Metadb = metadb ? metadb : this.OutputMetadb();
try { this.MetaPath = this.Metadb.Path ? this.Metadb.Path : 0; }
catch (e) { fb.trace( 'this.Update / this.MetaPath = ' + e.message); this.MetaPath = 0; }
if ( this.MetaPath ) {
// fb.trace( 'UPDATED!' );
this.CurrentCoverNumber = 0;
this.CurrentCover = this.GetCovers( this.MetaPath );
this.CachedPath = this.MetaPath;
}
else {
this.Covers = null;
this.CurrentCover = this.NoCover;
this.CurrentCover = null;
}
}
this.Update(metadb);
this.CycleTimer = 0;
this.TimerStarted = false;
}
var Cover = new CoverShow();
var a, b, g_hover = 0;
function on_paint( gr ) {
var text, measure;
Cover.DrawCover( gr );
if ( Cover.Covers != null && g_hover ) {
if ( Cover.Covers.length > 0 ) {
text = "wheel - on, double-click - view";
measure = gr.MeasureString( text, g_font, 0, 0, window.Width, 0, 0);
gr.FillSolidRect( 0, 0, window.Width, 2*measure.Height, RGBA(32,32,32,100));
gr.GdiDrawText( text, g_font, RGB(255,255,255), 0, 0, window.Width, measure.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
if ( typeof Cover.Covers[ Cover.CurrentCoverNumber ] == 'object' ) text = "Enclosing the track" + Cover.MetaPath.replace(/(.*)\\(.*)\.(.*)$/,'$2.$3') + '"' + " [" + (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length + "]";
else text = Cover.Covers[ Cover.CurrentCoverNumber ].replace(/(.*)\\(.*)\.(.*)$/,'$2.$3') + " [" + (Cover.CurrentCoverNumber+1) + "/" + Cover.Covers.length + "]";
}
measure = gr.MeasureString( text, g_font, 5, 0, window.Width-6, 0, 0);
gr.FillSolidRect( 0, window.Height - measure.Height, window.Width, measure.Height, RGBA(32,32,32,100));
gr.GdiDrawText( text, g_font, RGB(204,219,216), 0, window.Height - measure.Height, window.Width, measure.Height, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT);
}
}
function on_playback_new_track( metadb ){
Cover.Update( metadb );
Cover.StartTimer();
window.Repaint();
}
function on_mouse_move(x, y) {
if ( !g_hover ) {
g_hover = 1;
window.Repaint();
}
}
function on_mouse_leave() {
g_hover = 0;
window.Repaint();
}
function on_mouse_wheel( step ) {
(step < 0) ? Cover.NextCover() : Cover.PrevCover();
}
function on_mouse_lbtn_dblclk(x, y) {
if ( Cover.Covers != undefined )
{
if( Cover.Covers[ Cover.CurrentCoverNumber ] ) WshShell.run( '"' + Cover.Covers[ Cover.CurrentCoverNumber ] + '"' );
}
}
function on_playback_stop( Reason ) {
Cover.StopTimer();
}
function on_playlist_switch() {
var a = Cover.CachedPath ? Cover.CachedPath : ' ';
var b = Cover.OutputMetadb() ? Cover.OutputMetadb().Path : ' ';
if ( a.replace(/(.*)\\(.*)\.(.*)$/,'$1') != b.replace(/(.*)\\(.*)\.(.*)$/,'$1') ) {
Cover.Update();
window.Repaint();
}
}
function on_timer(id) {
if ( Cover.CycleTimer.ID == id ) {
Cover.NextCover();
}
}
Вернуться в Секреты foobar2000