Exemple #1
0
static QCString pathToNode(FTVNode *leaf,FTVNode *n)
{
    QCString result;
    if (n->parent)
    {
        result+=pathToNode(leaf,n->parent);
    }
    result+=QCString().setNum(n->index);
    if (leaf!=n) result+=",";
    return result;
}
Exemple #2
0
void Actor::setActorPath(ActorData *actor, const Point &fromPoint, const Point &toPoint) {
	Point nextPoint;
	int8 direction;

	_pathList[0] = toPoint;
	nextPoint = toPoint;

	_pathListIndex = 0;
	while (!(nextPoint == fromPoint)) {
		direction = getPathCell(nextPoint);
		if ((direction < 0) || (direction >= 8)) {
			error("Actor::setActorPath error direction 0x%X", direction);
		}
		nextPoint.x -= pathDirectionLUT2[direction][0];
		nextPoint.y -= pathDirectionLUT2[direction][1];
		++_pathListIndex;
		if (_pathListIndex >= _pathList.size()) {
			_pathList.push_back(nextPoint);
		} else {
			_pathList[_pathListIndex] = nextPoint;
		}

#ifdef ACTOR_DEBUG
		addDebugPoint(nextPoint, 0x8a);
#endif
	}

	pathToNode();
	removeNodes();
	nodeToPath();
	removePathPoints();

	for (uint i = 0; i < _pathNodeList.size(); i++) {
		actor->addWalkStepPoint(_pathNodeList[i].point);
	}
}
Exemple #3
0
static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t,
                           const QList<FTVNode> &nl,int level,bool &first)
{
    static QCString htmlOutput = Config_getString("HTML_OUTPUT");
    QCString indentStr;
    indentStr.fill(' ',level*2);
    bool found=FALSE;
    QListIterator<FTVNode> nli(nl);
    FTVNode *n;
    for (nli.toFirst(); (n=nli.current()); ++nli)
    {
        // terminate previous entry
        if (!first) t << "," << endl;
        first=FALSE;

        // start entry
        if (!found)
        {
            t << "[" << endl;
        }
        found=TRUE;

        if (n->addToNavIndex) // add entry to the navigation index
        {
            if (n->def && n->def->definitionType()==Definition::TypeFile)
            {
                FileDef *fd = (FileDef*)n->def;
                bool doc,src;
                doc = fileVisibleInIndex(fd,src);
                if (doc)
                {
                    navIndex.append(new NavIndexEntry(node2URL(n,TRUE,FALSE),pathToNode(n,n)));
                }
                if (src)
                {
                    navIndex.append(new NavIndexEntry(node2URL(n,TRUE,TRUE),pathToNode(n,n)));
                }
            }
            else
            {
                navIndex.append(new NavIndexEntry(node2URL(n),pathToNode(n,n)));
            }
        }

        if (n->separateIndex) // store items in a separate file for dynamic loading
        {
            bool firstChild=TRUE;
            t << indentStr << "  [ ";
            generateJSLink(t,n);
            if (n->children.count()>0) // write children to separate file for dynamic loading
            {
                QCString fileId = n->file;
                if (n->anchor)
                {
                    fileId+="_"+n->anchor;
                }
                if (dupOfParent(n))
                {
                    fileId+="_dup";
                }
                QFile f(htmlOutput+"/"+fileId+".js");
                if (f.open(IO_WriteOnly))
                {
                    FTextStream tt(&f);
                    tt << "var " << convertFileId2Var(fileId) << " =" << endl;
                    generateJSTree(navIndex,tt,n->children,1,firstChild);
                    tt << endl << "];";
                }
                t << "\"" << fileId << "\" ]";
            }
            else // no children
            {
                t << "null ]";
            }
        }
        else // show items in this file
        {
            bool firstChild=TRUE;
            t << indentStr << "  [ ";
            generateJSLink(t,n);
            bool emptySection = !generateJSTree(navIndex,t,n->children,level+1,firstChild);
            if (emptySection)
                t << "null ]";
            else
                t << endl << indentStr << "  ] ]";
        }
    }
    return found;
}
static bool generateJSTree(SortedList<NavIndexEntry *> &navIndex, QTextStream &t, const QList<FTVNode *> &nl, int level, bool &omitComma)
{
   static QString htmlOutput   = Config::getString("html-output");   
   static QString mainPageName = Config::getFullName(Config::getString("main-page-name")); 
   static bool mainPageOmit    = Config::getBool("main-page-omit"); 

   QString indentStr;
   indentStr.fill(' ', level * 2);

   bool found = false;

   for (auto node : nl)  {
      // terminate previous entry

      if (! omitComma) {
         t << "," << endl;
      }
      omitComma = false;

      // start entry
      if (! found) {
         t << "[" << endl;
      }
      found = true;

      if (node->addToNavIndex) { 
         // add entry to the navigation index

         if (node->def && node->def->definitionType() == Definition::TypeFile) {            
            QSharedPointer<FileDef> fd = node->def.dynamicCast<FileDef>();
  
            if (! mainPageName.isEmpty() && fd->getFilePath() == mainPageName) {       
               // do not add this file to the navIndex, for \files

            } else {  
                                   
               if (docFileVisibleInIndex(fd)) {
                  navIndex.inSort(new NavIndexEntry(node2URL(node, true, false), pathToNode(node)));
               }
   
               if (srcFileVisibleInIndex(fd)) {
                  navIndex.inSort(new NavIndexEntry(node2URL(node, true, true), pathToNode(node)));
               }
            }

         } else { 
                
            if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
               // do not add this file to the navIndex 
             
            } else {
               navIndex.inSort(new NavIndexEntry(node2URL(node), pathToNode(node)));
            }
         }
      }

      if (node->separateIndex) { 
         // store some items in a separate file (annotated, modules, namespaces, files)
         bool firstChild   = true;
         bool showMainPage = true;

         if (node->def && node->def->definitionType() == Definition::TypeFile) {            
            QSharedPointer<FileDef> fd = node->def.dynamicCast<FileDef>();

            if (! mainPageName.isEmpty() && fd->getFilePath() == mainPageName) {   
               // do not add this file to the navIndex, for \files

               showMainPage = false;
               omitComma    = true;
            }

         } else { 
                
            if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
               // do not add this file to the navIndex 

               showMainPage = false;
               omitComma    = true;
            }
         }

         if (showMainPage) {         
            t << indentStr << "  [ ";
            generateJSLink(t, node);
   
            if (node->children.count() > 0) { 
               // write children to separate file for dynamic loading
               QString fileId = node->file;
   
               if (! node->anchor.isEmpty()) {
                  fileId += "_" + node->anchor;
               }
   
               if (dupOfParent(node)) {
                  fileId += "_dup";
               }
   
               QFile fi(htmlOutput + "/" + fileId + ".js");
   
               if (fi.open(QIODevice::WriteOnly)) {
                  QTextStream tt(&fi);
   
                  tt << "var " << convertFileId2Var(fileId) << " =" << endl;
                  generateJSTree(navIndex, tt, node->children, 1, firstChild);
                  tt << endl << "];";
               }
   
               t << "\"" << fileId << "\" ]";            

            } else { 
               // no children
               t << "null ]";
            }
         }

      } else {
         bool firstChild = true;

         if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
            // omit treeview entries for index page
            omitComma = true;

         } else  {
            t << indentStr << "  [ ";
            generateJSLink(t, node);
   
            bool emptySection = ! generateJSTree(navIndex, t, node->children, level + 1, firstChild);
   
            if (emptySection) {
               t << "null ]";
            } else {
               t << endl << indentStr << "  ] ]";
            }
         }
      }
   }

   return found;
}