Most important things to look at:
Lua-based GUI/HUD overview: viewtopic.php?p=382529#p382529
New UI API prototype: viewtopic.php?p=382974#p382974
Formspecs have gone through a lot of changes lately. What with proper coordinates, advanced element styling, fixing ancient bugs and limitations, and many other new features, using formspecs isn't even close to the same as it was just a few versions ago. As for me, I've been right in the middle of all of it (All I meant to do was to make real_coordinates[], but that's morphed into a lot more). This has been the work of multiple people, especially Rubenwardy, SmallJoker (Krock), Desour (DS-Minetest), Df458 (I don't know a forum username, if any), and myself, plus other contributors.
The purpose of this thread is to list of what has been done with formspecs, what is currently being worked on and discussed, and what the future looks like. It's important for users to know what is going on and why.
The Past
Organized in topical sections, here is a list of what has been done in recent history following my entry into formspec work as far as I can remember. This list is does not seek to give large descriptions; see each associated pull request for more information. Also, it is not comprehensive, but tell me if I forgot anything major.Styling
#8383: The original PR adding style[] and style_type[]
#9380: Multiple element styling with comma separation
#9718: Universal formspec style selector *
#8916: Original hovered button styling
#9090: Internal button refactoring with consistent styling of different button types
#9378: Styling state selection with :hovered and :pressed.
#9187: Proper StaticText styling
#9290: 9-slice button backgrounds
#9661: Content offset and padding for buttons
#9763 and #10203: Font styling
#8678: Box styling
New Elements and Features
#8680: hypertext[]
#9258 and #9411: animated_image[]
#8660: 9-slice backgrounds with background9[]
#8996: Extra bgcolor[] features
#9101: scroll_container[]
#8530: More options for scrollbar use with scrollbaroptions[]
#9353: Set initial element focus with set_focus[]
#9496: Allow indexed dropdown events
General Improvements
#8524: Improvement of the coordinate system with real_coordinates[]
#8740, #9121, and #9262: Real formspec elements with proper draw order and clipping
#9534: Non-interactive element clickthrough
#8652: Item image clipping
#8507: Scrollbar variable bar size
#8665: Text cursor for fields and textareas
#10144: Optimize formspec size to stay within screen
The Present
In this section, current PRs for improving Minetest will be listed as far as I know. Descriptions are given because these things are currently being worked on now, and discussions (preferably in the GitHub pull request) are encouraged. If you want some of these features, help out by testing and bugging the core devs :)Priority numbers for each feature are also given next to the PR number based on my opinion, mostly for the benefit of any core devs reading this topic (0 is highest priority, 4 is lowest). The idea is to get the more important PRs merged to pave the way for important newer ones as well as to get requested features merged.
Styling
#10259: Prio. 1 to allow selector combination
This PR allows for grouping elements together with a group[] element so that they can be styled together as a group like CSS classes. In addition, it allows naming elements that have no name in the element definition for named styling. Finally, it removes the cumbersome difference between style[] and style_type[] with a new selector.
#10291: Prio. 1 to unify buttons
This adds two new style state selectors: :focused to style the last interacted with element and :disabled to style an uninteractable element, made as such with set_disabled[]
#10265: Prio. 3, requested feature
This allows image[], animated_image[] and image_button[] fgimg properties to have a 9-slice image like background9[]
#10083: Prio. 3, requested feature
This gives the ability to style inventory list slot size and spacing with styling.
#9818: Prio. 1 to unify buttons One approval
This PR colorizes button bgimgs automatically based on the bgcolor property to better facilitate prepends.
New Elements and Features
#8679: Prio. 2, highly popular feature
This PR adds a new feature that allows highly advanced key and mouse events to allow advanced custom behaviour in formspecs.
#9755: Prio. 3, requested feature
Gives many textual elements horizontal and vertical text alignment as well as giving labels the ability to be sized for clipping and the aforementioned alignment
#10106: Prio. 1 to unify buttons
This gives buttons the ability to be toggleable similar to a checkbox and exposes the :checked state to style it.
#10261: Prio. 2, highly popular feature One approval
This relatively new PR makes a new element, mesh[], which allows displaying a 3D object in a formspec with optional rotation and mouse control.
#10262: Prio. 3, requested feature
This PR gives no_prepend[] the ability to remove specific elements from the prepend string so some will be kept but not others.
General Improvements
#10260: Prio. 1 for style scoping
This PR defines formspec syntax more strongly by giving a unified end[] element for all containers. In addition, it gives sized containers for better clipping and other future features.
#10095: Prio. 4, performance
This performance PR doesn't draw elements that are totally clipped; good for scroll containers.
#10222: Prio. 0, refactoring!
This PR has no user-facing features, but it cleans up part of the internal formspec code, mainly inventory lists.
The Future
Well, this is a lot already, but we aren't even close to done. This last section is my personal roadmap for formspecs in a somewhat haphazard format. This list is by no means in chronological order. What is done first is directly based on what current PRs get merged first (hopefully the priority 1 PRs as they are necessary prerequisites) and what I consider to be best to do before the others. So here it is:Styling
- Upon merging all the Prio. 1 to unify buttons PRs, then two things will happen:
- The button code will be refactored to remove useless code, to fix up the other code, and to bring the style up to date with Minetest's code guidelines. This isn't a problem for Irrlicht updates because a) Irrlicht isn't updating and b) the button code is already drastically changed from the original.
- Styling will be added to other elements (woo!), probably scrollbars first since we already have the code and then fields since they are important. This will necessitate a new selector to select individual parts of an element, like the CSS pseudo-element selectors. Refactoring of those elements' code will follow. Every other element will have styling added in turn.
- After #10260 (unified container end[] element) is merged, two things will happen:
- Styling and other customization elements will be scoped to the current container. In addition, element names/groups will have namespaces in the events if the elements are in a named container to prevent name bleeding.
- A child selector, i.e. CSS >, will be added
- Finally, after #10259 (groups and new style selectors) is merged, selector combination will be added for even more advanced styling.
- I am planning to make styling animations (like CSS transition). This is a later style issue to deal with.
- This last point is a bit frivolous, but I am planning (at some point) to make fancy effects like blurring and noise filters for boxes, but this is not nearly as important as other points.
- After points 1, 1a, and 2 under Styling have been completed, button containers (issue #9754) will be added.
- table[] and the closely-related textlist[] will be completely refactored. Currently, it has terrible code, documented features do not work, and other things work badly in general. A new element will likely be created to allow better usage, although the existing ones will be preserved for compatibility. This may use button containers for better styling and usage.
- Formspec coordinates are rather limiting, so I plan to add units like CSS em and a combination between % and vx, vy, vmin, and vmax. Secondly, I hope to add layouting containers like grids, sizers, and whatnot.
- At some point far in the future after much else is completed, I will probably add some more useful elements like spinboxes and editable dropdowns that many GUI libraries have.
After #10222 (inventory list refactoring) has been completed, more refactoring will be done. This is probably the most important point of all and is the highest priority of anything. The formspec code is garbage, and it needs fixing. This is the necessary prerequisite to getting many features that people have been wanting for so long. To name two specific things, dynamic formspec editing and a new syntax, but really for all complex features. This is, unfortunately, a lot of work with no immediate benefit for users, but it will pay off.
I won't go into detail in this forum post as it's all very technical internal stuff, but it mainly necessitates rewriting much of the existing code in GUIFormSpecMenu, especially the parsing code at first to allow migration to a new format, but later to add a proper layouting system and dynamic element creation/editing to allow dynamic formspecs. My specific roadmap for this can be read in this forum reply.