From 79e2dcf82854e5a967bf8557d9bde77b29ac4824 Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Thu, 4 Aug 2011 01:08:23 -0500 Subject: [PATCH] Add Clamp module placeholders. --- Modules/Clamp/StarTip_Clamp.lua | 219 +++++++++++++++++++++++++++++++++++++++ Modules/Clamp/StarTip_Clamp.toc | 10 ++ Modules/Gestures/Gestures.lua | 9 +- 3 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 Modules/Clamp/StarTip_Clamp.lua create mode 100644 Modules/Clamp/StarTip_Clamp.toc diff --git a/Modules/Clamp/StarTip_Clamp.lua b/Modules/Clamp/StarTip_Clamp.lua new file mode 100644 index 0000000..e14f7cd --- /dev/null +++ b/Modules/Clamp/StarTip_Clamp.lua @@ -0,0 +1,219 @@ +local mod = StarTip:NewModule("Fade", "AceHook-3.0") +mod.name = "Fade" +local _G = _G +local GameTooltip = _G.GameTooltip +local StarTip = _G.StarTip +local UnitExists = _G.UnitExists +local self = mod +local L = StarTip.L + +local defaults = { + profile = { + unitFrames = 2, + otherFrames = 1, + units = 2, + objects = 2, + } +} + +mod.defaults = defaults + +local choices = { + "Hide", + "Fade out" +} + +local get = function(info) + return self.db.profile[info[#info]] +end + +local set = function(info, v) + self.db.profile[info[#info]] = v +end + +local options = { + units = { + name = L["World Units"], + desc = L["What to do with tooltips for world frames"], + type = "select", + values = choices, + get = get, + set = set, + order = 4 + }, + unitFrames = { + name = L["Unit Frames"], + desc = L["What to do with tooltips for unit frames"], + type = "select", + values = choices, + get = get, + set = set, + order = 5 + }, + otherFrames = { + name = L["Other Frames"], + desc = L["What to do with tooltips for other frames (spells, macros, items, etc..)"], + type = "select", + values = choices, + get = get, + set = set, + order = 6 + }, + objects = { + name = L["World Objects"], + desc = L["What to do with tooltips for world objects (mailboxes, portals, etc..)"], + type = "select", + values = choices, + get = get, + set = set, + order = 7 + } +} + +function mod:OnInitialize() + self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults) + StarTip:SetOptionsDisabled(options, true) + self:SecureHook("GameTooltip_SetDefaultAnchor") +end + +function mod:OnEnable() + StarTip:SetOptionsDisabled(options, false) +end + +function mod:OnDisable() + StarTip:SetOptionsDisabled(options, true) +end + +function mod:GetOptions() + return options +end + +function mod:GameTooltip_SetDefaultAnchor(this, owner) + if owner ~= UIParent and mod.isUnit then -- This is terrible. Fixes a bug, but it likely introduces another bug related to passing over unit frames. Didn't seem to bother anything in a BG test. + StarTip.tooltipMain:Hide() + end +end + +-- CowTip's solution below +local updateExistenceFrame = CreateFrame("Frame") +local updateAlphaFrame = CreateFrame("Frame") + +local checkExistence = function() + if not UnitExists(StarTip.unit) and mod.isUnit then + updateExistenceFrame:SetScript("OnUpdate", nil) + local kind + if GameTooltip:GetOwner() == UIParent then + kind = self.db.profile.units + else + kind = self.db.profile.unitFrames + end + if kind == 2 then + GameTooltip:FadeOut() + StarTip.tooltipMain:FadeOut() + else + GameTooltip:Hide() + StarTip.tooltipMain:Hide() + end + end +end + +local checkTooltipAlpha = function() + if GameTooltip:GetAlpha() < 1 then + updateAlphaFrame:SetScript("OnUpdate", nil) + local kind + if GameTooltip:IsOwned(UIParent) then + kind = self.db.profile.objects + else + kind = self.db.profile.otherFrames + end + if kind == 2 then + GameTooltip:FadeOut() + StarTip.tooltipMain:FadeOut() + else + GameTooltip:Hide() + StarTip.tooltipMain:Hide() + end + end +end + +function mod:OnShow() + if self.isUnit and UnitExists(StarTip.unit) then + updateExistenceFrame:SetScript("OnUpdate", checkExistence) + else + updateAlphaFrame:SetScript("OnUpdate", checkTooltipAlpha) + end +end + +function mod:OnFadeOut(this, ...) + if self.justFade then + self.justFade = nil + return true + end + local kind + if self.isUnit then + if GameTooltip:IsOwned(UIParent) then + kind = self.db.profile.units + else + kind = self.db.profile.unitFrames + end + else + if GameTooltip:IsOwned(UIParent) then + kind = self.db.profile.objects + else + kind = self.db.profile.otherFrames + end + end + self.isUnit = false + if kind == 2 then + return true + else + self.justHide = true + GameTooltip:Hide() + StarTip.tooltipMain:Hide() + end + +end + +function mod:GameTooltipHide(this, ...) + if self.justHide then + self.justHide = nil + return true + end + local kind + if self.isUnit then + if GameTooltip:IsOwned(UIParent) then + kind = self.db.profile.units + else + kind = self.db.profile.unitFrames + end + else + if GameTooltip:IsOwned(UIParent) then + kind = self.db.profile.objects + else + kind = self.db.profile.otherFrames + end + end + self.isUnit = false + if kind == 2 then + self.justFade = true + GameTooltip:FadeOut() + StarTip.tooltipMain:FadeOut() + else + return true + end +end + +function mod:SetUnit() + self.isUnit = true + updateExistenceFrame:SetScript("OnUpdate", checkExistence) +end + +function mod:SetItem() + self.isUnit = false + updateExistenceFrame:SetScript("OnUpdate", nil) +end + +function mod:SetSpell() + self.isUnit = false + updateExistenceFrame:SetScript("OnUpdate", nil) +end diff --git a/Modules/Clamp/StarTip_Clamp.toc b/Modules/Clamp/StarTip_Clamp.toc new file mode 100644 index 0000000..09b2f3c --- /dev/null +++ b/Modules/Clamp/StarTip_Clamp.toc @@ -0,0 +1,10 @@ +## Interface: 40200 +## Title: StarTip [Fade] +## Notes: Tooltips from Outerspace +## Author: Starlon +## Version: 1.0 +## Deps: StarTip +## X-Category: Tooltip +## X-Part-Of: StarTip + +Fade.lua diff --git a/Modules/Gestures/Gestures.lua b/Modules/Gestures/Gestures.lua index ca47844..665c636 100644 --- a/Modules/Gestures/Gestures.lua +++ b/Modules/Gestures/Gestures.lua @@ -66,7 +66,7 @@ StopNoise() startButton = "LeftButtonDown", stopButton = "LeftButtonUp", nextButton = "RightButtonDown", - cancelBUtton = "RightButtonUp", + cancelBUtton = "", startFunc = [[ return function(rec, a, b, c, d) print("startFunc") @@ -115,7 +115,12 @@ end cancelFunc = [[ return function(rec, a, b, c, d) print("cancelFunc") - self:Start() + if #rec.cdoodle > 1 then + local doodle = rec.cdoodle[#rec.cdoodle] + doodle[3]:Hide() + rec.cdoodle[#rec.cdoodle] = nil + self:Draw() + end end ]], tooltip = false, -- 1.7.9.5