[WIP] Port the help browser to GUI2
Reopening #994 as a new PR because GitHub won't let me actually reopen the old one.
This is a rebase which adds a bunch of commits from @Vultraz from the previous master branch. There were a bunch of conflicts, so these added commits may not be entirely what should be on this branch.
Please check the three issues I reported previously https://forums.wesnoth.org/viewtopic.php?f=16&t=48837&start=30#p633859
@jostephd – I haven't specifically checked this branch, but I think I recall Vultraz fixing at least the first and third of those issues. Not sure about the second.
I think this branch probably isn't ready for checking that yet – @Vultraz mentioned there are some display changes that probably should not have been included here, so someone (probably me) will at some point need to go over the commits more carefully to see if there's any that were included mistakenly, or any that need to be edited.
Quoting here since the linked post is limited to moderators:
Is the help refactor complete? I see three issues: double-clicking on the name of topic that a closed book icon next to it doesn't expand its children; clicking on a hyperlink does nothing; and the unit type pages are empty except for the title. All of these work in 1.14.
@CelticMinstrel Glad to hear it's been fixed. I look forward to seeing the new and improved help. :)
I think this should be postponed until 1.17.0. I've moved it to the "pre-1.16.0 string freeze" milestone, but think the freeze deadline for a task as large as "reformat the entire help text" has probably already gone.
This is also stalled pending #2687, so unless someone super-interested in it happens by, there's no chance of it being done by the end of the year.
This doesn't make the GUI2 help work, but at least it builds and runs. At the branch tip, the tree view nodes are broken and do not expand; that works somewhere in the middle, but I didn't bother to try and track down where it broke.
I deleted all the worthless refactoring and all the commits that delete the help markup parsing. In case there's something worthwhile mixed in, which there likely is, the previous version of this PR is available for the time being as the gui2_help_old branch.
Though I rebased and resolved the conflicts, I doubt it compiles as-is, so I've cancelled the workflow. I'll be making sure it compiles locally and then force-pushing again.
It looks like this now in a state where #9162 can be merged in and we can continue development right here on this branch.
I took a screenshot of the bluffs and gulch topic in the old and new help UI.
I think the new one still has room for improvement. Making it use a table has added excessive space between the image and the text. (This screenshot also demonstrates the ridiculous tiny text with pixel scaling bug.)
To summarize, I think the main issues remaining are as follows:
- [x] Tables have a lot of empty space in them. I think they're trying to fill the entire width of the window, perhaps? I think I'd prefer them to be more compact in most cases.
- [ ] There are a lot of wrapping issues. They become far more pronounced if you set pixel scaling to 3x. Some pages look completely broken.
- [ ] The text size somewhere is ignoring pixel scaling.
- [x] Nested tags aren't currently supported –
<b><i>test</i></b>will munch your text and display nothing. - [x] Left-aligned images permanently reserve their column (currently worked around by not using them and putting the image in a table, which doesn't always make sense).
Have I missed anything?
- [ ] Point 5 is caused by inline images followed by text alongside them are not properly implemented. They should work correctly whether the text alongside them is bigger or smaller or equal in height.
- [ ]
<br/>Doesn't work in all cases as it should. It's behavior should also be consistent with itself in various cases and with text linebreaks. Paragraph breaks might still need more checking. - [ ] Wrapping decides to break the text even if there is extra space available in that line.
- [x] Formatting and especially links break when padding is non-zero. (probably the padding not getting correctly added somewhere.)
- [x] Rich Label can't display scrollbars properly unless it is initialized with a big enough chunk of text. (Currently the license 😰️)
- [ ] Help Browser: Expanding sections in is very slow, especially with large eras with lots of unit types.
- [ ] Help Browser: (from sevu on Discord)
When browsing human unit pages in the help browser I stumbe occasionally about this – It is not the same help page, happens after a few ones:
Caught general 'St12out_of_range' exception: stoi
@CelticMinstrel You might notice a couple more issues if you enable the debug boxes around links. Otherwise you can't see whether the links are correctly positioned or not.
Some tree-view issues:
- [x] The topic list randomly scrolls to the top when you switch topics. Sometimes it does and sometimes it doesn't… it feels like it does it on every second or third click?
- [ ] The topic list can have a currently-selected item. This feels buggy. If I click on a topic and follow a link, I should be able to click the same topic again to go back. We should either get rid of the topic list selection (so it can't have a selected item at all), or keep it in sync with the actual visible topic (so following a link automatically selects the linked-to topic, or deselects every topic if the link pointed to a hidden topic).
Found some rich_label issues, @babaissarkar said to report them here.
- [ ] Setting width can result in text being squished. Possibly something is using
text_widthvswincorrectly. - [x] None of the rich_label definitions do anything since the canvas is dynamically generated
- [x] Likewise, the keys that are set (such as
text_font_size) don't do anything
- [x] FIxed
Steps to reproduce: Tutorial > Right click on unit > Description > misaligned portrait
Edit: Also happens with wolf pages. Reloading a couple of times fixes it with wolf pages.
The arrows in the upper right make no sense to me. There seems to be multiple issues, and I can't figure out how to break them up, so here's a sequence of strangeness...
- open help
- Gameplay
- Victory and Defeat
- At this point, you can use the arrows to go back and forth in your history
- return to gameplay
- Combat
- Notice the right arrow is active, which makes no sense
- click the right arrow and it deactivates
- Click the left arrow, which should be gameplay, right? That's the last page I was on. Nope, Victory and Defeat.
- It gets weirder as you go, particularly when the right arrow actually becomes active and lets you go "forward" to a previous page (but not one you've ever visited from this page). Sorry I can't describe it better than that, I have no clue what's happening.
EDIT: These are either known issues, or now fixed.
Why is TOD under terrain (is it a sibling w/o an icon?), and why is it separated from TOD schedule?
@white-haired-uncle thanks for the detailed report.
- the abilities being put in the next line is known.
- yes, the ToD Schedule page is missing icon. others are new errors though.
Note in the image how one line of text is cut severely short. Not including the "abilities issue" above, this is almost if not always associtiated with the bottom of an adjacent image, and most of the time occurs at the end of a paragraph.
- [x] Fixed (https://github.com/wesnoth/wesnoth/pull/9826)
Checking lua scripts... ok
ERROR: TYPE ERROR: expected string but found int (3)
Game error: TYPE ERROR: expected string but found int (3)
spartan$ echo $?
1
Select Units>Monsters>Fog Clearer from the treeview (it's not in the monsters list), or Mudcrawler from either the tv or the list.
Skeleton appears twice in the Undead treeview.
Skeleton appears before Skeleton Archer in the tv, but after Skeleton Rider in the unit list. See also Direwolf, Direwolf Rider.
In Gameplay and Units, you don't have to use the treeview, the main page lists all subpages. Once you get to Abilities, you must use the treeview
The nodes under Terrain are sorted alphabetically. Under its children (Cave for example), they are not sorted AFAICT.
It probably doesn't make sense to have three entries for each type of bridge (Terrain), for example. Necessary in the map editor, redundant and possibly confusing in Help.
20241001 18:15:35 error general: Mismatched parenthesis:
~RC(magenta
20241001 18:15:35 error general: Mismatched parenthesis:
RC(magenta
I don't know where this comes from. It doesn't seem to cause an error, just noticed it during an unrelated crash (I assume it was unrelated, the crash came about 10min later)...
Map and Scenario Editor > Editor Pallette
Game error: missing tag name
spartan$ echo $?
1
Encyclopedia>Calendar (why?) missing treeview icon?
didn't mean to shout, I guess gh takes my separators at more than face value
Misc things I found and saved as images, mostly the end of paragraph / bottom of adjacent image issue. Some have screenshots from before portrait issue was fixed -- I didn't update the pic, but if they are shown here the issue remains.
Thought about zipping these into a single attachment, but didn't.