annotate C++/api/html/navtree.js @ 610:01986636257a

Second check-in of Alex Brandmeyer's C++ implementation of CARFAC. Addressed style issues and completed implementation of remaining functions. Still needs proper testing of the output stages against the MATLAB version, and runtime functions need improvements in efficiency.
author alexbrandmeyer
date Thu, 16 May 2013 17:33:23 +0000
parents 97976133eb4d
children
rev   line source
flatmax@592 1 var NAVTREE =
flatmax@592 2 [
flatmax@592 3 [ "CARFAC C++", "index.html", [
flatmax@592 4 [ "CARFAC C++", "index.html", null ],
flatmax@592 5 [ "Classes", null, [
flatmax@592 6 [ "Class List", "annotated.html", "annotated" ],
flatmax@592 7 [ "Class Index", "classes.html", null ],
flatmax@592 8 [ "Class Hierarchy", "hierarchy.html", "hierarchy" ],
flatmax@592 9 [ "Class Members", "functions.html", [
flatmax@592 10 [ "All", "functions.html", null ],
flatmax@592 11 [ "Functions", "functions_func.html", null ],
flatmax@594 12 [ "Variables", "functions_vars.html", null ],
flatmax@594 13 [ "Related Functions", "functions_rela.html", null ]
flatmax@592 14 ] ]
flatmax@592 15 ] ],
flatmax@592 16 [ "Files", null, [
flatmax@592 17 [ "File List", "files.html", "files" ],
flatmax@592 18 [ "File Members", "globals.html", [
flatmax@592 19 [ "All", "globals.html", null ],
flatmax@592 20 [ "Typedefs", "globals_type.html", null ],
flatmax@592 21 [ "Defines", "globals_defs.html", null ]
flatmax@592 22 ] ]
flatmax@592 23 ] ]
flatmax@592 24 ] ]
flatmax@592 25 ];
flatmax@592 26
flatmax@592 27 function getData(varName)
flatmax@592 28 {
flatmax@592 29 var i = varName.lastIndexOf('/');
flatmax@592 30 var n = i>=0 ? varName.substring(i+1) : varName;
flatmax@592 31 return eval(n);
flatmax@592 32 }
flatmax@592 33
flatmax@592 34 function stripPath(uri)
flatmax@592 35 {
flatmax@592 36 return uri.substring(uri.lastIndexOf('/')+1);
flatmax@592 37 }
flatmax@592 38
flatmax@592 39 function getScript(scriptName,func,show)
flatmax@592 40 {
flatmax@592 41 var head = document.getElementsByTagName("head")[0];
flatmax@592 42 var script = document.createElement('script');
flatmax@592 43 script.id = scriptName;
flatmax@592 44 script.type = 'text/javascript';
flatmax@592 45 script.onload = func;
flatmax@592 46 script.src = scriptName+'.js';
flatmax@592 47 script.onreadystatechange = function() {
flatmax@592 48 if (script.readyState == 'complete') { func(); if (show) showRoot(); }
flatmax@592 49 };
flatmax@592 50 head.appendChild(script);
flatmax@592 51 }
flatmax@592 52
flatmax@592 53 function createIndent(o,domNode,node,level)
flatmax@592 54 {
flatmax@592 55 if (node.parentNode && node.parentNode.parentNode)
flatmax@592 56 {
flatmax@592 57 createIndent(o,domNode,node.parentNode,level+1);
flatmax@592 58 }
flatmax@592 59 var imgNode = document.createElement("img");
flatmax@592 60 imgNode.width = 16;
flatmax@592 61 imgNode.height = 22;
flatmax@592 62 if (level==0 && node.childrenData)
flatmax@592 63 {
flatmax@592 64 node.plus_img = imgNode;
flatmax@592 65 node.expandToggle = document.createElement("a");
flatmax@592 66 node.expandToggle.href = "javascript:void(0)";
flatmax@592 67 node.expandToggle.onclick = function()
flatmax@592 68 {
flatmax@592 69 if (node.expanded)
flatmax@592 70 {
flatmax@592 71 $(node.getChildrenUL()).slideUp("fast");
flatmax@592 72 if (node.isLast)
flatmax@592 73 {
flatmax@592 74 node.plus_img.src = node.relpath+"ftv2plastnode.png";
flatmax@592 75 }
flatmax@592 76 else
flatmax@592 77 {
flatmax@592 78 node.plus_img.src = node.relpath+"ftv2pnode.png";
flatmax@592 79 }
flatmax@592 80 node.expanded = false;
flatmax@592 81 }
flatmax@592 82 else
flatmax@592 83 {
flatmax@592 84 expandNode(o, node, false, false);
flatmax@592 85 }
flatmax@592 86 }
flatmax@592 87 node.expandToggle.appendChild(imgNode);
flatmax@592 88 domNode.appendChild(node.expandToggle);
flatmax@592 89 }
flatmax@592 90 else
flatmax@592 91 {
flatmax@592 92 domNode.appendChild(imgNode);
flatmax@592 93 }
flatmax@592 94 if (level==0)
flatmax@592 95 {
flatmax@592 96 if (node.isLast)
flatmax@592 97 {
flatmax@592 98 if (node.childrenData)
flatmax@592 99 {
flatmax@592 100 imgNode.src = node.relpath+"ftv2plastnode.png";
flatmax@592 101 }
flatmax@592 102 else
flatmax@592 103 {
flatmax@592 104 imgNode.src = node.relpath+"ftv2lastnode.png";
flatmax@592 105 domNode.appendChild(imgNode);
flatmax@592 106 }
flatmax@592 107 }
flatmax@592 108 else
flatmax@592 109 {
flatmax@592 110 if (node.childrenData)
flatmax@592 111 {
flatmax@592 112 imgNode.src = node.relpath+"ftv2pnode.png";
flatmax@592 113 }
flatmax@592 114 else
flatmax@592 115 {
flatmax@592 116 imgNode.src = node.relpath+"ftv2node.png";
flatmax@592 117 domNode.appendChild(imgNode);
flatmax@592 118 }
flatmax@592 119 }
flatmax@592 120 }
flatmax@592 121 else
flatmax@592 122 {
flatmax@592 123 if (node.isLast)
flatmax@592 124 {
flatmax@592 125 imgNode.src = node.relpath+"ftv2blank.png";
flatmax@592 126 }
flatmax@592 127 else
flatmax@592 128 {
flatmax@592 129 imgNode.src = node.relpath+"ftv2vertline.png";
flatmax@592 130 }
flatmax@592 131 }
flatmax@592 132 imgNode.border = "0";
flatmax@592 133 }
flatmax@592 134
flatmax@592 135 function newNode(o, po, text, link, childrenData, lastNode)
flatmax@592 136 {
flatmax@592 137 var node = new Object();
flatmax@592 138 node.children = Array();
flatmax@592 139 node.childrenData = childrenData;
flatmax@592 140 node.depth = po.depth + 1;
flatmax@592 141 node.relpath = po.relpath;
flatmax@592 142 node.isLast = lastNode;
flatmax@592 143
flatmax@592 144 node.li = document.createElement("li");
flatmax@592 145 po.getChildrenUL().appendChild(node.li);
flatmax@592 146 node.parentNode = po;
flatmax@592 147
flatmax@592 148 node.itemDiv = document.createElement("div");
flatmax@592 149 node.itemDiv.className = "item";
flatmax@592 150
flatmax@592 151 node.labelSpan = document.createElement("span");
flatmax@592 152 node.labelSpan.className = "label";
flatmax@592 153
flatmax@592 154 createIndent(o,node.itemDiv,node,0);
flatmax@592 155 node.itemDiv.appendChild(node.labelSpan);
flatmax@592 156 node.li.appendChild(node.itemDiv);
flatmax@592 157
flatmax@592 158 var a = document.createElement("a");
flatmax@592 159 node.labelSpan.appendChild(a);
flatmax@592 160 node.label = document.createTextNode(text);
flatmax@592 161 node.expanded = false;
flatmax@592 162 a.appendChild(node.label);
flatmax@592 163 if (link)
flatmax@592 164 {
flatmax@592 165 a.className = stripPath(link.replace('#',':'));
flatmax@592 166 if (link.indexOf('#')!=-1)
flatmax@592 167 {
flatmax@592 168 var aname = '#'+link.split('#')[1];
flatmax@592 169 var srcPage = stripPath($(location).attr('pathname'));
flatmax@592 170 var targetPage = stripPath(link.split('#')[0]);
flatmax@592 171 a.href = srcPage!=targetPage ? node.relpath+link : '#';
flatmax@592 172 a.onclick = function(){
flatmax@592 173 $('.item').removeClass('selected');
flatmax@592 174 $('.item').removeAttr('id');
flatmax@592 175 $(a).parent().parent().addClass('selected');
flatmax@592 176 $(a).parent().parent().attr('id','selected');
flatmax@592 177 var anchor = $(aname);
flatmax@592 178 $("#doc-content").animate({
flatmax@592 179 scrollTop: anchor.position().top +
flatmax@592 180 $('#doc-content').scrollTop() -
flatmax@592 181 $('#doc-content').offset().top
flatmax@592 182 },500,function(){
flatmax@592 183 window.location.replace(aname);
flatmax@592 184 });
flatmax@592 185 };
flatmax@592 186 }
flatmax@592 187 else
flatmax@592 188 {
flatmax@592 189 a.href = node.relpath+link;
flatmax@592 190 }
flatmax@592 191 }
flatmax@592 192 else
flatmax@592 193 {
flatmax@592 194 if (childrenData != null)
flatmax@592 195 {
flatmax@592 196 a.className = "nolink";
flatmax@592 197 a.href = "javascript:void(0)";
flatmax@592 198 a.onclick = node.expandToggle.onclick;
flatmax@592 199 }
flatmax@592 200 }
flatmax@592 201
flatmax@592 202 node.childrenUL = null;
flatmax@592 203 node.getChildrenUL = function()
flatmax@592 204 {
flatmax@592 205 if (!node.childrenUL)
flatmax@592 206 {
flatmax@592 207 node.childrenUL = document.createElement("ul");
flatmax@592 208 node.childrenUL.className = "children_ul";
flatmax@592 209 node.childrenUL.style.display = "none";
flatmax@592 210 node.li.appendChild(node.childrenUL);
flatmax@592 211 }
flatmax@592 212 return node.childrenUL;
flatmax@592 213 };
flatmax@592 214
flatmax@592 215 return node;
flatmax@592 216 }
flatmax@592 217
flatmax@592 218 function showRoot()
flatmax@592 219 {
flatmax@592 220 var headerHeight = $("#top").height();
flatmax@592 221 var footerHeight = $("#nav-path").height();
flatmax@592 222 var windowHeight = $(window).height() - headerHeight - footerHeight;
flatmax@592 223 (function (){ // retry until we can scroll to the selected item
flatmax@592 224 try {
flatmax@592 225 navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
flatmax@592 226 } catch (err) {
flatmax@592 227 setTimeout(arguments.callee, 0);
flatmax@592 228 }
flatmax@592 229 })();
flatmax@592 230 }
flatmax@592 231
flatmax@592 232 function expandNode(o, node, imm, showRoot)
flatmax@592 233 {
flatmax@592 234 if (node.childrenData && !node.expanded)
flatmax@592 235 {
flatmax@592 236 if (typeof(node.childrenData)==='string')
flatmax@592 237 {
flatmax@592 238 var varName = node.childrenData;
flatmax@592 239 getScript(node.relpath+varName,function(){
flatmax@592 240 node.childrenData = getData(varName);
flatmax@592 241 expandNode(o, node, imm, showRoot);
flatmax@592 242 }, showRoot);
flatmax@592 243 }
flatmax@592 244 else
flatmax@592 245 {
flatmax@592 246 if (!node.childrenVisited)
flatmax@592 247 {
flatmax@592 248 getNode(o, node);
flatmax@592 249 }
flatmax@592 250 if (imm)
flatmax@592 251 {
flatmax@592 252 $(node.getChildrenUL()).show();
flatmax@592 253 }
flatmax@592 254 else
flatmax@592 255 {
flatmax@592 256 $(node.getChildrenUL()).slideDown("fast");
flatmax@592 257 }
flatmax@592 258 if (node.isLast)
flatmax@592 259 {
flatmax@592 260 node.plus_img.src = node.relpath+"ftv2mlastnode.png";
flatmax@592 261 }
flatmax@592 262 else
flatmax@592 263 {
flatmax@592 264 node.plus_img.src = node.relpath+"ftv2mnode.png";
flatmax@592 265 }
flatmax@592 266 node.expanded = true;
flatmax@592 267 }
flatmax@592 268 }
flatmax@592 269 }
flatmax@592 270
flatmax@592 271 function showNode(o, node, index)
flatmax@592 272 {
flatmax@592 273 if (node.childrenData && !node.expanded)
flatmax@592 274 {
flatmax@592 275 if (typeof(node.childrenData)==='string')
flatmax@592 276 {
flatmax@592 277 var varName = node.childrenData;
flatmax@592 278 getScript(node.relpath+varName,function(){
flatmax@592 279 node.childrenData = getData(varName);
flatmax@592 280 showNode(o,node,index);
flatmax@592 281 },true);
flatmax@592 282 }
flatmax@592 283 else
flatmax@592 284 {
flatmax@592 285 if (!node.childrenVisited)
flatmax@592 286 {
flatmax@592 287 getNode(o, node);
flatmax@592 288 }
flatmax@592 289 $(node.getChildrenUL()).show();
flatmax@592 290 if (node.isLast)
flatmax@592 291 {
flatmax@592 292 node.plus_img.src = node.relpath+"ftv2mlastnode.png";
flatmax@592 293 }
flatmax@592 294 else
flatmax@592 295 {
flatmax@592 296 node.plus_img.src = node.relpath+"ftv2mnode.png";
flatmax@592 297 }
flatmax@592 298 node.expanded = true;
flatmax@592 299 var n = node.children[o.breadcrumbs[index]];
flatmax@592 300 if (index+1<o.breadcrumbs.length)
flatmax@592 301 {
flatmax@592 302 showNode(o,n,index+1);
flatmax@592 303 }
flatmax@592 304 else
flatmax@592 305 {
flatmax@592 306 if (typeof(n.childrenData)==='string')
flatmax@592 307 {
flatmax@592 308 var varName = n.childrenData;
flatmax@592 309 getScript(n.relpath+varName,function(){
flatmax@592 310 n.childrenData = getData(varName);
flatmax@592 311 node.expanded=false;
flatmax@592 312 showNode(o,node,index); // retry with child node expanded
flatmax@592 313 },true);
flatmax@592 314 }
flatmax@592 315 else
flatmax@592 316 {
flatmax@592 317 if (o.toroot=="index.html" || n.childrenData)
flatmax@592 318 {
flatmax@592 319 expandNode(o, n, true, true);
flatmax@592 320 }
flatmax@592 321 var a;
flatmax@592 322 if ($(location).attr('hash'))
flatmax@592 323 {
flatmax@592 324 var link=stripPath($(location).attr('pathname'))+':'+
flatmax@592 325 $(location).attr('hash').substring(1);
flatmax@592 326 a=$('.item a[class*=\""'+link+'"\"]');
flatmax@592 327 }
flatmax@592 328 if (a && a.length)
flatmax@592 329 {
flatmax@592 330 a.parent().parent().addClass('selected');
flatmax@592 331 a.parent().parent().attr('id','selected');
flatmax@592 332 var anchor = $($(location).attr('hash'));
flatmax@592 333 var targetDiv = anchor.next();
flatmax@592 334 $(targetDiv).children('.memproto,.memdoc').
flatmax@592 335 effect("highlight", {}, 1500);
flatmax@592 336 }
flatmax@592 337 else
flatmax@592 338 {
flatmax@592 339 $(n.itemDiv).addClass('selected');
flatmax@592 340 $(n.itemDiv).attr('id','selected');
flatmax@592 341 }
flatmax@592 342 }
flatmax@592 343 }
flatmax@592 344 }
flatmax@592 345 }
flatmax@592 346 }
flatmax@592 347
flatmax@592 348 function getNode(o, po)
flatmax@592 349 {
flatmax@592 350 po.childrenVisited = true;
flatmax@592 351 var l = po.childrenData.length-1;
flatmax@592 352 for (var i in po.childrenData)
flatmax@592 353 {
flatmax@592 354 var nodeData = po.childrenData[i];
flatmax@592 355 po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
flatmax@592 356 i==l);
flatmax@592 357 }
flatmax@592 358 }
flatmax@592 359
flatmax@592 360 function initNavTree(toroot,relpath)
flatmax@592 361 {
flatmax@592 362 var o = new Object();
flatmax@592 363 o.toroot = toroot;
flatmax@592 364 o.node = new Object();
flatmax@592 365 o.node.li = document.getElementById("nav-tree-contents");
flatmax@592 366 o.node.childrenData = NAVTREE;
flatmax@592 367 o.node.children = new Array();
flatmax@592 368 o.node.childrenUL = document.createElement("ul");
flatmax@592 369 o.node.getChildrenUL = function() { return o.node.childrenUL; };
flatmax@592 370 o.node.li.appendChild(o.node.childrenUL);
flatmax@592 371 o.node.depth = 0;
flatmax@592 372 o.node.relpath = relpath;
flatmax@592 373 o.node.expanded = false;
flatmax@592 374 o.node.isLast = true;
flatmax@592 375 o.node.plus_img = document.createElement("img");
flatmax@592 376 o.node.plus_img.src = relpath+"ftv2pnode.png";
flatmax@592 377 o.node.plus_img.width = 16;
flatmax@592 378 o.node.plus_img.height = 22;
flatmax@592 379
flatmax@592 380 getScript(relpath+"navtreeindex",function(){
flatmax@592 381 var navTreeIndex = eval('NAVTREEINDEX');
flatmax@592 382 if (navTreeIndex) {
flatmax@592 383 o.breadcrumbs = navTreeIndex[toroot];
flatmax@592 384 if (o.breadcrumbs==null) o.breadcrumbs = navTreeIndex["index.html"];
flatmax@592 385 o.breadcrumbs.unshift(0);
flatmax@592 386 showNode(o, o.node, 0);
flatmax@592 387 }
flatmax@592 388 },true);
flatmax@592 389
flatmax@592 390 $(window).bind('hashchange', function(){
flatmax@592 391 if (window.location.hash && window.location.hash.length>1){
flatmax@592 392 var anchor = $(window.location.hash);
flatmax@592 393 var targetDiv = anchor.next();
flatmax@592 394 $(targetDiv).children('.memproto,.memdoc').effect("highlight",{},1500);
flatmax@592 395 var docContent = $('#doc-content');
flatmax@592 396 if (docContent && anchor && anchor[0] && anchor[0].ownerDocument){
flatmax@592 397 docContent.scrollTop(anchor.position().top+docContent.scrollTop()-docContent.offset().top);
flatmax@592 398 }
flatmax@592 399 var a;
flatmax@592 400 if ($(location).attr('hash')){
flatmax@592 401 var link=stripPath($(location).attr('pathname'))+':'+
flatmax@592 402 $(location).attr('hash').substring(1);
flatmax@592 403 a=$('.item a[class*=\""'+link+'"\"]');
flatmax@592 404 }
flatmax@592 405 if (a && a.length){
flatmax@592 406 $('.item').removeClass('selected');
flatmax@592 407 $('.item').removeAttr('id');
flatmax@592 408 a.parent().parent().addClass('selected');
flatmax@592 409 a.parent().parent().attr('id','selected');
flatmax@592 410 var anchor = $($(location).attr('hash'));
flatmax@592 411 var targetDiv = anchor.next();
flatmax@592 412 showRoot();
flatmax@592 413 }
flatmax@592 414 } else {
flatmax@592 415 var docContent = $('#doc-content');
flatmax@592 416 if (docContent){ docContent.scrollTop(0); }
flatmax@592 417 }
flatmax@592 418 })
flatmax@592 419
flatmax@592 420 $(window).load(showRoot);
flatmax@592 421 }
flatmax@592 422