WoWInterface SVN GymnastTooltips

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

Gymnast/Gymnast.toc New file
0,0 → 1,13
## Interface: 40000
## Title: Gymnast
## Notes: Make your tooltips as flexible as you are.
## Notes-deDE: Ermöglicht es die Tooltips zu verschieben und flexibel zu verändern.
## Author: AnduinLothar
## Version: 3.3
## SavedVariables: Gymnast_TooltipPointSettings, Gymnast_RelocateUberTooltips, Gymnast_RelocateTooltip_ToMouse, Gymnast_TooltipAnchorSmart
## X-Date: $Date$
## X-Category: Tooltips
## X-Website: http://www.wowinterface.com/downloads/info5460-GymnastTooltips.html
## X-Localizations: enUS, deDE, frFR
## X-CompatibleLocales: enUS, enGB, deDE, frFR
Gymnast.xml
Gymnast/localization.lua New file
0,0 → 1,43
--------------------------------------------------------------------------
-- localization.lua
--------------------------------------------------------------------------
 
--English
 
GYMNAST_TOOLTIPS_HEADER = "Gymnast Tooltips";
GYMNAST_TOOLTIPS_HEADER_INFO = "Makes the Game Tooltips Drag-able for Placement.";
GYMNAST_TOOLTIPS_ENABLED_TEXT = "Enable Gymnast Tooltips";
GYMNAST_TOOLTIPS_ENABLED_TEXT_INFO = "Allow Gymnast to relocate the Game Tooltip.";
GYMNAST_TOOLTIPS_ENABLED_TEXT_FEEDBACK_ON = "Gymnast is enabled.";
GYMNAST_TOOLTIPS_ENABLED_TEXT_FEEDBACK_OFF = "Gymnast tooltips are turned off.";
GYMNAST_TOOLTIPS_SHOW_TEXT = "Show the Game Tooltip (For Dragging).";
GYMNAST_TOOLTIPS_SHOW_TEXT_INFO = "Makes the Game Tooltip visible for you to drag to your preferred position.";
GYMNAST_TOOLTIPS_RESET_TEXT = "Reset the Game Tooltip.";
GYMNAST_TOOLTIPS_RESET_TEXT_INFO = "Moves the Game Tooltip back to its original position.";
GYMNAST_TOOLTIPS_ANCHOR_TEXT = "Anchor %s.";
GYMNAST_TOOLTIPS_ANCHOR_TEXT_INFO = "Set the GameTooltip to expand from the %s.";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT = "Position Tooltips by Owner";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_INFO = "Will reposition normal tooltips near their owner frame, and so they are always on screen.";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_FEEDBACK_ON = "When a Game Tooltip is shown, it will now be near its owner.";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_FEEDBACK_OFF = "When a Game Tooltip is shown, it will now be near its owner.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT = "Relocate Uber Tooltips.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_INFO = "Set Enhanced UI tooltips to show near their parent frame.\n(Only works if Enhanced Tooltips are enabled in the Interface Options.)";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_FEEDBACK_ON = "Gymnast is going to relocate uber tooltips.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_FEEDBACK_OFF = "Gymnast won't relocate big tooltips.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT = "Anchor Tooltip To Mouse.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_INFO = "Set the GameTooltip to always show where the mouse is.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_FEEDBACK_ON = "Gymnast is anchoring the tooltip to the mouse.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_FEEDBACK_OFF = "Gymnast is not anchoring the tooltip to the mouse.";
GYMNAST_TOOLTIPS_ADV_OPTIONS = "Advanced Options";
GYMNAST_TOOLTIPS_ADV_OPTIONS_INFO = "Select what corner your tooltip extends from";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT = "Smart Anchoring";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_INFO = "Auto-detect what side to extend from.";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_FEEDBACK_ON = "When you reposition the tooltip it will now auto-detect what side to extend from.";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_FEEDBACK_OFF = "Before you reposition the tooltip you must manually select what side to extend from.";
GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT = "Show the Tooltip Top Center.";
GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT_INFO = "Move the Tooltip to the Top Center of the Screen.";
 
GYMNAST_TOOLTIPS_INSTRUCTIONS = "Drag this tooltip to your preferred\nposition. Tooltip will fade after click."
 
RESET = "Reset";
SHOW = "Show";
Gymnast/localization.fr.lua New file
0,0 → 1,32
-- Version : French ( by Sasmira )
-- Last Update : 03/19/2005
 
if (GetLocale() == "frFR") then
 
GYMNAST_TOOLTIPS_HEADER = "Gymnast Tooltips";
GYMNAST_TOOLTIPS_HEADER_INFO = "Permet de d\195\169placer la bulle d\'aide.";
GYMNAST_TOOLTIPS_ENABLED_TEXT = "Marche/Arr\195\170t de Gymnast Tooltips";
GYMNAST_TOOLTIPS_ENABLED_TEXT_INFO = "Permet \195\160 Gymnast de d\195\169placer la bulle d\'aide.";
GYMNAST_TOOLTIPS_SHOW_TEXT = "Voir la bulle d\'aide.";
GYMNAST_TOOLTIPS_SHOW_TEXT_INFO = "Rendre la bulle d\'aide visible afin de la positionner celon votre choix.";
GYMNAST_TOOLTIPS_RESET_TEXT = "Reinitialiser l\'emplacement.";
GYMNAST_TOOLTIPS_RESET_TEXT_INFO = "Place la bulle d\'aide a la position originale.";
GYMNAST_TOOLTIPS_ANCHOR_TEXT = "Mettre en %s.";
GYMNAST_TOOLTIPS_ANCHOR_TEXT_INFO = "Place la bulle d\'aide pour augmenter le %s.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT = "Replacer la bulle d\'aide des sorts.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_INFO = "Affiche la plupart des bulles d\'aide du jeu \195\160 l\'emplacement de la fen\195\170tre principale.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT = "Fixe la bulle d\'aide sur la Souris.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_INFO = "Fixe la bulle d\'aide sur le pointeur de la souris.";
GYMNAST_TOOLTIPS_ADV_OPTIONS = "Options Avanc\195\169es";
GYMNAST_TOOLTIPS_ADV_OPTIONS_INFO = "Choix du coin pour l\'extension de la bulle d\'aide";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT = "Placement intelligent";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_INFO = "D\195\169tection automatique du cot\195\169 de l\'extension.";
GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT = "Voir la bulle d\'aide en haut.";
GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT_INFO = "Place la bulle d\'aide en haut de l\'\195\169cran.";
 
GYMNAST_TOOLTIPS_INSTRUCTIONS = "Placer la bulle d\'aide \195\160 la position de votre choix. \nLa fen\195\170tre disparait apr\195\168s un clic."
 
RESET = "Reinitialisation";
SHOW = "Voir";
 
end
\ No newline at end of file
Gymnast/localization.de.lua New file
0,0 → 1,44
-- Version : German (by StarDust)
-- Last Update : 10/31/2005
 
if ( GetLocale() == "deDE" ) then
 
GYMNAST_TOOLTIPS_HEADER = "Gymnast Tooltips";
GYMNAST_TOOLTIPS_HEADER_INFO = "Erm\195\182glicht es die Tooltips zu verschieben und jene an einer anderen Position anzuzeigen.";
GYMNAST_TOOLTIPS_ENABLED_TEXT = "Gymnast Tooltips aktivieren";
GYMNAST_TOOLTIPS_ENABLED_TEXT_INFO = "Wenn aktiviert, erlaubt es Gymnast die Tooltips neu zu plazieren und zu verschieben.";
GYMNAST_TOOLTIPS_ENABLED_TEXT_FEEDBACK_ON = "Gymnast Tooltips sind aktiviert.";
GYMNAST_TOOLTIPS_ENABLED_TEXT_FEEDBACK_OFF = "Gymnast Tooltips sind deaktiviert.";
GYMNAST_TOOLTIPS_SHOW_TEXT = "Plazierungshilfe anzeigen";
GYMNAST_TOOLTIPS_SHOW_TEXT_INFO = "Wenn aktiviert, wird der Hilfe-Tooltip angezeigt um die neue Position der Tooltips festlegen zu k\195\182nnen.";
GYMNAST_TOOLTIPS_RESET_TEXT = "Position der Tooltips zur\195\188cksetzen";
GYMNAST_TOOLTIPS_RESET_TEXT_INFO = "Wenn aktiveirt, werden die Tooltips wieder zur\195\188ck an ihre urspr\195\188ngliche Position verschoben.";
GYMNAST_TOOLTIPS_ANCHOR_TEXT = "Ankerpunkt %s.";
GYMNAST_TOOLTIPS_ANCHOR_TEXT_INFO = "Der Gymnast Tooltip hat seinen Ausgangspunkt %s.";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT = "Tooltips am Owner ausrichten";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_INFO = "Wenn aktiviert, werden die Tooltips neben deren zugeh\195\182rigem Owner-Fenster ausgerichtet, womit sie immer am Bildschirm sichtbar sind.";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_FEEDBACK_ON = "Gymnast richtet Tooltips am Owner-Fenster aus.";
GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_FEEDBACK_OFF = "Gymnast richtet Tooltips nicht am Owner-Fenster aus.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT = "Tooltips am Fenster ausrichten";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_INFO = "Wenn aktiviert, werden die Tooltips neben deren zugeh\195\182rigem Eltern-Fenster ausgerichtet.\n(Funktioniert nur, wenn die erweiterten Tooltips in den Interface-Einstellungen aktiviert sind.)";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_FEEDBACK_ON = "Gymnast richtet Tooltips am Eltern-Fenster aus.";
GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_FEEDBACK_OFF = "Gymnast richtet Tooltips nicht am Eltern-Fenster aus.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT = "Tooltips am Mauszeiger ausrichten";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_INFO = "Wenn aktiviert, werden die meisten Tooltips an der momentanen Position des Mauszeigers ausgerichtet.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_FEEDBACK_ON = "Gymnast richtet Tooltips am Mauszeiger aus.";
GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_FEEDBACK_OFF = "Gymnast richtet Tooltips nicht am Mauszeiger aus.";
GYMNAST_TOOLTIPS_ADV_OPTIONS = "Erweiterte Einstellungen";
GYMNAST_TOOLTIPS_ADV_OPTIONS_INFO = "W\195\164hle die Ecke, in welcher der Tooltip angezeigt werden soll";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT = "Intelligenter Ankerpunkt";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_INFO = "Wenn aktiviert, wird die Richtung in welche der Tooltip expandieren soll automatisch erkannt.";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_FEEDBACK_ON = "Gymnast erkennt automatisch, in welche Richtung der Tooltips am besten expandieren sollen.";
GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_FEEDBACK_OFF = "Wenn der Tooltip neu positioniert wird, muss die gew\195\188nschte Richtung zum expandieren manuell eingestellt werden.";
GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT = "Tooltip Oben Mitte anzeigen";
GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT_INFO = "Wenn aktiviert, wird der Tooltip am Bildschirm Oben mittig angezeigt.";
 
GYMNAST_TOOLTIPS_INSTRUCTIONS = "Verschiebe diesen Tooltip an die\ngew\195\188nschte Position.\nAnschlie\195\159end die Maustaste dr\195\188cken um diesen\nHinweis wieder zu verbergen.";
 
RESET = "Zur\195\188cksetzen";
SHOW = "Anzeigen";
 
end
\ No newline at end of file
Gymnast/Gymnast.xml New file
0,0 → 1,35
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="localization.lua"/>
<Script file="localization.fr.lua" />
<Script file="localization.de.lua" />
<Script file="Gymnast.lua"/>
 
<GameTooltip name="MobileGameTooltip" hidden="true" frameStrata="DIALOG" parent="UIParent" inherits="GameTooltipTemplate" movable="true" enableMouse="true">
<Scripts>
<OnMouseUp>
Gymnast.OnMouseUp(self)
</OnMouseUp>
<OnMouseDown>
Gymnast.OnMouseDown(self,button)
</OnMouseDown>
<OnHide>
Gymnast.OnHide(self)
</OnHide>
<OnUpdate>
Gymnast.OnUpdate(self,elapsed)
</OnUpdate>
</Scripts>
</GameTooltip>
 
<Frame name="GymnastFrame" hidden="true">
<Scripts>
<OnLoad>
Gymnast.OnLoad(self)
</OnLoad>
<OnEvent>
Gymnast.OnEvent(self,event,...)
</OnEvent>
</Scripts>
</Frame>
</Ui>
Gymnast/Gymnast.lua New file
0,0 → 1,690
--------------------------------------------------------------------------
-- Gymnast.lua
--------------------------------------------------------------------------
--[[
Gymnast Tooltips
 
Bending over backwards to please. Make your Tooltip as flexible as you are.
 
By author: AnduinLothar <karlkfi@yahoo.com>
 
Slash Commands:
"/gtshow" - Makes the Game Tooltip visible for you to drag to your preferred position.
"/gtreset" - Moves the Game Tooltip back to its original position.
"/gttopcenter" - Moves the Game Tooltip to the alternate top center position.
"/gtanchor [position]" - Makes the tooltip extend from this anchored position.
(position can be "SMART", "TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT", "LEFT", "TOP", "RIGHT", "BOTTOM", "MOUSE", "UBER", "OWNER")
Note: "MOUSE", "UBER", and "OWNER" are toggle commands. Call them again to disable.
 
'mouse' relocates the tooltip to the mouse.
'uber' relocates "Enhanced Tooltips" to show near their parent frame. (toggle)
'owner' relocates normal tooltips to show near their parent frame. (toggle)
 
$Id: Gymnast.lua 17 2010-10-16 00:11:57Z kharthus1 $
$Rev: 17 $
$LastChangedBy: kharthus1 $
$Date: 2010-10-15 17:11:57 -0700 (Fri, 15 Oct 2010) $
 
changelog:
v3.3
-Converted to use hooksecurefunc instead of manual hooks to fix taint issues
-Removed unused SmartSetOwner hook
-Removed obsolete Cosmos and Khaos code
v3.2
-Changed VARIABLES_LOADED to ADDON_LOADED
-Fixed last instances of 'this'
v3.1
-Updated for WoW 4.0.1
v3.0
-Updated for lua 5.1
-Updated TOC to 20000
-Anchor to MOUSE mode now correctly dissables if you set another mode.
-OO'd the code
-Removed Chronos Dep
v2.7
-Added an option to relocate normal tooltips to be by their parent, like Uber Tooltips were. Using this option will fix things such as Buff tooltips showing up off screen when you move the buffs to the left of the screen.
-Fixed bug with the position by owner option, needed GetEffectiveScale
-Updated to not use RegisterForSave
-Updated TOC to 11000
v2.6
-Updated TOC to 1700
-Fixed issues not accounting for Screen Scaling
-Fixed compatibility with CosmosLegacy.
v2.5
-Updated TOC to 1600
-Added Khaos Options.
-Fixed the Smart Anchor option to be under advanced options.
-Raised advanced options to Master difficulty.
-Made feedback localizable.
-Clarified Uber tooltip relocation in the mouse-over info.
v2.42
-Extra options now save correctly when not using cosmos.
v2.41
-Updated TOC to 1300
-Fixed a Cosmos dependancy to be truely optional
v2.4
-French localization updated by Sasmira
v2.3
-Added smart anchoring and center anchoring
-Added a button to move to the old cosmos position top center.
v2.2
-Added Mouse and Uber tooltip relocations
v2.1
-Added Anchoring
-Modified instructions in the tooltip.
v2.0
-Completely redesigned... now it plays nicely with TooltipsBase.
v1.0
-Replaced tooltips with mobile ones.
-Included instructions in the tooltip.
 
]]--
 
local addonName, addonTable = ...;
 
Gymnast = {};
 
-- Constants
Gymnast.TOOLTIPS_POINT = "Point";
Gymnast.TOOLTIPS_RELATIVETO = "RelativeTo";
Gymnast.TOOLTIPS_RELATIVEPOINT = "RelativePoint";
Gymnast.TOOLTIPS_POSITION = "Position";
 
local anchorPositions = { "TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT", "CENTER", "LEFT", "TOP", "RIGHT", "BOTTOM" };
Gymnast.SetTooltipAnchorList = {};
 
 
function Gymnast.OnLoad(self)
 
self:RegisterEvent("ADDON_LOADED");
 
hooksecurefunc("GameTooltip_SetDefaultAnchor", Gymnast.GameTooltip_SetDefaultAnchor);
hooksecurefunc(GameTooltip,"SetOwner", Gymnast.GameTooltip_SetOwner);
 
for i, anchor in ipairs(anchorPositions) do
Gymnast.SetTooltipAnchorList[anchor] = function() Gymnast.SetTooltipAnchor(anchor) end;
end
--[[
if ( Khaos ) then
local options = {};
local commands = {};
local optionSet = {
id="Gymnast";
text=GYMNAST_TOOLTIPS_HEADER;
helptext=GYMNAST_TOOLTIPS_HEADER_INFO;
difficulty=1;
options=options;
commands=commands;
};
 
table.insert(
options,
{
id="Header";
type=K_HEADER;
text=TEXT(GYMNAST_TOOLTIPS_HEADER);
helptext=TEXT(GYMNAST_TOOLTIPS_HEADER_INFO);
difficulty=1;
default=false;
}
);
table.insert(
options,
{
id="Enable";
type=K_TEXT;
text=TEXT(GYMNAST_TOOLTIPS_ENABLED_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_ENABLED_TEXT_INFO);
callback=function(state)
Gymnast.Enabled=state.checked;
end;
feedback=function(state)
if ( state.checked ) then
return GYMNAST_TOOLTIPS_ENABLED_TEXT_FEEDBACK_ON;
else
return GYMNAST_TOOLTIPS_ENABLED_TEXT_FEEDBACK_OFF;
end
end;
difficulty=1;
check=true;
default={checked=true};
disabled={checked=false};
}
);
table.insert(
options,
{
id="OwnerAnchor";
type=K_TEXT;
text=TEXT(GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_INFO);
callback=function(state)
Gymnast.OwnerAnchor=state.checked;
end;
feedback=function(state)
if ( state.checked ) then
return GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_FEEDBACK_ON;
else
return GYMNAST_TOOLTIPS_OWNER_ANCHOR_TEXT_FEEDBACK_OFF;
end
end;
difficulty=1;
check=true;
default={checked=false};
disabled={checked=false};
}
);
table.insert(
options,
{
id="UberAnchor";
type=K_TEXT;
text=TEXT(GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_INFO);
callback=function(state)
Gymnast_RelocateUberTooltips=state.checked;
end;
feedback=function(state)
if ( state.checked ) then
return GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_FEEDBACK_ON;
else
return GYMNAST_TOOLTIPS_ANCHOR_UBER_TEXT_FEEDBACK_OFF;
end
end;
difficulty=1;
check=true;
default={checked=false};
disabled={checked=false};
}
);
table.insert(
options,
{
id="AnchorMouse";
type=K_TEXT;
text=TEXT(GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_INFO);
callback=function(state)
Gymnast_RelocateTooltip_ToMouse=state.checked;
end;
feedback=function(state)
if ( state.checked ) then
return GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_FEEDBACK_ON;
else
return GYMNAST_TOOLTIPS_ANCHOR_MOUSE_TEXT_FEEDBACK_OFF;
end
end;
difficulty=1;
check=true;
default={checked=false};
disabled={checked=false};
}
);
table.insert(
options,
{
id="ShowMobile";
type=K_BUTTON;
text=TEXT(GYMNAST_TOOLTIPS_SHOW_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_SHOW_TEXT_INFO);
callback=Gymnast.ShowMobileGameTooltip;
difficulty=1;
setup={buttonText=SHOW};
}
);
table.insert(
options,
{
id="ResetTooltip";
type=K_TEXT;
text=TEXT(GYMNAST_TOOLTIPS_RESET_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_RESET_TEXT_INFO);
callback=Gymnast.ResetGameTooltip;
difficulty=1;
setup={buttonText=RESET};
}
);
table.insert(
options,
{
id="TopCenter";
type=K_BUTTON;
text=TEXT(GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_SHOW_TOPCENTER_TEXT_INFO);
callback=Gymnast.SetTooltipTopCenter;
difficulty=1;
setup={buttonText=SHOW};
}
);
table.insert(
options,
{
id="AdvancedOptionsHeader";
type=K_HEADER;
text=TEXT(GYMNAST_TOOLTIPS_ADV_OPTIONS);
helptext=TEXT(GYMNAST_TOOLTIPS_ADV_OPTIONS_INFO);
difficulty=3;
}
);
table.insert(
options,
{
id="SmartAnchor";
type=K_TEXT;
text=TEXT(GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT);
helptext=TEXT(GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_INFO);
callback=function(state)
Gymnast_TooltipAnchorSmart=state.checked;
end;
feedback=function(state)
if ( state.checked ) then
return GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_FEEDBACK_ON;
else
return GYMNAST_TOOLTIPS_ANCHOR_SMART_TEXT_FEEDBACK_OFF;
end
end;
difficulty=3;
check=true;
default={checked=true};
disabled={checked=true};
}
);
 
for index, position in ipairs(anchorPositions) do
table.insert(
options,
{
id="Anchor"..Sea.string.capitalizeWords(position);
type=K_BUTTON;
text=string.format(GYMNAST_TOOLTIPS_ANCHOR_TEXT,position);
helptext=string.format(GYMNAST_TOOLTIPS_ANCHOR_TEXT_INFO,position);
callback=Gymnast.SetTooltipAnchorList[position];
difficulty=3;
setup={buttonText=position};
}
);
end
table.insert(commands,
{
id="GymnastCommands";
commands={"/gt"};
parseTree={
["show"] = Gymnast.ShowMobileGameTooltip;
["topcenter"] = Gymnast.SetTooltipTopCenter;
["reset"] = Gymnast.ResetGameTooltip;
["anchor"] = Gymnast.SlashAnchorTooltip;
};
}
);
Khaos.registerOptionSet(
"tooltip",
optionSet
);
else
]]--
Gymnast.Enabled = true;
--end
 
SlashCmdList["GYMNASTTOOLTIPSSHOW"] = Gymnast.ShowMobileGameTooltip;
SLASH_GYMNASTTOOLTIPSSHOW1 = "/gtshow";
 
SlashCmdList["GYMNASTTOOLTIPSTOPCENTER"] = Gymnast.SetTooltipTopCenter;
SLASH_GYMNASTTOOLTIPSTOPCENTER1 = "/gttopcenter";
 
SlashCmdList["GYMNASTTOOLTIPSRESET"] = Gymnast.ResetGameTooltip;
SLASH_GYMNASTTOOLTIPSRESET1 = "/gtreset";
 
SlashCmdList["GYMNASTTOOLTIPSANCHOR"] = Gymnast.SlashAnchorTooltip;
SLASH_GYMNASTTOOLTIPSANCHOR1 = "/gtanchor";
 
end
 
 
function Gymnast.OnEvent(self,event,...)
local arg1 = ...;
if (event == "ADDON_LOADED" and arg1 == addonName) then
if (not Gymnast_TooltipPointSettings) then
Gymnast_TooltipPointSettings = {
[Gymnast.TOOLTIPS_POINT] = "TOPLEFT",
[Gymnast.TOOLTIPS_RELATIVETO] = "UIParent",
[Gymnast.TOOLTIPS_RELATIVEPOINT] = "BOTTOMLEFT",
[Gymnast.TOOLTIPS_POSITION] = nil
};
end
end
end
 
 
function Gymnast.SetTooltipAnchor(point)
Gymnast.SetTooltipAnchorSmart(0);
Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POINT] = point;
end
 
function Gymnast.SetTooltipTopCenter()
MobileGameTooltip:SetOwner(UIParent, "ANCHOR_NONE");
MobileGameTooltip:SetPoint("TOP", "UIParent", "TOP", 0, -32);
local r = 0.3;
local g = 0.7;
local b = 0.9;
MobileGameTooltip:AddLine(GYMNAST_TOOLTIPS_HEADER, r+.3, g, b);
MobileGameTooltip:AddLine(" ", r, g, b);
MobileGameTooltip:AddLine(GYMNAST_TOOLTIPS_INSTRUCTIONS, r, g, b);
MobileGameTooltip:Show();
end
 
function Gymnast.SetTooltipAnchorSmart(checked)
Gymnast_TooltipAnchorSmart = (checked == 1);
end
 
function Gymnast.SlashAnchorTooltip(msg)
local var;
local onVal;
msg = string.upper(msg);
local startpos, endpos, anchor = string.find(msg, "(%w+)");
if (anchor) then
Gymnast_RelocateTooltip_ToMouse = false;
if (anchor == "SMART") then
Gymnast.SetTooltipAnchorSmart(1);
elseif (anchor == "MOUSE") then
Gymnast.RelocateGameTooltipToMouse();
elseif (anchor == "OWNER") then
Gymnast.GameTooltipOwner();
elseif (anchor == "UBER") then
Gymnast.GameTooltipUber();
else
for index, position in ipairs(anchorPositions) do
if (position == anchor) then
Gymnast.SetTooltipAnchor(position);
end
end
end
end
end
 
 
function Gymnast.MarkTooltipCoords()
local centerX,centerY = MobileGameTooltip:GetCenter();
local left = MobileGameTooltip:GetLeft();
local top = MobileGameTooltip:GetTop();
local right = MobileGameTooltip:GetRight();
local bottom = MobileGameTooltip:GetBottom();
local coords;
local place = Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POINT];
 
if (Gymnast_TooltipAnchorSmart) then
local parentW = UIParent:GetRight() - UIParent:GetLeft();
local parentH = UIParent:GetTop() - UIParent:GetLeft();
local onRightThird = (centerX > 2*(parentW/3));
local onLeftThird = (centerX < (parentW/3));
local onTopThird = (centerY > 2*(parentH/3));
local onBottomThird = (centerY < (parentH/3));
if onRightThird then
if onTopThird then
place = "TOPRIGHT";
elseif onBottomThird then
place = "BOTTOMRIGHT";
else
place = "RIGHT";
end
elseif onLeftThird then
if onTopThird then
place = "TOPLEFT";
elseif onBottomThird then
place = "BOTTOMLEFT";
else
place = "LEFT";
end
else
if onTopThird then
place = "TOP";
elseif onBottomThird then
place = "BOTTOM";
else
place = "CENTER";
end
end
Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POINT] = place;
end
 
if (place == "TOPLEFT") then
coords = { left, top };
elseif (place == "TOPRIGHT") then
coords = { right, top };
elseif (place == "BOTTOMLEFT") then
coords = { left, bottom };
elseif (place == "BOTTOMRIGHT") then
coords = { right, bottom };
elseif (place == "CENTER") then
coords = { centerX, centerY };
elseif (place == "LEFT") then
coords = { left, centerY };
elseif (place == "TOP") then
coords = { centerX, top };
elseif (place == "RIGHT") then
coords = { right, centerY };
elseif (place == "BOTTOM") then
coords = { centerX, bottom };
end
Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POSITION] = coords;
 
--print(place.." "..coords[1]..","..coords[2]);
end
 
function Gymnast.RelocateGameTooltipToMouse(toggle)
if ( toggle == nil ) then
Gymnast_RelocateTooltip_ToMouse = (not Gymnast_RelocateTooltip_ToMouse);
elseif ( toggle == 0 ) then
Gymnast_RelocateTooltip_ToMouse = false;
else
Gymnast_RelocateTooltip_ToMouse = true;
end
end
 
function Gymnast.GameTooltipUber(toggle)
if ( toggle == nil ) then
Gymnast_RelocateUberTooltips = (not Gymnast_RelocateUberTooltips);
elseif ( toggle == 0 ) then
Gymnast_RelocateUberTooltips = false;
else
Gymnast_RelocateUberTooltips = true;
end
end
 
function Gymnast.GameTooltipOwner(toggle)
if ( toggle == nil ) then
Gymnast.OwnerAnchor = (not Gymnast.OwnerAnchor);
elseif ( toggle == 0 ) then
Gymnast.OwnerAnchor = false;
else
Gymnast.OwnerAnchor = true;
end
end
 
function Gymnast.ToggleEnable(toggle)
if ( toggle == 0 ) then
Gymnast.Enabled = false;
else
Gymnast.Enabled = true;
end
end
 
function Gymnast.GameTooltip_SetOwner(tooltip, owner, anchorPoint, setX, setY)
if (Gymnast.Enabled and Gymnast.OwnerAnchor) then
if (not owner) then
owner = UIParent;
end
if (not tooltip) then
tooltip = GameTooltip;
end
NewSmartSetOwner(owner, "ANCHOR_NONE", setX, setY, tooltip);
end
end
 
function Gymnast.GameTooltip_SetDefaultAnchor(tooltip, owner)
if (Gymnast.Enabled) then
if (Gymnast_RelocateUberTooltips) and (owner ~= UIParent) then
NewSmartSetOwner(owner, "ANCHOR_NONE", 0, 0, tooltip);
return;
elseif (tooltip == GameTooltip) or (tooltip == MobileGameTooltip) then
if (Gymnast_RelocateTooltip_ToMouse) then
tooltip:ClearAllPoints();
tooltip:SetOwner(UIParent, "ANCHOR_CURSOR");
return;
elseif ( Gymnast_TooltipPointSettings ) then
local position = Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POSITION];
if ( ( position ) and ( position[1] ) and ( position[2] ) ) then
tooltip:Hide()
tooltip:SetOwner(owner, "ANCHOR_NONE");
tooltip:ClearAllPoints();
tooltip:SetPoint(Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POINT], Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_RELATIVETO], Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_RELATIVEPOINT], position[1], position[2] );
return;
end
end
end
end
tooltip:SetOwner(owner, "ANCHOR_NONE");
tooltip:SetPoint("BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", -CONTAINER_OFFSET_X - 13, CONTAINER_OFFSET_Y);
tooltip.default = 1;
end
 
function NewSmartSetOwner(owner, position, setX, setY, tooltip)
if (not owner) then
owner = UIParent;
end
if (not tooltip) then
tooltip = GameTooltip;
end
if (not setX) then
setX = 0;
end
if (not setY) then
setY = 0;
end
 
local x,y = owner:GetCenter();
local left = owner:GetLeft();
local right = owner:GetRight();
local top = owner:GetTop();
local bottom = owner:GetBottom();
local screenWidth = UIParent:GetRight() - UIParent:GetLeft();
local screenHeight = UIParent:GetTop() - UIParent:GetBottom();
local scale = owner:GetEffectiveScale();
if (x~=nil and y~=nil and left~=nil and right~=nil and top~=nil and bottom~=nil and screenWidth>0 and screenHeight>0) then
setX = setX * scale;
setY = setY * scale;
x = x * scale;
y = y * scale;
left = left * scale;
right = right * scale;
width = right - left;
top = top * scale;
bottom = bottom * scale;
local anchorPoint = "";
if (y <= (screenHeight * (1/2))) then
top = top + setY;
anchorPoint = "TOP";
if (top < 0) then
setY = setY - top;
end
else
setY = -setY;
bottom = bottom + setY;
anchorPoint = "BOTTOM";
if (bottom > screenHeight) then
setY = setY + (screenHeight - bottom);
end
end
 
if (x <= (screenWidth * (1/2))) then
left = left + setX;
if (anchorPoint == "BOTTOM") then
anchorPoint = anchorPoint.."RIGHT";
setX = setX - width;
if (left < 0) then
setX = setX - left;
end
else
anchorPoint = anchorPoint.."LEFT";
if (left < 0) then
setX = setX - left;
end
end
else
setX = -setX;
right = right + setX;
if (anchorPoint == "BOTTOM") then
anchorPoint = anchorPoint.."LEFT";
setX = setX + width;
if (right > screenWidth) then
setX = setX - (right - screenWidth);
end
else
anchorPoint = anchorPoint.."RIGHT";
if (right > screenWidth) then
setX = setX + (screenWidth - right);
end
end
end
 
if (anchorPoint == "") then
anchorPoint = "TOPLEFT";
end
scale = tooltip:GetScale();
if (scale) then
setX = setX / scale;
setY = setY / scale;
end
tooltip:SetOwner(owner, "ANCHOR_"..anchorPoint, setX, setY);
end
end
 
function Gymnast.ShowMobileGameTooltip()
GameTooltip_SetDefaultAnchor(MobileGameTooltip, UIParent);
local r = 0.3;
local g = 0.7;
local b = 0.9;
MobileGameTooltip:AddLine(GYMNAST_TOOLTIPS_HEADER, r+.3, g, b);
MobileGameTooltip:AddLine(" ", r, g, b);
MobileGameTooltip:AddLine(GYMNAST_TOOLTIPS_INSTRUCTIONS, r, g, b);
MobileGameTooltip:Show();
end
 
function Gymnast.ResetGameTooltip()
Gymnast_TooltipPointSettings[Gymnast.TOOLTIPS_POSITION] = nil;
Gymnast.ShowMobileGameTooltip();
MobileGameTooltip.fadeCount = 1;
end
 
-- Frame Scripts
function Gymnast.OnMouseUp(self)
if ( self.isMoving ) then
self:StopMovingOrSizing();
self.isMoving = false;
end
Gymnast.MarkTooltipCoords();
self.fadeCount = 1;
end
 
function Gymnast.OnMouseDown(self,button)
if ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( button == "LeftButton" ) then
self:StartMoving();
self.isMoving = true;
end
end
 
function Gymnast.OnHide(self)
if ( self.isMoving ) then
self:StopMovingOrSizing();
self.isMoving = false;
end
end
 
function Gymnast.OnUpdate(self,elapsed)
if ( self.fadeCount ) then
self.fadeCount = self.fadeCount - elapsed;
if ( self.fadeCount <= 0 ) then
self.fadeCount = nil;
self:FadeOut();
end
end
end