This is a quick update to let you folks know what I’m currently up to!
Calendar Mk2 work is still progressing with more automated tests being added all the time.
However, I decided to take a short break from the calendar work to enable me to deliver some much requested functionality: Folders!
Up until now the user had no real power of organisation in Sojour. They were reliant on the structure that’s provided in the Asset Browser.
The new code that’s being written changes this and will allow users to add their own folders so as to better organise their work:
To add a folder, all one need do is right click and select ‘Add Folder…’ to an existing folder or to one of the following nodes:
- Campaign Assets
- Characters
- Documents
- Journals
- Maps
- Tables
- Document Templates
This will result in the folder naming dialog appearing:
Once a name has been entered, your new folder will appear in the Asset Browser:
The folder system is coded to allow one to define folders within folders. You can go as deep as you need to go. The only limitation is that folders can only hold one type of data based on their parent node.
For example, if you create a number of folders under the Maps node, only maps can be stored in those folders. However, you can store as many maps as you want at whichever levels that you want!
I was on the home straight of delivering the folders functionality when I realised that Sojour had a bit of an architectural problem…
Whilst plumbing in the new menu items needed to support the folders system I realised that the display layer of Sojour had rather too much complex code in it. 6412 lines of code to be precise. (Eeek!)
This code encompasses a huge range of user functionality resulting in it being hard to figure out what’s where and how it all hangs together.
Architecturally, on the whole, Sojour is pretty good in that each subsystem such as Maps, Journals, Tables etc is confined to its own classes with no cross talk.
However, the large display layer kind of throws the spanner in the works with regard to architecture because it has to orchestrate many of these subsystems and user controls to do the users bidding – often resulting in some pretty complex code.
This complex code is made harder to understand simply because it is all in one place within the display layer.
I felt I needed a way to simplify the display layer in order to make it easier to find and understand what was going on within that layer.
To that end, I came up with the concept of an Action.
These Actions represent the actions of a user.
Actions would then be grouped into classes by originating subsystem. For example, all actions originating from a Journal would find themselves housed in a JournalActions class.
These actions classes would then coordinate all the UI changes and subsystem orchestrations in order to achieve what it is that the user wants. Such an architecture helps keep related functionality together and it encapsulates the really hard parts away from the display layer.
The result is that the display layer will have a much simpler and smaller code base.
For example, if you wanted to change the hit points of an NPC in the Journal, all the display layer would need to do is call JournalActions.UpdateNpcHitPoints – just one line of code and that’s it! This contrasts to the many hundreds of lines of code currently within the display layer for this specific functionality.
The other advantage of this architecture is that many UI elements can now cleanly invoke the same functionality without having to duplicate the code or understand how it works!
It’s a great architecture and I’m quite pleased with it. But, alas, it’s going to take a fair bit of time. I have already made a fair bit of progress but there is still a long way to go:
It turns out that the quick diversion from the Calendar Mk2 work for custom folders is going to end up being a not-so-quick one.
On the plus side, it will leave Sojour’s architecture in a much better place to accept changes and as a bonus you folks will get the much requested folders system!
That’s it for this update!
Have Fun!
RobP






