Давай. Тогда конкретно
Есть две картинки: активная (outputMH.png) и неактивная (output.png) кнопки. По клику на неактивной кнопке переключается вывод и картинки должны меняться так, чтобы оставалась индикация текущего вывода.
Список разделов › foobar2000 › Секреты foobar2000
Да я это и понял ещё по первому вопросу. Нужно что бы кнопка оставалась нажатой как в старой радиоле например. Разные варианты предлагал с точки зрения дизайна, что может выглядеть более выигрышно в данном случае, ну или более простая реализация с тем же эффектом. Но это всё лирика, перейдём к делу. Мне надо рабочий скрипт, в смысле не отрезок как в примере, попробую его отредактировать в Notepad++, потому что в своей сборке не получится запустить без переделки всё равно. Модифицированный не надо, лезть в "кнопки" я не буду, там специальный скрипт отдельный, проще сделать отдельно.imfam:Давай. Тогда конкретно
// DarkOne v2.1 Control Panel
// Code by T.P Wang and tedGo
// ==PREPROCESSOR==
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Script.js"
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Button Script.js"
// ==/PREPROCESSOR==
window.MinWidth = 280;
// ----- CREATE BUTTONS --------------------------------------------
var imgPath = fb.foobarPath + "themes\\DarkOne\\Buttons\\Control\\";
var btn_font = gdi.Font("Tahoma", 12, 0);
var r = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var s = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var t = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var u = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
Buttons.DEV = new Button(ww / 2 - 110, 22, 55, 14, r, function(){fb.RunMainMenuCommand("Playback/Device/Preferences...")}, "Output");
Buttons.EXT = new Button(ww / 2 - 55, 22, 55, 14, s, function(){fb.RunMainMenuCommand("Playback/Device/KS : AudioQuest DragonFly");}, "External");
Buttons.SHARED = new Button(ww / 2 + 0, 22, 55, 14, t, function(){fb.RunMainMenuCommand("Playback/Device/WASAPI (shared) : Speakers (Realtek(R) Audio)");}, "Shared");
Buttons.ASIO = new Button(ww / 2 + 55, 22, 55, 14, u, function(){fb.RunMainMenuCommand("Playback/Device/ASIO : Realtek ASIO");}, "ASIO");
// ----- DRAW ------------------------------------------------------
function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, ui_backcol);
buttonsDraw(gr);
var x2 = ww / 2 - 110;
var x3 = ww / 2 - 55;
var x4 = ww / 2 + 0;
var x5 = ww / 2 + 55;
gr.GdiDrawText("Output", btn_font, ui_btntxtcol, x2, 06, 55, 12, 33);
gr.GdiDrawText("External", btn_font, ui_btntxtcol, x3, 06, 55, 12, 33);
gr.GdiDrawText("Shared", btn_font, ui_btntxtcol, x4, 06, 55, 12, 33);
gr.GdiDrawText("ASIO", btn_font, ui_btntxtcol, x5, 06, 55, 12, 33);
}
// ----- EVENTS ----------------------------------------------------
function on_size() {
ww = window.Width;
wh = window.Height;
Buttons.DEV.changePos(ww / 2 - 110, 22, 55, 14);
Buttons.DEV.alterImage(r);
Buttons.EXT.changePos(ww / 2 - 55, 22, 55, 14);
Buttons.EXT.alterImage(s);
Buttons.SHARED.changePos(ww / 2 + 0, 22, 55, 14);
Buttons.SHARED.alterImage(t);
Buttons.ASIO.changePos(ww / 2 + 55, 22, 55, 14);
Buttons.ASIO.alterImage(u);
}
// DarkOne v2.1 Control Panel
// Code by T.P Wang and tedGo
// ==PREPROCESSOR==
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Script.js"
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Button Script.js"
// ==/PREPROCESSOR==
window.MinWidth = 280;
var active_device = window.GetProperty("active device buttons", 0);
var button_dev = gdi.Image(imgPath + "outputMH.png");
// ----- CREATE BUTTONS --------------------------------------------
var imgPath = fb.foobarPath + "themes\\DarkOne\\Buttons\\Control\\";
var btn_font = gdi.Font("Tahoma", 12, 0);
var r = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var s = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var t = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var u = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
Buttons.DEV = new Button(ww / 2 - 110, 22, 55, 14, r, function(){active_device = 0, activedevice(), fb.RunMainMenuCommand("Playback/Device/Preferences...")}, "Output");
Buttons.EXT = new Button(ww / 2 - 55, 22, 55, 14, s, function(){active_device = 1, activedevice(), fb.RunMainMenuCommand("Playback/Device/KS : AudioQuest DragonFly");}, "External");
Buttons.SHARED = new Button(ww / 2 + 0, 22, 55, 14, t, function(){active_device = 2, activedevice(), fb.RunMainMenuCommand("Playback/Device/WASAPI (shared) : Speakers (Realtek(R) Audio)");}, "Shared");
Buttons.ASIO = new Button(ww / 2 + 55, 22, 55, 14, u, function(){active_device = 3, activedevice(), fb.RunMainMenuCommand("Playback/Device/ASIO : Realtek ASIO");}, "ASIO");
// ----- DRAW ------------------------------------------------------
function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, ui_backcol);
buttonsDraw(gr);
var x2 = ww / 2 - 110;
var x3 = ww / 2 - 55;
var x4 = ww / 2 + 0;
var x5 = ww / 2 + 55;
/*
gr.GdiDrawText("Output", btn_font, ui_btntxtcol, x2, 06, 55, 12, 33);
gr.GdiDrawText("External", btn_font, ui_btntxtcol, x3, 06, 55, 12, 33);
gr.GdiDrawText("Shared", btn_font, ui_btntxtcol, x4, 06, 55, 12, 33);
gr.GdiDrawText("ASIO", btn_font, ui_btntxtcol, x5, 06, 55, 12, 33);
*/
gr.GdiDrawText("Output", btn_font, active_device == 0 ? RGB(128,192,255) : ui_btntxtcol, x2, 06, 55, 12, 33);
gr.GdiDrawText("External", btn_font, active_device == 1 ? RGB(128,192,255) : ui_btntxtcol, x3, 06, 55, 12, 33);
gr.GdiDrawText("Shared", btn_font, active_device == 2 ? RGB(128,192,255) : ui_btntxtcol, x4, 06, 55, 12, 33);
gr.GdiDrawText("ASIO", btn_font, active_device == 3 ? RGB(128,192,255) : ui_btntxtcol, x5, 06, 55, 12, 33);
gr.DrawImage(button_dev, ww / 2 - 110 + 55 * active_device, 22, 55, 14, 0, 0, 55, 14, 0, 255); //255 alpha
// gr.FillSolidRect(ww / 2 - 110 + 54 * active_device, 25, 53, 8, RGBA(19, 30, 38, 150));
// gr.FillSolidRect(ww / 2 - 74 + 55 * active_device, 28, 38, 2, RGBA(245, 55, 0, 230));
}
// ----- EVENTS ----------------------------------------------------
function on_size() {
ww = window.Width;
wh = window.Height;
Buttons.DEV.changePos(ww / 2 - 110, 22, 55, 14);
Buttons.DEV.alterImage(r);
Buttons.EXT.changePos(ww / 2 - 55, 22, 55, 14);
Buttons.EXT.alterImage(s);
Buttons.SHARED.changePos(ww / 2 + 0, 22, 55, 14);
Buttons.SHARED.alterImage(t);
Buttons.ASIO.changePos(ww / 2 + 55, 22, 55, 14);
Buttons.ASIO.alterImage(u);
}
function activedevice() {
window.SetProperty("active device buttons", active_device)
window.Repaint();
}
WSH Panel Mod ({B38385B4-7CBE-4019-BB99-8CCE46084548}): Parsing file "C:\Utilities\foobar2000\themes\DarkOne\Others\WSH Scripts\DO Global Script.js"
WSH Panel Mod ({B38385B4-7CBE-4019-BB99-8CCE46084548}): Parsing file "C:\Utilities\foobar2000\themes\DarkOne\Others\WSH Scripts\DO Global Button Script.js"
WSH Panel Mod ({B38385B4-7CBE-4019-BB99-8CCE46084548}): initialized in 3 ms
Error: WSH Panel Mod ({B38385B4-7CBE-4019-BB99-8CCE46084548}): Microsoft JScript runtime error:
Object expected
File: <main>
Ln: 46, Col: 5
<source text only available at compile time>
// DarkOne v2.1 Control Panel
// Code by T.P Wang and tedGo
// ==PREPROCESSOR==
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Script.js"
// @import "%fb2k_path%themes\DarkOne\Others\WSH Scripts\DO Global Button Script.js"
// ==/PREPROCESSOR==
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));}
window.MinWidth = 280;
var active_device = window.GetProperty("active device buttons", 0);
// ----- CREATE BUTTONS --------------------------------------------
var imgPath = fb.foobarPath + "themes\\DarkOne\\Buttons\\Control\\";
var button_dev = gdi.Image(imgPath + "outputMH.png");
var btn_font = gdi.Font("Tahoma", 12, 0);
var r = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var s = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var t = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
var u = {normal: imgPath + "output.png", hover: imgPath + "outputMH.png"};
Buttons.DEV = new Button(ww / 2 - 110, 22, 55, 14, r, function(){active_device = 0, activedevice(), fb.RunMainMenuCommand("Playback/Device/Preferences...")}, "Output");
Buttons.EXT = new Button(ww / 2 - 55, 22, 55, 14, s, function(){active_device = 1, activedevice(), fb.RunMainMenuCommand("Playback/Device/KS : AudioQuest DragonFly");}, "External");
Buttons.SHARED = new Button(ww / 2 + 0, 22, 55, 14, t, function(){active_device = 2, activedevice(), fb.RunMainMenuCommand("Playback/Device/WASAPI (shared) : Speakers (Realtek(R) Audio)");}, "Shared");
Buttons.ASIO = new Button(ww / 2 + 55, 22, 55, 14, u, function(){active_device = 3, activedevice(), fb.RunMainMenuCommand("Playback/Device/ASIO : Realtek ASIO");}, "ASIO");
// ----- DRAW ------------------------------------------------------
function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, ui_backcol);
buttonsDraw(gr);
var x2 = ww / 2 - 110;
var x3 = ww / 2 - 55;
var x4 = ww / 2 + 0;
var x5 = ww / 2 + 55;
/*
gr.GdiDrawText("Output", btn_font, ui_btntxtcol, x2, 06, 55, 12, 33);
gr.GdiDrawText("External", btn_font, ui_btntxtcol, x3, 06, 55, 12, 33);
gr.GdiDrawText("Shared", btn_font, ui_btntxtcol, x4, 06, 55, 12, 33);
gr.GdiDrawText("ASIO", btn_font, ui_btntxtcol, x5, 06, 55, 12, 33);
*/
gr.GdiDrawText("Output", btn_font, active_device == 0 ? RGB(128,192,255) : ui_btntxtcol, x2, 06, 55, 12, 33);
gr.GdiDrawText("External", btn_font, active_device == 1 ? RGB(128,192,255) : ui_btntxtcol, x3, 06, 55, 12, 33);
gr.GdiDrawText("Shared", btn_font, active_device == 2 ? RGB(128,192,255) : ui_btntxtcol, x4, 06, 55, 12, 33);
gr.GdiDrawText("ASIO", btn_font, active_device == 3 ? RGB(128,192,255) : ui_btntxtcol, x5, 06, 55, 12, 33);
gr.DrawImage(button_dev, ww / 2 - 110 + 55 * active_device, 22, 55, 14, 0, 0, 55, 14, 0, 255); //Image 255 alpha
// gr.FillSolidRect(ww / 2 - 110 + 55 * active_device, 25, 55, 8, RGBA(19, 30, 38, 200)); // Down Color
// gr.FillSolidRect(ww / 2 - 100 + 55 * active_device, 27, 38, 2, RGBA(245, 55, 0, 230)); //Orange light
}
// ----- EVENTS ----------------------------------------------------
function on_size() {
ww = window.Width;
wh = window.Height;
Buttons.DEV.changePos(ww / 2 - 110, 22, 55, 14);
Buttons.DEV.alterImage(r);
Buttons.EXT.changePos(ww / 2 - 55, 22, 55, 14);
Buttons.EXT.alterImage(s);
Buttons.SHARED.changePos(ww / 2 + 0, 22, 55, 14);
Buttons.SHARED.alterImage(t);
Buttons.ASIO.changePos(ww / 2 + 55, 22, 55, 14);
Buttons.ASIO.alterImage(u);
}
function activedevice() {
window.SetProperty("active device buttons", active_device)
window.Repaint();
}
Scripting Engine Initialization Failed (Biography, albums, title, similar artist info.www.last.fm. v10062020 by kgena_ua, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).
WSH Panel Mod ({A59FEF58-89B7-4955-B166-24E7D03BCAF8}): initialized in 49 ms
Error: WSH Panel Mod (Biography, albums, title, similar artist info.www.last.fm. v10062020 by kgena_ua): Ошибка выполнения Microsoft JScript:
Невозможно создание объекта сервером программирования объектов
File: <main>
Ln: 298, Col: 1
<source text only available at compile time>
заменитьSergPuh.68:Можно ли сделать как то что бы движение seekbar было не рывками а более плавно?
function on_playback_time(time){
window.Repaint();
}
var seek_timer;
function on_playback_time(time){
seek_timer && window.ClearInterval(seek_timer);
seek_timer = window.SetInterval(function() {
window.Repaint();
}, 40 );
}
SergPuh.68. да куда оно денетсяSergPuh.68:спасибо,работает
Вернуться в Секреты foobar2000