IPB

Welcome Guest ( Log In | Register )

60 Pages V  < 1 2 3 4 > »   
Reply to this topicStart new topic
WSH Panel Mod, foo_uie_wsh_panel_mod
chiwou
post Mar 24 2009, 18:34
Post #26





Group: Members
Posts: 236
Joined: 5-November 04
From: Spitzbergen
Member No.: 17985



@NEMO: thanks for the templates, they are working pretty good biggrin.gif

//edit
actually there are not biggrin.gif every time I close/start foobar I've to re-apply them, because they don't show up on start
but I use the panel width with window.Width
weird biggrin.gif

This post has been edited by chiwou: Mar 24 2009, 19:04
Go to the top of the page
+Quote Post
T.P Wang
post Mar 30 2009, 20:01
Post #27





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



Ver 1.1.0 Released, with some major changes.
Now implementing a "follow cursor" file info is now possible.

NOTICE
If you are using any of fb.GetNowPlaying(), fb.GetFocusItem(), on_playback_new_track() and on_items_selection_change(), please pay more attention to the ChangeLog.txt, Interfaces.txt and Callbacks.txt, because some features are not back backwards compatible.

This post has been edited by T.P Wang: Mar 30 2009, 20:09
Go to the top of the page
+Quote Post
NEMO7538
post Apr 1 2009, 05:44
Post #28





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



Thanks for the new version.
However, it seems that a callback would be needed: on_stopaftercurrent_changed (state) {} so that we can use the property properly.
Go to the top of the page
+Quote Post
TomBarlow
post Apr 2 2009, 11:15
Post #29





Group: Members
Posts: 585
Joined: 30-July 07
Member No.: 45750



Is it possible to run a service using foo_run with this? I tried it but couldn't get it to work. Could it be possible in the future?

The only other thing missing for me is a fixed width font in the editor! pinch.gif and maybe on_stopaftercurrent_changed (state) {}.
Go to the top of the page
+Quote Post
T.P Wang
post Apr 2 2009, 12:04
Post #30





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



@NEMO7538:
Thanks for your advice, I'll add them in the next version.

@TomBarlow:
The editor window use "Courier New" font (which is monospaced font), It should be installed with XP by default...

This post has been edited by T.P Wang: Apr 2 2009, 12:09
Go to the top of the page
+Quote Post
T.P Wang
post Apr 2 2009, 14:09
Post #31





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



1.1.1 released

@TomBarlow:
fb.RunContextCommand() is fixed, so you can run them now...

This post has been edited by T.P Wang: Apr 2 2009, 14:38
Go to the top of the page
+Quote Post
TomBarlow
post Apr 2 2009, 14:57
Post #32





Group: Members
Posts: 585
Joined: 30-July 07
Member No.: 45750



Fantastic!! This version is great! I still can't get the run services things to run, is there a particular syntax? I'm using e.g. fb.RunContextCommand('Run services//Last.fm') , although I don't really know if that's right. For some reason they're not working as a regular CUI toolbar button either, maybe the problem with with foo_run?

And I definitely have Courier New installed, I can't think why it's not showing up. It's not too much of a problem.
Go to the top of the page
+Quote Post
T.P Wang
post Apr 2 2009, 15:35
Post #33





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



@TomBarlow:
I tried it and it works, however, it will not be executed if there are no now playing content.
for exmaple:
fb.RunContextCommand("Run service/Google Artist");

And please contact me, I'll send you a debug version to find out why your font not work.
EDIT: I find out the problem, I'll fix that later.

This post has been edited by T.P Wang: Apr 2 2009, 15:52
Go to the top of the page
+Quote Post
NEMO7538
post Apr 3 2009, 07:37
Post #34





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



fb.RunContextCommand() only works with the nowplaying track. Is there a possibility to have it applied on the getfocusitem ?
Thanks
Go to the top of the page
+Quote Post
T.P Wang
post Apr 4 2009, 04:59
Post #35





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



1.1.2 Released smile.gif

@TomBarlow:
You now can change font is foobar2000 Preferences, WSH Panel Mod

@NEMO7538
You can use fb.RunContextCommandWithMetadb(metadb) from now on.
Go to the top of the page
+Quote Post
T.P Wang
post Apr 4 2009, 05:15
Post #36





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



For setting in Preferences->Display->WSH Panel Mod, Please read the following description.
This message is quoted from SciTE Doc
QUOTE
The value of each setting is a set of ',' separated fields, some of which have a subvalue after a ':'.
The fields are font, size, fore, back, italics, notitalics, bold, notbold, eolfilled, noteolfilled, underlined, notunderlined, and case. The font field has a subvalue which is the name of the font, the fore and back have colour subvalues, the size field has a numeric size subvalue, the case field has a subvalue of 'm', 'u', or 'l' for mixed, upper or lower case, and the bold, italics and eolfilled fields have no subvalue. The value "fore:#FF0000,font:Courier,size:14" represents 14 point, red Courier text.


Note that all fields is case sensitive.
Go to the top of the page
+Quote Post
Black_Over_Bills...
post Apr 4 2009, 09:08
Post #37





Group: Members
Posts: 124
Joined: 16-April 08
From: England
Member No.: 52832



I've never programmed this panel before so please excuse my ignorance.

I've seen several examples of how this panel can be programmed to be many things but could I use it to contain other panels. My thinking is a few buttons used to select which panel to display. I know I could PSS for this but that is a big step from 'normal' CUI.
Go to the top of the page
+Quote Post
TomBarlow
post Apr 4 2009, 16:25
Post #38





Group: Members
Posts: 585
Joined: 30-July 07
Member No.: 45750



Thanks for the new version, fonts work well now. Could you explain what RunContextCommandWithMetadb does exactly, and how to use it, and how it's different from RunContextCommand? Thanks.
Go to the top of the page
+Quote Post
T.P Wang
post Apr 4 2009, 16:50
Post #39





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



@Black_Over_Bills_Mothers:
Sorry, you cannot embed any other panels in WSH Panel.

@TomBarlow:
For example,
CODE
// Get current focus item handle
metadb = fb.GetFocusItem();
// Applying RunContextCommand to this handle
fb.RunContextCommandWithMetadb(metadb);


and something more:
fb.RunContextCommandWithMetadb(fb.GetNowPlaying()) is equivalent to fb.RunContextCommand(), since fb.RunContextCommand() apply on now playing item handle.

This post has been edited by T.P Wang: Apr 4 2009, 16:51
Go to the top of the page
+Quote Post
NEMO7538
post Apr 4 2009, 17:08
Post #40





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



Thank you TP Wang for the new version.

For those who are interested, I made a little toolbar to handle the rating :
CODE
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }


var g_drag = 0;
var bool;
var g_metadb;
var imgname;
var rating;
var nrating;
var lrating;
var img;
var hofset=20;
var imgw=20;
var g_tfo = fb.TitleFormat("%rating%");

on_item_focus_change();

function on_paint(gr){
// var info = g_metadb.GetFileInfo();
if (g_metadb) {
for (i = 1; i < 6; i++) {
img = gdi.image(fb.FoobarPath + "Images\\"
+ ((i > (g_drag ? lrating : rating)) ? "NoStar" : "Star" + (g_drag ? "-hover" : "")) + ".png");
// + ((i > (g_drag ? lrating : rating)) ? "No" : "") +"Star" + (g_drag ? ((rating != lrating) ? "-hover" : "") : "") + ".png");
// + ((i > (g_drag ? lrating : rating)) ? "No" : (g_drag ? ((rating != lrating) ? "Red" : "") : "")) +"Star.png");
// + (g_drag ? ((rating != lrating) ? "Blue" : "") : "") + ((i > (g_drag ? lrating : rating)) ? "No" : "") +"Star.png");
gr.DrawImage(img, hofset+imgw*(i-1), 4, 20, 16, 0, 0, 20, 16);
}
}
}

function on_mouse_wheel(delta){}


function on_mouse_lbtn_up(x,y){
// fb.trace("button up");
if (lrating !=rating) {if (g_metadb) {
bool = fb.RunContextCommandWithMetadb("Rating/"+((lrating==0) ? "<not set>" : lrating),g_metadb);
}}
}

function on_mouse_move(x, y) {
if (g_metadb) {
g_drag = 1;
nrating = Math.ceil((x-hofset)/imgw);
if (nrating > 5) nrating = 5;
if (nrating != lrating) {
lrating = nrating;
window.Repaint();
}
}
}
function on_mouse_leave() {
on_metadb_changed()
}

function on_item_focus_change() {
// fb.trace("itm focus changed");
if (g_metadb) {window.UnwatchMetadb();}
g_metadb = fb.GetFocusItem();
if (g_metadb) {
on_metadb_changed();
window.WatchMetadb(g_metadb);
}

}
function on_metadb_changed() {
g_drag = 0;
// fb.trace("changed");
rating = g_tfo.EvalWithMetadb(g_metadb);
if (rating == "?") {rating = 0;}
lrating = rating;
window.Repaint();
}

function on_playback_new_track(metadb) {on_item_focus_change();}
//EOF



For it to work:
  • you need the playback statistics standard component, with "Rating"as an entry in your context menu
  • you need to place "Star.png", "NoStar.png" and "Star-hover.png" in your foobar/Images directory. Sample:

@T.P. Wang: Since we have a metadb handle, it would be nice (if possible) to have a callback when metadb data is changed. Thanks.

This post has been edited by NEMO7538: Apr 4 2009, 21:18
Go to the top of the page
+Quote Post
tedgo
post Apr 4 2009, 18:15
Post #41





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



@NEMO7538
Thanks for this sample! smile.gif
I'm on replacing most settings of PSS in my config with WSH Panel mod, but i'm unfortunately too dumb to do it right... biggrin.gif
Now i finally have a sample i can work with.
Go to the top of the page
+Quote Post
chiwou
post Apr 4 2009, 18:29
Post #42





Group: Members
Posts: 236
Joined: 5-November 04
From: Spitzbergen
Member No.: 17985



@NEMO: could you please change your seekbar/volume config so that it use the window.Width/Height of the wsh panel *please*

and thanks for the rating buttons smile.gif
Go to the top of the page
+Quote Post
NEMO7538
post Apr 4 2009, 18:42
Post #43





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



This is another one for "Stop after current"
CODE
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_drag = 0;
var imgname;
var img;
function on_init(bool) {
imgname =bool ? "sac.png" : "playing.png";
img = gdi.image(fb.FoobarPath + "Images\\" + imgname);
window.Repaint();
};

on_init(fb.StopAfterCurrent);

function on_paint(gr){

gr.DrawImage(img, 0, 4, 20, 16, 0, 0, 20, 16);
}

function on_mouse_move(x, y) {

if (g_drag==0) {

on_init(!fb.StopAfterCurrent);
g_drag = 1;
}

}
function on_mouse_leave() {
if (g_drag==1) {

on_init(fb.StopAfterCurrent);
g_drag = 0;
}
}
function on_mouse_lbtn_up(x,y){

fb.StopAfterCurrent = !fb.StopAfterCurrent;
window.Repaint();

// g_drag = 0;
}


function on_playlist_stop_after_current_changed(state) {on_init(fb.StopAfterCurrent);}

//EOF
Where you need to use those two images: (In Foobar/Images directory)

.. and yet another one for the playback order :
CODE
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var PlaybackOrder = {
Default: 0,
RepeatPlaylist: 1,
RepeatTrack: 2,
Random: 3,
ShuffleTracks: 4,
ShuffleAlbums: 5,
ShuffleFolders: 6
}


var PlaybackOrderText = new Array(
"Default", // = 0
"Repeat (Playlist)",
"Repeat (Track)",
"Random",
"Shuffle (tracks)",
"Shuffle (albums)",
"Shuffle (folders)") ;

var g_font = gdi.Font("Arial", 11, 1);
var g_drag = 0;
var txt = "";
var bool;
function on_init() {
on_playback_order_changed(fb.PlaybackOrder);
};

on_init();
function on_paint(gr){
gr.SetTextRenderingHint(0);
gr.SetSmoothingMode(2);
// gr.FillGradRect( 3, 3, 0, window.Height-3, 90, RGB(240,240,240), RGB(100,230,100));
gr.DrawRect(15, 1, window.Width-36, 20, 1, RGB(64,64,64));
gr.FillGradRect(16, 2, window.Width-38, 18, 70, RGB(240,240,240), RGB(190,190,190));
gr.DrawString(txt, g_font, RGB(124,128,164), 5, 0, window.Width-15, 22, 0x11005000);

}

function on_mouse_wheel(delta){
if(delta>0) {if (fb.PlaybackOrder==6) fb.PlaybackOrder=0;
else fb.PlaybackOrder= fb.PlaybackOrder+1;}

else
{if (fb.PlaybackOrder==0) fb.PlaybackOrder=6;
else fb.PlaybackOrder= fb.PlaybackOrder-1;}
}
function on_mouse_lbtn_up(x,y){

if (fb.PlaybackOrder==0) fb.PlaybackOrder=4;
else fb.PlaybackOrder= 0;

// fb.trace("order="+fb.PlaybackOrder)

g_drag = 0;
}
function on_playback_order_changed(new_order_index) {
txt = PlaybackOrderText[fb.PlaybackOrder];

window.Repaint();
}
//EOF
Without images ... just click or use the mouse wheel.
Go to the top of the page
+Quote Post
T.P Wang
post Apr 4 2009, 18:43
Post #44





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



@NEMO7538:
Thanks for your advice, I now considering to include that feature in the next version.
However, I think l should restrict it to watch only one metadb handle at a time.
Go to the top of the page
+Quote Post
NEMO7538
post Apr 4 2009, 18:47
Post #45





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



QUOTE (chiwou @ Apr 4 2009, 18:29) *
@NEMO: could you please change your seekbar/volume config so that it use the window.Width/Height of the wsh panel

Here it is :
Volume bar:
CODE
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;
var hofset = 10;
var wh = 12;
var vofset;
var grad;

function on_paint(gr){
vofset = (window.Height-wh)/2;
grad = Math.pow((100+fb.Volume)/100,2);
ww = 5*Math.floor((window.Width - 2*hofset)/5);
var i = 0;
while (i < ww) {
var col = (grad<=0) ? RGB(168,168,168) : (i<=grad*ww) ? RGB(32+128*i/ww,164*(1-i/ww),32*(1-i/ww)) : RGB(168,168,168);
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;
v = 100 * (Math.pow(v,1/2) - 1);
fb.Volume = v;
}
}
function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}
function on_volume_change(val){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
//EOF

Seekbar
CODE
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 hofset = 10;
var wh = 13;
var vofset;
var length;
var grad;


function on_paint(gr){
vofset = (window.Height-wh)/2;
ww = 5*Math.floor((window.Width - 2*hofset)/5);
// fb.trace("ww="+ww);
length = fb.PlaybackLength;
grad = 0;
if (length > 0) {
grad = fb.PlaybackTime/fb.PlaybackLength;}

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

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

You need to adjust wh manually, however;

This post has been edited by NEMO7538: Apr 4 2009, 20:04
Go to the top of the page
+Quote Post
chiwou
post Apr 4 2009, 18:53
Post #46





Group: Members
Posts: 236
Joined: 5-November 04
From: Spitzbergen
Member No.: 17985



yeah I know biggrin.gif but especially for the seekbar it would be nice if it use the window.width (for resizing etc...)

but thanks for the answer ^^
Go to the top of the page
+Quote Post
NEMO7538
post Apr 4 2009, 18:53
Post #47





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



QUOTE (T.P Wang @ Apr 4 2009, 18:43) *
I now considering to include that feature in the next version.
However, I think l should restrict it to watch only one metadb handle at a time.
Yes, I understand it may cause performance issues. My request was for the rating panel to be refreshed when rating is set by another mean (the real context menu item, for instance).
Go to the top of the page
+Quote Post
T.P Wang
post Apr 4 2009, 19:56
Post #48





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



v1.1.3 Released.

Notes:
  • Previous editor properties will not transfer to this version, so make a backup of your editor properties, and edit them again in the Preferences->Display->WSH Panel Mod.
  • Some important notes is added, please check Callbacks.txt for details.

@NEMO7538:
WSH Panel now can get notified when metadb is changed wink.gif
Go to the top of the page
+Quote Post
NEMO7538
post Apr 4 2009, 21:13
Post #49





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



Thanks ... it works well now. I have updated the rating toolbar coded above. There is still a little annoyance with the fact that we don't get notified when the playlist has changed, so the stars does not exactly match the track which is selected in the new playlist ... but thanks anyway.

I have posted the toolbars and images here just in case someone wants to get all of them.
Please note that images are to be placed in Foobar/Images directory.

This post has been edited by NEMO7538: Apr 4 2009, 21:31
Go to the top of the page
+Quote Post
fbuser
post Apr 4 2009, 22:24
Post #50





Group: Developer
Posts: 673
Joined: 26-September 07
Member No.: 47369



QUOTE (chiwou @ Apr 4 2009, 18:53) *
yeah I know biggrin.gif but especially for the seekbar it would be nice if it use the window.width (for resizing etc...)

but thanks for the answer ^^
I didn't test it for this specific Seekbar, but it works for my Seekbar which had the same problem. You need to add the following code to make it dependent of the window.width:
CODE
on_size=function() {
  ww=window.Width;
}

Go to the top of the page
+Quote Post

60 Pages V  < 1 2 3 4 > » 
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th April 2014 - 06:13