src/driver/glcd: code formatting

Origin commit data
------------------
Commit: 39cfc018db
Author: max_10 <max_10@gmx.de>
Date: 2023-08-14 (Mon, 14 Aug 2023)

Origin message was:
------------------
- src/driver/glcd: code formatting

Signed-off-by: Thilo Graf <dbt@novatux.de>

# Conflicts:
#	src/driver/glcd/glcd.cpp
This commit is contained in:
max_10
2023-08-15 20:55:34 +02:00
committed by Thilo Graf
parent 2434e49cdc
commit db21ead167
10 changed files with 427 additions and 319 deletions

View File

@@ -1,24 +1,23 @@
/* /*
analog clock - DBoxII-Project analog clock - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean', Copyright (C) 2001 Steffen Hehn 'McClean', 2003 thegoodguy
2003 thegoodguy
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@@ -38,7 +37,7 @@ enum files
ANALOG_MIN = 2 ANALOG_MIN = 2
}; };
const char * const file_name[] = const char *const file_name[] =
{ {
"analog_clock", "analog_clock",
"analog_hour", "analog_hour",
@@ -46,7 +45,7 @@ const char * const file_name[] =
}; };
#define LCD_NUMBER_OF_FILES (sizeof(file_name)/sizeof(file_name[0])) #define LCD_NUMBER_OF_FILES (sizeof(file_name)/sizeof(file_name[0]))
const char * const file_path[] = const char *const file_path[] =
{ {
ICONSDIR_VAR "/oled/clock/", ICONSDIR_VAR "/oled/clock/",
ICONSDIR "/oled/clock/" ICONSDIR "/oled/clock/"
@@ -139,14 +138,14 @@ void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size,
mAngleInRad = ((6 * time_min) * (2 * pi / 360)); mAngleInRad = ((6 * time_min) * (2 * pi / 360));
mAngleSave = mAngleInRad; mAngleSave = mAngleInRad;
mAngleInRad -= pi/2; mAngleInRad -= pi / 2;
min_x = int((dia * 0.7 * cos(mAngleInRad))); min_x = int((dia * 0.7 * cos(mAngleInRad)));
min_y = int((dia * 0.7 * sin(mAngleInRad))); min_y = int((dia * 0.7 * sin(mAngleInRad)));
hAngleInRad = ((30 * time_hour) * (2 * pi / 360)); hAngleInRad = ((30 * time_hour) * (2 * pi / 360));
hAngleInRad += mAngleSave/12; hAngleInRad += mAngleSave / 12;
hAngleInRad -= pi/2; hAngleInRad -= pi / 2;
hour_x = int((dia * 0.5 * cos(hAngleInRad))); hour_x = int((dia * 0.5 * cos(hAngleInRad)));
hour_y = int((dia * 0.5 * sin(hAngleInRad))); hour_y = int((dia * 0.5 * sin(hAngleInRad)));
@@ -154,11 +153,11 @@ void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size,
for (int i = 0; i <= hour_size; i++) for (int i = 0; i <= hour_size; i++)
{ {
#if 1 #if 1
cglcd->bitmap->DrawLine(posx-i, posy-i, posx + hour_x,posy + hour_y, GLCD::cColor::White); cglcd->bitmap->DrawLine(posx - i, posy - i, posx + hour_x, posy + hour_y, GLCD::cColor::White);
cglcd->bitmap->DrawLine(posx+i, posy+i, posx + hour_x,posy + hour_y, GLCD::cColor::White); cglcd->bitmap->DrawLine(posx + i, posy + i, posx + hour_x, posy + hour_y, GLCD::cColor::White);
#else #else
cglcd->bitmap->DrawLine(posx-i, posy-i, posx + hour_x-i,posy + hour_y-i, t.glcd_color_fg); cglcd->bitmap->DrawLine(posx - i, posy - i, posx + hour_x - i, posy + hour_y - i, t.glcd_color_fg);
cglcd->bitmap->DrawLine(posx+i, posy+i, posx + hour_x+i,posy + hour_y+i, t.glcd_color_fg); cglcd->bitmap->DrawLine(posx + i, posy + i, posx + hour_x + i, posy + hour_y + i, t.glcd_color_fg);
#endif #endif
} }
@@ -166,11 +165,11 @@ void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size,
for (int i = 0; i <= min_size; i++) for (int i = 0; i <= min_size; i++)
{ {
#if 1 #if 1
cglcd->bitmap->DrawLine(posx-i, posy-i, posx + min_x,posy + min_y, GLCD::cColor::White); cglcd->bitmap->DrawLine(posx - i, posy - i, posx + min_x, posy + min_y, GLCD::cColor::White);
cglcd->bitmap->DrawLine(posx+i, posy+i, posx + min_x,posy + min_y, GLCD::cColor::White); cglcd->bitmap->DrawLine(posx + i, posy + i, posx + min_x, posy + min_y, GLCD::cColor::White);
#else #else
cglcd->bitmap->DrawLine(posx-i, posy-i, posx + min_x-i,posy + min_y-i, t.glcd_color_fg); cglcd->bitmap->DrawLine(posx - i, posy - i, posx + min_x - i, posy + min_y - i, t.glcd_color_fg);
cglcd->bitmap->DrawLine(posx+i, posy+i, posx + min_x+i,posy + min_y+i, t.glcd_color_fg); cglcd->bitmap->DrawLine(posx + i, posy + i, posx + min_x + i, posy + min_y + i, t.glcd_color_fg);
#endif #endif
} }
} }

View File

@@ -1,26 +1,24 @@
/* /*
LCD-Daemon - DBoxII-Project LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
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.
License: GPL 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.
This program is free software; you can redistribute it and/or modify You should have received a copy of the GNU General Public License
it under the terms of the GNU General Public License as published by along with this program; if not, write to the Free Software
the Free Software Foundation; either version 2 of the License, or Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(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.
*/ */
#include "glcd.h" #include "glcd.h"

View File

@@ -34,11 +34,11 @@
enum digits enum digits
{ {
TIME_ZERO = 0, TIME_ZERO = 0,
TIME_ONE = 1, TIME_ONE = 1,
TIME_TWO = 2, TIME_TWO = 2,
TIME_THREE = 3, TIME_THREE = 3,
TIME_FOUR = 4, TIME_FOUR = 4,
TIME_FIVE = 5, TIME_FIVE = 5,
TIME_SIX = 6, TIME_SIX = 6,
TIME_SEVEN = 7, TIME_SEVEN = 7,
@@ -47,13 +47,13 @@ enum digits
TIME_DOTS = 10 TIME_DOTS = 10
}; };
const char * const digit_name[] = const char *const digit_name[] =
{ {
"time_zero", "time_zero",
"time_one", "time_one",
"time_two", "time_two",
"time_three", "time_three",
"time_four", "time_four",
"time_five", "time_five",
"time_six", "time_six",
"time_seven", "time_seven",
@@ -63,7 +63,7 @@ const char * const digit_name[] =
}; };
#define LCD_NUMBER_OF_DIGITS (sizeof(digit_name)/sizeof(digit_name[0])) #define LCD_NUMBER_OF_DIGITS (sizeof(digit_name)/sizeof(digit_name[0]))
const char * const digit_path[] = const char *const digit_path[] =
{ {
ICONSDIR_VAR "/oled/clock/", ICONSDIR_VAR "/oled/clock/",
ICONSDIR "/oled/clock/" ICONSDIR "/oled/clock/"
@@ -159,9 +159,9 @@ void ShowDigitalClock(int hour, int minute)
int d = 258; int d = 258;
int e = 365; int e = 365;
RenderTimeDigit(hour/10, a, y); RenderTimeDigit(hour / 10, a, y);
RenderTimeDigit(hour%10, b, y); RenderTimeDigit(hour % 10, b, y);
RenderDots(c ,(t.glcd_standby_weather ? (y + 35) : y)); RenderDots(c, (t.glcd_standby_weather ? (y + 35) : y));
RenderTimeDigit(minute/10, d, y); RenderTimeDigit(minute / 10, d, y);
RenderTimeDigit(minute%10, e, y); RenderTimeDigit(minute % 10, e, y);
} }

View File

@@ -1,26 +1,24 @@
/* /*
LCD-Daemon - DBoxII-Project LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
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.
License: GPL 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.
This program is free software; you can redistribute it and/or modify You should have received a copy of the GNU General Public License
it under the terms of the GNU General Public License as published by along with this program; if not, write to the Free Software
the Free Software Foundation; either version 2 of the License, or Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(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.
*/ */
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"

View File

@@ -3,7 +3,6 @@
(C) 2012-2014 by martii (C) 2012-2014 by martii
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -51,11 +50,11 @@
#define ICONSEXT ".png" #define ICONSEXT ".png"
static const char * kDefaultConfigFile = "/etc/graphlcd.conf"; static const char *kDefaultConfigFile = "/etc/graphlcd.conf";
static cGLCD *cglcd = NULL; static cGLCD *cglcd = NULL;
extern CRemoteControl *g_RemoteControl; extern CRemoteControl *g_RemoteControl;
extern CPictureViewer * g_PicViewer; extern CPictureViewer *g_PicViewer;
cGLCD::cGLCD() cGLCD::cGLCD()
{ {
@@ -129,10 +128,10 @@ cGLCD::cGLCD()
if (!g_settings.glcd_enable) if (!g_settings.glcd_enable)
doSuspend = true; doSuspend = true;
if (pthread_create (&thrGLCD, 0, cGLCD::Run, this) != 0 ) if (pthread_create(&thrGLCD, 0, cGLCD::Run, this) != 0)
fprintf(stderr, "ERROR: pthread_create(cGLCD::Init)\n"); fprintf(stderr, "ERROR: pthread_create(cGLCD::Init)\n");
if (pthread_create (&thrTimeThread, 0, cGLCD::TimeThread, this) != 0 ) if (pthread_create(&thrTimeThread, 0, cGLCD::TimeThread, this) != 0)
fprintf(stderr, "ERROR: pthread_create(cGLCD::TimeThread)\n"); fprintf(stderr, "ERROR: pthread_create(cGLCD::TimeThread)\n");
InitAnalogClock(); InitAnalogClock();
@@ -184,9 +183,12 @@ uint32_t cGLCD::ColorConvert3to1(uint32_t red, uint32_t green, uint32_t blue)
unsigned int color_green_tmp = (static_cast<int>(green) * 2.55) + 1; unsigned int color_green_tmp = (static_cast<int>(green) * 2.55) + 1;
unsigned int color_blue_tmp = (static_cast<int>(blue) * 2.55) + 1; unsigned int color_blue_tmp = (static_cast<int>(blue) * 2.55) + 1;
uint32_t color = 0xff; color <<= 8; uint32_t color = 0xff;
color |= color_red_tmp; color <<= 8; color <<= 8;
color |= color_green_tmp; color <<= 8; color |= color_red_tmp;
color <<= 8;
color |= color_green_tmp;
color <<= 8;
color |= color_blue_tmp; color |= color_blue_tmp;
return color; return color;
@@ -208,13 +210,13 @@ void cGLCD::Exec()
GLCD::cFont font_tmp; GLCD::cFont font_tmp;
int fw = font_epg.Width(Epg); int fw = font_epg.Width(Epg);
fw = (fw == 0) ? 1: fw; fw = (fw == 0) ? 1 : fw;
font_tmp.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg * bitmap->Width() / fw); font_tmp.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg * bitmap->Width() / fw);
fw = font_tmp.Width(Epg); fw = font_tmp.Width(Epg);
int fh = font_tmp.Height(Epg); int fh = font_tmp.Height(Epg);
drawText(std::max(2,(bitmap->Width() - fw)/2), drawText(std::max(2, (bitmap->Width() - fw) / 2),
std::max(2,(bitmap->Height() - fh)/2), bitmap->Width(), fw, Epg, std::max(2, (bitmap->Height() - fh) / 2), bitmap->Width(), fw, Epg,
&font_tmp, ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent, true, 0, ALIGN_NONE); &font_tmp, ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent, true, 0, ALIGN_NONE);
lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height());
@@ -232,7 +234,7 @@ void cGLCD::Exec()
{ {
if (t.glcd_standby_clock == CLOCK_ANALOG) if (t.glcd_standby_clock == CLOCK_ANALOG)
{ {
ShowAnalogClock(tm->tm_hour, tm->tm_min, tm->tm_sec, bitmap->Width()/2, bitmap->Height()/2); ShowAnalogClock(tm->tm_hour, tm->tm_min, tm->tm_sec, bitmap->Width() / 2, bitmap->Height() / 2);
} }
else if (t.glcd_standby_clock == CLOCK_DIGITAL) else if (t.glcd_standby_clock == CLOCK_DIGITAL)
{ {
@@ -325,19 +327,28 @@ void cGLCD::Exec()
g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height); g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height);
if (t.glcd_logo && percent_logo && if (t.glcd_logo && percent_logo &&
showImage(channel_id, Channel, t.glcd_logo_x_position+(bitmap->Width()-(percent_logo_width * bitmap->Width()/100))/2, t.glcd_logo_y_position, percent_logo_width * bitmap->Width()/100, percent_logo * bitmap->Height()/100, true, false)) { showImage(channel_id, Channel, t.glcd_logo_x_position + (bitmap->Width() - (percent_logo_width * bitmap->Width() / 100)) / 2, t.glcd_logo_y_position, percent_logo_width * bitmap->Width() / 100, percent_logo * bitmap->Height() / 100, true, false))
{
doScrollChannel = false; doScrollChannel = false;
scrollChannelSkip = 0; scrollChannelSkip = 0;
} else if (percent_logo && icon_start_width && icon_start_height && }
doShowLcdIcon && showImage(Logo, icon_start_width, icon_start_height, t.glcd_logo_x_position, t.glcd_logo_y_position, bitmap->Width(), percent_logo * bitmap->Height()/100, true, false)) { else if (percent_logo && icon_start_width && icon_start_height &&
doShowLcdIcon && showImage(Logo, icon_start_width, icon_start_height, t.glcd_logo_x_position, t.glcd_logo_y_position, bitmap->Width(), percent_logo * bitmap->Height() / 100, true, false))
{
doScrollChannel = false; doScrollChannel = false;
scrollChannelSkip = 0; scrollChannelSkip = 0;
} else if (percent_channel) { }
if (ChannelWidth) { else if (percent_channel)
if (scrollChannelForward) { {
if (ChannelWidth)
{
if (scrollChannelForward)
{
if (ChannelWidth - scrollChannelSkip < bitmap->Width()) if (ChannelWidth - scrollChannelSkip < bitmap->Width())
scrollChannelForward = false; scrollChannelForward = false;
} else if (scrollChannelSkip <= 0) { }
else if (scrollChannelSkip <= 0)
{
scrollChannelSkip = 0; scrollChannelSkip = 0;
doScrollChannel = false; doScrollChannel = false;
} }
@@ -352,7 +363,8 @@ void cGLCD::Exec()
if (scrollChannelOffset < 0) if (scrollChannelOffset < 0)
scrollChannelOffset = 0; scrollChannelOffset = 0;
if (scrollChannelOffset == 0) { if (scrollChannelOffset == 0)
{
if (scrollChannelForward) if (scrollChannelForward)
scrollChannelSkip += g_settings.glcd_scroll_speed; scrollChannelSkip += g_settings.glcd_scroll_speed;
else else
@@ -365,10 +377,13 @@ void cGLCD::Exec()
{ {
if (EpgWidth) if (EpgWidth)
{ {
if (scrollEpgForward) { if (scrollEpgForward)
{
if (EpgWidth - scrollEpgSkip < bitmap->Width()) if (EpgWidth - scrollEpgSkip < bitmap->Width())
scrollEpgForward = false; scrollEpgForward = false;
} else if (scrollEpgSkip <= 0) { }
else if (scrollEpgSkip <= 0)
{
scrollEpgSkip = 0; scrollEpgSkip = 0;
doScrollEpg = false; doScrollEpg = false;
} }
@@ -383,7 +398,8 @@ void cGLCD::Exec()
if (scrollEpgOffset < 0) if (scrollEpgOffset < 0)
scrollEpgOffset = 0; scrollEpgOffset = 0;
if (scrollEpgOffset == 0) { if (scrollEpgOffset == 0)
{
if (scrollEpgForward) if (scrollEpgForward)
scrollEpgSkip += g_settings.glcd_scroll_speed; scrollEpgSkip += g_settings.glcd_scroll_speed;
else else
@@ -446,14 +462,15 @@ void cGLCD::Exec()
Lock(); Lock();
End = stagingEnd; End = stagingEnd;
EndWidth = font_end.Width(End); EndWidth = font_end.Width(End);
Unlock(); Unlock();
drawText(t.glcd_end_x_position, drawText(t.glcd_end_x_position,
t.glcd_end_y_position, bitmap->Width() - 1, EndWidth, End, t.glcd_end_y_position, bitmap->Width() - 1, EndWidth, End,
&font_end, ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent, true, 0, t.glcd_end_align); &font_end, ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent, true, 0, t.glcd_end_align);
} }
if (percent_smalltext && !doStandby) { if (percent_smalltext && !doStandby)
{
Lock(); Lock();
SmalltextWidth = font_smalltext.Width(Smalltext); SmalltextWidth = font_smalltext.Width(Smalltext);
Unlock(); Unlock();
@@ -473,11 +490,14 @@ void cGLCD::Exec()
if (t.glcd_icon_rec_x_position) if (t.glcd_icon_rec_x_position)
{ {
smalltext = "REC"; smalltext = "REC";
if (recLocked) { if (recLocked)
{
drawText(t.glcd_icon_rec_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_rec_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Red, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Red,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_rec_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_rec_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
@@ -487,11 +507,14 @@ void cGLCD::Exec()
if (t.glcd_icon_mute_x_position) if (t.glcd_icon_mute_x_position)
{ {
smalltext = "MUTE"; smalltext = "MUTE";
if (muteLocked) { if (muteLocked)
{
drawText(t.glcd_icon_mute_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_mute_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Red, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Red,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_mute_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_mute_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
@@ -501,24 +524,48 @@ void cGLCD::Exec()
if (t.glcd_icon_ts_x_position) if (t.glcd_icon_ts_x_position)
{ {
smalltext = "TS"; smalltext = "TS";
if (tsLocked) { if (tsLocked)
{
drawText(t.glcd_icon_ts_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_ts_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Yellow, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Yellow,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_ts_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_ts_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} }
} }
#if 0
if (t.glcd_icon_ecm_x_position)
{
smalltext = "ECM";
if (ecmLocked)
{
drawText(t.glcd_icon_ecm_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
GLCD::cColor::Transparent, true, 0, 0);
}
else
{
drawText(t.glcd_icon_ecm_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0);
}
}
#endif
if (t.glcd_icon_timer_x_position) if (t.glcd_icon_timer_x_position)
{ {
smalltext = "TIMER"; smalltext = "TIMER";
if (timerLocked) { if (timerLocked)
{
drawText(t.glcd_icon_timer_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_timer_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Yellow, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Yellow,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_timer_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_timer_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
@@ -528,11 +575,14 @@ void cGLCD::Exec()
if (t.glcd_icon_dd_x_position) if (t.glcd_icon_dd_x_position)
{ {
smalltext = "DD"; smalltext = "DD";
if (ddLocked) { if (ddLocked)
{
drawText(t.glcd_icon_dd_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_dd_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_dd_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_dd_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
@@ -541,24 +591,33 @@ void cGLCD::Exec()
if (t.glcd_icon_txt_x_position) if (t.glcd_icon_txt_x_position)
{ {
if (ismediaplayer) { if (ismediaplayer)
{
smalltext = "SUB"; smalltext = "SUB";
if (subLocked) { if (subLocked)
{
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} }
} else { }
else
{
smalltext = "TXT"; smalltext = "TXT";
if (txtLocked) { if (txtLocked)
{
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_txt_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
@@ -569,11 +628,14 @@ void cGLCD::Exec()
if (t.glcd_icon_cam_x_position) if (t.glcd_icon_cam_x_position)
{ {
smalltext = "CAM"; smalltext = "CAM";
if (camLocked) { if (camLocked)
{
drawText(t.glcd_icon_cam_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_cam_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Green,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
} else { }
else
{
drawText(t.glcd_icon_cam_x_position, t.glcd_icons_y_position, drawText(t.glcd_icon_cam_x_position, t.glcd_icons_y_position,
bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray, bitmap->Width() - 1, SmalltextWidth, smalltext, &font_smalltext, GLCD::cColor::Gray,
GLCD::cColor::Transparent, true, 0, 0); GLCD::cColor::Transparent, true, 0, 0);
@@ -609,55 +671,69 @@ void cGLCD::updateFonts()
int fontsize_end_new = percent_end * cglcd->lcd->Height() / 100; int fontsize_end_new = percent_end * cglcd->lcd->Height() / 100;
int fontsize_smalltext_new = percent_smalltext * cglcd->lcd->Height() / 100; int fontsize_smalltext_new = percent_smalltext * cglcd->lcd->Height() / 100;
if (!fonts_initialized || (fontsize_channel_new != fontsize_channel)) { if (!fonts_initialized || (fontsize_channel_new != fontsize_channel))
{
fontsize_channel = fontsize_channel_new; fontsize_channel = fontsize_channel_new;
if (!font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel)) { if (!font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel); font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel);
} }
} }
if (!fonts_initialized || (fontsize_epg_new != fontsize_epg)) { if (!fonts_initialized || (fontsize_epg_new != fontsize_epg))
{
fontsize_epg = fontsize_epg_new; fontsize_epg = fontsize_epg_new;
if (!font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg)) { if (!font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg); font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg);
} }
} }
if (!fonts_initialized || (fontsize_time_new != fontsize_time)) { if (!fonts_initialized || (fontsize_time_new != fontsize_time))
{
fontsize_time = fontsize_time_new; fontsize_time = fontsize_time_new;
if (!font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time)) { if (!font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time); font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time);
} }
} }
if (!fonts_initialized || (fontsize_duration_new != fontsize_duration)) { if (!fonts_initialized || (fontsize_duration_new != fontsize_duration))
{
fontsize_duration = fontsize_duration_new; fontsize_duration = fontsize_duration_new;
if (!font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration)) { if (!font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration); font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration);
} }
} }
if (!fonts_initialized || (fontsize_start_new != fontsize_start)) { if (!fonts_initialized || (fontsize_start_new != fontsize_start))
{
fontsize_start = fontsize_start_new; fontsize_start = fontsize_start_new;
if (!font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start)) { if (!font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start); font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start);
} }
} }
if (!fonts_initialized || (fontsize_end_new != fontsize_end)) { if (!fonts_initialized || (fontsize_end_new != fontsize_end))
{
fontsize_end = fontsize_end_new; fontsize_end = fontsize_end_new;
if (!font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end)) { if (!font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end); font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end);
} }
} }
if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext)) { if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext))
{
fontsize_smalltext = fontsize_smalltext_new; fontsize_smalltext = fontsize_smalltext_new;
if (!font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext)) { if (!font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext))
{
t.glcd_font = g_settings.font_file; t.glcd_font = g_settings.font_file;
font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext); font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext);
} }
@@ -670,7 +746,8 @@ void cGLCD::updateFonts()
bool cGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, int &bb_y, int &bb_w, int &bb_h) bool cGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, int &bb_y, int &bb_w, int &bb_h)
{ {
if (!width || !height) { if (!width || !height)
{
bb_x = bb_y = bb_w = bb_h = 0; bb_x = bb_y = bb_w = bb_h = 0;
return false; return false;
} }
@@ -679,7 +756,8 @@ bool cGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, i
uint32_t *b = buffer; uint32_t *b = buffer;
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++, b++) for (int x = 0; x < width; x++, b++)
if (*b) { if (*b)
{
y_min = y; y_min = y;
goto out1; goto out1;
} }
@@ -688,26 +766,31 @@ out1:
b = buffer + height * width - 1; b = buffer + height * width - 1;
for (int y = height - 1; y_min < y; y--) for (int y = height - 1; y_min < y; y--)
for (int x = 0; x < width; x++, b--) for (int x = 0; x < width; x++, b--)
if (*b) { if (*b)
{
y_max = y; y_max = y;
goto out2; goto out2;
} }
out2: out2:
int x_min = width; int x_min = width;
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++)
{
b = buffer + x + y_min * width; b = buffer + x + y_min * width;
for (int y = y_min; y < y_max; y++, b += width) for (int y = y_min; y < y_max; y++, b += width)
if (*b) { if (*b)
{
x_min = x; x_min = x;
goto out3; goto out3;
} }
} }
out3: out3:
int x_max = x_min; int x_max = x_min;
for (int x = width - 1; x_min < x; x--) { for (int x = width - 1; x_min < x; x--)
{
b = buffer + x + y_min * width; b = buffer + x + y_min * width;
for (int y = y_min; y < y_max; y++, b += width) for (int y = y_min; y < y_max; y++, b += width)
if (*b) { if (*b)
{
x_max = x; x_max = x;
goto out4; goto out4;
} }
@@ -726,7 +809,7 @@ out4:
return true; return true;
} }
void* cGLCD::Run(void *arg) void *cGLCD::Run(void *arg)
{ {
cGLCD *me = (cGLCD *)arg; cGLCD *me = (cGLCD *)arg;
me->Run(); me->Run();
@@ -757,7 +840,7 @@ void cGLCD::WakeUp()
} }
} }
void* cGLCD::TimeThread(void *p) void *cGLCD::TimeThread(void *p)
{ {
set_threadname("cGLCD:Time"); set_threadname("cGLCD:Time");
((cGLCD *)p)->time_thread_started = true; ((cGLCD *)p)->time_thread_started = true;
@@ -765,23 +848,23 @@ void* cGLCD::TimeThread(void *p)
{ {
sleep(1); sleep(1);
if (!cglcd->doExit && ( if (!cglcd->doExit && (
cglcd->locked_countdown == true cglcd->locked_countdown == true
|| cglcd->channelLocked == true || cglcd->channelLocked == true
|| cglcd->timeLocked == true || cglcd->timeLocked == true
|| cglcd->durationLocked == true || cglcd->durationLocked == true
|| cglcd->startLocked == true || cglcd->startLocked == true
|| cglcd->endLocked == true || cglcd->endLocked == true
|| cglcd->recLocked == true || cglcd->recLocked == true
|| cglcd->muteLocked == true || cglcd->muteLocked == true
|| cglcd->tsLocked == true || cglcd->tsLocked == true
|| cglcd->ecmLocked == true || cglcd->ecmLocked == true
|| cglcd->timerLocked == true || cglcd->timerLocked == true
|| cglcd->ddLocked == true || cglcd->ddLocked == true
|| cglcd->txtLocked == true || cglcd->txtLocked == true
|| cglcd->camLocked == true || cglcd->camLocked == true
|| cglcd->doShowVolume == true || cglcd->doShowVolume == true
|| cglcd->doMirrorOSD == true || cglcd->doMirrorOSD == true
)) ))
{ {
cGLCD::getInstance()->CountDown(); cGLCD::getInstance()->CountDown();
} }
@@ -833,9 +916,10 @@ void cGLCD::Run(void)
break; break;
if (!g_settings.glcd_enable) if (!g_settings.glcd_enable)
continue; continue;
} else }
while ((doSuspend || doStandby || !g_settings.glcd_enable) && !doExit) else
sem_wait(&sem); while ((doSuspend || doStandby || !g_settings.glcd_enable) && !doExit)
sem_wait(&sem);
if (doExit) if (doExit)
break; break;
@@ -846,7 +930,8 @@ void cGLCD::Run(void)
g_settings.glcd_selected_config = 0; g_settings.glcd_selected_config = 0;
lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[g_settings.glcd_selected_config].id, &GLCD::Config.driverConfigs[g_settings.glcd_selected_config]); lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[g_settings.glcd_selected_config].id, &GLCD::Config.driverConfigs[g_settings.glcd_selected_config]);
if (!lcd) { if (!lcd)
{
#ifdef GLCD_DEBUG #ifdef GLCD_DEBUG
fprintf(stderr, "CreateDriver failed.\n"); fprintf(stderr, "CreateDriver failed.\n");
#endif #endif
@@ -888,13 +973,13 @@ void cGLCD::Run(void)
blitFlag = false; blitFlag = false;
bitmap->Clear(GLCD::cColor::Black); bitmap->Clear(GLCD::cColor::Black);
ts.tv_sec = 0; // don't wait ts.tv_sec = 0; // don't wait
static CFrameBuffer* fb = CFrameBuffer::getInstance(); static CFrameBuffer *fb = CFrameBuffer::getInstance();
static int fb_height = fb->getScreenHeight(true); static int fb_height = fb->getScreenHeight(true);
static uint32_t *fbp = fb->getFrameBufferPointer(); static uint32_t *fbp = fb->getFrameBufferPointer();
int lcd_width = bitmap->Width(); int lcd_width = bitmap->Width();
int lcd_height = bitmap->Height(); int lcd_height = bitmap->Height();
#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUDUO4KSE ||BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE #if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUDUO4KSE || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE
unsigned int fb_stride = fb->getStride()/4; unsigned int fb_stride = fb->getStride() / 4;
if (!showImage(fbp, fb_stride, fb_height, 0, 0, lcd_width, lcd_height, false, false)) if (!showImage(fbp, fb_stride, fb_height, 0, 0, lcd_width, lcd_height, false, false))
{ {
#else #else
@@ -917,7 +1002,7 @@ void cGLCD::Run(void)
if (g_settings.glcd_mirror_video && !doStandbyTime && !doStandbyWeather) if (g_settings.glcd_mirror_video && !doStandbyTime && !doStandbyWeather)
{ {
#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUDUO4KSE ||BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE #if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUDUO4KSE || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE
lcd->SetMirrorVideo(true); lcd->SetMirrorVideo(true);
#else #else
char ws[10]; char ws[10];
@@ -945,7 +1030,7 @@ void cGLCD::Run(void)
continue; continue;
#endif #endif
} }
#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUDUO4KSE ||BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE #if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUDUO4KSE || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE
else else
lcd->SetMirrorVideo(false); lcd->SetMirrorVideo(false);
#endif #endif
@@ -970,9 +1055,9 @@ void cGLCD::Run(void)
if (!doScrollChannel && !doScrollEpg) if (!doScrollChannel && !doScrollEpg)
sem_timedwait(&sem, &ts); sem_timedwait(&sem, &ts);
while(!sem_trywait(&sem)); while (!sem_trywait(&sem));
if(doRescan || doSuspend || doStandby || doExit) if (doRescan || doSuspend || doStandby || doExit)
break; break;
if (doShowVolume) if (doShowVolume)
@@ -987,8 +1072,9 @@ void cGLCD::Run(void)
doScrollEpg = EpgWidth > bitmap->Width(); doScrollEpg = EpgWidth > bitmap->Width();
scrollEpgSkip = 0; scrollEpgSkip = 0;
scrollEpgForward = true; scrollEpgForward = true;
if (doScrollEpg) { if (doScrollEpg)
scrollEpgOffset = bitmap->Width()/4; {
scrollEpgOffset = bitmap->Width() / 4;
EpgWidth += scrollEpgOffset; EpgWidth += scrollEpgOffset;
} }
else else
@@ -999,7 +1085,9 @@ void cGLCD::Run(void)
scrollChannelForward = true; scrollChannelForward = true;
Scale = g_settings.current_volume; Scale = g_settings.current_volume;
//epg_id = -1; //epg_id = -1;
} else { }
else
{
Epg = ""; Epg = "";
if (Channel.compare(g_Locale->getText(LOCALE_GLCD_VOLUME))) if (Channel.compare(g_Locale->getText(LOCALE_GLCD_VOLUME)))
{ {
@@ -1008,8 +1096,9 @@ void cGLCD::Run(void)
doScrollChannel = ChannelWidth > bitmap->Width(); doScrollChannel = ChannelWidth > bitmap->Width();
scrollChannelForward = true; scrollChannelForward = true;
scrollChannelSkip = 0; scrollChannelSkip = 0;
if (doScrollChannel) { if (doScrollChannel)
scrollChannelOffset = bitmap->Width()/4; {
scrollChannelOffset = bitmap->Width() / 4;
ChannelWidth += scrollChannelOffset; ChannelWidth += scrollChannelOffset;
} }
else else
@@ -1034,7 +1123,7 @@ void cGLCD::Run(void)
scrollEpgSkip = 0; scrollEpgSkip = 0;
if (doScrollEpg) if (doScrollEpg)
{ {
scrollEpgOffset = bitmap->Width()/4; scrollEpgOffset = bitmap->Width() / 4;
EpgWidth += scrollEpgOffset; EpgWidth += scrollEpgOffset;
} }
else else
@@ -1049,7 +1138,7 @@ void cGLCD::Run(void)
scrollChannelSkip = 0; scrollChannelSkip = 0;
if (doScrollChannel) if (doScrollChannel)
{ {
scrollChannelOffset = bitmap->Width()/4; scrollChannelOffset = bitmap->Width() / 4;
ChannelWidth += scrollChannelOffset; ChannelWidth += scrollChannelOffset;
} }
else else
@@ -1060,7 +1149,7 @@ void cGLCD::Run(void)
} }
else else
{ {
CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; CChannelList *channelList = CNeutrinoApp::getInstance()->channelList;
if (!channelList) if (!channelList)
continue; continue;
t_channel_id new_channel_id = channelList->getActiveChannel_ChannelID(); t_channel_id new_channel_id = channelList->getActiveChannel_ChannelID();
@@ -1069,7 +1158,7 @@ void cGLCD::Run(void)
if ((new_channel_id != channel_id)) if ((new_channel_id != channel_id))
{ {
Channel = channelList->getActiveChannelName (); Channel = channelList->getActiveChannelName();
ChannelWidth = font_channel.Width(Channel); ChannelWidth = font_channel.Width(Channel);
epg_id = channelList->getActiveChannel()->getEpgID(); epg_id = channelList->getActiveChannel()->getEpgID();
Epg = ""; Epg = "";
@@ -1079,8 +1168,9 @@ void cGLCD::Run(void)
doScrollChannel = ChannelWidth > bitmap->Width(); doScrollChannel = ChannelWidth > bitmap->Width();
scrollChannelForward = true; scrollChannelForward = true;
scrollChannelSkip = 0; scrollChannelSkip = 0;
if (doScrollChannel) { if (doScrollChannel)
scrollChannelOffset = bitmap->Width()/4; {
scrollChannelOffset = bitmap->Width() / 4;
ChannelWidth += scrollChannelOffset; ChannelWidth += scrollChannelOffset;
} }
else else
@@ -1102,9 +1192,10 @@ void cGLCD::Run(void)
scrollEpgSkip = 0; scrollEpgSkip = 0;
if (doScrollEpg) if (doScrollEpg)
{ {
scrollEpgOffset = bitmap->Width()/4; scrollEpgOffset = bitmap->Width() / 4;
EpgWidth += scrollEpgOffset; EpgWidth += scrollEpgOffset;
} else }
else
scrollEpgOffset = 0; scrollEpgOffset = 0;
} }
@@ -1163,9 +1254,10 @@ void cGLCD::Run(void)
scrollEpgSkip = 0; scrollEpgSkip = 0;
if (doScrollEpg) if (doScrollEpg)
{ {
scrollEpgOffset = bitmap->Width()/4; scrollEpgOffset = bitmap->Width() / 4;
EpgWidth += scrollEpgOffset; EpgWidth += scrollEpgOffset;
} else }
else
scrollEpgOffset = 0; scrollEpgOffset = 0;
} }
} }
@@ -1205,7 +1297,8 @@ void cGLCD::Run(void)
lcd->DeInit(); lcd->DeInit();
delete lcd; delete lcd;
lcd = NULL; lcd = NULL;
} while(!doExit); }
while (!doExit);
} }
void cGLCD::Update() void cGLCD::Update()
@@ -1335,7 +1428,7 @@ void cGLCD::Resume()
void cGLCD::lockChannel(std::string c, std::string e, int s) void cGLCD::lockChannel(std::string c, std::string e, int s)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->Lock(); cglcd->Lock();
cglcd->channelLocked = true; cglcd->channelLocked = true;
@@ -1349,7 +1442,7 @@ void cGLCD::lockChannel(std::string c, std::string e, int s)
void cGLCD::unlockChannel(void) void cGLCD::unlockChannel(void)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->channelLocked = false; cglcd->channelLocked = false;
cglcd->Update(); cglcd->Update();
@@ -1358,7 +1451,7 @@ void cGLCD::unlockChannel(void)
void cGLCD::lockTime(std::string t) void cGLCD::lockTime(std::string t)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->Lock(); cglcd->Lock();
cglcd->timeLocked = true; cglcd->timeLocked = true;
@@ -1370,7 +1463,7 @@ void cGLCD::lockTime(std::string t)
void cGLCD::unlockTime(void) void cGLCD::unlockTime(void)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->timeLocked = false; cglcd->timeLocked = false;
cglcd->Update(); cglcd->Update();
@@ -1379,7 +1472,7 @@ void cGLCD::unlockTime(void)
void cGLCD::lockDuration(std::string t) void cGLCD::lockDuration(std::string t)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->Lock(); cglcd->Lock();
cglcd->durationLocked = true; cglcd->durationLocked = true;
@@ -1391,7 +1484,7 @@ void cGLCD::lockDuration(std::string t)
void cGLCD::unlockDuration(void) void cGLCD::unlockDuration(void)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->durationLocked = false; cglcd->durationLocked = false;
cglcd->Update(); cglcd->Update();
@@ -1400,7 +1493,7 @@ void cGLCD::unlockDuration(void)
void cGLCD::lockStart(std::string t) void cGLCD::lockStart(std::string t)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->Lock(); cglcd->Lock();
cglcd->startLocked = true; cglcd->startLocked = true;
@@ -1412,7 +1505,7 @@ void cGLCD::lockStart(std::string t)
void cGLCD::unlockStart(void) void cGLCD::unlockStart(void)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->startLocked = false; cglcd->startLocked = false;
cglcd->Update(); cglcd->Update();
@@ -1421,7 +1514,7 @@ void cGLCD::unlockStart(void)
void cGLCD::lockEnd(std::string t) void cGLCD::lockEnd(std::string t)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->Lock(); cglcd->Lock();
cglcd->endLocked = true; cglcd->endLocked = true;
@@ -1433,7 +1526,7 @@ void cGLCD::lockEnd(std::string t)
void cGLCD::unlockEnd(void) void cGLCD::unlockEnd(void)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->endLocked = false; cglcd->endLocked = false;
cglcd->Update(); cglcd->Update();
@@ -1442,7 +1535,7 @@ void cGLCD::unlockEnd(void)
void cGLCD::lockIcon(int type) void cGLCD::lockIcon(int type)
{ {
if(cglcd) if (cglcd)
{ {
cglcd->Lock(); cglcd->Lock();
if (type == REC) if (type == REC)
@@ -1470,7 +1563,7 @@ void cGLCD::lockIcon(int type)
void cGLCD::unlockIcon(int type) void cGLCD::unlockIcon(int type)
{ {
if(cglcd) if (cglcd)
{ {
if (type == REC) if (type == REC)
cglcd->recLocked = false; cglcd->recLocked = false;
@@ -1497,10 +1590,12 @@ void cGLCD::unlockIcon(int type)
bool cGLCD::showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress) bool cGLCD::showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress)
{ {
cglcd->bitmap->DrawRectangle(x1, y1, x1 + (x2 - x1 - 1), y2, color_border, false); cglcd->bitmap->DrawRectangle(x1, y1, x1 + (x2 - x1 - 1), y2, color_border, false);
if (scale) { if (scale)
{
cglcd->bitmap->DrawRectangle(x1 + 1, y1 + 1, x1 + (scale * (x2 - x1 - 1) / 100), y2 - 1, color_progress, true); cglcd->bitmap->DrawRectangle(x1 + 1, y1 + 1, x1 + (scale * (x2 - x1 - 1) / 100), y2 - 1, color_progress, true);
return true; return true;
} else }
else
return false; return false;
} }
@@ -1517,7 +1612,9 @@ bool cGLCD::showImage(fb_pixel_t *s, uint32_t sw, uint32_t sh, uint32_t dx, uint
uint32_t dw_new = dh * bb_w / bb_h; uint32_t dw_new = dh * bb_w / bb_h;
dx += (dw - dw_new) >> 1; dx += (dw - dw_new) >> 1;
dw = dw_new; dw = dw_new;
} else { }
else
{
uint32_t dh_new = dw * bb_h / bb_w; uint32_t dh_new = dw * bb_h / bb_w;
dy += (dh - dh_new) >> 1; dy += (dh - dh_new) >> 1;
dh = dh_new; dh = dh_new;
@@ -1537,7 +1634,7 @@ bool cGLCD::showImage(fb_pixel_t *s, uint32_t sw, uint32_t sh, uint32_t dx, uint
return false; return false;
} }
bool cGLCD::showImage(const std::string & filename, uint32_t sw, uint32_t sh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) bool cGLCD::showImage(const std::string &filename, uint32_t sw, uint32_t sh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize)
{ {
bool res = false; bool res = false;
if (!dw || !dh) if (!dw || !dh)
@@ -1562,7 +1659,7 @@ bool cGLCD::showImage(uint64_t cid, std::string cname, uint32_t dx, uint32_t dy,
return false; return false;
} }
bool cGLCD::imageShow(const std::string & filename, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize, bool clear, bool center_sw, bool center_sh) bool cGLCD::imageShow(const std::string &filename, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize, bool clear, bool center_sw, bool center_sh)
{ {
bool ret = false; bool ret = false;
int sw, sh; int sw, sh;
@@ -1574,34 +1671,32 @@ bool cGLCD::imageShow(const std::string & filename, uint32_t dx, uint32_t dy, ui
cglcd->bitmap->Clear(GLCD::cColor::Black); cglcd->bitmap->Clear(GLCD::cColor::Black);
if (maximize) if (maximize)
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) cglcd->bitmap->Width(), (uint32_t) cglcd->bitmap->Height(), transp, false); ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) cglcd->bitmap->Width(), (uint32_t) cglcd->bitmap->Height(), transp, false);
else else if (center_sw || center_sh)
if (center_sw || center_sh) {
{ int move_sw = 0;
int move_sw = 0; int move_sh = 0;
int move_sh = 0; if (center_sw)
if (center_sw) move_sw = dx - (sw / 2);
move_sw = dx - (sw / 2);
else
move_sw = dx;
if (center_sh)
move_sh = dy - (sh / 2);
else
move_sh = dy;
if (dw > 0 && dh > 0)
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) dw, (uint32_t) dh, transp, false);
else
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) sw, (uint32_t) sh, transp, false);
}
else else
if (dw > 0 && dh > 0) move_sw = dx;
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) dw, (uint32_t) dh, transp, false); if (center_sh)
else move_sh = dy - (sh / 2);
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) sw, (uint32_t) sh, transp, false); else
move_sh = dy;
if (dw > 0 && dh > 0)
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) dw, (uint32_t) dh, transp, false);
else
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) sw, (uint32_t) sh, transp, false);
}
else if (dw > 0 && dh > 0)
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) dw, (uint32_t) dh, transp, false);
else
ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) sw, (uint32_t) sh, transp, false);
} }
return ret; return ret;
} }
bool cGLCD::drawText(int x, int y, int xmax, int text_width, const std::string & text, const GLCD::cFont * font, uint32_t color1, uint32_t color2, bool proportional, int skipPixels, int align) bool cGLCD::drawText(int x, int y, int xmax, int text_width, const std::string &text, const GLCD::cFont *font, uint32_t color1, uint32_t color2, bool proportional, int skipPixels, int align)
{ {
int z = 0; int z = 0;
int offset = 10; // px int offset = 10; // px
@@ -1641,32 +1736,45 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
if (!fd) if (!fd)
return false; return false;
if(cglcd) if (cglcd)
cglcd->Lock(); cglcd->Lock();
if (format == BMP) { if (format == BMP)
{
// write bmp // write bmp
unsigned char hdr[14 + 40]; unsigned char hdr[14 + 40];
int i = 0; int i = 0;
#define PUT32(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); hdr[i++] = (((x)>>16)&0xFF); hdr[i++] = (((x)>>24)&0xFF); #define PUT32(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); hdr[i++] = (((x)>>16)&0xFF); hdr[i++] = (((x)>>24)&0xFF);
#define PUT16(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); #define PUT16(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF);
#define PUT8(x) hdr[i++] = ((x)&0xFF); #define PUT8(x) hdr[i++] = ((x)&0xFF);
PUT8('B'); PUT8('M'); PUT8('B');
PUT32((((xres * yres) * 3 + 3) &~ 3) + 14 + 40); PUT8('M');
PUT16(0); PUT16(0); PUT32(14 + 40); PUT32((((xres * yres) * 3 + 3) & ~ 3) + 14 + 40);
PUT32(40); PUT32(xres); PUT32(yres); PUT16(0);
PUT16(0);
PUT32(14 + 40);
PUT32(40);
PUT32(xres);
PUT32(yres);
PUT16(1); PUT16(1);
PUT16(output_bytes*8); // bits PUT16(output_bytes * 8); // bits
PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0);
PUT32(0);
PUT32(0);
PUT32(0);
PUT32(0);
PUT32(0);
#undef PUT32 #undef PUT32
#undef PUT16 #undef PUT16
#undef PUT8 #undef PUT8
fwrite(hdr, 1, i, fd); fwrite(hdr, 1, i, fd);
int y; int y;
for (y=yres-1; y>=0 ; y-=1) for (y = yres - 1; y >= 0 ; y -= 1)
fwrite(output + (y * xres * output_bytes), xres * output_bytes, 1, fd); fwrite(output + (y * xres * output_bytes), xres * output_bytes, 1, fd);
} else if (format == JPG) { }
else if (format == JPG)
{
const int row_stride = xres * output_bytes; const int row_stride = xres * output_bytes;
// write jpg // write jpg
if (output_bytes == 3) // swap bgr<->rgb if (output_bytes == 3) // swap bgr<->rgb
@@ -1693,7 +1801,7 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
{ {
unsigned char *scanline = output + (y * row_stride); unsigned char *scanline = output + (y * row_stride);
int x; int x;
for (x=0; x<xres; x++) for (x = 0; x < xres; x++)
{ {
const int xs = x * 4; const int xs = x * 4;
const int xd = x * 3; const int xd = x * 3;
@@ -1717,7 +1825,7 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
cinfo.in_color_space = JCS_RGB; cinfo.in_color_space = JCS_RGB;
cinfo.dct_method = JDCT_IFAST; cinfo.dct_method = JDCT_IFAST;
jpeg_set_defaults(&cinfo); jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo,jpg_quality, TRUE); jpeg_set_quality(&cinfo, jpg_quality, TRUE);
jpeg_start_compress(&cinfo, TRUE); jpeg_start_compress(&cinfo, TRUE);
while (cinfo.next_scanline < cinfo.image_height) while (cinfo.next_scanline < cinfo.image_height)
{ {
@@ -1726,7 +1834,9 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
} }
jpeg_finish_compress(&cinfo); jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo); jpeg_destroy_compress(&cinfo);
} else if (format == PNG) { }
else if (format == PNG)
{
// write png // write png
png_bytep *row_pointers; png_bytep *row_pointers;
png_structp png_ptr; png_structp png_ptr;
@@ -1736,15 +1846,15 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
info_ptr = png_create_info_struct(png_ptr); info_ptr = png_create_info_struct(png_ptr);
png_init_io(png_ptr, fd); png_init_io(png_ptr, fd);
row_pointers=(png_bytep*)malloc(sizeof(png_bytep)*yres); row_pointers = (png_bytep *)malloc(sizeof(png_bytep) * yres);
int y; int y;
//#pragma omp parallel for shared(output) //#pragma omp parallel for shared(output)
for (y=0; y<yres; y++) for (y = 0; y < yres; y++)
row_pointers[y]=output+(y*xres*output_bytes); row_pointers[y] = output + (y * xres * output_bytes);
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
png_set_IHDR(png_ptr, info_ptr, xres, yres, 8, ((output_bytes<4)?PNG_COLOR_TYPE_RGB:PNG_COLOR_TYPE_RGBA) , PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); png_set_IHDR(png_ptr, info_ptr, xres, yres, 8, ((output_bytes < 4) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGBA), PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_set_compression_level(png_ptr, Z_BEST_SPEED); png_set_compression_level(png_ptr, Z_BEST_SPEED);
png_write_info(png_ptr, info_ptr); png_write_info(png_ptr, info_ptr);
png_write_image(png_ptr, row_pointers); png_write_image(png_ptr, row_pointers);
@@ -1754,7 +1864,7 @@ bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename)
free(row_pointers); free(row_pointers);
} }
if(cglcd) if (cglcd)
cglcd->Unlock(); cglcd->Unlock();
fclose(fd); fclose(fd);
@@ -1770,9 +1880,9 @@ void cGLCD::UpdateBrightness()
if (cglcd && cglcd->lcd) if (cglcd && cglcd->lcd)
{ {
if (timeouted && !cglcd->doStandbyTime && !cglcd->doStandbyWeather) if (timeouted && !cglcd->doStandbyTime && !cglcd->doStandbyWeather)
cglcd->lcd->SetBrightness((unsigned int) (dim_brightness)); cglcd->lcd->SetBrightness((unsigned int)(dim_brightness));
else else
cglcd->lcd->SetBrightness((unsigned int) ((cglcd->doStandbyTime || cglcd->doStandbyWeather) ? g_settings.glcd_brightness_standby : g_settings.glcd_brightness)); cglcd->lcd->SetBrightness((unsigned int)((cglcd->doStandbyTime || cglcd->doStandbyWeather) ? g_settings.glcd_brightness_standby : g_settings.glcd_brightness));
} }
} }

View File

@@ -138,7 +138,7 @@ class cGLCD
uint32_t sw, uint32_t sh, uint32_t sw, uint32_t sh,
uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh,
bool transp = false, bool maximize = false); bool transp = false, bool maximize = false);
bool showImage(const std::string & filename, bool showImage(const std::string &filename,
uint32_t sw, uint32_t sh, uint32_t sw, uint32_t sh,
uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh,
bool transp = false, bool maximize = false); bool transp = false, bool maximize = false);
@@ -153,23 +153,26 @@ class cGLCD
void WakeUp(); void WakeUp();
static void *TimeThread(void *); static void *TimeThread(void *);
void Run(void); void Run(void);
static void* Run(void *); static void *Run(void *);
static void Lock(); static void Lock();
static void Unlock(); static void Unlock();
bool config_mode; bool config_mode;
public: public:
enum { enum
{
BMP = 0, BMP = 0,
JPG = 1, JPG = 1,
PNG = 2, PNG = 2,
}; };
enum { enum
{
ALIGN_NONE = 0, ALIGN_NONE = 0,
ALIGN_LEFT = 1, ALIGN_LEFT = 1,
ALIGN_CENTER = 2, ALIGN_CENTER = 2,
ALIGN_RIGHT = 3, ALIGN_RIGHT = 3,
}; };
enum { enum
{
REC = 0, REC = 0,
MUTE = 1, MUTE = 1,
TS = 2, TS = 2,
@@ -180,7 +183,8 @@ class cGLCD
SUB = 7, SUB = 7,
CAM = 8, CAM = 8,
}; };
enum { enum
{
CLOCK_OFF = 0, CLOCK_OFF = 0,
CLOCK_SIMPLE = 1, CLOCK_SIMPLE = 1,
CLOCK_LED = 2, CLOCK_LED = 2,
@@ -188,7 +192,7 @@ class cGLCD
CLOCK_DIGITAL = 4, CLOCK_DIGITAL = 4,
CLOCK_ANALOG = 5 CLOCK_ANALOG = 5
}; };
GLCD::cDriver * lcd; GLCD::cDriver *lcd;
GLCD::cFont font_channel; GLCD::cFont font_channel;
GLCD::cFont font_epg; GLCD::cFont font_epg;
GLCD::cFont font_time; GLCD::cFont font_time;
@@ -196,15 +200,15 @@ class cGLCD
GLCD::cFont font_start; GLCD::cFont font_start;
GLCD::cFont font_end; GLCD::cFont font_end;
GLCD::cFont font_smalltext; GLCD::cFont font_smalltext;
GLCD::cBitmap * bitmap; GLCD::cBitmap *bitmap;
cGLCD(); cGLCD();
~cGLCD(); ~cGLCD();
uint32_t ColorConvert3to1(uint32_t red, uint32_t green, uint32_t blue); uint32_t ColorConvert3to1(uint32_t red, uint32_t green, uint32_t blue);
void DeInit(); void DeInit();
void Rescan(); void Rescan();
bool showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress); bool showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress);
bool imageShow(const std::string & filename, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp = false, bool maximize = false, bool clear = false, bool center_sw = false, bool center_sh = false); bool imageShow(const std::string &filename, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp = false, bool maximize = false, bool clear = false, bool center_sw = false, bool center_sh = false);
bool drawText(int x, int y, int xmax, int text_width, const std::string & text, const GLCD::cFont * font, uint32_t color1, uint32_t color2, bool proportional, int skipPixels, int align); bool drawText(int x, int y, int xmax, int text_width, const std::string &text, const GLCD::cFont *font, uint32_t color1, uint32_t color2, bool proportional, int skipPixels, int align);
static cGLCD *getInstance(); static cGLCD *getInstance();
static void lockChannel(std::string txt, std::string epg = "", int scale = 0); static void lockChannel(std::string txt, std::string epg = "", int scale = 0);
static void unlockChannel(); static void unlockChannel();

View File

@@ -20,7 +20,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@@ -53,16 +52,17 @@ void SimpleClockUpdateFonts(int mode)
break; break;
case cGLCD::CLOCK_SIMPLE: case cGLCD::CLOCK_SIMPLE:
default: default:
font = t.glcd_font font = t.glcd_font;
;
} }
int fontsize_time_standby = 0; int fontsize_time_standby = 0;
int percent_time_standby = std::min(t.glcd_standby_clock_simple_size, 100); int percent_time_standby = std::min(t.glcd_standby_clock_simple_size, 100);
int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100;
if (fontsize_time_standby_new != fontsize_time_standby) { if (fontsize_time_standby_new != fontsize_time_standby)
{
fontsize_time_standby = fontsize_time_standby_new; fontsize_time_standby = fontsize_time_standby_new;
if (!font_time_standby.LoadFT2(font, "UTF-8", fontsize_time_standby)) { if (!font_time_standby.LoadFT2(font, "UTF-8", fontsize_time_standby))
{
font_time_standby.LoadFT2(g_settings.font_file, "UTF-8", fontsize_time_standby); font_time_standby.LoadFT2(g_settings.font_file, "UTF-8", fontsize_time_standby);
} }
} }
@@ -74,7 +74,7 @@ void RenderSimpleClock(std::string Time, int x, int y, int mode)
cGLCD *cglcd = cGLCD::getInstance(); cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme; SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
SimpleClockUpdateFonts(mode); SimpleClockUpdateFonts(mode);
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - font_time_standby.Width(Time))/2), cglcd->bitmap->DrawText(std::max(2, (cglcd->bitmap->Width() - 4 - font_time_standby.Width(Time)) / 2),
y, cglcd->bitmap->Width() - 1, Time, y, cglcd->bitmap->Width() - 1, Time,
&font_time_standby, cglcd->ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent); &font_time_standby, cglcd->ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent);
} }

View File

@@ -1,26 +1,24 @@
/* /*
LCD-Daemon - DBoxII-Project LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
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.
License: GPL 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.
This program is free software; you can redistribute it and/or modify You should have received a copy of the GNU General Public License
it under the terms of the GNU General Public License as published by along with this program; if not, write to the Free Software
the Free Software Foundation; either version 2 of the License, or Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(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.
*/ */
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"

View File

@@ -1,26 +1,25 @@
/* /*
weather - DBoxII-Project weather - DBoxII-Project
Copyright (C) 2018 redblue Copyright (C) 2018 redblue
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
#include <cstdio> #include <cstdio>
#include "weather.h" #include "weather.h"
@@ -62,16 +61,20 @@ void WeatherUpdateFonts()
standby_weather_percent = std::min(t.glcd_standby_weather_percent, 100); standby_weather_percent = std::min(t.glcd_standby_weather_percent, 100);
int standby_weather_fontsize_new = standby_weather_percent * cglcd->lcd->Height() / 100; int standby_weather_fontsize_new = standby_weather_percent * cglcd->lcd->Height() / 100;
if (!fonts_initialized || (weather_fontsize_new != weather_fontsize)) { if (!fonts_initialized || (weather_fontsize_new != weather_fontsize))
{
weather_fontsize = weather_fontsize_new; weather_fontsize = weather_fontsize_new;
if (!font_temperature.LoadFT2(t.glcd_font, "UTF-8", weather_fontsize)) { if (!font_temperature.LoadFT2(t.glcd_font, "UTF-8", weather_fontsize))
{
font_temperature.LoadFT2(g_settings.font_file, "UTF-8", weather_fontsize); font_temperature.LoadFT2(g_settings.font_file, "UTF-8", weather_fontsize);
} }
} }
if (!fonts_initialized || (standby_weather_fontsize_new != standby_weather_fontsize)) { if (!fonts_initialized || (standby_weather_fontsize_new != standby_weather_fontsize))
{
standby_weather_fontsize = standby_weather_fontsize_new; standby_weather_fontsize = standby_weather_fontsize_new;
if (!font_temperature_standby.LoadFT2(t.glcd_font, "UTF-8", standby_weather_fontsize)) { if (!font_temperature_standby.LoadFT2(t.glcd_font, "UTF-8", standby_weather_fontsize))
{
font_temperature_standby.LoadFT2(g_settings.font_file, "UTF-8", standby_weather_fontsize); font_temperature_standby.LoadFT2(g_settings.font_file, "UTF-8", standby_weather_fontsize);
} }
} }

View File

@@ -1,26 +1,24 @@
/* /*
LCD-Daemon - DBoxII-Project LCD-Daemon - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
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.
License: GPL 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.
This program is free software; you can redistribute it and/or modify You should have received a copy of the GNU General Public License
it under the terms of the GNU General Public License as published by along with this program; if not, write to the Free Software
the Free Software Foundation; either version 2 of the License, or Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(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.
*/ */
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"