From f3b50728449988d8152d1a63e29bb830b9971a3f Mon Sep 17 00:00:00 2001 From: Sidoine De Wispelaere Date: Sun, 28 Jun 2009 19:21:39 +0000 Subject: [PATCH] - ButtonFacade support git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@73 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Locale-enUS.lua | 3 +- Locale-frFR.lua | 3 +- Ovale.lua | 21 ++++++++++-- Ovale.toc | 6 ++-- OvaleFrame.lua | 100 ++++++++++++++++++++++++++++++++++++++++--------------- OvaleIcone.lua | 51 +++++++++++++--------------- OvaleIcone.xml | 8 ++--- 7 files changed, 125 insertions(+), 67 deletions(-) diff --git a/Locale-enUS.lua b/Locale-enUS.lua index aab5d5f..5a33793 100644 --- a/Locale-enUS.lua +++ b/Locale-enUS.lua @@ -23,4 +23,5 @@ L["Affichage numérique"] = "Numeric display" L["Affiche le temps de recharge sous forme numérique"] = "Show the remaining time in numerical form" L["Si cible uniquement"] = "If has target" L["Verrouiller position"] = "Lock position" -L["Vertical"] = true \ No newline at end of file +L["Vertical"] = true +L["Marge entre deux icônes"] = "Margin between icons" \ No newline at end of file diff --git a/Locale-frFR.lua b/Locale-frFR.lua index 0eaa86a..73dfa6d 100644 --- a/Locale-frFR.lua +++ b/Locale-frFR.lua @@ -23,4 +23,5 @@ L["Affichage numérique"] = true L["Affiche le temps de recharge sous forme numérique"] = true L["Si cible uniquement"] = true L["Verrouiller position"] = true -L["Vertical"] = true \ No newline at end of file +L["Vertical"] = true +L["Marge entre deux icônes"] = true \ No newline at end of file diff --git a/Ovale.lua b/Ovale.lua index c244daf..5a51815 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -114,6 +114,15 @@ local options = get = function(info) return Ovale.db.profile.apparence.smallIconHeight end, set = function(info,value) Ovale.db.profile.apparence.smallIconHeight = value; Ovale:UpdateFrame() end }, + margin = + { + order = 5.5, + type = "range", + name = L["Marge entre deux icônes"], + min = 0, max = 64, step = 1, + get = function(info) return Ovale.db.profile.apparence.margin end, + set = function(info,value) Ovale.db.profile.apparence.margin = value; Ovale:UpdateFrame() end + }, raccourcis = { order = 6, @@ -380,6 +389,7 @@ function Ovale:FirstInit() self.firstInit = true + options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) self.AceConfig:RegisterOptionsTable("Ovale", options.args.code, "Ovale") self.AceConfig:RegisterOptionsTable("Ovale Profile", options.args.profile) @@ -856,9 +866,10 @@ function Ovale:ChargerDefaut() top = 500, check = {}, list = {}, - apparence = {enCombat=false, iconWidth = 64, iconHeight = 64, - smallIconWidth=32, smallIconHeight=32, raccourcis=true, numeric=false, avecCible = false, - verrouille = false, vertical = false} + apparence = {enCombat=false, iconWidth = 64, iconHeight = 64, margin = 4, + smallIconWidth=28, smallIconHeight=28, raccourcis=true, numeric=false, avecCible = false, + verrouille = false, vertical = false}, + skin = {SkinID="Blizzard", Backdrop = true, Gloss = false, Colors = {}} } }) end @@ -876,6 +887,10 @@ local function OnDropDownValueChanged(widget) Ovale.db.profile.list[widget.userdata.k] = widget.value end +function Ovale:ToggleOptions() + self.frame:ToggleOptions() +end + function Ovale:UpdateFrame() self.frame:ReleaseChildren() diff --git a/Ovale.toc b/Ovale.toc index 69e9227..e2b2037 100644 --- a/Ovale.toc +++ b/Ovale.toc @@ -1,10 +1,10 @@ -## Interface: 30200 +## Interface: 30100 ## Title: Ovale ## Notes: Show the icon of the next spell to cast ## Notes-frFR: Affiche l'icône du prochain sort à lancer ## Author: Sidoine -## Version: 3.2.0 -## OptionalDeps: Ace3 +## Version: 3.1.14 +## OptionalDeps: Ace3, ButtonFacade ## SavedVariables: OvaleDB ## SavedVariablesPerCharacter: OvaleDBPC ## X-Category: Combat diff --git a/OvaleFrame.lua b/OvaleFrame.lua index 49fe473..46bb219 100644 --- a/OvaleFrame.lua +++ b/OvaleFrame.lua @@ -1,5 +1,6 @@ local AceGUI = LibStub("AceGUI-3.0") - +local LBF = LibStub("LibButtonFacade", true) + ---------------- -- Main Frame -- ---------------- @@ -12,13 +13,6 @@ do local Type = "OvaleFrame" local Version = 7 - local FrameBackdrop = { - bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", - edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, tileSize = 32, edgeSize = 32, - insets = { left = 8, right = 8, top = 8, bottom = 8 } - } - local function frameOnClose(this) this.obj:Fire("OnClose") end @@ -35,18 +29,22 @@ do end end + local function ToggleOptions(this) + if (this.content:IsShown()) then + this.content:Hide() + else + this.content:Show() + end + end + local function frameOnMouseUp(this) this:StopMovingOrSizing() if (Ovale.db.profile.left~=this:GetLeft() or Ovale.db.profile.top ~=this:GetTop()) then Ovale.db.profile.left = this:GetLeft() Ovale.db.profile.top = this:GetTop() - else - if (this.obj.content:IsShown()) then - this.obj.content:Hide() - else - this.obj.content:Show() - end + -- else + -- this.obj:ToggleOptions() end end @@ -55,6 +53,9 @@ do -- child.frame:Show() --end -- this.obj.content:Show() + if (not Ovale.db.profile.apparence.verrouille) then + this.obj.barre:Show() + end end @@ -63,6 +64,7 @@ do -- child.frame:Hide() --end --this.obj.content:Hide() + this.obj.barre:Hide() end local function Hide(self) @@ -111,6 +113,16 @@ do self.content:SetHeight(height+50) end + local function OnSkinChanged(self, skinID, gloss, backdrop, colors) + -- for k, icon in pairs(self.icone) do + -- icon:UpdateSkin(skinID, gloss, backdrop, colors) + -- end + Ovale.db.profile.SkinID = skinID + Ovale.db.profile.Gloss = gloss + Ovale.db.profile.Backdrop = backdrop + Ovale.db.profile.Colors = colors + end + local function UpdateIcons(self) for k, icon in pairs(self.icone) do icon:Hide() @@ -125,30 +137,45 @@ do return; end + local BARRE = 8 + + local margin = Ovale.db.profile.apparence.margin + for k,node in pairs(Ovale.masterNodes) do if (not self.icone[k]) then - self.icone[k] = CreateFrame("Frame",nil,self.frame,"OvaleIcone"); + -- self.icone[k] = CreateFrame("Frame", "Icon"..k,self.frame,"OvaleIcone"); + self.icone[k] = CreateFrame("CheckButton", "Icon"..k,self.frame,"OvaleIcone"); end + -- self.icone[k]:SetFrameLevel(1) self.icone[k].masterNode = node local width, height if (node.params.size == "small") then - width = Ovale.db.profile.apparence.smallIconWidth - height = Ovale.db.profile.apparence.smallIconHeight + width = Ovale.db.profile.apparence.smallIconWidth + margin + height = Ovale.db.profile.apparence.smallIconHeight + margin else - width = Ovale.db.profile.apparence.iconWidth - height = Ovale.db.profile.apparence.iconHeight + width = Ovale.db.profile.apparence.iconWidth + margin + height = Ovale.db.profile.apparence.iconHeight + margin end - if (top + height > Ovale.db.profile.apparence.iconHeight) then + if (top + height > Ovale.db.profile.apparence.iconHeight + margin) then top = 0 left = maxWidth end if (Ovale.db.profile.apparence.vertical) then - self.icone[k]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",top,-left) + self.icone[k]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",top,-left-BARRE-margin) else - self.icone[k]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",left,-top) + self.icone[k]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",left,-top-BARRE-margin) + end + self.icone[k]:SetWidth(width - margin) + self.icone[k]:SetHeight(height - margin) + if (not LBF) then + self.icone[k].normalTexture:SetWidth((width - margin)*66/36) + self.icone[k].normalTexture:SetHeight((height - margin)*66/36) + self.icone[k].shortcut:SetWidth(width-margin) + self.icone[k].remains:SetWidth(width-margin) + end + if LBF then + self.icone[k]:SetSkinGroup(self.skinGroup) end - self.icone[k]:SetWidth(width) - self.icone[k]:SetHeight(height) self.icone[k]:Show(); top = top + height if (top> maxHeight) then @@ -158,13 +185,18 @@ do maxWidth = left + width end end + if (Ovale.db.profile.apparence.vertical) then + self.barre:SetWidth(maxHeight - margin) + self.barre:SetHeight(BARRE) self.frame:SetWidth(maxHeight) - self.frame:SetHeight(maxWidth) + self.frame:SetHeight(maxWidth+BARRE+margin) self.content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",maxHeight,0) else + self.barre:SetWidth(maxWidth - margin) + self.barre:SetHeight(BARRE) self.frame:SetWidth(maxWidth) - self.frame:SetHeight(maxHeight) + self.frame:SetHeight(maxHeight+BARRE+margin) self.content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",maxWidth,0) end end @@ -184,6 +216,8 @@ do self.ApplyStatus = ApplyStatus self.LayoutFinished = OnLayoutFinished self.UpdateIcons = UpdateIcons + self.OnSkinChanged = OnSkinChanged + self.ToggleOptions = ToggleOptions self.localstatus = {} self.icone = {} @@ -204,6 +238,11 @@ do frame:SetScript("OnHide",frameOnClose) + self.barre = self.frame:CreateTexture(); + self.barre:SetTexture(0,0.8,0) + self.barre:SetPoint("TOPLEFT",0,0) + self.barre:Hide() + --Container Support local content = CreateFrame("Frame",nil,frame) self.content = content @@ -217,6 +256,15 @@ do AceGUI:RegisterAsContainer(self) + if LBF then + self.skinGroup = LBF:Group("Ovale") + self.skinGroup.SkinID = Ovale.db.profile.SkinID + self.skinGroup.Gloss = Ovale.db.profile.Gloss + self.skinGroup.Backdrop = Ovale.db.profile.Backdrop + self.skinGroup.Colors = Ovale.db.profile.Colors + LBF:RegisterSkinCallback("Ovale", self.OnSkinChanged, self) + end + return self end diff --git a/OvaleIcone.lua b/OvaleIcone.lua index 2e0d589..a107144 100644 --- a/OvaleIcone.lua +++ b/OvaleIcone.lua @@ -93,10 +93,10 @@ -- L'indicateur de portée self.aPortee:Show() if (IsActionInRange(meilleureAction,"target")==1) then - self.aPortee:SetTexture(1,1,1) + self.aPortee:SetVertexColor(0.6,0.6,0.6) self.aPortee:Show() elseif (IsActionInRange(meilleureAction,"target")==0) then - self.aPortee:SetTexture(1,0,0) + self.aPortee:SetVertexColor(1.0,0.1,0.1) self.aPortee:Show() else self.aPortee:Hide() @@ -109,33 +109,28 @@ end end +local function SetSkinGroup(self, _skinGroup) + Ovale:Print("SetSkinGroup") + self.skinGroup = _skinGroup + self.skinGroup:AddButton(self) +end + +function OvaleIcone_OnClick(self) + Ovale:ToggleOptions() + self:SetChecked(0) +end function OvaleIcone_OnLoad(self) - self.icone = self:CreateTexture(); - self.icone:SetDrawLayer("ARTWORK"); - self.icone:SetAllPoints(self); - self.icone:Show(); - - self.shortcut = self:CreateFontString(nil, "OVERLAY"); - self.shortcut:SetFontObject("GameFontHighlightLarge"); - self.shortcut:SetPoint("BOTTOMLEFT",0,0); - self.shortcut:SetText("A"); - self.shortcut:SetTextColor(1,1,1); - self.shortcut:Show(); - - self.remains = self:CreateFontString(nil, "OVERLAY"); - self.remains:SetFontObject("GameFontHighlightLarge"); - self.remains:SetAllPoints(self); - self.remains:SetTextColor(1,1,1); - self.remains:Show(); - - self.aPortee = self:CreateTexture(); - self.aPortee:SetDrawLayer("OVERLAY") - self.aPortee:SetPoint("TOPRIGHT",self,"TOPRIGHT",-4,-4); - self.aPortee:SetHeight(self:GetHeight()/6); - self.aPortee:SetWidth(self:GetWidth()/6); - self.aPortee:SetTexture(0,0,1); + local name = self:GetName() + self.icone = _G[name.."Icon"] + self.shortcut = _G[name.."HotKey"] + self.remains = _G[name.."Name"] + self.aPortee = _G[name.."Count"] + self.aPortee:SetText(RANGE_INDICATOR) + self.cd = _G[name.."Cooldown"] + self.normalTexture = _G[name.."NormalTexture"] - self.cd = CreateFrame("Cooldown",nil,self,nil); - self.cd:SetAllPoints(self); + self:RegisterForClicks("LeftButtonUp") + self.SetSkinGroup = SetSkinGroup + self.UpdateSkin = UpdateSkin end diff --git a/OvaleIcone.xml b/OvaleIcone.xml index f49f422..0178686 100644 --- a/OvaleIcone.xml +++ b/OvaleIcone.xml @@ -1,12 +1,10 @@  - - - - + OvaleIcone_OnUpdate(self); OvaleIcone_OnLoad(self); + OvaleIcone_OnClick(self) - + -- 1.7.9.5