Where in the source code are filer windows implemented?
Charlotte Benton (8631) 168 posts |
(I think the title says it all.) |
Julie Stamp (8365) 474 posts |
It’s all here. There’s a lot of it! Were you looking for something particular? |
Charlotte Benton (8631) 168 posts |
Thanks
Not really. I’m mainly (at least at this stage) curious as to how it works. Furthermore, am I correct in thinking that it performs file operations by issuing star commands, or are things more complicated than that? |
Julie Stamp (8365) 474 posts |
You’re partly right: back when the operations were single-tasking it would issue star commands. But now that they are multi-tasking, it is more complicated than that. The operation gets sent to the Filer_Action module using a SWI instead. Here’s the code for doing a delete. Filer_Action itself uses the SWI’s OS_File and OS_FSControl, rather than star commands. That all happens in this file. |
Stuart Swales (1481) 351 posts |
I think I wrote the original Filer operations using star commands rather than SWI OS_FSControl so that someone (third party dev/a user) could implement a better *Copy etc. if they wished. |
Charlotte Benton (8631) 168 posts |
So am I right in thinking that: The stuff in /RiscOS/Sources/Desktop/Filer/ implements the filer windows. These pass anything that needs doing to the Filer_Action module implemented by RiscOS/Sources/Desktop/FilerAct/, which generates progress windows (e.g. i.e. stuff like the copying progress window) and performs said actions? And a couple more questions: Do all changes to the file system made by Filer go through FilerAct, or does it do some stuff directly? And is there any interaction with the file system that doesn’t go through OS_File or OS_FSControl? As to the implementation, I notice that Filer is written in Assembler and FilerAct is written in C. Is this the state Acorn left it in, or has the latter been ported since? |
Steve Pampling (1551) 8170 posts |
and some of the desktop shortcut keys. Filer code is a participant in the WIMP spaghetti |
Charlotte Benton (8631) 168 posts |
Don’t those just call said code? Or are things so bad that the filer windows rely on the implementation of the shortcut keys? |
Steve Pampling (1551) 8170 posts |
The shortcuts sometimes rely on menu code, sometimes their own thing. I can say that if you start looking deeply into the various elements of the WIMP spaghetti, you may find reality slipping away. |
Julie Stamp (8365) 474 posts |
I don’t know if there are any more, but I found directory creation at least is done directly.
Reading directory contents uses OS_GBPB. If you drag from a save box into a filer window, it is up to the saving application how it does it; it could use the whole suite of FS SWI’s, or do something else entirely.
It looks like it has always been in C. One less for us to worry about :-) |
David J. Ruck (33) 1635 posts |
Even Acorn saw the light eventually. |
Stuart Swales (1481) 351 posts |
Admittedly a little more might have been written in C back in the day had ROM-able PIC code generation been available in 1986/7. |
Charlotte Benton (8631) 168 posts |
And another question: Are there any projects (in progress) to write a new version in C, analogous to Pinboard 2? |
Julie Stamp (8365) 474 posts |
(I think Steffen said he did a Filer view in Ada as well.) |
Charlotte Benton (8631) 168 posts |
So in essence, redoing the filer GUI1 in C wouldn’t be pointlessly reinventing the wheel? 1 I have no interest in the Lovecraftian horror that is file system itself. |
Andreas Skyman (8677) 170 posts |
Could this be it? http://source.riscpkg.org/svnweb/Filer-Free/browse/trunk/filer |
Jeffrey Lee (213) 6048 posts |
There’s an implementation detail which we should probably make sure any rewrite of the filer retains – the optimised item redraw order. This had a noticeable impact on the redraw speed on older machines (around 10-20% improvement – there’s some before and after stats, but they aren’t exact since there were some other optimisations made at the same time). Other than that I’m not aware of anything particularly noteworthy about the current sources. Have fun! |
Rick Murray (539) 13840 posts |
Wait ’til you see the keyboard handling. |
Steffen Huber (91) 1953 posts |
CDBurn and CDVDBurn use a “pseudo filer” for its drag&drop ISO image creation. It mimics the filer really closely, but does not support the post-RO3.7 features like Alt-Click to rename. I don’t have any free time at the moment, and the code is really ugly, but I could extract it and put it somewhere as an example of all the finer details of the filer visualization (and especially the selection-drag stuff) you can possibly get wrong. |
Charlotte Benton (8631) 168 posts |
Another question: Is there a distinct “put icon corresponding to a particular device on the icon bar” command, or is doing that part of the desktop spaghetti? |
Jeffrey Lee (213) 6048 posts |
That’s where things start to get a bit messy. The filesystem icon bar icons (& associated menus) are handled by the assorted “…Filer” modules. There’s an old thread that discusses the possibility of replacing the many (ROM-based) filer modules with just a single one: https://www.riscosopen.org/forum/forums/2/topics/815 |
Julie Stamp (8365) 474 posts |
ADFSFiler, SCSIFiler and SDFSFiler are all conditionally compiled from the same source code. I’ve thought about using Toolbox for the XXXFilers, but it doesn’t let you reload your messages file after you’ve started which the current Filers do so that might be a problem. Also all the existing internationalisation is in messages files, and Toolbox does it in res files instead so it might be awkward to do1. If Toolbox could be used though, it would cut down on some coding. I should also say in response to the idea of all-filer-icons-in-one, I like the idea, and have thought about how it might work, but really there is a lot of code that is not in common between them – see CDFSFiler for instance. One way (depending on being able to use Toolbox) might be to still have separate modules, and separate wimp tasks, but implement a generic filer icon as a Toolbox object. You’d then make MiscOp calls to that object to add any custom bits and bobs, e.g. please add a menu from my RES file as a submenu. The object can be configured in the usual way to either do a default action (e.g. left click opens whatever dir) or deliver custom event code. re. The Filer, if it is possible to write it so that the directory view code can be used by other applications, that would be splendid. 1 These problems apply to all the module tasks (Display manager, switcher…) though, so it would be worthwhile to do something here e.g. add a call to Toolbox. |
Charlotte Benton (8631) 168 posts |
By “directory view code” do you mean producing a graphical representation of what’s in a directory? |
Julie Stamp (8365) 474 posts |
More or less – a lot of the filer is generic (i.e. you could show something other than the contents of a directory), and so was the Toolbox gadget I mentioned above (anybody know where it is??). Whether it’s possible to do this with Jeffrey’s optimised algorithm in place I don’t know. Things that could be included in a generic viewer gadget
|
Julie Stamp (8365) 474 posts |
As long as existing code (Paint/CDBurn/Toolbox gadget/…) is used where possible. I started writing a module viewer as an exercise last year which also does a fairly accurate filer-like display as far as it goes, with a view to turning it into a Toolbox gadget, but then I found the existing one and other jobs took priority so I haven’t done anything with it since then. |