Module menu

Functions for interacting with the ML menu

Info:

  • Copyright: 2014
  • License: GPL
  • Author: Magic Lantern Team

Functions

new (definition) Creates a new menu item
set (menu, entry, value) Set the value of some existing ML menu entry
get (menu, entry) Get the value of some existing ML menu entry
block (enaabled) Block the ML menu from redrawing (if you wand to do custom drawing)
open () Open ML menu
close () Close ML menu

Fields

visible Get whether or not the ML menu is visible

Class menu

menu.value current value of the menu item
menu.name Name for the menu item
menu.help Help text for the menu item (line 1)
menu.help2 Help text for the menu item (line 2)
menu.advanced Advanced setting in submenus
menu.depends_on Dependencies for this menu item.
menu.edit_mode Editing mode for the menu item
menu.hidden Hidden from main menu
menu.icon_type The type of icon to use for this menu item
menu.jhidden Hidden from junkie menu
menu.max The maximum value the menu item can have
menu.min The minimum value the menu item can have
menu.selected Whether or not the menu is selected
menu.shidden Special hide, not toggleable by user
menu.starred Present in "my menu"
menu.submenu_height Submenu Height
menu.submenu_width Submenu Width
menu.unit The unit for the menu item's value
menu.works_best_in Suggested operating mode for this menu item
menu.run_in_separate_task Whether or not the backend should run 'select' in it's own task
menu:select (delta) Function called when menu is toggled
menu:update () Function called when menu is displayed.
menu:info () Function called when menu is displayed.
menu:rinfo () Function called when menu is displayed.
menu:warning () Function called when menu is displayed.
menu.choices List of strings to display as choices in the menu item
menu.submenu Table of more menu tables that define a submenu
menu:remove () Removes this menu entry


Functions

new (definition)
Creates a new menu item

Parameters:

Returns:

    a menu object

Usage:

    mymenu = menu.new
    {
        parent = "Scripts",
        name = "Lua Test Script",
        help = "Some help for this script",
        value = 1,
        submenu =
        {
            {
                name = "Run",
                help = "Run this script.",
                icon_type = ICON_TYPE.ACTION,
                update = "",
            },
            {
                name = "Parameter Example",
                help = "Help for Parameter Example",
                min = 0,
                max = 100,
                unit = UNIT.DEC,
                warning = function(this) if this.value == 5 then return "this value is not supported" end end,
            },
            {
                name = "Choices Example",
                choices = { "choice1", "choice2", "choice3" },
            }
        },
        update = function(this) return this.submenu["Choices Example"].value end,
    }
    
    mymenu.submenu["Run"].select = function()
        print("Parameter Example= "..mymenu.submenu["Parameter Example"].value)
        print("Choices Example= "..mymenu.submenu["Choices Example"].value)
    end
set (menu, entry, value)
Set the value of some existing ML menu entry

Parameters:

  • menu name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc)
  • entry name of the menu entry
  • value the value to set

Returns:

    whether or not the call was sucessful
get (menu, entry)
Get the value of some existing ML menu entry

Parameters:

  • menu name of the parent menu ('Audio', 'Expo', 'Overlay', 'Shoot', 'Movie', etc)
  • entry name of the menu entry

Returns:

    the value of the menu entry
block (enaabled)
Block the ML menu from redrawing (if you wand to do custom drawing)

Parameters:

  • enaabled bool
open ()
Open ML menu
close ()
Close ML menu

Fields

visible
Get whether or not the ML menu is visible
  • visible bool

Class menu

Represents a menu item
menu.value
current value of the menu item
menu.name
Name for the menu item
menu.help
Help text for the menu item (line 1)
menu.help2
Help text for the menu item (line 2)
menu.advanced
Advanced setting in submenus
  • advanced bool
menu.depends_on
Dependencies for this menu item. If the dependecies are not met, the item will be greyed out and a warning will appear at the bottom of the screen.
menu.edit_mode
Editing mode for the menu item
  • edit_mode int
menu.hidden
Hidden from main menu
  • hidden bool
menu.icon_type
The type of icon to use for this menu item
menu.jhidden
Hidden from junkie menu
  • jhidden bool
menu.max
The maximum value the menu item can have
  • max int
menu.min
The minimum value the menu item can have
  • min int
menu.selected
Whether or not the menu is selected
  • selected int
menu.shidden
Special hide, not toggleable by user
  • shidden bool
menu.starred
Present in "my menu"
  • starred bool
menu.submenu_height
Submenu Height
  • submenu_height int
menu.submenu_width
Submenu Width
  • submenu_width int
menu.unit
The unit for the menu item's value
menu.works_best_in
Suggested operating mode for this menu item
menu.run_in_separate_task
Whether or not the backend should run 'select' in it's own task
  • run_in_separate_task bool
menu:select (delta)
Function called when menu is toggled

Parameters:

  • delta int
menu:update ()
Function called when menu is displayed. Return a string to be displayed.

Returns:

    string
menu:info ()
Function called when menu is displayed. Return a string to be displayed in the info area (in green).

Returns:

    string
menu:rinfo ()
Function called when menu is displayed. Return a string to be displayed on the right side of the menu item

Returns:

    string
menu:warning ()
Function called when menu is displayed. Return a string when there is a warning (menu will be greyed out).

Returns:

    string
menu.choices
List of strings to display as choices in the menu item
menu.submenu
Table of more menu tables that define a submenu
menu:remove ()
Removes this menu entry
generated by LDoc 1.4.3 Last updated 2016-04-23 15:53:20