From 78d101e7310c605264f9766319c421bb738faafe Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 20 Jun 2019 21:32:01 +0200 Subject: [PATCH] menue.h/cpp: add method to override menu position from user settings Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/341ce4a9c7b28aaf93a1f62fa27344abd6467c28 Author: Thilo Graf Date: 2019-06-20 (Thu, 20 Jun 2019) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 7 +++++-- src/gui/widget/menue.h | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d5d20b4f4..6e8e25dfb 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -638,6 +638,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c //pos x = y = 0; height = 0; + w_pos_mode = MENU_POS_PRESET; //caption and icon nameString = NameString; @@ -1454,8 +1455,10 @@ void CMenuWidget::setMenuPos(const int& menu_width) int real_h = full_height + hint_h; // full_height includes footer_height : see calcSize int x_old = x; int y_old = y; - //configured positions - switch(g_settings.menu_pos) + + //configured/custom positions + int menu_pos = w_pos_mode == MENU_POS_PRESET ? g_settings.menu_pos : w_pos_mode; + switch(menu_pos) { case MENU_POS_CENTER: x = offx + scr_x + ((scr_w - menu_width ) >> 1 ); diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index b0f0f5c24..6cbcda974 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -555,6 +555,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals CComponentsHeader *header, *sub_header; CComponentsFooter *footer; std::string subhead_text; + int w_pos_mode; unsigned int saveScreen_width ; unsigned int saveScreen_height; unsigned int saveScreen_y; @@ -664,7 +665,9 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals MENU_POS_TOP_LEFT , MENU_POS_TOP_RIGHT , MENU_POS_BOTTOM_LEFT , - MENU_POS_BOTTOM_RIGHT + MENU_POS_BOTTOM_RIGHT , + + MENU_POS_PRESET }; void addKey(neutrino_msg_t key, CMenuTarget *menue, const std::string &action); void setFooter(const struct button_label *_fbutton_label, const int _fbutton_count, bool repaint = false); @@ -672,6 +675,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals void setNextShortcut(int sc) { nextShortcut = sc; }; int getNextShortcut() { return nextShortcut; }; bool gotAction() { return !no_action; }; + void setMenuPosMode(int pos_mode){w_pos_mode = pos_mode;} }; class CPINProtection