Merge branch 'master' into pu/mp

This commit is contained in:
Jacek Jendrzej
2017-04-25 13:43:33 +02:00
8 changed files with 52 additions and 25 deletions

View File

@@ -128,7 +128,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
cch_logo.Id = 0; cch_logo.Id = 0;
cch_logo.Name = ""; cch_logo.Name = "";
cch_logo.dy_max = -1; cch_logo.dy_max = -1;
cch_logo.Align = CC_LOGO_RIGHT; cch_logo.Align = DEFAULT_LOGO_ALIGN;
cch_col_text = COL_MENUHEAD_TEXT; cch_col_text = COL_MENUHEAD_TEXT;
cch_caption_align = CTextBox::NO_AUTO_LINEBREAK; cch_caption_align = CTextBox::NO_AUTO_LINEBREAK;
cch_items_y = CC_CENTERED; cch_items_y = CC_CENTERED;
@@ -281,6 +281,14 @@ void CComponentsHeader::initLogo()
else else
cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name);
//ensure logo is not larger than original size if in auto mode
if (cch_logo.dy_max == -1){
int dx_orig = 0, dy_orig = 0 ;
cch_logo_obj->getRealSize(&dx_orig, &dy_orig);
if (cch_logo.dy_max > dy_orig)
cch_logo.dy_max = dy_orig;
}
if (cch_logo_obj->hasLogo()){ if (cch_logo_obj->hasLogo()){
cch_logo_obj->setHeight(cch_logo.dy_max, true); cch_logo_obj->setHeight(cch_logo.dy_max, true);

View File

@@ -32,6 +32,8 @@
#include "cc_frm_clock.h" #include "cc_frm_clock.h"
#include <driver/colorgradient.h> #include <driver/colorgradient.h>
#define DEFAULT_LOGO_ALIGN CComponentsHeader::CC_LOGO_CENTER
//! Sub class of CComponentsForm. Shows a header with prepared items. //! Sub class of CComponentsForm. Shows a header with prepared items.
/*! /*!
CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows
@@ -317,10 +319,11 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
* CC_LOGO_RIGHT \n * CC_LOGO_RIGHT \n
* @param[in] dy * @param[in] dy
* @li optional logo height, default = -1 (auto) * @li optional logo height, default = -1 (auto)
* @note In auto mode, logo use full height minus inner offset but not larger than original logo height.
*/ */
void setChannelLogo( const uint64_t& channelId, void setChannelLogo( const uint64_t& channelId,
const std::string& channelName, const std::string& channelName,
cc_logo_alignment_t alignment = CC_LOGO_CENTER, cc_logo_alignment_t alignment = DEFAULT_LOGO_ALIGN,
const int& dy = -1) const int& dy = -1)
{cch_logo.Id = channelId; cch_logo.Name = channelName, cch_logo.Align = alignment, cch_logo.dy_max = dy; initCCItems();} {cch_logo.Id = channelId; cch_logo.Name = channelName, cch_logo.Align = alignment, cch_logo.dy_max = dy; initCCItems();}
/**Methode to get channel logo object for direct access to its properties and methodes /**Methode to get channel logo object for direct access to its properties and methodes

View File

@@ -76,6 +76,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
y = y_old = y_pos; y = y_old = y_pos;
width = width_old = dx = dxc = w; width = width_old = dx = dxc = w;
height = height_old = dy = dyc = h; height = height_old = dy = dyc = h;
dx_orig = dy_orig = 0;
pic_name = pic_name_old = image_name; pic_name = pic_name_old = image_name;
shadow = shadow_mode; shadow = shadow_mode;
shadow_w = OFFSET_SHADOW; shadow_w = OFFSET_SHADOW;
@@ -201,6 +202,9 @@ void CComponentsPicture::initCCItem()
if (height == 0) if (height == 0)
height = dy_tmp; height = dy_tmp;
} }
dx_orig = width;
dy_orig = height;
/* leave init methode here if we in no scale mode /* leave init methode here if we in no scale mode
* otherwise goto next step! * otherwise goto next step!
*/ */
@@ -211,8 +215,12 @@ void CComponentsPicture::initCCItem()
* check internal dimension values (dx/dy) and ensure that values are >0 * check internal dimension values (dx/dy) and ensure that values are >0
* real image size * real image size
*/ */
if ((dx != width || dy != height) || (dx == 0 || dy == 0)) g_PicViewer->getSize(pic_name.c_str(), &dx_orig, &dy_orig);
g_PicViewer->getSize(pic_name.c_str(), &dx, &dy); if ((dx != width || dy != height) || (dx == 0 || dy == 0)){
dx = dx_orig;
dy = dy_orig;
//g_PicViewer->getSize(pic_name.c_str(), &dx, &dy);
}
} }
/* on next step check item dimensions (width/height) for 0 values /* on next step check item dimensions (width/height) for 0 values
@@ -269,11 +277,11 @@ void CComponentsPicture::initPosition(int *x_position, int *y_position)
} }
// void CComponentsPicture::getSize(int* width_image, int *height_image) void CComponentsPicture::getRealSize(int* dx_original, int *dy_original)
// { {
// *width_image = width; *dx_original = dx_orig;
// *height_image = height; *dy_original = dy_orig;
// } }
int CComponentsPicture::getWidth() int CComponentsPicture::getWidth()
{ {

View File

@@ -54,9 +54,10 @@ class CComponentsPicture : public CComponentsItem
///screen cache content for painted image ///screen cache content for painted image
fb_pixel_t *image_cache; fb_pixel_t *image_cache;
///current original image dimensions ///current image dimensions
int dx, dy; int dx, dy;
///original image dimensions
int dx_orig, dy_orig;
///cached image dimensions ///cached image dimensions
int dxc, dyc; int dxc, dyc;
@@ -146,8 +147,8 @@ class CComponentsPicture : public CComponentsItem
///returns current assigned image name ///returns current assigned image name
std::string getPictureName(){return pic_name;} std::string getPictureName(){return pic_name;}
// ///handle image size ///get original image size
// void getSize(int* width_image, int *height_image); void getRealSize(int* dx_orig, int *dy_orig);
///return width of item ///return width of item
int getWidth(); int getWidth();
///return height of item ///return height of item

View File

@@ -157,6 +157,9 @@ class CProgressBar : public CComponentsItem
//set gradient (overides g_settings.theme.progressbar_gradient) //set gradient (overides g_settings.theme.progressbar_gradient)
void setGradient(int &gradient) { pb_gradient = &gradient; } void setGradient(int &gradient) { pb_gradient = &gradient; }
void setXPos(const int& xpos){CCDraw::setXPos(xpos);}
void setYPos(const int& ypos){CCDraw::setYPos(ypos);}
}; };
#endif /* __CC_PROGRESSBAR_H__ */ #endif /* __CC_PROGRESSBAR_H__ */

View File

@@ -19,8 +19,7 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@@ -111,20 +110,23 @@ void EpgPlus::Header::paint(const char * Name)
std::string caption = Name ? Name : g_Locale->getText(LOCALE_EPGPLUS_HEAD); std::string caption = Name ? Name : g_Locale->getText(LOCALE_EPGPLUS_HEAD);
if (this->head == NULL) if (this->head == NULL)
{
this->head = new CComponentsHeader(); this->head = new CComponentsHeader();
this->head->setContextButton(CComponentsHeader::CC_BTN_HELP);
this->head->enableClock(true, "%H:%M", "%H %M", true);
}
if (this->head) if (this->head)
{ {
if (g_settings.channellist_show_channellogo) if (g_settings.channellist_show_channellogo)
{ {
// ensure to have clean background // ensure to have clean background
this->head->getChannelLogoObject()->hide(); this->logo = this->head->getChannelLogoObject();
this->head->getChannelLogoObject()->allowPaint(false); this->logo->hide();
this->logo->allowPaint(false);
} }
this->head->setDimensionsAll(this->x, this->y, this->width, this->font->getHeight()); this->head->setDimensionsAll(this->x, this->y, this->width, this->font->getHeight());
this->head->setCaption(caption, CTextBox::NO_AUTO_LINEBREAK); this->head->setCaption(caption, CTextBox::NO_AUTO_LINEBREAK);
this->head->setContextButton(CComponentsHeader::CC_BTN_HELP);
this->head->enableClock(true, "%H:%M", "%H %M", true);
this->head->paint(CC_SAVE_SCREEN_NO); this->head->paint(CC_SAVE_SCREEN_NO);
} }
} }
@@ -136,14 +138,14 @@ void EpgPlus::Header::paintChannelLogo(const CZapitChannel * Channel)
if (this->head) if (this->head)
{ {
this->head->getChannelLogoObject()->hide(); this->logo->hide();
this->head->getChannelLogoObject()->clearSavedScreen(); this->logo->clearSavedScreen();
if (Channel) if (Channel)
{ {
this->head->setChannelLogo(Channel->getChannelID(), Channel->getName()); this->head->setChannelLogo(Channel->getChannelID(), Channel->getName());
} }
this->head->getChannelLogoObject()->allowPaint(true); this->logo->allowPaint(true);
this->head->getChannelLogoObject()->paint(); this->logo->paint();
} }
} }

View File

@@ -18,8 +18,7 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __epgplus__ #ifndef __epgplus__
@@ -69,6 +68,8 @@ class EpgPlus
class Header class Header
{ {
private:
CComponentsChannelLogoScalable *logo;
//// construction / destruction //// construction / destruction
public: public:
Header(CFrameBuffer* frameBuffer, Header(CFrameBuffer* frameBuffer,

View File

@@ -316,6 +316,7 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
memset(window_size_value, 0, sizeof(window_size_value)); memset(window_size_value, 0, sizeof(window_size_value));
snprintf(window_size_value, sizeof(window_size_value), "%d / %d", g_settings.window_width, g_settings.window_height); snprintf(window_size_value, sizeof(window_size_value), "%d / %d", g_settings.window_width, g_settings.window_height);
mfWindowSize->setOption(window_size_value); mfWindowSize->setOption(window_size_value);
CNeutrinoApp::getInstance()->channelList->ResetModules();
break; break;
} else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) { } else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) {
g_settings.window_width = old_window_width; g_settings.window_width = old_window_width;