[Solved] Theme Issue: Tooltip padding

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
EctoOne
Posts: 32
Joined: Sun Apr 18, 2021 6:18 pm

[Solved] Theme Issue: Tooltip padding

Post by EctoOne »

Hi,
I was working on a dark theme based on the classic theme but with round elements. And so far I'm quite happy with the result but there is one small detail that I can't figure out.

As shown in the attached images, when I try to set a padding to the tooltip, the border gets messed up. I've tried several values, but the one that I used in this case is the following:

Code: Select all

<drawdata id = 'tooltip_bg' cache = 'false'>
		<drawstep	func = 'roundedsq'
					radius = '5'
					padding = '-10,0,-10,0'
		/>
</drawdata>
Which already seems weird to me, because I thought that padding is: left, right, top, bottom. But here it is: left, top, right, bottom. And it is also weird that I had to use negative values, otherwise the text would move outside the box.

So, I don't know if this is intentional behavior, in which case I would appreciate any idea to fix it (Although, the tooltip isn't that important and I can just remove the padding). Or if this might be a bug.
Attachments
default.jpg
default.jpg (26.19 KiB) Viewed 2397 times
with-padding.jpg
with-padding.jpg (26.65 KiB) Viewed 2397 times
Last edited by EctoOne on Sun Sep 26, 2021 7:38 pm, edited 1 time in total.
User avatar
sev
ScummVM Lead
Posts: 2306
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Re: Theme Issue: Tooltip padding

Post by sev »

Negative paddings are not supported. This is not CSS. We never had a need to implement it.


Eugene
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: Theme Issue: Tooltip padding

Post by criezy »

EctoOne wrote: Wed Sep 22, 2021 5:09 am And it is also weird that I had to use negative values, otherwise the text would move outside the box.
I guess you mean that if you use a positive padding the text moves outside of the box?
The tooltips have a XPadding and YPadding attribute that control the padding for the text I think.
If you add a padding for the tooltip background you maybe also need to increase the padding for the text itself.
EctoOne
Posts: 32
Joined: Sun Apr 18, 2021 6:18 pm

Re: Theme Issue: Tooltip padding

Post by EctoOne »

sev wrote: Thu Sep 23, 2021 10:44 pm Negative paddings are not supported. This is not CSS. We never had a need to implement it.


Eugene
If it is not supported, then why do have negative values any effect?
criezy wrote: Fri Sep 24, 2021 10:49 am
EctoOne wrote: Wed Sep 22, 2021 5:09 am And it is also weird that I had to use negative values, otherwise the text would move outside the box.
I guess you mean that if you use a positive padding the text moves outside of the box?
The tooltips have a XPadding and YPadding attribute that control the padding for the text I think.
If you add a padding for the tooltip background you maybe also need to increase the padding for the text itself.
I guess that means I have to edit the layout.stx files? So far I have only edited the gfx.stx file.

Edit: I have just looked at the layout.stx file and I don't see any way of adding padding to the tooltip text.
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: Theme Issue: Tooltip padding

Post by criezy »

EctoOne wrote: Sun Sep 26, 2021 5:06 am I have just looked at the layout.stx file and I don't see any way of adding padding to the tooltip text.
Which ScummVM version are you writing the theme for?
In ScummVM 2.2.0 there was indeed no way to play with the text padding as it was hardcoded in the ScummVM source code. The padding was made configurable about 5 months ago, so this will only be available with the next release (that is due in a few weeks), or if you are using daily builds (or your own builds).
User avatar
Raziel
ScummVM Porter
Posts: 1541
Joined: Tue Oct 25, 2005 8:27 am
Location: a dying planet
Contact:

Re: Theme Issue: Tooltip padding

Post by Raziel »

Sorry for hijacking, but was .png support added as well?
The limit to .bmp images was putting me off trying my own theme...
EctoOne
Posts: 32
Joined: Sun Apr 18, 2021 6:18 pm

Re: Theme Issue: Tooltip padding

Post by EctoOne »

criezy wrote: Sun Sep 26, 2021 12:13 pm [Which ScummVM version are you writing the theme for?
I'm using a recent daily build. Probably at weekend ago, I downloaded the Raspberry Pi version and extracted the Classic Theme.
But maybe I couldn't find the correct tag because it is just not yet mentioned in the Wiki or used in the Classic Theme? Then, like I said, I used that as base and just changed some things.

Edit: Additional Question: Is there a way to specify a variable size? I just messed some more with the layout.stx files and changed the widgdt with the searchbar to be centered. But I noticed that when I switched the scaling to medium, it was of center. And I assume that happened because of the (increased) width. I think it is be better if I could set the size to like 45% instead of a fixed width.
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: Theme Issue: Tooltip padding

Post by criezy »

EctoOne wrote: Sun Sep 26, 2021 2:37 pm But maybe I couldn't find the correct tag because it is just not yet mentioned in the Wiki or used in the Classic Theme? Then, like I said, I used that as base and just changed some things.
As far as I know the information in the wiki is indeed outdated.
Two globals variables were introduced to deal with the tooltip text padding: "Tooltip.XPadding" and "Tooltip.YPadding". They have a default value of 2 and not all themes may indeed specify a custom value.

We also introduced a "scalable" attribute to indicate that on HiDPI screen, or when changing the GUI scaling, the value should be scaled accordingly. But the theme engine indeed has some limitations in how you can define the layout.
EctoOne
Posts: 32
Joined: Sun Apr 18, 2021 6:18 pm

Re: Theme Issue: Tooltip padding

Post by EctoOne »

criezy wrote: Sun Sep 26, 2021 4:53 pm Two globals variables were introduced to deal with the tooltip text padding: "Tooltip.XPadding" and "Tooltip.YPadding".
Awesome, I just added those and it works fine. Thanks for help.
I'll attach the theme if someone wants to give it a try. I couldn't really test it on a desktop version of ScummVM because I mostly use it on my Tablet. And personally I use a Grey colored version but I changed it back to green (not quite the original colors though).

Edit: Fixed upload
Attachments
classicreborn.zip
(25.29 KiB) Downloaded 97 times
EctoOne
Posts: 32
Joined: Sun Apr 18, 2021 6:18 pm

Re: [Solved] Theme Issue: Tooltip padding

Post by EctoOne »

OK, one more question.
Ist there a global variable for the engine a game uses?
I would like to add such row to the game edit screen below the language, system information.
I prefer to rename my games to [ENGINE] GAMENAME (DETAILS) and sometimes I have to look up the used engine. Having that information right there would be very useful.
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: [Solved] Theme Issue: Tooltip padding

Post by criezy »

This is not something you can do with a theme. You would need to modify the ScummVM source code to achieve this.

Also you may be interested in the work that was done recently to group the games in the game list:
https://github.com/scummvm/scummvm/pull/3135

This may remove your need to edit your game description to add the engine as prefix.
This work has not been merged yet, so this will not be included in the next release that is due very soon. But I expect it will be included in the release that follow.
EctoOne
Posts: 32
Joined: Sun Apr 18, 2021 6:18 pm

Re: [Solved] Theme Issue: Tooltip padding

Post by EctoOne »

I've seen the PR before and surely can't wait for but I'm still surprised that the used engine is not displayed anywhere in the GUI.
Well, according to the blog entry for the PR, it will be possible to group by engines. So I guess I just have to wait.
Post Reply