From 862f212214f77993a0940ab4e655b88c873dc87e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 10 Jan 2017 22:07:49 +0100 Subject: [PATCH] CHintBox: add possibility to left hintbox with RC_up and RC_down RC_up and RC_down are used for text scroll, but most message texts are small and no scroll mode is required. In case of large texts it should falling back to scroll mode. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/1d8de839d576a9d844b7fa31ebc8c97957deb864 Author: Thilo Graf Date: 2017-01-10 (Tue, 10 Jan 2017) --- src/gui/widget/hintbox.cpp | 13 ++++++++++--- src/gui/widget/hintbox.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 45ec42223..9be2aae6f 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -134,6 +134,8 @@ void CHintBox::init(const std::string& Text, const int& Width, const std::string hb_font = MSG_FONT; + enable_txt_scroll = false; + //enable shadow shadow = CC_SHADOW_ON; @@ -219,10 +221,14 @@ int CHintBox::exec() } else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) { - if (msg == CRCInput::RC_up) - this->scroll_up(); + if (enable_txt_scroll){ + if (msg == CRCInput::RC_up) + this->scroll_up(); + else + this->scroll_down(); + } else - this->scroll_down(); + res = messages_return::cancel_all; } else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! @@ -274,6 +280,7 @@ void CHintBox::addHintItem(const std::string& Text, const int& text_mode, const if (h_lines > h_hint_obj){ txt_mode = text_mode | CTextBox::SCROLL; ccw_buttons = ccw_buttons | CComponentsHeader::CC_BTN_UP | CComponentsHeader::CC_BTN_DOWN; + enable_txt_scroll = true; } /* define y start position of infobox inside body */ diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index 0bd123c45..187752286 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -60,6 +60,7 @@ class CHintBox : public CComponentsWindow int y_hint_obj; int h_hint_obj; int w_indentation; + bool enable_txt_scroll; Font* hb_font;