From e596bf3f21402ed555b305af7649546991bf8c3d Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 18 Jan 2019 10:59:56 +0100 Subject: Double id for tooltips in XHTML Possible. The tooltips (XHTML) should not be displayed per code fragment but for the entire (output) file as otherwise tooltips might be added multiple times resulting in double IDs. --- src/clangparser.cpp | 2 -- src/code.l | 5 --- src/fortrancode.l | 5 --- src/htmlgen.cpp | 5 ++- src/index.cpp | 3 ++ src/pycode.l | 5 --- src/sqlcode.l | 6 ---- src/vhdlcode.l | 5 --- src/xmlcode.l | 6 ---- testing/085/085__tooltip_8cpp.xml | 66 +++++++++++++++++++++++++++++++++++++++ testing/085_tooltip.cpp | 22 +++++++++++++ 11 files changed, 95 insertions(+), 35 deletions(-) create mode 100755 testing/085/085__tooltip_8cpp.xml create mode 100644 testing/085_tooltip.cpp diff --git a/src/clangparser.cpp b/src/clangparser.cpp index c22d5c5..f24ec0a 100644 --- a/src/clangparser.cpp +++ b/src/clangparser.cpp @@ -825,7 +825,6 @@ static void detectFunctionBody(const char *s) void ClangParser::writeSources(CodeOutputInterface &ol,FileDef *fd) { - TooltipManager::instance()->clearTooltips(); // (re)set global parser state g_currentDefinition=0; g_currentMemberDef=0; @@ -934,7 +933,6 @@ void ClangParser::writeSources(CodeOutputInterface &ol,FileDef *fd) clang_disposeString(tokenString); } ol.endCodeLine(); - TooltipManager::instance()->writeTooltips(ol); } ClangParser::ClangParser() diff --git a/src/code.l b/src/code.l index 558c439..933a7a7 100644 --- a/src/code.l +++ b/src/code.l @@ -3745,7 +3745,6 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); - TooltipManager::instance()->clearTooltips(); if (g_codeClassSDict==0) { resetCCodeParserState(); @@ -3828,10 +3827,6 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, DBG_CTX((stderr,"endCodeLine(%d)\n",g_yyLineNr)); g_code->endCodeLine(); } - if (fd) - { - TooltipManager::instance()->writeTooltips(*g_code); - } if (cleanupSourceDef) { // delete the temporary file definition used for this example diff --git a/src/fortrancode.l b/src/fortrancode.l index 0e610fd..616df5b 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -1327,7 +1327,6 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri if (s.isEmpty()) return; printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); - TooltipManager::instance()->clearTooltips(); g_code = &od; g_inputString = s; g_inputPosition = 0; @@ -1382,10 +1381,6 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri endFontClass(); g_code->endCodeLine(); } - if (fd) - { - TooltipManager::instance()->writeTooltips(*g_code); - } if (exBlock && g_sourceFileDef) { // delete the temporary file definition used for this example diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index b8fc5a2..787d0a4 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -43,7 +43,7 @@ #include "ftvhelp.h" #include "bufstr.h" #include "resourcemgr.h" - +#include "tooltip.h" //#define DBG_HTML(x) x; #define DBG_HTML(x) @@ -981,6 +981,9 @@ void HtmlGenerator::writePageFooter(FTextStream &t,const QCString &lastTitle, void HtmlGenerator::writeFooter(const char *navPath) { + // Currently only tooltips in HTML + TooltipManager::instance()->writeTooltips(m_codeGen); + writePageFooter(t,lastTitle,relPath,navPath); } diff --git a/src/index.cpp b/src/index.cpp index 5d16e4e..6dc8720 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -48,6 +48,7 @@ #include "classlist.h" #include "namespacedef.h" #include "filename.h" +#include "tooltip.h" #define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200 #define MAX_ITEMS_BEFORE_QUICK_INDEX 30 @@ -301,9 +302,11 @@ void endFile(OutputList &ol,bool skipNavIndex,bool skipEndContents, ol.writeString("\n"); } } + ol.writeFooter(navPath); // write the footer ol.popGeneratorState(); ol.endFile(); + TooltipManager::instance()->clearTooltips(); // Only clear after the last is written } void endFileWithNavPath(Definition *d,OutputList &ol) diff --git a/src/pycode.l b/src/pycode.l index d9c9f01..8f2279e 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -1569,7 +1569,6 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/, if (s.isEmpty()) return; printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); g_codeClassSDict.setAutoDelete(TRUE); - TooltipManager::instance()->clearTooltips(); g_code = &od; g_inputString = s; g_inputPosition = 0; @@ -1620,10 +1619,6 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/, { endCodeLine(); } - if (fd) - { - TooltipManager::instance()->writeTooltips(*g_code); - } if (cleanupSourceDef) { // delete the temporary file definition used for this example diff --git a/src/sqlcode.l b/src/sqlcode.l index fd0f11e..cbc6c3a 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -355,8 +355,6 @@ void parseSqlCode( { if (s.isEmpty()) return; - TooltipManager::instance()->clearTooltips(); - g_code = &od; g_inputString = s; g_inputPosition = 0; @@ -404,10 +402,6 @@ void parseSqlCode( { endCodeLine(); } - if (fd) - { - TooltipManager::instance()->writeTooltips(*g_code); - } if (cleanupSourceDef) { // delete the temporary file definition used for this example diff --git a/src/vhdlcode.l b/src/vhdlcode.l index aa15183..821cd33 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -1549,7 +1549,6 @@ void parseVhdlCode(CodeOutputInterface &od,const char *className,const QCString //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd); if (s.isEmpty()) return; printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); - TooltipManager::instance()->clearTooltips(); if (memberDef) { ClassDef *dd=memberDef->getClassDef(); @@ -1623,10 +1622,6 @@ void parseVhdlCode(CodeOutputInterface &od,const char *className,const QCString { endCodeLine(); } - if (fd) - { - TooltipManager::instance()->writeTooltips(*g_code); - } if (cleanupSourceDef) { // delete the temporary file definition used for this example diff --git a/src/xmlcode.l b/src/xmlcode.l index d2f94ad..c6e01e8 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -339,8 +339,6 @@ void parseXmlCode( { if (s.isEmpty()) return; - TooltipManager::instance()->clearTooltips(); - g_code = &od; g_inputString = s; g_inputPosition = 0; @@ -388,10 +386,6 @@ void parseXmlCode( { endCodeLine(); } - if (fd) - { - TooltipManager::instance()->writeTooltips(*g_code); - } if (cleanupSourceDef) { // delete the temporary file definition used for this example diff --git a/testing/085/085__tooltip_8cpp.xml b/testing/085/085__tooltip_8cpp.xml new file mode 100755 index 0000000..d9eaf8b --- /dev/null +++ b/testing/085/085__tooltip_8cpp.xml @@ -0,0 +1,66 @@ + + + + 085_tooltip.cpp + + + FOPEN_MACRO + + fn + + + mod + + if ((unit = fopen(fn, mod)) == NULL) \ + { \ + msg(OPEN_ERR,strerror(errno)); \ + } + + + + a general open macro + + + + + + + FCLOSE_MACRO + if (fclose(unit) != 0) \ + { \ + msg(CLOSE_ERR,strerror(errno)); \ + } + + + + a general close macro + + + + + + + + + FILE * + FILE* unit + + unit + = NULL + + the unit + + + + + + + + + + + + + + + diff --git a/testing/085_tooltip.cpp b/testing/085_tooltip.cpp new file mode 100644 index 0000000..fa97018 --- /dev/null +++ b/testing/085_tooltip.cpp @@ -0,0 +1,22 @@ +// objective: test tooltip in XHTML +// check: 085__tooltip_8cpp.xml +// config: SOURCE_BROWSER=YES +/** \file */ + + +/** \brief the unit */ +FILE *unit = NULL; + +/** a general open macro */ +#define FOPEN_MACRO(fn ,mod) \ + if ((unit = fopen(fn, mod)) == NULL) \ + { \ + msg(OPEN_ERR,strerror(errno)); \ + } + +/** a general close macro */ +#define FCLOSE_MACRO \ + if (fclose(unit) != 0) \ + { \ + msg(CLOSE_ERR,strerror(errno)); \ + } -- cgit v0.12