mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
CImageInfo: Scroll license text if text box too small
Origin commit data
------------------
Branch: ni/coolstream
Commit: 801a15df7c
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-03-20 (Wed, 20 Mar 2013)
Origin message was:
------------------
* CImageInfo: Scroll license text if text box too small
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -201,6 +201,8 @@ class CComponentsText : public CComponentsItem
|
||||
virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
|
||||
virtual void removeLineBreaks(std::string& str);
|
||||
|
||||
CTextBox* getCCItemTextBoxInst() { return ct_textbox; };
|
||||
};
|
||||
|
||||
class CComponentsLabel : public CComponentsText
|
||||
@@ -223,7 +225,6 @@ class CComponentsInfoBox : public CComponentsText
|
||||
{
|
||||
private:
|
||||
int x_text, x_offset;
|
||||
CComponentsText * cctext;
|
||||
CComponentsPicture * pic;
|
||||
std::string pic_default_name;
|
||||
|
||||
@@ -232,6 +233,8 @@ class CComponentsInfoBox : public CComponentsText
|
||||
std::string pic_name;
|
||||
|
||||
public:
|
||||
CComponentsText * cctext;
|
||||
|
||||
CComponentsInfoBox();
|
||||
CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
|
||||
|
@@ -59,6 +59,7 @@ CImageInfo::CImageInfo(): config ('\t')
|
||||
void CImageInfo::Init(void)
|
||||
{
|
||||
cc_win = NULL;
|
||||
cc_lic = NULL;
|
||||
item_offset = 20;
|
||||
item_top = item_offset;
|
||||
license_txt = "";
|
||||
@@ -73,6 +74,21 @@ CImageInfo::~CImageInfo()
|
||||
delete cc_win;
|
||||
}
|
||||
|
||||
void CImageInfo::ScrollLic(bool scrollDown)
|
||||
{
|
||||
if (cc_lic && (cc_lic->cctext)) {
|
||||
CTextBox* ctb = cc_lic->cctext->getCCItemTextBoxInst();
|
||||
if (ctb) {
|
||||
ctb->enableBackgroundPaint(true);
|
||||
if (scrollDown)
|
||||
ctb->scrollPageDown(1);
|
||||
else
|
||||
ctb->scrollPageUp(1);
|
||||
ctb->enableBackgroundPaint(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
||||
{
|
||||
int res = menu_return::RETURN_REPAINT;
|
||||
@@ -98,6 +114,12 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
||||
res = menu_return::RETURN_EXIT_ALL;
|
||||
break;
|
||||
}
|
||||
else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_page_up)) {
|
||||
ScrollLic(false);
|
||||
}
|
||||
else if ((msg == CRCInput::RC_down) || (msg == CRCInput::RC_page_down)) {
|
||||
ScrollLic(true);
|
||||
}
|
||||
else if (msg <= CRCInput::RC_MaxRC){
|
||||
break;
|
||||
}
|
||||
@@ -271,8 +293,8 @@ void CImageInfo::InitLicenseText()
|
||||
}
|
||||
in.close();
|
||||
|
||||
CComponentsInfoBox *cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top);
|
||||
cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]);
|
||||
cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top);
|
||||
cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]);
|
||||
|
||||
//add text to container
|
||||
cc_win->addCCItem(cc_lic);
|
||||
|
@@ -54,8 +54,10 @@ class CImageInfo : public CMenuTarget
|
||||
void InitSupportInfos();
|
||||
void ShowWindow();
|
||||
void InitLicenseText();
|
||||
void ScrollLic(bool scrollDown);
|
||||
|
||||
CComponentsWindow *cc_win;
|
||||
CComponentsInfoBox *cc_lic;
|
||||
CConfigFile config;
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user