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: Track Info Panel with ability to change font (Read 729721 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Track Info Panel with ability to change font

Reply #950
I'm trying to figure out two things.  First, I'd like to create a button that toggles a dockable panel but I'm not quite sure how to do it.  I want to be able to test for whether or not the panel is activated and if it is, have it so the button closes the panel.  If the panel isn't activated, I want to be able to open it via the button.

This same sort of thing applies to my other question.  I want to create a button that toggles between shuffling tracks and the default track order.  Again, I want to be able to test the state of the track order so that I can have the correct button display.  It was easy enough to do it for a play/pause button using $ispaused and $not(%isplaying%), but I can't figure out how to do it for track order.

Anyone have any ideas?

Track Info Panel with ability to change font

Reply #951
I've moved it below the // PerSecond thing and it does nothing but make the button disappear.

Buttons must go in the // PerTrack section.  If it's under // PerSecond, that's not // PerTrack anymore.

I'm trying to figure out two things.  First, I'd like to create a button that toggles a dockable panel but I'm not quite sure how to do it.  I want to be able to test for whether or not the panel is activated and if it is, have it so the button closes the panel.  If the panel isn't activated, I want to be able to open it via the button.

This same sort of thing applies to my other question.  I want to create a button that toggles between shuffling tracks and the default track order.  Again, I want to be able to test the state of the track order so that I can have the correct button display.  It was easy enough to do it for a play/pause button using $ispaused and $not(%isplaying%), but I can't figure out how to do it for track order.

Anyone have any ideas?


From the wiki -

"The following returns a sort index of the field, ie if the playlist is sorted first by genre, then artist, then by album, $sorted(artist) will return 3. If the playlist is not sorted by 'field' through the SORT command described above, then $sorted(field) will be evaluated as false and produce '[UNKNOWN FUNCTION]' as text output.

$sorted(field)"

Using $sorted() you can test if the playlist uses a certain sort string, ie $if($sorted(Artist),....,.....).  Bear in mind that $sorted() test for the NAME, not the VALUE in name_1|value_1.

 

Track Info Panel with ability to change font

Reply #952
If the button is in per track how do I get it to update immediatly after clicking the button. My playback button doesn't update until track change and I want it to toggle the playback continuously until the esired playback is found.

Track Info Panel with ability to change font

Reply #953
From the wiki -

"The following returns a sort index of the field, ie if the playlist is sorted first by genre, then artist, then by album, $sorted(artist) will return 3. If the playlist is not sorted by 'field' through the SORT command described above, then $sorted(field) will be evaluated as false and produce '[UNKNOWN FUNCTION]' as text output.

$sorted(field)"

Using $sorted() you can test if the playlist uses a certain sort string, ie $if($sorted(Artist),....,.....).  Bear in mind that $sorted() test for the NAME, not the VALUE in name_1|value_1.


I have absolutely no idea what this means.

Track Info Panel with ability to change font

Reply #954
I have absolutely no idea what this means.

My mistake.  I thought you were talking about sorting your playlist.  You meant changing the playback order.

I think what you need is -

Code: [Select]
$button2(DstX,DstY,X,Y,W,H,TEXT,HOVER TEXT,COMMAND,OPTIONS)


where COMMAND is anything from this list - http://wiki.hydrogenaudio.org/index.php?ti...Main_Menu_Items

# Playback/Order/Default
# Playback/Order/Random
# Playback/Order/Repeat
# Playback/Order/Repeat One
# Playback/Order/Shuffle
# Playback/Order/Shuffle album
# Playback/Order/Shuffle album 2
# Playback/Order/Shuffle tag set

For example
Code: [Select]
$button2(DstX,DstY,X,Y,W,H,TEXT,HOVER TEXT,'Shuffle (tracks)',)


You can use %cwb_playback_order% to return what the current playback order is (available with foo_cwb_hooks, and only returns a value while a song is playing).

EDIT - it seems some of the commands in the list are out of date with foobar 0.9.  Basically just look in the menu, and the command should have the same syntax, ie 'Shuffle (tracks)'.

Track Info Panel with ability to change font

Reply #955
If the button is in per track how do I get it to update immediatly after clicking the button. My playback button doesn't update until track change and I want it to toggle the playback continuously until the esired playback is found.

This works for me, as long as a song is playing or paused.  If it is stopped, then %cwb_playback_order% has no value.  But when playing, the button updates as it should.
Code: [Select]
// Global
// Background
// PerTrack
$if($strcmp(%cwb_playback_order%,'Default'),
$button2(5,5,0,0,50,20,'shuffle','SHUFFLE','Shuffle (tracks)',)
,
$button2(5,5,0,0,50,20,'default','DEFAULT','Default',)
)

// PerSecond
$alignabs(5,30,500,20,left,middle)
%cwb_playback_order%

Track Info Panel with ability to change font

Reply #956
You can use %cwb_playback_order% to return what the current playback order is (available with foo_cwb_hooks, and only returns a value while a song is playing).


That's exactly what I was looking for.  Thanks!

Now that I've got that done, I have one last thing I'm trying to figure out, but it may be impossible.  I want to test whether or not an item in the menus is selected.  For example, foo_dockable_panels has a submenu in the View menu that allows you to activate and collapse panels.  I want to be able to toggle it open and closed with a button.  Luckily, it turns out this doesn't require any iterative statements to determine whether the panel is open or not, I just have to figure out how to actually activate this particular menu option.  Does anyone know what I'm talking about? (I had trouble explaining it well)  And if so, any advice?

Edit: I was able to create a keyboard shortcut for this action, I just can't figure out how to tie it to a button.  I feel like this should be easier than I'm making it.

Track Info Panel with ability to change font

Reply #957
You can use %cwb_playback_order% to return what the current playback order is (available with foo_cwb_hooks, and only returns a value while a song is playing).


That is exactly what I needed too. Thank you.

Is there a way to make scrolling lyrics in the track panel? I have been experiemnting for some time without actually getting them to scroll with the song similar to the actual lyrics panel. Thanks for any help.

Track Info Panel with ability to change font

Reply #958
Code: [Select]
$puts(percent,$muldiv(%_time_elapsed_seconds%,100,
%_time_total_seconds%))
$puts(hgt,$calcheight(%lyrics%))
$if($meta_test(lyrics),
$alignabs(0,$div($sub(%_height%,$muldiv($get(percent),%_height%,50)),3),%_width%,$mul($get(hgt),96),center,top)
$font(Calibri,$sub(24,$get(hgt)),,)
%lyrics%,
$align(center,middle)
%artist% - %title%)


I have scrolling lyrics working for the most part I have only tested it with one album and it paces itself relativly well with the song but its not quite perfect.

Track Info Panel with ability to change font

Reply #959
I just realized that in oder to make the lyrics to scroll properly I need a function that can either get the number of lines in a given field or return the total number of pixels a particular text has. Pixels would be preferrable.
something like:

$textPx(text)
$textPy(text)
or
$lines(text)

That way I can Identify the bottom of the lyrics by the number of pixles or lines it has in order to make it move at that particular rate.

Track Info Panel with ability to change font

Reply #960
I just realized that in oder to make the lyrics to scroll properly I need a function that can either get the number of lines in a given field or return the total number of pixels a particular text has. Pixels would be preferrable.
something like:

$textPx(text)
$textPy(text)
or
$lines(text)

That way I can Identify the bottom of the lyrics by the number of pixles or lines it has in order to make it move at that particular rate.

$calcwidth(text) and $calcheight(text) do return the width and height in pixels.  $len(text) will return the length of a string in characters.  But I don't think there is a function to return the number of lines a paragraph takes up.

Track Info Panel with ability to change font

Reply #961

I just realized that in oder to make the lyrics to scroll properly I need a function that can either get the number of lines in a given field or return the total number of pixels a particular text has. Pixels would be preferrable.
something like:

$textPx(text)
$textPy(text)
or
$lines(text)

That way I can Identify the bottom of the lyrics by the number of pixles or lines it has in order to make it move at that particular rate.

$calcwidth(text) and $calcheight(text) do return the width and height in pixels.  $len(text) will return the length of a string in characters.  But I don't think there is a function to return the number of lines a paragraph takes up.


I noticed that but its not helping the situation. $calcheight() and $calcwidth() both give you the pixles but only for the pt size of the font.

Track Info Panel with ability to change font

Reply #962
Hmmm... The wiki says that you can use "PVAR:SET:variable:value" in a button to set globals, but I can't seem to get it to work.  I'm trying to make an info-panel that can be toggled on and off.

Sample:
Code: [Select]
$if($get(ShowDetails,
$button2(4,4,0,0,100,50,'$font(,24pt,,192-0-0)Details','$font(,24pt,,255-255-255)Details','PVAR:SET:ShowDetails:0',)
Genre: %genre%[and so on...],
$button2(4,4,0,0,100,50,'$font(,24pt,,192-0-0)Details','$font(,24pt,,255-255-255)Details','PVAR:SET:ShowDetails:1',))


Even doing something as simple as setting the button to assign a value to any variable, and then using $get() to read it returns null every time.

Track Info Panel with ability to change font

Reply #963
foo_dockable_panels has a submenu in the View menu that allows you to activate and collapse panels. I want to be able to toggle it open and closed with a button

Code: [Select]
$button(4,32,0,0,7,7,/images\switch_01.png,/images\switch_02.png,collapse,)

Track Info Panel with ability to change font

Reply #964
Hmmm... The wiki says that you can use "PVAR:SET:variable:value" in a button to set globals, but I can't seem to get it to work.  I'm trying to make an info-panel that can be toggled on and off.

Sample:
Code: [Select]
$if($get(ShowDetails,
$button2(4,4,0,0,100,50,'$font(,24pt,,192-0-0)Details','$font(,24pt,,255-255-255)Details','PVAR:SET:ShowDetails:0',)
Genre: %genre%[and so on...],
$button2(4,4,0,0,100,50,'$font(,24pt,,192-0-0)Details','$font(,24pt,,255-255-255)Details','PVAR:SET:ShowDetails:1',))


Even doing something as simple as setting the button to assign a value to any variable, and then using $get() to read it returns null every time.

I see two things right off.  Your first line $get() function needs a close parenthesis - $get(ShowDetails)

Second, the wiki says -
"Sets a persistent variable - a variable that is recognized throughout the Trackinfo pannel mod and can be changed through buttons."
It seems to me this is a variable just for the Trackinfo panel mod, not a true ColumnsUI global variable.

Track Info Panel with ability to change font

Reply #965
I see two things right off.  Your first line $get() function needs a close parenthesis - $get(ShowDetails)

Second, the wiki says -
"Sets a persistent variable - a variable that is recognized throughout the Trackinfo pannel mod and can be changed through buttons."
It seems to me this is a variable just for the Trackinfo panel mod, not a true ColumnsUI global variable.


Oops... I must have deleted that parenthesis while I was cutting and pasting... it's in my actual config.

And I'm just looking to pick it up in various (1 or 2) spots within trackinfo_mod... I could care less if it shows up in SCP or anywhere else in columnsUI, it's just supposed to toggle a details display within the trackinfo panel, yet I can't read the variable anywhere... unless I'm using the wrong function?

Track Info Panel with ability to change font

Reply #966
And I'm just looking to pick it up in various (1 or 2) spots within trackinfo_mod... I could care less if it shows up in SCP or anywhere else in columnsUI, it's just supposed to toggle a details display within the trackinfo panel, yet I can't read the variable anywhere... unless I'm using the wrong function?

Try this -
Code: [Select]
// Global
// Background

// PerTrack


$ifequal($getpvar(ShowDetails),1,
$button2(4,4,0,0,100,50,'$font(,24,,192-0-0)Details','$font(,24,,255-255-255)Details','PVAR:SET:ShowDetails:0',)
$alignabs(4,75,%_width%,%_height%,left,top)$font(calibri,12,bold,255-255-255)'DETAILS TEXT',
$button2(4,4,0,0,100,50,'$font(,24,,192-0-0)Details','$font(,24,,255-255-255)Details','PVAR:SET:ShowDetails:1',))
$align(left,bottom)'ShowDetails = '$getpvar(ShowDetails)

// PerSecond


The functions $get() and $getpvar() are separate and exclusive.  PVAR:SET change the $getpvar() function.  I'll have to edit the wiki when I get a chance, but this is from the release notes in the latest version of trackinfo_mod -
Code: [Select]
+ Persistant variables & button to set values PVAR:SET:name:val : (example)
    $puts(val,$if2($getpvar(val),0))
    $align(left,bottom)$get(val)
    $button2(20,50,0,0,50,10,Add,Add,PVAR:SET:val:$add($get(val),1),)

Track Info Panel with ability to change font

Reply #967
(moderation: removed unnecessary full quote)



HELLO

Is there a way to add a heading for Composer to song info that would only show when then composer is different than the artist?

Track Info Panel with ability to change font

Reply #968
yes. It's called an $if() statement.
elevatorladylevitateme

Track Info Panel with ability to change font

Reply #969
Hi guys,

I'm not sure whether this has already been done by someone else, but I wanted to implement horizontal scrolling of text and have come up with a method.  Essentially, it uses the fact that alignabs() can take negative values.

As the time elapses, the "left" value in alignabs() becomes more (or is that less?) negative and gives the appearance of scrolling across.  One of the tricks is to repeat the desired string so it's long enough to allow scrolling for the entire length of the song.

For example, Rock & Rock Aint' Noise Pollution would become:

Rock & Rock Aint' Noise Pollution  Rock & Rock Aint' Noise Pollution  Rock & Rock Aint' Noise Pollution

and would give the appearance of scrolling across, pixel by pixel.

The limitation is that it will scroll across the entire width of the track info - this is what I wanted anyway. 

Apologies to anyone who has already described this, but I couldn't find anything using the search.  I'm sure someone more adept at track info design will be able to extend this.

Cheers,

c0utta

Code: [Select]
// make sure you've set your font beforehand so measurements are correct
// put your text you want to scroll here
$puts(txt,"$meta(title)")
// put the rate of scrolling here
$puts(rate,3)

$ifgreater($calcwidth($get(txt)),%_width%,
$puts(tot,$add(%_width%,$mul(%_time_total_seconds%,$get(rate))))
$puts(txt,$repeat($get(txt)'     ',$add(1,$div($get(tot),$calcwidth($get(txt))))))
$alignabs($sub(0,$mul(%_time_elapsed_seconds%,$get(rate))),6,$add(%_width%,$calcwidth($get(txt))),30,left,)
,$alignabs(0,6,%_width%,30,center,))
[$get(txt)]

Track Info Panel with ability to change font

Reply #970
The limitation is that it will scroll across the entire width of the track info - this is what I wanted anyway.

You could get around this by covering whatever portion of the trackinfo panel you don't want to see the scrolling text with a $drawrect() the color of your background.  That way the text scrolls behind the rectangle and disappears.  If you really want to get fancy you could position a PNG graphic that fades from transparent to solid at the edges of the scrolling text so it fades away all cool like.  Nice code.

Track Info Panel with ability to change font

Reply #971
Try this -


The functions $get() and $getpvar() are separate and exclusive.  PVAR:SET change the $getpvar() function.  I'll have to edit the wiki when I get a chance, but this is from the release notes in the latest version of trackinfo_mod -


Ah, thanks! That explains it.

Track Info Panel with ability to change font

Reply #972
Some quick questions. Im working on a layout, and Ive had a few things come up:

1> I have a progress bar that works well. What I want to do with it, though, is put an overlapping text to it. Thats easy, but I want to make the text change color at the same time as the progress bar. The code I have, in theory, should work, but trackinfo_mod seems to clip text that doesnt fit within its defined box. Is there a way to define a containing box for text thats smaller than the text itself, yet still show the partial text? Here's my code:

Code: [Select]
// Global

$puts(color1,105-9-10)
$puts(color2,229-151-149)
$puts(color3,247-247-247)

$puts(proglen,162)
$puts(progcalc,$left($num($div($mul(%_time_elapsed_seconds%,$mul($get(proglen),10)),%length_seconds%),4),3))
$ifgreater(1,$get(progcalc),$puts(progcalc,1),)

$puts(prog1,$drawrect(0,0,$get(proglen),16,pencolor-0-0-0 brushcolor-$get(color3) width-1))
$puts(prog2,$drawrect(0,0,$get(progcalc),16,pencolor-0-0-0 brushcolor-$get(color1) width-1))
$puts(prog3,$alignabs(0,0,$get(proglen),16,$get(proglen),16)$font(verdana,8,,$get(color1))Progress)
$puts(prog4,$alignabs(0,0,$get(progcalc),16,0,0)$font(verdana,8,,$get(color2))Progress)

// PerTrack


// PerSecond

$get(prog1)$get(prog3)
$get(prog2)$get(prog4)

$get(prog3) stays hidden until its the length of the string "Progress", and I want to circumvent that.

PS - I scripted that progress bar myself. Did I use any extraneous code that can be consolidated? Thx

2> $button2 doesnt seem to want to work with my panels. If I use the example code on hydrogen's wiki page for info_mod:

Code: [Select]
// Global

$button2(0,0,0,0,30,13,$font(tahoma,8,,0-0-0)Forward,$font(tahoma,8,underline,0-0-0)Forward,'Seek ahead by 10 seconds',)

I get this:



needless to say, the button doesnt work either. If i remove the font tags, sometimes it works with plain text, other times the text is hidden but the button works if you find it through blind clicking (default text black, white background). Can someone tell me what Im doing wrong? I got the img buttons to work fine, but I want text buttons for certain things and its not exactly working for me.

3> Not all the button commands seem to want to work for me. I must be doing something wrong here. For example, my playback order buttons. Default works, but Repeat doesnt, and either does Repeat one or 'Repeat one'.

works:

$button(13,175,0,0,21,17,D:\Erich\mugglenet\poll1.gif,D:\Erich\mugglenet\poll2.gif,Default,)
$alignabs(35,177,162,16,162,16)$font(verdana,8,,247-247-247)Default

Doesnt work:

$button(13,195,0,0,21,17,D:\Erich\mugglenet\poll1.gif,D:\Erich\mugglenet\poll2.gif,'Repeat playlist',)
$alignabs(35,197,162,16,162,16)$font(verdana,8,,247-247-247)Repeat

The buttons show, and the mouseover works fine, but the command does nothing. Any help?

anyone reading this, thank you kindly for your time.

~E

Track Info Panel with ability to change font

Reply #973
2> $button2 doesnt seem to want to work with my panels. If I use the example code on hydrogen's wiki page for info_mod:

Code: [Select]
// Global

$button2(0,0,0,0,30,13,$font(tahoma,8,,0-0-0)Forward,$font(tahoma,8,underline,0-0-0)Forward,'Seek ahead by 10 seconds',)


You need single quotes around the font and text statement -
Code: [Select]
$button2(0,0,0,0,30,13,'$font(tahoma,8,,0-0-0)Forward','$font(tahoma,8,underline,0-0-0)Forward','Seek ahead by 10 seconds',)


3> Not all the button commands seem to want to work for me. I must be doing something wrong here. For example, my playback order buttons. Default works, but Repeat doesnt, and either does Repeat one or 'Repeat one'.


Your commands must match exactly what you see in the foobar context or main menus.  For example -
Code: [Select]
'Repeat (playlist)'
'Repeat (track)'
'Shuffle (tracks)'
'Shuffle (albums)'

Track Info Panel with ability to change font

Reply #974
1> I have a progress bar that works well. What I want to do with it, though, is put an overlapping text to it. Thats easy, but I want to make the text change color at the same time as the progress bar. The code I have, in theory, should work, but trackinfo_mod seems to clip text that doesnt fit within its defined box. Is there a way to define a containing box for text thats smaller than the text itself, yet still show the partial text? Here's my code:

$get(prog3) stays hidden until its the length of the string "Progress", and I want to circumvent that.


I've been racking my brain on this one, and I can't figure a solution using text and $drawrect().

But you could use images to accomplish this.  Make your first and last state progress bar images, then use $imageabs2() to crop the top image accordingly to reveal it as the song progresses.  This also gives you the flexibility to use something flashier than text in your progress bar - gradients, background images, etc.  Sorry I don't have a better solution for you.