Doxygen
Loading...
Searching...
No Matches
FTVHelp Class Reference

A class that generates a dynamic tree view side panel. More...

#include <src/ftvhelp.h>

+ Inheritance diagram for FTVHelp:
+ Collaboration diagram for FTVHelp:

Classes

struct  Private
 

Public Member Functions

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

Static Public Member Functions

static void generateTreeViewImages ()
 

Private Attributes

std::unique_ptr< Privatep
 

Detailed Description

A class that generates a dynamic tree view side panel.

Definition at line 40 of file ftvhelp.h.

Constructor & Destructor Documentation

◆ FTVHelp()

FTVHelp::FTVHelp ( bool TLI)

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

Definition at line 119 of file ftvhelp.cpp.

119: p(std::make_unique<Private>(TLI)) {}
std::unique_ptr< Private > p
Definition ftvhelp.h:69

References p.

Referenced by ~FTVHelp().

◆ ~FTVHelp()

FTVHelp::~FTVHelp ( )
default

References FTVHelp().

Member Function Documentation

◆ addContentsItem()

void FTVHelp::addContentsItem ( bool isDir,
const QCString & name,
const QCString & ref,
const QCString & file,
const QCString & anchor,
bool separateIndex,
bool addToNavIndex,
const 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.
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 184 of file ftvhelp.cpp.

193{
194 //printf("%p: p->indent=%d addContentsItem(%d,%s,%s,%s,%s)\n",(void*)this,p->indent,isDir,qPrint(name),qPrint(ref),qPrint(file),qPrint(anchor));
195 auto &nl = p->indentNodes[p->indent];
196 if (!nl.empty())
197 {
198 nl.back()->isLast=FALSE;
199 }
200 auto newNode = std::make_shared<FTVNode>(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def);
201 nl.push_back(newNode);
202 newNode->index = static_cast<int>(nl.size()-1);
203 if (p->indent>0)
204 {
205 auto &pnl = p->indentNodes[p->indent-1];
206 if (!pnl.empty())
207 {
208 newNode->parent = pnl.back();
209 }
210 }
211}
#define FALSE
Definition qcstring.h:34

References FALSE, and p.

Referenced by writeClassTree(), writeClassTreeForList(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptList(), writeConceptRootList(), writeConceptTreeInsideNamespaceElement(), writeDirHierarchy(), writeDirTreeNode(), writeGroupTreeNode(), writeModuleTreeNode(), writeNamespaceTreeElement(), and writePages().

◆ addImageFile()

void FTVHelp::addImageFile ( const QCString & )
inlinevirtual

Implements IndexIntf.

Definition at line 61 of file ftvhelp.h.

61{}

◆ addIndexFile()

void FTVHelp::addIndexFile ( const QCString & )
inlinevirtual

Implements IndexIntf.

Definition at line 60 of file ftvhelp.h.

60{}

◆ addIndexItem()

void FTVHelp::addIndexItem ( const Definition * ,
const MemberDef * ,
const QCString & ,
const QCString &  )
inlinevirtual

Implements IndexIntf.

Definition at line 59 of file ftvhelp.h.

59{}

◆ addStyleSheetFile()

void FTVHelp::addStyleSheetFile ( const QCString & )
inlinevirtual

Implements IndexIntf.

Definition at line 62 of file ftvhelp.h.

62{}

◆ decContentsDepth()

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 153 of file ftvhelp.cpp.

154{
155 //printf("%p: decContentsDepth() indent=%d\n",this,p->indent);
156 ASSERT(p->indent>0);
157 if (p->indent>0)
158 {
159 p->indent--;
160 auto &nl = p->indentNodes[p->indent];
161 if (!nl.empty())
162 {
163 auto &parent = nl.back();
164 auto &children = p->indentNodes[p->indent+1];
165 for (const auto &child : children)
166 {
167 parent->children.push_back(child);
168 }
169 children.clear();
170 }
171 }
172}
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324
#define ASSERT(x)
Definition qcstring.h:39

References ASSERT, p, and parent().

Referenced by writeClassTree(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptTreeInsideNamespaceElement(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement(), and writePages().

◆ finalize()

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 133 of file ftvhelp.cpp.

134{
136}
void generateTreeView()
Definition ftvhelp.cpp:936

References generateTreeView().

◆ generateTreeView()

void FTVHelp::generateTreeView ( )

Definition at line 936 of file ftvhelp.cpp.

937{
940}
static void generateTreeViewImages()
Definition ftvhelp.cpp:851
void generateTreeViewScripts()
Definition ftvhelp.cpp:866

References generateTreeViewImages(), and generateTreeViewScripts().

Referenced by finalize().

◆ generateTreeViewImages()

void FTVHelp::generateTreeViewImages ( )
static

Definition at line 851 of file ftvhelp.cpp.

852{
853 QCString dname=Config_getString(HTML_OUTPUT);
854 const ResourceMgr &rm = ResourceMgr::instance();
855 rm.copyResource("doc.svg",dname);
856 rm.copyResource("docd.svg",dname);
857 rm.copyResource("folderopen.svg",dname);
858 rm.copyResource("folderopend.svg",dname);
859 rm.copyResource("folderclosed.svg",dname);
860 rm.copyResource("folderclosedd.svg",dname);
861 rm.copyResource("splitbar.lum",dname);
862 rm.copyResource("splitbard.lum",dname);
863}
static ResourceMgr & instance()
Returns the one and only instance of this class.
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory.
#define Config_getString(name)
Definition config.h:32

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

Referenced by generateOutput(), and generateTreeView().

◆ generateTreeViewInline()

void FTVHelp::generateTreeViewInline ( TextStream & t)

Definition at line 875 of file ftvhelp.cpp.

876{
877 int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES);
878 t << "<div class=\"directory\">\n";
879 int d=1, depth=1;
880 for (const auto &n : p->indentNodes[0])
881 {
882 if (!n->children.empty())
883 {
884 d = n->computeTreeDepth(2);
885 if (d>depth) depth=d;
886 }
887 }
888 int preferredDepth = depth;
889 // write level selector
890 if (depth>1)
891 {
892 t << "<div class=\"levels\">[";
894 t << " ";
895 for (int i=1;i<=depth;i++)
896 {
897 t << "<span onclick=\"javascript:dynsection.toggleLevel(" << i << ");\">" << i << "</span>";
898 }
899 t << "]</div>";
900
901 if (preferredNumEntries>0)
902 {
903 preferredDepth=1;
904 for (int i=1;i<=depth;i++)
905 {
906 int num=0;
907 for (const auto &n : p->indentNodes[0])
908 {
909 num+=n->numNodesAtLevel(0,i);
910 }
911 if (num<=preferredNumEntries)
912 {
913 preferredDepth=i;
914 }
915 else
916 {
917 break;
918 }
919 }
920 }
921 }
922 //printf("preferred depth=%d\n",preferredDepth);
923
924 if (!p->indentNodes[0].empty())
925 {
926 t << "<table class=\"directory\">\n";
927 int index=0;
928 p->generateTree(t,p->indentNodes[0],0,preferredDepth,index);
929 t << "</table>\n";
930 }
931
932 t << "</div><!-- directory -->\n";
933}
virtual QCString trDetailLevel()=0
#define Config_getInt(name)
Definition config.h:34
Translator * theTranslator
Definition language.cpp:71

References Config_getInt, p, and theTranslator.

Referenced by writeAnnotatedIndexGeneric(), writeConceptIndex(), writeFileIndex(), writeHierarchicalExceptionIndex(), writeHierarchicalIndex(), writeHierarchicalInterfaceIndex(), writeModuleIndex(), writeNamespaceIndex(), writePageIndex(), and writeTopicIndex().

◆ generateTreeViewScripts()

void FTVHelp::generateTreeViewScripts ( )

Definition at line 866 of file ftvhelp.cpp.

867{
868 QCString htmlOutput = Config_getString(HTML_OUTPUT);
869
870 // generate navtree.js & navtreeindex.js
871 generateJSNavTree(p->indentNodes[0]);
872}
static void generateJSNavTree(const FTVNodes &nodeList)
Definition ftvhelp.cpp:731

References Config_getString, generateJSNavTree(), and p.

Referenced by generateTreeView().

◆ incContentsDepth()

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 142 of file ftvhelp.cpp.

143{
144 //printf("%p: incContentsDepth() indent=%d\n",this,p->indent);
145 p->indent++;
146 p->indentNodes.resize(p->indent+1);
147}

References p.

Referenced by writeClassTree(), writeClassTreeInsideNamespaceElement(), writeClassTreeToOutput(), writeConceptTreeInsideNamespaceElement(), writeDirTreeNode(), writeGroupTreeNode(), writeNamespaceTreeElement(), and writePages().

◆ initialize()

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 125 of file ftvhelp.cpp.

126{
127}

Member Data Documentation

◆ p

std::unique_ptr<Private> FTVHelp::p
private

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