Closed gcasa closed 1 year ago
@gcasa any progress on this front? I was considering starting an implementation of the engine. My plan was to begin with a simple class to solve the equations for a given set of layout constraints, I would begin with the simplest cases and build up from there. If this was successful I would look at integrating it into the event loop.
@BennyKJohnson Hey. I haven't gotten around to it as of yet. Feel free to start an implementation! I really don't know where to begin.
@gcasa I wanted to provide an update on this. AutoLayout uses an algorithm called Cassowary. There are a number of existing library implementations, I chose Kiwi and I have written an auto layout engine that bridges NSLayoutConstraint to it. I have a number of test cases that are passing but I still have some outstanding work to do in order to support all auto layout functionality. Also I haven't looked at integrating it into the view pipeline yet because I wanted to ensure I could get the correct calculations for the constraints first.
I will aim to push my work on the engine class soon.
Hey @BennyKJohnson. This is very awesome! I'm wondering if we have a copyright assignment/disclaimer from you. If not would you mind signing one? Please write me at greg.casamento@gmail.com so I have your email.
The email you need to ping at the FSF is assign@gnu.org. You need to tell them you need a copyright assignment for the gnustep project. Thanks again! I am really looking forward to taking a look at your code! :) @fredkiefer
@BennyKJohnson I hope this didn't scare you away. I haven't seen any activity since my last comment.
@gcasa Sorry for the late response. Life got in the way and it took me a bit longer than I expected to push my work. Here is the repo with my implementation https://github.com/BennyKJohnson/GSAutoLayoutEngine.
There are a couple of issues to my work:
Next steps will be to try to compile it with GNUstep and integrate it into the view loop.
I will try to complete the copyright assignment for you. In the meantime my implementation is unlicensed so feel free to copy it outright.
Here's an update on my progress since my last update:
With this work complete, I now finally have a working end to end demo. My demo is not super interesting, on the surface its just a view that is pinned to the top right corner of the window view however it is setup using only public auto layout methods and the layout is calculated across 3 views (root window view, window content view, color view) with each view containing 4 constraints. If you wish to give it a go you'll need to install my fork of libsgui and download the test project.
Whats left:
Awesome progress!!! Keep me informed! I would be happy to take a look once you're done. @fredkiefer is the authority with respect to code accepted in gui but I will give any feedback I have.
Should this issue be closed, I thought this functionality was merged.
Hello @gcasa, sorry for the radio silence, only the VFL parser was merged. I've got a near complete working implementation for Autolayout. The only remaining part I'm working on is the debugging functionality, but these functions are not essential and can be added in the future. One of the main problems I have is I don't know what the best way to proceed with a PR. There are various pieces of functionality like view/layout hook functionality, the auto layout engine and the cassowary engine. In total it would be several thousand lines of code. My preferred approach would be to submit the functionality from bottom to top. This would however mean that the code won't be functional until everything is merged but would still compile. I would like to hear your thoughts.
My work can be found here https://github.com/BennyKJohnson/CassowaryKit and https://github.com/BennyKJohnson/libs-gui/tree/autolayout-engine-cassowary
@gcasa @fredkiefer I have completed the implementation of all the auto layout APIs including debugging, and I am now ready to initiate the Pull Request process. However, the amount of work is significant, making it unrealistic to submit it in a single PR. I think it would be more efficient to submit it incrementally, so I'll be submitting pieces of work until everything has been submitted. This will mean that there will be source code that won't be contributing functionality until the whole work is submitted. I hope this approach is okay with you all, let me know otherwise.
@BennyKJohnson reassigned this to you since you're the one working on it. :)
Merged code.
Need to figure out how to apply the constraints which are decoded.