diff --git a/Libs/LibJostle-3.0.lua b/Libs/LibJostle-3.0.lua index 01fb94d..8f7916a 100644 --- a/Libs/LibJostle-3.0.lua +++ b/Libs/LibJostle-3.0.lua @@ -1,16 +1,16 @@ --[[ Name: LibJostle-3.0 -Revision: $Rev: 44 $ +Revision: $Rev: 49 $ Author(s): ckknight (ckknight@gmail.com) Website: http://ckknight.wowinterface.com/ -Documentation: http://wiki.wowace.com/index.php/LibJostle-3.0 -SVN: http://svn.wowace.com/root/trunk/JostleLib/LibJostle-3.0 +Documentation: http://www.wowace.com/addons/libjostle-3-0/ +SVN: svn://svn.wowace.com/wow/libjostle-3-0/mainline/trunk Description: A library to handle rearrangement of blizzard's frames when bars are added to the sides of the screen. License: LGPL v2.1 ]] local MAJOR_VERSION = "LibJostle-3.0" -local MINOR_VERSION = tonumber(("$Revision: 44 $"):match("(%d+)")) + 90000 +local MINOR_VERSION = tonumber(("$Revision: 49 $"):match("(%d+)")) + 90000 if not LibStub then error(MAJOR_VERSION .. " requires LibStub") end @@ -33,13 +33,12 @@ local blizzardFrames = { 'CT_TargetFrame_Drag', 'Gypsy_PlayerFrameCapsule', 'Gypsy_TargetFrameCapsule', - 'TemporaryEnchantFrame', + 'ConsolidatedBuffs', 'DEFAULT_CHAT_FRAME', 'ChatFrame2', 'GroupLootFrame1', 'TutorialFrameParent', 'FramerateLabel', - 'QuestTimerFrame', 'DurabilityFrame', 'CastingBarFrame', } @@ -156,7 +155,7 @@ function Jostle:WorldMapFrame_Hide() end function Jostle:TicketStatusFrame_OnEvent() - self:Refresh(TicketStatusFrame, TemporaryEnchantFrame) + self:Refresh(TicketStatusFrame, ConsolidatedBuffs) end function Jostle:FCF_UpdateDockPosition() @@ -168,7 +167,7 @@ function Jostle:FCF_UpdateCombatLogPosition() end function Jostle:UIParent_ManageFramePositions() - self:Refresh(GroupLootFrame1, TutorialFrameParent, FramerateLabel, QuestTimerFrame, DurabilityFrame) + self:Refresh(GroupLootFrame1, TutorialFrameParent, FramerateLabel, DurabilityFrame) end function Jostle:PlayerFrame_SequenceFinished() @@ -394,7 +393,7 @@ function Jostle:Refresh(...) DurabilityFrame:Hide() elseif frame == FramerateLabel and ((frameData.lastX and not isClose(frameData.lastX, frame:GetLeft())) or not isClose(WorldFrame:GetHeight() * WorldFrame:GetScale(), UIParent:GetHeight() * UIParent:GetScale())) then -- do nothing - elseif frame == PlayerFrame or frame == MainMenuBar or frame == TemporaryEnchantFrame or frame == CastingBarFrame or frame == TutorialFrameParent or frame == FramerateLabel or frame == QuestTimerFrame or frame == DurabilityFrame or frame == QuestWatchFrame or not (frameData.lastScale and frame.GetScale and frameData.lastScale == frame:GetScale()) or not (frameData.lastX and frameData.lastY and (not isClose(frameData.lastX, frame:GetLeft()) or not isClose(frameData.lastY, frame:GetTop()))) then + elseif frame == PlayerFrame or frame == MainMenuBar or frame == ConsolidatedBuffs or frame == CastingBarFrame or frame == TutorialFrameParent or frame == FramerateLabel or frame == DurabilityFrame or frame == WatchFrame or not (frameData.lastScale and frame.GetScale and frameData.lastScale == frame:GetScale()) or not (frameData.lastX and frameData.lastY and (not isClose(frameData.lastX, frame:GetLeft()) or not isClose(frameData.lastY, frame:GetTop()))) then local anchor local anchorAlt local width, height = GetScreenWidth(), GetScreenHeight() @@ -423,7 +422,7 @@ function Jostle:Refresh(...) end if frame == MinimapCluster and not MinimapBorderTop:IsShown() then offset = offset + MinimapBorderTop:GetHeight() * 3/5 - elseif frame == TemporaryEnchantFrame and TicketStatusFrame:IsShown() then + elseif frame == ConsolidatedBuffs and TicketStatusFrame:IsShown() then offset = offset - TicketStatusFrame:GetHeight() * TicketStatusFrame:GetScale() elseif frame == DEFAULT_CHAT_FRAME then y = MainMenuBar:GetHeight() * MainMenuBar:GetScale() + 32 @@ -450,15 +449,12 @@ function Jostle:Refresh(...) if MultiBarBottomLeft:IsShown() or MultiBarBottomRight:IsShown() then offset = offset + MultiBarBottomLeft:GetHeight() * MultiBarBottomLeft:GetScale() end - elseif frame == QuestTimerFrame or frame == DurabilityFrame or frame == QuestWatchFrame then + elseif frame == DurabilityFrame or frame == WatchFrame then anchorFrame = MinimapCluster x = 0 y = 0 offset = 0 - if QuestTimerFrame and frame ~= QuestTimerFrame and QuestTimerFrame:IsShown() then - y = y - QuestTimerFrame:GetHeight() * QuestTimerFrame:GetScale() - end - if frame == QuestWatchFrame and DurabilityFrame:IsShown() then + if frame == WatchFrame and DurabilityFrame:IsShown() then y = y - DurabilityFrame:GetHeight() * DurabilityFrame:GetScale() end if frame == DurabilityFrame then diff --git a/Libs/tekKonfigAboutPanel.lua b/Libs/tekKonfigAboutPanel.lua index 98022b4..f7ea166 100644 --- a/Libs/tekKonfigAboutPanel.lua +++ b/Libs/tekKonfigAboutPanel.lua @@ -1,115 +1,115 @@ - -local lib, oldminor = LibStub:NewLibrary("tekKonfig-AboutPanel", 5) -if not lib then return end - - -function lib.new(parent, addonname) - local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer) - frame.name, frame.parent, frame.addonname = parent and "About" or addonname, parent, addonname - frame:Hide() - frame:SetScript("OnShow", lib.OnShow) - InterfaceOptions_AddCategory(frame) - return frame -end - - -local editbox = CreateFrame('EditBox', nil, UIParent) -editbox:Hide() -editbox:SetAutoFocus(true) -editbox:SetHeight(32) -editbox:SetFontObject('GameFontHighlightSmall') -lib.editbox = editbox - -local left = editbox:CreateTexture(nil, "BACKGROUND") -left:SetWidth(8) left:SetHeight(20) -left:SetPoint("LEFT", -5, 0) -left:SetTexture("Interface\\Common\\Common-Input-Border") -left:SetTexCoord(0, 0.0625, 0, 0.625) - -local right = editbox:CreateTexture(nil, "BACKGROUND") -right:SetWidth(8) right:SetHeight(20) -right:SetPoint("RIGHT", 0, 0) -right:SetTexture("Interface\\Common\\Common-Input-Border") -right:SetTexCoord(0.9375, 1, 0, 0.625) - -local center = editbox:CreateTexture(nil, "BACKGROUND") -center:SetHeight(20) -center:SetPoint("RIGHT", right, "LEFT", 0, 0) -center:SetPoint("LEFT", left, "RIGHT", 0, 0) -center:SetTexture("Interface\\Common\\Common-Input-Border") -center:SetTexCoord(0.0625, 0.9375, 0, 0.625) - -editbox:SetScript("OnEscapePressed", editbox.ClearFocus) -editbox:SetScript("OnEnterPressed", editbox.ClearFocus) -editbox:SetScript("OnEditFocusLost", editbox.Hide) -editbox:SetScript("OnEditFocusGained", editbox.HighlightText) -editbox:SetScript("OnTextChanged", function(self) - self:SetText(self:GetParent().val) - self:HighlightText() -end) - - -function lib.OpenEditbox(self) - editbox:SetText(self.val) - editbox:SetParent(self) - editbox:SetPoint("LEFT", self) - editbox:SetPoint("RIGHT", self) - editbox:Show() -end - - -local fields = {"Version", "Author", "X-Category", "X-License", "X-Email", "X-Website", "X-Credits"} -local haseditbox = {["Version"] = true, ["X-Website"] = true, ["X-Email"] = true} -local function HideTooltip() GameTooltip:Hide() end -local function ShowTooltip(self) - GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") - GameTooltip:SetText("Click and press Ctrl-C to copy") -end -function lib.OnShow(frame) - local notes = GetAddOnMetadata(frame.addonname, "Notes") - - local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") - title:SetPoint("TOPLEFT", 16, -16) - title:SetText((frame.parent or frame.addonname).." - About") - - local subtitle = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") - subtitle:SetHeight(32) - subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8) - subtitle:SetPoint("RIGHT", parent, -32, 0) - subtitle:SetNonSpaceWrap(true) - subtitle:SetJustifyH("LEFT") - subtitle:SetJustifyV("TOP") - subtitle:SetText(notes) - - local anchor - for _,field in pairs(fields) do - local val = GetAddOnMetadata(frame.addonname, field) - if val then - local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") - title:SetWidth(75) - if not anchor then title:SetPoint("TOPLEFT", subtitle, "BOTTOMLEFT", -2, -8) - else title:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -6) end - title:SetJustifyH("RIGHT") - title:SetText(field:gsub("X%-", "")) - - local detail = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") - detail:SetPoint("LEFT", title, "RIGHT", 4, 0) - detail:SetPoint("RIGHT", -16, 0) - detail:SetJustifyH("LEFT") - detail:SetText((haseditbox[field] and "|cff9999ff" or "").. val) - - if haseditbox[field] then - local button = CreateFrame("Button", nil, frame) - button:SetAllPoints(detail) - button.val = val - button:SetScript("OnClick", lib.OpenEditbox) - button:SetScript("OnEnter", ShowTooltip) - button:SetScript("OnLeave", HideTooltip) - end - - anchor = title - end - end - - frame:SetScript("OnShow", nil) -end + +local lib, oldminor = LibStub:NewLibrary("tekKonfig-AboutPanel", 5) +if not lib then return end + + +function lib.new(parent, addonname) + local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer) + frame.name, frame.parent, frame.addonname = parent and "About" or addonname, parent, addonname + frame:Hide() + frame:SetScript("OnShow", lib.OnShow) + InterfaceOptions_AddCategory(frame) + return frame +end + + +local editbox = CreateFrame('EditBox', nil, UIParent) +editbox:Hide() +editbox:SetAutoFocus(true) +editbox:SetHeight(32) +editbox:SetFontObject('GameFontHighlightSmall') +lib.editbox = editbox + +local left = editbox:CreateTexture(nil, "BACKGROUND") +left:SetWidth(8) left:SetHeight(20) +left:SetPoint("LEFT", -5, 0) +left:SetTexture("Interface\\Common\\Common-Input-Border") +left:SetTexCoord(0, 0.0625, 0, 0.625) + +local right = editbox:CreateTexture(nil, "BACKGROUND") +right:SetWidth(8) right:SetHeight(20) +right:SetPoint("RIGHT", 0, 0) +right:SetTexture("Interface\\Common\\Common-Input-Border") +right:SetTexCoord(0.9375, 1, 0, 0.625) + +local center = editbox:CreateTexture(nil, "BACKGROUND") +center:SetHeight(20) +center:SetPoint("RIGHT", right, "LEFT", 0, 0) +center:SetPoint("LEFT", left, "RIGHT", 0, 0) +center:SetTexture("Interface\\Common\\Common-Input-Border") +center:SetTexCoord(0.0625, 0.9375, 0, 0.625) + +editbox:SetScript("OnEscapePressed", editbox.ClearFocus) +editbox:SetScript("OnEnterPressed", editbox.ClearFocus) +editbox:SetScript("OnEditFocusLost", editbox.Hide) +editbox:SetScript("OnEditFocusGained", editbox.HighlightText) +editbox:SetScript("OnTextChanged", function(self) + self:SetText(self:GetParent().val) + self:HighlightText() +end) + + +function lib.OpenEditbox(self) + editbox:SetText(self.val) + editbox:SetParent(self) + editbox:SetPoint("LEFT", self) + editbox:SetPoint("RIGHT", self) + editbox:Show() +end + + +local fields = {"Version", "Author", "X-Category", "X-License", "X-Email", "X-Website", "X-Credits"} +local haseditbox = {["Version"] = true, ["X-Website"] = true, ["X-Email"] = true} +local function HideTooltip() GameTooltip:Hide() end +local function ShowTooltip(self) + GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") + GameTooltip:SetText("Click and press Ctrl-C to copy") +end +function lib.OnShow(frame) + local notes = GetAddOnMetadata(frame.addonname, "Notes") + + local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") + title:SetPoint("TOPLEFT", 16, -16) + title:SetText((frame.parent or frame.addonname).." - About") + + local subtitle = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") + subtitle:SetHeight(32) + subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8) + subtitle:SetPoint("RIGHT", parent, -32, 0) + subtitle:SetNonSpaceWrap(true) + subtitle:SetJustifyH("LEFT") + subtitle:SetJustifyV("TOP") + subtitle:SetText(notes) + + local anchor + for _,field in pairs(fields) do + local val = GetAddOnMetadata(frame.addonname, field) + if val then + local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") + title:SetWidth(75) + if not anchor then title:SetPoint("TOPLEFT", subtitle, "BOTTOMLEFT", -2, -8) + else title:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -6) end + title:SetJustifyH("RIGHT") + title:SetText(field:gsub("X%-", "")) + + local detail = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") + detail:SetPoint("LEFT", title, "RIGHT", 4, 0) + detail:SetPoint("RIGHT", -16, 0) + detail:SetJustifyH("LEFT") + detail:SetText((haseditbox[field] and "|cff9999ff" or "").. val) + + if haseditbox[field] then + local button = CreateFrame("Button", nil, frame) + button:SetAllPoints(detail) + button.val = val + button:SetScript("OnClick", lib.OpenEditbox) + button:SetScript("OnEnter", ShowTooltip) + button:SetScript("OnLeave", HideTooltip) + end + + anchor = title + end + end + + frame:SetScript("OnShow", nil) +end diff --git a/Libs/tekKonfigScroll.lua b/Libs/tekKonfigScroll.lua index 18ad71a..ff69b13 100644 --- a/Libs/tekKonfigScroll.lua +++ b/Libs/tekKonfigScroll.lua @@ -1,80 +1,80 @@ - -local lib, oldminor = LibStub:NewLibrary("tekKonfig-Scroll", 2) -if not lib then return end - -lib.bg = { - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, - tileSize = 16, - edgeSize = 12, - insets = { left = 0, right = 0, top = 5, bottom = 5 } -} - --- Creates a scrollbar --- Parent is required, offset and step are optional -function lib.new(parent, offset, step) - local f = CreateFrame("Slider", nil, parent) - f:SetWidth(16) - - f:SetPoint("TOPRIGHT", 0 - (offset or 0), -16 - (offset or 0)) - f:SetPoint("BOTTOMRIGHT", 0 - (offset or 0), 16 + (offset or 0)) - - local up = CreateFrame("Button", nil, f) - up:SetPoint("BOTTOM", f, "TOP") - up:SetWidth(16) up:SetHeight(16) - up:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Up") - up:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Down") - up:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Disabled") - up:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Highlight") - - up:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - up:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - up:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - up:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - up:GetHighlightTexture():SetBlendMode("ADD") - - up:SetScript("OnClick", function(self) - local parent = self:GetParent() - parent:SetValue(parent:GetValue() - (step or parent:GetHeight()/2)) - PlaySound("UChatScrollButton") - end) - - local down = CreateFrame("Button", nil, f) - down:SetPoint("TOP", f, "BOTTOM") - down:SetWidth(16) down:SetHeight(16) - down:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up") - down:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down") - down:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Disabled") - down:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Highlight") - - down:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - down:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - down:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - down:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) - down:GetHighlightTexture():SetBlendMode("ADD") - - down:SetScript("OnClick", function(self) - local parent = self:GetParent() - parent:SetValue(parent:GetValue() + (step or parent:GetHeight()/2)) - PlaySound("UChatScrollButton") - end) - - f:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") - local thumb = f:GetThumbTexture() - thumb:SetWidth(16) thumb:SetHeight(24) - thumb:SetTexCoord(1/4, 3/4, 1/8, 7/8) - - f:SetScript("OnValueChanged", function(self, value) - local min, max = self:GetMinMaxValues() - if value == min then up:Disable() else up:Enable() end - if value == max then down:Disable() else down:Enable() end - end) - - local border = CreateFrame("Frame", nil, f) - border:SetPoint("TOPLEFT", up, -5, 5) - border:SetPoint("BOTTOMRIGHT", down, 5, -3) - border:SetBackdrop(lib.bg) - border:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 0.5) - - return f, up, down, border -end + +local lib, oldminor = LibStub:NewLibrary("tekKonfig-Scroll", 2) +if not lib then return end + +lib.bg = { + edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", + tile = true, + tileSize = 16, + edgeSize = 12, + insets = { left = 0, right = 0, top = 5, bottom = 5 } +} + +-- Creates a scrollbar +-- Parent is required, offset and step are optional +function lib.new(parent, offset, step) + local f = CreateFrame("Slider", nil, parent) + f:SetWidth(16) + + f:SetPoint("TOPRIGHT", 0 - (offset or 0), -16 - (offset or 0)) + f:SetPoint("BOTTOMRIGHT", 0 - (offset or 0), 16 + (offset or 0)) + + local up = CreateFrame("Button", nil, f) + up:SetPoint("BOTTOM", f, "TOP") + up:SetWidth(16) up:SetHeight(16) + up:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Up") + up:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Down") + up:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Disabled") + up:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollUpButton-Highlight") + + up:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + up:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + up:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + up:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + up:GetHighlightTexture():SetBlendMode("ADD") + + up:SetScript("OnClick", function(self) + local parent = self:GetParent() + parent:SetValue(parent:GetValue() - (step or parent:GetHeight()/2)) + PlaySound("UChatScrollButton") + end) + + local down = CreateFrame("Button", nil, f) + down:SetPoint("TOP", f, "BOTTOM") + down:SetWidth(16) down:SetHeight(16) + down:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up") + down:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down") + down:SetDisabledTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Disabled") + down:SetHighlightTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Highlight") + + down:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + down:GetPushedTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + down:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + down:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) + down:GetHighlightTexture():SetBlendMode("ADD") + + down:SetScript("OnClick", function(self) + local parent = self:GetParent() + parent:SetValue(parent:GetValue() + (step or parent:GetHeight()/2)) + PlaySound("UChatScrollButton") + end) + + f:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") + local thumb = f:GetThumbTexture() + thumb:SetWidth(16) thumb:SetHeight(24) + thumb:SetTexCoord(1/4, 3/4, 1/8, 7/8) + + f:SetScript("OnValueChanged", function(self, value) + local min, max = self:GetMinMaxValues() + if value == min then up:Disable() else up:Enable() end + if value == max then down:Disable() else down:Enable() end + end) + + local border = CreateFrame("Frame", nil, f) + border:SetPoint("TOPLEFT", up, -5, 5) + border:SetPoint("BOTTOMRIGHT", down, 5, -3) + border:SetBackdrop(lib.bg) + border:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 0.5) + + return f, up, down, border +end