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.

107 {
108  /* initial depth */
111  m_indent=0;
112  m_topLevelIndex = TLI;
113 }
QList< FTVNode > * m_indentNodes
Definition: ftvhelp.h:70
#define MAX_INDENT
Definition: ftvhelp.cpp:41
int m_indent
Definition: ftvhelp.h:71
void setAutoDelete(bool enable)
Definition: qlist.h:99
const bool TRUE
Definition: qglobal.h:371
bool m_topLevelIndex
Definition: ftvhelp.h:72
FTVHelp::~FTVHelp ( )

Destroys the ftv help object.

Definition at line 116 of file ftvhelp.cpp.

117 {
118  delete[] m_indentNodes;
119 }
QList< FTVNode > * m_indentNodes
Definition: ftvhelp.h:70

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.

192 {
193  //printf("%p: m_indent=%d addContentsItem(%s,%s,%s,%s)\n",this,m_indent,name,ref,file,anchor);
195  FTVNode *newNode = new FTVNode(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def);
196  if (!nl->isEmpty())
197  {
198  nl->getLast()->isLast=FALSE;
199  }
200  nl->append(newNode);
201  newNode->index = nl->count()-1;
202  if (m_indent>0)
203  {
205  newNode->parent = pnl->getLast();
206  }
207 
208 }
static QCString name
Definition: declinfo.cpp:673
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
QList< FTVNode > * m_indentNodes
Definition: ftvhelp.h:70
uint count() const
Definition: qlist.h:66
type * getLast() const
Definition: qlist.h:96
bool isEmpty() const
Definition: qlist.h:67
int index
Definition: ftvhelp.cpp:60
FTVNode * parent
Definition: ftvhelp.cpp:62
int m_indent
Definition: ftvhelp.h:71
bool isLast
Definition: ftvhelp.cpp:54
std::string nl(std::size_t i=1)
void FTVHelp::addImageFile ( const char *  )
inlinevirtual

Implements IndexIntf.

Definition at line 56 of file ftvhelp.h.

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

Implements IndexIntf.

Definition at line 55 of file ftvhelp.h.

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

Implements IndexIntf.

Definition at line 54 of file ftvhelp.h.

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

Implements IndexIntf.

Definition at line 57 of file ftvhelp.h.

57 {}
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.

153 {
154  //printf("decContentsDepth() indent=%d\n",m_indent);
155  ASSERT(m_indent>0);
156  if (m_indent>0)
157  {
158  m_indent--;
160  FTVNode *parent = nl->getLast();
161  if (parent)
162  {
163  QList<FTVNode> *children = &m_indentNodes[m_indent+1];
164  while (!children->isEmpty())
165  {
166  parent->children.append(children->take(0));
167  }
168  }
169  }
170 }
void append(const type *d)
Definition: qlist.h:73
QList< FTVNode > * m_indentNodes
Definition: ftvhelp.h:70
QList< FTVNode > children
Definition: ftvhelp.cpp:61
type * getLast() const
Definition: qlist.h:96
bool isEmpty() const
Definition: qlist.h:67
int m_indent
Definition: ftvhelp.h:71
type * take(uint i)
Definition: qlist.h:81
std::string nl(std::size_t i=1)
def parent(G, child, parent_type)
Definition: graph.py:67
#define ASSERT(x)
Definition: qglobal.h:590
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.

133 {
135 }
void generateTreeView()
Definition: ftvhelp.cpp:779
void FTVHelp::generateIndent ( FTextStream t,
FTVNode n,
bool  opened 
)
private

Definition at line 253 of file ftvhelp.cpp.

254 {
255  int indent=0;
256  FTVNode *p = n->parent;
257  while (p) { indent++; p=p->parent; }
258  if (n->isDir)
259  {
260  QCString dir = opened ? "&#9660;" : "&#9658;";
261  t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\">&#160;</span>"
262  << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" ";
263  t << "onclick=\"toggleFolder('" << generateIndentLabel(n,0) << "')\"";
264  t << ">" << dir
265  << "</span>";
266  }
267  else
268  {
269  t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>";
270  }
271 }
bool isDir
Definition: ftvhelp.cpp:55
string dir
QCString generateIndentLabel(FTVNode *n, int level)
Definition: ftvhelp.cpp:242
p
Definition: test.py:223
FTVNode * parent
Definition: ftvhelp.cpp:62
QCString FTVHelp::generateIndentLabel ( FTVNode n,
int  level 
)
private

Definition at line 242 of file ftvhelp.cpp.

243 {
245  if (n->parent)
246  {
247  result=generateIndentLabel(n->parent,level+1);
248  }
249  result+=QCString().setNum(n->index)+"_";
250  return result;
251 }
static QCString result
QCString generateIndentLabel(FTVNode *n, int level)
Definition: ftvhelp.cpp:242
int index
Definition: ftvhelp.cpp:60
FTVNode * parent
Definition: ftvhelp.cpp:62
QCString & setNum(short n)
Definition: qcstring.cpp:469
void FTVHelp::generateLink ( FTextStream t,
FTVNode n 
)
private

Definition at line 273 of file ftvhelp.cpp.

274 {
275  //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n",
276  // n->ref.data(),n->file.data(),n->anchor.data());
277  if (n->file.isEmpty()) // no link
278  {
279  t << "<b>" << convertToHtml(n->name) << "</b>";
280  }
281  else // link into other frame
282  {
283  if (!n->ref.isEmpty()) // link to entity imported via tag file
284  {
285  t << "<a class=\"elRef\" ";
286  t << externalLinkTarget() << externalRef("",n->ref,FALSE);
287  }
288  else // local link
289  {
290  t << "<a class=\"el\" ";
291  }
292  t << "href=\"";
293  t << externalRef("",n->ref,TRUE);
294  t << node2URL(n);
295  if (m_topLevelIndex)
296  t << "\" target=\"basefrm\">";
297  else
298  t << "\" target=\"_self\">";
299  t << convertToHtml(n->name);
300  t << "</a>";
301  if (!n->ref.isEmpty())
302  {
303  t << "&#160;[external]";
304  }
305  }
306 }
bool isEmpty() const
Definition: qcstring.h:189
const bool FALSE
Definition: qglobal.h:370
QCString file
Definition: ftvhelp.cpp:57
QCString convertToHtml(const char *s, bool keepEntities)
Definition: util.cpp:5746
QCString ref
Definition: ftvhelp.cpp:56
static QCString node2URL(FTVNode *n, bool overruleFile=FALSE, bool srcLink=FALSE)
Definition: ftvhelp.cpp:210
QCString name
Definition: ftvhelp.cpp:59
QCString externalLinkTarget()
Definition: util.cpp:7850
const bool TRUE
Definition: qglobal.h:371
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition: util.cpp:7856
bool m_topLevelIndex
Definition: ftvhelp.h:72
void FTVHelp::generateTree ( FTextStream t,
const QList< FTVNode > &  nl,
int  level,
int  maxLevel,
int &  index 
)
private

Definition at line 325 of file ftvhelp.cpp.

326 {
327  QListIterator<FTVNode> nli(nl);
328  FTVNode *n;
329  for (nli.toFirst();(n=nli.current());++nli)
330  {
331  t << "<tr id=\"row_" << generateIndentLabel(n,0) << "\"";
332  if ((index&1)==0) // even row
333  t << " class=\"even\"";
334  if (level>=maxLevel) // item invisible by default
335  t << " style=\"display:none;\"";
336  else // item visible by default
337  index++;
338  t << "><td class=\"entry\">";
339  bool nodeOpened = level+1<maxLevel;
340  generateIndent(t,n,nodeOpened);
341  if (n->isDir)
342  {
343  if (n->def && n->def->definitionType()==Definition::TypeGroup)
344  {
345  // no icon
346  }
347  else if (n->def && n->def->definitionType()==Definition::TypePage)
348  {
349  // no icon
350  }
351  else if (n->def && n->def->definitionType()==Definition::TypeNamespace)
352  {
353  t << "<span class=\"icona\"><span class=\"icon\">N</span></span>";
354  }
355  else if (n->def && n->def->definitionType()==Definition::TypeClass)
356  {
357  t << "<span class=\"icona\"><span class=\"icon\">C</span></span>";
358  }
359  else
360  {
361  t << "<span id=\"img_" << generateIndentLabel(n,0)
362  << "\" class=\"iconf"
363  << (nodeOpened?"open":"closed")
364  << "\" onclick=\"toggleFolder('" << generateIndentLabel(n,0)
365  << "')\">&#160;</span>";
366  }
367  generateLink(t,n);
368  t << "</td><td class=\"desc\">";
369  if (n->def)
370  {
371  generateBriefDoc(t,n->def);
372  }
373  t << "</td></tr>" << endl;
374  folderId++;
375  generateTree(t,n->children,level+1,maxLevel,index);
376  }
377  else // leaf node
378  {
379  FileDef *srcRef=0;
380  if (n->def && n->def->definitionType()==Definition::TypeFile &&
381  ((FileDef*)n->def)->generateSourceFile())
382  {
383  srcRef = (FileDef*)n->def;
384  }
385  if (srcRef)
386  {
387  t << "<a href=\"" << srcRef->getSourceFileBase()
389  << "\">";
390  }
391  if (n->def && n->def->definitionType()==Definition::TypeGroup)
392  {
393  // no icon
394  }
395  else if (n->def && n->def->definitionType()==Definition::TypePage)
396  {
397  // no icon
398  }
399  else if (n->def && n->def->definitionType()==Definition::TypeNamespace)
400  {
401  t << "<span class=\"icona\"><span class=\"icon\">N</span></span>";
402  }
403  else if (n->def && n->def->definitionType()==Definition::TypeClass)
404  {
405  t << "<span class=\"icona\"><span class=\"icon\">C</span></span>";
406  }
407  else
408  {
409  t << "<span class=\"icondoc\"></span>";
410  }
411  if (srcRef)
412  {
413  t << "</a>";
414  }
415  generateLink(t,n);
416  t << "</td><td class=\"desc\">";
417  if (n->def)
418  {
419  generateBriefDoc(t,n->def);
420  }
421  t << "</td></tr>" << endl;
422  }
423  }
424 }
Definition * def
Definition: ftvhelp.cpp:65
void generateIndent(FTextStream &t, FTVNode *n, bool opened)
Definition: ftvhelp.cpp:253
bool isDir
Definition: ftvhelp.cpp:55
static int folderId
Definition: ftvhelp.cpp:43
static QCString htmlFileExtension
Definition: doxygen.h:130
void generateTree(FTextStream &t, const QList< FTVNode > &nl, int level, int maxLevel, int &index)
Definition: ftvhelp.cpp:325
virtual DefType definitionType() const =0
QList< FTVNode > children
Definition: ftvhelp.cpp:61
static void generateBriefDoc(FTextStream &t, Definition *def)
Definition: ftvhelp.cpp:308
QCString getSourceFileBase() const
Definition: filedef.cpp:1771
std::void_t< T > n
QCString generateIndentLabel(FTVNode *n, int level)
Definition: ftvhelp.cpp:242
void generateLink(FTextStream &t, FTVNode *n)
Definition: ftvhelp.cpp:273
QTextStream & endl(QTextStream &s)
void FTVHelp::generateTreeView ( )

Definition at line 779 of file ftvhelp.cpp.

780 {
783 }
void generateTreeViewScripts()
Definition: ftvhelp.cpp:703
static void generateTreeViewImages()
Definition: ftvhelp.cpp:690
void FTVHelp::generateTreeViewImages ( )
static

Definition at line 690 of file ftvhelp.cpp.

691 {
692  QCString dname=Config_getString("HTML_OUTPUT");
693  const ResourceMgr &rm = ResourceMgr::instance();
694  rm.copyResource("doc.luma",dname);
695  rm.copyResource("folderopen.luma",dname);
696  rm.copyResource("folderclosed.luma",dname);
697  rm.copyResource("arrowdown.luma",dname);
698  rm.copyResource("arrowright.luma",dname);
699  rm.copyResource("splitbar.lum",dname);
700 }
bool copyResource(const char *name, const char *targetDir) const
static ResourceMgr & instance()
Definition: resourcemgr.cpp:35
Singleton for managing resources compiled into an executable.
Definition: resourcemgr.h:32
#define Config_getString(val)
Definition: config.cpp:660
void FTVHelp::generateTreeViewInline ( FTextStream t)

Definition at line 716 of file ftvhelp.cpp.

717 {
718  int preferredNumEntries = Config_getInt("HTML_INDEX_NUM_ENTRIES");
719  t << "<div class=\"directory\">\n";
721  FTVNode *n;
722  int d=1, depth=1;
723  for (;(n=li.current());++li)
724  {
725  if (n->children.count()>0)
726  {
727  d = n->computeTreeDepth(2);
728  if (d>depth) depth=d;
729  }
730  }
731  int preferredDepth = depth;
732  // write level selector
733  if (depth>1)
734  {
735  t << "<div class=\"levels\">[";
736  t << theTranslator->trDetailLevel();
737  t << " ";
738  int i;
739  for (i=1;i<=depth;i++)
740  {
741  t << "<span onclick=\"javascript:toggleLevel(" << i << ");\">" << i << "</span>";
742  }
743  t << "]</div>";
744 
745  if (preferredNumEntries>0)
746  {
747  preferredDepth=1;
748  for (int i=1;i<=depth;i++)
749  {
750  int num=0;
752  FTVNode *n;
753  for (;(n=li.current());++li)
754  {
755  num+=n->numNodesAtLevel(0,i);
756  }
757  if (num<=preferredNumEntries)
758  {
759  preferredDepth=i;
760  }
761  else
762  {
763  break;
764  }
765  }
766  }
767  }
768  //printf("preferred depth=%d\n",preferredDepth);
769 
770  t << "<table class=\"directory\">\n";
771  int index=0;
772  generateTree(t,m_indentNodes[0],0,preferredDepth,index);
773  t << "</table>\n";
774 
775  t << "</div><!-- directory -->\n";
776 }
int numNodesAtLevel(int level, int maxLevel) const
Definition: ftvhelp.cpp:84
void generateTree(FTextStream &t, const QList< FTVNode > &nl, int level, int maxLevel, int &index)
Definition: ftvhelp.cpp:325
int computeTreeDepth(int level) const
Definition: ftvhelp.cpp:68
QList< FTVNode > * m_indentNodes
Definition: ftvhelp.h:70
virtual QCString trDetailLevel()=0
#define Config_getInt(val)
Definition: config.cpp:661
uint count() const
Definition: qlist.h:66
QList< FTVNode > children
Definition: ftvhelp.cpp:61
std::void_t< T > n
Translator * theTranslator
Definition: language.cpp:157
void FTVHelp::generateTreeViewScripts ( )

Definition at line 703 of file ftvhelp.cpp.

704 {
705  QCString htmlOutput = Config_getString("HTML_OUTPUT");
706 
707  // generate navtree.js & navtreeindex.js
709 
710  // copy resize.js & navtree.css
711  ResourceMgr::instance().copyResource("resize.js",htmlOutput);
712  ResourceMgr::instance().copyResource("navtree.css",htmlOutput);
713 }
bool copyResource(const char *name, const char *targetDir) const
static ResourceMgr & instance()
Definition: resourcemgr.cpp:35
QList< FTVNode > * m_indentNodes
Definition: ftvhelp.h:70
static void generateJSNavTree(const QList< FTVNode > &nodeList)
Definition: ftvhelp.cpp:580
#define Config_getString(val)
Definition: config.cpp:660
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.

142 {
143  //printf("incContentsDepth() indent=%d\n",m_indent);
144  m_indent++;
146 }
#define MAX_INDENT
Definition: ftvhelp.cpp:41
int m_indent
Definition: ftvhelp.h:71
#define ASSERT(x)
Definition: qglobal.h:590
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.

125 {
126 }

Member Data Documentation

int FTVHelp::m_indent
private

Definition at line 71 of file ftvhelp.h.

QList<FTVNode>* FTVHelp::m_indentNodes
private

Definition at line 70 of file ftvhelp.h.

bool FTVHelp::m_topLevelIndex
private

Definition at line 72 of file ftvhelp.h.


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