diff options
author | David Crocker <dcrocker@eschertech.com> | 2018-08-27 12:21:13 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2018-08-27 12:21:13 +0300 |
commit | 413586e519ce77215d9bee808cc62cf0e6ac6f79 (patch) | |
tree | e175b92b431e25e538012842d5fb46e69afcaf97 /src/Display/Menu.h | |
parent | cdaf681010845fc6e8300f656bfb213a499f94ae (diff) |
Merged in Matt's additions to 12864 display support
Diffstat (limited to 'src/Display/Menu.h')
-rw-r--r-- | src/Display/Menu.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/Display/Menu.h b/src/Display/Menu.h index 742a176b..e6658c64 100644 --- a/src/Display/Menu.h +++ b/src/Display/Menu.h @@ -22,21 +22,30 @@ public: void Refresh(); private: + void LoadFixedMenu(); + bool bInFixedMenu() const; + void ResetCache(); void Reload(); - const char *ParseCommand(char *s); + const char *ParseMenuLine(char *s); void LoadError(const char *msg, unsigned int line); void AddItem(MenuItem *item, bool isSelectable); const char *AppendString(const char *s); void LoadImage(const char *fname); MenuItem *FindHighlightedItem() const; + void EncoderAction_EnterItemHelper(); + void EncoderAction_AdjustItemHelper(int action); + void EncoderAction_ExitItemHelper(int action); + void EncoderAction_ExecuteHelper(const char *const cmd); + static const char *SkipWhitespace(const char *s); static char *SkipWhitespace(char *s); + static bool CheckVisibility(MenuItem::Visibility vis); - static const size_t CommandBufferSize = 256; - static const size_t MaxMenuLineLength = 80; - static const size_t MaxMenuFilenameLength = 30; - static const size_t MaxMenuNesting = 3; // maximum number of nested menus + static const size_t CommandBufferSize = 512; + static const size_t MaxMenuLineLength = 80; // adjusts behaviour in Reload() + static const size_t MaxMenuFilenameLength = 18; + static const size_t MaxMenuNesting = 8; // maximum number of nested menus static const PixelNumber InnerMargin = 2; // how many pixels we keep clear inside the border static const PixelNumber OuterMargin = 8 + InnerMargin; // how many pixels of the previous menu we leave on each side static const PixelNumber DefaultNumberWidth = 20; // default numeric field width @@ -45,6 +54,9 @@ private: const LcdFont * const *fonts; const size_t numFonts; + bool timeoutEnabled; + uint32_t lastActionTime; + MenuItem *selectableItems; // selectable items at the innermost level MenuItem *unSelectableItems; // unselectable items at the innermost level String<MaxMenuFilenameLength> filenames[MaxMenuNesting]; @@ -53,11 +65,14 @@ private: int highlightedItem; bool itemIsSelected; + static constexpr const char *const m_pcFixedMenu = "zzFixed"; + // Variables used while parsing size_t commandBufferIndex; - unsigned int fontNumber; + MenuItem::FontNumber fontNumber; PixelNumber currentMargin; PixelNumber row, column; + PixelNumber rowOffset; // Buffer for commands to be executed when the user presses a selected item char commandBuffer[CommandBufferSize]; |