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: WSH Panel Mod (Read 681298 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #1700
@anyone who used this with windows 8 .... was the high cpu usage with JScript9 engine/on_mouse_move fixed by an update to windows 8 or was it only fixed when 8.1 came out?

WSH Panel Mod

Reply #1701
i can't tell, i had this issue with windows 8 but no more under 8.1 or 10, but as it fixed by a windows 8.0 fix or by 8.1, i can't tell...

Re: WSH Panel Mod

Reply #1702
Nevertheless i've made those two toolbars to replace foobar's standard ones :



Seekbar:
Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;
var ww = 270;
var hofset = 10;
var wh = 12;
function on_paint(gr){
var vofset = (window.Height-wh)/2;
var length = fb.PlaybackLength;
var grad = 0;
if (length > 0) {
grad = fb.PlaybackTime/fb.PlaybackLength;}

var i = 0;
while (i < ww+1) {

var col = (grad<=0)  ? RGB(168,168,168) : (i<=grad*ww) ? RGB(0,32+48*(1-i/ww),96+64*(1-i/ww)) :  RGB(128+48*(1-i/ww),128+48*(1-i/ww),128+48*(1-i/ww));
gr.FillSolidRect(hofset+1+i,vofset,4,wh, col);
i = i +5;
}
gr.DrawRect(hofset,vofset, i, wh, 1.0, RGB(192,192,192));
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var v = (x-hofset)/ww;
v = (v<0) ? 0 : (v<1) ? v : 1;
fb.PlaybackTime = fb.PlaybackLength * v;



}

}
function on_mouse_wheel(delta){
if(delta>0)
fb.PlaybackTime = fb.PlaybackTime + delta;
else
fb.PlaybackTime = fb.PlaybackTime + delta;
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
Thanks NEMO7538 for the code.
I adapted it to my foobar2000 so the seekbar autoexpand to the window width.

Code: [Select]
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;
var ww = 820;
var hofset = 20;
var wh = 24;
function on_paint(gr){
var vofset = (window.Height-wh)/2;
    var ww = window.Width-(2*hofset);
var length = fb.PlaybackLength;
var grad = 0;
if (length > 0) {
grad = fb.PlaybackTime/fb.PlaybackLength;}

var i = 0;
while (i < ww+1) {

var col = (grad<=0)  ? RGB(168,168,168) : (i<=grad*ww) ? RGB(100,32+48*(1-i/ww),96+64*(1-i/ww)) :  RGB(128+48*(1-i/ww),128+48*(1-i/ww),128+48*(1-i/ww));
gr.FillSolidRect(hofset+1+i,vofset,4,wh, col);
i = i +5;
}
gr.DrawRect(hofset,vofset, i, wh, 1.0, RGB(192,192,192));
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var v = (x-hofset)/ww;
v = (v<0) ? 0 : (v<1) ? v : 1;
fb.PlaybackTime = fb.PlaybackLength * v;



}

}
function on_mouse_wheel(delta){
if(delta>0)
fb.PlaybackTime = fb.PlaybackTime + delta;
else
fb.PlaybackTime = fb.PlaybackTime + delta;
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}


Re: WSH Panel Mod

Reply #1703
Enjoy my glowing bluishness:
I don't remember if I have already post this or not, but here it is the seek bar I use, which is one of the best I've seen. I didn't make it though, I found it somewhere in the 'interwebs':

Code: [Select]
// =========================
// Info Bar 0.1.2
// Copyright ©2010 Lediur
// --------------
// Completely rewritten from the stock WSH Panel progress bar script.
// Licensed under BSD License
// =========================

// =========================
// License bits
// ------------
// This script is considered an addon for WSH Panel Mod.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
// AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
// OF SUCH DAMAGE.
// =========================

// =========================
// Basic functions
// =========================

// =========================
// Evaluates color input
// INPUT: 3 values, RED GREEN BLUE;
//        4 values, RED GREEN BLUE ALPHA;
//
// RETURNS: Byte value representing the selected color
// =========================

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)); }

// =========================
// Evaluates time from seconds
// INPUT: 1 value, SECONDS
//
// RETURNS: A formatted string representing the desired time.
// =========================

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);
}
//----------------------------------------------------------------------------

// =========================
// String variables
// =========================

//var title;
//var artist;
//var status;
//var time;
//var s_playbackOrder = "<NOT ACCESSIBLE>";
var title = "foobar 2000 ";
var artist = "v1.3.8";
//var artist = "%_foobar2000_version%";

var status;
var time;
var s_playbackOrder = "";

// =========================
// Animation information
// =========================

var playback_alpha = 128;
var playback_XPos = 0;
var playback_animating = false;
var animation_timer = false;

// =========================
// Fonts
// =========================

var title_fontsize = 36;
var artist_fontsize = 20;

var g_titlefont = gdi.Font("Arial", title_fontsize, 1);
var g_artistfont = gdi.Font("Arial", artist_fontsize, 1);
var g_statusfont = gdi.Font("Arial", 24, 1);
var g_timefont = gdi.Font("Segoe UI", 28, 2);
//var g_trackfont = gdi.Font("Arial", 18, 1);

var title_sizelimit = 36;
var artist_sizelimit = 20;

var title_width = 0;
var artist_width = 0;

// =========================
// Dimension information
// =========================

var info_width;
var margin = 20;

// =========================
// Title Formats
// =========================

var g_title = fb.TitleFormat("%title%");
var g_artist = fb.TitleFormat("[%artist%] / [%album%]");
var g_time = fb.TitleFormat("%playback_time%/%length%");
var g_status = fb.TitleFormat("♥%rating% ♪%play_count% %codec% %samplerate%Hz $caps(%channels%) %bitrate%kbps ");
//var g_track = fb.TitleFormat("%track%");

// =========================
// Boolean variables for seek-checking
// =========================

var g_drag = 0;
var g_drag_seek = 0;

// =========================
// Gradient settings
// =========================

var c_progtop = RGB(0,150,255);
var c_progbot = RGB(0,50,200);
var c_proglead = RGBA(0,30,255,255);

// =========================
// Timer for updating progress bar and other items
// =========================

var f_timer;
var timer_interval = 50;
var timer_interval_animation = 5;

function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var pos = 0;
var length = fb.PlaybackLength;
    gr.SetTextRenderingHint(4);
    gr.SetSmoothingMode(2);

// =========================
// Evaluation of information
// =========================

if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
title = "Seeking: ";
            time =  TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else{
pos = window.Width * (fb.PlaybackTime / length);
               
title = g_title.Eval();
//            track = g_track.Eval();
            artist = g_artist.Eval();
            time = g_time.Eval();
            status = g_status.Eval();
}
}
   
    // =========================
// Title Size Update
// =========================
   
    title_width = Math.round((gr.MeasureString(title,g_titlefont,0,0,ww,wh,0x00000400)).Width);
   
    if(title_fontsize > title_sizelimit)
title_fontsize = title_sizelimit;
       
    if(title_width > Math.round(ww - info_width - wh/2 - margin) || title_fontsize > title_sizelimit)
    {
        title_fontsize -= ( title_width-Math.round(ww - info_width - wh/2 - margin) )/100;
    }
    else if (title_width < Math.round(ww - info_width - wh/2 - margin) && title_fontsize < title_sizelimit)
    {
        title_fontsize += ( Math.round(ww - info_width - wh/2 - margin) - title_width)/100;
    }

g_titlefont = gdi.Font("Arial", title_fontsize, 1);
   
    // =========================
// Artist Size Update
// =========================
   
    artist_width = Math.round((gr.MeasureString(artist,g_artistfont,0,0,ww,wh,0x00000400)).Width);
   
    if(artist_fontsize > artist_sizelimit)
artist_fontsize = artist_sizelimit;
       
    if(artist_width > Math.round(ww - info_width - wh/2 - margin) || artist_fontsize > artist_sizelimit)
    {
        artist_fontsize -= ( artist_width - Math.round(ww - info_width - wh/2 - margin) )/100;
    }
    else if (artist_width < Math.round(ww - info_width - wh/2 - margin) && artist_fontsize < artist_sizelimit)
    {
        artist_fontsize += ( Math.round(ww - info_width - wh/2 - margin) - artist_width)/100;
    }

g_artistfont = gdi.Font("Arial", artist_fontsize, 2);
   
// =========================
// FillGradRect ( Starting X, Starting Y, Width, Height, Gradient Rotation, Starting Color, Ending Color )
// =========================

    // Background Bar
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(0,0,0), RGB(11,22,32));
   
    // Progress Bar
gr.FillGradRect(  0, 0,    pos, wh, 90, c_progtop, c_progbot);
   
    // Progress Bar Leader
    gr.FillGradRect(pos-3, 0, 50, wh, 180, RGBA(0,0,0,0), c_proglead);
   
    // Right Gradient
    gr.FillGradRect(ww-100, 0, 250, wh, 0, RGBA(0,0,0,0), RGBA(17,66,170,255));

// =========================
// DrawString ( Output String, Output Font, Color, Starting X, Starting Y, Width, Height, Hex Values )
// =========================

// =========================
// /!\ NOTICE
// =========================
// These values were determined through trial and error.
// They work fine on my computer and resolution, but
// you might want to tweak them to fit your taste.
// -------------------------
// Unfortunately, I don't have documentation for the hex values.
// Here's what I figured out so far, though.
//
// 1: Alignment (0: left, 1: center, 2: right)
// =========================

//    gr.DrawString(g_track.Eval(), gdi.Font("Arial", 18, 1), RGB(190,200,250), wh/14, -wh/10, ww-250, wh, 0x01000000);
//    gr.DrawString(title, g_titlefont, RGB(255,255,255), wh/2.5, -wh/5.7, ww-250, wh, 0x01000000);
    gr.DrawString(title, g_titlefont, RGB(255,255,255), wh/4, -wh/4, ww-250, wh, 0x01000000);
    gr.DrawString(artist, g_artistfont, RGB(255,255,255), wh/2.5, wh/4.5, ww-250, wh, 0x01000000);
    gr.DrawString(time, g_timefont, RGB(255,255,255), 0-wh/6, -wh/6.5, ww, wh, 0x21000000);
    gr.DrawString(status, g_statusfont, RGB(254,168,0), 0-wh/6, wh/4.5, ww, wh, 0x21000000);
   
    // Background Title
    info_width = (gr.MeasureString(status,g_statusfont,0,0,ww,wh,0x00000400)).Width;
  
    AnimateBackgroundTitle();
    gr.DrawString(s_playbackOrder, g_statusfont, RGBA(255,255,255,playback_alpha), ww-wh/6-info_width+playback_XPos, 0-wh/6.5, ww, wh, 0x01000000);
}

function AnimateBackgroundTitle(){
   
    if(playback_animating)
    {
        if(!animation_timer){
            //fb.trace("-- Animation timer on - setting timer interval to " + timer_interval_animation);
            //fb.trace("-- Animation starting: >");
            f_timer = window.CreateTimerInterval(timer_interval_animation);
            animation_timer = true;
        }
        if(playback_XPos <= 0)
            playback_XPos = 0;
           
        if(playback_alpha > 128)
            playback_alpha = 128;
           
        playback_XPos -= 1;
        playback_alpha += 1;
    }
   
    if(playback_animating && (playback_XPos <= -1 || playback_alpha >= 129))
    {
        playback_animating = false;
        //fb.trace("-- Animation finished.");
        playback_XPos = 0;
        playback_alpha = 128;
    }
   
    if(!playback_animating && animation_timer){
        //fb.trace("-- Animation timer off - setting timer interval to " + timer_interval);
        f_timer = window.CreateTimerInterval(timer_interval);
        animation_timer = false;
    }
}

// =========================
// Resizes the text in the info panel
// INPUT: WSH Panel HEIGHT, WSH Panel WIDTH,
//
// RETURNS: Byte value representing the selected color
// =========================

// =========================
// /!\ NOTICE
// =========================
// These values were determined through trial and error.
// They work fine on my computer and resolution, but
// you might want to tweak them to fit your taste.
// =========================

function updateSize(){
   
    var font_size = title_sizelimit;
   
    // ====== TITLE SIZE COMPENSATION ======
/*
    font_size = (window.Width - 50) / 25 + (window.Height-200)/10;
    factor = (window.Width - 400) / 100;

// Upper-bound font size limiter
if(font_size > 36)
font_size = 36;
       
// If we don't check for this we get the JavaScript
// equivalent of a NullPointerException.
if (title != null){
        font_size -= title.length / 100;
       
// Upper-bound width limiter
if(window.Width > 800) {
factor = 0;
            font_size -= title.length / 100;
        }
           
// Lower-bound width limiter
        if(window.Width < 300)
font_size += window.Width / 70;

// Try to check for excessively long titles
if(title.length > 50)
font_size -= title.length / 7;

if(title.length > 70)
font_size -= title.length / 50;
}*/
   
    // Upper-bound font size limiter
   
     // ====== ARTIST SIZE COMPENSATION ======
     /*
     font_size = (window.Width - 50) / 40 + (window.Height-200)/20;

// Upper-bound font size limiter
if(font_size > 24)
font_size = 24;

// If we don't check for this we get the JavaScript
// equivalent of a NullPointerException.       
if (artist != null){
// Upper-bound width limiter
if(window.Width > 800)
font_size -= artist.length / 120;

// Lower-bound width limiter
        if(window.Width < 300)
font_size += window.Width / 90;

// Try to check for excessively long titles
if(artist.length > 80)
font_size -= artist.length / 22;

if(artist.length > 120)
font_size -= 6;
}

g_artistfont = gdi.Font("Arial", font_size, 2);
   
    */
   
     // ====== TIME SIZE COMPENSATION ======
    
     font_size = (window.Height - 5) / 2;
    
     g_timefont = gdi.Font("Arial", font_size, 2);
    
     // ====== STATUS SIZE COMPENSATION ======
    
     font_size = (window.Height - 5) / 4;
    
     g_statusfont = gdi.Font("Arial", font_size, 1);
}

// =========================
// Some of this stuff may be redundant,
// but it works fine on everything I've listened
// to so far.
// =========================

function on_size(){
updateSize();
}

function on_focus(focused){
//fb.trace("focus " + focused);
}

function on_key_down(key){
//fb.trace("key " + key);
}

function on_mouse_lbtn_down(x,y){
g_drag = 1;
    g_drag_seek = x / window.Width;
    window.Repaint();
}

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;
}
}

// =========================
// Allow for seeking
// =========================
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(delta){
fb.PlaybackOrder += delta * 2;
    if(fb.PlaybackOrder > 4)
        fb.PlaybackOrder = 0;
   
            if(fb.PlaybackOrder == 4)
            {
                //fb.trace("Playback Order: Shuffle");
                s_playbackOrder = "Shuffle";
            }
            else if (fb.PlaybackOrder == 2)
            {
                //fb.trace("Playback Order: Repeat");
                s_playbackOrder = "Repeat";
            }
            else
            {
                //fb.trace("Playback Order: Sequential");
                s_playbackOrder = "Sequential";
            }
           
    playback_XPos = 128;
    playback_alpha = 0;
    playback_animating = true;
}

// =========================
// Create a timer for updating the bar.
// =========================
function on_playback_starting(cmd, paused){
    f_timer = window.CreateTimerInterval(timer_interval);
}

// =========================
// Update information, repaint on new track.
// =========================
function on_playback_new_track(info){  
    c_progtop = RGB(0,150,255);
    c_progbot = RGB(0,50,200);
    c_proglead = RGBA(0,30,255,255);
   
    if(fb.PlaybackOrder == 4)
        s_playbackOrder = "Repeat";
    else if (fb.PlaybackOrder == 2)
        s_playbackOrder = "Shuffle";
    else
        s_playbackOrder = "Sequential";
       
    title_fontsize = 36;
    artist_fontsize = 20;

title = g_title.Eval();
    artist = g_artist.Eval();
    time = g_time.Eval();
    status = g_status.Eval();
   
updateSize();
    window.Repaint();
}

// =========================
// Playback Stop
// =========================
function on_playback_stop(){

// CPU usage saver
    if(f_timer){window.KillTimer(f_timer);}
updateSize();
window.Repaint();
}

// =========================
// Repaint every time we seek
// =========================
function on_playback_seek(time){
window.Repaint();
}

// =========================
// Changes the color of the bar based on the pause state.
// =========================
function on_playback_pause(state){
    if(state){
        if(f_timer){window.KillTimer(f_timer);}
    } else {
        f_timer = window.CreateTimerInterval(timer_interval);
    }
    //c_progtop = state ?  RGB(100,100,140) : RGB(0,150,255);
    //c_progbot = state ?  RGB(50,50,100) : RGB(0,50,200);

    c_progtop = state ?  RGB(0,0,30) : RGB(0,150,255);
    c_progbot = state ?  RGB(0,0,0) : RGB(0,50,200);
   
    // c_proglead = state ?  RGB(5,29,84) : RGBA(20,30,255,255);
    c_proglead = state ?  RGB(10,58,168) : RGBA(20,30,255,255);
    window.Repaint();
}

// =========================
// Repaint every tick
// =========================
function on_timer(){
    window.Repaint();
}
//EOF

 

Re: WSH Panel Mod

Reply #1704
that script contains old functions no longer supported in this component. i do mention it in the readme but it's completely my fault for not providing a link to it from the releases page. sorry for the inconvenience.

https://github.com/19379/foo_uie_wsh_panel_...aster/README.md

you should use the official component because i'm not updating other people's scripts.
Ok, I'm understand, but, I don't know who write this script, and can't write new one. I'm a medic. Mark, may be ... you look it, pleeeeees....

Eiko was too old, so do not try to update it's WSH Panel Mod component to 1.5.6+.
A rose will bloom, it then will fade.

 
SimplePortal 1.0.0 RC1 © 2008-2021