Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
deluge::gui::menu_item::Submenu Class Reference
Inheritance diagram for deluge::gui::menu_item::Submenu:
Collaboration diagram for deluge::gui::menu_item::Submenu:

Public Types

enum  RenderingStyle { VERTICAL , HORIZONTAL }
 

Public Member Functions

 Submenu (l10n::String newName, std::initializer_list< MenuItem * > newItems)
 
 Submenu (l10n::String newName, std::span< MenuItem * > newItems)
 
 Submenu (l10n::String newName, l10n::String title, std::initializer_list< MenuItem * > newItems)
 
 Submenu (l10n::String newName, l10n::String title, std::span< MenuItem * > newItems)
 
void beginSession (MenuItem *navigatedBackwardFrom=nullptr) override
 Begin an editing session with this menu item.
 
void updateDisplay ()
 
void selectEncoderAction (int32_t offset) final
 Handle select encoder movement.
 
MenuItemselectButtonPress () final
 Handle a select button press.
 
ActionResult buttonAction (deluge::hid::Button b, bool on, bool inCardRoutine) final
 Handle an arbitrary button.
 
void readValueAgain () final
 Re-read the value from the system and redraw the display to match.
 
void unlearnAction () final
 Unlearn the parameter controlled by this menu.
 
bool usesAffectEntire () override
 Claim support for Kit AFFECT_ENTIRE editing.
 
bool allowsLearnMode () final
 Used by SoundEditor to determine if the current menu item can accept MIDI learning.
 
void learnKnob (MIDICable *cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel) final
 
void learnProgramChange (MIDICable &cable, int32_t channel, int32_t programNumber) override
 
bool learnNoteOn (MIDICable &cable, int32_t channel, int32_t noteCode) final
 Attempt to bind this menu item to a note code.
 
void drawPixelsForOled () override
 Paints the pixels below the standard title block.
 
void drawSubmenuItemsForOled (std::span< MenuItem * > options, const int32_t selectedOption)
 
bool wrapAround ()
 Indicates if the menu-like object should wrap-around. Destined to be virtualized. At the moment implements the legacy behaviour of wrapping on 7seg but not on OLED.
 
bool isSubmenu () override
 
virtual bool focusChild (const MenuItem *child)
 
virtual bool supportsHorizontalRendering ()
 Submenus which support horizontal rendering need to override this.
 
RenderingStyle renderingStyle ()
 
void updatePadLights () override
 
MenuItempatchingSourceShortcutPress (PatchSource s, bool previousPressStillActive=false) override
 Action to take when a source shortcut is pressed.
 
deluge::modulation::params::Kind getParamKind () override
 
uint32_t getParamIndex () override
 
- Public Member Functions inherited from MenuItem
 MenuItem (deluge::l10n::String newName, deluge::l10n::String newTitle=deluge::l10n::String::EMPTY_STRING)
 
 MenuItem (const MenuItem &other)=delete
 
 MenuItem (const MenuItem &&other)=delete
 
MenuItemoperator= (const MenuItem &other)=delete
 
MenuItemoperator= (const MenuItem &&other)=delete
 
virtual void horizontalEncoderAction (int32_t offset)
 Handle horizontal encoder movement.
 
virtual void verticalEncoderAction (int32_t offset)
 Handle vertical encoder movement.
 
virtual bool selectEncoderActionEditsInstrument ()
 Used by the sound editor to mark the current instrument as edited when the select encoder is scrolled.
 
virtual ActionResult timerCallback ()
 Handle a TimerName::UI_SPECIFIC event.
 
virtual MenuPermission checkPermissionToBeginSession (ModControllableAudio *modControllable, int32_t whichThing, MultiRange **currentRange)
 Double-check that this MenuItem will work with the currently selected sound range.
 
virtual void readCurrentValue ()
 Like readValueAgain, but does not redraw.
 
virtual uint8_t getIndexOfPatchedParamToBlink ()
 
virtual uint8_t shouldBlinkPatchingSourceShortcut (PatchSource s, uint8_t *colour)
 
virtual void learnCC (MIDICable &cable, int32_t channel, int32_t ccNumber, int32_t value)
 
virtual bool shouldBlinkLearnLed ()
 
virtual bool isRangeDependent ()
 Returns true if this parameter is only relevant to some note ranges.
 
virtual void renderOLED ()
 Root rendering routine for OLED.
 
virtual std::string_view getTitle () const
 Get the title to be used when rendering on OLED, both as a deluge::gui::menu_item::Submenu and when displaying ourselves (using the default renderOLED implementation).
 
virtual uint8_t shouldDrawDotOnName ()
 Get the "draw dot state".
 
virtual void drawName ()
 Draw the name we want to use when selecting this in a deluge::gui::menu_item::Submenu to the 7SEG.
 
virtual std::string_view getName () const
 Get the actual name for use on OLED for deluge::gui::menu_item::Submenu s.
 
virtual void getColumnLabel (StringBuf &label)
 Get the name for use on horizontal menus.
 
virtual bool isRelevant (ModControllableAudio *modControllable, int32_t whichThing)
 Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
 
virtual bool shouldEnterSubmenu ()
 Check if selecting this menu item (with select encoder) should enter a submenu.
 
virtual int32_t getSubmenuItemTypeRenderLength ()
 Handle rendering of submenu item types.
 
virtual int32_t getSubmenuItemTypeRenderIconStart ()
 
virtual void renderSubmenuItemTypeForOled (int32_t yPixel)
 
virtual void renderInHorizontalMenu (int32_t startX, int32_t width, int32_t startY, int32_t height)
 
virtual void setupNumberEditor ()
 
virtual void updateAutomationViewParameter ()
 
void renderColumnLabel (int32_t startX, int32_t width, int32_t startY)
 

Protected Member Functions

void drawVerticalMenu ()
 
void drawHorizontalMenu ()
 

Private Member Functions

bool shouldForwardButtons ()
 

Private Attributes

deluge::vector< MenuItem * > items
 
decltype(items) ::iterator current_item_
 

Additional Inherited Members

static void drawItemsForOled (std::span< std::string_view > options, int32_t selectedOption, int32_t offset=0)
 Internal helper which can draw the standard deluge::gui::menu_item::Submenu layout.
 
deluge::l10n::String title
 Can get overridden by getTitle(). Actual max num chars for OLED display is 14.
 
const deluge::l10n::String name
 Default name for use on OLED for deluge::gui::menu_item::Submenu s.
 

Member Function Documentation

◆ allowsLearnMode()

bool deluge::gui::menu_item::Submenu::allowsLearnMode ( )
finalvirtual

Used by SoundEditor to determine if the current menu item can accept MIDI learning.

Reimplemented from MenuItem.

◆ beginSession()

void deluge::gui::menu_item::Submenu::beginSession ( MenuItem * navigatedBackwardFrom = nullptr)
overridevirtual

Begin an editing session with this menu item.

Should make sure the menu's internal state matches the system and redraw the display.

Reimplemented from MenuItem.

Reimplemented in deluge::gui::menu_item::SubmenuReferringToOneThing.

◆ buttonAction()

ActionResult deluge::gui::menu_item::Submenu::buttonAction ( deluge::hid::Button b,
bool on,
bool inCardRoutine )
finalvirtual

Handle an arbitrary button.

The returned result is forwarded up the View stack, so returning ActionResult::DEALT_WITH will suppress buttons going to the current View.

This is called with (b == SELECT_ENC && on) immediately after the menu is entered, or after selectButtonPress is called and returns NO_NAVIGATION.

Reimplemented from MenuItem.

◆ drawPixelsForOled()

void deluge::gui::menu_item::Submenu::drawPixelsForOled ( )
overridevirtual

Paints the pixels below the standard title block.

Reimplemented from MenuItem.

◆ getParamIndex()

uint32_t deluge::gui::menu_item::Submenu::getParamIndex ( )
overridevirtual
Returns
the parameter index (deluge::modulation::params) we edit if we're a patched param, otherwise 255.

Reimplemented from MenuItem.

◆ getParamKind()

deluge::modulation::params::Kind deluge::gui::menu_item::Submenu::getParamKind ( )
overridevirtual

Declares which parameter we intend to edit. SoundEditor uses this to find which shortcut pad to blink based on paramShortcutsForSounds.

Returns
the parameter kind (deluge::modulation::params::Kind) we edit if we're a patched param, otherwise Kind::NONE

Reimplemented from MenuItem.

◆ isSubmenu()

bool deluge::gui::menu_item::Submenu::isSubmenu ( )
inlineoverridevirtual

Reimplemented from MenuItem.

◆ learnKnob()

void deluge::gui::menu_item::Submenu::learnKnob ( MIDICable * cable,
int32_t whichKnob,
int32_t modKnobMode,
int32_t midiChannel )
finalvirtual

Learn a mod knob to the parameter edited by this menu.

Parameters
cableThe MIDI cable to learn from, or null if a mod knob is to be learned.

Reimplemented from MenuItem.

◆ learnNoteOn()

bool deluge::gui::menu_item::Submenu::learnNoteOn ( MIDICable & cable,
int32_t channel,
int32_t noteCode )
finalvirtual

Attempt to bind this menu item to a note code.

Returns
True if the learn succeeded and the feature controlled by this menu item will now be bound to a MIDI note, false otherwise.

Reimplemented from MenuItem.

◆ learnProgramChange()

void deluge::gui::menu_item::Submenu::learnProgramChange ( MIDICable & cable,
int32_t channel,
int32_t programNumber )
overridevirtual

Reimplemented from MenuItem.

◆ patchingSourceShortcutPress()

MenuItem * deluge::gui::menu_item::Submenu::patchingSourceShortcutPress ( PatchSource s,
bool previousPressStillActive = false )
overridevirtual

Action to take when a source shortcut is pressed.

Potentially reconfigures some SoundEditor state so patching will work.

Parameters
sThe source being pressed.
previousPressStillActiveTrue if there is another patch source press still active. Useful to set up cable strength modulation.
Returns
  • NO_NAVIGATION if the SoundEditor should ask the menu 1 layer up in the stack what to do
  • nullptr if nothing should happen
  • A valid MenuItem if we should switch to that menu item.

Reimplemented from MenuItem.

◆ readValueAgain()

void deluge::gui::menu_item::Submenu::readValueAgain ( )
inlinefinalvirtual

Re-read the value from the system and redraw the display to match.

Reimplemented from MenuItem.

◆ selectButtonPress()

MenuItem * deluge::gui::menu_item::Submenu::selectButtonPress ( )
finalvirtual

Handle a select button press.

Returns
  • NO_NAVIGATION if the SoundEditor should stay on the current menu.
  • nullptr if the SoundEditor should go up one level in the menu stack.
  • otherwise, enter the returned menu.

Reimplemented from MenuItem.

◆ selectEncoderAction()

void deluge::gui::menu_item::Submenu::selectEncoderAction ( int32_t offset)
finalvirtual

Handle select encoder movement.

Child classes which override this should be careful to handle offsets larger than 1, as holding shift and scrolling will increase them.

Reimplemented from MenuItem.

◆ supportsHorizontalRendering()

virtual bool deluge::gui::menu_item::Submenu::supportsHorizontalRendering ( )
inlinevirtual

Submenus which support horizontal rendering need to override this.

Reimplemented in deluge::gui::menu_item::HorizontalMenu, and deluge::gui::menu_item::submenu::Envelope.

◆ unlearnAction()

void deluge::gui::menu_item::Submenu::unlearnAction ( )
finalvirtual

Unlearn the parameter controlled by this menu.

Reimplemented from MenuItem.

◆ updatePadLights()

void deluge::gui::menu_item::Submenu::updatePadLights ( )
overridevirtual

Reimplemented from MenuItem.

◆ usesAffectEntire()

bool deluge::gui::menu_item::Submenu::usesAffectEntire ( )
overridevirtual

Claim support for Kit AFFECT_ENTIRE editing.

Returns
true if this Menu can edit parameters across an entire kit if changed with AFFECT_ENTIRE held down.

Reimplemented from MenuItem.


The documentation for this class was generated from the following files: