Skip to main content

Topic: WSH Panel Mod (Read 578523 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
WSH Panel Mod
Reply #100
Thanks TP Wang
Regarding the volume control, I personally use :
v = Math.pow((100+fb.Volume)/100,2); and
fb.Volume = 100 * (Math.pow(v,1/2) - 1);

Where would I use that code to modify the horizontal volume bar sample provide with the plugin...

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

// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here is 0, means FontStyleRegular
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;

function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
var pos = window.Width * ((100+volume)/100);
var txt = (Math.ceil(volume)) + "dB";
gr.FillGradRect(  0, 0,    pos, wh, 90, RGB(240,240,240), RGB(100,230,100));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(240,240,240), RGB(190,190,190));
gr.DrawString(txt, g_font, RGB(64,64,128), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(150,150,150));
}

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 / window.Width;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
if(fb.Volume != v)
fb.Volume = v;
}
}

function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}

function on_volume_change(val){
window.Repaint();
}
//EOF

  • T.P Wang
  • [*][*][*][*]
  • Developer
WSH Panel Mod
Reply #101
v1.1.7 Released

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

// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here is 0, means FontStyleRegular
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;


function len2vol(len) {
return 100 * (Math.sqrt(len) - 1);
}

function vol2len(vol) {
return Math.pow((100 + fb.Volume) / 100, 2);
}

function on_paint(gr) {
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
var pos = window.Width * vol2len(volume);
var txt = (Math.ceil(volume)) + "dB";
gr.FillGradRect( 0, 0, pos, wh, 90, RGB(240,240,240), RGB(100,230,100));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(240,240,240), RGB(190,190,190));
gr.DrawString(txt, g_font, RGB(64,64,128), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(150,150,150));
}

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 / window.Width;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = len2vol(v);
if(fb.Volume != v)
fb.Volume = v;
}
}

function on_mouse_wheel(delta) {
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}

function on_volume_change(val) {
window.Repaint();
}
//EOF

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod
Reply #102
thanx for the update, but this new version make out of order one of my script (rating system)

it was working fine with v1.1.6, but now with 1.1.7, i've got an error line 21

Error: WSH Panel Mod (HWND: 0x404c0): Erreur d'exécution Microsoft JScript:
Argument ou appel de procédure incorrect
Ln: 21, Col: 1

here is the line concerned:


img = gdi.image(fb.FoobarPath + "skins\\xchange\\bt\\"
+ ((i > (g_drag ? lrating : rating)) ? "_star-off" : "star" + (g_drag ? ((i==rating)?((i==lrating)?"-kill":"-hover") :"-hover") : "")) + ".png");


Code: [Select]
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=0;
var imgw=15;
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 + "skins\\xchange\\bt\\"
+ ((i > (g_drag ? lrating : rating)) ? "_star-off" : "star" + (g_drag ? ((i==rating)?((i==lrating)?"-kill":"-hover") :"-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), 1, 16, 16, 0, 0, 16, 16);
}
}
}

function on_mouse_wheel(delta){}

function on_mouse_lbtn_up(x,y){
// fb.trace("button up");
if (lrating !=rating) {if (g_metadb) {
bool = g_metadb.UpdateFileInfoSimple("RATING",lrating);
}}
else {
bool = g_metadb.UpdateFileInfoSimple("RATING",0);}
}

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 (fb.IsPlaying | fb.IsPaused) g_metadb = fb.GetNowPlaying();
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


what have you changed ?

thanx by advance


EDIT : ignore, i have figured out the pb, one of the image file doesn't exist, but in 1.1.6, that wasn't generate any error, 1.1.7 does
  • Last Edit: 05 May, 2009, 02:36:08 PM by Falstaff

  • T.P Wang
  • [*][*][*][*]
  • Developer
WSH Panel Mod
Reply #103
@Fallstaff:
Yes, now it's more strict, in order to prevent unexpectable result.

WSH Panel Mod
Reply #104
Thanks T.P Wang

WSH Panel Mod
Reply #105
I used this script in the old wsh panel, in the new one it doesn´t work anymore. Any idea, why?

Code: [Select]
//--------
var weight_normal =400;
var weight_bold  =800;
var italic_no =0;
var italic    =1;
var uline_no  =0;
var uline    =1;
//--------
var align_top  =0;
var align_middle=1;
var align_bottom=2;

var align_left  =0;
var align_center=1;
var align_right =2;

var trim_no    =0;
var trim_chara  =1;
var trim_word  =2;
var trim_elips_chara =3;
var trim_elips_word  =4;
var trim_elips_path  =5;

var flag_rtl        =0x0001;
var flag_vert      =0x0002;
var flag_nofit      =0x0004;
var flag_dispctrl  =0x0020;
var flag_nofallback =0x0400;
var flag_trailspace =0x0800;
var flag_nowrap    =0x1000;
var flag_linelimit  =0x2000;
var flag_noclip    =0x4000;

function StrFmt(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
//--------
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)); }
//--------
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(-12, weight_normal, italic, uline_no, "MeiryoKe_PGothic");
var g_titlefmt = fb.TitleFormat("%playback_time%/%length% %samplerate%Hz %bitrate%kbps");
var g_fileinfo = null;

var g_drag = 0;
var g_drag_seek = 0;

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

if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else{
pos = window.Width * (fb.PlaybackTime / length);
txt = g_titlefmt.Eval();
}
}

gr.FillGradRect(  0, 0,    pos, wh, 90, RGB(255,255,255), RGB(255,255,255));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(157,253,41), RGB(157,253,41));


}
function on_size(){
}
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;
}
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_mouse_wheel(delta){
//fb.trace("wheel " + delta);
}
//--------
function on_playback_starting(cmd, paused){
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_pause(state){
}
function on_playback_edited(){
}
function on_playback_dynamic_info(){
}
function on_playback_dynamic_info_track(){
}
function on_playback_time(time){
window.Repaint();
}
function on_volume_change(val){
}

//EOF

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod
Reply #106
Change
var g_font = gdi.Font(-12, weight_normal, italic, uline_no, "MeiryoKe_PGothic");

to:
var g_font = gdi.Font("MeiryoKe_PGothic", 12, 2);

EDIT:
I can't see, where you call this variable, so you could also delete the whole line and the whole part above
//-------
function RGB...

So this should work (as you don't have any text in your progressbar)
Code: [Select]
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)); }

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_fileinfo = null;
var g_drag = 0;
var g_drag_seek = 0;

function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var pos = 0;
var length = fb.PlaybackLength;
if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
}
else{
pos = window.Width * (fb.PlaybackTime / length);
}
}
gr.FillGradRect(  0, 0,    pos, wh, 90, RGB(255,255,255), RGB(255,255,255));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(157,253,41), RGB(157,253,41));
}

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_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();
}
//EOF
  • Last Edit: 06 May, 2009, 11:20:56 AM by tedgo

WSH Panel Mod
Reply #107
works now, Thanks a lot! 

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod
Reply #108
But now there is no way to add text for the moment!
  • Last Edit: 06 May, 2009, 01:57:23 PM by tedgo

WSH Panel Mod
Reply #109
But now there is no way to add text for the moment!


yes, I know, I don´t want it, that´s why I (at least tried to) delete anything for it...

still there is this ding-dong sound at startup, saying it´s not quite ok now, I´ll try to find out, why... I really don´t have any idea about Jscript, so trial and error is the way

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod
Reply #110
Hm, i haven't tried it, but it should work without an error...
Maybe you have to change on_playback_new_track(ifo) to on_playback_new_track(metadb).

Have you took a look at the console?
There you can see the error and the line in which it occurs.
  • Last Edit: 06 May, 2009, 02:27:45 PM by tedgo

WSH Panel Mod
Reply #111
Have you took a look at the console?
There you can see the error and the line in which it occurs.


oh yes, console, always forget about it....

Error: foo_uie_wsh_panel_mod: Laufzeitfehler in Microsoft JScript:
Falsche Anzahl an Argumenten oder ungültige Eigenschaftszuweisung
Ln: 3, Col: 1

Falls ich mich nicht irre, bist Du doch Deutscher, oder?

Ln:3 = Line 3? it´s empty

played around without success...

P.S. The on_playback_new_track(metadb) didn´t solve it...


  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod
Reply #112
Tried it now and sorry, it works...
I don't get any error message with the script.
Do you have another WSH Panel mod in your config which could cause the error?

WSH Panel Mod
Reply #113
Tried it now and sorry, it works...
I don't get any error message with the script.
Do you have another WSH Panel mod in your config which could cause the error?


strange, I removed all other WSH panels, same...

well, I can live with it, everything works, but still strange
  • Last Edit: 06 May, 2009, 04:33:38 PM by vogliadicane

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod
Reply #114
Really strange...
I tried it with a fresh portable install and my own config (which has 8 wsh panel mods inside now...).
Works on both without 'ping' and error on xp with wsh panel mod 1.1.7.
  • Last Edit: 06 May, 2009, 04:51:44 PM by tedgo

WSH Panel Mod
Reply #115
Really strange...
I tried it with a fresh portable install and my own config (which has 8 wsh panel mods inside now...).
Works on both without 'ping' and error on xp with wsh panel mod 1.1.7.


just for information: today there´s no more ping. I didn´t change anything just restart the computer. Let´s put it to the X-Files.
  • Last Edit: 07 May, 2009, 04:41:44 AM by vogliadicane

  • TomBarlow
  • [*][*][*][*][*]
WSH Panel Mod
Reply #116
I just got a weird error on startup in one of my wsh panels:

Error: WSH Panel Mod (HWND: 0x701e8): (null):
(null)
Ln: 193, Col: 2

I just updated foo_audioscrobbler. Line 193 is:
   if (metadb)
which is inside a function for getting album art, metadb should have come from fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem(), foobar wasn't playing on startup so it should be fb.GetFocusItem(). The code worked when I clicked Apply. Odd...

  • T.P Wang
  • [*][*][*][*]
  • Developer
WSH Panel Mod
Reply #117
TomBarlow, vogliadicane:
I think it's because the IActiveScriptSiteInterruptPoll interface introduced in 1.1.7, I've add the interface in order to prevent infinity loop, but it's limited time is too low for you ( 5 secs ), so weird errors occured.

I've removed the IActiveScriptSiteInterruptPoll interface from the latest build, you can get it here:
LINK Removed because of critical bug.

If you find it's ok, please let me know.
  • Last Edit: 08 May, 2009, 02:06:44 PM by T.P Wang

WSH Panel Mod
Reply #118
TomBarlow, vogliadicane:
I think it's because the IActiveScriptSiteInterruptPoll interface introduced in 1.1.7, I've add the interface in order to prevent infinity loop, but it's limited time is too low for you ( 5 secs ), so weird errors occured.


this might also be the reason for errors using the included PBOButton script?

e.g. '$buttons' not defined...

  • TomBarlow
  • [*][*][*][*][*]
WSH Panel Mod
Reply #119
T.P. Wang, I have a wsh panel that displays album art, and it works fine, except I've found the window seems to redraw whenever another window is moved over it- e.g. the preferences window, configure dialog, console etc. I'm only calling window.Repaint() from inside on_playback_new_track, on_item_focus_change and on_playback_dynamic_info_track, so I don't think it should be redrawing- it slows everything down by a lot when it does. Would you be able to stop it doing that?

It happens with my other wsh panels but it's only noticeable on the one with art.

Cheers

  • 2E7AH
  • [*][*][*][*][*]
WSH Panel Mod
Reply #120
@T.P.Wang
I need some help, regarding using VBS in WSH:
All those shared scripts are made in Jscript (which is similar but very different than VBS), so I can't find example in VBS and get feeling how to use it in WSH panel
For example, I've made VBS to open/close CD tray. I could make CUI button and link it to VB script file, but I'm curious how this can be done using VBS in WSH?
And why JScript is somehow prefered over VBS?

  • AngryWolf
  • [*]
WSH Panel Mod
Reply #121
Hi, thanks for great mod.
I used some code from here and made volume bar and seek bar. Seekbar has no problem because it's fool opacity. But volume bar is thins line and slider. Sometimes window background not erased - some trash on background from other windows or simply black fill. If I move some window above or minimize/maximize foobar - background looks as it must be.
"Pseudo transparent" checkbox checked, if I unchek this, background have no that problem, but have white color, what differs from my windows theme.
Anybody can help me with this problem? Maybe I must do some function like on_wmbgerase or something 

Code: [Select]
function RGB(r,g,b,a){ return ((a<<24)|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("Calibri",14,0);
var g_drag = 0;
var ww = 16;
var wh = 9;
var vofset = 5;
var hlofset = 3;
var hrofset = 3;
var ih=25;
var iw=14;
var col_o = RGB(103,133,156,255); // progress bar frame
var col_i = RGB(23,53,76,255); // progress bar frame
var col1 = RGB(83,103,136,255); // progress bar gradien1
var col2 = RGB(103,133,156,255); // progress bar gradien2
var col_pb = RGB(133,163,186,255); // progress bar indicator frame
var col_bg = RGB(46,48,63,255); // background color
var col_txt = RGB(9,0,0,255); // Text color
var col_txt_sh = RGB(9,0,0,55); // Text color
var img = gdi.image(fb.FoobarPath+"Images\\volume2.png");

function HSV(h,s,v)
{
h=Math.abs(h%360);
s=(s<0)?0:(s>100)?100:s;
v=(v<0)?0:(v>100)?100:v;
s=s/100;
v=v/100;
h_i=Math.floor(h/60)%6;
f=h/60-Math.floor(h/60);
p=v*(1-s);
q=v*(1-f*s);
t=v*(1-(1-f)*s);
switch(h_i)
{
case 0:
return (0xff000000|(0xff*v<<16)|(0xff*t<<8)|(0xff*p));
break;
case 1:
return (0xff000000|(0xff*q<<16)|(0xff*v<<8)|(0xff*p));
break;
case 2:
return (0xff000000|(0xff*p<<16)|(0xff*v<<8)|(0xff*t));
break;
case 3:
return (0xff000000|(0xff*p<<16)|(0xff*q<<8)|(0xff*v));
break;
case 4:
return (0xff000000|(0xff*t<<16)|(0xff*p<<8)|(0xff*v));
break;
case 5:
return (0xff000000|(0xff*v<<16)|(0xff*p<<8)|(0xff*q));
break;
}
}

function nice_percent(x) {
var i = Math.round(x);
var y = Math.round((vol-Math.round(vol))*100);
ret = i+".";
if (Math.abs(y)<10) { ret = ret+"0"+Math.abs(y) } else { ret = ret+Math.abs(y) };
return (ret);
}

function on_paint(gr) {
hrofset = gr.CalcTextWidth("-100.00 dB",g_font)+3;
ww = window.Width-hlofset-hrofset-1;

volume = fb.Volume;
pos = (ww-3)*Math.pow((100+fb.Volume)/100,2);

// Background
gr.FillSolidRect(hlofset,vofset,ww,wh,col_bg);
gr.DrawRect(hlofset,vofset,ww,wh,1,col_o);
gr.DrawRect(hlofset+1,vofset+1,ww-2,wh-2,1,col_i);

// Volume bar
gr.FillGradRect(hlofset+2,vofset+2,pos,wh-3,90,RGB(50,150,190,192),RGB(30,130,160,192));

// Text volume level
vol = fb.Volume;
txt = fb.Volume>-100?nice_percent(vol)+" dB":"mute";

gr.SetTextRenderingHint(5);
gr.GdiDrawText(txt,g_font,HSV(0,0,65),hlofset+ww+5,vofset+1,window.Width-hlofset-ww-4,wh,0x00000025);
gr.GdiDrawText(txt,g_font,HSV(0,0,15),hlofset+ww+4,vofset,window.Width-hlofset-ww-4,wh,0x00000025);

// Glass effect
gr.FillGradRect(hlofset+1,vofset+1,ww-1,wh/2,90,RGB(255,255,255,84),RGB(255,255,255,0));

// Slider
gr.DrawImage(img,pos,(window.Height-ih)/2,iw,ih,0,0,iw,ih);
}

function on_mouse_lbtn_down(x,y){
g_drag = 0;
pos = (ww-3)*Math.pow((100+fb.Volume)/100,2);
// Check for marker move
if ((x>=pos && x<=pos+iw) && (y>=(window.Height-ih)/2 && y<=(window.Height-ih)/2+ih)) {
g_drag = 1;
return;
}
// Check for direct bar press
if ((x>=hlofset+2 && x<=window.Width-hrofset-2) && (y>=vofset+1 && y<vofset+wh)) {
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-hlofset-2) / (window.Width-hlofset-hrofset-4);
v = (v<0) ? 0 : (v<1) ? v : 1;
v = 100*(Math.pow(v,1/2)-1);
if(fb.Volume != v) 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_size() {
wh = window.Height-2*vofset-1;
}
//EOF
  • Last Edit: 16 May, 2009, 05:22:23 PM by AngryWolf

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod
Reply #122
yes, with Pseudo Transparent WSH, the refresh of the background is badly handled "sometimes" (often ...)
==>it keeps the previous main background as background on track change (so when the main background change too !!)

i had yo use tweaks in my PSS config to refresh the WSH background by resizing the WSH panel twice to refresh its background to fit the real background ...

can a fix be done T.P ?
  • Last Edit: 16 May, 2009, 08:48:04 AM by Falstaff

  • T.P Wang
  • [*][*][*][*]
  • Developer
WSH Panel Mod
Reply #123
@vogliadicane:
Yes, and I assume that you've seen a popup message which described that.

@TomBarlow:
Windows XP sends WM_PAINT message to window which is overlapped, or the window won't display right, it's by design. FYI: You won't get that message if you are using Vista.

In fact, I've optimized the repaint operations to repaint the region which is necessary, so on_paint() get called doesn't mean the whole panel will be repainted.

So, my suggestion is, there should be only necessary drawing, logical and numeric operations in on_paint(). There should be no object creation such as reading images (Notes & Hints: #7).
If you don't care about alpha channel of an Image, you can create RawBitmap, and use gr.GdiDrawBitmap() method to speed up drawing operations(however, don't create RawBitmap during on_paint()).
  • Last Edit: 16 May, 2009, 11:38:07 AM by T.P Wang

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod
Reply #124
...
In fact, I've optimized the repaint operations to repaint the region which is necessary, so on_paint() get called doesn't mean the whole panel will be repainted.
...


what a shame, it is really not compliant with the Pseudo Transparency mode

can you disable this 'optimization' when Transparency is actived ???