Best way to do complex layout?
Pages: 1 2
Alan Adams (2486) 1149 posts |
I think that was Steffan. One reason I’ve never tried plotting text directly comes with step 1. You have a paragraph of text. You want to use an outline font. How do you work out how much of that paragraph fits on the first line? Add in unicode. Or on the next one? After I’d read the relevent section of the PRM until my eyes watered, I gave up. |
Rick Murray (539) 13851 posts |
…who was quoting David. ;-)
Work out how wide the line is, and then call Font_ScanString using space as the split character.
Depends how much Unicode. If basic western European languages, then just construct a valid UTF-8 string, open a /utf8 font handle, and call ScanString as before.
Yeah, that bit of the PRM really could have done with some examples. |
Alan Adams (2486) 1149 posts |
Like rather a lot of it. Talking of PRMs, have you compared the PRM “Window Manager” printed version’s description of Wimp_PlotIcon with that under “documentation” on this website? The website has no mention of R2, which switches around the behaviour using a choice of magic words. I’ve started using both sources recently, because they tend to differ, and sometimes combining both gives a better picture. |
Steffen Huber (91) 1953 posts |
I recommend to add the StrongHelp manuals as an information source to offer a third opinion. |
Steve Pampling (1551) 8172 posts |
You can edit the wiki where it is out of phase with the implementation |
Steve Fryatt (216) 2105 posts |
Before you go editing the Wiki, are you sure that “our” version of Wimp_PlotIcon looks for “TASK” or “KSAT” in R2 on entry? Remember there are now two versions of the Wimp, which are incompatible in numerous interesting and exciting ways. I’ve not checked, but it’s quite possible that the two different behaviours you refer to are “RISC OS Select Only”. |
Alan Adams (2486) 1149 posts |
I’m not sure. However the book that documents them is published and sold by ROOL, which makes me think it’s RO5 territory. Going back to our earlier discussion about layout, icon copying vs plotting: I’ve made use of your technique of orphaning some icons from a template, and use the data there in a re-written icon copy routine. The result is something a lot more understandable than the old code, and without the subtle bugs that resulted in icons sharing the wrong buffers. What made it simpler is that I can now copy the icons in an order that results in logical icon numbers. Previously the icon numbers were fixed by the order in the template file, for the first row, then in some other order in the copies. Working from a copy of the orphaned icons, I now create the first row as well, and in fact create each column of icons in turn, rather than in rows, which is only possible because I can pick the original icons in any order, not the fixed order I had before. So thanks for your suggestion. |
Steve Fryatt (216) 2105 posts |
Which book is that? The one I’m looking at, the Programmers[sic] Reference Manual – The Window Manager, was published by RISCOS Ltd in 2007 and documents the changes that led up to Adjust. |
Alan Adams (2486) 1149 posts |
I see what you mean. That’s the one I’m using, and I’m fairly sure I bought it from the ROOL stand at a show. Hence thinking it was a ROOL publication. Looking at the test code I tried, it would be the same for either version of the magic word, so I can’t tell from that. I’m wondering now whether my attempts a couple of years ago to use the nested window manager weren’t successful because of using this book. It’s just a shame if so, as it’s much ore convenient using the one book rather than PRM volume 3, plus 5A plus the separate index. |
Pages: 1 2