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 script discussion/help (Read 311208 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: JScript Panel script discussion/help

Reply #1000
It should but work but there are 2 things to note:

-It only works with 64bit fb2k 2.0 / JScript Panel3. AFAIK, there is no 32bit version of the JXL DLL.
-The album art preferences must explicitly specify the file extension. Wildcards won't work.

Well that explains it, time to transition to foobar 2.0, Thanks for the quick reply!


Re: JScript Panel script discussion/help

Reply #1002
Hi :) etip
Playlist Organizer (Playlist Manager) (JScript Panel 3 Script) 2023-03-10
https://hydrogenaud.io/index.php/topic,110516.msg1023599.html#msg1023599

Many Thanks.
https://i.imgur.com/yhPyoxs.png
https://i.imgur.com/W4a6lCe.png
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, SONY WH-ULT900N (ULT WEAR) (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1003
Darker colours come from using Default UI (top) as opposed to Columns UI (bottom).
Spoiler (click to show/hide)
Thanks for the reply, I was thought you were using custom build that able to change that main dark background.
---
I have another question. In regard to Track Info + Seekbar + Buttons script. I would like to add a shuffle/default toggle button that can switch between different icon and colour states.
I'm not sure how to make the toggle function work, and I'm not a programmer, so I have them on a separate button instead.
May I ask how to make it on one button toggle?
Many thanks
Code: [Select]
//default
    this.buttons.regular = new _button(panel.w - LM - (bs * 4), y, bs, bs, {
        char: !fb.RunMainMenuCommand('Playback/Order/Default') || fb.RunMainMenuCommand('Playback/Order/Shuffle (tracks)')
            ? '\uF074'
            : chars.music,
        colour: RGB(255, 255, 255)
    }, null, function () {
        if (fb.RunMainMenuCommand('Playback/Order/Shuffle (tracks)')) {
            fb.RunMainMenuCommand('Playback/Order/Default');
        }
    }, !fb.RunMainMenuCommand('Playback/Order/Default') || fb.RunMainMenuCommand('Playback/Order/Shuffle (tracks)')
        ? 'Default'
        : 'Shuffle');

//shuffle
    this.buttons.shuffle = new _button(panel.w - LM - (bs * 5), y, bs, bs, {
        char: '\uF074',
        colour: fb.StopAfterCurrent
            ? colours.sac
            : colours.test
    }, null, function () {
        fb.RunMainMenuCommand('Playback/Order/Shuffle (tracks)');
    }, 'Shuffle');

Re: JScript Panel script discussion/help

Reply #1004
Hi there, yet another newbie questions.

[Track Info + Seekbar + Buttons]
1. How can I use SVG on the buttons instead of char?

[JS Playlist]
2. How to make the rating color change when on hover just like the standalone rating sample script or like the default rating hover on DUI?
3. Is it possible to load characters from a different set of fonts, such as MaterialIcons fonts?

Re: JScript Panel script discussion/help

Reply #1005
After hours upon hours, I'm satisfied enough to have this look and function properly.
Thanks for the samples, @marc2k3, even a newbie like me who is new to JavaScript learned a few things here.


Re: JScript Panel script discussion/help

Reply #1006
Your previous post where you were trying to determine the char to display after running main menu commands was too painful for me to respond to. I had to lie down and recover.

I hope you discovered plman.PlaybackOrder as a property than can be used to get and set and the on_playback_order_changed callback.

Re: JScript Panel script discussion/help

Reply #1007
Yes, that on_playback_order_changed took me a while (days) to figure out. Eventually, I was able to get the function to work properly using setup; perhaps, this is sufficient for me.

Code: [Select]
	//shuffle
    this.buttons.shuffle = new _button(panel.w / 2 - 100, 12, bs, bs, {
char : (plman.PlaybackOrder == 0) ? chars.shuffle
: (plman.PlaybackOrder == 4) ? chars.shuffle
: (plman.PlaybackOrder == 5) ? chars.shuffle2
: (plman.PlaybackOrder == 6) ? chars.shuffle2
: chars.shuffle,
        colour  : (plman.PlaybackOrder == 0) ? colours.buttons
: (plman.PlaybackOrder == 4) ? colours.accent
: (plman.PlaybackOrder == 5) ? colours.sac
: (plman.PlaybackOrder == 6) ? colours.red
: colours.buttons,
    }, null, function () {
shuffle_switch();
}, (plman.PlaybackOrder == 0) ? 'Enable Shuffle'
: (plman.PlaybackOrder == 4) ? 'Shuffle Tracks'
: (plman.PlaybackOrder == 5) ? 'Shuffle Album'
: (plman.PlaybackOrder == 6) ? 'Shuffle Folder'
: 'Shuffle');

Code: [Select]
function shuffle_switch() {
if (plman.PlaybackOrder < 6 && plman.PlaybackOrder > 3) {
plman.PlaybackOrder += 1;
}
else if (plman.PlaybackOrder === 6) {
plman.PlaybackOrder = 0;
}
else {
plman.PlaybackOrder = 4;
}
window.Repaint();
}

Code: [Select]
//finally
function on_playback_order_changed() {
buttons.update();
window.Repaint();
}

Re: JScript Panel script discussion/help

Reply #1008
Thumbs script: Double click on a picture opens external picture viewer. I prefer to use internal foobar2000 picture viewer (see: double click on DUI Album Art Viewer). Is it possible?

Re: JScript Panel script discussion/help

Reply #1009
Not at the moment, no.

The included album art script already supports it. It has a customisable double click action....



This is because it takes an album_art_data_ptr object as input so I implemented as a metadb handle method where you supply the desired album art id....

https://jscript-panel.github.io/docs/interfaces/IMetadbHandle/#showalbumartviewerart_id-want_stub

Because thumbs loads any old random image from disk, it's obviously not possible right now. I do know to how to create an album_art_data_ptr from image file paths but it would require a brand new method in the component itself. I'll think about it.

edit: the component already has an internal helper method for doing this. Embedding album art requires an album_art_data_ptr and my methods take an image file path for that.

edit2: look at all this code I had to write...

Code: [Select]
STDMETHODIMP Fb::ShowPictureViewer(BSTR path)
{
album_art_data_ptr data = AlbumArt::path_to_data(path);
if (data.is_valid())
{
fb2k::imageViewer::get()->show(core_api::get_main_window(), data);
}
return S_OK;
}

I'm super tired now.  :))

Re: JScript Panel script discussion/help

Reply #1010
Thumbs script: Want to download and display Last.fm artist pictures for classical composers. My problem: The artist field (%artist%) is for example "Englund - Klas, Tampere Philharmonic Orchestra", so it gives no result. "Einar Englund" instead gives results, but its in my %composer% tag. How do I replace %artist% with %composer% in Thumbs script? Thanks.


Re: JScript Panel script discussion/help

Reply #1012
Marc,
I did implement a scrollbar to the Playlist organizer script.  The scrollbar appears when i reload the script but does not when Foobar is launched.
Would you have any pointers/direction to look at ? I frankly have no idea why this can happen.

https://hydrogenaud.io/index.php/topic,123820.new.html#new
Thanks in advance


Re: JScript Panel script discussion/help

Reply #1014
unfortunately not, i'm setting width & height during the on_size callback and the scrollbar Size is also setup during this callback :

Code: [Select]
this.size = function () {
this.panel_h = window.Height;
this.panel_w = window.Width;
this.w = window.Width - cScrollBar.width-5;
this.h = window.Height - TM;
...
p_scrollbar.setSize(this.panel_w - cScrollBar.width, this.ylist, cScrollBar.width, this.h);
p_scrollbar.setCursor(this.rows, this.items, this.offset);

}
Do you know when the on_size callback kicks when the script is launched ?

Re: JScript Panel script discussion/help

Reply #1015
it's actually quite weird as the scrollbar loads correctly at startup but at the end of the loading (cursor goes back to normal), the scrollbar disappears. See below :
X

Re: JScript Panel script discussion/help

Reply #1016
As I've made clear before, I did not write the scrollbar code but it has always worked perfectly for me with thousands of items in JS Playlist and Smooth Playlist. Only your own code can make it appear/disappear?  :o

As for on_size, it's always called when a script initialises. Any code not inside a function runs first then on_size kicks in then on_paint.

After that, a script does nothing until various callbacks are triggered by fb2k core reporting changes/your mouse/keyboard etc.


Re: JScript Panel script discussion/help

Reply #1017
ok, thanks. This order is important to me to try to understand what's going on, as you said, it's my code that has an issue (i had no doubt !)
Thanks



Re: JScript Panel script discussion/help

Reply #1020
Nevermind. Previously, I intended to add a few more font options, but after testing a few material icon variants, I think the segoe mdl is a good enough alternative.

Re: JScript Panel script discussion/help

Reply #1021
I'm already changing it for the next release, It's not consistent across Windows 10/11 - the console icon I chose is borked on 11.

I'll be using Segoe Fluent Icons. It's included in 11 and can be downloaded for 10.

https://learn.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font

https://github.com/jscript-panel/component/commit/a8f3c198560af85a4b5619b952147507e1bc6ea8

Re: JScript Panel script discussion/help

Reply #1022
Yeah, that fluent version looks more consistent.

Segoe Fluent Icons


Segoe MDL2 Assets

tab stack

Reply #1023
tab stack in JSP 3 is pretty ugly .
How to replace it with button image or SVG to switch tabs ?
how to hide and show var panel = new_panel on left click mouse ?
how to change coordinate of the panel ? i know : panel.w and panel.h but the x and y position ?
all of this in jscript panel 3 . thanks

Re: JScript Panel script discussion/help

Reply #1024
tab stack in JSP 3 is pretty ugly .
How to replace it with button image or SVG to switch tabs ?
how to hide and show var panel = new_panel on left click mouse ?
how to change coordinate of the panel ? i know : panel.w and panel.h but the x and y position ?
all of this in jscript panel 3 . thanks

I think tab stacks are unrelated to JSP 3, but rather a basic UI element from foobar or a Windows element.

Marc did mention replacing the tabs with a single panel but only for JSP panels on this post, but it was too advance for me.
Spoiler (click to show/hide)
--------------
Quote
How to replace it with button image or SVG to switch tabs ?
I'd like to know this as well, although I'm not sure how the built-in panels would fit in.

ColumnsUI would be the only way for beginners like me, as the other option like panel splitter or jsplitter are for advance user only.
There is an open issue on ColumnsUI GitHub regarding these tab stacking to make tab appearance customisable.
https://github.com/reupen/columns_ui/issues/555

Actually, I did modify mine, but only as far as changing its tabs colour background.
Spoiler (click to show/hide)