Ah, crap. I'm just gonna ask because I tried this and asked someone else to use it since I thought maybe it was something with my script, but I added the flag,
DT_NOPREFIX = 0x00000800; // NOTE: Please use this flag, or a '&' character will become a underline '_' [I added the DT_NOPREFIX]
, but maybe I didn't add it in the right place, but it Aw, crashed ;(
I added it to the line:
gr.GdiDrawText(stxt, g_font, RGB(45,45,45), ww/5, 0, 4*ww/5, wh/2, DT_NOPREFIX | DT_CENTER | DT_VCENTER | DT_SINGLELINE);
But is the whole code necessary for any help on it? Console just says <source text only available at compile time>
↓
// Flags
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000002;
var DT_CENTER2 = 0x00000002;
var DT_SINGLELINE = 0x00000020;
//--------
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("Tahoma",16);
var g_titlefmt = fb.TitleFormat("$if(%ispaused%,PAUSED )$if($or($greater($right(%discnumber%,$sub($strchr(%discnumber%,/),1)),1),$greater(%totaldiscs%,1)),$if($strcmp(%codec%,Vorbis),'('CD$num($left(%discnumber%,$sub($strchr(%discnumber%,/),1)),1)')','('CD$num(%discnumber%,1)')')) %track%. %title% by %artist% -%_time_remaining%/%length%");
var g_titlefmt2 = fb.TitleFormat("$if(%ispaused%,PAUSED )'['%album%']' '('$if(%date%,%date%,)')' %_time_elapsed%/%length%");
var g_fileinfo = null;
var g_colors = new Array(RGB(235,190,99), RGB(0,161,0), RGB(235,190,99), RGB(0,161,0));
var g_drag = 0;
var g_drag_seek = 0;
var g_hover;
var g_bar = 0;
var Tooltip = window.CreateTooltip();
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var spos = 0;
var length = fb.PlaybackLength;
var volume = (fb.Volume ) * 5;
var vpos = (window.Width / 5) * ((100+volume)/100);
var stxt;
var stxt2;
var vtxt = "v5";
var vtxt2 = "Vol. " + (Math.ceil(volume)) + "%";
if(length > 0) {
if ( g_drag && g_drag_seek && g_bar == 1) {
spos = (window.Width - window.Width/5) * g_drag_seek;
stxt = "Seek: " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else if ( g_drag && g_bar == 2) {
vpos = (window.Width / 5) * ((100+volume)/100);
vtxt = "v5";
var vtxt2 = "Vol. " + (Math.ceil(volume)) + "%";
}
if ( g_bar != 1 ) {
spos = (window.Width - window.Width/5) * (fb.PlaybackTime / length);
stxt = g_titlefmt.Eval();
stxt2 = g_titlefmt2.Eval();
}
}
else if ( fb.PlaybackTime ) { stxt = "Streaming..."; }
gr.FillGradRect(ww/5, 0, ww, wh, 90, RGB(38,103,108), RGB(38,103,199));
gr.FillGradRect(ww/5, 0, spos, wh, 90, g_colors[4], g_colors[2]);
gr.FillGradRect(0, 0, ww/5, wh, 90, RGB(38,103,199), RGB(38,103,199));
gr.FillGradRect(0, 0, vpos, wh, 90, g_colors[1], g_colors[3]);
gr.GdiDrawText(stxt, g_font, RGB(45,45,45), ww/5, 0, 4*ww/5, wh/2, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(stxt2, g_font, RGB(45,45,45), ww/5, wh/2, 4*ww/5, wh/2, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(vtxt, g_font, RGB(45,45,45), 0, 0, ww/5, wh/2, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(vtxt2, g_font, RGB(45,45,45), 0, wh/2, ww/5, wh/2, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
//if( g_hover && !g_drag ) { Tooltip.Text = g_hover; Tooltip.Activate(); }
}
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;
if ( x <= window.Width/5) g_bar = 2;
else if ( x > window.Width/5 ) g_bar = 1;
on_mouse_move(x,y);
}
function on_mouse_lbtn_up(x,y){
x=x-window.width/5;
if( g_drag ) {
if ( g_bar == 1 ) {
g_drag = 0;
g_drag_seek = x / (4*window.Width/5);
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
g_bar = 0;
}
else if (g_bar == 2) {
x=x+window.width/5;
on_mouse_move(x,y);
g_drag = 0;
}
}
}
function on_mouse_move(x,y) {
x=x-window.width/5;
if(g_drag) {
if ( g_bar == 1 ) {
g_drag_seek = x / (4*window.Width/5);
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
else if ( g_bar == 2 ) {
x=x+window.width/5;
var v = x / (window.Width/5);
//v -= 4;
//v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
v=v/5;
if(fb.Volume != v)
fb.Volume = v;
}
}
else {
if ( x <= 4*window.Width/5) {
g_hover = x / (4*window.Width/5);
g_hover = (g_hover<0) ? 0 : (g_hover<1) ? g_hover : 1;
g_hover = TimeFmt( g_hover * fb.PlaybackLength );
}
else if ( x > 4*window.Width/5 ) {
var v = x / (window.Width/5);
v -= 4;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
v=v/5;
g_hover = Math.ceil(v) + " dB";
}
window.Repaint();
}
}
function on_mouse_leave() {
Tooltip.Deactivate();
}
function on_mouse_wheel(delta){
if(delta<0)
fb.VolumeUp();
else
fb.VolumeDown();
}
//--------
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){
window.Repaint();
}
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){
window.Repaint();
}
//EOF