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
......
/*!
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(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function($) {
// useful private variables
var $document = $(document),
$window = $(window),
$body = $('body');
// constants
var DATA_DISPLAYCONTROLLER = 'displayController',
DATA_HASACTIVEHOVER = 'hasActiveHover',
DATA_FORCEDOPEN = 'forcedOpen',
DATA_HASMOUSEMOVE = 'hasMouseMove',
DATA_MOUSEONTOTIP = 'mouseOnToPopup',
DATA_ORIGINALTITLE = 'originalTitle',
DATA_POWERTIP = 'powertip',
DATA_POWERTIPJQ = 'powertipjq',
DATA_POWERTIPTARGET = 'powertiptarget',
RAD2DEG = 180 / Math.PI;
/**
* Session data
* Private properties global to all powerTip instances
*/
var session = {
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
};
/**
* Collision enumeration
* @enum {number}
*/
var Collision = {
none: 0,
top: 1,
bottom: 2,
left: 4,
right: 8
};
/**
* Display hover tooltips on the matched elements.
* @param {(Object|string)} opts The options object to use for the plugin, or
* the name of a method to invoke on the first matched element.
* @param {*=} [arg] Argument for an invoked method (optional).
* @return {jQuery} jQuery object for the matched selectors.
*/
$.fn.powerTip = function(opts, arg) {
// don't do any work if there were no matched elements
if (!this.length) {
return this;
}
// handle api method calls on the plugin, e.g. powerTip('hide')
if ($.type(opts) === 'string' && $.powerTip[opts]) {
return $.powerTip[opts].call(this, this, arg);
}
// extend options and instantiate TooltipController
var options = $.extend({}, $.fn.powerTip.defaults, opts),
tipController = new TooltipController(options);
// hook mouse and viewport dimension tracking
initTracking();
// setup the elements
this.each(function elementSetup() {
var $this = $(this),
dataPowertip = $this.data(DATA_POWERTIP),
dataElem = $this.data(DATA_POWERTIPJQ),
dataTarget = $this.data(DATA_POWERTIPTARGET),
title;
// handle repeated powerTip calls on the same element by destroying the
// original instance hooked to it and replacing it with this call
if ($this.data(DATA_DISPLAYCONTROLLER)) {
$.powerTip.destroy($this);
}
// attempt to use title attribute text if there is no data-powertip,
// data-powertipjq or data-powertiptarget. If we do use the title
// attribute, delete the attribute so the browser will not show it
title = $this.attr('title');
if (!dataPowertip && !dataTarget && !dataElem && title) {
$this.data(DATA_POWERTIP, title);
$this.data(DATA_ORIGINALTITLE, title);
$this.removeAttr('title');
}
// create hover controllers for each element
$this.data(
DATA_DISPLAYCONTROLLER,
new DisplayController($this, options, tipController)
);
});
// attach events to matched elements if the manual options is not enabled
if (!options.manual) {
this.on({
// mouse events
'mouseenter.powertip': function elementMouseEnter(event) {
$.powerTip.show(this, event);
},
'mouseleave.powertip': function elementMouseLeave() {
$.powerTip.hide(this);
},
// keyboard events
'focus.powertip': function elementFocus() {
$.powerTip.show(this);
},
'blur.powertip': function elementBlur() {
$.powerTip.hide(this, true);
},
'keydown.powertip': function elementKeyDown(event) {
// close tooltip when the escape key is pressed
if (event.keyCode === 27) {
$.powerTip.hide(this, true);
}
}
});
}
return this;
};
/**
* Default options for the powerTip plugin.
*/
$.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
};
/**
* Default smart placement priority lists.
* The first item in the array is the highest priority, the last is the lowest.
* The last item is also the default, which will be used if all previous options
* do not fit.
*/
$.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']
};
/**
* Public API
*/
$.powerTip = {
/**
* Attempts to show the tooltip for the specified element.
* @param {jQuery|Element} element The element to open the tooltip for.
* @param {jQuery.Event=} event jQuery event for hover intent and mouse
* tracking (optional).
*/
show: function apiShowTip(element, event) {
if (event) {
trackMouse(event);
session.previousX = event.pageX;
session.previousY = event.pageY;
$(element).data(DATA_DISPLAYCONTROLLER).show();
} else {
$(element).first().data(DATA_DISPLAYCONTROLLER).show(true, true);
}
return element;
},
/**
* Repositions the tooltip on the element.
* @param {jQuery|Element} element The element the tooltip is shown for.
*/
reposition: function apiResetPosition(element) {
$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();
return element;
},
/**
* Attempts to close any open tooltips.
* @param {(jQuery|Element)=} element The element with the tooltip that
* should be closed (optional).
* @param {boolean=} immediate Disable close delay (optional).
*/
hide: function apiCloseTip(element, immediate) {
if (element) {
$(element).first().data(DATA_DISPLAYCONTROLLER).hide(immediate);
} else {
if (session.activeHover) {
session.activeHover.data(DATA_DISPLAYCONTROLLER).hide(true);
}
}
return element;
},
/**
* Destroy and roll back any powerTip() instance on the specified element.
* @param {jQuery|Element} element The element with the powerTip instance.
*/
destroy: function apiDestroy(element) {
$(element).off('.powertip').each(function destroy() {
var $this = $(this),
dataAttributes = [
DATA_ORIGINALTITLE,
DATA_DISPLAYCONTROLLER,
DATA_HASACTIVEHOVER,
DATA_FORCEDOPEN
];
if ($this.data(DATA_ORIGINALTITLE)) {
$this.attr('title', $this.data(DATA_ORIGINALTITLE));
dataAttributes.push(DATA_POWERTIP);
}
$this.removeData(dataAttributes);
});
return element;
}
};
// API aliasing
$.powerTip.showTip = $.powerTip.show;
$.powerTip.closeTip = $.powerTip.hide;
/**
* Creates a new CSSCoordinates object.
* @private
* @constructor
*/
function CSSCoordinates() {
var me = this;
// initialize object properties
me.top = 'auto';
me.left = 'auto';
me.right = 'auto';
me.bottom = 'auto';
/**
* Set a property to a value.
* @private
* @param {string} property The name of the property.
* @param {number} value The value of the property.
*/
me.set = function(property, value) {
if ($.isNumeric(value)) {
me[property] = Math.round(value);
}
};
}
/**
* Creates a new tooltip display controller.
* @private
* @constructor
* @param {jQuery} element The element that this controller will handle.
* @param {Object} options Options object containing settings.
* @param {TooltipController} tipController The TooltipController object for
* this instance.
*/
function DisplayController(element, options, tipController) {
var hoverTimer = null;
/**
* Begins the process of showing a tooltip.
* @private
* @param {boolean=} immediate Skip intent testing (optional).
* @param {boolean=} forceOpen Ignore cursor position and force tooltip to
* open (optional).
*/
function openTooltip(immediate, forceOpen) {
cancelTimer();
if (!element.data(DATA_HASACTIVEHOVER)) {
if (!immediate) {
session.tipOpenImminent = true;
hoverTimer = setTimeout(
function intentDelay() {
hoverTimer = null;
checkForIntent();
},
options.intentPollInterval
);
} else {
if (forceOpen) {
element.data(DATA_FORCEDOPEN, true);
}
tipController.showTip(element);
}
}
}
/**
* Begins the process of closing a tooltip.
* @private
* @param {boolean=} disableDelay Disable close delay (optional).
*/
function closeTooltip(disableDelay) {
cancelTimer();
session.tipOpenImminent = false;
if (element.data(DATA_HASACTIVEHOVER)) {
element.data(DATA_FORCEDOPEN, false);
if (!disableDelay) {
session.delayInProgress = true;
hoverTimer = setTimeout(
function closeDelay() {
hoverTimer = null;
tipController.hideTip(element);
session.delayInProgress = false;
},
options.closeDelay
);
} else {
tipController.hideTip(element);
}
}
}
/**
* Checks mouse position to make sure that the user intended to hover on the
* specified element before showing the tooltip.
* @private
*/
function checkForIntent() {
// calculate mouse position difference
var xDifference = Math.abs(session.previousX - session.currentX),
yDifference = Math.abs(session.previousY - session.currentY),
totalDifference = xDifference + yDifference;
// check if difference has passed the sensitivity threshold
if (totalDifference < options.intentSensitivity) {
tipController.showTip(element);
} else {
// try again
session.previousX = session.currentX;
session.previousY = session.currentY;
openTooltip();
}
}
/**
* Cancels active hover timer.
* @private
*/
function cancelTimer() {
hoverTimer = clearTimeout(hoverTimer);
session.delayInProgress = false;
}
/**
* Repositions the tooltip on this element.
* @private
*/
function repositionTooltip() {
tipController.resetPosition(element);
}
// expose the methods
this.show = openTooltip;
this.hide = closeTooltip;
this.cancel = cancelTimer;
this.resetPosition = repositionTooltip;
}
/**
* Creates a new Placement Calculator.
* @private
* @constructor
*/
function PlacementCalculator() {
/**
* Compute the CSS position to display a tooltip at the specified placement
* relative to the specified element.
* @private
* @param {jQuery} element The element that the tooltip should target.
* @param {string} placement The placement for the tooltip.
* @param {number} tipWidth Width of the tooltip element in pixels.
* @param {number} tipHeight Height of the tooltip element in pixels.
* @param {number} offset Distance to offset tooltips in pixels.
* @return {CSSCoordinates} A CSSCoordinates object with the position.
*/
function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
var placementBase = placement.split('-')[0], // ignore 'alt' for corners
coords = new CSSCoordinates(),
position;
if (isSvgElement(element)) {
position = getSvgPlacement(element, placementBase);
} else {
position = getHtmlPlacement(element, placementBase);
}
// calculate the appropriate x and y position in the document
switch (placement) {
case 'n':
coords.set('left', position.left - (tipWidth / 2));
coords.set('bottom', session.windowHeight - position.top + offset);
break;
case 'e':
coords.set('left', position.left + offset);
coords.set('top', position.top - (tipHeight / 2));
break;
case 's':
coords.set('left', position.left - (tipWidth / 2));
coords.set('top', position.top + offset);
break;
case 'w':
coords.set('top', position.top - (tipHeight / 2));
coords.set('right', session.windowWidth - position.left + offset);
break;
case 'nw':
coords.set('bottom', session.windowHeight - position.top + offset);
coords.set('right', session.windowWidth - position.left - 20);
break;
case 'nw-alt':
coords.set('left', position.left);
coords.set('bottom', session.windowHeight - position.top + offset);
break;
case 'ne':
coords.set('left', position.left - 20);
coords.set('bottom', session.windowHeight - position.top + offset);
break;
case 'ne-alt':
coords.set('bottom', session.windowHeight - position.top + offset);
coords.set('right', session.windowWidth - position.left);
break;
case 'sw':
coords.set('top', position.top + offset);
coords.set('right', session.windowWidth - position.left - 20);
break;
case 'sw-alt':
coords.set('left', position.left);
coords.set('top', position.top + offset);
break;
case 'se':
coords.set('left', position.left - 20);
coords.set('top', position.top + offset);
break;
case 'se-alt':
coords.set('top', position.top + offset);
coords.set('right', session.windowWidth - position.left);
break;
}
return coords;
}
/**
* Finds the tooltip attachment point in the document for a HTML DOM element
* for the specified placement.
* @private
* @param {jQuery} element The element that the tooltip should target.
* @param {string} placement The placement for the tooltip.
* @return {Object} An object with the top,left position values.
*/
function getHtmlPlacement(element, placement) {
var objectOffset = element.offset(),
objectWidth = element.outerWidth(),
objectHeight = element.outerHeight(),
left,
top;
// calculate the appropriate x and y position in the document
switch (placement) {
case 'n':
left = objectOffset.left + objectWidth / 2;
top = objectOffset.top;
break;
case 'e':
left = objectOffset.left + objectWidth;
top = objectOffset.top + objectHeight / 2;
break;
case 's':
left = objectOffset.left + objectWidth / 2;
top = objectOffset.top + objectHeight;
break;
case 'w':
left = objectOffset.left;
top = objectOffset.top + objectHeight / 2;
break;
case 'nw':
left = objectOffset.left;
top = objectOffset.top;
break;
case 'ne':
left = objectOffset.left + objectWidth;
top = objectOffset.top;
break;
case 'sw':
left = objectOffset.left;
top = objectOffset.top + objectHeight;
break;
case 'se':
left = objectOffset.left + objectWidth;
top = objectOffset.top + objectHeight;
break;
}
return {
top: top,
left: left
};
}
/**
* Finds the tooltip attachment point in the document for a SVG element for
* the specified placement.
* @private
* @param {jQuery} element The element that the tooltip should target.
* @param {string} placement The placement for the tooltip.
* @return {Object} An object with the top,left position values.
*/
function getSvgPlacement(element, placement) {
var svgElement = element.closest('svg')[0],
domElement = element[0],
point = svgElement.createSVGPoint(),
boundingBox = domElement.getBBox(),
matrix = domElement.getScreenCTM(),
halfWidth = boundingBox.width / 2,
halfHeight = boundingBox.height / 2,
placements = [],
placementKeys = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'],
coords,
rotation,
steps,
x;
function pushPlacement() {
placements.push(point.matrixTransform(matrix));
}
// get bounding box corners and midpoints
point.x = boundingBox.x;
point.y = boundingBox.y;
pushPlacement();
point.x += halfWidth;
pushPlacement();
point.x += halfWidth;
pushPlacement();
point.y += halfHeight;
pushPlacement();
point.y += halfHeight;
pushPlacement();
point.x -= halfWidth;
pushPlacement();
point.x -= halfWidth;
pushPlacement();
point.y -= halfHeight;
pushPlacement();
// determine rotation
if (placements[0].y !== placements[1].y || placements[0].x !== placements[7].x) {
rotation = Math.atan2(matrix.b, matrix.a) * RAD2DEG;
steps = Math.ceil(((rotation % 360) - 22.5) / 45);
if (steps < 1) {
steps += 8;
}
while (steps--) {
placementKeys.push(placementKeys.shift());
}
}
// find placement
for (x = 0; x < placements.length; x++) {
if (placementKeys[x] === placement) {
coords = placements[x];
break;
}
}
return {
top: coords.y + session.scrollTop,
left: coords.x + session.scrollLeft
};
}
// expose methods
this.compute = computePlacementCoords;
}
/**
* Creates a new tooltip controller.
* @private
* @constructor
* @param {Object} options Options object containing settings.
*/
function TooltipController(options) {
var placementCalculator = new PlacementCalculator(),
tipElement = $('#' + options.popupId);
// build and append tooltip div if it does not already exist
if (tipElement.length === 0) {
tipElement = $('<div/>', { id: options.popupId });
// grab body element if it was not populated when the script loaded
// note: this hack exists solely for jsfiddle support
if ($body.length === 0) {
$body = $('body');
}
$body.append(tipElement);
}
// hook mousemove for cursor follow tooltips
if (options.followMouse) {
// only one positionTipOnCursor hook per tooltip element, please
if (!tipElement.data(DATA_HASMOUSEMOVE)) {
$document.on('mousemove', positionTipOnCursor);
$window.on('scroll', positionTipOnCursor);
tipElement.data(DATA_HASMOUSEMOVE, true);
}
}
// if we want to be able to mouse onto the tooltip then we need to attach
// hover events to the tooltip that will cancel a close request on hover and
// start a new close request on mouseleave
if (options.mouseOnToPopup) {
tipElement.on({
mouseenter: function tipMouseEnter() {
// we only let the mouse stay on the tooltip if it is set to let
// users interact with it
if (tipElement.data(DATA_MOUSEONTOTIP)) {
// check activeHover in case the mouse cursor entered the
// tooltip during the fadeOut and close cycle
if (session.activeHover) {
session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel();
}
}
},
mouseleave: function tipMouseLeave() {
// check activeHover in case the mouse cursor entered the
// tooltip during the fadeOut and close cycle
if (session.activeHover) {
session.activeHover.data(DATA_DISPLAYCONTROLLER).hide();
}
}
});
}
/**
* Gives the specified element the active-hover state and queues up the
* showTip function.
* @private
* @param {jQuery} element The element that the tooltip should target.
*/
function beginShowTip(element) {
element.data(DATA_HASACTIVEHOVER, true);
// show tooltip, asap
tipElement.queue(function queueTipInit(next) {
showTip(element);
next();
});
}
/**
* Shows the tooltip, as soon as possible.
* @private
* @param {jQuery} element The element that the tooltip should target.
*/
function showTip(element) {
var tipContent;
// it is possible, especially with keyboard navigation, to move on to
// another element with a tooltip during the queue to get to this point
// in the code. if that happens then we need to not proceed or we may
// have the fadeout callback for the last tooltip execute immediately
// after this code runs, causing bugs.
if (!element.data(DATA_HASACTIVEHOVER)) {
return;
}
// if the tooltip is open and we got asked to open another one then the
// old one is still in its fadeOut cycle, so wait and try again
if (session.isTipOpen) {
if (!session.isClosing) {
hideTip(session.activeHover);
}
tipElement.delay(100).queue(function queueTipAgain(next) {
showTip(element);
next();
});
return;
}
// trigger powerTipPreRender event
element.trigger('powerTipPreRender');
// set tooltip content
tipContent = getTooltipContent(element);
if (tipContent) {
tipElement.empty().append(tipContent);
} else {
// we have no content to display, give up
return;
}
// trigger powerTipRender event
element.trigger('powerTipRender');
session.activeHover = element;
session.isTipOpen = true;
tipElement.data(DATA_MOUSEONTOTIP, options.mouseOnToPopup);
// set tooltip position
if (!options.followMouse) {
positionTipOnElement(element);
session.isFixedTipOpen = true;
} else {
positionTipOnCursor();
}
// fadein
tipElement.fadeIn(options.fadeInTime, function fadeInCallback() {
// start desync polling
if (!session.desyncTimeout) {
session.desyncTimeout = setInterval(closeDesyncedTip, 500);
}
// trigger powerTipOpen event
element.trigger('powerTipOpen');
});
}
/**
* Hides the tooltip.
* @private
* @param {jQuery} element The element that the tooltip should target.
*/
function hideTip(element) {
// reset session
session.isClosing = true;
session.activeHover = null;
session.isTipOpen = false;
// stop desync polling
session.desyncTimeout = clearInterval(session.desyncTimeout);
// reset element state
element.data(DATA_HASACTIVEHOVER, false);
element.data(DATA_FORCEDOPEN, false);
// fade out
tipElement.fadeOut(options.fadeOutTime, function fadeOutCallback() {
var coords = new CSSCoordinates();
// reset session and tooltip element
session.isClosing = false;
session.isFixedTipOpen = false;
tipElement.removeClass();
// support mouse-follow and fixed position tips at the same time by
// moving the tooltip to the last cursor location after it is hidden
coords.set('top', session.currentY + options.offset);
coords.set('left', session.currentX + options.offset);
tipElement.css(coords);
// trigger powerTipClose event
element.trigger('powerTipClose');
});
}
/**
* Moves the tooltip to the users mouse cursor.
* @private
*/
function positionTipOnCursor() {
// to support having fixed tooltips on the same page as cursor tooltips,
// where both instances are referencing the same tooltip element, we
// need to keep track of the mouse position constantly, but we should
// only set the tip location if a fixed tip is not currently open, a tip
// open is imminent or active, and the tooltip element in question does
// have a mouse-follow using it.
if (!session.isFixedTipOpen && (session.isTipOpen || (session.tipOpenImminent && tipElement.data(DATA_HASMOUSEMOVE)))) {
// grab measurements
var tipWidth = tipElement.outerWidth(),
tipHeight = tipElement.outerHeight(),
coords = new CSSCoordinates(),
collisions,
collisionCount;
// grab collisions
coords.set('top', session.currentY + options.offset);
coords.set('left', session.currentX + options.offset);
collisions = getViewportCollisions(
coords,
tipWidth,
tipHeight
);
// handle tooltip view port collisions
if (collisions !== Collision.none) {
collisionCount = countFlags(collisions);
if (collisionCount === 1) {
// if there is only one collision (bottom or right) then
// simply constrain the tooltip to the view port
if (collisions === Collision.right) {
coords.set('left', session.windowWidth - tipWidth);
} else if (collisions === Collision.bottom) {
coords.set('top', session.scrollTop + session.windowHeight - tipHeight);
}
} else {
// if the tooltip has more than one collision then it is
// trapped in the corner and should be flipped to get it out
// of the users way
coords.set('left', session.currentX - tipWidth - options.offset);
coords.set('top', session.currentY - tipHeight - options.offset);
}
}
// position the tooltip
tipElement.css(coords);
}
}
/**
* Sets the tooltip to the correct position relative to the specified target
* element. Based on options settings.
* @private
* @param {jQuery} element The element that the tooltip should target.
*/
function positionTipOnElement(element) {
var priorityList,
finalPlacement;
if (options.smartPlacement) {
priorityList = $.fn.powerTip.smartPlacementLists[options.placement];
// iterate over the priority list and use the first placement option
// that does not collide with the view port. if they all collide
// then the last placement in the list will be used.
$.each(priorityList, function(idx, pos) {
// place tooltip and find collisions
var collisions = getViewportCollisions(
placeTooltip(element, pos),
tipElement.outerWidth(),
tipElement.outerHeight()
);
// update the final placement variable
finalPlacement = pos;
// break if there were no collisions
if (collisions === Collision.none) {
return false;
}
});
} else {
// if we're not going to use the smart placement feature then just
// compute the coordinates and do it
placeTooltip(element, options.placement);
finalPlacement = options.placement;
}
// add placement as class for CSS arrows
tipElement.addClass(finalPlacement);
}
/**
* Sets the tooltip position to the appropriate values to show the tip at
* the specified placement. This function will iterate and test the tooltip
* to support elastic tooltips.
* @private
* @param {jQuery} element The element that the tooltip should target.
* @param {string} placement The placement for the tooltip.
* @return {CSSCoordinates} A CSSCoordinates object with the top, left, and
* right position values.
*/
function placeTooltip(element, placement) {
var iterationCount = 0,
tipWidth,
tipHeight,
coords = new CSSCoordinates();
// set the tip to 0,0 to get the full expanded width
coords.set('top', 0);
coords.set('left', 0);
tipElement.css(coords);
// to support elastic tooltips we need to check for a change in the
// rendered dimensions after the tooltip has been positioned
do {
// grab the current tip dimensions
tipWidth = tipElement.outerWidth();
tipHeight = tipElement.outerHeight();
// get placement coordinates
coords = placementCalculator.compute(
element,
placement,
tipWidth,
tipHeight,
options.offset
);
// place the tooltip
tipElement.css(coords);
} while (
// sanity check: limit to 5 iterations, and...
++iterationCount <= 5 &&
// try again if the dimensions changed after placement
(tipWidth !== tipElement.outerWidth() || tipHeight !== tipElement.outerHeight())
);
return coords;
}
/**
* Checks for a tooltip desync and closes the tooltip if one occurs.
* @private
*/
function closeDesyncedTip() {
var isDesynced = false;
// It is possible for the mouse cursor to leave an element without
// firing the mouseleave or blur event. This most commonly happens when
// the element is disabled under mouse cursor. If this happens it will
// result in a desynced tooltip because the tooltip was never asked to
// close. So we should periodically check for a desync situation and
// close the tip if such a situation arises.
if (session.isTipOpen && !session.isClosing && !session.delayInProgress) {
// user moused onto another tip or active hover is disabled
if (session.activeHover.data(DATA_HASACTIVEHOVER) === false || session.activeHover.is(':disabled')) {
isDesynced = true;
} else {
// hanging tip - have to test if mouse position is not over the
// active hover and not over a tooltip set to let the user
// interact with it.
// for keyboard navigation: this only counts if the element does
// not have focus.
// for tooltips opened via the api: we need to check if it has
// the forcedOpen flag.
if (!isMouseOver(session.activeHover) && !session.activeHover.is(':focus') && !session.activeHover.data(DATA_FORCEDOPEN)) {
if (tipElement.data(DATA_MOUSEONTOTIP)) {
if (!isMouseOver(tipElement)) {
isDesynced = true;
}
} else {
isDesynced = true;
}
}
}
if (isDesynced) {
// close the desynced tip
hideTip(session.activeHover);
}
}
}
// expose methods
this.showTip = beginShowTip;
this.hideTip = hideTip;
this.resetPosition = positionTipOnElement;
}
/**
* Determine whether a jQuery object is an SVG element
* @private
* @param {jQuery} element The element to check
* @return {boolean} Whether this is an SVG element
*/
function isSvgElement(element) {
return window.SVGElement && element[0] instanceof SVGElement;
}
/**
* Initializes the viewport dimension cache and hooks up the mouse position
* tracking and viewport dimension tracking events.
* Prevents attaching the events more than once.
* @private
*/
function initTracking() {
if (!session.mouseTrackingActive) {
session.mouseTrackingActive = true;
// grab the current viewport dimensions on load
$(function getViewportDimensions() {
session.scrollLeft = $window.scrollLeft();
session.scrollTop = $window.scrollTop();
session.windowWidth = $window.width();
session.windowHeight = $window.height();
});
// hook mouse move tracking
$document.on('mousemove', trackMouse);
// hook viewport dimensions tracking
$window.on({
resize: function trackResize() {
session.windowWidth = $window.width();
session.windowHeight = $window.height();
},
scroll: function trackScroll() {
var x = $window.scrollLeft(),
y = $window.scrollTop();
if (x !== session.scrollLeft) {
session.currentX += x - session.scrollLeft;
session.scrollLeft = x;
}
if (y !== session.scrollTop) {
session.currentY += y - session.scrollTop;
session.scrollTop = y;
}
}
});
}
}
/**
* Saves the current mouse coordinates to the session object.
* @private
* @param {jQuery.Event} event The mousemove event for the document.
*/
function trackMouse(event) {
session.currentX = event.pageX;
session.currentY = event.pageY;
}
/**
* Tests if the mouse is currently over the specified element.
* @private
* @param {jQuery} element The element to check for hover.
* @return {boolean}
*/
function isMouseOver(element) {
// use getBoundingClientRect() because jQuery's width() and height()
// methods do not work with SVG elements
// compute width/height because those properties do not exist on the object
// returned by getBoundingClientRect() in older versions of IE
var elementPosition = element.offset(),
elementBox = element[0].getBoundingClientRect(),
elementWidth = elementBox.right - elementBox.left,
elementHeight = elementBox.bottom - elementBox.top;
return session.currentX >= elementPosition.left &&
session.currentX <= elementPosition.left + elementWidth &&
session.currentY >= elementPosition.top &&
session.currentY <= elementPosition.top + elementHeight;
}
/**
* Fetches the tooltip content from the specified element's data attributes.
* @private
* @param {jQuery} element The element to get the tooltip content for.
* @return {(string|jQuery|undefined)} The text/HTML string, jQuery object, or
* undefined if there was no tooltip content for the element.
*/
function getTooltipContent(element) {
var tipText = element.data(DATA_POWERTIP),
tipObject = element.data(DATA_POWERTIPJQ),
tipTarget = element.data(DATA_POWERTIPTARGET),
targetElement,
content;
if (tipText) {
if ($.isFunction(tipText)) {
tipText = tipText.call(element[0]);
}
content = tipText;
} else if (tipObject) {
if ($.isFunction(tipObject)) {
tipObject = tipObject.call(element[0]);
}
if (tipObject.length > 0) {
content = tipObject.clone(true, true);
}
} else if (tipTarget) {
targetElement = $('#' + tipTarget);
if (targetElement.length > 0) {
content = targetElement.html();
}
}
return content;
}
/**
* Finds any viewport collisions that an element (the tooltip) would have if it
* were absolutely positioned at the specified coordinates.
* @private
* @param {CSSCoordinates} coords Coordinates for the element.
* @param {number} elementWidth Width of the element in pixels.
* @param {number} elementHeight Height of the element in pixels.
* @return {number} Value with the collision flags.
*/
function getViewportCollisions(coords, elementWidth, elementHeight) {
var viewportTop = session.scrollTop,
viewportLeft = session.scrollLeft,
viewportBottom = viewportTop + session.windowHeight,
viewportRight = viewportLeft + session.windowWidth,
collisions = Collision.none;
if (coords.top < viewportTop || Math.abs(coords.bottom - session.windowHeight) - elementHeight < viewportTop) {
collisions |= Collision.top;
}
if (coords.top + elementHeight > viewportBottom || Math.abs(coords.bottom - session.windowHeight) > viewportBottom) {
collisions |= Collision.bottom;
}
if (coords.left < viewportLeft || coords.right + elementWidth > viewportRight) {
collisions |= Collision.left;
}
if (coords.left + elementWidth > viewportRight || coords.right < viewportLeft) {
collisions |= Collision.right;
}
return collisions;
}
/**
* Counts the number of bits set on a flags value.
* @param {number} value The flags value.
* @return {number} The number of bits that have been set.
*/
function countFlags(value) {
var count = 0;
while (value) {
value &= value - 1;
count++;
}
return count;
}
}));
# 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 source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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
"/*!\n"
" PowerTip - v1.2.0 - 2013-04-03\n"
" http://stevenbenner.github.com/jquery-powertip/\n"
" Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).\n"
" Released under MIT license.\n"
" https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt\n"
"*/\n"
"(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}}));\n"
......@@ -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