From 78eee4f22269bbe53c87216e82a2dd2920818d53 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 20 Apr 2015 13:38:51 +0200 Subject: [PATCH] Merge with develop --- code/CMakeLists.txt | 1 - code/CMakeModules/FindLibwww.cmake | 190 --- code/nel/include/nel/gui/group_html.h | 97 +- code/nel/include/nel/gui/libwww.h | 65 +- code/nel/include/nel/gui/libwww_nel_stream.h | 28 - code/nel/include/nel/gui/libwww_types.h | 1073 ++++++++++++++++ code/nel/include/nel/gui/url_parser.h | 63 + code/nel/src/gui/CMakeLists.txt | 4 +- code/nel/src/gui/group_html.cpp | 1117 ++++++++++------- code/nel/src/gui/group_html_parser.cpp | 312 +++++ code/nel/src/gui/libwww.cpp | 529 ++------ code/nel/src/gui/libwww_nel_stream.cpp | 633 ---------- code/nel/src/gui/libwww_types.cpp | 797 ++++++++++++ code/nel/src/gui/url_parser.cpp | 222 ++++ code/nel/src/gui/view_pointer.cpp | 4 +- .../3d/plugin_max/nel_export/nel_export.rc | 609 ++++----- .../nel_export/nel_export_node_properties.cpp | 10 +- .../tools/3d/plugin_max/nel_export/resource.h | 12 +- code/ryzom/client/src/ig_client.cpp | 2 +- .../client/src/interface_v3/group_html_cs.cpp | 4 +- .../client/src/interface_v3/group_html_cs.h | 2 +- .../src/interface_v3/group_html_forum.cpp | 10 +- .../src/interface_v3/group_html_forum.h | 2 +- .../src/interface_v3/group_html_mail.cpp | 10 +- .../client/src/interface_v3/group_html_mail.h | 2 +- .../src/interface_v3/group_html_webig.cpp | 16 +- .../src/interface_v3/group_html_webig.h | 4 +- .../src/interface_v3/group_quick_help.cpp | 2 +- .../src/interface_v3/group_quick_help.h | 2 +- code/ryzom/client/src/light_cycle_manager.cpp | 12 +- code/ryzom/client/src/misc.h | 8 +- 31 files changed, 3607 insertions(+), 2235 deletions(-) delete mode 100644 code/CMakeModules/FindLibwww.cmake delete mode 100644 code/nel/include/nel/gui/libwww_nel_stream.h create mode 100644 code/nel/include/nel/gui/libwww_types.h create mode 100644 code/nel/include/nel/gui/url_parser.h create mode 100644 code/nel/src/gui/group_html_parser.cpp delete mode 100644 code/nel/src/gui/libwww_nel_stream.cpp create mode 100644 code/nel/src/gui/libwww_types.cpp create mode 100644 code/nel/src/gui/url_parser.cpp diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 05286fb4c..440a5fcd3 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -152,7 +152,6 @@ IF(WITH_NEL) ENDIF(WITH_NEL_TESTS) IF(WITH_GUI) - FIND_PACKAGE(Libwww REQUIRED) FIND_PACKAGE(Luabind REQUIRED) FIND_PACKAGE(CURL REQUIRED) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake deleted file mode 100644 index e742c6ae5..000000000 --- a/code/CMakeModules/FindLibwww.cmake +++ /dev/null @@ -1,190 +0,0 @@ -# -# Find the W3C libwww includes and library -# -# This module defines -# LIBWWW_INCLUDE_DIR, where to find tiff.h, etc. -# LIBWWW_LIBRARY, where to find the Libwww library. -# LIBWWW_FOUND, If false, do not try to use Libwww. - -OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) - -# also defined, but not for general use are -IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - # in cache already - SET(Libwww_FIND_QUIETLY TRUE) -ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - -FIND_PATH(LIBWWW_INCLUDE_DIR - WWWInit.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES libwww w3c-libwww -) - -# when installing libwww on mac os x using macports the file wwwconf.h resides -# in /opt/local/include and not in the real libwww include dir :/ -FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR - wwwconf.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include -) - -# combine both include directories into one variable -IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR}) -ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) - -# helper to find all the libwww sub libraries -MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE) - IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - - FIND_LIBRARY(${MYLIBRARY}_RELEASE - NAMES ${FILE} - PATHS - /usr/local/lib - /usr/lib - /usr/lib/x86_64-linux-gnu - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - ) - - FIND_LIBRARY(${MYLIBRARY}_DEBUG - NAMES ${FILE}d - PATHS - /usr/local/lib - /usr/lib - /usr/lib/x86_64-linux-gnu - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - ) - - IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) - ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - - IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSEIF(${MYLIBRARY}_RELEASE) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSEIF(${MYLIBRARY}_DEBUG) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) - MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") - ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) - ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - - MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG) -ENDMACRO(FIND_WWW_LIBRARY) - -MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) - IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) - LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) - ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) -ENDMACRO(LINK_WWW_LIBRARY) - -# Find and link required libs for static or dynamic -FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY REQUIRED wwwapp) # cache core file ftp gopher html http mime news stream telnet trans utils zip xml xmlparse -FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY REQUIRED wwwcore) # utils -FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY REQUIRED wwwfile) # core trans utils html -FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY REQUIRED wwwhtml) # core utils -FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY REQUIRED wwwhttp) # md5 core mime stream utils -FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY REQUIRED wwwmime) # core cache stream utils - -# Required for static or if underlinking -FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY OPTIONAL wwwcache) # core trans utils -FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY OPTIONAL wwwstream) # core file utils - -FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY REQUIRED wwwtrans) # core utils -FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY REQUIRED wwwutils) - - -# Required only if underlinking - -# Unused protocols -FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY OPTIONAL wwwftp) # core file utils -FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY OPTIONAL wwwgopher) # core html utils file -FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY OPTIONAL wwwnews) # core html mime stream utils -FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY OPTIONAL wwwtelnet) # core utils - -# Other used by app -FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY OPTIONAL wwwdir) # file -FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY OPTIONAL wwwinit) # app cache core file html utils -FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY OPTIONAL wwwmux) # core stream trans utils -FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY OPTIONAL wwwxml) # core utils xmlparse -FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY OPTIONAL wwwzip) # core utils -FIND_WWW_LIBRARY(LIBXMLPARSE_LIBRARY OPTIONAL xmlparse) # xmltok - -# Other used by other -FIND_WWW_LIBRARY(LIBXMLTOK_LIBRARY OPTIONAL xmltok) -FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY OPTIONAL wwwssl) -FIND_WWW_LIBRARY(LIBMD5_LIBRARY OPTIONAL md5) -FIND_WWW_LIBRARY(LIBPICS_LIBRARY OPTIONAL pics) - -# Other external libraries -FIND_PACKAGE(EXPAT QUIET) -FIND_PACKAGE(OpenSSL QUIET) -FIND_WWW_LIBRARY(LIBREGEX_LIBRARY OPTIONAL gnu_regex) - -# Now link all libs together -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTLoadCache) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTCacheAppend) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWFTP_LIBRARY HTLoadFTP) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWGOPHER_LIBRARY HTLoadGopher) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWNEWS_LIBRARY HTLoadNews) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWTELNET_LIBRARY HTLoadTelnet) - -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTStreamToChunk) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTGuess_new) -LINK_WWW_LIBRARY(LIBWWWFILE_LIBRARY LIBWWWDIR_LIBRARY HTDir_new) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWINIT_LIBRARY HTProtocolInit) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWXML_LIBRARY HTXML_new) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWZIP_LIBRARY HTZLib_inflate) - -# libwwwxml can be linked to xmlparse or expat -LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY LIBXMLPARSE_LIBRARY XML_ParserCreate) - -IF(LIBXMLPARSE_LIBRARY_LINKED) - LINK_WWW_LIBRARY(LIBXMLPARSE_LIBRARY EXPAT_LIBRARY XmlInitEncoding) -ELSE(LIBXMLPARSE_LIBRARY_LINKED) - LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY EXPAT_LIBRARY XML_ParserCreate) -ENDIF(LIBXMLPARSE_LIBRARY_LINKED) - -LINK_WWW_LIBRARY(LIBWWWHTTP_LIBRARY LIBMD5_LIBRARY MD5Init) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG - LIBWWW_LIBRARIES - LIBWWW_INCLUDE_DIR -) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 920c58948..f52132fad 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -25,14 +25,10 @@ #include "nel/gui/group_tree.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/group_table.h" +#include "nel/gui/libwww_types.h" typedef std::map TStyle; -extern "C" -{ -#include "WWWInit.h" -} - namespace NLGUI { class CCtrlButton; @@ -41,7 +37,8 @@ namespace NLGUI class CDBGroupComboBox; class CGroupParagraph; - + extern std::string CurrentCookie; + extern std::string HTTPCurrentDomain; // HTML group /** @@ -55,15 +52,6 @@ namespace NLGUI public: DECLARE_UI_CLASS( CGroupHTML ) - friend void TextAdd (struct _HText *me, const char * buf, int len); - friend void TextBeginElement (_HText *me, int element_number, const BOOL *present, const char ** value); - friend void TextEndElement (_HText *me, int element_number); - friend void TextLink (struct _HText *me, int element_number, int attribute_number, struct _HTChildAnchor *anchor, const BOOL *present, const char **value); - friend void TextBuild (HText * me, HTextStatus status); - friend void TextBeginUnparsedElement(HText *me, const char *buffer, int length); - friend void TextEndUnparsedElement(HText *me, const char *buffer, int length); - friend int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status); - /// Web browser options for CGroupHTML struct SWebOptions { @@ -102,6 +90,9 @@ namespace NLGUI // Browse virtual void browse (const char *url); + // parse html string using libxml2 parser + virtual bool parseHtml(std::string htmlString); + // Refresh void refresh(); @@ -175,6 +166,34 @@ namespace NLGUI std::string DefaultBackgroundBitmapView; std::string CurrentLinkTitle; + struct TFormField { + public: + TFormField(const std::string &k, const std::string &v) + :name(k),value(v) + {} + std::string name; + std::string value; + }; + + struct SFormFields { + public: + SFormFields() + { + } + + void clear() + { + Values.clear(); + } + + void add(const std::string &key, const std::string &value) + { + Values.push_back(TFormField(key, value)); + } + + std::vector Values; + }; + // Browser home std::string Home; @@ -199,6 +218,7 @@ namespace NLGUI int luaBeginElement(CLuaState &ls); int luaEndElement(CLuaState &ls); int luaShowDiv(CLuaState &ls); + int luaParseHtml(CLuaState &ls); REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText) REFLECT_LUA_METHOD("browse", luaBrowse) @@ -210,6 +230,7 @@ namespace NLGUI REFLECT_LUA_METHOD("beginElement", luaBeginElement) REFLECT_LUA_METHOD("endElement", luaEndElement) REFLECT_LUA_METHOD("showDiv", luaShowDiv) + REFLECT_LUA_METHOD("parseHtml", luaParseHtml) REFLECT_STRING("url", getURL, setURL) REFLECT_FLOAT("timeout", getTimeout, setTimeout) REFLECT_EXPORT_END @@ -228,10 +249,10 @@ namespace NLGUI virtual void addText (const char * buf, int len); // A link has been parsed - virtual void addLink (uint element_number, uint attribute_number, HTChildAnchor *anchor, const BOOL *present, const char **value); + virtual void addLink (uint element_number, const std::vector &present, const std::vector &value); // A new begin HTML element has been parsed ( for exemple) - virtual void beginElement (uint element_number, const BOOL *present, const char **value); + virtual void beginElement (uint element_number, const std::vector &present, const std::vector &value); // A new end HTML element has been parsed ( for exemple) virtual void endElement (uint element_number); @@ -246,10 +267,14 @@ namespace NLGUI virtual void addHTTPGetParams (std::string &url, bool trustedDomain); // Add POST params to the libwww list - virtual void addHTTPPostParams (HTAssocList *formfields, bool trustedDomain); + virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); // the current request is terminated - virtual void requestTerminated(HTRequest *request); + virtual void requestTerminated(); + + // libxml2 html parser functions + void htmlElement(xmlNode *node, int element_number); + void htmlWalkDOM(xmlNode *a_node); // Get Home URL virtual std::string home(); @@ -338,6 +363,7 @@ namespace NLGUI bool _Connecting; double _TimeoutValue; // the timeout in seconds double _ConnectingTimeout; + uint32 _RedirectsRemaining; // minimal embeded lua script support // Note : any embeded script is executed immediately after the closing @@ -351,11 +377,8 @@ namespace NLGUI bool _Object; std::string _ObjectScript; - // Someone is conecting. We got problem with libwww : 2 connection requests can deadlock the client. - static CGroupHTML *_ConnectingLock; - - // LibWWW data - class CLibWWWData *_LibWWW; + // Data container for active curl transfer + class CCurlWWWData * _CurlWWW; // Current paragraph std::string _DivName; @@ -668,6 +691,18 @@ namespace NLGUI // read style attribute void getStyleParams(const std::string &styleString, CStyleParams &style, bool inherit = true); + // load and render local html file (from bnp for example) + void doBrowseLocalFile(const std::string &filename); + + // load remote content using either GET or POST + void doBrowseRemoteUrl(const std::string &url, const std::string &referer, bool doPost = false, const SFormFields &formfields = SFormFields()); + + // render html string as new browser page + bool renderHtmlString(const std::string &html); + + // initialize formfields list from form elements on page + void buildHTTPPostParams (SFormFields &formfields); + private: // decode all HTML entities static ucstring decodeHTMLEntities(const ucstring &str); @@ -677,13 +712,16 @@ namespace NLGUI struct CDataDownload { - CDataDownload(CURL *c, const std::string &u, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m) : curl(c), url(u), luaScript(s), md5sum(m), type(t), fp(f) + public: + CDataDownload(CURL *c, const std::string &u, const std::string &d, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m) : curl(c), url(u), dest(d), luaScript(s), md5sum(m), type(t), fp(f) { if (t == ImgType) imgs.push_back(i); } + public: CURL *curl; std::string url; + std::string dest; std::string luaScript; std::string md5sum; TDataType type; @@ -699,6 +737,7 @@ namespace NLGUI void checkImageDownload(); void addImageDownload(const std::string &url, CViewBase *img); 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); @@ -712,6 +751,13 @@ namespace NLGUI void releaseDownloads(); void checkDownloads(); + // HtmlType download finished + void htmlDownloadFinished(const std::string &content, const std::string &type, long code); + + // cURL transfer callbacks + static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData); + static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData); + static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); }; // adapter group that store y offset for inputs inside an html form @@ -725,7 +771,6 @@ namespace NLGUI xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup); }; - } #endif diff --git a/code/nel/include/nel/gui/libwww.h b/code/nel/include/nel/gui/libwww.h index b1f070ddd..be3d02242 100644 --- a/code/nel/include/nel/gui/libwww.h +++ b/code/nel/include/nel/gui/libwww.h @@ -20,12 +20,10 @@ #ifndef CL_LIB_WWW_H #define CL_LIB_WWW_H -extern "C" -{ -#include "WWWInit.h" -} +#include #include "nel/misc/rgba.h" +#include "nel/gui/libwww_types.h" namespace NLGUI { @@ -35,14 +33,12 @@ namespace NLGUI // *************************************************************************** + // Legacy function from libwww + SGML_dtd * HTML_dtd (void); + // Init the libwww void initLibWWW(); - // Get an url and setup a local domain - const std::string &setCurrentDomain(const std::string &url); - - extern std::string CurrentCookie; - // *************************************************************************** // Some DTD table @@ -230,46 +226,6 @@ namespace NLGUI // *************************************************************************** - // A smart ptr for LibWWW strings - class C3WSmartPtr - { - public: - C3WSmartPtr () - { - _Ptr = NULL; - } - C3WSmartPtr (const char *ptr) - { - _Ptr = ptr; - } - ~C3WSmartPtr () - { - clear(); - } - void operator=(const char *str) - { - clear (); - _Ptr = str; - } - operator const char *() const - { - return _Ptr; - } - void clear() - { - if (_Ptr) - { - void *ptr = (void*)_Ptr; - HT_FREE(ptr); - } - _Ptr = NULL; - } - private: - const char *_Ptr; - }; - - // *************************************************************************** - // Read a width HTML parameter. "100" or "100%". Returns true if percent (0 ~ 1) else false bool getPercentage (sint32 &width, float &percent, const char *str); @@ -280,15 +236,10 @@ namespace NLGUI // *************************************************************************** - void _VerifyLibWWW(const char *function, bool ok, const char *file, int line); - #define VerifyLibWWW(a,b) _VerifyLibWWW(a,(b)!=FALSE,__FILE__,__LINE__) + const std::string &setCurrentDomain(const std::string &uri); + void receiveCookies (CURL *curl, const std::string &domain, bool trusted); + void sendCookies(CURL *curl, const std::string &domain, bool trusted); - // *************************************************************************** - - // Standard request terminator - int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status) ; - - // *************************************************************************** } #endif diff --git a/code/nel/include/nel/gui/libwww_nel_stream.h b/code/nel/include/nel/gui/libwww_nel_stream.h deleted file mode 100644 index 4dbadf1b8..000000000 --- a/code/nel/include/nel/gui/libwww_nel_stream.h +++ /dev/null @@ -1,28 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -#ifndef LIBWWW_NEL_STREAM_H -#define LIBWWW_NEL_STREAM_H - - -#include "HTProt.h" - -extern "C" HTProtCallback HTLoadNeLFile; -extern "C" PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * param, int mode); - -#endif // LIBWWW_NEL_STREAM_H diff --git a/code/nel/include/nel/gui/libwww_types.h b/code/nel/include/nel/gui/libwww_types.h new file mode 100644 index 000000000..4a1c6b238 --- /dev/null +++ b/code/nel/include/nel/gui/libwww_types.h @@ -0,0 +1,1073 @@ +/** + libwww Copyright Notice + [This notice should be placed within redistributed or derivative software + code when appropriate. This particular formulation of W3C's notice for + inclusion in libwww code became active on August 14 1998.] + + LIBWWW COPYRIGHT NOTICE + + libwww: W3C's implementation of HTTP can be found at: + http://www.w3.org/Library/ + + Copyright ¨ 1995-2002 World Wide Web Consortium, + (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en + Automatique, Keio University). All Rights Reserved. + This program is distributed under the W3C's + Intellectual Property License. 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 W3C License + http://www.w3.org/Consortium/Legal/ for more details. + + Copyright ¨ 1995 CERN. "This product includes computer + software created and made available by CERN. This + acknowledgment shall be mentioned in full in any + product which includes the CERN computer software + included herein or parts thereof." + + *****************************************************************************/ + +#ifndef CL_LIB_WWW_TYPES_H +#define CL_LIB_WWW_TYPES_H + +// +// LibWWW elements +// - order must be kept for backward compatibility, new tags can be added to the end +typedef enum _HTMLElement { + HTML_A = 0, + HTML_ABBR, + HTML_ACRONYM, + HTML_ADDRESS, + HTML_APPLET, + HTML_AREA, + HTML_B, + HTML_BASE, + HTML_BASEFONT, + HTML_BDO, + HTML_BIG, + HTML_BLOCKQUOTE, + HTML_BODY, + HTML_BR, + HTML_BUTTON, + HTML_CAPTION, + HTML_CENTER, + HTML_CITE, + HTML_CODE, + HTML_COL, + HTML_COLGROUP, + HTML_DD, + HTML_DEL, + HTML_DFN, + HTML_DIR, + HTML_DIV, + HTML_DL, + HTML_DT, + HTML_EM, + HTML_FIELDSET, + HTML_FONT, + HTML_FORM, + HTML_FRAME, + HTML_FRAMESET, + HTML_H1, + HTML_H2, + HTML_H3, + HTML_H4, + HTML_H5, + HTML_H6, + HTML_HEAD, + HTML_HR, + HTML_HTML, + HTML_I, + HTML_IFRAME, + HTML_IMG, + HTML_INPUT, + HTML_INS, + HTML_ISINDEX, + HTML_KBD, + HTML_LABEL, + HTML_LEGEND, + HTML_LI, + HTML_LINK, + HTML_MAP, + HTML_MENU, + HTML_META, + HTML_NEXTID, /* !!! */ + HTML_NOFRAMES, + HTML_NOSCRIPT, + HTML_OBJECT, + HTML_OL, + HTML_OPTGROUP, + HTML_OPTION, + HTML_P, + HTML_PARAM, + HTML_PRE, + HTML_Q, + HTML_S, + HTML_SAMP, + HTML_SCRIPT, + HTML_SELECT, + HTML_SMALL, + HTML_SPAN, + HTML_STRIKE, + HTML_STRONG, + HTML_STYLE, + HTML_SUB, + HTML_SUP, + HTML_TABLE, + HTML_TBODY, + HTML_TD, + HTML_TEXTAREA, + HTML_TFOOT, + HTML_TH, + HTML_THEAD, + HTML_TITLE, + HTML_TR, + HTML_TT, + HTML_U, + HTML_UL, + HTML_VAR, + // new tags + HTML_LUA, + // this must be the last entry + HTML_ELEMENTS +} HTMLElement; + + +#define HTML_ATTR(t,a) HTML_##t##_##a +#define HTML_ATTRIBUTES(t) HTML_##t##_ATTRIBUTES + +/* + ( + A + ) + */ + +enum _HTML_A_Attributes { + HTML_ATTR(A,ACCESSKEY) = 0, + HTML_ATTR(A,CHARSET), + HTML_ATTR(A,CLASS), + HTML_ATTR(A,COORDS), + HTML_ATTR(A,DIR), + HTML_ATTR(A,HREF), + HTML_ATTR(A,HREFLANG), + HTML_ATTR(A,ID), + HTML_ATTR(A,NAME), + HTML_ATTR(A,REL), + HTML_ATTR(A,REV), + HTML_ATTR(A,SHAPE), + HTML_ATTR(A,STYLE), + HTML_ATTR(A,TABINDEX), + HTML_ATTR(A,TARGET), + HTML_ATTR(A,TYPE), + HTML_ATTR(A,TITLE), + HTML_ATTR(A,Z_ACTION_CATEGORY), // NLGUI + HTML_ATTR(A,Z_ACTION_PARANS), // NLGUI + HTML_ATTR(A,Z_ACTION_SHORTCUT), // NLGUI + HTML_ATTRIBUTES(A) +}; + +/* + ( + APPLET - Deprecated + ) + */ + +enum _HTML_APPLET_Attributes { + HTML_ATTR(APPLET,ALIGN) = 0, + HTML_ATTR(APPLET,ALT), + HTML_ATTR(APPLET,ARCHIVE), + HTML_ATTR(APPLET,CLASS), + HTML_ATTR(APPLET,CODE), + HTML_ATTR(APPLET,CODEBASE), + HTML_ATTR(APPLET,HEIGHT), + HTML_ATTR(APPLET,HSPACE), + HTML_ATTR(APPLET,ID), + HTML_ATTR(APPLET,NAME), + HTML_ATTR(APPLET,OBJECT), + HTML_ATTR(APPLET,STYLE), + HTML_ATTR(APPLET,TITLE), + HTML_ATTR(APPLET,VSPACE), + HTML_ATTR(APPLET,WIDTH), + HTML_ATTRIBUTES(APPLET) +}; + +/* + ( + AREA + ) + */ + +enum _HTML_AREA_Attributes { + HTML_ATTR(AREA,ACCESSKEY) = 0, + HTML_ATTR(AREA,ALT), + HTML_ATTR(AREA,CLASS), + HTML_ATTR(AREA,COORDS), + HTML_ATTR(AREA,DIR), + HTML_ATTR(AREA,HREF), + HTML_ATTR(AREA,ID), + HTML_ATTR(AREA,NAME), + HTML_ATTR(AREA,NOHREF), + HTML_ATTR(AREA,LANG), + HTML_ATTR(AREA,SHAPE), + HTML_ATTR(AREA,STYLE), + HTML_ATTR(AREA,TABINDEX), + HTML_ATTR(AREA,TARGET), + HTML_ATTR(AREA,TITLE), + HTML_ATTRIBUTES(AREA) +}; + + +/* + ( + BASE + ) + */ + +enum _HTML_BASE_Attributes { + HTML_ATTR(BASE,HREF) = 0, + HTML_ATTR(BASE,TARGET), + HTML_ATTRIBUTES(BASE) +}; + +/* + ( + BDO + ) + */ + +enum _HTML_BDO_Attributes { + HTML_ATTR(BDO,CLASS) = 0, + HTML_ATTR(BDO,DIR), + HTML_ATTR(BDO,ID), + HTML_ATTR(BDO,LANG), + HTML_ATTR(BDO,STYLE), + HTML_ATTR(BDO,TITLE), + HTML_ATTRIBUTES(BDO) +}; + +/* + ( + BLOCKQUOTE + ) + */ + +enum _HTML_BQ_Attributes { + HTML_ATTR(BQ,CITE) = 0, + HTML_ATTR(BQ,CLASS), + HTML_ATTR(BQ,DIR), + HTML_ATTR(BQ,ID), + HTML_ATTR(BQ,LANG), + HTML_ATTR(BQ,STYLE), + HTML_ATTR(BQ,TITLE), + HTML_ATTRIBUTES(BQ) +}; + +/* + ( + BODY + ) + */ + +enum _HTML_BODY_Attributes { + HTML_ATTR(BODY,ALINK) = 0, + HTML_ATTR(BODY,BACKGROUND), + HTML_ATTR(BODY,BGCOLOR), + HTML_ATTR(BODY,CLASS), + HTML_ATTR(BODY,DIR), + HTML_ATTR(BODY,ID), + HTML_ATTR(BODY,LANG), + HTML_ATTR(BODY,LINK), + HTML_ATTR(BODY,STYLE), + HTML_ATTR(BODY,TEXT), + HTML_ATTR(BODY,TITLE), + HTML_ATTR(BODY,VLINK), + HTML_ATTRIBUTES(BODY) +}; + +/* + ( + BR + ) + */ + +enum _HTML_BR_Attributes { + HTML_ATTR(BR,CLASS) = 0, + HTML_ATTR(BR,CLEAR), + HTML_ATTR(BR,ID), + HTML_ATTR(BR,STYLE), + HTML_ATTR(BR,TITLE), + HTML_ATTRIBUTES(BR) +}; + +/* + ( + BUTTON + ) + */ + +enum _HTML_BUTTON_Attributes { + HTML_ATTR(BUTTON,ACCESSKEY) = 0, + HTML_ATTR(BUTTON,CLASS), + HTML_ATTR(BUTTON,DIR), + HTML_ATTR(BUTTON,DISABLED), + HTML_ATTR(BUTTON,ID), + HTML_ATTR(BUTTON,LANG), + HTML_ATTR(BUTTON,NAME), + HTML_ATTR(BUTTON,STYLE), + HTML_ATTR(BUTTON,TABINDEX), + HTML_ATTR(BUTTON,TITLE), + HTML_ATTR(BUTTON,TYPE), + HTML_ATTR(BUTTON,VALUE), + HTML_ATTRIBUTES(BUTTON) +}; + +/* + ( + COL + ) + */ + +enum _HTML_COL_Attributes { + HTML_ATTR(COL,CLASS) = 0, + HTML_ATTR(COL,DIR), + HTML_ATTR(COL,ID), + HTML_ATTR(COL,LANG), + HTML_ATTR(COL,SPAN), + HTML_ATTR(COL,STYLE), + HTML_ATTR(COL,TITLE), + HTML_ATTR(COL,WIDTH), + HTML_ATTRIBUTES(COL) +}; + +/* + ( + DEL, INS + ) + */ + +enum _HTML_CHANGES_Attributes { + HTML_ATTR(CHANGES,CITE) = 0, + HTML_ATTR(CHANGES,CLASS), + HTML_ATTR(CHANGES,DATETIME), + HTML_ATTR(CHANGES,DIR), + HTML_ATTR(CHANGES,ID), + HTML_ATTR(CHANGES,LANG), + HTML_ATTR(CHANGES,STYLE), + HTML_ATTR(CHANGES,TITLE), + HTML_ATTRIBUTES(CHANGES) +}; + +/* + ( + FONT - Deprecated + ) + */ + +enum _HTML_FONT_Attributes { + HTML_ATTR(FONT,CLASS) = 0, + HTML_ATTR(FONT,COLOR), + HTML_ATTR(FONT,DIR), + HTML_ATTR(FONT,FACE), + HTML_ATTR(FONT,ID), + HTML_ATTR(FONT,LANG), + HTML_ATTR(FONT,SIZE), + HTML_ATTR(FONT,STYLE), + HTML_ATTR(FONT,TITLE), + HTML_ATTRIBUTES(FONT) +}; + +/* + ( + FORM + ) + */ + +enum _HTML_FORM_Attributes { + HTML_ATTR(FORM,ACCEPT) = 0, + HTML_ATTR(FORM,ACCEPT_CHARSET), /* { "ACCEPT-CHARSET" } */ + HTML_ATTR(FORM,ACTION), + HTML_ATTR(FORM,CLASS), + HTML_ATTR(FORM,DIR), + HTML_ATTR(FORM,ENCTYPE), + HTML_ATTR(FORM,ID), + HTML_ATTR(FORM,LANG), + HTML_ATTR(FORM,METHOD), + HTML_ATTR(FORM,STYLE), + HTML_ATTR(FORM,TARGET), + HTML_ATTR(FORM,TITLE), + HTML_ATTRIBUTES(FORM) +}; + +/* + ( + FRAME + ) + */ + +enum _HTML_FRAME_Attributes { + HTML_ATTR(FRAME,CLASS) = 0, + HTML_ATTR(FRAME,FRAMEBORDER), + HTML_ATTR(FRAME,ID), + HTML_ATTR(FRAME,NAME), + HTML_ATTR(FRAME,MARGINHEIGHT), + HTML_ATTR(FRAME,MARGINWIDTH), + HTML_ATTR(FRAME,NORESIZE), + HTML_ATTR(FRAME,LONGDESC), + HTML_ATTR(FRAME,SCROLLING), + HTML_ATTR(FRAME,SRC), + HTML_ATTR(FRAME,STYLE), + HTML_ATTR(FRAME,TARGET), + HTML_ATTR(FRAME,TITLE), + HTML_ATTRIBUTES(FRAME) +}; + +/* + ( + FRAMESET + ) + */ + +enum _HTML_FRAMESET_Attributes { + HTML_ATTR(FRAMESET,CLASS) = 0, + HTML_ATTR(FRAMESET,COLS), + HTML_ATTR(FRAMESET,ID), + HTML_ATTR(FRAMESET,ROWS), + HTML_ATTR(FRAMESET,STYLE), + HTML_ATTR(FRAMESET,TITLE), + HTML_ATTRIBUTES(FRAMESET) +}; + +/* + ( + Generic attributes + ) + */ + +enum _HTML_GEN_Attributes { + HTML_ATTR(GEN,CLASS) = 0, + HTML_ATTR(GEN,DIR), + HTML_ATTR(GEN,ID), + HTML_ATTR(GEN,LANG), + HTML_ATTR(GEN,STYLE), + HTML_ATTR(GEN,TITLE), + HTML_ATTRIBUTES(GEN) +}; + +/* + ( + BLOCK + ) + */ + +enum _HTML_BLOCK_Attributes { + HTML_ATTR(BLOCK,ALIGN) = 0, + HTML_ATTR(BLOCK,CLASS), + HTML_ATTR(BLOCK,DIR), + HTML_ATTR(BLOCK,ID), + HTML_ATTR(BLOCK,LANG), + HTML_ATTR(BLOCK,STYLE), + HTML_ATTR(BLOCK,TITLE), + HTML_ATTRIBUTES(BLOCK) +}; + +/* + ( + HEAD + ) + */ + +enum _HTML_HEAD_Attributes { + HTML_ATTR(HEAD,DIR) = 0, + HTML_ATTR(HEAD,LANG), + HTML_ATTR(HEAD,PROFILE), + HTML_ATTRIBUTES(HEAD) +}; + +/* + ( + HR + ) + */ + +enum _HTML_HR_Attributes { + HTML_ATTR(HR,ALIGN) = 0, + HTML_ATTR(HR,CLASS), + HTML_ATTR(HR,DIR), + HTML_ATTR(HR,ID), + HTML_ATTR(HR,LANG), + HTML_ATTR(HR,NOSHADE), + HTML_ATTR(HR,SIZE), + HTML_ATTR(HR,STYLE), + HTML_ATTR(HR,TITLE), + HTML_ATTR(HR,WIDTH), + HTML_ATTRIBUTES(HR) +}; + +/* + ( + HTML + ) + */ + +enum _HTML_HTML_Attributes { + HTML_ATTR(HTML,DIR) = 0, + HTML_ATTR(HTML,LANG), + HTML_ATTR(HTML,VERSION), + HTML_ATTRIBUTES(HTML) +}; + +/* + ( + IFRAME + ) + */ + +enum _HTML_IFRAME_Attributes { + HTML_ATTR(IFRAME,ALIGN) = 0, + HTML_ATTR(IFRAME,CLASS), + HTML_ATTR(IFRAME,FRAMEBORDER), + HTML_ATTR(IFRAME,HEIGHT), + HTML_ATTR(IFRAME,ID), + HTML_ATTR(IFRAME,LONGDESC), + HTML_ATTR(IFRAME,MARGINHEIGHT), + HTML_ATTR(IFRAME,MARGINWIDTH), + HTML_ATTR(IFRAME,NAME), + HTML_ATTR(IFRAME,SCROLLING), + HTML_ATTR(IFRAME,SRC), + HTML_ATTR(IFRAME,STYLE), + HTML_ATTR(IFRAME,TARGET), + HTML_ATTR(IFRAME,TITLE), + HTML_ATTR(IFRAME,WIDTH), + HTML_ATTRIBUTES(IFRAME) +}; + +/* + ( + IMG + ) + */ + +enum _HTML_IMG_Attributes { + HTML_ATTR(IMG,ALIGN) = 0, + HTML_ATTR(IMG,ALT), + HTML_ATTR(IMG,BORDER), + HTML_ATTR(IMG,CLASS), + HTML_ATTR(IMG,DIR), + HTML_ATTR(IMG,HEIGHT), + HTML_ATTR(IMG,HSPACE), + HTML_ATTR(IMG,ID), + HTML_ATTR(IMG,ISMAP), + HTML_ATTR(IMG,LANG), + HTML_ATTR(IMG,LONGDESC), + HTML_ATTR(IMG,SRC), + HTML_ATTR(IMG,STYLE), + HTML_ATTR(IMG,TITLE), + HTML_ATTR(IMG,USEMAP), + HTML_ATTR(IMG,VSPACE), + HTML_ATTR(IMG,WIDTH), + HTML_ATTRIBUTES(IMG) +}; + +/* + ( + INPUT + ) + */ + +enum _HTML_INPUT_Attributes { + HTML_ATTR(INPUT,ACCEPT) = 0, + HTML_ATTR(INPUT,ACCESSKEY), + HTML_ATTR(INPUT,ALIGN), + HTML_ATTR(INPUT,ALT), + HTML_ATTR(INPUT,CHECKED), + HTML_ATTR(INPUT,CLASS), + HTML_ATTR(INPUT,DIR), + HTML_ATTR(INPUT,DISABLED), + HTML_ATTR(INPUT,ID), + HTML_ATTR(INPUT,LANG), + HTML_ATTR(INPUT,MAXLENGTH), + HTML_ATTR(INPUT,NAME), + HTML_ATTR(INPUT,READONLY), + HTML_ATTR(INPUT,SIZE), + HTML_ATTR(INPUT,SRC), + HTML_ATTR(INPUT,STYLE), + HTML_ATTR(INPUT,TABINDEX), + HTML_ATTR(INPUT,TITLE), + HTML_ATTR(INPUT,TYPE), + HTML_ATTR(INPUT,USEMAP), + HTML_ATTR(INPUT,VALUE), + HTML_ATTRIBUTES(INPUT) +}; + +/* + ( + ) + */ + +enum _HTML_ISINDEX_Attributes { + HTML_ATTR(ISINDEX,CLASS) = 0, + HTML_ATTR(ISINDEX,DIR), + HTML_ATTR(ISINDEX,ID), + HTML_ATTR(ISINDEX,LANG), + HTML_ATTR(ISINDEX,PROMPT), + HTML_ATTR(ISINDEX,STYLE), + HTML_ATTR(ISINDEX,TITLE), + HTML_ATTRIBUTES(ISINDEX) +}; + +/* + ( + ) + */ + +enum _HTML_LABEL_Attributes { + HTML_ATTR(LABEL,ACCESSKEY) = 0, + HTML_ATTR(LABEL,CLASS), + HTML_ATTR(LABEL,DIR), + HTML_ATTR(LABEL,FOR), + HTML_ATTR(LABEL,ID), + HTML_ATTR(LABEL,LANG), + HTML_ATTR(LABEL,STYLE), + HTML_ATTR(LABEL,TITLE), + HTML_ATTRIBUTES(LABEL) +}; + +/* + ( + ) + */ + +enum _HTML_LEGEND_Attributes { + HTML_ATTR(LEGEND,ACCESSKEY) = 0, + HTML_ATTR(LEGEND,ALIGN), + HTML_ATTR(LEGEND,CLASS), + HTML_ATTR(LEGEND,DIR), + HTML_ATTR(LEGEND,ID), + HTML_ATTR(LEGEND,LANG), + HTML_ATTR(LEGEND,STYLE), + HTML_ATTR(LEGEND,TITLE), + HTML_ATTRIBUTES(LEGEND) +}; + +/* + ( + LI + ) + */ + +enum _HTML_LI_Attributes { + HTML_ATTR(LI,CLASS) = 0, + HTML_ATTR(LI,COMPACT), + HTML_ATTR(LI,DIR), + HTML_ATTR(LI,ID), + HTML_ATTR(LI,LANG), + HTML_ATTR(LI,STYLE), + HTML_ATTR(LI,TITLE), + HTML_ATTR(LI,TYPE), + HTML_ATTR(LI,VALUE), + HTML_ATTRIBUTES(LI) +}; + +/* + ( + LINK + ) + */ + +enum _HTML_LINK_Attributes { + HTML_ATTR(LINK,CHARSET) = 0, + HTML_ATTR(LINK,CLASS), + HTML_ATTR(LINK,DIR), + HTML_ATTR(LINK,HREF), + HTML_ATTR(LINK,HREFLANG), + HTML_ATTR(LINK,ID), + HTML_ATTR(LINK,LANG), + HTML_ATTR(LINK,MEDIA), + HTML_ATTR(LINK,REL), + HTML_ATTR(LINK,REV), + HTML_ATTR(LINK,STYLE), + HTML_ATTR(LINK,TARGET), + HTML_ATTR(LINK,TITLE), + HTML_ATTR(LINK,TYPE), + HTML_ATTRIBUTES(LINK) +}; + +/* + ( + MAP + ) + */ + +enum _HTML_MAP_Attributes { + HTML_ATTR(MAP,CLASS) = 0, + HTML_ATTR(MAP,DIR), + HTML_ATTR(MAP,ID), + HTML_ATTR(MAP,LANG), + HTML_ATTR(MAP,NAME), + HTML_ATTR(MAP,STYLE), + HTML_ATTR(MAP,TITLE), + HTML_ATTRIBUTES(MAP) +}; + +/* + ( + META + ) + */ + +enum _HTML_META_Attributes { + HTML_ATTR(META,CONTENT) = 0, + HTML_ATTR(META,DIR), + HTML_ATTR(META,HTTP_EQUIV), /* { "HTTP-EQUIV" ) */ + HTML_ATTR(META,LANG), + HTML_ATTR(META,NAME), + HTML_ATTR(META,SCHEME), + HTML_ATTRIBUTES(META) +}; + +/* + ( + NEXTID + ) + */ + +#define HTML_NEXTID_ATTRIBUTES 1 +#define HTML_NEXTID_N 0 + +/* + ( + OBJECT + ) + */ + +enum _HTML_OBJECT_Attributes { + HTML_ATTR(OBJECT,ALIGN) = 0, + HTML_ATTR(OBJECT,ARCHIVE), + HTML_ATTR(OBJECT,BORDER), + HTML_ATTR(OBJECT,CLASS), + HTML_ATTR(OBJECT,CLASSID), + HTML_ATTR(OBJECT,CODEBASE), + HTML_ATTR(OBJECT,CODETYPE), + HTML_ATTR(OBJECT,DATA), + HTML_ATTR(OBJECT,DECLARE), + HTML_ATTR(OBJECT,DIR), + HTML_ATTR(OBJECT,HEIGHT), + HTML_ATTR(OBJECT,HSPACE), + HTML_ATTR(OBJECT,ID), + HTML_ATTR(OBJECT,LANG), + HTML_ATTR(OBJECT,NAME), + HTML_ATTR(OBJECT,STANDBY), + HTML_ATTR(OBJECT,STYLE), + HTML_ATTR(OBJECT,TABINDEX), + HTML_ATTR(OBJECT,TITLE), + HTML_ATTR(OBJECT,TYPE), + HTML_ATTR(OBJECT,USEMAP), + HTML_ATTR(OBJECT,VSPACE), + HTML_ATTR(OBJECT,WIDTH), + HTML_ATTRIBUTES(OBJECT) +}; + +/* + ( + OL + ) + */ + +enum _HTML_OL_Attributes { + HTML_ATTR(OL,CLASS) = 0, + HTML_ATTR(OL,COMPACT), + HTML_ATTR(OL,DIR), + HTML_ATTR(OL,ID), + HTML_ATTR(OL,LANG), + HTML_ATTR(OL,START), + HTML_ATTR(OL,STYLE), + HTML_ATTR(OL,TITLE), + HTML_ATTR(OL,TYPE), + HTML_ATTRIBUTES(OL) +}; + +/* + ( + OPTGROUP + ) + */ + +enum _HTML_OPTGROUP_Attributes { + HTML_ATTR(OPTGROUP,CLASS) = 0, + HTML_ATTR(OPTGROUP,DISABLED), + HTML_ATTR(OPTGROUP,DIR), + HTML_ATTR(OPTGROUP,ID), + HTML_ATTR(OPTGROUP,LABEL), + HTML_ATTR(OPTGROUP,LANG), + HTML_ATTR(OPTGROUP,STYLE), + HTML_ATTR(OPTGROUP,TITLE), + HTML_ATTRIBUTES(OPTGROUP) +}; + +/* + ( + OPTION + ) + */ + +enum _HTML_OPTION_Attributes { + HTML_ATTR(OPTION,CLASS) = 0, + HTML_ATTR(OPTION,DISABLED), + HTML_ATTR(OPTION,DIR), + HTML_ATTR(OPTION,ID), + HTML_ATTR(OPTION,LABEL), + HTML_ATTR(OPTION,LANG), + HTML_ATTR(OPTION,SELECTED), + HTML_ATTR(OPTION,STYLE), + HTML_ATTR(OPTION,TITLE), + HTML_ATTR(OPTION,VALUE), + HTML_ATTRIBUTES(OPTION) +}; + +/* + ( + PARAM + ) + */ + +enum _HTML_PARAM_Attributes { + HTML_ATTR(PARAM,ID) = 0, + HTML_ATTR(PARAM,NAME), + HTML_ATTR(PARAM,TYPE), + HTML_ATTR(PARAM,VALUE), + HTML_ATTR(PARAM,VALUETYPE), + HTML_ATTRIBUTES(PARAM) +}; + +/* + ( + PRE + ) + */ + +enum _HTML_PRE_Attributes { + HTML_ATTR(PRE,CLASS) = 0, + HTML_ATTR(PRE,DIR), + HTML_ATTR(PRE,ID), + HTML_ATTR(PRE,LANG), + HTML_ATTR(PRE,STYLE), + HTML_ATTR(PRE,TITLE), + HTML_ATTR(PRE,WIDTH), + HTML_ATTRIBUTES(PRE) +}; + +/* + ( + SCRIPT + ) + */ + +enum _HTML_SCRIPT_Attributes { + HTML_ATTR(SCRIPT,CHARSET) = 0, + HTML_ATTR(SCRIPT,DEFER), + HTML_ATTR(SCRIPT,LANGUAGE), + HTML_ATTR(SCRIPT,SRC), + HTML_ATTR(SCRIPT,TYPE), + HTML_ATTRIBUTES(SCRIPT) +}; + +/* + ( + SELECT + ) + */ + +enum _HTML_SELECT_Attributes { + HTML_ATTR(SELECT,CLASS) = 0, + HTML_ATTR(SELECT,DIR), + HTML_ATTR(SELECT,DISABLED), + HTML_ATTR(SELECT,ID), + HTML_ATTR(SELECT,LANG), + HTML_ATTR(SELECT,MULTIPLE), + HTML_ATTR(SELECT,NAME), + HTML_ATTR(SELECT,SIZE), + HTML_ATTR(SELECT,STYLE), + HTML_ATTR(SELECT,TABINDEX), + HTML_ATTR(SELECT,TITLE), + HTML_ATTRIBUTES(SELECT) +}; + +/* + ( + STYLE + ) + */ + +enum _HTML_STYLE_Attributes { + HTML_ATTR(STYLE,DIR) = 0, + HTML_ATTR(STYLE,LANG), + HTML_ATTR(STYLE,MEDIA), + HTML_ATTR(STYLE,TITLE), + HTML_ATTR(STYLE,TYPE), + HTML_ATTRIBUTES(STYLE) +}; + +/* + ( + TABLE + ) + */ + +enum _HTML_TABLE_Attributes { + HTML_ATTR(TABLE,ALIGN) = 0, + HTML_ATTR(TABLE,BGCOLOR), + HTML_ATTR(TABLE,BORDER), + HTML_ATTR(TABLE,CELLPADDING), + HTML_ATTR(TABLE,CELLSPACING), + HTML_ATTR(TABLE,CLASS), + HTML_ATTR(TABLE,DIR), + HTML_ATTR(TABLE,FRAME), + HTML_ATTR(TABLE,ID), + HTML_ATTR(TABLE,LANG), + HTML_ATTR(TABLE,RULES), + HTML_ATTR(TABLE,SUMMARY), + HTML_ATTR(TABLE,STYLE), + HTML_ATTR(TABLE,TITLE), + HTML_ATTR(TABLE,WIDTH), + HTML_ATTRIBUTES(TABLE) +}; + +/* + ( + TABLE Elements + ) + */ + +enum _HTML_TELE_Attributes { + HTML_ATTR(TELE,ALIGN) = 0, + HTML_ATTR(TELE,CHAR), + HTML_ATTR(TELE,CHAROFF), + HTML_ATTR(TELE,CLASS), + HTML_ATTR(TELE,DIR), + HTML_ATTR(TELE,ID), + HTML_ATTR(TELE,LANG), + HTML_ATTR(TELE,STYLE), + HTML_ATTR(TELE,TITLE), + HTML_ATTR(TELE,VALIGN), + HTML_ATTRIBUTES(TELE) +}; + +/* + ( + TD + ) + */ + +enum _HTML_TD_Attributes { + HTML_ATTR(TD,ABBR) = 0, + HTML_ATTR(TD,ALIGN), + HTML_ATTR(TD,AXIS), + HTML_ATTR(TD,BGCOLOR), + HTML_ATTR(TD,CHAR), + HTML_ATTR(TD,CHAROFF), + HTML_ATTR(TD,CLASS), + HTML_ATTR(TD,COLSPAN), + HTML_ATTR(TD,DIR), + HTML_ATTR(TD,ID), + HTML_ATTR(TD,HEADERS), + HTML_ATTR(TD,HEIGHT), + HTML_ATTR(TD,LANG), + HTML_ATTR(TD,NOWRAP), + HTML_ATTR(TD,ROWSPAN), + HTML_ATTR(TD,SCOPE), + HTML_ATTR(TD,STYLE), + HTML_ATTR(TD,TITLE), + HTML_ATTR(TD,VALIGN), + HTML_ATTR(TD,WIDTH), + HTML_ATTRIBUTES(TD) +}; + +/* + ( + TEXTAREA + ) + */ + +enum _HTML_TEXTAREA_Attributes { + HTML_ATTR(TEXTAREA,CLASS) = 0, + HTML_ATTR(TEXTAREA,COLS), + HTML_ATTR(TEXTAREA,DIR), + HTML_ATTR(TEXTAREA,DISABLED), + HTML_ATTR(TEXTAREA,ID), + HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,NAME), + HTML_ATTR(TEXTAREA,READONLY), + HTML_ATTR(TEXTAREA,ROWS), + HTML_ATTR(TEXTAREA,STYLE), + HTML_ATTR(TEXTAREA,TABINDEX), + HTML_ATTR(TEXTAREA,TITLE), + HTML_ATTRIBUTES(TEXTAREA) +}; + +/* + ( + TITLE + ) + */ + +enum _HTML_TITLE_Attributes { + HTML_ATTR(TITLE,DIR) = 0, + HTML_ATTR(TITLE,LANG), + HTML_ATTRIBUTES(TITLE) +}; + +/* + ( + UL + ) + */ + +enum _HTML_UL_Attributes { + HTML_ATTR(UL,CLASS) = 0, + HTML_ATTR(UL,COMPACT), + HTML_ATTR(UL,DIR), + HTML_ATTR(UL,ID), + HTML_ATTR(UL,LANG), + HTML_ATTR(UL,STYLE), + HTML_ATTR(UL,TITLE), + HTML_ATTR(UL,TYPE), + HTML_ATTRIBUTES(UL) +}; + + +/* +** ELEMENTS +** Must match definitions in HTMLPDTD.html! +** Must be in alphabetical order. +** +** Name, Attributes, content +*/ + +// +// SGML.h +// +#define MAX_ATTRIBUTES 32 + +typedef struct _HTAttr { + char * name; +} HTAttr; + +// striped struct +typedef struct _HTTag { + std::string name; + HTAttr * attributes; + int number_of_attributes; +} HTTag; + +// entities are removed +typedef struct { + HTTag * tags; + int number_of_tags; +} SGML_dtd; + +SGML_dtd * HTML_dtd (void); + +#endif + diff --git a/code/nel/include/nel/gui/url_parser.h b/code/nel/include/nel/gui/url_parser.h new file mode 100644 index 000000000..b47e67b37 --- /dev/null +++ b/code/nel/include/nel/gui/url_parser.h @@ -0,0 +1,63 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_URL_PARSER_H +#define CL_URL_PARSER_H + +#include + +namespace NLGUI +{ + /** + * Simple URL parser + * \author Meelis Mägi + * \date 2015 + */ + class CUrlParser + { + public: + CUrlParser(){} + + // parse uri to components + CUrlParser(const std::string &url); + + // parse uri to components + void parse(std::string uri); + + // serialize URL back to string + std::string toString() const; + + // inherit scheme, domain, path from given url + void inherit(const std::string &url); + + // if current parts can compose absolute url or not + bool isAbsolute() const; + + // resolve relative path like './a/../b' to absolute path '/a/b' + static void resolveRelativePath(std::string &path); + + public: + std::string scheme; + std::string domain; + std::string path; + std::string query; + std::string hash; + }; + +}// namespace + +#endif // CL_URL_PARSER_H + diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index 32125791d..6e82b2240 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -6,9 +6,9 @@ SOURCE_GROUP("src" FILES ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) -INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR} ${CURL_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${CURL_INCLUDE_DIRS}) -TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBWWW_LIBRARIES} ${CURL_LIBRARIES}) +TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${CURL_LIBRARIES}) SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nelgui "NeL, Library: NeL GUI") NL_ADD_RUNTIME_FLAGS(nelgui) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 4dd9ea7ac..9cfdc1ef0 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -19,14 +19,6 @@ #include "stdpch.h" #include "nel/gui/group_html.h" -// LibWWW -extern "C" -{ -#include "WWWLib.h" /* Global Library Include file */ -#include "WWWApp.h" -#include "WWWInit.h" -} - #include #include "nel/misc/types_nl.h" #include "nel/misc/rgba.h" @@ -51,13 +43,16 @@ extern "C" #include "nel/misc/md5.h" #include "nel/3d/texture_file.h" #include "nel/misc/big_file.h" +#include "nel/gui/url_parser.h" using namespace std; using namespace NLMISC; // Default timeout to connect a server -#define DEFAULT_RYZOM_CONNECTION_TIMEOUT (10.0) +#define DEFAULT_RYZOM_CONNECTION_TIMEOUT (30.0) +// Allow up to 10 redirects, then give up +#define DEFAULT_RYZOM_REDIRECT_LIMIT (10) namespace NLGUI { @@ -65,10 +60,62 @@ namespace NLGUI // Uncomment to see the log about image download //#define LOG_DL 1 - CGroupHTML *CGroupHTML::_ConnectingLock = NULL; CGroupHTML::SWebOptions CGroupHTML::options; + // Active cURL www transfer + class CCurlWWWData + { + public: + CCurlWWWData(CURL *curl, const std::string &url) + : Request(curl), Url(url), Content(""), HeadersSent(NULL) + { + } + ~CCurlWWWData() + { + if (Request) + curl_easy_cleanup(Request); + + if (HeadersSent) + curl_slist_free_all(HeadersSent); + } + + void setRecvHeader(const std::string &header) + { + size_t pos = header.find(": "); + if (pos == std::string::npos) + return; + + std::string key = toLower(header.substr(0, pos)); + if (pos != std::string::npos) + { + HeadersRecv[key] = header.substr(pos + 2); + //nlinfo(">> received header '%s' = '%s'", key.c_str(), HeadersRecv[key].c_str()); + } + } + + // return last received "Location: " header or empty string if no header set + const std::string getLocationHeader() + { + if (HeadersRecv.count("location") > 0) + return HeadersRecv["location"]; + + return ""; + } + + public: + CURL *Request; + + std::string Url; + std::string Content; + + // headers sent with curl request, must be released after transfer + curl_slist * HeadersSent; + + // headers received from curl transfer + std::map HeadersRecv; + }; + // Check if domain is on TrustedDomain bool CGroupHTML::isTrustedDomain(const string &domain) { @@ -130,13 +177,15 @@ namespace NLGUI // Add a image download request in the multi_curl void CGroupHTML::addImageDownload(const string &url, CViewBase *img) { + string finalUrl = getAbsoluteUrl(url); + // Search if we are not already downloading this url. for(uint i = 0; i < Curls.size(); i++) { - if(Curls[i].url == url) + if(Curls[i].url == finalUrl) { #ifdef LOG_DL - nlwarning("already downloading '%s' img %p", url.c_str(), img); + nlwarning("already downloading '%s' img %p", finalUrl.c_str(), img); #endif Curls[i].imgs.push_back(img); return; @@ -145,12 +194,13 @@ namespace NLGUI CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true); - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_URL, finalUrl.c_str()); + // use requested url for local name string dest = localImageName(url); string tmpdest = localImageName(url)+".tmp"; #ifdef LOG_DL - nlwarning("add to download '%s' dest '%s' img %p", url.c_str(), dest.c_str(), img); + nlwarning("add to download '%s' dest '%s' img %p", finalUrl.c_str(), dest.c_str(), img); #endif // erase the tmp file if exists @@ -169,7 +219,7 @@ namespace NLGUI curl_easy_setopt(curl, CURLOPT_FILE, fp); curl_multi_add_handle(MultiCurl, curl); - Curls.push_back(CDataDownload(curl, url, fp, ImgType, img, "", "")); + Curls.push_back(CDataDownload(curl, finalUrl, dest, fp, ImgType, img, "", "")); #ifdef LOG_DL nlwarning("adding handle %x, %d curls", curl, Curls.size()); #endif @@ -264,7 +314,7 @@ namespace NLGUI curl_easy_setopt(curl, CURLOPT_FILE, fp); curl_multi_add_handle(MultiCurl, curl); - Curls.push_back(CDataDownload(curl, url, fp, BnpType, NULL, script, md5sum)); + Curls.push_back(CDataDownload(curl, url, dest, fp, BnpType, NULL, script, md5sum)); #ifdef LOG_DL nlwarning("adding handle %x, %d curls", curl, Curls.size()); #endif @@ -294,7 +344,7 @@ namespace NLGUI { //nlassert(_CrtCheckMemory()); - if(RunningCurls == 0) + if(Curls.empty() && _CurlWWW == NULL) return; int NewRunningCurls = 0; @@ -315,8 +365,82 @@ namespace NLGUI int msgs_left; while ((msg = curl_multi_info_read(MultiCurl, &msgs_left))) { + #ifdef LOG_DL + nlwarning("> (%s) msgs_left %d", _Id.c_str(), msgs_left); + #endif if (msg->msg == CURLMSG_DONE) { + if (_CurlWWW && _CurlWWW->Request && _CurlWWW->Request == msg->easy_handle) + { + CURLcode res = msg->data.result; + long code; + curl_easy_getinfo(_CurlWWW->Request, CURLINFO_RESPONSE_CODE, &code); + #ifdef LOG_DL + nlwarning("(%s) web transfer '%p' completed with status %d, http %d, url (len %d) '%s'", _Id.c_str(), _CurlWWW->Request, res, code, _CurlWWW->Url.size(), _CurlWWW->Url.c_str()); + #endif + + if (res != CURLE_OK) + { + browseError(string("Connection failed with curl error " + string(curl_easy_strerror(res))).c_str()); + } + else + if ((code >= 301 && code <= 303) || code == 307 || code == 308) + { + if (_RedirectsRemaining < 0) + { + browseError(string("Redirect limit reached : " + _URL).c_str()); + } + else + { + // redirect, get the location and try browse again + // we cant use curl redirection because 'addHTTPGetParams()' must be called on new destination + std::string location(_CurlWWW->getLocationHeader()); + if (location.size() > 0) + { + #ifdef LOG_DL + nlwarning("(%s) request (%d) redirected to (len %d) '%s'", _Id.c_str(), _RedirectsRemaining, location.size(), location.c_str()); + #endif + location = getAbsoluteUrl(location); + // throw away this handle and start with new one (easier than reusing) + requestTerminated(); + + _PostNextTime = false; + _RedirectsRemaining--; + + doBrowse(location.c_str()); + } + else + { + browseError(string("Request was redirected, but location was not set : "+_URL).c_str()); + } + } + } + else + { + _RedirectsRemaining = DEFAULT_RYZOM_REDIRECT_LIMIT; + + if ( (code < 200 || code >= 300) ) + { + browseError(string("Connection failed (curl code " + toString((sint32)res) + "), http code " + toString(code) + ") : " + _CurlWWW->Url).c_str()); + } + else + { + receiveCookies(_CurlWWW->Request, HTTPCurrentDomain, _TrustedDomain); + + char *ch; + std::string contentType; + res = curl_easy_getinfo(_CurlWWW->Request, CURLINFO_CONTENT_TYPE, &ch); + if (res == CURLE_OK) + { + contentType = ch; + } + + htmlDownloadFinished(_CurlWWW->Content, contentType, code); + } + requestTerminated(); + } + } + for (vector::iterator it=Curls.begin(); iteasy_handle == it->curl) @@ -327,49 +451,40 @@ namespace NLGUI fclose(it->fp); #ifdef LOG_DL - nlwarning("transfer %x completed with status res %d r %d - %d curls", msg->easy_handle, res, r, Curls.size()); + nlwarning("(%s) transfer '%p' completed with status %d, http %d, url (len %d) '%s'", _Id.c_str(), it->curl, res, r, it->url.size(), it->url.c_str()); #endif + curl_multi_remove_handle(MultiCurl, it->curl); curl_easy_cleanup(it->curl); - string file; - - if (it->type == ImgType) - file = localImageName(it->url); - else - file = localBnpName(it->url); - - if(res != CURLE_OK || r < 200 || r >= 300 || ((it->md5sum != "") && (it->md5sum != getMD5(file+".tmp").toString()))) + string tmpfile = it->dest + ".tmp"; + if(res != CURLE_OK || r < 200 || r >= 300 || ((it->md5sum != "") && (it->md5sum != getMD5(tmpfile).toString()))) { - NLMISC::CFile::deleteFile((file+".tmp").c_str()); + NLMISC::CFile::deleteFile(tmpfile.c_str()); } else { string finalUrl; if (it->type == ImgType) { - CFile::moveFile(file.c_str(), (file+".tmp").c_str()); - if (lookupLocalFile (finalUrl, file.c_str(), false)) + CFile::moveFile(it->dest.c_str(), tmpfile.c_str()); + //if (lookupLocalFile (finalUrl, file.c_str(), false)) { for(uint i = 0; i < it->imgs.size(); i++) { - // don't display image that are not power of 2 - //uint32 w, h; - //CBitmap::loadSize (file, w, h); - //if (w == 0 || h == 0 || ((!NLMISC::isPowerOf2(w) || !NLMISC::isPowerOf2(h)) && !NL3D::CTextureFile::supportNonPowerOfTwoTextures())) - // file.clear(); - setImage(it->imgs[i], file); + setImage(it->imgs[i], it->dest); } } } else { - CFile::moveFile(file.c_str(), (file+".tmp").c_str()); - if (lookupLocalFile (finalUrl, file.c_str(), false)) + CFile::moveFile(it->dest.c_str(), tmpfile.c_str()); + //if (lookupLocalFile (finalUrl, file.c_str(), false)) { CLuaManager::getInstance().executeLuaScript( it->luaScript, true ); } } } + Curls.erase(it); break; } @@ -378,6 +493,10 @@ namespace NLGUI } } RunningCurls = NewRunningCurls; + #ifdef LOG_DL + if (RunningCurls > 0 || Curls.size() > 0) + nlwarning("(%s) RunningCurls %d, _Curls %d", _Id.c_str(), RunningCurls, Curls.size()); + #endif } @@ -440,33 +559,18 @@ namespace NLGUI template void popIfNotEmpty(A &vect) { if(!vect.empty()) vect.pop_back(); } - // Data stored in CGroupHTML for libwww. - - class CLibWWWData - { - public: - CLibWWWData () - { - Request = NULL; - Anchor = NULL; - } - HTRequest *Request; - HTAnchor *Anchor; - }; - // *************************************************************************** void CGroupHTML::beginBuild () { if (_Browsing) { - nlassert (_Connecting); - nlassert (_ConnectingLock == this); _Connecting = false; - _ConnectingLock = NULL; removeContent (); } + else + nlwarning("_Browsing = FALSE"); } @@ -570,7 +674,7 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTChildAnchor *anchor, const BOOL *present, const char **value) + void CGroupHTML::addLink (uint element_number, const std::vector &present, const std::vector &value) { if (_Browsing) { @@ -591,16 +695,8 @@ namespace NLGUI } else { - HTAnchor * dest = HTAnchor_followMainLink((HTAnchor *) anchor); - if (dest) - { - C3WSmartPtr uri = HTAnchor_address(dest); - _Link.push_back ((const char*)uri); - } - else - { - _Link.push_back(""); - } + // convert href from "?key=val" into "http://domain.com/?key=val" + _Link.push_back(getAbsoluteUrl(suri)); } for(uint8 i = MY_HTML_A_ACCESSKEY; i < MY_HTML_A_Z_ACTION_SHORTCUT; i++) @@ -886,7 +982,7 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::beginElement (uint element_number, const BOOL *present, const char **value) + void CGroupHTML::beginElement (uint element_number, const std::vector &present, const std::vector &value) { if (_Browsing) { @@ -1076,30 +1172,11 @@ namespace NLGUI // Get the action name if (present[HTML_FORM_ACTION] && value[HTML_FORM_ACTION]) { - HTParentAnchor *parent = HTAnchor_parent (_LibWWW->Anchor); - HTChildAnchor *child = HTAnchor_findChildAndLink (parent, "", value[HTML_FORM_ACTION], NULL); - if (child) - { - HTAnchor *mainChild = HTAnchor_followMainLink((HTAnchor *) child); - if (mainChild) - { - C3WSmartPtr uri = HTAnchor_address(mainChild); - form.Action = (const char*)uri; - } - } - else - { - HTAnchor * dest = HTAnchor_findAddress (value[HTML_FORM_ACTION]); - if (dest) - { - C3WSmartPtr uri = HTAnchor_address(dest); - form.Action = (const char*)uri; - } - else - { - form.Action = value[HTML_FORM_ACTION]; - } - } + form.Action = getAbsoluteUrl(string(value[HTML_FORM_ACTION])); + } + else + { + form.Action = _URL; } _Forms.push_back(form); } @@ -1294,7 +1371,16 @@ namespace NLGUI // Translate the tooltip if (tooltip) - ctrlButton->setDefaultContextHelp (CI18N::get (tooltip)); + { + if (CI18N::hasTranslation(tooltip)) + { + ctrlButton->setDefaultContextHelp(CI18N::get(tooltip)); + } + else + { + ctrlButton->setDefaultContextHelp(ucstring(tooltip)); + } + } ctrlButton->setText(ucstring::makeFromUtf8(text)); } @@ -1387,24 +1473,11 @@ namespace NLGUI if (!(_Forms.empty())) { // A select box - - // read general property - string templateName; - string minWidth; - - // Widget template name - if (present[MY_HTML_INPUT_Z_INPUT_TMPL] && value[MY_HTML_INPUT_Z_INPUT_TMPL]) - templateName = value[MY_HTML_INPUT_Z_INPUT_TMPL]; - // Widget minimal width - if (present[MY_HTML_INPUT_Z_INPUT_WIDTH] && value[MY_HTML_INPUT_Z_INPUT_WIDTH]) - minWidth = value[MY_HTML_INPUT_Z_INPUT_WIDTH]; - string name; if (present[HTML_SELECT_NAME] && value[HTML_SELECT_NAME]) name = value[HTML_SELECT_NAME]; - string formTemplate = templateName.empty() ? DefaultFormSelectGroup : templateName; - CDBGroupComboBox *cb = addComboBox(formTemplate, name.c_str()); + CDBGroupComboBox *cb = addComboBox(DefaultFormSelectGroup, name.c_str()); CGroupHTML::CForm::CEntry entry; entry.Name = name; entry.ComboBox = cb; @@ -1875,7 +1948,8 @@ namespace NLGUI // *************************************************************************** CGroupHTML::CGroupHTML(const TCtorParam ¶m) : CGroupScrollText(param), - _TimeoutValue(DEFAULT_RYZOM_CONNECTION_TIMEOUT) + _TimeoutValue(DEFAULT_RYZOM_CONNECTION_TIMEOUT), + _RedirectsRemaining(DEFAULT_RYZOM_REDIRECT_LIMIT) { // add it to map of group html created _GroupHtmlUID= ++_GroupHtmlUIDPool; // valid assigned Id begin to 1! @@ -1889,7 +1963,6 @@ namespace NLGUI _PostNextTime = false; _Browsing = false; _Connecting = false; - _LibWWW = new CLibWWWData; _CurrentViewLink = NULL; _CurrentViewImage = NULL; _Indent = 0; @@ -1946,9 +2019,11 @@ namespace NLGUI MultiCurl = curl_multi_init(); RunningCurls = 0; + _CurlWWW = NULL; initImageDownload(); initBnpDownload(); + initLibWWW(); } // *************************************************************************** @@ -1973,7 +2048,8 @@ namespace NLGUI // this is why the call to 'updateRefreshButton' has been removed from stopBrowse clearContext(); - delete _LibWWW; + if (_CurlWWW) + delete _CurlWWW; } std::string CGroupHTML::getProperty( const std::string &name ) const @@ -2902,28 +2978,20 @@ namespace NLGUI clearContext(); _Browsing = false; - if (_Connecting) - { - nlassert (_ConnectingLock == this); - _ConnectingLock = NULL; - } - else - nlassert (_ConnectingLock != this); - _Connecting = false; - // stopBrowse (); updateRefreshButton(); #ifdef LOG_DL - nlwarning("*** ALREADY BROWSING, break first"); + nlwarning("(%s) *** ALREADY BROWSING, break first", _Id.c_str()); #endif } #ifdef LOG_DL - nlwarning("Browsing URL : '%s'", url); + nlwarning("(%s) Browsing URL : '%s'", _Id.c_str(), url); #endif // go _URL = url; + _Connecting = false; _BrowseNextTime = true; // if a BrowseTree is bound to us, try to select the node that opens this URL (auto-locate) @@ -2971,7 +3039,7 @@ namespace NLGUI void CGroupHTML::stopBrowse () { #ifdef LOG_DL - nlwarning("*** STOP BROWSE"); + nlwarning("*** STOP BROWSE (%s)", _Id.c_str()); #endif // Clear all the context @@ -2979,23 +3047,7 @@ namespace NLGUI _Browsing = false; - if (_Connecting) - { - nlassert (_ConnectingLock == this); - _ConnectingLock = NULL; - } - else - nlassert (_ConnectingLock != this); - _Connecting = false; - - // Request running ? - if (_LibWWW->Request) - { - // VerifyLibWWW("HTRequest_kill", HTRequest_kill(_LibWWW->Request) == TRUE); - HTRequest_kill(_LibWWW->Request); - HTRequest_delete(_LibWWW->Request); - _LibWWW->Request = NULL; - } + requestTerminated(); } // *************************************************************************** @@ -3618,7 +3670,6 @@ namespace NLGUI p->setTopSpace(beginSpace); else group->setY(-(sint32)beginSpace); - parentGroup->addGroup (group); } @@ -3774,36 +3825,6 @@ namespace NLGUI } }; - static int timer_called = 0; - - static int - timer_callback(HTTimer * const timer , - void * const user_data , - HTEventType const event ) - { - /*---------------------------------------------------------------------------- - A handy timer callback which cancels the running event loop. - -----------------------------------------------------------------------------*/ - nlassert(event == HTEvent_TIMEOUT); - timer_called = 1; - HTEventList_stopLoop(); - - /* XXX - The meaning of this return value is undocumented, but close - ** inspection of libwww's source suggests that we want to return HT_OK. */ - return HT_OK; - } - - static void handleLibwwwEvents() - { - HTTimer *timer; - timer_called = 0; - timer = HTTimer_new(NULL, &timer_callback, NULL, - 1, YES, NO); - if (!timer_called) - HTEventList_newLoop(); - HTTimer_delete(timer); - } - // *************************************************************************** void CGroupHTML::handle () @@ -3812,306 +3833,408 @@ namespace NLGUI const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes(); + // handle curl downloads + checkDownloads(); + if (_Connecting) { - nlassert (_ConnectingLock == this); - // Check timeout if needed if (_TimeoutValue != 0 && _ConnectingTimeout <= ( times.thisFrameMs / 1000.0f ) ) { browseError(("Connection timeout : "+_URL).c_str()); + + _Connecting = false; + } + } + else + if (_BrowseNextTime || _PostNextTime) + { + // Set timeout + _Connecting = true; + _ConnectingTimeout = ( times.thisFrameMs / 1000.0f ) + _TimeoutValue; + + // freeze form buttons + CButtonFreezer freezer; + this->visit(&freezer); + + // Home ? + if (_URL == "home") + _URL = home(); + + string finalUrl; + bool isLocal = lookupLocalFile (finalUrl, _URL.c_str(), true); + + // Save new url + _URL = finalUrl; + + // file is probably from bnp (ingame help) + if (isLocal) + { + doBrowseLocalFile(finalUrl); + } + else + { + _TrustedDomain = isTrustedDomain(setCurrentDomain(finalUrl)); + + SFormFields formfields; + if (_PostNextTime) + { + buildHTTPPostParams(formfields); + // _URL is set from form.Action + finalUrl = _URL; + } + else + { + // Add custom get params from child classes + addHTTPGetParams (finalUrl, _TrustedDomain); + } + + doBrowseRemoteUrl(finalUrl, "", _PostNextTime, formfields); + } + + _BrowseNextTime = false; + _PostNextTime = false; + } + } + + // *************************************************************************** + void CGroupHTML::buildHTTPPostParams (SFormFields &formfields) + { + // Add text area text + uint i; + + if (_PostFormId >= _Forms.size()) + { + nlwarning("(%s) invalid form index %d, _Forms %d", _Id.c_str(), _PostFormId, _Forms.size()); + return; + } + // Ref the form + CForm &form = _Forms[_PostFormId]; + + // Save new url + _URL = form.Action; + _TrustedDomain = isTrustedDomain(setCurrentDomain(_URL)); + + for (i=0; igetGroup ("eb"); + if (group) + { + // Should be a CGroupEditBox + CGroupEditBox *editBox = dynamic_cast(group); + if (editBox) + { + entryData = editBox->getViewText()->getText(); + addEntry = true; + } + } + } + else if (form.Entries[i].Checkbox) + { + // todo handle unicode POST here + if (form.Entries[i].Checkbox->getPushed ()) + { + entryData = ucstring ("on"); + addEntry = true; + } + } + else if (form.Entries[i].ComboBox) + { + CDBGroupComboBox *cb = form.Entries[i].ComboBox; + entryData.fromUtf8(form.Entries[i].SelectValues[cb->getSelection()]); + addEntry = true; + } + // This is a hidden value + else + { + entryData = form.Entries[i].Value; + addEntry = true; + } + + // Add this entry + if (addEntry) + { + formfields.add(form.Entries[i].Name, CI18N::encodeUTF8(entryData)); + } + } + + if (_PostFormSubmitType == "image") + { + // Add the button coordinates + if (_PostFormSubmitButton.find_first_of("[") == string::npos) + { + formfields.add(_PostFormSubmitButton + "_x", NLMISC::toString(_PostFormSubmitX)); + formfields.add(_PostFormSubmitButton + "_y", NLMISC::toString(_PostFormSubmitY)); + } + else + { + formfields.add(_PostFormSubmitButton, NLMISC::toString(_PostFormSubmitX)); + formfields.add(_PostFormSubmitButton, NLMISC::toString(_PostFormSubmitY)); + } + } + else + formfields.add(_PostFormSubmitButton, _PostFormSubmitValue); + + // Add custom params from child classes + addHTTPPostParams(formfields, _TrustedDomain); + } + + // *************************************************************************** + void CGroupHTML::doBrowseLocalFile(const std::string &uri) + { + std::string filename; + if (strlwr(uri).find("file:/") == 0) + { + filename = uri.substr(6, uri.size() - 6); + } + else + { + filename = uri; + } + + #if LOG_DL + nlwarning("(%s) browse local file '%s'", filename.c_str()); + #endif + + _TrustedDomain = true; + + // Stop previous browse, remove content + stopBrowse (); + + _Browsing = true; + updateRefreshButton(); + + CIFile in; + if (in.open(filename)) + { + std::string html; + while(!in.eof()) + { + char buf[1024]; + in.getline(buf, 1024); + html += std::string(buf) + "\n"; + } + in.close(); + + if (!renderHtmlString(html)) + { + browseError((string("Failed to parse html from file : ")+filename).c_str()); } } else { - if (_ConnectingLock == NULL) - { - if (_BrowseNextTime) - { - // Stop browsing now - stopBrowse (); - updateRefreshButton(); - - // Home ? - if (_URL == "home") - _URL = home(); - - string finalUrl; - bool isLocal = lookupLocalFile (finalUrl, _URL.c_str(), true); - - // Reset the title - if(_TitlePrefix.empty()) - setTitle (CI18N::get("uiPleaseWait")); - else - setTitle (_TitlePrefix + " - " + CI18N::get("uiPleaseWait")); - - // Start connecting - nlassert (_ConnectingLock == NULL); - _ConnectingLock = this; - _Connecting = true; - _ConnectingTimeout = ( times.thisFrameMs / 1000.0f ) + _TimeoutValue; - - - CButtonFreezer freezer; - this->visit(&freezer); - - // Browsing - _Browsing = true; - updateRefreshButton(); - - // Save new url - _URL = finalUrl; - - // display HTTP query - //nlinfo("WEB: GET '%s'", finalUrl.c_str()); - - // Init LibWWW - initLibWWW(); - _TrustedDomain = isTrustedDomain(setCurrentDomain(finalUrl)); - - // Add custom get params - addHTTPGetParams (finalUrl, _TrustedDomain); - - - // Get the final URL - C3WSmartPtr uri = HTParse(finalUrl.c_str(), NULL, PARSE_ALL); - - // Create an anchor - #ifdef NL_OS_WINDOWS - if ((_LibWWW->Anchor = HTAnchor_findAddress(uri)) == NULL) - #else - // temporarily disable local URL's until LibWWW can be replaced. - if (isLocal || ((_LibWWW->Anchor = HTAnchor_findAddress(uri)) == NULL)) - #endif - { - browseError((string("The page address is malformed : ")+(const char*)uri).c_str()); - } - else - { - /* Add our own request terminate handler. Nb: pass as param a UID, not the ptr */ - /* FIX ME - every connection is appending a new callback to the list, and its never removed (Vinicius Arroyo)*/ - HTNet_addAfter(requestTerminater, NULL, (void*)(size_t)_GroupHtmlUID, HT_ALL, HT_FILTER_LAST); - - /* Set the timeout for long we are going to wait for a response */ - HTHost_setEventTimeout(60000); - - /* Start the first request */ - - // request = Request_new(app); - _LibWWW->Request = HTRequest_new(); - HTRequest_setContext(_LibWWW->Request, this); - - // add supported language header - HTList *langs = HTList_new(); - // set the language code used by the client - HTLanguage_add(langs, options.languageCode.c_str(), 1.0); - HTRequest_setLanguage (_LibWWW->Request, langs, 1); - - // get_document(_LibWWW->Request, _LibWWW->Anchor); - C3WSmartPtr address = HTAnchor_address(_LibWWW->Anchor); - HTRequest_setAnchor(_LibWWW->Request, _LibWWW->Anchor); - if (HTLoad(_LibWWW->Request, NO)) - { - } - else - { - browseError((string("The page cannot be displayed : ")+(const char*)uri).c_str()); - } - } - - _BrowseNextTime = false; - } - - if (_PostNextTime) - { - /* Create a list to hold the form arguments */ - HTAssocList * formfields = HTAssocList_new(); - - // Add text area text - uint i; - - // Ref the form - CForm &form = _Forms[_PostFormId]; - - // Save new url - _URL = form.Action; - - for (i=0; igetGroup ("eb"); - if (group) - { - // Should be a CGroupEditBox - CGroupEditBox *editBox = dynamic_cast(group); - if (editBox) - { - entryData = editBox->getViewText()->getText(); - addEntry = true; - } - } - } - else if (form.Entries[i].Checkbox) - { - // todo handle unicode POST here - if (form.Entries[i].Checkbox->getPushed ()) - { - entryData = ucstring ("on"); - addEntry = true; - } - } - else if (form.Entries[i].ComboBox) - { - CDBGroupComboBox *cb = form.Entries[i].ComboBox; - entryData.fromUtf8(form.Entries[i].SelectValues[cb->getSelection()]); - addEntry = true; - } - // This is a hidden value - else - { - entryData = form.Entries[i].Value; - addEntry = true; - } - - // Add this entry - if (addEntry) - { - // Build a utf8 string - string uft8 = form.Entries[i].Name + "=" + CI18N::encodeUTF8(entryData); - - /* Parse the content and add it to the association list */ - HTParseFormInput(formfields, uft8.c_str()); - } - } - - if (_PostFormSubmitType == "image") - { - // Add the button coordinates - if (_PostFormSubmitButton.find_first_of("[") == string::npos) - { - HTParseFormInput(formfields, (_PostFormSubmitButton + "_x=" + NLMISC::toString(_PostFormSubmitX)).c_str()); - HTParseFormInput(formfields, (_PostFormSubmitButton + "_y=" + NLMISC::toString(_PostFormSubmitY)).c_str()); - } - else - { - HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitX)).c_str()); - HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitY)).c_str()); - } - } - else - HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + _PostFormSubmitValue).c_str()); - - // Add custom params - addHTTPPostParams(formfields, _TrustedDomain); - - // Reset the title - if(_TitlePrefix.empty()) - setTitle (CI18N::get("uiPleaseWait")); - else - setTitle (_TitlePrefix + " - " + CI18N::get("uiPleaseWait")); - - // Stop previous browse - stopBrowse (); - - // Set timeout - nlassert (_ConnectingLock == NULL); - _ConnectingLock = this; - _Connecting = true; - _ConnectingTimeout = ( times.thisFrameMs / 1000.0f ) + _TimeoutValue; - - CButtonFreezer freezer; - this->visit(&freezer); - - // Browsing - _Browsing = true; - updateRefreshButton(); - - // display HTTP query with post parameters - //nlinfo("WEB: POST %s", _URL.c_str()); - - // Init LibWWW - initLibWWW(); - _TrustedDomain = isTrustedDomain(setCurrentDomain(_URL)); - - // Get the final URL - C3WSmartPtr uri = HTParse(_URL.c_str(), NULL, PARSE_ALL); - - // Create an anchor - if ((_LibWWW->Anchor = HTAnchor_findAddress(uri)) == NULL) - { - browseError((string("The page address is malformed : ")+(const char*)uri).c_str()); - } - else - { - /* Add our own request terminate handler. Nb: pass as param a UID, not the ptr */ - /* FIX ME - every connection is appending a new callback to the list, and its never removed (Vinicius Arroyo)*/ - HTNet_addAfter(requestTerminater, NULL, (void*)(size_t)_GroupHtmlUID, HT_ALL, HT_FILTER_LAST); - - /* Start the first request */ - - // request = Request_new(app); - _LibWWW->Request = HTRequest_new(); - HTRequest_setContext(_LibWWW->Request, this); - - /* - ** Dream up a source anchor (an editor can for example use this). - ** After creation we associate the data that we want to post and - ** set some metadata about what the data is. More formats can be found - ** ../src/HTFormat.html - */ - /*HTParentAnchor *src = HTTmpAnchor(NULL); - HTAnchor_setDocument(src, (void*)(data.c_str())); - HTAnchor_setFormat(src, WWW_PLAINTEXT);*/ - - /* - ** If not posting to an HTTP/1.1 server then content length MUST be - ** there. If HTTP/1.1 then it doesn't matter as we just use chunked - ** encoding under the covers - */ - // HTAnchor_setLength(src, data.size()); - - HTParentAnchor *result = HTPostFormAnchor (formfields, _LibWWW->Anchor, _LibWWW->Request); - if (result) - { - } - else - { - browseError((string("The page cannot be displayed : ")+(const char*)uri).c_str()); - } - - /* POST the source to the dest */ - /* - BOOL status = NO; - status = HTPostAnchor(src, _LibWWW->Anchor, _LibWWW->Request); - if (status) - { - } - else - { - browseError((string("The page cannot be displayed : ")+(const char*)uri).c_str()); - }*/ - } - - _PostNextTime = false; - } - } + browseError((string("The page address is malformed : ")+filename).c_str()); } - #ifndef NL_OS_WINDOWS - if(isBrowsing()) - handleLibwwwEvents(); + } + + // *************************************************************************** + void CGroupHTML::doBrowseRemoteUrl(const std::string &url, const std::string &referer, bool doPost, const SFormFields &formfields) + { + // Stop previous request and remove content + stopBrowse (); + + _Browsing = true; + updateRefreshButton(); + + // Reset the title + if(_TitlePrefix.empty()) + setTitle (CI18N::get("uiPleaseWait")); + else + setTitle (_TitlePrefix + " - " + CI18N::get("uiPleaseWait")); + + #if LOG_DL + nlwarning("(%s) browse url (trusted=%s) '%s', referer='%s', post='%s', nb form values %d", + _Id.c_str(), (_TrustedDomain ? "true" :"false"), url.c_str(), referer.c_str(), (doPost ? "true" : "false"), formfields.Values.size()); #endif + + if (!MultiCurl) + { + browseError(string("Invalid MultCurl handle, loading url failed : "+url).c_str()); + return; + } + + CURL *curl = curl_easy_init(); + if (!curl) + { + nlwarning("(%s) failed to create curl handle", _Id.c_str()); + browseError(string("Failed to create cURL handle : " + url).c_str()); + return; + } + + // do not follow redirects, we have own handler + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0); + // after redirect + curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); + + // tell curl to use compression if possible (gzip, deflate) + // leaving this empty allows all encodings that curl supports + //curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); + + // limit curl to HTTP and HTTPS protocols only + curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + + // Destination + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + + // User-Agent: + std::string userAgent = options.appName + "/" + options.appVersion; + curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); + + // Cookies + sendCookies(curl, HTTPCurrentDomain, _TrustedDomain); + + // Referer + if (!referer.empty()) + { + curl_easy_setopt(curl, CURLOPT_REFERER, referer.c_str()); + #ifdef LOG_DL + nlwarning("(%s) set referer '%s'", _Id.c_str(), referer.c_str()); + #endif + } + + if (doPost) + { + // serialize form data and add it to curl + std::string data; + for(uint i=0; i0) + data += "&"; + + data += std::string(escapedName) + "=" + escapedValue; + + curl_free(escapedName); + curl_free(escapedValue); + } + curl_easy_setopt(curl, CURLOPT_POST, 1); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.size()); + curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, data.c_str()); + } + else + { + curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); + } + + // transfer handle + _CurlWWW = new CCurlWWWData(curl, url); + + // set the language code used by the client + std::vector headers; + headers.push_back("Accept-Language: "+options.languageCode); + headers.push_back("Accept-Charset: utf-8"); + for(uint i=0; i< headers.size(); ++i) + { + _CurlWWW->HeadersSent = curl_slist_append(_CurlWWW->HeadersSent, headers[i].c_str()); + } + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, _CurlWWW->HeadersSent); + + // catch headers for redirect + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlHeaderCallback); + curl_easy_setopt(curl, CURLOPT_WRITEHEADER, _CurlWWW); + + // catch body + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlDataCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, _CurlWWW); + + #if LOG_DL + // progress callback + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, curlProgressCallback); + curl_easy_setopt(curl, CURLOPT_XFERINFODATA, _CurlWWW); + #else + // progress off + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); + #endif + + // + curl_multi_add_handle(MultiCurl, curl); + + // start the transfer + int NewRunningCurls = 0; + curl_multi_perform(MultiCurl, &NewRunningCurls); + RunningCurls++; + } + + // *************************************************************************** + void CGroupHTML::htmlDownloadFinished(const std::string &content, const std::string &type, long code) + { + #ifdef LOG_DL + nlwarning("(%s) HTML download finished, content length %d, type '%s', code %d", _Id.c_str(), content.size(), type.c_str(), code); + #endif + + // set trusted domain for parsing + _TrustedDomain = isTrustedDomain(setCurrentDomain(_URL)); + + // create markup for image downloads + if (type.find("image/") == 0 && content.size() > 0) + { + try + { + std::string dest = localImageName(_URL); + COFile out; + out.open(dest); + out.serialBuffer((uint8 *)(content.c_str()), content.size()); + out.close(); + #ifdef LOG_DL + nlwarning("(%s) image saved to '%s', url '%s'", _Id.c_str(), dest.c_str(), _URL.c_str()); + #endif + } + catch(...) { } + + // create html code with image url inside and do the request again + renderHtmlString(""+_URL+""); + } + else + { + renderHtmlString(content); + } + } + + // *************************************************************************** + + bool CGroupHTML::renderHtmlString(const std::string &html) + { + bool success; + + // + _Browsing = true; + + // clear content + beginBuild(); + + success = parseHtml(html); + + // invalidate coords + endBuild(); + + // set the browser as complete + _Browsing = false; + updateRefreshButton(); + + // check that the title is set, or reset it (in the case the page + // does not provide a title) + if (_TitleString.empty()) + { + setTitle(_TitlePrefix); + } + + return success; } // *************************************************************************** void CGroupHTML::draw () { - checkDownloads(); CGroupScrollText::draw (); } @@ -4130,28 +4253,27 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::addHTTPPostParams (HTAssocList * /* formfields */, bool /*trustedDomain*/) + void CGroupHTML::addHTTPPostParams (SFormFields &/* formfields */, bool /*trustedDomain*/) { } // *************************************************************************** - - void CGroupHTML::requestTerminated(HTRequest * request ) + void CGroupHTML::requestTerminated() { - // this callback is being called for every request terminated - if (request == _LibWWW->Request) + if (_CurlWWW) { - // set the browser as complete - _Browsing = false; - updateRefreshButton(); - // check that the title is set, or reset it (in the case the page - // does not provide a title) - if (_TitleString.empty()) - { - setTitle(_TitlePrefix); - } - } - } + #if LOG_DL + nlwarning("(%s) stop curl, url '%s'", _Id.c_str(), _CurlWWW->Url.c_str()); + #endif + if (MultiCurl) + curl_multi_remove_handle(MultiCurl, _CurlWWW->Request); + + delete _CurlWWW; + + _CurlWWW = NULL; + _Connecting = false; + } + } // *************************************************************************** @@ -4178,7 +4300,9 @@ namespace NLGUI _GroupListAdaptor->clearViews(); CWidgetManager::getInstance()->clearViewUnders(); CWidgetManager::getInstance()->clearCtrlsUnders(); - _Paragraph = NULL; + + // Clear all the context + clearContext(); // Reset default background color setBackgroundColor (BgColor); @@ -4480,7 +4604,7 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE); uint element_number = (uint)ls.toNumber(1); - std::vector present; + std::vector present; std::vector value; present.resize(30, false); value.resize(30); @@ -4514,9 +4638,9 @@ namespace NLGUI value.insert(value.begin() + (uint)it.nextKey().toNumber(), buffer); } - beginElement(element_number, &present[0], &value[0]); + beginElement(element_number, present, value); if (element_number == HTML_A) - addLink(element_number, 0, NULL, &present[0], &value[0]); + addLink(element_number, present, value); return 0; } @@ -4650,6 +4774,18 @@ namespace NLGUI return result; } + // *************************************************************************** + std::string CGroupHTML::getAbsoluteUrl(const std::string &url) + { + CUrlParser uri(url); + if (uri.isAbsolute()) + return url; + + uri.inherit(_URL); + + return uri.toString(); + } + // *************************************************************************** // CGroupHTML::CStyleParams style; // style.FontSize; // font-size: 10px; @@ -4728,5 +4864,46 @@ namespace NLGUI style.StrikeThrough = getFontStrikeThrough() || style.StrikeThrough; } } + + // *************************************************************************** + size_t CGroupHTML::curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData) + { + CCurlWWWData * me = static_cast(pCCurlWWWData); + if (me) + { + std::string header; + header.append(buffer, size * nmemb); + me->setRecvHeader(header.substr(0, header.find_first_of("\n\r"))); + } + + return size * nmemb; + } + + // *************************************************************************** + size_t CGroupHTML::curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData) + { + CCurlWWWData * me = static_cast(pCCurlWWWData); + if (me) + me->Content.append(buffer, size * nmemb); + + return size * nmemb; + } + + // *************************************************************************** + size_t CGroupHTML::curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) + { + CCurlWWWData * me = static_cast(pCCurlWWWData); + if (me) + { + if (dltotal > 0 || dlnow > 0 || ultotal > 0 || ulnow > 0) + { + nlwarning("> dltotal %d, dlnow %d, ultotal %d, ulnow %d, url '%s'", dltotal, dlnow, ultotal, ulnow, me->Url.c_str()); + } + } + + // return 1 to cancel download + return 0; + } + } diff --git a/code/nel/src/gui/group_html_parser.cpp b/code/nel/src/gui/group_html_parser.cpp new file mode 100644 index 000000000..260e6a96f --- /dev/null +++ b/code/nel/src/gui/group_html_parser.cpp @@ -0,0 +1,312 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "stdpch.h" + +#include +#include + +#include "nel/misc/types_nl.h" +#include "nel/gui/libwww.h" +#include "nel/gui/group_html.h" +#include "nel/gui/lua_ihm.h" + +using namespace std; +using namespace NLMISC; + +namespace NLGUI +{ + // *************************************************************************** + void CGroupHTML::htmlElement(xmlNode *node, int element_number) + { + SGML_dtd *HTML_DTD = HTML_dtd (); + + if (element_number < HTML_ELEMENTS) + { + CXMLAutoPtr ptr; + // load attributes into libwww structs + std::vector present; + std::vectorvalue; + std::string strvalues[MAX_ATTRIBUTES]; + present.resize(30, false); + value.resize(30); + + uint nbAttributes = std::min(MAX_ATTRIBUTES, HTML_DTD->tags[element_number].number_of_attributes); + for(uint i=0; itags[element_number].attributes[i].name)); + ptr = xmlGetProp(node, (const xmlChar *)name.c_str()); + if (ptr) + { + // copy xmlChar to string (xmlChar will be released) + strvalues[i] = (const char *)(ptr); + // now use string pointer in value[] array + value[i] = strvalues[i].c_str(); + present[i] = true; + } + } + + if (element_number == HTML_A) + { + addLink(element_number, present, value); + } + + beginElement(element_number, present, value); + } + else + { + beginUnparsedElement((const char *)(node->name), xmlStrlen(node->name)); + } + + // recursive - text content / child nodes + htmlWalkDOM(node->children); + + // closing tag + if (element_number < HTML_ELEMENTS) + { + endElement(element_number); + } + else + { + endUnparsedElement((const char *)(node->name), xmlStrlen(node->name)); + } + } + + // *************************************************************************** + // recursive function to walk html document + void CGroupHTML::htmlWalkDOM(xmlNode *a_node) + { + SGML_dtd *HTML_DTD = HTML_dtd (); + + uint element_number; + xmlNode *node = a_node; + while(node) + { + if (node->type == XML_TEXT_NODE) + { + addText((const char *)(node->content), xmlStrlen(node->content)); + } + else + if (node->type == XML_ELEMENT_NODE) + { + // find libwww tag + for(element_number = 0; element_numbername, (const xmlChar *)HTML_DTD->tags[element_number].name.c_str(), xmlStrlen(node->name)) == 0) + break; + } + + htmlElement(node, element_number); + } + + // move into next sibling + node = node->next; + } + } + + // *************************************************************************** + // http://stackoverflow.com/a/18335183 + static std::string correct_non_utf_8(const std::string &str) + { + int i,f_size=str.size(); + unsigned char c,c2,c3,c4; + std::string to; + to.reserve(f_size); + + for(i=0 ; i127 && c2<192){//valid 2byte UTF8 + if(c==194 && c2<160){//control char, skipping + ; + }else{ + to.append(1,c); + to.append(1,c2); + } + i++; + continue; + } + }else if(c<240 && i+2127 && c2<192 && c3>127 && c3<192){//valid 3byte UTF8 + to.append(1,c); + to.append(1,c2); + to.append(1,c3); + i+=2; + continue; + } + }else if(c<245 && i+3127 && c2<192 && c3>127 && c3<192 && c4>127 && c4<192){//valid 4byte UTF8 + to.append(1,c); + to.append(1,c2); + to.append(1,c3); + to.append(1,c4); + i+=3; + continue; + } + } + //invalid UTF8, converting ASCII (c>245 || string too short for multi-byte)) + to.append(1,(unsigned char)195); + to.append(1,c-64); + } + return to; + } + + // *************************************************************************** + static void patchHtmlQuirks(std::string &htmlString) + { + size_t npos = std::string::npos; + size_t pos; + + // get rid of BOM (some ingame help files does not show up otherwise) + if (htmlString.substr(0, 3) == "\xEF\xBB\xBF") + { + htmlString.erase(0, 3); + } + + // if any element is before , then parser adds + // and original tags are ignored (their attributes not processed) + // + // only fix situation when there is tag with attributes + // + // tags are considered to be lowercase + + pos = htmlString.find(" + if (htmlString.substr(start, 2) == ""); + if (end != npos && start < end && end < pos) + { + // body tag end position + size_t insert = htmlString.find(">", pos); + if (insert != npos) + { + std::string str = htmlString.substr(start, end - start); + htmlString.insert(insert+1, str); + htmlString.erase(start, str.size()); + } + } + } + + // make sure (if present) is last in document or tags coming after it are ignored + pos = htmlString.find(""); + if (pos != npos && htmlString.find("<", pos+1) > pos) + { + htmlString.erase(pos, 7); + htmlString += ""; + } + + // if there is invalid utf-8 chars, then libxml will break everything after first it finds. + htmlString = correct_non_utf_8(htmlString); + } + + // *************************************************************************** + bool CGroupHTML::parseHtml(std::string htmlString) + { + htmlParserCtxtPtr parser = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL, XML_CHAR_ENCODING_UTF8); + if (!parser) + { + nlwarning("Creating html parser context failed"); + return false; + } + + htmlCtxtUseOptions(parser, HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING | HTML_PARSE_NONET); + + // parser is little strict on tag order, so fix whats needed + patchHtmlQuirks(htmlString); + + htmlParseChunk(parser, htmlString.c_str(), htmlString.size(), 0); + htmlParseChunk(parser, "", 0, 1); + + bool success = true; + if (parser->myDoc) + { + xmlNode *root = xmlDocGetRootElement(parser->myDoc); + if (root) + { + htmlWalkDOM(root); + } + else + { + nlwarning("html root node failed"); + success = false; + } + } + else + { + nlwarning("htmlstring parsing failed"); + success = false; + } + + htmlFreeParserCtxt(parser); + return success; + } + + // *************************************************************************** + int CGroupHTML::luaParseHtml(CLuaState &ls) + { + const char *funcName = "parseHtml"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + std::string html = ls.toString(1); + + parseHtml(html); + + return 0; + } + +} + diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index 14e921aea..ff73bb59a 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -16,35 +16,21 @@ #include "stdpch.h" +#include "nel/gui/libwww.h" #include "nel/gui/group_html.h" -// LibWWW -extern "C" -{ -#include "WWWLib.h" /* Global Library Include file */ -#include "WWWApp.h" -#include "WWWInit.h" -} - -#include "nel/gui/group_html.h" -#include "nel/gui/libwww_nel_stream.h" - using namespace NLMISC; -// The HText structure for libwww -struct _HText -{ - NLGUI::CGroupHTML *Parent; -}; - namespace NLGUI { + // *************************************************************************** + /// the cookie value for session identification (nel cookie) std::string CurrentCookie; /// store all cookies we receive and resent them depending of the domain - std::map > HTTPCookies; + static std::map > HTTPCookies; std::string HTTPCurrentDomain; // The current domain that will be used to get which cookies to send // *************************************************************************** @@ -213,7 +199,6 @@ namespace NLGUI { 0 } }; - HTAttr p_attr[] = { HTML_ATTR(P,QUICK_HELP_CONDITION), @@ -243,90 +228,6 @@ namespace NLGUI // *************************************************************************** - void _VerifyLibWWW(const char *function, bool ok, const char *file, int line) - { - if (!ok) - nlwarning("%s(%d) : LIBWWW %s returned a bad status", file, line, function); - } - #define VerifyLibWWW(a,b) _VerifyLibWWW(a,(b)!=FALSE,__FILE__,__LINE__) - - // *************************************************************************** - - int NelPrinter (const char * fmt, va_list pArgs) - { - char info[1024]; - int ret; - - ret = vsnprintf(info, sizeof(info), fmt, pArgs); - nlinfo("%s", info); - return ret; - } - - // *************************************************************************** - - int NelTracer (const char * fmt, va_list pArgs) - { - char err[1024]; - int ret; - - ret = vsnprintf(err, sizeof(err), fmt, pArgs); - nlwarning ("%s", err); - return ret; - } - - // *************************************************************************** - - HText * TextNew (HTRequest * request, - HTParentAnchor * /* anchor */, - HTStream * /* output_stream */) - { - HText *text = new HText; - text->Parent = (CGroupHTML *) HTRequest_context(request); - return text; - } - - // *************************************************************************** - - BOOL TextDelete (HText * me) - { - delete me; - return YES; - } - - // *************************************************************************** - - void TextBuild (HText * me, HTextStatus status) - { - // Do the work in the class - if (status == HTEXT_BEGIN) - me->Parent->beginBuild (); - else if (status == HTEXT_END) - me->Parent->endBuild (); - } - - // *************************************************************************** - - void TextAdd (HText * me, const char * buf, int len) - { - // Do the work in the class - me->Parent->addText (buf, len); - } - - // *************************************************************************** - - void TextLink (HText * me, - int element_number, - int attribute_number, - HTChildAnchor * anchor, - const BOOL * present, - const char ** value) - { - // Do the work in the class - me->Parent->addLink (element_number, attribute_number, anchor, present, value); - } - - // *************************************************************************** - // Read a width HTML parameter. "100" or "100%". Returns true if percent (0 ~ 1) else false bool getPercentage (sint32 &width, float &percent, const char *str) { @@ -383,307 +284,143 @@ namespace NLGUI return dst; } - // *************************************************************************** - - void TextBeginElement (HText *me, int element_number, const BOOL *present, const char **value) + // set current HTTPCurrentDomain for cookie selection, return new domain + const std::string &setCurrentDomain(const std::string &uri) { - // Do the work in the class - me->Parent->beginElement (element_number, present, value); - } - - // *************************************************************************** - - void TextEndElement (HText *me, int element_number) - { - // Do the work in the class - me->Parent->endElement (element_number); - } - - // *************************************************************************** - void TextBeginUnparsedElement(HText *me, const char *buffer, int length) - { - me->Parent->beginUnparsedElement(buffer, length); - } - - // *************************************************************************** - void TextEndUnparsedElement(HText *me, const char *buffer, int length) - { - me->Parent->endUnparsedElement(buffer, length); - } - - // *************************************************************************** - void TextUnparsedEntity (HText * /* HText */, const char *buffer, int length) - { - std::string str(buffer, buffer+length); - nlinfo("Unparsed entity '%s'", str.c_str()); - } - - // *************************************************************************** - int requestTerminater (HTRequest * request, HTResponse * /* response */, - void * param, int /* status */) - { - /* - Yoyo and Boris: we had to make the request terminate by UID and not by pointer (param is an uid). - Because this method was called at mainLoop time, but for GroupHTML created/deleted at login time !!! - => Memory Crash. - */ - - // TestYoyo - //nlinfo("** requestTerminater(): uid%d", (uint32)param); - - // the parameter is actually an uint32 - if (param != 0) - { - CGroupHTML::TGroupHtmlByUIDMap::iterator it= CGroupHTML::_GroupHtmlByUID.find((uint32)(size_t)param); - if(it!=CGroupHTML::_GroupHtmlByUID.end()) - { - // get the pointer. NB: the refptr should not be NULL - // since object removed from map when deleted - CGroupHTML *gh = it->second; - nlassert(gh); - - // callback the browser - gh->requestTerminated(request); - } - } - return HT_OK; - } - - - // callback called when receiving a cookie - BOOL receiveCookie (HTRequest * /* request */, HTCookie * cookie, void * /* param */) - { - if (strcmp(HTCookie_name(cookie), "ryzomId") == 0) - { - // we receive the ryzom id cookie, store it - CurrentCookie = HTCookie_value(cookie); - } + if (uri.find("http://") == 0) + HTTPCurrentDomain = uri.substr(7, uri.find("/", 7) - 7); else - { - // store the id/value cookie - HTTPCookies[HTTPCurrentDomain][HTCookie_name(cookie)] = HTCookie_value(cookie); - // nlwarning("get cookie for domain %s %s=%s", HTTPCurrentDomain.c_str(), HTCookie_name(cookie), HTCookie_value(cookie)); - } - - return YES; - } - - // callback called to add cookie to a request before sending it to the server - HTAssocList *sendCookie (HTRequest * /* request */, void * /* param */) - { - HTAssocList * alist = 0; - if (!CurrentCookie.empty()) - { - if(alist == 0) alist = HTAssocList_new(); /* Is deleted by the cookie module */ - HTAssocList_addObject(alist, "ryzomId", CurrentCookie.c_str()); - } - - if(!HTTPCookies[HTTPCurrentDomain].empty()) - { - if(alist == 0) alist = HTAssocList_new(); - for(std::map::iterator it = HTTPCookies[HTTPCurrentDomain].begin(); it != HTTPCookies[HTTPCurrentDomain].end(); it++) - { - HTAssocList_addObject(alist, it->first.c_str(), it->second.c_str()); - // nlwarning("set cookie for domain '%s' %s=%s", HTTPCurrentDomain.c_str(), it->first.c_str(), it->second.c_str()); - } - } - return alist; - } - - - // *************************************************************************** - - HTAnchor * TextFindAnchor (HText * /* me */, int /* index */) - { - return NULL; - } - - int HTMIME_location_custom (HTRequest * request, HTResponse * response, char * token, char * value) - { - char * location = HTStrip(value); - - std::string finalLocation; - - //nlinfo("redirect to '%s' '%s'", value, location); - - // If not absolute URI (Error) then find the base - if (!HTURL_isAbsolute(location)) - { - char * base = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); - location = HTParse(location, base, PARSE_ALL); - //redirection = HTAnchor_findAddress(location); - finalLocation = location; - HT_FREE(base); - HT_FREE(location); - } + if (uri.find("https://") == 0) + HTTPCurrentDomain = uri.substr(8, uri.find("/", 8) - 8); else - { - finalLocation = location; - } - //nlinfo("final location '%s'", finalLocation.c_str()); - - CGroupHTML *gh = (CGroupHTML *) HTRequest_context(request); - - gh->setURL(finalLocation); - - return HT_OK; - } - - - // *************************************************************************** - - const std::string &setCurrentDomain(const std::string &url) - { - if(url.find("http://") == 0) - { - HTTPCurrentDomain = url.substr(7, url.find('/', 7)-7); - // nlinfo("****cd: %s", HTTPCurrentDomain.c_str()); - } + if (uri.find("//") == 0) + HTTPCurrentDomain = uri.substr(2, uri.find("/", 2) - 2); else - { - HTTPCurrentDomain.clear(); - // nlinfo("****cd: clear the domain"); - } + if (uri.find("/") != std::string::npos) + HTTPCurrentDomain = uri.substr(0, uri.find("/") - 1); + return HTTPCurrentDomain; } + // update HTTPCookies list + static void receiveCookie(const char *nsformat, const std::string &domain, bool trusted) + { + // 0 1 2 3 4 5 6 + // domain tailmatch path secure expires name value + // .app.ryzom.com TRUE / FALSE 1234 ryzomId AAAAAAAA|BBBBBBBB|CCCCCCCC + // #HttpOnly_app.ryzom.com FALSE / FALSE 0 PHPSESSID sess-id-value + std::string cookie(nsformat); + + std::vector chunks; + splitString(cookie, "\t", chunks); + if (chunks.size() < 6) + { + nlwarning("invalid cookie format '%s'", cookie.c_str()); + } + + if (chunks[0].find("#HttpOnly_") == 0) + { + chunks[0] = chunks[0].substr(10); + } + + if (chunks[0] != domain && chunks[0] != std::string("." + domain)) + { + // cookie is for different domain + //nlinfo("cookie for different domain ('%s')", nsformat); + return; + } + + if (chunks[5] == "ryzomId") + { + // we receive this cookie because we are telling curl about this on send + // normally, this cookie should be set from client and not from headers + // it's used for R2 sessions + if (trusted && CurrentCookie != chunks[6]) + { + CurrentCookie = chunks[6]; + nlwarning("received ryzomId cookie '%s' from trusted domain '%s'", CurrentCookie.c_str(), domain.c_str()); + } + } + else + { + uint32 expires = 0; + fromString(chunks[4], expires); + // expires == 0 is session cookie + if (expires > 0) + { + time_t now; + time(&now); + if (expires < now) + { + nlwarning("cookie expired, remove from list '%s'", nsformat); + HTTPCookies[domain].erase(chunks[5]); + + return; + } + } + + // this overrides cookies with same name, but different paths + //nlwarning("save domain '%s' cookie '%s' value '%s'", domain.c_str(), chunks[5].c_str(), nsformat); + HTTPCookies[domain][chunks[5]] = nsformat; + } + } + + // update HTTPCookies with cookies received from curl + void receiveCookies (CURL *curl, const std::string &domain, bool trusted) + { + struct curl_slist *cookies = NULL; + if (curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies) == CURLE_OK) + { + struct curl_slist *nc; + nc = cookies; + while(nc) + { + //nlwarning("received cookie '%s'", nc->data); + receiveCookie(nc->data, domain, trusted); + nc = nc->next; + } + + curl_slist_free_all(cookies); + } + } + + // add all cookies for domain to curl handle + void sendCookies(CURL *curl, const std::string &domain, bool trusted) + { + if (domain.empty()) + return; + + if (trusted && !CurrentCookie.empty()) + { + // domain tailmatch path secure expires name value + // .app.ryzom.com TRUE / FALSE 1234 ryzomId AAAAAAAA|BBBBBBBB|CCCCCCCC + // #HttpOnly_app.ryzom.com FALSE / FALSE 0 PHPSESSID sess-id-value + std::string cookie; + // set tailmatch + if (domain[0] != '.' && domain[0] != '#') + cookie = "." + domain + "\tTRUE"; + else + cookie = domain + "\tFALSE"; + cookie += "\t/\tFALSE\t0\tryzomId\t" + CurrentCookie; + curl_easy_setopt(curl, CURLOPT_COOKIELIST, cookie.c_str()); + //nlwarning("domain '%s', cookie '%s'", domain.c_str(), cookie.c_str()); + } + + if(!HTTPCookies[domain].empty()) + { + for(std::map::iterator it = HTTPCookies[domain].begin(); it != HTTPCookies[domain].end(); it++) + { + curl_easy_setopt(curl, CURLOPT_COOKIELIST, it->second.c_str()); + //nlwarning("set domain '%s' cookie '%s'", domain.c_str(), it->second.c_str()); + } + } + } void initLibWWW() { static bool initialized = false; if (!initialized) { - //HTProfile_newNoCacheClient("Ryzom", "1.1"); - - /* Need our own trace and print functions */ - HTPrint_setCallback(NelPrinter); - HTTrace_setCallback(NelTracer); - - /* Initiate libwww */ - HTLib_setAppName( CGroupHTML::options.appName.c_str() ); - HTLib_setAppVersion( CGroupHTML::options.appVersion.c_str() ); - - /* Set up TCP as transport */ - VerifyLibWWW("HTTransport_add", HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, HTBufferWriter_new)); - VerifyLibWWW("HTTransport_add", HTTransport_add("local", HT_TP_SINGLE, HTNeLReader_new, HTWriter_new)); - // VerifyLibWWW("HTTransport_add", HTTransport_add("local", HT_TP_SINGLE, HTANSIReader_new, HTWriter_new)); - // VerifyLibWWW("HTTransport_add", HTTransport_add("local", HT_TP_SINGLE, HTReader_new, HTWriter_new)); - - /* Set up HTTP as protocol */ - VerifyLibWWW("HTProtocol_add", HTProtocol_add("http", "buffered_tcp", 80, NO, HTLoadHTTP, NULL)); - VerifyLibWWW("HTProtocol_add", HTProtocol_add("file", "local", 0, YES, HTLoadNeLFile, NULL)); - //VerifyLibWWW("HTProtocol_add", HTProtocol_add("file", "local", 0, YES, HTLoadFile, NULL)); - // HTProtocol_add("cache", "local", 0, NO, HTLoadCache, NULL); - - HTBind_init(); - // HTCacheInit(NULL, 20); - - /* Setup up transfer coders */ - HTFormat_addTransferCoding((char*)"chunked", HTChunkedEncoder, HTChunkedDecoder, 1.0); - - /* Setup MIME stream converters */ - HTFormat_addConversion("message/rfc822", "*/*", HTMIMEConvert, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-foot", "*/*", HTMIMEFooter, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-head", "*/*", HTMIMEHeader, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-cont", "*/*", HTMIMEContinue, 1.0, 0.0, 0.0); - HTFormat_addConversion("message/x-rfc822-partial","*/*", HTMIMEPartial, 1.0, 0.0, 0.0); - HTFormat_addConversion("multipart/*", "*/*", HTBoundary, 1.0, 0.0, 0.0); - - /* Setup HTTP protocol stream */ - HTFormat_addConversion("text/x-http", "*/*", HTTPStatus_new, 1.0, 0.0, 0.0); - - /* Setup the HTML parser */ - HTFormat_addConversion("text/html", "www/present", HTMLPresent, 1.0, 0.0, 0.0); - - /* Setup black hole stream */ - HTFormat_addConversion("*/*", "www/debug", HTBlackHoleConverter, 1.0, 0.0, 0.0); - HTFormat_addConversion("*/*", "www/present", HTBlackHoleConverter, 0.3, 0.0, 0.0); - - /* Set max number of sockets we want open simultaneously */ - HTNet_setMaxSocket(32); - - /* Register our HTML parser callbacks */ - VerifyLibWWW("HText_registerCDCallback", HText_registerCDCallback (TextNew, TextDelete)); - VerifyLibWWW("HText_registerBuildCallback", HText_registerBuildCallback (TextBuild)); - VerifyLibWWW("HText_registerTextCallback", HText_registerTextCallback(TextAdd)); - VerifyLibWWW("HText_registerLinkCallback", HText_registerLinkCallback (TextLink)); - VerifyLibWWW("HText_registerElementCallback", HText_registerElementCallback (TextBeginElement, TextEndElement)); - VerifyLibWWW("HText_registerUnparsedElementCallback", HText_registerUnparsedElementCallback(TextBeginUnparsedElement, TextEndUnparsedElement)); - VerifyLibWWW("HText_registerUnparsedEntityCallback ", HText_registerUnparsedEntityCallback (TextUnparsedEntity )); - - - /* Register the default set of MIME header parsers */ - struct { - const char * string; - HTParserCallback * pHandler; - } fixedHandlers[] = { - {"accept", &HTMIME_accept}, - {"accept-charset", &HTMIME_acceptCharset}, - {"accept-encoding", &HTMIME_acceptEncoding}, - {"accept-language", &HTMIME_acceptLanguage}, - {"accept-ranges", &HTMIME_acceptRanges}, - {"authorization", NULL}, - {"cache-control", &HTMIME_cacheControl}, - {"connection", &HTMIME_connection}, - {"content-encoding", &HTMIME_contentEncoding}, - {"content-length", &HTMIME_contentLength}, - {"content-range", &HTMIME_contentRange}, - {"content-transfer-encoding", &HTMIME_contentTransferEncoding}, - {"content-type", &HTMIME_contentType}, - {"digest-MessageDigest", &HTMIME_messageDigest}, - {"keep-alive", &HTMIME_keepAlive}, - {"link", &HTMIME_link}, - {"location", &HTMIME_location_custom}, - {"max-forwards", &HTMIME_maxForwards}, - {"mime-version", NULL}, - {"pragma", &HTMIME_pragma}, - {"protocol", &HTMIME_protocol}, - {"protocol-info", &HTMIME_protocolInfo}, - {"protocol-request", &HTMIME_protocolRequest}, - {"proxy-authenticate", &HTMIME_authenticate}, - {"proxy-authorization", &HTMIME_proxyAuthorization}, - {"public", &HTMIME_public}, - {"range", &HTMIME_range}, - {"referer", &HTMIME_referer}, - {"retry-after", &HTMIME_retryAfter}, - {"server", &HTMIME_server}, - {"trailer", &HTMIME_trailer}, - {"transfer-encoding", &HTMIME_transferEncoding}, - {"upgrade", &HTMIME_upgrade}, - {"user-agent", &HTMIME_userAgent}, - {"vary", &HTMIME_vary}, - {"via", &HTMIME_via}, - {"warning", &HTMIME_warning}, - {"www-authenticate", &HTMIME_authenticate}, - {"authentication-info", &HTMIME_authenticationInfo}, - {"proxy-authentication-info", &HTMIME_proxyAuthenticationInfo} - }; - - for (uint i = 0; i < sizeof(fixedHandlers)/sizeof(fixedHandlers[0]); i++) - HTHeader_addParser(fixedHandlers[i].string, NO, fixedHandlers[i].pHandler); - - /* Set up default event loop */ - HTEventInit(); - - /* Add our own request terminate handler */ - HTNet_addAfter(requestTerminater, NULL, 0, HT_ALL, HT_FILTER_LAST); - - /* Setup cookies */ - HTCookie_init(); - HTCookie_setCookieMode(HTCookieMode(HT_COOKIE_ACCEPT | HT_COOKIE_SEND)); - HTCookie_setCallbacks(receiveCookie, NULL, sendCookie, NULL); - - /* Start the first request */ - - /* Go into the event loop... */ - // HTEventList_newLoop(); - - // App_delete(app); - - HTBind_add("htm", "text/html", NULL, "8bit", NULL, 1.0); /* HTML */ - HTBind_add("html", "text/html", NULL, "8bit", NULL, 1.0); /* HTML */ - - HTBind_caseSensitive(NO); // Change the HTML DTD SGML_dtd *HTML_DTD = HTML_dtd (); @@ -710,16 +447,6 @@ namespace NLGUI HTML_DTD->tags[HTML_SPAN].attributes = span_attr; HTML_DTD->tags[HTML_SPAN].number_of_attributes = sizeof(span_attr) / sizeof(HTAttr) - 1; - // Set a request timeout - // HTHost_setEventTimeout (30000); - // HTHost_setActiveTimeout (30000); - // HTHost_setPersistTimeout (30000); - - // libwww default value is 2000ms for POST/PUT requests on the first and 3000 on the second, smallest allowed value is 21ms - // too small values may create timeout problems but we want it low as possible - // second value is the timeout for the second try to we set that high - HTTP_setBodyWriteDelay(250, 3000); - // Initialized initialized = true; } diff --git a/code/nel/src/gui/libwww_nel_stream.cpp b/code/nel/src/gui/libwww_nel_stream.cpp deleted file mode 100644 index b7e218b30..000000000 --- a/code/nel/src/gui/libwww_nel_stream.cpp +++ /dev/null @@ -1,633 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include "stdpch.h" -#include - -extern "C" -{ - -/* Library Includes */ -#include "wwwsys.h" -#include "WWWUtil.h" -#include "WWWCore.h" -#include "WWWDir.h" -#include "WWWTrans.h" -#include "HTReqMan.h" -#include "HTBind.h" -#include "HTMulti.h" -#include "HTNetMan.h" -#include "HTChannl.h" -#include "nel/gui/libwww_nel_stream.h" /* Implemented here */ -} - -using namespace std; -using namespace NLMISC; - -extern "C" -{ - -/* Final states have negative value */ -typedef enum _FileState -{ - FS_RETRY = -4, - FS_ERROR = -3, - FS_NO_DATA = -2, - FS_GOT_DATA = -1, - FS_BEGIN = 0, - FS_PENDING, - FS_DO_CN, - FS_NEED_OPEN_FILE, - FS_NEED_BODY, - FS_PARSE_DIR, - FS_TRY_FTP -} FileState; - -/* This is the context structure for the this module */ -typedef struct _file_info -{ - FileState state; /* Current state of the connection */ - char * local; /* Local representation of file name */ - struct stat stat_info; /* Contains actual file chosen */ - HTNet * net; - HTTimer * timer; -} file_info; - -struct _HTStream -{ - const HTStreamClass * isa; -}; - -struct _HTInputStream -{ - const HTInputStreamClass * isa; - HTChannel * ch; - HTHost * host; - char * write; /* Last byte written */ - char * read; /* Last byte read */ - int b_read; - char data [INPUT_BUFFER_SIZE]; /* buffer */ -}; - -PRIVATE int FileCleanup (HTRequest *req, int status) -{ - HTNet * net = HTRequest_net(req); - file_info * file = (file_info *) HTNet_context(net); - HTStream * input = HTRequest_inputStream(req); - - /* Free stream with data TO Local file system */ - if (input) - { - if (status == HT_INTERRUPTED) - (*input->isa->abort)(input, NULL); - else - (*input->isa->_free)(input); - HTRequest_setInputStream(req, NULL); - } - - /* - ** Remove if we have registered a timer function as a callback - */ - if (file->timer) - { - HTTimer_delete(file->timer); - file->timer = NULL; - } - - if (file) - { - HT_FREE(file->local); - HT_FREE(file); - } - - HTNet_delete(net, status); - return YES; -} - - -PRIVATE int FileEvent (SOCKET soc, void * pVoid, HTEventType type); - -PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request) -{ - file_info *file; /* Specific access information */ - HTNet * net = HTRequest_net(request); - HTParentAnchor * anchor = HTRequest_anchor(request); - - HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTAnchor_physical(anchor)); - if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL) HT_OUTOFMEM("HTLoadFILE"); - file->state = FS_BEGIN; - file->net = net; - HTNet_setContext(net, file); - HTNet_setEventCallback(net, FileEvent); - HTNet_setEventParam(net, file); /* callbacks get http* */ - - return FileEvent(soc, file, HTEvent_BEGIN); /* get it started - ops is ignored */ -} - -PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */) -{ - file_info * file = (file_info *) param; - if (timer != file->timer) HTDEBUGBREAK("File timer %p not in sync\n" _ timer); - - HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer); - - /* - ** Delete the timer - */ - HTTimer_delete(file->timer); - file->timer = NULL; - - /* - ** Now call the event again - */ - return FileEvent(INVSOC, file, HTEvent_READ); -} - -PUBLIC int HTNeLFileOpen (HTNet * net, char * local, HTLocalMode /* mode */) -{ - HTRequest * request = HTNet_request(net); - HTHost * host = HTNet_host(net); - CIFile* fp = new CIFile; - - if (!fp->open (local)) - { - HTRequest_addSystemError(request, ERR_FATAL, errno, NO, "CIFile::open"); - return HT_ERROR; - } - - HTHost_setChannel(host, HTChannel_new(INVSOC, (FILE*)fp, YES)); - - HTHost_getInput(host, HTNet_transport(net), NULL, 0); - HTHost_getOutput(host, HTNet_transport(net), NULL, 0); - return HT_OK; -} - -PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type) -{ - file_info *file = (file_info *)pVoid; /* Specific access information */ - int status = HT_ERROR; - HTNet * net = file->net; - HTRequest * request = HTNet_request(net); - HTParentAnchor * anchor = HTRequest_anchor(request); - - if (type == HTEvent_CLOSE) - { - /* Interrupted */ - HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED, - NULL, 0, "HTLoadFile"); - FileCleanup(request, HT_INTERRUPTED); - return HT_OK; - } - - - /* Now jump into the machine. We know the state from the previous run */ - for(;;) - { - switch (file->state) - { - case FS_BEGIN: - - /* We only support safe (GET, HEAD, etc) methods for the moment */ - if (!HTMethod_isSafe(HTRequest_method(request))) { - HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED, - NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; - break; - } - - /* Check whether we have access to local disk at all */ - if (HTLib_secure()) - { - HTTRACE(PROT_TRACE, "LoadFile.... No access to local file system\n"); - file->state = FS_TRY_FTP; - break; - } - - /*file->local = HTWWWToLocal(HTAnchor_physical(anchor), "", - HTRequest_userProfile(request));*/ - { - string tmp = HTAnchor_physical(anchor); - if (strlwr(tmp).find("file:/") == 0) - { - tmp = tmp.substr(6, tmp.size()-6); - } - StrAllocCopy(file->local, tmp.c_str()); - } - - if (!file->local) - { - file->state = FS_TRY_FTP; - break; - } - - /* Create a new host object and link it to the net object */ - { - HTHost * host = NULL; - if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR; - HTNet_setHost(net, host); - if (HTHost_addNet(host, net) == HT_PENDING) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); - /* move to the hack state */ - file->state = FS_PENDING; - return HT_OK; - } - } - file->state = FS_DO_CN; - break; - - case FS_PENDING: - { - HTHost * host = NULL; - if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR; - HTNet_setHost(net, host); - if (HTHost_addNet(host, net) == HT_PENDING) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); - file->state = FS_PENDING; - return HT_OK; - } - } - file->state = FS_DO_CN; - break; - - case FS_DO_CN: - if (HTRequest_negotiation(request) && - HTMethod_isSafe(HTRequest_method(request))) - { - HTAnchor_setPhysical(anchor, file->local); - HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local); - } - else - { - if (HT_STAT(file->local, &file->stat_info) == -1) - { - HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local); - HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; - break; - } - } - - if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR) - { - if (HTRequest_method(request) == METHOD_GET) - { - file->state = FS_PARSE_DIR; - } - else - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile"); - file->state = FS_NO_DATA; - } - break; - } - - { - BOOL editable = FALSE; - HTBind_getAnchorBindings(anchor); - if (editable) HTAnchor_appendAllow(anchor, METHOD_PUT); - - /* Set the file size */ - CIFile nelFile; - if (nelFile.open (file->local)) - { - file->stat_info.st_size = nelFile.getFileSize(); - } - nelFile.close(); - - if (file->stat_info.st_size) - HTAnchor_setLength(anchor, file->stat_info.st_size); - - /* Set the file last modified time stamp */ - if (file->stat_info.st_mtime > 0) - HTAnchor_setLastModified(anchor, file->stat_info.st_mtime); - - /* Check to see if we can edit it */ - if (!editable && !file->stat_info.st_size) - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile"); - file->state = FS_NO_DATA; - } - else - { - file->state = (HTRequest_method(request)==METHOD_GET) ? FS_NEED_OPEN_FILE : FS_GOT_DATA; - } - } - break; - - case FS_NEED_OPEN_FILE: - status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY); - if (status == HT_OK) - { - { - HTStream * rstream = HTStreamStack(HTAnchor_format(anchor), - HTRequest_outputFormat(request), - HTRequest_outputStream(request), - request, YES); - HTNet_setReadStream(net, rstream); - HTRequest_setOutputConnected(request, YES); - } - - { - HTOutputStream * output = HTNet_getOutput(net, NULL, 0); - HTRequest_setInputStream(request, (HTStream *) output); - } - - if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request)) return HT_OK; - - HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0, "HTLoadFile"); - file->state = FS_NEED_BODY; - - if (HTEvent_isCallbacksRegistered()) - { - if (!HTRequest_preemptive(request)) - { - if (!HTNet_preemptive(net)) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); - HTHost_register(HTNet_host(net), net, HTEvent_READ); - } - else if (!file->timer) - { - HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); - file->timer = HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO); - } - return HT_OK; - } - } - } - else if (status == HT_WOULD_BLOCK || status == HT_PENDING) - { - return HT_OK; - } - else - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL, NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; /* Error or interrupt */ - } - break; - - case FS_NEED_BODY: - status = HTHost_read(HTNet_host(net), net); - if (status == HT_WOULD_BLOCK) - { - return HT_OK; - } - else if (status == HT_LOADED || status == HT_CLOSED) - { - file->state = FS_GOT_DATA; - } - else - { - HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN, NULL, 0, "HTLoadFile"); - file->state = FS_ERROR; - } - break; - - case FS_TRY_FTP: - { - char *url = HTAnchor_physical(anchor); - HTAnchor *anchor; - char *newname = NULL; - StrAllocCopy(newname, "ftp:"); - if (!strncmp(url, "file:", 5)) - { - StrAllocCat(newname, url+5); - } - else - { - StrAllocCat(newname, url); - } - anchor = HTAnchor_findAddress(newname); - HTRequest_setAnchor(request, anchor); - HT_FREE(newname); - FileCleanup(request, HT_IGNORE); - return HTLoad(request, YES); - } - break; - - case FS_GOT_DATA: - FileCleanup(request, HT_LOADED); - return HT_OK; - break; - - case FS_NO_DATA: - FileCleanup(request, HT_NO_DATA); - return HT_OK; - break; - - case FS_RETRY: - FileCleanup(request, HT_RETRY); - return HT_OK; - break; - - case FS_ERROR: - FileCleanup(request, HT_ERROR); - return HT_OK; - break; - - default: - break; - } - } /* End of while(1) */ -} - -// ************************************************************************* -// HTNeLReader -// ************************************************************************* - -size_t nel_fread (void *buffer, uint size, FILE *fp) -{ - CIFile *file = (CIFile *)fp; - int toRead = std::min ((int)(file->getFileSize () - file->getPos ()), (int)size); - file->serialBuffer((uint8*)buffer, toRead); - return toRead; -} - -PRIVATE int HTNeLReader_read (HTInputStream * me) -{ - FILE * fp = HTChannel_file(me->ch); - HTNet * net = HTHost_getReadNet(me->host); - int status; - - /* Read the file desriptor */ - while (fp) - { - if ((me->b_read = (int)nel_fread(me->data, FILE_BUFFER_SIZE, fp)) == 0) - { - HTAlertCallback *cbf = HTAlert_find(HT_PROG_DONE); - // HTTRACE(PROT_TRACE, "ANSI read... Finished loading file %p\n" _ fp); - if (cbf) - (*cbf)(net->request, HT_PROG_DONE, HT_MSG_NULL,NULL,NULL,NULL); - return HT_CLOSED; - } - - /* Remember how much we have read from the input socket */ - HTTRACEDATA(me->data, me->b_read, "HTANSIReader_read me->data:"); - me->write = me->data; - me->read = me->data + me->b_read; - - { - HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ); - HTNet_addBytesRead(net, me->b_read); - if (cbf) - { - int tr = HTNet_bytesRead(net); - (*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL); - } - } - - if (!net->readStream) - return HT_ERROR; - - /* Now push the data down the stream */ - if ((status = (*net->readStream->isa->put_block) - (net->readStream, me->data, me->b_read)) != HT_OK) - { - if (status == HT_WOULD_BLOCK) - { - HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n"); - return HT_WOULD_BLOCK; - } - else if (status == HT_PAUSE) - { - HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n"); - return HT_PAUSE; - } - else if (status > 0) - { - /* Stream specific return code */ - HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status); - me->write = me->data + me->b_read; - return status; - } - else - { - /* We have a real error */ - HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n"); - return status; - } - } - me->write = me->data + me->b_read; - } - HTTRACE(PROT_TRACE, "ANSI read... File descriptor is NULL...\n"); - return HT_ERROR; -} - -PRIVATE int HTNeLReader_close (HTInputStream * me) -{ - CIFile *file = (CIFile *)HTChannel_file(me->ch); - if (file) - { - file->close(); - } - - int status = HT_OK; - HTNet * net = HTHost_getReadNet(me->host); - - - if (net && net->readStream) - { - if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK) return HT_WOULD_BLOCK; - net->readStream = NULL; - } - - HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n"); - HT_FREE(me); - - return status; -} - -PUBLIC int HTNeLReader_consumed (HTInputStream * me, size_t bytes) -{ - me->write += bytes; - me->b_read -= (int)bytes; - HTHost_setRemainingRead(me->host, me->b_read); - return HT_OK; -} - -PRIVATE int HTNeLReader_flush (HTInputStream * me) -{ - HTNet * net = HTHost_getReadNet(me->host); - return net && net->readStream ? (*net->readStream->isa->flush)(net->readStream) : HT_OK; -} - -PRIVATE int HTNeLReader_free (HTInputStream * me) -{ - CIFile *file = (CIFile *)HTChannel_file(me->ch); - if (file) - { - delete file; - HTChannel_setFile (me->ch, NULL); - } - - HTNet * net = HTHost_getReadNet(me->host); - if (net && net->readStream) - { - int status = (*net->readStream->isa->_free)(net->readStream); - if (status == HT_OK) net->readStream = NULL; - return status; - } - return HT_OK; -} - -PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */) -{ - HTNet * net = HTHost_getReadNet(me->host); - if (net && net->readStream) - { - int status = (*net->readStream->isa->abort)(net->readStream, NULL); - if (status != HT_IGNORE) net->readStream = NULL; - } - return HT_ERROR; -} - -PRIVATE const HTInputStreamClass HTNeLReader = -{ - "SocketReader", - HTNeLReader_flush, - HTNeLReader_free, - HTNeLReader_abort, - HTNeLReader_read, - HTNeLReader_close, - HTNeLReader_consumed -}; - -PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * /* param */, int /* mode */) -{ - if (host && ch) - { - HTInputStream * me = HTChannel_input(ch); - if (me == NULL) - { - if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL) HT_OUTOFMEM("HTNeLReader_new"); - me->isa = &HTNeLReader; - me->ch = ch; - me->host = host; - HTTRACE(STREAM_TRACE, "Reader...... Created reader stream %p\n" _ me); - } - return me; - } - return NULL; -} - -//PUBLIC unsigned int WWW_TraceFlag = 0; - -} // extern "C" - - diff --git a/code/nel/src/gui/libwww_types.cpp b/code/nel/src/gui/libwww_types.cpp new file mode 100644 index 000000000..31e05f456 --- /dev/null +++ b/code/nel/src/gui/libwww_types.cpp @@ -0,0 +1,797 @@ +/** + libwww Copyright Notice + [This notice should be placed within redistributed or derivative software + code when appropriate. This particular formulation of W3C's notice for + inclusion in libwww code became active on August 14 1998.] + + LIBWWW COPYRIGHT NOTICE + + libwww: W3C's implementation of HTTP can be found at: + http://www.w3.org/Library/ + + Copyright ¨ 1995-2002 World Wide Web Consortium, + (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en + Automatique, Keio University). All Rights Reserved. + This program is distributed under the W3C's + Intellectual Property License. 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 W3C License + http://www.w3.org/Consortium/Legal/ for more details. + + Copyright ¨ 1995 CERN. "This product includes computer + software created and made available by CERN. This + acknowledgment shall be mentioned in full in any + product which includes the CERN computer software + included herein or parts thereof." + + ****************************************************************************/ + +#include "nel/gui/libwww_types.h" + +namespace NLGUI +{ + +/* + ** ATTRIBUTE DEFINITION MACROS (see HTMLPDTD.h) + */ + +/* + * redefine the macros, so that the "stringized" attribute name + * is generated + */ + +#undef HTML_ATTR +#define HTML_ATTR(t,a) { (char *) #a } +#undef HTML_ATTRIBUTES +#define HTML_ATTRIBUTES(t) { 0 } + +/* + ** ATTRIBUTE LISTS + */ + +static HTAttr no_attr[1] = { + { 0 } +}; + +static HTAttr body_attr[HTML_BODY_ATTRIBUTES+1] = { /* to catch images */ + HTML_ATTR(BODY,ALINK), + HTML_ATTR(BODY,BACKGROUND), + HTML_ATTR(BODY,BGCOLOR), + HTML_ATTR(BODY,CLASS), + HTML_ATTR(BODY,DIR), + HTML_ATTR(BODY,ID), + HTML_ATTR(BODY,LANG), + HTML_ATTR(BODY,LINK), + HTML_ATTR(BODY,STYLE), + HTML_ATTR(BODY,TEXT), + HTML_ATTR(BODY,TITLE), + HTML_ATTR(BODY,VLINK), + HTML_ATTRIBUTES(BODY) +}; + +static HTAttr frame_attr[HTML_FRAME_ATTRIBUTES+1] = { /* frame attributes */ + HTML_ATTR(FRAME,CLASS), + HTML_ATTR(FRAME,FRAMEBORDER), + HTML_ATTR(FRAME,ID), + HTML_ATTR(FRAME,NAME), + HTML_ATTR(FRAME,MARGINHEIGHT), + HTML_ATTR(FRAME,MARGINWIDTH), + HTML_ATTR(FRAME,NORESIZE), + HTML_ATTR(FRAME,LONGDESC), + HTML_ATTR(FRAME,SCROLLING), + HTML_ATTR(FRAME,SRC), + HTML_ATTR(FRAME,STYLE), + HTML_ATTR(FRAME,TARGET), + HTML_ATTR(FRAME,TITLE), + HTML_ATTRIBUTES(FRAME) +}; + +static HTAttr frameset_attr[HTML_FRAMESET_ATTRIBUTES+1] = { /* frameset attributes */ + HTML_ATTR(FRAMESET,CLASS), + HTML_ATTR(FRAMESET,COLS), + HTML_ATTR(FRAMESET,ID), + HTML_ATTR(FRAMESET,ROWS), + HTML_ATTR(FRAMESET,STYLE), + HTML_ATTR(FRAMESET,TITLE), + HTML_ATTRIBUTES(FRAMESET) +}; + +static HTAttr a_attr[HTML_A_ATTRIBUTES+1] = { /* Anchor attributes */ + HTML_ATTR(A,ACCESSKEY), + HTML_ATTR(A,CHARSET), + HTML_ATTR(A,CLASS), + HTML_ATTR(A,COORDS), + HTML_ATTR(A,DIR), + HTML_ATTR(A,HREF), + HTML_ATTR(A,HREFLANG), + HTML_ATTR(A,ID), + HTML_ATTR(A,NAME), + HTML_ATTR(A,REL), + HTML_ATTR(A,REV), + HTML_ATTR(A,SHAPE), + HTML_ATTR(A,STYLE), + HTML_ATTR(A,TABINDEX), + HTML_ATTR(A,TARGET), + HTML_ATTR(A,TYPE), + HTML_ATTR(A,TITLE), + HTML_ATTRIBUTES(A) +}; + +static HTAttr applet_attr[HTML_APPLET_ATTRIBUTES+1] = { + HTML_ATTR(APPLET,ALIGN), + HTML_ATTR(APPLET,ALT), + HTML_ATTR(APPLET,ARCHIVE), + HTML_ATTR(APPLET,CLASS), + HTML_ATTR(APPLET,CODE), + HTML_ATTR(APPLET,CODEBASE), + HTML_ATTR(APPLET,HEIGHT), + HTML_ATTR(APPLET,HSPACE), + HTML_ATTR(APPLET,ID), + HTML_ATTR(APPLET,NAME), + HTML_ATTR(APPLET,OBJECT), + HTML_ATTR(APPLET,STYLE), + HTML_ATTR(APPLET,TITLE), + HTML_ATTR(APPLET,VSPACE), + HTML_ATTR(APPLET,WIDTH), + HTML_ATTRIBUTES(APPLET) +}; + +static HTAttr area_attr[HTML_AREA_ATTRIBUTES+1] = { /* Area attributes */ + HTML_ATTR(AREA,ACCESSKEY), + HTML_ATTR(AREA,ALT), + HTML_ATTR(AREA,CLASS), + HTML_ATTR(AREA,COORDS), + HTML_ATTR(AREA,DIR), + HTML_ATTR(AREA,HREF), + HTML_ATTR(AREA,ID), + HTML_ATTR(AREA,NAME), + HTML_ATTR(AREA,NOHREF), + HTML_ATTR(AREA,LANG), + HTML_ATTR(AREA,SHAPE), + HTML_ATTR(AREA,STYLE), + HTML_ATTR(AREA,TABINDEX), + HTML_ATTR(AREA,TARGET), + HTML_ATTR(AREA,TITLE), + HTML_ATTRIBUTES(AREA) +}; + +static HTAttr base_attr[HTML_BASE_ATTRIBUTES+1] = { /* BASE attributes */ + HTML_ATTR(BASE,HREF), + HTML_ATTR(BASE,TARGET), + HTML_ATTRIBUTES(BASE) +}; + +static HTAttr bdo_attr[HTML_BDO_ATTRIBUTES+1] = { + HTML_ATTR(BDO,CLASS), + HTML_ATTR(BDO,DIR), + HTML_ATTR(BDO,ID), + HTML_ATTR(BDO,LANG), + HTML_ATTR(BDO,STYLE), + HTML_ATTR(BDO,TITLE), + HTML_ATTRIBUTES(BDO) +}; + +static HTAttr bq_attr[HTML_BQ_ATTRIBUTES+1] = { + HTML_ATTR(BQ,CITE), + HTML_ATTR(BQ,CLASS), + HTML_ATTR(BQ,DIR), + HTML_ATTR(BQ,ID), + HTML_ATTR(BQ,LANG), + HTML_ATTR(BQ,STYLE), + HTML_ATTR(BQ,TITLE), + HTML_ATTRIBUTES(BQ) +}; + +static HTAttr br_attr[HTML_BR_ATTRIBUTES+1] = { + HTML_ATTR(BR,CLASS), + HTML_ATTR(BR,CLEAR), + HTML_ATTR(BR,ID), + HTML_ATTR(BR,STYLE), + HTML_ATTR(BR,TITLE), + HTML_ATTRIBUTES(BR) +}; + +static HTAttr button_attr[HTML_BUTTON_ATTRIBUTES+1] = { + HTML_ATTR(BUTTON,ACCESSKEY), + HTML_ATTR(BUTTON,CLASS), + HTML_ATTR(BUTTON,DIR), + HTML_ATTR(BUTTON,DISABLED), + HTML_ATTR(BUTTON,ID), + HTML_ATTR(BUTTON,LANG), + HTML_ATTR(BUTTON,NAME), + HTML_ATTR(BUTTON,STYLE), + HTML_ATTR(BUTTON,TABINDEX), + HTML_ATTR(BUTTON,TITLE), + HTML_ATTR(BUTTON,TYPE), + HTML_ATTR(BUTTON,VALUE), + HTML_ATTRIBUTES(BUTTON), +}; + +static HTAttr col_attr[HTML_COL_ATTRIBUTES+1] = { + HTML_ATTR(COL,CLASS), + HTML_ATTR(COL,DIR), + HTML_ATTR(COL,ID), + HTML_ATTR(COL,LANG), + HTML_ATTR(COL,SPAN), + HTML_ATTR(COL,STYLE), + HTML_ATTR(COL,TITLE), + HTML_ATTR(COL,WIDTH), + HTML_ATTRIBUTES(COL) +}; + +static HTAttr changes_attr[HTML_CHANGES_ATTRIBUTES+1] = { + HTML_ATTR(CHANGES,CITE), + HTML_ATTR(CHANGES,CLASS), + HTML_ATTR(CHANGES,DATETIME), + HTML_ATTR(CHANGES,DIR), + HTML_ATTR(CHANGES,ID), + HTML_ATTR(CHANGES,LANG), + HTML_ATTR(CHANGES,STYLE), + HTML_ATTR(CHANGES,TITLE), + HTML_ATTRIBUTES(CHANGES) +}; + +static HTAttr font_attr[HTML_FONT_ATTRIBUTES+1] = { + HTML_ATTR(FONT,CLASS), + HTML_ATTR(FONT,COLOR), + HTML_ATTR(FONT,DIR), + HTML_ATTR(FONT,FACE), + HTML_ATTR(FONT,ID), + HTML_ATTR(FONT,LANG), + HTML_ATTR(FONT,SIZE), + HTML_ATTR(FONT,STYLE), + HTML_ATTR(FONT,TITLE), + HTML_ATTRIBUTES(FONT) +}; + +static HTAttr form_attr[HTML_FORM_ATTRIBUTES+1] = { + HTML_ATTR(FORM,ACCEPT), + { (char *) "ACCEPT-CHARSET" }, /* HTML_ATTR(FORM,ACCEPT_CHARSET) */ + HTML_ATTR(FORM,ACTION), + HTML_ATTR(FORM,CLASS), + HTML_ATTR(FORM,DIR), + HTML_ATTR(FORM,ENCTYPE), + HTML_ATTR(FORM,ID), + HTML_ATTR(FORM,LANG), + HTML_ATTR(FORM,METHOD), + HTML_ATTR(FORM,STYLE), + HTML_ATTR(FORM,TARGET), + HTML_ATTR(FORM,TITLE), + HTML_ATTRIBUTES(FORM) +}; + +static HTAttr gen_attr[HTML_GEN_ATTRIBUTES+1] = { /* General, for many things */ + HTML_ATTR(GEN,CLASS), + HTML_ATTR(GEN,DIR), + HTML_ATTR(GEN,ID), + HTML_ATTR(GEN,LANG), + HTML_ATTR(GEN,STYLE), + HTML_ATTR(GEN,TITLE), + HTML_ATTRIBUTES(GEN) +}; + +static HTAttr block_attr[HTML_BLOCK_ATTRIBUTES+1] = { /* DIV, SPAN, H1-H6 */ + HTML_ATTR(BLOCK,ALIGN), + HTML_ATTR(BLOCK,CLASS), + HTML_ATTR(BLOCK,DIR), + HTML_ATTR(BLOCK,ID), + HTML_ATTR(BLOCK,LANG), + HTML_ATTR(BLOCK,STYLE), + HTML_ATTR(BLOCK,TITLE), + HTML_ATTRIBUTES(BLOCK) +}; + +static HTAttr head_attr[HTML_HEAD_ATTRIBUTES+1] = { + HTML_ATTR(HEAD,DIR), + HTML_ATTR(HEAD,LANG), + HTML_ATTR(HEAD,PROFILE), + HTML_ATTRIBUTES(HEAD) +}; + +static HTAttr hr_attr[HTML_HR_ATTRIBUTES+1] = { + HTML_ATTR(HR,ALIGN), + HTML_ATTR(HR,CLASS), + HTML_ATTR(HR,DIR), + HTML_ATTR(HR,ID), + HTML_ATTR(HR,LANG), + HTML_ATTR(HR,NOSHADE), + HTML_ATTR(HR,SIZE), + HTML_ATTR(HR,STYLE), + HTML_ATTR(HR,TITLE), + HTML_ATTR(HR,WIDTH), + HTML_ATTRIBUTES(HR) +}; + +static HTAttr html_attr[HTML_HTML_ATTRIBUTES+1] = { + HTML_ATTR(HTML,DIR), + HTML_ATTR(HTML,LANG), + HTML_ATTR(HTML,VERSION), + HTML_ATTRIBUTES(HTML) +}; + +static HTAttr iframe_attr[HTML_IFRAME_ATTRIBUTES+1] = { + HTML_ATTR(IFRAME,ALIGN), + HTML_ATTR(IFRAME,CLASS), + HTML_ATTR(IFRAME,FRAMEBORDER), + HTML_ATTR(IFRAME,HEIGHT), + HTML_ATTR(IFRAME,ID), + HTML_ATTR(IFRAME,LONGDESC), + HTML_ATTR(IFRAME,MARGINHEIGHT), + HTML_ATTR(IFRAME,MARGINWIDTH), + HTML_ATTR(IFRAME,NAME), + HTML_ATTR(IFRAME,SCROLLING), + HTML_ATTR(IFRAME,SRC), + HTML_ATTR(IFRAME,STYLE), + HTML_ATTR(IFRAME,TARGET), + HTML_ATTR(IFRAME,TITLE), + HTML_ATTR(IFRAME,WIDTH), + HTML_ATTRIBUTES(IFRAME) +}; + +static HTAttr img_attr[HTML_IMG_ATTRIBUTES+1] = { /* IMG attributes */ + HTML_ATTR(IMG,ALIGN), + HTML_ATTR(IMG,ALT), + HTML_ATTR(IMG,BORDER), + HTML_ATTR(IMG,CLASS), + HTML_ATTR(IMG,DIR), + HTML_ATTR(IMG,HEIGHT), + HTML_ATTR(IMG,HSPACE), + HTML_ATTR(IMG,ID), + HTML_ATTR(IMG,ISMAP), + HTML_ATTR(IMG,LANG), + HTML_ATTR(IMG,LONGDESC), + HTML_ATTR(IMG,SRC), + HTML_ATTR(IMG,STYLE), + HTML_ATTR(IMG,TITLE), + HTML_ATTR(IMG,USEMAP), + HTML_ATTR(IMG,VSPACE), + HTML_ATTR(IMG,WIDTH), + HTML_ATTRIBUTES(IMG) +}; + +static HTAttr input_attr[HTML_INPUT_ATTRIBUTES+1] = { + HTML_ATTR(INPUT,ACCEPT), + HTML_ATTR(INPUT,ACCESSKEY), + HTML_ATTR(INPUT,ALIGN), + HTML_ATTR(INPUT,ALT), + HTML_ATTR(INPUT,CHECKED), + HTML_ATTR(INPUT,CLASS), + HTML_ATTR(INPUT,DIR), + HTML_ATTR(INPUT,DISABLED), + HTML_ATTR(INPUT,ID), + HTML_ATTR(INPUT,LANG), + HTML_ATTR(INPUT,MAXLENGTH), + HTML_ATTR(INPUT,NAME), + HTML_ATTR(INPUT,READONLY), + HTML_ATTR(INPUT,SIZE), + HTML_ATTR(INPUT,SRC), + HTML_ATTR(INPUT,STYLE), + HTML_ATTR(INPUT,TABINDEX), + HTML_ATTR(INPUT,TITLE), + HTML_ATTR(INPUT,TYPE), + HTML_ATTR(INPUT,USEMAP), + HTML_ATTR(INPUT,VALUE), + HTML_ATTRIBUTES(INPUT) +}; + +static HTAttr isindex_attr[HTML_ISINDEX_ATTRIBUTES+1] = { + HTML_ATTR(ISINDEX,CLASS), + HTML_ATTR(ISINDEX,DIR), + HTML_ATTR(ISINDEX,ID), + HTML_ATTR(ISINDEX,LANG), + HTML_ATTR(ISINDEX,PROMPT), + HTML_ATTR(ISINDEX,STYLE), + HTML_ATTR(ISINDEX,TITLE), + HTML_ATTRIBUTES(ISINDEX) +}; + +static HTAttr label_attr[HTML_LABEL_ATTRIBUTES+1] = { + HTML_ATTR(LABEL,ACCESSKEY), + HTML_ATTR(LABEL,CLASS), + HTML_ATTR(LABEL,DIR), + HTML_ATTR(LABEL,FOR), + HTML_ATTR(LABEL,ID), + HTML_ATTR(LABEL,LANG), + HTML_ATTR(LABEL,STYLE), + HTML_ATTR(LABEL,TITLE), + HTML_ATTRIBUTES(LABEL) +}; + +static HTAttr legend_attr[HTML_LEGEND_ATTRIBUTES+1] = { + HTML_ATTR(LEGEND,ACCESSKEY), + HTML_ATTR(LEGEND,ALIGN), + HTML_ATTR(LEGEND,CLASS), + HTML_ATTR(LEGEND,DIR), + HTML_ATTR(LEGEND,ID), + HTML_ATTR(LEGEND,LANG), + HTML_ATTR(LEGEND,STYLE), + HTML_ATTR(LEGEND,TITLE), + HTML_ATTRIBUTES(LEGEND) +}; + +static HTAttr li_attr[HTML_LI_ATTRIBUTES+1] = { + HTML_ATTR(LI,CLASS), + HTML_ATTR(LI,COMPACT), + HTML_ATTR(LI,DIR), + HTML_ATTR(LI,ID), + HTML_ATTR(LI,LANG), + HTML_ATTR(LI,STYLE), + HTML_ATTR(LI,TITLE), + HTML_ATTR(LI,TYPE), + HTML_ATTR(LI,VALUE), + HTML_ATTRIBUTES(LI) +}; + +static HTAttr link_attr[HTML_LINK_ATTRIBUTES+1] = { /* link attributes */ + HTML_ATTR(LINK,CHARSET), + HTML_ATTR(LINK,CLASS), + HTML_ATTR(LINK,DIR), + HTML_ATTR(LINK,HREF), + HTML_ATTR(LINK,HREFLANG), + HTML_ATTR(LINK,ID), + HTML_ATTR(LINK,LANG), + HTML_ATTR(LINK,MEDIA), + HTML_ATTR(LINK,REL), + HTML_ATTR(LINK,REV), + HTML_ATTR(LINK,STYLE), + HTML_ATTR(LINK,TARGET), + HTML_ATTR(LINK,TITLE), + HTML_ATTR(LINK,TYPE), + HTML_ATTRIBUTES(LINK) +}; + +static HTAttr map_attr[HTML_MAP_ATTRIBUTES+1] = { + HTML_ATTR(MAP,CLASS), + HTML_ATTR(MAP,DIR), + HTML_ATTR(MAP,ID), + HTML_ATTR(MAP,LANG), + HTML_ATTR(MAP,NAME), + HTML_ATTR(MAP,STYLE), + HTML_ATTR(MAP,TITLE), + HTML_ATTRIBUTES(MAP) +}; + +static HTAttr meta_attr[HTML_META_ATTRIBUTES+1] = { + HTML_ATTR(META,CONTENT), + HTML_ATTR(META,DIR), + { (char *)"HTTP-EQUIV" }, /* HTML_ATTR(META,HTTP_EQUIV) */ + HTML_ATTR(META,LANG), + HTML_ATTR(META,NAME), + HTML_ATTR(META,SCHEME), + HTML_ATTRIBUTES(META) +}; + +static HTAttr nextid_attr[HTML_NEXTID_ATTRIBUTES+1] = { + { (char *)"N" }, + { 0 } /* Terminate list */ +}; + +static HTAttr object_attr[HTML_OBJECT_ATTRIBUTES+1] = { /* object attributes */ + HTML_ATTR(OBJECT,ALIGN), + HTML_ATTR(OBJECT,ARCHIVE), + HTML_ATTR(OBJECT,BORDER), + HTML_ATTR(OBJECT,CLASS), + HTML_ATTR(OBJECT,CLASSID), + HTML_ATTR(OBJECT,CODEBASE), + HTML_ATTR(OBJECT,CODETYPE), + HTML_ATTR(OBJECT,DATA), + HTML_ATTR(OBJECT,DECLARE), + HTML_ATTR(OBJECT,DIR), + HTML_ATTR(OBJECT,HEIGHT), + HTML_ATTR(OBJECT,HSPACE), + HTML_ATTR(OBJECT,ID), + HTML_ATTR(OBJECT,LANG), + HTML_ATTR(OBJECT,NAME), + HTML_ATTR(OBJECT,STANDBY), + HTML_ATTR(OBJECT,STYLE), + HTML_ATTR(OBJECT,TABINDEX), + HTML_ATTR(OBJECT,TITLE), + HTML_ATTR(OBJECT,TYPE), + HTML_ATTR(OBJECT,USEMAP), + HTML_ATTR(OBJECT,VSPACE), + HTML_ATTR(OBJECT,WIDTH), + HTML_ATTRIBUTES(OBJECT) +}; + +static HTAttr ol_attr[HTML_OL_ATTRIBUTES+1] = { + HTML_ATTR(OL,CLASS), + HTML_ATTR(OL,COMPACT), + HTML_ATTR(OL,DIR), + HTML_ATTR(OL,ID), + HTML_ATTR(OL,LANG), + HTML_ATTR(OL,START), + HTML_ATTR(OL,STYLE), + HTML_ATTR(OL,TITLE), + HTML_ATTR(OL,TYPE), + HTML_ATTRIBUTES(OL) +}; + +static HTAttr optgroup_attr[HTML_OPTGROUP_ATTRIBUTES+1] = { + HTML_ATTR(OPTGROUP,CLASS), + HTML_ATTR(OPTGROUP,DISABLED), + HTML_ATTR(OPTGROUP,DIR), + HTML_ATTR(OPTGROUP,ID), + HTML_ATTR(OPTGROUP,LABEL), + HTML_ATTR(OPTGROUP,LANG), + HTML_ATTR(OPTGROUP,STYLE), + HTML_ATTR(OPTGROUP,TITLE), + HTML_ATTRIBUTES(OPTGROUP) +}; + +static HTAttr option_attr[HTML_OPTION_ATTRIBUTES+1] = { + HTML_ATTR(OPTION,CLASS), + HTML_ATTR(OPTION,DISABLED), + HTML_ATTR(OPTION,DIR), + HTML_ATTR(OPTION,ID), + HTML_ATTR(OPTION,LABEL), + HTML_ATTR(OPTION,LANG), + HTML_ATTR(OPTION,SELECTED), + HTML_ATTR(OPTION,STYLE), + HTML_ATTR(OPTION,TITLE), + HTML_ATTR(OPTION,VALUE), + HTML_ATTRIBUTES(OPTION) +}; + +static HTAttr param_attr[HTML_PARAM_ATTRIBUTES+1] = { + HTML_ATTR(PARAM,ID), + HTML_ATTR(PARAM,NAME), + HTML_ATTR(PARAM,TYPE), + HTML_ATTR(PARAM,VALUE), + HTML_ATTR(PARAM,VALUETYPE), + HTML_ATTRIBUTES(PARAM) +}; + +static HTAttr pre_attr[HTML_PRE_ATTRIBUTES+1] = { + HTML_ATTR(PRE,CLASS), + HTML_ATTR(PRE,DIR), + HTML_ATTR(PRE,ID), + HTML_ATTR(PRE,LANG), + HTML_ATTR(PRE,STYLE), + HTML_ATTR(PRE,TITLE), + HTML_ATTR(PRE,WIDTH), + HTML_ATTRIBUTES(PRE) +}; + +static HTAttr script_attr[HTML_SCRIPT_ATTRIBUTES+1] = { + HTML_ATTR(SCRIPT,CHARSET), + HTML_ATTR(SCRIPT,DEFER), + HTML_ATTR(SCRIPT,LANGUAGE), + HTML_ATTR(SCRIPT,SRC), + HTML_ATTR(SCRIPT,TYPE), + HTML_ATTRIBUTES(SCRIPT) +}; + +static HTAttr select_attr[HTML_SELECT_ATTRIBUTES+1] = { + HTML_ATTR(SELECT,CLASS), + HTML_ATTR(SELECT,DIR), + HTML_ATTR(SELECT,DISABLED), + HTML_ATTR(SELECT,ID), + HTML_ATTR(SELECT,LANG), + HTML_ATTR(SELECT,MULTIPLE), + HTML_ATTR(SELECT,NAME), + HTML_ATTR(SELECT,SIZE), + HTML_ATTR(SELECT,STYLE), + HTML_ATTR(SELECT,TABINDEX), + HTML_ATTR(SELECT,TITLE), + HTML_ATTRIBUTES(SELECT) +}; + +static HTAttr style_attr[HTML_STYLE_ATTRIBUTES+1] = { + HTML_ATTR(STYLE,DIR), + HTML_ATTR(STYLE,LANG), + HTML_ATTR(STYLE,MEDIA), + HTML_ATTR(STYLE,TITLE), + HTML_ATTR(STYLE,TYPE), + HTML_ATTRIBUTES(STYLE) +}; + +static HTAttr table_attr[HTML_TABLE_ATTRIBUTES+1] = { + HTML_ATTR(TABLE,ALIGN), + HTML_ATTR(TABLE,BGCOLOR), + HTML_ATTR(TABLE,BORDER), + HTML_ATTR(TABLE,CELLPADDING), + HTML_ATTR(TABLE,CELLSPACING), + HTML_ATTR(TABLE,CLASS), + HTML_ATTR(TABLE,DIR), + HTML_ATTR(TABLE,FRAME), + HTML_ATTR(TABLE,ID), + HTML_ATTR(TABLE,LANG), + HTML_ATTR(TABLE,RULES), + HTML_ATTR(TABLE,SUMMARY), + HTML_ATTR(TABLE,STYLE), + HTML_ATTR(TABLE,TITLE), + HTML_ATTR(TABLE,WIDTH), + HTML_ATTRIBUTES(TABLE) +}; + +static HTAttr tele_attr[HTML_TELE_ATTRIBUTES+1] = { + HTML_ATTR(TELE,ALIGN), + HTML_ATTR(TELE,CHAR), + HTML_ATTR(TELE,CHAROFF), + HTML_ATTR(TELE,CLASS), + HTML_ATTR(TELE,DIR), + HTML_ATTR(TELE,ID), + HTML_ATTR(TELE,LANG), + HTML_ATTR(TELE,STYLE), + HTML_ATTR(TELE,TITLE), + HTML_ATTR(TELE,VALIGN), + HTML_ATTRIBUTES(TELE) +}; + +static HTAttr td_attr[HTML_TD_ATTRIBUTES+1] = { + HTML_ATTR(TD,ABBR), + HTML_ATTR(TD,ALIGN), + HTML_ATTR(TD,AXIS), + HTML_ATTR(TD,BGCOLOR), + HTML_ATTR(TD,CHAR), + HTML_ATTR(TD,CHAROFF), + HTML_ATTR(TD,CLASS), + HTML_ATTR(TD,COLSPAN), + HTML_ATTR(TD,DIR), + HTML_ATTR(TD,ID), + HTML_ATTR(TD,HEADERS), + HTML_ATTR(TD,HEIGHT), + HTML_ATTR(TD,LANG), + HTML_ATTR(TD,NOWRAP), + HTML_ATTR(TD,ROWSPAN), + HTML_ATTR(TD,SCOPE), + HTML_ATTR(TD,STYLE), + HTML_ATTR(TD,TITLE), + HTML_ATTR(TD,VALIGN), + HTML_ATTR(TD,WIDTH), + HTML_ATTRIBUTES(TD) +}; + +static HTAttr textarea_attr[HTML_TEXTAREA_ATTRIBUTES+1] = { + HTML_ATTR(TEXTAREA,CLASS), + HTML_ATTR(TEXTAREA,COLS), + HTML_ATTR(TEXTAREA,DIR), + HTML_ATTR(TEXTAREA,DISABLED), + HTML_ATTR(TEXTAREA,ID), + HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,NAME), + HTML_ATTR(TEXTAREA,READONLY), + HTML_ATTR(TEXTAREA,ROWS), + HTML_ATTR(TEXTAREA,STYLE), + HTML_ATTR(TEXTAREA,TABINDEX), + HTML_ATTR(TEXTAREA,TITLE), + HTML_ATTRIBUTES(TEXTAREA) +}; + +static HTAttr title_attr[HTML_TITLE_ATTRIBUTES+1] = { + HTML_ATTR(TITLE,DIR), + HTML_ATTR(TITLE,LANG), + HTML_ATTRIBUTES(TITLE) +}; + +static HTAttr ul_attr[HTML_UL_ATTRIBUTES+1] = { + HTML_ATTR(UL,CLASS), + HTML_ATTR(UL,COMPACT), + HTML_ATTR(UL,DIR), + HTML_ATTR(UL,ID), + HTML_ATTR(UL,LANG), + HTML_ATTR(UL,STYLE), + HTML_ATTR(UL,TITLE), + HTML_ATTR(UL,TYPE), + HTML_ATTRIBUTES(UL) +}; + +/* + ** ELEMENTS + ** Must match definitions in HTMLPDTD.html! + ** Must be in alphabetical order. + ** + ** Name, Attributes, content + */ +static HTTag tags[HTML_ELEMENTS] = { + { "A" , a_attr, HTML_A_ATTRIBUTES }, + { "ABBR" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "ADDRESS" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES }, + { "AREA" , area_attr, HTML_AREA_ATTRIBUTES }, + { "B" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "BASE" , base_attr, HTML_BASE_ATTRIBUTES }, + { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES }, + { "BDO" , bdo_attr, HTML_BDO_ATTRIBUTES }, + { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES }, + { "BODY" , body_attr, HTML_BODY_ATTRIBUTES }, + { "BR" , br_attr, HTML_BR_ATTRIBUTES }, + { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES }, + { "CAPTION" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "CENTER" , no_attr, 0 }, + { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "COL" , col_attr, HTML_COL_ATTRIBUTES }, + { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES }, + { "DD" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DEL" , changes_attr, HTML_CHANGES_ATTRIBUTES }, + { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DIR" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DIV" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "DL" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "DT" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "EM" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "FIELDSET", gen_attr, HTML_GEN_ATTRIBUTES }, + { "FONT" , font_attr, HTML_FONT_ATTRIBUTES }, + { "FORM" , form_attr, HTML_FORM_ATTRIBUTES }, + { "FRAME" , frame_attr, HTML_FRAME_ATTRIBUTES }, + { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES }, + { "H1" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H2" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H3" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H4" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H5" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "H6" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "HEAD" , head_attr, HTML_HEAD_ATTRIBUTES }, + { "HR" , hr_attr, HTML_HR_ATTRIBUTES }, + { "HTML" , html_attr, HTML_HTML_ATTRIBUTES }, + { "I" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES }, + { "IMG" , img_attr, HTML_IMG_ATTRIBUTES }, + { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES }, + { "INS" , changes_attr, HTML_CHANGES_ATTRIBUTES }, + { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES }, + { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES }, + { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES }, + { "LI" , li_attr, HTML_LI_ATTRIBUTES }, + { "LINK" , link_attr, HTML_LINK_ATTRIBUTES }, + { "MAP" , map_attr, HTML_MAP_ATTRIBUTES }, + { "MENU" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "META" , meta_attr, HTML_META_ATTRIBUTES }, + { "NEXTID" , nextid_attr, 1 }, + { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES }, + { "NOSCRIPT", gen_attr, HTML_GEN_ATTRIBUTES }, + { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES }, + { "OL" , ol_attr, HTML_OL_ATTRIBUTES }, + { "OPTGROUP", optgroup_attr,HTML_OPTGROUP_ATTRIBUTES }, + { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES }, + { "P" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES }, + { "PRE" , pre_attr, HTML_PRE_ATTRIBUTES }, + { "Q" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "S" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES }, + { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES }, + { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SPAN" , block_attr, HTML_BLOCK_ATTRIBUTES }, + { "STRIKE" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "STRONG" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "STYLE" , style_attr, HTML_STYLE_ATTRIBUTES }, + { "SUB" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "SUP" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "TABLE" , table_attr, HTML_TABLE_ATTRIBUTES }, + { "TBODY" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TD" , td_attr, HTML_TD_ATTRIBUTES }, + { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES }, + { "TFOOT" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TH" , td_attr, HTML_TD_ATTRIBUTES }, + { "THEAD" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TITLE" , title_attr, HTML_TITLE_ATTRIBUTES }, + { "TR" , tele_attr, HTML_TELE_ATTRIBUTES }, + { "TT" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "U" , gen_attr, HTML_GEN_ATTRIBUTES }, + { "UL" , ul_attr, HTML_UL_ATTRIBUTES }, + { "VAR" , gen_attr, HTML_GEN_ATTRIBUTES }, +}; + +static SGML_dtd HTMLP_dtd = { + tags, + HTML_ELEMENTS +}; + +static SGML_dtd * DTD = &HTMLP_dtd; + +SGML_dtd * HTML_dtd (void) +{ + return DTD; +} + +}// namespace + diff --git a/code/nel/src/gui/url_parser.cpp b/code/nel/src/gui/url_parser.cpp new file mode 100644 index 000000000..68d4f8496 --- /dev/null +++ b/code/nel/src/gui/url_parser.cpp @@ -0,0 +1,222 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "nel/misc/types_nl.h" +#include "nel/gui/url_parser.h" + +using namespace std; + + +namespace NLGUI +{ + // *************************************************************************** + CUrlParser::CUrlParser(const std::string &uri) + { + parse(uri); + } + + // *************************************************************************** + void CUrlParser::parse(std::string uri) + { + const size_t npos = std::string::npos; + size_t pos; + size_t offset = 0; + + // strip fragment if present + pos = uri.find("#"); + if (pos != npos) + { + hash = uri.substr(pos + 1); + uri = uri.substr(0, pos); + } + + // scan for scheme + pos = uri.find(":"); + if (pos != npos && pos >= 1) + { + for (uint i=0; i 0) + { + // full or last segment + sub = path.substr(pos-1, 4); + if (sub == "/../" || sub == "/..") + { + if (pos > 1) + lhp = path.find_last_of("/", pos - 2); + else + lhp = 0; + + // pos points to first dot in .. + // lhp points to start slash (/) of last segment + pos += sub.size() - 1; + path.replace(lhp, pos - lhp, "/"); + pos = lhp; + } + } + }// sub == ".." + } // path[pos] == '.' + pos++; + }// while + } + + bool CUrlParser::isAbsolute() const + { + return !scheme.empty() && !domain.empty(); + } + + // serialize URL back to string + std::string CUrlParser::toString() const + { + std::string result; + if (!scheme.empty()) + result += scheme + ":"; + + if (!domain.empty()) + { + result += domain; + } + + // path already has leading slash + if (!path.empty()) + result += path; + + if (!query.empty()) + result += "?" + query; + + if (!hash.empty()) + result += "#" + hash; + + return result; + } + +}// namespace + diff --git a/code/nel/src/gui/view_pointer.cpp b/code/nel/src/gui/view_pointer.cpp index 5777ea848..3816045b8 100644 --- a/code/nel/src/gui/view_pointer.cpp +++ b/code/nel/src/gui/view_pointer.cpp @@ -252,7 +252,7 @@ namespace NLGUI if (vLink->getMouseOverShape(tooltip, rot, col)) { - setString(ucstring(tooltip)); + setString(ucstring::makeFromUtf8(tooltip)); sint32 texId = rVR.getTextureIdFromName ("curs_pick.tga"); CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor; @@ -408,7 +408,7 @@ namespace NLGUI splitString(tooltipInfos, "@", tooltipInfosList); texName = tooltipInfosList[0]; tooltip = tooltipInfosList[1]; - setString(ucstring(tooltip)); + setString(ucstring::makeFromUtf8(tooltip)); CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 texId = rVR.getTextureIdFromName (texName); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.rc b/code/nel/tools/3d/plugin_max/nel_export/nel_export.rc index e42b888ea..6118893ec 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.rc +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // #include "resource.h" @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include +#include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -26,141 +26,109 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Dialog // -IDD_PANEL DIALOG DISCARDABLE 0, 0, 108, 251 -STYLE WS_CHILD | WS_VISIBLE +IDD_PANEL DIALOG 0, 0, 108, 251 +STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE FONT 8, "MS Sans Serif" BEGIN PUSHBUTTON "Export model",ID_SAVEMODEL,10,10,85,15 PUSHBUTTON "Export model animations",ID_SAVE_MODEL_ANIM,10,90,85,15 PUSHBUTTON "View the scene",ID_VIEW,10,152,85,15 - PUSHBUTTON "Export scene animations",ID_SAVE_SCENE_ANIM,10,110,85, - 15 + PUSHBUTTON "Export scene animations",ID_SAVE_SCENE_ANIM,10,110,85,15 PUSHBUTTON "Export skeleton weights",ID_SAVESWT,10,50,85,15 - PUSHBUTTON "Export Instance Group",ID_EXPORTINSTANCEGROUP,10,70,85, - 15 + PUSHBUTTON "Export Instance Group",ID_EXPORTINSTANCEGROUP,10,70,85,15 PUSHBUTTON "Export skeleton",ID_SAVESKELETON,10,30,85,15 PUSHBUTTON "Options",ID_OPTIONS,10,173,85,15 PUSHBUTTON "Node properties",ID_NODE_PROPERTIES,10,194,85,15 PUSHBUTTON "Export Collision",ID_SAVECOLLISION,10,131,85,15 CTEXT "Can't read the version",IDC_VERSION,15,234,75,10 - PUSHBUTTON "Test interface mesh",ID_TEST_INTERFACE_MESH,10,215,85, - 15 + PUSHBUTTON "Test interface mesh",ID_TEST_INTERFACE_MESH,10,215,85,15 END -IDD_SWT DIALOG DISCARDABLE 0, 0, 186, 63 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION +IDD_SWT DIALOG 0, 0, 186, 63 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "Choose the channel to export" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK",IDOK,129,7,50,14 PUSHBUTTON "Cancel",IDCANCEL,129,42,50,14 - CONTROL "All",IDC_ALLCHANNEL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,7,23,10 - CONTROL "Channel Position",IDC_CHANNELPOS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,23,69,10 - CONTROL "Channel Rotation",IDC_CHANNELROT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,34,71,10 - CONTROL "Channel Scale",IDC_CHANNELSCA,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,46,62,10 + CONTROL "All",IDC_ALLCHANNEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,23,10 + CONTROL "Channel Position",IDC_CHANNELPOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,23,69,10 + CONTROL "Channel Rotation",IDC_CHANNELROT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,71,10 + CONTROL "Channel Scale",IDC_CHANNELSCA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,46,62,10 END -IDD_EXPORTSCENE DIALOG DISCARDABLE 0, 0, 171, 255 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +IDD_EXPORTSCENE DIALOG 0, 0, 171, 255 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Options" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK",IDOK,115,173,50,14 PUSHBUTTON "Cancel",IDCANCEL,115,190,50,14 - CONTROL "Export Lighting",IDC_CHECKEXPORTLIGHTING,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,18,63,10 + CONTROL "Export Lighting",IDC_CHECKEXPORTLIGHTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,18,63,10 GROUPBOX "Light Method",IDC_STATIC,7,60,74,39,WS_GROUP - CONTROL "Raytrace",IDC_RADIONORMALEXPORTLIGHTING,"Button", - BS_AUTORADIOBUTTON,15,74,45,10 - CONTROL "Soft Shadow",IDC_RADIORADIOSITYEXPORTLIGHTING,"Button", - BS_AUTORADIOBUTTON,15,84,57,10 + CONTROL "Raytrace",IDC_RADIONORMALEXPORTLIGHTING,"Button",BS_AUTORADIOBUTTON,15,74,45,10 + CONTROL "Soft Shadow",IDC_RADIORADIOSITYEXPORTLIGHTING,"Button",BS_AUTORADIOBUTTON,15,84,57,10 EDITTEXT IDC_EDITEXPORTLIGHTING,7,42,137,14,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_BUTTONEXPORTLIGHTING,151,42,13,14 LTEXT "Lumel Size in meter",IDC_STATIC,90,63,62,8 EDITTEXT IDC_EDITLUMELSIZE,90,73,40,14,ES_AUTOHSCROLL GROUPBOX "OverSampling",IDC_STATIC,7,104,60,54,WS_GROUP - CONTROL "None",IDC_RADIOSS1,"Button",BS_AUTORADIOBUTTON,15,113, - 33,10 - CONTROL "4x",IDC_RADIOSS2,"Button",BS_AUTORADIOBUTTON,15,124,23, - 10 - CONTROL "16x",IDC_RADIOSS3,"Button",BS_AUTORADIOBUTTON,15,135,27, - 10 - CONTROL "64x",IDC_RADIOSS4,"Button",BS_AUTORADIOBUTTON,15,146,27, - 10 - CONTROL "Shadow",IDC_SHADOW,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,81,18,42,10 + CONTROL "None",IDC_RADIOSS1,"Button",BS_AUTORADIOBUTTON,15,113,33,10 + CONTROL "4x",IDC_RADIOSS2,"Button",BS_AUTORADIOBUTTON,15,124,23,10 + CONTROL "16x",IDC_RADIOSS3,"Button",BS_AUTORADIOBUTTON,15,135,27,10 + CONTROL "64x",IDC_RADIOSS4,"Button",BS_AUTORADIOBUTTON,15,146,27,10 + CONTROL "Shadow",IDC_SHADOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,81,18,42,10 CONTROL "Exclude non selected nodes from lighting",IDC_EXCLUDE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,145,10 - CONTROL "Show Lumel",IDC_SHOWLUMEL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,91,100,55,10 - CONTROL "Export bg color",IDC_EXPORT_BG_COLOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,91,115,63,10 - CONTROL "Test Surface Lighting",IDC_TEST_SURFACE_LIGHT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,173,84,10 + CONTROL "Show Lumel",IDC_SHOWLUMEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,100,55,10 + CONTROL "Export bg color",IDC_EXPORT_BG_COLOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,115,63,10 + CONTROL "Test Surface Lighting",IDC_TEST_SURFACE_LIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,173,84,10 EDITTEXT IDC_EDITCELLSIZE,15,198,65,15,ES_AUTOHSCROLL LTEXT "Surface CellSize (in meter)",IDC_STATIC,15,188,85,10 EDITTEXT IDC_EDITCELLDELTAZ,15,228,65,15,ES_AUTOHSCROLL LTEXT "Surface DeltaZ (in meter)",IDC_STATIC2,15,218,85,10 GROUPBOX "Surface Lighting",IDC_STATIC,7,163,98,85 - CONTROL "Output lightmap log",IDC_CHECKOUTPUTLIGHTMAPLOG,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,29,77,10 + CONTROL "Output lightmap log",IDC_CHECKOUTPUTLIGHTMAPLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,29,77,10 END -IDD_CALCULATING DIALOG DISCARDABLE 0, 0, 186, 181 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION +IDD_CALCULATING DIALOG 0, 0, 186, 181 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "Calculating..." FONT 8, "MS Sans Serif" BEGIN - CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER, - 7,41,172,14 - LTEXT "Please wait intializing...",IDC_STATICTIMELEFT,7,7,172, - 8 + CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER,7,41,172,14 + LTEXT "Please wait intializing...",IDC_STATICTIMELEFT,7,7,172,8 PUSHBUTTON "Interrupt",IDC_BUTTONCANCEL,129,23,50,14,BS_NOTIFY LTEXT "Object progression",IDC_STATIC,7,28,79,8 LTEXT "Lightmaps Information...",IDC_STATICINFO,7,60,172,114 END -IDD_LOD DIALOG DISCARDABLE 0, 0, 360, 200 -STYLE WS_CHILD +IDD_LOD DIALOG 0, 0, 360, 200 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN GROUPBOX "LOD Root Properties",IDC_STATIC,5,5,172,95 - LTEXT "List of lod mesh (ungrowing order):",IDC_STATIC,15,15, - 108,10,SS_CENTERIMAGE - LISTBOX IDC_LIST1,15,25,111,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | - WS_TABSTOP + LTEXT "List of lod mesh (ungrowing order):",IDC_STATIC,15,15,108,10,SS_CENTERIMAGE + LISTBOX IDC_LIST1,15,25,111,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Add..",IDC_ADD,131,25,40,14 PUSHBUTTON "Remove",IDC_REMOVE,131,39,40,14 PUSHBUTTON "Up",IDC_UP,131,54,40,14 PUSHBUTTON "Down",IDC_DOWN,131,68,40,14 GROUPBOX "LOD Properties",IDC_STATIC,5,105,172,50 - CONTROL "Blend in",IDC_BLEND_IN,"Button",BS_AUTO3STATE | - WS_TABSTOP,15,121,40,10 - CONTROL "Blend out",IDC_BLEND_OUT,"Button",BS_AUTO3STATE | - WS_TABSTOP,15,130,45,10 - CONTROL "Coarse mesh",IDC_COARSE_MESH,"Button",BS_AUTO3STATE | - WS_TABSTOP,15,140,55,10 - CONTROL "Dynamic mesh",IDC_DYNAMIC_MESH,"Button",BS_AUTO3STATE | - WS_TABSTOP,80,120,60,10 + CONTROL "Blend in",IDC_BLEND_IN,"Button",BS_AUTO3STATE | WS_TABSTOP,15,121,40,10 + CONTROL "Blend out",IDC_BLEND_OUT,"Button",BS_AUTO3STATE | WS_TABSTOP,15,130,45,10 + CONTROL "Coarse mesh",IDC_COARSE_MESH,"Button",BS_AUTO3STATE | WS_TABSTOP,15,140,55,10 + CONTROL "Dynamic mesh",IDC_DYNAMIC_MESH,"Button",BS_AUTO3STATE | WS_TABSTOP,80,120,60,10 LTEXT "Dist Max:",IDC_STATIC,5,160,45,13,SS_CENTERIMAGE EDITTEXT IDC_DIST_MAX,51,160,45,12,ES_AUTOHSCROLL | ES_NUMBER LTEXT "Blend length:",IDC_STATIC,80,135,45,13,SS_CENTERIMAGE - EDITTEXT IDC_BLEND_LENGTH,125,135,45,12,ES_AUTOHSCROLL | - ES_NUMBER + EDITTEXT IDC_BLEND_LENGTH,125,135,45,12,ES_AUTOHSCROLL | ES_NUMBER GROUPBOX "MRM properties",IDC_STATIC,185,5,172,95 - CONTROL "Active MRM",IDC_ACTIVE_MRM,"Button",BS_AUTO3STATE | - WS_TABSTOP,195,20,60,10 + CONTROL "Active MRM",IDC_ACTIVE_MRM,"Button",BS_AUTO3STATE | WS_TABSTOP,195,20,60,10 LTEXT "Skin reduction",IDC_STATIC,195,35,50,10,SS_CENTERIMAGE - CONTROL "Min",IDC_SKIN_REDUCTION_MIN,"Button",BS_AUTORADIOBUTTON, - 195,45,45,8 - CONTROL "Max",IDC_SKIN_REDUCTION_MAX,"Button",BS_AUTORADIOBUTTON, - 195,55,45,8 - CONTROL "Best",IDC_SKIN_REDUCTION_BEST,"Button", - BS_AUTORADIOBUTTON,195,65,45,8 + CONTROL "Min",IDC_SKIN_REDUCTION_MIN,"Button",BS_AUTORADIOBUTTON,195,45,45,8 + CONTROL "Max",IDC_SKIN_REDUCTION_MAX,"Button",BS_AUTORADIOBUTTON,195,55,45,8 + CONTROL "Best",IDC_SKIN_REDUCTION_BEST,"Button",BS_AUTORADIOBUTTON,195,65,45,8 LTEXT "Steps count:",IDC_STATIC,260,20,45,13,SS_CENTERIMAGE EDITTEXT IDC_NB_LOD,305,20,45,12,ES_AUTOHSCROLL | ES_NUMBER LTEXT "Divisor poly:",IDC_STATIC,260,35,45,13,SS_CENTERIMAGE @@ -170,128 +138,91 @@ BEGIN LTEXT "Dist middle:",IDC_STATIC,260,65,45,13,SS_CENTERIMAGE EDITTEXT IDC_DIST_MIDDLE,305,65,45,12,ES_AUTOHSCROLL | ES_NUMBER LTEXT "Dist coarsest:",IDC_STATIC,260,80,45,13,SS_CENTERIMAGE - EDITTEXT IDC_DIST_COARSEST,305,80,45,12,ES_AUTOHSCROLL | - ES_NUMBER + EDITTEXT IDC_DIST_COARSEST,305,80,45,12,ES_AUTOHSCROLL | ES_NUMBER GROUPBOX "LOD Bones",IDC_STATIC,185,105,170,45 - LTEXT "Disable Distance (0 means always activated) :", - IDC_STATIC,190,120,160,10 - EDITTEXT IDC_BONE_LOD_DISTANCE,190,130,45,12,ES_AUTOHSCROLL | - ES_NUMBER - CONTROL "Export as Lod character (.clod)",IDC_EXPORT_CLOD,"Button", - BS_AUTO3STATE | WS_TABSTOP,190,160,150,10 + LTEXT "Disable Distance (0 means always activated) :",IDC_STATIC,190,120,160,10 + EDITTEXT IDC_BONE_LOD_DISTANCE,190,130,45,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Export as Lod character (.clod)",IDC_EXPORT_CLOD,"Button",BS_AUTO3STATE | WS_TABSTOP,190,160,150,10 END -IDD_ACCEL DIALOG DISCARDABLE 0, 0, 360, 200 -STYLE WS_CHILD +IDD_ACCEL DIALOG 0, 0, 360, 200 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - CONTROL "Not an accelerator",IDC_RADIOACCELNO,"Button", - BS_AUTORADIOBUTTON,5,5,75,10 - CONTROL "Portal",IDC_RADIOACCELPORTAL,"Button", - BS_AUTORADIOBUTTON,5,21,34,10 - CONTROL "Cluster",IDC_RADIOACCELCLUSTER,"Button", - BS_AUTORADIOBUTTON,5,70,37,10 - CONTROL "Father visible",IDC_FATHER_VISIBLE,"Button", - BS_AUTO3STATE | WS_TABSTOP,27,81,57,10 - CONTROL "Visible from father",IDC_VISIBLE_FROM_FATHER,"Button", - BS_AUTO3STATE | WS_TABSTOP,27,92,71,10 - CONTROL "Dynamic Portal",IDC_DYNAMIC_PORTAL,"Button", - BS_AUTO3STATE | WS_TABSTOP,27,44,63,10 - CONTROL "Clusterize",IDC_CLUSTERIZE,"Button",BS_AUTO3STATE | - WS_TABSTOP,93,5,46,10 - COMBOBOX IDC_OCC_MODEL,209,30,123,134,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP + CONTROL "Not an accelerator",IDC_RADIOACCELNO,"Button",BS_AUTORADIOBUTTON,5,5,75,10 + CONTROL "Portal",IDC_RADIOACCELPORTAL,"Button",BS_AUTORADIOBUTTON,5,21,34,10 + CONTROL "Cluster",IDC_RADIOACCELCLUSTER,"Button",BS_AUTORADIOBUTTON,5,70,37,10 + CONTROL "Father visible",IDC_FATHER_VISIBLE,"Button",BS_AUTO3STATE | WS_TABSTOP,27,81,57,10 + CONTROL "Visible from father",IDC_VISIBLE_FROM_FATHER,"Button",BS_AUTO3STATE | WS_TABSTOP,27,92,71,10 + CONTROL "Dynamic Portal",IDC_DYNAMIC_PORTAL,"Button",BS_AUTO3STATE | WS_TABSTOP,27,44,63,10 + CONTROL "Clusterize",IDC_CLUSTERIZE,"Button",BS_AUTO3STATE | WS_TABSTOP,93,5,46,10 + COMBOBOX IDC_OCC_MODEL,209,30,123,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Occlusion model",IDC_STATIC,134,30,68,12,SS_CENTERIMAGE - COMBOBOX IDC_OPEN_OCC_MODEL,209,44,123,116,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - RTEXT "Open portal occlusion model",IDC_STATIC,112,44,89,10, - SS_CENTERIMAGE + COMBOBOX IDC_OPEN_OCC_MODEL,209,44,123,116,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "Open portal occlusion model",IDC_STATIC,112,44,89,10,SS_CENTERIMAGE GROUPBOX "Audio properties",IDC_STATIC,105,19,237,141 RTEXT "Sound group",IDC_STATIC,111,86,90,14 - COMBOBOX IDC_ENV_FX,209,106,123,87,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP + COMBOBOX IDC_ENV_FX,209,106,123,87,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Environment FX",IDC_STATIC,112,106,89,10,SS_CENTERIMAGE - COMBOBOX IDC_SOUND_GROUP,209,86,123,101,CBS_DROPDOWN | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - CONTROL "Father audible",IDC_FATHER_AUDIBLE,"Button", - BS_AUTO3STATE | WS_TABSTOP,210,135,61,10 - CONTROL "Audible from father",IDC_AUDIBLE_FROM_FATHER,"Button", - BS_AUTO3STATE | WS_TABSTOP,210,145,81,10 - CONTROL "Audible like visible",IDC_AUDIBLE_LIKE_VISIBLE,"Button", - BS_AUTO3STATE | WS_TABSTOP,210,125,73,10 + COMBOBOX IDC_SOUND_GROUP,209,86,123,101,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Father audible",IDC_FATHER_AUDIBLE,"Button",BS_AUTO3STATE | WS_TABSTOP,210,135,61,10 + CONTROL "Audible from father",IDC_AUDIBLE_FROM_FATHER,"Button",BS_AUTO3STATE | WS_TABSTOP,210,145,81,10 + CONTROL "Audible like visible",IDC_AUDIBLE_LIKE_VISIBLE,"Button",BS_AUTO3STATE | WS_TABSTOP,210,125,73,10 END -IDD_LIGHTMAP DIALOG DISCARDABLE 0, 0, 360, 211 -STYLE WS_CHILD -FONT 8, "MS Sans Serif" +IDD_LIGHTMAP DIALOGEX 0, 0, 360, 211 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - GROUPBOX "Properties for objects with lightmaps",IDC_STATIC,5,5, - 150,70 - LTEXT "Lumel Size Multiplier",IDC_STATIC,10,15,64,13, - SS_CENTERIMAGE + GROUPBOX "Properties for objects with lightmaps",IDC_STATIC,5,5,150,70 + LTEXT "Lumel Size Multiplier",IDC_STATIC,10,15,64,13,SS_CENTERIMAGE EDITTEXT IDC_EDIT_LUMELSIZEMUL,96,15,40,14,ES_AUTOHSCROLL - LTEXT "Soft Shadow Radius",IDC_STATIC,10,35,66,13, - SS_CENTERIMAGE + LTEXT "Soft Shadow Radius",IDC_STATIC,10,35,66,13,SS_CENTERIMAGE EDITTEXT IDC_EDIT_SOFTSHADOW_RADIUS,96,35,40,14,ES_AUTOHSCROLL - LTEXT "Soft Shadow Cone Length",IDC_STATIC,10,55,84,13, - SS_CENTERIMAGE - EDITTEXT IDC_EDIT_SOFTSHADOW_CONELENGTH,96,55,40,14, - ES_AUTOHSCROLL - GROUPBOX "Properties for objects without lightmaps",IDC_STATIC,5, - 80,150,60 - CONTROL "If checked, use per vertex lighting attenuation else use global lighting attenuation for the object. Doesn't work with per pixel lighting shader.", - IDC_USE_LIGHT_LOCAL_ATTENUATION,"Button",BS_AUTO3STATE | - BS_TOP | BS_MULTILINE | WS_TABSTOP,15,95,120,41 + LTEXT "Soft Shadow Cone Length",IDC_STATIC,10,55,84,13,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_SOFTSHADOW_CONELENGTH,96,55,40,14,ES_AUTOHSCROLL + GROUPBOX "Properties for objects without lightmaps",IDC_STATIC,5,80,150,60 + CONTROL "If checked, use per vertex lighting attenuation else use global lighting attenuation for the object. Doesn't work with per pixel lighting shader.",IDC_USE_LIGHT_LOCAL_ATTENUATION, + "Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,18,96,120,41 GROUPBOX "Properties for lights",IDC_STATIC,160,5,185,200 - CONTROL "RealTime Light. If set, this light will light scene objects.", - IDC_EXPORT_REALTIME_LIGHT,"Button",BS_AUTO3STATE | - BS_TOP | BS_MULTILINE | WS_TABSTOP,170,15,165,20 - CONTROL "RealTime Sun Light. If set, this DIRECTIONNAL light will be used as sun light to light scene objects.", - IDC_EXPORT_AS_SUN_LIGHT,"Button",BS_AUTO3STATE | BS_TOP | - BS_MULTILINE | WS_TABSTOP,170,34,170,25 - CONTROL "LightMap Light. If set, this light will be used to compute the lightmaps of the project objects.", - IDC_EXPORT_LIGHTMAP_LIGHT,"Button",BS_AUTO3STATE | - BS_TOP | BS_MULTILINE | WS_TABSTOP,170,60,170,20 - LTEXT "LightMap Animation Name. This is the name of the animation used to flick the light color.", - IDC_STATIC,170,135,170,20 - EDITTEXT IDC_EXPORT_LIGHTMAP_NAME,170,155,85,15,ES_AUTOHSCROLL + CONTROL "RealTime Light. If set, this light will light scene objects.",IDC_EXPORT_REALTIME_LIGHT, + "Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,174,18,168,18 + CONTROL "RealTime Sun Light. If set, this DIRECTIONNAL light will be used as sun light to light scene objects.",IDC_EXPORT_AS_SUN_LIGHT, + "Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,174,36,168,24 + CONTROL "LightMap Light. If set, this light will be used to compute the lightmaps of the project objects.",IDC_EXPORT_LIGHTMAP_LIGHT, + "Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,174,60,168,18 + LTEXT "LightMap Animation Name. This is the name of the animation used to flick the light color.",IDC_STATIC,174,138,170,20 + EDITTEXT IDC_EXPORT_LIGHTMAP_NAME,174,156,85,15,ES_AUTOHSCROLL CONTROL "Animated Dynamic Light",IDC_EXPORT_LIGHTMAP_ANIMATED, - "Button",BS_AUTO3STATE | WS_TABSTOP,170,175,125,10 - CONTROL "Always group",IDC_LIGHT_GROUP_ALWAYS,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,170,80,150,15 - CONTROL "Sun group",IDC_LIGHT_GROUP_DAY,"Button", - BS_AUTORADIOBUTTON,170,95,150,15 - CONTROL "Night group",IDC_LIGHT_GROUP_NIGHT,"Button", - BS_AUTORADIOBUTTON,170,110,150,15 + "Button",BS_AUTO3STATE | WS_TABSTOP,174,177,125,10 + CONTROL "Always on lightgroup (0)",IDC_LIGHT_GROUP_ALWAYS,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,174,90,156,12 + CONTROL "Day cycle (3)",IDC_LIGHT_GROUP_DAY_CYCLE,"Button",BS_AUTORADIOBUTTON,174,102,66,12 + CONTROL "Night cycle (2)",IDC_LIGHT_GROUP_NIGHT_CYCLE,"Button",BS_AUTORADIOBUTTON,174,114,66,12 GROUPBOX "Misc",IDC_STATIC,5,145,150,60 - CONTROL "Don't cast shadow for Interior. Known as Trick of the ""Matis serre""", - IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR,"Button", - BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,15, - 155,135,20 - CONTROL "Don't cast shadow for Exterior. Known as Trick of the ""Matis serre""", - IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR,"Button", - BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,15, - 175,135,20 - CONTROL "Add Realtime Ambient Light With sun Ambient", - IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,170,190,160,10 + CONTROL "Don't cast shadow for Interior. Known as Trick of the ""Matis serre""",IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR, + "Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,15,155,135,20 + CONTROL "Don't cast shadow for Exterior. Known as Trick of the ""Matis serre""",IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR, + "Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,15,175,135,20 + CONTROL "Add Realtime Ambient Light With sun Ambient",IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,192,160,10 + CONTROL "Landscape Diffuse (Sun) (1)",IDC_LIGHT_GROUP_LANDSCAPE_DIFFUSE, + "Button",BS_AUTORADIOBUTTON,240,102,102,12 + CONTROL "Landscape Ambient (4)",IDC_LIGHT_GROUP_LANDSCAPE_AMBIENT, + "Button",BS_AUTORADIOBUTTON,240,114,102,12 END -IDD_MISC DIALOG DISCARDABLE 0, 0, 360, 221 -STYLE WS_CHILD +IDD_MISC DIALOG 0, 0, 360, 221 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - CONTROL "Floating Object",IDC_FLOATING_OBJECT,"Button", - BS_AUTO3STATE | WS_TABSTOP,5,5,65,12 + CONTROL "Floating Object",IDC_FLOATING_OBJECT,"Button",BS_AUTO3STATE | WS_TABSTOP,5,5,65,12 GROUPBOX "Ligoscape",IDC_STATIC,5,100,120,45 - CONTROL "Symmetry",IDC_LIGO_SYMMETRY,"Button",BS_AUTO3STATE | - WS_TABSTOP,11,110,44,12 + CONTROL "Symmetry",IDC_LIGO_SYMMETRY,"Button",BS_AUTO3STATE | WS_TABSTOP,11,110,44,12 LTEXT "Rotation:",IDC_STATIC,11,125,30,13,SS_CENTERIMAGE EDITTEXT IDC_LIGO_ROTATE,60,126,57,14,ES_AUTOHSCROLL LTEXT "Weight (0~1):",IDC_STATIC,10,75,43,13,SS_CENTERIMAGE EDITTEXT IDC_SWT_WEIGHT,60,75,60,14,ES_AUTOHSCROLL - CONTROL "Enable",IDC_SWT,"Button",BS_AUTO3STATE | WS_TABSTOP,10, - 60,40,10 + CONTROL "Enable",IDC_SWT,"Button",BS_AUTO3STATE | WS_TABSTOP,10,60,40,10 GROUPBOX "Skeleton template weight",IDC_STATIC,5,50,120,45 GROUPBOX "Radial Normals",IDC_STATIC,135,5,130,105 LTEXT "Smooth group 29",IDC_STATIC,140,45,55,13,SS_CENTERIMAGE @@ -302,144 +233,104 @@ BEGIN EDITTEXT IDC_RADIAL_NORMAL_31,200,75,57,14,ES_AUTOHSCROLL LTEXT "Smooth group 32",IDC_STATIC,140,90,55,13,SS_CENTERIMAGE EDITTEXT IDC_RADIAL_NORMAL_32,200,90,57,14,ES_AUTOHSCROLL - LTEXT "For the 4 last smoothing group, choose the node you want to use the position to compute radial normals from it.", - IDC_STATIC,140,15,120,25 + LTEXT "For the 4 last smoothing group, choose the node you want to use the position to compute radial normals from it.",IDC_STATIC,140,15,120,25 GROUPBOX "Mesh interfaces",IDC_STATIC,134,110,219,56 - LTEXT "Interface .max file",IDC_STATIC,141,120,61,15, - SS_CENTERIMAGE + LTEXT "Interface .max file",IDC_STATIC,141,120,61,15,SS_CENTERIMAGE EDITTEXT IDC_EDIT_INTERFACE_FILE,221,120,110,14,ES_AUTOHSCROLL - LTEXT "Interface weld threshold",IDC_STATIC,141,137,77,15, - SS_CENTERIMAGE - EDITTEXT IDC_EDIT_INTERFACE_THRESHOLD,221,137,110,14, - ES_AUTOHSCROLL + LTEXT "Interface weld threshold",IDC_STATIC,141,137,77,15,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_INTERFACE_THRESHOLD,221,137,110,14,ES_AUTOHSCROLL GROUPBOX "Bone Scale",IDC_STATIC,5,150,120,60 - CONTROL "Enable",IDC_EXPORT_BONE_SCALE,"Button",BS_AUTO3STATE | - WS_TABSTOP,10,160,38,10 - LTEXT "Bone Reference Name extension:",IDC_STATIC,10,175,110, - 13,SS_CENTERIMAGE - EDITTEXT IDC_EXPORT_BONE_SCALE_NAME_EXT,10,190,75,14, - ES_AUTOHSCROLL - CONTROL "Get interface normals from scene objects", - IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,142,151,145,15 + CONTROL "Enable",IDC_EXPORT_BONE_SCALE,"Button",BS_AUTO3STATE | WS_TABSTOP,10,160,38,10 + LTEXT "Bone Reference Name extension:",IDC_STATIC,10,175,110,13,SS_CENTERIMAGE + EDITTEXT IDC_EXPORT_BONE_SCALE_NAME_EXT,10,190,75,14,ES_AUTOHSCROLL + CONTROL "Get interface normals from scene objects",IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,142,151,145,15 GROUPBOX "Remanence",IDC_STATIC,134,169,219,45 - CONTROL "Use remanence",IDC_USE_REMANENCE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,137,178,66,9 + CONTROL "Use remanence",IDC_USE_REMANENCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,137,178,66,9 LTEXT "Slice number :",IDC_STATIC,138,191,47,10,SS_CENTERIMAGE EDITTEXT IDC_REMANENCE_SLICE_NUMBER,186,189,19,14,ES_AUTOHSCROLL - LTEXT "Sampling period :",IDC_STATIC,210,192,54,10, - SS_CENTERIMAGE - EDITTEXT IDC_REMANENCE_SAMPLING_PERIOD,266,190,20,14, - ES_AUTOHSCROLL - CONTROL "Shift texture at start of animation", - IDC_REMANENCE_SHIFTING_TEXTURE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,207,178,116,9 + LTEXT "Sampling period :",IDC_STATIC,210,192,54,10,SS_CENTERIMAGE + EDITTEXT IDC_REMANENCE_SAMPLING_PERIOD,266,190,20,14,ES_AUTOHSCROLL + CONTROL "Shift texture at start of animation",IDC_REMANENCE_SHIFTING_TEXTURE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,178,116,9 LTEXT "Rollup ratio :",IDC_ROLLUP_RATIO,290,192,41,8 EDITTEXT IDC_REMANENCE_ROLLUP_RATIO,332,190,16,14,ES_AUTOHSCROLL END -IDD_VEGETABLE DIALOG DISCARDABLE 0, 0, 360, 200 -STYLE WS_CHILD +IDD_VEGETABLE DIALOG 0, 0, 360, 200 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - CONTROL "Vegetable",IDC_VEGETABLE,"Button",BS_AUTO3STATE | - WS_TABSTOP,5,5,50,12 - CONTROL "Alpha Blend ON (double sided)", - IDC_VEGETABLE_ALPHA_BLEND_ON,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,21,30,112,15 - CONTROL "Alpha Blend OFF",IDC_VEGETABLE_ALPHA_BLEND_OFF,"Button", - BS_AUTORADIOBUTTON,20,74,85,15 - CONTROL "Lighted - precomputed", - IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,50,45,85,15 - CONTROL "Unlighted",IDC_VEGETABLE_AB_ON_UNLIGHTED,"Button", - BS_AUTORADIOBUTTON,50,61,90,15 - CONTROL "Lighted - precomputed", - IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,50,90,85,15 + CONTROL "Vegetable",IDC_VEGETABLE,"Button",BS_AUTO3STATE | WS_TABSTOP,5,5,50,12 + CONTROL "Alpha Blend ON (double sided)",IDC_VEGETABLE_ALPHA_BLEND_ON, + "Button",BS_AUTORADIOBUTTON | WS_GROUP,21,30,112,15 + CONTROL "Alpha Blend OFF",IDC_VEGETABLE_ALPHA_BLEND_OFF,"Button",BS_AUTORADIOBUTTON,20,74,85,15 + CONTROL "Lighted - precomputed",IDC_VEGETABLE_AB_ON_LIGHTED_PRECOMPUTED, + "Button",BS_AUTORADIOBUTTON | WS_GROUP,50,45,85,15 + CONTROL "Unlighted",IDC_VEGETABLE_AB_ON_UNLIGHTED,"Button",BS_AUTORADIOBUTTON,50,61,90,15 + CONTROL "Lighted - precomputed",IDC_VEGETABLE_AB_OFF_LIGHTED_PRECOMPUTED, + "Button",BS_AUTORADIOBUTTON | WS_GROUP,50,90,85,15 CONTROL "Lighted - dynamic",IDC_VEGETABLE_AB_OFF_LIGHTED_DYNAMIC, "Button",BS_AUTORADIOBUTTON,50,105,90,15 - CONTROL "Unighted",IDC_VEGETABLE_AB_OFF_UNLIGHTED,"Button", - BS_AUTORADIOBUTTON,50,120,85,15 - CONTROL "Double sided",IDC_VEGETABLE_AB_OFF_DOUBLE_SIDED,"Button", - BS_AUTO3STATE | WS_TABSTOP,50,135,85,15 + CONTROL "Unighted",IDC_VEGETABLE_AB_OFF_UNLIGHTED,"Button",BS_AUTORADIOBUTTON,50,120,85,15 + CONTROL "Double sided",IDC_VEGETABLE_AB_OFF_DOUBLE_SIDED,"Button",BS_AUTO3STATE | WS_TABSTOP,50,135,85,15 GROUPBOX "Alpha mode",IDC_STATIC,15,20,135,155 GROUPBOX "Bend center",IDC_STATIC,160,20,105,45 - CONTROL "Center Null",IDC_CENTER_NULL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,166,30,50,15 - CONTROL "Center Z",IDC_CENTER_Z,"Button",BS_AUTORADIOBUTTON,166, - 45,50,15 + CONTROL "Center Null",IDC_CENTER_NULL,"Button",BS_AUTORADIOBUTTON | WS_GROUP,166,30,50,15 + CONTROL "Center Z",IDC_CENTER_Z,"Button",BS_AUTORADIOBUTTON,166,45,50,15 LTEXT "Bend Factor (0 - 1)",IDC_STATIC,160,75,60,8 EDITTEXT IDC_VEGETABLE_BEND_FACTOR,226,70,40,14,ES_AUTOHSCROLL - CONTROL "Force Best Sided Lighting", - IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING,"Button", - BS_AUTO3STATE | WS_TABSTOP,20,155,120,15 + CONTROL "Force Best Sided Lighting",IDC_VEGETABLE_FORCE_BEST_SIDED_LIGHTING, + "Button",BS_AUTO3STATE | WS_TABSTOP,20,155,120,15 END -IDD_INSTANCE DIALOG DISCARDABLE 0, 0, 360, 226 -STYLE WS_CHILD +IDD_INSTANCE DIALOG 0, 0, 360, 226 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN LTEXT "Instance shape",IDC_STATIC,5,5,51,15,SS_CENTERIMAGE EDITTEXT IDC_EDIT_INSTANCE_GROUP_SHAPE,80,5,110,14,ES_AUTOHSCROLL - LTEXT "Name of the instancied object. (ex: ""table.shape"").", - IDC_STATIC,195,5,160,8,SS_CENTERIMAGE + LTEXT "Name of the instancied object. (ex: ""table.shape"").",IDC_STATIC,195,5,160,8,SS_CENTERIMAGE LTEXT "Instance name",IDC_STATIC,5,25,49,15,SS_CENTERIMAGE EDITTEXT IDC_EDIT_INSTANCE_NAME,80,25,110,14,ES_AUTOHSCROLL - LTEXT "String associed with the instance in the instance group file. Enter ... to erase all.", - IDC_STATIC,195,26,160,16 - LTEXT "Instance group name",IDC_STATIC,5,45,70,15, - SS_CENTERIMAGE + LTEXT "String associed with the instance in the instance group file. Enter ... to erase all.",IDC_STATIC,195,26,160,16 + LTEXT "Instance group name",IDC_STATIC,5,45,70,15,SS_CENTERIMAGE EDITTEXT IDC_EDIT_INSTANCE_GROUP_NAME,80,45,110,14,ES_AUTOHSCROLL - LTEXT "Name of the instance group where this instance will be inserted. Enter ... to erase all", - IDC_STATIC,195,45,160,15 - CONTROL "Don't add to scene. If checked, this instance will not be added in the scene.", - IDC_DONT_ADD_TO_SCENE,"Button",BS_AUTO3STATE | - WS_TABSTOP,5,71,255,10 - CONTROL "Don't export the shape. If checked, no shape file will be exported from this object.", - IDC_DONT_EXPORT,"Button",BS_AUTO3STATE | WS_TABSTOP,5,86, - 271,10 + LTEXT "Name of the instance group where this instance will be inserted. Enter ... to erase all",IDC_STATIC,195,45,160,15 + CONTROL "Don't add to scene. If checked, this instance will not be added in the scene.",IDC_DONT_ADD_TO_SCENE, + "Button",BS_AUTO3STATE | WS_TABSTOP,5,71,255,10 + CONTROL "Don't export the shape. If checked, no shape file will be exported from this object.",IDC_DONT_EXPORT, + "Button",BS_AUTO3STATE | WS_TABSTOP,5,86,271,10 GROUPBOX "Collision",IDC_STATIC,5,180,170,40 - CONTROL "Collision Mesh",IDC_CHECK_COLLISION,"Button", - BS_AUTO3STATE | WS_TABSTOP,15,191,110,10 + CONTROL "Collision Mesh",IDC_CHECK_COLLISION,"Button",BS_AUTO3STATE | WS_TABSTOP,15,191,110,10 CONTROL "Collision Mesh Exterior",IDC_CHECK_COLLISION_EXTERIOR, "Button",BS_AUTO3STATE | WS_TABSTOP,15,204,110,10 LTEXT "Enter ... to erase all.",IDC_STATIC,195,15,108,10 GROUPBOX "Camera Collision",IDC_STATIC,5,105,270,70 - CONTROL "Automatic (collision only if mesh is lightmapped)", - IDC_CAMERA_COL_RADIO1,"Button",BS_AUTORADIOBUTTON,15,115, - 230,10 - CONTROL "Disable (don't collision with camera)", - IDC_CAMERA_COL_RADIO2,"Button",BS_AUTORADIOBUTTON,15,130, - 230,10 - CONTROL "Forced (collision with camera, even if not lightmapped)", - IDC_CAMERA_COL_RADIO3,"Button",BS_AUTORADIOBUTTON,15,145, - 230,10 - CONTROL "Camera collision only (mesh not displayed)", - IDC_CAMERA_COL_RADIO4,"Button",BS_AUTORADIOBUTTON,15,160, - 230,10 + CONTROL "Automatic (collision only if mesh is lightmapped)",IDC_CAMERA_COL_RADIO1, + "Button",BS_AUTORADIOBUTTON,15,115,230,10 + CONTROL "Disable (don't collision with camera)",IDC_CAMERA_COL_RADIO2, + "Button",BS_AUTORADIOBUTTON,15,130,230,10 + CONTROL "Forced (collision with camera, even if not lightmapped)",IDC_CAMERA_COL_RADIO3, + "Button",BS_AUTORADIOBUTTON,15,145,230,10 + CONTROL "Camera collision only (mesh not displayed)",IDC_CAMERA_COL_RADIO4, + "Button",BS_AUTORADIOBUTTON,15,160,230,10 END -IDD_ANIM DIALOG DISCARDABLE 0, 0, 360, 221 -STYLE WS_CHILD +IDD_ANIM DIALOG 0, 0, 360, 221 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - CONTROL "Export note track",IDC_EXPORT_NOTE_TRACK,"Button", - BS_AUTO3STATE | WS_TABSTOP,5,50,75,10 - CONTROL "Export animated materials", - IDC_EXPORT_ANIMATED_MATERIALS,"Button",BS_AUTO3STATE | - WS_TABSTOP,5,35,98,10 - CONTROL "Export node animation",IDC_EXPORT_NODE_ANIMATION,"Button", - BS_AUTO3STATE | WS_TABSTOP,5,5,98,10 - CONTROL "Prefixe tracks with node name (Instance name or, if emtpy, node name)", - IDC_EXPORT_ANIMATION_PREFIXE_NAME,"Button",BS_AUTO3STATE | - BS_MULTILINE | WS_TABSTOP,5,20,245,10 - CONTROL "Allow automatic animation. If the shape is ""obj.shape"", then it will bind ""obj.anim"" automatically.", - IDC_AUTOMATIC_ANIM,"Button",BS_AUTO3STATE | BS_MULTILINE | - WS_TABSTOP,5,65,315,10 - CONTROL "Export SSS track (Skeleton Spawn Script)", - IDC_EXPORT_SSS_TRACK,"Button",BS_AUTO3STATE | WS_TABSTOP, - 5,80,310,10 + CONTROL "Export note track",IDC_EXPORT_NOTE_TRACK,"Button",BS_AUTO3STATE | WS_TABSTOP,5,50,75,10 + CONTROL "Export animated materials",IDC_EXPORT_ANIMATED_MATERIALS, + "Button",BS_AUTO3STATE | WS_TABSTOP,5,35,98,10 + CONTROL "Export node animation",IDC_EXPORT_NODE_ANIMATION,"Button",BS_AUTO3STATE | WS_TABSTOP,5,5,98,10 + CONTROL "Prefixe tracks with node name (Instance name or, if emtpy, node name)",IDC_EXPORT_ANIMATION_PREFIXE_NAME, + "Button",BS_AUTO3STATE | BS_MULTILINE | WS_TABSTOP,5,20,245,10 + CONTROL "Allow automatic animation. If the shape is ""obj.shape"", then it will bind ""obj.anim"" automatically.",IDC_AUTOMATIC_ANIM, + "Button",BS_AUTO3STATE | BS_MULTILINE | WS_TABSTOP,5,65,315,10 + CONTROL "Export SSS track (Skeleton Spawn Script)",IDC_EXPORT_SSS_TRACK, + "Button",BS_AUTO3STATE | WS_TABSTOP,5,80,310,10 END @@ -449,7 +340,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE +GUIDELINES DESIGNINFO BEGIN IDD_PANEL, DIALOG BEGIN @@ -548,18 +439,18 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE DISCARDABLE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE DISCARDABLE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE DISCARDABLE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -568,7 +459,6 @@ END #endif // APSTUDIO_INVOKED -#ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version @@ -591,17 +481,13 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0" - VALUE "CompanyName", "Ryzom Core\0" + VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample" + VALUE "CompanyName", "Ryzom Core" VALUE "FileVersion", "0.12.0\0" - VALUE "InternalName", "CNelExport\0" - VALUE "LegalCopyright", "\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "CNelExport.dlu\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Ryzom Core\0" + VALUE "InternalName", "CNelExport" + VALUE "OriginalFilename", "CNelExport.dlu" + VALUE "ProductName", "Ryzom Core" VALUE "ProductVersion", "0.12.0\0" - VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" @@ -610,15 +496,13 @@ BEGIN END END -#endif // !_MAC - ///////////////////////////////////////////////////////////////////////////// // // String Table // -STRINGTABLE DISCARDABLE +STRINGTABLE BEGIN IDS_LIBDESCRIPTION "Geometry Export/View" IDS_CATEGORY "Nel Tools" @@ -645,8 +529,8 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH // Dialog // -IDD_NODE_PROPERTIES_PANEL DIALOG DISCARDABLE 0, 0, 384, 290 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_NODE_PROPERTIES_PANEL DIALOG 0, 0, 384, 290 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Node properties" FONT 8, "MS Sans Serif" BEGIN @@ -655,76 +539,57 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,327,267,50,15 END -IDD_VERTEX_PROGRAM DIALOG DISCARDABLE 0, 0, 361, 211 -STYLE WS_CHILD +IDD_VERTEX_PROGRAM DIALOG 0, 0, 361, 211 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN LTEXT "VertexProgram :",IDC_VP_TEXT,5,5,70,10 COMBOBOX IDC_COMBO_VP,80,0,105,55,CBS_DROPDOWNLIST | WS_TABSTOP - LTEXT "Can't use vp (needed by material shader)",IDC_BYPASS_VP, - 196,3,132,9 + LTEXT "Can't use vp (needed by material shader)",IDC_BYPASS_VP,196,3,132,9 END -IDD_VP_WINDTREE DIALOG DISCARDABLE 0, 0, 356, 191 -STYLE WS_CHILD +IDD_VP_WINDTREE DIALOG 0, 0, 356, 191 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - CONTROL "Use VP SpecularLighting",IDC_CHECK_VP_SPECLIGHT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,5,105,10 + CONTROL "Use VP SpecularLighting",IDC_CHECK_VP_SPECLIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,5,105,10 LTEXT "Frequency Scale :",IDC_STATIC,120,5,60,10 LTEXT "Distance Scale :",IDC_STATIC,245,5,60,10 - EDITTEXT IDC_EDIT_VPWT_FREQ_SCALE,190,5,35,12,ES_MULTILINE | - ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN - EDITTEXT IDC_EDIT_VPWT_DIST_SCALE,305,5,35,12,ES_MULTILINE | - ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN + EDITTEXT IDC_EDIT_VPWT_FREQ_SCALE,190,5,35,12,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN + EDITTEXT IDC_EDIT_VPWT_DIST_SCALE,305,5,35,12,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN GROUPBOX "Level 0 (eg: Tree Trunk)",IDC_STATIC,0,20,355,50 GROUPBOX "Level 1 (eg: branch)",IDC_STATIC,0,75,355,55 GROUPBOX "Level 2 (eg: leaves)",IDC_STATIC,0,135,355,55 LTEXT "Frequency :",IDC_STATIC,5,31,50,10 LTEXT "DistanceXY :",IDC_STATIC,5,41,50,10 LTEXT "Distance Bias :",IDC_STATIC,5,51,50,10 - CONTROL "Slider1",IDC_SLIDER_VPWT_FREQ_L0,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,30,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_DISTXY_L0,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,41,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_FREQ_L0,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,30,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_DISTXY_L0,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,41,100,11 LTEXT "FreqWindDep :",IDC_STATIC,180,31,50,10 LTEXT "DistanceZ :",IDC_STATIC,180,40,50,10 - CONTROL "Slider1",IDC_SLIDER_VPWT_FREQWD_L0,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,30,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_DISTZ_L0,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,40,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_BIAS_L0,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,51,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_FREQWD_L0,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,30,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_DISTZ_L0,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,40,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_BIAS_L0,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,51,100,11 LTEXT "Frequency :",IDC_STATIC,5,90,50,10 LTEXT "DistanceXY :",IDC_STATIC,5,101,50,10 LTEXT "Distance Bias :",IDC_STATIC,5,112,50,10 - CONTROL "Slider1",IDC_SLIDER_VPWT_FREQ_L1,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,91,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_DISTXY_L1,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,101,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_FREQ_L1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,91,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_DISTXY_L1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,101,100,11 LTEXT "FreqWindDep :",IDC_STATIC,180,92,50,10 LTEXT "DistanceZ :",IDC_STATIC,180,100,50,10 - CONTROL "Slider1",IDC_SLIDER_VPWT_FREQWD_L1,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,90,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_DISTZ_L1,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,100,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_BIAS_L1,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,112,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_FREQWD_L1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,90,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_DISTZ_L1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,100,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_BIAS_L1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,112,100,11 LTEXT "Frequency :",IDC_STATIC,5,150,50,10 LTEXT "DistanceXY :",IDC_STATIC,5,160,50,10 LTEXT "Distance Bias :",IDC_STATIC,5,170,50,10 - CONTROL "Slider1",IDC_SLIDER_VPWT_FREQ_L2,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,150,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_DISTXY_L2,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,160,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_FREQ_L2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,150,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_DISTXY_L2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,160,100,11 LTEXT "FreqWindDep :",IDC_STATIC,180,153,50,10 LTEXT "DistanceZ :",IDC_STATIC,180,162,50,10 - CONTROL "Slider1",IDC_SLIDER_VPWT_FREQWD_L2,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,151,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_DISTZ_L2,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,162,100,11 - CONTROL "Slider1",IDC_SLIDER_VPWT_BIAS_L2,"msctls_trackbar32", - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,170,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_FREQWD_L2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,151,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_DISTZ_L2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,230,162,100,11 + CONTROL "Slider1",IDC_SLIDER_VPWT_BIAS_L2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,55,170,100,11 LTEXT "-0.12",IDC_STATIC_VPWT_FREQ_L0,155,31,20,10,SS_SUNKEN LTEXT "0.12",IDC_STATIC_VPWT_DISTXY_L0,155,41,20,10,SS_SUNKEN LTEXT "0.12",IDC_STATIC_VPWT_BIAS_L0,155,51,20,10,SS_SUNKEN @@ -748,8 +613,8 @@ BEGIN LTEXT "+2",IDC_STATIC,145,180,10,8 END -IDD_LIGHTMAP2 DIALOG DISCARDABLE 0, 0, 361, 211 -STYLE WS_CHILD +IDD_LIGHTMAP2 DIALOG 0, 0, 361, 211 +STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN GROUPBOX "LMC: 8Bits Lightmap compression",IDC_STATIC,5,5,195,190 @@ -757,67 +622,45 @@ BEGIN LTEXT "Sun Group",IDC_LMC_STATIC3,10,115,40,10 LTEXT "Night Group",IDC_LMC_STATIC6,10,155,45,10 LTEXT "Ambient:",IDC_LMC_STATIC1,10,90,45,10 - CONTROL "Custom1",IDC_LM_ALWAYS_AMBIENT,"ColorSwatch",WS_TABSTOP, - 65,85,30,15 + CONTROL "Custom1",IDC_LM_ALWAYS_AMBIENT,"ColorSwatch",WS_TABSTOP,65,85,30,15 LTEXT "Diffuse:",IDC_LMC_STATIC2,105,90,45,10 - CONTROL "Custom1",IDC_LM_ALWAYS_DIFFUSE,"ColorSwatch",WS_TABSTOP, - 160,85,30,15 + CONTROL "Custom1",IDC_LM_ALWAYS_DIFFUSE,"ColorSwatch",WS_TABSTOP,160,85,30,15 LTEXT "Ambient:",IDC_LMC_STATIC4,10,130,45,10 - CONTROL "Custom1",IDC_LM_DAY_AMBIENT,"ColorSwatch",WS_TABSTOP,65, - 125,30,15 + CONTROL "Custom1",IDC_LM_DAY_AMBIENT,"ColorSwatch",WS_TABSTOP,65,125,30,15 LTEXT "Diffuse:",IDC_LMC_STATIC5,105,130,45,10 - CONTROL "Custom1",IDC_LM_DAY_DIFFUSE,"ColorSwatch",WS_TABSTOP, - 160,125,30,15 + CONTROL "Custom1",IDC_LM_DAY_DIFFUSE,"ColorSwatch",WS_TABSTOP,160,125,30,15 LTEXT "Ambient:",IDC_LMC_STATIC7,10,170,45,10 - CONTROL "Custom1",IDC_LM_NIGHT_AMBIENT,"ColorSwatch",WS_TABSTOP, - 65,165,30,15 + CONTROL "Custom1",IDC_LM_NIGHT_AMBIENT,"ColorSwatch",WS_TABSTOP,65,165,30,15 LTEXT "Diffuse:",IDC_LMC_STATIC8,105,170,45,10 - CONTROL "Custom1",IDC_LM_NIGHT_DIFFUSE,"ColorSwatch",WS_TABSTOP, - 160,165,30,15 - CONTROL "Use 8Bits lightmaps",IDC_LM_COMPRESS_8BIT,"Button", - BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,10,20, - 90,10 + CONTROL "Custom1",IDC_LM_NIGHT_DIFFUSE,"ColorSwatch",WS_TABSTOP,160,165,30,15 + CONTROL "Use 8Bits lightmaps",IDC_LM_COMPRESS_8BIT,"Button",BS_AUTO3STATE | BS_TOP | BS_MULTILINE | WS_TABSTOP,10,20,90,10 PUSHBUTTON "Auto Setup All",IDC_LMC_AUTO_SETUP,15,45,65,15 - PUSHBUTTON "Auto Setup Visible",IDC_LMC_AUTO_SETUP_VISIBLEONLY,95, - 45,90,15 + PUSHBUTTON "Auto Setup Visible",IDC_LMC_AUTO_SETUP_VISIBLEONLY,95,45,90,15 PUSHBUTTON "Copy From",IDC_LMC_COPY_FROM,120,20,65,15 END -IDD_LMC_CHOOSE_FROM DIALOG DISCARDABLE 0, 0, 217, 290 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_LMC_CHOOSE_FROM DIALOG 0, 0, 217, 290 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Choose LMC setup from object" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK",IDOK,160,240,50,14 PUSHBUTTON "Cancel",IDCANCEL,160,265,50,14 - LISTBOX IDC_LMC_COPY_LIST,5,20,120,260,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_LMC_COPY_LIST,5,20,120,260,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LTEXT "List of objects in LMC mode.",IDC_STATIC,5,10,120,10 - CONTROL "Custom1",IDC_LMC_COPY_ALWAYS_DIFFUSE,"ColorSwatch", - WS_TABSTOP,180,45,30,15 - CONTROL "Custom1",IDC_LMC_COPY_ALWAYS_AMBIENT,"ColorSwatch", - WS_TABSTOP,140,45,30,15 - CONTROL "Custom1",IDC_LMC_COPY_SUN_AMBIENT,"ColorSwatch", - WS_TABSTOP,140,90,30,15 - CONTROL "Custom1",IDC_LMC_COPY_SUN_DIFFUSE,"ColorSwatch", - WS_TABSTOP,180,90,30,15 - CONTROL "Custom1",IDC_LMC_COPY_NIGHT_DIFFUSE,"ColorSwatch", - WS_TABSTOP,180,135,30,15 - CONTROL "Custom1",IDC_LMC_COPY_NIGHT_AMBIENT,"ColorSwatch", - WS_TABSTOP,140,135,30,15 + CONTROL "Custom1",IDC_LMC_COPY_ALWAYS_DIFFUSE,"ColorSwatch",WS_TABSTOP,180,45,30,15 + CONTROL "Custom1",IDC_LMC_COPY_ALWAYS_AMBIENT,"ColorSwatch",WS_TABSTOP,140,45,30,15 + CONTROL "Custom1",IDC_LMC_COPY_SUN_AMBIENT,"ColorSwatch",WS_TABSTOP,140,90,30,15 + CONTROL "Custom1",IDC_LMC_COPY_SUN_DIFFUSE,"ColorSwatch",WS_TABSTOP,180,90,30,15 + CONTROL "Custom1",IDC_LMC_COPY_NIGHT_DIFFUSE,"ColorSwatch",WS_TABSTOP,180,135,30,15 + CONTROL "Custom1",IDC_LMC_COPY_NIGHT_AMBIENT,"ColorSwatch",WS_TABSTOP,140,135,30,15 LTEXT "Colors for this node:",IDC_STATIC,140,25,70,10 - CONTROL "Get",IDC_LMC_COPY_ALWAYS_AMBIENT_FILTER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,65,30,10 - CONTROL "Get",IDC_LMC_COPY_ALWAYS_DIFFUSE_FILTER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,180,65,30,10 - CONTROL "Get",IDC_LMC_COPY_SUN_DIFFUSE_FILTER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,180,110,30,10 - CONTROL "Get",IDC_LMC_COPY_SUN_AMBIENT_FILTER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,110,30,10 - CONTROL "Get",IDC_LMC_COPY_NIGHT_AMBIENT_FILTER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,155,30,10 - CONTROL "Get",IDC_LMC_COPY_NIGHT_DIFFUSE_FILTER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,180,155,30,10 + CONTROL "Get",IDC_LMC_COPY_ALWAYS_AMBIENT_FILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,65,30,10 + CONTROL "Get",IDC_LMC_COPY_ALWAYS_DIFFUSE_FILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,65,30,10 + CONTROL "Get",IDC_LMC_COPY_SUN_DIFFUSE_FILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,110,30,10 + CONTROL "Get",IDC_LMC_COPY_SUN_AMBIENT_FILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,110,30,10 + CONTROL "Get",IDC_LMC_COPY_NIGHT_AMBIENT_FILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,155,30,10 + CONTROL "Get",IDC_LMC_COPY_NIGHT_DIFFUSE_FILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,155,30,10 PUSHBUTTON "Clear All",IDC_LMC_COPY_CLEAR,140,175,70,15 PUSHBUTTON "Get All",IDC_LMC_COPY_GET_ALL,140,195,70,15 END @@ -829,7 +672,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE +GUIDELINES DESIGNINFO BEGIN IDD_NODE_PROPERTIES_PANEL, DIALOG BEGIN diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index bd37cee61..e65449409 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -1054,7 +1054,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( // Set enable disable LightingStateChanged (hwndDlg, currentParam); - CheckRadioButton (hwndDlg, IDC_LIGHT_GROUP_ALWAYS, IDC_LIGHT_GROUP_NIGHT, IDC_LIGHT_GROUP_ALWAYS+(currentParam->LightGroup%3)); + CheckRadioButton (hwndDlg, IDC_LIGHT_GROUP_ALWAYS, IDC_LIGHT_GROUP_LANDSCAPE_AMBIENT, IDC_LIGHT_GROUP_ALWAYS+(currentParam->LightGroup%5)); } break; @@ -1096,10 +1096,14 @@ INT_PTR CALLBACK LightmapDialogCallback ( // Get the acceleration type if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_ALWAYS) == BST_CHECKED) currentParam->LightGroup = 0; - else if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_DAY) == BST_CHECKED) + else if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_LANDSCAPE_DIFFUSE) == BST_CHECKED) currentParam->LightGroup = 1; - else if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_NIGHT) == BST_CHECKED) + else if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_NIGHT_CYCLE) == BST_CHECKED) currentParam->LightGroup = 2; + else if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_DAY_CYCLE) == BST_CHECKED) + currentParam->LightGroup = 3; + else if (IsDlgButtonChecked (hwndDlg, IDC_LIGHT_GROUP_LANDSCAPE_AMBIENT) == BST_CHECKED) + currentParam->LightGroup = 4; else currentParam->LightGroup = -1; } diff --git a/code/nel/tools/3d/plugin_max/nel_export/resource.h b/code/nel/tools/3d/plugin_max/nel_export/resource.h index 3c14091f3..c6340a356 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/resource.h +++ b/code/nel/tools/3d/plugin_max/nel_export/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. +// Microsoft Visual C++ generated include file. // Used by nel_export.rc // #define IDS_LIBDESCRIPTION 1 @@ -7,7 +7,6 @@ #define IDS_CLASS_NAME 3 #define IDC_ADD 3 #define IDS_PARAMS 4 -#define IDC_STATIC -1 #define IDC_REMOVE 4 #define IDS_SPIN 5 #define IDC_UP 5 @@ -225,9 +224,6 @@ #define IDC_OPEN_OCC_MODEL 1529 #define IDC_ENV_FX 1531 #define IDC_SOUND_GROUP 1532 -#define IDC_LIGHT_GROUP_ALWAYS 1533 -#define IDC_LIGHT_GROUP_DAY 1534 -#define IDC_LIGHT_GROUP_NIGHT 1535 #define IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR 1536 #define IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR 1537 #define IDC_8BITS_LIGHTMAP 1537 @@ -270,6 +266,12 @@ #define IDC_LMC_COPY_ALWAYS_DIFFUSE 1567 #define IDC_LMC_COPY_LIST 1568 #define IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN 1569 +#define IDC_LIGHT_GROUP_ALWAYS 1570 +#define IDC_LIGHT_GROUP_LANDSCAPE_DIFFUSE 1571 +#define IDC_LIGHT_GROUP_NIGHT_CYCLE 1572 +#define IDC_LIGHT_GROUP_DAY_CYCLE 1573 +#define IDC_LIGHT_GROUP_LANDSCAPE_AMBIENT 1574 +#define IDC_STATIC -1 // Next default values for new objects // diff --git a/code/ryzom/client/src/ig_client.cpp b/code/ryzom/client/src/ig_client.cpp index 401ecb83b..b508248f3 100644 --- a/code/ryzom/client/src/ig_client.cpp +++ b/code/ryzom/client/src/ig_client.cpp @@ -71,7 +71,7 @@ void initIG() { // Initialize lightmaps colors for the fireworks. - // Fireworks is group 3 + // Fireworks is group 5 Scene->setLightGroupColor (LightGroupFireworks, CRGBA(0,0,0)); }// initIG // diff --git a/code/ryzom/client/src/interface_v3/group_html_cs.cpp b/code/ryzom/client/src/interface_v3/group_html_cs.cpp index 8dc9fdb2b..ef72eaae6 100644 --- a/code/ryzom/client/src/interface_v3/group_html_cs.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_cs.cpp @@ -70,7 +70,7 @@ void CGroupHTMLCS::addHTTPGetParams (string &url, bool /*trustedDomain*/) // *************************************************************************** -void CGroupHTMLCS::addHTTPPostParams (HTAssocList *formfields, bool /*trustedDomain*/) +void CGroupHTMLCS::addHTTPPostParams (SFormFields &formfields, bool /*trustedDomain*/) { std::vector parameters; getParameters (parameters, false); @@ -78,7 +78,7 @@ void CGroupHTMLCS::addHTTPPostParams (HTAssocList *formfields, bool /*trustedDom uint i; for (i=0; igetLoginName (); - HTParseFormInput(formfields, ("shard="+toString(CharacterHomeSessionId)).c_str()); - HTParseFormInput(formfields, ("user_login="+user_name.toString()).c_str()); - HTParseFormInput(formfields, ("session_cookie="+NetMngr.getLoginCookie().toString()).c_str()); - HTParseFormInput(formfields, ("lang="+CI18N::getCurrentLanguageCode()).c_str()); + formfields.add("shard", toString(CharacterHomeSessionId)); + formfields.add("user_login", user_name.toString()); + formfields.add("session_cookie", NetMngr.getLoginCookie().toString()); + formfields.add("lang", CI18N::getCurrentLanguageCode()); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/group_html_mail.h b/code/ryzom/client/src/interface_v3/group_html_mail.h index 675a580c4..4731e1c3c 100644 --- a/code/ryzom/client/src/interface_v3/group_html_mail.h +++ b/code/ryzom/client/src/interface_v3/group_html_mail.h @@ -40,7 +40,7 @@ public: // From CGroupHTML virtual void addHTTPGetParams (std::string &url, bool trustedDomain); - virtual void addHTTPPostParams (HTAssocList *formfields, bool trustedDomain); + virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); virtual std::string home(); virtual void handle (); diff --git a/code/ryzom/client/src/interface_v3/group_html_webig.cpp b/code/ryzom/client/src/interface_v3/group_html_webig.cpp index 680a26273..1b74233e7 100644 --- a/code/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -307,19 +307,19 @@ void CGroupHTMLAuth::addHTTPGetParams (string &url, bool trustedDomain) // *************************************************************************** -void CGroupHTMLAuth::addHTTPPostParams (HTAssocList *formfields, bool trustedDomain) +void CGroupHTMLAuth::addHTTPPostParams (SFormFields &formfields, bool trustedDomain) { if(!UserEntity) return; uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot; - HTParseFormInput(formfields, ("shardid="+toString(CharacterHomeSessionId)).c_str()); - HTParseFormInput(formfields, ("name="+UserEntity->getLoginName().toUtf8()).c_str()); - HTParseFormInput(formfields, ("lang="+CI18N::getCurrentLanguageCode()).c_str()); - HTParseFormInput(formfields, "ig=1"); + formfields.add("shardid", toString(CharacterHomeSessionId)); + formfields.add("name", UserEntity->getLoginName().toUtf8()); + formfields.add("lang", CI18N::getCurrentLanguageCode()); + formfields.add("ig", "1"); if (trustedDomain) { - HTParseFormInput(formfields, ("cid="+toString(cid)).c_str()); - HTParseFormInput(formfields, ("authkey="+getWebAuthKey()).c_str()); + formfields.add("cid", toString(cid)); + formfields.add("authkey", getWebAuthKey()); } } @@ -365,7 +365,7 @@ void CGroupHTMLWebIG::addHTTPGetParams (string &url, bool trustedDomain) // *************************************************************************** -void CGroupHTMLWebIG::addHTTPPostParams (HTAssocList *formfields, bool trustedDomain) +void CGroupHTMLWebIG::addHTTPPostParams (SFormFields &formfields, bool trustedDomain) { CGroupHTMLAuth::addHTTPPostParams(formfields, trustedDomain); } diff --git a/code/ryzom/client/src/interface_v3/group_html_webig.h b/code/ryzom/client/src/interface_v3/group_html_webig.h index 9da5adee5..49aac7153 100644 --- a/code/ryzom/client/src/interface_v3/group_html_webig.h +++ b/code/ryzom/client/src/interface_v3/group_html_webig.h @@ -33,7 +33,7 @@ public: // From CGroupHTML virtual void addHTTPGetParams (std::string &url, bool trustedDomain); - virtual void addHTTPPostParams (HTAssocList *formfields, bool trustedDomain); + virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); virtual std::string home(); virtual void handle (); @@ -55,7 +55,7 @@ public: /// From CGroupHTMLAuth virtual void addHTTPGetParams (std::string &url, bool trustedDomain); - virtual void addHTTPPostParams (HTAssocList *formfields, bool trustedDomain); + virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); virtual std::string home(); virtual void handle (); diff --git a/code/ryzom/client/src/interface_v3/group_quick_help.cpp b/code/ryzom/client/src/interface_v3/group_quick_help.cpp index d2444d413..b3c2c1ecc 100644 --- a/code/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/code/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -215,7 +215,7 @@ void CGroupQuickHelp::setGroupTextSize (CInterfaceGroup *group, bool selected) extern CActionsContext ActionsContext; -void CGroupQuickHelp::beginElement (uint element_number, const BOOL *present, const char **value) +void CGroupQuickHelp::beginElement (uint element_number, const std::vector &present, const std::vector&value) { CGroupHTML::beginElement (element_number, present, value); diff --git a/code/ryzom/client/src/interface_v3/group_quick_help.h b/code/ryzom/client/src/interface_v3/group_quick_help.h index a4557a4c7..76f863bf9 100644 --- a/code/ryzom/client/src/interface_v3/group_quick_help.h +++ b/code/ryzom/client/src/interface_v3/group_quick_help.h @@ -48,7 +48,7 @@ private: virtual void updateCoords(); // From CGroupHTML - virtual void beginElement (uint element_number, const BOOL *present, const char **value); + virtual void beginElement (uint element_number, const std::vector &present, const std::vector&value); virtual void endBuild (); virtual void browse (const char *url); virtual std::string home(); diff --git a/code/ryzom/client/src/light_cycle_manager.cpp b/code/ryzom/client/src/light_cycle_manager.cpp index 1f7175dba..5ef2f52fb 100644 --- a/code/ryzom/client/src/light_cycle_manager.cpp +++ b/code/ryzom/client/src/light_cycle_manager.cpp @@ -354,11 +354,17 @@ void CLightCycleManager::setHour(float hour, const CWeatherManagerClient &wm, NL { CRGBA color; color.add(_LastDiffuse, lightningColor); - Scene->setLightGroupColor (LightGroupDay, color); + Scene->setLightGroupColor(LightGroupLandscapeDiffuse, color); + color.add(_LastAmbient, lightningColor); + Scene->setLightGroupColor(LightGroupLandscapeAmbient, color); float nightLevel = _LightLevel*255.f; clamp (nightLevel, 0, 255); - color.set ((uint8)nightLevel, (uint8)nightLevel, (uint8)nightLevel); - Scene->setLightGroupColor (LightGroupNight, color); + uint8 nightLevelColor = (uint8)nightLevel; + color.set (nightLevelColor, nightLevelColor, nightLevelColor); + Scene->setLightGroupColor (LightGroupNightCycle, color); + uint8 dayLevelColor = 255 - nightLevel; + color.set (dayLevelColor, dayLevelColor, dayLevelColor); + Scene->setLightGroupColor (LightGroupDayCycle, color); } if (Landscape) diff --git a/code/ryzom/client/src/misc.h b/code/ryzom/client/src/misc.h index 463f02b66..7fba7204c 100644 --- a/code/ryzom/client/src/misc.h +++ b/code/ryzom/client/src/misc.h @@ -65,9 +65,11 @@ class CPlayerSheet; enum TLightGroup { LightGroupAlways = 0, - LightGroupDay, - LightGroupNight, - LightGroupFireworks, + LightGroupLandscapeDiffuse = 1, + LightGroupNightCycle = 2, + LightGroupDayCycle = 3, + LightGroupLandscapeAmbient = 4, + LightGroupFireworks }; class CSeeds;