aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llxml/llcontrol.h
diff options
context:
space:
mode:
authorPatrick Sapinski2010-08-24 03:04:20 -0400
committerMcCabe Maxsted2010-08-30 17:04:59 -0700
commitded1245db74ae4c97d174c5779f8572ee2f032fa (patch)
treef42c33f233ed68e715a0ac4c74ddc043f43a68da /linden/indra/llxml/llcontrol.h
parentAdded debug setting UseLegacyChatLogsFolder for saving chat.txt and IM logs i... (diff)
downloadmeta-impy-ded1245db74ae4c97d174c5779f8572ee2f032fa.zip
meta-impy-ded1245db74ae4c97d174c5779f8572ee2f032fa.tar.gz
meta-impy-ded1245db74ae4c97d174c5779f8572ee2f032fa.tar.bz2
meta-impy-ded1245db74ae4c97d174c5779f8572ee2f032fa.tar.xz
added spellcheck + translation from Emerald Viewer. references to modularsystems.sl should be changed!
Diffstat (limited to '')
-rw-r--r--linden/indra/llxml/llcontrol.h80
1 files changed, 80 insertions, 0 deletions
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:
242 void resetWarnings(); 242 void resetWarnings();
243}; 243};
244 244
245///////////////////////
246namespace jc_you_suck
247{
248class jc_rebind
249{
250 template <typename REC> static void rebind_callback(const LLSD &data, REC *reciever){ *reciever = data; }
251
252 typedef boost::signal<void(const LLSD&)> signal_t;
253
254public:
255
256//#define binder_debug
257
258 template <typename RBTYPE> static RBTYPE* rebind_llcontrol(std::string name, LLControlGroup* controlgroup, bool init)
259 {
260 static std::map<LLControlGroup*, std::map<std::string, void*> > references;
261
262#ifdef binder_debug
263 llinfos << "rebind_llcontrol" << llendl;
264#endif
265
266 RBTYPE* type = NULL;
267 if(controlgroup)
268 {
269 if(references.find(controlgroup) == references.end())
270 {
271#ifdef binder_debug
272 llinfos << "was no map for a group, adding" << llendl;
273#endif
274 references[controlgroup] = std::map<std::string, void*>();
275 }
276
277 if(references[controlgroup].find(name) != references[controlgroup].end())
278 {
279#ifdef binder_debug
280 llinfos << "pulling type from map for " << name << llendl;
281#endif
282 type = (RBTYPE*)(references[controlgroup][name]);
283 if(type == NULL)llerrs << "bad type stored" << llendl;
284 }else
285 {
286#ifdef binder_debug
287 llinfos << "creating type in map for " << name << llendl;
288#endif
289 type = new RBTYPE();
290 references[controlgroup][name] = (void*)type;
291 LLControlVariable* control = controlgroup->getControl(name);
292 if(control)
293 {
294#ifdef binder_debug
295 llinfos << "control there " << name << llendl;
296#endif
297 signal_t* signal = control->getSignal();
298 if(signal)
299 {
300#ifdef binder_debug
301 llinfos << "signal there" << name << llendl;
302#endif
303 signal->connect(boost::bind(&jc_rebind::rebind_callback<RBTYPE>, _1, type));
304 if(init)jc_rebind::rebind_callback<RBTYPE>(control->getValue(),type);
305 }else llerrs << "no signal!" << llendl;
306 }else llerrs << "no control for " << name << "!" << llendl;
307 }
308 }
309 return type;
310 }
311};
312
313template <> void jc_rebind::rebind_callback<S32>(const LLSD &data, S32 *reciever);
314template <> void jc_rebind::rebind_callback<F32>(const LLSD &data, F32 *reciever);
315template <> void jc_rebind::rebind_callback<U32>(const LLSD &data, U32 *reciever);
316template <> void jc_rebind::rebind_callback<std::string>(const LLSD &data, std::string *reciever);
317template <> void jc_rebind::rebind_callback<LLColor4>(const LLSD &data, LLColor4 *reciever);
318
319}
320using namespace jc_you_suck;
321#define rebind_llcontrol jc_rebind::rebind_llcontrol
322
323///////////////////////
324
245#endif 325#endif