adventuregamestudio / ags

AGS editor and engine source code
Other
708 stars 159 forks source link

Editor: add support for sub items in file menu and move global messages upgrade actions to submenu #2464

Closed ericoporto closed 4 months ago

ericoporto commented 4 months ago

This is the minimal amount of code I could think that give support to submenus. The other approach would be to make the property read-only and then make so you can only pass such list in Constructor - which would make it more similar to the other properties.

I noticed the following todo:

// TODO: I do not see any way to schedule sub-menus in this system!?
// but if it's supported, maybe put these 2 global messages commands int a submenu

Decided to try to fix it. Not sure on the name of the group as "Global Messages upgrade".

image

ivan-mogilko commented 4 months ago

I propose to name it simply "Global Messages", and move to the bottom of the separated group (after "Restore all sprites"), as it's the least useful of these.

ericoporto commented 4 months ago

Redid as following

image

If at some point in the future new actions post old-game import appear, we could rename this menu to something like "Legacy Project Post-Upgrade Actions" or some short version of it.

ivan-mogilko commented 4 months ago

I confirm that submenu works as expected, but I think this system may be expanded to allow nested submenus (submenus in submenus), if you pick out menu item registration / addition into helper function(s) that is called recursively over SubCommands.

ericoporto commented 4 months ago

I am not 100% sure, but I think I figured how to support it recursively to register the submenus. I am not completely sure because there are a few dictionaries in things like AddMenuCommandGroup and RemoveMenuCommandGroup I am not completely sure how it's supposed to work.

ivan-mogilko commented 4 months ago

I think it's working right.

I am not completely sure because there are a few dictionaries in things like AddMenuCommandGroup and RemoveMenuCommandGroup

I quickly checked that out, and these dictionaries store MenuCommands objects in a list mapped to a key "menu name". All the items and submenus are stored internally inside MenuCommands, so should not affect these dicts.