diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 1e7cd3363..c0a281434 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -668,13 +668,18 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in int r = v_fbdata[i].r; if (corner_radius > -1) r = corner_radius; - frameBuffer->paintBoxRel(v_fbdata[i].x, - v_fbdata[i].y, - v_fbdata[i].dx, - v_fbdata[i].dy, - bg_color, - r, - corner_type); + + if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){ + frameBuffer->paintBoxRel(v_fbdata[i].x, + v_fbdata[i].y, + v_fbdata[i].dx, + v_fbdata[i].dy, + bg_color, + r, + corner_type); + }else + dprintf(DEBUG_NORMAL, "\033[33m[CCDraw][%s - %d], WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy ); + if (v_fbdata[i].frame_thickness) frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index cd4b5116c..a8cb33d63 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -840,7 +840,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "msgbox_test_yes_no") { - int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 500, -1); + int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 500); std::string msg_txt = "Return value of MsgBox test is "; msg_txt += to_string(msgRet); @@ -863,7 +863,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } else if (actionKey == "msgbox_test_all"){ - int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbAll, NULL, 700, -1); + int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbAll, NULL, 700); std::string msg_txt = "Return value of MsgBox test is "; msg_txt += to_string(msgRet); @@ -871,7 +871,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } else if (actionKey == "msgbox_test_yes_no_cancel"){ - int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrCancel, CMsgBox::mbYes | CMsgBox::mbNo | CMsgBox::mbCancel, NULL, 500, -1); + int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrCancel, CMsgBox::mbYes | CMsgBox::mbNo | CMsgBox::mbCancel, NULL, 500); std::string msg_txt = "Return value of MsgBox test is "; msg_txt += to_string(msgRet); @@ -879,7 +879,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } else if (actionKey == "msgbox_test_ok_cancel"){ - int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbOk | CMsgBox::mbCancel, NULL, 500, -1); + int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbOk | CMsgBox::mbCancel, NULL, 500); std::string msg_txt = "Return value of MsgBox test is "; msg_txt += to_string(msgRet); @@ -887,7 +887,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } else if (actionKey == "msgbox_test_no_yes"){ - int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbNoYes, NULL, 500, -1); + int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbNoYes, NULL, 500); std::string msg_txt = "Return value of MsgBox test is "; msg_txt += to_string(msgRet); @@ -895,7 +895,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } else if (actionKey == "msgbox_test_ok"){ - int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press ok key! ...", CMsgBox::mbrOk, CMsgBox::mbOk, NULL, 500, -1); + int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press ok key! ...", CMsgBox::mbrOk, CMsgBox::mbOk, NULL, 500); std::string msg_txt = "Return value of MsgBox test is "; msg_txt += to_string(msgRet); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 5222ce90c..4860793e9 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -653,7 +653,6 @@ struct button_label TimerListButtons[] = { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD }, { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY }, { NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }, - { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE }, { NEUTRINO_ICON_BUTTON_PLAY , NONEXISTANT_LOCALE } }; size_t TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]); @@ -991,7 +990,7 @@ int CTimerList::show() if (!epgdata.title.empty()) title = "(" + epgdata.title + ")\n"; snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_TIMERLIST_ASK_TO_DELETE), title.c_str()); - if (ShowMsg(LOCALE_RECORDINGMENU_RECORD_IS_RUNNING, buf1, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, 30, false) == CMsgBox::mbrNo) + if (ShowMsg(LOCALE_RECORDINGMENU_RECORD_IS_RUNNING, buf1, CMsgBox::mbrNo, CMsgBox::mbYesNo, NULL, 450) & CMsgBox::mbrNo) { killTimer = false; update = false; @@ -1385,16 +1384,18 @@ void CTimerList::paintHead() void CTimerList::paintFoot() { - CTimerd::responseGetTimer* timer=&timerlist[selected]; - if (timer != NULL) + if(!timerlist.empty() ) { + CTimerd::responseGetTimer* timer=&timerlist[selected]; + if (timer != NULL) + { //replace info button with dummy if timer is not type REC or ZAP - if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_REMOTEBOX || timer->eventType == CTimerd::TIMER_ZAPTO) - TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_INFO_SMALL; - else - TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_DUMMY_SMALL; + if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_REMOTEBOX || timer->eventType == CTimerd::TIMER_ZAPTO) + TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_INFO_SMALL; + else + TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_DUMMY_SMALL; + } } - //shadow frameBuffer->paintBoxRel(x + OFFSET_SHADOW, y + height - footerHeight, width, footerHeight + OFFSET_SHADOW, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index 17a932b04..5da8d7ebe 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -17,7 +17,6 @@ noinst_LIBRARIES = libneutrino_gui_widget.a libneutrino_gui_widget2.a libneutrino_gui_widget_a_SOURCES = \ buttons.cpp \ colorchooser.cpp \ - drawable.cpp \ helpbox.cpp \ hintbox.cpp \ keychooser.cpp \ diff --git a/src/gui/widget/drawable.cpp b/src/gui/widget/drawable.cpp deleted file mode 100644 index 0319e34ff..000000000 --- a/src/gui/widget/drawable.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#include - -#include -#include - -Drawable::Drawable() -{ -} - -Drawable::~Drawable() -{ -} - -int Drawable::getWidth(void) -{ - return m_width; -} - -int Drawable::getHeight(void) -{ - return m_height; -} - -Drawable::DType Drawable::getType(void) -{ - return Drawable::DTYPE_DRAWABLE; -} - - -// ------------------------------------------------------------------------------ -DText::DText(std::string& text) -{ - m_text = text; - init(); -} - -DText::DText(const char *text) -{ - m_text = std::string(text); - init(); -} - -void DText::init() -{ - m_width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(m_text); - m_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); -} - - -void DText::draw(CFBWindow *window, int x, int y, int width) -{ - window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU], x, y + m_height, width, - m_text.c_str(), COL_MENUCONTENT_TEXT); -} - -void DText::print(void) -{ - std::cout << " text: " << m_text; -} - -// ------------------------------------------------------------------------------ -DIcon::DIcon(std::string& icon) -{ - m_icon = icon; - init(); -} - -DIcon::DIcon(const char *icon) -{ - m_icon = std::string(icon); - init(); -} - -void DIcon::init() -{ - m_height = 16; - m_width = 16; -} - -void DIcon::draw(CFBWindow *window, int x, int y, int /*width*/) -{ - window->paintIcon(m_icon.c_str(), x, y); -} - -void DIcon::print(void) -{ - std::cout << " icon: " << m_icon; -} - -// ------------------------------------------------------------------------------ -DPagebreak::DPagebreak() -{ - m_height = 0; - m_width = 0; -} - -void DPagebreak::draw(CFBWindow */*window*/, int /*x*/, int /*y*/, int /*width*/) -{ -// window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU], -// x, y + m_height, width, "", -// COL_MENUCONTENT_TEXT); -} - -void DPagebreak::print(void) -{ - std::cout << ""; -} - -Drawable::DType DPagebreak::getType(void) -{ - return Drawable::DTYPE_PAGEBREAK; -} diff --git a/src/gui/widget/drawable.h b/src/gui/widget/drawable.h deleted file mode 100644 index 744f4446e..000000000 --- a/src/gui/widget/drawable.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - Neutrino-GUI - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#ifndef __drawable__ -#define __drawable__ - -#include -#include - -#include -#include - -class Drawable; - -typedef std::vector > ContentLines; - - -/** - * The base class for items which can be drawn on a CFBWindow. - */ -class Drawable -{ -public: - - enum DType { - DTYPE_DRAWABLE, - DTYPE_PAGEBREAK - }; - - virtual ~Drawable(); - - /** - * Overwrite this method in subclasses to draw on the window - * - * @param window the window to draw on - * @param x x component of the top left corner - * @param y y component of the top left corner - */ - virtual void draw(CFBWindow *window, int x, int y, int width) = 0; - - virtual int getWidth(void); - - virtual int getHeight(void); - - /** - * Overwrite this method in subclasses to print some info - * about the content. Mainly used for debuging ;) - */ - virtual void print(void) = 0; - - /** - * Returns the type of this drawable. Used to distinguish between - * drawing objects and control objects like pagebreaks. - * @return the type of this drawable. - */ - virtual DType getType(); - -protected: - - Drawable(); - - int m_height; - - int m_width; - -private: - -}; - -/** - * This class draws a given string. - */ -class DText : public Drawable -{ -public: - DText(std::string& text); - - DText(const char *text); - - void init(); - - void draw(CFBWindow *window, int x, int y, int width); - - void print(); - -protected: - - std::string m_text; - -}; - - -/** - * This class draws a given icon. - */ -class DIcon : public Drawable -{ -public: - DIcon(std::string& icon); - - DIcon(const char *icon); - - void init(); - - void draw(CFBWindow *window, int x, int y, int width); - - void print(); - -protected: - - std::string m_icon; -}; - -/** - * This class is used as a control object and forces a new page - * in scrollable windows. - */ -class DPagebreak : public Drawable -{ -public: - DPagebreak(); - - void draw(CFBWindow *window, int x, int y, int width); - - void print(); - - DType getType(); - -protected: - -private: - -}; - -#endif diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index 4afacb82a..c005feb26 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -36,7 +36,8 @@ #define HINTBOX_MIN_HEIGHT 125 #define HINTBOX_MAX_HEIGHT 520 #define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES] -#define NO_TIMEOUT -1 +#define NO_TIMEOUT 0 +#define DEFAULT_TIMEOUT -1 //frame around hint container as indent #define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100 //frame color around hint/message box @@ -179,7 +180,9 @@ class CHintBox : public CComponentsWindow int exec(); /** - * Defines timeout, timeout is enabled if parameter1 > -1 + * Defines timeout for message window. + * Timeout is enabled with parameter1 = DEFAULT_TIMEOUT (-1) or any other value > 0 + * To disable timeout use NO_TIMEOUT (0) * @param[in] Timeout as int as seconds */ virtual void setTimeOut(const int& Timeout){timeout = Timeout;} diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 151a0cc73..5f6e375e0 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -114,7 +114,7 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t void CMsgBox::initTimeOut() { - timeout = -1; + timeout = NO_TIMEOUT; enable_timeout_result = false; } @@ -238,7 +238,9 @@ int CMsgBox::exec() ccw_footer->getSelectedButtonObject()->setButtonAlias(mb_show_button); int selected = ccw_footer->getSelectedButton(); if (timeout == NO_TIMEOUT) - timeout = MSGBOX_DEFAULT_TIMEOUT; + timeout = 0; + if (timeout == DEFAULT_TIMEOUT) + timeout = g_settings.timing[SNeutrinoSettings::TIMING_STATIC_MESSAGES]; uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); @@ -528,12 +530,12 @@ int ShowMsg( const std::string & Title, void DisplayErrorMessage(const char * const ErrorMsg, const neutrino_locale_t& caption, const int& Text_mode) { - ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, -1, false, Text_mode, COL_RED); + ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, NO_TIMEOUT, false, Text_mode, COL_RED); } void DisplayErrorMessage(const char * const ErrorMsg, const std::string& caption, const int& Text_mode) { - ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, -1, false, Text_mode, COL_RED); + ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, NO_TIMEOUT, false, Text_mode, COL_RED); } void DisplayErrorMessage(const char * const ErrorMsg, const int& Text_mode) @@ -543,12 +545,12 @@ void DisplayErrorMessage(const char * const ErrorMsg, const int& Text_mode) void DisplayInfoMessage(const char * const InfoMsg, const neutrino_locale_t& caption, const int& Text_mode, fb_pixel_t color_frame) { - ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, -1, false, Text_mode, color_frame); + ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, NO_TIMEOUT, false, Text_mode, color_frame); } void DisplayInfoMessage(const char * const InfoMsg, const std::string& caption, const int& Text_mode, fb_pixel_t color_frame) { - ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, -1, false, Text_mode, color_frame); + ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, NO_TIMEOUT, false, Text_mode, color_frame); } void DisplayInfoMessage(const char * const InfoMsg, const int& Text_mode, fb_pixel_t color_frame) diff --git a/src/gui/widget/msgbox.h b/src/gui/widget/msgbox.h index 5c81dfb33..ad959dc59 100644 --- a/src/gui/widget/msgbox.h +++ b/src/gui/widget/msgbox.h @@ -56,14 +56,14 @@ class CMsgBox : public CHintBox /* enum definition */ enum msg_result_t { - mbrYes = 0, - mbrNo = 1, - mbrCancel = 2, - mbrBack = 3, - mbrOk = 4, - mbrTimeout = 5, + mbrYes = 0x01, + mbrNo = 0x02, + mbrCancel = 0x04, + mbrBack = 0x08, + mbrOk = 0x10, + mbrTimeout = 0x20, - mbrNone = -1 + mbrNone = 0x00 }; enum button_define_t { @@ -171,7 +171,7 @@ class CMsgBox : public CHintBox const int& Width = MSGBOX_MIN_WIDTH, const int& Height = MSGBOX_MIN_HEIGHT, const int& ShowButtons = mbCancel, - const msg_result_t& Default_result = mbrCancel, + const msg_result_t& Default_result = mbrNone, const int& Text_mode = DEFAULT_MSGBOX_TEXT_MODE); /**CMsgBox Constructor @@ -225,7 +225,7 @@ class CMsgBox : public CHintBox const int& Width = MSGBOX_MIN_WIDTH, const int& Height = MSGBOX_MIN_HEIGHT, const int& ShowButtons = mbCancel, - const msg_result_t& Default_result = mbrCancel, + const msg_result_t& Default_result = mbrNone, const int& Text_mode = DEFAULT_MSGBOX_TEXT_MODE); // ~CMsgBox(); //inherited diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 353830464..04146ed3d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3560,7 +3560,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) { if (mode != mode_scart && mode != mode_standby) { - int timeout = NO_TIMEOUT; + int timeout = DEFAULT_TIMEOUT; std::string text = (char*)data; std::string::size_type pos; diff --git a/src/system/settings.h b/src/system/settings.h index 7d5377840..4b2d65b9d 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -962,12 +962,13 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define RADIUS_NONE 0 // offsets -#define OFFSET_SHADOW 6 -#define OFFSET_INTER 6 +#define OFFSET_SHADOW 6 +#define OFFSET_INTER 6 #define OFFSET_INNER_LARGE 20 #define OFFSET_INNER_MID 10 #define OFFSET_INNER_SMALL 5 #define OFFSET_INNER_MIN 2 +#define OFFSET_INNER_NONE 0 struct SglobalInfo {