Text + Sprite icons
Martin Avison (27) 1418 posts |
If there is a text + sprite icon in a window (common ones are a Radio or Option icons) then there seems no way to avoid having a nasty coloured box behind the text. If the icon background colour is set to 1 (light grey) and the window background is also 1, then they both appear slightly mottled when textured window backgrounds is used. Which looks fine. However, if the window background is coloured, there seems no way to make the text backround transparent, so it looks nasty. Obviously you can make the icon background the same as the window background, but if the window background can vary this becomes a chore. You can also define the text separately, but then it is a chore to accept clicks on the text. I know that the *WimpVisualFlags command has options Is there any way to have a transparent text background in a text+sprite icon? Which probably raises the question of why is there a need for the VisualFlags IconBoxes options anyway? |
Rick Murray (539) 13405 posts |
It looks like the Wimp is wrong (cue Jeffrey to point out some subtlety that we’re missing…). The fun and games begin at line 1802 of Wimp04. There is a test to see if there’s to be no background with transparent windows ( A little further down, line 1869, we check the flags again – for the remove icon backgrounds ( I have a text icon with a background colour of red on a window of cyan and it plots with no background showing if I choose not to have the icon “filled”. If I take this same icon and set it to be a sprite+text icon (changing nothing else, no sprite name or anything), then I get a filled rectangle behind the part of the icon that is the text (note, only the text, not the entire icon). This seems to me like a bug. Why branch to 92 (and draw a rectangle) instead of branching to 02 (and not drawing anything)? Edit 1: Actually, it would need to branch to 91 to fix up the stack. At any rate, why draw a background rectangle when one isn’t wanted? Edit 2: I’ve done a binary hack to my ROM to branch to 91 instead of 92. Still seeing the backgrounds, so I wonder where this is actually happening? |
Martin Avison (27) 1418 posts |
Thanks Rick for investigating, and for confirming my suspicion that it looks like a bug. The sources are interesting … but not easy to follow with all the nested [..] sections for 3Dpatch, BlendedFonts, outlinefont, etc. as well as the branches for the Visual options. I do wonder if this ‘bug’ is what causes Nemo’s excellent ColourFiler modules to display nasty text backgrounds in coloured Filer windows? However, this ‘facility’ is what is used in group boxes to blank out the box line under the title, which is a text+sprite icon (with no sprite specified). That cannot be transparent (but I have long wished it could be done more automatically with a blank at the beginning and end of the text). |
Rick Murray (539) 13405 posts |
Probably not in his version of WindowManager. :-p
True. These days, apart from swapping (did that ever work? how did it work?), I just tend to assume that everything is enabled. The hard part, then, is spotting the ‘|’ that marks the “else do this” code that needs to be ignored.
Well, the configuration option is to not draw backgrounds behind text+sprite icons. So here’s the option, here’s a non-filled text+sprite icon, and here’s a background rectangle that won’t go away…
Why not? We are surely not asking for all text+sprite icons to be transparent. Only the ones that do not have the filled attribute (just like regular text icons). If we are to have the group name be filled to blank out the box, surely it’s better to set the filled attribute and not the sprite attribute? That just sounds really broken… Edit: Looked at my icons. I use a simple filled text icon (and size it to fit, with some whitespace either side because it looks naff otherwise). Paint and Chars use text+sprite. Presumably because the Style Guide says to do so (p112 virtual, 119 real). With this in mind, there’s no way that removing the text background is going to be possible without side effects. And I still think it’s a really broken way of doing things (it just screams “BODGE!” to me). :-/ |
Martin Avison (27) 1418 posts |
Because if you fill the icon, it obliterates the box for the full width of the icon. Currently, if it is unfilled, the box is covered only for the length of the text itself (if text+sprite). This means it adjusts for your current font, size, etc, and caters for cases where the text itself is variable (eg for when foreign translations are in force). [see new Style Guide p111/112] |
Rick Murray (539) 13405 posts |
Yes, I noted that further down my post; and commented that it sounds like a horrible bodge. Maybe we should have had a new indirection operator to do this instead of ruining the chance of using any text+sprite icon in any situation that is neither “background is colour 1” or “background is transparent”? Also, as you noted, while it is nice to have it resize as appropriate for the text, it doesn’t include any left/right borders so ends up looking cramped. While I’m whinging, let’s throw in for the hell of it:
I can’t speak for everybody else, but I’ve never created a multilingual program that didn’t come with a language-specific Templates file… |
Martin Avison (27) 1418 posts |
Well, I now maintain one! And it is a damn sight easier to get a plain list of messages translated than having to manually edit a Template file with 43 windows defined with about 1,100 icons! And I shudder to think of the problems of keeping the window definitions in step when they change. |