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

Enable category toggle in pickup selectors #58917

Merged
merged 3 commits into from Jul 8, 2022

Conversation

IndecisionTree
Copy link
Contributor

@IndecisionTree IndecisionTree commented Jul 2, 2022

Summary

Interface "Enable category toggling in pickup selectors"

Purpose of change

This change allows toggling between category view and hierarchy view in pickup menus.

Describe the solution

toggle_categorize_contained() now categorizes or uncategorizes all column entries by either adding or removing their custom category. To preserve invlets between the map and selection columns, prepare_layout() is called directly and the ui is invalidated, but not marked for resize, so that a redraw will occur but invlets will not be reassigned (mark_resize() would end up calling prepare_layout() in the resize callback, which would call reassign_custom_invlets() and that would remove the selection columns invlets). All selected entries will then be re-toggled with their new invlets after paging.

Describe alternatives you've considered

Somehow getting selection column entries to link to the other columns and then special-casing the selection column in layout code to avoid invlets being clobbered. This felt like a more extensive change which would require rewriting many things.

Testing

Tested with an inventory full of items, some containers, and gear ensuring that categories toggled properly and columns were in sync. Also tested other selection menus (multidrop and inventory) to ensure nothing broke.

Additional context

Thanks to @andrei8l for the code to get this started!

Demo:

pickup_toggle.mp4

@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jul 2, 2022
@dseguin dseguin merged commit e4a81da into CleverRaven:master Jul 8, 2022
@IndecisionTree IndecisionTree deleted the toggle-categorize-map branch July 8, 2022 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants