Thread: [Commits] : Tuxbox-GIT: apps branch master updated. CVS-Final-139-g51c9a02
Tuxbox Sources
Brought to you by:
dbt1
|
From: Thilo G. <tux...@ne...> - 2013-04-30 06:15:37
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 51c9a02e9630fb0744eea7664b6772aca8b6d7f3 (commit)
via 2ee986630202e9b08b881fe972cc33b7b68967dd (commit)
via 09fe447728d819946215b26f3ce1a75a12b8de19 (commit)
via a8c58ff7f14ce3e28ae35090aa931f4bea75823f (commit)
via 6854af4a1f6d7cd12f23ccd3f179fa36eb70276d (commit)
via 72e67085ff69553395eb5d23c24896c156b8248c (commit)
via 8c56d34e5591a42768b96ddd3305c755441ba8d4 (commit)
via a967ebae0744fe64f265c98d1fed0c1a6a162fb5 (commit)
via d7b95b5a94e6f0c44a410bde47ad6a3c7c556e1c (commit)
via 275bf133983690f10d36cc141bef989889575e89 (commit)
via 524fe056252cd77792885c9bb081e1f80cff52b1 (commit)
via df0adb40aef302167639dd79b141e550a9350a34 (commit)
via 8d58661d3e921afc184233a5896ec1f3eaab1e19 (commit)
via 5b3a1e1f3272ee141083e97b8f6ca94c804baf40 (commit)
via ebe5796b56af0d90fed1b07c32eb6d2f45a0a20a (commit)
via d61aadd2ba940cd52a15f45ff7d3feb7796d7fe6 (commit)
via ad82c8eed470084299f37a718e1be5cf8d837fe7 (commit)
via 83716e51dca34a19feaf414b298af2363fcc5bd9 (commit)
via 15f3b51886a333256e7698be8cebfcc8c8540828 (commit)
via 4876e6f59be97e12e9caa76cd775a33e50faf80e (commit)
via 5a61b058ba4e4f5328c2c32eae69916ba152a741 (commit)
via 8a9a9871586d6386d4443c2d84fbd5d772dde940 (commit)
via 53a3fa70e547b8a164184dc466d7d833bad6aa89 (commit)
via 31f4161bd4b7900a1299e3475eef51a5622e07b1 (commit)
via aa628e1b7f5aa7539749dd61e9b7a0096145a607 (commit)
from db94409e9100a7cac7f438cbd8aebce09c7b1126 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 51c9a02e9630fb0744eea7664b6772aca8b6d7f3
Author: GetAway <get...@t-...>
Date: Mon Apr 29 17:27:44 2013 +0200
audioplayer: use new style of item2Detailsline recalc playlistsize if filled and empty
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/audioplayer.cpp b/tuxbox/neutrino/src/gui/audioplayer.cpp
index 58e9c7d..66ffe51 100644
--- a/tuxbox/neutrino/src/gui/audioplayer.cpp
+++ b/tuxbox/neutrino/src/gui/audioplayer.cpp
@@ -92,10 +92,10 @@
#define DVR ADAP "/dvr0"
#endif
-#ifdef ConnectLineBox_Width
-#undef ConnectLineBox_Width
-#endif
-#define ConnectLineBox_Width 16
+//#ifdef ConnectLineBox_Width
+//#undef ConnectLineBox_Width
+//#endif
+#define ConnectLineBox_Width 12
#define AUDIOPLAYERGUI_SMSKEY_TIMEOUT 1000
#define SHOW_FILE_LOAD_LIMIT 50
@@ -250,7 +250,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
m_current = 0;
m_selected = 0;
- m_width = w_max(710, ConnectLineBox_Width);
+ m_width = w_max(720, 2 * ConnectLineBox_Width);
m_height = h_max(570, 0);
m_sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
m_buttonHeight = std::min(25, m_sheight);
@@ -260,9 +260,8 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
m_info_height = m_fheight*2;
m_listmaxshow = (m_height - m_info_height - m_title_height - m_theight - 2*m_buttonHeight) / (m_fheight);
m_height = m_theight + m_info_height + m_title_height + 2*m_buttonHeight + m_listmaxshow * m_fheight; // recalc height
+ calcSize();
- m_x = getScreenStartX(m_width + ConnectLineBox_Width) + ConnectLineBox_Width;
- m_y = getScreenStartY(m_height);
m_idletime=time(NULL);
m_screensaver=false;
@@ -387,6 +386,13 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
//------------------------------------------------------------------------
+void CAudioPlayerGui::calcSize()
+{
+ m_x = getScreenStartX(m_width - (m_playlist.empty() ? 0 : ConnectLineBox_Width));
+ m_y = getScreenStartY(m_height);
+}
+//------------------------------------------------------------------------
+
int CAudioPlayerGui::show()
{
neutrino_msg_t msg;
@@ -431,6 +437,7 @@ int CAudioPlayerGui::show()
clear_before_update = false;
}
update = false;
+ calcSize();
paint();
}
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
@@ -1881,29 +1888,34 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos)
m_height - m_title_height - m_info_height);
// paint Line if detail info (and not valid list pos)
- if (!m_playlist.empty() && (pos >= 0))
+ if (!m_playlist.empty() && (pos > -1))
{
// paint id3 infobox
- int yoffs = g_settings.rounded_corners ? 7 : 0;
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 4, ypos2+yoffs, 1, m_info_height-2*yoffs, col2);
- m_frameBuffer->paintBoxRel(m_x - 3, ypos2+yoffs, 3, m_info_height-2*yoffs, col1);
m_frameBuffer->paintBoxFrame(m_x, ypos2, m_width, m_info_height, 2,col1, RADIUS_MID);
m_frameBuffer->paintBoxRel(m_x + 2, ypos2 + 2 , m_width - 4, m_info_height - 4, col3, RADIUS_MID);
- // 1. col thick line
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 4, ypos1, 4, m_fheight, col2, RADIUS_SMALL, CORNER_LEFT);
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 3, ypos1, 8, m_fheight, col1, RADIUS_SMALL, CORNER_LEFT); // item marker
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 16, ypos1a, 4, ypos2a - ypos1a, col1);
+ // 1. top line vert.
+ m_frameBuffer->paintBoxRel(xpos+11, ypos1+4, 1,m_fheight-8, col2); // item marker gray vert.
+ m_frameBuffer->paintBoxRel(xpos+8, ypos1+4, 3,m_fheight-8, col1); // white vert.
+
+ // 2. top line hor.
+ m_frameBuffer->paintBoxRel(xpos, ypos1a , 8, 3, col1); //top small hor. line
+ m_frameBuffer->paintBoxRel(xpos, ypos1a+3, 8, 1, col2); // hor. gray top xxx
+
+ // 3. long line
+ m_frameBuffer->paintBoxRel(xpos, ypos1a, 3,ypos2a-ypos1a, col1); // white
+ m_frameBuffer->paintBoxRel(xpos+3, ypos1a+4, 1,ypos2a-ypos1a-4, col2); //vert. gray
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 16, ypos1a, 12, 4, col1);
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 16, ypos2a, 12, 4, col1);
+ // 4. bottom line vert.
+ m_frameBuffer->paintBoxRel(xpos, ypos2a , 8,3, col1); // white
+ m_frameBuffer->paintBoxRel(xpos, ypos2a+3, 8,1, col2); // gray
- // 2. col small line
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 16, ypos1a, 1, ypos2a - ypos1a + 4, col2);
+ // 5. col thick line bottom
+ int yoffs = g_settings.rounded_corners ? 10 : 0;
+ m_frameBuffer->paintBoxRel(m_x-1, ypos2+yoffs, 1, m_info_height-2*yoffs, col2);
+ m_frameBuffer->paintBoxRel(m_x-4, ypos2+yoffs, 3, m_info_height-2*yoffs, col1);
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 16, ypos1a, 12, 1, col2);
- m_frameBuffer->paintBoxRel(xpos + ConnectLineBox_Width - 12, ypos2a, 8, 1, col2);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos2 + 2 + 1*m_fheight, m_width- 80,
m_playlist[m_selected].MetaData.title, COL_MENUCONTENTDARK, 0, true); // UTF-8
diff --git a/tuxbox/neutrino/src/gui/audioplayer.h b/tuxbox/neutrino/src/gui/audioplayer.h
index cb06273..f288e97 100644
--- a/tuxbox/neutrino/src/gui/audioplayer.h
+++ b/tuxbox/neutrino/src/gui/audioplayer.h
@@ -147,6 +147,7 @@ class CAudioPlayerGui : public CMenuTarget
void paintInfo();
void paintLCD();
void hide();
+ void calcSize();
void get_id3(CAudiofileExt * audiofile);
void get_mp3info(CAudiofileExt * audiofile);
commit 2ee986630202e9b08b881fe972cc33b7b68967dd
Author: Christian Schuett <Gau...@ho...>
Date: Mon Apr 29 16:16:53 2013 +0200
Neutrino moviebrowser: only add separator line to serie menu if needed
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index d218780..16713ee 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -3008,7 +3008,8 @@ int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info)
CMenuWidget serieMenu(LOCALE_MOVIEBROWSER_INFO_HEAD, NEUTRINO_ICON_STREAMING);
serieMenu.addIntroItems(LOCALE_MOVIEBROWSER_SERIE_HEAD);
serieMenu.addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_SERIE_NAME, true, movie_info->serieName,&serieUserInput));
- serieMenu.addItem(GenericMenuSeparatorLine);
+ if (!m_vHandleSerienames.empty())
+ serieMenu.addItem(GenericMenuSeparatorLine);
for(unsigned int i=0; i < m_vHandleSerienames.size(); i++)
serieMenu.addItem( new CMenuSelector(m_vHandleSerienames[i]->serieName.c_str(), true, movie_info->serieName));
commit 09fe447728d819946215b26f3ce1a75a12b8de19
Author: [CST] Focus <foc...@gm...>
Date: Mon Apr 29 11:09:30 2013 +0200
settings: remove useDefaults(), init all variables to default values
Signed-off-by: GetAway <get...@t-...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/system/settings.cpp b/tuxbox/neutrino/src/system/settings.cpp
index 36f0352..70dfb99 100644
--- a/tuxbox/neutrino/src/system/settings.cpp
+++ b/tuxbox/neutrino/src/system/settings.cpp
@@ -36,7 +36,10 @@ CScanSettings::CScanSettings(void)
: configfile('\t')
{
delivery_system = DVB_S;
- satNameNoDiseqc[0] = 0;
+ bouquetMode = CZapitClient::BM_UPDATEBOUQUETS;
+ scanType = CZapitClient::ST_ALL;
+ strcpy(satNameNoDiseqc, "none");
+
for( int i = 0; i < MAX_SATELLITES; i++)
{
satName[i][0] = 0;
@@ -183,60 +186,31 @@ void CScanSettings::toMotorPosList(CZapitClient::ScanMotorPosList& motorPosList)
}
}
-void CScanSettings::useDefaults(const delivery_system_t _delivery_system)
+bool CScanSettings::loadSettings(const char * const fileName, const delivery_system_t dsys)
{
- delivery_system = _delivery_system;
- bouquetMode = CZapitClient::BM_UPDATEBOUQUETS;
- scanType = CZapitClient::ST_ALL;
- diseqcMode = NO_DISEQC;
- diseqcRepeat = 0;
- uni_qrg = 1210;
- uni_scr = 0;
-
- motorRotationSpeed = 8;
- useGotoXX = 0;
- gotoXXLatitude = 00.000000;
- gotoXXLongitude = 00.000000;
- gotoXXLaDirection = 1;
- gotoXXLoDirection = 1;
+ bool ret = configfile.loadConfig(fileName);
-#ifdef HAVE_TRIPLEDRAGON
- TP_mod = 0;
-#elif HAVE_DVB_API_VERSION >= 3
- TP_mod = QAM_AUTO;
-#else
- // i do not know how to do it correctly for old API -- seife
- TP_mod = QAM_256;
-#endif
- strcpy(satNameNoDiseqc, "none");
-}
-
-bool CScanSettings::loadSettings(const char * const fileName, const delivery_system_t _delivery_system)
-{
- useDefaults(_delivery_system);
-
- if(!configfile.loadConfig(fileName))
- return false;
-
- if (configfile.getInt32("delivery_system", -1) != delivery_system)
+ if (configfile.getInt32("delivery_system", -1) != dsys)
{
// configfile is not for this delivery system
configfile.clear();
- return false;
+ ret = false;
}
- diseqcMode = (diseqc_t) configfile.getInt32("diseqcMode" , diseqcMode);
- diseqcRepeat = configfile.getInt32("diseqcRepeat", diseqcRepeat);
- uni_qrg = configfile.getInt32("uni_qrg", uni_qrg);
- uni_scr = configfile.getInt32("uni_scr", uni_scr);
- bouquetMode = (CZapitClient::bouquetMode) configfile.getInt32("bouquetMode" , bouquetMode);
+ delivery_system = dsys;
+
+ diseqcMode = (diseqc_t) configfile.getInt32("diseqcMode", NO_DISEQC);
+ diseqcRepeat = configfile.getInt32("diseqcRepeat", 0);
+ uni_qrg = configfile.getInt32("uni_qrg", 1210);
+ uni_scr = configfile.getInt32("uni_scr", 0);
+ bouquetMode = (CZapitClient::bouquetMode) configfile.getInt32("bouquetMode", bouquetMode);
scanType=(CZapitClient::scanType) configfile.getInt32("scanType", scanType);
strcpy(satNameNoDiseqc, configfile.getString("satNameNoDiseqc", satNameNoDiseqc).c_str());
motorRotationSpeed = configfile.getInt32("motorRotationSpeed", 8);
useGotoXX = configfile.getInt32("useGotoXX", 0);
- gotoXXLatitude = strtod(configfile.getString("gotoXXLatitude", "00.000000").c_str(), NULL);
- gotoXXLongitude = strtod(configfile.getString("gotoXXLongitude", "00.000000").c_str(), NULL);
+ gotoXXLatitude = strtod(configfile.getString("gotoXXLatitude", "0.0").c_str(), NULL);
+ gotoXXLongitude = strtod(configfile.getString("gotoXXLongitude", "0.0").c_str(), NULL);
gotoXXLaDirection = configfile.getInt32("gotoXXLaDirection", 1);
gotoXXLoDirection = configfile.getInt32("gotoXXLoDirection", 1);
@@ -271,16 +245,22 @@ bool CScanSettings::loadSettings(const char * const fileName, const delivery_sys
// i do not know how to do it correctly for old API -- seife
TP_mod = configfile.getInt32("TP_mod", QAM_256); // default qam 256
#endif
- strcpy(TP_freq, configfile.getString("TP_freq", "10100000").c_str());
- strcpy(TP_rate, configfile.getString("TP_rate", "27500000").c_str());
- strncpy(TP_satname, configfile.getString("TP_satname", "Astra 19.2E").c_str(), 30);
+
+ if(delivery_system == DVB_S) {
+ strcpy(TP_freq, configfile.getString("TP_freq", "10100000").c_str());
+ strcpy(TP_rate, configfile.getString("TP_rate", "27500000").c_str());
+ } else {
+ strcpy(TP_freq, configfile.getString("TP_freq", "362000000").c_str());
+ strcpy(TP_rate, configfile.getString("TP_rate", "6875000").c_str());
+ }
+ strncpy(TP_satname, configfile.getString("TP_satname", "").c_str(), 30);
TP_diseqc = *diseqscOfSat(TP_satname);
#if HAVE_DVB_API_VERSION >= 3
if(TP_fec == 4) TP_fec = 5;
#endif
scanSectionsd = configfile.getInt32("scanSectionsd", 0);
- return true;
+ return ret;
}
bool CScanSettings::saveSettings(const char * const fileName)
diff --git a/tuxbox/neutrino/src/system/settings.h b/tuxbox/neutrino/src/system/settings.h
index b78ecac..1ec81e7 100644
--- a/tuxbox/neutrino/src/system/settings.h
+++ b/tuxbox/neutrino/src/system/settings.h
@@ -633,9 +633,7 @@ class CScanSettings
void toSatList( CZapitClient::ScanSatelliteList& ) const;
void toMotorPosList( CZapitClient::ScanMotorPosList& ) const;
- void useDefaults(const delivery_system_t _delivery_system);
-
- bool loadSettings(const char * const fileName, const delivery_system_t _delivery_system);
+ bool loadSettings(const char * const fileName, const delivery_system_t dsys);
bool saveSettings(const char * const fileName);
};
commit a8c58ff7f14ce3e28ae35090aa931f4bea75823f
Author: Christian Schuett <Gau...@ho...>
Date: Mon Apr 29 00:33:53 2013 +0200
Neutrino CMenuWidget: consider scrollbar width when calculating start pos
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/widget/menue.cpp b/tuxbox/neutrino/src/gui/widget/menue.cpp
index e43d379..7c98c5c 100644
--- a/tuxbox/neutrino/src/gui/widget/menue.cpp
+++ b/tuxbox/neutrino/src/gui/widget/menue.cpp
@@ -669,15 +669,15 @@ void CMenuWidget::paint()
if(hheight+itemHeightTotal < height)
height=hheight+itemHeightTotal;
- x = getScreenStartX(width);
- y = getScreenStartY(height);
-
int sb_width;
if(total_pages > 1)
sb_width=15;
else
sb_width=0;
+ x = getScreenStartX(width + sb_width);
+ y = getScreenStartY(height);
+
int c_rad_mid = RADIUS_MID;
frameBuffer->paintBoxRel(x + SHADOW_OFFSET, y + SHADOW_OFFSET, width + sb_width, height + (c_rad_mid / 3 * 2), COL_MENUCONTENTDARK_PLUS_0, c_rad_mid);
commit 6854af4a1f6d7cd12f23ccd3f179fa36eb70276d
Author: Christian Schuett <Gau...@ho...>
Date: Sun Apr 28 22:49:11 2013 +0200
Neutrino: move redundant code from menu item classes into base class
ported from Neutrino-HD
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 2d6a71c..d218780 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -3677,7 +3677,6 @@ bool CBookItemMenuForwarderNotifier::changeNotify(const neutrino_locale_t, void*
CMenuSelector::CMenuSelector(const char * OptionName, const bool Active , char * OptionValue, int* ReturnInt ,int ReturnIntValue ) : CMenuItem()
{
- height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
optionValueString = NULL;
optionName = OptionName;
optionValue = OptionValue;
@@ -3688,7 +3687,6 @@ CMenuSelector::CMenuSelector(const char * OptionName, const bool Active , char *
CMenuSelector::CMenuSelector(const char * OptionName, const bool Active , std::string& OptionValue, int* ReturnInt ,int ReturnIntValue ) : CMenuItem()
{
- height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
optionValueString = &OptionValue;
optionName = OptionName;
strncpy(buffer,OptionValue.c_str(),BUFFER_MAX);
@@ -3699,6 +3697,11 @@ CMenuSelector::CMenuSelector(const char * OptionName, const bool Active , std::s
returnInt = ReturnInt;
};
+int CMenuSelector::getHeight(void) const
+{
+ return g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
+}
+
int CMenuSelector::exec(CMenuTarget* /*parent*/)
{
if(returnInt != NULL)
@@ -3716,28 +3719,16 @@ int CMenuSelector::exec(CMenuTarget* /*parent*/)
int CMenuSelector::paint(bool selected)
{
- CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
-
- unsigned char color = COL_MENUCONTENT;
- fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0;
- if (selected)
- {
- color = COL_MENUCONTENTSELECTED;
- bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
- }
- if (!active)
- {
- color = COL_MENUCONTENTINACTIVE;
- bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
- }
+ int height = getHeight();
- frameBuffer->paintBoxRel(x, y, dx, height, bgcolor);
+ //paint item
+ prepareItem(selected, height);
- int stringstartposName = x + offx + 10;
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposName, y+height,dx- (stringstartposName - x), optionName, color, 0, true); // UTF-8
+ //paint item icon
+ paintItemButton(selected, height, NEUTRINO_ICON_BUTTON_OKAY);
- if (selected)
- CLCD::getInstance()->showMenuText(0, optionName, -1, true); // UTF-8
+ //paint text
+ paintItemCaption(selected, height, optionName);
return y+height;
}
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.h b/tuxbox/neutrino/src/gui/moviebrowser.h
index 03e096c..9065a47 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.h
+++ b/tuxbox/neutrino/src/gui/moviebrowser.h
@@ -427,14 +427,13 @@ class CMenuSelector : public CMenuItem
std::string* optionValueString;
int returnIntValue;
int* returnInt;
- int height;
char buffer[BUFFER_MAX];
public:
CMenuSelector(const char * OptionName, const bool Active = true, char * OptionValue = NULL, int* ReturnInt = NULL,int ReturnIntValue = 0);
CMenuSelector(const char * OptionName, const bool Active , std::string & OptionValue, int* ReturnInt = NULL,int ReturnIntValue = 0);
int exec(CMenuTarget* parent);
int paint(bool selected);
- int getHeight(void) const{return height;};
+ int getHeight(void) const;
bool isSelectable(void) const { return active;}
};
diff --git a/tuxbox/neutrino/src/gui/widget/menue.cpp b/tuxbox/neutrino/src/gui/widget/menue.cpp
index 441bb99..e43d379 100644
--- a/tuxbox/neutrino/src/gui/widget/menue.cpp
+++ b/tuxbox/neutrino/src/gui/widget/menue.cpp
@@ -92,11 +92,78 @@ void CMenuItem::setItemButton(const std::string& icon_Name, const bool is_select
iconName = icon_Name;
}
-void CMenuItem::paintItemButton(const int startX, const int frame_height, const bool select_mode, const std::string &icon_Name)
+void CMenuItem::initItemColors(const bool select_mode)
+{
+ if (select_mode)
+ {
+ item_color = COL_MENUCONTENTSELECTED;
+ item_bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
+ }
+ else if (!active)
+ {
+ item_color = COL_MENUCONTENTINACTIVE;
+ item_bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
+ }
+ else
+ {
+ item_color = COL_MENUCONTENT;
+ item_bgcolor = COL_MENUCONTENT_PLUS_0;
+ }
+}
+
+void CMenuItem::paintItemBackground (const bool /*select_mode*/, const int &item_height)
+{
+ CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
+#if 0
+ //FIXME what select_mode change here ??
+ if (select_mode)
+ frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_SMALL);
+ else
+#endif
+ frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_SMALL);
+}
+
+void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, const char * left_text, const char * right_text)
+{
+ bool right_text_is_utf8 = (right_text != NULL) ? isUTF8(right_text, strlen(right_text)) : false;
+
+ if (select_mode)
+ {
+ CLCD::getInstance()->showMenuText(0, left_text, -1, true); // UTF-8
+ if (right_text != NULL)
+ CLCD::getInstance()->showMenuText(1, right_text, -1, right_text_is_utf8);
+ else
+ CLCD::getInstance()->showMenuText(1, "");
+ }
+
+ //left text
+ int stringstartposName = x + offx + 10;
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposName, y + item_height, dx - (stringstartposName - x), left_text, item_color, 0, true); // UTF-8
+
+ //right text
+ if (right_text != NULL)
+ {
+ int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(right_text, right_text_is_utf8);
+ int stringstartposOption = std::max(stringstartposName + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(left_text, true) + 10,
+ x + dx - stringwidth - 10); //+ offx
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y + item_height, dx - (stringstartposOption - x), right_text, item_color, 0, right_text_is_utf8);
+ }
+}
+
+void CMenuItem::prepareItem(const bool select_mode, const int &item_height)
+{
+ //set colors
+ initItemColors(select_mode);
+
+ //paint item background
+ paintItemBackground(select_mode, item_height);
+}
+
+void CMenuItem::paintItemButton(const bool select_mode, const int &item_height, const std::string &icon_Name)
{
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
bool selected = select_mode;
- int height = frame_height;
+ int height = item_height;
bool icon_painted = false;
std::string icon_name = iconName;
@@ -128,7 +195,7 @@ void CMenuItem::paintItemButton(const int startX, const int frame_height, const
frameBuffer->getIconSize(NEUTRINO_ICON_RIGHT_MARKER, &m_icon_w, &m_icon_h);
int icon_x = 0;
- int icon_space = (x+(startX-x)/2);
+ int icon_space = x + (offx+10)/2;
if (!icon_name.empty())
{
@@ -744,27 +811,10 @@ int CMenuOptionNumberChooser::exec(CMenuTarget*)
int CMenuOptionNumberChooser::paint(bool selected)
{
- CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
int height = getHeight();
- unsigned char color = COL_MENUCONTENT;
- fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0;
- if (selected)
- {
- color = COL_MENUCONTENTSELECTED;
- bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
- }
- if (!active)
- {
- color = COL_MENUCONTENTINACTIVE;
- bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
- }
-
- frameBuffer->paintBoxRel(x, y, dx, height, bgcolor, RADIUS_SMALL);
-
const char * l_option;
char option_value[11];
-
if ((localized_value_name == NONEXISTANT_LOCALE) || ((*optionValue) != localized_value))
{
sprintf(option_value, "%d", ((*optionValue) + display_offset));
@@ -775,21 +825,14 @@ int CMenuOptionNumberChooser::paint(bool selected)
const char * l_optionName = (optionString != NULL) ? optionString : g_Locale->getText(optionName);
- int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_option, true); // UTF-8
- int stringstartposName = x + offx + 10;
- int stringstartposOption = std::max(stringstartposName + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_optionName, true) + 10,
- x + dx - stringwidth - 10); //+ offx
+ //paint item
+ prepareItem(selected, height);
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposName, y+height,dx- (stringstartposName - x), l_optionName, color, 0, true); // UTF-8
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y+height,dx- (stringstartposOption - x), l_option, color, 0, true); // UTF-8
-
- paintItemButton(stringstartposName, height, selected, NEUTRINO_ICON_BUTTON_OKAY);
+ //paint item icon
+ paintItemButton(selected, height, NEUTRINO_ICON_BUTTON_OKAY);
- if (selected)
- {
- CLCD::getInstance()->showMenuText(0, l_optionName, -1, true); // UTF-8
- CLCD::getInstance()->showMenuText(1, l_option, -1, true); // UTF-8
- }
+ //paint text
+ paintItemCaption(selected, height, l_optionName, l_option);
return y+height;
}
@@ -903,26 +946,9 @@ int CMenuOptionChooser::exec(CMenuTarget* parent)
int CMenuOptionChooser::paint( bool selected )
{
- CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
int height = getHeight();
- unsigned char color = COL_MENUCONTENT;
- fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0;
- if (selected)
- {
- color = COL_MENUCONTENTSELECTED;
- bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
- }
- if (!active)
- {
- color = COL_MENUCONTENTINACTIVE;
- bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
- }
-
- frameBuffer->paintBoxRel(x, y, dx, height, bgcolor, RADIUS_SMALL);
-
neutrino_locale_t option = NONEXISTANT_LOCALE;
-
for(unsigned int count = 0 ; count < number_of_options; count++)
{
if (options[count].key == *optionValue)
@@ -931,27 +957,16 @@ int CMenuOptionChooser::paint( bool selected )
break;
}
}
-
- if (optionName != NONEXISTANT_LOCALE)
- optionNameString = g_Locale->getText(optionName);
-
const char * l_option = g_Locale->getText(option);
- int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_option, true); // UTF-8
- int stringstartposName = x + offx + 10;
- int stringstartposOption = std::max(stringstartposName + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(optionNameString.c_str(), true) + 10,
- x + dx - stringwidth - 10); //+ offx
-
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposName, y+height,dx- (stringstartposName - x), optionNameString.c_str(), color, 0, true); // UTF-8
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y+height,dx- (stringstartposOption - x), l_option, color, 0, true); // UTF-8
+ //paint item
+ prepareItem(selected, height);
- paintItemButton(stringstartposName, height, selected, NEUTRINO_ICON_BUTTON_OKAY);
+ //paint item icon
+ paintItemButton(selected, height, NEUTRINO_ICON_BUTTON_OKAY);
- if (selected)
- {
- CLCD::getInstance()->showMenuText(0, optionNameString.c_str(), -1, true); // UTF-8
- CLCD::getInstance()->showMenuText(1, l_option, -1, true); // UTF-8
- }
+ //paint text
+ paintItemCaption(selected, height, optionNameString.c_str(), l_option);
return y+height;
}
@@ -1050,39 +1065,16 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
int CMenuOptionStringChooser::paint( bool selected )
{
int height = getHeight();
-
- unsigned char color = COL_MENUCONTENT;
- fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0;
- if (selected)
- {
- color = COL_MENUCONTENTSELECTED;
- bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
- }
- if (!active)
- {
- color = COL_MENUCONTENTINACTIVE;
- bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
- }
-
- CFrameBuffer::getInstance()->paintBoxRel(x, y, dx, height, bgcolor, RADIUS_SMALL);
-
const char * l_optionName = g_Locale->getText(optionName);
- int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(optionValue);
- int stringstartposName = x + offx + 10;
- int stringstartposOption = std::max(stringstartposName + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_optionName, true) + 10,
- x + dx - stringwidth - 10); //+ offx
+ //paint item
+ prepareItem(selected, height);
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposName, y+height,dx- (stringstartposName - x), l_optionName, color, 0, true); // UTF-8
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y+height,dx- (stringstartposOption - x), optionValue, color);
+ //paint item icon
+ paintItemButton(selected, height, NEUTRINO_ICON_BUTTON_OKAY);
- paintItemButton(stringstartposName, height, selected, NEUTRINO_ICON_BUTTON_OKAY);
-
- if (selected)
- {
- CLCD::getInstance()->showMenuText(0, l_optionName, -1, true); // UTF-8
- CLCD::getInstance()->showMenuText(1, optionValue);
- }
+ //paint text
+ paintItemCaption(selected, height, l_optionName, optionValue);
return y+height;
}
@@ -1168,52 +1160,18 @@ const char * CMenuForwarder::getName(void)
int CMenuForwarder::paint(bool selected)
{
- CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
int height = getHeight();
const char * l_text = getName();
-
- int stringstartposX = x + offx + 10;
-
const char * option_text = getOption();
- bool option_text_is_utf8 = (option_text != NULL) ? isUTF8(option_text, strlen(option_text)) : false;
-
- if (selected)
- {
- CLCD * lcd = CLCD::getInstance();
- lcd->showMenuText(0, l_text, -1, true); // UTF-8
-
- if (option_text != NULL)
- lcd->showMenuText(1, option_text, -1, option_text_is_utf8);
- else
- lcd->showMenuText(1, "", -1, true); // UTF-8
- }
-
- unsigned char color = COL_MENUCONTENT;
- fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0;
- if (selected)
- {
- color = COL_MENUCONTENTSELECTED;
- bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
- }
- if (!active)
- {
- color = COL_MENUCONTENTINACTIVE;
- bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
- }
-
- frameBuffer->paintBoxRel(x, y, dx, height, bgcolor, RADIUS_SMALL);
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposX, y+ height, dx- (stringstartposX - x), l_text, color, 0, true); // UTF-8
- paintItemButton(stringstartposX, height, selected);
+ //paint item
+ prepareItem(selected, height);
- if (option_text != NULL)
- {
- int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_text, option_text_is_utf8);
- int stringstartposOption = std::max(stringstartposX + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_text, true) + 10,
- x + dx - stringwidth - 10); //+ offx
+ //paint item icon
+ paintItemButton(selected, height);
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y + height, dx - (stringstartposOption - x), option...
[truncated message content] |