Feature #161 ยป imonlcd-0.0.2-twolinemode.patch
imonlcd-0.0.2/imon.c 2009-09-24 07:21:47.000000000 +0200 | ||
---|---|---|
ciMonFont* tmpFont = NULL;
|
||
cString sFileName = cFont::GetFontFileName(szFont);
|
||
if(!isempty(sFileName)) {
|
||
tmpFont = new ciMonFont(sFileName,12,11);
|
||
if(!isempty(sFileName))
|
||
{
|
||
if (theSetup.m_bTwoLineMode)
|
||
{
|
||
tmpFont = new ciMonFont(sFileName,6,8);
|
||
} else {
|
||
tmpFont = new ciMonFont(sFileName,12,11);
|
||
}
|
||
} else {
|
||
esyslog("iMonLCD: unable to find file for font '%s'",szFont);
|
||
}
|
imonlcd-0.0.2/setup.c 2009-09-24 07:23:38.000000000 +0200 | ||
---|---|---|
#define DEFAULT_HEIGHT 16
|
||
#define DEFAULT_FONT "Sans:Bold"
|
||
#define DEFAULT_WAKEUP 5
|
||
#define DEFAULT_TWO_LINE_MODE false
|
||
/// The one and only Stored setup data
|
||
cIMonSetup theSetup;
|
||
... | ... | |
m_nHeight = DEFAULT_HEIGHT;
|
||
m_nWakeup = DEFAULT_WAKEUP;
|
||
m_bTwoLineMode = DEFAULT_TWO_LINE_MODE;
|
||
strncpy(m_szFont,DEFAULT_FONT,sizeof(m_szFont));
|
||
}
|
||
... | ... | |
m_nHeight = x.m_nHeight;
|
||
m_nWakeup = x.m_nWakeup;
|
||
m_bTwoLineMode = x.m_bTwoLineMode;
|
||
strncpy(m_szFont,x.m_szFont,sizeof(m_szFont));
|
||
... | ... | |
m_nWakeup = n;
|
||
return true;
|
||
}
|
||
// Two Line Mode
|
||
// TODO: support different types to enable/disable (Yes, No, true, false, 0,1)
|
||
if(!strcasecmp(szName, "TwoLineMode")) {
|
||
int n = atoi(szValue);
|
||
if ((n != 0) && (n != 1))
|
||
{
|
||
esyslog("iMonLCD: TwoLineMode must be 0 or 1. Setting %d", DEFAULT_TWO_LINE_MODE );
|
||
n = DEFAULT_TWO_LINE_MODE;
|
||
}
|
||
if (n) {
|
||
m_bTwoLineMode = true;
|
||
} else {
|
||
m_bTwoLineMode = false;
|
||
}
|
||
return true;
|
||
}
|
||
//Unknow parameter
|
||
return false;
|
||
}
|
||
... | ... | |
SetupStore("Contrast", theSetup.m_nContrast);
|
||
SetupStore("Font", theSetup.m_szFont);
|
||
SetupStore("Wakeup", theSetup.m_nWakeup);
|
||
if (theSetup.m_bTwoLineMode) {
|
||
SetupStore("TwoLineMode", 1);
|
||
} else {
|
||
SetupStore("TwoLineMode", 0);
|
||
}
|
||
}
|
||
ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev)
|
imonlcd-0.0.2/setup.h 2009-09-24 07:19:47.000000000 +0200 | ||
---|---|---|
char m_szFont[256];
|
||
int m_nWakeup;
|
||
int m_bTwoLineMode; /* enable two line mode ?*/
|
||
cIMonSetup(void);
|
||
cIMonSetup(const cIMonSetup& x);
|
imonlcd-0.0.2/watch.c 2009-09-25 09:12:07.000000000 +0200 | ||
---|---|---|
bool ciMonWatch::RenderScreen() {
|
||
cString* scRender;
|
||
cString* firstLine = NULL;
|
||
bool bForce = m_bUpdateScreen;
|
||
if(osdMessage) {
|
||
scRender = osdMessage;
|
||
} else if(osdItem) {
|
||
scRender = osdItem;
|
||
} else if(m_eWatchMode == eLiveTV) {
|
||
firstLine = chName;
|
||
if(Program()) {
|
||
bForce = true;
|
||
}
|
||
if(chPresentTitle)
|
||
scRender = chPresentTitle;
|
||
else
|
||
scRender = chName;
|
||
else {
|
||
if (theSetup.m_bTwoLineMode) {
|
||
scRender = NULL;
|
||
} else {
|
||
scRender = chName;
|
||
}
|
||
}
|
||
} else {
|
||
if(Replay()) {
|
||
bForce = true;
|
||
}
|
||
scRender = replayTitle;
|
||
}
|
||
if (theSetup.m_bTwoLineMode && (m_eWatchMode >= eReplayNormal) ) {
|
||
time_t ts = time(NULL);
|
||
struct tm l;
|
||
localtime_r(&ts, &l);
|
||
|
||
char* buffer = new char[20];
|
||
sprintf(buffer, "%d:%d", l.tm_hour, l.tm_min);
|
||
firstLine = new cString(buffer);;
|
||
}
|
||
if(bForce) {
|
||
m_nScrollOffset = 0;
|
||
m_bScrollBackward = false;
|
||
... | ... | |
if(bForce || m_nScrollOffset > 0 || m_bScrollBackward) {
|
||
this->clear();
|
||
if(scRender) {
|
||
int iRet = this->DrawText(0 - m_nScrollOffset,0,(*scRender));
|
||
|
||
int iRet = -1;
|
||
if (theSetup.m_bTwoLineMode) {
|
||
iRet = this->DrawText(0 - m_nScrollOffset,8 ,(*scRender));
|
||
} else {
|
||
iRet = this->DrawText(0 - m_nScrollOffset,0,(*scRender));
|
||
}
|
||
switch(iRet) {
|
||
case 0:
|
||
if(m_nScrollOffset <= 0) {
|
||
... | ... | |
}
|
||
}
|
||
if (firstLine && theSetup.m_bTwoLineMode ) {
|
||
this->DrawText(0, 0, *firstLine);
|
||
// if we are in replay mode the clock need updates. Therefore we have to leave slighly different
|
||
if (m_eWatchMode >= eReplayNormal) {
|
||
m_bUpdateScreen = true;
|
||
return true;
|
||
}
|
||
}
|
||
m_bUpdateScreen = false;
|
||
return true;
|
||
}
|