From c6a0b3ed9b76dcac0f588907d99596ff3354cd76 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 8 Jun 2017 22:37:19 +0300 Subject: [PATCH 1/4] Added: Show image tooltips even if not inside link --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 92b5dee3f..083e8df2d 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1686,18 +1686,28 @@ namespace NLGUI if (present[MY_HTML_IMG_STYLE] && value[MY_HTML_IMG_STYLE]) getStyleParams(value[MY_HTML_IMG_STYLE], style); + // Tooltip + const char *tooltip = NULL; + // keep "alt" attribute for backward compatibility + if (present[MY_HTML_IMG_ALT] && value[MY_HTML_IMG_ALT]) + tooltip = value[MY_HTML_IMG_ALT]; + // tooltip + if (present[MY_HTML_IMG_TITLE] && value[MY_HTML_IMG_TITLE]) + tooltip = value[MY_HTML_IMG_TITLE]; + if (getA() && getParent () && getParent ()->getParent()) { - // Tooltip - const char *tooltip = NULL; - if (present[MY_HTML_IMG_ALT] && value[MY_HTML_IMG_ALT]) - tooltip = value[MY_HTML_IMG_ALT]; - string params = "name=" + getId() + "|url=" + getLink (); addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], "", "browse", params.c_str(), tooltip, style); } else + if (tooltip) + { + addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], + "", "", "", tooltip, style); + } + else { // Get the option to reload (class==reload) bool reloadImg = false; From f80c8e7d81266fd6b996165616f481956b510a59 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 8 Jun 2017 22:37:19 +0300 Subject: [PATCH 2/4] Added: Image mouseover effect --HG-- branch : develop --- code/nel/include/nel/gui/group_html.h | 12 +++--- code/nel/include/nel/gui/libwww.h | 2 + code/nel/src/gui/group_html.cpp | 57 ++++++++++++++++++++------- code/nel/src/gui/libwww.cpp | 2 + 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index e996b6214..da90095a3 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -807,25 +807,27 @@ namespace NLGUI // ImageDownload system enum TDataType {ImgType= 0, BnpType}; + enum TImageType {NormalImage=0, OverImage}; struct CDataImageDownload { public: - CDataImageDownload(CViewBase *img, CStyleParams style): Image(img), Style(style) + CDataImageDownload(CViewBase *img, CStyleParams style, TImageType type): Image(img), Style(style), Type(type) { } public: CViewBase * Image; CStyleParams Style; + TImageType Type; }; struct CDataDownload { public: - CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams()) + CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams(), const TImageType imagetype = NormalImage) : data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0) { - if (t == ImgType) imgs.push_back(CDataImageDownload(i, style)); + if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype)); } public: @@ -848,12 +850,12 @@ namespace NLGUI void initImageDownload(); void checkImageDownload(); - void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams()); + void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams(), const TImageType type = NormalImage); std::string localImageName(const std::string &url); std::string getAbsoluteUrl(const std::string &url); bool isTrustedDomain(const std::string &domain); - void setImage(CViewBase *view, const std::string &file); + void setImage(CViewBase *view, const std::string &file, const TImageType type); void setImageSize(CViewBase *view, const CStyleParams &style = CStyleParams()); // BnpDownload system diff --git a/code/nel/include/nel/gui/libwww.h b/code/nel/include/nel/gui/libwww.h index 22eba2f02..0825779f2 100644 --- a/code/nel/include/nel/gui/libwww.h +++ b/code/nel/include/nel/gui/libwww.h @@ -149,6 +149,8 @@ namespace NLGUI HTML_ATTR(IMG,USEMAP), HTML_ATTR(IMG,VSPACE), HTML_ATTR(IMG,WIDTH), + // not sorted to keep enum values + HTML_ATTR(IMG,DATA_OVER_SRC), }; enum diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 083e8df2d..7e67facfe 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -172,18 +172,25 @@ namespace NLGUI } // Update view after download has finished - void CGroupHTML::setImage(CViewBase * view, const string &file) + void CGroupHTML::setImage(CViewBase * view, const string &file, const TImageType type) { CCtrlButton *btn = dynamic_cast(view); if(btn) { - btn->setTexture (file); - btn->setTexturePushed(file); - btn->invalidateCoords(); - btn->invalidateContent(); - btn->resetInvalidCoords(); - btn->updateCoords(); - paragraphChange(); + if (type == NormalImage) + { + btn->setTexture (file); + btn->setTexturePushed(file); + btn->invalidateCoords(); + btn->invalidateContent(); + btn->resetInvalidCoords(); + btn->updateCoords(); + paragraphChange(); + } + else + { + btn->setTextureOver(file); + } } else { @@ -389,7 +396,7 @@ namespace NLGUI } // Add a image download request in the multi_curl - void CGroupHTML::addImageDownload(const string &url, CViewBase *img, const CStyleParams &style) + void CGroupHTML::addImageDownload(const string &url, CViewBase *img, const CStyleParams &style, TImageType type) { string finalUrl = getAbsoluteUrl(url); @@ -401,7 +408,7 @@ namespace NLGUI #ifdef LOG_DL nlwarning("already downloading '%s' img %p", finalUrl.c_str(), img); #endif - Curls[i].imgs.push_back(CDataImageDownload(img, style)); + Curls[i].imgs.push_back(CDataImageDownload(img, style, type)); return; } } @@ -412,7 +419,7 @@ namespace NLGUI nlwarning("add to download '%s' dest '%s' img %p", finalUrl.c_str(), dest.c_str(), img); #endif - Curls.push_back(CDataDownload(finalUrl, dest, ImgType, img, "", "", style)); + Curls.push_back(CDataDownload(finalUrl, dest, ImgType, img, "", "", style, type)); if (Curls.size() < options.curlMaxConnections) { if (!startCurlDownload(Curls.back())) { @@ -728,7 +735,7 @@ namespace NLGUI CFile::moveFile(it->dest, tmpfile); for(uint i = 0; i < it->imgs.size(); i++) { - setImage(it->imgs[i].Image, it->dest); + setImage(it->imgs[i].Image, it->dest, it->imgs[i].Type); setImageSize(it->imgs[i].Image, it->imgs[i].Style); } } @@ -1695,17 +1702,25 @@ namespace NLGUI if (present[MY_HTML_IMG_TITLE] && value[MY_HTML_IMG_TITLE]) tooltip = value[MY_HTML_IMG_TITLE]; + // Mouse over image + const char *overSrc = value[MY_HTML_IMG_SRC]; + if (present[MY_HTML_IMG_DATA_OVER_SRC] && value[MY_HTML_IMG_DATA_OVER_SRC]) + { + overSrc = value[MY_HTML_IMG_DATA_OVER_SRC]; + } + + if (getA() && getParent () && getParent ()->getParent()) { string params = "name=" + getId() + "|url=" + getLink (); addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], - "", "browse", params.c_str(), tooltip, style); + overSrc, "browse", params.c_str(), tooltip, style); } else - if (tooltip) + if (tooltip || overSrc) { addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], - "", "", "", tooltip, style); + overSrc, "", "", tooltip, style); } else { @@ -4606,6 +4621,18 @@ namespace NLGUI } string over = overBitmap.empty()?"":CFile::getPath(overBitmap) + CFile::getFilenameWithoutExtension(overBitmap) + ".tga"; + // schedule mouseover bitmap for download if its different from normal + if (!over.empty() && !CPath::exists(over)) + { + if (overBitmap != normalBitmap) + { + over = localImageName(overBitmap); + if (!CFile::fileExists(over)) + { + addImageDownload(overBitmap, ctrlButton, style, TImageType::OverImage); + } + } + } ctrlButton->setType (type); if (!normal.empty()) diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index 919d50562..c8b41a38f 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -150,6 +150,8 @@ namespace NLGUI HTML_ATTR(IMG,USEMAP), HTML_ATTR(IMG,VSPACE), HTML_ATTR(IMG,WIDTH), + // not sorted to keep enum values + HTML_ATTR(IMG,DATA-OVER-SRC), { 0 } }; From e0ab70ca8237c738771b4f29d6fc573a6a4947d8 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 8 Jun 2017 22:37:19 +0300 Subject: [PATCH 3/4] Fixed: Correctly expire object if file is removed from cache. --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 7e67facfe..8c309aa46 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -325,7 +325,7 @@ namespace NLGUI time(¤tTime); CHttpCacheObject cache = CHttpCache::getInstance()->lookup(download.dest); - if (cache.Expires > currentTime) + if (CFile::fileExists(download.dest) && cache.Expires > currentTime) { #ifdef LOG_DL nlwarning("Cache for (%s) is not expired (%s, expires:%d)", download.url.c_str(), download.dest.c_str(), cache.Expires - currentTime); From e956f69691f1cc6a04548526f8bd558a4ec912b8 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 8 Jun 2017 22:37:19 +0300 Subject: [PATCH 4/4] Changed: Enable fps view on game config window --HG-- branch : develop --- code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml index bcd2bb808..2728e7854 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml @@ -529,10 +529,8 @@ posref="TL TL" group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color"> -