Commit dbd55926 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Added SOURCE_TOOLTIPS option for advanced tooltip support while source browsing

parent 4f520b36
......@@ -44,7 +44,6 @@ SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
......
......@@ -2,6 +2,7 @@ JQUERY_VERSION = 1.7.1
JQUERY_UI_VERSION = 1.8.18
HASHCHANGE_VERSION = 1.3
SCROLL_VERSION = 1.4.2
POWERTIP_VERSION = 1.2.0
MINIFIER = /usr/local/bin/yuicompressor-2.4.7
SCRIPTS = jquery-$(JQUERY_VERSION).js \
jquery.ui-$(JQUERY_UI_VERSION).core.js \
......@@ -9,8 +10,10 @@ SCRIPTS = jquery-$(JQUERY_VERSION).js \
jquery.ui-$(JQUERY_UI_VERSION).mouse.js \
jquery.ui-$(JQUERY_UI_VERSION).resizable.js \
jquery.ba-$(HASHCHANGE_VERSION)-hashchange.js \
jquery.scrollTo-$(SCROLL_VERSION).js
RESULTS = jquery_p1.js jquery_p2.js jquery_p3.js jquery_ui.js jquery_fx.js
jquery.scrollTo-$(SCROLL_VERSION).js \
jquery.powertip-$(POWERTIP_VERSION).js
RESULTS = jquery_p1.js jquery_p2.js jquery_p3.js \
jquery_ui.js jquery_fx.js jquery_pt.js
SCRIPTS_MIN = $(SCRIPTS:%.js=%-min.js)
......@@ -26,6 +29,9 @@ jquery_ui.js: scripts
jquery.ui-$(JQUERY_UI_VERSION).resizable-min.js \
jquery.ba-$(HASHCHANGE_VERSION)-hashchange-min.js > jquery_ui.js
jquery_pt.js: scripts
cat jquery.powertip-$(POWERTIP_VERSION)-min.js > jquery_pt.js
jquery_fx.js: scripts
cat jquery.scrollTo-$(SCROLL_VERSION)-min.js > jquery_fx.js
......
......@@ -9,6 +9,7 @@ packages:
- jquery.ui.resizable
- jquery.hashchange: 1.3: http://benalman.com/projects/jquery-hashchange-plugin/
- jquery.scrollTo: 1.4.2: https://github.com/flesler/jquery.scrollTo
- jquery.powertip: 1.2.0: http://stevenbenner.github.io/jquery-powertip/
The Makefile will built the jquery_*.js files used by doxygen.
Some files are split into smaller parts to make sure Visual Studio can compile them
......
This diff is collapsed.
# Doxyfile 1.8.3.1
# Doxyfile 1.8.4
#---------------------------------------------------------------------------
# Project related configuration options
......@@ -124,6 +124,7 @@ STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
CLANG_ASSISTED_PARSING = YES
......
......@@ -17,6 +17,7 @@
#include "growbuf.h"
#include "membername.h"
#include "filename.h"
#include "tooltip.h"
static Definition *g_currentDefinition=0;
static MemberDef *g_currentMemberDef=0;
......@@ -611,10 +612,19 @@ static void codifyLines(CodeOutputInterface &ol,FileDef *fd,const char *text,
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
FileDef *fd,uint &line,uint &column,
const char *ref,const char *file,
const char *anchor,const char *text,
const char *tooltip)
Definition *d,
const char *text)
{
static bool sourceTooltips = Config_getBool("SOURCE_TOOLTIPS");
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
}
bool done=FALSE;
char *p=(char *)text;
while (!done)
......@@ -685,14 +695,7 @@ void ClangParser::linkMacro(CodeOutputInterface &ol,FileDef *fd,
{
if (md->isDefine())
{
writeMultiLineCodeLink(ol,
fd,line,column,
md->getReference(),
md->getOutputFileBase(),
md->anchor(),
text,
md->briefDescriptionAsTooltip()
);
writeMultiLineCodeLink(ol,fd,line,column,md,text);
return;
}
}
......@@ -738,14 +741,7 @@ void ClangParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd,
{
addDocCrossReference(g_currentMemberDef,(MemberDef*)d);
}
writeMultiLineCodeLink(ol,
fd,line,column,
d->getReference(),
d->getOutputFileBase(),
d->anchor(),
text,
d->briefDescriptionAsTooltip()
);
writeMultiLineCodeLink(ol,fd,line,column,d,text);
}
else
{
......@@ -786,6 +782,7 @@ 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;
......@@ -894,6 +891,7 @@ void ClangParser::writeSources(CodeOutputInterface &ol,FileDef *fd)
clang_disposeString(tokenString);
}
ol.endCodeLine();
TooltipManager::instance()->writeTooltips(ol);
}
ClangParser::ClangParser()
......
......@@ -3457,7 +3457,7 @@ QCString ClassDef::getSourceFileBase() const
}
else
{
return convertNameToFile(m_impl->fileName)+"_source";
return Definition::getSourceFileBase();
}
}
......
......@@ -40,6 +40,7 @@
#include "filedef.h"
#include "filename.h"
#include "namespacedef.h"
#include "tooltip.h"
// Toggle for some debugging info
//#define DBG_CTX(x) fprintf x
......@@ -597,10 +598,19 @@ static void codifyLines(const char *text)
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
const char *ref,const char *file,
const char *anchor,const char *text,
const char *tooltip)
Definition *d,
const char *text)
{
static bool sourceTooltips = Config_getBool("SOURCE_TOOLTIPS");
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
}
bool done=FALSE;
char *p=(char *)text;
while (!done)
......@@ -881,11 +891,7 @@ static bool getLinkInScope(const QCString &c, // scope
}
//printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
writeMultiLineCodeLink(ol,md->getReference(),
md->getOutputFileBase(),
md->anchor(),
text ? text : memberText,
md->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,md, text ? text : memberText);
addToSearchIndex(text ? text : memberText);
return TRUE;
}
......@@ -1004,7 +1010,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName
g_anchorCount++;
}
}
writeMultiLineCodeLink(ol,cd->getReference(),cd->getOutputFileBase(),cd->anchor(),clName,cd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,cd,clName);
addToSearchIndex(className);
g_theCallContext.setClass(cd);
if (md)
......@@ -1063,7 +1069,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName
{
text=clName;
}
writeMultiLineCodeLink(ol,md->getReference(),md->getOutputFileBase(),md->anchor(),text,md->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,md,text);
addToSearchIndex(clName);
if (g_currentMemberDef)
{
......@@ -1127,8 +1133,7 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,MemberDef *xmd,const
}
// write the actual link
writeMultiLineCodeLink(ol,xmd->getReference(),
xmd->getOutputFileBase(),xmd->anchor(),memName,xmd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,xmd,memName);
addToSearchIndex(memName);
return TRUE;
}
......@@ -1498,12 +1503,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx)
{
if (ctx->method && ctx->method->isLinkable())
{
writeMultiLineCodeLink(*g_code,
ctx->method->getReference(),
ctx->method->getOutputFileBase(),
ctx->method->anchor(),
pName->data(),
ctx->method->briefDescriptionAsTooltip());
writeMultiLineCodeLink(*g_code,ctx->method,pName->data());
if (g_currentMemberDef)
{
addDocCrossReference(g_currentMemberDef,ctx->method);
......@@ -1582,12 +1582,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx)
}
else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable
{
writeMultiLineCodeLink(*g_code,
ctx->objectVar->getReference(),
ctx->objectVar->getOutputFileBase(),
ctx->objectVar->anchor(),
pObject->data(),
ctx->objectVar->briefDescriptionAsTooltip());
writeMultiLineCodeLink(*g_code,ctx->objectVar,pObject->data());
if (g_currentMemberDef)
{
addDocCrossReference(g_currentMemberDef,ctx->objectVar);
......@@ -1599,12 +1594,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx)
) // object is class name
{
ClassDef *cd = ctx->objectType;
writeMultiLineCodeLink(*g_code,
cd->getReference(),
cd->getOutputFileBase(),
cd->anchor(),
pObject->data(),
cd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(*g_code,cd,pObject->data());
}
else // object still needs to be resolved
{
......@@ -1613,12 +1603,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx)
if (cd && cd->isLinkable())
{
if (ctx->objectType==0) ctx->objectType=cd;
writeMultiLineCodeLink(*g_code,
cd->getReference(),
cd->getOutputFileBase(),
cd->anchor(),
pObject->data(),
cd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(*g_code,cd,pObject->data());
}
else
{
......@@ -1978,7 +1963,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
//printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "<none>",found);
if (found)
{
g_code->writeCodeLink(fd->getReference(),fd->getOutputFileBase(),0,yytext,fd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(*g_code,fd,yytext);
}
else
{
......@@ -3559,6 +3544,7 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s,
//printf("***parseCode() exBlock=%d exName=%s fd=%p className=%s searchCtx=%s\n",
// exBlock,exName,fd,className,searchCtx?searchCtx->name().data():"<none>");
if (s.isEmpty()) return;
TooltipManager::instance()->clearTooltips();
if (g_codeClassSDict==0)
{
resetCCodeParserState();
......@@ -3637,6 +3623,10 @@ 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
......
......@@ -786,6 +786,13 @@ and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
link to the source code. Otherwise they will link to the documentation.
' defval='1'/>
<option type='bool' id='SOURCE_TOOLTIPS' docs='
If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
source code will show a tooltip with additional information such as prototype,
brief description and links to the definition and documentation. Since this will
make the HTML file larger and loading of large files a bit slower, you can opt
to disable this feature.
' defval='1' depends='SOURCE_BROWSER'/>
<option type='bool' id='USE_HTAGS' docs='
If the USE_HTAGS tag is set to YES then the references to source code
will point to the HTML generated by the htags(1) tool instead of doxygen
......
This diff is collapsed.
......@@ -867,24 +867,53 @@ bool readCodeFragment(const char *fileName,
return found;
}
QCString Definition::getSourceFileBase() const
{
ASSERT(definitionType()!=Definition::TypeFile); // file overloads this method
QCString fn;
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
if (sourceBrowser &&
m_impl->body && m_impl->body->startLine!=-1 && m_impl->body->fileDef)
{
fn = m_impl->body->fileDef->getSourceFileBase();
}
return fn;
}
QCString Definition::getSourceAnchor() const
{
QCString anchorStr;
if (m_impl->body && m_impl->body->startLine!=-1)
{
if (Htags::useHtags)
{
anchorStr.sprintf("L%d",m_impl->body->startLine);
}
else
{
anchorStr.sprintf("l%05d",m_impl->body->startLine);
}
}
return anchorStr;
}
/*! Write a reference to the source code defining this definition */
void Definition::writeSourceDef(OutputList &ol,const char *)
{
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
static bool latexSourceCode = Config_getBool("LATEX_SOURCE_CODE");
ol.pushGeneratorState();
//printf("Definition::writeSourceRef %d %p\n",bodyLine,bodyDef);
if (sourceBrowser &&
m_impl->body && m_impl->body->startLine!=-1 && m_impl->body->fileDef)
QCString fn = getSourceFileBase();
if (!fn.isEmpty())
{
QCString refText = theTranslator->trDefinedAtLineInSourceFile();
int lineMarkerPos = refText.find("@0");
int fileMarkerPos = refText.find("@1");
if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this.
{
QCString lineStr,anchorStr;
QCString lineStr;
lineStr.sprintf("%d",m_impl->body->startLine);
anchorStr.sprintf(Htags::useHtags ? "L%d" : "l%05d",m_impl->body->startLine);
QCString anchorStr = getSourceAnchor();
ol.startParagraph();
if (lineMarkerPos<fileMarkerPos) // line marker before file marker
{
......@@ -898,8 +927,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *)
ol.disable(OutputGenerator::Latex);
}
// write line link (HTML, LaTeX optionally)
ol.writeObjectLink(0,m_impl->body->fileDef->getSourceFileBase(),
anchorStr,lineStr);
ol.writeObjectLink(0,fn,anchorStr,lineStr);
ol.enableAll();
ol.disable(OutputGenerator::Html);
if (latexSourceCode)
......@@ -922,8 +950,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *)
ol.disable(OutputGenerator::Latex);
}
// write line link (HTML, LaTeX optionally)
ol.writeObjectLink(0,m_impl->body->fileDef->getSourceFileBase(),
0,m_impl->body->fileDef->name());
ol.writeObjectLink(0,fn,0,m_impl->body->fileDef->name());
ol.enableAll();
ol.disable(OutputGenerator::Html);
if (latexSourceCode)
......@@ -950,8 +977,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *)
ol.disable(OutputGenerator::Latex);
}
// write file link (HTML only)
ol.writeObjectLink(0,m_impl->body->fileDef->getSourceFileBase(),
0,m_impl->body->fileDef->name());
ol.writeObjectLink(0,fn,0,m_impl->body->fileDef->name());
ol.enableAll();
ol.disable(OutputGenerator::Html);
if (latexSourceCode)
......@@ -975,8 +1001,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *)
}
ol.disableAllBut(OutputGenerator::Html);
// write line link (HTML only)
ol.writeObjectLink(0,m_impl->body->fileDef->getSourceFileBase(),
anchorStr,lineStr);
ol.writeObjectLink(0,fn,anchorStr,lineStr);
ol.enableAll();
ol.disable(OutputGenerator::Html);
if (latexSourceCode)
......
......@@ -130,8 +130,11 @@ class Definition : public DefinitionIntf
/*! Returns the anchor within a page where this item can be found */
virtual QCString anchor() const = 0;
/*! Returns the name of the source listing of this file. */
virtual QCString getSourceFileBase() const { ASSERT(0); return "NULL"; }
/*! Returns the name of the source listing of this definition. */
virtual QCString getSourceFileBase() const;
/*! Returns the anchor of the source listing of this definition. */
virtual QCString getSourceAnchor() const;
/*! Returns the detailed description of this definition */
QCString documentation() const;
......
......@@ -208,6 +208,12 @@ class DocbookCodeGenerator : public CodeOutputInterface
writeDocbookLink(m_t,ref,file,anchor,name,tooltip);
col+=strlen(name);
}
void writeTooltip(const char *, const DocLinkInfo &, const char *,
const char *, const SourceLinkInfo &, const SourceLinkInfo &
)
{
Docbook_DB(("(writeToolTip)\n"));
}
void startCodeLine(bool)
{
Docbook_DB(("(startCodeLine)\n"));
......@@ -235,16 +241,6 @@ class DocbookCodeGenerator : public CodeOutputInterface
m_external.resize(0);
m_insideCodeLine=FALSE;
}
void startCodeAnchor(const char *id)
{
Docbook_DB(("(startCodeAnchor)\n"));
m_t << "<anchor id=\"" << id << "\">";
}
void endCodeAnchor()
{
Docbook_DB(("(endCodeAnchor)\n"));
m_t << "</anchor>";
}
void startFontClass(const char * /*colorClass*/)
{
Docbook_DB(("(startFontClass)\n"));
......
......@@ -141,11 +141,11 @@ a.el {
a.elRef {
}
a.code, a.code:visited {
a.code, a.code:visited, a.line, a.line:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited {
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #4665A2;
}
......@@ -1165,6 +1165,177 @@ tr.heading h2 {
margin-bottom: 4px;
}
/* tooltip related style info */
.ttc {
position: absolute;
display: none;
}
#powerTip {
cursor: default;
white-space: nowrap;
background-color: white;
border: 1px solid gray;
border-radius: 4px 4px 4px 4px;
box-shadow: 1px 1px 7px gray;
display: none;
font-size: smaller;
max-width: 80%;
opacity: 0.9;
padding: 1ex 1em 1em;
position: absolute;
z-index: 2147483647;
}
#powerTip div.ttdoc {
color: grey;
font-style: italic;
}
#powerTip div.ttname a {
font-weight: bold;
}
#powerTip div.ttname {
font-weight: bold;
}
#powerTip div.ttdeci {
color: #006318;
}
#powerTip div {
margin: 0px;
padding: 0px;
font: 12px/16px Roboto,sans-serif;
}
#powerTip:before, #powerTip:after {
content: "";
position: absolute;
margin: 0px;
}
#powerTip.n:after, #powerTip.n:before,
#powerTip.s:after, #powerTip.s:before,
#powerTip.w:after, #powerTip.w:before,
#powerTip.e:after, #powerTip.e:before,
#powerTip.ne:after, #powerTip.ne:before,
#powerTip.se:after, #powerTip.se:before,
#powerTip.nw:after, #powerTip.nw:before,
#powerTip.sw:after, #powerTip.sw:before {
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
}
#powerTip.n:after, #powerTip.s:after,
#powerTip.w:after, #powerTip.e:after,
#powerTip.nw:after, #powerTip.ne:after,
#powerTip.sw:after, #powerTip.se:after {
border-color: rgba(255, 255, 255, 0);
}
#powerTip.n:before, #powerTip.s:before,
#powerTip.w:before, #powerTip.e:before,
#powerTip.nw:before, #powerTip.ne:before,
#powerTip.sw:before, #powerTip.se:before {
border-color: rgba(128, 128, 128, 0);
}
#powerTip.n:after, #powerTip.n:before,
#powerTip.ne:after, #powerTip.ne:before,
#powerTip.nw:after, #powerTip.nw:before {
top: 100%;
}
#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after {
border-top-color: #ffffff;
border-width: 10px;
margin: 0px -10px;
}
#powerTip.n:before {
border-top-color: #808080;
border-width: 11px;
margin: 0px -11px;
}
#powerTip.n:after, #powerTip.n:before {
left: 50%;
}
#powerTip.nw:after, #powerTip.nw:before {
right: 14px;
}
#powerTip.ne:after, #powerTip.ne:before {
left: 14px;
}
#powerTip.s:after, #powerTip.s:before,
#powerTip.se:after, #powerTip.se:before,
#powerTip.sw:after, #powerTip.sw:before {
bottom: 100%;
}
#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after {
border-bottom-color: #ffffff;
border-width: 10px;
margin: 0px -10px;
}
#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before {
border-bottom-color: #808080;
border-width: 11px;
margin: 0px -11px;
}
#powerTip.s:after, #powerTip.s:before {
left: 50%;
}
#powerTip.sw:after, #powerTip.sw:before {
right: 14px;
}
#powerTip.se:after, #powerTip.se:before {
left: 14px;
}
#powerTip.e:after, #powerTip.e:before {
left: 100%;
}
#powerTip.e:after {
border-left-color: #ffffff;
border-width: 10px;
top: 50%;
margin-top: -10px;
}
#powerTip.e:before {
border-left-color: #808080;
border-width: 11px;
top: 50%;
margin-top: -11px;
}
#powerTip.w:after, #powerTip.w:before {
right: 100%;
}
#powerTip.w:after {
border-right-color: #ffffff;
border-width: 10px;
top: 50%;
margin-top: -10px;
}
#powerTip.w:before {
border-right-color: #808080;
border-width: 11px;
top: 50%;
margin-top: -11px;
}
@media print
{
#top { display: none; }
......
......@@ -141,11 +141,11 @@
"a.elRef {\n"
"}\n"
"\n"
"a.code, a.code:visited {\n"
"a.code, a.code:visited, a.line, a.line:visited {\n"
" color: #4665A2; \n"
"}\n"
"\n"
"a.codeRef, a.codeRef:visited {\n"
"a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {\n"
" color: #4665A2; \n"
"}\n"
"\n"
......@@ -1165,6 +1165,177 @@
" margin-bottom: 4px;\n"
"}\n"
"\n"
"/* tooltip related style info */\n"
"\n"
".ttc {\n"
" position: absolute;\n"
" display: none;\n"
"}\n"
"\n"
"#powerTip {\n"
" cursor: default;\n"
" white-space: nowrap;\n"
" background-color: white;\n"
" border: 1px solid gray;\n"
" border-radius: 4px 4px 4px 4px;\n"
" box-shadow: 1px 1px 7px gray;\n"
" display: none;\n"
" font-size: smaller;\n"
" max-width: 80%;\n"
" opacity: 0.9;\n"
" padding: 1ex 1em 1em;\n"
" position: absolute;\n"
" z-index: 2147483647;\n"
"}\n"
"\n"
"#powerTip div.ttdoc {\n"
" color: grey;\n"
" font-style: italic;\n"
"}\n"
"\n"
"#powerTip div.ttname a {\n"
" font-weight: bold;\n"
"}\n"
"\n"
"#powerTip div.ttname {\n"
" font-weight: bold;\n"
"}\n"
"\n"
"#powerTip div.ttdeci {\n"
" color: #006318;\n"
"}\n"
"\n"
"#powerTip div {\n"
" margin: 0px;\n"
" padding: 0px;\n"
" font: 12px/16px Roboto,sans-serif;\n"
"}\n"
"\n"
"#powerTip:before, #powerTip:after {\n"
" content: \"\";\n"
" position: absolute;\n"
" margin: 0px;\n"
"}\n"
"\n"
"#powerTip.n:after, #powerTip.n:before,\n"
"#powerTip.s:after, #powerTip.s:before,\n"
"#powerTip.w:after, #powerTip.w:before,\n"
"#powerTip.e:after, #powerTip.e:before,\n"
"#powerTip.ne:after, #powerTip.ne:before,\n"
"#powerTip.se:after, #powerTip.se:before,\n"
"#powerTip.nw:after, #powerTip.nw:before,\n"
"#powerTip.sw:after, #powerTip.sw:before {\n"
" border: solid transparent;\n"
" content: \" \";\n"
" height: 0;\n"
" width: 0;\n"
" position: absolute;\n"
"}\n"
"\n"
"#powerTip.n:after, #powerTip.s:after,\n"
"#powerTip.w:after, #powerTip.e:after,\n"
"#powerTip.nw:after, #powerTip.ne:after,\n"
"#powerTip.sw:after, #powerTip.se:after {\n"
" border-color: rgba(255, 255, 255, 0);\n"
"}\n"
"\n"
"#powerTip.n:before, #powerTip.s:before,\n"
"#powerTip.w:before, #powerTip.e:before,\n"
"#powerTip.nw:before, #powerTip.ne:before,\n"
"#powerTip.sw:before, #powerTip.se:before {\n"
" border-color: rgba(128, 128, 128, 0);\n"
"}\n"
"\n"
"#powerTip.n:after, #powerTip.n:before,\n"
"#powerTip.ne:after, #powerTip.ne:before,\n"
"#powerTip.nw:after, #powerTip.nw:before {\n"
" top: 100%;\n"
"}\n"
"\n"
"#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after {\n"
" border-top-color: #ffffff;\n"
" border-width: 10px;\n"
" margin: 0px -10px;\n"
"}\n"
"#powerTip.n:before {\n"
" border-top-color: #808080;\n"
" border-width: 11px;\n"
" margin: 0px -11px;\n"
"}\n"
"#powerTip.n:after, #powerTip.n:before {\n"
" left: 50%;\n"
"}\n"
"\n"
"#powerTip.nw:after, #powerTip.nw:before {\n"
" right: 14px;\n"
"}\n"
"\n"
"#powerTip.ne:after, #powerTip.ne:before {\n"
" left: 14px;\n"
"}\n"
"\n"
"#powerTip.s:after, #powerTip.s:before,\n"
"#powerTip.se:after, #powerTip.se:before,\n"
"#powerTip.sw:after, #powerTip.sw:before {\n"
" bottom: 100%;\n"
"}\n"
"\n"
"#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after {\n"
" border-bottom-color: #ffffff;\n"
" border-width: 10px;\n"
" margin: 0px -10px;\n"
"}\n"
"\n"
"#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before {\n"
" border-bottom-color: #808080;\n"
" border-width: 11px;\n"
" margin: 0px -11px;\n"
"}\n"
"\n"
"#powerTip.s:after, #powerTip.s:before {\n"
" left: 50%;\n"
"}\n"
"\n"
"#powerTip.sw:after, #powerTip.sw:before {\n"
" right: 14px;\n"
"}\n"
"\n"
"#powerTip.se:after, #powerTip.se:before {\n"
" left: 14px;\n"
"}\n"
"\n"
"#powerTip.e:after, #powerTip.e:before {\n"
" left: 100%;\n"
"}\n"
"#powerTip.e:after {\n"
" border-left-color: #ffffff;\n"
" border-width: 10px;\n"
" top: 50%;\n"
" margin-top: -10px;\n"
"}\n"
"#powerTip.e:before {\n"
" border-left-color: #808080;\n"
" border-width: 11px;\n"
" top: 50%;\n"
" margin-top: -11px;\n"
"}\n"
"\n"
"#powerTip.w:after, #powerTip.w:before {\n"
" right: 100%;\n"
"}\n"
"#powerTip.w:after {\n"
" border-right-color: #ffffff;\n"
" border-width: 10px;\n"
" top: 50%;\n"
" margin-top: -10px;\n"
"}\n"
"#powerTip.w:before {\n"
" border-right-color: #808080;\n"
" border-width: 11px;\n"
" top: 50%;\n"
" margin-top: -11px;\n"
"}\n"
"\n"
"@media print\n"
"{\n"
" #top { display: none; }\n"
......
......@@ -54,12 +54,13 @@ class DevNullCodeDocInterface : public CodeOutputInterface
virtual void writeCodeLink(const char *,const char *,
const char *,const char *,
const char *) {}
virtual void writeTooltip(const char *, const DocLinkInfo &, const char *,
const char *, const SourceLinkInfo &, const SourceLinkInfo &
) {}
virtual void writeLineNumber(const char *,const char *,
const char *,int) {}
virtual void startCodeLine(bool) {}
virtual void endCodeLine() {}
virtual void startCodeAnchor(const char *) {}
virtual void endCodeAnchor() {}
virtual void startFontClass(const char *) {}
virtual void endFontClass() {}
virtual void writeCodeAnchor(const char *) {}
......@@ -1645,14 +1646,7 @@ QCString FileDef::getSourceFileBase() const
/*! Returns the name of the verbatim copy of this file (if any). */
QCString FileDef::includeName() const
{
if (Htags::useHtags)
{
return Htags::path2URL(m_filePath);
}
else
{
return convertNameToFile(m_diskName)+"_source";
}
return getSourceFileBase();
}
MemberList *FileDef::createMemberList(MemberListType lt)
......
......@@ -49,6 +49,7 @@
#include "classlist.h"
#include "filedef.h"
#include "namespacedef.h"
#include "tooltip.h"
// Toggle for some debugging info
//#define DBG_CTX(x) fprintf x
......@@ -337,9 +338,18 @@ static void codifyLines(QCString str)
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
const char *ref,const char *file,
const char *anchor,const char *text)
Definition *d,const char *text)
{
static bool sourceTooltips = Config_getBool("SOURCE_TOOLTIPS");
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
}
bool done=FALSE;
char *p=(char *)text;
while (!done)
......@@ -352,7 +362,7 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol,
g_yyLineNr++;
*(p-1)='\0';
//printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
ol.writeCodeLink(ref,file,anchor,sp,0);
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
endCodeLine();
if (g_yyLineNr<g_inputLines)
{
......@@ -362,7 +372,7 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol,
else
{
//printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
ol.writeCodeLink(ref,file,anchor,sp,0);
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
done=TRUE;
}
}
......@@ -559,10 +569,7 @@ static bool getLink(UseSDict *usedict, // dictonary with used modules
{
addDocCrossReference(g_currentMemberDef,md);
}
writeMultiLineCodeLink(ol,md->getReference(),
md->getOutputFileBase(),
md->anchor(),
text ? text : memberText);
writeMultiLineCodeLink(ol,md,text ? text : memberText);
addToSearchIndex(text ? text : memberText);
return TRUE;
}
......@@ -587,7 +594,7 @@ static void generateLink(CodeOutputInterface &ol, char *lname)
}
else
{ // write type or interface link
writeMultiLineCodeLink(ol,cd->getReference(),cd->getOutputFileBase(),cd->anchor(),tmp);
writeMultiLineCodeLink(ol,cd,tmp);
addToSearchIndex(tmp.data());
}
}
......
......@@ -90,6 +90,10 @@ static const char search_jquery_script5[]=
#include "jquery_fx_js.h"
;
static const char search_jquery_script6[]=
#include "jquery_pt_js.h"
;
static const char svgpan_script[]=
#include "svgpan_js.h"
;
......@@ -1247,7 +1251,7 @@ void HtmlCodeGenerator::setRelativePath(const QCString &path)
void HtmlCodeGenerator::codify(const char *str)
{
static int tabSize = Config_getInt("TAB_SIZE");
if (str)
if (str && m_streamSet)
{
const char *p=str;
char c;
......@@ -1294,7 +1298,7 @@ void HtmlCodeGenerator::codify(const char *str)
void HtmlCodeGenerator::docify(const char *str)
{
if (str)
if (str && m_streamSet)
{
const char *p=str;
char c;
......@@ -1324,40 +1328,47 @@ void HtmlCodeGenerator::docify(const char *str)
void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename,
const char *anchor,int l)
{
if (!m_streamSet) return;
QCString lineNumber,lineAnchor;
lineNumber.sprintf("%5d",l);
lineAnchor.sprintf("l%05d",l);
m_t << "<div class=\"line\">";
m_t << "<a name=\"" << lineAnchor << "\"></a><span class=\"lineno\">";
if (filename)
{
startCodeAnchor(lineAnchor);
writeCodeLink(ref,filename,anchor,lineNumber,0);
endCodeAnchor();
_writeCodeLink("line",ref,filename,anchor,lineNumber,0);
}
else
{
startCodeAnchor(lineAnchor);
codify(lineNumber);
endCodeAnchor();
}
m_t << "</span>";
m_t << "&#160;";
}
void HtmlCodeGenerator::writeCodeLink(const char *ref,const char *f,
const char *anchor, const char *name,
const char *tooltip)
{
if (!m_streamSet) return;
//printf("writeCodeLink(ref=%s,f=%s,anchor=%s,name=%s,tooltip=%s)\n",ref,f,anchor,name,tooltip);
_writeCodeLink("code",ref,f,anchor,name,tooltip);
}
void HtmlCodeGenerator::_writeCodeLink(const char *className,
const char *ref,const char *f,
const char *anchor, const char *name,
const char *tooltip)
{
if (ref)
{
m_t << "<a class=\"codeRef\" ";
m_t << "<a class=\"" << className << "Ref\" ";
m_t << externalLinkTarget() << externalRef(m_relPath,ref,FALSE);
}
else
{
m_t << "<a class=\"code\" ";
m_t << "<a class=\"" << className << "\" ";
}
m_t << "href=\"";
m_t << externalRef(m_relPath,ref,TRUE);
......@@ -1371,29 +1382,102 @@ void HtmlCodeGenerator::writeCodeLink(const char *ref,const char *f,
m_col+=qstrlen(name);
}
void HtmlCodeGenerator::startCodeLine(bool hasLineNumbers)
{
if (!hasLineNumbers) m_t << "<div class=\"line\">";
m_col=0;
void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo,
const char *decl, const char *desc,
const SourceLinkInfo &defInfo,
const SourceLinkInfo &declInfo)
{
m_t << "<div class=\"ttc\" id=\"" << id << "\">";
m_t << "<div class=\"ttname\">";
if (!docInfo.url.isEmpty())
{
m_t << "<a href=\"";
m_t << externalRef(m_relPath,docInfo.ref,TRUE);
m_t << docInfo.url << Doxygen::htmlFileExtension;
if (!docInfo.anchor.isEmpty())
{
m_t << "#" << docInfo.anchor;
}
m_t << "\">";
}
docify(docInfo.name);
if (!docInfo.url.isEmpty())
{
m_t << "</a>";
}
m_t << "</div>";
if (decl)
{
m_t << "<div class=\"ttdeci\">";
docify(decl);
m_t << "</div>";
}
if (desc)
{
m_t << "<div class=\"ttdoc\">";
docify(desc);
m_t << "</div>";
}
if (!defInfo.file.isEmpty())
{
m_t << "<div class=\"ttdef\"><b>Definition:</b> ";
if (!defInfo.url.isEmpty())
{
m_t << "<a href=\"";
m_t << externalRef(m_relPath,defInfo.ref,TRUE);
m_t << defInfo.url << Doxygen::htmlFileExtension;
if (!defInfo.anchor.isEmpty())
{
m_t << "#" << defInfo.anchor;
}
m_t << "\">";
}
m_t << defInfo.file << ":" << defInfo.line;
if (!defInfo.url.isEmpty())
{
m_t << "</a>";
}
m_t << "</div>";
}
if (!declInfo.file.isEmpty())
{
m_t << "<div class=\"ttdecl\"><b>Declaration:</b> ";
if (!declInfo.url.isEmpty())
{
m_t << "<a href=\"";
m_t << externalRef(m_relPath,declInfo.ref,TRUE);
m_t << declInfo.url << Doxygen::htmlFileExtension;
if (!declInfo.anchor.isEmpty())
{
m_t << "#" << declInfo.anchor;
}
m_t << "\">";
}
m_t << declInfo.file << ":" << declInfo.line;
if (!declInfo.url.isEmpty())
{
m_t << "</a>";
}
m_t << "</div>";
}
m_t << "</div>" << endl;
}
void HtmlCodeGenerator::endCodeLine()
{
m_t << "</div>\n";
}
void HtmlCodeGenerator::startCodeAnchor(const char *label)
void HtmlCodeGenerator::startCodeLine(bool hasLineNumbers)
{
m_t << "<div class=\"line\">";
m_t << "<a name=\"" << label << "\"></a><span class=\"lineno\">";
if (m_streamSet)
{
if (!hasLineNumbers) m_t << "<div class=\"line\">";
m_col=0;
}
}
void HtmlCodeGenerator::endCodeAnchor()
void HtmlCodeGenerator::endCodeLine()
{
m_t << "</span>";
if (m_streamSet) m_t << "</div>\n";
}
void HtmlCodeGenerator::startFontClass(const char *s)
{
if (m_streamSet) m_t << "<span class=\"" << s << "\">";
......@@ -1484,6 +1568,10 @@ void HtmlGenerator::init()
{
t << search_jquery_script4 << search_jquery_script5;
}
if (Config_getBool("SOURCE_BROWSER"))
{
t << search_jquery_script6;
}
}
}
......@@ -1503,6 +1591,16 @@ void HtmlGenerator::init()
{
FTextStream t(&f);
t << dynsections_script;
if (Config_getBool("SOURCE_BROWSER") && Config_getBool("SOURCE_TOOLTIPS"))
{
t << endl <<
"$(document).ready(function() {\n"
" $('.code,.codeRef').each(function() {\n"
" $(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n"
" $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n"
" });\n"
"});\n";
}
}
}
}
......
......@@ -39,11 +39,16 @@ class HtmlCodeGenerator : public CodeOutputInterface
void writeCodeLink(const char *ref,const char *file,
const char *anchor,const char *name,
const char *tooltip);
void writeTooltip(const char *id,
const DocLinkInfo &docInfo,
const char *decl,
const char *desc,
const SourceLinkInfo &defInfo,
const SourceLinkInfo &declInfo
);
void writeLineNumber(const char *,const char *,const char *,int);
void startCodeLine(bool);
void endCodeLine();
void startCodeAnchor(const char *label);
void endCodeAnchor();
void startFontClass(const char *s);
void endFontClass();
void writeCodeAnchor(const char *anchor);
......@@ -51,6 +56,10 @@ class HtmlCodeGenerator : public CodeOutputInterface
void addWord(const char *,bool) {}
private:
void _writeCodeLink(const char *className,
const char *ref,const char *file,
const char *anchor,const char *name,
const char *tooltip);
void docify(const char *str);
bool m_streamSet;
FTextStream m_t;
......@@ -94,14 +103,14 @@ class HtmlGenerator : public OutputGenerator
{ m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); }
void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber)
{ m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); }
void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl,
const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo
)
{ m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); }
void startCodeLine(bool hasLineNumbers)
{ m_codeGen.startCodeLine(hasLineNumbers); }
void endCodeLine()
{ m_codeGen.endCodeLine(); }
void startCodeAnchor(const char *label)
{ m_codeGen.startCodeAnchor(label); }
void endCodeAnchor()
{ m_codeGen.endCodeAnchor(); }
void startFontClass(const char *s)
{ m_codeGen.startFontClass(s); }
void endFontClass()
......
/*!
PowerTip - v1.2.0 - 2013-04-03
http://stevenbenner.github.com/jquery-powertip/
Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).
Released under MIT license.
https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt
*/
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(k){var A=k(document),s=k(window),w=k("body");var n="displayController",e="hasActiveHover",d="forcedOpen",u="hasMouseMove",f="mouseOnToPopup",g="originalTitle",y="powertip",o="powertipjq",l="powertiptarget",E=180/Math.PI;var c={isTipOpen:false,isFixedTipOpen:false,isClosing:false,tipOpenImminent:false,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:false,delayInProgress:false,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0};var p={none:0,top:1,bottom:2,left:4,right:8};k.fn.powerTip=function(F,N){if(!this.length){return this}if(k.type(F)==="string"&&k.powerTip[F]){return k.powerTip[F].call(this,this,N)}var O=k.extend({},k.fn.powerTip.defaults,F),G=new x(O);h();this.each(function M(){var R=k(this),Q=R.data(y),P=R.data(o),T=R.data(l),S;if(R.data(n)){k.powerTip.destroy(R)}S=R.attr("title");if(!Q&&!T&&!P&&S){R.data(y,S);R.data(g,S);R.removeAttr("title")}R.data(n,new t(R,O,G))});if(!O.manual){this.on({"mouseenter.powertip":function J(P){k.powerTip.show(this,P)},"mouseleave.powertip":function L(){k.powerTip.hide(this)},"focus.powertip":function K(){k.powerTip.show(this)},"blur.powertip":function H(){k.powerTip.hide(this,true)},"keydown.powertip":function I(P){if(P.keyCode===27){k.powerTip.hide(this,true)}}})}return this};k.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false};k.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};k.powerTip={show:function z(F,G){if(G){i(G);c.previousX=G.pageX;c.previousY=G.pageY;k(F).data(n).show()}else{k(F).first().data(n).show(true,true)}return F},reposition:function r(F){k(F).first().data(n).resetPosition();return F},hide:function D(G,F){if(G){k(G).first().data(n).hide(F)}else{if(c.activeHover){c.activeHover.data(n).hide(true)}}return G},destroy:function C(G){k(G).off(".powertip").each(function F(){var I=k(this),H=[g,n,e,d];if(I.data(g)){I.attr("title",I.data(g));H.push(y)}I.removeData(H)});return G}};k.powerTip.showTip=k.powerTip.show;k.powerTip.closeTip=k.powerTip.hide;function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bottom="auto";F.set=function(H,G){if(k.isNumeric(G)){F[H]=Math.round(G)}}}function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c.tipOpenImminent=true;J=setTimeout(function O(){J=null;I()},N.intentPollInterval)}else{if(Q){K.data(d,true)}F.showTip(K)}}}function G(P){M();c.tipOpenImminent=false;if(K.data(e)){K.data(d,false);if(!P){c.delayInProgress=true;J=setTimeout(function O(){J=null;F.hideTip(K);c.delayInProgress=false},N.closeDelay)}else{F.hideTip(K)}}}function I(){var Q=Math.abs(c.previousX-c.currentX),O=Math.abs(c.previousY-c.currentY),P=Q+O;if(P<N.intentSensitivity){F.showTip(K)}else{c.previousX=c.currentX;c.previousY=c.currentY;L()}}function M(){J=clearTimeout(J);c.delayInProgress=false}function H(){F.resetPosition(K)}this.show=L;this.hide=G;this.cancel=M;this.resetPosition=H}function j(){function G(M,L,J,O,P){var K=L.split("-")[0],N=new b(),I;if(q(M)){I=H(M,K)}else{I=F(M,K)}switch(L){case"n":N.set("left",I.left-(J/2));N.set("bottom",c.windowHeight-I.top+P);break;case"e":N.set("left",I.left+P);N.set("top",I.top-(O/2));break;case"s":N.set("left",I.left-(J/2));N.set("top",I.top+P);break;case"w":N.set("top",I.top-(O/2));N.set("right",c.windowWidth-I.left+P);break;case"nw":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"nw-alt":N.set("left",I.left);N.set("bottom",c.windowHeight-I.top+P);break;case"ne":N.set("left",I.left-20);N.set("bottom",c.windowHeight-I.top+P);break;case"ne-alt":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left);break;case"sw":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"sw-alt":N.set("left",I.left);N.set("top",I.top+P);break;case"se":N.set("left",I.left-20);N.set("top",I.top+P);break;case"se-alt":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left);break}return N}function F(K,J){var O=K.offset(),N=K.outerWidth(),I=K.outerHeight(),M,L;switch(J){case"n":M=O.left+N/2;L=O.top;break;case"e":M=O.left+N;L=O.top+I/2;break;case"s":M=O.left+N/2;L=O.top+I;break;case"w":M=O.left;L=O.top+I/2;break;case"nw":M=O.left;L=O.top;break;case"ne":M=O.left+N;L=O.top;break;case"sw":M=O.left;L=O.top+I;break;case"se":M=O.left+N;L=O.top+I;break}return{top:L,left:M}}function H(O,K){var S=O.closest("svg")[0],N=O[0],W=S.createSVGPoint(),L=N.getBBox(),V=N.getScreenCTM(),M=L.width/2,Q=L.height/2,P=[],I=["nw","n","ne","e","se","s","sw","w"],U,X,R,T;function J(){P.push(W.matrixTransform(V))}W.x=L.x;W.y=L.y;J();W.x+=M;J();W.x+=M;J();W.y+=Q;J();W.y+=Q;J();W.x-=M;J();W.x-=M;J();W.y-=Q;J();if(P[0].y!==P[1].y||P[0].x!==P[7].x){X=Math.atan2(V.b,V.a)*E;R=Math.ceil(((X%360)-22.5)/45);if(R<1){R+=8}while(R--){I.push(I.shift())}}for(T=0;T<P.length;T++){if(I[T]===K){U=P[T];break}}return{top:U.y+c.scrollTop,left:U.x+c.scrollLeft}}this.compute=G}function x(Q){var P=new j(),O=k("#"+Q.popupId);if(O.length===0){O=k("<div/>",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.top<G||Math.abs(M.bottom-c.windowHeight)-K<G){H|=p.top}if(M.top+K>I||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.left<J||M.right+L>F){H|=p.left}if(M.left+L>F||M.right<J){H|=p.right}return H}function a(G){var F=0;while(G){G&=G-1;F++}return F}}));
\ No newline at end of file
This diff is collapsed.
......@@ -2053,6 +2053,8 @@ void LatexGenerator::endCodeFragment()
void LatexGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l)
{
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
if (m_prettyCode)
{
QCString lineNumber;
......@@ -2063,9 +2065,12 @@ void LatexGenerator::writeLineNumber(const char *ref,const char *fileName,const
QCString lineAnchor;
lineAnchor.sprintf("_l%05d",l);
lineAnchor.prepend(sourceFileName);
startCodeAnchor(lineAnchor);
//if (!m_prettyCode) return;
if (usePDFLatex && pdfHyperlinks)
{
t << "\\hypertarget{" << stripPath(lineAnchor) << "}{}";
}
writeCodeLink(ref,fileName,anchor,lineNumber,0);
endCodeAnchor();
}
else
{
......@@ -2101,21 +2106,6 @@ void LatexGenerator::endFontClass()
t << "}";
}
void LatexGenerator::startCodeAnchor(const char *name)
{
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
//if (!m_prettyCode) return;
if (usePDFLatex && pdfHyperlinks)
{
t << "\\hypertarget{" << stripPath(name) << "}{}";
}
}
void LatexGenerator::endCodeAnchor()
{
}
void LatexGenerator::startInlineHeader()
{
if (Config_getBool("COMPACT_LATEX"))
......
......@@ -87,6 +87,9 @@ class LatexGenerator : public OutputGenerator
void writeCodeLink(const char *ref, const char *file,
const char *anchor,const char *name,
const char *tooltip);
void writeTooltip(const char *, const DocLinkInfo &, const char *,
const char *, const SourceLinkInfo &, const SourceLinkInfo &
) {}
void startTextLink(const char *,const char *);
void endTextLink();
void startHtmlLink(const char *url);
......@@ -148,8 +151,6 @@ class LatexGenerator : public OutputGenerator
void endMemberDoc(bool);
void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
void endDoxyAnchor(const char *,const char *);
void startCodeAnchor(const char *);
void endCodeAnchor();
void writeChar(char c);
void writeLatexSpacing() { t << "\\hspace{0.3cm}"; }
void writeStartAnnoItem(const char *type,const char *file,
......
......@@ -72,6 +72,7 @@ HEADERS = arguments.h \
jquery_p3_js.h \
jquery_ui_js.h \
jquery_fx_js.h \
jquery_pt_js.h \
svgpan_js.h \
dynsections_js.h \
language.h \
......@@ -127,6 +128,7 @@ HEADERS = arguments.h \
tagreader.h \
tclscanner.h \
textdocvisitor.h \
tooltip.h \
translator.h \
translator_adapter.h \
translator_am.h \
......@@ -257,6 +259,7 @@ SOURCES = arguments.cpp \
tagreader.cpp \
tclscanner.cpp \
textdocvisitor.cpp \
tooltip.cpp \
translator.cpp \
util.cpp \
version.cpp \
......
......@@ -174,6 +174,9 @@ jquery_ui_js.h: jquery_ui.js
jquery_fx_js.h: jquery_fx.js
cat jquery_fx.js | $(TO_C_CMD) >jquery_fx_js.h
jquery_pt_js.h: jquery_pt.js
cat jquery_pt.js | $(TO_C_CMD) >jquery_pt_js.h
navtree_css.h: navtree.css
cat navtree.css | $(TO_C_CMD) >navtree_css.h
......
......@@ -84,6 +84,9 @@ class ManGenerator : public OutputGenerator
void writeCodeLink(const char *ref,const char *file,
const char *anchor,const char *name,
const char *tooltip);
void writeTooltip(const char *, const DocLinkInfo &, const char *,
const char *, const SourceLinkInfo &, const SourceLinkInfo &
) {}
void startTextLink(const char *,const char *) {}
void endTextLink() {}
void startHtmlLink(const char *url);
......@@ -145,8 +148,6 @@ class ManGenerator : public OutputGenerator
void endMemberDoc(bool);
void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
void endDoxyAnchor(const char *,const char *) {}
void startCodeAnchor(const char *) {}
void endCodeAnchor() {}
void writeLatexSpacing() {}
void writeStartAnnoItem(const char *type,const char *file,
const char *path,const char *name);
......
......@@ -37,13 +37,31 @@ class GroupDef;
class Definition;
class QFile;
struct DocLinkInfo
{
QCString name;
QCString ref;
QCString url;
QCString anchor;
};
struct SourceLinkInfo
{
QCString file;
int line;
QCString ref;
QCString url;
QCString anchor;
};
/** Output interface for code parser.
*/
class CodeOutputInterface
{
public:
virtual ~CodeOutputInterface() {}
/*! Writes an ASCII string to the output. This function should keep
/*! Writes an code fragment to the output. This function should keep
* spaces visible, should break lines at a newline and should convert
* tabs to the right number of spaces.
*/
......@@ -62,15 +80,50 @@ class CodeOutputInterface
const char *anchor,const char *name,
const char *tooltip) = 0;
/*! Writes the line number of a source listing
* \param ref External reference (when imported from a tag file)
* \param file The file part of the URL pointing to the docs.
* \param anchor The anchor part of the URL pointing to the docs.
* \param lineNumber The line number to write
*/
virtual void writeLineNumber(const char *ref,const char *file,
const char *anchor,int lineNumber) = 0;
/*! Writes a tool tip definition
* \param id unique identifier for the tooltip
* \param docInfo Info about the symbol's documentation.
* \param decl full declaration of the symbol (for functions)
* \param desc brief description for the symbol
* \param defInfo Info about the symbol's definition in the source code
* \param declInfo Info about the symbol's declaration in the source code
*/
virtual void writeTooltip(const char *id,
const DocLinkInfo &docInfo,
const char *decl,
const char *desc,
const SourceLinkInfo &defInfo,
const SourceLinkInfo &declInfo
) = 0;
virtual void startCodeLine(bool hasLineNumbers) = 0;
/*! Ends a line of code started with startCodeLine() */
virtual void endCodeLine() = 0;
virtual void startCodeAnchor(const char *label) = 0;
virtual void endCodeAnchor() = 0;
virtual void startFontClass(const char *) = 0;
/*! Starts a block with a certain meaning. Used for syntax highlighting,
* which elements of the same type are rendered using the same 'font class'.
* \param clsName The category name.
*/
virtual void startFontClass(const char *clsName) = 0;
/*! Ends a block started with startFontClass() */
virtual void endFontClass() = 0;
/*! Write an anchor to a source listing.
* \param name The name of the anchor.
*/
virtual void writeCodeAnchor(const char *name) = 0;
virtual void setCurrentDoc(Definition *context,const char *anchor,bool isSourceFile) = 0;
virtual void addWord(const char *word,bool hiPriority) = 0;
};
......
......@@ -291,6 +291,31 @@ void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6),a1,a2,a
} \
}
// seven arguments
#define FORALL7(a1,a2,a3,a4,a5,a6,a7,p1,p2,p3,p4,p5,p6,p7) \
void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7),a1,a2,a3,a4,a5,a6,a7) \
{ \
OutputGenerator *og=outputs->first(); \
while (og) \
{ \
if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7); \
og=outputs->next(); \
} \
}
// eight arguments
#define FORALL8(a1,a2,a3,a4,a5,a6,a7,a8,p1,p2,p3,p4,p5,p6,p7,p8) \
void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7,a8),a1,a2,a3,a4,a5,a6,a7,a8) \
{ \
OutputGenerator *og=outputs->first(); \
while (og) \
{ \
if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7,p8); \
og=outputs->next(); \
} \
}
// now instantiate only the ones we need.
FORALL1(const char *a1,a1)
......@@ -332,6 +357,7 @@ FORALL4(const char *a1,const char *a2,const char *a3,int a4,a1,a2,a3,a4)
FORALL5(const char *a1,const char *a2,const char *a3,const char *a4,const char *a5,a1,a2,a3,a4,a5)
FORALL5(const char *a1,const char *a2,const char *a3,const char *a4,bool a5,a1,a2,a3,a4,a5)
FORALL6(const char *a1,const char *a2,const char *a3,const char *a4,const char *a5,const char *a6,a1,a2,a3,a4,a5,a6)
FORALL6(const char *a1,const DocLinkInfo &a2,const char *a3,const char *a4,const SourceLinkInfo &a5,const SourceLinkInfo &a6,a1,a2,a3,a4,a5,a6)
//--------------------------------------------------------------------------
......@@ -34,6 +34,10 @@
void forall(void (OutputGenerator::*func)(arg1,arg2,arg3,arg4,arg5),arg1,arg2,arg3,arg4,arg5)
#define FORALLPROTO6(arg1,arg2,arg3,arg4,arg5,arg6) \
void forall(void (OutputGenerator::*func)(arg1,arg2,arg3,arg4,arg5,arg6),arg1,arg2,arg3,arg4,arg5,arg6)
#define FORALLPROTO7(arg1,arg2,arg3,arg4,arg5,arg6,arg7) \
void forall(void (OutputGenerator::*func)(arg1,arg2,arg3,arg4,arg5,arg6,arg7),arg1,arg2,arg3,arg4,arg5,arg6,arg7)
#define FORALLPROTO8(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \
void forall(void (OutputGenerator::*func)(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8),arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
class ClassDiagram;
class DotClassGraph;
......@@ -149,6 +153,9 @@ class OutputList : public OutputDocInterface
const char *anchor,const char *name,
const char *tooltip)
{ forall(&OutputGenerator::writeCodeLink,ref,file,anchor,name,tooltip); }
void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl,
const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo)
{ forall(&OutputGenerator::writeTooltip,id,docInfo,decl,desc,defInfo,declInfo); }
void startTextLink(const char *file,const char *anchor)
{ forall(&OutputGenerator::startTextLink,file,anchor); }
void endTextLink()
......@@ -262,10 +269,6 @@ class OutputList : public OutputDocInterface
{ forall(&OutputGenerator::startDoxyAnchor,fName,manName,anchor,name,args); }
void endDoxyAnchor(const char *fn,const char *anchor)
{ forall(&OutputGenerator::endDoxyAnchor,fn,anchor); }
void startCodeAnchor(const char *label)
{ forall(&OutputGenerator::startCodeAnchor,label); }
void endCodeAnchor()
{ forall(&OutputGenerator::endCodeAnchor); }
void writeLatexSpacing()
{ forall(&OutputGenerator::writeLatexSpacing); }
void startDescription()
......@@ -542,6 +545,7 @@ class OutputList : public OutputDocInterface
FORALLPROTO5(const char *,const char *,const char *,const char *,const char *);
FORALLPROTO5(const char *,const char *,const char *,const char *,bool);
FORALLPROTO6(const char *,const char *,const char *,const char *,const char *,const char *);
FORALLPROTO6(const char *,const DocLinkInfo &,const char *,const char *,const SourceLinkInfo &,const SourceLinkInfo &);
OutputList(const OutputList &ol);
QList<OutputGenerator> *outputs;
......
......@@ -42,6 +42,7 @@
#include "classlist.h"
#include "filedef.h"
#include "namespacedef.h"
#include "tooltip.h"
// Toggle for some debugging info
//#define DBG_CTX(x) fprintf x
......@@ -429,10 +430,19 @@ static void nextCodeLine()
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
const char *ref,const char *file,
const char *anchor,const char *text,
const char *tooltip)
Definition *d,
const char *text)
{
static bool sourceTooltips = Config_getBool("SOURCE_TOOLTIPS");
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
}
bool done=FALSE;
char *p=(char *)text;
while (!done)
......@@ -549,11 +559,7 @@ static bool getLinkInScope(const QCString &c, // scope
}
//printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
writeMultiLineCodeLink(ol,md->getReference(),
md->getOutputFileBase(),
md->anchor(),
text ? text : memberText,
md->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,md, text ? text : memberText);
addToSearchIndex(text ? text : memberText);
return TRUE;
}
......@@ -617,7 +623,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
NamespaceDef *nd = getResolvedNamespace(scope);
if (nd)
{
writeMultiLineCodeLink(ol,nd->getReference(),nd->getOutputFileBase(),nd->anchor(),clName,nd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,nd,clName);
addToSearchIndex(className);
return;
}
......@@ -639,7 +645,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
if (cd && cd->isLinkable()) // is it a linkable class
{
writeMultiLineCodeLink(ol,cd->getReference(),cd->getOutputFileBase(),cd->anchor(),clName,cd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,cd,clName);
addToSearchIndex(className);
if (md)
{
......@@ -667,7 +673,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
if (md)
{
g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
writeMultiLineCodeLink(ol,md->getReference(),md->getOutputFileBase(),md->anchor(),clName,md->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,md,clName);
addToSearchIndex(className);
Definition *d = md->getOuterScope()==Doxygen::globalScope ?
md->getBodyDef() : md->getOuterScope();
......@@ -689,7 +695,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
{
//printf("name=%s scope=%s\n",locName.data(),scope.data());
g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
writeMultiLineCodeLink(ol,md->getReference(),md->getOutputFileBase(),md->anchor(),clName,md->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,md,clName);
addToSearchIndex(className);
Definition *d = md->getOuterScope()==Doxygen::globalScope ?
md->getBodyDef() : md->getOuterScope();
......@@ -765,7 +771,6 @@ static bool findMemberLink(CodeOutputInterface &ol,Definition *sym,const char *s
{
ClassDef *cd = (ClassDef*)sym->getOuterScope();
ClassDef *thisCd = (ClassDef *)g_currentDefinition;
QCString anchor=sym->anchor();
if (sym->definitionType()==Definition::TypeMember)
{
if (g_currentMemberDef)
......@@ -779,11 +784,7 @@ static bool findMemberLink(CodeOutputInterface &ol,Definition *sym,const char *s
// thisCd
if (cd==thisCd || (thisCd && thisCd->isBaseClass(cd,TRUE)))
{
writeMultiLineCodeLink(ol,sym->getReference(),
sym->getOutputFileBase(),
anchor,
symName,
sym->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,sym,symName);
return TRUE;
}
}
......@@ -1458,6 +1459,7 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/,
//--------------------------------------
if (s.isEmpty()) return;
TooltipManager::instance()->clearTooltips();
g_code = &od;
g_inputString = s;
g_inputPosition = 0;
......@@ -1506,6 +1508,10 @@ 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
......
......@@ -84,6 +84,9 @@ class RTFGenerator : public OutputGenerator
void writeCodeLink(const char *ref, const char *file,
const char *anchor,const char *name,
const char *tooltip);
void writeTooltip(const char *, const DocLinkInfo &, const char *,
const char *, const SourceLinkInfo &, const SourceLinkInfo &
) {}
void startTextLink(const char *f,const char *anchor);
void endTextLink();
void startHtmlLink(const char *url);
......@@ -139,8 +142,6 @@ class RTFGenerator : public OutputGenerator
void endMemberDoc(bool);
void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *);
void endDoxyAnchor(const char *,const char *);
void startCodeAnchor(const char *) {};
void endCodeAnchor() {};
void writeChar(char c);
void writeLatexSpacing() {};//{ t << "\\hspace{0.3cm}"; }
void writeStartAnnoItem(const char *type,const char *file,
......
......@@ -2,7 +2,7 @@
#define SETTINGS_H
#define USE_SQLITE3 0
#define USE_LIBCLANG 0
#define USE_LIBCLANG 1
#define IS_SUPPORTED(x) \
((USE_SQLITE3 && strcmp("USE_SQLITE3",(x))==0) || \
......
/******************************************************************************
*
* Copyright (C) 1997-2013 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
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#include <qdict.h>
#include "tooltip.h"
#include "definition.h"
#include "outputgen.h"
#include "util.h"
#include "filedef.h"
#include "doxygen.h"
#include "config.h"
class TooltipManager::Private
{
public:
Private() : tooltipInfo(10007) {}
QDict<Definition> tooltipInfo;
};
TooltipManager *TooltipManager::s_theInstance = 0;
TooltipManager::TooltipManager()
{
p = new Private;
}
TooltipManager::~TooltipManager()
{
delete p;
}
TooltipManager *TooltipManager::instance()
{
if (!s_theInstance)
{
s_theInstance = new TooltipManager;
}
return s_theInstance;
}
void TooltipManager::clearTooltips()
{
p->tooltipInfo.clear();
}
static QCString escapeId(const char *s)
{
QCString res=s;
char *p=res.data();
while (*p)
{
if (!isId(*p)) *p='_';
p++;
}
return res;
}
void TooltipManager::addTooltip(Definition *d)
{
static bool sourceTooltips = Config_getBool("SOURCE_TOOLTIPS");
if (!sourceTooltips) return;
QCString id = d->getOutputFileBase();
int i=id.findRev('/');
if (i!=-1)
{
id = id.right(id.length()-i-1); // strip path (for CREATE_SUBDIRS=YES)
}
id+=escapeId(Doxygen::htmlFileExtension);
QCString anc = d->anchor();
if (!anc.isEmpty())
{
id+="_"+anc;
}
if (p->tooltipInfo.find(id)==0)
{
p->tooltipInfo.insert(id,d);
}
}
void TooltipManager::writeTooltips(CodeOutputInterface &ol)
{
QDictIterator<Definition> di(p->tooltipInfo);
Definition *d;
for (di.toFirst();(d=di.current());++di)
{
DocLinkInfo docInfo;
docInfo.name = d->qualifiedName();
docInfo.ref = d->getReference();
docInfo.url = d->getOutputFileBase();
docInfo.anchor = d->anchor();
SourceLinkInfo defInfo;
if (d->getBodyDef() && d->getStartBodyLine()!=-1)
{
defInfo.file = d->getBodyDef()->name();
defInfo.line = d->getStartBodyLine();
defInfo.url = d->getSourceFileBase();
defInfo.anchor = d->getSourceAnchor();
}
SourceLinkInfo declInfo; // TODO: fill in...
QCString decl;
if (d->definitionType()==Definition::TypeMember)
{
MemberDef *md = (MemberDef*)d;
decl = md->declaration();
if (!decl.isEmpty() && decl.at(0)=='@') // hide enum values
{
decl.resize(0);
}
}
ol.writeTooltip(di.currentKey(), // id
docInfo, // symName
decl, // decl
d->briefDescriptionAsTooltip(), // desc
defInfo,
declInfo
);
}
}
/******************************************************************************
*
* Copyright (C) 1997-2013 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
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef TOOLTIP_H
#define TOOLTIP_H
class Definition;
class CodeOutputInterface;
class TooltipManager
{
public:
static TooltipManager *instance();
void clearTooltips();
void addTooltip(Definition *d);
void writeTooltips(CodeOutputInterface &ol);
private:
class Private;
Private *p;
TooltipManager();
~TooltipManager();
static TooltipManager *s_theInstance;
};
#endif
......@@ -42,6 +42,7 @@
#include "config.h"
#include "classdef.h"
#include "filedef.h"
#include "tooltip.h"
#define YY_NEVER_INTERACTIVE 1
#define YY_NO_INPUT 1
......@@ -395,10 +396,19 @@ static void codifyLines(const char *text,const char *cl=0,bool classlink=FALSE,b
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(CodeOutputInterface &ol,
const char *ref,const char *file,
const char *anchor,const char *text,
const char *tooltip)
Definition *d,
const char *text)
{
static bool sourceTooltips = Config_getBool("SOURCE_TOOLTIPS");
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
}
bool done=FALSE;
char *p=(char *)text;
while (!done)
......@@ -455,11 +465,7 @@ static void generateFuncLink(CodeOutputInterface &ol,MemberDef* mdef)
if (mdef && mdef->isLinkable()) // is it a linkable class
{
writeMultiLineCodeLink(ol,mdef->getReference(),
mdef->getOutputFileBase(),
mdef->anchor(),
mdef->name(),
mdef->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,mdef,mdef->name());
addToSearchIndex(memberName);
return;
}
......@@ -496,11 +502,7 @@ static void generateMemLink(CodeOutputInterface &ol,QCString &clName,QCString& m
if (md && md->isLinkable()) // is it a linkable class
{
writeMultiLineCodeLink(ol,md->getReference(),
md->getOutputFileBase(),
md->anchor(),
memberName,
md->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,md,memberName);
addToSearchIndex(memberName);
return;
}
......@@ -532,11 +534,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName
//{
// temp=VhdlDocGen::getClassName(cd);
//}
writeMultiLineCodeLink(ol,cd->getReference(),
cd->getOutputFileBase(),
cd->anchor(),
temp,
cd->briefDescriptionAsTooltip());
writeMultiLineCodeLink(ol,cd,temp);
addToSearchIndex(className);
return;
}
......@@ -1518,6 +1516,7 @@ 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;
TooltipManager::instance()->clearTooltips();
if (memberDef)
{
ClassDef *dd=memberDef->getClassDef();
......@@ -1588,6 +1587,10 @@ 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
......
......@@ -257,6 +257,12 @@ class XMLCodeGenerator : public CodeOutputInterface
writeXMLLink(m_t,ref,file,anchor,name,tooltip);
col+=qstrlen(name);
}
void writeTooltip(const char *, const DocLinkInfo &, const char *,
const char *, const SourceLinkInfo &, const SourceLinkInfo &
)
{
XML_DB(("(writeToolTip)\n"));
}
void startCodeLine(bool)
{
XML_DB(("(startCodeLine)\n"));
......@@ -299,21 +305,6 @@ class XMLCodeGenerator : public CodeOutputInterface
m_external.resize(0);
m_insideCodeLine=FALSE;
}
void startCodeAnchor(const char *id)
{
XML_DB(("(startCodeAnchor)\n"));
if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag)
{
m_t << "<highlight class=\"normal\">";
m_normalHLNeedStartTag=FALSE;
}
m_t << "<anchor id=\"" << id << "\">";
}
void endCodeAnchor()
{
XML_DB(("(endCodeAnchor)\n"));
m_t << "</anchor>";
}
void startFontClass(const char *colorClass)
{
XML_DB(("(startFontClass)\n"));
......
......@@ -3258,6 +3258,10 @@
RelativePath="..\src\textdocvisitor.cpp"
>
</File>
<File
RelativePath="..\src\tooltip.cpp"
>
</File>
<File
RelativePath="..\src\translator.cpp"
>
......@@ -4013,6 +4017,10 @@
RelativePath="..\src\textdocvisitor.h"
>
</File>
<File
RelativePath="..\src\tooltip.h"
>
</File>
<File
RelativePath="..\src\translator.h"
>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment