Skip to content

Releases: regorxxx/Menu-Framework-SMP

v2.6.0 - Easy checks method + Fixes

28 Nov 19:04
Compare
Choose a tag to compare

[2.6.0] - 2023-11-28

Added

  • New method .newCheckMenuLast(boolFunc),sShorthand for .newCheckMenu(menuName, entryTextA, void(0), boolFunc), where the entry is automatically retrieved from the last one added to the menu.

Changed

Removed

Fixed

  • "menuName.indexOf is not a function" error at newMenu() due to typo on variable type checks.
  • concat() not working properly with menu objects with sub-menus or menu checks.
  • btn_up(x, y, object, ....) not working properly with menu objects with sub-menus or menu checks.

v2.5.0 - Usability improvements

26 Sep 13:15
Compare
Choose a tag to compare

[2.5.0] - 2023-09-26

Added

  • New argument 'bLogEntries' on menu object creation which allows to enable/disable the logging of clicked menu entries.
  • New argument 'bInit'. Set to false to directly replace with a contextual/main menu obj.
  • New method retry() to call last entry with configurable arguments.
  • New method isSeparator() and isNotSeparator() to be used along newCheckMenu(), when checking the index of an array of options (so it filters the separators). Looks for properties named 'entryText' or 'name. For ex:
const options = [{name: 'My entry', val: true}, {name: 'sep'}, {name: 'My other entry', val: true}];
options.forEach(() => ...); // Create menu entries, etc.
menu.newCheckMenu(menuName, options[0].name, options[options.length - 1].name, () => {return options.filter(menu.isNotSeparator).findIndex((opt) => opt.val === val;});

Changed

  • Improved contextual menu for handle lists with a header at top (playlist name + # tracks).
  • Exposed getNextId() method, to retrieve invisible Ids.
  • Improved error reporting for check menus.

Removed

Fixed

v2.4.0 - Context and main menu managers support

08 Mar 17:46
Compare
Choose a tag to compare

[2.4.0] - 2023-03-08

Added

  • Support for contextual menus and main menus at newMenu(menuName, subMenuFrom, flags, context /{type, playlistIdx}/, main /{type}/) method, by setting the 'context' or 'main' arguments. Type may be either 'handlelist', 'playlist', or 'nowplaying' in the case of contextual menus; for main menus, type must be one of the following: 'file', 'view', 'edit', 'playback', 'library', 'help'. All ids are handled under the hood. Creating a contextual menu is as easier as:
// If no playlistIdx is given then it uses the active playlist
menu.newMenu('Items...', void(0), void(0), {type: 'handlelist', playlistIdx: plman.FindPlaylist(pls.nameId)});

Changed

Removed

Fixed

  • Objects not properly parsed at error logging.
  • Entry name not properly set -to the function name- when entryText was a function at addToMenu() method.

v2.3.0 - Helpers for invisible Ids

24 Feb 16:15
Compare
Choose a tag to compare

[2.3.0] - 2023-02-24

Added

  • New method getMenuNameFrom() which allows to partial match a submenu from a parent menu using the name minus the invisible ID (at the end). i.e hasMenu() would always fail if not providing the exact ID, but the former would work fine as long as the submenu and parent names are known.
  • New method findOrNewMenu() which can now be used along invisible IDs to create or retrieve a (sub)menu without need to check if the menu already exists. i.e. if the menu 'Genre' has a submenu called 'Edit' with invisible Ids, instead of storing the name + ID in a variable, findOrNewMenu('Edit', 'Genre') will either create that submenu or retrieve the existing one. It's obviously a shortcut to getMenuNameFrom() or newMenu() within a single line of code.

Changed

  • Code cleanup. Moved most helpers to private context.

Removed

Fixed

v2.2.0 - Allow duplicated menu names and other extras

28 Jan 09:36
Compare
Choose a tag to compare

Added

  • When trying to add multiple (sub)menus with same name (and different parent), an invisible ID may be added to allow it. '.newMenu()' will return the final name in such case. Set 'bAddInvisibleIds' on menu creation for this.
  • Added new argument to _attachedMenu() named 'popup' which may be used to avoid calling attached menu. It's expected to return true when calling popup.isEnabled() to do so.
  • Added 'onBtnUp' callback called after processing mouse btn_up. Respects the value of this inside the function, if any. It may be used to do something according to the processing of the menu.

v2.1.1

01 Oct 14:44
Compare
Choose a tag to compare

Changed

  • Reworked separator identification with regexp instead of string matching in all instances, case insensitive.
  • Separator entries passed to 'newCheckMenu' will be skipped; not requiring additional code anymore to split menu creation for standard entries and separators.
  • Improved error reporting.

Fixed

  • Crash on btn_up() when multiple submenus with same name where added using newMenu(). Now warns about it when calling newMenu() and aborts the addition to avoid later crashing.

v2.1.0

01 Oct 14:43
Compare
Choose a tag to compare

Added

  • iMaxTabLen: similar to 'iMaxEntryLen' menu can be initialized with a fixed entry text length for displaying purposes. This variable will cut anything found after '\t', usually used to display additional values or tips on menus. Menu entry names are now split by '\t' before applying iMaxMenuLen and iMaxTabLen max length to both parts. Default value is Infinity, i.e. it will use the full entry name. For ex: 'Allows only these tags on the pool...\tRock, Folk, Blues, Opera' -> 'Allows only these tags on the pool...\tRock, ...'
  • bindArgs: added new argument 'bindArgs' to .initMenu(object, bindArgs = null /{pos: -1, args: null}/). Works the same than the one at .btn_up(), but the former applies to conditional entries calling. Could be used to run specific conditional entries only on demand.

Changed

  • iMaxMenuLen: renamed to iMaxEntryLen. Default value is now Infinity, i.e. it will use the full entry name.
  • iMaxMenuLen and iMaxTabLen: string cutting now looks for ')', ']', '}' and ':' at the end of both strings to add it again after cutting. Previously it only did so for ':'. For ex: 'Allows only these tags on the pool...\t(Rock, Folk, Blues, Opera)' -> 'Allows only these tags on the pool...\t(Rock, ...)'
  • All entry and menu names passed as arguments to menu construction (newMenu, newEntry, newCheckMenu, newCondEntry) are converted automatically to strings whenever a number/array/object/boolean variable is used. In the case of being a function, it's evaluated just before menu tracking (addToMenu) -i.e. maintains the previous behavior-; the returned value is given the previous treatment, but if a function is returned, then its name (function.name) is used as entry name. Although it's recommended to only pass strings to the menus, this ensures passing arrays, lists or other output from functions which can be converted to string still create valid menu entries. Passing any other value type will throw an error and report the failed entry.

v2.0.1

23 Dec 19:02
Compare
Choose a tag to compare

Added

  • iMaxMenuLen: menu can be initialized with a fixed entry text length for displaying purposes. Entries will be cut to such length and added '...' to the end when they are cut. ':' is also maintained at the end when edited. For ex: 'Varied Styles/Genres mix, within a decade' - > 'Varied Styles/Genres mix, ...'. 'Check errors on current playlist:' - > 'Check errors on current...:'. Internal names preserve the original full length string, and that's what's used to call the menu entry or when reporting it to console.

Changed

  • hasMenu: allows a second argument pointing to its main menu (subMenuFrom). Leave it blank to look for the menu at any place. hasMenu(menuName, subMenuFrom = '')

Removed

Fixed

  • hasMenu: not working as expected, always returning false.

v2.0.0

14 Oct 16:44
Compare
Choose a tag to compare

Added some missing functions of native SMP menus (trackPopupMenu's flag), split creation in 2 steps (creation and mouse tracking), added menu simulation capabilities, ...

v1.2.2 - Minor update

07 Jun 18:13
Compare
Choose a tag to compare

Better compatibility with right tabbed text at menu entries. See changelog.