Where in the source code are filer windows implemented?
Jeffrey Lee (213) 6048 posts |
As long as it has a list of which items need redrawing, and a way to (approximately) work out what the item looks like (e.g. sprite used and any “effects” applied like inverted colours), then yes. The filer was already building a list of which items needed redrawing, the only bit I added was to make sure the list is sorted so that items with identical sprites & effects are drawn in sequence. If your items are complex objects (multiple sprites, or multiple font types/sizes) then things will be more complicated – e.g. if each item is a slabbed background with a sprite on top then for best performance you’d usually want to draw all the slabs first and then all the sprites on top. The aim being to achieve maximum efficiency for the different caches involved (CPU cache, any colour translation tables the Wimp might be caching, character data in the font cache, etc.). |
Michael Drake (88) 336 posts |
Could it have been the TreeView gadget? https://web.archive.org/web/20150222054936/http://squeakysoftware.org/gadgets.html |
Julie Stamp (8365) 474 posts |
Yay I found it :-) It doesn’t build though, but getting it working could just be a case of changing some includes. |
Charlotte Benton (8631) 168 posts |
What do you mean by Paint in this context? And isn’t Toolbox caught up in RISC OS 4 vs 5 awkwardness? |
Stuart Swales (1481) 351 posts |
Toolbox is being converged at present. |
Steve Pampling (1551) 8170 posts |
Apparently Mr Rawnsley took a turn at untangling things, so daggers are not drawn etc. |
Charlotte Benton (8631) 168 posts |
As for optimization, I think I’ll take a basic functionality first, polish it later approach. |
Julie Stamp (8365) 474 posts |
The window in !Paint that shows you the different sprites in a file is a filer-like view including mod-cons such as renaming and auto-scroll so might be of interest. |
Julie Stamp (8365) 474 posts |
I’ve had a quick go at getting the ResDisplay object to build. It now compiles, but I haven’t tried using it in an application. I put the necessary changes here. |
Charlotte Benton (8631) 168 posts |
Is this the right file? https://gitlab.riscosopen.org/RiscOS/Sources/Apps/Paint/-/blob/master/c/SprWindow |
Julie Stamp (8365) 474 posts |
and c.AltRename. The change log is interesting reading!
|
Charlotte Benton (8631) 168 posts |
The upcoming toolbox unification worries me somewhat. Is now a bad time for beginning a new infrastructure project? |
Steve Pampling (1551) 8170 posts |
There is never a good time. |
Steve Pampling (1551) 8170 posts |
Is it appropriate in assembly?
Well, various bits of it are clearer to me in its current form than they would be in C, but that’s my mental block in play. Even I can see that C is a better option. |
Steffen Huber (91) 1953 posts |
If done in the right way, you gain three things: maintainability, portability and reusability. E.g. you could easily provide common code that could power the Filer itself as well as a much-demanded Toolbox gadget providing a filer-like UI component. |
Steve Pampling (1551) 8170 posts |
As with all assembler, for ANY CPU, it is wonderfully opaque to anyone who doesn’t know that CPU. |
Rick Murray (539) 13840 posts |
I don’t. Why? Take your pick:
Buy contrast, Mr Pilling probably just did a recompile and fixed up a few small assembler helpers and it was job done for his stuff. That’s pretty much what I did for Ovation…and those programs of mine I’m still maintaining. So while I accept that C can be a real PITA to get your head around, there are clear benefits to it. Even Acorn saw the light, as RISC OS 2 was pretty much pure assembler for the entire OS. Then, little by little, things started being written in C instead.
The same way you do for code in any other programming language.
How do you define clean? I would point you at the Wimp for an example of something unclean. A number of files with the name “Wimp” and a numerical suffix. They seem to be broadly topic related, but you’ll find odd functions stuffed in here and there, and an absolute rats nest of conditionals (some with odd names like something to do with chocolate). As for maintainable, we’ve been over this numerous times. There’s no problem maintaining a 10K program written in assembler. There is a problem maintaining a 4MB operating system where half of it is assembler. |
Andy S (2979) 504 posts |
Charlotte, Is this the right file? You probably found out by now, but no, the sprite file windows are implemented, confusingly, in c.Main: https://gitlab.riscosopen.org/RiscOS/Sources/Apps/Paint/-/blob/master/c/Main The code’s mixed in with the main() function itself and a few other things. In an ideal world someone would refactor the file window stuff into a c.FileWindow but life’s too short. |
Charlotte Benton (8631) 168 posts |
The biggest problem with assembler is that you’re pretty much f****d if the ISA changes. Which happens to be fairly soon… |
Rick Murray (539) 13840 posts |
That’s probably because the running assembler binary is pretty much identical to the source, only without the labels and other named bits.
Even RISC OS, with its notoriously mediocre development tools has a debugger capable, when using debug builds, of throwing away the assembler completely and stepping (including single stepping) through the program as it exists in source form.
Debugging applications isn’t hard, just a bit tedious.
The easiest language I’ve ever debugged was Visual Basic 5. And that was something like twenty years ago. Things have improved. And over here? Dumping messages to a circular buffer and hoping I don’t stiff the machine before I’ve read the dump… Just lucky I grew up doing it the hard way, so this just seems normal rather than some medieval torture.
It appears (not looked too hard) that the code is organised fairly well. The problem is that it is devious as hell. I understand that a fair number of issues come from the use of words as being both pointers to things and holding flags about the thing. It might even use running status over SWI calls (in the old API, status was preserved) which would need to be spotted and handled.
I won’t hold my breath. ;-)
Two observations – firstly AArch64 is ARM. It’s not the type of ARM we know and love, but it is ARM. And secondly? RISC OS is whatever the rights holders say it is. If it gets ported to 64 bit and ROD are behind that transition, then it’s RISC OS, just like it’ll say when it goes “beep” at boot.
Uh huh. Okay… |
Charlotte Benton (8631) 168 posts |
But back to topic, what is the most accessible “gadget” to do the nitty-gritty of wrangling icons in a filer window like way? Is it the new !Paint stuff? And for that matter, is there any sort of guide to available gadgets, or is it sporadic? |
Andreas Skyman (8677) 170 posts |
Whether or not the future is C, this sounds really interesting! :) |
Andy S (2979) 504 posts |
Charlotte: But back to topic, what is the most accessible “gadget” to do the nitty-gritty of wrangling icons in a filer window like way? Is it the new !Paint stuff? The file icon code in Paint is fairly simple to read but it’s also fairly integrated with the data structures for the sprite files and mixed up with the other code, so as it stands it’s not really a gadget that can be lifted out to readily use elsewhere. That said, there’s nothing to stop someone extracting all the relevant functions into a new library and turning the sprite file linked lists into something more generic. Rick: [Impression is] also quite possibly the single largest application ever written in assembler, so there’s a lot of it to go through. This made me think of Braben’s Frontier: Elite II but Wikipedia says that was about 250,000 lines of assembler so I suppose that’s “only” around 1 megabyte! How big’s the code for Impression Publisher? It was always out of my league. |
Chris Johnson (125) 825 posts |
The actual RunImage file is a little over half a megabyte, but it does also use a lot of ‘helper’ modules, which would more than double that size. |
Alan Adams (2486) 1149 posts |
How on earth does anyone write 250,000 lines of anything, let alone assembler? The mind boggles! |