My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
FTVHelp Class Reference

#include <ftvhelp.h>

Inheritance diagram for FTVHelp:
IndexIntf

Public Member Functions

 FTVHelp (bool LTI)
 
 ~FTVHelp ()
 
void initialize ()
 
void finalize ()
 
void incContentsDepth ()
 
void decContentsDepth ()
 
void addContentsItem (bool isDir, const char *name, const char *ref, const char *file, const char *anchor, bool separateIndex, bool addToNavIndex, Definition *def)
 
void addIndexItem (Definition *, MemberDef *, const char *, const char *)
 
void addIndexFile (const char *)
 
void addImageFile (const char *)
 
void addStyleSheetFile (const char *)
 
void generateTreeView ()
 
void generateTreeViewInline (FTextStream &t)
 
void generateTreeViewScripts ()
 
- Public Member Functions inherited from IndexIntf
virtual ~IndexIntf ()
 

Static Public Member Functions

static void generateTreeViewImages ()
 

Private Member Functions

void generateTree (FTextStream &t, const QList< FTVNode > &nl, int level, int maxLevel, int &index)
 
QCString generateIndentLabel (FTVNode *n, int level)
 
void generateIndent (FTextStream &t, FTVNode *n, bool opened)
 
void generateLink (FTextStream &t, FTVNode *n)
 

Private Attributes

QList< FTVNode > * m_indentNodes
 
int m_indent
 
bool m_topLevelIndex
 

Detailed Description

A class that generates a dynamic tree view side panel.

Definition at line 37 of file ftvhelp.h.

Constructor & Destructor Documentation

FTVHelp::FTVHelp ( bool  TLI)

Constructs an ftv help object. The object has to be initialized before it can be used.

Definition at line 106 of file ftvhelp.cpp.

References m_indent, m_indentNodes, m_topLevelIndex, and MAX_INDENT.

{
/* initial depth */
m_indentNodes = new QList<FTVNode>[MAX_INDENT];
m_indentNodes[0].setAutoDelete(TRUE);
}
FTVHelp::~FTVHelp ( )

Destroys the ftv help object.

Definition at line 116 of file ftvhelp.cpp.

References m_indentNodes.

{
delete[] m_indentNodes;
}

Member Function Documentation

void FTVHelp::addContentsItem ( bool  isDir,
const char *  name,
const char *  ref,
const char *  file,
const char *  anchor,
bool  separateIndex,
bool  addToNavIndex,
Definition def 
)
virtual

Add a list item to the contents file.

Parameters
isDirTRUE if the item is a directory, FALSE if it is a text
nameThe name of the item.
refthe URL of to the item.
filethe file containing the definition of the item
anchorthe anchor within the file.
namethe name of the item.
separateIndexput the entries in a separate index file
addToNavIndexadd this entry to the quick navigation index
defDefinition corresponding to this entry

Implements IndexIntf.

Definition at line 183 of file ftvhelp.cpp.

References FTVNode::index, m_indent, m_indentNodes, and FTVNode::parent.

Referenced by writeClassTree(), writeClassTreeForList(), writeDirHierarchy(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTree(), and writePages().

{
//printf("%p: m_indent=%d addContentsItem(%s,%s,%s,%s)\n",this,m_indent,name,ref,file,anchor);
QList<FTVNode> *nl = &m_indentNodes[m_indent];
FTVNode *newNode = new FTVNode(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def);
if (!nl->isEmpty())
{
nl->getLast()->isLast=FALSE;
}
nl->append(newNode);
newNode->index = nl->count()-1;
if (m_indent>0)
{
QList<FTVNode> *pnl = &m_indentNodes[m_indent-1];
newNode->parent = pnl->getLast();
}
}
void FTVHelp::addImageFile ( const char *  )
inlinevirtual

Implements IndexIntf.

Definition at line 56 of file ftvhelp.h.

{}
void FTVHelp::addIndexFile ( const char *  )
inlinevirtual

Implements IndexIntf.

Definition at line 55 of file ftvhelp.h.

{}
void FTVHelp::addIndexItem ( Definition ,
MemberDef ,
const char *  ,
const char *   
)
inlinevirtual

Implements IndexIntf.

Definition at line 54 of file ftvhelp.h.

{}
void FTVHelp::addStyleSheetFile ( const char *  )
inlinevirtual

Implements IndexIntf.

Definition at line 57 of file ftvhelp.h.

{}
void FTVHelp::decContentsDepth ( )
virtual

Decrease the level of the contents hierarchy. This will end the current sublist.

See Also
incContentsDepth()

Implements IndexIntf.

Definition at line 152 of file ftvhelp.cpp.

References FTVNode::children, m_indent, and m_indentNodes.

Referenced by writeClassTree(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTree(), and writePages().

{
//printf("decContentsDepth() indent=%d\n",m_indent);
ASSERT(m_indent>0);
if (m_indent>0)
{
QList<FTVNode> *nl = &m_indentNodes[m_indent];
FTVNode *parent = nl->getLast();
if (parent)
{
QList<FTVNode> *children = &m_indentNodes[m_indent+1];
while (!children->isEmpty())
{
parent->children.append(children->take(0));
}
}
}
}
void FTVHelp::finalize ( )
virtual

Finalizes the FTV help. This will finish and close the contents file (index.js).

See Also
initialize()

Implements IndexIntf.

Definition at line 132 of file ftvhelp.cpp.

References generateTreeView().

void FTVHelp::generateIndent ( FTextStream t,
FTVNode n,
bool  opened 
)
private

Definition at line 253 of file ftvhelp.cpp.

References generateIndentLabel(), FTVNode::isDir, and FTVNode::parent.

Referenced by generateTree().

{
int indent=0;
FTVNode *p = n->parent;
while (p) { indent++; p=p->parent; }
if (n->isDir)
{
QCString dir = opened ? "&#9660;" : "&#9658;";
t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\">&#160;</span>"
<< "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" ";
t << "onclick=\"toggleFolder('" << generateIndentLabel(n,0) << "')\"";
t << ">" << dir
<< "</span>";
}
else
{
t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>";
}
}
QCString FTVHelp::generateIndentLabel ( FTVNode n,
int  level 
)
private

Definition at line 242 of file ftvhelp.cpp.

References FTVNode::index, and FTVNode::parent.

Referenced by generateIndent(), and generateTree().

{
QCString result;
if (n->parent)
{
result=generateIndentLabel(n->parent,level+1);
}
result+=QCString().setNum(n->index)+"_";
return result;
}
void FTVHelp::generateLink ( FTextStream t,
FTVNode n 
)
private

Definition at line 273 of file ftvhelp.cpp.

References convertToHtml(), externalLinkTarget(), externalRef(), FTVNode::file, m_topLevelIndex, FTVNode::name, node2URL(), and FTVNode::ref.

Referenced by generateTree().

{
//printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n",
// n->ref.data(),n->file.data(),n->anchor.data());
if (n->file.isEmpty()) // no link
{
t << "<b>" << convertToHtml(n->name) << "</b>";
}
else // link into other frame
{
if (!n->ref.isEmpty()) // link to entity imported via tag file
{
t << "<a class=\"elRef\" ";
t << externalLinkTarget() << externalRef("",n->ref,FALSE);
}
else // local link
{
t << "<a class=\"el\" ";
}
t << "href=\"";
t << externalRef("",n->ref,TRUE);
t << node2URL(n);
t << "\" target=\"basefrm\">";
else
t << "\" target=\"_self\">";
t << convertToHtml(n->name);
t << "</a>";
if (!n->ref.isEmpty())
{
t << "&#160;[external]";
}
}
}
void FTVHelp::generateTree ( FTextStream t,
const QList< FTVNode > &  nl,
int  level,
int  maxLevel,
int &  index 
)
private

Definition at line 325 of file ftvhelp.cpp.

References FTVNode::children, FTVNode::def, DefinitionIntf::definitionType(), endl(), folderId, generateBriefDoc(), generateIndent(), generateIndentLabel(), generateLink(), FileDef::getSourceFileBase(), Doxygen::htmlFileExtension, FTVNode::isDir, DefinitionIntf::TypeClass, DefinitionIntf::TypeFile, DefinitionIntf::TypeGroup, DefinitionIntf::TypeNamespace, and DefinitionIntf::TypePage.

Referenced by generateTreeViewInline().

{
QListIterator<FTVNode> nli(nl);
FTVNode *n;
for (nli.toFirst();(n=nli.current());++nli)
{
t << "<tr id=\"row_" << generateIndentLabel(n,0) << "\"";
if ((index&1)==0) // even row
t << " class=\"even\"";
if (level>=maxLevel) // item invisible by default
t << " style=\"display:none;\"";
else // item visible by default
index++;
t << "><td class=\"entry\">";
bool nodeOpened = level+1<maxLevel;
generateIndent(t,n,nodeOpened);
if (n->isDir)
{
{
// no icon
}
else if (n->def && n->def->definitionType()==Definition::TypePage)
{
// no icon
}
{
t << "<span class=\"icona\"><span class=\"icon\">N</span></span>";
}
{
t << "<span class=\"icona\"><span class=\"icon\">C</span></span>";
}
else
{
t << "<span id=\"img_" << generateIndentLabel(n,0)
<< "\" class=\"iconf"
<< (nodeOpened?"open":"closed")
<< "\" onclick=\"toggleFolder('" << generateIndentLabel(n,0)
<< "')\">&#160;</span>";
}
t << "</td><td class=\"desc\">";
if (n->def)
{
}
t << "</td></tr>" << endl;
generateTree(t,n->children,level+1,maxLevel,index);
}
else // leaf node
{
FileDef *srcRef=0;
((FileDef*)n->def)->generateSourceFile())
{
srcRef = (FileDef*)n->def;
}
if (srcRef)
{
t << "<a href=\"" << srcRef->getSourceFileBase()
<< "\">";
}
{
// no icon
}
else if (n->def && n->def->definitionType()==Definition::TypePage)
{
// no icon
}
{
t << "<span class=\"icona\"><span class=\"icon\">N</span></span>";
}
{
t << "<span class=\"icona\"><span class=\"icon\">C</span></span>";
}
else
{
t << "<span class=\"icondoc\"></span>";
}
if (srcRef)
{
t << "</a>";
}
t << "</td><td class=\"desc\">";
if (n->def)
{
}
t << "</td></tr>" << endl;
}
}
}
void FTVHelp::generateTreeView ( )
void FTVHelp::generateTreeViewImages ( )
static

Definition at line 690 of file ftvhelp.cpp.

References Config_getString, ResourceMgr::copyResource(), and ResourceMgr::instance().

Referenced by generateOutput(), and generateTreeView().

{
QCString dname=Config_getString(HTML_OUTPUT);
rm.copyResource("doc.luma",dname);
rm.copyResource("folderopen.luma",dname);
rm.copyResource("folderclosed.luma",dname);
rm.copyResource("splitbar.lum",dname);
}
void FTVHelp::generateTreeViewInline ( FTextStream t)

Definition at line 714 of file ftvhelp.cpp.

References FTVNode::children, FTVNode::computeTreeDepth(), Config_getInt, generateTree(), m_indentNodes, FTVNode::numNodesAtLevel(), theTranslator, and Translator::trDetailLevel().

Referenced by writeAnnotatedIndex(), writeFileIndex(), writeGroupIndex(), writeHierarchicalIndex(), writeNamespaceIndex(), and writePageIndex().

{
int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES);
t << "<div class=\"directory\">\n";
QListIterator<FTVNode> li(m_indentNodes[0]);
FTVNode *n;
int d=1, depth=1;
for (;(n=li.current());++li)
{
if (n->children.count()>0)
{
d = n->computeTreeDepth(2);
if (d>depth) depth=d;
}
}
int preferredDepth = depth;
// write level selector
if (depth>1)
{
t << "<div class=\"levels\">[";
t << " ";
int i;
for (i=1;i<=depth;i++)
{
t << "<span onclick=\"javascript:toggleLevel(" << i << ");\">" << i << "</span>";
}
t << "]</div>";
if (preferredNumEntries>0)
{
preferredDepth=1;
for (int i=1;i<=depth;i++)
{
int num=0;
QListIterator<FTVNode> li(m_indentNodes[0]);
FTVNode *n;
for (;(n=li.current());++li)
{
num+=n->numNodesAtLevel(0,i);
}
if (num<=preferredNumEntries)
{
preferredDepth=i;
}
else
{
break;
}
}
}
}
//printf("preferred depth=%d\n",preferredDepth);
t << "<table class=\"directory\">\n";
int index=0;
generateTree(t,m_indentNodes[0],0,preferredDepth,index);
t << "</table>\n";
t << "</div><!-- directory -->\n";
}
void FTVHelp::generateTreeViewScripts ( )

Definition at line 701 of file ftvhelp.cpp.

References Config_getString, ResourceMgr::copyResource(), generateJSNavTree(), ResourceMgr::instance(), and m_indentNodes.

Referenced by generateTreeView().

{
QCString htmlOutput = Config_getString(HTML_OUTPUT);
// generate navtree.js & navtreeindex.js
// copy resize.js & navtree.css
ResourceMgr::instance().copyResource("resize.js",htmlOutput);
ResourceMgr::instance().copyResource("navtree.css",htmlOutput);
}
void FTVHelp::incContentsDepth ( )
virtual

Increase the level of the contents hierarchy. This will start a new sublist in contents file.

See Also
decContentsDepth()

Implements IndexIntf.

Definition at line 141 of file ftvhelp.cpp.

References m_indent, and MAX_INDENT.

Referenced by writeClassTree(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTree(), and writePages().

{
//printf("incContentsDepth() indent=%d\n",m_indent);
}
void FTVHelp::initialize ( )
virtual

This will create a folder tree view table of contents file (tree.js).

See Also
finalize()

Implements IndexIntf.

Definition at line 124 of file ftvhelp.cpp.

{
}

Member Data Documentation

int FTVHelp::m_indent
private

Definition at line 71 of file ftvhelp.h.

Referenced by addContentsItem(), decContentsDepth(), FTVHelp(), and incContentsDepth().

QList<FTVNode>* FTVHelp::m_indentNodes
private
bool FTVHelp::m_topLevelIndex
private

Definition at line 72 of file ftvhelp.h.

Referenced by FTVHelp(), and generateLink().


The documentation for this class was generated from the following files: