Skip to content

Add a API to add/remove items to the "Tools" menu

Rafał Mikrut requested to merge pr-issue-1429 into master

Created by: ghost

Make possible add and remove items to the "Tools" menu. The API is based on my initial proposal but i changed some things during the implementation:

  • I removed the has_plugin_menu_item(I don't added it since other functions don't have it's has_* counterpart).
  • All function were renamed to use *_tool_* instead of *_plugin_*, IMO this way it's clear that the functions are related to the "Tools" menu.
  • The int ID parameter of add_tool_menu_item was changed to Variant ud, used for the callback function.
  • The callback format now is callback(Variant ud), which made the code simpler and more flexible.
  • The name format for the items, were changed from "my_category/my_item"/"MyCategory/MyItem" to ANY string_Format/My Item Name where the first slice is the item category, this way the name parameter is friendlier to translation(e.g. "category/"+TTR("My Item Name") or vformat("categoty/%s", TTR("My Item Name"))).

Closes #1429 (closed).

Merge request reports