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 816046 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

WSH Panel Mod

Reply #500
The GetAblumArtxxx() function behaves as in fb2k 0.9.5.x or 0.9.6.x, not 1.0.  And It don't have any relationship in CUI.

WSH Panel Mod

Reply #501
I´m using these codes in a rating panel (which are afair not changed from the template here):

Code: [Select]
// painting
function on_paint(gr){
if (g_metadb) {
for (i = 1; i < 6; i++) {
img = gdi.image(fb.FoobarPath + "Images\\ConcreteLove\\"
+ ((i > (g_drag ? lrating : rating)) ? "CLRateOff" : "CLRate" + (g_drag ? "Over" : "")) + ".png");
gr.DrawImage(img, hofset+imgw*(i-1), 0, 28, 34, 0, 0, 28, 34);
}
}
}

//rating
function on_mouse_lbtn_up(x,y){
// fb.trace("button up");
if (lrating !=rating) {if (g_metadb) {
bool = g_metadb.UpdateFileInfoSimple("RATING",lrating);
}}
}
The strange thing is, it writes the code to the file tag, but seems to take it (for painting) from the playback statistics tag, so all in all changes are not seen sometimes in the panel, where the not-yet-updated playback statistics tag is shown. Was there some syntax change in one of the last WSH panel mod vesions?

Or what would you recommend? For the future I would like to stay with tagging via only Playback statistics, but I doubt it´s not updated fast enough to be suitable for a rating panel...
thanks for help.

WSH Panel Mod

Reply #502
i don't know where you got that code from. the examples i've seen posted in this thread all use playback statistics...

Code: [Select]
function on_mouse_lbtn_up(x,y){
    if (lrating !=rating && g_metadb) fb.RunContextCommandWithMetadb("Rating/"+((lrating==0) ? "<not set>" : lrating),g_metadb);
}

WSH Panel Mod

Reply #503
The GetAblumArtxxx() function behaves as in fb2k 0.9.5.x or 0.9.6.x, not 1.0.  And It don't have any relationship in CUI.


Sorry, I don't understand what this implies for using the function to successfully retrieve an artist picture? Doesn't the function get the image data from foobar's internal album art service which is configurable in "Preferences > Display"?

WSH Panel Mod

Reply #504
@marc2003

Thanks a lot, don´t remember, where I got my code from, must have missed this one. Works fine now!

WSH Panel Mod

Reply #505
The GetAblumArtxxx() function behaves as in fb2k 0.9.5.x or 0.9.6.x, not 1.0.  And It don't have any relationship in CUI.


Sorry, I don't understand what this implies for using the function to successfully retrieve an artist picture? Doesn't the function get the image data from foobar's internal album art service which is configurable in "Preferences > Display"?


the options under "Preferences > Display" are new to v1. and as the new SDK hasn't been released yet, no 3rd party component developers can take advantage of that right now.

EDIT: i'm no programmer - that's just an educated guess on how things work.

WSH Panel Mod

Reply #506
i'd like to display the whole foobar menu on one click (on a button)

i've found this since v1.2.1 :

// [1.2.1] New
interface IMainMenuManager {
Methods:
   void Init(root_name);
   // NOTE: the last param is count, not max_id
   void BuildMenu(IMenuObj, base_id, count);
   boolean ExecuteByID(id);
   void Dispose();
}


root_name can be one of the menu entry ("File" or "View" ...)

but is there a root_name value to have the whole menu available?

like that : menuman.Init("Root"); ?

---

// Custom popup menu should always reponse to left-click
function on_mouse_lbtn_down(x, y) {
   var menuman = fb.CreateMainMenuManager();
   var menu = window.CreatePopupMenu();
   var ret;
   
   // Build a menu based on "View"
   menuman.Init("Root");
   menuman.BuildMenu(menu, 1, 128);
   
   // Show menu
   ret = menu.TrackPopupMenu(x, y);
   
   fb.trace(ret);
   
   if (ret > 0)
   {
      // Execute menu commands
      // "ID" is based on which is generated
      menuman.ExecuteByID(ret - 1);
   }
   
   menuman.Dispose();
   menu.Dispose();
}


---

if not available, can this feature be added in a futur version please ?

Thanx by advance

WSH Panel Mod

Reply #507
yeah  it was discussed

WSH Panel Mod

Reply #508
OK, thanks for consideration and clearance 

[edit] would be great if it could be .Init("Main Menu") 


i second that

please, please please


(thanx 2E7AH, i haven't seen these posts about this subject!)

WSH Panel Mod

Reply #509
^someone had found a way to do that(maybe):
Code: [Select]
// Created by YBStone
// Modded by T.P Wang
// Flags, used by Menu
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;

function on_mouse_lbtn_up(x, y) {

    var basemenu = window.CreatePopupMenu();
    var contextman = fb.CreateContextMenuManager();

    contextman.InitNowPlaying();

    var child1 = window.CreatePopupMenu(); //File
    var child2 = window.CreatePopupMenu(); //Edit
    var child3 = window.CreatePopupMenu(); //View
    var child4 = window.CreatePopupMenu(); //Playback
    var child5 = window.CreatePopupMenu(); //Library
    var child6 = window.CreatePopupMenu(); //Help
    var child7 = window.CreatePopupMenu(); //Now playing

    var menuman1 = fb.CreateMainMenuManager();
    var menuman2 = fb.CreateMainMenuManager();
    var menuman3 = fb.CreateMainMenuManager();
    var menuman4 = fb.CreateMainMenuManager();
    var menuman5 = fb.CreateMainMenuManager();
    var menuman6 = fb.CreateMainMenuManager();

    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child1.ID, "File");
    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child2.ID, "Edit");
    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child3.ID, "View");
    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child4.ID, "Playback");
    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child5.ID, "Library");
    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child6.ID, "Help");
    basemenu.AppendMenuItem(MF_STRING | MF_POPUP, child7.ID, "Now Playing");

    menuman1.Init("file");
    menuman2.Init("edit");
    menuman3.Init("View");
    menuman4.Init("playback");
    menuman5.Init("library");
    menuman6.Init("help");

    menuman1.BuildMenu(child1, 1, 100);
    menuman2.BuildMenu(child2, 100, 150);
    menuman3.BuildMenu(child3, 200, 200);
    menuman4.BuildMenu(child4, 300, 250);
    menuman5.BuildMenu(child5, 400, 300);
    menuman6.BuildMenu(child6, 500, 350);

    contextman.InitNowPlaying();
    contextman.BuildMenu(child7, 600, -1);
    ret = 0;

    ret = basemenu.TrackPopupMenu(x, y);

    // fb.trace(ret);
    switch (true)
    {
    case (ret >= 1 && ret < 100):
        menuman1.ExecuteByID(ret - 1);
    break;

    case (ret >= 100 && ret < 200):
        menuman2.ExecuteByID(ret - 100);
        break;

case (ret >= 200 && ret < 300):
        menuman3.ExecuteByID(ret - 200);
break;

    case (ret >= 300 && ret < 400):
        menuman4.ExecuteByID(ret - 300);
break;

    case (ret >= 400 && ret < 500):
        menuman5.ExecuteByID(ret - 400);
break;

    case (ret >= 500 && ret < 600):
        menuman6.ExecuteByID(ret - 500);
break;
   
    case (ret >= 600):
        contextman.ExecuteByID(ret - 600);
break;
    }

    basemenu.Dispose();
    contextman.Dispose();
    menuman1.Dispose();
    menuman2.Dispose();
    menuman3.Dispose();
    menuman4.Dispose();
    menuman5.Dispose();
    menuman6.Dispose();
}


WSH Panel Mod

Reply #510
works for me, thanks 
now I've gained some more space in toolbar

[edit] is there a toolbar limitation of 64 pixels width or similar?

WSH Panel Mod

Reply #511
Thanx T.P but i have a script error here :

Error: WSH Panel Mod (GUID: 6CF0B6A9-AF70-4CF7-8A7D-5ECF8E08C0EA): Erreur d'exécution Microsoft JScript:
Argument ou appel de procédure incorrect
Ln: 50, Col: 1
<no source text available>


it's about the root_item "help" in the code :

menuman6.Init("help");

???

if i change it to "File" (for example), then the script is OK, but i have 2 "File" file menu and no help menu

it's weird, any idea ?

 

WSH Panel Mod

Reply #512
There was a quick fix for WSH Panel Mod of version 1.2.1, released a coup of days ago, you should get the new one.

WSH Panel Mod

Reply #513
I don't have errors but Library submenu doesn't work

WSH Panel Mod

Reply #514
^are you using soft_playlists. i think the problem is that are too many sub menu items for this script to deal with. you just need to modify it so there is a bigger range between each menu.

WSH Panel Mod

Reply #515
good thinking!
thanks Marc

WSH Panel Mod

Reply #516
There was a quick fix for WSH Panel Mod of version 1.2.1, released a coup of days ago, you should get the new one.


you're rigth!

thank you, it's know OK with the lataset 1.2.1 (confusing, you should named it 1.2.1.1 or somthing like that )

now ... returning to play with WSH panel mod

WSH Panel Mod

Reply #517
foo_softplaylist messes this menu hardly than I thought. I raised number from 100 to 1000 than 2000, but still random help menu item executions. I also replaced help submenu with library submenu (making library last item), but than library menu throws random menu items.

Any ideas?


[edit] nevermind, I forgot to raise also menuman.BuildMenu values

WSH Panel Mod

Reply #518
@TP Wang: I am trying to write my own albumart viewer with the script you gave me and it works great. Now i need to make it work with lastfm tracks. I also use elplaylist which can use the artreader which can see lastfm tracks albumarts. Is there any way to use the artreader in wsh panel mod?

WSH Panel Mod

Reply #519
Hey! This is my first post on this topic. I have trying three days for now to create buttons to the bottom of the wsh window  and managed to create something using

function on_size() {
ww=window.Width;   
wh=window.Height;
}

All is good until i resize window the images move with the window but the hover point stays one place until i push apply, then it jumps to write place again.
It's driving me totally nuts.

ww & wh works on the this.draw = function (gr) and function on_paint(gr) but how can i call them in the this.onMove = function (x, y) ??

I'm trying to learn very hard, but this thing is rocket science to me for now! 

Can someone please post example.

WSH Panel Mod

Reply #520
@TPWang: forget my last post about artreader, i did what i wanted with getAlbumArt.

Now i am trying to make a progress bar that looks like the native theme progressbar. Elplaylist can do such a thing using $drawthemerect. I was wondering if it was possible in WSH Panel Mod.

Does anyone sees how to do that?

Thanks

WSH Panel Mod

Reply #521
i'm not sure if there is a function to get the system colours but this script draws the windows 7 selected item colour....

Code: [Select]
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}

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

var g_font = gdi.Font("Segoe UI", 12, 0);

var g_drag = 0;
var g_drag_seek = 0;

function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var pos = 0;
var time = fb.PlaybackTime;
var length = fb.PlaybackLength;
var txt;
if(length > 0){
if(g_drag){
pos = ww * g_drag_seek;
txt = TimeFmt(length * g_drag_seek) + " / " + TimeFmt(length);
} else {
pos = ww * (time / length);
txt = TimeFmt(time) + " / " + TimeFmt(length);
}
}
gr.FillGradRect( 0, 0, pos, wh, 90, RGB(217,233,251), RGB(188,214,247));
gr.DrawString(txt, g_font, RGB(0,0,0), 0, 0, ww-10, wh,553668608);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(170,170,170));
}

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_playback_time(time) {
if(fb.PlaybackLength>0) window.Repaint();
}

function on_playback_seek(time){
window.Repaint();
}

infact i have a question of my own... at the moment this script updates once a second but can look a bit rubbish on short tracks. i've seen some samples posted earlier in the thread on how how to get it to draw more often than once a second. but the sample TomBarlow posted looks overly complicated plus tedgo says it causes memory usage problems. i also tried a snippet that durch posted but that stops working randomly?? not sure why that is? has anybody got any simple code for this?

WSH Panel Mod

Reply #522
OK, i think it would be great if we add access to that windows function: DrawThemeBackground.
I am almost sure that s the one used by ELPlaylist.

WSH Panel Mod

Reply #523
Hi  Oh wonder I need some help

I made a seekbar and works but then I added some text with the progress time and the song length
and now when I click on the text the seekbar jumps to the beginning or to the next song

this is the actual layout
0:34 ------------------------ 4:23

how can I change the mouse pressing area (I hope you understand)


the other think I am trying to do is to "fill" the text with >0<
like 00:00:34 and that the 0's (only on the left side) have a different color, is it possible?


thanks and have a nice day
-Chris

WSH Panel Mod

Reply #524
@carmenm:
New functions like DrawThemeBackground() is planned but won't be implemented soon. I can't give any ETA.

@chiwou:
There's no mouse pressing area, I think this is one thing you need:
In:
function on_mouse_xxx_btn_xxx() {
...
// Add some condition statements for coordinate: (x, y), in order to "exclude" some area you don't want.
..
}