From ded1245db74ae4c97d174c5779f8572ee2f032fa Mon Sep 17 00:00:00 2001 From: Patrick Sapinski Date: Tue, 24 Aug 2010 03:04:20 -0400 Subject: added spellcheck + translation from Emerald Viewer. references to modularsystems.sl should be changed! --- linden/indra/llxml/llcontrol.cpp | 6 +++ linden/indra/llxml/llcontrol.h | 80 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) (limited to 'linden/indra/llxml') diff --git a/linden/indra/llxml/llcontrol.cpp b/linden/indra/llxml/llcontrol.cpp index 88eb2c3..1d1f024 100644 --- a/linden/indra/llxml/llcontrol.cpp +++ b/linden/indra/llxml/llcontrol.cpp @@ -1217,6 +1217,12 @@ void LLControlGroup::resetWarnings() } } +template <> void jc_rebind::rebind_callback(const LLSD &data, S32 *reciever){ *reciever = data.asInteger(); } +template <> void jc_rebind::rebind_callback(const LLSD &data, F32 *reciever){ *reciever = data.asReal(); } +template <> void jc_rebind::rebind_callback(const LLSD &data, U32 *reciever){ *reciever = data.asInteger(); } +template <> void jc_rebind::rebind_callback(const LLSD &data, std::string *reciever){ *reciever = data.asString(); } +template <> void jc_rebind::rebind_callback(const LLSD &data, LLColor4 *reciever){ *reciever = LLColor4(LLColor4U(data)); } + //============================================================================ #ifdef TEST_HARNESS diff --git a/linden/indra/llxml/llcontrol.h b/linden/indra/llxml/llcontrol.h index ba0a1c7..316de5c 100644 --- a/linden/indra/llxml/llcontrol.h +++ b/linden/indra/llxml/llcontrol.h @@ -242,4 +242,84 @@ public: void resetWarnings(); }; +/////////////////////// +namespace jc_you_suck +{ +class jc_rebind +{ + template static void rebind_callback(const LLSD &data, REC *reciever){ *reciever = data; } + + typedef boost::signal signal_t; + +public: + +//#define binder_debug + + template static RBTYPE* rebind_llcontrol(std::string name, LLControlGroup* controlgroup, bool init) + { + static std::map > references; + +#ifdef binder_debug + llinfos << "rebind_llcontrol" << llendl; +#endif + + RBTYPE* type = NULL; + if(controlgroup) + { + if(references.find(controlgroup) == references.end()) + { +#ifdef binder_debug + llinfos << "was no map for a group, adding" << llendl; +#endif + references[controlgroup] = std::map(); + } + + if(references[controlgroup].find(name) != references[controlgroup].end()) + { +#ifdef binder_debug + llinfos << "pulling type from map for " << name << llendl; +#endif + type = (RBTYPE*)(references[controlgroup][name]); + if(type == NULL)llerrs << "bad type stored" << llendl; + }else + { +#ifdef binder_debug + llinfos << "creating type in map for " << name << llendl; +#endif + type = new RBTYPE(); + references[controlgroup][name] = (void*)type; + LLControlVariable* control = controlgroup->getControl(name); + if(control) + { +#ifdef binder_debug + llinfos << "control there " << name << llendl; +#endif + signal_t* signal = control->getSignal(); + if(signal) + { +#ifdef binder_debug + llinfos << "signal there" << name << llendl; +#endif + signal->connect(boost::bind(&jc_rebind::rebind_callback, _1, type)); + if(init)jc_rebind::rebind_callback(control->getValue(),type); + }else llerrs << "no signal!" << llendl; + }else llerrs << "no control for " << name << "!" << llendl; + } + } + return type; + } +}; + +template <> void jc_rebind::rebind_callback(const LLSD &data, S32 *reciever); +template <> void jc_rebind::rebind_callback(const LLSD &data, F32 *reciever); +template <> void jc_rebind::rebind_callback(const LLSD &data, U32 *reciever); +template <> void jc_rebind::rebind_callback(const LLSD &data, std::string *reciever); +template <> void jc_rebind::rebind_callback(const LLSD &data, LLColor4 *reciever); + +} +using namespace jc_you_suck; +#define rebind_llcontrol jc_rebind::rebind_llcontrol + +/////////////////////// + #endif -- cgit v1.1