Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Port the help browser to GUI2 #3653

Open
wants to merge 45 commits into
base: master
from

Conversation

@CelticMinstrel
Copy link
Member

commented Oct 24, 2018

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.

CelticMinstrel and others added some commits Apr 10, 2017

Help Browser: Actually show the correct topics with the correct icons
This also fixes the lag when opening help and makes the topic text appear.
(The topic text is not parsed at the moment, though.)
Help Viewer: Parse help markup to Pango markup... mostly.
The help parser now outputs a config rather than a vector of strings of
which some should be taken literally and others parsed as WML.
Help Browser: Support arbitrary initial topic
Hidden topics still untested.
Help: removed code to show old GUI1 help browser
Attempting to launch it crashes the game (probably to do with a null video surface),
and since it's being replaced there's no point in restoring it to functionality.

The implementation details (help_menu, etc) have been left for now. Will remove soon.

This also means the GUI2 help browser is shown by default now.
Removed GUI1 Help interface code
Not needed anymore since we're moving to GUI2 for this dialog.
Removed a whole bunch of GUI1 stuff
This almost completely removes GUI1, save for the button widget (will remove once I get
all the Theme handling sorted out) and the editor's own GUI1 widgets.

This includes the GUI1 textbox, scrollbar, scrollarea, and menu widgets, as well as the
dialog_frame and dialog_manager classes. I've also removed floating_textbox. It was only
kept around for reference (it's unused as of the inclusion of the GUI2 command console).

gui::in_dialog has been replaced by GUI2's is_in_dialog directly now that we have no more
GUI1 dialogs.

\o/
Removed help_manager struct (it will be replaced)
This is in preparation for a larger refactor.
Help: explicitly sort Terrain sections
[ci skip]

This happened incidentally with the current help implementation, but that no longer happens
with my in-progress refactor. We still want these sections sorted, though.

The removal of the "sort_sections=generated" key from the Eras section is a forward-port of
6b20ccd from 1.14.

Vultraz added some commits Apr 2, 2018

Help: massive refactor and cleanup of the help backend
This basically splits all the stuff in help/help_impl.*pp into multiple files by their
function, and refactors the entire workflow into a proper object-oriented interface in
modern C++.

There are still a features missing (such as hidden section parsing in the manager) that
I'll get back to.

Few incidental changes and fixes:
* Terrain topics now sorted alphabetically.
* Help text now small
* Fixed wrong toggle button id in browser. This is what was making it impossible to expand
  any sections.

The GUI2 help browser is now back in working order, inasmuch as you can view all sections'
and topics' text (save units').
Help/Manager: don't need to keep a game config pointer anymore
I had removed the code that used it. We can just keep a help config pointer.
Help: removed useless 'is nonnull' debug info from terrain topics
is_nonnull() just means "is not "none" or void terrain".
Fixed crash when starting the editor (fixes #2816)
If no display_context was passed to the display ctor (such as is the case in the editor),
the terrain_builder's gamemap pointer would be null. Really not sure why this didn't cause
a crash n the 1.14 branch, but oh well.

I just removed the ctor call to rebuild_all() since it's not really needed. The map is
rebuilt when change_display_context is called anyway, which both the editor_controller and
play_controller do.
Help: fixed unit section such as the Walking Corpse's not generating
I didn't realize that is_valid_id was only meant to check IDs provided in the help config and
not IDs generated dynamically; the latter are always correct. Granted, the old code did actually
call its analogous codepath for race and era generation, but it did not for unit sections. My
refactor made it so this check happened *any* time a section was created, regardless of its source.

To rectify that, I moved ID validation for sections into the static section generation loop like
for topics. I also moved the topic id validation prior to the ToD generation, tweaked the invalid
id message, and renamed a variable for clarity and consistency.
Help Browser: don't generate nodes for hidden topics, updated link color
See 1903b05 for GUI2 label link color change. Really, this shouldn't be hardcoded here,
but I'll get to that.
@jostephd

This comment has been minimized.

Copy link
Member

commented Oct 24, 2018

Please check the three issues I reported previously https://forums.wesnoth.org/viewtopic.php?f=16&t=48837&start=30#p633859

next_player_number = gamestate_->next_player_number_;
assert(next_player_number <= 2 * static_cast<int>(gamestate().board_.teams().size()));
assert(next_player_number <= 2 * int(gamestate().board_.teams().size()));
{
const texture tex = item.image.find("~NO_TOD_SHIFT()") == std::string::npos
? image::get_texture(item.image) // TODO
: image::get_texture(item.image);

This comment has been minimized.

/** Thrown when the help manager fails to parse something. */
struct parse_error : public game::error
{
parse_error(const std::string& msg) : game::error(msg) {}
/** Thrown when trying to create a sub-section deeper than the max allowed depth. */
struct max_recursion_reached : public game::error
{
max_recursion_reached(const std::string& msg) : game::error(msg) {}
class unit_topic_generator : public topic_text_generator
{
public:
unit_topic_generator(const unit_type& t, std::string variation = "")

This comment has been minimized.

@CelticMinstrel

This comment has been minimized.

Copy link
Member Author

commented Oct 27, 2018

@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.

@jostephd

This comment has been minimized.

Copy link
Member

commented Oct 27, 2018

@CelticMinstrel Glad to hear it's been fixed. I look forward to seeing the new and improved help. :)

@sevu sevu added this to the 1.15.0 milestone Jan 6, 2019

@sevu sevu modified the milestones: 1.15.0, 1.16.0 Jun 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.