CHANGED: #1471 Broke up CInterfaceOptions to two files, moved the options from CInterfaceParser to CWidgetManager, CGroupFrame no longer depends on CInterfaceManager.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-06-08 02:43:20 +02:00
parent 388cabed97
commit 2fd850b0eb
40 changed files with 795 additions and 708 deletions

View file

@ -630,7 +630,7 @@ bool CCharacter3D::init (UScene *pScene)
// ANIMATIONS
CInterfaceManager *pIM = CInterfaceManager::getInstance();
COptionsAnimationSet *pOAS= dynamic_cast<COptionsAnimationSet*>(pIM->getOptions("character_animations"));
COptionsAnimationSet *pOAS= dynamic_cast<COptionsAnimationSet*>(CWidgetManager::getInstance()->getOptions("character_animations"));
if(!pOAS || !pOAS->AnimationSet)
{
nlwarning("Not found <options> 'character_animations', or not of type 'animation_set'");

View file

@ -24,6 +24,7 @@
#include "game_share/slot_types.h"
#include "nel/3d/u_skeleton.h"
#include "interface_options.h"
#include "interface_options_ryzom.h"
#include "interface_element.h"

View file

@ -108,7 +108,7 @@ void CCtrlButton::draw ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA globalColor= pIM->getGlobalColorForContent();
CRGBA globalColor= CWidgetManager::getInstance()->getGlobalColorForContent();
// *** Detect Over
bool lastOver = false;

View file

@ -98,7 +98,7 @@ void CCtrlColPick::draw()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col = CRGBA(255,255,255,(uint8)pIM->getGlobalColor().A);
CRGBA col = CRGBA(255,255,255,(uint8)CWidgetManager::getInstance()->getGlobalColor().A);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal,
_WReal, _HReal,

View file

@ -250,12 +250,12 @@ void CCtrlPolygon::draw()
CRGBA col;
if(getModulateGlobalColor())
{
col.modulateFromColor (_Color, im->getGlobalColorForContent());
col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _Color;
col.A = (uint8)(((sint32)col.A*((sint32)im->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
vr.drawUnclippedTriangles(_RenderLayer, _RealTris, col);
}

View file

@ -66,12 +66,12 @@ void CCtrlQuad::draw()
CRGBA col;
if(getModulateGlobalColor())
{
col.modulateFromColor (_Color, pIM->getGlobalColorForContent());
col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _Color;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
/*if (_InheritGCAlpha)

View file

@ -405,7 +405,7 @@ void CCtrlScroll::updateCoords()
void CCtrlScroll::draw()
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col = CInterfaceManager::getInstance()->getGlobalColorForContent();
CRGBA col = CWidgetManager::getInstance()->getGlobalColorForContent();
if (_Target)
{

View file

@ -274,7 +274,7 @@ void CCtrlTextButton::draw ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA globalColor= pIM->getGlobalColorForContent();
CRGBA globalColor= CWidgetManager::getInstance()->getGlobalColorForContent();
// *** Detect Over
bool lastOver = false;

View file

@ -1852,7 +1852,7 @@ void CDBCtrlSheet::draw()
// Display slot
if (_DrawSlot)
rVR.draw11RotFlipBitmap (_RenderLayer, _XReal, _YReal, 0, false, _DispSlotBmpId, pIM->getGlobalColorForContent());
rVR.draw11RotFlipBitmap (_RenderLayer, _XReal, _YReal, 0, false, _DispSlotBmpId, CWidgetManager::getInstance()->getGlobalColorForContent());
// Drag'N'Drop : display the selected slot bitmap if this slot accept the currently dragged element
_CanDrop = false;
@ -1893,7 +1893,7 @@ void CDBCtrlSheet::draw()
if (_CanDrop)
{
// decal layer because must drawn after Items/Brick in DXTC
rVR.draw11RotFlipBitmap (_RenderLayer+1, _XReal, _YReal, 0, false, _DispSelSlotId, pIM->getGlobalColorForContent());
rVR.draw11RotFlipBitmap (_RenderLayer+1, _XReal, _YReal, 0, false, _DispSelSlotId, CWidgetManager::getInstance()->getGlobalColorForContent());
}
if (_RegenTickRange.EndTick != _RegenTickRange.StartTick)
@ -2099,13 +2099,13 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
// the sheet color is modulated by GlobalAlpha, but not by global RGB
CRGBA curSheetColor= _SheetColor;
curSheetColor.A= ( (pIM->getGlobalColorForContent().A+1) * _SheetColor.A )>>8;
curSheetColor.A= ( (CWidgetManager::getInstance()->getGlobalColorForContent().A+1) * _SheetColor.A )>>8;
// The "disp with no sheet" case is a bit different
CRGBA curNoSheetColor;
if(_InterfaceColor)
curNoSheetColor= pIM->getGlobalColorForContent();
curNoSheetColor= CWidgetManager::getInstance()->getGlobalColorForContent();
else
curNoSheetColor= CRGBA(255,255,255, pIM->getGlobalColorForContent().A);
curNoSheetColor= CRGBA(255,255,255, CWidgetManager::getInstance()->getGlobalColorForContent().A);
// The gray color
CRGBA grayColor= pIM->getSystemOption(CInterfaceManager::OptionCtrlSheetGrayColor).getValColor();
@ -2117,12 +2117,12 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
{
// do not modulate color for redifyed color
numberColor= redifyColor;
numberColor.A= (uint8)(((uint32)redifyColor.A * (pIM->getGlobalColorForContent().A+1))>>8);
numberColor.A= (uint8)(((uint32)redifyColor.A * (CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
else if(_Grayed)
numberColor.modulateFromColor(grayColor, pIM->getGlobalColorForContent());
numberColor.modulateFromColor(grayColor, CWidgetManager::getInstance()->getGlobalColorForContent());
else
numberColor= pIM->getGlobalColorForContent();
numberColor= CWidgetManager::getInstance()->getGlobalColorForContent();
// Different draws according to Sheet Type.
switch (_ActualType)
@ -2534,7 +2534,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
CRGBA color = ssg->getColor();
if (ssg->isGlobalColorEnabled())
{
color.modulateFromColor(color, pIM->getGlobalColorForContent());
color.modulateFromColor(color, CWidgetManager::getInstance()->getGlobalColorForContent());
}
// decal layer because must drawn after Items/Brick in DXTC
rVR.draw11RotFlipBitmap (_RenderLayer+1, middleX - (tw >> 1), middleY - (th >> 1), 0, false, ssg->getTextureIndex(), color);

View file

@ -182,7 +182,7 @@ void CDBViewBar::draw ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
color.A = (uint8)(((sint32)color.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
color.A = (uint8)(((sint32)color.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
// compute the DeltaY: mean of dif.
sint32 deltaY= (_H-_HBar)/2;

View file

@ -163,7 +163,7 @@ void CDBViewBar3::draw ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA gColor = pIM->getGlobalColorForContent();
CRGBA gColor = CWidgetManager::getInstance()->getGlobalColorForContent();
if (_Mini)
{

View file

@ -22,6 +22,7 @@
#include "group_container.h"
#include "interface_manager.h"
#include "interface_options.h"
#include "interface_options_ryzom.h"
#include "nel/misc/xml_auto_ptr.h"
#include "action_handler.h"
#include "../time_client.h"
@ -469,7 +470,7 @@ COptionsContainerInsertion *CCtrlMover::getInsertionOptions()
static NLMISC::CRefPtr<COptionsContainerInsertion> insertionOptions;
if (insertionOptions) return insertionOptions;
CInterfaceManager *im = CInterfaceManager::getInstance();
insertionOptions = (COptionsContainerInsertion *) im->getOptions("container_insertion_opt");
insertionOptions = (COptionsContainerInsertion *) CWidgetManager::getInstance()->getOptions("container_insertion_opt");
return insertionOptions;
}
@ -1798,8 +1799,8 @@ void CGroupContainer::draw ()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
float speed = pIM->getAlphaRolloverSpeed();
CRGBA oldGlobalColor = pIM->getGlobalColor();
CRGBA oldGColForGrayed = pIM->getGlobalColor();
CRGBA oldGlobalColor = CWidgetManager::getInstance()->getGlobalColor();
CRGBA oldGColForGrayed = CWidgetManager::getInstance()->getGlobalColor();
if (_Blinking)
{
const uint blinkDuration = 300;
@ -1815,7 +1816,7 @@ void CGroupContainer::draw ()
if (abs(newCol.R - oldGlobalColor.R) < 64) newCol.R = 192;
if (abs(newCol.G - oldGlobalColor.G) < 64) newCol.G = 192;
if (abs(newCol.B - oldGlobalColor.B) < 64) newCol.B = 192;
pIM->setGlobalColor(newCol);
CWidgetManager::getInstance()->setGlobalColor(newCol);
_BlinkState = true;
}
else
@ -1850,7 +1851,7 @@ void CGroupContainer::draw ()
// Draw the container
CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col = pIM->getGlobalColor();
CRGBA col = CWidgetManager::getInstance()->getGlobalColor();
bool bGrayed = isGrayed();
if (bGrayed)
@ -1858,7 +1859,7 @@ void CGroupContainer::draw ()
col.R = col.R / 2;
col.G = col.G / 2;
col.B = col.B / 2;
pIM->setGlobalColor(col);
CWidgetManager::getInstance()->setGlobalColor(col);
oldGlobalColor.R = oldGlobalColor.R / 2;
oldGlobalColor.G = oldGlobalColor.G / 2;
oldGlobalColor.B = oldGlobalColor.B / 2;
@ -2078,7 +2079,7 @@ void CGroupContainer::draw ()
if (_Blinking)
{
pIM->setGlobalColor(oldGlobalColor);
CWidgetManager::getInstance()->setGlobalColor(oldGlobalColor);
}
// Top window : title is highlighted
@ -2117,7 +2118,7 @@ void CGroupContainer::draw ()
// Render inside window
uint8 oldAlphaContent = pIM->getContentAlpha();
uint8 oldAlphaContent = CWidgetManager::getInstance()->getContentAlpha();
uint8 oldAlphaContainer = _CurrentContainerAlpha;
if (parentGC)
{
@ -2131,7 +2132,7 @@ void CGroupContainer::draw ()
_CurrentContainerAlpha = _UseGlobalAlpha ? pIM->getGlobalContainerAlpha() : _ContainerAlpha;
}
// set content alpha multiplied by rollover alpha
pIM->setContentAlpha((uint8) (((uint16) _CurrentContentAlpha * (uint16) _ICurrentRolloverAlphaContent) >> 8));
CWidgetManager::getInstance()->setContentAlpha((uint8) (((uint16) _CurrentContentAlpha * (uint16) _ICurrentRolloverAlphaContent) >> 8));
// set content alpha multiplied by rollover alpha
_CurrentContainerAlpha = (uint8) (((uint16) _CurrentContainerAlpha * (uint16) _ICurrentRolloverAlphaContainer) >> 8);
@ -2189,7 +2190,7 @@ void CGroupContainer::draw ()
}
pIM->setContentAlpha(oldAlphaContent);
CWidgetManager::getInstance()->setContentAlpha(oldAlphaContent);
_CurrentContainerAlpha = oldAlphaContainer;
@ -2252,7 +2253,7 @@ void CGroupContainer::draw ()
if (bGrayed)
{
pIM->setGlobalColor(oldGColForGrayed);
CWidgetManager::getInstance()->setGlobalColor(oldGColForGrayed);
}
@ -3084,7 +3085,7 @@ COptionsLayer *CGroupContainer::getContainerOptions(sint32 ls)
sLayerName = &sTmp;
}
COptionsLayer *pLayer = (COptionsLayer*)CInterfaceManager::getInstance()->getOptions(*sLayerName);
COptionsLayer *pLayer = (COptionsLayer*)CWidgetManager::getInstance()->getOptions(*sLayerName);
nlassert(pLayer != NULL);
return pLayer;
}
@ -3445,7 +3446,7 @@ COptionsContainerMove *CGroupContainer::getMoveOptions()
static NLMISC::CRefPtr<COptionsContainerMove> moveOptions;
if (moveOptions) return moveOptions;
CInterfaceManager *im = CInterfaceManager::getInstance();
moveOptions = (COptionsContainerMove *) im->getOptions("container_move_opt");
moveOptions = (COptionsContainerMove *) CWidgetManager::getInstance()->getOptions("container_move_opt");
return moveOptions;
}

View file

@ -249,7 +249,7 @@ void CGroupEditBox::draw ()
{
sint32 blankTextId= rVR.getBlankTextureId();
CRGBA col= _BackSelectColor;
col.A= pIM->getGlobalColorForContent().A;
col.A= CWidgetManager::getInstance()->getGlobalColorForContent().A;
sint32 minPos= min(_CursorPos, _SelectCursorPos) + (sint32)_Prompt.length();
sint32 maxPos= max(_CursorPos, _SelectCursorPos) + (sint32)_Prompt.length();
@ -1124,7 +1124,7 @@ void CGroupEditBox::setup()
_ViewTextDeltaX= 0;
// read options
CInterfaceOptions *pIO = CInterfaceManager::getInstance()->getOptions("text_selection");
CInterfaceOptions *pIO = CWidgetManager::getInstance()->getOptions("text_selection");
if (pIO != NULL)
{
_BackSelectColor= pIO->getValColor("back_select_color");

View file

@ -14,13 +14,11 @@
// 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 "stdpch.h"
#include "group_frame.h"
#include "interface_manager.h"
#include "widget_manager.h"
#include "interface_options.h"
#include "interface_element.h"
#include "nel/gui/view_renderer.h"
#include "nel/misc/xml_auto_ptr.h"
using namespace std;
@ -71,14 +69,13 @@ bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
// Get the borders texture
_DispTypeDefined= false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
CInterfaceOptions *pIO = NULL;
if (ptr)
pIO = pIM->getOptions(ptr);
pIO = CWidgetManager::getInstance()->getOptions(ptr);
// The first type in display type struct is the default display type
if (_DispTypes.size() == 0)
@ -159,13 +156,12 @@ void CGroupFrame::draw ()
{
if (_DisplayFrame)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
// get global color
CRGBA col;
if(getModulateGlobalColor())
col.modulateFromColor (_Color, pIM->getGlobalColor());
col.modulateFromColor( _Color, CWidgetManager::getInstance()->getGlobalColor() );
else
col= _Color;

View file

@ -643,12 +643,12 @@ void CGroupList::draw ()
CRGBA col = _OverColor;
if(getModulateGlobalColor())
{
col.modulateFromColor (_OverColor, pIM->getGlobalColorForContent());
col.modulateFromColor (_OverColor, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _OverColor;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
rVR.drawRotFlipBitmap (_RenderLayer, pVB->getXReal(), pVB->getYReal(),
pVB->getWReal(), pVB->getHReal(), 0, false, rVR.getBlankTextureId(),

View file

@ -1472,7 +1472,7 @@ void CGroupMap::draw()
makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH);
CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = *CViewRenderer::getInstance();
uint8 alpha = im->getGlobalColorForContent().A;
uint8 alpha = CWidgetManager::getInstance()->getGlobalColorForContent().A;
updateScale();
// No Op if screen minimized

View file

@ -75,7 +75,7 @@ void CViewTextMenu::setChecked(bool c)
{
if (_CheckBox)
{
CInterfaceOptions *pIO = CInterfaceManager::getInstance()->getOptions("menu_checkbox");
CInterfaceOptions *pIO = CWidgetManager::getInstance()->getOptions("menu_checkbox");
if (!pIO) return;
_CheckBox->setTexture(pIO->getValStr(c ? "checked_bitmap" : "unchecked_bitmap"));
}
@ -380,7 +380,7 @@ CViewBitmap *CGroupSubMenu::createCheckBox(bool checked)
pVB->setParentPos (_GroupList);
pVB->setParentPosRef (Hotspot_BR);
pVB->setPosRef (Hotspot_BL);
CInterfaceOptions *pIO = CInterfaceManager::getInstance()->getOptions("menu_checkbox");
CInterfaceOptions *pIO = CWidgetManager::getInstance()->getOptions("menu_checkbox");
if (pIO)
{
pVB->setTexture(pIO->getValStr(checked ? "checked_bitmap" : "unchecked_bitmap"));

View file

@ -17,9 +17,9 @@
#include "group_modal.h"
#include "interface_manager.h"
#include "interface_element.h"
#include "nel/misc/xml_auto_ptr.h"
#include "nel/gui/view_renderer.h"
using namespace std;

View file

@ -823,12 +823,12 @@ void CGroupParagraph::draw ()
CRGBA col = _OverColor;
if(getModulateGlobalColor())
{
col.modulateFromColor (_OverColor, pIM->getGlobalColorForContent());
col.modulateFromColor (_OverColor, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _OverColor;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
rVR.drawRotFlipBitmap (_RenderLayer, pVB->getXReal(), pVB->getYReal(),
pVB->getWReal(), pVB->getHReal(), 0, false, rVR.getBlankTextureId(),

View file

@ -247,7 +247,7 @@ void CGroupCell::draw ()
else
{
CRGBA finalColor;
finalColor.modulateFromColor (BgColor, pIM->getGlobalColor());
finalColor.modulateFromColor (BgColor, CWidgetManager::getInstance()->getGlobalColor());
// Get the parent table
if (getParent ())
@ -946,7 +946,7 @@ void CGroupTable::draw ()
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CRGBA finalColor;
finalColor.modulateFromColor (BgColor, pIM->getGlobalColor());
finalColor.modulateFromColor (BgColor, CWidgetManager::getInstance()->getGlobalColor());
finalColor.A = CurrentAlpha;
// Draw the top and bottom lines

View file

@ -660,12 +660,12 @@ void CGroupTree::draw()
CRGBA col = _OverColor;
if(getModulateGlobalColor())
{
col.modulateFromColor (_OverColor, pIM->getGlobalColorForContent());
col.modulateFromColor (_OverColor, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _OverColor;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
drawSelection( getHrcIconXEnd(_Lines[_OverLine].Depth + _Lines[_OverLine].getNumAdditionnalBitmap()), ((sint)_Lines.size()-_OverLine-1)*_BmpH,
@ -680,7 +680,7 @@ void CGroupTree::draw()
{
// simulate alpha blend of the selection bitmap
CRGBA sel= _SelectedColor;
sel.A= (uint8)((sel.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
sel.A= (uint8)((sel.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
col.blendFromuiRGBOnly(col, sel, sel.A);
}
@ -696,12 +696,12 @@ void CGroupTree::draw()
CRGBA col = _SelectedColor;
if(getModulateGlobalColor())
{
col.modulateFromColor (_SelectedColor, pIM->getGlobalColorForContent());
col.modulateFromColor (_SelectedColor, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _SelectedColor;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
drawSelection( getHrcIconXEnd(_Lines[_SelectedLine].Depth + _Lines[_SelectedLine].getNumAdditionnalBitmap()), ((sint)_Lines.size()-_SelectedLine-1)*_BmpH,

View file

@ -390,7 +390,7 @@ static DECLARE_INTERFACE_USER_FCT(getClientActionTypeColor)
// To Color
// Get the action_bar_color options
CInterfaceOptions *options= CInterfaceManager::getInstance()->getOptions("action_bar_color");
CInterfaceOptions *options= CWidgetManager::getInstance()->getOptions("action_bar_color");
if(options)
{
const CInterfaceOptionValue &optVal= options->getValue(CLIENT_ACTION_TYPE::toString(actType));

View file

@ -271,9 +271,6 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
_ScreenW = _ScreenH = 0;
_LastInGameScreenW = _LastInGameScreenH = 0;
_DescTextTarget = NULL;
_GlobalColor = CRGBA(255,255,255,255);
_GlobalColorForContent = _GlobalColor;
_ContentAlpha = 255;
_ContainerAlpha = 255;
_GlobalContentAlpha = 255;
_GlobalContainerAlpha = 255;
@ -284,10 +281,7 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
_ConfigLoaded = false;
_LogState = false;
_KeysLoaded = false;
_RProp = NULL;
_GProp = NULL;
_BProp = NULL;
_AProp = NULL;
CWidgetManager::getInstance()->resetColorProps();
_AlphaRolloverSpeedDB = NULL;
_NeutralColor = NULL;
_WarningColor = NULL;
@ -388,10 +382,6 @@ void CInterfaceManager::reset()
_NeutralColor = NULL;
_WarningColor = NULL;
_ErrorColor = NULL;
_RProp = NULL;
_GProp = NULL;
_BProp = NULL;
_AProp = NULL;
_AlphaRolloverSpeedDB = NULL;
}
@ -1197,10 +1187,7 @@ void CInterfaceManager::uninitInGame1 ()
_WarningColor = NULL;
_ErrorColor = NULL;
_AlphaRolloverSpeedDB = NULL;
_RProp = NULL;
_GProp = NULL;
_BProp = NULL;
_AProp = NULL;
CWidgetManager::getInstance()->resetColorProps();
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
CInterfaceManager::getInstance()->DebugTrackGroupsDump();
@ -1360,21 +1347,11 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera)
}
// ------------------------------------------------------------------------------------------------
CInterfaceOptions *CInterfaceManager::getOptions(const string &name)
{
map<string, NLMISC::CSmartPtr<CInterfaceOptions> >::iterator it = _OptionsMap.find(name);
if (it == _OptionsMap.end())
return NULL;
else
return it->second;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::setupOptions()
{
// After parsing options and templates node -> init system options.
CInterfaceOptions *opt= getOptions("system");
CInterfaceOptions *opt= CWidgetManager::getInstance()->getOptions("system");
if(opt)
{
// List here all Special options
@ -1832,14 +1809,18 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
}
// Update global color from database
_GlobalColor = CRGBA ( (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(),
CWidgetManager::getInstance()->setGlobalColor( CRGBA ( (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(),
(uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G")->getValue32(),
(uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B")->getValue32(),
(uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() );
_GlobalColorForContent.R = _GlobalColor.R;
_GlobalColorForContent.G = _GlobalColor.G;
_GlobalColorForContent.B = _GlobalColor.B;
_GlobalColorForContent.A = (uint8) (( (uint16) _GlobalColor.A * (uint16) _ContentAlpha) >> 8);
(uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() ) );
CRGBA c = CWidgetManager::getInstance()->getGlobalColorForContent();
CRGBA gc = CWidgetManager::getInstance()->getGlobalColor();
c.R = gc.R;
c.G = gc.G;
c.B = gc.B;
c.A = (uint8) (( (uint16) c.A * (uint16) CWidgetManager::getInstance()->getContentAlpha() ) >> 8);
CWidgetManager::getInstance()->setGlobalColorForContent( c );
// Update global alphaS from database
_GlobalContentAlpha = (uint8)NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32();
@ -2421,28 +2402,6 @@ uint CInterfaceManager::adjustTooltipPosition(CCtrlBase *newCtrl,
return clampCount;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::setGlobalColor (NLMISC::CRGBA col)
{
if (!_RProp)
{
_RProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R");
_GProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G");
_BProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
_AProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
}
_RProp ->setValue32 (col.R);
_GProp ->setValue32 (col.G);
_BProp ->setValue32 (col.B);
_AProp ->setValue32 (col.A);
_GlobalColor = col;
// set the global color for content (the same with modulated alpha)
_GlobalColorForContent = _GlobalColor;
_GlobalColorForContent.A = (uint8) (( (uint16) _GlobalColorForContent.A * (uint16) _ContentAlpha) >> 8);
}
// ------------------------------------------------------------------------------------------------
bool CInterfaceManager::isControlInWindow (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd)
{
@ -3670,20 +3629,14 @@ void CInterfaceManager::launchContextMenuInGame (const std::string &nameOfCM)
}
}
// ***************************************************************************
void CInterfaceManager::setContentAlpha(uint8 alpha)
{
_ContentAlpha = alpha;
// update alpha of global color
_GlobalColorForContent.A = alpha;/*(uint8) (( (uint16) _GlobalColor.A * (uint16) _ContentAlpha) >> 8);*/
}
// ***************************************************************************
void CInterfaceManager::setContainerAlpha(uint8 alpha)
{
_ContainerAlpha = alpha;
// update alpha of global color
_GlobalColor.A = alpha;/*(uint8) (( (uint16) _GlobalColor.A * (uint16) _ContainerAlpha) >> 8); */
CRGBA c = CWidgetManager::getInstance()->getGlobalColor();
c.A = alpha;/*(uint8) (( (uint16) _GlobalColor.A * (uint16) _ContainerAlpha) >> 8); */
CWidgetManager::getInstance()->setGlobalColor( c );
}

View file

@ -291,13 +291,9 @@ public:
void drawContextHelp ();
//void drawContextMenu ();
void setGlobalColor (NLMISC::CRGBA col);
NLMISC::CRGBA getGlobalColor() { return _GlobalColor; }
void setContentAlpha(uint8 alpha);
uint8 getContentAlpha() const { return _ContentAlpha; }
void setContainerAlpha(uint8 alpha);
uint8 getContainerAlpha() const { return _ContainerAlpha; }
NLMISC::CRGBA getGlobalColorForContent() { return _GlobalColorForContent; }
// these values are updated from the DB
uint8 getGlobalContentAlpha() const { return _GlobalContentAlpha; }
uint8 getGlobalContainerAlpha() const { return _GlobalContainerAlpha; }
@ -318,9 +314,6 @@ public:
/// \name Global Interface Options
// @{
/// Get options by name
CInterfaceOptions *getOptions (const std::string &optName);
// List of system options
enum TSystemOption
{
@ -696,9 +689,7 @@ private:
uint8 _LocalSyncActionCounterMask;
uint8 _ContentAlpha;
uint8 _ContainerAlpha;
NLMISC::CRGBA _GlobalColorForContent;
//
uint8 _GlobalContentAlpha;
uint8 _GlobalContainerAlpha;
@ -737,7 +728,6 @@ private:
std::vector<SIDStringWaiter*> _IDStringWaiters;
uint32 _ScreenW, _ScreenH; // Change res detection
NLMISC::CRGBA _GlobalColor;
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
// List of active Anims
@ -775,10 +765,6 @@ private:
NLMISC::CCDBNodeLeaf *_NeutralColor;
NLMISC::CCDBNodeLeaf *_WarningColor;
NLMISC::CCDBNodeLeaf *_ErrorColor;
NLMISC::CCDBNodeLeaf *_RProp;
NLMISC::CCDBNodeLeaf *_GProp;
NLMISC::CCDBNodeLeaf *_BProp;
NLMISC::CCDBNodeLeaf *_AProp;
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
// The next ViewText to draw for Over

View file

@ -16,28 +16,13 @@
// ----------------------------------------------------------------------------
#include "stdpch.h"
#include "interface_options.h"
#include "interface_manager.h"
#include "group_menu.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../net_manager.h"
#include "../sheet_manager.h"
#include "../entity_animation_manager.h"
#include "../client_sheets/animation_set_list_sheet.h"
#include "../client_sheets/emot_list_sheet.h"
#include "nel/3d/u_animation_set.h"
#include "nel/misc/algo.h"
#include "interface_options.h"
#include "interface_element.h"
// ----------------------------------------------------------------------------
using namespace std;
using namespace NL3D;
using namespace NLMISC;
extern CEntityAnimationManager *EAM;
// ***************************************************************************
const CInterfaceOptionValue CInterfaceOptionValue::NullValue;
@ -138,370 +123,3 @@ bool CInterfaceOptions::getValBool(const std::string &sParamName) const
return getValue(sParamName).getValBool();
}
// ----------------------------------------------------------------------------
// CInterfaceLayer
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
COptionsLayer::COptionsLayer()
{
TxId_TL = TxId_T = TxId_TR = TxId_L = TxId_R = TxId_Blank = TxId_BL = TxId_B = -2;
TxId_BR = TxId_BL_Open = TxId_B_Open = TxId_BR_Open = TxId_EL_Open = TxId_EM_Open = TxId_ER_Open =-2;
Tile_Blank = 0;
Tile_M_Header = Tile_M_Scrollbar = 0;
Tile_T = Tile_B = Tile_L = Tile_R = 0;
Tile_B_Open = Tile_EM_Open = Tile_M_Open = 0;
Scrollbar_Offset_X = 4;
Scrollbar_W = 8;
}
// ----------------------------------------------------------------------------
COptionsLayer::~COptionsLayer()
{
}
// ----------------------------------------------------------------------------
bool COptionsLayer::parse (xmlNodePtr cur)
{
if (!CInterfaceOptions::parse (cur))
return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
Tile_Blank = getValSInt32("tile_blank");
Tile_M_Header = getValSInt32("tile_m_header");
Tile_M_Scrollbar = getValSInt32("tile_m_scrollbar");
Tile_T = getValSInt32("tile_t");
Tile_B = getValSInt32("tile_b");
Tile_L = getValSInt32("tile_l");
Tile_R = getValSInt32("tile_r");
Tile_B_Open = getValSInt32("tile_b_open");
Tile_EM_Open = getValSInt32("tile_em_open");
Tile_M_Open = getValSInt32("tile_m_open");
Scrollbar_Offset_X = getValSInt32("scrollbar_offset_x");
Scrollbar_W = getValSInt32("scrollbar_size_w");
TxId_B_Scrollbar = rVR.getTextureIdFromName (getValStr("scrollbar_tx_b"));
rVR.getTextureSizeFromId(TxId_B_Scrollbar, W_B_Scrollbar, H_B_Scrollbar);
TxId_M_Scrollbar = rVR.getTextureIdFromName (getValStr("scrollbar_tx_m"));
rVR.getTextureSizeFromId(TxId_M_Scrollbar, W_M_Scrollbar, H_M_Scrollbar);
TxId_T_Scrollbar = rVR.getTextureIdFromName (getValStr("scrollbar_tx_t"));
rVR.getTextureSizeFromId(TxId_T_Scrollbar, W_T_Scrollbar, H_T_Scrollbar);
TxId_L_Header = rVR.getTextureIdFromName (getValStr("tx_l_header"));
rVR.getTextureSizeFromId(TxId_L_Header, W_L_Header, H_L_Header);
TxId_M_Header = rVR.getTextureIdFromName (getValStr("tx_m_header"));
rVR.getTextureSizeFromId(TxId_M_Header, W_M_Header, H_M_Header);
TxId_R_Header = rVR.getTextureIdFromName (getValStr("tx_r_header"));
rVR.getTextureSizeFromId(TxId_R_Header, W_R_Header, H_R_Header);
TxId_TL = rVR.getTextureIdFromName (getValStr("tx_tl"));
rVR.getTextureSizeFromId(TxId_TL, W_TL, H_TL);
TxId_T = rVR.getTextureIdFromName (getValStr("tx_t"));
rVR.getTextureSizeFromId(TxId_T, W_T, H_T);
TxId_TR = rVR.getTextureIdFromName (getValStr("tx_tr"));
rVR.getTextureSizeFromId(TxId_TR, W_TR, H_TR);
TxId_L = rVR.getTextureIdFromName (getValStr("tx_l"));
rVR.getTextureSizeFromId(TxId_L, W_L, H_L);
TxId_R = rVR.getTextureIdFromName (getValStr("tx_r"));
rVR.getTextureSizeFromId(TxId_R, W_R, H_R);
TxId_Blank = rVR.getTextureIdFromName (getValStr("tx_blank"));
rVR.getTextureSizeFromId(TxId_Blank, W_Blank, H_Blank);
TxId_BL = rVR.getTextureIdFromName (getValStr("tx_bl"));
rVR.getTextureSizeFromId(TxId_BL, W_BL, H_BL);
TxId_B = rVR.getTextureIdFromName (getValStr("tx_b"));
rVR.getTextureSizeFromId(TxId_B, W_B, H_B);
TxId_BR = rVR.getTextureIdFromName (getValStr("tx_br"));
rVR.getTextureSizeFromId(TxId_BR, W_BR, H_BR);
//
TxId_BL_Open = rVR.getTextureIdFromName (getValStr("tx_bl_open"));
rVR.getTextureSizeFromId(TxId_BL_Open, W_BL_Open, H_BL_Open);
TxId_B_Open = rVR.getTextureIdFromName (getValStr("tx_b_open"));
rVR.getTextureSizeFromId(TxId_B_Open, W_B_Open, H_B_Open);
TxId_BR_Open = rVR.getTextureIdFromName (getValStr("tx_br_open"));
rVR.getTextureSizeFromId(TxId_BR_Open, W_BR_Open, H_BR_Open);
TxId_EL_Open = rVR.getTextureIdFromName (getValStr("tx_el_open"));
rVR.getTextureSizeFromId(TxId_EL_Open, W_EL_Open, H_EL_Open);
TxId_EM_Open = rVR.getTextureIdFromName (getValStr("tx_em_open"));
rVR.getTextureSizeFromId(TxId_EM_Open, W_EM_Open, H_EM_Open);
TxId_ER_Open = rVR.getTextureIdFromName (getValStr("tx_er_open"));
rVR.getTextureSizeFromId(TxId_ER_Open, W_ER_Open, H_ER_Open);
TxId_M_Open = rVR.getTextureIdFromName (getValStr("tx_m_open"));
rVR.getTextureSizeFromId(TxId_M_Open, W_M_Open, H_M_Open);
TxId_E_Open = rVR.getTextureIdFromName (getValStr("tx_e_open"));
rVR.getTextureSizeFromId(TxId_E_Open, W_E_Open, H_E_Open);
//
TxId_TL_HighLight = rVR.getTextureIdFromName (getValStr("tx_tl_highlight"));
TxId_T_HighLight = rVR.getTextureIdFromName (getValStr("tx_t_highlight"));
TxId_TR_HighLight = rVR.getTextureIdFromName (getValStr("tx_tr_highlight"));
TxId_L_HighLight = rVR.getTextureIdFromName (getValStr("tx_l_highlight"));
TxId_R_HighLight = rVR.getTextureIdFromName (getValStr("tx_r_highlight"));
TxId_BL_HighLight = rVR.getTextureIdFromName (getValStr("tx_bl_highlight"));
TxId_B_HighLight = rVR.getTextureIdFromName (getValStr("tx_b_highlight"));
TxId_BR_HighLight = rVR.getTextureIdFromName (getValStr("tx_br_highlight"));
//
HeaderH = getValSInt32("header_h");
return true;
}
// ----------------------------------------------------------------------------
COptionsContainerInsertion::COptionsContainerInsertion()
{
TxId_R_Arrow = -2;
TxId_L_Arrow = -2;
TxId_T_Arrow = -2;
TxId_B_Arrow = -2;
TxId_InsertionBar = -2;
}
// ----------------------------------------------------------------------------
bool COptionsContainerInsertion::parse(xmlNodePtr cur)
{
if (!CInterfaceOptions::parse (cur))
return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
TxId_T_Arrow = rVR.getTextureIdFromName (getValStr("arrow_top"));
TxId_B_Arrow = rVR.getTextureIdFromName (getValStr("arrow_down"));
TxId_L_Arrow = rVR.getTextureIdFromName (getValStr("arrow_left"));
TxId_R_Arrow = rVR.getTextureIdFromName (getValStr("arrow_right"));
TxId_InsertionBar = rVR.getTextureIdFromName (getValStr("insertion_bar"));
return true;
}
// ***************************************************************************
COptionsContainerMove::COptionsContainerMove()
{
TrackW = -8;
TrackH = 22;
TrackY = -4;
TrackYWithTopResizer = -8;
TrackHWithTopResizer = 18;
ResizerSize = 8;
}
// ***************************************************************************
bool COptionsContainerMove::parse(xmlNodePtr cur)
{
if (!CInterfaceOptions::parse (cur))
return false;
fromString(getValStr("track_w"), TrackW);
fromString(getValStr("track_h"), TrackH);
fromString(getValStr("track_y"), TrackY);
fromString(getValStr("track_y_with_top_resizer"), TrackYWithTopResizer);
fromString(getValStr("track_h_with_top_resizer"), TrackHWithTopResizer);
fromString(getValStr("resizer_size"), ResizerSize);
return true;
}
// ***************************************************************************
COptionsList::COptionsList()
{
_NumParams= 0;
}
// ***************************************************************************
bool COptionsList::parse (xmlNodePtr cur)
{
cur = cur->children;
bool ok = true;
uint id= 0;
while (cur)
{
if ( !stricmp((char*)cur->name,"param") )
{
CXMLAutoPtr ptr, val;
val = xmlGetProp (cur, (xmlChar*)"value");
if (!val)
{
nlinfo("param with no name or no value");
ok = false;
}
else
{
string value = (string((const char*)val));
_ParamValue[toString(id)].init(value);
id++;
}
}
cur = cur->next;
}
_NumParams= id;
return ok;
}
// ***************************************************************************
const CInterfaceOptionValue &COptionsList::getValue(uint paramId) const
{
return CInterfaceOptions::getValue(toString(paramId));
}
// ***************************************************************************
bool CMissionIconList::parse(xmlNodePtr cur)
{
bool result = CInterfaceOptions::parse(cur);
if (!result) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = *CViewRenderer::getInstance();
for(std::map<std::string, CInterfaceOptionValue>::iterator it = _ParamValue.begin(); it != _ParamValue.end(); ++it)
{
int index;
if (fromString(it->first, index))
{
if (index > 255)
{
nlwarning("bad index for texture");
}
else
{
string sTmp = it->second.getValStr();
string sBack, sIcon;
if (sTmp.find('|') != string::npos)
{
sBack = sTmp.substr(0,sTmp.find('|'));
sIcon = sTmp.substr(sTmp.find('|')+1,sTmp.size());
}
else
{
sBack = sTmp;
}
sint32 texID = vr.getTextureIdFromName(sBack);
if (texID != -1)
{
IconBackTexID.resize(std::max((int) IconBackTexID.size(), index + 1), -1);
IconBackTexID[index] = texID;
}
texID = vr.getTextureIdFromName(sIcon);
if (texID != -1)
{
IconTexID.resize(std::max((int) IconTexID.size(), index + 1), -1);
IconTexID[index] = texID;
}
}
}
}
NLMISC::contReset(_ParamValue); // not needed anymore
return true;
}
// ***************************************************************************
COptionsAnimationSet::COptionsAnimationSet()
{
AnimationSet= NULL;
}
// ***************************************************************************
COptionsAnimationSet::~COptionsAnimationSet()
{
if(AnimationSet)
{
/* Important Note: this CInterfaceOptions is released BEFORE any CCharacter3d is released himself
BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList
(see deleteAnimationSet() doc)
*/
CViewRenderer::getInstance()->getDriver()->deleteAnimationSet(AnimationSet);
AnimationSet= NULL;
}
}
// ***************************************************************************
bool COptionsAnimationSet::parse (xmlNodePtr cur)
{
bool result = CInterfaceOptions::parse(cur);
if (!result) return false;
nlassert( CViewRenderer::getInstance()->getDriver() );
// create the animation set
AnimationSet= CViewRenderer::getInstance()->getDriver()->createAnimationSet();
nlassert(AnimationSet);
AnimMale.clear();
AnimFemale.clear();
// Add all male/female animations
string sTmp;
for(uint gender=0; gender<2; gender++)
{
string prefix= (gender==0)?"m":"f";
uint i = 0;
do
{
sTmp = getValStr(prefix+toString(i));
if (!sTmp.empty())
{
// get params
vector<string> params;
splitString(sTmp, "|", params);
// if error or first param empty, abort all
if(params.empty() || params[0].empty())
{
sTmp.clear();
}
else
{
string animName= params[0];
animName += ".anim";
uint animID = AnimationSet->addAnimation (animName.c_str(), animName.c_str());
if (animID == UAnimationSet::NotFound)
nlwarning ("Character3D : not found anim : %s", animName.c_str());
// try to add the Face animation for this one (not important if failed)
string faceAnimName= getFaceAnimName(animName);
AnimationSet->addAnimation (faceAnimName.c_str(), faceAnimName.c_str());
// append the new anim desc
CAnim newAnim;
newAnim.AnimId= animID;
newAnim.ApplyRaceScalePos= true;
// parse param
for(uint p=1;p<params.size();p++)
{
if(params[p]=="no_race_scale_pos")
newAnim.ApplyRaceScalePos= false;
}
// append to the correct anim list
if(gender==0)
AnimMale.push_back(newAnim);
else
AnimFemale.push_back(newAnim);
}
}
++i;
} while(!sTmp.empty());
}
// build
AnimationSet->build ();
return true;
}
// ***************************************************************************
string COptionsAnimationSet::getFaceAnimName(const std::string &animName)
{
string faceAnimName= animName;
string::size_type extPos= faceAnimName.find(".anim");
if(extPos!=string::npos)
faceAnimName= faceAnimName.substr(0, extPos);
faceAnimName+= "_face";
if(extPos!=string::npos)
faceAnimName+= ".anim";
return faceAnimName;
}

View file

@ -92,161 +92,6 @@ protected:
};
// ***************************************************************************
class COptionsLayer : public CInterfaceOptions
{
public:
COptionsLayer();
~COptionsLayer();
virtual bool parse (xmlNodePtr cur);
// Container optimizer
sint32 Tile_Blank;
sint32 Tile_M_Header, Tile_M_Scrollbar;
sint32 Tile_T, Tile_B, Tile_L, Tile_R;
sint32 Tile_B_Open, Tile_EM_Open, Tile_M_Open;
sint32 Scrollbar_Offset_X;
sint32 Scrollbar_W;
sint32 TxId_B_Scrollbar, W_B_Scrollbar, H_B_Scrollbar;
sint32 TxId_M_Scrollbar, W_M_Scrollbar, H_M_Scrollbar;
sint32 TxId_T_Scrollbar, W_T_Scrollbar, H_T_Scrollbar;
sint32 TxId_L_Header, W_L_Header, H_L_Header;
sint32 TxId_M_Header, W_M_Header, H_M_Header;
sint32 TxId_R_Header, W_R_Header, H_R_Header;
sint32 TxId_TL, W_TL, H_TL;
sint32 TxId_T, W_T, H_T;
sint32 TxId_TR, W_TR, H_TR;
sint32 TxId_L, W_L, H_L;
sint32 TxId_R, W_R, H_R;
sint32 TxId_Blank, W_Blank, H_Blank;
sint32 TxId_BL, W_BL, H_BL;
sint32 TxId_B, W_B, H_B;
sint32 TxId_BR, W_BR, H_BR;
sint32 TxId_BL_Open, W_BL_Open, H_BL_Open;
sint32 TxId_B_Open, W_B_Open, H_B_Open;
sint32 TxId_BR_Open, W_BR_Open, H_BR_Open;
sint32 TxId_EL_Open, W_EL_Open, H_EL_Open;
sint32 TxId_EM_Open, W_EM_Open, H_EM_Open;
sint32 TxId_ER_Open, W_ER_Open, H_ER_Open;
sint32 TxId_E_Open, W_E_Open, H_E_Open;
sint32 TxId_M_Open, W_M_Open, H_M_Open;
sint32 TxId_TL_HighLight;
sint32 TxId_T_HighLight;
sint32 TxId_TR_HighLight;
sint32 TxId_L_HighLight;
sint32 TxId_R_HighLight;
sint32 TxId_BL_HighLight;
sint32 TxId_B_HighLight;
sint32 TxId_BR_HighLight;
sint32 HeaderH;
};
// ***************************************************************************
class COptionsContainerInsertion : public CInterfaceOptions
{
public:
COptionsContainerInsertion();
virtual bool parse (xmlNodePtr cur);
sint32 TxId_R_Arrow;
sint32 TxId_L_Arrow;
sint32 TxId_T_Arrow;
sint32 TxId_B_Arrow;
sint32 TxId_InsertionBar;
};
// ***************************************************************************
class COptionsContainerMove : public CInterfaceOptions
{
public:
COptionsContainerMove();
virtual bool parse (xmlNodePtr cur);
sint32 TrackW;
sint32 TrackH;
sint32 TrackY;
sint32 TrackYWithTopResizer;
sint32 TrackHWithTopResizer;
sint32 ResizerSize;
};
// ***************************************************************************
/**
* read a list of <param> with no name. id auto incremented
*/
class COptionsList : public CInterfaceOptions
{
public:
COptionsList();
virtual bool parse (xmlNodePtr cur);
uint getNumParams() const {return _NumParams;}
// get a value by its index (from 0 to numParams)
const CInterfaceOptionValue &getValue(uint paramId) const;
private:
uint _NumParams;
};
// ***************************************************************************
class CMissionIconList : public CInterfaceOptions
{
public:
virtual bool parse (xmlNodePtr cur);
sint32 getBackTexID(uint index) const { return index >= IconBackTexID.size() ? -1 : IconBackTexID[index]; }
sint32 getTexID(uint index) const { return index >= IconTexID.size() ? -1 : IconTexID[index]; }
private:
std::vector<sint32> IconBackTexID;
std::vector<sint32> IconTexID;
};
// ***************************************************************************
/** Describe an animation Set container, used for multiple CCharacter3d for instance
*/
class COptionsAnimationSet : public CInterfaceOptions
{
public:
COptionsAnimationSet();
// see code for important release note
virtual ~COptionsAnimationSet();
virtual bool parse (xmlNodePtr cur);
// tool fct to get the face anim name from a name (append "_face" before .anim)
static std::string getFaceAnimName(const std::string &animName);
public:
NL3D::UAnimationSet *AnimationSet;
struct CAnim
{
// Indexes in this animation set
uint AnimId;
// true if must apply the race/gender scale to the position (not in rare case)
bool ApplyRaceScalePos;
CAnim()
{
AnimId= -1;
ApplyRaceScalePos= true;
}
};
// Male and female Animation
std::vector<CAnim> AnimMale;
std::vector<CAnim> AnimFemale;
};
#endif // NL_INTERFACE_LAYER_H
/* End of interface_layer.h */

View file

@ -0,0 +1,407 @@
// 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 "interface_options_ryzom.h"
#include "stdpch.h"
#include "interface_options.h"
#include "interface_manager.h"
#include "group_menu.h"
#include "nel/misc/xml_auto_ptr.h"
#include "../net_manager.h"
#include "../sheet_manager.h"
#include "../entity_animation_manager.h"
#include "../client_sheets/animation_set_list_sheet.h"
#include "../client_sheets/emot_list_sheet.h"
#include "nel/3d/u_animation_set.h"
#include "nel/misc/algo.h"
// ----------------------------------------------------------------------------
using namespace std;
using namespace NL3D;
using namespace NLMISC;
extern CEntityAnimationManager *EAM;
// ----------------------------------------------------------------------------
// CInterfaceLayer
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
COptionsLayer::COptionsLayer()
{
TxId_TL = TxId_T = TxId_TR = TxId_L = TxId_R = TxId_Blank = TxId_BL = TxId_B = -2;
TxId_BR = TxId_BL_Open = TxId_B_Open = TxId_BR_Open = TxId_EL_Open = TxId_EM_Open = TxId_ER_Open =-2;
Tile_Blank = 0;
Tile_M_Header = Tile_M_Scrollbar = 0;
Tile_T = Tile_B = Tile_L = Tile_R = 0;
Tile_B_Open = Tile_EM_Open = Tile_M_Open = 0;
Scrollbar_Offset_X = 4;
Scrollbar_W = 8;
}
// ----------------------------------------------------------------------------
COptionsLayer::~COptionsLayer()
{
}
// ----------------------------------------------------------------------------
bool COptionsLayer::parse (xmlNodePtr cur)
{
if (!CInterfaceOptions::parse (cur))
return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
Tile_Blank = getValSInt32("tile_blank");
Tile_M_Header = getValSInt32("tile_m_header");
Tile_M_Scrollbar = getValSInt32("tile_m_scrollbar");
Tile_T = getValSInt32("tile_t");
Tile_B = getValSInt32("tile_b");
Tile_L = getValSInt32("tile_l");
Tile_R = getValSInt32("tile_r");
Tile_B_Open = getValSInt32("tile_b_open");
Tile_EM_Open = getValSInt32("tile_em_open");
Tile_M_Open = getValSInt32("tile_m_open");
Scrollbar_Offset_X = getValSInt32("scrollbar_offset_x");
Scrollbar_W = getValSInt32("scrollbar_size_w");
TxId_B_Scrollbar = rVR.getTextureIdFromName (getValStr("scrollbar_tx_b"));
rVR.getTextureSizeFromId(TxId_B_Scrollbar, W_B_Scrollbar, H_B_Scrollbar);
TxId_M_Scrollbar = rVR.getTextureIdFromName (getValStr("scrollbar_tx_m"));
rVR.getTextureSizeFromId(TxId_M_Scrollbar, W_M_Scrollbar, H_M_Scrollbar);
TxId_T_Scrollbar = rVR.getTextureIdFromName (getValStr("scrollbar_tx_t"));
rVR.getTextureSizeFromId(TxId_T_Scrollbar, W_T_Scrollbar, H_T_Scrollbar);
TxId_L_Header = rVR.getTextureIdFromName (getValStr("tx_l_header"));
rVR.getTextureSizeFromId(TxId_L_Header, W_L_Header, H_L_Header);
TxId_M_Header = rVR.getTextureIdFromName (getValStr("tx_m_header"));
rVR.getTextureSizeFromId(TxId_M_Header, W_M_Header, H_M_Header);
TxId_R_Header = rVR.getTextureIdFromName (getValStr("tx_r_header"));
rVR.getTextureSizeFromId(TxId_R_Header, W_R_Header, H_R_Header);
TxId_TL = rVR.getTextureIdFromName (getValStr("tx_tl"));
rVR.getTextureSizeFromId(TxId_TL, W_TL, H_TL);
TxId_T = rVR.getTextureIdFromName (getValStr("tx_t"));
rVR.getTextureSizeFromId(TxId_T, W_T, H_T);
TxId_TR = rVR.getTextureIdFromName (getValStr("tx_tr"));
rVR.getTextureSizeFromId(TxId_TR, W_TR, H_TR);
TxId_L = rVR.getTextureIdFromName (getValStr("tx_l"));
rVR.getTextureSizeFromId(TxId_L, W_L, H_L);
TxId_R = rVR.getTextureIdFromName (getValStr("tx_r"));
rVR.getTextureSizeFromId(TxId_R, W_R, H_R);
TxId_Blank = rVR.getTextureIdFromName (getValStr("tx_blank"));
rVR.getTextureSizeFromId(TxId_Blank, W_Blank, H_Blank);
TxId_BL = rVR.getTextureIdFromName (getValStr("tx_bl"));
rVR.getTextureSizeFromId(TxId_BL, W_BL, H_BL);
TxId_B = rVR.getTextureIdFromName (getValStr("tx_b"));
rVR.getTextureSizeFromId(TxId_B, W_B, H_B);
TxId_BR = rVR.getTextureIdFromName (getValStr("tx_br"));
rVR.getTextureSizeFromId(TxId_BR, W_BR, H_BR);
//
TxId_BL_Open = rVR.getTextureIdFromName (getValStr("tx_bl_open"));
rVR.getTextureSizeFromId(TxId_BL_Open, W_BL_Open, H_BL_Open);
TxId_B_Open = rVR.getTextureIdFromName (getValStr("tx_b_open"));
rVR.getTextureSizeFromId(TxId_B_Open, W_B_Open, H_B_Open);
TxId_BR_Open = rVR.getTextureIdFromName (getValStr("tx_br_open"));
rVR.getTextureSizeFromId(TxId_BR_Open, W_BR_Open, H_BR_Open);
TxId_EL_Open = rVR.getTextureIdFromName (getValStr("tx_el_open"));
rVR.getTextureSizeFromId(TxId_EL_Open, W_EL_Open, H_EL_Open);
TxId_EM_Open = rVR.getTextureIdFromName (getValStr("tx_em_open"));
rVR.getTextureSizeFromId(TxId_EM_Open, W_EM_Open, H_EM_Open);
TxId_ER_Open = rVR.getTextureIdFromName (getValStr("tx_er_open"));
rVR.getTextureSizeFromId(TxId_ER_Open, W_ER_Open, H_ER_Open);
TxId_M_Open = rVR.getTextureIdFromName (getValStr("tx_m_open"));
rVR.getTextureSizeFromId(TxId_M_Open, W_M_Open, H_M_Open);
TxId_E_Open = rVR.getTextureIdFromName (getValStr("tx_e_open"));
rVR.getTextureSizeFromId(TxId_E_Open, W_E_Open, H_E_Open);
//
TxId_TL_HighLight = rVR.getTextureIdFromName (getValStr("tx_tl_highlight"));
TxId_T_HighLight = rVR.getTextureIdFromName (getValStr("tx_t_highlight"));
TxId_TR_HighLight = rVR.getTextureIdFromName (getValStr("tx_tr_highlight"));
TxId_L_HighLight = rVR.getTextureIdFromName (getValStr("tx_l_highlight"));
TxId_R_HighLight = rVR.getTextureIdFromName (getValStr("tx_r_highlight"));
TxId_BL_HighLight = rVR.getTextureIdFromName (getValStr("tx_bl_highlight"));
TxId_B_HighLight = rVR.getTextureIdFromName (getValStr("tx_b_highlight"));
TxId_BR_HighLight = rVR.getTextureIdFromName (getValStr("tx_br_highlight"));
//
HeaderH = getValSInt32("header_h");
return true;
}
// ----------------------------------------------------------------------------
COptionsContainerInsertion::COptionsContainerInsertion()
{
TxId_R_Arrow = -2;
TxId_L_Arrow = -2;
TxId_T_Arrow = -2;
TxId_B_Arrow = -2;
TxId_InsertionBar = -2;
}
// ----------------------------------------------------------------------------
bool COptionsContainerInsertion::parse(xmlNodePtr cur)
{
if (!CInterfaceOptions::parse (cur))
return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
TxId_T_Arrow = rVR.getTextureIdFromName (getValStr("arrow_top"));
TxId_B_Arrow = rVR.getTextureIdFromName (getValStr("arrow_down"));
TxId_L_Arrow = rVR.getTextureIdFromName (getValStr("arrow_left"));
TxId_R_Arrow = rVR.getTextureIdFromName (getValStr("arrow_right"));
TxId_InsertionBar = rVR.getTextureIdFromName (getValStr("insertion_bar"));
return true;
}
// ***************************************************************************
COptionsContainerMove::COptionsContainerMove()
{
TrackW = -8;
TrackH = 22;
TrackY = -4;
TrackYWithTopResizer = -8;
TrackHWithTopResizer = 18;
ResizerSize = 8;
}
// ***************************************************************************
bool COptionsContainerMove::parse(xmlNodePtr cur)
{
if (!CInterfaceOptions::parse (cur))
return false;
fromString(getValStr("track_w"), TrackW);
fromString(getValStr("track_h"), TrackH);
fromString(getValStr("track_y"), TrackY);
fromString(getValStr("track_y_with_top_resizer"), TrackYWithTopResizer);
fromString(getValStr("track_h_with_top_resizer"), TrackHWithTopResizer);
fromString(getValStr("resizer_size"), ResizerSize);
return true;
}
// ***************************************************************************
COptionsList::COptionsList()
{
_NumParams= 0;
}
// ***************************************************************************
bool COptionsList::parse (xmlNodePtr cur)
{
cur = cur->children;
bool ok = true;
uint id= 0;
while (cur)
{
if ( !stricmp((char*)cur->name,"param") )
{
CXMLAutoPtr ptr, val;
val = xmlGetProp (cur, (xmlChar*)"value");
if (!val)
{
nlinfo("param with no name or no value");
ok = false;
}
else
{
string value = (string((const char*)val));
_ParamValue[toString(id)].init(value);
id++;
}
}
cur = cur->next;
}
_NumParams= id;
return ok;
}
// ***************************************************************************
const CInterfaceOptionValue &COptionsList::getValue(uint paramId) const
{
return CInterfaceOptions::getValue(toString(paramId));
}
// ***************************************************************************
bool CMissionIconList::parse(xmlNodePtr cur)
{
bool result = CInterfaceOptions::parse(cur);
if (!result) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = *CViewRenderer::getInstance();
for(std::map<std::string, CInterfaceOptionValue>::iterator it = _ParamValue.begin(); it != _ParamValue.end(); ++it)
{
int index;
if (fromString(it->first, index))
{
if (index > 255)
{
nlwarning("bad index for texture");
}
else
{
string sTmp = it->second.getValStr();
string sBack, sIcon;
if (sTmp.find('|') != string::npos)
{
sBack = sTmp.substr(0,sTmp.find('|'));
sIcon = sTmp.substr(sTmp.find('|')+1,sTmp.size());
}
else
{
sBack = sTmp;
}
sint32 texID = vr.getTextureIdFromName(sBack);
if (texID != -1)
{
IconBackTexID.resize(std::max((int) IconBackTexID.size(), index + 1), -1);
IconBackTexID[index] = texID;
}
texID = vr.getTextureIdFromName(sIcon);
if (texID != -1)
{
IconTexID.resize(std::max((int) IconTexID.size(), index + 1), -1);
IconTexID[index] = texID;
}
}
}
}
NLMISC::contReset(_ParamValue); // not needed anymore
return true;
}
// ***************************************************************************
COptionsAnimationSet::COptionsAnimationSet()
{
AnimationSet= NULL;
}
// ***************************************************************************
COptionsAnimationSet::~COptionsAnimationSet()
{
if(AnimationSet)
{
/* Important Note: this CInterfaceOptions is released BEFORE any CCharacter3d is released himself
BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList
(see deleteAnimationSet() doc)
*/
CViewRenderer::getInstance()->getDriver()->deleteAnimationSet(AnimationSet);
AnimationSet= NULL;
}
}
// ***************************************************************************
bool COptionsAnimationSet::parse (xmlNodePtr cur)
{
bool result = CInterfaceOptions::parse(cur);
if (!result) return false;
nlassert( CViewRenderer::getInstance()->getDriver() );
// create the animation set
AnimationSet= CViewRenderer::getInstance()->getDriver()->createAnimationSet();
nlassert(AnimationSet);
AnimMale.clear();
AnimFemale.clear();
// Add all male/female animations
string sTmp;
for(uint gender=0; gender<2; gender++)
{
string prefix= (gender==0)?"m":"f";
uint i = 0;
do
{
sTmp = getValStr(prefix+toString(i));
if (!sTmp.empty())
{
// get params
vector<string> params;
splitString(sTmp, "|", params);
// if error or first param empty, abort all
if(params.empty() || params[0].empty())
{
sTmp.clear();
}
else
{
string animName= params[0];
animName += ".anim";
uint animID = AnimationSet->addAnimation (animName.c_str(), animName.c_str());
if (animID == UAnimationSet::NotFound)
nlwarning ("Character3D : not found anim : %s", animName.c_str());
// try to add the Face animation for this one (not important if failed)
string faceAnimName= getFaceAnimName(animName);
AnimationSet->addAnimation (faceAnimName.c_str(), faceAnimName.c_str());
// append the new anim desc
CAnim newAnim;
newAnim.AnimId= animID;
newAnim.ApplyRaceScalePos= true;
// parse param
for(uint p=1;p<params.size();p++)
{
if(params[p]=="no_race_scale_pos")
newAnim.ApplyRaceScalePos= false;
}
// append to the correct anim list
if(gender==0)
AnimMale.push_back(newAnim);
else
AnimFemale.push_back(newAnim);
}
}
++i;
} while(!sTmp.empty());
}
// build
AnimationSet->build ();
return true;
}
// ***************************************************************************
string COptionsAnimationSet::getFaceAnimName(const std::string &animName)
{
string faceAnimName= animName;
string::size_type extPos= faceAnimName.find(".anim");
if(extPos!=string::npos)
faceAnimName= faceAnimName.substr(0, extPos);
faceAnimName+= "_face";
if(extPos!=string::npos)
faceAnimName+= ".anim";
return faceAnimName;
}

View file

@ -0,0 +1,178 @@
// 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 IF_OPTIONS_RZ
#define IP_OPTIONS_RZ
#include "interface_options.h"
// ***************************************************************************
class COptionsLayer : public CInterfaceOptions
{
public:
COptionsLayer();
~COptionsLayer();
virtual bool parse (xmlNodePtr cur);
// Container optimizer
sint32 Tile_Blank;
sint32 Tile_M_Header, Tile_M_Scrollbar;
sint32 Tile_T, Tile_B, Tile_L, Tile_R;
sint32 Tile_B_Open, Tile_EM_Open, Tile_M_Open;
sint32 Scrollbar_Offset_X;
sint32 Scrollbar_W;
sint32 TxId_B_Scrollbar, W_B_Scrollbar, H_B_Scrollbar;
sint32 TxId_M_Scrollbar, W_M_Scrollbar, H_M_Scrollbar;
sint32 TxId_T_Scrollbar, W_T_Scrollbar, H_T_Scrollbar;
sint32 TxId_L_Header, W_L_Header, H_L_Header;
sint32 TxId_M_Header, W_M_Header, H_M_Header;
sint32 TxId_R_Header, W_R_Header, H_R_Header;
sint32 TxId_TL, W_TL, H_TL;
sint32 TxId_T, W_T, H_T;
sint32 TxId_TR, W_TR, H_TR;
sint32 TxId_L, W_L, H_L;
sint32 TxId_R, W_R, H_R;
sint32 TxId_Blank, W_Blank, H_Blank;
sint32 TxId_BL, W_BL, H_BL;
sint32 TxId_B, W_B, H_B;
sint32 TxId_BR, W_BR, H_BR;
sint32 TxId_BL_Open, W_BL_Open, H_BL_Open;
sint32 TxId_B_Open, W_B_Open, H_B_Open;
sint32 TxId_BR_Open, W_BR_Open, H_BR_Open;
sint32 TxId_EL_Open, W_EL_Open, H_EL_Open;
sint32 TxId_EM_Open, W_EM_Open, H_EM_Open;
sint32 TxId_ER_Open, W_ER_Open, H_ER_Open;
sint32 TxId_E_Open, W_E_Open, H_E_Open;
sint32 TxId_M_Open, W_M_Open, H_M_Open;
sint32 TxId_TL_HighLight;
sint32 TxId_T_HighLight;
sint32 TxId_TR_HighLight;
sint32 TxId_L_HighLight;
sint32 TxId_R_HighLight;
sint32 TxId_BL_HighLight;
sint32 TxId_B_HighLight;
sint32 TxId_BR_HighLight;
sint32 HeaderH;
};
// ***************************************************************************
class COptionsContainerInsertion : public CInterfaceOptions
{
public:
COptionsContainerInsertion();
virtual bool parse (xmlNodePtr cur);
sint32 TxId_R_Arrow;
sint32 TxId_L_Arrow;
sint32 TxId_T_Arrow;
sint32 TxId_B_Arrow;
sint32 TxId_InsertionBar;
};
// ***************************************************************************
class COptionsContainerMove : public CInterfaceOptions
{
public:
COptionsContainerMove();
virtual bool parse (xmlNodePtr cur);
sint32 TrackW;
sint32 TrackH;
sint32 TrackY;
sint32 TrackYWithTopResizer;
sint32 TrackHWithTopResizer;
sint32 ResizerSize;
};
// ***************************************************************************
/**
* read a list of <param> with no name. id auto incremented
*/
class COptionsList : public CInterfaceOptions
{
public:
COptionsList();
virtual bool parse (xmlNodePtr cur);
uint getNumParams() const {return _NumParams;}
// get a value by its index (from 0 to numParams)
const CInterfaceOptionValue &getValue(uint paramId) const;
private:
uint _NumParams;
};
// ***************************************************************************
class CMissionIconList : public CInterfaceOptions
{
public:
virtual bool parse (xmlNodePtr cur);
sint32 getBackTexID(uint index) const { return index >= IconBackTexID.size() ? -1 : IconBackTexID[index]; }
sint32 getTexID(uint index) const { return index >= IconTexID.size() ? -1 : IconTexID[index]; }
private:
std::vector<sint32> IconBackTexID;
std::vector<sint32> IconTexID;
};
// ***************************************************************************
/** Describe an animation Set container, used for multiple CCharacter3d for instance
*/
class COptionsAnimationSet : public CInterfaceOptions
{
public:
COptionsAnimationSet();
// see code for important release note
virtual ~COptionsAnimationSet();
virtual bool parse (xmlNodePtr cur);
// tool fct to get the face anim name from a name (append "_face" before .anim)
static std::string getFaceAnimName(const std::string &animName);
public:
NL3D::UAnimationSet *AnimationSet;
struct CAnim
{
// Indexes in this animation set
uint AnimId;
// true if must apply the race/gender scale to the position (not in rare case)
bool ApplyRaceScalePos;
CAnim()
{
AnimId= -1;
ApplyRaceScalePos= true;
}
};
// Male and female Animation
std::vector<CAnim> AnimMale;
std::vector<CAnim> AnimFemale;
};
#endif

View file

@ -32,6 +32,7 @@
#include "interface_parser.h"
#include "interface_observer.h"
#include "interface_options.h"
#include "interface_options_ryzom.h"
#include "interface_anim.h"
#include "interface_3d_scene.h"
// View
@ -1353,6 +1354,8 @@ bool CInterfaceParser::parseOptions (xmlNodePtr cur, CInterfaceGroup * /* parent
options = new CInterfaceOptions;
}
CWidgetManager *wm = CWidgetManager::getInstance();
// get the name
ptr = (char*) xmlGetProp( cur, (xmlChar*)"name" );
if (!ptr)
@ -1368,17 +1371,17 @@ bool CInterfaceParser::parseOptions (xmlNodePtr cur, CInterfaceGroup * /* parent
if (ptr)
{
string optionsParentName = ptr;
std::map<std::string, NLMISC::CSmartPtr<CInterfaceOptions> >::iterator it= _OptionsMap.find(optionsParentName);
if(it!=_OptionsMap.end())
options->copyBasicMap(*it->second);
CInterfaceOptions *io = wm->getOptions( optionsParentName );
if( io != NULL )
options->copyBasicMap( *io );
}
// parse parameters
if (options->parse (cur))
{
// Remove old one
_OptionsMap.erase(optionsName);
_OptionsMap.insert(map<string,CInterfaceOptions*>::value_type(optionsName,options));
wm->removeOptions( optionsName );
wm->addOptions( optionsName, options );
}
else
{
@ -3549,12 +3552,6 @@ void CInterfaceParser::removeAllLinks()
_LinkMap.clear();
}
// ***************************************************************************
void CInterfaceParser::removeAllOptions()
{
_OptionsMap.clear(); // options are holded by smart pointers ..
}
// ***************************************************************************
void CInterfaceParser::removeAllProcedures()
{
@ -3599,7 +3596,7 @@ void CInterfaceParser::removeAll()
removeAllLinks();
//nlinfo ("%d seconds for removeAllLinks", (uint32)(ryzomGetLocalTime ()-initStart)/1000);
initStart = ryzomGetLocalTime ();
removeAllOptions();
CWidgetManager::getInstance()->removeAllOptions();
//nlinfo ("%d seconds for removeAllOptions", (uint32)(ryzomGetLocalTime ()-initStart)/1000);
initStart = ryzomGetLocalTime ();
removeAllProcedures();

View file

@ -218,7 +218,6 @@ public:
/// \name Clearing mgt
// @{
void removeAllLinks();
void removeAllOptions();
void removeAllProcedures();
void removeAllDefines();
void removeAllTemplates();
@ -248,9 +247,6 @@ protected:
* Data of initialized interface
*/
// Options description
std::map<std::string, NLMISC::CSmartPtr<CInterfaceOptions> > _OptionsMap;
/// Define Variable list
typedef std::map<std::string, std::string> TVarMap;
typedef TVarMap::iterator ItVarMap;

View file

@ -205,7 +205,7 @@ void CMacroCmdManager::initInGame()
// Get all custom icon bitmaps
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = *CViewRenderer::getInstance();
CInterfaceOptions *pIO = pIM->getOptions("macro_custom_icon");
CInterfaceOptions *pIO = CWidgetManager::getInstance()->getOptions("macro_custom_icon");
if (pIO != NULL)
{
string sTmp;

View file

@ -29,6 +29,8 @@
#include "../actions_client.h"
#include "ctrl_button.h"
#include "interface_options_ryzom.h"
using namespace std;
using namespace NLMISC;
@ -160,7 +162,7 @@ public:
const CActionsManager::TActionComboMap &acmap = pAM->getActionComboMap();
COptionsList *pOL = dynamic_cast<COptionsList*>(pIM->getOptions("gestion_windows_key_binding"));
COptionsList *pOL = dynamic_cast<COptionsList*>(CWidgetManager::getInstance()->getOptions("gestion_windows_key_binding"));
if (pOL == NULL) return;
for (uint i = 0; i < pOL->getNumParams(); ++i)

View file

@ -150,12 +150,12 @@ void CViewBitmap::draw ()
CRGBA col;
if(getModulateGlobalColor())
{
col.modulateFromColor (_Color, pIM->getGlobalColorForContent());
col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _Color;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
if (_InheritGCAlpha)

View file

@ -186,7 +186,7 @@ void CViewPointer::draw ()
CRGBA col;
if(getModulateGlobalColor())
col.modulateFromColor (_Color, pIM->getGlobalColor());
col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColor());
else
col= _Color;

View file

@ -168,12 +168,12 @@ void CViewPolygon::draw()
CRGBA col;
if(getModulateGlobalColor())
{
col.modulateFromColor (_Color, im->getGlobalColorForContent());
col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _Color;
col.A = (uint8)(((sint32)col.A*((sint32)im->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
vr.drawUnclippedTriangles(_RenderLayer, _RealTris, col);
}

View file

@ -63,12 +63,12 @@ void CViewQuad::draw()
CRGBA col;
if(getModulateGlobalColor())
{
col.modulateFromColor (_Color, pIM->getGlobalColorForContent());
col.modulateFromColor (_Color, CWidgetManager::getInstance()->getGlobalColorForContent());
}
else
{
col= _Color;
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}
/*if (_InheritGCAlpha)

View file

@ -153,9 +153,9 @@ void CViewRadar::draw ()
CRGBA col = entity->getColor();
if(getModulateGlobalColor())
col.modulateFromColor (col, pIM->getGlobalColorForContent());
col.modulateFromColor (col, CWidgetManager::getInstance()->getGlobalColorForContent());
else
col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
// Select the icon to display and draw it
uint spotId = CNPCIconCache::getInstance().getNPCIcon(entity).getSpotId();

View file

@ -442,7 +442,7 @@ void CViewText::draw ()
CRGBA col, shcol;
if(getModulateGlobalColor())
{
CRGBA gcfc = pIM->getGlobalColorForContent();
CRGBA gcfc = CWidgetManager::getInstance()->getGlobalColorForContent();
col.modulateFromColor (_Color, gcfc);
shcol.modulateFromColor (_ShadowColor, gcfc);
}
@ -450,8 +450,8 @@ void CViewText::draw ()
{
col = _Color;
shcol = _ShadowColor;
col.A = (uint8)(((sint)col.A*((sint)pIM->getGlobalColorForContent().A+1))>>8);
shcol.A = (uint8)(((sint)shcol.A*((sint)pIM->getGlobalColorForContent().A+1))>>8);
col.A = (uint8)(((sint)col.A*((sint)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
shcol.A = (uint8)(((sint)shcol.A*((sint)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
}

View file

@ -16,13 +16,16 @@
#include "widget_manager.h"
#include "interface_group.h"
#include "group_container.h"
#include "group_modal.h"
#include "group_container.h"
#include "nel/gui/db_manager.h"
#include "nel/gui/view_renderer.h"
#include "view_pointer_base.h"
#include "group_editbox_base.h"
#include "ctrl_draggable.h"
#include "interface_options.h"
CWidgetManager* CWidgetManager::instance = NULL;
std::string CWidgetManager::_CtrlLaunchingModalId= "ctrl_launch_modal";
@ -948,6 +951,8 @@ void CWidgetManager::reset()
_OldCaptureKeyboard = NULL;
setCapturePointerLeft(NULL);
setCapturePointerRight(NULL);
resetColorProps();
}
@ -1310,11 +1315,79 @@ void CWidgetManager::unMakeWindow(CInterfaceGroup *group, bool noWarning)
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::setGlobalColor (NLMISC::CRGBA col)
{
if (!_RProp)
{
_RProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R");
_GProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G");
_BProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
_AProp = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
}
_RProp ->setValue32 (col.R);
_GProp ->setValue32 (col.G);
_BProp ->setValue32 (col.B);
_AProp ->setValue32 (col.A);
_GlobalColor = col;
// set the global color for content (the same with modulated alpha)
_GlobalColorForContent = _GlobalColor;
_GlobalColorForContent.A = (uint8) (( (uint16) _GlobalColorForContent.A * (uint16) _ContentAlpha) >> 8);
}
// ***************************************************************************
void CWidgetManager::setContentAlpha(uint8 alpha)
{
_ContentAlpha = alpha;
// update alpha of global color
_GlobalColorForContent.A = alpha;/*(uint8) (( (uint16) _GlobalColor.A * (uint16) _ContentAlpha) >> 8);*/
}
void CWidgetManager::resetColorProps()
{
_RProp = NULL;
_GProp = NULL;
_BProp = NULL;
_AProp = NULL;
}
// ------------------------------------------------------------------------------------------------
CInterfaceOptions* CWidgetManager::getOptions( const std::string &name )
{
std::map< std::string, NLMISC::CSmartPtr< CInterfaceOptions > >::iterator it = _OptionsMap.find( name );
if( it == _OptionsMap.end() )
return NULL;
else
return it->second;
}
void CWidgetManager::addOptions( std::string name, CInterfaceOptions *options )
{
_OptionsMap.insert( std::map< std::string, CInterfaceOptions* >::value_type( name, options ) );
}
void CWidgetManager::removeOptions( std::string name )
{
_OptionsMap.erase( name );
}
void CWidgetManager::removeAllOptions()
{
_OptionsMap.clear();
}
CWidgetManager::CWidgetManager()
{
_Pointer = NULL;
curContextHelp = NULL;
resetColorProps();
_GlobalColor = NLMISC::CRGBA(255,255,255,255);
_GlobalColorForContent = _GlobalColor;
_ContentAlpha = 255;
}
CWidgetManager::~CWidgetManager()

View file

@ -28,6 +28,12 @@ class CCtrlBase;
class CViewBase;
class CInterfaceGroup;
class CViewPointerBase;
class CInterfaceOptions;
namespace NLMISC
{
class CCDBNodeLeaf;
}
class IParser
{
@ -267,6 +273,22 @@ public:
// Remove a group from the windows list of its master group
void unMakeWindow( CInterfaceGroup *group, bool noWarning = false );
void setGlobalColor( NLMISC::CRGBA col );
NLMISC::CRGBA getGlobalColor() const{ return _GlobalColor; }
void setContentAlpha( uint8 alpha );
uint8 getContentAlpha() const{ return _ContentAlpha; }
NLMISC::CRGBA getGlobalColorForContent() const { return _GlobalColorForContent; }
void setGlobalColorForContent( NLMISC::CRGBA col ){ _GlobalColorForContent = col; }
void resetColorProps();
/// Get options by name
CInterfaceOptions* getOptions( const std::string &optName );
void addOptions( std::string name, CInterfaceOptions *options );
void removeOptions( std::string name );
void removeAllOptions();
static IParser *parser;
private:
@ -280,6 +302,9 @@ private:
NLMISC::CRefPtr< CCtrlBase > curContextHelp;
CViewPointerBase *_Pointer;
// Options description
std::map< std::string, NLMISC::CSmartPtr< CInterfaceOptions > > _OptionsMap;
NLMISC::CRefPtr< CInterfaceGroup > _WindowUnder;
// Capture
@ -296,6 +321,15 @@ private:
// view that should be notified from clock msg
std::vector<CCtrlBase*> _ClockMsgTargets;
NLMISC::CRGBA _GlobalColor;
NLMISC::CRGBA _GlobalColorForContent;
uint8 _ContentAlpha;
NLMISC::CCDBNodeLeaf *_RProp;
NLMISC::CCDBNodeLeaf *_GProp;
NLMISC::CCDBNodeLeaf *_BProp;
NLMISC::CCDBNodeLeaf *_AProp;
};
#endif