summaryrefslogtreecommitdiffstats
path: root/src/layout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout.cpp')
-rw-r--r--src/layout.cpp68
1 files changed, 60 insertions, 8 deletions
diff --git a/src/layout.cpp b/src/layout.cpp
index 79b4533..1fa6a41 100644
--- a/src/layout.cpp
+++ b/src/layout.cpp
@@ -21,6 +21,7 @@
#include "language.h"
#include "vhdldocgen.h"
#include "util.h"
+#include "doxygen.h"
#include <qxml.h>
#include <qfile.h>
@@ -55,7 +56,8 @@ static bool elemIsVisible(const QXmlAttributes &attrib,bool defVal=TRUE)
//---------------------------------------------------------------------------------
-LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind) const
+LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind,
+ const char *file) const
{
LayoutNavEntry *result=0;
QListIterator<LayoutNavEntry> li(m_children);
@@ -64,9 +66,9 @@ LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind) const
{
// depth first search, needed to find the entry furthest from the
// root in case an entry is in the tree twice
- result = entry->find(kind);
+ result = entry->find(kind,file);
if (result) return result;
- if (entry->kind()==kind)
+ if (entry->kind()==kind && (file==0 || entry->baseFile()==file))
{
return entry;
}
@@ -74,6 +76,39 @@ LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind) const
return result;
}
+QCString LayoutNavEntry::url() const
+{
+ QCString url = baseFile().stripWhiteSpace();
+ if (kind()!=LayoutNavEntry::User)
+ {
+ url+=Doxygen::htmlFileExtension;
+ }
+ else if (url.left(5)=="@ref " || url.left(5)=="\\ref ")
+ {
+ Definition *d;
+ QCString anchor;
+ bool found=FALSE;
+ if (resolveLink(0,url.mid(5).stripWhiteSpace(),TRUE,&d,anchor))
+ {
+ if (d && d->isLinkable())
+ {
+ url=d->getOutputFileBase()+Doxygen::htmlFileExtension;
+ if (!anchor.isEmpty())
+ {
+ url+="#"+anchor;
+ }
+ found=TRUE;
+ }
+ }
+ if (!found)
+ {
+ msg("warning: explicit link request to '%s' in layout file '%s' could not be resolved\n",qPrint(url.mid(5)),qPrint(Config_getString("LAYOUT_FILE")));
+ }
+ }
+ //printf("LayoutNavEntry::url()=%s\n",url.data());
+ return url;
+}
+
//---------------------------------------------------------------------------------
class LayoutParser : public QXmlDefaultHandler
@@ -771,13 +806,13 @@ class LayoutParser : public QXmlDefaultHandler
{
m_scope="navindex/";
m_rootNav = LayoutDocManager::instance().rootNavEntry();
- m_rootNav->clear();
+ if (m_rootNav) m_rootNav->clear();
}
void endNavIndex()
{
m_scope="";
- if (!m_rootNav->find(LayoutNavEntry::MainPage))
+ if (m_rootNav && !m_rootNav->find(LayoutNavEntry::MainPage))
{
// no MainPage node... add one the first item of the root node...
new LayoutNavEntry(m_rootNav,LayoutNavEntry::MainPage, TRUE,
@@ -923,6 +958,13 @@ class LayoutParser : public QXmlDefaultHandler
QCString(),
"user"
},
+ { "usergroup",
+ LayoutNavEntry::UserGroup,
+ QCString(),
+ QCString(),
+ QCString(),
+ "usergroup"
+ },
{ 0, // end of list
(LayoutNavEntry::Kind)0,
QCString(),
@@ -952,8 +994,9 @@ class LayoutParser : public QXmlDefaultHandler
}
else
{
- err("error: the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n");
+ err("error: the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n",type.data());
}
+ m_invalidEntry=TRUE;
return;
}
QCString baseFile = mapping[i].baseFile;
@@ -978,6 +1021,10 @@ class LayoutParser : public QXmlDefaultHandler
{
baseFile=url;
}
+ else if (kind==LayoutNavEntry::UserGroup)
+ {
+ baseFile+=QCString().sprintf("%d",m_userGroupCount++);
+ }
// create new item and make it the new root
m_rootNav = new LayoutNavEntry(m_rootNav,kind,kind==LayoutNavEntry::MainPage?TRUE:isVisible,baseFile,title,intro);
}
@@ -985,7 +1032,8 @@ class LayoutParser : public QXmlDefaultHandler
void endNavEntry()
{
// set the root back to the parent
- m_rootNav = m_rootNav->parent();
+ if (m_rootNav && !m_invalidEntry) m_rootNav = m_rootNav->parent();
+ m_invalidEntry=FALSE;
}
void startClass(const QXmlAttributes &)
@@ -1142,15 +1190,19 @@ class LayoutParser : public QXmlDefaultHandler
}
private:
- LayoutParser() : m_sHandler(163), m_eHandler(17) { }
+ LayoutParser() : m_sHandler(163), m_eHandler(17), m_invalidEntry(FALSE) { }
QDict<StartElementHandler> m_sHandler;
QDict<EndElementHandler> m_eHandler;
QString m_scope;
int m_part;
LayoutNavEntry *m_rootNav;
+ bool m_invalidEntry;
+ static int m_userGroupCount;
};
+int LayoutParser::m_userGroupCount=0;
+
//---------------------------------------------------------------------------------
class LayoutErrorHandler : public QXmlErrorHandler