Total-RP / Total-RP-3

The best roleplaying add-on for World of Warcraft.
http://curse.totalrp.com
Apache License 2.0
33 stars 19 forks source link

Migrate to new menu system #900

Closed Meorawr closed 1 month ago

Meorawr commented 1 month ago

This lengthy and frankly under-commented mess of changes converts all of our dropdown and context menus in the core addon to use Blizzard's new menu system added in 11.0.

The changes largely mean that we now follow the new way of doing things and have completely excised the MSA dropdown library and LibDropDownExtension. For Classic compatibility, there's a lightweight backport of the new API that I've dubbed as "legacy" menus which maps the subset of the new concepts that we need back to UIDropDownMenu.

The new menu system will be used based upon the TRP3_USE_MODERN_MENUS global which is currently set to true if we detect one of the new templates added in 11.0 specific to menus. If it isn't set, then the legacy renderer kicks in and UIDropDownMenu will be used behind the scenes.

With this set of changes the TRP3_DropDownMenuTemplate template has been deprecated. All uses of it in the core addon are gone and the replacement TRP3_DropdownButtonTemplate is used instead.

As part of this change, Extended will need to fix up the position of all of its dropdowns, approximately nudging them by 13-16 units left or right based upon their current anchors. The reason for this is that the old dropdowns (based on UIDropDownMenuTemplate) had a lot of padding on those edges which isn't present with new menus.

Otherwise in terms of functionality - all menus seem to work fine without any casualties.

On the unit popups module, this has undergone more significant changes and has been intentionally disabled unless modern menus are available.

The reason here is that unlike the other menus where the differences between the two renderers are abstracted away, it's a bit harder to do that in the context of unit popups because it needs to append to existing menus and deal with the fact that there's a library in the way rather than simply talking straight to UIDropDownMenu. As that'd be a lot of effort we'll instead just disable it until the new menu API makes its way back to Classic. On the plus side however, the "Character Status" option on the players' own menu has been re-added now that we no longer need to deal with LibDropDownExtension.