Merge with develop

--HG--
branch : feature-streamed-package
hg/feature/streamed-package
kaetemi 10 years ago
commit b7208c9513

@ -3,3 +3,5 @@
00d9b6e29e95f56785fbf85abe60afd34674f402 ryzomcore/v0.9.0 00d9b6e29e95f56785fbf85abe60afd34674f402 ryzomcore/v0.9.0
79776c337176dd5b02e1a74fe5dfb703b91747aa ryzomcore/v0.9.1 79776c337176dd5b02e1a74fe5dfb703b91747aa ryzomcore/v0.9.1
fedf2aa443d09707beed814b0f499c6a5519cc84 ryzomcore/v0.10.0 fedf2aa443d09707beed814b0f499c6a5519cc84 ryzomcore/v0.10.0
edaa3624a56420b02ccc64c26059801a389927ee ryzomcore/v0.11.0
e3fe4855f22c3e75722e015dc33c091c340b3ad7 ryzomcore/v0.11.1

@ -2,7 +2,7 @@
# #
# NeL # NeL
# Authors: Nevrax and the NeL Community # Authors: Nevrax and the NeL Community
# Version: 0.10.0 # Version: 0.11.1
# #
# Notes: # Notes:
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path # * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
@ -47,8 +47,8 @@ CHECK_OUT_OF_SOURCE()
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C) PROJECT(RyzomCore CXX C)
SET(NL_VERSION_MAJOR 0) SET(NL_VERSION_MAJOR 0)
SET(NL_VERSION_MINOR 10) SET(NL_VERSION_MINOR 11)
SET(NL_VERSION_PATCH 0) SET(NL_VERSION_PATCH 1)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

@ -52,12 +52,6 @@ IF(DXSDK_DIR)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio) FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9) FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9) FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
#FIND_DXSDK_LIBRARY(DXSDK_MESH_LIBRARY mesh)
#FIND_DXSDK_LIBRARY(DXSDK_MAXUTIL_LIBRARY maxutil)
#FIND_DXSDK_LIBRARY(DXSDK_MAXSCRIPT_LIBRARY maxscrpt)
#FIND_DXSDK_LIBRARY(DXSDK_PARAMBLK2_LIBRARY paramblk2)
#FIND_DXSDK_LIBRARY(DXSDK_BMM_LIBRARY bmm)
ENDIF(DXSDK_DIR) ENDIF(DXSDK_DIR)
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if # Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if

@ -11,6 +11,12 @@ MACRO(FIND_CORRECT_LUA_VERSION)
SET(LUA52_LIBRARY "liblua5.2") SET(LUA52_LIBRARY "liblua5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
IF(NOT LUALIB_FOUND)
# fedora (v20)
SET(LUA52_LIBRARY "liblua-5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
ENDIF(NOT LUALIB_FOUND)
IF(LUALIB_FOUND) IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2") MESSAGE(STATUS "Luabind is using Lua 5.2")

@ -71,7 +71,7 @@ public:
// For clipTrav. cleared at beginning of CClipTrav::traverse // For clipTrav. cleared at beginning of CClipTrav::traverse
void clearVisibleList(); void clearVisibleList();
// For ClipTrav only. NB: list is cleared at begininng of traverse(). NB: only CTransform are supported // For ClipTrav only. NB: list is cleared at beginning of traverse(). NB: only CTransform are supported
void addVisibleModel(CTransform *model) void addVisibleModel(CTransform *model)
{ {
_VisibleList[_CurrentNumVisibleModels]= model; _VisibleList[_CurrentNumVisibleModels]= model;

@ -82,6 +82,8 @@ public:
void setShaded (bool b) { _Shaded = b; } void setShaded (bool b) { _Shaded = b; }
void setShadeOutline (bool b) { _ShadeOutline = b; }
void setShadeExtent (float shext) { _ShadeExtent = shext; } void setShadeExtent (float shext) { _ShadeExtent = shext; }
/// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) /// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255)
@ -107,6 +109,8 @@ public:
bool getShaded() const { return _Shaded; } bool getShaded() const { return _Shaded; }
bool getShadeOutline() const { return _ShadeOutline; }
bool getKeep800x600Ratio() const {return _Keep800x600Ratio;} bool getKeep800x600Ratio() const {return _Keep800x600Ratio;}
NLMISC::CRGBA getShadeColor () const { return _ShadeColor; } NLMISC::CRGBA getShadeColor () const { return _ShadeColor; }
@ -138,15 +142,30 @@ public:
{ {
nlassert (index < _CacheStrings.size()); nlassert (index < _CacheStrings.size());
CComputedString &rCS = _CacheStrings[index]; CComputedString &rCS = _CacheStrings[index];
if(_Shaded) if (_Shaded)
{ {
CRGBA bkup = rCS.Color; CRGBA bkup = rCS.Color;
rCS.Color = _ShadeColor; rCS.Color = _ShadeColor;
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
rCS.render2D (*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
rCS.render2D(*_Driver, x+rext, z-rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-rext, z-rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-rext, z+rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x+rext, z+rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x+_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
}
else
{
rCS.render2D(*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
}
rCS.Color= bkup; rCS.Color= bkup;
} }
rCS.render2D (*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ); rCS.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
} }
/** Clip and print a string that is in the cache (it leaves the string in the cache) /** Clip and print a string that is in the cache (it leaves the string in the cache)
@ -161,7 +180,22 @@ public:
CRGBA bkup = rCS.Color; CRGBA bkup = rCS.Color;
rCS.Color= _ShadeColor; rCS.Color= _ShadeColor;
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax); if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z-rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z-rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z+rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z+rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtent, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtent, xmin, ymin, xmax, ymax);
}
else
{
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax);
}
rCS.Color= bkup; rCS.Color= bkup;
} }
rCS.render2DClip (*_Driver, rdrBuffer, x, z, xmin, ymin, xmax, ymax); rCS.render2DClip (*_Driver, rdrBuffer, x, z, xmin, ymin, xmax, ymax);
@ -174,12 +208,27 @@ public:
{ {
nlassert (index < _CacheStrings.size()); nlassert (index < _CacheStrings.size());
CComputedString &rCS = _CacheStrings[index]; CComputedString &rCS = _CacheStrings[index];
if(_Shaded) if (_Shaded)
{ {
CRGBA bkup = rCS.Color; CRGBA bkup = rCS.Color;
rCS.Color= _ShadeColor; rCS.Color= _ShadeColor;
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y-rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y-rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y+rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y+rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
}
else
{
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
}
rCS.Color= bkup; rCS.Color= bkup;
} }
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y, depth, xmin, ymin, xmax, ymax); rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y, depth, xmin, ymin, xmax, ymax);
@ -194,17 +243,32 @@ public:
_FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio); _FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded // draw shaded
if(_Shaded) if (_Shaded)
{ {
CRGBA bkup = _TempString.Color; CRGBA bkup = _TempString.Color;
_TempString.Color= _ShadeColor; _TempString.Color = _ShadeColor;
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
_TempString.render2D (*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); if (_ShadeOutline)
_TempString.Color= bkup; {
float rext = _ShadeExtent * 0.7071f;
_TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
else
{
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
_TempString.Color = bkup;
} }
// draw // draw
_TempString.render2D (*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ); _TempString.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
} }
/// Directly print a string /// Directly print a string
@ -218,17 +282,32 @@ public:
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio); _FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded // draw shaded
if(_Shaded) if (_Shaded)
{ {
CRGBA bkup = _TempString.Color; CRGBA bkup = _TempString.Color;
_TempString.Color = _ShadeColor; _TempString.Color = _ShadeColor;
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
_TempString.render2D (*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); if (_ShadeOutline)
_TempString.Color= bkup; {
float rext = _ShadeExtent * 0.7071f;
_TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
else
{
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
_TempString.Color = bkup;
} }
// draw // draw
_TempString.render2D (*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ); _TempString.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
} }
/// Get computed string from index /// Get computed string from index
@ -317,6 +396,9 @@ private:
/// true if text is shaded /// true if text is shaded
bool _Shaded; bool _Shaded;
/// true if shade appears as an outline
bool _ShadeOutline;
/// shade's extent (shadow size) /// shade's extent (shadow size)
float _ShadeExtent; float _ShadeExtent;

@ -64,19 +64,21 @@ public:
/// \name Text look. /// \name Text look.
// @{ // @{
void setColor(NLMISC::CRGBA color); void setColor(NLMISC::CRGBA color);
void setFontSize(uint32 fontSize) ; void setFontSize(uint32 fontSize);
uint32 getFontSize() const ; uint32 getFontSize() const;
void setHotSpot(THotSpot hotSpot) ; void setHotSpot(THotSpot hotSpot);
THotSpot getHotSpot() const ; THotSpot getHotSpot() const;
void setScaleX(float scaleX) ; void setScaleX(float scaleX);
void setScaleY(float scaleY) ; void setScaleY(float scaleY);
float getScaleX() const ; float getScaleX() const;
float getScaleY() const ; float getScaleY() const;
void setShaded(bool b) ; void setShaded(bool b);
bool getShaded() const ; bool getShaded() const;
void setShadeExtent(float shext) ; void setShadeOutline(bool b);
void setShadeColor (NLMISC::CRGBA sc); bool getShadeOutline() const;
NLMISC::CRGBA getShadeColor () const; void setShadeExtent(float shext) ;
void setShadeColor (NLMISC::CRGBA sc);
NLMISC::CRGBA getShadeColor () const;
void setKeep800x600Ratio(bool keep); void setKeep800x600Ratio(bool keep);
bool getKeep800x600Ratio() const; bool getKeep800x600Ratio() const;
// @} // @}

@ -174,6 +174,15 @@ public:
* \return the shade state * \return the shade state
*/ */
virtual bool getShaded () const = 0; virtual bool getShaded () const = 0;
/**
* set the shade states
* \param the shade state
*/
virtual void setShadeOutline (bool b) = 0;
/**
* \return the shade state
*/
virtual bool getShadeOutline () const = 0;
/** /**
* set the shadow's size * set the shadow's size
* \param the shade extent * \param the shade extent

@ -126,6 +126,7 @@ namespace NLGUI
void onRemoved(); void onRemoved();
void onWidgetDeleted( CInterfaceElement *e ); void onWidgetDeleted( CInterfaceElement *e );
void moveBy( sint32 x, sint32 y );
protected: protected:

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string> #include <string>
#include <vector>
namespace NLGUI namespace NLGUI
{ {
@ -24,7 +25,7 @@ namespace NLGUI
public: public:
/// Notifies the watcher about the change /// Notifies the watcher about the change
virtual void selectionChanged( std::string &newSelection ) = 0; virtual void selectionChanged() = 0;
}; };
} }

@ -285,7 +285,7 @@ namespace NLGUI
void addImage(const char *image, bool globalColor, bool reloadImg=false); void addImage(const char *image, bool globalColor, bool reloadImg=false);
// Add a text area in the current paragraph // Add a text area in the current paragraph
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content); CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
// Add a combo box in the current paragraph // Add a combo box in the current paragraph
CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name); CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name);
@ -528,7 +528,7 @@ namespace NLGUI
CCellParams () : BgColor(0,0,0,0) CCellParams () : BgColor(0,0,0,0)
{ {
Align = CGroupCell::Left; Align = CGroupCell::Left;
VAlign = CGroupCell::Top; VAlign = CGroupCell::Middle;
LeftMargin = 0; LeftMargin = 0;
NoWrap = false; NoWrap = false;
} }
@ -557,6 +557,7 @@ namespace NLGUI
std::string _TextAreaName; std::string _TextAreaName;
uint _TextAreaRow; uint _TextAreaRow;
uint _TextAreaCols; uint _TextAreaCols;
uint _TextAreaMaxLength;
// current mode is in select option // current mode is in select option
bool _SelectOption; bool _SelectOption;

@ -381,6 +381,7 @@ namespace NLGUI
bool _CloseSubMenuUsingPopModal; bool _CloseSubMenuUsingPopModal;
bool _Shadow; bool _Shadow;
bool _ShadowOutline;
bool _Formatted; bool _Formatted;
uint8 _Space; uint8 _Space;
sint32 _FontSize; sint32 _FontSize;

@ -78,6 +78,9 @@ namespace NLGUI
// The Width you want in pixel. This is the <td width="100"> parameter // The Width you want in pixel. This is the <td width="100"> parameter
sint32 WidthWanted; sint32 WidthWanted;
sint32 ColSpan;
sint32 RowSpan;
sint32 TableColumnIndex;
// The min height of the cell // The min height of the cell
sint32 Height; sint32 Height;
@ -142,6 +145,7 @@ namespace NLGUI
// Table borders // Table borders
sint32 Border; sint32 Border;
NLMISC::CRGBA BorderColor;
sint32 CellPadding; sint32 CellPadding;
sint32 CellSpacing; sint32 CellSpacing;
@ -191,13 +195,14 @@ namespace NLGUI
WidthMax = 0; WidthMax = 0;
WidthWanted = 0; WidthWanted = 0;
TableRatio = 0; TableRatio = 0;
Height = 0; RowSpan = 1;
} }
sint32 Width; sint32 Width;
sint32 Height; sint32 Height;
sint32 WidthWanted; sint32 WidthWanted;
sint32 WidthMax; sint32 WidthMax;
float TableRatio; float TableRatio;
sint32 RowSpan;
}; };
// Table row // Table row

@ -491,8 +491,12 @@ namespace NLGUI
void setEditorSelected( bool b ){ editorSelected = b; } void setEditorSelected( bool b ){ editorSelected = b; }
bool isEditorSelected() const{ return editorSelected; } bool isEditorSelected() const{ return editorSelected; }
void parsePosParent( const std::string &id );
void setPosParent( const std::string &id ); void setPosParent( const std::string &id );
void getPosParent( std::string &id ) const;
void parseSizeParent( const std::string &id );
void setSizeParent( const std::string &id ); void setSizeParent( const std::string &id );
void getSizeParent( std::string &id ) const;
void setSerializable( bool b ){ serializable = b; } void setSerializable( bool b ){ serializable = b; }
bool IsSerializable() const{ return serializable; } bool IsSerializable() const{ return serializable; }
@ -508,7 +512,24 @@ namespace NLGUI
/// Called when the widget is deleted, /// Called when the widget is deleted,
/// so other widgets in the group can check if it belongs to them /// so other widgets in the group can check if it belongs to them
virtual void onWidgetDeleted( CInterfaceElement *e ){} virtual void onWidgetDeleted( CInterfaceElement *e );
/// Move the element by x in the X direction and y in the Y direction
// Uses real coordinates
virtual void moveBy( sint32 x, sint32 y )
{
_XReal += x;
_YReal += y;
}
/// Retrieves the coordinates of the specified hotspot
void getHSCoords( const THotSpot &hs, sint32 &x, sint32 &y ) const;
/// Tells which hotspot is the closest to the specified element
void getClosestHotSpot( const CInterfaceElement *other, THotSpot &hs );
/// Aligns the element to the other element specified
void alignTo( CInterfaceElement *other );
protected: protected:

@ -14,19 +14,22 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WIDGET_ADD_WATCHER #ifndef IFACE_FACTORY
#define WIDGET_ADD_WATCHER #define IFACE_FACTORY
#include <string> #include <string>
namespace NLGUI namespace NLGUI
{ {
class IWidgetAdditionWatcher class CViewBase;
/// Simple interface element ( widget ) factory
class CInterfaceFactory
{ {
public: public:
virtual void widgetAdded( const std::string &name ) = 0; static CViewBase* createClass( const std::string &name );
}; };
} }
#endif
#endif

@ -57,6 +57,7 @@ namespace NLGUI
CInterfaceElement* findFromShortId(const std::string &id); CInterfaceElement* findFromShortId(const std::string &id);
/// Dynamic creation /// Dynamic creation
virtual void addElement (CInterfaceElement *child, sint eltOrder = -1 );
virtual void addView (CViewBase *child , sint eltOrder = -1); virtual void addView (CViewBase *child , sint eltOrder = -1);
virtual void addCtrl (CCtrlBase *child, sint eltOrder = -1); virtual void addCtrl (CCtrlBase *child, sint eltOrder = -1);
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1); virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
@ -327,6 +328,17 @@ namespace NLGUI
void onWidgetDeleted( CInterfaceElement *e ); void onWidgetDeleted( CInterfaceElement *e );
void moveBy( sint32 x, sint32 y );
// Blows up the group, moves it's children to it's parent
bool explode();
/// Adjusts the group's size so that all elements are fully inside the borders
void spanElements();
/// Aligns the elements - used for forming groups
void alignElements();
protected: protected:
void makeNewClip (sint32 &oldClipX, sint32 &oldClipY, sint32 &oldClipW, sint32 &oldClipH); void makeNewClip (sint32 &oldClipX, sint32 &oldClipY, sint32 &oldClipW, sint32 &oldClipH);

@ -150,16 +150,17 @@ namespace NLGUI
sint32 TxId_E_Open, W_E_Open, H_E_Open; sint32 TxId_E_Open, W_E_Open, H_E_Open;
sint32 TxId_M_Open, W_M_Open, H_M_Open; sint32 TxId_M_Open, W_M_Open, H_M_Open;
sint32 TxId_TL_HighLight; sint32 TxId_TL_HighLight, W_TL_HighLight, H_TL_HighLight;
sint32 TxId_T_HighLight; sint32 TxId_T_HighLight, W_T_HighLight, H_T_HighLight;
sint32 TxId_TR_HighLight; sint32 TxId_TR_HighLight, W_TR_HighLight, H_TR_HighLight;
sint32 TxId_L_HighLight; sint32 TxId_L_HighLight, W_L_HighLight, H_L_HighLight;
sint32 TxId_R_HighLight; sint32 TxId_R_HighLight, W_R_HighLight, H_R_HighLight;
sint32 TxId_BL_HighLight; sint32 TxId_BL_HighLight, W_BL_HighLight, H_BL_HighLight;
sint32 TxId_B_HighLight; sint32 TxId_B_HighLight, W_B_HighLight, H_B_HighLight;
sint32 TxId_BR_HighLight; sint32 TxId_BR_HighLight, W_BR_HighLight, H_BR_HighLight;
sint32 HeaderH; sint32 HeaderH;
sint32 InsetT; // Offset height of top texture
}; };
// *************************************************************************** // ***************************************************************************

@ -28,6 +28,7 @@
#include "nel/gui/proc.h" #include "nel/gui/proc.h"
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
#include "nel/gui/link_data.h" #include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI namespace NLGUI
{ {
@ -100,20 +101,6 @@ namespace NLGUI
virtual void setupOptions() = 0; virtual void setupOptions() = 0;
}; };
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
CInterfaceParser(); CInterfaceParser();
virtual ~CInterfaceParser(); virtual ~CInterfaceParser();
@ -353,7 +340,15 @@ namespace NLGUI
std::map< std::string, std::string > pointerSettings; std::map< std::string, std::string > pointerSettings;
std::map< std::string, std::map< std::string, std::string > > keySettings; std::map< std::string, std::map< std::string, std::string > > keySettings;
std::string _WorkDir;
public: public:
/// Sets the working directory, where files should be looked for
void setWorkDir( const std::string &workdir ){ _WorkDir = workdir; }
/// Looks up a file in either the working directory or using CPath::lookup
std::string lookup( const std::string &file );
void initLUA(); void initLUA();
void uninitLUA(); void uninitLUA();
bool isLuaInitialized() const{ return luaInitialized; } bool isLuaInitialized() const{ return luaInitialized; }
@ -378,6 +373,7 @@ namespace NLGUI
void setEditorMode( bool b ){ editorMode = b; } void setEditorMode( bool b ){ editorMode = b; }
void setVariable( const VariableData &v );
bool serializeVariables( xmlNodePtr parentNode ) const; bool serializeVariables( xmlNodePtr parentNode ) const;
bool serializeProcs( xmlNodePtr parentNode ) const; bool serializeProcs( xmlNodePtr parentNode ) const;
bool serializePointerSettings( xmlNodePtr parentNode ) const; bool serializePointerSettings( xmlNodePtr parentNode ) const;

@ -79,6 +79,7 @@ namespace NLGUI
HTML_ATTR(TABLE,ALIGN) = 0, HTML_ATTR(TABLE,ALIGN) = 0,
HTML_ATTR(TABLE,BGCOLOR), HTML_ATTR(TABLE,BGCOLOR),
HTML_ATTR(TABLE,BORDER), HTML_ATTR(TABLE,BORDER),
HTML_ATTR(TABLE,BORDERCOLOR),
HTML_ATTR(TABLE,CELLPADDING), HTML_ATTR(TABLE,CELLPADDING),
HTML_ATTR(TABLE,CELLSPACING), HTML_ATTR(TABLE,CELLSPACING),
HTML_ATTR(TABLE,CLASS), HTML_ATTR(TABLE,CLASS),
@ -189,6 +190,7 @@ namespace NLGUI
HTML_ATTR(TEXTAREA,DISABLED), HTML_ATTR(TEXTAREA,DISABLED),
HTML_ATTR(TEXTAREA,ID), HTML_ATTR(TEXTAREA,ID),
HTML_ATTR(TEXTAREA,LANG), HTML_ATTR(TEXTAREA,LANG),
HTML_ATTR(TEXTAREA,MAXLENGTH),
HTML_ATTR(TEXTAREA,NAME), HTML_ATTR(TEXTAREA,NAME),
HTML_ATTR(TEXTAREA,READONLY), HTML_ATTR(TEXTAREA,READONLY),
HTML_ATTR(TEXTAREA,ROWS), HTML_ATTR(TEXTAREA,ROWS),

@ -23,6 +23,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/gui/proc.h" #include "nel/gui/proc.h"
#include "nel/gui/link_data.h" #include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI namespace NLGUI
{ {
@ -83,11 +84,13 @@ namespace NLGUI
virtual void removeLinkData( uint32 id ) = 0; virtual void removeLinkData( uint32 id ) = 0;
virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0; virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0;
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0; virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
virtual void setVariable( const VariableData &v ) = 0;
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0; virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0; virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0; virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0;
virtual bool serializeKeySettings( xmlNodePtr parentNode ) const = 0; virtual bool serializeKeySettings( xmlNodePtr parentNode ) const = 0;
virtual CViewBase* createClass( const std::string &name ) = 0; virtual CViewBase* createClass( const std::string &name ) = 0;
virtual void setWorkDir( const std::string &workdir ) = 0;
}; };
} }

@ -0,0 +1,46 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef ROOT_GROUP_H
#define ROOT_GROUP_H
#include <string>
#include <map>
#include "nel/gui/interface_group.h"
namespace NLGUI
{
class CRootGroup : public CInterfaceGroup
{
public:
CRootGroup(const TCtorParam &param);
virtual ~CRootGroup();
virtual CInterfaceElement* getElement (const std::string &id);
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
virtual bool delGroup (CInterfaceGroup *child, bool dontDelete = false);
private:
std::map< std::string, CInterfaceGroup* > _Accel;
};
}
#endif

@ -14,27 +14,28 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _READPIC_H_ #ifndef VARIABLE_DATA_H
#define _READPIC_H_ #define VARIABLE_DATA_H
#ifdef _MSC_VER #include "nel/misc/types_nl.h"
#pragma warning(disable:4786)
#endif
#include <string>
#include <vector>
#include <nel/misc/types_nl.h> namespace NLGUI
#include <nel/misc/rgba.h> {
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
//============================================================ }
// API.
//============================================================
bool PIC_LoadPic(std::string Path, std::vector<NLMISC::CBGRA> &Tampon, uint &Width, uint &Height);
#endif
#endif

@ -48,7 +48,7 @@ namespace NLGUI
/// Constructor /// Constructor
CViewText (const std::string& id, const std::string Text="", sint FontSize=12, CViewText (const std::string& id, const std::string Text="", sint FontSize=12,
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false); NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false, bool ShadowOutline=false);
virtual ~CViewText(); virtual ~CViewText();
@ -83,6 +83,7 @@ namespace NLGUI
void setFontSize (sint nFontSize); void setFontSize (sint nFontSize);
void setColor (const NLMISC::CRGBA &color); void setColor (const NLMISC::CRGBA &color);
void setShadow (bool bShadow); void setShadow (bool bShadow);
void setShadowOutline (bool bShadowOutline);
void setShadowColor (const NLMISC::CRGBA &color); void setShadowColor (const NLMISC::CRGBA &color);
void setLineMaxW (sint nMaxW, bool invalidate=true); void setLineMaxW (sint nMaxW, bool invalidate=true);
void setMultiLine (bool bMultiLine); void setMultiLine (bool bMultiLine);
@ -102,6 +103,7 @@ namespace NLGUI
sint getFontSize() const; sint getFontSize() const;
NLMISC::CRGBA getColor() { return _Color; } NLMISC::CRGBA getColor() { return _Color; }
bool getShadow() { return _Shadow; } bool getShadow() { return _Shadow; }
bool getShadowOutline() { return _ShadowOutline; }
NLMISC::CRGBA getShadowColor() { return _ShadowColor; } NLMISC::CRGBA getShadowColor() { return _ShadowColor; }
sint getLineMaxW() const { return _LineMaxW; } sint getLineMaxW() const { return _LineMaxW; }
bool getMultiLine() const { return _MultiLine; } bool getMultiLine() const { return _MultiLine; }
@ -202,7 +204,11 @@ namespace NLGUI
REFLECT_EXPORT_END REFLECT_EXPORT_END
virtual void serial(NLMISC::IStream &f); virtual void serial(NLMISC::IStream &f);
// Sets the parent element
// See the comment at the field
void setParentElm( CInterfaceElement *parent ){ _ParentElm = parent; }
protected: protected:
std::string _HardtextFormat; std::string _HardtextFormat;
@ -225,6 +231,7 @@ namespace NLGUI
NLMISC::CRGBA _Color; NLMISC::CRGBA _Color;
/// the shadow mode /// the shadow mode
bool _Shadow; bool _Shadow;
bool _ShadowOutline;
/// the case mode /// the case mode
TCaseMode _CaseMode; TCaseMode _CaseMode;
/// the text shadow color /// the text shadow color
@ -379,6 +386,9 @@ namespace NLGUI
/// Dynamic tooltips /// Dynamic tooltips
std::vector<CCtrlToolTip*> _Tooltips; std::vector<CCtrlToolTip*> _Tooltips;
// Parent element is the element where this text belongs to
// For example: text button
CInterfaceElement *_ParentElm;
private: private:
void setup (); void setup ();

@ -75,6 +75,16 @@ namespace NLGUI
virtual void process() = 0; virtual void process() = 0;
}; };
// Interface for event handlers that can be called when widgets are added or moved
class IWidgetWatcher
{
public:
IWidgetWatcher(){}
virtual ~IWidgetWatcher(){}
virtual void onWidgetAdded( const std::string &name ) = 0;
virtual void onWidgetMoved( const std::string &oldid, const std::string &newid ) = 0;
};
/// Frame render times /// Frame render times
struct SInterfaceTimes struct SInterfaceTimes
{ {
@ -493,17 +503,33 @@ namespace NLGUI
IParser* getParser() const{ return parser; } IParser* getParser() const{ return parser; }
std::string& getCurrentEditorSelection(){ return currentEditorSelection; } /// Retrieves the Id of the currently selected widgets
void setCurrentEditorSelection( const std::string &name ); void getEditorSelection( std::vector< std::string > &selection );
/// Adds the widget with the specified Id to the selected widgets
void selectWidget( const std::string &name );
/// Clears the selection
void clearEditorSelection();
void notifySelectionWatchers(); void notifySelectionWatchers();
void registerSelectionWatcher( IEditorSelectionWatcher *watcher ); void registerSelectionWatcher( IEditorSelectionWatcher *watcher );
void unregisterSelectionWatcher( IEditorSelectionWatcher *watcher ); void unregisterSelectionWatcher( IEditorSelectionWatcher *watcher );
void notifyAdditionWatchers( const std::string &widgetName );
void registerAdditionWatcher( IWidgetAdditionWatcher *watcher ); void onWidgetAdded( const std::string &id );
void unregisterAdditionWatcher( IWidgetAdditionWatcher *watcher ); void onWidgetMoved( const std::string &oldid, const std::string &newid );
void registerWidgetWatcher( IWidgetWatcher *watcher );
void unregisterWidgetWatcher( IWidgetWatcher *watcher );
CInterfaceElement* addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName ); CInterfaceElement* addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName );
void setGroupSelection( bool b ){ _GroupSelection = b; }
bool groupSelection();
bool unGroupSelection();
void setMultiSelection( bool b ){ multiSelection = b; }
bool createNewGUI( const std::string &project, const std::string &window );
private: private:
CWidgetManager(); CWidgetManager();
@ -532,7 +558,7 @@ namespace NLGUI
NLMISC::CRefPtr< CViewBase > _CapturedView; NLMISC::CRefPtr< CViewBase > _CapturedView;
NLMISC::CRefPtr< CInterfaceElement > draggedElement; NLMISC::CRefPtr< CInterfaceElement > draggedElement; // the element that we're currently dragging
bool startDragging(); bool startDragging();
void stopDragging(); void stopDragging();
@ -594,10 +620,12 @@ namespace NLGUI
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers; std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers; std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
std::vector< IEditorSelectionWatcher* > selectionWatchers; std::vector< IEditorSelectionWatcher* > selectionWatchers;
std::vector< IWidgetAdditionWatcher* > additionWatchers; std::vector< IWidgetWatcher* > widgetWatchers;
std::vector< std::string > editorSelection;
std::string currentEditorSelection; bool _GroupSelection;
bool multiSelection;
uint32 _WidgetCount;
}; };
} }

@ -0,0 +1,327 @@
/*
Copyright (c) 2009-2014, Jan BOON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLMISC_CALLBACK_H
#define NLMISC_CALLBACK_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/debug.h>
// Project includes
namespace NLMISC {
#define NLMISC_CALLBACK_TEMPLATE \
/** \
* \brief NLMISC_CALLBACK_ARGS_CLASS \
* \date 2009-03-03 18:09GMT \
* \author Jan BOON \
* Callback template \
*/ \
template<typename TReturn NLMISC_CALLBACK_ARGS_TYPENAME> \
class NLMISC_CALLBACK_ARGS_CLASS \
{ \
/* Very simple reference counting callback base */ \
class CCallbackBase \
{ \
public: \
CCallbackBase() : m_RefCount(0) \
{ \
\
} \
\
virtual ~CCallbackBase() \
{ \
nlassert(!m_RefCount); \
} \
\
void refAdd() \
{ \
++m_RefCount; \
} \
\
void refRemove() \
{ \
--m_RefCount; \
if (!m_RefCount) \
delete this; \
} \
\
virtual TReturn callback(NLMISC_CALLBACK_ARGS_DECL) = 0; \
\
virtual bool equals(const CCallbackBase *callbackBase) = 0; \
\
/* disable copy */ \
CCallbackBase(const CCallbackBase &); \
CCallbackBase &operator=(const CCallbackBase &); \
\
private: \
uint m_RefCount; \
}; \
\
typedef TReturn TCallbackFunction(NLMISC_CALLBACK_ARGS_DECL); \
class CCallbackFunction : public CCallbackBase \
{ \
public: \
CCallbackFunction(TCallbackFunction *callbackFunction) : m_CallbackFunction(callbackFunction) \
{ \
nlassert(m_CallbackFunction); \
} \
\
virtual ~CCallbackFunction() \
{ \
m_CallbackFunction = NULL; \
} \
\
virtual TReturn callback(NLMISC_CALLBACK_ARGS_DECL) \
{ \
return m_CallbackFunction(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
virtual bool equals(const CCallbackBase *callbackBase) \
{ \
const CCallbackFunction *callbackFunction = \
dynamic_cast<const CCallbackFunction *>(callbackBase); \
if (!callbackFunction) return false; \
return m_CallbackFunction == callbackFunction->m_CallbackFunction; \
} \
\
private: \
TCallbackFunction *m_CallbackFunction; \
}; \
\
template<typename TClass> \
class CCallbackMethod : public CCallbackBase \
{ \
typedef TReturn (TClass::*TCallbackMethod)(NLMISC_CALLBACK_ARGS_DECL); \
public: \
CCallbackMethod(TClass *callbackObject, TCallbackMethod callbackMethod) : m_CallbackObject(callbackObject), m_CallbackMethod(callbackMethod) \
{ \
nlassert(m_CallbackObject); \
nlassert(m_CallbackMethod); \
} \
\
virtual ~CCallbackMethod() \
{ \
m_CallbackObject = NULL; \
m_CallbackMethod = NULL; \
} \
\
virtual TReturn callback(NLMISC_CALLBACK_ARGS_DECL) \
{ \
return (m_CallbackObject->*m_CallbackMethod)(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
virtual bool equals(const CCallbackBase *callbackBase) \
{ \
const CCallbackMethod *callbackMethod = \
dynamic_cast<const CCallbackMethod *>(callbackBase); \
if (!callbackMethod) return false; \
return m_CallbackObject == callbackMethod->m_CallbackObject \
&& m_CallbackMethod == callbackMethod->m_CallbackMethod; \
} \
\
private: \
TClass *m_CallbackObject; \
TCallbackMethod m_CallbackMethod; \
}; \
\
public: \
CCallback() : m_CallbackBase(NULL) \
{ \
\
} \
\
CCallback(TCallbackFunction *callbackFunction) : m_CallbackBase(new CCallbackFunction(callbackFunction)) \
{ \
nlassert(m_CallbackBase); \
m_CallbackBase->refAdd(); \
} \
\
template<typename TClass> \
CCallback(TClass *callbackObject, TReturn (TClass::*callbackMethod)(NLMISC_CALLBACK_ARGS_DECL)) : m_CallbackBase(new CCallbackMethod<TClass>(callbackObject, callbackMethod)) \
{ \
nlassert(m_CallbackBase); \
m_CallbackBase->refAdd(); \
} \
\
CCallback(const CCallback &callback) \
{ \
m_CallbackBase = callback.m_CallbackBase; \
if (m_CallbackBase) \
m_CallbackBase->refAdd(); \
} \
\
CCallback &operator=(const CCallback &callback) \
{ \
if (m_CallbackBase != callback.m_CallbackBase) \
{ \
if (m_CallbackBase) \
m_CallbackBase->refRemove(); \
m_CallbackBase = callback.m_CallbackBase; \
if (m_CallbackBase) \
m_CallbackBase->refAdd(); \
} \
return *this; \
} \
\
~CCallback() \
{ \
if (m_CallbackBase) \
{ \
m_CallbackBase->refRemove(); \
m_CallbackBase = NULL; \
} \
} \
\
TReturn callback(NLMISC_CALLBACK_ARGS_DECL) \
{ \
nlassert(m_CallbackBase); \
return m_CallbackBase->callback(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
TReturn operator()(NLMISC_CALLBACK_ARGS_DECL) \
{ \
nlassert(m_CallbackBase); \
return m_CallbackBase->callback(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
bool valid() const \
{ \
return m_CallbackBase != NULL; \
} \
\
operator bool() const \
{ \
return m_CallbackBase != NULL; \
} \
\
bool operator==(const CCallback &callback) \
{ \
return m_CallbackBase->equals(callback.m_CallbackBase); \
} \
\
private: \
CCallbackBase *m_CallbackBase; \
\
}; /* class CCallback */ \
template<typename TReturn, typename TArgsA = void, typename TArgsB = void, typename TArgsC = void, typename TArgsD = void, typename TArgsE = void, typename TArgsF = void, typename TArgsG = void, typename TDummy = void>
class CCallback;
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, void, void, void, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME
#define NLMISC_CALLBACK_ARGS_DECL
#define NLMISC_CALLBACK_ARGS_IMPL
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, void, void, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA
#define NLMISC_CALLBACK_ARGS_IMPL argsA
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, void, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, TArgsF, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE, typename TArgsF
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE, TArgsF argsF
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE, argsF
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, TArgsF, TArgsG, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE, typename TArgsF, typename TArgsG
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE, TArgsF argsF, TArgsG argsG
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE, argsF, argsG
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#undef NLMISC_CALLBACK_ARGS_CLASSNAME
#undef NLMISC_CALLBACK_TEMPLATE
} /* namespace NLMISC */
#endif /* #ifndef NLMISC_CALLBACK_H */
/* end of file */

@ -1,3 +1,4 @@
ADD_SUBDIRECTORY(callback)
ADD_SUBDIRECTORY(command) ADD_SUBDIRECTORY(command)
ADD_SUBDIRECTORY(configfile) ADD_SUBDIRECTORY(configfile)
ADD_SUBDIRECTORY(debug) ADD_SUBDIRECTORY(debug)

@ -0,0 +1,9 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(nl_sample_callback ${SRC})
TARGET_LINK_LIBRARIES(nl_sample_callback nelmisc)
NL_DEFAULT_PROPS(nl_sample_callback "NeL, Samples, Misc: Callback")
NL_ADD_RUNTIME_FLAGS(nl_sample_callback)
INSTALL(TARGETS nl_sample_callback RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samplesmisc)

@ -0,0 +1,62 @@
/*
Copyright (c) 2014, Jan BOON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <nel/misc/callback.h>
#include <nel/misc/debug.h>
class CTestClass
{
public:
void helloWorld(int y)
{
nldebug("Method call: %i, %i", y, x);
}
int x;
};
void functionCall(int i)
{
nldebug("Function call: %i", i);
}
typedef NLMISC::CCallback<void, int> TCallbackType;
int main(int argc, char **argv)
{
CTestClass tc;
tc.x = 42;
TCallbackType cbMethod = TCallbackType(&tc, &CTestClass::helloWorld);
TCallbackType cbFunction = TCallbackType(functionCall);
cbMethod(100);
cbFunction(99);
getchar();
return EXIT_SUCCESS;
}

@ -463,6 +463,7 @@ bool CDriverGL::unInit()
{ {
nlwarning("Can't unregister NLClass"); nlwarning("Can't unregister NLClass");
} }
_Registered = 0;
// Restaure monitor color parameters // Restaure monitor color parameters
if (_NeedToRestaureGammaRamp) if (_NeedToRestaureGammaRamp)
@ -626,9 +627,11 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
// Offscreen mode ? // Offscreen mode ?
if (_CurrentMode.OffScreen) if (_CurrentMode.OffScreen)
{ {
#if 0
if (!createWindow(mode)) if (!createWindow(mode))
return false; return false;
HWND tmpHWND = _win;
int width = mode.Width;
int height = mode.Height;
// resize the window // resize the window
RECT rc; RECT rc;
@ -907,7 +910,6 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_hDC = NULL; _hDC = NULL;
return false; return false;
} }
#endif
} }
else else
{ {
@ -1436,8 +1438,17 @@ bool CDriverGL::createWindow(const GfxMode &mode)
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// create the OpenGL window // create the OpenGL window
window = CreateWindowW(L"NLClass", L"NeL Window", WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, DWORD dwStyle = WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
CW_USEDEFAULT, CW_USEDEFAULT, mode.Width, mode.Height, HWND_DESKTOP, NULL, GetModuleHandle(NULL), NULL); int pos = CW_USEDEFAULT;
HWND hwndParent = HWND_DESKTOP;
if (mode.OffScreen)
{
dwStyle &= ~WS_VISIBLE;
pos = 0;
hwndParent = NULL;
}
window = CreateWindowW(L"NLClass", L"NeL Window", dwStyle,
pos, pos, mode.Width, mode.Height, hwndParent, NULL, GetModuleHandle(NULL), NULL);
if (window == EmptyWindow) if (window == EmptyWindow)
{ {
@ -1851,6 +1862,9 @@ bool CDriverGL::setMode(const GfxMode& mode)
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
// save relative cursor // save relative cursor
POINT cursorPos; POINT cursorPos;
cursorPos.x = 0;
cursorPos.y = 0;
BOOL cursorPosOk = isSystemCursorInClientArea() BOOL cursorPosOk = isSystemCursorInClientArea()
&& GetCursorPos(&cursorPos) && GetCursorPos(&cursorPos)
&& ScreenToClient(_win, &cursorPos); && ScreenToClient(_win, &cursorPos);

@ -148,7 +148,7 @@ CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_PP(NULL), m_VP(NULL),
m_QuadUV.V2 = CVector(1.f, 1.f, 0.5f); m_QuadUV.V2 = CVector(1.f, 1.f, 0.5f);
m_QuadUV.V3 = CVector(0.f, 1.f, 0.5f); m_QuadUV.V3 = CVector(0.f, 1.f, 0.5f);
if (drv->textureCoordinateAlternativeMode()) /*if (drv->textureCoordinateAlternativeMode())
{ {
m_QuadUV.Uv0 = CUV(0.f, 1.f); m_QuadUV.Uv0 = CUV(0.f, 1.f);
m_QuadUV.Uv1 = CUV(1.f, 1.f); m_QuadUV.Uv1 = CUV(1.f, 1.f);
@ -156,12 +156,12 @@ CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_PP(NULL), m_VP(NULL),
m_QuadUV.Uv3 = CUV(0.f, 0.f); m_QuadUV.Uv3 = CUV(0.f, 0.f);
} }
else else
{ {*/
m_QuadUV.Uv0 = CUV(0.f, 0.f); m_QuadUV.Uv0 = CUV(0.f, 0.f);
m_QuadUV.Uv1 = CUV(1.f, 0.f); m_QuadUV.Uv1 = CUV(1.f, 0.f);
m_QuadUV.Uv2 = CUV(1.f, 1.f); m_QuadUV.Uv2 = CUV(1.f, 1.f);
m_QuadUV.Uv3 = CUV(0.f, 1.f); m_QuadUV.Uv3 = CUV(0.f, 1.f);
} /*}*/
/*CVertexBuffer &vb = m_VB; /*CVertexBuffer &vb = m_VB;
vb.clearValueEx(); vb.clearValueEx();

@ -40,6 +40,7 @@ CTextContext::CTextContext()
_ScaleZ = 1.0f; _ScaleZ = 1.0f;
_Shaded = false; _Shaded = false;
_ShadeOutline = false;
_ShadeExtent = 0.001f; _ShadeExtent = 0.001f;
_ShadeColor = NLMISC::CRGBA(0,0,0); _ShadeColor = NLMISC::CRGBA(0,0,0);

@ -148,6 +148,18 @@ bool CTextContextUser::getShaded() const
return _TextContext.getShaded(); return _TextContext.getShaded();
} }
void CTextContextUser::setShadeOutline(bool b)
{
H_AUTO2;
_TextContext.setShadeOutline(b);
}
bool CTextContextUser::getShadeOutline() const
{
H_AUTO2;
return _TextContext.getShadeOutline();
}
void CTextContextUser::setShadeExtent(float shext) void CTextContextUser::setShadeExtent(float shext)
{ {
H_AUTO2; H_AUTO2;

@ -23,6 +23,7 @@
#include "nel/gui/group_container_base.h" #include "nel/gui/group_container_base.h"
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
#include "nel/gui/interface_factory.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
using namespace std; using namespace std;
@ -66,8 +67,6 @@ namespace NLGUI
{ {
if( _ViewText != NULL ) if( _ViewText != NULL )
{ {
if( _Parent != NULL )
_Parent->delView( _ViewText, true );
delete _ViewText; delete _ViewText;
_ViewText = NULL; _ViewText = NULL;
} }
@ -569,6 +568,7 @@ namespace NLGUI
((CViewTextID*)_ViewText)->parseTextIdOptions(cur); ((CViewTextID*)_ViewText)->parseTextIdOptions(cur);
// Same RenderLayer as us. // Same RenderLayer as us.
_ViewText->setRenderLayer(getRenderLayer()); _ViewText->setRenderLayer(getRenderLayer());
_ViewText->setParentElm(this);
// Parse the hardText (if not text id) // Parse the hardText (if not text id)
if(!_IsViewTextId) if(!_IsViewTextId)
{ {
@ -863,6 +863,8 @@ namespace NLGUI
} }
if(getFrozen() && getFrozenHalfTone()) if(getFrozen() && getFrozenHalfTone())
_ViewText->setAlpha(_ViewText->getAlpha()>>2); _ViewText->setAlpha(_ViewText->getAlpha()>>2);
_ViewText->draw();
} }
} }
@ -873,6 +875,9 @@ namespace NLGUI
// Should have been setuped with addCtrl // Should have been setuped with addCtrl
nlassert(_Setuped); nlassert(_Setuped);
if( _Name == "==MARKED==" )
bool marked = true;
// Compute Size according to bitmap and Text. // Compute Size according to bitmap and Text.
if (!(_SizeRef & 1)) if (!(_SizeRef & 1))
{ {
@ -886,6 +891,8 @@ namespace NLGUI
} }
CViewBase::updateCoords(); CViewBase::updateCoords();
_ViewText->updateCoords();
} }
// *************************************************************************** // ***************************************************************************
@ -901,7 +908,7 @@ namespace NLGUI
if( _ViewText == NULL ) if( _ViewText == NULL )
{ {
CViewBase *v = CWidgetManager::getInstance()->getParser()->createClass( "text" ); CViewBase *v = CInterfaceFactory::createClass( "text" );
nlassert( v != NULL ); nlassert( v != NULL );
_ViewText = dynamic_cast< CViewText* >( v ); _ViewText = dynamic_cast< CViewText* >( v );
_ViewText->setId( _Id + "_text" ); _ViewText->setId( _Id + "_text" );
@ -910,15 +917,13 @@ namespace NLGUI
} }
// setup the viewText and add to parent // setup the viewText and add to parent
_ViewText->setParent (getParent()); _ViewText->setParentElm (this);
_ViewText->setParentPos (this); _ViewText->setParentPos (this);
_ViewText->setParentPosRef (_TextParentPosRef); _ViewText->setParentPosRef (_TextParentPosRef);
_ViewText->setPosRef (_TextPosRef); _ViewText->setPosRef (_TextPosRef);
_ViewText->setActive(_Active); _ViewText->setActive(_Active);
_ViewText->setX(_TextX); _ViewText->setX(_TextX);
_ViewText->setY(_TextY); _ViewText->setY(_TextY);
getParent()->addView(_ViewText);
} }
// *************************************************************************** // ***************************************************************************
@ -1007,17 +1012,18 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CCtrlTextButton::onRemoved() void CCtrlTextButton::onRemoved()
{ {
if( _ViewText != NULL )
{
if( _Parent != NULL )
_Parent->delView( _ViewText, true );
}
} }
void CCtrlTextButton::onWidgetDeleted( CInterfaceElement *e ) void CCtrlTextButton::onWidgetDeleted( CInterfaceElement *e )
{ {
if( e == _ViewText ) }
_ViewText = NULL;
void CCtrlTextButton::moveBy( sint32 x, sint32 y )
{
CInterfaceElement::moveBy( x, y );
if( _ViewText != NULL )
_ViewText->updateCoords();
} }
} }

@ -2373,7 +2373,7 @@ namespace NLGUI
{ {
setMaxH(_PopupMaxH); setMaxH(_PopupMaxH);
// _W is given by scripter-man // _W is given by scripter-man
newH = pLayer->H_T; newH = (pLayer->H_T - pLayer->InsetT);
} }
else else
{ {
@ -2382,7 +2382,7 @@ namespace NLGUI
_W = _Parent->getW(); _W = _Parent->getW();
} }
setMaxH (16384); // No scrollbar for container of layer > 0 setMaxH (16384); // No scrollbar for container of layer > 0
newH = pLayer->H_T; newH = (pLayer->H_T - pLayer->InsetT);
} }
if (_Opened) if (_Opened)
@ -2396,11 +2396,11 @@ namespace NLGUI
_HeaderOpened->setY (- newH); _HeaderOpened->setY (- newH);
_HeaderOpened->setW (_W-(pLayer->W_L+pLayer->W_R)); _HeaderOpened->setW (_W-(pLayer->W_L+pLayer->W_R));
_HeaderOpened->updateCoords(); _HeaderOpened->updateCoords();
newH += max (_HeaderOpened->getHReal(), pLayer->getValSInt32 ("header_h")); newH += max (_HeaderOpened->getHReal(), pLayer->HeaderH);
} }
else else
{ {
newH += pLayer->getValSInt32 ("header_h"); newH += pLayer->HeaderH;
} }
newH -= (sint32) _ContentYOffset; newH -= (sint32) _ContentYOffset;
@ -2448,12 +2448,12 @@ namespace NLGUI
if (_LayerSetup == 0) if (_LayerSetup == 0)
{ {
// zeH is the height to substract to total height of the container to obtain height of the list // zeH is the height to substract to total height of the container to obtain height of the list
sint32 zeH = pLayer->H_T + pLayer->H_B_Open + pLayer->H_EM_Open; sint32 zeH = (pLayer->H_T - pLayer->InsetT) + pLayer->H_B_Open + pLayer->H_EM_Open;
if (_HeaderOpened != NULL) if (_HeaderOpened != NULL)
zeH += max (_HeaderOpened->getHReal(), pLayer->getValSInt32 ("header_h")); zeH += max (_HeaderOpened->getHReal(), pLayer->HeaderH);
else else
zeH += pLayer->getValSInt32 ("header_h"); zeH += pLayer->HeaderH;
if (_Content != NULL) if (_Content != NULL)
zeH += _Content->getHReal(); zeH += _Content->getHReal();
@ -2513,11 +2513,11 @@ namespace NLGUI
_HeaderClosed->setY (-newH); _HeaderClosed->setY (-newH);
_HeaderClosed->setW (_W-(pLayer->W_L+pLayer->W_R)); _HeaderClosed->setW (_W-(pLayer->W_L+pLayer->W_R));
_HeaderClosed->updateCoords(); _HeaderClosed->updateCoords();
newH += max (_HeaderClosed->getHReal(), pLayer->getValSInt32 ("header_h")); newH += max (_HeaderClosed->getHReal(), pLayer->HeaderH);
} }
else else
{ {
newH += pLayer->getValSInt32 ("header_h"); newH += pLayer->HeaderH;
} }
newH += pLayer->H_B; newH += pLayer->H_B;
@ -2731,7 +2731,8 @@ namespace NLGUI
// h is the size of what is on top of the child list // h is the size of what is on top of the child list
sint32 x, y, w, h; sint32 x, y, w, h;
h = pLayer->H_T + pLayer->H_B_Open; bool bHasChild = (_List->getNbElement() > 0);
h = (pLayer->H_T - pLayer->InsetT) + (((!_Opened) || (!bHasChild)) ? pLayer->H_B : pLayer->H_B_Open);
if (_Opened) if (_Opened)
{ {
@ -2749,7 +2750,6 @@ namespace NLGUI
{ {
h = _HReal; h = _HReal;
} }
bool bHasChild = (_List->getNbElement() > 0);
x = _XReal; x = _XReal;
y = _YReal+_HReal-h; y = _YReal+_HReal-h;
@ -2767,7 +2767,7 @@ namespace NLGUI
// Top Right // Top Right
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_TR, y+h-pLayer->H_TR, pLayer->W_TR, pLayer->H_TR, 0, false, pLayer->TxId_TR, col); rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_TR, y+h-pLayer->H_TR, pLayer->W_TR, pLayer->H_TR, 0, false, pLayer->TxId_TR, col);
if ((!_Opened) || (_Opened && !bHasChild)) if ((!_Opened) || (!bHasChild))
{ // Not opened { // Not opened
// Left // Left
if (pLayer->Tile_L == 0) // Tiling ? if (pLayer->Tile_L == 0) // Tiling ?
@ -2817,9 +2817,9 @@ namespace NLGUI
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_BR_Open, y, pLayer->W_BR_Open, pLayer->H_BR_Open, 0, false, pLayer->TxId_BR_Open, col); rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_BR_Open, y, pLayer->W_BR_Open, pLayer->H_BR_Open, 0, false, pLayer->TxId_BR_Open, col);
// Content // Content
if (pLayer->Tile_Blank == 0) // Tiling ? if (pLayer->Tile_Blank == 0) // Tiling ?
rVR.drawRotFlipBitmap (rl, x+pLayer->W_L, y+pLayer->H_B, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, col); rVR.drawRotFlipBitmap (rl, x+pLayer->W_L, y+pLayer->H_B_Open, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, col);
else else
rVR.drawRotFlipBitmapTiled (rl, x+pLayer->W_L, y+pLayer->H_B, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, pLayer->Tile_Blank-1, col); rVR.drawRotFlipBitmapTiled (rl, x+pLayer->W_L, y+pLayer->H_B_Open, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, pLayer->Tile_Blank-1, col);
// ScrollBar Placement // ScrollBar Placement
if (pLayer->Tile_M_Open == 0) // Tiling ? if (pLayer->Tile_M_Open == 0) // Tiling ?
rVR.drawRotFlipBitmap (rl, x, _YReal+pLayer->H_EL_Open, pLayer->W_M_Open, _HReal-h-pLayer->H_EL_Open, 0, false, pLayer->TxId_M_Open, col); rVR.drawRotFlipBitmap (rl, x, _YReal+pLayer->H_EL_Open, pLayer->W_M_Open, _HReal-h-pLayer->H_EL_Open, 0, false, pLayer->TxId_M_Open, col);
@ -2848,7 +2848,7 @@ namespace NLGUI
// Top Right // Top Right
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_TR, y+h-pLayer->H_TR, pLayer->W_TR, pLayer->H_TR, 0, false, pLayer->TxId_TR, col); rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_TR, y+h-pLayer->H_TR, pLayer->W_TR, pLayer->H_TR, 0, false, pLayer->TxId_TR, col);
if ((!_Opened) || (_Opened && !bHasChild)) if ((!_Opened) || (!bHasChild))
{ {
// Left // Left
if (pLayer->Tile_L == 0) // Tiling ? if (pLayer->Tile_L == 0) // Tiling ?
@ -2856,7 +2856,7 @@ namespace NLGUI
else else
rVR.drawRotFlipBitmapTiled (rl, x, y+pLayer->H_BL, pLayer->W_L, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_L, pLayer->Tile_L-1, col); rVR.drawRotFlipBitmapTiled (rl, x, y+pLayer->H_BL, pLayer->W_L, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_L, pLayer->Tile_L-1, col);
// Right // Right
if (pLayer->Tile_T == 0) // Tiling ? if (pLayer->Tile_R == 0) // Tiling ?
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_R, y+pLayer->H_BR, pLayer->W_R, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_R, col); rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_R, y+pLayer->H_BR, pLayer->W_R, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_R, col);
else else
rVR.drawRotFlipBitmapTiled (rl, x+w-pLayer->W_R, y+pLayer->H_BR, pLayer->W_R, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_R, pLayer->Tile_R-1, col); rVR.drawRotFlipBitmapTiled (rl, x+w-pLayer->W_R, y+pLayer->H_BR, pLayer->W_R, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_R, pLayer->Tile_R-1, col);
@ -3003,18 +3003,16 @@ namespace NLGUI
col.A = nInverted; col.A = nInverted;
else else
col.A = max(_HighLightedAlpha, nInverted); col.A = max(_HighLightedAlpha, nInverted);
sint32 hw, hh; // size of highlight texture
rVR.getTextureSizeFromId(pLayer->TxId_TL_HighLight, hw, hh);
// corners // corners
rVR.drawRotFlipBitmap (_RenderLayer, x, y + h - hh, hw, hh, 0, false, pLayer->TxId_TL_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x, y + h - pLayer->H_T_HighLight, pLayer->W_TL_HighLight, pLayer->H_TL_HighLight, 0, false, pLayer->TxId_TL_HighLight, col);
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - hw, y + h - hh, hw, hh, 0, false, pLayer->TxId_TR_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - pLayer->W_TR_HighLight, y + h - pLayer->H_T_HighLight, pLayer->W_TR_HighLight, pLayer->H_TR_HighLight, 0, false, pLayer->TxId_TR_HighLight, col);
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal, hw, hh, 0, false, pLayer->TxId_BL_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal, pLayer->W_BL_HighLight, pLayer->H_BL_HighLight, 0, false, pLayer->TxId_BL_HighLight, col);
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - hw, _YReal, hw, hh, 0, false, pLayer->TxId_BR_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - pLayer->W_BR_HighLight, _YReal, pLayer->W_BR_HighLight, pLayer->H_BR_HighLight, 0, false, pLayer->TxId_BR_HighLight, col);
// border // border
rVR.drawRotFlipBitmap (_RenderLayer, x + hw, y + h - hh, _WReal - 2 * hw, hh, 0, false, pLayer->TxId_T_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x + pLayer->W_TL_HighLight, y + h - pLayer->H_T_HighLight, _WReal - pLayer->W_TL_HighLight - pLayer->W_TR_HighLight, pLayer->H_T_HighLight, 0, false, pLayer->TxId_T_HighLight, col);
rVR.drawRotFlipBitmap (_RenderLayer, x + hw, _YReal, _WReal - 2 * hw, hh, 0, false, pLayer->TxId_B_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x + pLayer->W_BL_HighLight, _YReal, _WReal - pLayer->W_BL_HighLight - pLayer->W_BR_HighLight, pLayer->H_B_HighLight, 0, false, pLayer->TxId_B_HighLight, col);
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal + hh, hw, _HReal - 2 * hh, 0, false, pLayer->TxId_L_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal + pLayer->H_B_HighLight, pLayer->W_L_HighLight, _HReal - pLayer->H_T_HighLight - pLayer->H_B_HighLight, 0, false, pLayer->TxId_L_HighLight, col);
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - hw, _YReal + hh, hw, _HReal - 2 * hh, 0, false, pLayer->TxId_R_HighLight, col); rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - pLayer->W_R_HighLight, _YReal + pLayer->H_B_HighLight, pLayer->W_R_HighLight, _HReal - pLayer->H_T_HighLight - pLayer->H_B_HighLight, 0, false, pLayer->TxId_R_HighLight, col);
} }
@ -3715,6 +3713,7 @@ namespace NLGUI
_TitleOpened->setParentPosRef (Hotspot_TL); _TitleOpened->setParentPosRef (Hotspot_TL);
_TitleOpened->setPosRef (Hotspot_TL); _TitleOpened->setPosRef (Hotspot_TL);
_TitleOpened->setShadow (true); _TitleOpened->setShadow (true);
_TitleOpened->setShadowOutline (false);
_TitleOpened->setColor (CRGBA(255,255,255,255)); _TitleOpened->setColor (CRGBA(255,255,255,255));
_TitleOpened->setModulateGlobalColor(getModulateGlobalColor()); _TitleOpened->setModulateGlobalColor(getModulateGlobalColor());
_TitleOpened->setOverExtendViewText(_TitleOverExtendViewText); _TitleOpened->setOverExtendViewText(_TitleOverExtendViewText);
@ -3766,6 +3765,7 @@ namespace NLGUI
_TitleClosed->setParentPosRef (Hotspot_TL); _TitleClosed->setParentPosRef (Hotspot_TL);
_TitleClosed->setPosRef (Hotspot_TL); _TitleClosed->setPosRef (Hotspot_TL);
_TitleClosed->setShadow (true); _TitleClosed->setShadow (true);
_TitleClosed->setShadowOutline (false);
_TitleClosed->setColor (CRGBA(255,255,255,255)); _TitleClosed->setColor (CRGBA(255,255,255,255));
_TitleClosed->setModulateGlobalColor(getModulateGlobalColor()); _TitleClosed->setModulateGlobalColor(getModulateGlobalColor());
_TitleClosed->setOverExtendViewText(_TitleOverExtendViewText); _TitleClosed->setOverExtendViewText(_TitleOverExtendViewText);

@ -27,7 +27,7 @@
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
#include "nel/gui/view_renderer.h" #include "nel/gui/view_renderer.h"
#include "nel/gui/db_manager.h" #include "nel/gui/db_manager.h"
#include <limits> #include "nel/gui/interface_factory.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -1320,6 +1320,16 @@ namespace NLGUI
} }
} }
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen)
{
_SelectingText = false;
if (_SelectCursorPos == _CursorPos)
_CurrSelection = NULL;
return true;
}
if (!isIn(eventDesc.getX(), eventDesc.getY())) if (!isIn(eventDesc.getX(), eventDesc.getY()))
return false; return false;
@ -1329,6 +1339,7 @@ namespace NLGUI
_SelectingText = true; _SelectingText = true;
stopParentBlink(); stopParentBlink();
CWidgetManager::getInstance()->setCaptureKeyboard (this); CWidgetManager::getInstance()->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCapturePointerLeft (this);
// set the right cursor position // set the right cursor position
uint newCurPos; uint newCurPos;
bool cursorAtPreviousLineEnd; bool cursorAtPreviousLineEnd;
@ -1356,16 +1367,6 @@ namespace NLGUI
return true; return true;
} }
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen)
{
_SelectingText = false;
if (_SelectCursorPos == _CursorPos)
_CurrSelection = NULL;
return true;
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown) if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown)
{ {
CWidgetManager::getInstance()->setCapturePointerRight(this); CWidgetManager::getInstance()->setCapturePointerRight(this);
@ -1542,7 +1543,7 @@ namespace NLGUI
if( editorMode ) if( editorMode )
{ {
nlwarning( "Trying to create a new 'edit_text' for %s", getId().c_str() ); nlwarning( "Trying to create a new 'edit_text' for %s", getId().c_str() );
_ViewText = dynamic_cast< CViewText* >( CWidgetManager::getInstance()->getParser()->createClass( "text" ) ); _ViewText = dynamic_cast< CViewText* >( CInterfaceFactory::createClass( "text" ) );
if( _ViewText != NULL ) if( _ViewText != NULL )
{ {
_ViewText->setParent( this ); _ViewText->setParent( this );

@ -1289,16 +1289,19 @@ namespace NLGUI
string name; string name;
ucstring ucValue; ucstring ucValue;
uint size = 120; uint size = 120;
uint maxlength = 1024;
if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME]) if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME])
name = value[MY_HTML_INPUT_NAME]; name = value[MY_HTML_INPUT_NAME];
if (present[MY_HTML_INPUT_SIZE] && value[MY_HTML_INPUT_SIZE]) if (present[MY_HTML_INPUT_SIZE] && value[MY_HTML_INPUT_SIZE])
fromString(value[MY_HTML_INPUT_SIZE], size); fromString(value[MY_HTML_INPUT_SIZE], size);
if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE]) if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE])
ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]); ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]);
if (present[MY_HTML_INPUT_MAXLENGTH] && value[MY_HTML_INPUT_MAXLENGTH])
fromString(value[MY_HTML_INPUT_MAXLENGTH], maxlength);
string textTemplate(!templateName.empty() ? templateName : DefaultFormTextGroup); string textTemplate(!templateName.empty() ? templateName : DefaultFormTextGroup);
// Add the editbox // Add the editbox
CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue); CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue, maxlength);
if (textArea) if (textArea)
{ {
// Add the text area to the form // Add the text area to the form
@ -1450,6 +1453,8 @@ namespace NLGUI
getPercentage (table->ForceWidthMin, table->TableRatio, value[MY_HTML_TABLE_WIDTH]); getPercentage (table->ForceWidthMin, table->TableRatio, value[MY_HTML_TABLE_WIDTH]);
if (present[MY_HTML_TABLE_BORDER] && value[MY_HTML_TABLE_BORDER]) if (present[MY_HTML_TABLE_BORDER] && value[MY_HTML_TABLE_BORDER])
fromString(value[MY_HTML_TABLE_BORDER], table->Border); fromString(value[MY_HTML_TABLE_BORDER], table->Border);
if (present[MY_HTML_TABLE_BORDERCOLOR] && value[MY_HTML_TABLE_BORDERCOLOR])
table->BorderColor = getColor (value[MY_HTML_TABLE_BORDERCOLOR]);
if (present[MY_HTML_TABLE_CELLSPACING] && value[MY_HTML_TABLE_CELLSPACING]) if (present[MY_HTML_TABLE_CELLSPACING] && value[MY_HTML_TABLE_CELLSPACING])
fromString(value[MY_HTML_TABLE_CELLSPACING], table->CellSpacing); fromString(value[MY_HTML_TABLE_CELLSPACING], table->CellSpacing);
if (present[MY_HTML_TABLE_CELLPADDING] && value[MY_HTML_TABLE_CELLPADDING]) if (present[MY_HTML_TABLE_CELLPADDING] && value[MY_HTML_TABLE_CELLPADDING])
@ -1514,11 +1519,19 @@ namespace NLGUI
} }
} }
} }
if (present[MY_HTML_TD_COLSPAN] && value[MY_HTML_TD_COLSPAN])
fromString(value[MY_HTML_TD_COLSPAN], _Cells.back()->ColSpan);
if (present[MY_HTML_TD_ROWSPAN] && value[MY_HTML_TD_ROWSPAN])
fromString(value[MY_HTML_TD_ROWSPAN], _Cells.back()->RowSpan);
_Cells.back()->BgColor = _CellParams.back().BgColor; _Cells.back()->BgColor = _CellParams.back().BgColor;
_Cells.back()->Align = _CellParams.back().Align; _Cells.back()->Align = _CellParams.back().Align;
_Cells.back()->VAlign = _CellParams.back().VAlign; _Cells.back()->VAlign = _CellParams.back().VAlign;
_Cells.back()->LeftMargin = _CellParams.back().LeftMargin; _Cells.back()->LeftMargin = _CellParams.back().LeftMargin;
_Cells.back()->NoWrap = _CellParams.back().NoWrap; _Cells.back()->NoWrap = _CellParams.back().NoWrap;
_Cells.back()->ColSpan = std::max(1, _Cells.back()->ColSpan);
_Cells.back()->RowSpan = std::max(1, _Cells.back()->RowSpan);
float temp; float temp;
if (present[MY_HTML_TD_WIDTH] && value[MY_HTML_TD_WIDTH]) if (present[MY_HTML_TD_WIDTH] && value[MY_HTML_TD_WIDTH])
@ -1553,12 +1566,15 @@ namespace NLGUI
_TextAreaRow = 1; _TextAreaRow = 1;
_TextAreaCols = 10; _TextAreaCols = 10;
_TextAreaContent = ""; _TextAreaContent = "";
if (present[HTML_TEXTAREA_NAME] && value[HTML_TEXTAREA_NAME]) _TextAreaMaxLength = 1024;
_TextAreaName = value[HTML_TEXTAREA_NAME]; if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME])
if (present[HTML_TEXTAREA_ROWS] && value[HTML_TEXTAREA_ROWS]) _TextAreaName = value[MY_HTML_TEXTAREA_NAME];
fromString(value[HTML_TEXTAREA_ROWS], _TextAreaRow); if (present[MY_HTML_TEXTAREA_ROWS] && value[MY_HTML_TEXTAREA_ROWS])
if (present[HTML_TEXTAREA_COLS] && value[HTML_TEXTAREA_COLS]) fromString(value[MY_HTML_TEXTAREA_ROWS], _TextAreaRow);
fromString(value[HTML_TEXTAREA_COLS], _TextAreaCols); if (present[MY_HTML_TEXTAREA_COLS] && value[MY_HTML_TEXTAREA_COLS])
fromString(value[MY_HTML_TEXTAREA_COLS], _TextAreaCols);
if (present[MY_HTML_TEXTAREA_MAXLENGTH] && value[MY_HTML_TEXTAREA_MAXLENGTH])
fromString(value[MY_HTML_TEXTAREA_MAXLENGTH], _TextAreaMaxLength);
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
_TextArea = true; _TextArea = true;
@ -1675,21 +1691,19 @@ namespace NLGUI
break; break;
case HTML_TEXTAREA: case HTML_TEXTAREA:
{ {
// Add the editbox _TextArea = false;
// nlinfo("textarea temp '%s'", _TextAreaTemplate.c_str()); if (!(_Forms.empty()))
// nlinfo("textarea name '%s'", _TextAreaName.c_str());
// nlinfo("textarea %d %d", _TextAreaRow, _TextAreaCols);
// nlinfo("textarea content '%s'", _TextAreaContent.toUtf8().c_str());
CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent);
if (textArea)
{ {
// Add the text area to the form CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength);
CGroupHTML::CForm::CEntry entry; if (textArea)
entry.Name = _TextAreaName; {
entry.TextArea = textArea; // Add the text area to the form
_Forms.back().Entries.push_back (entry); CGroupHTML::CForm::CEntry entry;
entry.Name = _TextAreaName;
entry.TextArea = textArea;
_Forms.back().Entries.push_back (entry);
}
} }
_TextArea = false;
} }
break; break;
case HTML_TITLE: case HTML_TITLE:
@ -3149,116 +3163,62 @@ namespace NLGUI
void CGroupHTML::addImage(const char *img, bool globalColor, bool reloadImg) void CGroupHTML::addImage(const char *img, bool globalColor, bool reloadImg)
{ {
// In a paragraph ? // In a paragraph ?
if (_Paragraph) if (!_Paragraph)
{ {
string finalUrl; newParagraph (0);
paragraphChange ();
}
string finalUrl;
// No more text in this text view
_CurrentViewLink = NULL;
// Not added ?
CViewBitmap *newImage = new CViewBitmap (TCtorParam());
//
// 1/ try to load the image with the old system (local files in bnp)
//
string image = CFile::getPath(img) + CFile::getFilenameWithoutExtension(img) + ".tga";
if (lookupLocalFile (finalUrl, image.c_str(), false))
{
newImage->setRenderLayer(getRenderLayer()+1);
image = finalUrl;
}
else
{
// //
// 1/ try to load the image with the old system (local files in bnp) // 2/ if it doesn't work, try to load the image in cache
// //
string image = CFile::getPath(img) + CFile::getFilenameWithoutExtension(img) + ".tga"; image = localImageName(img);
if (lookupLocalFile (finalUrl, image.c_str(), false)) if (!reloadImg && lookupLocalFile (finalUrl, image.c_str(), false))
{ {
// No more text in this text view // don't display image that are not power of 2
_CurrentViewLink = NULL; uint32 w, h;
CBitmap::loadSize (image, w, h);
// Not added ? if (w == 0 || h == 0 || ((!NLMISC::isPowerOf2(w) || !NLMISC::isPowerOf2(h)) && !NL3D::CTextureFile::supportNonPowerOfTwoTextures()))
CViewBitmap *newImage = new CViewBitmap (TCtorParam()); image.clear();
/* todo link in image
if (getA())
{
newImage->Link = getLink();
newImage->setHTMLView (this);
}*/
newImage->setRenderLayer(getRenderLayer()+1);
newImage->setTexture (finalUrl);
newImage->setModulateGlobalColor(globalColor);
/* todo link in image
if (getA())
getParagraph()->addChildLink(newImage);
else*/
getParagraph()->addChild(newImage);
paragraphChange ();
} }
else else
{ {
// //
// 2/ if it doesn't work, try to load the image in cache // 3/ if it doesn't work, display a placeholder and ask to dl the image into the cache
// //
image = localImageName(img); image = "web_del.tga";
if (!reloadImg && lookupLocalFile (finalUrl, image.c_str(), false)) addImageDownload(img, newImage);
{
// No more text in this text view
_CurrentViewLink = NULL;
// Not added ?
CViewBitmap *newImage = new CViewBitmap (TCtorParam());
/* todo link in image
if (getA())
{
newImage->Link = getLink();
newImage->setHTMLView (this);
}*/
// don't display image that are not power of 2
uint32 w, h;
CBitmap::loadSize (image, w, h);
if (w == 0 || h == 0 || ((!NLMISC::isPowerOf2(w) || !NLMISC::isPowerOf2(h)) && !NL3D::CTextureFile::supportNonPowerOfTwoTextures()))
image.clear();
newImage->setTexture (image);
// newImage->setTexture (finalUrl);
newImage->setModulateGlobalColor(globalColor);
/* todo link in image
if (getA())
getParagraph()->addChildLink(newImage);
else*/
getParagraph()->addChild(newImage);
paragraphChange ();
}
else
{
//
// 3/ if it doesn't work, display a placeholder and ask to dl the image into the cache
//
image = "web_del.tga";
if (lookupLocalFile (finalUrl, image.c_str(), false))
{
// No more text in this text view
_CurrentViewLink = NULL;
// Not added ?
CViewBitmap *newImage = new CViewBitmap (TCtorParam());
/* todo link in image
if (getA())
{
newImage->Link = getLink();
newImage->setHTMLView (this);
}*/
newImage->setTexture (image);
// newImage->setTexture (finalUrl);
newImage->setModulateGlobalColor(globalColor);
addImageDownload(img, newImage);
/* todo link in image
if (getA())
getParagraph()->addChildLink(newImage);
else*/
getParagraph()->addChild(newImage);
paragraphChange ();
}
}
} }
} }
newImage->setTexture (image);
newImage->setModulateGlobalColor(globalColor);
getParagraph()->addChild(newImage);
paragraphChange ();
} }
// *************************************************************************** // ***************************************************************************
CInterfaceGroup *CGroupHTML::addTextArea(const std::string &templateName, const char *name, uint /* rows */, uint cols, bool multiLine, const ucstring &content) CInterfaceGroup *CGroupHTML::addTextArea(const std::string &templateName, const char *name, uint /* rows */, uint cols, bool multiLine, const ucstring &content, uint maxlength)
{ {
// In a paragraph ? // In a paragraph ?
if (!_Paragraph) if (!_Paragraph)
@ -3280,7 +3240,8 @@ namespace NLGUI
templateParams.push_back (std::pair<std::string,std::string> ("multiline", multiLine?"true":"false")); templateParams.push_back (std::pair<std::string,std::string> ("multiline", multiLine?"true":"false"));
templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false")); templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false"));
templateParams.push_back (std::pair<std::string,std::string> ("enter_recover_focus", "false")); templateParams.push_back (std::pair<std::string,std::string> ("enter_recover_focus", "false"));
templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", "1024")); if (maxlength > 0)
templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", toString(maxlength)));
CInterfaceGroup *textArea = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(), CInterfaceGroup *textArea = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(),
getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size()); getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());

@ -1203,6 +1203,7 @@ namespace NLGUI
pV->setColor (_GroupMenu->_Color); pV->setColor (_GroupMenu->_Color);
pV->setFontSize (_GroupMenu->_FontSize); pV->setFontSize (_GroupMenu->_FontSize);
pV->setShadow (_GroupMenu->_Shadow); pV->setShadow (_GroupMenu->_Shadow);
pV->setShadowOutline (_GroupMenu->_ShadowOutline);
pV->setCheckable(checkable); pV->setCheckable(checkable);
pV->setChecked(checked); pV->setChecked(checked);
pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor); pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor);
@ -1282,6 +1283,7 @@ namespace NLGUI
pV->setColor (_GroupMenu->_Color); pV->setColor (_GroupMenu->_Color);
pV->setFontSize (_GroupMenu->_FontSize); pV->setFontSize (_GroupMenu->_FontSize);
pV->setShadow (_GroupMenu->_Shadow); pV->setShadow (_GroupMenu->_Shadow);
pV->setShadowOutline (_GroupMenu->_ShadowOutline);
pV->setCheckable(checkable); pV->setCheckable(checkable);
pV->setChecked(checked); pV->setChecked(checked);
pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor); pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor);
@ -1922,6 +1924,7 @@ namespace NLGUI
_HighLightOver.set(128, 0, 0, 255); _HighLightOver.set(128, 0, 0, 255);
_FontSize = 12; _FontSize = 12;
_Shadow = false; _Shadow = false;
_ShadowOutline = false;
_ResizeFromChildH = _ResizeFromChildW = true; _ResizeFromChildH = _ResizeFromChildW = true;
_DisplayFrame = false; _DisplayFrame = false;
_RootMenu = NULL; _RootMenu = NULL;
@ -1998,6 +2001,11 @@ namespace NLGUI
return toString( _Shadow ); return toString( _Shadow );
} }
else else
if( name == "shadow_outline" )
{
return toString( _ShadowOutline );
}
else
if( name == "formatted" ) if( name == "formatted" )
{ {
return toString( _Formatted ); return toString( _Formatted );
@ -2110,6 +2118,14 @@ namespace NLGUI
return; return;
} }
else else
if( name == "shadow_outline" )
{
bool b;
if( fromString( value, b ) )
_ShadowOutline = b;
return;
}
else
if( name == "formatted" ) if( name == "formatted" )
{ {
bool b; bool b;
@ -2152,6 +2168,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "space", BAD_CAST toString( _Space ).c_str() ); xmlSetProp( node, BAD_CAST "space", BAD_CAST toString( _Space ).c_str() );
xmlSetProp( node, BAD_CAST "fontsize", BAD_CAST toString( _FontSize ).c_str() ); xmlSetProp( node, BAD_CAST "fontsize", BAD_CAST toString( _FontSize ).c_str() );
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() ); xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
xmlSetProp( node, BAD_CAST "formatted", BAD_CAST toString( _Formatted ).c_str() ); xmlSetProp( node, BAD_CAST "formatted", BAD_CAST toString( _Formatted ).c_str() );
if( _RootMenu == NULL ) if( _RootMenu == NULL )
@ -2197,6 +2214,7 @@ namespace NLGUI
_Color = gm->_Color; _Color = gm->_Color;
_ShadowColor = gm->_ShadowColor; _ShadowColor = gm->_ShadowColor;
_Shadow = gm->_Shadow; _Shadow = gm->_Shadow;
_ShadowOutline = gm->_ShadowOutline;
_FontSize = gm->_FontSize; _FontSize = gm->_FontSize;
_ColorOver = gm->_ColorOver; _ColorOver = gm->_ColorOver;
_ShadowColorOver = gm->_ShadowColorOver; _ShadowColorOver = gm->_ShadowColorOver;
@ -2266,6 +2284,10 @@ namespace NLGUI
if (prop) if (prop)
_Shadow = convertBool(prop); _Shadow = convertBool(prop);
prop = (char*) xmlGetProp( in, (xmlChar*)"shadow_outline" );
if (prop)
_ShadowOutline = convertBool(prop);
prop = (char*) xmlGetProp( in, (xmlChar*)"formatted" ); prop = (char*) xmlGetProp( in, (xmlChar*)"formatted" );
if (prop) if (prop)
_Formatted = convertBool(prop); _Formatted = convertBool(prop);

@ -44,9 +44,12 @@ namespace NLGUI
TableRatio = 0.f; TableRatio = 0.f;
WidthWanted = 0; WidthWanted = 0;
Height = 0; Height = 0;
ColSpan = 1;
RowSpan = 1;
TableColumnIndex = 0;
Group = new CInterfaceGroup(CViewBase::TCtorParam()); Group = new CInterfaceGroup(CViewBase::TCtorParam());
Align = Left; Align = Left;
VAlign = Top; VAlign = Middle;
LeftMargin = 0; LeftMargin = 0;
NoWrap = false; NoWrap = false;
IgnoreMaxWidth = false; IgnoreMaxWidth = false;
@ -249,6 +252,22 @@ namespace NLGUI
AddChildW = b; AddChildW = b;
return; return;
} }
else
if (name == "colspan" )
{
sint32 i;
if (fromString( value, i ) )
ColSpan = std::max(1, i);
return;
}
else
if (name == "rowspan" )
{
sint32 i;
if (fromString( value, i ) )
RowSpan = std::max(1, i);
return;
}
else else
CInterfaceGroup::setProperty( name, value ); CInterfaceGroup::setProperty( name, value );
} }
@ -310,6 +329,8 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "ignore_max_width", BAD_CAST toString( IgnoreMaxWidth ).c_str() ); xmlSetProp( node, BAD_CAST "ignore_max_width", BAD_CAST toString( IgnoreMaxWidth ).c_str() );
xmlSetProp( node, BAD_CAST "ignore_min_width", BAD_CAST toString( IgnoreMinWidth ).c_str() ); xmlSetProp( node, BAD_CAST "ignore_min_width", BAD_CAST toString( IgnoreMinWidth ).c_str() );
xmlSetProp( node, BAD_CAST "add_child_w", BAD_CAST toString( AddChildW ).c_str() ); xmlSetProp( node, BAD_CAST "add_child_w", BAD_CAST toString( AddChildW ).c_str() );
xmlSetProp( node, BAD_CAST "colspan", BAD_CAST toString( ColSpan ).c_str() );
xmlSetProp( node, BAD_CAST "rowspan", BAD_CAST toString( RowSpan ).c_str() );
return node; return node;
} }
@ -422,6 +443,22 @@ namespace NLGUI
{ {
AddChildW = convertBool(ptr); AddChildW = convertBool(ptr);
} }
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"colspan" );
if (ptr)
{
sint32 i;
if (fromString((const char*)ptr, i))
ColSpan = std::max(1, i);
}
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"rowspan" );
if (ptr)
{
sint32 i;
if (fromString((const char*)ptr, i))
RowSpan = std::max(1, i);
}
return true; return true;
} }
@ -499,6 +536,29 @@ namespace NLGUI
} }
} }
// Get the parent table
if (getParent ())
{
CGroupTable *table = static_cast<CGroupTable*> (getParent ());
if (table->Border) {
CRGBA lighter = blend(table->BorderColor, CRGBA::White, 0.5f);
CRGBA borderColorTL;
borderColorTL.modulateFromColor (lighter, CWidgetManager::getInstance()->getGlobalColor());
borderColorTL.A = (uint8) (((uint16) table->CurrentAlpha * (uint16) borderColorTL.A) >> 8);
CRGBA borderColorBR;
borderColorBR.modulateFromColor (table->BorderColor, CWidgetManager::getInstance()->getGlobalColor());
borderColorBR.A = (uint8) (((uint16) table->CurrentAlpha * (uint16) borderColorBR.A) >> 8);
CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, 1, 0, false, rVR.getBlankTextureId(), borderColorTL );
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, 1, _HReal, 0, false, rVR.getBlankTextureId(), borderColorBR );
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal+_HReal-1, _WReal, 1, 0, false, rVR.getBlankTextureId(), borderColorBR );
rVR.drawRotFlipBitmap (_RenderLayer, _XReal+_WReal-1, _YReal, 1, _HReal, 0, false, rVR.getBlankTextureId(), borderColorTL );
}
}
CInterfaceGroup::draw (); CInterfaceGroup::draw ();
} }
@ -559,8 +619,9 @@ namespace NLGUI
TableRatio = 0.f; TableRatio = 0.f;
ForceWidthMin = 0; ForceWidthMin = 0;
Border=0; Border=0;
CellPadding=0; BorderColor = CRGBA(32, 32, 32, 255);
CellSpacing=0; CellPadding=1;
CellSpacing=2;
ContinuousUpdate = false; ContinuousUpdate = false;
} }
@ -692,35 +753,75 @@ namespace NLGUI
// New cell ? // New cell ?
if (cell->NewLine) if (cell->NewLine)
{
while (column < _Columns.size())
{
if (_Columns[column].RowSpan > 1)
_Columns[column].RowSpan--;
column++;
}
column = 0; column = 0;
}
// Resize the array // Resize the array
if (column>=_Columns.size()) if (column>=_Columns.size())
_Columns.resize(column+1); _Columns.resize(column+1);
// Handle rowspan from previous row
while (_Columns[column].RowSpan > 1)
{
_Columns[column].RowSpan--;
column++;
// if previous row had less <TD> elements, then we missing columns
if (column>=_Columns.size())
_Columns.resize(column+1);
}
// remember column index for later use
cell->TableColumnIndex = column;
// new column, set rowspan from current <TD>
_Columns[column].RowSpan = cell->RowSpan;
float colspan = 1.f / cell->ColSpan;
float rowspan = 1.f / cell->RowSpan;
// Update sizes // Update sizes
if (cellWidth > _Columns[column].Width) if (cellWidth*colspan > _Columns[column].Width)
_Columns[column].Width = cellWidth; _Columns[column].Width = cellWidth*colspan;
if (cell->WidthMax > _Columns[column].WidthMax) if (cell->WidthMax*colspan > _Columns[column].WidthMax)
_Columns[column].WidthMax = cell->WidthMax; _Columns[column].WidthMax = cell->WidthMax*colspan;
if (cell->TableRatio > _Columns[column].TableRatio) if (cell->TableRatio*colspan > _Columns[column].TableRatio)
_Columns[column].TableRatio = cell->TableRatio; _Columns[column].TableRatio = cell->TableRatio*colspan;
if (cell->WidthWanted + additionnalWidth > _Columns[column].WidthWanted) if (cell->WidthWanted*colspan + additionnalWidth > _Columns[column].WidthWanted)
_Columns[column].WidthWanted = cell->WidthWanted + additionnalWidth; _Columns[column].WidthWanted = (sint32)(cell->WidthWanted*colspan) + additionnalWidth;
if (cell->Height > _Columns[column].Height)
_Columns[column].Height = cell->Height;
if (_Columns[column].WidthWanted + additionnalWidth) if (_Columns[column].WidthWanted + additionnalWidth)
_Columns[column].WidthMax = _Columns[column].WidthWanted + additionnalWidth; _Columns[column].WidthMax = _Columns[column].WidthWanted + additionnalWidth;
if (_Columns[column].WidthWanted > _Columns[column].Width) if (_Columns[column].WidthWanted > _Columns[column].Width)
_Columns[column].Width = _Columns[column].WidthWanted; _Columns[column].Width = _Columns[column].WidthWanted;
if (cell->ColSpan > 1) {
// copy this info to all spanned columns, create new columns as needed
uint newsize = column + cell->ColSpan - 1;
if (newsize >= _Columns.size())
_Columns.resize(newsize+1);
for(uint span = 0; span < cell->ColSpan -1; span++){
column++;
_Columns[column].Width = _Columns[column-1].Width;
_Columns[column].WidthMax = _Columns[column-1].WidthMax;
_Columns[column].TableRatio = _Columns[column-1].TableRatio;
_Columns[column].WidthWanted = _Columns[column-1].WidthWanted;
_Columns[column].RowSpan = _Columns[column-1].RowSpan;
}
}
// Next column // Next column
column++; column++;
} }
// Width of cells and table borders // Width of cells and table borders
sint32 borderWidth = 2*Border + ((sint32)_Columns.size()+1) * CellSpacing + ((sint32)_Columns.size()*2) * CellPadding; sint32 padding = CellPadding + (Border ? 1 : 0);
sint32 borderWidth = 2*Border + ((sint32)_Columns.size()+1) * CellSpacing + ((sint32)_Columns.size()*2) * padding;
// Get the width // Get the width
sint32 tableWidthMax = ForceWidthMin?ForceWidthMin:_LastParentW; // getWReal(); sint32 tableWidthMax = ForceWidthMin?ForceWidthMin:_LastParentW; // getWReal();
@ -802,7 +903,6 @@ namespace NLGUI
// Some space ? // Some space ?
space = finalWidth - tableWidth; space = finalWidth - tableWidth;
if (space > 0) if (space > 0)
{ {
// Then add in wanted Width cells // Then add in wanted Width cells
@ -892,6 +992,18 @@ namespace NLGUI
} }
} }
} }
// If there is still space left, then sum up column widths
// and add all the remaining space to final column.
if (space > 0)
{
sint32 innerWidth = 0;
for(i=0;i<_Columns.size();i++)
innerWidth += _Columns[i].Width;
if (innerWidth > 0 && finalWidth > innerWidth)
_Columns[_Columns.size()-1].Width += finalWidth - innerWidth;
}
} }
} }
} }
@ -902,7 +1014,8 @@ namespace NLGUI
column = 0; column = 0;
sint32 row = 0; sint32 row = 0;
sint32 currentX = Border + CellSpacing + CellPadding; sint32 currentX = Border + CellSpacing + padding;
_Rows.clear (); _Rows.clear ();
for (i=0; i<_Cells.size(); i++) for (i=0; i<_Cells.size(); i++)
{ {
@ -911,25 +1024,41 @@ namespace NLGUI
if (cell->NewLine) if (cell->NewLine)
{ {
column = 0; column = 0;
currentX = Border + CellSpacing + CellPadding; currentX = Border + CellSpacing + padding;
_Rows.push_back(CRow()); _Rows.push_back(CRow());
} }
if (cell->TableColumnIndex > 0)
{
// we have active rowspan, must add up 'skipped' columns
for( ; column<cell->TableColumnIndex; column++)
currentX += _Columns[column].Width + padding*2 + CellSpacing;
}
// Set the x and width // Set the x and width
// Check align // Check align
sint32 alignmentX = 0; sint32 alignmentX = 0;
sint32 widthReduceX = 0; sint32 widthReduceX = 0;
if (cell->WidthMax < _Columns[column].Width) sint32 columnWidth = _Columns[column].Width;
if (cell->ColSpan > 1)
{
// scan ahead and add up column widths as they might be different
for(int j = 1; j<cell->ColSpan; j++)
columnWidth += CellSpacing + padding*2 + _Columns[column+j].Width;
}
if (cell->WidthMax < columnWidth)
{ {
switch (cell->Align) switch (cell->Align)
{ {
case CGroupCell::Center: case CGroupCell::Center:
alignmentX = (_Columns[column].Width - cell->WidthMax) / 2; alignmentX = (columnWidth - cell->WidthMax) / 2;
widthReduceX = alignmentX * 2; widthReduceX = alignmentX * 2;
break; break;
case CGroupCell::Right: case CGroupCell::Right:
alignmentX = _Columns[column].Width - cell->WidthMax; alignmentX = columnWidth - cell->WidthMax;
widthReduceX = alignmentX; widthReduceX = alignmentX;
break; break;
default: default:
@ -937,11 +1066,11 @@ namespace NLGUI
} }
} }
cell->setX(currentX); cell->setX(currentX - padding);
cell->setW(_Columns[column].Width); cell->setW(columnWidth + padding*2);
cell->Group->setX(alignmentX+cell->LeftMargin); cell->Group->setX(alignmentX + cell->LeftMargin + padding);
cell->Group->setW(_Columns[column].Width - widthReduceX); cell->Group->setW(columnWidth - widthReduceX);
cell->Group->CInterfaceElement::updateCoords(); cell->Group->CInterfaceElement::updateCoords();
// Update coords to get H // Update coords to get H
@ -949,16 +1078,17 @@ namespace NLGUI
cell->Group->updateCoords(); cell->Group->updateCoords();
// Resize the row array // Resize the row array
_Rows.back().Height = std::max(cell->Height, std::max(_Rows.back().Height, (sint32)cell->Group->getH())); float rowspan = 1 / cell->RowSpan;
_Rows.back().Height = std::max((sint32)(cell->Height*rowspan), std::max(_Rows.back().Height, (sint32)(cell->Group->getH()*rowspan)));
// Next column // Next column
currentX += _Columns[column].Width + 2*CellPadding + CellSpacing; currentX += columnWidth + 2*padding + CellSpacing;
column ++; column += cell->ColSpan;
} }
// Set cell Y // Set cell Y
row = 0; row = 0;
sint32 currentY = -(Border + CellSpacing + CellPadding); sint32 currentY = -(Border + CellSpacing + padding);
for (i=0; i<_Cells.size(); i++) for (i=0; i<_Cells.size(); i++)
{ {
// New cell ? // New cell ?
@ -967,37 +1097,45 @@ namespace NLGUI
{ {
if (_Rows[row].Height != 0) if (_Rows[row].Height != 0)
{ {
currentY -= _Rows[row].Height + 2*CellPadding + CellSpacing; currentY -= _Rows[row].Height + 2*padding + CellSpacing;
} }
row++; row++;
} }
// Check align // Check align
sint32 alignmentY = 0; sint32 alignmentY = 0;
if ((sint32)cell->Group->getH() < _Rows[row].Height) sint32 rowHeight = _Rows[row].Height;
if (cell->RowSpan > 1)
{
// we need to scan down and add up row heights
int k = std::min((sint32)_Rows.size(), row + cell->RowSpan);
for(int j=row+1; j<k; j++)
rowHeight += CellSpacing + padding*2 + _Rows[j].Height;
}
if ((sint32)cell->Group->getH() < rowHeight)
{ {
switch (cell->VAlign) switch (cell->VAlign)
{ {
case CGroupCell::Middle: case CGroupCell::Middle:
alignmentY = (_Rows[row].Height - (sint32)cell->Group->getH()) / 2; alignmentY = (rowHeight - (sint32)cell->Group->getH()) / 2;
break; break;
case CGroupCell::Bottom: case CGroupCell::Bottom:
alignmentY = _Rows[row].Height - (sint32)cell->Group->getH(); alignmentY = rowHeight - (sint32)cell->Group->getH();
break; break;
default: default:
break; break;
} }
} }
cell->setY(currentY); cell->setY(currentY + padding);
cell->setH (_Rows[row].Height); cell->setH (rowHeight + 2*padding);
cell->Group->setY(-alignmentY); cell->Group->setY(-(alignmentY + padding));
} }
// Resize the table // Resize the table
setW(finalWidth+borderWidth-_LastParentW); setW(finalWidth+borderWidth-_LastParentW);
if (!_Rows.empty()) if (!_Rows.empty())
currentY -= _Rows[row].Height + CellPadding + CellSpacing + Border; currentY -= _Rows[row].Height + padding + CellSpacing + Border;
setH(-currentY); setH(-currentY);
// All done // All done
@ -1177,60 +1315,66 @@ namespace NLGUI
if (gr == NULL) if (gr == NULL)
CurrentAlpha = 255; CurrentAlpha = 255;
if (!_Columns.empty() && !_Rows.empty() && BgColor.A) if (!_Columns.empty() && !_Rows.empty())
{ {
sint32 border = Border + CellSpacing + CellPadding; sint32 border = Border + CellSpacing;
if (border) if (border && BgColor.A)
{ {
CRGBA finalColor; CRGBA finalColor;
finalColor.modulateFromColor (BgColor, CWidgetManager::getInstance()->getGlobalColor()); finalColor.modulateFromColor (BgColor, CWidgetManager::getInstance()->getGlobalColor());
finalColor.A = CurrentAlpha; finalColor.A = CurrentAlpha;
// Draw the top and bottom lines // Draw the top line
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal-border+_HReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal-border+_HReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor);
// Draw the left and right lines // Draw the left line
sint32 insideHeight = std::max((sint32)0, (sint32)_HReal - (sint32)2*border); sint32 insideHeight = std::max((sint32)0, (sint32)_HReal - (sint32)border);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal+border, border, insideHeight, 0, false, rVR.getBlankTextureId(), finalColor); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, border, insideHeight, 0, false, rVR.getBlankTextureId(), finalColor);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal+_WReal-border, _YReal+border, border, insideHeight, 0, false, rVR.getBlankTextureId(), finalColor);
// Draw the inside borders // Draw the inside borders
sint32 insideWidth = 2*CellPadding + CellSpacing; if (CellSpacing)
if (insideWidth)
{ {
// Draw the inside verticals
uint i; uint i;
sint32 x = _XReal + _Columns[0].Width + border; sint32 x, y;
for (i=1; i<_Columns.size(); i++) for (i=0; i<_Cells.size(); i++)
{ {
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal+border, insideWidth, insideHeight, 0, false, rVR.getBlankTextureId(), finalColor); CGroupCell *cell = _Cells[i];
x += _Columns[i].Width + insideWidth;
x = cell->getXReal();
y = cell->getYReal() - CellSpacing;
// right
rVR.drawRotFlipBitmap (_RenderLayer, x + cell->getW(), y, CellSpacing, cell->getH() + CellSpacing, 0, false, rVR.getBlankTextureId(), finalColor);
// bottom
rVR.drawRotFlipBitmap (_RenderLayer, x, y, cell->getW(), CellSpacing, 0, false, rVR.getBlankTextureId(), finalColor);
} }
}
// Draw the inside horizontals }
sint32 y = _YReal + _HReal - border - _Rows[0].Height; if (Border)
if (_Rows[0].Height != 0) {
{ CViewRenderer &rVR = *CViewRenderer::getInstance();
y -= insideWidth;
} CRGBA borderColorTL;
for (i=1; i<_Rows.size(); i++) CRGBA lighter = blend(BorderColor, CRGBA::White, 0.5f);
{ borderColorTL.modulateFromColor (lighter, CWidgetManager::getInstance()->getGlobalColor());
uint j; borderColorTL.A = CurrentAlpha;
x = _XReal + border;
if (_Rows[i].Height != 0) CRGBA borderColorBR;
{ borderColorBR.modulateFromColor (BorderColor, CWidgetManager::getInstance()->getGlobalColor());
for (j=0; j<_Columns.size(); j++) borderColorBR.A = CurrentAlpha;
{
rVR.drawRotFlipBitmap (_RenderLayer, x, y, _Columns[j].Width, insideWidth, 0, false, rVR.getBlankTextureId(), finalColor); // beveled table border
x += _Columns[j].Width + insideWidth; for (sint32 i=0; i<Border; i++)
} {
y -= _Rows[i].Height+ insideWidth; // bottom, left, top, right
} rVR.drawRotFlipBitmap (_RenderLayer, _XReal+i, _YReal+i, _WReal-i*2, 1, 0, false, rVR.getBlankTextureId(), borderColorBR);
} rVR.drawRotFlipBitmap (_RenderLayer, _XReal+i, _YReal+i, 1, _HReal-i*2, 0, false, rVR.getBlankTextureId(), borderColorTL);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal+i, _YReal+_HReal-i-1, _WReal-i*2, 1, 0, false, rVR.getBlankTextureId(), borderColorTL);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal+_WReal-i-1, _YReal+i, 1, _HReal-i*2, 0, false, rVR.getBlankTextureId(), borderColorBR);
} }
} }
} }
CInterfaceGroup::draw (); CInterfaceGroup::draw ();
@ -1243,6 +1387,11 @@ namespace NLGUI
return toString( Border ); return toString( Border );
} }
else else
if( name == "bordercolor" )
{
return toString( BorderColor );
}
else
if( name == "cellpadding" ) if( name == "cellpadding" )
{ {
return toString( CellPadding ); return toString( CellPadding );
@ -1279,6 +1428,14 @@ namespace NLGUI
return; return;
} }
else else
if( name == "bordercolor" )
{
CRGBA c;
if( fromString( value, c ) )
BorderColor = c;
return;
}
else
if( name == "cellpadding" ) if( name == "cellpadding" )
{ {
sint32 i; sint32 i;
@ -1321,6 +1478,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "type", BAD_CAST "table" ); xmlSetProp( node, BAD_CAST "type", BAD_CAST "table" );
xmlSetProp( node, BAD_CAST "border", BAD_CAST toString( Border ).c_str() ); xmlSetProp( node, BAD_CAST "border", BAD_CAST toString( Border ).c_str() );
xmlSetProp( node, BAD_CAST "bordercolor", BAD_CAST toString( BorderColor ).c_str() );
xmlSetProp( node, BAD_CAST "cellpadding", BAD_CAST toString( CellPadding ).c_str() ); xmlSetProp( node, BAD_CAST "cellpadding", BAD_CAST toString( CellPadding ).c_str() );
xmlSetProp( node, BAD_CAST "cellspacing", BAD_CAST toString( CellSpacing ).c_str() ); xmlSetProp( node, BAD_CAST "cellspacing", BAD_CAST toString( CellSpacing ).c_str() );
xmlSetProp( node, BAD_CAST "bgcolor", BAD_CAST toString( BgColor ).c_str() ); xmlSetProp( node, BAD_CAST "bgcolor", BAD_CAST toString( BgColor ).c_str() );
@ -1345,6 +1503,12 @@ namespace NLGUI
fromString((const char*)ptr, Border); fromString((const char*)ptr, Border);
} }
// //
ptr = (char*) xmlGetProp( cur, (xmlChar*)"bordercolor" );
if (ptr)
{
BorderColor = convertColor((const char*)ptr);
}
//
ptr = (char*) xmlGetProp( cur, (xmlChar*)"cellpadding" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"cellpadding" );
if (ptr) if (ptr)
{ {

@ -147,12 +147,16 @@ namespace NLGUI
} }
if( name == "posparent" ) if( name == "posparent" )
{ {
return CWidgetManager::getInstance()->getParser()->getParentPosAssociation( (CInterfaceElement*)this ); std::string pp;
getPosParent( pp );
return pp;
} }
else else
if( name == "sizeparent" ) if( name == "sizeparent" )
{ {
return CWidgetManager::getInstance()->getParser()->getParentSizeAssociation( (CInterfaceElement*)this ); std::string sp;
getSizeParent( sp );
return sp;
} }
else else
if( name == "global_color" ) if( name == "global_color" )
@ -226,13 +230,13 @@ namespace NLGUI
else else
if( name == "posref" ) if( name == "posref" )
{ {
convertHotSpot( value.c_str() ); _PosRef = convertHotSpot( value.c_str() );
return; return;
} }
else else
if( name == "parentposref" ) if( name == "parentposref" )
{ {
convertHotSpot( value.c_str() ); _ParentPosRef = convertHotSpot( value.c_str() );
} }
else else
if( name == "sizeref" ) if( name == "sizeref" )
@ -294,11 +298,13 @@ namespace NLGUI
xmlNewProp( node, BAD_CAST "w", BAD_CAST toString( _W ).c_str() ); xmlNewProp( node, BAD_CAST "w", BAD_CAST toString( _W ).c_str() );
xmlNewProp( node, BAD_CAST "h", BAD_CAST toString( _H ).c_str() ); xmlNewProp( node, BAD_CAST "h", BAD_CAST toString( _H ).c_str() );
xmlNewProp( node, BAD_CAST "posref", BAD_CAST HotSpotCoupleToString( _ParentPosRef, _PosRef ).c_str() ); xmlNewProp( node, BAD_CAST "posref", BAD_CAST HotSpotCoupleToString( _ParentPosRef, _PosRef ).c_str() );
xmlNewProp( node, BAD_CAST "posparent",
BAD_CAST CWidgetManager::getInstance()->getParser()->getParentPosAssociation( (CInterfaceElement*)this ).c_str() ); std::string pp;
getPosParent( pp );
xmlNewProp( node, BAD_CAST "posparent", BAD_CAST pp.c_str() );
xmlNewProp( node, BAD_CAST "sizeref", BAD_CAST getSizeRefAsString().c_str() ); xmlNewProp( node, BAD_CAST "sizeref", BAD_CAST getSizeRefAsString().c_str() );
xmlNewProp( node, BAD_CAST "sizeparent", getSizeParent( pp );
BAD_CAST CWidgetManager::getInstance()->getParser()->getParentSizeAssociation( (CInterfaceElement*)this ).c_str() ); xmlNewProp( node, BAD_CAST "sizeparent", BAD_CAST pp.c_str() );
xmlNewProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() ); xmlNewProp( node, BAD_CAST "global_color", BAD_CAST toString( _ModulateGlobalColor ).c_str() );
xmlNewProp( node, BAD_CAST "render_layer", BAD_CAST toString( _RenderLayer ).c_str() ); xmlNewProp( node, BAD_CAST "render_layer", BAD_CAST toString( _RenderLayer ).c_str() );
@ -382,13 +388,13 @@ namespace NLGUI
ptr = (char*) xmlGetProp( cur, (xmlChar*)"posparent" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"posparent" );
if (ptr) if (ptr)
{ {
setPosParent( std::string( (const char*)ptr ) ); parsePosParent( (const char*)ptr );
} }
ptr = (char*) xmlGetProp( cur, (xmlChar*)"sizeparent" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"sizeparent" );
if (ptr) if (ptr)
{ {
setSizeParent( std::string( (const char*)ptr ) ); parseSizeParent( (const char*)ptr );
} }
ptr = (char*) xmlGetProp (cur, (xmlChar*)"sizeref"); ptr = (char*) xmlGetProp (cur, (xmlChar*)"sizeref");
@ -1526,42 +1532,170 @@ namespace NLGUI
return false; return false;
} }
void CInterfaceElement::parsePosParent( const std::string &id )
{
CInterfaceElement *p = getParent();
if( ( id == "parent" ) || ( id.empty() ) )
{
setParentPos( p );
return;
}
std::string ppId;
if( p != NULL )
ppId = p->getId() + ":" + id;
else
ppId = std::string( "ui:" ) + id;
CWidgetManager::getInstance()->getParser()->addParentPositionAssociation( this, ppId );
}
void CInterfaceElement::setPosParent( const std::string &id ) void CInterfaceElement::setPosParent( const std::string &id )
{ {
std::string Id = stripId( id ); // Parent or empty id simply means the group parent
if( ( id == "parent" ) || ( id.empty() ) )
{
setParentPos( getParent() );
return;
}
if( Id != "parent" ) CInterfaceElement *pp = NULL;
// Check if it's a short Id
std::string::size_type idx = id.find( "ui:" );
if( idx == std::string::npos )
{ {
std::string idParent; // If it is, find the widget in the parent group and set as posparent
if( _Parent != NULL ) CInterfaceGroup *p = getParent();
idParent = _Parent->getId() + ":"; if( p != NULL )
else {
idParent = "ui:"; pp = p->findFromShortId( id );
CWidgetManager::getInstance()->getParser()->addParentPositionAssociation( this, idParent + Id ); }
}
else
{
// If it is not, find using the widgetmanager
// TODO: refactor, shouldn't use a singleton
pp = CWidgetManager::getInstance()->getElementFromId( id );
} }
if( pp != NULL )
setParentPos( pp );
} }
void CInterfaceElement::setSizeParent( const std::string &id ) void CInterfaceElement::getPosParent( std::string &id ) const
{ {
std::string Id = stripId( id );
std::string idParent;
if( Id != "parent" ) // If there's no pos parent set, then the parent group is the pos parent
if( getParentPos() == NULL )
{ {
if( _Parent != NULL ) id = "parent";
idParent = _Parent->getId() + ":"; return;
else
idParent = "ui:";
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent + Id );
} }
// If pos parent and parent are the same then ofc the parent group is the pos parent...
CInterfaceElement *p = getParent();
if( getParentPos() == p )
{
id = "parent";
return;
}
// If parent is in the same group, use the short id
p = getParentPos();
if( p->isInGroup( getParent() ) )
{
id = p->getShortId();
return;
}
// Otherwise use the full id
id = p->getId();
}
void CInterfaceElement::parseSizeParent( const std::string &id )
{
CInterfaceElement *p = getParent();
if( ( id == "parent" ) || ( id.empty() ) )
{
setParentSize( p );
return;
}
std::string spId;
if( p != NULL )
spId = p->getId() + ":" + id;
else else
spId = std::string( "ui:" ) + id;
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, spId );
}
void CInterfaceElement::setSizeParent( const std::string &id )
{
// Parent or empty id simply means the group parent
if( ( id == "parent" ) || ( id.empty() ) )
{ {
if( _Parent != NULL ) setParentSize( getParent() );
return;
}
CInterfaceElement *pp = NULL;
// Check if it's a short Id
std::string::size_type idx = id.find( "ui:" );
if( idx == std::string::npos )
{
// If it is, find the widget in the parent group and set as posparent
CInterfaceGroup *p = getParent();
if( p != NULL )
{ {
idParent = _Parent->getId(); pp = p->findFromShortId( id );
CWidgetManager::getInstance()->getParser()->addParentSizeAssociation( this, idParent );
} }
} }
else
{
// If it is not, find using the widgetmanager
// TODO: refactor, shouldn't use a singleton
pp = CWidgetManager::getInstance()->getElementFromId( id );
}
if( pp != NULL )
setParentSize( pp );
}
void CInterfaceElement::getSizeParent( std::string &id ) const
{
CInterfaceElement *p = getParentSize();
// If there's no parent set then the size parent is the parent
if( p == NULL )
{
id = "parent";
return;
}
// If the size parent is the same as the group parent, then the size parent is the parent ofc
if( p == getParent() )
{
id = "parent";
return;
}
// If the size parent is in the parent group, use the short Id
if( p->isInGroup( getParent() ) )
{
id = p->getShortId();
return;
}
// Otherwise use the full Id
id = p->getId();
} }
void CInterfaceElement::registerDeletionWatcher( IDeletionWatcher *watcher ) void CInterfaceElement::registerDeletionWatcher( IDeletionWatcher *watcher )
@ -1594,6 +1728,105 @@ namespace NLGUI
} }
} }
void CInterfaceElement::getHSCoords( const THotSpot &hs, sint32 &x, sint32 &y ) const
{
x = _XReal;
y = _YReal;
if( ( hs & Hotspot_Mx ) != 0 )
y += _HReal / 2;
else
if( ( hs & Hotspot_Tx ) != 0 )
y += _HReal;
if( ( hs & Hotspot_xM ) != 0 )
x += _WReal / 2;
else
if( ( hs & Hotspot_xR ) != 0 )
x += _WReal;
}
void CInterfaceElement::getClosestHotSpot( const CInterfaceElement *other, THotSpot &hs )
{
/// Iterate over the following hotspots, calculate the distance and store the closest
static THotSpot hslist[] =
{
Hotspot_BL,
Hotspot_BR,
Hotspot_MM,
Hotspot_TL,
Hotspot_TR
};
int c = sizeof( hslist ) / sizeof( THotSpot );
int x,y,ox,oy,vx,vy;
float d;
float closestd = 9999999.0f;
THotSpot closestHS = Hotspot_TR;
for( int i = 0; i < c; i++ )
{
other->getHSCoords( hslist[ i ], ox, oy );
getHSCoords( hslist[ i ], x, y );
// Make a vector between the two hotspots
vx = x - ox;
vy = y - oy;
// Calculate length
d = sqrt( pow( vx, 2.0f ) + pow( vy, 2.0f ) );
// If these hotspots are the closest, store the hotspot
if( d < closestd )
{
closestd = d;
closestHS = hslist[ i ];
}
}
hs = closestHS;
}
void CInterfaceElement::alignTo( CInterfaceElement *other )
{
if( other == this )
return;
// Check which hotspot is the closest
THotSpot hs;
other->getClosestHotSpot( this, hs );
// Get the hotspot coordinates
sint32 x, y, ox, oy;
getHSCoords( hs, x, y );
other->getHSCoords( hs, ox, oy );
// Calculate the difference between the hotspot we found and our current position,
sint32 dx = ox - x;
sint32 dy = oy - y;
// This difference is our offset, so we remain in the same position
setX( -1 * dx );
setY( -1 * dy );
setPosRef( hs );
setParentPosRef( hs );
invalidateCoords();
}
void CInterfaceElement::onWidgetDeleted( CInterfaceElement *e )
{
if( e == getParentPos() )
setParentPos( NULL );
if( e == getParentSize() )
setParentSize( NULL );
}
CStringMapper* CStringShared::_UIStringMapper = NULL; CStringMapper* CStringShared::_UIStringMapper = NULL;

@ -0,0 +1,29 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#include "nel/gui/interface_factory.h"
#include "nel/gui/view_base.h"
#include "nel/misc/factory.h"
namespace NLGUI
{
CViewBase* CInterfaceFactory::createClass( const std::string &name )
{
return NLMISC_GET_FACTORY( CViewBase, std::string ).createObject( std::string( name ) , CViewBase::TCtorParam() );
}
}

@ -911,6 +911,31 @@ namespace NLGUI
} }
} }
// ------------------------------------------------------------------------------------------------
void CInterfaceGroup::addElement (CInterfaceElement *child, sint eltOrder /*= -1*/)
{
if (!child)
{
nlwarning("<CInterfaceGroup::addView> : tried to add a NULL view");
return;
}
if( child->isGroup() )
{
addGroup( static_cast< CInterfaceGroup* >( child ), eltOrder );
}
else
if( child->isCtrl() )
{
addCtrl( static_cast< CCtrlBase* >( child ), eltOrder );
}
else
if( child->isView() )
{
addView( static_cast< CViewBase* >( child ), eltOrder );
}
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::addView (CViewBase *child, sint eltOrder /*= -1*/) void CInterfaceGroup::addView (CViewBase *child, sint eltOrder /*= -1*/)
{ {
@ -1312,6 +1337,11 @@ namespace NLGUI
for (ite = _EltOrder.begin() ; ite != _EltOrder.end(); ite++) for (ite = _EltOrder.begin() ; ite != _EltOrder.end(); ite++)
{ {
CViewBase *pVB = *ite; CViewBase *pVB = *ite;
if( pVB->getName() == "=MARKED=" )
{
nlinfo( "=MARKED=" );
}
if (pVB->getActive()) if (pVB->getActive())
pVB->draw(); pVB->draw();
} }
@ -2514,5 +2544,101 @@ namespace NLGUI
for( std::vector< CInterfaceGroup* >::iterator itr = _ChildrenGroups.begin(); itr != _ChildrenGroups.end(); ++itr ) for( std::vector< CInterfaceGroup* >::iterator itr = _ChildrenGroups.begin(); itr != _ChildrenGroups.end(); ++itr )
(*itr)->onWidgetDeleted( e ); (*itr)->onWidgetDeleted( e );
} }
void CInterfaceGroup::moveBy( sint32 x, sint32 y )
{
CInterfaceElement::moveBy( x, y );
for( int i = 0; i < _EltOrder.size(); i++ )
{
CViewBase *v = _EltOrder[ i ];
v->updateCoords();
}
}
bool CInterfaceGroup::explode()
{
CInterfaceGroup *p = getParent();
if( p == NULL )
return false;
std::string oldId;
// Reparent children
for( sint32 i = 0; i < _EltOrder.size(); i++ )
{
CInterfaceElement *e = _EltOrder[ i ];
oldId = e->getId();
e->setW( e->getWReal() );
e->setH( e->getHReal() );
e->setSizeRef( "" );
e->setParent( p );
e->setParentPos( p );
e->setParentSize( p );
e->alignTo( p );
p->addElement( e );
e->setIdRecurse( e->getShortId() );
CWidgetManager::getInstance()->onWidgetMoved( oldId, e->getId() );
}
_EltOrder.clear();
_Views.clear();
_Controls.clear();
_ChildrenGroups.clear();
return true;
}
void CInterfaceGroup::spanElements()
{
sint32 minx = std::numeric_limits< sint32 >::max();
sint32 miny = std::numeric_limits< sint32 >::max();
sint32 maxx = std::numeric_limits< sint32 >::min();
sint32 maxy = std::numeric_limits< sint32 >::min();
sint32 tlx,tly,brx,bry;
// Find the min and max coordinates of the elements
for( int i = 0; i < _EltOrder.size(); i++ )
{
CViewBase *v = _EltOrder[ i ];
v->getHSCoords( Hotspot_TL, tlx, tly );
v->getHSCoords( Hotspot_BR, brx, bry );
if( tlx < minx )
minx = tlx;
if( brx > maxx )
maxx = brx;
if( bry < miny )
miny = bry;
if( tly > maxy )
maxy = tly;
}
// Set the position and the width and height based on these coords
setW( maxx - minx );
setH( maxy - miny );
_WReal = getW();
_HReal = getH();
_XReal = minx;
_YReal = miny;
}
void CInterfaceGroup::alignElements()
{
for( int i = 0; i < _EltOrder.size(); i++ )
{
CViewBase *v = _EltOrder[ i ];
v->alignTo( this );
}
}
} }

@ -271,16 +271,25 @@ namespace NLGUI
// //
TxId_TL_HighLight = rVR.getTextureIdFromName (getValStr("tx_tl_highlight")); TxId_TL_HighLight = rVR.getTextureIdFromName (getValStr("tx_tl_highlight"));
rVR.getTextureSizeFromId(TxId_TL_HighLight, W_TL_HighLight, H_TL_HighLight);
TxId_T_HighLight = rVR.getTextureIdFromName (getValStr("tx_t_highlight")); TxId_T_HighLight = rVR.getTextureIdFromName (getValStr("tx_t_highlight"));
rVR.getTextureSizeFromId(TxId_T_HighLight, W_T_HighLight, H_T_HighLight);
TxId_TR_HighLight = rVR.getTextureIdFromName (getValStr("tx_tr_highlight")); TxId_TR_HighLight = rVR.getTextureIdFromName (getValStr("tx_tr_highlight"));
rVR.getTextureSizeFromId(TxId_TR_HighLight, W_TR_HighLight, H_TR_HighLight);
TxId_L_HighLight = rVR.getTextureIdFromName (getValStr("tx_l_highlight")); TxId_L_HighLight = rVR.getTextureIdFromName (getValStr("tx_l_highlight"));
rVR.getTextureSizeFromId(TxId_L_HighLight, W_L_HighLight, H_L_HighLight);
TxId_R_HighLight = rVR.getTextureIdFromName (getValStr("tx_r_highlight")); TxId_R_HighLight = rVR.getTextureIdFromName (getValStr("tx_r_highlight"));
rVR.getTextureSizeFromId(TxId_R_HighLight, W_R_HighLight, H_R_HighLight);
TxId_BL_HighLight = rVR.getTextureIdFromName (getValStr("tx_bl_highlight")); TxId_BL_HighLight = rVR.getTextureIdFromName (getValStr("tx_bl_highlight"));
rVR.getTextureSizeFromId(TxId_BL_HighLight, W_BL_HighLight, H_BL_HighLight);
TxId_B_HighLight = rVR.getTextureIdFromName (getValStr("tx_b_highlight")); TxId_B_HighLight = rVR.getTextureIdFromName (getValStr("tx_b_highlight"));
rVR.getTextureSizeFromId(TxId_B_HighLight, W_B_HighLight, H_B_HighLight);
TxId_BR_HighLight = rVR.getTextureIdFromName (getValStr("tx_br_highlight")); TxId_BR_HighLight = rVR.getTextureIdFromName (getValStr("tx_br_highlight"));
rVR.getTextureSizeFromId(TxId_BR_HighLight, W_BR_HighLight, H_BR_HighLight);
// //
HeaderH = getValSInt32("header_h"); HeaderH = getValSInt32("header_h");
InsetT = getValSInt32("inset_t");
return true; return true;
} }

@ -37,6 +37,7 @@
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
#include "nel/gui/lua_manager.h" #include "nel/gui/lua_manager.h"
#include "nel/gui/root_group.h"
#ifdef LUA_NEVRAX_VERSION #ifdef LUA_NEVRAX_VERSION
#include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger #include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger
@ -113,86 +114,6 @@ namespace NLGUI
return node; return node;
} }
// ----------------------------------------------------------------------------
// CRootGroup
// ----------------------------------------------------------------------------
class CRootGroup : public CInterfaceGroup
{
public:
CRootGroup(const TCtorParam &param)
: CInterfaceGroup(param)
{ }
/// Destructor
virtual ~CRootGroup() { }
virtual CInterfaceElement* getElement (const std::string &id)
{
if (_Id == id)
return this;
if (id.substr(0, _Id.size()) != _Id)
return NULL;
vector<CViewBase*>::const_iterator itv;
for (itv = _Views.begin(); itv != _Views.end(); itv++)
{
CViewBase *pVB = *itv;
if (pVB->getId() == id)
return pVB;
}
vector<CCtrlBase*>::const_iterator itc;
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
{
CCtrlBase* ctrl = *itc;
if (ctrl->getId() == id)
return ctrl;
}
// Accelerate
string sTmp = id;
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
string::size_type pos = sTmp.find(':');
if (pos != string::npos)
sTmp = sTmp.substr(0,pos);
map<string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
CInterfaceGroup *pIG = it->second;
return pIG->getElement(id);
}
return NULL;
}
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1)
{
string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
_Accel.insert(pair<string,CInterfaceGroup*>(sTmp, child));
CInterfaceGroup::addGroup(child,eltOrder);
}
virtual bool delGroup (CInterfaceGroup *child, bool dontDelete = false)
{
string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
map<string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
_Accel.erase(it);
}
return CInterfaceGroup::delGroup(child,dontDelete);
}
private:
map<string,CInterfaceGroup*> _Accel;
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// CInterfaceParser // CInterfaceParser
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -233,6 +154,22 @@ namespace NLGUI
destStream.seek(0, NLMISC::IStream::begin); destStream.seek(0, NLMISC::IStream::begin);
} }
std::string CInterfaceParser::lookup( const std::string &file )
{
std::string filename;
if( editorMode && !_WorkDir.empty() )
{
std::string wdpath = CPath::standardizePath( _WorkDir ) + file;
if( CFile::fileExists( wdpath ) )
filename = wdpath;
}
if( filename.empty() )
filename = CPath::lookup( file );
return filename;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterfaceParser::parseInterface (const std::vector<std::string> & strings, bool reload, bool isFilename, bool checkInData) bool CInterfaceParser::parseInterface (const std::vector<std::string> & strings, bool reload, bool isFilename, bool checkInData)
{ {
@ -270,7 +207,7 @@ namespace NLGUI
{ {
//get the first file document pointer //get the first file document pointer
firstFileName = *it; firstFileName = *it;
string filename = CPath::lookup(firstFileName); string filename = lookup( firstFileName );
bool isInData = false; bool isInData = false;
string::size_type pos = filename.find ("@"); string::size_type pos = filename.find ("@");
if (pos != string::npos) if (pos != string::npos)
@ -283,7 +220,7 @@ namespace NLGUI
isInData = true; isInData = true;
} }
if ((needCheck && !isInData) || !file.open (CPath::lookup(firstFileName))) if ((needCheck && !isInData) || !file.open (lookup(firstFileName)))
{ {
// todo hulud interface syntax error // todo hulud interface syntax error
nlwarning ("could not open file %s, skipping xml parsing",firstFileName.c_str()); nlwarning ("could not open file %s, skipping xml parsing",firstFileName.c_str());
@ -331,7 +268,7 @@ namespace NLGUI
{ {
saveParseResult = true; saveParseResult = true;
std::string archive = CPath::lookup(nextFileName + "_compressed", false, false); std::string archive = CPath::lookup(nextFileName + "_compressed", false, false);
std::string current = CPath::lookup(nextFileName, false, false); std::string current = lookup(nextFileName);
if (!archive.empty() && !current.empty()) if (!archive.empty() && !current.empty())
{ {
if (CFile::getFileModificationDate(current) <= CFile::getFileModificationDate(archive)) if (CFile::getFileModificationDate(current) <= CFile::getFileModificationDate(archive))
@ -351,7 +288,7 @@ namespace NLGUI
{ {
if (isFilename) if (isFilename)
{ {
if (!file.open(CPath::lookup(nextFileName, false, false))) if (!file.open(lookup(nextFileName)))
{ {
// todo hulud interface syntax error // todo hulud interface syntax error
nlwarning ("could not open file %s, skipping xml parsing",nextFileName.c_str()); nlwarning ("could not open file %s, skipping xml parsing",nextFileName.c_str());
@ -3014,6 +2951,34 @@ namespace NLGUI
itr->second = linkData; itr->second = linkData;
} }
void CInterfaceParser::setVariable( const VariableData &v )
{
CInterfaceProperty prop;
const std::string &type = v.type;
const std::string &value = v.value;
const std::string &entry = v.entry;
if( type == "sint64" )
prop.readSInt64( value.c_str(), entry );
else
if( type == "sint32" )
prop.readSInt32( value.c_str(), entry );
else
if( type == "float" || type == "double" )
prop.readDouble( value.c_str(), entry );
else
if( type == "bool" )
prop.readBool( value.c_str(), entry );
else
if( type == "rgba" )
prop.readRGBA( value.c_str(), entry );
else
if( type == "hotspot" )
prop.readHotSpot( value.c_str(), entry );
variableCache[ entry ] = v;
}
bool CInterfaceParser::serializeVariables( xmlNodePtr parentNode ) const bool CInterfaceParser::serializeVariables( xmlNodePtr parentNode ) const
{ {

@ -86,6 +86,7 @@ namespace NLGUI
HTML_ATTR(TABLE,ALIGN), HTML_ATTR(TABLE,ALIGN),
HTML_ATTR(TABLE,BGCOLOR), HTML_ATTR(TABLE,BGCOLOR),
HTML_ATTR(TABLE,BORDER), HTML_ATTR(TABLE,BORDER),
HTML_ATTR(TABLE,BORDERCOLOR),
HTML_ATTR(TABLE,CELLPADDING), HTML_ATTR(TABLE,CELLPADDING),
HTML_ATTR(TABLE,CELLSPACING), HTML_ATTR(TABLE,CELLSPACING),
HTML_ATTR(TABLE,CLASS), HTML_ATTR(TABLE,CLASS),
@ -201,6 +202,7 @@ namespace NLGUI
HTML_ATTR(TEXTAREA,DISABLED), HTML_ATTR(TEXTAREA,DISABLED),
HTML_ATTR(TEXTAREA,ID), HTML_ATTR(TEXTAREA,ID),
HTML_ATTR(TEXTAREA,LANG), HTML_ATTR(TEXTAREA,LANG),
HTML_ATTR(TEXTAREA,MAXLENGTH),
HTML_ATTR(TEXTAREA,NAME), HTML_ATTR(TEXTAREA,NAME),
HTML_ATTR(TEXTAREA,READONLY), HTML_ATTR(TEXTAREA,READONLY),
HTML_ATTR(TEXTAREA,ROWS), HTML_ATTR(TEXTAREA,ROWS),

@ -0,0 +1,94 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#include "nel/gui/root_group.h"
#include <vector>
namespace NLGUI
{
CRootGroup::CRootGroup(const TCtorParam &param) :
CInterfaceGroup(param)
{
}
CRootGroup::~CRootGroup()
{
}
CInterfaceElement* CRootGroup::getElement (const std::string &id)
{
if (_Id == id)
return this;
if (id.substr(0, _Id.size()) != _Id)
return NULL;
std::vector<CViewBase*>::const_iterator itv;
for (itv = _Views.begin(); itv != _Views.end(); itv++)
{
CViewBase *pVB = *itv;
if (pVB->getId() == id)
return pVB;
}
std::vector<CCtrlBase*>::const_iterator itc;
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
{
CCtrlBase* ctrl = *itc;
if (ctrl->getId() == id)
return ctrl;
}
// Accelerate
std::string sTmp = id;
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
std::string::size_type pos = sTmp.find(':');
if (pos != std::string::npos)
sTmp = sTmp.substr(0,pos);
std::map<std::string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
CInterfaceGroup *pIG = it->second;
return pIG->getElement(id);
}
return NULL;
}
void CRootGroup::addGroup (CInterfaceGroup *child, sint eltOrder)
{
std::string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
_Accel.insert(std::pair<std::string,CInterfaceGroup*>(sTmp, child));
CInterfaceGroup::addGroup(child,eltOrder);
}
bool CRootGroup::delGroup (CInterfaceGroup *child, bool dontDelete)
{
std::string sTmp = child->getId();
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
std::map<std::string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
if (it != _Accel.end())
{
_Accel.erase(it);
}
return CInterfaceGroup::delGroup(child,dontDelete);
}
}

@ -18,6 +18,7 @@
#define NELGUI_H #define NELGUI_H
#include <string> #include <string>
#include <limits>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/algo.h" #include "nel/misc/algo.h"

@ -57,7 +57,7 @@ namespace NLGUI
{ {
if( editorMode ) if( editorMode )
{ {
CWidgetManager::getInstance()->setCurrentEditorSelection( getId() ); CWidgetManager::getInstance()->selectWidget( getId() );
return true; return true;
} }
} }

@ -28,8 +28,6 @@
#include "nel/gui/lua_ihm.h" #include "nel/gui/lua_ihm.h"
#include "nel/gui/view_pointer_base.h" #include "nel/gui/view_pointer_base.h"
#include <limits>
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
using namespace NL3D; using namespace NL3D;
@ -62,6 +60,7 @@ namespace NLGUI
CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32(); CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
_Color = CRGBA(255,255,255,255); _Color = CRGBA(255,255,255,255);
_Shadow = false; _Shadow = false;
_ShadowOutline = false;
_ShadowColor = CRGBA(0,0,0,255); _ShadowColor = CRGBA(0,0,0,255);
_MultiLine = false; _MultiLine = false;
@ -111,7 +110,7 @@ namespace NLGUI
///constructor ///constructor
// *************************************************************************** // ***************************************************************************
CViewText:: CViewText (const std::string& id, const std::string Text, sint FontSize, CViewText:: CViewText (const std::string& id, const std::string Text, sint FontSize,
NLMISC::CRGBA Color, bool Shadow) NLMISC::CRGBA Color, bool Shadow, bool ShadowOutline)
:CViewBase(TCtorParam()) :CViewBase(TCtorParam())
{ {
_Id = id; _Id = id;
@ -120,6 +119,7 @@ namespace NLGUI
_FontSize = FontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32(); _FontSize = FontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
_Color = Color; _Color = Color;
_Shadow = Shadow; _Shadow = Shadow;
_ShadowOutline = ShadowOutline;
setText(Text); setText(Text);
computeFontSize (); computeFontSize ();
} }
@ -159,6 +159,7 @@ namespace NLGUI
_FontSize = vt._FontSize; _FontSize = vt._FontSize;
_Color = vt._Color; _Color = vt._Color;
_Shadow = vt._Shadow; _Shadow = vt._Shadow;
_ShadowOutline = vt._ShadowOutline;
_ShadowColor = vt._ShadowColor; _ShadowColor = vt._ShadowColor;
_MultiLine = false; _MultiLine = false;
@ -225,6 +226,11 @@ namespace NLGUI
return toString( _Shadow ); return toString( _Shadow );
} }
else else
if( name == "shadow_outline" )
{
return toString( _ShadowOutline );
}
else
if( name == "shadow_color" ) if( name == "shadow_color" )
{ {
return toString( _ShadowColor ); return toString( _ShadowColor );
@ -360,6 +366,14 @@ namespace NLGUI
return true; return true;
} }
else else
if( name == "shadow_outline" )
{
bool b;
if( fromString( value, b ) )
_ShadowOutline = b;
return true;
}
else
if( name == "shadow_color" ) if( name == "shadow_color" )
{ {
CRGBA c; CRGBA c;
@ -520,6 +534,7 @@ namespace NLGUI
).c_str() ); ).c_str() );
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() ); xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() ); xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() );
xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() ); xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() );
@ -604,6 +619,11 @@ namespace NLGUI
if (prop) if (prop)
_Shadow = convertBool(prop); _Shadow = convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"shadow_outline" );
_ShadowOutline = false;
if (prop)
_ShadowOutline = convertBool(prop);
prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_color" ); prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_color" );
_ShadowColor = CRGBA(0,0,0,255); _ShadowColor = CRGBA(0,0,0,255);
if (prop) if (prop)
@ -864,6 +884,7 @@ namespace NLGUI
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setShadeColor (shcol); TextContext->setShadeColor (shcol);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
@ -978,6 +999,7 @@ namespace NLGUI
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setShadeColor (shcol); TextContext->setShadeColor (shcol);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
@ -1146,6 +1168,14 @@ namespace NLGUI
invalidateContent(); invalidateContent();
} }
// ***************************************************************************
void CViewText::setShadowOutline (bool bShadowOutline)
{
_ShadowOutline = bShadowOutline;
computeFontSize ();
invalidateContent();
}
// *************************************************************************** // ***************************************************************************
void CViewText::setShadowColor(const NLMISC::CRGBA & color) void CViewText::setShadowColor(const NLMISC::CRGBA & color)
{ {
@ -1647,6 +1677,7 @@ namespace NLGUI
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// default state // default state
@ -1814,9 +1845,18 @@ namespace NLGUI
if (_AutoClamp) if (_AutoClamp)
{ {
CViewBase::updateCoords (); CViewBase::updateCoords ();
if (_Parent)
// If there's no parent, try the parent of the parent element.
// Since we will be under the same group
CInterfaceGroup *parent = _Parent;
if( parent == NULL )
{
if( _ParentElm != NULL )
parent = _ParentElm->getParent();
}
if (parent)
{ {
CInterfaceGroup *parent = _Parent;
// avoid resizing parents to compute the limiter // avoid resizing parents to compute the limiter
while (parent && (parent->getResizeFromChildW() || parent->isGroupList() )) while (parent && (parent->getResizeFromChildW() || parent->isGroupList() ))
{ {
@ -1958,6 +1998,7 @@ namespace NLGUI
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// CViewRenderer &rVR = *CViewRenderer::getInstance(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
height = getFontHeight(); height = getFontHeight();
@ -2089,6 +2130,7 @@ namespace NLGUI
// setup the text context // setup the text context
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// find the line where the character is // find the line where the character is
// CViewRenderer &rVR = *CViewRenderer::getInstance(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
@ -2363,6 +2405,7 @@ namespace NLGUI
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
TCharPos linePos = 0; TCharPos linePos = 0;
@ -2447,6 +2490,7 @@ namespace NLGUI
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// Current position in text // Current position in text
@ -2498,12 +2542,13 @@ namespace NLGUI
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setShadeOutline (_ShadowOutline);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// Letter size // Letter size
UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); // for now we can't now that directly from UTextContext UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); // for now we can't now that directly from UTextContext
_FontHeight = (uint) si.StringHeight + (_Shadow?1:0); _FontHeight = (uint) si.StringHeight; // + (_Shadow?(_ShadowOutline?2:1):0);
_FontLegHeight = (uint) si.StringLine + (_Shadow?1:0); _FontLegHeight = (uint) si.StringLine; // + (_Shadow?(_ShadowOutline?2:1):0);
// Space width // Space width
si = TextContext->getStringInfo(ucstring(" ")); si = TextContext->getStringInfo(ucstring(" "));
@ -2789,7 +2834,8 @@ namespace NLGUI
pTooltip->setId(_Id+"_tt"+toString(i)); pTooltip->setId(_Id+"_tt"+toString(i));
pTooltip->setAvoidResizeParent(avoidResizeParent()); pTooltip->setAvoidResizeParent(avoidResizeParent());
pTooltip->setRenderLayer(getRenderLayer()); pTooltip->setRenderLayer(getRenderLayer());
pTooltip->setDefaultContextHelp(CI18N::get(tempTooltips[i].toString())); bool isI18N = tempTooltips[i].size() >= 2 && tempTooltips[i][0] == 'u' && tempTooltips[i][1] == 'i';
pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltips[i].toString()) : tempTooltips[i]);
pTooltip->setParentPos(this); pTooltip->setParentPos(this);
pTooltip->setParentPosRef(Hotspot_BR); pTooltip->setParentPosRef(Hotspot_BR);
pTooltip->setPosRef(Hotspot_BR); pTooltip->setPosRef(Hotspot_BR);
@ -2960,6 +3006,7 @@ namespace NLGUI
f.serial(_SpaceWidth); f.serial(_SpaceWidth);
f.serial(_Color); f.serial(_Color);
f.serial(_Shadow); f.serial(_Shadow);
f.serial(_ShadowOutline);
f.serialEnum(_CaseMode); f.serialEnum(_CaseMode);
f.serial(_ShadowColor); f.serial(_ShadowColor);
f.serial(_LineMaxW); f.serial(_LineMaxW);

@ -34,8 +34,8 @@
#include "nel/gui/interface_expr.h" #include "nel/gui/interface_expr.h"
#include "nel/gui/reflect_register.h" #include "nel/gui/reflect_register.h"
#include "nel/gui/editor_selection_watcher.h" #include "nel/gui/editor_selection_watcher.h"
#include "nel/gui/widget_addition_watcher.h"
#include "nel/misc/events.h" #include "nel/misc/events.h"
#include "nel/gui/root_group.h"
namespace NLGUI namespace NLGUI
{ {
@ -1036,12 +1036,14 @@ namespace NLGUI
setCapturePointerLeft(NULL); setCapturePointerLeft(NULL);
setCapturePointerRight(NULL); setCapturePointerRight(NULL);
_CapturedView = NULL; _CapturedView = NULL;
resetColorProps(); resetColorProps();
resetAlphaRolloverSpeedProps(); resetAlphaRolloverSpeedProps();
resetGlobalAlphasProps(); resetGlobalAlphasProps();
activeAnims.clear(); activeAnims.clear();
editorSelection.clear();
} }
@ -1186,6 +1188,7 @@ namespace NLGUI
vtDst->setColor (vtSrc->getColor()); vtDst->setColor (vtSrc->getColor());
vtDst->setModulateGlobalColor(vtSrc->getModulateGlobalColor()); vtDst->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
vtDst->setShadow(vtSrc->getShadow()); vtDst->setShadow(vtSrc->getShadow());
vtDst->setShadowOutline(vtSrc->getShadowOutline());
vtDst->setShadowColor(vtSrc->getShadowColor()); vtDst->setShadowColor(vtSrc->getShadowColor());
vtDst->setCaseMode(vtSrc->getCaseMode()); vtDst->setCaseMode(vtSrc->getCaseMode());
vtDst->setUnderlined(vtSrc->getUnderlined()); vtDst->setUnderlined(vtSrc->getUnderlined());
@ -2078,9 +2081,9 @@ namespace NLGUI
if( CInterfaceElement::getEditorMode() ) if( CInterfaceElement::getEditorMode() )
{ {
if( !currentEditorSelection.empty() ) for( int i = 0; i < editorSelection.size(); i++ )
{ {
CInterfaceElement *e = getElementFromId( currentEditorSelection ); CInterfaceElement *e = getElementFromId( editorSelection[ i ] );
if( e != NULL ) if( e != NULL )
e->drawHighlight(); e->drawHighlight();
} }
@ -2303,6 +2306,14 @@ namespace NLGUI
eventDesc.setX( _Pointer->getX() ); eventDesc.setX( _Pointer->getX() );
eventDesc.setY( _Pointer->getY() ); eventDesc.setY( _Pointer->getY() );
if( CInterfaceElement::getEditorMode() )
{
// Let's pretend we've handled the event... or actually we have!
if( ( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown ) ||
( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup ) )
return true;
}
if( isMouseHandlingEnabled() ) if( isMouseHandlingEnabled() )
{ {
// First thing to do : Capture handling // First thing to do : Capture handling
@ -2401,20 +2412,37 @@ namespace NLGUI
// This may happen when alt-tab has been used => the sheet is dragged but the left button is up // This may happen when alt-tab has been used => the sheet is dragged but the left button is up
if (!CCtrlDraggable::getDraggedSheet()) if (!CCtrlDraggable::getDraggedSheet())
{ {
// Take the top most control. if( CInterfaceElement::getEditorMode() && _GroupSelection )
uint nMaxDepth = 0;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer();
for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--)
{ {
CCtrlBase *ctrl= _CtrlsUnderPointer[i]; for( sint32 i = _GroupsUnderPointer.size() - 1; i >= 0; i-- )
if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) )
{ {
uint d = ctrl->getDepth( pNewCurrentWnd ); CInterfaceGroup *g = _GroupsUnderPointer[ i ];
if (d > nMaxDepth) if( ( g != NULL ) && ( g->isInGroup( pNewCurrentWnd ) ) )
{ {
nMaxDepth = d; _CapturedView = g;
setCapturePointerLeft( ctrl );
captured = true; captured = true;
break;
}
}
}
if( !captured )
{
// Take the top most control.
uint nMaxDepth = 0;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = getCtrlsUnderPointer();
for (sint32 i = (sint32)_CtrlsUnderPointer.size()-1; i >= 0; i--)
{
CCtrlBase *ctrl= _CtrlsUnderPointer[i];
if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) )
{
uint d = ctrl->getDepth( pNewCurrentWnd );
if (d > nMaxDepth)
{
nMaxDepth = d;
setCapturePointerLeft( ctrl );
captured = true;
}
} }
} }
} }
@ -2451,6 +2479,11 @@ namespace NLGUI
// handle the capture // handle the capture
_CapturedView->handleEvent( evnt ); _CapturedView->handleEvent( evnt );
} }
else
{
if( CInterfaceElement::getEditorMode() )
clearEditorSelection();
}
} }
// Manage RightClick // Manage RightClick
@ -2539,6 +2572,12 @@ namespace NLGUI
{ {
if ( getCapturePointerLeft() != NULL) if ( getCapturePointerLeft() != NULL)
{ {
if( !handled )
{
CCtrlBase *c = getCapturePointerLeft();
c->handleEvent( evnt );
}
setCapturePointerLeft(NULL); setCapturePointerLeft(NULL);
handled = true; handled = true;
} }
@ -2624,9 +2663,10 @@ namespace NLGUI
else else
if( draggedElement != NULL ) if( draggedElement != NULL )
{ {
draggedElement->setXReal( newX ); sint32 dx = newX - oldX;
draggedElement->setYReal( newY ); sint32 dy = newY - oldY;
draggedElement->invalidateCoords();
draggedElement->moveBy( dx, dy );
} }
} }
@ -2653,13 +2693,36 @@ namespace NLGUI
e->setParent( NULL ); e->setParent( NULL );
draggedElement = e; draggedElement = e;
return true; return true;
} }
void CWidgetManager::stopDragging() void CWidgetManager::stopDragging()
{ {
draggedElement = NULL; if( draggedElement != NULL )
{
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
CInterfaceElement *e = draggedElement;
CInterfaceGroup *tw = getTopWindow();
if( g == NULL )
g = tw;
std::string oldid = e->getId();
e->setParent( g );
e->setIdRecurse( e->getShortId() );
e->setParentPos( g );
e->setParentSize( g );
g->addElement( e );
e->alignTo( g );
//e->setName( "==MARKED==" );
draggedElement = NULL;
onWidgetMoved( oldid, e->getId() );
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -3290,25 +3353,53 @@ namespace NLGUI
} }
} }
void CWidgetManager::getEditorSelection( std::vector< std::string > &selection )
{
selection.clear();
for( int i = 0; i < editorSelection.size(); i++ )
selection.push_back( editorSelection[ i ] );
}
void CWidgetManager::setCurrentEditorSelection( const std::string &name ) void CWidgetManager::selectWidget( const std::string &name )
{ {
std::vector< std::string >::iterator itr
= std::find( editorSelection.begin(), editorSelection.end(), name );
CInterfaceElement *e = getElementFromId( name ); CInterfaceElement *e = getElementFromId( name );
if( e != NULL )
if( itr != editorSelection.end() )
{ {
if( !currentEditorSelection.empty() ) // If multiselection is on unselect if already selected
if( multiSelection )
{ {
CInterfaceElement *prev = getElementFromId( currentEditorSelection ); editorSelection.erase( itr );
if( prev != NULL ) if( e != NULL )
prev->setEditorSelected( false ); e->setEditorSelected( false );
} }
e->setEditorSelected( true );
} }
else else
if( !name.empty() ) {
return; // Select if not yet selected
if( e != NULL )
currentEditorSelection = name; {
// If multiselection is off, we can only have 1 widget selected
if( !multiSelection )
{
editorSelection.clear();
}
e->setEditorSelected( true );
editorSelection.push_back( name );
}
}
notifySelectionWatchers();
}
void CWidgetManager::clearEditorSelection()
{
editorSelection.clear();
notifySelectionWatchers(); notifySelectionWatchers();
} }
@ -3317,7 +3408,7 @@ namespace NLGUI
std::vector< IEditorSelectionWatcher* >::iterator itr = selectionWatchers.begin(); std::vector< IEditorSelectionWatcher* >::iterator itr = selectionWatchers.begin();
while( itr != selectionWatchers.end() ) while( itr != selectionWatchers.end() )
{ {
(*itr)->selectionChanged( currentEditorSelection ); (*itr)->selectionChanged();
++itr; ++itr;
} }
} }
@ -3346,36 +3437,46 @@ namespace NLGUI
selectionWatchers.erase( itr ); selectionWatchers.erase( itr );
} }
void CWidgetManager::notifyAdditionWatchers( const std::string &widgetName ) void CWidgetManager::onWidgetAdded( const std::string &id )
{ {
std::vector< IWidgetAdditionWatcher* >::const_iterator itr = additionWatchers.begin(); std::vector< IWidgetWatcher* >::const_iterator itr = widgetWatchers.begin();
while( itr != additionWatchers.end() ) while( itr != widgetWatchers.end() )
{ {
(*itr)->widgetAdded( widgetName ); (*itr)->onWidgetAdded( id );
++itr; ++itr;
} }
} }
void CWidgetManager::registerAdditionWatcher( IWidgetAdditionWatcher *watcher ) void CWidgetManager::onWidgetMoved( const std::string &oldid, const std::string &newid )
{ {
std::vector< IWidgetAdditionWatcher* >::const_iterator itr std::vector< IWidgetWatcher* >::const_iterator itr = widgetWatchers.begin();
= std::find( additionWatchers.begin(), additionWatchers.end(), watcher ); while( itr != widgetWatchers.end() )
{
(*itr)->onWidgetMoved( oldid, newid );
++itr;
}
}
void CWidgetManager::registerWidgetWatcher( IWidgetWatcher *watcher )
{
std::vector< IWidgetWatcher* >::const_iterator itr
= std::find( widgetWatchers.begin(), widgetWatchers.end(), watcher );
// already exists // already exists
if( itr != additionWatchers.end() ) if( itr != widgetWatchers.end() )
return; return;
additionWatchers.push_back( watcher ); widgetWatchers.push_back( watcher );
} }
void CWidgetManager::unregisterAdditionWatcher( IWidgetAdditionWatcher *watcher ) void CWidgetManager::unregisterWidgetWatcher( IWidgetWatcher *watcher )
{ {
std::vector< IWidgetAdditionWatcher* >::iterator itr std::vector< IWidgetWatcher* >::iterator itr
= std::find( additionWatchers.begin(), additionWatchers.end(), watcher ); = std::find( widgetWatchers.begin(), widgetWatchers.end(), watcher );
// doesn't exist // doesn't exist
if( itr == additionWatchers.end() ) if( itr == widgetWatchers.end() )
return; return;
additionWatchers.erase( itr ); widgetWatchers.erase( itr );
} }
CInterfaceElement* CWidgetManager::addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName ) CInterfaceElement* CWidgetManager::addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName )
@ -3408,11 +3509,165 @@ namespace NLGUI
else else
g->addView( v ); g->addView( v );
notifyAdditionWatchers( v->getId() ); onWidgetAdded( v->getId() );
return v; return v;
} }
bool CWidgetManager::groupSelection()
{
std::vector< CInterfaceElement* > elms;
// Resolve the widget names
for( int i = 0; i < editorSelection.size(); i++ )
{
CInterfaceElement *e = getElementFromId( editorSelection[ i ] );
if( e != NULL )
elms.push_back( e );
}
editorSelection.clear();
if( elms.empty() )
return false;
// Create the group as the subgroup of the top window
CInterfaceGroup *g = static_cast< CInterfaceGroup* >( getParser()->createClass( "interface_group" ) );
getTopWindow()->addGroup( g );
g->setParent( getTopWindow() );
g->setIdRecurse( std::string( "group" ) + NLMISC::toString( _WidgetCount ) );
_WidgetCount++;
onWidgetAdded( g->getId() );
std::string oldId;
// Reparent the widgets to the new group
for( int i = 0; i < elms.size(); i++ )
{
CInterfaceElement *e = elms[ i ];
oldId = e->getId();
CInterfaceGroup *p = e->getParent();
if( p != NULL )
p->takeElement( e );
g->addElement( e );
e->setParent( g );
e->setParentPos( g );
e->setParentSize( g );
e->setIdRecurse( e->getShortId() );
onWidgetMoved( oldId, e->getId() );
}
elms.clear();
// Make sure widgets aren't clipped because the group isn't big enough
g->spanElements();
// Make sure widgets are aligned
g->alignElements();
// Align the new group to the top window
g->alignTo( getTopWindow() );
g->setActive( true );
return true;
}
bool CWidgetManager::unGroupSelection()
{
if( editorSelection.size() != 1 )
return false;
// Does the element exist?
CInterfaceElement *e = getElementFromId( editorSelection[ 0 ] );
if( e == NULL )
return false;
// Is the element a group?
CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( e );
if( g == NULL )
return false;
// Can't blow up a root group :(
CInterfaceGroup *p = g->getParent();
if( p == NULL )
return false;
// KABOOM!
bool ok = g->explode();
if( !ok )
return false;
p->delElement( g );
clearEditorSelection();
p->updateCoords();
return true;
}
bool CWidgetManager::createNewGUI( const std::string &project, const std::string &window )
{
reset();
for( int i = 0; i < _MasterGroups.size(); i++ )
delete _MasterGroups[i].Group;
_MasterGroups.clear();
// First create the master group
CRootGroup *root = new CRootGroup( CViewBase::TCtorParam() );
SMasterGroup mg;
mg.Group = root;
root->setIdRecurse( project );
root->setW( 1024 );
root->setH( 768 );
root->setActive( true );
// Create the first / main window
CInterfaceGroup *wnd = new CInterfaceGroup( CViewBase::TCtorParam() );
wnd->setW( 1024 );
wnd->setH( 768 );
wnd->setParent( root );
wnd->setParentPos( root );
wnd->setParentSize( root );
wnd->setPosRef( Hotspot_MM );
wnd->setParentPosRef( Hotspot_MM );
wnd->setIdRecurse( window );
wnd->setActive( true );
// Add the window
root->addElement( wnd );
mg.addWindow( wnd, wnd->getPriority() );
_MasterGroups.push_back( mg );
_Pointer = new CViewPointer( CViewBase::TCtorParam() );
IParser *parser = getParser();
// Set base color to white
VariableData v;
v.type = "sint32";
v.value = "255";
v.entry = "UI:SAVE:COLOR:R";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:G";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:B";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:A";
parser->setVariable( v );
return true;
}
CWidgetManager::CWidgetManager() CWidgetManager::CWidgetManager()
{ {
@ -3451,7 +3706,9 @@ namespace NLGUI
setScreenWH( 0, 0 ); setScreenWH( 0, 0 );
currentEditorSelection = ""; _GroupSelection = false;
multiSelection = false;
_WidgetCount = 0;
} }
CWidgetManager::~CWidgetManager() CWidgetManager::~CWidgetManager()
@ -3465,6 +3722,8 @@ namespace NLGUI
curContextHelp = NULL; curContextHelp = NULL;
CStringShared::deleteStringMapper(); CStringShared::deleteStringMapper();
editorSelection.clear();
} }
} }

@ -328,7 +328,7 @@ yynewstate:
#endif #endif
/* Get the current used size of the three stacks, in elements. */ /* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1; int size = (int)(yyssp - yyss + 1);
#ifdef yyoverflow #ifdef yyoverflow
/* Each stack pointer address is followed by the size of /* Each stack pointer address is followed by the size of

@ -1000,7 +1000,7 @@ int yyFlexLexer::yyinput()
else else
{ /* need more input */ { /* need more input */
int offset = yy_c_buf_p - yytext_ptr; int offset = (int)(yy_c_buf_p - yytext_ptr);
++yy_c_buf_p; ++yy_c_buf_p;
switch ( yy_get_next_buffer() ) switch ( yy_get_next_buffer() )

@ -2773,7 +2773,7 @@ static int input()
else else
{ /* need more input */ { /* need more input */
int offset = yy_c_buf_p - yytext_ptr; int offset = (int)(yy_c_buf_p - yytext_ptr);
++yy_c_buf_p; ++yy_c_buf_p;
switch ( yy_get_next_buffer() ) switch ( yy_get_next_buffer() )

@ -1739,14 +1739,14 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c
float posY = config.CellSize * (float)ymin; float posY = config.CellSize * (float)ymin;
// Use NELU // Use NELU
if (CNELU::init (oversampledWidth, oversampledHeight, CViewport(), 32, true, NULL, true)) if (CNELU::init (oversampledWidth, oversampledHeight, CViewport(), 32, true, NULL, false, true)) // FIXME: OpenGL not working correctly, offscreen not available in Direct3D
{ {
// Setup the camera // Setup the camera
CNELU::Camera->setTransformMode (ITransformable::DirectMatrix); CNELU::Camera->setTransformMode (ITransformable::DirectMatrix);
CMatrix view; CMatrix view;
view.setPos (CVector (width/2 + posX, height/2 + posY, width)); view.setPos (CVector (width/2 + posX, height/2 + posY, width));
view.setRot (CVector::I, -CVector::K, CVector::J); view.setRot (CVector::I, -CVector::K, CVector::J);
CNELU::Camera->setFrustum (width, height, 0.1f, 1000.f, false); CNELU::Camera->setFrustum (width, height, 0.1f, 10000.f, false);
CNELU::Camera->setMatrix (view); CNELU::Camera->setMatrix (view);
// Create a Landscape. // Create a Landscape.
@ -1766,12 +1766,17 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c
theLand->enableAdditive (true); theLand->enableAdditive (true);
theLand->Landscape.setRefineMode (true); theLand->Landscape.setRefineMode (true);
// theLand->Landscape.setupStaticLight(CRGBA(255, 255, 255), CRGBA(0, 0, 0), 1.0f);
// theLand->Landscape.setThreshold(0.0005);
// Enbable automatique lighting // Enbable automatique lighting
#ifndef NL_DEBUG #ifndef NL_DEBUG
theLand->Landscape.enableAutomaticLighting (true); // theLand->Landscape.enableAutomaticLighting (true);
theLand->Landscape.setupAutomaticLightDir (CVector (0, 0, -1)); // theLand->Landscape.setupAutomaticLightDir (CVector (0, 0, -1));
#endif // NL_DEBUG #endif // NL_DEBUG
// theLand->Landscape.updateLightingAll();
// Clear the backbuffer and the alpha // Clear the backbuffer and the alpha
CNELU::clearBuffers(CRGBA(255,0,255,0)); CNELU::clearBuffers(CRGBA(255,0,255,0));
@ -1851,7 +1856,7 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c
Value* make_snapshot_cf (Value** arg_list, int count) Value* make_snapshot_cf (Value** arg_list, int count)
{ {
// Make sure we have the correct number of arguments (7) // Make sure we have the correct number of arguments (7)
check_arg_count(check_zone_with_template, 7, count); check_arg_count(NeLLigoMakeSnapShot, 7, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"; char *message = "NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]";
@ -1903,11 +1908,11 @@ Value* make_snapshot_cf (Value** arg_list, int count)
else else
{ {
// Build a filename // Build a filename
char drive[512]; char drivetga[512];
char path[512]; char pathtga[512];
char name[512]; char nametga[512];
char ext[512]; char exttga[512];
_splitpath (fileName.c_str(), drive, path, name, ext); _splitpath (fileName.c_str(), drivetga, pathtga, nametga, exttga);
// Build the zone // Build the zone
CZone zone; CZone zone;
@ -1970,7 +1975,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
{ {
// Build the snap shot filename // Build the snap shot filename
char outputFilenameSnapShot[512]; char outputFilenameSnapShot[512];
_makepath (outputFilenameSnapShot, drive, path, name, ".tga"); _makepath (outputFilenameSnapShot, drivetga, pathtga, nametga, ".tga");
// Output the snap shot // Output the snap shot
COFile outputSnapShot; COFile outputSnapShot;
@ -2011,10 +2016,10 @@ Value* make_snapshot_cf (Value** arg_list, int count)
// Write the zone // Write the zone
COFile outputLigoZone; COFile outputLigoZone;
_makepath (outputFilenameSnapShot, drive, path, name, ".ligozone"); _makepath (outputFilenameSnapShot, drivetga, pathtga, nametga, ".ligozone");
// Catch exception // Catch exception
try /*try
{ {
// Open the selected zone file // Open the selected zone file
if (outputLigoZone.open (outputFilenameSnapShot)) if (outputLigoZone.open (outputFilenameSnapShot))
@ -2043,7 +2048,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
char tmp[512]; char tmp[512];
smprintf (tmp, 512, "Error while loading the file %s : %s", fileName, e.what()); smprintf (tmp, 512, "Error while loading the file %s : %s", fileName, e.what());
CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog); CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog);
} }*/
} }
else else
{ {

@ -575,8 +575,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 10, 0, 0 FILEVERSION 0, 11, 0, 0
PRODUCTVERSION 0, 10, 0, 0 PRODUCTVERSION 0, 11, 0, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -593,14 +593,14 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0" VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0"
VALUE "CompanyName", "Ryzom Core\0" VALUE "CompanyName", "Ryzom Core\0"
VALUE "FileVersion", "0.10.0\0" VALUE "FileVersion", "0.11.0\0"
VALUE "InternalName", "CNelExport\0" VALUE "InternalName", "CNelExport\0"
VALUE "LegalCopyright", "\0" VALUE "LegalCopyright", "\0"
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "CNelExport.dlu\0" VALUE "OriginalFilename", "CNelExport.dlu\0"
VALUE "PrivateBuild", "\0" VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Ryzom Core\0" VALUE "ProductName", "Ryzom Core\0"
VALUE "ProductVersion", "0.10.0\0" VALUE "ProductVersion", "0.11.0\0"
VALUE "SpecialBuild", "\0" VALUE "SpecialBuild", "\0"
END END
END END

@ -85,8 +85,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 10, 0, 0 FILEVERSION 0, 11, 0, 0
PRODUCTVERSION 0, 10, 0, 0 PRODUCTVERSION 0, 11, 0, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -103,12 +103,12 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "http://www.ryzomcore.org/" VALUE "Comments", "http://www.ryzomcore.org/"
VALUE "FileDescription", "PatchMesh to RykolPatchMesh" VALUE "FileDescription", "PatchMesh to RykolPatchMesh"
VALUE "FileVersion", "0.10.0" VALUE "FileVersion", "0.11.0"
VALUE "InternalName", "PatchMesh to RykolPatchMesh" VALUE "InternalName", "PatchMesh to RykolPatchMesh"
VALUE "LegalCopyright", "Copyright, 2000 Nevrax Ltd." VALUE "LegalCopyright", "Copyright, 2000 Nevrax Ltd."
VALUE "OriginalFilename", "nel_convert_patch.dlm" VALUE "OriginalFilename", "nel_convert_patch.dlm"
VALUE "ProductName", "NeL Patch Converter" VALUE "ProductName", "NeL Patch Converter"
VALUE "ProductVersion", "0.10.0" VALUE "ProductVersion", "0.11.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

@ -338,6 +338,8 @@ get_selected_tile_cf(Value** arg_list, int count)
if (tri->rpatch->tileSel[i]) if (tri->rpatch->tileSel[i])
array->append(Integer::intern(i+1)); array->append(Integer::intern(i+1));
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -383,6 +385,8 @@ get_selected_patch_cf(Value** arg_list, int count)
if (tri->patch.patchSel[i]) if (tri->patch.patchSel[i])
array->append(Integer::intern(i+1)); array->append(Integer::intern(i+1));
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -428,6 +432,8 @@ get_selected_vertex_cf(Value** arg_list, int count)
if (tri->patch.vertSel[i]) if (tri->patch.vertSel[i])
array->append(Integer::intern(i+1)); array->append(Integer::intern(i+1));
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -617,6 +623,8 @@ set_vertex_count_cf(Value** arg_list, int count)
{ {
nRet=tri->patch.numVerts; nRet=tri->patch.numVerts;
} }
if (os.obj != tri)
delete tri;
} }
return Integer::intern(nRet); return Integer::intern(nRet);
@ -655,6 +663,8 @@ set_vector_count_cf(Value** arg_list, int count)
{ {
nRet=tri->patch.numVecs; nRet=tri->patch.numVecs;
} }
if (os.obj != tri)
delete tri;
} }
return Integer::intern(nRet); return Integer::intern(nRet);
@ -702,6 +712,8 @@ set_vertex_pos_cf(Value** arg_list, int count)
node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime()); ip->RedrawViews(ip->GetTime());
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -750,6 +762,8 @@ set_vector_pos_cf(Value** arg_list, int count)
node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime()); ip->RedrawViews(ip->GetTime());
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -792,6 +806,8 @@ get_vertex_pos_cf(Value** arg_list, int count)
{ {
vRet=new Point3Value (tri->patch.verts[nVertex].p); vRet=new Point3Value (tri->patch.verts[nVertex].p);
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -834,6 +850,8 @@ get_vector_pos_cf(Value** arg_list, int count)
{ {
vRet=new Point3Value (tri->patch.vecs[nVertex].p); vRet=new Point3Value (tri->patch.vecs[nVertex].p);
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -877,6 +895,8 @@ get_edge_vect1_cf(Value** arg_list, int count)
{ {
nVert=tri->patch.edges[nEdge].vec12; nVert=tri->patch.edges[nEdge].vec12;
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -919,6 +939,8 @@ get_edge_vect2_cf(Value** arg_list, int count)
{ {
nVert=tri->patch.edges[nEdge].vec21; nVert=tri->patch.edges[nEdge].vec21;
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -961,6 +983,8 @@ get_edge_vert1_cf(Value** arg_list, int count)
{ {
nVert=tri->patch.edges[nEdge].v1; nVert=tri->patch.edges[nEdge].v1;
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -1004,6 +1028,8 @@ get_edge_vert2_cf(Value** arg_list, int count)
{ {
nVert=tri->patch.edges[nEdge].v2; nVert=tri->patch.edges[nEdge].v2;
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -1050,6 +1076,8 @@ get_sel_edge_cf(Value** arg_list, int count)
array->append(Integer::intern(i+1)); array->append(Integer::intern(i+1));
//array->data[j++]=; //array->data[j++]=;
} }
if (os.obj != tri)
delete tri;
} }
} }
@ -1158,6 +1186,8 @@ set_tile_steps_cf(Value** arg_list, int count)
nTess=5; nTess=5;
tri->rpatch->rTess.TileTesselLevel=nTess; tri->rpatch->rTess.TileTesselLevel=nTess;
tri->rpatch->InvalidateChannels (PART_ALL); tri->rpatch->InvalidateChannels (PART_ALL);
if (os.obj != tri)
delete tri;
} }
if (bRet) if (bRet)
{ {

@ -755,6 +755,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac
TCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } TCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); }
void ActivateSubobjSel(int level, XFormModes& modes ); void ActivateSubobjSel(int level, XFormModes& modes );
int NeedUseSubselButton() { return 0; } int NeedUseSubselButton() { return 0; }
void SelectSubPatch(int index);
void SelectSubComponent( HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert ); void SelectSubComponent( HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert );
void ClearSelection(int selLevel); void ClearSelection(int selLevel);
void SelectAll(int selLevel); void SelectAll(int selLevel);

@ -514,8 +514,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 10, 0, 0 FILEVERSION 0, 11, 0, 0
PRODUCTVERSION 0, 10, 0, 0 PRODUCTVERSION 0, 11, 0, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -533,13 +533,13 @@ BEGIN
VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0" VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0"
VALUE "CompanyName", "Ryzom Core" VALUE "CompanyName", "Ryzom Core"
VALUE "FileDescription", "NeL Patch Edit" VALUE "FileDescription", "NeL Patch Edit"
VALUE "FileVersion", "0.10.0" VALUE "FileVersion", "0.11.0"
VALUE "InternalName", "neleditpatch" VALUE "InternalName", "neleditpatch"
VALUE "LegalCopyright", "Copyright © 2000 Nevrax Ltd. Copyright © 1998 Autodesk Inc." VALUE "LegalCopyright", "Copyright © 2000 Nevrax Ltd. Copyright © 1998 Autodesk Inc."
VALUE "LegalTrademarks", "The following are registered trademarks of Autodesk, Inc.: 3D Studio MAX. The following are trademarks of Autodesk, Inc.: Kinetix, Kinetix(logo), BIPED, Physique, Character Studio, MAX DWG, DWG Unplugged, Heidi, FLI, FLC, DXF." VALUE "LegalTrademarks", "The following are registered trademarks of Autodesk, Inc.: 3D Studio MAX. The following are trademarks of Autodesk, Inc.: Kinetix, Kinetix(logo), BIPED, Physique, Character Studio, MAX DWG, DWG Unplugged, Heidi, FLI, FLC, DXF."
VALUE "OriginalFilename", "neleditpatch.dlm" VALUE "OriginalFilename", "neleditpatch.dlm"
VALUE "ProductName", "Ryzom Core" VALUE "ProductName", "Ryzom Core"
VALUE "ProductVersion", "0.10.0" VALUE "ProductVersion", "0.11.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

@ -84,6 +84,31 @@
*> Copyright(c) 1994, All Rights Reserved. *> Copyright(c) 1994, All Rights Reserved.
**********************************************************************/ **********************************************************************/
#include "stdafx.h" #include "stdafx.h"
#if MAX_VERSION_MAJOR >= 14
# include <maxscript/maxscript.h>
# include <maxscript/foundation/3dmath.h>
# include <maxscript/foundation/numbers.h>
# include <maxscript/maxwrapper/maxclasses.h>
# include <maxscript/foundation/streams.h>
# include <maxscript/foundation/mxstime.h>
# include <maxscript/maxwrapper/mxsobjects.h>
# include <maxscript/compiler/parser.h>
# include <maxscript/macros/define_instantiation_functions.h>
#else
# include <MaxScrpt/maxscrpt.h>
# include <MaxScrpt/3dmath.h>
// Various MAX and MXS includes
# include <MaxScrpt/Numbers.h>
# include <MaxScrpt/MAXclses.h>
# include <MaxScrpt/Streams.h>
# include <MaxScrpt/MSTime.h>
# include <MaxScrpt/MAXObj.h>
# include <MaxScrpt/Parser.h>
// define the new primitives using macros from SDK
# include <MaxScrpt/definsfn.h>
#endif
#include "editpat.h" #include "editpat.h"
#include "../nel_patch_lib/vertex_neighborhood.h" #include "../nel_patch_lib/vertex_neighborhood.h"
@ -855,3 +880,67 @@ void ResetVert (PatchMesh *patch)
patch->computeInteriors(); patch->computeInteriors();
patch->InvalidateGeomCache (); patch->InvalidateGeomCache ();
} }
def_visible_primitive(turn_patch, "RykolTurnPatch");
Value *turn_patch_cf (Value** arg_list, int count)
{
// Make sure we have the correct number of arguments (2)
check_arg_count(RykolTurnPatch, 3, count);
// Check to see if the arguments match up to what we expect
// We want to use 'TurnAllTexturesOn <object to use>'
type_check(arg_list[0], MAXNode, "RykolTurnPatch [Node] [Modifier] [Patch]");
type_check(arg_list[1], MAXModifier, "RykolTurnPatch [Node] [Modifier] [Patch]");
type_check(arg_list[2], Integer, "RykolTurnPatch [Node] [Modifier] [Patch]");
// Get a good interface pointer
Interface *ip = MAXScript_interface;
// Get a INode pointer from the argument passed to us
INode *node = arg_list[0]->to_node();
nlassert (node);
// Get a Object pointer
ObjectState os = node->EvalWorldState(ip->GetTime());
// ok ?
bool bRet=false;
if (os.obj)
{
// Get class id
if (os.obj->CanConvertToType(RYKOLPATCHOBJ_CLASS_ID))
{
bRet = true;
RPO *tri = (RPO *)os.obj->ConvertToType(ip->GetTime(), RYKOLPATCHOBJ_CLASS_ID);
if (tri)
{
Modifier *mod = arg_list[1]->to_modifier();
if (mod)
{
EditPatchMod *epmod = (EditPatchMod *)mod;
epmod->ClearSelection(EP_PATCH);
epmod->SelectSubPatch(arg_list[2]->to_int() - 1);
epmod->DoPatchTurn(true);
epmod->ClearSelection(EP_PATCH);
}
else
{
bRet = false;
}
}
// Note that the TriObject should only be deleted
// if the pointer to it is not equal to the object
// pointer that called ConvertToType()
if (os.obj != tri)
delete tri;
// redraw and update
node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime());
}
}
return bRet?&true_value:&false_value;
}

@ -37,7 +37,6 @@ int EditPatchMod::DoAttach(INode *node, PatchMesh *attPatch, RPatchMesh *rattPat
nodes.DisposeTemporary(); nodes.DisposeTemporary();
return 0; return 0;
} }
patchData->BeginEdit(ip->GetTime());
// If the mesh isn't yet cached, this will cause it to get cached. // If the mesh isn't yet cached, this will cause it to get cached.
RPatchMesh *rpatch; RPatchMesh *rpatch;
@ -49,6 +48,7 @@ int EditPatchMod::DoAttach(INode *node, PatchMesh *attPatch, RPatchMesh *rattPat
} }
patchData->RecordTopologyTags(patch); patchData->RecordTopologyTags(patch);
RecordTopologyTags(); RecordTopologyTags();
patchData->BeginEdit(ip->GetTime());
// Transform the shape for attachment: // Transform the shape for attachment:
// If reorienting, just translate to align pivots // If reorienting, just translate to align pivots

@ -236,6 +236,50 @@ void EditPatchMod::SetSelLevel(DWORD level)
// ------------------------------------------------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SelectSubPatch(int index)
{
if (!ip)
return;
TimeValue t = ip->GetTime();
ip->ClearCurNamedSelSet();
ModContextList mcList;
INodeTab nodes;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
return;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
return;
patchData->BeginEdit(t);
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent"));
patch->patchSel.Set(index);
patchData->UpdateChanges(patch, rpatch, FALSE);
if (patchData->tempData)
{
patchData->tempData->Invalidate(PART_SELECT);
}
}
PatchSelChanged();
UpdateSelectDisplay();
NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// Select a subcomponent within our object(s). WARNING! Because the HitRecord list can // Select a subcomponent within our object(s). WARNING! Because the HitRecord list can
// indicate any of the objects contained within the group of patches being edited, we need // indicate any of the objects contained within the group of patches being edited, we need
// to watch for control breaks in the patchData pointer within the HitRecord! // to watch for control breaks in the patchData pointer within the HitRecord!

@ -176,6 +176,7 @@ LockBorders = KeyL;
ZoomIn = Key1; ZoomIn = Key1;
ZoomOut = Key2; ZoomOut = Key2;
GetState = Key3; GetState = Key3;
ResetPatch = KeyF10;
/*************** /***************
*This is the the light settings *This is the the light settings

@ -96,8 +96,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 10, 0, 0 FILEVERSION 0, 11, 1, 0
PRODUCTVERSION 0, 10, 0, 0 PRODUCTVERSION 0, 11, 1, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -116,14 +116,14 @@ BEGIN
VALUE "Comments", "TECH: cyril.corvazier\0" VALUE "Comments", "TECH: cyril.corvazier\0"
VALUE "CompanyName", "Ryzom Core\0" VALUE "CompanyName", "Ryzom Core\0"
VALUE "FileDescription", "NeL Patch Paint\0" VALUE "FileDescription", "NeL Patch Paint\0"
VALUE "FileVersion", "0.10.0\0" VALUE "FileVersion", "0.11.1\0"
VALUE "InternalName", "mods\0" VALUE "InternalName", "mods\0"
VALUE "LegalCopyright", "Copyright © 2000 Nevrax Ltd\0" VALUE "LegalCopyright", "Copyright © 2000 Nevrax Ltd\0"
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "nelpatchpaint.dlm\0" VALUE "OriginalFilename", "nelpatchpaint.dlm\0"
VALUE "PrivateBuild", "\0" VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Ryzom Core\0" VALUE "ProductName", "Ryzom Core\0"
VALUE "ProductVersion", "0.10.0\0" VALUE "ProductVersion", "0.11.1\0"
VALUE "SpecialBuild", "\0" VALUE "SpecialBuild", "\0"
END END
END END

@ -145,7 +145,7 @@ std::vector<CZoneSymmetrisation> symVector;
// Painter modes // Painter modes
enum TModePaint { ModeTile, ModeColor, ModeDisplace}; enum TModePaint { ModeTile, ModeColor, ModeDisplace};
enum TModeMouse { ModePaint, ModeSelect, ModePick, ModeFill, ModeGetState }; enum TModeMouse { ModePaint, ModeSelect, ModePick, ModeFill, ModeGetState, ModeResetPatch };
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
@ -2585,6 +2585,13 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
// Set mode // Set mode
modeSelect=ModeGetState; modeSelect=ModeGetState;
// Mode reset zone
if (AsyncListener.isKeyDown ((TKey)PainterKeys[ResetPatch]))
{
// Set mode
modeSelect=ModeResetPatch;
}
// Mode picking // Mode picking
if (AsyncListener.isKeyDown ((TKey)PainterKeys[Fill0])) if (AsyncListener.isKeyDown ((TKey)PainterKeys[Fill0]))
{ {
@ -2891,6 +2898,8 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
SetCursor (bankCont->HFill); SetCursor (bankCont->HFill);
else if (pData->pobj->TileTrick) else if (pData->pobj->TileTrick)
SetCursor (bankCont->HTrick); SetCursor (bankCont->HTrick);
else if (modeSelect==ModeResetPatch)
SetCursor (LoadCursor (NULL, IDC_NO));
else else
SetCursor (LoadCursor (NULL, IDC_ARROW)); SetCursor (LoadCursor (NULL, IDC_ARROW));
@ -3034,7 +3043,7 @@ private:
// Callback on mouse events // Callback on mouse events
virtual void operator ()(const CEvent& event) virtual void operator ()(const CEvent& event)
{ {
if (event==EventDestroyWindowId) if (event==EventDestroyWindowId || event==EventCloseWindowId)
{ {
WindowActive=false; WindowActive=false;
} }
@ -3140,9 +3149,30 @@ private:
_FillTile.fillColor (mesh1, patch, _VectMesh, maxToNel (color1), (uint16)(256.f*opa1), PaintColor); _FillTile.fillColor (mesh1, patch, _VectMesh, maxToNel (color1), (uint16)(256.f*opa1), PaintColor);
else if (nModeTexture==ModeDisplace) else if (nModeTexture==ModeDisplace)
// Fill this patch with the current color // Fill this patch with the current displace
_FillTile.fillDisplace (mesh1, patch, _VectMesh, bank); _FillTile.fillDisplace (mesh1, patch, _VectMesh, bank);
} }
else if (modeSelect==ModeResetPatch)
{
int np = _VectMesh[mesh1].PMesh->numPatches;
for (int pp = 0; pp < np; ++pp)
{
// Fill default tile
_FillTile.fillTile (mesh1, pp, _VectMesh, -1, 0, 0, true, bank);
// Fill default color
_FillTile.fillColor (mesh1, pp, _VectMesh, CRGBA(255, 255, 255), 256, PaintColor);
// Backup current displace, fill default, restore
int bkdt = _Pobj->DisplaceTile;
int bkdts = _Pobj->DisplaceTileSet;
_Pobj->DisplaceTile = 0;
_Pobj->DisplaceTileSet = -1;
_FillTile.fillDisplace (mesh1, pp, _VectMesh, bank);
_Pobj->DisplaceTile = bkdt;
_Pobj->DisplaceTileSet = bkdts;
}
}
} }
} }
// Pick with right mouse // Pick with right mouse
@ -4095,7 +4125,7 @@ DWORD WINAPI myThread (LPVOID vData)
// Create a Landscape. // Create a Landscape.
CLandscapeModel *TheLand= (CLandscapeModel*)CNELU::Scene->createModel(LandscapeModelId); CLandscapeModel *TheLand= (CLandscapeModel*)CNELU::Scene->createModel(LandscapeModelId);
TheLand->Landscape.setTileNear (1000.f); TheLand->Landscape.setTileNear (10000.f);
TheLand->Landscape.TileBank=bank; TheLand->Landscape.TileBank=bank;
// Enbable automatique lighting // Enbable automatique lighting
@ -4192,7 +4222,7 @@ DWORD WINAPI myThread (LPVOID vData)
mat.setPos(P); mat.setPos(P);
CNELU::Camera->setTransformMode (ITransformable::DirectMatrix); CNELU::Camera->setTransformMode (ITransformable::DirectMatrix);
CNELU::Camera->setMatrix (mat); CNELU::Camera->setMatrix (mat);
CNELU::Camera->setPerspective( 75.f*(float)Pi/180.f/*vp->GetFOV()*/, 1.33f, 0.1f, 1000.f); CNELU::Camera->setPerspective( 75.f*(float)Pi/180.f/*vp->GetFOV()*/, 1.33f, 0.1f, 10000.f);
// Resize the sym vector // Resize the sym vector
symVector.resize (pData->VectMesh.size()); symVector.resize (pData->VectMesh.size());
@ -4257,6 +4287,7 @@ DWORD WINAPI myThread (LPVOID vData)
CNELU::EventServer.addListener (EventMouseUpId, &listener); CNELU::EventServer.addListener (EventMouseUpId, &listener);
CNELU::EventServer.addListener (EventMouseDblClkId, &listener); CNELU::EventServer.addListener (EventMouseDblClkId, &listener);
CNELU::EventServer.addListener (EventDestroyWindowId, &listener); CNELU::EventServer.addListener (EventDestroyWindowId, &listener);
CNELU::EventServer.addListener (EventCloseWindowId, &listener);
CNELU::EventServer.addListener (EventKeyDownId, &listener); CNELU::EventServer.addListener (EventKeyDownId, &listener);
// Camera position // Camera position
@ -4326,6 +4357,7 @@ DWORD WINAPI myThread (LPVOID vData)
CNELU::EventServer.removeListener (EventMouseDblClkId, &listener); CNELU::EventServer.removeListener (EventMouseDblClkId, &listener);
CNELU::EventServer.removeListener (EventKeyDownId, &listener); CNELU::EventServer.removeListener (EventKeyDownId, &listener);
CNELU::EventServer.removeListener (EventDestroyWindowId, &listener); CNELU::EventServer.removeListener (EventDestroyWindowId, &listener);
CNELU::EventServer.removeListener (EventCloseWindowId, &listener);
// End. // End.
//======== //========

@ -43,6 +43,7 @@ uint PainterKeys[KeyCounter]=
Key1, Key1,
Key2, Key2,
KeyI, KeyI,
KeyF10,
}; };
// Keys // Keys
@ -77,6 +78,7 @@ const char* PainterKeysName[KeyCounter]=
"ZoomIn", "ZoomIn",
"ZoomOut", "ZoomOut",
"GetState", "GetState",
"ResetPatch",
}; };
// Light settings // Light settings

@ -122,6 +122,7 @@ enum PainterKeysType
ZoomIn, ZoomIn,
ZoomOut, ZoomOut,
GetState, GetState,
ResetPatch,
KeyCounter KeyCounter
}; };

@ -125,8 +125,8 @@ IDC_DROPPER_CURSOR CURSOR DISCARDABLE "dropcurs.cur"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 10, 0, 0 FILEVERSION 0, 11, 0, 0
PRODUCTVERSION 0, 10, 0, 0 PRODUCTVERSION 0, 11, 0, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -145,13 +145,13 @@ BEGIN
VALUE "Comments", "TECH: \0" VALUE "Comments", "TECH: \0"
VALUE "CompanyName", "Ryzom Core\0" VALUE "CompanyName", "Ryzom Core\0"
VALUE "FileDescription", "Vertex Tree Paint\0" VALUE "FileDescription", "Vertex Tree Paint\0"
VALUE "FileVersion", "0.10.0\0" VALUE "FileVersion", "0.11.0\0"
VALUE "InternalName", "VertexTreePaint\0" VALUE "InternalName", "VertexTreePaint\0"
VALUE "LegalCopyright", "Copyright © 2000 Nevrax Ltd. Copyright © 1998 Autodesk Inc.\0" VALUE "LegalCopyright", "Copyright © 2000 Nevrax Ltd. Copyright © 1998 Autodesk Inc.\0"
VALUE "LegalTrademarks", "The following are registered trademarks of Autodesk, Inc.: 3D Studio MAX. The following are trademarks of Autodesk, Inc.: Kinetix, Kinetix(logo), BIPED, Physique, Character Studio, MAX DWG, DWG Unplugged, Heidi, FLI, FLC, DXF.\0" VALUE "LegalTrademarks", "The following are registered trademarks of Autodesk, Inc.: 3D Studio MAX. The following are trademarks of Autodesk, Inc.: Kinetix, Kinetix(logo), BIPED, Physique, Character Studio, MAX DWG, DWG Unplugged, Heidi, FLI, FLC, DXF.\0"
VALUE "OriginalFilename", "nel_vertex_tree_paint.dlm\0" VALUE "OriginalFilename", "nel_vertex_tree_paint.dlm\0"
VALUE "ProductName", "Ryzom Core\0" VALUE "ProductName", "Ryzom Core\0"
VALUE "ProductVersion", "0.10.0\0" VALUE "ProductVersion", "0.11.0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

@ -0,0 +1,124 @@
gc()
nodes = getCurrentSelection()
max select none
clearselection()
undo off
(
for cnode in nodes do
(
if (classof cnode) == Editable_Patch or (classof cnode) == RklPatch then
(
print cnode.name
selectmore cnode
if (classof cnode) == Editable_Patch and (classof cnode) != RklPatch then
(
modPanel.addModToSelection (NeL_Convert ()) ui:on
)
modPanel.addModToSelection (NeL_Edit ()) ui:on
setCommandPanelTaskMode #modify
cmod = modpanel.getCurrentObject()
pcount = (GetRykolPatchCount cnode)
print pcount
for p = 1 to pcount do
(
--print p
vbegin = (NeLGetPatchVertex cnode p 1)
vend = (NeLGetPatchVertex cnode p 2)
vref = (NeLGetPatchVertex cnode p 3)
begin = (GetRykolVertexPos cnode vbegin)
end = (GetRykolVertexPos cnode vend)
ref = (GetRykolVertexPos cnode vref)
normal = (cross (end - begin) (ref - begin))
normal = (normalize normal)
rotnormal = (point3 0 0 0)
if (normal.z > 0.9) then
(
--print "x normal"
rotnormal = (normal * (rotateXMatrix -90))
)
else
(
normal.z = 0
normal = (normalize normal)
rotnormal = (normal * (rotateZMatrix -90))
)
--print rotnormal
-- print normal
-- print rotnormal
-- print begin
-- print end
dir = (normalize (end - begin))
-- print dir
score1 = (dot dir rotnormal)
RykolTurnPatch cnode cmod (p)
vbegin = (NeLGetPatchVertex cnode p 1)
vend = (NeLGetPatchVertex cnode p 2)
begin = (GetRykolVertexPos cnode vbegin)
end = (GetRykolVertexPos cnode vend)
dir = (normalize (end - begin))
score2 = (dot dir rotnormal)
RykolTurnPatch cnode cmod (p)
vbegin = (NeLGetPatchVertex cnode p 1)
vend = (NeLGetPatchVertex cnode p 2)
begin = (GetRykolVertexPos cnode vbegin)
end = (GetRykolVertexPos cnode vend)
dir = (normalize (end - begin))
score3 = (dot dir rotnormal)
RykolTurnPatch cnode cmod (p)
vbegin = (NeLGetPatchVertex cnode p 1)
vend = (NeLGetPatchVertex cnode p 2)
begin = (GetRykolVertexPos cnode vbegin)
end = (GetRykolVertexPos cnode vend)
dir = (normalize (end - begin))
score4 = (dot dir rotnormal)
-- print score1
-- print score2
-- print score3
-- print score4
if (score1 > score2 and score1 > score3 and score1 > score4) then
(
-- print "score 1"
RykolTurnPatch cnode cmod (p)
)
else if (score2 > score3 and score2 > score4) then
(
-- print "score 2"
RykolTurnPatch cnode cmod (p)
RykolTurnPatch cnode cmod (p)
)
else if (score3 > score4) then
(
-- print "score 3"
RykolTurnPatch cnode cmod (p)
RykolTurnPatch cnode cmod (p)
RykolTurnPatch cnode cmod (p)
)
else
(
-- print "score 4"
)
)
maxOps.CollapseNode cnode off
max select none
)
)
)
max select none
clearselection()
undo off
(
for cnode in nodes do
(
selectmore cnode
)
)

@ -0,0 +1,68 @@
-- This script sets proper centered zone positions and generates their names
-- Use after cutting the zone into 160m by 160m pieces
cell_size = 160.0
offset_x = 7680 / 2
offset_y = -(20480 + (5120 / 2))
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-- http://proofofprogress.blogspot.be/2011/03/solution-align-pivot-to-world-without.html
Function alignPivotToWorld &theObject = (
--VLM = Visible Local Matrix.
--The matrix/pivot you see when selecting object and "Local" axis is selected as viewable.
VLM = theObject.Transform;
IP_LocalRot = theObject.objectOffsetRot; --Rotation to be used later.
IP_LOCAL = theObject.objectOffsetPos; --Invisible Pivot Local coordinates
--In relation to VLM matrix.
IP_WORLD = IP_LOCAL * VLM; --World Coordinates of Invisible Pivot. [Local To World Transform]
VLM_0 = matrix3 1; --Reset Visible Local matrix coordinates.
NEW_IP_LOCAL = IP_WORLD * inverse(VLM_0); --[World To local Transform]
theObject.Transform = VLM_0;
theObject.objectOffsetPos = NEW_IP_LOCAL;
--Now Handle Rotation:
--Since rotation of visible local matrix has been zeroed out,
--You must add that loss to the invisible pivot rotation.
GeomWorldRot = VLM.RotationPart + IP_LocalRot;
theObject.objectOffsetRot = GeomWorldRot;
)
-- Convert a coordinate in a name
-- name = coordToName #(x, y)
fn coordToName coord =
(
up = floor(coord[1] / 26) + 1
down = floor(coord[1] - ((up-1) * 26)) + 1
return (((-coord[2] + 1) as integer) as string) + "_" + alphabet[up] + alphabet[down]
)
fn realCoordToName coord =
(
return coordToName(#(((coord[1] + offset_x) / cell_size) + 0.5, ((coord[2] + offset_y) / cell_size) + 0.5))
)
fn roundedCoord coord =
(
return #(ceil(coord[1] / cell_size) * cell_size - (cell_size / 2), ceil(coord[2] / cell_size) * cell_size - (cell_size / 2))
)
max select none
clearselection()
for node in geometry do
(
if (classof node) == RklPatch or (classof node) == Editable_Patch then
(
newcoords = roundedCoord(#(node.center.x, node.center.y))
newname = realCoordToName(newcoords)
node.name = newname
alignPivotToWorld &node
node.pivot.x = newcoords[1]
node.pivot.y = newcoords[2]
resetxform node
maxOps.CollapseNode node off
)
)

@ -0,0 +1,162 @@
-- Use to take the snapshots of a large manually created zone
from_x = 160
size_x = 7680-320
from_y = -25600+160
size_y = 5120-320
targetdir = "W:/database/landscape/ligo/asteroids/max"
snapshotdir = "W:/database/landscape/ligo/asteroids/zonebitmaps"
zonename = "anne"
resumeonly = true
cell_size = 160.0
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
fn lowercase instring = -- beginning of function definition
(
local upper, lower, outstring -- declare variables as local
upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ" -- set variables to literals
lower="abcdefghijklmnopqrstuvwxyz"
outstring=copy instring
for i=1 to outstring.count do
(
j=findString upper outstring[i]
if (j != undefined) do outstring[i]=lower[j]
)
return outstring -- value of outstring will be returned as function result
)
fn existFile fname = (getfiles fname).count != 0
-- Convert a coordinate in a name
-- name = coordToName #(x, y)
fn coordToName coord =
(
up = floor(coord[1] / 26) + 1
down = floor(coord[1] - ((up-1) * 26)) + 1
return (((-coord[2] + 1) as integer) as string) + "_" + alphabet[up] + alphabet[down]
)
fn roundedCoord coord =
(
return #(ceil(coord[1] / cell_size) * cell_size - (cell_size / 2), ceil(coord[2] / cell_size) * cell_size - (cell_size / 2))
)
fn coordId coord =
(
coordr = (roundedCoord coord)
return #(((coordr[1]) / cell_size) + 0.5, ((coordr[2]) / cell_size) + 0.5)
)
from_coord = (coordId #(from_x, from_y))
to_coord = (coordId #(from_x + size_x, from_y + size_y))
print from_coord
print to_coord
print (coordToName from_coord)
undo off
(
for x=from_coord[1] to to_coord[1] do
(
for y=from_coord[2] to to_coord[2] do
(
ny=y+1
sy=y-1
ex=x+1
wx=x-1
zc = coordToName #(x, y)
zn = coordToName #(x, ny)
zne = coordToName #(ex, ny)
ze = coordToName #(ex, y)
zse = coordToName #(ex, sy)
zs = coordToName #(x, sy)
zsw = coordToName #(wx, sy)
zw = coordToName #(wx, y)
znw = coordToName #(wx, ny)
maxc = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zc) + ".max"
csnapfile = snapshotdir + "/" + zonename + "-" + (lowercase zc) + ".tga"
if existFile maxc and (not resumeonly or not (existFile csnapfile)) then
(
print zc
resetMAXFile #noprompt
gc()
mergeMAXFile maxc #(zc)
ccenter = getnodebyname zc
maxn = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zn) + ".max"
if existFile maxn then
(
mergeMAXFile maxn #(zn)
cnode = getnodebyname zn
cnode.position.y = cnode.position.y + 160
NeLAttachPatchMesh cnode ccenter
)
maxne = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zne) + ".max"
if existFile maxne then
(
mergeMAXFile maxne #(zne)
cnode = getnodebyname zne
cnode.position.x = cnode.position.x + 160
cnode.position.y = cnode.position.y + 160
NeLAttachPatchMesh cnode ccenter
)
maxe = targetdir + "/zonematerial-" + zonename + "-" + (lowercase ze) + ".max"
if existFile maxe then
(
mergeMAXFile maxe #(ze)
cnode = getnodebyname ze
cnode.position.x = cnode.position.x + 160
NeLAttachPatchMesh cnode ccenter
)
maxse = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zse) + ".max"
if existFile maxse then
(
mergeMAXFile maxse #(zse)
cnode = getnodebyname zse
cnode.position.x = cnode.position.x + 160
cnode.position.y = cnode.position.y - 160
NeLAttachPatchMesh cnode ccenter
)
maxs = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zs) + ".max"
if existFile maxs then
(
mergeMAXFile maxs #(zs)
cnode = getnodebyname zs
cnode.position.y = cnode.position.y - 160
NeLAttachPatchMesh cnode ccenter
)
maxsw = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zsw) + ".max"
if existFile maxsw then
(
mergeMAXFile maxsw #(zsw)
cnode = getnodebyname zsw
cnode.position.x = cnode.position.x - 160
cnode.position.y = cnode.position.y - 160
--NeLAttachPatchMesh cnode ccenter
)
maxw = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zw) + ".max"
if existFile maxw then
(
mergeMAXFile maxw #(zw)
cnode = getnodebyname zw
cnode.position.x = cnode.position.x - 160
NeLAttachPatchMesh cnode ccenter
)
maxnw = targetdir + "/zonematerial-" + zonename + "-" + (lowercase znw) + ".max"
if existFile maxnw then
(
mergeMAXFile maxnw #(znw)
cnode = getnodebyname znw
cnode.position.x = cnode.position.x - 160
cnode.position.y = cnode.position.y + 160
NeLAttachPatchMesh cnode ccenter
)
NeLWeldPatchMesh ccenter 1.0
NeLLigoMakeSnapShot ccenter csnapfile 0 1 0 1 false
)
)
)
)

@ -124,8 +124,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 10, 0, 0 FILEVERSION 0, 11, 0, 0
PRODUCTVERSION 0, 10, 0, 0 PRODUCTVERSION 0, 11, 0, 0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -142,12 +142,12 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0" VALUE "Comments", "Based on Kinetix 3D Studio Max 3.0 plugin sample\0"
VALUE "CompanyName", "Ryzom Core\0" VALUE "CompanyName", "Ryzom Core\0"
VALUE "FileVersion", "0.10.0\0" VALUE "FileVersion", "0.11.0\0"
VALUE "InternalName", "Tile_utility\0" VALUE "InternalName", "Tile_utility\0"
VALUE "LegalCopyright", "\0" VALUE "LegalCopyright", "\0"
VALUE "OriginalFilename", "Tile_utility.dlu\0" VALUE "OriginalFilename", "Tile_utility.dlu\0"
VALUE "ProductName", "Ryzom Core\0" VALUE "ProductName", "Ryzom Core\0"
VALUE "ProductVersion", "0.10.0\0" VALUE "ProductVersion", "0.11.0\0"
VALUE "FileDescription", "Create material for tiles\0" VALUE "FileDescription", "Create material for tiles\0"
VALUE "Comments", "TECH: \0" VALUE "Comments", "TECH: \0"
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"

@ -885,7 +885,7 @@ void Browse::OnChangeVariety()
void Browse::OnBatchLoad () void Browse::OnBatchLoad ()
{ {
CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING,
"Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
if (sFile.DoModal()==IDOK) if (sFile.DoModal()==IDOK)
{ {
@ -1365,7 +1365,7 @@ void Browse::OnExportBorder()
{ {
// Select a file // Select a file
CFileDialog sFile (false, NULL, NULL, OFN_ENABLESIZING, CFileDialog sFile (false, NULL, NULL, OFN_ENABLESIZING,
"Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
if (sFile.DoModal()==IDOK) if (sFile.DoModal()==IDOK)
{ {
// Get the border of the bank // Get the border of the bank
@ -1431,7 +1431,7 @@ void Browse::OnImportBorder()
{ {
// Select a file // Select a file
CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING,
"Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
if (sFile.DoModal()==IDOK) if (sFile.DoModal()==IDOK)
{ {
// Get the border of the bank // Get the border of the bank

@ -1,4 +1,4 @@
FILE(GLOB SRC *.cpp *.h PIC/*.cpp PIC/*.h) FILE(GLOB SRC *.cpp *.h)
FILE(GLOB SRC2 cpu.cpp DllEntry.cpp Popup.* thread_win32.* TileCtrl.* TileList.* TileView.*) FILE(GLOB SRC2 cpu.cpp DllEntry.cpp Popup.* thread_win32.* TileCtrl.* TileList.* TileView.*)
LIST(REMOVE_ITEM SRC ${SRC2}) LIST(REMOVE_ITEM SRC ${SRC2})

@ -1,126 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <stdarg.h>
#define PIC_ERRSIZE 256
static unsigned long PIC_Sys_MEM_Allocated;
static unsigned long PIC_Sys_MEM_NbAllocs;
// ----------------------------------------------------------------------------------------------------------------------------------
void *Pic_malloc(unsigned long size)
{
void *mem;
mem=malloc(size);
if (mem)
{
PIC_Sys_MEM_Allocated+=size;
PIC_Sys_MEM_NbAllocs++;
}
return(mem);
}
// -----
void *Pic_calloc(unsigned long count, unsigned long size)
{
void *mem;
mem=calloc(count,size);
if (mem)
{
PIC_Sys_MEM_Allocated+=(size*count);
PIC_Sys_MEM_NbAllocs++;
}
return(mem);
}
// -----
void Pic_free(void *memblock)
{
unsigned long size;
size=(unsigned long)_msize(memblock);
PIC_Sys_MEM_Allocated-=size;
PIC_Sys_MEM_NbAllocs--;
free(memblock);
}
// -----
unsigned long Pic__msize(void *memblock)
{
return(unsigned long)(_msize(memblock));
}
// -----
unsigned long PIC_GetMemNbAllocs(void)
{
return(PIC_Sys_MEM_NbAllocs);
}
// -----
unsigned long PIC_GetMemAllocated(void)
{
return(PIC_Sys_MEM_Allocated);
}
// ----------------------------------------------------------------------------------------------------------------------------------
static char PIC_ErrorFlag;
static char PIC_ErrorString[PIC_ERRSIZE];
static unsigned char PIC_Sys_FnctActive=0;
static void (*PIC_Sys_Fnct)(void);
void Pic_SetError(const char *msg, ...)
{
char curerr[PIC_ERRSIZE],olderr[PIC_ERRSIZE];
va_list args;
va_start(args,msg);
vsprintf(curerr,msg,args);
va_end(args);
if ( (strlen(curerr)+strlen(PIC_ErrorString))>PIC_ERRSIZE ) return;
if (PIC_ErrorFlag)
{
strcpy(olderr,PIC_ErrorString);
sprintf(PIC_ErrorString,"--- [PIC#%03d] :\n%s",PIC_ErrorFlag,curerr);
strcat(PIC_ErrorString,"\n");
strcat(PIC_ErrorString,olderr);
}
else
{
sprintf(PIC_ErrorString,"--- [PIC#%03d] :\n%s",PIC_ErrorFlag,curerr);
}
PIC_ErrorFlag++;
if (PIC_Sys_FnctActive) PIC_Sys_Fnct();
return;
}
// -----
char* PIC_GetError(void)
{
return(PIC_ErrorString);
}
// -----
unsigned char PIC_Error(void)
{
return(PIC_ErrorFlag);
}
// -----
void PIC_ResetError(void)
{
strcpy(PIC_ErrorString,"");
PIC_ErrorFlag=0;
}
// -----
unsigned char PIC_OnErrorCall( void pFnct(void) )
{
if (pFnct != NULL)
{
PIC_Sys_Fnct=pFnct;
PIC_Sys_FnctActive=1;
}
else
{
PIC_Sys_FnctActive=0;
}
return(1);
}
// ----------------------------------------------------------------------------------------------------------------------------------

@ -1,215 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pic_private.h"
#include "pic.h"
// ----------------------------------------------------------------------------------------------------------------------------------
#pragma pack(1)
typedef struct BMP_HEADER
{
unsigned short bfType;
unsigned long bfSize;
unsigned short Res1;
unsigned short Res2;
unsigned long bfOffBits;
unsigned long biSize;
unsigned long biWidth;
unsigned long biHeight;
unsigned short biPlanes;
unsigned short biBitCount;
unsigned long biCompression;
unsigned long biSizeImage;
unsigned long biXPelsPerMeter;
unsigned long biYPelsPerMeter;
unsigned long biClrUsed;
unsigned long biClrImportant;
} BMP_HEADER;
#pragma pack()
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_BMP_Write( const char *FileName,
char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d)
{
FILE *file;
BMP_HEADER bmph;
unsigned long slsize;
unsigned char *scanline;
unsigned long i;
long x,y,rest;
unsigned char r,g,b;
file=fopen(FileName,"wb");
if (!file)
{
return(0);
}
memset(&bmph,0,sizeof(BMP_HEADER));
bmph.bfType=19778;
bmph.bfSize=sizeof(BMP_HEADER);
bmph.bfSize+=w*h*d/8;
if (pPal)
{
bmph.bfSize+=(256*4);
}
bmph.bfOffBits=sizeof(BMP_HEADER);
if (pPal)
{
bmph.bfOffBits+=(256*4);
}
bmph.biSize=40;//sizeof(BMP_HEADER);
bmph.biWidth=w;
bmph.biHeight=h;
bmph.biPlanes=1;
bmph.biBitCount=(unsigned short)d;
bmph.biCompression=0;
bmph.biSizeImage=w*h*d/8;
fwrite(&bmph,1,sizeof(BMP_HEADER),file);
if (pPal)
{
for(i=0 ; i<256 ; i++)
{
fwrite(&pPal[i*3+0],1,1,file);
fwrite(&pPal[i*3+1],1,1,file);
fwrite(&pPal[i*3+2],1,1,file);
fwrite(&pPal[i*3+2],1,1,file);
}
}
slsize=w*d/8;
scanline=(unsigned char*)Pic_calloc(1,slsize);
if (!scanline)
{
Pic_SetError("BMP_Write, not enough memory for scanline");
return(0);
}
for(rest=0 ; ((w*d/8)+rest)%4!=0 ; rest++);
for(y=0 ; y<(long)h ; y++)
{
memcpy(scanline,&pDatas[(h-y-1)*slsize],slsize);
if (d==24)
{
for(x=0 ; x<(long)w ; x++)
{
b=scanline[x*3+0];
g=scanline[x*3+1];
r=scanline[x*3+2];
scanline[x*3+0]=b;
scanline[x*3+1]=g;
scanline[x*3+2]=r;
}
}
fwrite(scanline,1,slsize,file);
if (rest)
{
fwrite(scanline,1,rest,file);
}
}
Pic_free(scanline);
fclose(file);
return(1);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_BMP_Read( const char *FileName,
char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth)
{
FILE *file;
BMP_HEADER bmph;
char *pPal;
char *pDatas;
unsigned char *scanline;
long w,h,d;
long i,x,y,rest;
unsigned char r,g,b;
unsigned char pad[4];
pPal=NULL;
pDatas=NULL;
file=fopen(FileName,"rb");
if (!file)
{
Pic_SetError("BMP_Read, unable to open %s",FileName);
return(0);
}
fread(&bmph,1,sizeof(BMP_HEADER),file);
*pWidth=w=bmph.biWidth;
*pHeight=h=bmph.biHeight;
*pDepth=d=bmph.biBitCount;
if (d!=8 && d!=24)
{
Pic_SetError("BMP_Read, number of bits per pixel unsupported");
return(0);
}
if (*pDepth==8)
{
pPal=(char*)Pic_calloc(1,256*3);
if (!pPal)
{
Pic_SetError("BMP_Read, not enough memory for palette");
return(0);
}
for(i=0 ; i<256 ; i++)
{
fread(&pPal[i*3+2],1,1,file);
fread(&pPal[i*3+1],1,1,file);
fread(&pPal[i*3+0],1,1,file);
fread(&pad[0],1,1,file);
}
}
pDatas=(char*)Pic_calloc(1,w*h*d/8);
if (!pDatas)
{
if (pPal)
{
Pic_free(pPal);
}
Pic_SetError("BMP_Read, not enough memory for datas");
return(0);
}
scanline=(unsigned char*)Pic_calloc(1,w*h*d/8);
if (!scanline)
{
if (pPal)
{
Pic_free(pPal);
}
Pic_free(pDatas);
Pic_SetError("BMP_Read, not enough memory for scanline");
return(0);
}
for(rest=0 ; (w+rest)%4!=0 ; rest++);
for(y=0 ; y<h ; y++)
{
fread(scanline,w,d/8,file);
if (d==24)
{
for(x=0 ; x<w ; x++)
{
r=scanline[x*3+0];
g=scanline[x*3+1];
b=scanline[x*3+2];
scanline[x*3+0]=b;
scanline[x*3+1]=g;
scanline[x*3+2]=r;
}
}
memcpy(&pDatas[(h-y-1)*w*d/8],scanline,w*d/8);
fread(pad,rest,d/8,file);
}
fclose(file);
Pic_free(scanline);
*ppPal=pPal;
*ppDatas=pDatas;
return(1);
}
// ----------------------------------------------------------------------------------------------------------------------------------

@ -1,160 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <string.h>
#include <jpeglib.h>
#include "pic_private.h"
#include "pic.h"
// ----------------------------------------------------------------------------------------------------------------------------------
struct my_error_mgr
{
struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer;
};
typedef struct my_error_mgr * my_error_ptr;
// ----------------------------------------------------------------------------------------------------------------------------------
static unsigned char error;
// ----------------------------------------------------------------------------------------------------------------------------------
void my_error_exit(j_common_ptr cinfo)
{
my_error_ptr myerr = (my_error_ptr) cinfo->err;
error=1;
longjmp(myerr->setjmp_buffer, 1);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_JPG_Read(const char *FileName, char **ppPal, char **ppDatas, unsigned long *w, unsigned long *h)
{
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
FILE *file;
JSAMPARRAY buffer;
int row_stride,i;
char *pDatas,*pPal;
unsigned long ptr;
error=0;
ptr=0;
file=fopen(FileName, "rb");
if (!file)
{
Pic_SetError("JPG_Read, unable to open %s",FileName);
return(0);
}
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
setjmp(jerr.setjmp_buffer);
if (error)
{
Pic_SetError("JPG_Read, internal decompression error");
jpeg_destroy_decompress(&cinfo);
return(0);
}
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, file);
(void) jpeg_read_header(&cinfo, TRUE);
*w=cinfo.image_width;
*h=cinfo.image_height;
if (!ppPal)
{
pDatas=(char*)Pic_calloc(1,(*w)*(*h)*3);
}
else
{
pDatas=(char*)Pic_calloc(1,(*w)*(*h));
pPal=(char*)Pic_calloc(1,256*3);
if (!pPal)
{
Pic_SetError("JPG_Read, not enough memory for palette");
return(0);
}
cinfo.desired_number_of_colors = 256;
cinfo.quantize_colors = TRUE;
cinfo.dither_mode = JDITHER_ORDERED;
}
if (!pDatas)
{
Pic_SetError("JPG_Read, not enough memory for pic");
return(0);
}
(void) jpeg_start_decompress(&cinfo);
row_stride = cinfo.output_width * cinfo.output_components;
buffer = (*cinfo.mem->alloc_sarray)
((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
while (cinfo.output_scanline < cinfo.output_height)
{
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
memcpy(&pDatas[ptr],buffer[0],row_stride);
ptr+=row_stride;
}
*ppDatas=pDatas;
if (ppPal)
{
for(i=0 ; i<256 ; i++)
{
pPal[i*3+0]=cinfo.colormap[2][i];
pPal[i*3+1]=cinfo.colormap[1][i];
pPal[i*3+2]=cinfo.colormap[0][i];
}
*ppPal=pPal;
}
(void) jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(file);
return(1);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_JPG_Write(const char *FileName, unsigned long Qual, char *pDatas, unsigned long w, unsigned long h)
{
struct jpeg_compress_struct cinfo;
struct my_error_mgr jerr;
FILE *file;
JSAMPROW row_pointer[1];
int row_stride;
error=0;
file=fopen(FileName,"wb");
if (!file)
{
Pic_SetError("JPG_Write, unable to open %s",FileName);
return(0);
}
jpeg_create_compress(&cinfo);
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
setjmp(jerr.setjmp_buffer);
if (error)
{
Pic_SetError("JPG_Write, internal compression error");
jpeg_destroy_compress(&cinfo);
return(0);
}
jpeg_stdio_dest(&cinfo, file);
cinfo.image_width = w;
cinfo.image_height = h;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo, Qual, TRUE);
jpeg_start_compress(&cinfo, TRUE);
row_stride = w * 3;
while(cinfo.next_scanline<cinfo.image_height)
{
row_pointer[0] = (JSAMPROW)& pDatas[cinfo.next_scanline * row_stride];
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
}
jpeg_finish_compress(&cinfo);
fclose(file);
jpeg_destroy_compress(&cinfo);
return(1);
}

@ -1,637 +0,0 @@
#include <string.h>
#include "pic_private.h"
#include "pic.h"
static unsigned long NbPics=0;
static PIC_PICTURE *HeadPic=NULL;
// ----------------------------------------------------------------------------------------------------------------------------------
static PIC_PICTURE *GetPic(unsigned long id)
{
PIC_PICTURE *pic;
for(pic=HeadPic ; pic ; pic=pic->Next)
{
if (pic->ID==id)
{
return(pic);
}
}
return(NULL);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long PIC_Load(char* FileName, unsigned char Quantize)
{
char ext[4];
unsigned long type;
unsigned long i,taken,id;
PIC_PICTURE *pic;
char *pDatas;
char *pPal;
unsigned long w,h,Depth;
unsigned long ret;
// --- Init
ret=0;
type=0;
id=0;
taken=0;
w=0;
h=0;
Depth=0;
pic=NULL;
pDatas=NULL;
pPal=NULL;
// --- Get 1st available ID
for(i=1 ; i<=NbPics+1 ; i++)
{
taken=0;
for(pic=HeadPic ; pic ; pic=pic->Next)
{
if (pic->ID==i)
{
taken=1;
break;
}
}
if (!taken)
{
id=i;
break;
}
}
if (!id)
{
Pic_SetError("Load, unable to create ID");
return(0);
}
// --- Load pic
if (FileName)
{
ext[0]=FileName[strlen(FileName)-3];
ext[1]=FileName[strlen(FileName)-2];
ext[2]=FileName[strlen(FileName)-1];
ext[3]=0;
strupr(ext);
if ( !strcmp(ext,"JPG") )
{
type=1;
}
else if ( !strcmp(ext,"TGA") )
{
type=2;
}
else if ( !strcmp(ext,"BMP") )
{
type=3;
}
switch(type)
{
// - JPG
case 1:
if (!Quantize)
{
Depth=24;
ret=Pic_JPG_Read(FileName,NULL,&pDatas,&w,&h);
}
else
{
Depth=8;
ret=Pic_JPG_Read(FileName,&pPal,&pDatas,&w,&h);
}
if (!ret)
{
Pic_SetError("Load, unable to load JPG file %s",FileName);
return(0);
}
break;
// - TGA
case 2:
ret=Pic_TGA_Read(FileName,&pPal,&pDatas,&w,&h,&Depth);
if (!ret)
{
Pic_SetError("Load, unable to load TGA file %s",FileName);
return(0);
}
break;
// - BMP
case 3:
ret=Pic_BMP_Read(FileName,&pPal,&pDatas,&w,&h,&Depth);
if (!ret)
{
Pic_SetError("Load, unable to load BMP file %s",FileName);
return(0);
}
break;
// - Unknown
default:
Pic_SetError("Load, unknown extension for %s",FileName);
return(0);
}
}
// --- Create and place new pic struct
pic=(PIC_PICTURE *)Pic_calloc(1,sizeof(PIC_PICTURE));
if (!pic)
{
Pic_SetError("Load, not enough memory for internal structure");
return(0);
}
pic->Next=HeadPic;
HeadPic=pic;
NbPics++;
pic->ID=id;
pic->pDatas=pDatas;
pic->pPal=pPal;
pic->Width=w;
pic->Height=h;
pic->Depth=Depth;
return(id);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long PIC_Create(char* pPal, char* pDatas, unsigned long w, unsigned long h, unsigned long d)
{
unsigned long i,taken,id;
PIC_PICTURE *pic;
// --- Init
id=0;
taken=0;
pic=NULL;
// --- Get 1st available ID
for(i=1 ; i<=NbPics+1 ; i++)
{
taken=0;
for(pic=HeadPic ; pic ; pic=pic->Next)
{
if (pic->ID==i)
{
taken=1;
break;
}
}
if (!taken)
{
id=i;
break;
}
}
if (!id)
{
Pic_SetError("Create, unable to create ID");
return(0);
}
// --- Create pic
if (!pDatas)
{
pDatas=(char *)Pic_calloc(1,w*h*d/8);
if (!pDatas)
{
Pic_SetError("Create, not enough memory for datas");
return(0);
}
}
if (d==8)
{
if (!pPal)
{
pPal=(char *)Pic_calloc(1,256*3);
if (!pPal)
{
Pic_SetError("Create, not enough memory for palette");
return(0);
}
}
}
else
{
pPal=NULL;
}
// --- Create and place new pic struct
pic=(PIC_PICTURE *)Pic_calloc(1,sizeof(PIC_PICTURE));
if (!pic)
{
Pic_SetError("Create, not enough memory for internal structure");
return(0);
}
pic->Next=HeadPic;
HeadPic=pic;
NbPics++;
pic->ID=id;
pic->pDatas=pDatas;
pic->pPal=pPal;
pic->Width=w;
pic->Height=h;
pic->Depth=d;
return(id);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long PIC_GetInfos( unsigned long id,
char **ppPal, char **ppDatas,
unsigned long *pW, unsigned long *pH, unsigned long *pD)
{
PIC_PICTURE *pic;
pic=GetPic(id);
if (!pic)
{
Pic_SetError("GetInfos, picture internal structure not found");
return(0);
}
if (ppPal)
{
*ppPal=pic->pPal;
}
if (ppDatas)
{
*ppDatas=pic->pDatas;
}
if (pW)
{
*pW=pic->Width;
}
if (pH)
{
*pH=pic->Height;
}
if (pD)
{
*pD=pic->Depth;
}
return(id);
}
// ----------------------------------------------------------------------------------------------------------------------------------
static char* Conv8To24(unsigned long id)
{
PIC_PICTURE *pic;
char *buf;
unsigned long i;
pic=GetPic(id);
if (!pic)
{
Pic_SetError("Conv8To24, picture internal structure not found");
return(NULL);
}
buf=(char *)Pic_malloc(pic->Width*pic->Height*3);
if (!buf)
{
Pic_SetError("Conv8To24, not enough memory for temporary buffer");
return(NULL);
}
for(i=0 ; i<pic->Width*pic->Height ; i++)
{
buf[i*3+0]=pic->pPal[pic->pDatas[i]*3+0];
buf[i*3+1]=pic->pPal[pic->pDatas[i]*3+1];
buf[i*3+2]=pic->pPal[pic->pDatas[i]*3+2];
}
return(buf);
}
// ----------------------------------------
static char* Conv8To16(unsigned long id)
{
PIC_PICTURE *pic;
unsigned short *buf;
unsigned long i;
unsigned short r,g,b,pix16;
pic=GetPic(id);
if (!pic)
{
Pic_SetError("Conv8To24, picture internal structure not found");
return(NULL);
}
buf=(unsigned short*)Pic_malloc(pic->Width*pic->Height*2);
if (!buf)
{
Pic_SetError("Conv8To24, not enough memory for temporary buffer");
return(NULL);
}
for(i=0 ; i<pic->Width*pic->Height ; i++)
{
b=pic->pPal[pic->pDatas[i]*3+0];
g=pic->pPal[pic->pDatas[i]*3+1];
r=pic->pPal[pic->pDatas[i]*3+2];
r>>=3;
g>>=3; g&=0x3E;
b>>=3;
pix16=(r<<10)+(g<<5)+b;
buf[i]=pix16;
}
return (char*)buf;
}
// ----------------------------------------
static char* Conv16To24(unsigned long id)
{
PIC_PICTURE *pic;
unsigned short *pDatas;
unsigned char *buf;
unsigned long i;
unsigned short r,g,b;
pic=GetPic(id);
if (!pic)
{
Pic_SetError("Conv16To24, picture internal structure not found");
return(NULL);
}
buf=(unsigned char *)Pic_malloc(pic->Width*pic->Height*3);
if (!buf)
{
Pic_SetError("Conv16To24, not enough memory for temporary buffer");
return(NULL);
}
pDatas=(unsigned short*)pic->pDatas;
for(i=0 ; i<pic->Width*pic->Height ; i++)
{
r=(pDatas[i] & 0x7C00)>>(10-3);
g=(pDatas[i] & 0x03E0)>>(5-3);
b=(pDatas[i] & 0x001F)<<3;
buf[i*3+0]=(unsigned char)r;
buf[i*3+1]=(unsigned char)g;
buf[i*3+2]=(unsigned char)b;
}
return (char*)buf;
}
// ----------------------------------------
static char* Conv24To16(unsigned long id)
{
PIC_PICTURE *pic;
unsigned short *buf;
unsigned long i;
unsigned short r,g,b;
unsigned short pix16;
pic=GetPic(id);
if (!pic)
{
Pic_SetError("Conv24To16, picture internal structure not found");
return(NULL);
}
buf=(unsigned short*)Pic_malloc(pic->Width*pic->Height*2);
if (!buf)
{
Pic_SetError("Conv24To16, not enough memory for temporary buffer");
return(NULL);
}
for(i=0 ; i<pic->Width*pic->Height ; i++)
{
r=pic->pDatas[i*3+0];
g=pic->pDatas[i*3+1];
b=pic->pDatas[i*3+2];
// r : 5 bits forts (0x7C)
// g : 5 bits (6e zapped) (0x3E)
// b : 5 bits faibles (0x1F)
r>>=3;
g>>=3; g&=0x3E;
b>>=3;
pix16=(r<<10)+(g<<5)+b;
buf[i]=pix16;
}
return (char*)buf;
}
// ----------------------------------------
static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr)
{
char *buf;
unsigned long src,dst;
*pErr=0;
buf=NULL;
src=pic->Depth;
if (type==PIC_TYPE_TGA8 || type==PIC_TYPE_BMP8)
{
dst=8;
}
if (type==PIC_TYPE_TGA16)
{
dst=16;
}
if (type==PIC_TYPE_JPG || type==PIC_TYPE_TGA24 || type==PIC_TYPE_BMP24)
{
dst=24;
}
// ---
if (src==dst)
{
return(NULL);
}
// ---
if (src==8 && dst==24)
{
buf=Conv8To24(pic->ID);
if (!buf)
{
*pErr=1;
}
return(buf);
}
if (src==8 && dst==16)
{
buf=Conv8To16(pic->ID);
if (!buf)
{
*pErr=1;
}
return(buf);
}
// ---
if (src==16 && dst==24)
{
buf=Conv16To24(pic->ID);
if (!buf)
{
*pErr=1;
}
return(buf);
}
// ---
if (src==24 && dst==16)
{
buf=Conv24To16(pic->ID);
if (!buf)
{
*pErr=1;
}
return buf;
}
// ---
if (src==24 && dst==8)
{
Pic_SetError("ConvPic, downsampling 24 to 8 bits unsupported");
*pErr=1;
return(NULL);
}
Pic_SetError("ConvPic, conversion %d to %d unsupported",src,dst);
*pErr=1;
return(NULL);
}
// ----------------------------------------
unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual)
{
PIC_PICTURE *pic;
char err;
char *buf;
char *freeit;
unsigned long depth;
freeit=NULL;
pic=GetPic(id);
if (!pic)
{
Pic_SetError("Save %s, picture internal structure not found",FileName);
return(0);
}
freeit = ConvPic(pic,type,&err);
if (err)
{
Pic_SetError("Save %s, error while converting picture",FileName);
return(0);
}
if (!freeit)
{
buf=pic->pDatas;
}
else
{
buf=freeit;
}
err=0;
switch(type)
{
// ---
case PIC_TYPE_JPG:
if ( !Pic_JPG_Write(FileName,qual,buf,pic->Width,pic->Height) )
{
if (freeit)
{
Pic_free(buf);
}
Pic_SetError("Save %s, error while saving JPG file",FileName);
err=1;
}
break;
// ---
case PIC_TYPE_TGA8:
case PIC_TYPE_TGA16:
case PIC_TYPE_TGA24:
if (type==PIC_TYPE_TGA8)
{
depth=8;
}
if (type==PIC_TYPE_TGA16)
{
depth=16;
}
if (type==PIC_TYPE_TGA24)
{
depth=24;
}
if ( !Pic_TGA_Write(FileName,pic->pPal,buf,pic->Width,pic->Height,depth) )
{
if (freeit)
{
Pic_free(freeit);
}
Pic_SetError("Save %s, error while saving TGA file",FileName);
err=1;
}
break;
// ---
case PIC_TYPE_BMP8:
case PIC_TYPE_BMP24:
if (type==PIC_TYPE_BMP8)
{
depth=8;
}
if (type==PIC_TYPE_BMP24)
{
depth=24;
}
if ( !Pic_BMP_Write(FileName,pic->pPal,buf,pic->Width,pic->Height,depth) )
{
if (freeit)
{
Pic_free(freeit);
}
Pic_SetError("Save %s, error while saving BMP file",FileName);
err=1;
}
break;
// ---
default:
Pic_SetError("Save %s, unknow save format/type",FileName);
err=1;
break;
}
if (freeit)
{
Pic_free(freeit);
}
return(err-1);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long PIC_Destroy(unsigned long id)
{
PIC_PICTURE *prevpic,*pic;
unsigned long found;
prevpic=NULL;
found=0;
for(pic=HeadPic ; pic ; pic=pic->Next)
{
if (pic->ID==id)
{
found=1;
break;
}
prevpic=pic;
}
if (!found)
{
Pic_SetError("Destroy, picture internal structure not found");
return(0);
}
if (prevpic)
{
prevpic->Next=pic->Next;
}
if (pic->pDatas)
{
Pic_free(pic->pDatas);
}
if (pic->pPal)
{
Pic_free(pic->pPal);
}
if (pic==HeadPic)
{
HeadPic=pic->Next;
}
Pic_free(pic);
return(1);
}
// ----------------------------------------------------------------------------------------------------------------------------------

@ -1,215 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pic_private.h"
#include "pic.h"
// ----------------------------------------------------------------------------------------------------------------------------------
#pragma pack(1)
typedef struct TGA_HEADER
{
unsigned char LengthID;
unsigned char CMapType;
unsigned char ImageType;
unsigned short Origin;
unsigned short Length;
unsigned char Depth;
unsigned short XOrg;
unsigned short YOrg;
unsigned short Width;
unsigned short Height;
unsigned char ImageDepth;
unsigned char Desc;
} TGA_HEADER;
#pragma pack()
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_TGA_Read( const char *FileName,
char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth)
{
FILE *file;
TGA_HEADER tgah;
long w,h,d;
unsigned long size;
char *pDatas;
char *pPal;
long x,y;
long slsize;
unsigned char *scanline;
unsigned char r,g,b;
long i;
int upSideDown;
pDatas=NULL;
pPal=NULL;
file=fopen(FileName,"rb");
if (!file)
{
Pic_SetError("TGA_Read, unable to open %s",FileName);
return(0);
}
fread(&tgah,1,sizeof(TGA_HEADER),file);
if (tgah.ImageType>3)
{
Pic_SetError("TGA_Read, unsupported TGA format");
return(0);
}
*pWidth=w=tgah.Width;
*pHeight=h=tgah.Height;
*pDepth=d=tgah.ImageDepth;
upSideDown = ((tgah.Desc & (1 << 5))==0);
size=tgah.Width*tgah.Height*(tgah.ImageDepth/8);
pDatas=(char*)Pic_malloc(size);
if (!pDatas)
{
Pic_SetError("TGA_Read, not enough memory");
return(0);
}
if (*pDepth==8)
{
if (!ppPal)
{
Pic_free(pDatas);
Pic_SetError("TGA_Read, need a pointer to palette");
return(0);
}
pPal=(char*)Pic_calloc(1,256*3);
if (!pPal)
{
Pic_SetError("TGA_Read, not enough memory for palette");
return(0);
}
if (tgah.ImageType==1)
{
for(i=0 ; i<256*3 ; i+=3)
{
fread(&pPal[i+2],1,1,file);
fread(&pPal[i+1],1,1,file);
fread(&pPal[i+0],1,1,file);
}
}
*ppPal=pPal;
}
slsize=w*d/8;
scanline=(unsigned char*)Pic_calloc(1,slsize);
if (!scanline)
{
if (pPal)
{
Pic_free(pPal);
}
Pic_free(pDatas);
Pic_SetError("TGA_Read, not enough memory for scanline");
return(0);
}
for(y=0 ; y<h ; y++)
{
fread(scanline,1,slsize,file);
if (d==24 || d==32)
{
long mult=3;
if(d==32) mult=4;
for(x=0 ; x<w ; x++)
{
r=scanline[x*mult+0];
g=scanline[x*mult+1];
b=scanline[x*mult+2];
scanline[x*mult+0]=b;
scanline[x*mult+1]=g;
scanline[x*mult+2]=r;
}
}
if (upSideDown)
memcpy(&pDatas[(h-y-1)*slsize], scanline, slsize);
else
memcpy(&pDatas[(y)*slsize], scanline, slsize);
}
Pic_free(scanline);
fclose(file);
*ppDatas=pDatas;
return(1);
}
// ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_TGA_Write( const char *FileName,
char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d)
{
FILE *file;
TGA_HEADER tgah;
long x,y;
long slsize;
unsigned char *scanline;
unsigned char r,g,b;
file=fopen(FileName,"wb");
if (!file)
{
Pic_SetError("TGA_Write, unable to open %s",FileName);
return(0);
}
memset(&tgah,0,sizeof(TGA_HEADER));
tgah.LengthID=0;
if (d>8)
{
tgah.CMapType=0;
tgah.ImageType=2;
tgah.Length=0;
tgah.Depth=0;
}
else
{
tgah.CMapType=1;
tgah.ImageType=1;
tgah.Length=256;
tgah.Depth=24;
}
tgah.Origin=0;
tgah.XOrg=0;
tgah.YOrg=0;
tgah.Width=(unsigned short)w;
tgah.Height=(unsigned short)h;
tgah.ImageDepth=(unsigned char)d;
tgah.Desc=0;
fwrite(&tgah,1,sizeof(TGA_HEADER),file);
if (d==8)
{
fwrite(pPal,1,256*3,file);
}
slsize=w*d/8;
scanline=(unsigned char*)Pic_calloc(1,slsize);
if (!scanline)
{
Pic_SetError("TGA_Write, not enough memory for scanline");
return(0);
}
for(y=0 ; y<(long)h ; y++)
{
memcpy(scanline,&pDatas[(h-y-1)*slsize],slsize);
if (d==24)
{
for(x=0 ; x<(long)w ; x++)
{
r=scanline[x*3+0];
g=scanline[x*3+1];
b=scanline[x*3+2];
scanline[x*3+0]=b;
scanline[x*3+1]=g;
scanline[x*3+2]=r;
}
}
fwrite(scanline,1,slsize,file);
}
Pic_free(scanline);
fclose(file);
return(1);
}

@ -1,58 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef _PIC_H_
#define _PIC_H_
// ----------------------------------------------------------------------------------------------------------------------------------
#define PIC_TYPE_JPG 1
#define PIC_TYPE_TGA8 2
#define PIC_TYPE_TGA16 3
#define PIC_TYPE_TGA24 4
#define PIC_TYPE_BMP8 5
#define PIC_TYPE_BMP24 6
// ----------------------------------------------------------------------------------------------------------------------------------
//
// Basic API
//
extern unsigned long PIC_Load(char* FileName, unsigned char Quantize);
extern unsigned long PIC_Create(char* pPal, char* pDatas, unsigned long w, unsigned long h, unsigned long d);
extern unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual);
extern unsigned long PIC_GetInfos( unsigned long id,
char **ppPal, char **ppDatas,
unsigned long *pW, unsigned long *pH, unsigned long *pD);
extern unsigned long PIC_Destroy(unsigned long id);
//
// System
//
extern unsigned long PIC_GetMemNbAllocs(void);
extern unsigned long PIC_GetMemAllocated(void);
extern char* PIC_GetError(void);
extern unsigned char PIC_Error(void);
extern void PIC_ResetError(void);
extern unsigned char PIC_OnErrorCall( void pFnct(void) );
// ----------------------------------------------------------------------------------------------------------------------------------
#endif

@ -1,81 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef _PIC_PRIVATE_H_
#define _PIC_PRIVATE_H_
// ----------------------------------------------------------------------------------------------------------------------------------
typedef struct PIC_PICTURE
{
unsigned long ID;
unsigned long Width;
unsigned long Height;
unsigned long Depth;
char *pDatas;
char *pPal;
struct PIC_PICTURE *Next;
} PIC_PICTURE;
// ----------------------------------------------------------------------------------------------------------------------------------
//
// JPG
//
extern unsigned long Pic_JPG_Read( const char *FileName,
char **ppPal, char **ppDatas,
unsigned long *w, unsigned long *h);
extern unsigned long Pic_JPG_Write( const char *FileName,
unsigned long Qual,
char *pDatas,
unsigned long w, unsigned long h);
//
// TGA
//
extern unsigned long Pic_TGA_Read( const char *FileName,
char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth);
extern unsigned long Pic_TGA_Write( const char *FileName,
char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d);
//
// BMP
//
extern unsigned long Pic_BMP_Read( const char *FileName,
char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth);
extern unsigned long Pic_BMP_Write( const char *FileName,
char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d);
//
// System
//
extern void* Pic_malloc(unsigned long size);
extern void* Pic_calloc(unsigned long count, unsigned long size);
extern void Pic_free(void *memblock);
extern unsigned long Pic__msize(void *memblock);
extern void Pic_SetError(const char *msg, ...);
// ----------------------------------------------------------------------------------------------------------------------------------
#endif

@ -1,84 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#include <assert.h>
#include <algorithm>
#include "readpic.h"
#include "pic.h"
#include <nel/misc/rgba.h>
using namespace std;
//============================================================
// Image API.
//============================================================
bool PIC_LoadPic(string path, vector<NLMISC::CBGRA> &tampon, uint &Width, uint &Height)
{
uint32 id;
char *pal, *data;
unsigned long w,h,depth;
uint i;
// Loadons l'image.
id= PIC_Load((char*)path.c_str(), 0);
if(id==0)
return false;
PIC_GetInfos( id, &pal, &data, &w, &h, &depth);
Width=w;
Height=h;
// On traduit en RGBA.
tampon.resize(w*h);
switch(depth)
{
case 8:
for(i=0;i<w*h;i++)
{
tampon[i].R= data[i];
tampon[i].G= data[i];
tampon[i].B= data[i];
tampon[i].A= data[i];
}
break;
case 24:
for(i=0;i<w*h;i++)
{
tampon[i].R= data[i*3+ 0];
tampon[i].G= data[i*3+ 1];
tampon[i].B= data[i*3+ 2];
tampon[i].A= 255;
}
break;
case 32:
for(i=0;i<w*h;i++)
{
tampon[i].R= data[i*4+ 0];
tampon[i].G= data[i*4+ 1];
tampon[i].B= data[i*4+ 2];
tampon[i].A= data[i*4+ 3];
}
break;
}
// On ferme.
PIC_Destroy(id);
return true;
}

@ -24,7 +24,7 @@
#include <direct.h> #include <direct.h>
//#include "ListGroup.h" //#include "ListGroup.h"
//#include "ViewPopup.h" //#include "ViewPopup.h"
#include "pic/readpic.h" //#include "pic/readpic.h"
using namespace std; using namespace std;
using namespace NL3D; using namespace NL3D;
@ -74,6 +74,37 @@ void rotateBuffer (uint &Width, uint &Height, std::vector<NLMISC::CBGRA>& Tampon
Height=tmp; Height=tmp;
} }
static bool loadPic(const string &path, std::vector<NLMISC::CBGRA> &tampon, uint &width, uint &height)
{
try
{
NLMISC::CIFile file;
if (file.open(path.c_str()))
{
NLMISC::CBitmap bitmap;
bitmap.load(file);
width = bitmap.getWidth();
height = bitmap.getHeight();
tampon.resize(width * height);
bitmap.convertToType(NLMISC::CBitmap::RGBA);
for (uint y = 0; y < height; ++y)
{
for (uint x = 0; x < width; ++x)
{
NLMISC::CRGBA c = bitmap.getPixelColor(x, y, 0);
c.R = (c.R * c.A) / 255;
c.G = (c.G * c.A) / 255;
c.B = (c.B * c.A) / 255;
tampon[(y * width) + x] = c;
}
}
return true;
}
}
catch (NLMISC::Exception& ) { }
return false;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CTView // CTView
//Attention : windows veut que le buffer image commence du bas vers le haut //Attention : windows veut que le buffer image commence du bas vers le haut
@ -82,7 +113,7 @@ int _LoadBitmap(const std::string& path,LPBITMAPINFO BitmapInfo, std::vector<NLM
//vector<NLMISC::CBGRA> Tampon; //vector<NLMISC::CBGRA> Tampon;
uint Width; uint Width;
uint Height; uint Height;
if (PIC_LoadPic(path, Tampon, Width, Height)) if (loadPic(path, Tampon, Width, Height))
{ {
BitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); BitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
BitmapInfo->bmiHeader.biWidth=Width; BitmapInfo->bmiHeader.biWidth=Width;
@ -207,7 +238,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
vector<NLMISC::CBGRA> tampon; vector<NLMISC::CBGRA> tampon;
uint Width; uint Width;
uint Height; uint Height;
if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
} }
@ -272,7 +303,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
vector<NLMISC::CBGRA> tampon; vector<NLMISC::CBGRA> tampon;
uint Width; uint Width;
uint Height; uint Height;
if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
} }
@ -338,7 +369,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
vector<NLMISC::CBGRA> tampon; vector<NLMISC::CBGRA> tampon;
uint Width; uint Width;
uint Height; uint Height;
if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
} }
@ -451,7 +482,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
vector<NLMISC::CBGRA> tampon; vector<NLMISC::CBGRA> tampon;
uint Width; uint Width;
uint Height; uint Height;
if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
return MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES; return MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
} }
@ -1490,7 +1521,7 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
_chdir (LastPath.c_str()); _chdir (LastPath.c_str());
CFileDialog load(true, NULL, LastPath.c_str(), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, CFileDialog load(true, NULL, LastPath.c_str(), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT,
"Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
load.m_ofn.lpstrFile = new char[10000]; // buffer contains filenames list load.m_ofn.lpstrFile = new char[10000]; // buffer contains filenames list
load.m_ofn.lpstrFile[0] = 0; load.m_ofn.lpstrFile[0] = 0;
// with 10 KB we should be large enough... // with 10 KB we should be large enough...

@ -10,9 +10,6 @@
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "nel/misc/types_nl.h"
#include "nel/misc/file.h"
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components #include <afxwin.h> // MFC core and standard components

@ -419,7 +419,7 @@ PrintfCommandsFreeTrial = {
DisplayMissingAnimFile = 0; DisplayMissingAnimFile = 0;
LoadingStringCount = 54; LoadingStringCount = 0;
// Some R2 parameters ... // Some R2 parameters ...

@ -345,6 +345,7 @@ void displayStreamingDebug ()
//----------------// //----------------//
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(ClientCfg.DebugFontSize); TextContext->setFontSize(ClientCfg.DebugFontSize);
// Set the text color // Set the text color
@ -390,6 +391,7 @@ void displayStreamingDebug ()
// No more shadow when displaying a text. // No more shadow when displaying a text.
TextContext->setShaded(false); TextContext->setShaded(false);
TextContext->setShadeOutline(false);
} }
} }
@ -567,6 +569,7 @@ void displayNetDebug ()
//----------------// //----------------//
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(ClientCfg.DebugFontSize); TextContext->setFontSize(ClientCfg.DebugFontSize);
// Set the text color // Set the text color

@ -184,8 +184,8 @@ void CEventsListener::operator()(const CEvent& event)
} }
// NOTE: No 0, 0 center mouse message in Windows (lower mouse message rate), but safe to assume any movement messages are requeued relative to our new position // NOTE: No 0, 0 center mouse message in Windows (lower mouse message rate), but safe to assume any movement messages are requeued relative to our new position
// In case free look bugs on other platform, we may need to push in our own message on setMousePos for Windows bool outsideBounds = ((abs(scX) > (drW >> 3)) || (abs(scY) > (drH >> 3)));
if (s_MouseFreeLookWaitCenter) // scX == 0 && scY == 0) if (s_MouseFreeLookWaitCenter && !outsideBounds)
{ {
// Centered, set last to 0 // Centered, set last to 0
s_MouseFreeLookLastX = 0; s_MouseFreeLookLastX = 0;
@ -204,8 +204,7 @@ void CEventsListener::operator()(const CEvent& event)
// updateFreeLookPos is called in updateMouseSmoothing per frame // updateFreeLookPos is called in updateMouseSmoothing per frame
// Center cursor // Center cursor
bool outsideBounds = ((abs(scX) > (drW >> 3)) || (abs(scY) > (drH >> 3))); if (outsideBounds && !s_MouseFreeLookWaitCenter)
if (outsideBounds)
{ {
s_MouseFreeLookWaitCenter = true; s_MouseFreeLookWaitCenter = true;
Driver->setMousePos(0.5f, 0.5f); Driver->setMousePos(0.5f, 0.5f);

@ -134,6 +134,7 @@ void CGraph::renderGraph ()
if (TextContext != NULL) if (TextContext != NULL)
{ {
TextContext->setShaded (false); TextContext->setShaded (false);
TextContext->setShadeOutline(false);
TextContext->setHotSpot (UTextContext::MiddleLeft); TextContext->setHotSpot (UTextContext::MiddleLeft);
TextContext->setColor (frontCol); TextContext->setColor (frontCol);
TextContext->setFontSize (10); TextContext->setFontSize (10);

@ -807,6 +807,7 @@ void CTestGroundFX::displayFXBoxes() const
Driver->setFrustum(fr); Driver->setFrustum(fr);
TextContext->setColor(CRGBA::Green); TextContext->setColor(CRGBA::Green);
TextContext->setShaded(false); TextContext->setShaded(false);
TextContext->setShadeOutline(false);
TextContext->setFontSize(12); TextContext->setFontSize(12);
// //
float size = 0.4f; float size = 0.4f;

@ -157,6 +157,7 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
CViewText *vt = new CViewText(CViewText::TCtorParam()); CViewText *vt = new CViewText(CViewText::TCtorParam());
// get parameters from config.xml // get parameters from config.xml
vt->setShadow(isTextShadowed()); vt->setShadow(isTextShadowed());
vt->setShadowOutline(false);
vt->setFontSize(getTextFontSize()); vt->setFontSize(getTextFontSize());
vt->setMultiLine(true); vt->setMultiLine(true);
vt->setTextMode(justified ? CViewText::Justified : CViewText::DontClipWord); vt->setTextMode(justified ? CViewText::Justified : CViewText::DontClipWord);

@ -880,6 +880,7 @@ void CDBGroupListSheetText::setup()
text->setFontSize(_TextTemplate.getFontSize()); text->setFontSize(_TextTemplate.getFontSize());
text->setColor(_TextTemplate.getColor()); text->setColor(_TextTemplate.getColor());
text->setShadow(_TextTemplate.getShadow()); text->setShadow(_TextTemplate.getShadow());
text->setShadowOutline(_TextTemplate.getShadowOutline());
text->setLineMaxW(_TextTemplate.getLineMaxW()); text->setLineMaxW(_TextTemplate.getLineMaxW());
text->setMultiLine(_TextTemplate.getMultiLine()); text->setMultiLine(_TextTemplate.getMultiLine());
if(text->getMultiLine()) if(text->getMultiLine())

@ -95,6 +95,7 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::init(CDBGroupListS
text->setFontSize(compoList->getTextTemplate().getFontSize()); text->setFontSize(compoList->getTextTemplate().getFontSize());
text->setColor(compoList->getTextTemplate().getColor()); text->setColor(compoList->getTextTemplate().getColor());
text->setShadow(compoList->getTextTemplate().getShadow()); text->setShadow(compoList->getTextTemplate().getShadow());
text->setShadowOutline(compoList->getTextTemplate().getShadowOutline());
text->setMultiLine(false); text->setMultiLine(false);
text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor()); text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor());

@ -121,6 +121,7 @@ void CDBGroupListSheetTextShare::CSheetChildShare::init(CDBGroupListSheetText *p
text->setFontSize(compoList->getTextTemplate().getFontSize()); text->setFontSize(compoList->getTextTemplate().getFontSize());
text->setColor(compoList->getTextTemplate().getColor()); text->setColor(compoList->getTextTemplate().getColor());
text->setShadow(compoList->getTextTemplate().getShadow()); text->setShadow(compoList->getTextTemplate().getShadow());
text->setShadowOutline(compoList->getTextTemplate().getShadowOutline());
text->setMultiLine(false); text->setMultiLine(false);
text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor()); text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor());
// Add it to the scrolled list. // Add it to the scrolled list.
@ -139,6 +140,7 @@ void CDBGroupListSheetTextShare::CSheetChildShare::init(CDBGroupListSheetText *p
text->setFontSize(compoList->getTextTemplate().getFontSize()); text->setFontSize(compoList->getTextTemplate().getFontSize());
text->setColor(compoList->getTextTemplate().getColor()); text->setColor(compoList->getTextTemplate().getColor());
text->setShadow(compoList->getTextTemplate().getShadow()); text->setShadow(compoList->getTextTemplate().getShadow());
text->setShadowOutline(compoList->getTextTemplate().getShadowOutline());
text->setMultiLine(false); text->setMultiLine(false);
text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor()); text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor());
// Add it to the scrolled list. // Add it to the scrolled list.

@ -2333,6 +2333,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
pNewText->setColor(CRGBA(255,255,255,255)); pNewText->setColor(CRGBA(255,255,255,255));
pNewText->setShadow(true); pNewText->setShadow(true);
pNewText->setShadowOutline(false);
pNewText->setShadowColor(CRGBA(0,0,0,255)); pNewText->setShadowColor(CRGBA(0,0,0,255));
pNewText->setModulateGlobalColor(false); pNewText->setModulateGlobalColor(false);
pNewText->Type = rCLM.Type; pNewText->Type = rCLM.Type;

@ -1013,6 +1013,7 @@ bool mainLoop()
SetMouseCursor (); SetMouseCursor ();
// Set the cursor. // Set the cursor.
ContextCur.context("STAND BY"); ContextCur.context("STAND BY");
UserControls.reset();
// set the default box for keyboard // set the default box for keyboard
setDefaultChatWindow(PeopleInterraction.ChatGroup.Window); setDefaultChatWindow(PeopleInterraction.ChatGroup.Window);
@ -1924,6 +1925,7 @@ bool mainLoop()
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(10); TextContext->setFontSize(10);
// Set the text color // Set the text color
@ -2462,6 +2464,7 @@ bool mainLoop()
SetMouseCursor (); SetMouseCursor ();
// Set the cursor. // Set the cursor.
ContextCur.context("STAND BY"); ContextCur.context("STAND BY");
UserControls.reset();
// set the default box for keyboard // set the default box for keyboard
CChatWindow *defaultChatWindow; CChatWindow *defaultChatWindow;
@ -2586,6 +2589,7 @@ void displaySpecialTextProgress(const char *text)
{ {
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(12); TextContext->setFontSize(12);
// Set the text color // Set the text color

@ -80,6 +80,7 @@ void displayDebug()
//----------------// //----------------//
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(ClientCfg.DebugFontSize); TextContext->setFontSize(ClientCfg.DebugFontSize);
// Set the text color // Set the text color
@ -470,6 +471,7 @@ void displayDebug()
// No more shadow when displaying a text. // No more shadow when displaying a text.
TextContext->setShaded(false); TextContext->setShaded(false);
TextContext->setShadeOutline(false);
}// displayDebug // }// displayDebug //
// ******************************************************************** // ********************************************************************
@ -491,6 +493,7 @@ void displayDebugFps()
//----------------// //----------------//
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(ClientCfg.DebugFontSize); TextContext->setFontSize(ClientCfg.DebugFontSize);
// Set the text color // Set the text color
@ -533,6 +536,7 @@ void displayDebugUIUnderMouse()
//----------------// //----------------//
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(ClientCfg.DebugFontSize); TextContext->setFontSize(ClientCfg.DebugFontSize);
@ -707,6 +711,7 @@ void displayHelp()
// Create a shadow when displaying a text. // Create a shadow when displaying a text.
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
// Set the font size. // Set the font size.
TextContext->setFontSize(ClientCfg.HelpFontSize); TextContext->setFontSize(ClientCfg.HelpFontSize);
// Set the text color // Set the text color
@ -763,6 +768,7 @@ void displayHelp()
// No more shadow when displaying a text. // No more shadow when displaying a text.
TextContext->setShaded(false); TextContext->setShaded(false);
TextContext->setShadeOutline(false);
}// displayHelp // }// displayHelp //
// ******************************************************************** // ********************************************************************

@ -174,6 +174,10 @@ void CUserControls::init()
}// init // }// init //
void CUserControls::reset()
{
init();
}
//----------------------------------------------- //-----------------------------------------------
// needReleaseForward : // needReleaseForward :

@ -152,6 +152,8 @@ public:
/// Constructor /// Constructor
CUserControls(); CUserControls();
void reset();
/// Return the string associated to the motion Mode. /// Return the string associated to the motion Mode.
std::string modeStr() const; std::string modeStr() const;
/// Return the motion Mode. /// Return the motion Mode.

@ -1789,6 +1789,7 @@ void CEditor::waitScenarioScreen()
if (!waitScreen) if (!waitScreen)
{ {
TextContext->setShaded(true); TextContext->setShaded(true);
TextContext->setShadeOutline(false);
TextContext->setFontSize(40); TextContext->setFontSize(40);
TextContext->setColor(CRGBA::White); TextContext->setColor(CRGBA::White);

@ -829,6 +829,7 @@ void CTimedFXManager::displayFXBoxes(TDebugDisplayMode displayMode) const
Driver->setFrustum(fr); Driver->setFrustum(fr);
TextContext->setColor(CRGBA::Blue); TextContext->setColor(CRGBA::Blue);
TextContext->setShaded(false); TextContext->setShaded(false);
TextContext->setShadeOutline(false);
TextContext->setFontSize(10); TextContext->setFontSize(10);
// //
float size = 0.4f; float size = 0.4f;

@ -18,16 +18,15 @@
#include "crypt.h" #include "crypt.h"
char * rz_crypt(register const char *key, register const char *setting); char * rz_crypt(register const char *key, register const char *setting, char *buf);
char *__crypt_sha512(const char *key, const char *setting, char *output);
// Crypts password using salt // Crypts password using salt
std::string CCrypt::crypt(const std::string& password, const std::string& salt) std::string CCrypt::crypt(const std::string& password, const std::string& salt)
{ {
std::string result = ::rz_crypt(password.c_str(), salt.c_str()); char buf[128];
return ::rz_crypt(password.c_str(), salt.c_str(), buf);
return result;
} }
@ -506,7 +505,7 @@ static char cryptresult[1+4+4+11+1]; /* encrypted result */
* Return a pointer to static data consisting of the "setting" * Return a pointer to static data consisting of the "setting"
* followed by an encryption produced by the "key" and "setting". * followed by an encryption produced by the "key" and "setting".
*/ */
char * rz_crypt(register const char *key, register const char *setting) { char * rz_crypt(register const char *key, register const char *setting, char *buf) {
register char *encp; register char *encp;
register long i; register long i;
register int t; register int t;
@ -521,6 +520,10 @@ char * rz_crypt(register const char *key, register const char *setting) {
return buff; return buff;
#endif #endif
if (setting[0] == '$' && setting[1] == '6') {
return __crypt_sha512(key, setting, buf);
}
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if ((t = 2*(unsigned char)(*key)) != 0) if ((t = 2*(unsigned char)(*key)) != 0)
key++; key++;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save