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: "Playback>Stop after current" indicator? (Read 2003 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

"Playback>Stop after current" indicator?

I'm using an "$if(%_isplaying%..." string to display a musical note character next to the track that is currently playing in "playlist view".

I'd like to find a string that will display a character to indicate that the "Stop after current" function is active.  I don't know how to specify playback functions/menu commands in title formatting strings...  is it even possible?

Using foobar2000 v2.0 and CUI 2.0.0-rc.1 on Win10

tia!

Re: "Playback>Stop after current" indicator?

Reply #1
You can add a button to your toolbar for Stop After Current (Definitely works in Columns UI, might also in Default UI). The button will show active when it is active.
Think millionaire, but with cannons.

Re: "Playback>Stop after current" indicator?

Reply #2
You can add a button to your toolbar for Stop After Current...
Thanks, Cannonaire.
That's how I had it working before, but since v2.0 has been released, my layout has no visible menu items or buttons. 



I've assigned a keyboard shortcut for the function, but there isn't a simple way to see if it's engaged (in this layout): 
Perhaps there's a way to get the "Stop after current" function to automatically reset to "off" after the track ends...?

Re: "Playback>Stop after current" indicator?

Reply #3
Title formatting obviously does not exist. But even if it did, it would only be half the story.

What use is a visual indicator if no panels are designed to handle the state being updated? You can toggle it on/off at any time and you would expect any display update to be instantaneous. But if a panel is designed to display metadata only, it will update itself on selection changes, new track starting, tag edits etc. It will be oblivious to your stop after current actions. Do you see the problem here?

CUI buttons can obviously handle this change in state because they were explicitly designed to. Javascript-y components like WSH Panel mod, Spider Monkey, JScript Panel can also handle it but only if you know what code to write.

Re: "Playback>Stop after current" indicator?

Reply #4
Well, poo...  It was worth a try, though.  Thanks for the info!


Re: "Playback>Stop after current" indicator?

Reply #6
That code snippet was posted for WSH panel mod 10 years before JSP3 existed and is not compatible. It might be easy for some people to spot what needs changing but for most, it won't.

Re: "Playback>Stop after current" indicator?

Reply #7
Fixed version for JScript Panel 3 (1 function name replaced):

Code: [Select]
var ww = 0;
var wh = 0;

function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

function on_size() {
ww = window.Width;
wh = window.Height;
}

function on_paint(gr) {
gr.FillRectangle(0, 0, ww, wh, fb.StopAfterCurrent ? RGB(255,0,0) : RGB(0,255,0));
}

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

function on_mouse_lbtn_up() {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
}

Re: "Playback>Stop after current" indicator?

Reply #8
There is the whole other issue of it being hideously ugly and not deserving a place in any layout. It didn't matter back then because the forum was alive with script writers who only needed help with the mechanics of SAC such as the callback triggered by changes from fb2k core/toggling on click. They were more than capable of making things look nice without assistance. But the people capable of that now.... it would be a very short list.

Re: "Playback>Stop after current" indicator?

Reply #9
Alternative Stop after current indicator using JScript Panel 3: https://hydrogenaud.io/index.php/topic,77883.msg797324.html#msg797324

Fixed version for JScript Panel 3 (1 function name replaced):

Code: [Select]
var ww = 0;
var wh = 0;

function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

function on_size() {
ww = window.Width;
wh = window.Height;
}

function on_paint(gr) {
gr.FillRectangle(0, 0, ww, wh, fb.StopAfterCurrent ? RGB(255,0,0) : RGB(0,255,0));
}

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

function on_mouse_lbtn_up() {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
}




With repect to marc2k3 I hope my intrusion in this thread will be forgiven and overlooked.

Below is the exact script I use for my "Stop after current" indicator. The script is from the link you posted with the addition of a tooltip script. The tooltip script is from a sample that was included with WSH panel mod.

I have tried the below script in Spider Monkey Panel 1.6.1 and it worked. I have also tried it in JScript Panel 3 and it did not work. Now that you have posted the script so that it will function in JScript Panel 3, will the "tooltip" section of the below script also function in JScript Panel 3 or does a change need to be made to it too?

If any change does need to be made for it to work in JScript Panel 3 I am not knowledgeable to do it. I got lucky when I blended the tooltip script into marc's script.

If marc2k3 would just rather this all go away please do not answer my question.

I would check the script in JScript Panel 3 myself but it would be a few days before I would be able to do so.



Code: [Select]

var ww = 0;
var wh = 0;

function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

// Tooltip script begins here
var g_tooltip = window.CreateTooltip();
var g_font = gdi.Font("Tahoma", 14);
var g_trackingMouse = false;
var g_oldX, g_oldY;
var ww, wh;


function on_mouse_move(x, y) {
    if (!g_trackingMouse) {
        g_tooltip.Activate();
        g_tooltip.TrackActivate = true;
        g_trackingMouse = true;
    }
   
    // Make sure the position is changed
    if (g_oldX != x || g_oldY != y) {
        g_tooltip.Text = "Playback / Stop after current";
        g_tooltip.TrackPosition(x + 10, y + 20);
        g_oldX = x;
        g_oldY = y;
    }
}

function on_mouse_leave() {
    g_trackingMouse = false;
    g_tooltip.TrackActivate = false;
}
// Tooltip script ends here

function on_size() {
ww = window.Width;
wh = window.Height;
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, fb.StopAfterCurrent ? RGB(255,0,0) : RGB(220,226,234));
}

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

function on_mouse_lbtn_up() {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
}




Re: "Playback>Stop after current" indicator?

Reply #10
Fixed script for JScript Panel 3 (with tooltip).

Code: [Select]
var ww = 0;
var wh = 0;

function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

// Tooltip script begins here
var g_tooltip = window.CreateTooltip();
var g_font = "";
var g_trackingMouse = false;
var g_oldX, g_oldY;
var ww, wh;


function on_mouse_move(x, y) {
    if (!g_trackingMouse) {
        g_tooltip.Activate();
        g_tooltip.TrackActivate = true;
        g_trackingMouse = true;
    }
  
    // Make sure the position is changed
    if (g_oldX != x || g_oldY != y) {
        g_tooltip.Text = "Playback / Stop after current";
        g_tooltip.TrackPosition(x + 10, y + 20);
        g_oldX = x;
        g_oldY = y;
    }
}

function on_mouse_leave() {
    g_trackingMouse = false;
    g_tooltip.TrackActivate = false;
}
// Tooltip script ends here

function on_size() {
ww = window.Width;
wh = window.Height;
}

function on_paint(gr) {
gr.FillRectangle(0, 0, ww, wh, fb.StopAfterCurrent ? RGB(255,0,0) : RGB(220,226,234));
}

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

function on_mouse_lbtn_up() {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
}




Re: "Playback>Stop after current" indicator?

Reply #12
Perhaps there's a way to get the "Stop after current" function to automatically reset to "off" after the track ends...?
This exists!  ;D
Preferences > Playback > Reset the above when stopping (for Stop playback after current track)
Think millionaire, but with cannons.

Re: "Playback>Stop after current" indicator?

Reply #13
This exists!  ;D
Preferences > Playback > Reset the above when stopping (for Stop playback after current track)
Excellent!  Thank you, Cannonaire.  This will be a great help until I decide to jump into the Java stuff, and try out the script that cwb, grimes, and marc2k3 have hashed out.
Thanks for all the info, everyone!

Re: "Playback>Stop after current" indicator?

Reply #14
All playback buttons bundled with JScript Panel 3 (fb2k 2.0 version only) now include a Stop After Current toggle when right clicking the stop button.

https://hydrogenaud.io/index.php/topic,110499.msg1026536.html#msg1026536