From 5f9f82b8e6f232218f2a47bcdad7cf365a1e395f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 8 May 2017 17:39:30 +0200 Subject: [PATCH 01/14] src/gui/eventlist.cpp show prev next channel name on start --- src/gui/eventlist.cpp | 81 +++++++++++++++++++++++++------------------ src/gui/eventlist.h | 3 +- 2 files changed, 50 insertions(+), 34 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 3d7c56e01..b7102cd00 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -263,6 +263,38 @@ void CEventList::readEvents(const t_channel_id channel_id) return; } +void CEventList::getPrvNextChannelName(t_channel_id &channel_id,std::string &next_channel_name,std::string &prev_channel_name,std::string ¤t_channel_name, neutrino_msg_t msg){ + t_bouquet_id current_bouquet_id= bouquetList->getActiveBouquetNumber(); + t_channel_id channel_id_tmp = channel_id; + const unsigned int channel_nr = bouquetList->Bouquets[current_bouquet_id]->channelList->getSize(); + if(channel_nr < 2){ + channel_id = 0; + return; + } + unsigned int tmp_channel = 0; + for(unsigned int channel = 0; channel < channel_nr; channel++) + { + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); + if(channel_id_tmp == channel_id){ + if ( msg==CRCInput::RC_right || msg==CRCInput::RC_forward ) { + channel = (channel+1) %channel_nr; + }else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_rewind ){ //RC_rewind + channel = (channel == 0) ? channel_nr -1 : channel - 1; + } + channel_id = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); + current_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id); + + tmp_channel = (channel == 0) ? channel_nr - 1 : channel - 1; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); + prev_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); + + tmp_channel = (channel+1) %channel_nr; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); + next_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); + break; + } + } +} int CEventList::exec(const t_channel_id channel_id, const std::string& channelname, const std::string& channelname_prev, const std::string& channelname_next,const CChannelEventList &followlist) // UTF-8 { @@ -346,7 +378,14 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna UpdateTimerList(); bool dont_hide = false; - paintHead(channel_id, channelname, channelname_prev, channelname_next); + if(channelname_prev.empty() && channelname_prev.empty()){ + std::string nextChannelName,prevChannelName,tmp; + t_channel_id tmp_channel_id = channel_id; + getPrvNextChannelName(tmp_channel_id, nextChannelName, prevChannelName, tmp,0); + paintHead(channel_id, channelname, prevChannelName, nextChannelName); + }else{ + paintHead(channel_id, channelname, channelname_prev, channelname_next); + } paint(channel_id); showFunctionBar(channel_id); @@ -558,39 +597,15 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna } else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_right || msg==CRCInput::RC_rewind || msg==CRCInput::RC_forward ) { // maybe remove RC_rewind and RC_forward in the future? - bgRightBoxPaint = false; - t_bouquet_id current_bouquet_id= bouquetList->getActiveBouquetNumber(); - t_channel_id channel_id_tmp, _channel_id = channel_id; - const unsigned int channel_nr = bouquetList->Bouquets[current_bouquet_id]->channelList->getSize(); - std::string next_channel_name; - std::string prev_channel_name ; - std::string current_channel_name; - unsigned int tmp_channel = 0; - for(unsigned int channel = 0; channel < channel_nr; channel++) - { - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); - if(channel_id_tmp == channel_id){ - if ( msg==CRCInput::RC_right || msg==CRCInput::RC_forward ) { - channel = (channel+1) %channel_nr; - }else { //RC_rewind - channel = (channel == 0) ? channel_nr -1 : channel - 1; - } - _channel_id = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); - current_channel_name = CServiceManager::getInstance()->GetServiceName(_channel_id); - - tmp_channel = (channel == 0) ? channel_nr - 1 : channel - 1; - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); - prev_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); - - tmp_channel = (channel+1) %channel_nr; - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); - next_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); - break; - } + std::string next_channel_name, prev_channel_name, current_channel_name; + t_channel_id _channel_id = channel_id; + getPrvNextChannelName(_channel_id, next_channel_name, prev_channel_name, current_channel_name, msg); + if(_channel_id){ + bgRightBoxPaint = false; + loop = false; + dont_hide = true; + exec(_channel_id, current_channel_name, prev_channel_name, next_channel_name); } - loop = false; - dont_hide = true; - exec(_channel_id, current_channel_name, prev_channel_name, next_channel_name); } else if (msg == CRCInput::RC_0) { hide(); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 69cf7442c..05d9fbc87 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -116,7 +116,8 @@ class CEventList : public CListHelpers void showProgressBar(int pos); void hide(); void showFunctionBar(t_channel_id channel_id); - + void getPrvNextChannelName(t_channel_id &channel_id,std::string &next_channel_name,std::string &prev_channel_name,std::string ¤t_channel_name, neutrino_msg_t msg); + int timerPre; int timerPost; void UpdateTimerList(void); From 5dc4424d969c64fde9c61c38606514a5c31bfa11 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 8 May 2017 18:02:04 +0200 Subject: [PATCH 02/14] supplement to 5f9f82b8e6f232218f2a47bcdad7cf365a1e395f --- src/gui/eventlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index b7102cd00..02e205425 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -378,7 +378,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna UpdateTimerList(); bool dont_hide = false; - if(channelname_prev.empty() && channelname_prev.empty()){ + if(channelname_prev.empty() && channelname_next.empty()){ std::string nextChannelName,prevChannelName,tmp; t_channel_id tmp_channel_id = channel_id; getPrvNextChannelName(tmp_channel_id, nextChannelName, prevChannelName, tmp,0); From d051691f89c2d51fa66b41e218bd34224a067856 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 8 May 2017 19:43:36 +0200 Subject: [PATCH 03/14] supplement 2 to 5f9f82b8e6f232218f2a47bcdad7cf365a1e395f --- src/gui/eventlist.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 02e205425..9d2acb3b3 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -378,14 +378,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna UpdateTimerList(); bool dont_hide = false; - if(channelname_prev.empty() && channelname_next.empty()){ - std::string nextChannelName,prevChannelName,tmp; - t_channel_id tmp_channel_id = channel_id; - getPrvNextChannelName(tmp_channel_id, nextChannelName, prevChannelName, tmp,0); - paintHead(channel_id, channelname, prevChannelName, nextChannelName); - }else{ - paintHead(channel_id, channelname, channelname_prev, channelname_next); - } + paintHead(channel_id, channelname, channelname_prev, channelname_next); paint(channel_id); showFunctionBar(channel_id); @@ -898,6 +891,10 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s header->paint(CC_SAVE_SCREEN_NO); + if(_channelname_prev.empty() && _channelname_next.empty()){ + getPrvNextChannelName(_channel_id, _channelname_next, _channelname_prev, _channelname,0); + } + paintBottomBox(_channelname_prev, _channelname_next); } From edb4ce3e4f4b93beb82d9e28e027951866a00323 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 8 May 2017 21:08:23 +0200 Subject: [PATCH 04/14] - eventlist: minor cosmetics; rename getPrvNextChannelName() to getChannelNames() --- src/gui/eventlist.cpp | 11 ++++++----- src/gui/eventlist.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 9d2acb3b3..d8203b2da 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -263,9 +263,10 @@ void CEventList::readEvents(const t_channel_id channel_id) return; } -void CEventList::getPrvNextChannelName(t_channel_id &channel_id,std::string &next_channel_name,std::string &prev_channel_name,std::string ¤t_channel_name, neutrino_msg_t msg){ - t_bouquet_id current_bouquet_id= bouquetList->getActiveBouquetNumber(); - t_channel_id channel_id_tmp = channel_id; +void CEventList::getChannelNames(t_channel_id &channel_id, std::string ¤t_channel_name, std::string &prev_channel_name, std::string &next_channel_name, neutrino_msg_t msg) +{ + t_bouquet_id current_bouquet_id = bouquetList->getActiveBouquetNumber(); + t_channel_id channel_id_tmp = channel_id; const unsigned int channel_nr = bouquetList->Bouquets[current_bouquet_id]->channelList->getSize(); if(channel_nr < 2){ channel_id = 0; @@ -592,7 +593,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna // maybe remove RC_rewind and RC_forward in the future? std::string next_channel_name, prev_channel_name, current_channel_name; t_channel_id _channel_id = channel_id; - getPrvNextChannelName(_channel_id, next_channel_name, prev_channel_name, current_channel_name, msg); + getChannelNames(_channel_id, current_channel_name, prev_channel_name, next_channel_name, msg); if(_channel_id){ bgRightBoxPaint = false; loop = false; @@ -892,7 +893,7 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s header->paint(CC_SAVE_SCREEN_NO); if(_channelname_prev.empty() && _channelname_next.empty()){ - getPrvNextChannelName(_channel_id, _channelname_next, _channelname_prev, _channelname,0); + getChannelNames(_channel_id, _channelname, _channelname_prev, _channelname_next, 0); } paintBottomBox(_channelname_prev, _channelname_next); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 05d9fbc87..55401bff9 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -116,7 +116,7 @@ class CEventList : public CListHelpers void showProgressBar(int pos); void hide(); void showFunctionBar(t_channel_id channel_id); - void getPrvNextChannelName(t_channel_id &channel_id,std::string &next_channel_name,std::string &prev_channel_name,std::string ¤t_channel_name, neutrino_msg_t msg); + void getChannelNames(t_channel_id &channel_id, std::string ¤t_channel_name, std::string &prev_channel_name, std::string &next_channel_name, neutrino_msg_t msg); int timerPre; int timerPost; From edb0a5937e30477f633550c18c87cdfa6c2a5827 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 8 May 2017 23:44:45 +0200 Subject: [PATCH 05/14] - neutrino: fix hw_caps init; it must be initialized after zapit start --- src/neutrino.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index dda468ad7..07f6d2231 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -456,14 +456,22 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.hdd_noise = configfile.getInt32( "hdd_noise", 254); g_settings.hdd_statfs_mode = configfile.getInt32( "hdd_statfs_mode", SNeutrinoSettings::HDD_STATFS_RECORDING); + /* + hw_caps uses CFEManager and CFEManager needs g_settings. + So g_settings cannot use hw_caps. + + For this reason we need this workaround. + */ + bool can_shutdown = (cs_get_revision() > 7); + g_settings.shutdown_real = false; - if (g_info.hw_caps->can_shutdown) + if (can_shutdown) //(g_info.hw_caps->can_shutdown) g_settings.shutdown_real = configfile.getBool("shutdown_real" , false ); g_settings.shutdown_real_rcdelay = configfile.getBool("shutdown_real_rcdelay", false ); g_settings.shutdown_count = configfile.getInt32("shutdown_count", 0); g_settings.shutdown_min = 0; - if (g_info.hw_caps->can_shutdown) + if (can_shutdown) //(g_info.hw_caps->can_shutdown) g_settings.shutdown_min = configfile.getInt32("shutdown_min", 180); g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); @@ -2043,8 +2051,6 @@ TIMER_START(); cs_api_init(); cs_register_messenger(CSSendMessage); - g_info.hw_caps = get_hwcaps(); - g_Locale = new CLocaleManager; int loadSettingsErg = loadSetup(NEUTRINO_SETTINGS_FILE); @@ -2130,6 +2136,9 @@ TIMER_START(); CheckFastScan(); + // init hw_caps *after* zapit start! + g_info.hw_caps = get_hwcaps(); + //timer start timer_wakeup = false;//init wake_up( timer_wakeup ); From 1d5bb7cd8eb1d2c772d6b1e66fa0a9d9c8818791 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 9 May 2017 11:30:06 +0200 Subject: [PATCH 06/14] CBuildInfo: fix shadow parameter Type is int not bool --- src/gui/buildinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 23f81f85b..b35300b78 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -53,7 +53,7 @@ void CBuildInfo::initVarBuildInfo() setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); - shadow = true; + shadow = CC_SHADOW_ON; } From 468fbcd79c776bd0b3decbb4d82f1c10eb7f5ff8 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 9 May 2017 11:40:32 +0200 Subject: [PATCH 07/14] - locale: minor changes in EPG-Plus locales --- data/locale/deutsch.locale | 6 +++--- data/locale/english.locale | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index d8739fca7..d44cc4275 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1,5 +1,5 @@ AUDIOSelectMenue.head Auswahl der Tonspur -EPGMenu.epgplus Vorschauübersicht +EPGMenu.epgplus Vorschau-Übersicht EPGMenu.eventinfo Info zur Sendung EPGMenu.eventlist Vorschau aktuelles Programm EPGMenu.head EPG - Programminformation @@ -7,7 +7,7 @@ EPGMenu.streaminfo Technische Information EPGPlus.actions Aktionen EPGPlus.bybouquet_mode bouquetweise EPGPlus.bypage_mode seitenweise -EPGPlus.head Vorschau Übersicht (EPG Plus) +EPGPlus.head Vorschau-Übersicht (EPG Plus) EPGPlus.next_bouquet Bouquet vor EPGPlus.options Optionen EPGPlus.page_down Seite zurück @@ -19,7 +19,7 @@ EPGPlus.remind Vormerken EPGPlus.scroll_mode Scroll-Modus EPGPlus.stretch_mode Stretch-Modus EPGPlus.swap_mode Blättern -EPGPlus.view_mode Modus +EPGPlus.view_mode Ansicht GENRE.ALL aus GENRE.ARTS Kultur GENRE.ARTS.0 Kunst/Kultur diff --git a/data/locale/english.locale b/data/locale/english.locale index 7d71de370..e404aef70 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2,24 +2,24 @@ AUDIOSelectMenue.head Audio Selection EPGMenu.epgplus Eventlist overview EPGMenu.eventinfo Details current program EPGMenu.eventlist Eventlist current programm -EPGMenu.head EPG - Program Information -EPGMenu.streaminfo technical information +EPGMenu.head EPG - Program information +EPGMenu.streaminfo Technical information EPGPlus.actions Actions EPGPlus.bybouquet_mode by bouquet EPGPlus.bypage_mode by page -EPGPlus.head Eventlist Overview (EPG Plus) -EPGPlus.next_bouquet next bouquet -EPGPlus.options options -EPGPlus.page_down page down -EPGPlus.page_up page up -EPGPlus.prev_bouquet prev bouquet +EPGPlus.head Eventlist overview (EPG Plus) +EPGPlus.next_bouquet Next bouquet +EPGPlus.options Options +EPGPlus.page_down Page down +EPGPlus.page_up Page up +EPGPlus.prev_bouquet Prev bouquet EPGPlus.record Record EPGPlus.refresh_epg Refresh EPGPlus.remind Schedule -EPGPlus.scroll_mode Scroll Mode -EPGPlus.stretch_mode Stretch Mode -EPGPlus.swap_mode swap mode -EPGPlus.view_mode view mode +EPGPlus.scroll_mode Scroll mode +EPGPlus.stretch_mode Stretch mode +EPGPlus.swap_mode Swap mode +EPGPlus.view_mode View mode GENRE.ALL off GENRE.ARTS Arts GENRE.ARTS.0 arts/culture From 1f978f01ad2a14ce69097b34bd1d550523b8f9e9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 9 May 2017 12:08:03 +0200 Subject: [PATCH 08/14] CLuaInstCCWindow: fix passed shadow paramater --- src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/lua_cc_window.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 078e88ef8..1edd9814a 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 73 +#define LUA_API_VERSION_MINOR 74 diff --git a/src/gui/lua/lua_cc_window.cpp b/src/gui/lua/lua_cc_window.cpp index 819fe18d2..8fb985e67 100644 --- a/src/gui/lua/lua_cc_window.cpp +++ b/src/gui/lua/lua_cc_window.cpp @@ -89,12 +89,13 @@ int CLuaInstCCWindow::CCWindowNew(lua_State *L) tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name); tableLookup(L, "icon", icon); - bool has_shadow = false; + int has_shadow = CC_SHADOW_OFF; if (!tableLookup(L, "has_shadow", has_shadow)) { tmp1 = "false"; if (tableLookup(L, "has_shadow", tmp1)) paramBoolDeprecated(L, tmp1.c_str()); - has_shadow = (tmp1 == "true" || tmp1 == "1" || tmp1 == "yes"); + if ((tmp1 == "true" || tmp1 == "1" || tmp1 == "yes")) + has_shadow = CC_SHADOW_ON; } tableLookup(L, "color_frame" , color_frame); @@ -126,7 +127,7 @@ int CLuaInstCCWindow::CCWindowNew(lua_State *L) CLuaCCWindow **udata = (CLuaCCWindow **) lua_newuserdata(L, sizeof(CLuaCCWindow *)); *udata = new CLuaCCWindow(); - (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), 0, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), NULL, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); /* Ignore percent conversion of width and height to remain compatible with the Lua API */ (*udata)->w->setWidth(dx); From c08144a9d9ba022c2548512bc97881521f900af6 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 9 May 2017 13:31:59 +0200 Subject: [PATCH 09/14] - clearify comment --- src/neutrino.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 07f6d2231..1ec31e04a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -457,8 +457,8 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.hdd_statfs_mode = configfile.getInt32( "hdd_statfs_mode", SNeutrinoSettings::HDD_STATFS_RECORDING); /* - hw_caps uses CFEManager and CFEManager needs g_settings. - So g_settings cannot use hw_caps. + hw_caps needs CFEManager and CFEManager needs g_settings. + So loadSetup() cannot use hw_caps to init g_settings. For this reason we need this workaround. */ From 107db09299f528ab0cea8bd7970a8aedb716d258 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 May 2017 10:42:08 +0200 Subject: [PATCH 10/14] CComponentsHeader: fix order of width calculation Required for following position calculation --- src/gui/components/cc_frm_header.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f6e20c5a0..21633e22c 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -576,20 +576,20 @@ void CComponentsHeader::initCaption() //set header text properties if (cch_text_obj){ + //recalc caption width + cc_text_w = min(cc_text_w, cch_font->getRenderWidth(cch_text)/*+ OFFSET_INNER_MID*/); + //set alignment of text item in dependency from text alignment if (cch_caption_align == CTextBox::CENTER) cch_text_x = CC_CENTERED; - //recalc caption width - cc_text_w = min(cc_text_w, cch_font->getRenderWidth(cch_text)+ OFFSET_INNER_MID); - //assign general properties cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height); cch_text_obj->setColorBody(col_body); if (cc_body_gradient_enable != cc_body_gradient_enable_old) cch_text_obj->getCTextBoxObject()->clearScreenBuffer(); cch_text_obj->setTextColor(cch_col_text); - cch_text_obj->setText(cch_text, cch_caption_align, cch_font); + cch_text_obj->setText(cch_text, cch_caption_align, cch_font, cch_col_text); cch_text_obj->enableTboxSaveScreen(cc_body_gradient_enable || cc_txt_save_screen); //corner of text item From c320dbf8ec424c40795e1eeea212946763ccac2b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 May 2017 10:42:08 +0200 Subject: [PATCH 11/14] CComponentsHeader: remove double text color assignment --- src/gui/components/cc_frm_header.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 21633e22c..e0ae29a75 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -588,7 +588,6 @@ void CComponentsHeader::initCaption() cch_text_obj->setColorBody(col_body); if (cc_body_gradient_enable != cc_body_gradient_enable_old) cch_text_obj->getCTextBoxObject()->clearScreenBuffer(); - cch_text_obj->setTextColor(cch_col_text); cch_text_obj->setText(cch_text, cch_caption_align, cch_font, cch_col_text); cch_text_obj->enableTboxSaveScreen(cc_body_gradient_enable || cc_txt_save_screen); From 178bf6f5968a317cf0913f6bb6e2f0a734a4a343 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 May 2017 10:42:08 +0200 Subject: [PATCH 12/14] CComponentsHeader: fix centering of header title --- src/gui/components/cc_frm_header.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index e0ae29a75..1f075bfac 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -581,7 +581,7 @@ void CComponentsHeader::initCaption() //set alignment of text item in dependency from text alignment if (cch_caption_align == CTextBox::CENTER) - cch_text_x = CC_CENTERED; + cch_text_x = width/2 - cc_text_w/2; //assign general properties cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height); From 5b541571f936275ad7973af6e6c9d90fb5016bfa Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 May 2017 10:42:08 +0200 Subject: [PATCH 13/14] CComponentsHeader: Try to adopt different logo/title alignments Not all constellations are tested. Please report. --- src/gui/components/cc_frm_header.cpp | 56 +++++++++++++++++++++------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 1f075bfac..da59a3b7f 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -302,13 +302,23 @@ void CComponentsHeader::initLogo() //right end int x_logo_right = width - cch_logo_obj->getWidth(); - if (cch_btn_obj) - x_logo_right -= cch_btn_obj->getWidth(); - if (cch_cl_obj) - x_logo_right -= cch_cl_obj->getWidth(); + if (cch_caption_align != CTextBox::RIGHT){ + if (cch_btn_obj) + x_logo_right -= cch_btn_obj->getWidth(); + if (cch_cl_obj) + x_logo_right -= cch_cl_obj->getWidth(); + }else{ + if (cch_icon_obj) + x_logo_right += cch_icon_obj->getWidth(); + } //left end - int x_logo_left = getCCItem(prev_id) ? getCCItem(prev_id)->getXPos() + getCCItem(prev_id)->getWidth() : 0; + int x_logo_left = cch_offset; + if (cch_caption_align != CTextBox::RIGHT) + x_logo_left = getCCItem(prev_id) ? getCCItem(prev_id)->getXPos() + getCCItem(prev_id)->getWidth() : 0; + else + if (cch_icon_obj) + x_logo_left += cch_icon_obj->getWidth(); //calculate available space int logo_space = x_logo_right + cch_logo_obj->getWidth() - x_logo_left; @@ -319,17 +329,30 @@ void CComponentsHeader::initLogo() //set final logo position int x_logo = 0; - if (cch_logo.Align == CC_LOGO_RIGHT) - x_logo = x_logo_right; + if (cch_logo.Align == CC_LOGO_RIGHT){ + if (cch_caption_align == CTextBox::RIGHT) + if (cch_text_obj) + x_logo = cch_text_obj->getXPos() - cch_logo_obj->getWidth(); + else + x_logo = x_logo_right; + } if (cch_logo.Align == CC_LOGO_LEFT) x_logo = x_logo_left; if (cch_logo.Align == CC_LOGO_CENTER){ x_logo = width/2 - cch_logo_obj->getWidth()/2; - //fallback if previous item and logo are overlapping - if (getCCItem(prev_id)){ - int x_tmp = x_logo_left + logo_space/2 - cch_logo_obj->getWidth()/2; - if (x_logo <= x_logo_left) - x_logo = x_tmp; + //fallback if adjacent item and logo are overlapping + if (cch_caption_align != CTextBox::RIGHT){ + if (getCCItem(prev_id)){ + int x_tmp = x_logo_left + logo_space/2 - cch_logo_obj->getWidth()/2; + if (x_logo <= x_logo_left) + x_logo = x_tmp; + } + }else{ + if (cch_text_obj){ + if (x_logo + cch_logo_obj->getWidth() >= cch_text_obj->getXPos()){ + x_logo = (x_logo_left + cch_text_obj->getXPos())/2 - cch_logo_obj->getWidth()/2; + } + } } } @@ -576,13 +599,20 @@ void CComponentsHeader::initCaption() //set header text properties if (cch_text_obj){ + int w_free = cc_text_w; + //recalc caption width - cc_text_w = min(cc_text_w, cch_font->getRenderWidth(cch_text)/*+ OFFSET_INNER_MID*/); + cc_text_w = min(cc_text_w, cch_font->getRenderWidth(cch_text)+ OFFSET_INNER_MID); //set alignment of text item in dependency from text alignment if (cch_caption_align == CTextBox::CENTER) cch_text_x = width/2 - cc_text_w/2; + if (cch_caption_align == CTextBox::RIGHT){ + cch_text_x += w_free; + cch_text_x -= max(cc_text_w, cch_font->getRenderWidth(cch_text)+ OFFSET_INNER_MID); + } + //assign general properties cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height); cch_text_obj->setColorBody(col_body); From 27eb80eb5b51f47c792a0c7ace9b4d597ac61579 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 May 2017 10:42:08 +0200 Subject: [PATCH 14/14] CLuaInstCCWindow: try to fix window title align parameter Additional (lua_Integer)CTextBox::NO_AUTO_LINEBREAK) overwrites passed parameter and has no effect, because NO_AUTO_LINEBREAK is already default. --- src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/lua_cc_window.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 1edd9814a..4320eacbe 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 74 +#define LUA_API_VERSION_MINOR 75 diff --git a/src/gui/lua/lua_cc_window.cpp b/src/gui/lua/lua_cc_window.cpp index 8fb985e67..490a48e37 100644 --- a/src/gui/lua/lua_cc_window.cpp +++ b/src/gui/lua/lua_cc_window.cpp @@ -224,7 +224,7 @@ int CLuaInstCCWindow::CCWindowSetCaption(lua_State *L) lua_Integer alignment = (lua_Integer)CTextBox::NO_AUTO_LINEBREAK; tableLookup(L, "alignment", alignment); - D->w->setWindowCaption(name, alignment | (lua_Integer)CTextBox::NO_AUTO_LINEBREAK); + D->w->setWindowCaption(name, alignment); return 0; }