The codebase to run the *spark d-fuser controller www.sparkav.co.uk/dvimixer
Dependencies: SPK-TVOne DMX DmxArtNet NetServicesMin OSC PinDetect mRotaryEncoder iniparser mbed spk_oled_ssd1305 filter
Diff: spk_utils.h
- Revision:
- 24:49c6624119ae
- Parent:
- 23:909928cafb95
- Child:
- 48:c0fedfa8c525
--- a/spk_utils.h Fri Oct 26 16:51:28 2012 +0000 +++ b/spk_utils.h Fri Oct 26 19:22:39 2012 +0000 @@ -65,19 +65,20 @@ class SPKMenuItem { public: - enum itemType { changesToMenu, sendsCommand, usesMenuControls }; + enum itemType { changesToMenu, sendsCommand }; itemType type; string text; + bool handlingControls; union { SPKMenu* menu; int32_t command[2]; - bool handlingControls; } payload; - SPKMenuItem(string title, SPKMenu* menu) + SPKMenuItem(string title, SPKMenu* menu, bool handlesControls = false) { text = title; type = changesToMenu; + handlingControls = handlesControls; payload.menu = menu; } @@ -85,6 +86,7 @@ { text = title; type = sendsCommand; + handlingControls = false; payload.command[0] = command; payload.command[1] = 0; } @@ -93,16 +95,10 @@ { text = title; type = sendsCommand; + handlingControls = false; payload.command[0] = command1; payload.command[1] = command2; } - - SPKMenuItem(string title) - { - text = title; - type = usesMenuControls; - payload.handlingControls = true; - } }; @@ -141,11 +137,13 @@ return selected.index(); } - std::string selectedString() { + std::string selectedString() { + if (items.size() == 0) printf("SPKMenu no items"); return items[selected.index()].text; } SPKMenuItem selectedItem() { + if (items.size() == 0) printf("SPKMenu no items"); return items[selected.index()]; }