diff options
Diffstat (limited to 'src/ftvhelp.cpp')
-rw-r--r-- | src/ftvhelp.cpp | 126 |
1 files changed, 37 insertions, 89 deletions
diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 11d3b1d..4613a92 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -1,7 +1,7 @@ /****************************************************************************** * ftvhelp.cpp,v 1.0 2000/09/06 16:09:00 * - * Copyright (C) 1997-2013 by Dimitri van Heesch. + * Copyright (C) 1997-2014 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby @@ -234,6 +234,7 @@ static unsigned char doc_a_png[528] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#if 0 static unsigned char module_png[528] = { 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, @@ -338,6 +339,7 @@ static unsigned char letter_a_png[528] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#endif static unsigned char arrow_right_png[352] = @@ -507,6 +509,7 @@ struct FTVImageInfo //extern FTVImageInfo image_info[]; +#if 0 #define FTVIMG_blank 0 #define FTVIMG_doc 1 #define FTVIMG_folderclosed 2 @@ -553,6 +556,7 @@ static FTVImageInfo image_info[] = { "M", "ftv2mo.png", 0 /*ftv2vertline_png*/ /*,352*/,24,22 }, { 0, 0, 0 /*, 0*/, 0, 0 } }; +#endif static ColoredImgDataItem ftv_image_data[] = { @@ -560,9 +564,9 @@ static ColoredImgDataItem ftv_image_data[] = { "ftv2doc.png", 24, 22, doc_png, doc_a_png }, { "ftv2folderclosed.png", 24, 22, folderclosed_png, folderclosed_a_png }, { "ftv2folderopen.png", 24, 22, folderopen_png, folderopen_a_png }, - { "ftv2ns.png", 24, 22, namespace_png, letter_a_png }, - { "ftv2mo.png", 24, 22, module_png, letter_a_png }, - { "ftv2cl.png", 24, 22, class_png, letter_a_png }, +// { "ftv2ns.png", 24, 22, namespace_png, letter_a_png }, +// { "ftv2mo.png", 24, 22, module_png, letter_a_png }, +// { "ftv2cl.png", 24, 22, class_png, letter_a_png }, { "ftv2lastnode.png", 16, 22, blank_png, blank_png }, { "ftv2link.png", 24, 22, doc_png, doc_a_png }, { "ftv2mlastnode.png", 16, 22, arrow_down_png, arrow_down_a_png }, @@ -780,68 +784,27 @@ QCString FTVHelp::generateIndentLabel(FTVNode *n,int level) { result=generateIndentLabel(n->parent,level+1); } - result+=QCString().sprintf("%d_",n->index); + result+=QCString().setNum(n->index)+"_"; return result; } -void FTVHelp::generateIndent(FTextStream &t, FTVNode *n,int level, bool opened) +void FTVHelp::generateIndent(FTextStream &t, FTVNode *n,bool opened) { - if (n->parent) + int indent=0; + FTVNode *p = n->parent; + while (p) { indent++; p=p->parent; } + if (n->isDir) { - generateIndent(t,n->parent,level+1,opened); + QCString dir = opened ? "▼" : "►"; + t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\"> </span>" + << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" "; + t << "onclick=\"toggleFolder('" << generateIndentLabel(n,0) << "')\""; + t << ">" << dir + << "</span>"; } - // from the root up to node n do... - if (level==0) // item before a dir or document + else { - if (n->isLast) - { - if (n->isDir) - { - t << "<img id=\"arr_" << generateIndentLabel(n,0) - << "\" "; - if (opened) - t << FTV_IMGATTRIBS(mlastnode); - else - t << FTV_IMGATTRIBS(plastnode); - t << "onclick=\"toggleFolder('" - << generateIndentLabel(n,0) - << "')\"/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(lastnode) << "/>"; - } - } - else - { - if (n->isDir) - { - t << "<img id=\"arr_" << generateIndentLabel(n,0) - << "\" "; - if (opened) - t << FTV_IMGATTRIBS(mnode); - else - t << FTV_IMGATTRIBS(pnode); - t << "onclick=\"toggleFolder('" - << generateIndentLabel(n,0) - << "')\"/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(node) << "/>"; - } - } - } - else // item at another level - { - if (n->isLast) - { - t << "<img " << FTV_IMGATTRIBS(blank) << "/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(vertline) << "/>"; - } + t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\"> </span>"; } } @@ -912,7 +875,7 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in index++; t << "><td class=\"entry\">"; bool nodeOpened = level+1<maxLevel; - generateIndent(t,n,0,nodeOpened); + generateIndent(t,n,nodeOpened); if (n->isDir) { if (n->def && n->def->definitionType()==Definition::TypeGroup) @@ -925,29 +888,19 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in } else if (n->def && n->def->definitionType()==Definition::TypeNamespace) { - t << "<img "; - t << FTV_IMGATTRIBS(ns); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">N</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeClass) { - t << "<img "; - t << FTV_IMGATTRIBS(cl); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">C</span></span>"; } else { - t << "<img "; - t << "id=\"img_" << generateIndentLabel(n,0) - << "\" "; - if (nodeOpened) - t << FTV_IMGATTRIBS(folderopen); - else - t << FTV_IMGATTRIBS(folderclosed); - t << "onclick=\"toggleFolder('" - << generateIndentLabel(n,0) - << "')\""; - t << "/>"; + t << "<span id=\"img_" << generateIndentLabel(n,0) + << "\" class=\"iconf" + << (nodeOpened?"open":"closed") + << "\" onclick=\"toggleFolder('" << generateIndentLabel(n,0) + << "')\"> </span>"; } generateLink(t,n); t << "</td><td class=\"desc\">"; @@ -983,21 +936,15 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in } else if (n->def && n->def->definitionType()==Definition::TypeNamespace) { - t << "<img "; - t << FTV_IMGATTRIBS(ns); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">N</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeClass) { - t << "<img "; - t << FTV_IMGATTRIBS(cl); - t << "/>"; + t << "<span class=\"icona\"><span class=\"icon\">C</span></span>"; } else { - t << "<img "; - t << FTV_IMGATTRIBS(doc); - t << "/>"; + t << "<span class=\"icondoc\"></span>"; } if (srcRef) { @@ -1023,15 +970,16 @@ struct NavIndexEntry QCString path; }; -class NavIndexEntryList : public QList<NavIndexEntry> +class NavIndexEntryList : public QList<NavIndexEntry> { public: NavIndexEntryList() : QList<NavIndexEntry>() { setAutoDelete(TRUE); } ~NavIndexEntryList() {} - int compareItems(QCollection::Item item1,QCollection::Item item2) + private: + int compareValues(const NavIndexEntry *item1,const NavIndexEntry *item2) const { // sort list based on url - return qstrcmp(((NavIndexEntry*)item1)->url,((NavIndexEntry*)item2)->url); + return qstrcmp(item1->url,item2->url); } }; |