From be5336b1fb005d2b11cc5ec08c3866bb0e0aa572 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 22 Jun 2012 03:49:43 +0200 Subject: [PATCH] CHANGED: #1471 CViewBitmap is now part of NELGUI library, and is under NLGUI namespace. --- code/nel/include/nel/gui/view_bitmap.h | 146 ++++++++ code/nel/src/gui/view_bitmap.cpp | 315 ++++++++++++++++++ code/ryzom/client/src/init_main_loop.cpp | 2 +- .../src/interface_v3/action_handler_game.cpp | 2 +- .../src/interface_v3/action_handler_item.cpp | 2 +- .../src/interface_v3/bot_chat_page_trade.cpp | 2 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 2 +- .../src/interface_v3/dbgroup_build_phrase.h | 2 +- .../dbgroup_list_sheet_text_share.cpp | 2 +- .../dbgroup_list_sheet_text_share.h | 5 +- .../interface_v3/dbgroup_select_number.cpp | 2 +- .../src/interface_v3/dbgroup_select_number.h | 4 +- .../client/src/interface_v3/dbview_bar.h | 2 +- .../client/src/interface_v3/dbview_bar3.h | 2 +- .../src/interface_v3/encyclopedia_manager.cpp | 2 +- .../src/interface_v3/group_container.cpp | 2 +- .../client/src/interface_v3/group_container.h | 2 +- .../client/src/interface_v3/group_html.cpp | 2 +- .../interface_v3/group_in_scene_user_info.cpp | 2 +- .../client/src/interface_v3/group_list.cpp | 2 +- .../ryzom/client/src/interface_v3/group_map.h | 2 +- .../client/src/interface_v3/group_menu.cpp | 2 +- .../client/src/interface_v3/group_menu.h | 2 +- .../src/interface_v3/group_paragraph.cpp | 2 +- .../client/src/interface_v3/group_skills.cpp | 2 +- .../client/src/interface_v3/group_table.cpp | 2 +- .../client/src/interface_v3/group_tree.cpp | 2 +- .../client/src/interface_v3/group_tree.h | 3 +- .../client/src/interface_v3/guild_manager.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 2 +- .../src/interface_v3/interface_parser.cpp | 2 +- .../client/src/interface_v3/people_list.cpp | 2 +- .../register_interface_elements.cpp | 2 +- .../client/src/interface_v3/skill_manager.cpp | 2 +- .../client/src/interface_v3/view_bitmap.cpp | 311 ----------------- .../client/src/interface_v3/view_bitmap.h | 141 -------- .../src/interface_v3/view_bitmap_faber_mp.h | 2 +- .../client/src/r2/displayer_visual_shape.h | 6 +- code/ryzom/client/src/r2/instance_map_deco.h | 2 +- code/ryzom/client/src/r2/prim_render.cpp | 2 +- 40 files changed, 504 insertions(+), 491 deletions(-) create mode 100644 code/nel/include/nel/gui/view_bitmap.h create mode 100644 code/nel/src/gui/view_bitmap.cpp delete mode 100644 code/ryzom/client/src/interface_v3/view_bitmap.cpp delete mode 100644 code/ryzom/client/src/interface_v3/view_bitmap.h diff --git a/code/nel/include/nel/gui/view_bitmap.h b/code/nel/include/nel/gui/view_bitmap.h new file mode 100644 index 000000000..00030caaa --- /dev/null +++ b/code/nel/include/nel/gui/view_bitmap.h @@ -0,0 +1,146 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +#ifndef NL_VIEW_BITMAP_H +#define NL_VIEW_BITMAP_H + +#include "nel/gui/view_base.h" +#include "nel/3d/u_texture.h" +#include "nel/gui/view_renderer.h" + +namespace NLGUI +{ + + /** + * class implementing a bitmap view + * \author Matthieu 'TrapII' Besson + * \author Nevrax France + * \date 2002 + */ + class CViewBitmap : public CViewBase + { + public: + DECLARE_UI_CLASS(CViewBitmap) + enum EType { Stretched = 0, Tiled, TypeCount }; + public: + + /// Constructor + CViewBitmap(const TCtorParam ¶m) : CViewBase(param) + { + _Color = NLMISC::CRGBA(255,255,255,255); + _Scale = false; + _Rot = 0; + _Flip = false; + _Tile = false; + _Align = 0; + _Type = Stretched; + _InheritGCAlpha = false; + + // Default parameters for createTexture + _TxtOffsetX = 0; + _TxtOffsetY = 0; + _TxtWidth = -1; + _TxtHeight = -1; + } + + /** + * parse an xml node and initialize the base view mambers. Must call CViewBase::parse + * \param cur : pointer to the xml node to be parsed + * \param parentGroup : the parent group of the view + * \partam id : a refence to the string that will receive the view ID + * \return true if success + */ + bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); + virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } + + virtual void updateCoords (); + + /// Draw the view + virtual void draw (); + + bool getScale() const { return _Scale; } + void setScale (bool s) { _Scale = s; } + bool getTile() const { return _Tile; } + void setTile (bool s) { _Tile = s; } + void setColor (const NLMISC::CRGBA &r) { _Color = r; } + + // Reflected + + virtual void setTexture(const std::string & TxName); + virtual std::string getTexture () const; + + /** Force the bitmap to match current texture size + * The 'scale' flag isnot modified + */ + void fitTexture(); + + bool isTextureValid() const { return _TextureId != -1; } + + void setColorAsString(const std::string & col); + std::string getColorAsString() const; + + void setColorAsInt(sint32 col); + sint32 getColorAsInt() const; + + void setColorRGBA(NLMISC::CRGBA col); + NLMISC::CRGBA getColorRGBA() const; + + virtual sint32 getAlpha() const { return _Color.A; } + virtual void setAlpha (sint32 a) { _Color.A = (uint8)a; } + + REFLECT_EXPORT_START(CViewBitmap, CViewBase) + REFLECT_STRING ("color", getColorAsString, setColorAsString); + REFLECT_SINT32 ("color_as_int", getColorAsInt, setColorAsInt); + REFLECT_RGBA ("color_rgba", getColorRGBA, setColorRGBA); + REFLECT_SINT32 ("alpha", getAlpha, setAlpha); + REFLECT_STRING ("texture", getTexture, setTexture); + REFLECT_BOOL("scale", getScale, setScale); + REFLECT_EXPORT_END + + /// \from CInterfaceElement + sint32 getMaxUsedW() const; + sint32 getMinUsedW() const; + + virtual void serial(NLMISC::IStream &f); + + protected: + CViewRenderer::CTextureId _TextureId; /// Accelerator + NLMISC::CRGBA _Color; + sint32 _Rot; + sint32 _Align; /// 1st bit - Left/Right (0/1) 2nd bit - Bottom/Top (0/1) + EType _Type; + bool _Scale : 1; + bool _Flip : 1; + bool _Tile : 1; + bool _InheritGCAlpha : 1; + + // For single texture + + sint32 _TxtOffsetX; // Offset X of the single texture + sint32 _TxtOffsetY; // Offset Y of the single texture + sint32 _TxtWidth; // Width of the single texture + sint32 _TxtHeight; // Height of the single texture + + }; + + +} + +#endif // NL_VIEW_BITMAP_H + +/* End of view_bitmap.h */ diff --git a/code/nel/src/gui/view_bitmap.cpp b/code/nel/src/gui/view_bitmap.cpp new file mode 100644 index 000000000..8643b4162 --- /dev/null +++ b/code/nel/src/gui/view_bitmap.cpp @@ -0,0 +1,315 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +#include "nel/gui/view_bitmap.h" +#include "nel/misc/xml_auto_ptr.h" +#include "nel/gui/widget_manager.h" +#include "nel/gui/interface_group.h" +#include "nel/gui/group_container_base.h" + +using namespace std; +using namespace NLMISC; +using namespace NL3D; + + +NLMISC_REGISTER_OBJECT(CViewBase, CViewBitmap, std::string, "bitmap"); +REGISTER_UI_CLASS(CViewBitmap) + +namespace NLGUI +{ + + // ---------------------------------------------------------------------------- + + bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) + { + CXMLAutoPtr prop; + + //try to get props that can be inherited from groups + //if a property is not defined, try to find it in the parent group. + //if it is undefined, set it to zero + if (! CViewBase::parse(cur,parentGroup) ) + { + string tmp = string("cannot parse view:")+getId()+", parent:"+parentGroup->getId(); + nlinfo (tmp.c_str()); + return false; + } + + //try to get the NEEDED specific props + prop= (char*) xmlGetProp( cur, (xmlChar*)"color" ); + _Color = CRGBA(255,255,255,255); + if (prop) + _Color = convertColor (prop); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"txtoffsetx" ); + _TxtOffsetX = 0; + if (prop) fromString((const char*)prop, _TxtOffsetX); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"txtoffsety" ); + _TxtOffsetY = 0; + if (prop) fromString((const char*)prop, _TxtOffsetY); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"txtwidth" ); + _TxtWidth = -1; + if (prop) fromString((const char*)prop, _TxtWidth); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"txtheight" ); + _TxtHeight = -1; + if (prop) fromString((const char*)prop, _TxtHeight); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"texture" ); + if (prop) + { + string TxName = (const char *) prop; + TxName = strlwr (TxName); + setTexture (TxName); + //CInterfaceManager *pIM = CInterfaceManager::getInstance(); + //CViewRenderer &rVR = *CViewRenderer::getInstance(); + //_TextureId = rVR.getTextureIdFromName (TxName); + } + + prop = (char*) xmlGetProp( cur, (xmlChar*)"scale" ); + _Scale = false; + if (prop) + _Scale = convertBool(prop); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"rot" ); + _Rot = 0; + if (prop) + fromString((const char*)prop, _Rot); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"flip" ); + _Flip = false; + if (prop) + _Flip = convertBool(prop); + + prop = (char*) xmlGetProp( cur, (xmlChar*)"tile" ); + _Tile = false; + if (prop) + _Tile = convertBool(prop); + + prop = (char*) xmlGetProp (cur, (xmlChar*)"align"); + _Align = 0; + if (prop) + { + const char *seekPtr = prop.getDatas(); + while (*seekPtr != 0) + { + if ((*seekPtr=='l')||(*seekPtr=='L')) + { + _Align &= ~1; + } + if ((*seekPtr=='r')||(*seekPtr=='R')) + { + _Align |= 1; + } + if ((*seekPtr=='b')||(*seekPtr=='B')) + { + _Align &= ~2; + } + if ((*seekPtr=='t')||(*seekPtr=='T')) + { + _Align |= 2; + } + ++seekPtr; + } + } + + _InheritGCAlpha = false; + prop = (char*) xmlGetProp( cur, (xmlChar*)"inherit_gc_alpha" ); + if (prop) + { + _InheritGCAlpha = convertBool(prop); + } + + return true; + } + + // ---------------------------------------------------------------------------- + void CViewBitmap::draw () + { + CViewRenderer &rVR = *CViewRenderer::getInstance(); + + CRGBA col; + if(getModulateGlobalColor()) + { + col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent()); + } + else + { + col= _Color; + col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8); + } + + if (_InheritGCAlpha) + { + // search a parent container + CInterfaceGroup *gr = getParent(); + while (gr) + { + if (gr->isGroupContainer()) + { + CGroupContainerBase *gc = static_cast(gr); + col.A = (uint8)(((sint32)col.A*((sint32)gc->getCurrentContainerAlpha()+1))>>8); + break; + } + gr = gr->getParent(); + } + } + + if (_Scale && !_Tile) + { + rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, + _WReal, _HReal, + (uint8)_Rot, _Flip, + _TextureId, + col ); + } + else + { + if (!_Tile) + { + rVR.draw11RotFlipBitmap (_RenderLayer, _XReal, _YReal, + (uint8)_Rot, _Flip, + _TextureId, + col); + } + else + { + rVR.drawRotFlipBitmapTiled(_RenderLayer, _XReal, _YReal, + _WReal, _HReal, + (uint8)_Rot, _Flip, + _TextureId, + _Align, + col); + } + } + } + + // ---------------------------------------------------------------------------- + void CViewBitmap::updateCoords() + { + if (!_Scale) + { + CViewRenderer &rVR = *CViewRenderer::getInstance(); + sint32 txw, txh; + rVR.getTextureSizeFromId (_TextureId, txw, txh); + _W = txw; + _H = txh; + } + CViewBase::updateCoords(); + } + + // ---------------------------------------------------------------------------- + void CViewBitmap::setTexture(const std::string & TxName) + { + // CInterfaceManager *pIM = CInterfaceManager::getInstance(); + // CViewRenderer &rVR = *CViewRenderer::getInstance(); + + _TextureId.setTexture (TxName.c_str (), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false); + } + + // ---------------------------------------------------------------------------- + std::string CViewBitmap::getTexture () const + { + CViewRenderer &rVR = *CViewRenderer::getInstance(); + return rVR.getTextureNameFromId (_TextureId); + } + + // *************************************************************************** + void CViewBitmap::fitTexture() + { + CViewRenderer &rVR = *CViewRenderer::getInstance(); + sint32 w, h; + rVR.getTextureSizeFromId(_TextureId, w, h); + setW(w); + setH(h); + } + + // *************************************************************************** + void CViewBitmap::setColorAsString(const std::string & col) + { + _Color = convertColor (col.c_str()); + } + + // *************************************************************************** + std::string CViewBitmap::getColorAsString() const + { + return NLMISC::toString(_Color.R) + " " + NLMISC::toString(_Color.G) + " " + NLMISC::toString(_Color.B) + " " + NLMISC::toString(_Color.A); + } + + // *************************************************************************** + void CViewBitmap::setColorAsInt(sint32 col) + { + _Color.setPacked(col); + } + + // *************************************************************************** + sint32 CViewBitmap::getColorAsInt() const + { + return _Color.getPacked(); + } + + // *************************************************************************** + void CViewBitmap::setColorRGBA(NLMISC::CRGBA col) + { + _Color = col; + } + + // *************************************************************************** + NLMISC::CRGBA CViewBitmap::getColorRGBA() const + { + return _Color; + } + + // *************************************************************************** + sint32 CViewBitmap::getMaxUsedW() const + { + sint32 txw, txh; + CViewRenderer &rVR = *CViewRenderer::getInstance(); + rVR.getTextureSizeFromId (_TextureId, txw, txh); + return txw; + } + + // *************************************************************************** + sint32 CViewBitmap::getMinUsedW() const + { + return getMaxUsedW(); + } + + // *************************************************************************** + void CViewBitmap::serial(NLMISC::IStream &f) + { + CViewBase::serial(f); + f.serial(_TextureId); + f.serial(_Color); + f.serial(_Rot); + f.serialEnum(_Align); + f.serialEnum(_Type); + nlSerialBitBool(f, _Scale); + nlSerialBitBool(f, _Flip); + nlSerialBitBool(f, _Tile); + nlSerialBitBool(f, _InheritGCAlpha); + f.serial(_TxtOffsetX); + f.serial(_TxtOffsetY); + f.serial(_TxtWidth); + f.serial(_TxtHeight); + } + +} + +// *************************************************************************** diff --git a/code/ryzom/client/src/init_main_loop.cpp b/code/ryzom/client/src/init_main_loop.cpp index d35d00561..a9e72c2eb 100644 --- a/code/ryzom/client/src/init_main_loop.cpp +++ b/code/ryzom/client/src/init_main_loop.cpp @@ -53,7 +53,7 @@ #include "interface_v3/interface_manager.h" #include "interface_v3/people_interraction.h" -#include "interface_v3/view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/interface_link.h" #include "cursor_functions.h" diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9de7ed7c4..486f9b70f 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -46,7 +46,7 @@ #include "interface_ddx.h" #include "group_tree.h" #include "group_map.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "action_handler_tools.h" #include "../connection.h" #include "../client_chat_manager.h" diff --git a/code/ryzom/client/src/interface_v3/action_handler_item.cpp b/code/ryzom/client/src/interface_v3/action_handler_item.cpp index c9d37f5fb..57fb10631 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -42,7 +42,7 @@ #include "nel/gui/ctrl_base_button.h" #include "../connection.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" extern CSheetManager SheetMngr; extern NLMISC::CLog g_log; diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 70077ab47..aeb455224 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -47,7 +47,7 @@ #include "guild_manager.h" #include "../sheet_manager.h" #include "../user_entity.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/misc/common.h" using namespace std::rel_ops; diff --git a/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index bfe7e06fe..b885a9979 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -22,7 +22,7 @@ #include "sphrase_manager.h" #include "interface_manager.h" #include "dbctrl_sheet.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/ctrl_button.h" #include "group_editbox.h" #include "../client_cfg.h" diff --git a/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.h b/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.h index 94af94de9..f37ea9134 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.h @@ -30,13 +30,13 @@ namespace NLGUI { class CCtrlBaseButton; class CViewText; + class CViewBitmap; } // *************************************************************************** class CDBCtrlSheet; class CSBrickSheet; -class CViewBitmap; class CGroupEditBox; diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp index 18299a803..aefc371f8 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp @@ -21,7 +21,7 @@ #include "../client_sheets/sbrick_sheet.h" #include "nel/misc/xml_auto_ptr.h" #include "interface_manager.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/ctrl_text_button.h" #include "../net_manager.h" #include "../client_sheets/item_sheet.h" diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.h b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.h index 272c0cb9d..b94240b8b 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.h @@ -22,7 +22,10 @@ #include "nel/misc/types_nl.h" #include "dbgroup_list_sheet_text.h" -class CViewBitmap; +namespace NLGUI +{ + class CViewBitmap; +} // *************************************************************************** /** diff --git a/code/ryzom/client/src/interface_v3/dbgroup_select_number.cpp b/code/ryzom/client/src/interface_v3/dbgroup_select_number.cpp index 4889fa367..1b7e7a0e5 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_select_number.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_select_number.cpp @@ -22,7 +22,7 @@ #include "dbgroup_select_number.h" #include "nel/gui/view_text.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/interface_property.h" #include "interface_manager.h" diff --git a/code/ryzom/client/src/interface_v3/dbgroup_select_number.h b/code/ryzom/client/src/interface_v3/dbgroup_select_number.h index d6446ee33..0b3b1a530 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_select_number.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_select_number.h @@ -27,12 +27,10 @@ namespace NLGUI { class CCtrlBaseButton; class CViewText; + class CViewBitmap; } -// *************************************************************************** -class CViewBitmap; - // *************************************************************************** /** diff --git a/code/ryzom/client/src/interface_v3/dbview_bar.h b/code/ryzom/client/src/interface_v3/dbview_bar.h index 79d73fd78..f3ee02129 100644 --- a/code/ryzom/client/src/interface_v3/dbview_bar.h +++ b/code/ryzom/client/src/interface_v3/dbview_bar.h @@ -20,7 +20,7 @@ #define RZ_DBVIEW_BAR_H #include "nel/misc/types_nl.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" /** * class implementing a bitmap used as the front texture of a progress bar diff --git a/code/ryzom/client/src/interface_v3/dbview_bar3.h b/code/ryzom/client/src/interface_v3/dbview_bar3.h index 751b93a1b..f745564c3 100644 --- a/code/ryzom/client/src/interface_v3/dbview_bar3.h +++ b/code/ryzom/client/src/interface_v3/dbview_bar3.h @@ -20,7 +20,7 @@ #define RZ_DBVIEW_BAR3_H #include "nel/misc/types_nl.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" /** * class implementing a 3 Bar widget diff --git a/code/ryzom/client/src/interface_v3/encyclopedia_manager.cpp b/code/ryzom/client/src/interface_v3/encyclopedia_manager.cpp index d6d6bf44e..b3f2abad2 100644 --- a/code/ryzom/client/src/interface_v3/encyclopedia_manager.cpp +++ b/code/ryzom/client/src/interface_v3/encyclopedia_manager.cpp @@ -21,7 +21,7 @@ #include "interface_manager.h" #include "group_tree.h" #include "nel/gui/view_text_id.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "action_handler_misc.h" #include "../sheet_manager.h" diff --git a/code/ryzom/client/src/interface_v3/group_container.cpp b/code/ryzom/client/src/interface_v3/group_container.cpp index 707e85588..8e397bcfc 100644 --- a/code/ryzom/client/src/interface_v3/group_container.cpp +++ b/code/ryzom/client/src/interface_v3/group_container.cpp @@ -35,7 +35,7 @@ #include "nel/gui/ctrl_button.h" #include "nel/gui/ctrl_scroll.h" #include "nel/gui/view_text.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "../time_client.h" diff --git a/code/ryzom/client/src/interface_v3/group_container.h b/code/ryzom/client/src/interface_v3/group_container.h index 731e9bcc7..26a1b3a45 100644 --- a/code/ryzom/client/src/interface_v3/group_container.h +++ b/code/ryzom/client/src/interface_v3/group_container.h @@ -29,13 +29,13 @@ namespace NLGUI class CCtrlButton; class CCtrlScroll; class CViewText; + class CViewBitmap; } class COptionsContainerInsertion; class COptionsContainerMove; class CGroupContainer; class CInterfaceManager; -class CViewBitmap; class COptionsLayer; class CGroupList; diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index d3b09c9e5..77d4c422d 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -40,7 +40,7 @@ extern "C" #include "group_paragraph.h" #include "group_editbox.h" #include "interface_manager.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "../actions.h" #include "dbgroup_combo_box.h" #include "nel/gui/lua_ihm.h" diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index 16a16393b..d8c5bd4a8 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -18,7 +18,7 @@ #include "stdpch.h" #include "interface_manager.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "group_in_scene_user_info.h" #include "nel/gui/action_handler.h" #include "../entities.h" diff --git a/code/ryzom/client/src/interface_v3/group_list.cpp b/code/ryzom/client/src/interface_v3/group_list.cpp index 9315d9024..43b109ac1 100644 --- a/code/ryzom/client/src/interface_v3/group_list.cpp +++ b/code/ryzom/client/src/interface_v3/group_list.cpp @@ -22,7 +22,7 @@ #include "interface_manager.h" #include "nel/gui/interface_element.h" #include "../client_chat_manager.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/view_text_id.h" #include "group_container.h" #include "nel/gui/lua_ihm.h" diff --git a/code/ryzom/client/src/interface_v3/group_map.h b/code/ryzom/client/src/interface_v3/group_map.h index 0521ede20..d39a8c1b3 100644 --- a/code/ryzom/client/src/interface_v3/group_map.h +++ b/code/ryzom/client/src/interface_v3/group_map.h @@ -27,7 +27,7 @@ #include "nel/gui/interface_group.h" #include "nel/gui/ctrl_button.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/view_text.h" #include "animal_position_state.h" #include "../continent.h" diff --git a/code/ryzom/client/src/interface_v3/group_menu.cpp b/code/ryzom/client/src/interface_v3/group_menu.cpp index da2681f53..b0a062049 100644 --- a/code/ryzom/client/src/interface_v3/group_menu.cpp +++ b/code/ryzom/client/src/interface_v3/group_menu.cpp @@ -22,7 +22,7 @@ #include "nel/gui/interface_expr.h" #include "group_menu.h" #include "nel/misc/xml_auto_ptr.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/action_handler.h" // Just for getAllParams #include "nel/gui/lua_ihm.h" #include "lua_ihm_ryzom.h" diff --git a/code/ryzom/client/src/interface_v3/group_menu.h b/code/ryzom/client/src/interface_v3/group_menu.h index bcb24c559..4b4298ab7 100644 --- a/code/ryzom/client/src/interface_v3/group_menu.h +++ b/code/ryzom/client/src/interface_v3/group_menu.h @@ -28,9 +28,9 @@ namespace NLGUI { class CCtrlScroll; + class CViewBitmap; } -class CViewBitmap; class CGroupMenu; class CGroupList; diff --git a/code/ryzom/client/src/interface_v3/group_paragraph.cpp b/code/ryzom/client/src/interface_v3/group_paragraph.cpp index b3d915235..ae8791c6c 100644 --- a/code/ryzom/client/src/interface_v3/group_paragraph.cpp +++ b/code/ryzom/client/src/interface_v3/group_paragraph.cpp @@ -23,7 +23,7 @@ #include "interface_manager.h" #include "nel/gui/interface_element.h" #include "../client_chat_manager.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/view_text_id.h" #include "group_container.h" diff --git a/code/ryzom/client/src/interface_v3/group_skills.cpp b/code/ryzom/client/src/interface_v3/group_skills.cpp index d866a8c5a..c73082c1e 100644 --- a/code/ryzom/client/src/interface_v3/group_skills.cpp +++ b/code/ryzom/client/src/interface_v3/group_skills.cpp @@ -24,7 +24,7 @@ #include "nel/gui/interface_expr.h" #include "nel/gui/view_text.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "dbview_number.h" #include "dbview_bar.h" diff --git a/code/ryzom/client/src/interface_v3/group_table.cpp b/code/ryzom/client/src/interface_v3/group_table.cpp index 0b4bb5cd1..7d9d6239f 100644 --- a/code/ryzom/client/src/interface_v3/group_table.cpp +++ b/code/ryzom/client/src/interface_v3/group_table.cpp @@ -22,7 +22,7 @@ #include "interface_manager.h" #include "nel/gui/interface_element.h" #include "../client_chat_manager.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/view_text_id.h" #include "group_container.h" diff --git a/code/ryzom/client/src/interface_v3/group_tree.cpp b/code/ryzom/client/src/interface_v3/group_tree.cpp index 4c6d48bb6..7a5eafc75 100644 --- a/code/ryzom/client/src/interface_v3/group_tree.cpp +++ b/code/ryzom/client/src/interface_v3/group_tree.cpp @@ -21,7 +21,7 @@ #include "group_tree.h" #include "interface_manager.h" #include "nel/gui/interface_element.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/view_text.h" #include "group_container.h" #include "nel/gui/action_handler.h" diff --git a/code/ryzom/client/src/interface_v3/group_tree.h b/code/ryzom/client/src/interface_v3/group_tree.h index 5b158f67b..fcc321a2b 100644 --- a/code/ryzom/client/src/interface_v3/group_tree.h +++ b/code/ryzom/client/src/interface_v3/group_tree.h @@ -26,10 +26,9 @@ namespace NLGUI { class CViewText; + class CViewBitmap; } -class CViewBitmap; - // ---------------------------------------------------------------------------- class CGroupTree : public CInterfaceGroup { diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index a89387a82..bb6f66f38 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -33,7 +33,7 @@ #include "../connection.h" #include "../entity_cl.h" #include "../user_entity.h" // UserEntity -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "../sheet_manager.h" #include "../net_manager.h" #include "../client_sheets/building_sheet.h" diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 8b9fc658d..65e7b6d2d 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -46,7 +46,7 @@ #include "action_handler_help.h" #include "action_handler_item.h" // View -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" //#include "view_bitmap_progress.h" #include "view_bitmap_faber_mp.h" #include "view_bitmap_combo.h" diff --git a/code/ryzom/client/src/interface_v3/interface_parser.cpp b/code/ryzom/client/src/interface_v3/interface_parser.cpp index 32d48d7d8..d593b1000 100644 --- a/code/ryzom/client/src/interface_v3/interface_parser.cpp +++ b/code/ryzom/client/src/interface_v3/interface_parser.cpp @@ -36,7 +36,7 @@ #include "interface_anim.h" #include "interface_3d_scene.h" // View -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "view_bitmap_faber_mp.h" #include "view_bitmap_combo.h" #include "nel/gui/view_text.h" diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index a5ddacdbf..46a08234a 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -20,7 +20,7 @@ #include "people_list.h" #include "group_container.h" #include "group_list.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "interface_manager.h" #include "nel/gui/action_handler.h" #include "group_editbox.h" diff --git a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp index 00959b4d2..ca2681bdd 100644 --- a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp +++ b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp @@ -22,7 +22,7 @@ #include "nel/gui/view_base.h" #include "nel/gui/view_text.h" #include "nel/gui/view_text_id.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "view_radar.h" #include "nel/gui/group_submenu_base.h" #include "group_menu.h" diff --git a/code/ryzom/client/src/interface_v3/skill_manager.cpp b/code/ryzom/client/src/interface_v3/skill_manager.cpp index d31a4d034..1f849522b 100644 --- a/code/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/code/ryzom/client/src/interface_v3/skill_manager.cpp @@ -28,7 +28,7 @@ #include "nel/gui/action_handler.h" #include "sbrick_manager.h" #include "dbgroup_combo_box.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "../net_manager.h" #include "sbrick_manager.h" #include "../user_entity.h" diff --git a/code/ryzom/client/src/interface_v3/view_bitmap.cpp b/code/ryzom/client/src/interface_v3/view_bitmap.cpp deleted file mode 100644 index dfbd2c1c7..000000000 --- a/code/ryzom/client/src/interface_v3/view_bitmap.cpp +++ /dev/null @@ -1,311 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -#include "view_bitmap.h" -#include "nel/misc/xml_auto_ptr.h" -#include "nel/gui/widget_manager.h" -#include "nel/gui/interface_group.h" -#include "nel/gui/group_container_base.h" - -using namespace std; -using namespace NLMISC; -using namespace NL3D; - - -NLMISC_REGISTER_OBJECT(CViewBase, CViewBitmap, std::string, "bitmap"); -REGISTER_UI_CLASS(CViewBitmap) - -// ---------------------------------------------------------------------------- - -bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) -{ - CXMLAutoPtr prop; - - //try to get props that can be inherited from groups - //if a property is not defined, try to find it in the parent group. - //if it is undefined, set it to zero - if (! CViewBase::parse(cur,parentGroup) ) - { - string tmp = string("cannot parse view:")+getId()+", parent:"+parentGroup->getId(); - nlinfo (tmp.c_str()); - return false; - } - - //try to get the NEEDED specific props - prop= (char*) xmlGetProp( cur, (xmlChar*)"color" ); - _Color = CRGBA(255,255,255,255); - if (prop) - _Color = convertColor (prop); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"txtoffsetx" ); - _TxtOffsetX = 0; - if (prop) fromString((const char*)prop, _TxtOffsetX); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"txtoffsety" ); - _TxtOffsetY = 0; - if (prop) fromString((const char*)prop, _TxtOffsetY); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"txtwidth" ); - _TxtWidth = -1; - if (prop) fromString((const char*)prop, _TxtWidth); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"txtheight" ); - _TxtHeight = -1; - if (prop) fromString((const char*)prop, _TxtHeight); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"texture" ); - if (prop) - { - string TxName = (const char *) prop; - TxName = strlwr (TxName); - setTexture (TxName); - //CInterfaceManager *pIM = CInterfaceManager::getInstance(); - //CViewRenderer &rVR = *CViewRenderer::getInstance(); - //_TextureId = rVR.getTextureIdFromName (TxName); - } - - prop = (char*) xmlGetProp( cur, (xmlChar*)"scale" ); - _Scale = false; - if (prop) - _Scale = convertBool(prop); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"rot" ); - _Rot = 0; - if (prop) - fromString((const char*)prop, _Rot); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"flip" ); - _Flip = false; - if (prop) - _Flip = convertBool(prop); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"tile" ); - _Tile = false; - if (prop) - _Tile = convertBool(prop); - - prop = (char*) xmlGetProp (cur, (xmlChar*)"align"); - _Align = 0; - if (prop) - { - const char *seekPtr = prop.getDatas(); - while (*seekPtr != 0) - { - if ((*seekPtr=='l')||(*seekPtr=='L')) - { - _Align &= ~1; - } - if ((*seekPtr=='r')||(*seekPtr=='R')) - { - _Align |= 1; - } - if ((*seekPtr=='b')||(*seekPtr=='B')) - { - _Align &= ~2; - } - if ((*seekPtr=='t')||(*seekPtr=='T')) - { - _Align |= 2; - } - ++seekPtr; - } - } - - _InheritGCAlpha = false; - prop = (char*) xmlGetProp( cur, (xmlChar*)"inherit_gc_alpha" ); - if (prop) - { - _InheritGCAlpha = convertBool(prop); - } - - return true; -} - -// ---------------------------------------------------------------------------- -void CViewBitmap::draw () -{ - CViewRenderer &rVR = *CViewRenderer::getInstance(); - - CRGBA col; - if(getModulateGlobalColor()) - { - col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent()); - } - else - { - col= _Color; - col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8); - } - - if (_InheritGCAlpha) - { - // search a parent container - CInterfaceGroup *gr = getParent(); - while (gr) - { - if (gr->isGroupContainer()) - { - CGroupContainerBase *gc = static_cast(gr); - col.A = (uint8)(((sint32)col.A*((sint32)gc->getCurrentContainerAlpha()+1))>>8); - break; - } - gr = gr->getParent(); - } - } - - if (_Scale && !_Tile) - { - rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, - _WReal, _HReal, - (uint8)_Rot, _Flip, - _TextureId, - col ); - } - else - { - if (!_Tile) - { - rVR.draw11RotFlipBitmap (_RenderLayer, _XReal, _YReal, - (uint8)_Rot, _Flip, - _TextureId, - col); - } - else - { - rVR.drawRotFlipBitmapTiled(_RenderLayer, _XReal, _YReal, - _WReal, _HReal, - (uint8)_Rot, _Flip, - _TextureId, - _Align, - col); - } - } -} - -// ---------------------------------------------------------------------------- -void CViewBitmap::updateCoords() -{ - if (!_Scale) - { - CViewRenderer &rVR = *CViewRenderer::getInstance(); - sint32 txw, txh; - rVR.getTextureSizeFromId (_TextureId, txw, txh); - _W = txw; - _H = txh; - } - CViewBase::updateCoords(); -} - -// ---------------------------------------------------------------------------- -void CViewBitmap::setTexture(const std::string & TxName) -{ -// CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = *CViewRenderer::getInstance(); - - _TextureId.setTexture (TxName.c_str (), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false); -} - -// ---------------------------------------------------------------------------- -std::string CViewBitmap::getTexture () const -{ - CViewRenderer &rVR = *CViewRenderer::getInstance(); - return rVR.getTextureNameFromId (_TextureId); -} - -// *************************************************************************** -void CViewBitmap::fitTexture() -{ - CViewRenderer &rVR = *CViewRenderer::getInstance(); - sint32 w, h; - rVR.getTextureSizeFromId(_TextureId, w, h); - setW(w); - setH(h); -} - -// *************************************************************************** -void CViewBitmap::setColorAsString(const std::string & col) -{ - _Color = convertColor (col.c_str()); -} - -// *************************************************************************** -std::string CViewBitmap::getColorAsString() const -{ - return NLMISC::toString(_Color.R) + " " + NLMISC::toString(_Color.G) + " " + NLMISC::toString(_Color.B) + " " + NLMISC::toString(_Color.A); -} - -// *************************************************************************** -void CViewBitmap::setColorAsInt(sint32 col) -{ - _Color.setPacked(col); -} - -// *************************************************************************** -sint32 CViewBitmap::getColorAsInt() const -{ - return _Color.getPacked(); -} - -// *************************************************************************** -void CViewBitmap::setColorRGBA(NLMISC::CRGBA col) -{ - _Color = col; -} - -// *************************************************************************** -NLMISC::CRGBA CViewBitmap::getColorRGBA() const -{ - return _Color; -} - -// *************************************************************************** -sint32 CViewBitmap::getMaxUsedW() const -{ - sint32 txw, txh; - CViewRenderer &rVR = *CViewRenderer::getInstance(); - rVR.getTextureSizeFromId (_TextureId, txw, txh); - return txw; -} - -// *************************************************************************** -sint32 CViewBitmap::getMinUsedW() const -{ - return getMaxUsedW(); -} - -// *************************************************************************** -void CViewBitmap::serial(NLMISC::IStream &f) -{ - CViewBase::serial(f); - f.serial(_TextureId); - f.serial(_Color); - f.serial(_Rot); - f.serialEnum(_Align); - f.serialEnum(_Type); - nlSerialBitBool(f, _Scale); - nlSerialBitBool(f, _Flip); - nlSerialBitBool(f, _Tile); - nlSerialBitBool(f, _InheritGCAlpha); - f.serial(_TxtOffsetX); - f.serial(_TxtOffsetY); - f.serial(_TxtWidth); - f.serial(_TxtHeight); -} - - -// *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/view_bitmap.h b/code/ryzom/client/src/interface_v3/view_bitmap.h deleted file mode 100644 index cea94116b..000000000 --- a/code/ryzom/client/src/interface_v3/view_bitmap.h +++ /dev/null @@ -1,141 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -#ifndef NL_VIEW_BITMAP_H -#define NL_VIEW_BITMAP_H - -#include "nel/gui/view_base.h" -#include "nel/3d/u_texture.h" -#include "nel/gui/view_renderer.h" - -/** - * class implementing a bitmap view - * \author Matthieu 'TrapII' Besson - * \author Nevrax France - * \date 2002 - */ -class CViewBitmap : public CViewBase -{ -public: - DECLARE_UI_CLASS(CViewBitmap) - enum EType { Stretched = 0, Tiled, TypeCount }; -public: - - /// Constructor - CViewBitmap(const TCtorParam ¶m) : CViewBase(param) - { - _Color = NLMISC::CRGBA(255,255,255,255); - _Scale = false; - _Rot = 0; - _Flip = false; - _Tile = false; - _Align = 0; - _Type = Stretched; - _InheritGCAlpha = false; - - // Default parameters for createTexture - _TxtOffsetX = 0; - _TxtOffsetY = 0; - _TxtWidth = -1; - _TxtHeight = -1; - } - - /** - * parse an xml node and initialize the base view mambers. Must call CViewBase::parse - * \param cur : pointer to the xml node to be parsed - * \param parentGroup : the parent group of the view - * \partam id : a refence to the string that will receive the view ID - * \return true if success - */ - bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup); - virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } - - virtual void updateCoords (); - - /// Draw the view - virtual void draw (); - - bool getScale() const { return _Scale; } - void setScale (bool s) { _Scale = s; } - bool getTile() const { return _Tile; } - void setTile (bool s) { _Tile = s; } - void setColor (const NLMISC::CRGBA &r) { _Color = r; } - - // Reflected - - virtual void setTexture(const std::string & TxName); - virtual std::string getTexture () const; - - /** Force the bitmap to match current texture size - * The 'scale' flag isnot modified - */ - void fitTexture(); - - bool isTextureValid() const { return _TextureId != -1; } - - void setColorAsString(const std::string & col); - std::string getColorAsString() const; - - void setColorAsInt(sint32 col); - sint32 getColorAsInt() const; - - void setColorRGBA(NLMISC::CRGBA col); - NLMISC::CRGBA getColorRGBA() const; - - virtual sint32 getAlpha() const { return _Color.A; } - virtual void setAlpha (sint32 a) { _Color.A = (uint8)a; } - - REFLECT_EXPORT_START(CViewBitmap, CViewBase) - REFLECT_STRING ("color", getColorAsString, setColorAsString); - REFLECT_SINT32 ("color_as_int", getColorAsInt, setColorAsInt); - REFLECT_RGBA ("color_rgba", getColorRGBA, setColorRGBA); - REFLECT_SINT32 ("alpha", getAlpha, setAlpha); - REFLECT_STRING ("texture", getTexture, setTexture); - REFLECT_BOOL("scale", getScale, setScale); - REFLECT_EXPORT_END - - /// \from CInterfaceElement - sint32 getMaxUsedW() const; - sint32 getMinUsedW() const; - - virtual void serial(NLMISC::IStream &f); - -protected: - CViewRenderer::CTextureId _TextureId; /// Accelerator - NLMISC::CRGBA _Color; - sint32 _Rot; - sint32 _Align; /// 1st bit - Left/Right (0/1) 2nd bit - Bottom/Top (0/1) - EType _Type; - bool _Scale : 1; - bool _Flip : 1; - bool _Tile : 1; - bool _InheritGCAlpha : 1; - - // For single texture - - sint32 _TxtOffsetX; // Offset X of the single texture - sint32 _TxtOffsetY; // Offset Y of the single texture - sint32 _TxtWidth; // Width of the single texture - sint32 _TxtHeight; // Height of the single texture - -}; - - -#endif // NL_VIEW_BITMAP_H - -/* End of view_bitmap.h */ diff --git a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.h b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.h index 22c7b3e0b..02327576c 100644 --- a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.h +++ b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.h @@ -20,7 +20,7 @@ #define NL_VIEW_BITMAP_MP_FABER_H #include "nel/misc/types_nl.h" -#include "view_bitmap.h" +#include "nel/gui/view_bitmap.h" ///\todo nico : do the real display when item icons are available diff --git a/code/ryzom/client/src/r2/displayer_visual_shape.h b/code/ryzom/client/src/r2/displayer_visual_shape.h index 72ae05e01..dda2a721e 100644 --- a/code/ryzom/client/src/r2/displayer_visual_shape.h +++ b/code/ryzom/client/src/r2/displayer_visual_shape.h @@ -23,7 +23,11 @@ #include "instance_map_deco.h" class CEntityCL; -class CViewBitmap; + +namespace NLGUI +{ + class CViewBitmap; +} namespace NL3D { diff --git a/code/ryzom/client/src/r2/instance_map_deco.h b/code/ryzom/client/src/r2/instance_map_deco.h index 074604dc7..a142602c8 100644 --- a/code/ryzom/client/src/r2/instance_map_deco.h +++ b/code/ryzom/client/src/r2/instance_map_deco.h @@ -24,10 +24,10 @@ namespace NLGUI { class CCtrlQuad; + class CViewBitmap; } class CGroupMap; -class CViewBitmap; namespace R2 { diff --git a/code/ryzom/client/src/r2/prim_render.cpp b/code/ryzom/client/src/r2/prim_render.cpp index e7f881c0a..63a6a5844 100644 --- a/code/ryzom/client/src/r2/prim_render.cpp +++ b/code/ryzom/client/src/r2/prim_render.cpp @@ -22,7 +22,7 @@ #include "nel/misc/vector_2f.h" #include "nel/misc/time_nl.h" // -#include "../interface_v3/view_bitmap.h" +#include "nel/gui/view_bitmap.h" #include "nel/gui/ctrl_quad.h" #include "nel/gui/ctrl_polygon.h" #include "../interface_v3/interface_manager.h"