diff --git a/ProfessionMenu/Libs/DewdropLib/Changelog-DewdropLib-r326.txt b/ProfessionMenu/Libs/DewdropLib/Changelog-DewdropLib-r326.txt new file mode 100644 index 0000000..b301b8d --- /dev/null +++ b/ProfessionMenu/Libs/DewdropLib/Changelog-DewdropLib-r326.txt @@ -0,0 +1,15 @@ +------------------------------------------------------------------------ +r326 | oscarucb | 2013-10-12 19:33:25 +0000 (Sat, 12 Oct 2013) | 2 lines +Changed paths: + M /trunk/Dewdrop-2.0/Dewdrop-2.0.lua + +fix menu width auto-resizing to work correctly for long items + +------------------------------------------------------------------------ +r325 | oscarucb | 2013-02-23 05:42:20 +0000 (Sat, 23 Feb 2013) | 2 lines +Changed paths: + M /trunk/Dewdrop-2.0/Dewdrop-2.0.lua + +tweak to allow loading in combat + +------------------------------------------------------------------------ diff --git a/ProfessionMenu/Libs/DewdropLib/Dewdrop-2.0/Dewdrop-2.0.lua b/ProfessionMenu/Libs/DewdropLib/Dewdrop-2.0/Dewdrop-2.0.lua index f1dbaf9..c07198e 100644 --- a/ProfessionMenu/Libs/DewdropLib/Dewdrop-2.0/Dewdrop-2.0.lua +++ b/ProfessionMenu/Libs/DewdropLib/Dewdrop-2.0/Dewdrop-2.0.lua @@ -1,6 +1,6 @@ ---[[ +--[[ Name: Dewdrop-2.0 -Revision: $Rev: 321 $ +Revision: $Rev: 326 $ Author(s): ckknight (ckknight@gmail.com) Website: http://ckknight.wowinterface.com/ Documentation: http://wiki.wowace.com/index.php/Dewdrop-2.0 @@ -11,7 +11,7 @@ License: LGPL v2.1 ]] local MAJOR_VERSION = "Dewdrop-2.0" -local MINOR_VERSION = tonumber(strmatch("$Revision: 321 $", "%d+")) + 90000 +local MINOR_VERSION = tonumber(strmatch("$Revision: 326 $", "%d+")) + 90000 if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end @@ -171,8 +171,9 @@ local buttons -- master secureframe that we pop onto menu items on mouseover. This requires -- some dark magic with OnLeave etc, but it's not too bad. -local secureFrame = CreateFrame("Button", nil, nil, "SecureActionButtonTemplate") -secureFrame:Hide() +local eventFrame = CreateFrame("Button") +local secureFrame +local createSecureFrame local function secureFrame_Show(self) local owner = self.owner @@ -209,37 +210,43 @@ local function secureFrame_Hide(self) self.secure = nil end -secureFrame:SetScript("OnEvent", - function() +eventFrame:SetScript("OnEvent", + function(this, event) if event=="PLAYER_REGEN_ENABLED" then - this.combat = false - if not this:IsShown() and this.owner then - secureFrame_Show(this) + createSecureFrame() + secureFrame.combat = false + if not secureFrame:IsShown() and secureFrame.owner then + secureFrame_Show(secureFrame) end - elseif event=="PLAYER_REGEN_DISABLED" then - this.combat = true - if this:IsShown() then - secureFrame_Hide(this) + elseif event=="PLAYER_REGEN_DISABLED" and secureFrame then + secureFrame.combat = true + if secureFrame:IsShown() then + secureFrame_Hide(secureFrame) end end end ) -secureFrame:RegisterEvent("PLAYER_REGEN_ENABLED") -secureFrame:RegisterEvent("PLAYER_REGEN_DISABLED") +eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED") +eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED") + +function createSecureFrame() + if secureFrame or InCombatLockdown() then return end + secureFrame = CreateFrame("Button", nil, nil, "SecureActionButtonTemplate") + secureFrame:Hide() secureFrame:SetScript("OnLeave", - function() + function(this) local owner=this.owner this:Deactivate() - owner:GetScript("OnLeave")() + owner:GetScript("OnLeave")(owner) end ) secureFrame:HookScript("OnClick", - function() + function(this) local realthis = this this = this.owner - this:GetScript("OnClick")() + this:GetScript("OnClick")(this) end ) @@ -266,6 +273,8 @@ function secureFrame:Deactivate() self.owner = nil end +end +createSecureFrame() -- END secure frame utilities @@ -354,8 +363,8 @@ local function CheckSize(self, level) extra = extra + 24 end button.text:SetFont(STANDARD_TEXT_FONT, button.textHeight) - if button.text:GetWidth() + extra > width then - width = button.text:GetWidth() + extra + if button.text:GetStringWidth() + extra > width then + width = button.text:GetStringWidth() + extra end end level:SetWidth(width + 20) @@ -611,7 +620,7 @@ local function AcquireButton(self, level) radioHighlight:SetBlendMode("ADD") radioHighlight:SetTexCoord(0.5, 0.75, 0, 1) radioHighlight:Hide() - button:SetScript("OnEnter", function() + button:SetScript("OnEnter", function(this) if (sliderFrame and sliderFrame:IsShown() and sliderFrame.mouseDown and sliderFrame.level == this.level.num + 1) or (editBoxFrame and editBoxFrame:IsShown() and editBoxFrame.mouseDown and editBoxFrame.level == this.level.num + 1) then for i = 1, this.level.num do Refresh(self, levels[i]) @@ -648,12 +657,12 @@ local function AcquireButton(self, level) end showGameTooltip(this) end) - button:SetScript("OnHide", function() + button:SetScript("OnHide", function(this) if this.secure and secureFrame:IsOwnedBy(this) then secureFrame:Deactivate() end end) - button:SetScript("OnLeave", function() + button:SetScript("OnLeave", function(this) if this.secure and secureFrame:IsShown() then return; -- it's ok, we didn't actually mouse out of the button, only onto the secure frame on top of it end @@ -668,7 +677,7 @@ local function AcquireButton(self, level) GameTooltip:Hide() end) local first = true - button:SetScript("OnClick", function() + button:SetScript("OnClick", function(this) if not this.disabled then if this.hasColorSwatch then local func = button.colorFunc @@ -762,12 +771,12 @@ local function AcquireButton(self, level) button.text = text text:SetFontObject(GameFontHighlightSmall) button.text:SetFont(STANDARD_TEXT_FONT, UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT) - button:SetScript("OnMouseDown", function() + button:SetScript("OnMouseDown", function(this) if not this.disabled and (this.func or this.colorFunc or this.closeWhenClicked) then text:SetPoint("LEFT", button, "LEFT", this.notCheckable and 1 or 25, -1) end end) - button:SetScript("OnMouseUp", function() + button:SetScript("OnMouseUp", function(this) if not this.disabled and (this.func or this.colorFunc or this.closeWhenClicked) then text:SetPoint("LEFT", button, "LEFT", this.notCheckable and 0 or 24, 0) end @@ -899,7 +908,7 @@ local function AcquireLevel(self, level) frame:SetScript("OnLeave", function() StartCounting(self, i) end) - frame:SetScript("OnMouseWheel", function() + frame:SetScript("OnMouseWheel", function(this, arg1) Scroll(self, frame, arg1 < 0) end) if i == 1 then @@ -2925,6 +2934,7 @@ function Dewdrop:Register(parent, ...) if parent:HasScript("OnMouseUp") then local script = parent:GetScript("OnMouseUp") parent:SetScript("OnMouseUp", function(this, ...) + local arg1 = ... if script then script(this, ...) end diff --git a/ProfessionMenu/Libs/DewdropLib/DewdropLib.toc b/ProfessionMenu/Libs/DewdropLib/DewdropLib.toc index f6414c5..1a7b862 100644 --- a/ProfessionMenu/Libs/DewdropLib/DewdropLib.toc +++ b/ProfessionMenu/Libs/DewdropLib/DewdropLib.toc @@ -8,7 +8,7 @@ ## OptionalDeps: Ace2 ## X-AceLibrary-Dewdrop-2.0: true ## X-License: LGPL v2.1 -## X-Curse-Packaged-Version: r321 +## X-Curse-Packaged-Version: r326 ## X-Curse-Project-Name: DewdropLib ## X-Curse-Project-ID: dewdroplib ## X-Curse-Repository-ID: wow/dewdroplib/mainline diff --git a/ProfessionMenu/ProfessionMenu.lua b/ProfessionMenu/ProfessionMenu.lua index 7866c4e..03d2f2f 100644 --- a/ProfessionMenu/ProfessionMenu.lua +++ b/ProfessionMenu/ProfessionMenu.lua @@ -245,6 +245,8 @@ function PM:AddDividerLine(maxLenght) return true end + + --sets up the drop down menu for specs local function ProfessionMenu_DewdropRegister(self) if dewdrop:IsOpen(self) then dewdrop:Close() return end @@ -339,6 +341,16 @@ local function ProfessionMenu_DewdropRegister(self) 'dontHook', true ) dewdrop:Open(self) + local hook + if not hook then + WorldFrame:HookScript("OnEnter", function() + if dewdrop:IsOpen(self) then + dewdrop:Close() + end + end) + hook = true + end + GameTooltip:Hide() end @@ -438,7 +450,7 @@ end InterfaceOptionsFrame:HookScript("OnShow", function() if InterfaceOptionsFrame and ProfessionMenuOptionsFrame:IsVisible() then - PM:OpenOptions() + PM:OpenOptions() end end) diff --git a/ProfessionMenu/ProfessionMenu.toc b/ProfessionMenu/ProfessionMenu.toc index 36516e3..f25787e 100644 --- a/ProfessionMenu/ProfessionMenu.toc +++ b/ProfessionMenu/ProfessionMenu.toc @@ -7,6 +7,6 @@ ## X-Category: Profession ## X-OptionsFrame: ProfessionMenuOptionsFrame ## DefaultState: enabled -## Version: 0.8 +## Version: 0.9 embeds.xml