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: JScript Panel (Read 305318 times) previous topic - next topic
0 Members and 5 Guests are viewing this topic.

Re: JScript Panel

Reply #1500
That's weird. Even if you didn't install the font as mentioned in the previous post, the display is just borked on certain icons that make up the layout. No errors should be thrown.

Hold Shift+Winkey together and right click the panel>Configure. Add this code.

Code: [Select]
String.prototype.calc_width = function (font_str) {
console.log("DEBUG", font_str);
var font = JSON.parse(font_str);
return utils.CalcTextWidth(this, font.Name, font.Size, font.Weight || 400);
}

You should get the same error but with a console DEBUG message before it. I'd like to see that please.

edit: the shift+winkey bit isn't necessary when the script has errored. It's only required when JSPlaylist is "working". :P

Re: JScript Panel

Reply #1501
That's weird. Even if you didn't install the font as mentioned in the previous post, the display is just borked on certain icons that make up the layout. No errors should be thrown.

Hold Shift+Winkey together and right click the panel>Configure. Add this code.

Code: [Select]
String.prototype.calc_width = function (font_str) {
console.log("DEBUG", font_str);
var font = JSON.parse(font_str);
return utils.CalcTextWidth(this, font.Name, font.Size, font.Weight || 400);
}

You should get the same error but with a console DEBUG message before it. I'd like to see that please.

edit: the shift+winkey bit isn't necessary when the script has errored. It's only required when JSPlaylist is "working". :P

DEBUG {"Name":"FontAwesome","Size":0,"Weight":400}
JScript Panel 3.4.4 (JS Playlist by Br3tt aka Falstaff)
JavaScript runtime error
Invalid procedure call or argument
File: N:\foobar2000\profile\user-components\foo_jscript_panel3\samples\jsplaylist\main.js
Line: 1379, Col: 2


Re: JScript Panel

Reply #1503
1) Is there a plman.ReplayGain (like plman.PlaybackOrder) variable available to reflect current state of replaygain?
2) Is a function on_replaygain_changed(new_index) available (like on_playback_order_changed(new_index))?

RTFM.

plman is Playlist Manager so it won't be there. A good place to look would be fb since it's related to fb2k core settings.

https://jscript-panel.github.io/docs/namespaces/fb/

fb.ReplaygainMode is a readable and writable property https://jscript-panel.github.io/docs/flags/#replaygainmode

Callback: https://jscript-panel.github.io/docs/callbacks/foobar2000/#on_replaygain_mode_changednew_mode

Why do I even bother writing documentation? :/

Even starting a search with on_repl would have found it...



I have been trying to do searches in this forum many many times, but searches always come up empty.
I bookmarked the three links you included.

Thank you. With your help I was able to implement the intended button.

Re: JScript Panel

Reply #1504
-----
3.4.6

I read the release notes, but I don't understand:
Transparency is now reserved exclusively for genuine Columns UI toolbars. Adding as a toolbar via the Columns UI Layout settings will have no effect and it will be a normal panel with a solid color background.

Please explain how I can restore transparency for the JS3 stuff or propagate 3.4.5 like 3.3.40 2.8.8 as a legacy release.
----

Does this mean that effectively JS3 from version 3.4.6 onwards does not support transparency anymore?

Re: JScript Panel

Reply #1505
You reported the flickering with transparency so I solved it by removing the transparency. Without your report, I would have been oblivious to it.  Thanks.

The legacy versions will continue to support the transparency hack. You're using PSS from 2009. JSP 2.8.8 is from August 2022, JSP 3.3.40 is just over 3 weeks old. If you have a problem with that, contact your bank for a refund.

Re: JScript Panel

Reply #1506
You reported the flickering with transparency so I solved it by removing the transparency. Without your report, I would have been oblivious to it.  Thanks.

The legacy versions will continue to support the transparency hack. You're using PSS from 2009. JSP 2.8.8 is from August 2022, JSP 3.3.40 is just over 3 weeks old. If you have a problem with that, contact your bank for a refund.

I guess that's your way of saying yes.

What I said was "I have a small refresh question/issue about JS3" and told you only JS panels had this thingy. I did not  even call it a bug or anything. It was just a small glitch I noticed.

First you respond by saying movepanel/showpanel/panelshow is bugged.
I've got around 100 panels running all operated by movepanel/showpanel/panelshow and I have zero issues. Except for the small JS glitch.

Later you confirm the small issue and respond by removing transparency support completely.

Bit like going to the doctor with a ingrown toenail and the doctor solves the problem by amputating the whole leg.

Re: JScript Panel

Reply #1507
Yeah, I put more restrictions in. While it's nice to have a dozen or 2 images on rotation, I think getting in to the hundreds is silly and way beyond what this was ever meant for. Edit the script yourself if you want to change it.

https://github.com/jscript-panel/component/blob/8fb1bdde45a742de574db6fc132b8686f3334559/samples/js/thumbs.js#L140-L150

Just be warned that this can exhaust all memory and cause fb2k to crash. I mean proper crashes, not script errors.
The number of sheets displayed does not change when Thumbs is Off, though,
Is it necessary to limit the number of pictures displayed even when Thumbs is Off?



Re: JScript Panel

Reply #1510
3.4.8 internal font related changes. It does nothing to address the JSPlaylist script error reported above but I hope any future errors point somewhere else in the code. If it does, it will give me a better idea of what is wrong.

https://github.com/jscript-panel/release/releases/tag/latest

edit: hardly worth mentioning but the JSPlaylist state column can now display 3 digit queue indexes. I think when it was written, the queue limit was 64 which was OK but since it was updated to 256, it got truncated.

Re: JScript Panel

Reply #1511
3.4.8 internal font related changes. It does nothing to address the JSPlaylist script error reported above but I hope any future errors point somewhere else in the code. If it does, it will give me a better idea of what is wrong.

https://github.com/jscript-panel/release/releases/tag/latest

edit: hardly worth mentioning but the JSPlaylist state column can now display 3 digit queue indexes. I think when it was written, the queue limit was 64 which was OK but since it was updated to 256, it got truncated.

I'll try this fix altough I found that this is actually a CUI problem.
I opened the settings and all the Font size were 0.
I change them to 12 and it's working.
No idea how it worked with 0 font size as it was set to all types.
Strange but now it works.

Re: JScript Panel

Reply #1512
Everyone else handles that gracefully so I guess I should as well...

3.4.9
Quote
Update window.GetFontCUI to gracefully handle a font with zero size being defined in the Preferences.

https://github.com/jscript-panel/release/releases

BTW, the most likely cause of it being borked was using foo_ui_hacks.

edit: most components didn't have to do anything because GDI fonts default to something sane if source properties are nonsense.

I'm storing the font name as a string and using numbers for other properties like weight, size etc. Passing a size of zero to this method caused the error.

https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createtextformat



Re: JScript Panel

Reply #1513
3.4.10

https://github.com/jscript-panel/release/releases

Not worthy of a changelog entry but the crappy transparency effect for CUI toolbars is once again available when added as panels. Even with my supposed removal of it, flickering can still happen so it might as well stay. All flickering can be avoided by using standard panels in proper splitters - not PSS.

edit: I didn't mean to say transparency in CUI toolbars is crappy - it's essential. Adding toolbars as panels to use with PSS sucks. :P

Re: JScript Panel

Reply #1514
3.4.10

https://github.com/jscript-panel/release/releases

Not worthy of a changelog entry but the crappy transparency effect for CUI toolbars is once again available when added as panels. Even with my supposed removal of it, flickering can still happen so it might as well stay. All flickering can be avoided by using standard panels in proper splitters - not PSS.

Great. Thx

Re: JScript Panel

Reply #1515
Message to marc2k3:

I have Columns UI and JScriptPanel3 3.4.10 installed and have configured "Track Info + Seekbar + Buttons + Volume.txt" with my own code.

I need, if possible, the following:

In the image you can see in the playlist view, the title column in which I have made a script with title formating that makes the texts in parentheses (up to a maximum of 4) except if it is at the beginning to be painted in low brightness.

The caption shows the title with the text in parentheses on the right removed.

What I need is a routine that allows to paint in the footer the title with the texts in brackets that are not at the beginning in low luminosity.

Current: 

(I Love You) Caravan

Desired:

(I Love You) Caravan (Bande Originale Du Film) aka "Paris, Paris" (Spain) "Paris 36" (Europe)

Code: [Select]
// ==PREPROCESSOR==
// @name "Track Info + Seekbar + Buttons + Volume"

// con 1 fuente (Segoe Fluent Icons.ttf)
// Pie en un solo panel

// @author "marc2003"
// @import "%fb2k_component_path%helpers.txt"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// @import "%fb2k_component_path%samples\js\common.js"
// @import "%fb2k_component_path%samples\js\panel.js"
// @import "%fb2k_component_path%samples\js\seekbar.js"
// @import "%fb2k_component_path%samples\js\volume.js"

// ==/PREPROCESSOR==

/*
The Segoe Fluent Icons font is already included with Windows 11. Windows 10 users can download it here:
https://download.microsoft.com/download/8/f/c/8fc7cbc3-177e-4a22-af48-2a85e1c5bffb/Segoe-Fluent-Icons.zip

If installed, you can right click the panel and change the button set.
*/

//////////////////////////////////////////////////////////////
//tamaño botones
var bs = _scale(26);
var sep_bot = 3;

//tamaño botón volume
var bsv = _scale(25);

//posicion botones
var posi_horiz_bot = -1;
var posi_vert_bot = 757;

//posiciones para el botón activate
var posi_horiz_bot2 = -1;
var posi_vert_bot2 = 275;

//posiciones seekbar
var posi_vert_seekbar_ini = 59;
var ancho_seekbar = _scale(896);
var alto_seekbar = _scale(5);
var posi_horiz_seekbar = 2;

//posiciones knob
var ancho_knob = _scale(6)
var alto_knob = ancho_knob

//posiciones barra volumen
var alto_volume = alto_seekbar;
var posi_horiz_barra_volume = _scale(24);
var ancho_volume = _scale(524);
var separacion_pared_derecha_volume = _scale(13);

//posición icono volumen
var posi_horiz_volume = _scale(14);

//el valor _scale(-xxx) marca el límite en que se corta el texto con ...
var limite1 = _scale(-485);

var posi_vert_lin_izq = 10;
var posi_horiz_lin1 = -5;
var posi_horiz_lin2 = 24;

//Recuadro de tiempos
//desplazamiento vertical
var time_x = 1420
//desplazamiento horizontal
var time_y = 23
//ancho de izq. a dcha.
var time_w = -240
//alto
var time_h = 26

var posi_horiz_time = 0;
var sep_time = 161;
var posi_vert_time_actual = _scale(1815);
var posi_vert_time_resto = posi_vert_time_actual + sep_time;
var posi_vert_time_total = posi_vert_time_resto + sep_time;

var posi_horiz_porcen = -2

//texto encima volumen
var posi_horiz_linea1 = -25;
var posi_vert_herz = 1650;
var posi_vert_codec = 1827;

//texto debajo volumen
var posi_horiz_gain = 22;
var posi_vert_gain = 1827;

//fuentes para los textos
var normal2_font = CreateFontString('Segoe UI', 12);
var normal3_font = CreateFontString('Segoe UI', 13);
var normal4_font = CreateFontString('Segoe UI', 11);
var normal5_font = CreateFontString('Eras ITC', 14);
var normal6_font = CreateFontString('Segoe UI', 8);
var bold_font = CreateFontString('Segoe UI', 12, true);

//aquí se definen los colores
var colours = {
buttons : RGB(220, 220, 220),
background : RGB(34, 34, 34),
artist : RGB(170, 170, 170),
año : RGB(230, 230, 230),
album : RGB(200, 200, 200),
composer : RGB(160, 160, 160),
track : RGB(200, 200, 200),
title : RGB(225, 225, 225),
porcen : RGB(180, 180, 180),

time : RGB(180, 180, 180),
time_total : RGB(220, 220, 220),
time_reborde : RGB(32, 32, 32),
time_recuadro_degra1 : RGB(25, 25, 25),
time_recuadro_degra2 : RGB(50, 50, 50),

gain : RGB(180, 180, 180),
codec : RGB(170, 170, 170),
seekbar_background : RGB(15, 15, 15),
seekbar_progress : RGB(80, 80, 80),
knob : RGB(220, 0, 0),
sac : RGB(196, 30, 35),
};

//aquí se guardan los metadatos que se van a pintar
//metadatos que se depurarán de paréntesis
var tfo_album = fb.TitleFormat('[%album%]');
var tfo_title = fb.TitleFormat('[%title%]');
var tfo_artist = fb.TitleFormat('[%artist%]');
var tfo_genero = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$cut(%genre%,7),)');

var panel = new _panel();
var seekbar = new _seekbar(0, 0, 0, 0);
var volume = new _volume(0, 0, 0, 0);
var buttons = new _buttons();

var img = null;
window.MaxHeight = _scale(150);

on_playback_new_track(fb.GetNowPlaying());

buttons.update = function () {
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot;

//  aquí se pintan los botones tomándolos de helpers.txt
this.buttons.stop = new _button(panel.w - posi_vert_bot - (sep_bot * 4) - (bs * 8), y, bs, bs, { char : chars.stop, colour:fb.StopAfterCurrent ? colours.sac : colours.buttons}, null, function () { fb.Stop(); }, 'Stop');

this.buttons.previous = new _button(panel.w - posi_vert_bot - (sep_bot * 3) - (bs * 7), y, bs, bs, { char : chars.prev, colour:colours.buttons }, null, function () { fb.Prev(); }, 'Previous');

this.buttons.play = new _button(panel.w - posi_vert_bot - (sep_bot * 2) - (bs * 6), y, bs, bs, { char : !fb.IsPlaying || fb.IsPaused ? chars.play : chars.pause, colour:colours.buttons}, null, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause');

this.buttons.next = new _button(panel.w - posi_vert_bot-sep_bot - (bs * 5), y, bs, bs, { char : chars.next, colour:colours.buttons }, null, function () { fb.Next(); }, 'Next');

//  aquí se pinta el boton activate que está definido en helpers.txt como right
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot2;
this.buttons.activate = new _button(panel.w - posi_vert_bot - (bs * 4), y, bs, bs, { char : chars.right, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('View/Playlist view/Activate now playing'); }, 'Activate now playing');

//  Aquí se pinta el boton volumen
this.buttons.volume = new _button(volume.x - bs, posi_horiz_volume, bsv, bsv, { char : chars.volume, colour:colours.buttons }, null, function () { fb.VolumeMute(); }, 'Mute Volume');
}

function update_album_art(metadb) {
if (img) img.Dispose();
img = null;
if (metadb) {
img = metadb.GetAlbumArt();
}
window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
volume.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
if (x < panel.h && fb.IsPlaying && img) {
fb.GetNowPlaying().ShowAlbumArtViewer();
return;
}
if (buttons.lbtn_up(x, y)) {
return;
}
if (seekbar.lbtn_up(x, y)) {
return;
}
if (volume.lbtn_up(x, y)) {
return;
}
fb.RunMainMenuCommand('View/Show now playing in playlist');
}

function on_mouse_leave() {
buttons.leave();
}

function on_mouse_move(x, y) {
window.SetCursor(x < panel.h && fb.IsPlaying && img ? IDC_HAND : IDC_ARROW);
if (buttons.move(x, y)) {
return;
}
if (seekbar.move(x, y)) {
return;
}
volume.move(x, y);
}

function on_mouse_rbtn_up(x, y) {
if (buttons.buttons.stop.containsXY(x, y)) {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
} else {
var menu = window.CreatePopupMenu();
menu.AppendMenuItem(MF_STRING, 1, 'Configure');

var idx = menu.TrackPopupMenu(x, y);
menu.Dispose();

switch (idx ) {
case 1:
window.ShowConfigure();
break;
}
}

return true;
}

function on_mouse_wheel(s) {
if (seekbar.wheel(s)) {
return;
}
volume.wheel(s);
}

function on_paint(gr) {
//aquí se pinta el background de todo el pie
gr.Clear(colours.background);

//aquí se pinta la barra nula
    gr.FillRoundedRectangle(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, _scale(2), _scale(2), colours.seekbar_background);

buttons.paint(gr);

//Aquí se pinta la barra de volumen
gr.FillRoundedRectangle(volume.x, volume.y, volume.w + _scale(6), volume.h, _scale(2), _scale(2), colours.seekbar_background)

    //aquí se pinta la parte izquierda de la barra de volumen
var pos = volume.pos();
gr.FillRoundedRectangle(volume.x, volume.y, pos, volume.h, _scale(2), _scale(2), colours.seekbar_progress);

    //aquí se pinta el knob del volumen
gr.FillEllipse(volume.x + _scale(3) + pos, volume.y + _scale(3), ancho_knob, alto_knob, colours.knob);

buttons.paint(gr);

//aquí se pinta el recuadro con reborde que aloja los tiempos
FillGradientRectangle(gr, time_x, time_y, time_w, time_h, 0, colours.time_recuadro_degra2, colours.time_recuadro_degra1);

//aquí se pinta el reborde del recuadro
DrawRectangle(gr, time_x, time_y, time_w, time_h, colours.time_reborde);

//aquí se pinta la miniatura fuera de If (fb.IsPlaying) para que no se borre al pulsar stop --------
if (img) {
_drawImage(gr, img, 0, 0, panel.h - 2, panel.h - 2, image.centre);
}

if (fb.IsPlaying) {
//aquí se pinta la linea 1 izq: artist, año, album
//elimino el metadato %album% dejándole su $rgb y tb el %artist% solo en la clásica para después añadir el la string lin1 las strings album y artist ya depuradas de ()
var lin1 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$rgb(170,170,170)   $rgb(230,230,230)%date%   $rgb(170,170,170),$rgb(170,170,170)[%artist%]   $rgb(230,230,230)[%date%]   $rgb(170,170,170))').Eval();

//elimina texto entre ()
var arr = tfo_album.Eval();
textoFormateado = QuitaTextoEntreParentesis(arr);
var album = textoFormateado

//elimina texto entre ()
var arr = tfo_artist.Eval();
textoFormateado = QuitaTextoEntreParentesis(arr);
var artist = textoFormateado

var genero = tfo_genero.Eval();
//añado a lin1 las strings depuradas de () de forma que DrawColouredText es capaz de aplicar el color definido en fb.TitleFormat
if (genero == 'Clásica') lin1 = album + lin1 + artist;
else lin1 = lin1 + album;

DrawColouredText(gr,lin1, normal2_font, colours.artist, panel.h + posi_vert_lin_izq, posi_horiz_lin1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta la linea 2 izq: composer, track, title
var lin2 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$rgb(130,130,130)"$upper(%composer%)"  ,)$rgb(150,150,150)[%tracknumber%.  ]$rgb(225,225,225)').Eval();

//elimina texto entre ()
var arr = tfo_title.Eval();
textoFormateado = QuitaTextoEntreParentesis(arr);
var title = textoFormateado

var lin2 = lin2 + title

        //la linea siguiente es solo para Susi. En ella se pinta el title sin ninguna depuración de paréntesis
//var lin2 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$rgb(130,130,130)"$upper(%composer%)"  ,)$rgb(150,150,150)[%tracknumber%.  ]$rgb(225,225,225)%title%').Eval();

DrawColouredText(gr, lin2, normal2_font, colours.title, panel.h + posi_vert_lin_izq, posi_horiz_lin2, seekbar.x - panel.h - limite1, panel.h * 0.9, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta el porcen a la dcha. de la seekbar
var porcen = fb.TitleFormat('$ifgreater(%_time_total_seconds%,0,$div($mul(%_time_elapsed_seconds%,100),%_time_total_seconds%) ٪,LIVE)').Eval();
gr.WriteText(porcen, normal3_font, colours.porcen, seekbar.x + seekbar.w + _scale(12), posi_horiz_porcen, _scale(130), panel.h, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//tiempo transcurrido
var time_actual = fb.TitleFormat('%playback_time%').Eval();
gr.WriteText(time_actual, normal5_font, colours.time, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_actual, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
//tiempo restante
var time_resto = fb.TitleFormat('[- %playback_time_remaining%]').Eval();
gr.WriteText(time_resto, normal5_font, colours.time, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_resto, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
//tiempo total
var time_total = fb.TitleFormat('[%length%]').Eval();
gr.WriteText(time_total, normal5_font, colours.time_total, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_total, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta texto encima del volumen -------------------------

//aquí se pinta los herzios en 2 colores
var str = fb.TitleFormat('$ifgreater(%samplerate%,49000,$rgb(0,210,0),)%samplerate% Hz').Eval();
DrawColouredText(gr, str, normal3_font, colours.codec, seekbar.x, posi_horiz_linea1, posi_vert_herz, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pintan: bitrate, codec
var tfo = fb.TitleFormat('%bitrate% k          $ext($upper(%_path%))');
var arr = tfo.Eval().split('^^');
gr.WriteText(arr[0], normal3_font, colours.codec, seekbar.x, posi_horiz_linea1, posi_vert_codec, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta texto debajo del volumen -------------------------

//aquí se pinta last played y gain
        var tfo = fb.TitleFormat('[AGain: %replaygain_album_gain%     ]$if($and($strcmp($strstr(%last_played%,-),5),$strcmp($strstr(%last_played%,:),14)),Last Play: $substr(%last_played%,9,10)-$substr(%last_played%,6,7)-$substr(%last_played%,1,4) $substr(%last_played%,12,13):$substr(%last_played%,15,16)     ,)[TGain: %replaygain_track_gain%]');
var arr = tfo.Eval().split('^^');
gr.WriteText(arr[0], normal4_font, colours.gain, seekbar.x, posi_horiz_gain, posi_vert_gain, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

if (fb.PlaybackLength > 0) {
var pos = seekbar.pos();
//aquí se pinta la parte izquierda de la seekbar
gr.FillRoundedRectangle(seekbar.x, seekbar.y, pos, seekbar.h, _scale(2), _scale(2), colours.seekbar_progress);

//aquí se pinta el knob del seekbar avanzando
gr.FillEllipse(seekbar.x + _scale(3) + pos, seekbar.y + _scale(3), ancho_knob, alto_knob, colours.knob);
}
}
}

function on_playback_dynamic_info_track(type) {
if (type == 0) window.Repaint();
else update_album_art(fb.GetNowPlaying());
}

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

function on_playback_new_track(metadb) {
update_album_art(metadb);
}

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

function on_playback_seek() {
seekbar.playback_seek();
}

function on_playback_starting() {
buttons.update();
window.Repaint();
}

function on_playback_stop() {
buttons.update();
window.Repaint();
}

function on_playback_time() {
//la linea siguiente la sustituí por la siguiente según me indicó marc2k3 en el foro para arreglar el que no se pintaban los tiempos per second
// window.RepaintRect(panel.h, 0, seekbar.x - panel.h, panel.h);
window.Repaint();
}

function on_playlist_stop_after_current_changed() {
buttons.update();
window.Repaint();
}

//aquí se definen las coordenadas de la seekbar y el volumen
function on_size() {
panel.size();
seekbar.x = _scale(posi_vert_seekbar_ini);
    seekbar.w = panel.w - seekbar.x - ancho_seekbar;
seekbar.h = alto_seekbar;
seekbar.y = (panel.h - seekbar.h) / posi_horiz_seekbar;

volume.x = seekbar.x + seekbar.w + ancho_volume + (bs * 5);
volume.y = posi_horiz_barra_volume;
volume.w = panel.w - volume.x - separacion_pared_derecha_volume;
volume.h = alto_volume;

buttons.update();
}

function on_volume_change() {
volume.volume_change();
window.Repaint();
}

function QuitaTextoEntreParentesis(arr) {
//elimina texto entre () excepto que esté al principio
//1ª depuración empezando por la derecha
var first = arr.indexOf('(');
var last = arr.lastIndexOf('(');
if (last > first) arr = arr.substr(0, last-1).trim();
else if (first > 0) arr = arr.substr(0, first-1).trim();
//2ª depuración empezando por la derecha
var first = arr.indexOf('(');
var last = arr.lastIndexOf('(');
if (last > first) arr = arr.substr(0, last-1).trim();
else if (first > 0) arr = arr.substr(0, first-1).trim();
//3ª depuración empezando por la derecha
var first = arr.indexOf('(');
var last = arr.lastIndexOf('(');
if (last > first) arr = arr.substr(0, last-1).trim();
else if (first > 0) arr = arr.substr(0, first-1).trim();
        //4ª depuración empezando por la derecha
        var first = arr.indexOf('(');
        var last = arr.lastIndexOf('(');
        if (last > first) arr = arr.substr(0, last-1).trim();
        else if (first > 0) arr = arr.substr(0, first-1).trim();

textoFormateado = arr
return textoFormateado;
}


Re: JScript Panel

Reply #1517
I can't be bothered to do the title formating gymnastics necessary to ignore a bracket if it's first character but this example which doesn't care works fine. If this works, why would any other TF pattern not?

Code: [Select]
$replace(%title%,'(',$rgb(255,0,0)'(',')',')'$rgb())



You'll need to provide examples.


Re: JScript Panel

Reply #1518
3.4.10

https://github.com/jscript-panel/release/releases

Not worthy of a changelog entry but the crappy transparency effect for CUI toolbars is once again available when added as panels. Even with my supposed removal of it, flickering can still happen so it might as well stay. All flickering can be avoided by using standard panels in proper splitters - not PSS.

edit: I didn't mean to say transparency in CUI toolbars is crappy - it's essential. Adding toolbars as panels to use with PSS sucks. :P

Since the following piece was added in helpers.txt,

Code: [Select]
Array.prototype.empty = function () {
return this.length == 0;
}

my process_string function in Smooth Playlist is not working

Code: [Select]
function process_string(str) {
var str_ = [];
str = str.toLowerCase();
while (str != (temp = str.replace("  ", " ")))
str = temp;
str = str.split(" ").sort();
for (var i in str) {
if (str[i] != "") {
str_[str_.length] = str[i];
}
}
console.log(str_);
return str_;
}

This is what I got in console.

Code: [Select]
JScript Panel 3.4.10 (id:18088926): initialised in 30 ms
function () {
return this.length == 0;
}

It's all good if I delete the prototype function in helpers.txt.
What shall I change when helpers.txt is untouched?

Re: JScript Panel

Reply #1519
Sorry about that. I didn't think empty would conflict with anything. It's a keyword usually associated with strings/vectors/other containers in C++ and I thought adding this for myself in JS would be safe.

edit: it will be removed in the next release. You shouldn't have to modify your code for this.

Re: JScript Panel

Reply #1520
I also have a small issue with Smooth Playlist Manager. In some cases the icon is too tall and in all cases there's not enough padding between the icon and the playlist name.

Can I adjust that myself?

Re: JScript Panel

Reply #1521
3.4.11 fixes the bad helpers.txt update.

https://github.com/jscript-panel/release/releases

The horizontal padding in Smooth Playlist Manager has been tweaked but I have no idea why the overall look in that screenshot above is so appalling. I can't make it look that bad if I try. Changing fonts/DPI/scrolling with ctrl key down to increase size - nothing went that wrong. :/

Re: JScript Panel

Reply #1522
3.4.11 fixes the bad helpers.txt update.

https://github.com/jscript-panel/release/releases

The horizontal padding in Smooth Playlist Manager has been tweaked but I have no idea why the overall look in that screenshot above is so appalling. I can't make it look that bad if I try. Changing fonts/DPI/scrolling with ctrl key down to increase size - nothing went that wrong. :/

All good, thx for support!

Re: JScript Panel

Reply #1523
3.4.11 fixes the bad helpers.txt update.

https://github.com/jscript-panel/release/releases

The horizontal padding in Smooth Playlist Manager has been tweaked but I have no idea why the overall look in that screenshot above is so appalling. I can't make it look that bad if I try. Changing fonts/DPI/scrolling with ctrl key down to increase size - nothing went that wrong. :/

Doesn't matter. 3.4.11 also fixes my smp issue. Thx!

Re: JScript Panel

Reply #1524
3.4.12 add IMetadbHandleList Reverse and Playback Order buttons to included buttons samples. For existing users, they need re-importing.

There is a minimal new Playback Buttons + Playback Order. The others are combined with seekbars.

https://github.com/jscript-panel/release/releases

Unlike an example I posted last night in the script discussion thread, these buttons support all modes. I found Segoe Fluent Icon chars which will do. Tooltips are there to help if not. :P