In the past months, I have been busy re-writing the widgets system.
Instead of a flat array of Widget structs, I have made a tree of widgets, based on the 'is contained in' relation.
The new widgets know their own minimal size from their contents, and their resize step size. Together with the tree, the new widgets can compute the minimal size of the window they are kept in, and how the window can be resized.
This means eg that switching to another language will cause all the windows to get resized, so the new strings fit again in the windows.
The new widgets are more OO, which means that extending widgets with your own custom behavior is now possible.
With respect to the actual implementation, there are 3 currently windows implemented as a demo against revision 13920, the airport picker window (to show nested widgets), the intro-screen window (has lots of spacing around the widgets), and the news-history window (has a scrollbar). Of the latter, the mouse-wheel doesn't work yet.
(due to attachment limit, see next post for the widget implementation)
Hierarchical widgets
Moderator: OpenTTD Developers
Hierarchical widgets
- Attachments
-
- airport_gui.patch
- (19.4 KiB) Downloaded 155 times
-
- intro_gui.patch
- (9.86 KiB) Downloaded 154 times
-
- news_gui.patch
- (5.92 KiB) Downloaded 157 times
Re: Hierarchical widgets
The widgets are defined in window_gui.h (in the widget_defs.patch), and implemented in widget.cpp (widget_impl.patch). Other (mostly window interfacing) are in the final other_changes.patch
I consider this a proof of concept.
I'd like to know what the devs think, and whether (and if yes, how/in what direction) to proceed.
PS There are Doxygen doc strings everywhere, an overview of available widgets is in the widget_impl.patch
I consider this a proof of concept.
I'd like to know what the devs think, and whether (and if yes, how/in what direction) to proceed.
PS There are Doxygen doc strings everywhere, an overview of available widgets is in the widget_impl.patch
- Attachments
-
- widget_defs.patch
- (29.68 KiB) Downloaded 189 times
-
- widget_implementation.patch
- (79.47 KiB) Downloaded 199 times
-
- other_changes.patch
- (17.98 KiB) Downloaded 150 times
Re: Hierarchical widgets
For those of you that expected pictures, the differences are very small, some widgets just moved a few pixels, really not worth putting a picture up.
Re: Hierarchical widgets
Without having read your patch, I suppose you have made quite a decent change to the widgets and widgets definition. Have you been in touch with the devs to get their thoughts on your idea? (easiest way to get in touch with the devs for discussion is on #openttd at irc.oftc.net)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Hierarchical widgets
Zuu:
I am regularly at IRC, and have shown the intro-screen gui code there to several devs, so they know.
There is also FS1905 where I have been throwing windowing system code changes in, where most have been put into trunk already.
With respect to these changes, I haven't yet had a reaction, but they seem pretty much busy with convincing trains to share track with each other, and teach cargo about where it wants to go to, so I will wait a while longer before I ask.
In addition, starting this week, I went back to work so I have no time any way outside the weekend.
None the less, thank you for pointing it out.
Albert
I am regularly at IRC, and have shown the intro-screen gui code there to several devs, so they know.
There is also FS1905 where I have been throwing windowing system code changes in, where most have been put into trunk already.
With respect to these changes, I haven't yet had a reaction, but they seem pretty much busy with convincing trains to share track with each other, and teach cargo about where it wants to go to, so I will wait a while longer before I ask.
In addition, starting this week, I went back to work so I have no time any way outside the weekend.
None the less, thank you for pointing it out.
Albert
Who is online
Users browsing this forum: No registered users and 8 guests