Список разделов › foobar2000 › Секреты foobar2000
Rink:Сделал, на экране прозрачное окно с индикатором Пионера.Не могли бы вы выложить готовую сборку?
Полный функционал. Масштабирование на регуляторе Pitch Cont. Только стартует в разрешении 1008х756.Rink:Спасибо за готовую сборку, я так понял, что масштабировать её не получится?
Как бы не критично, но если днем на работе запустил почти сразу, дома часа два возился, сначала на буке настроил, потом на десктопе запустил.iprad:В выложенной теме при запуске работает скрипт определения разрешения монитора. Поэтому возможны траблы.
// ==PREPROCESSOR==
// @name "DarkOne Cover Panel"
// @version "3.0"
// @author "tedGo, includes partial code by T.P Wang"
// ==/PREPROCESSOR==
var configPath = fb.FoobarPath + "themes\\PioneerRT909\\";
var btn_font = gdi.Font("Europe_Ext", 7, 0);
var dsp_font = gdi.Font("Europe_Ext", 15, 0);
var ui_type = window.InstanceType;
var ww = 0; wh = 0;
// ----- CREATE RGB(A) ----------------------------------------------
function RGBA(r, g, b, a) {
return ((a << 24) | (r << 16) | (g << 8) | (b));
}
// ----- CREATE CUSTOM COLOUR ---------------------------------------
function CustomColour(colour){
tempc = colour.split("-");
return ((tempc[3] << 24) | (tempc[0]<<16) | (tempc[1]<<8) | (tempc[2]));
}
// ----- GET UI COLOURS ---------------------------------------------
function get_colors() {
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);
}
get_colors();
function on_colors_changed() {
get_colors();
window.Repaint();
}
var g_img = null;
var descr_timer = null;
var cycle_timer = null;
var g_active = false;
var g_fade = 255;
var g_state = 0;
var metadb;
// ----- CREATE OPTIONS --------------------------------------------
var a_arr = new Array("Picture 1", "Picture 2", "Picture 3", "Picture 4", "Picture 5");
var b_arr = new Array("Front Cover", "Back Cover", "Disc", "Icon", "Artist");
function artType() {
at = window.GetProperty("Enable Custom Pictures", false);
c_arr = at ? a_arr : b_arr;
}
artType();
function aspectRatio() {
ar = window.GetProperty("Aspect ratio", 0);
if (typeof ar < 0 || ar > 2) ar = 0;
return ar;
}
aspectRatio();
// ----- GET PICTURE -----------------------------------------------
var imgPath = configPath + "StubImage\\";
var a_img = gdi.Image(imgPath + "DarkOne.png");
var b_img = gdi.Image(imgPath + "Radio.png");
var c_img = gdi.Image(imgPath + "AudioCD.png");
var d_img = gdi.Image(imgPath + "NoImage.png");
var e_arr = [];
e_arr[0] = gdi.Image(imgPath + "NoFront.png");
e_arr[1] = gdi.Image(imgPath + "NoBack.png");
e_arr[2] = gdi.Image(imgPath + "NoDisc.png");
e_arr[3] = gdi.Image(imgPath + "NoIcon.png");
e_arr[4] = gdi.Image(imgPath + "NoArtist.png");
var f_arr = [];
f_arr[0] = window.GetProperty(a_arr[0],"");
f_arr[1] = window.GetProperty(a_arr[1],"");
f_arr[2] = window.GetProperty(a_arr[2],"");
f_arr[3] = window.GetProperty(a_arr[3],"");
f_arr[4] = window.GetProperty(a_arr[4],"");
var g_ext = window.GetProperty("File extension order", "jpg|png|gif|bmp|tif");
var g_arr = g_ext.split("|");
var g_art = null;
function getRightImage(switchstate) {
metadb = fb.GetNowPlaying();
if (g_art) {
g_img.Dispose();
g_art = null;
}
if (metadb) {
var f_img = null;
if (fb.PlaybackLength <= 0) {
f_img = b_img;
g_active = false;
} else if (metadb.RawPath.indexOf("cdda://") == 0) {
f_img = c_img;
g_active = false;
} else {
var old_state = g_state;
do {
switchstate && switchState();
if (at) {
var arr = utils.Glob(fb.TitleFormat(f_arr[g_state]).Eval() + ".*").toArray();
var g_break = false;
for (var n = 0; n < g_arr.length && !g_break; n++) {
for (var i = 0; i < arr.length; i++) {
var re = new RegExp("\." + g_arr[n] + "$", "i");
if (arr[i].match(re)) {
g_art = gdi.Image(arr[i]);
g_break = true;
break;
}
}
}
f_img = g_art;
} else {
g_art = utils.GetAlbumArtV2(metadb, g_state);
f_img = g_art;
}
}
while (switchstate && old_state != g_state && !f_img);
g_active = true;
}
} else {
f_img = a_img;
g_active = false;
}
if (f_img) g_img = f_img;
else if (!switchstate) g_img = at ? d_img : e_arr[g_state];
return g_img ? true : false;
}
getRightImage(false);
// ----- CREATE ACTIONS --------------------------------------------
function getTimer() {
if (descr_timer) {
descr_timer.Dispose(),
descr_timer = null;
}
descr_timer = window.CreateTimerTimeout(1500);
window.Repaint();
}
function switchState() {
if (g_state == 4) g_state = 0;
else g_state++;
}
function switchType() {
window.SetProperty("Enable Custom Pictures", at ? false : true);
artType();
g_state = 0;
getRightImage(false);
if (g_active && !g_art) getRightImage(true);
getTimer();
}
// ----- CREATE MENU -----------------------------------------------
function CustomMenu(x, y) {
var a = window.CreatePopupMenu();
var idx;
a.AppendMenuItem(0, 1, "Keep aspect ratio");
a.AppendMenuItem(0, 2, "Noexpansion");
a.AppendMenuItem(0, 3, "Stretch");
a.CheckMenuRadioItem(1, 3, ar + 1);
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 4, at ? "Album Art" : "Custom Pictures");
a.AppendMenuItem(2048, 0, 0);
if (!ac) {
for (var i = 0; i < c_arr.length; i++) {
a.AppendMenuItem(0, 5 + i, c_arr[i]);
}
a.CheckMenuRadioItem(5, 9, g_state + 5);
a.AppendMenuItem(2048, 0, 0);
}
a.AppendMenuItem(ac ? 8 : 0, 10, "Auto Cycle Image");
ac && a.AppendMenuItem(ct ? 8 : 0, 11, "Faded Transition");
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 12, "Properties");
a.AppendMenuItem(0, 13, "Configure...");
idx = a.TrackPopupMenu(x, y);
switch (true) {
case (idx >= 1 && idx <= 3):
window.SetProperty("Aspect ratio", idx - 1);
aspectRatio();
window.Repaint();
break;
case (idx == 4):
switchType();
break;
case (idx >= 5 && idx <= 9):
g_state = idx - 5;
getRightImage(false);
getTimer();
break;
case (idx == 10):
window.SetProperty("Auto Cycle Image", ac ? false : true);
ac = window.GetProperty("Auto Cycle Image");
break;
case (idx == 11):
window.SetProperty("Auto Cycle Transition Fader on", ct ? false : true);
ct = window.GetProperty("Auto Cycle Transition Fader on");
break;
case (idx == 12):
window.ShowProperties();
break;
case (idx == 13):
window.ShowConfigure();
break;
}
a.Dispose();
}
// ----- DRAW ------------------------------------------------------
var overlay_active = window.GetProperty("Back Overlay: Activate", true);
var overlay_colour = window.GetProperty("Back Overlay: Colour", "63-100-127-72");
var g_acol = CustomColour(overlay_colour);
var descr_tcolour = window.GetProperty("Description: Text Colour", "128-192-255-255");
var g_bcol = CustomColour(descr_tcolour);
var descr_bcolour = window.GetProperty("Description: Back Colour", "19-30-38-224");
var g_ccol = CustomColour(descr_bcolour);
function on_paint(gr) {
if (!window.IsTransparent) gr.FillSolidRect(0, 0, ww, wh, ui_backcol);
if (fb.IsPlaying && overlay_active) gr.FillSolidRect(0, 0, ww, wh, g_acol);
if (g_img) {
var w, h, x, y;
if (ar == 0 || ar == 1 && (g_img.Width > ww || g_img.Height > wh)) {
var img_scale = Math.min(ww / g_img.Width, wh / g_img.Height);
w = g_img.Width * img_scale;
h = g_img.Height * img_scale;
x = (ww - w) / 2;
y = (wh - h) / 2;
} else if (ar == 1) {
w = g_img.Width;
h = g_img.Height;
x = (ww - w) / 2;
y = (wh - h) / 2;
} else {
w = ww;
h = wh;
x = y = 0;
}
gr.DrawImage(g_img, x, y, w, h, 0, 0, g_img.Width, g_img.Height, 0, Math.abs(g_fade));
}
if (descr_timer) {
gr.SetSmoothingMode(2);
gr.FillRoundRect(5, 5, 129, 29, 3, 3, g_ccol);
gr.GdiDrawText(c_arr[g_state], dsp_font, g_bcol, 10, 10, 125, 30, 33);
}
}
// ----- MOUSE ACTIONS ---------------------------------------------
function on_mouse_move(x, y) {
!ac && g_active && window.SetCursor(32649);
}
function on_mouse_lbtn_down(x, y) {
if (!ac && g_active) {
getRightImage(true);
getTimer();
}
}
function on_mouse_mbtn_down(x, y) {
g_active && switchType();
}
function on_mouse_rbtn_up(x, y) {
if (g_active) {
CustomMenu(x, y);
return true;
}
}
function on_mouse_wheel(step) {
if (!ac && g_active) {
g_state -= step;
if (g_state < 0 ) g_state = 4;
else if (g_state > 4) g_state = 0;
getRightImage(false);
getTimer();
}
}
// ----- EVENTS ----------------------------------------------------
var ac = window.GetProperty("Auto Cycle Image", false);
var ci = window.GetProperty("Auto Cycle Interval in s", 15);
var ct = window.GetProperty("Auto Cycle Transition Fader on", false);
function on_size() {
ww = window.Width;
wh = window.Height;
}
function on_timer(id) {
if (cycle_timer && id == cycle_timer.ID) {
g_fade -= 51;
if (g_fade <= -255) {
g_fade = 255;
cycle_timer.Dispose();
cycle_timer = null;
}
if (g_fade == 0) getRightImage(true);
window.Repaint();
} else if (descr_timer && id == descr_timer.ID) {
window.RepaintRect(5, 5, 130, 30);
descr_timer.Dispose();
descr_timer = null;
}
}
function on_playback_new_track(metadb) {
getRightImage(false);
window.Repaint();
}
function on_playback_time(time) {
if (ac && g_active && g_art && time > 1 && Math.round(time % ci) == 1) {
if (ct) {
if (cycle_timer) {
cycle_timer.Dispose();
cycle_timer = null;
}
cycle_timer = window.CreateTimerInterval(50);
} else {
getRightImage(true);
window.Repaint();
}
}
}
function on_playback_stop(reason) {
if (cycle_timer) {
cycle_timer.Dispose();
cycle_timer = null;
g_fade = 255;
}
if (descr_timer) {
descr_timer.Dispose();
descr_timer = null;
}
if (reason != 2) {
getRightImage(false);
window.Repaint();
}
}
Вернуться в Секреты foobar2000