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 814873 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #1000
Hello,

after updating to version 1.4.0.beta3, i'm receiving Invalid procedure call or argument
on gr.drawimage(...

Has something changed in this version which causes something what worked, not to work anymore?


I found out it had to do with the defining of the pictures.
<3 f00

WSH Panel Mod

Reply #1001
I had the same problem compiling component under VS2008 as saivert had (see this post):

MIDL2335: illegal expression type in constant FillGradRect

Solved this by changing [defaultvalue(1.0)] to [defaultvalue(1)], ie
from
STDMETHOD(FillGradRect)(float x, float y, float w, float h, float angle, DWORD color1, DWORD color2, [defaultvalue(1.0)] float focus);
to
STDMETHOD(FillGradRect)(float x, float y, float w, float h, float angle, DWORD color1, DWORD color2, [defaultvalue(1)] float focus);

Hope this will help somebody.

WSH Panel Mod

Reply #1002
Hello! Thanks for the beta 4. It works fine but I think it would be better to uncheck Delay Load by default.

 

WSH Panel Mod

Reply #1004
Hello! Thanks for the beta 4. It works fine but I think it would be better to uncheck Delay Load by default.


+1 for the default state of this new option "Delay Load"

> is this option for fixing the reported problem with fb.IsAutolaylist() that is not affected on panel first on_size() call ? i think so cause i've emulated this delay in the script i use to fix this problem , SO Thanx a lot

> when "Delay Load" is activated, on foobar launch, we see the WSH panel like it was in ERROR, and it turns to normal display (paint) after the delay ... it's really ugly IMHO, could the panel turnned to a default plain color instead  (black?) ?

btw, thanx for the new beta, i will now test the playlist count item

WSH Panel Mod

Reply #1005
Hmm, weird behaviour just happened!

a Script Error in one of my WSH panels on a condition line ( if(gr.CalcTextWidth(fit_txt, artist_default_font)>(ww - 60 - time_w)) { ...), then, all my panels (WSH or others too!) turned to black with glitch display (no more RePaint calls ...) then foobar had crashed with no dump at all ...

i keep testing this 1.4.0 beta 4 ...

WSH Panel Mod

Reply #1006
Hmm, weird behaviour just happened!

a Script Error in one of my WSH panels on a condition line ( if(gr.CalcTextWidth(fit_txt, artist_default_font)>(ww - 60 - time_w)) { ...), then, all my panels (WSH or others too!) turned to black with glitch display (no more RePaint calls ...) then foobar had crashed with no dump at all ...

i keep testing this 1.4.0 beta 4 ...

i haven't reproduced it, i hope it was due to my bad scripting !

==> just happened twice in 10 minutes ... the last time was different from the 2 previous ones : no panel SCRIPT ERROR, just a WSH panel turned to white, another (never in error before too) goes in SCRIPT ERROR, another is no more refreshed (WSH lyrics panel), and the foobar toolbar has bad redraw, like the ELPlaylist that finally turn to black (foobar MENU is affected too, no refresh, item turned to black and refresh on mouse hover only

i use foobar 1.1.1 and WSH panel 1.4.0 beta 4

here is a screeshot of the display problems (and commands down too, can't display the console and other commands ...):
[a href=\"http://img534.imageshack.us/i/glitches.png/\" target=\"_blank\"] , by chance, i do backups often

------------------------------------------------

PlaylistItemCount works fine...


WSH Panel Mod

Reply #1007
returned to Beta 4, because i realize that i've installed a new component today, just before the beta 4 of WSH panel mod ... it's foo_keep_queue_0.3.3, and it could be the cause of these issues too ! sdo i've just removed it, and re-installed the beta 4 ... let's see what's going on.

EDIT: bad news

it still happens  even without foo_keep_queue



now, i have no doubt, so i return to beta 3 to be sure at 100%.

WSH Panel Mod

Reply #1008
i confirm the stability of the beta 3, all is fne, so beta 4 has to be fixed, good luck T.P.

WSH Panel Mod

Reply #1009
beta4: What does mean
Quote
Aw, crashed ":("

white on blue, during foobar2000-startup?


it is equal to the SCRIPT ERROR appearing on previous versions.
mad messy misanthropist morbid mused

WSH Panel Mod

Reply #1010
WSH Panel Mod 1.4.0 Beta 5 uploaded.
The value of "dealy load" will be reset to false from previous build.

WSH Panel Mod

Reply #1011
WSH Panel Mod 1.4.0 Beta 5 uploaded.
The value of "dealy load" will be reset to false from previous build.


still crashing (freeze) as beta 4 did  ... happens after playing some tracks ...

all was fine in beta 5 UNTIL i right click a wsh panel (now playing WSH panel with track info + time elapse) to select "Configure..." entry, it opens the WSH editor window, but all is white, no script visible, and i'm stuck, then panel fall in Script ERROR immediatly. This time, i can use the foobar menu to open the console, and the line in error is not the same than yesterday but it's about (again!) on the use of CalcTextWidth function ! :
    var time_font = gdi.Font("segoe ui", 36, 1);
>  var time_w = gr.CalcTextWidth(((fb.IsPlaying)?g_playback_time:"0:00")+" / "+g_length, time_font)
    ...

here are 2 screenshots :


good luck to find what's wrong!



WSH Panel Mod

Reply #1012
Falstaff, I use gr.CalcTextWidth in some scripts but it works good. Still may be some plugin conflicts in your Foo2k?

WSH Panel Mod

Reply #1013
Falstaff, I use gr.CalcTextWidth in some scripts but it works good. Still may be some plugin conflicts in your Foo2k?

i didn't say that it was the cause, just a remark for T.P, twice script error happened on the freeze of all the repaint WSH and glitches on foobar windows (any panels, WSH or not)

btw, i don't think i have exotic component, check below:


but i've just remove shpeck component, even if it was not used in the config, i keep testing. ==> just happened again Grrrr. Beta 3 cause no problem at all

WSH Panel Mod

Reply #1014
i have reduced the list of the components to the minimum to run my config, it just rest these :


...after playing some tracks, it keeps crashing (always the same panel in script error first, with all panels repaint freezed + toolbars too!)

EDIT:

i've removed foo_uie_channel_spectrum and foo_covers2 ==> ALWAYS REPAINT/FREEZE problem, with same Script Error on the same panel,

SO, if it's due to a bug in Beta 4 or 5, it's maybe triggered by my WSH script panel that always fall in error, so, here is the panel script, Thanx for using it for testing on your config (panel size used is ~ 600x120 pixels)

HOW TO REPRODUCE THE CRASH ? ==> i keep use NEXT TRACK playback action (tracks plays 1 or 2 seconds), to change tracks from a big playlist (happens too in a playlist with only one track, always repeated so), it takes differents number of track starts to get the problem [10:100] ...
(maybe with a script edit on the panel before, ... hard to say)

maybe a buffer overflow problem ?


Code: [Select]
//=================================================// Options
var c1 = RGB(20, 60, 120);

//=================================================// Title Format
var g_path = fb.TitleFormat("$left(%_path_raw%,4)");
var elap_seconds = fb.TitleFormat("%playback_time_seconds%");
var len_seconds = fb.Titleformat("%length_seconds%");
var first_played = fb.Titleformat("%first_played%");
var last_played = fb.Titleformat("%last_played%");
var play_counter = fb.Titleformat("%play_counter%");
var play_count = fb.Titleformat("%play_count%");

var tf_title = fb.TitleFormat("$if2(%title%,'N/A')");
var tf_artist = fb.TitleFormat("$if2(%artist%,'N/A')");
var tf_album = fb.TitleFormat("$if2(%album%,'Single')");
var tf_date = fb.TitleFormat("[%date%])");

var tf_playback_time = fb.TitleFormat("%playback_time%");
var tf_length = fb.TitleFormat("%length%");

//=================================================// Constants

// Use with GdiDrawText()
// {{
var DT_LEFT = 0x00000000;
var DT_RIGHT = 0x00000002;
var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_EDITCONTROL = 0x00002000;
var DT_END_ELLIPSIS = 0x00008000;
// }}

var ButtonStates = {
    normal: 0,
    hover: 1,
    down: 2
};

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

//Text formatting function
function StringFormat() {
    var h_align = 0,
        v_align = 0,
        trimming = 0,
        flags = 0;
    switch (arguments.length) {
            // fall-thru
        case 4:
            flags = arguments[3];
        case 3:
            trimming = arguments[2];
        case 2:
            v_align = arguments[1];
        case 1:
            h_align = arguments[0];
            break;
        default:
            return 0;
        }
    return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}

StringAlignment = {
    Near: 0,
    Centre: 1,
    Far: 2
};

function num(strg, nb) {
    var i;
    var str = strg.toString();
    var k = nb - str.length;
    if(k>0) {
        for(i=0;i<k;i++) {
            str = "0" + str;
        }
    }
    return str.toString();
}

var l_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
var c_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
var r_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);

var g_metadb;
var g_notify_info = {};
var g_timer;
var g_timer_count=0;
var g_playback_time;
var g_length;

// Common global variables
var ww = window.Width;
var wh = window.Height;
var mouse_x;
var mouse_y;

//=================================================// Panel Callbacks
function on_size() {
    var i;
    ww = window.Width;
    wh = window.Height;
    on_item_focus_change();
}

function on_paint(gr) {
    var i;
    var fit_txt;
   
    gr.SetTextRenderingHint(3);

    // --- Default background colour
    gr.FillSolidRect(0, 0, ww, wh, c1);
    gr.FillGradRect(0, 0, ww, wh, 90, RGBA(255, 255, 255, 40), RGBA(255, 255, 255, 0));

    // --- Top shadow
    gr.FillGradRect(-20, 0, ww+40, 9, 90, RGBA(0,0,0,200), RGBA(0,0,0,0));

    // --- Time elpased / total
    var time_font = gdi.Font("segoe ui", 36, 1);
    var time_w = gr.CalcTextWidth(((fb.IsPlaying)?g_playback_time:"0:00")+" / "+g_length, time_font)
    var time_bg_colour = RGBA(0, 0, 0, 70);
    var time_colour = RGBA(140, 200, 240, (250-g_timer_count*10));
    gr.DrawString(((fb.IsPlaying)?g_playback_time:"0:00")+" / "+g_length, time_font, time_bg_colour, ww-time_w-10, 12, time_w, 32, r_stringformat);
    gr.DrawString(((fb.IsPlaying)?g_playback_time:"0:00")+" / "+g_length, time_font, time_colour, ww-time_w-10, 10, time_w, 32, r_stringformat);

    // --- Status Icon (Play/Pause/Stop)
    if(fb.IsPlaying && !fb.IsPaused) {
        gr.SetSmoothingMode(2);
        var points1 = Array(10,19,26,26,10,33);
        gr.FillPolygon(RGBA(0, 0, 0, 70), 0, points1);
        var points2 = Array(10,17,26,24,10,31);
        if(g_timer_count==0) {
            gr.FillPolygon(RGBA(140, 200, 240, 250), 0, points2);
        }
        gr.SetSmoothingMode(0);
    } else if(fb.IsPaused) {
        gr.FillSolidRect(10, 19, 6, 14, RGBA(0, 0, 0, 70));
        gr.FillSolidRect(10, 17, 6, 14, RGBA(140, 200, 240, 250));
        if(g_timer_count==0) {
            gr.FillSolidRect(20, 19, 6, 14, RGBA(0, 0, 0, 70));
            gr.FillSolidRect(20, 17, 6, 14, RGBA(140, 200, 240, 250));
        }
    } else {
        gr.FillSolidRect(10, 19, 16, 14, RGBA(0, 0, 0, 70));
        if(g_timer_count==0) {
            gr.FillSolidRect(10, 17, 16, 14, RGBA(140, 200, 240, 250));
        }
    }
   
    // --- TRACK TITLE INFO
    var title_default_font = gdi.Font("segoe ui", 20, 1);
    var title_font = gdi.Font("segoe ui", (20+g_timer_count*5), 1);
    var title_bg_colour = RGBA(0, 0, 0, 70);
    var title_colour = RGBA(140, 200, 240, 250-g_timer_count*10);
    fit_txt = "";
    if(g_notify_info.title) {
        for(i=0;i<g_notify_info.title.length;i++) {
            fit_txt = fit_txt + g_notify_info.title.substring(i,i+1);
            if(gr.CalcTextWidth(fit_txt, title_default_font)>(ww - 80 - time_w)) {
                fit_txt = fit_txt + "...";
                break;
            }
        }
    }
    gr.DrawString(fit_txt, title_default_font, title_bg_colour, 32, 10, (ww - 32 - time_w - 10), wh, lt_stringformat);
    gr.DrawString(fit_txt, title_font, title_colour, 32-g_timer_count*3, 08-g_timer_count*05, (ww - 32 - time_w - 10)*g_timer_count, wh, lt_stringformat);

    // --- ARTIST INFO
    var artist_default_font = gdi.Font("segoe ui", 15, 1);
    var artist_font = gdi.Font("segoe ui", (15+g_timer_count*5), 1);
    var artist_bg_colour = RGBA(0, 0, 0, 70);
    var artist_colour = RGBA(220, 240, 250, 250-g_timer_count*10);
    fit_txt = "";
    if(g_notify_info.artist) {
        for(i=0;i<g_notify_info.artist.length;i++) {
            fit_txt = fit_txt + g_notify_info.artist.substring(i,i+1);
            if(gr.CalcTextWidth(fit_txt, artist_default_font)>(ww - 60 - time_w)) {
                fit_txt = fit_txt + "...";
                break;
            }
        }
    }
    gr.DrawString(fit_txt, artist_default_font, artist_bg_colour, 10, 44, (ww + 50), wh, lt_stringformat);
    gr.DrawString(fit_txt, artist_font, artist_colour, 10+g_timer_count*3, 42-g_timer_count*1, (ww - 40)*g_timer_count, wh, lt_stringformat);

    // --- ALBUM INFO
    var album_default_font = gdi.Font("segoe ui", 13, 1);
    var album_font = gdi.Font("segoe ui", (13+g_timer_count*4), 1);
    var album_bg_colour = RGBA(0, 0, 0, 70);
    var album_colour = RGBA(225, 155, 055, (250-g_timer_count*10));
    fit_txt = "";
    if(g_notify_info.album) {
        var line = g_notify_info.date.length>0?g_notify_info.album+" - ["+g_notify_info.date+"]":g_notify_info.album;
        for(i=0;i<line.length;i++) {
            fit_txt = fit_txt + line.substring(i,i+1);
            if(gr.CalcTextWidth(fit_txt, album_default_font)>(ww - 60 - time_w)) {
                fit_txt = fit_txt + "...";
                break;
            }
        }
    }
    gr.DrawString(fit_txt, album_default_font, album_bg_colour, 10, 71, (ww + 50), wh, lt_stringformat);
    gr.DrawString(fit_txt, album_default_font, album_colour, 10, 69, (ww - 40), wh, lt_stringformat);


}

//=================================================// Playlist Callbacks
function on_playlists_changed() {
    on_item_focus_change();
}

function on_playlist_switch() {
    on_item_focus_change();
}

//=================================================// Mouse Callbacks
function on_mouse_lbtn_down(x, y) {
}

function on_mouse_lbtn_up(x, y) {
}

function on_mouse_rbtn_down(x, y) {
}

function on_mouse_rbtn_up(x, y) {
}

function on_mouse_move(x, y) {
}

//=================================================// Other Callbacks
function on_focus(is_focused) {
}

function on_timer(id) {
    if(g_timer) {
        if(g_timer.ID == id) {
            g_timer_count-=2;
            if(g_timer_count<=0) {
                g_timer_count = 0;
                window.KillTimer(g_timer);
            }
            window.Repaint();
        }
    }
}

//=================================================// Playback Callbacks
function on_playback_time(time) {
    g_playback_time = tf_playback_time.Eval();
    g_length = tf_length.Eval();
    window.Repaint();
}

function on_playback_seek(time) {
    on_item_focus_change();
}

function on_playback_new_track(info) {
    g_timer && window.KillTimer(g_timer);
    g_timer_count = 20;
    g_timer = window.CreateTimerInterval(50);
    on_item_focus_change();
}

function on_playback_pause() {
    window.Repaint();
}

function on_playback_stop(reason) {
    g_timer && window.KillTimer(g_timer);
    on_item_focus_change();
}

//=================================================// MetaDB Callbacks
function on_item_focus_change() {
    if(g_metadb) {
        window.UnwatchMetadb();
    }
    // enforce TF_mode to Now playing regardless foobar preferences setting
    g_metadb = (fb.IsPlaying||fb.IsPaused)?fb.GetNowPlaying():fb.GetFocusItem();
    if(g_metadb) {
        on_metadb_changed();
        window.WatchMetadb(g_metadb);
    }
}

function on_metadb_changed() {
    g_playback_time = tf_playback_time.Eval();
   
    g_length = tf_length.EvalWithMetadb(g_metadb);
    g_notify_info.g_metadb = g_metadb;
   
    g_notify_info.title = tf_title.EvalWithMetadb(g_metadb);
    g_notify_info.artist = tf_artist.EvalWithMetadb(g_metadb);
    g_notify_info.album = tf_album.EvalWithMetadb(g_metadb);
    g_notify_info.date = tf_date.EvalWithMetadb(g_metadb);

    window.Repaint();
}


WSH Panel Mod

Reply #1015
I've also had some problems with the UI freezing. It only seems to happen during playback, but it stops the playing song from being scrobbled or from being registered as played by playback stats. I seem to have fixed it by commenting out this bit of code:

Code: [Select]
//Scroll lyrics automatically
function on_playback_time(time)
{
    if(showlyrics && !draw_lyrics_failed && !fcstrk && !fb.IsPaused)
    {
        if(time>fb.PlaybackLength*(box_siz)/(2*siz))
        {
            applyDelta( -(siz)/(fb.PlaybackLength) );
            window.Repaint();
        }
    }
}

I figured that was the only bit of code that was doing anything during playback, but I don't know why it would break anything....

Oh and thanks for the trackpopupmenu flags!


WSH Panel Mod

Reply #1017
Hi Falstaff! Just played around with your script on DUI and also CUI with PSS and foobar 1.1.1 + WSH 1.4.0 beta 5 and all seems to work flawlessly, i cannot reproduce any script error here!
By the way nice animation 

WSH Panel Mod

Reply #1018
here is as CUI config file (.fcl) to import for reproduce the freeze and script error. It's just a WSH panel mod in a CUI, so, only 2 components required : ColumnsUI + WSH Panel Mod 1.4.0 beta 5

link: http://br3tt.free.fr/MU/crash_test.zip

the wsh panel change track every seconds, so, let it running in background, and after soe minutes, crash will happen, if not, try to edit (Configure... entry) the WSH script, etc ... it will not long to crash after.

HTH

WSH Panel Mod

Reply #1019
Hi Falstaff! Just played around with your script on DUI and also CUI with PSS and foobar 1.1.1 + WSH 1.4.0 beta 5 and all seems to work flawlessly, i cannot reproduce any script error here!
By the way nice animation 


thanx, but you may haven't run it enough, because, i've just tested the script on another PC, and it crash too, after some minutes ...  so, it's a general problem, not only my PC.

WSH Panel Mod

Reply #1020
Ok after running it a fev minutes, it crashed and foobar freezed.

WSH Panel Mod

Reply #1021
Ok after running it a fev minutes, it crashed and foobar freezed.


pah! you see that i'm not crazy


I insist but, all was ok in beta 3, what changes have you made T.P., maybe the window script editor changes with the delay option? is this option really required ?

WSH Panel Mod

Reply #1022
Okay, I may find that problem... I'm working on it now...


WSH Panel Mod

Reply #1024
WSH Panel Mod 1.4.0 Beta 6 Uploaded, should fix these horrible memory leaks.

Thanks for reporting.