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 730620 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Track Info Panel with ability to change font

Reply #825
Iodine_Galaxy: Did you place your bitrate code beneath a // PerSecond header?
Code: [Select]
Mode: %_trackinfo_mode%$char(10)$char(10)$if(%_trackinfo_notrack%,No track,Artist: %artist%$char(10)Title: %title%$char(10)Album: %album%)$char(10)Bitrate: %bitrate% kbps)
Just added %bitrate% tag. Imma beginner in a foobar customization.
Damn, i feel stupid. Added // PerSecond header. Works like charm. Thanks. 

Track Info Panel with ability to change font

Reply #826
Is it possible to make the rating system like iTunes where there are blank stars for unrated tracks then you can click and rate within the info panel?

While there may be a more simple and straigt-forward way to do it, I managed to find a way for the ratings to work like Windows Media Player, where the hypothetical rating is displayed on mousover, and the actual rating is displayed without mousover.  It gets complicated the way I did it because the ordering of button command layers is the opposite of that for display (with button commands, the button at the top of the code is on top of all others; with button display, the button at the bottom of the code is displayed above all others, soo that what you see is not quite in synch with what you would expect to get).

This method basically splits into two parts: getting the pretty dynamic display, and getting the tagging functionality.



First you make text buttons ($button2) with no text, only rating commands that cover the stars, so that clicking on any star will make the appropriate change in the %rating% field.

Then you make one button that covers all of  the stars plus a bit of area around it that has no command, but displays the actual rating on mousover and 'mousoff', as it were.  If this button is not large enough, then moving the mouse to fast off of the stars might cause strange rating displays for a little while.

Then you make buttons that stack on on top of the other to display the hypothetical mousover rating.  You want to stack them so that the fifth star is on top (last line of code), fourth star is beneath the fifth (code above that of the fifth), and so on.  You want the button of the first star to start on the first star and go to the last star.  The button for the second star then starts on the second star and spans the distance to the last star.  The third similarly starts on the third and ends on the last.  Each button should display a dark star when moused over, and else a dark star if the rating is greater than or equal to the number of the star, and a light star otherwise.

Track Info Panel with ability to change font

Reply #827
Here's the rating code that I've been using for a while. It works like WMP stars and is based on a scale of 1-10 so you can have half stars. I also made it so that you could change the size and position of the stars easily using variables:

Code: [Select]
//Start Variables
$puts(ratewidth,90)
$puts(xpos,15)
$puts(ypos,2)
$puts(imagedir,C:\Program Files\foobar2000\images\Ratings\)
//End Variables

$drawrect(,,,,brushcolor-SYSCOL-15 pencolor-null)
$puts(rating,$ifgreater(%RATING%,10,$puts(rate,$div($add(%RATING%,5),10)),$puts(rate,%RATING%)))
$imageabs2($get(ratewidth),$div($get(ratewidth),5),,,,,$get(xpos),$get(ypos),$get(imagedir)$if2(%rating%,0).png,alpha-95)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),9),0,$get(ratewidth),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'10.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'10.png,alpha-115)',TAG:SET:Rating:10,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),8),0,$mul($div($get(ratewidth),10),9),20,'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'9.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'9.png,alpha-115)',TAG:SET:Rating:9,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),7),0,$mul($div($get(ratewidth),10),8),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'8.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'8.png,alpha-115)',TAG:SET:Rating:8,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),6),0,$mul($div($get(ratewidth),10),7),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'7.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'7.png,alpha-115)',TAG:SET:Rating:7,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),5),0,$mul($div($get(ratewidth),10),6),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'6.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'6.png,alpha-115)',TAG:SET:Rating:6,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),4),0,$mul($div($get(ratewidth),10),5),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'5.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'5.png,alpha-115)',TAG:SET:Rating:5,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),3),0,$mul($div($get(ratewidth),10),4),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'4.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'4.png,alpha-115)',TAG:SET:Rating:4,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),2),0,$mul($div($get(ratewidth),10),3),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'3.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'3.png,alpha-115)',TAG:SET:Rating:3,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),1),0,$mul($div($get(ratewidth),10),2),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'2.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'2.png,alpha-115)',TAG:SET:Rating:2,)
$button2($get(xpos),$get(ypos),$mul($div($get(ratewidth),10),0),0,$mul($div($get(ratewidth),10),1),$div($get(ratewidth),5),'$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'1.png,alpha-25)','$imageabs2('$get(ratewidth)','$div($get(ratewidth),5)',,,,,,,'$get(imagedir)'1.png,alpha-115)',TAG:SET:Rating:1,)
$button2(0,0,0,0,$get(xpos),$div($get(ratewidth),5),,,TAG:SET:Rating:0,)

And use the images I uploaded here (make sure to set imagedir to wherever you extract them):
http://www.mytempdir.com/1131194

Now if only I could figure out how to get that tagging progressbar not to show up

Track Info Panel with ability to change font

Reply #828
I noticed the same problem, too.
However, it seems that the cause is not progressive jpeg format but an embedded thumbnail image.


It's nice when people find the problem, and then diagnose the cause also

I'd be surprised if this hasn't been suggested before, but I'd like to see some script control commands, along the lines of Sinclair BASIC to keep it nice and simple, but handy to speed up code execution and make it easier to code.  We already have IF..THEN..ELSE, so I'd like to see:


this would all need to be implemented by the general titleformat processor in the foobar core.

Noone having a CPU problem?

With a fullscreen panel and the only codeline: "// PerSecond" I'm having 75% CPU usage (most of the time) on my P3/800 Thinkbad notebook. With the same code, I have 5% on my P3/500 workstation. I can definitely say it's the Perseconds statement. Sometimes fb2k works fluently with Perseconds turned on, but most of the time it eats cpu. Could it be a graphics driver issue?


the only code you have is "// PerSecond" and nothing else and you get 75% cpu usage? It could be a driver issue, although I think you would notice a general sluggishness (especially when scrolling) in every other program as well. See what results you get when running this http://www.stereopsis.com/blttest/ benchmark.

Track Info Panel with ability to change font

Reply #829
the only code you have is "// PerSecond" and nothing else and you get 75% cpu usage? It could be a driver issue, although I think you would notice a general sluggishness (especially when scrolling) in every other program as well.
It definitily only happens with your plugin and "// PerSecond (PS)". I have no such problems since I turned of PS. Unfortunately it's kind of strange. If I add the PS to my configuration, fb2k may run fine at first, even with the PS layout loaded. But after using fb2k (may be because of changing layouts?) a couple of times, the cpu load increases and can only be decreased by removing the PS or change to another layout without PS.

Track Info Panel with ability to change font

Reply #830
Code: [Select]
$button2(0,20,0,0,25,25,$imageabs2(25,25,0,0,25,25,0,0,/images\gant\prev.png,),$imageabs2(25,25,0,0,25,25,0,0,/images\gant\prev.png,),previous,)


That won't work. It shows the image fine, but no matter what numbers I put in for the first two spots, the button is always placed at (0,0). Also, the button doesn't work when clicked on. Yes it is under PerTrack.

Track Info Panel with ability to change font

Reply #831
Is there a reason you need the $imageabs2() functions? Have you tried without them? $button2() should handle .png without a problem.

 

Track Info Panel with ability to change font

Reply #832
Is there a reason you need the $imageabs2() functions? Have you tried without them? $button2() should handle .png without a problem.


yes, but then it wont resize the image

edit: oh well doesnt matter, i just resized them myself


but another question:

Right now I have some buttons to rate the currently playing song, is there a way to get the panel to reload when i rate a song so the new rating buttons will show up?

I think that's easy to understand

Track Info Panel with ability to change font

Reply #833
terrestrial:
I think that you're coding to load images from file path with Gdiplus::Bitmap(pchar) now, but is there a plan to use Gdiplus::Bitmap(IStream) constructor? Then if so we get possible to use interface of archive or etc via filesystem::g_open().

Track Info Panel with ability to change font

Reply #834
I read earlier in this thread that a command exists to set line spacing, but it hasn't been published yet.  Well, could you tell me what it is?  I'd like to set a global linespacing so I don't have to use the #LINEHEIGHT# command after every line to space things out a bit.  This would be for all text under my $alignabs() setting for the bounding box.

Also, can someone be more clear how the $pad(X,Y) command works?  I can't get it to do anything useful.  Is this a per line setting?  Per section (like after an $alignabs() box)? Global value?

Track Info Panel with ability to change font

Reply #835
ok guys I have a problem - I want to display artist image in my track info.

I can do this if I hard code it.

The problem is - I want to pull the path of the cd/album and then go 1 oe 2 folders down back to the artist folder and display the artist image.

Dont know if that makes sense - basically I just want to have one copy of the artist image in the actual artist folder

eg
F:\music\_electro\Sneaky Sound System\Sneaky Sound System

my artist image is stored in

F:\music\_electro\Sneaky Sound System\Artist.jpg

I am currently using this to find/replace for my album art with great success.

$imageabs2(150,150,,,,,$sub(%_width%,150),0,$replace(%path%,%filename_ext%,Artist.*),NOKEEPASPECT)

This only displays the artists image if it is in the album folder itself.

Is there any way I can code it so that it checks the folder below the album folder & also if the folder below is CDX format then it goes one more folder down and then displays the artist.jpg if its present..

I hope all that makes sense

Appreciate your help

Track Info Panel with ability to change font

Reply #836
4nt1: try something like this:
Code: [Select]
$imageabs2(150,150,,,,,$sub(%_width%,150),0,
$replace(%path%,%directoryname%$char(92)%filename_ext%,Artist.*)
,NOKEEPASPECT)

Track Info Panel with ability to change font

Reply #837
thanks will try that - was thinking about that on the way to work in my car.

I did not know %directoryname% was a valid tag.
I have had some more ideas which I will try when I get home.
Thanks for the assitance, will let you know how I go.


Track Info Panel with ability to change font

Reply #839
on the subject of artist images, my images are in 1 folder and are named %artist%.png

is there any way to retrieve them if the artist name includes a '.' eg 'Dr. Dre'

Track Info Panel with ability to change font

Reply #840
Also, can someone be more clear how the $pad(X,Y) command works?  I can't get it to do anything useful.  Is this a per line setting?  Per section (like after an $alignabs() box)? Global value?

Posts seem to get lost quick in this thread.  Anyone got an idea on this?

I figured out the LINEHEIGHT thing. If I set it once after my $alignabs() tag, it works for all my lines.

Track Info Panel with ability to change font

Reply #841
Code: [Select]
$button2(0,20,0,0,25,25,$imageabs2(25,25,0,0,25,25,0,0,/images\gant\prev.png,),$imageabs2(25,25,0,0,25,25,0,0,/images\gant\prev.png,),previous,)


you're missing single quotes around the button text (eg. '$imageabs2(....')

Right now I have some buttons to rate the currently playing song, is there a way to get the panel to reload when i rate a song so the new rating buttons will show up?


how are you rating the songs? If it's through tags then it should it should update automatically. If its by some other means, then maybe not...

terrestrial:
I think that you're coding to load images from file path with Gdiplus::Bitmap(pchar) now, but is there a plan to use Gdiplus::Bitmap(IStream) constructor? Then if so we get possible to use interface of archive or etc via filesystem::g_open().


I'll look into it, but I don't think so with the way things are currently structured.

I read earlier in this thread that a command exists to set line spacing, but it hasn't been published yet.  Well, could you tell me what it is?  I'd like to set a global linespacing so I don't have to use the #LINEHEIGHT# command after every line to space things out a bit.  This would be for all text under my $alignabs() setting for the bounding box.

Also, can someone be more clear how the $pad(X,Y) command works?  I can't get it to do anything useful.  Is this a per line setting?  Per section (like after an $alignabs() box)? Global value?


Code: [Select]
$alignabs(0,0,100,200,top,left)#LINEHEIGHT,43#test$char(10)test$char(10)test


you don't have to use it after every line, but after every $alignabs(2) etc.

Track Info Panel with ability to change font

Reply #842
ok so this is what I am currently using

$imageabs2(150,150,,,,,$sub(%_width%,150),0,$replace(%path%,%directoryname%$char(92)%filename_ext%,Artist.*),NOKEEPASPECT)

I have artist.jpg in 1 folder down from the album folder - this works.

My next problem however is what happens when I have multiple cd's in each album - this would then make album the folder that should infact be the band folder. Appreciate any ideas.

eg
F:\music\genre\band\album

F:\music\genre\band\album\CD1

the artist image is in the band folder

Track Info Panel with ability to change font

Reply #843
If you have a predictable directory structure this isn't that hard to accomplish. Using your above example you can do something like this:
Code: [Select]
$imageabs2(150,150,,,,,$sub(%_width%,150),0,
$replace(%path%,
$if($strcmp($lower($left(%directoryname%,2)),cd),$directory(%path%,2)$char(92),)
%directoryname%$char(92)
%filename_ext%,Artist.*)
,NOKEEPASPECT)


* Read the file titleformat_help.html in your foobar directory for more information about basic functions.

Track Info Panel with ability to change font

Reply #844
Hello,

i want to make buttons that change their design according to the values of %cwb_volume%. As written in the wiki, i put the button into the //PerTrack section. On the first sight it looks ok, but when I change the volume with the volume slider, the design of the button doesn't change as long as the played track doesn't change. Now I thought I could move the button code to the //PerSecond section. But then the whole button isn't drawn at all.

Is there a way to have buttons that are updated every second? It is not only useful for volume but for many other things like the playback order for example.

Thanks in advance,
Radioactive Man

Track Info Panel with ability to change font

Reply #845
i was just wondering how you would code the trackinfo panel to scale the font size based on the amount of characters being displayed

Track Info Panel with ability to change font

Reply #846
If fb2k lays behind a window, and you try to activate fb2k window by clicking randomly in a trackinfo panel, fb2k becomes active, but are not sent to front.

Will this ever be fixed?
Can't wait for a HD-AAC encoder :P

Track Info Panel with ability to change font

Reply #847
Quote
i was just wondering how you would code the trackinfo panel to scale the font size based on the amount of characters being displayed


I'd like to know how to do this too.

Track Info Panel with ability to change font

Reply #848
This can probably be done by using a calculation for the size parameter of the font statement.

$font(<fontname>,$unknownformula(),<color>,<options>)

I tried playing around a bit applying $len() and %_width% but only had moderate success. Does anyone know how to convert pixel size to font point size? I searched and found some vague answers but nothing specific.

Track Info Panel with ability to change font

Reply #849
Code: [Select]
 
// Sets the offsets for the screensaver mode
// It will change the position of the info block with every new track

$puts(wide,1000)
$puts(xgap,$sub(%_width%,1000))$char(10)
$puts(ygap,$sub(%_height%,680))$char(10)
$puts(offsetx,$mod($add(%_length_seconds%,$len(%title%),$len(%artist%),$len(%artist%),$len(%performer%),%date%),$get(xgap)))
$char(10)
$puts(offsety,$mod($add(%_length_seconds%,$len(%title%),$len(%artist%),$len(%artist%),$len(%performer%)),$get(ygap)))


//Auto resizing text for title tag

$font(,36,,)
$alignabs($add(0,$get(offsetx)),$add(0,$get(offsety)),1000,160,center,middle)
$puts(txt2,$ifgreater($calcwidth(%title%),$mul(2,$get(wide)),
$ifgreater($calcwidth(%title%),$mul(3,$get(wide)),
$ifgreater($calcwidth(%title%),$mul(4,$get(wide)),
24,26),28),36))
$font(,$get(txt2),,)$if(%_isplaying%,$rgb(255,255,0)[%title%],[%title%])



I set up a big info display with many boxes for the various tags.
To mimic a screensaver, at the start of a new track I recalculate the origin point of all the display so to make the boxes move to a different point than before. You can get rid of that replacing the "offsetx" and "offsety" with static x and y points in the first line after the font 36 one.
The title info box can hold 2 lines of text.

Feel free to ask for other explanation.


If anybody is interested, I also have set up an auto-vertical-scrolling for another info box.

Is it known that the window of this plugin steals the focus from others windows over it?
(Not sure if the term "steals the focus" is correct but if I open the properties over it and then try to click on it to drag it nothing happens unless I can click it in an area that is not over the trackinfomod panel.)

Thanks.