diff --git a/code/nel/include/nel/gui/interface_group.h b/code/nel/include/nel/gui/interface_group.h index 451e38ff3..38d0c1e32 100644 --- a/code/nel/include/nel/gui/interface_group.h +++ b/code/nel/include/nel/gui/interface_group.h @@ -252,6 +252,7 @@ namespace NLGUI bool isGroupContainer() const { return _IsGroupContainer; } bool isGroupScrollText() const{ return _IsGroupScrollText; } bool isGroupInScene() const{ return _IsGroupInScene; } + bool isGroupList() const{ return _IsGroupList; } CInterfaceGroup* getEnclosingContainer(); @@ -354,6 +355,7 @@ namespace NLGUI bool _IsGroupContainer : 1; // faster than a virual call bool _IsGroupScrollText : 1; bool _IsGroupInScene : 1; + bool _IsGroupList : 1; bool _NeedFrameUpdatePos : 1; // typically For CGroupInScene sint32 _ResizeFromChildWMargin; sint32 _ResizeFromChildHMargin; diff --git a/code/nel/include/nel/gui/interface_options.h b/code/nel/include/nel/gui/interface_options.h index 7ca938140..6fcd6c18d 100644 --- a/code/nel/include/nel/gui/interface_options.h +++ b/code/nel/include/nel/gui/interface_options.h @@ -22,6 +22,8 @@ #include "nel/misc/debug.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/rgba.h" +#include "libxml/globals.h" +#include "nel/misc/xml_auto_ptr.h" namespace NL3D { diff --git a/code/nel/include/nel/gui/view_renderer.h b/code/nel/include/nel/gui/view_renderer.h index 5adde3cb3..83b45f79f 100644 --- a/code/nel/include/nel/gui/view_renderer.h +++ b/code/nel/include/nel/gui/view_renderer.h @@ -578,6 +578,8 @@ namespace NLGUI static NL3D::UTextContext *textcontext; public: + static NL3D::UTextContext* getTextContext(){ return textcontext; } + static std::set< std::string > *hwCursors; static float hwCursorScale; diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 1c15ac357..8188a68cb 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -25,6 +25,7 @@ #include "nel/misc/rgba.h" #include "nel/misc/types_nl.h" #include "nel/gui/interface_common.h" +#include "nel/gui/interface_options.h" namespace NLMISC { @@ -302,6 +303,45 @@ namespace NLGUI // Get the User DblClick Delay (according to save...), in milisecond uint getUserDblClickDelay(); + /// \name Global Interface Options + // @{ + + // List of system options + enum TSystemOption{ + OptionCtrlSheetGrayColor=0, + OptionCtrlTextGrayColor, + OptionCtrlSheetRedifyColor, + OptionCtrlTextRedifyColor, + OptionCtrlSheetGreenifyColor, + OptionCtrlTextGreenifyColor, + OptionViewTextOverBackColor, + OptionFont, + OptionAddCoefFont, + OptionMulCoefAnim, + OptionTimeoutBubbles, + OptionTimeoutMessages, + OptionTimeoutContext, + OptionTimeoutContextHtml, + NumSystemOptions + }; + + void setupOptions(); + /** Get a system option by its enum (faster than getOptions() and getVal()) + * NB: array updated after each parseInterface() + */ + const CInterfaceOptionValue &getSystemOption( TSystemOption o ) const{ return _SystemOptions[ o ]; } + + // @} + + CInterfaceElement* getOverExtendViewText(){ return _OverExtendViewText; } + NLMISC::CRGBA& getOverExtendViewTextBackColor(){ return _OverExtendViewTextBackColor; } + + // For single lined ViewText that are clipped: on over of viewText too big, the text is drawn on top. A CRefPtr is kept + void setOverExtendViewText( CInterfaceElement *vt, NLMISC::CRGBA backGround ){ + _OverExtendViewText = vt; + _OverExtendViewTextBackColor = backGround; + } + static IParser *parser; private: @@ -345,6 +385,13 @@ namespace NLGUI NLMISC::CCDBNodeLeaf *_AProp; bool _MouseHandlingEnabled; + + // System Options + CInterfaceOptionValue _SystemOptions[ NumSystemOptions ]; + + // The next ViewText to draw for Over + NLMISC::CRefPtr< CInterfaceElement > _OverExtendViewText; + NLMISC::CRGBA _OverExtendViewTextBackColor; }; } diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index bfa58b535..ac8842b81 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -60,6 +60,7 @@ namespace NLGUI _IsGroupContainer = false; _IsGroupScrollText = false; _IsGroupInScene = false; + _IsGroupList = false; _AHOnActive = NULL; _AHOnDeactive = NULL; _AHOnLeftClick = NULL; diff --git a/code/nel/src/gui/interface_options.cpp b/code/nel/src/gui/interface_options.cpp index 1a01bce6e..c4cd33f2c 100644 --- a/code/nel/src/gui/interface_options.cpp +++ b/code/nel/src/gui/interface_options.cpp @@ -17,7 +17,6 @@ #include "nel/gui/interface_element.h" -#include "nel/misc/xml_auto_ptr.h" #include "nel/gui/interface_options.h" using namespace std; diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 76b0afcc7..483df5887 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -1419,8 +1419,32 @@ namespace NLGUI uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f); return dbclickDelay; } - - + + // ------------------------------------------------------------------------------------------------ + void CWidgetManager::setupOptions() + { + // After parsing options and templates node -> init system options. + CInterfaceOptions *opt = getOptions( "system" ); + if( opt != NULL ) + { + // List here all Special options + _SystemOptions[OptionCtrlSheetGrayColor]= opt->getValue("ctrl_sheet_gray_color"); + _SystemOptions[OptionCtrlTextGrayColor]= opt->getValue("ctrl_text_gray_color"); + _SystemOptions[OptionCtrlSheetRedifyColor]= opt->getValue("ctrl_sheet_redify_color"); + _SystemOptions[OptionCtrlTextRedifyColor]= opt->getValue("ctrl_text_redify_color"); + _SystemOptions[OptionCtrlSheetGreenifyColor]= opt->getValue("ctrl_sheet_greenify_color"); + _SystemOptions[OptionCtrlTextGreenifyColor]= opt->getValue("ctrl_text_greenify_color"); + _SystemOptions[OptionViewTextOverBackColor]= opt->getValue("text_over_back_color"); + _SystemOptions[OptionFont]= opt->getValue("font"); + _SystemOptions[OptionAddCoefFont]= opt->getValue("add_coef_font"); + _SystemOptions[OptionMulCoefAnim]= opt->getValue("mul_coef_anim"); + _SystemOptions[OptionTimeoutBubbles]= opt->getValue("bubbles_timeout"); + _SystemOptions[OptionTimeoutMessages]= opt->getValue("messages_timeout"); + _SystemOptions[OptionTimeoutContext]= opt->getValue("context_timeout"); + _SystemOptions[OptionTimeoutContextHtml]= opt->getValue("context_html_timeout"); + } + + } CWidgetManager::CWidgetManager() { diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 586817ac4..c02b21caf 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -2108,8 +2108,8 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti curNoSheetColor= CRGBA(255,255,255, CWidgetManager::getInstance()->getGlobalColorForContent().A); // The gray color - CRGBA grayColor= pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetGrayColor).getValColor(); - CRGBA redifyColor= pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetRedifyColor).getValColor(); + CRGBA grayColor= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlSheetGrayColor).getValColor(); + CRGBA redifyColor= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlSheetRedifyColor).getValColor(); // The color of the number. CRGBA numberColor; diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp index 68c0a8260..fe56bf1d9 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp @@ -89,34 +89,34 @@ void CDBGroupListSheetMission::CSheetChildMission::updateViewText(CDBGroupListSh if (CachePreReqState == MISSION_DESC::PreReqFail) { // If mission prerequesits failed for miscellaneaous reasons : COLOR RED - CRGBA color = pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetRedifyColor).getValColor(); + CRGBA color = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlSheetRedifyColor).getValColor(); Ctrl->setGrayed(true); Ctrl->setSheetColor(color); - color = pIM->getSystemOption(CInterfaceManager::OptionCtrlTextRedifyColor).getValColor(); + color = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextRedifyColor).getValColor(); Text->setColor(color); } else if (CachePreReqState == MISSION_DESC::PreReqFailAlreadyDone) { // If mission prerequesits failed because mission is already done : COLOR GREEN - CRGBA color = pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetGreenifyColor).getValColor(); + CRGBA color = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlSheetGreenifyColor).getValColor(); Ctrl->setGrayed(true); Ctrl->setSheetColor(color); - color = pIM->getSystemOption(CInterfaceManager::OptionCtrlTextGreenifyColor).getValColor(); + color = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGreenifyColor).getValColor(); Text->setColor(color); } else if (CachePreReqState == MISSION_DESC::PreReqFailRunning) { // If mission prerequesits failed because the mission is in progress : COLOR GRAY - CRGBA color = pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetGrayColor).getValColor(); + CRGBA color = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlSheetGrayColor).getValColor(); Ctrl->setGrayed(true); Ctrl->setSheetColor(color); - color = pIM->getSystemOption(CInterfaceManager::OptionCtrlTextGrayColor).getValColor(); + color = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor(); Text->setColor(color); } else diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 1ec3d9420..b76ef53fb 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -506,8 +506,8 @@ void CDBGroupListSheetText::checkCoords () { // The gray color CRGBA normalColor= _TextTemplate.getColor(); - CRGBA grayColor= pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetGrayColor).getValColor(); - CRGBA redifyColor= pIM->getSystemOption(CInterfaceManager::OptionCtrlTextRedifyColor).getValColor(); + CRGBA grayColor= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlSheetGrayColor).getValColor(); + CRGBA redifyColor= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextRedifyColor).getValColor(); grayColor.modulateFromColor(grayColor, normalColor); redifyColor.modulateFromColor(redifyColor, normalColor); diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index 32ab05086..603c7f5e5 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -73,7 +73,7 @@ void contextHelp (const std::string &name) completeURL += "_" + ClientCfg.getHtmlLanguageCode() + ".html"; // Add bubble InSceneBubbleManager.addContextHelpHTML(completeURL, target, - pIM->getSystemOption(CInterfaceManager::OptionTimeoutContextHtml).getValSInt32()); + CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutContextHtml).getValSInt32()); } // Found one help @@ -565,7 +565,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA // default timeout? if(time==0) - time=pIM->getSystemOption(CInterfaceManager::OptionTimeoutMessages).getValSInt32(); + time=CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutMessages).getValSInt32(); // Create a skill popup string id = "message_popup_"+toString(_PopupCount++); @@ -614,7 +614,7 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message, // default timeout? if(time==0) - time= pIM->getSystemOption(CInterfaceManager::OptionTimeoutMessages).getValSInt32(); + time= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutMessages).getValSInt32(); // Create a skill popup string id = "message_popup_"+toString(_PopupCount++); @@ -825,7 +825,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText, CCharacterCL *pChar = dynamic_cast(EntitiesMngr.getEntityByCompressedIndex(nUID)); if (pChar == NULL || nUID==CLFECOMMON::INVALID_CLIENT_DATASET_INDEX) return; - if (bubbleTimer == 0) bubbleTimer = pIM->getSystemOption(CInterfaceManager::OptionTimeoutBubbles).getValSInt32(); + if (bubbleTimer == 0) bubbleTimer = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); // Output the message in a bubble @@ -1575,7 +1575,7 @@ class CHandlerCharacterBubble : public IActionHandler string sTime = getParam (sParams, "time"); uint duration; if (sTime.empty()) - duration = pIM->getSystemOption(CInterfaceManager::OptionTimeoutBubbles).getValSInt32(); + duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32(); else fromString(sTime, duration); @@ -1602,7 +1602,7 @@ class CHandlerSkillPopup : public IActionHandler string sTime = getParam (sParams, "time"); uint duration; if (sTime.empty()) - duration = pIM->getSystemOption(CInterfaceManager::OptionTimeoutMessages).getValSInt32(); + duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutMessages).getValSInt32(); else fromString(sTime, duration); @@ -1626,7 +1626,7 @@ class CHandlerMessagePopup : public IActionHandler string sTime = getParam (sParams, "time"); uint duration; if (sTime.empty()) - duration = pIM->getSystemOption(CInterfaceManager::OptionTimeoutMessages).getValSInt32(); + duration = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutMessages).getValSInt32(); else fromString(sTime, duration); @@ -1651,7 +1651,7 @@ class CHandlerContextHelp : public IActionHandler if (itext.empty()) itext = CI18N::get(text); - InSceneBubbleManager.addContextHelp (itext, targetName, pIM->getSystemOption(CInterfaceManager::OptionTimeoutContext).getValSInt32()); + InSceneBubbleManager.addContextHelp (itext, targetName, CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutContext).getValSInt32()); } }; REGISTER_ACTION_HANDLER( CHandlerContextHelp, "context_help"); diff --git a/code/ryzom/client/src/interface_v3/group_list.cpp b/code/ryzom/client/src/interface_v3/group_list.cpp index e77f675d6..64fe82706 100644 --- a/code/ryzom/client/src/interface_v3/group_list.cpp +++ b/code/ryzom/client/src/interface_v3/group_list.cpp @@ -53,6 +53,7 @@ CGroupList::CGroupList(const TCtorParam ¶m) _Over = false; _OverColor = CRGBA(255, 255, 255, 32); _OverElt = -1; + _IsGroupList = true; } // ---------------------------------------------------------------------------- diff --git a/code/ryzom/client/src/interface_v3/group_tree.cpp b/code/ryzom/client/src/interface_v3/group_tree.cpp index c739be7dd..17c0bff09 100644 --- a/code/ryzom/client/src/interface_v3/group_tree.cpp +++ b/code/ryzom/client/src/interface_v3/group_tree.cpp @@ -685,7 +685,7 @@ void CGroupTree::draw() } // will be drawn over all the interface - pIM->setOverExtendViewText(viewTextExtend, col); + CWidgetManager::getInstance()->setOverExtendViewText(viewTextExtend, col); } } } diff --git a/code/ryzom/client/src/interface_v3/interface_anim.cpp b/code/ryzom/client/src/interface_v3/interface_anim.cpp index be39bc9b1..6f3001dd9 100644 --- a/code/ryzom/client/src/interface_v3/interface_anim.cpp +++ b/code/ryzom/client/src/interface_v3/interface_anim.cpp @@ -123,7 +123,7 @@ bool CInterfaceTrack::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) { double dTime; fromString(k.Time, dTime); - k.Time = toString(dTime * CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionMulCoefAnim).getValFloat()); + k.Time = toString(dTime * CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionMulCoefAnim).getValFloat()); } // Depending on the type of the track read extra values @@ -193,7 +193,7 @@ bool CInterfaceTrack::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) float fAnimTime; fromString((const char*)time, fAnimTime); - TAnimationTime animTime = fAnimTime * CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionMulCoefAnim).getValFloat(); + TAnimationTime animTime = fAnimTime * CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionMulCoefAnim).getValFloat(); double animValue; fromString(value, animValue); @@ -544,7 +544,7 @@ bool CInterfaceAnim::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) fromString((const char*)ptr, _Duration); if (_Duration == 0) _Duration = 1.0; - _Duration *= CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionMulCoefAnim).getValFloat(); + _Duration *= CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionMulCoefAnim).getValFloat(); ptr = xmlGetProp (cur, (xmlChar*)"disable_buttons"); if (ptr) diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 89c1bc64b..1e9ebb20e 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1343,36 +1343,17 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera) } -// ------------------------------------------------------------------------------------------------ void CInterfaceManager::setupOptions() { - // After parsing options and templates node -> init system options. - CInterfaceOptions *opt= CWidgetManager::getInstance()->getOptions("system"); - if(opt) - { - // List here all Special options - _SystemOptions[OptionCtrlSheetGrayColor]= opt->getValue("ctrl_sheet_gray_color"); - _SystemOptions[OptionCtrlTextGrayColor]= opt->getValue("ctrl_text_gray_color"); - _SystemOptions[OptionCtrlSheetRedifyColor]= opt->getValue("ctrl_sheet_redify_color"); - _SystemOptions[OptionCtrlTextRedifyColor]= opt->getValue("ctrl_text_redify_color"); - _SystemOptions[OptionCtrlSheetGreenifyColor]= opt->getValue("ctrl_sheet_greenify_color"); - _SystemOptions[OptionCtrlTextGreenifyColor]= opt->getValue("ctrl_text_greenify_color"); - _SystemOptions[OptionViewTextOverBackColor]= opt->getValue("text_over_back_color"); - _SystemOptions[OptionFont]= opt->getValue("font"); - _SystemOptions[OptionAddCoefFont]= opt->getValue("add_coef_font"); - _SystemOptions[OptionMulCoefAnim]= opt->getValue("mul_coef_anim"); - _SystemOptions[OptionTimeoutBubbles]= opt->getValue("bubbles_timeout"); - _SystemOptions[OptionTimeoutMessages]= opt->getValue("messages_timeout"); - _SystemOptions[OptionTimeoutContext]= opt->getValue("context_timeout"); - _SystemOptions[OptionTimeoutContextHtml]= opt->getValue("context_html_timeout"); - } - + CWidgetManager *wm = CWidgetManager::getInstance(); + wm->setupOptions(); + // Try to change font if any - string sFont = _SystemOptions[OptionFont].getValStr(); + string sFont = wm->getSystemOption( CWidgetManager::OptionFont ).getValStr(); + extern void resetTextContext( const char*, bool ); if ((!sFont.empty()) && (driver != NULL)) resetTextContext(sFont.c_str(), true); - // Continue to parse the rest of the interface } @@ -4029,21 +4010,14 @@ void CInterfaceManager::incLocalSyncActionCounter() } -// *************************************************************************** -void CInterfaceManager::setOverExtendViewText(CViewText *vt, CRGBA backGround) -{ - _OverExtendViewText= vt; - _OverExtendViewTextBackColor= backGround; -} - // *************************************************************************** void CInterfaceManager::drawOverExtendViewText() { // CViewRenderer &rVR= getViewRenderer(); - if(_OverExtendViewText) + if( CWidgetManager::getInstance()->getOverExtendViewText() ) { - CViewText *vtSrc= safe_cast((CInterfaceElement*)_OverExtendViewText); + CViewText *vtSrc= safe_cast( CWidgetManager::getInstance()->getOverExtendViewText() ); CInterfaceGroup *groupOver = getWindowForActiveMasterGroup("over_extend_view_text"); if(groupOver) @@ -4065,7 +4039,7 @@ void CInterfaceManager::drawOverExtendViewText() CViewBitmap *pBack= dynamic_cast(groupOver->getView("midback")); CViewBitmap *pOutline= dynamic_cast(groupOver->getView("midoutline")); if(pBack) - pBack->setColor(_OverExtendViewTextBackColor); + pBack->setColor( CWidgetManager::getInstance()->getOverExtendViewTextBackColor() ); if(pOutline) { pOutline->setColor(vtSrc->getColor()); @@ -4112,7 +4086,7 @@ void CInterfaceManager::drawOverExtendViewText() } // Reset the ptr so at next frame, won't be rendered (but if reset) - _OverExtendViewText= NULL; + CWidgetManager::getInstance()->setOverExtendViewText( NULL, CWidgetManager::getInstance()->getOverExtendViewTextBackColor() ); } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index d70a1def9..46e0d9cac 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -315,39 +315,8 @@ public: // display a system info string void displaySystemInfo(const ucstring &str, const std::string &Category = "SYS"); NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS"); - /// \name Global Interface Options - // @{ - - // List of system options - enum TSystemOption - { - OptionCtrlSheetGrayColor=0, - OptionCtrlTextGrayColor, - OptionCtrlSheetRedifyColor, - OptionCtrlTextRedifyColor, - OptionCtrlSheetGreenifyColor, - OptionCtrlTextGreenifyColor, - OptionViewTextOverBackColor, - OptionFont, - OptionAddCoefFont, - OptionMulCoefAnim, - OptionTimeoutBubbles, - OptionTimeoutMessages, - OptionTimeoutContext, - OptionTimeoutContextHtml, - - NumSystemOptions, - }; - - virtual void setupOptions(); - - /** Get a system option by its enum (faster than getOptions() and getVal()) - * NB: array updated after each parseInterface() - */ - const CInterfaceOptionValue &getSystemOption(TSystemOption o) const {return _SystemOptions[o];} - - // @} + void setupOptions(); /** Open a MessageBox. this is a simple ModalWindow with a Ok button * ui:interface:message_box must be defined in xml, with a "text" ViewText son @@ -493,9 +462,6 @@ public: return fTmp*fTmp*fTmp; } - // For single lined ViewText that are clipped: on over of viewText too big, the text is drawn on top. A CRefPtr is kept - void setOverExtendViewText(CViewText *vt, NLMISC::CRGBA backGround); - // Item Carac Test, get the value bool isItemCaracRequirementMet(CHARACTERISTICS::TCharacteristics type, sint32 value) { @@ -730,9 +696,6 @@ private: bool isControlInWindow (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd); uint getDepth (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd); - // System Options - CInterfaceOptionValue _SystemOptions[NumSystemOptions]; - // Modes CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES]; uint8 _CurrentMode; @@ -758,9 +721,6 @@ private: NLMISC::CCDBNodeLeaf *_ErrorColor; NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB; - // The next ViewText to draw for Over - NLMISC::CRefPtr _OverExtendViewText; - NLMISC::CRGBA _OverExtendViewTextBackColor; void drawOverExtendViewText(); CInterfaceGroup *getWindowForActiveMasterGroup(const std::string &windowName); diff --git a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp index 8eb74210a..7ffe97d27 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -97,14 +97,14 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s if (pViewKeyName != NULL) { pViewKeyName->setText (keyName); - pViewKeyName->setColor(grayed?pIM->getSystemOption(CInterfaceManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); + pViewKeyName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } CViewText *pViewShortcutName = dynamic_cast(pKeysLine->getView(TEMPLATE_KEYS_SHORTCUT_NAME)); if (pViewShortcutName != NULL) { pViewShortcutName->setText (shortcutName); - pViewShortcutName->setColor(grayed?pIM->getSystemOption(CInterfaceManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); + pViewShortcutName->setColor(grayed?CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionCtrlTextGrayColor).getValColor():CRGBA::White); } pKeysLine->setParent (pParent); diff --git a/code/ryzom/client/src/interface_v3/view_text.cpp b/code/ryzom/client/src/interface_v3/view_text.cpp index 19812d86b..fc50c1b76 100644 --- a/code/ryzom/client/src/interface_v3/view_text.cpp +++ b/code/ryzom/client/src/interface_v3/view_text.cpp @@ -18,13 +18,13 @@ #include "nel/misc/i18n.h" #include "view_text.h" -#include "interface_manager.h" #include "nel/gui/view_renderer.h" #include "nel/gui/widget_manager.h" #include "nel/gui/group_container_base.h" #include "nel/gui/ctrl_tooltip.h" #include "nel/misc/xml_auto_ptr.h" #include "nel/gui/lua_ihm.h" +#include "nel/gui/view_pointer_base.h" using namespace std; using namespace NLMISC; @@ -51,7 +51,8 @@ void CViewText::setupDefault () _ParentPosRef = Hotspot_BL; _PosRef = Hotspot_BL; - _FontSize = 12+CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionAddCoefFont).getValSInt32(); + _FontSize = 12 + + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32(); _Color = CRGBA(255,255,255,255); _Shadow = false; _ShadowColor = CRGBA(0,0,0,255); @@ -109,7 +110,7 @@ CViewText:: CViewText (const std::string& id, const std::string Text, sint FontS _Id = id; setupDefault (); - _FontSize = FontSize+CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionAddCoefFont).getValSInt32(); + _FontSize = FontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32(); _Color = Color; _Shadow = Shadow; setText(Text); @@ -120,7 +121,7 @@ CViewText:: CViewText (const std::string& id, const std::string Text, sint FontS CViewText::~CViewText() { if (_Index != 0xFFFFFFFF) - CInterfaceManager::getInstance()->getTextContext()->erase (_Index); + CViewRenderer::getTextContext()->erase (_Index); clearLines(); if (!_Setuped) @@ -134,7 +135,7 @@ CViewText::~CViewText() CViewText &CViewText::operator=(const CViewText &vt) { if (_Index != 0xFFFFFFFF) - CInterfaceManager::getInstance()->getTextContext()->erase (_Index); + CViewRenderer::getTextContext()->erase (_Index); // Create database entries _Active = vt._Active; @@ -187,11 +188,11 @@ void CViewText::parseTextOptions (xmlNodePtr cur) _ModulateGlobalColor= convertBool(prop); prop = (char*) xmlGetProp( cur, (xmlChar*)"fontsize" ); - _FontSize = 12+CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionAddCoefFont).getValSInt32(); + _FontSize = 12 + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32(); if (prop) { fromString((const char*)prop, _FontSize); - _FontSize += CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionAddCoefFont).getValSInt32(); + _FontSize += CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32(); } prop = (char*) xmlGetProp( cur, (xmlChar*)"shadow" ); @@ -376,7 +377,6 @@ void CViewText::checkCoords () } else { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); CCtrlBase *pCB = CWidgetManager::getInstance()->getCapturePointerLeft(); if (pCB != NULL) { @@ -412,7 +412,6 @@ void CViewText::draw () { H_AUTO( RZ_Interface_CViewText_draw ) - CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance(); // *** Out Of Clip? @@ -430,7 +429,7 @@ void CViewText::draw () return; rVR.getScreenOOSize (oow, ooh); - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); // *** get current color @@ -455,7 +454,7 @@ void CViewText::draw () { if (_Lines.size() == 0) return; - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); @@ -645,8 +644,8 @@ void CViewText::draw () CGroupContainerBase *gc= dynamic_cast(pIG); if(!gc || !gc->isMoving()) { - CRGBA col= pIM->getSystemOption(CInterfaceManager::OptionViewTextOverBackColor).getValColor(); - pIM->setOverExtendViewText(this, col); + CRGBA col= CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionViewTextOverBackColor).getValColor(); + CWidgetManager::getInstance()->setOverExtendViewText(this, col); } } } @@ -716,7 +715,7 @@ void CViewText::setText(const ucstring & text) // *************************************************************************** void CViewText::setFontSize (sint nFontSize) { - _FontSize = nFontSize+CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionAddCoefFont).getValSInt32(); + _FontSize = nFontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32(); computeFontSize (); invalidateContent(); } @@ -724,7 +723,7 @@ void CViewText::setFontSize (sint nFontSize) // *************************************************************************** sint CViewText::getFontSize() const { - return _FontSize - CInterfaceManager::getInstance()->getSystemOption(CInterfaceManager::OptionAddCoefFont).getValSInt32(); + return _FontSize - CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32(); } // *************************************************************************** @@ -862,7 +861,7 @@ void CViewText::updateTextContextMultiLine(uint nMaxWidth) rWidthCurrentLine= max(rWidthCurrentLine, (float)wordFormat.TabX*_FontWidth); } - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); // Parse the letter { @@ -1040,7 +1039,7 @@ void CViewText::updateTextContextMultiLineJustified(uint nMaxWidth, bool expandS // Get the word value. wordValue = _Text.substr(spaceEnd, wordEnd - spaceEnd); // compute width of word - si = CInterfaceManager::getInstance()->getTextContext()->getStringInfo(wordValue); + si = CViewRenderer::getTextContext()->getStringInfo(wordValue); // compute size of spaces/Tab + word newLineWidth = lineWidth + numSpaces * _SpaceWidth; @@ -1119,7 +1118,7 @@ void CViewText::updateTextContextMultiLineJustified(uint nMaxWidth, bool expandS for(currChar = 0; currChar < wordValue.length(); ++currChar) { oneChar = wordValue[currChar]; - si = CInterfaceManager::getInstance()->getTextContext()->getStringInfo(oneChar); + si = CViewRenderer::getTextContext()->getStringInfo(oneChar); if ((uint) (px + si.StringWidth) > nMaxWidth) break; px += si.StringWidth; } @@ -1238,7 +1237,7 @@ void CViewText::updateTextContextMultiLineJustified(uint nMaxWidth, bool expandS // *************************************************************************** void CViewText::updateTextContext () { - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); @@ -1413,7 +1412,7 @@ void CViewText::updateCoords() { CInterfaceGroup *parent = _Parent; // avoid resizing parents to compute the limiter - while (parent && (parent->getResizeFromChildW() || dynamic_cast(parent))) + while (parent && (parent->getResizeFromChildW() || parent->isGroupList() )) { // NB nico : the dynamic_cast for CGroupList is bad!! // can't avoid it for now, because, CGroupList implicitly does a "resize from child" in its update coords @@ -1550,7 +1549,7 @@ void CViewText::setColorRGBA(NLMISC::CRGBA col) void CViewText::getCharacterPositionFromIndex(sint index, bool cursorAtPreviousLineEnd, sint &x, sint &y, sint &height) const { NLMISC::clamp(index, 0, (sint) _Text.length()); - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); TextContext->setFontSize (_FontSize); @@ -1662,7 +1661,7 @@ static uint getCharacterIndex(const ucstring &textValue, float x) { // get character width singleChar[0] = textValue[i]; - si = CInterfaceManager::getInstance()->getTextContext()->getStringInfo(singleChar); + si = CViewRenderer::getTextContext()->getStringInfo(singleChar); px += si.StringWidth; // the character is at the i - 1 position if (px > x) @@ -1679,7 +1678,7 @@ static uint getCharacterIndex(const ucstring &textValue, float x) // *************************************************************************** void CViewText::getCharacterIndexFromPosition(sint x, sint y, uint &index, bool &cursorAtPreviousLineEnd) const { - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); // setup the text context TextContext->setHotSpot (UTextContext::BottomLeft); @@ -1819,7 +1818,7 @@ void CViewText::setStringSelectionSkipingSpace(uint stringId, const ucstring &te quadSize--; } // select what quad to skip - CInterfaceManager::getInstance()->getTextContext()->setStringSelection(stringId, quadStart, quadSize); + CViewRenderer::getTextContext()->setStringSelection(stringId, quadStart, quadSize); } // *************************************************************************** @@ -1911,7 +1910,7 @@ void CViewText::CLine::clear() for(uint k = 0; k < _Words.size(); ++k) { if (_Words[k].Index != 0xffffffff) - CInterfaceManager::getInstance()->getTextContext()->erase(_Words[k].Index); + CViewRenderer::getTextContext()->erase(_Words[k].Index); } _Words.clear(); _NumChars = 0; @@ -1932,7 +1931,7 @@ void CViewText::CWord::build(const ucstring &text, uint numSpaces/*=0*/) { Text = text; NumSpaces = numSpaces; - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); Index = TextContext->textPush(text); Info = TextContext->getStringInfo(Index); } @@ -1955,7 +1954,7 @@ sint32 CViewText::getMaxUsedW() const static const ucstring lineFeedStr("\n"); float maxWidth = 0; - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); TextContext->setFontSize (_FontSize); @@ -2039,7 +2038,7 @@ sint32 CViewText::getMinUsedW() const // If we can't clip the words, return the size of the largest word else if ((_TextMode == DontClipWord) || (_TextMode == Justified)) { - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); TextContext->setFontSize (_FontSize); @@ -2090,7 +2089,7 @@ void CViewText::onInvalidateContent() // *************************************************************************** void CViewText::computeFontSize () { - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); TextContext->setFontSize (_FontSize); @@ -2444,7 +2443,7 @@ void CViewText::setSingleLineTextFormatTaged(const ucstring &text) } // convert in ULetterColors - NL3D::UTextContext *TextContext = CInterfaceManager::getInstance()->getTextContext(); + NL3D::UTextContext *TextContext = CViewRenderer::getTextContext(); ULetterColors * letterColors = TextContext->createLetterColors(); for(uint i=0; i