diff --git a/Locale-enUS.lua b/Locale-enUS.lua index ecf0531..fda0142 100644 --- a/Locale-enUS.lua +++ b/Locale-enUS.lua @@ -2,14 +2,22 @@ local AceLocale = LibStub:GetLibrary("AceLocale-3.0") local L = AceLocale:NewLocale("Ovale", "enUS", true) if not L then return end L["Largeur des icônes"] = "Icon width" -L["La largeur des icônes"] = "The icon width" +L["La largeur des icônes"] = "The icons width" L["Hauteur des icônes"] = "Icon height" -L["La hauteur des icônes"] = "The icon height" -L["Afficher en combat uniquement"] = "Show in combat only" +L["La hauteur des icônes"] = "The icons height" +L["Largeur des petites icônes"] = "Small icon width" +L["La largeur des petites icônes"] = "The small icons width" +L["Hauteur des petites icônes"] = "Small icon height" +L["La hauteur des petites icônes"] = "The small icons height" +L["En combat uniquement"] = "Show in combat only" L["Code"] = "Code" L["Compiler"] = "Compile" L["BUGTEXT"] = "Sometimes the button won't highlight when you try to confirm changes and the text will scroll if you click. Please, put the cursor at the bottom of the text before accepting the changes." L["AOE"] = "AOE" L["None"] = "None" L["Blood"] = true -L["Melee"] = true \ No newline at end of file +L["Melee"] = true +L["Raccourcis clavier"] = "Keyboard shortcuts" +L["Afficher les raccourcis clavier dans le coin inférieur gauche des icônes"] = "Show keyboard shortcuts in the icon bottom-left corner" +L["Affichage numérique"] = "Numeric display" +L["Affiche le temps de recharge sous forme numérique"] = "Show the remaining time in numerical form" \ No newline at end of file diff --git a/Locale-frFR.lua b/Locale-frFR.lua index afa98bf..ec07a23 100644 --- a/Locale-frFR.lua +++ b/Locale-frFR.lua @@ -5,11 +5,19 @@ L["Largeur des icônes"] = true L["La largeur des icônes"] = true L["Hauteur des icônes"] = true L["La hauteur des icônes"] = true -L["Afficher en combat uniquement"] = true +L["Largeur des petites icônes"] = true +L["La largeur des petites icônes"] = true +L["Hauteur des petites icônes"] = true +L["La hauteur des petites icônes"] = true +L["En combat uniquement"] = true L["Code"] = true L["Compiler"] = true L["BUGTEXT"] = "Parfois passer la souris sur le bouton de confirmation en bas de la fenêtre ne l'éclairera pas et cliquer sélectionnera du texte. Placez d'abord le curseur en bas du texte avant de confirmer les changements." L["AOE"] = "Multicible" L["None"] = "Aucun" L["Blood"] = "Saignement" -L["Melee"] = "Corps-à-corps" \ No newline at end of file +L["Melee"] = "Corps-à-corps" +L["Raccourcis clavier"] = true +L["Afficher les raccourcis clavier dans le coin inférieur gauche des icônes"] = true +L["Affichage numérique"] = true +L["Affiche le temps de recharge sous forme numérique"] = true \ No newline at end of file diff --git a/Ovale.lua b/Ovale.lua index ea52206..e482fe7 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -43,8 +43,9 @@ local options = { combatUniquement = { + order = 1, type = "toggle", - name = L["Afficher en combat uniquement"], + name = L["En combat uniquement"], get = function(info) return Ovale.db.profile.apparence.enCombat end, @@ -55,22 +56,62 @@ local options = }, iconWidth = { + order = 2, type = "range", name = L["Largeur des icônes"], desc = L["La largeur des icônes"], - min = 16, max = 256, step = 1, + min = 16, max = 256, step = 2, get = function(info) return Ovale.db.profile.apparence.iconWidth end, set = function(info,value) Ovale.db.profile.apparence.iconWidth = value; Ovale:UpdateFrame() end }, iconHeight = { + order = 3, type = "range", name = L["Hauteur des icônes"], desc = L["La hauteur des icônes"], - min = 16, max = 256, step = 1, + min = 16, max = 256, step = 2, get = function(info) return Ovale.db.profile.apparence.iconHeight end, set = function(info,value) Ovale.db.profile.apparence.iconHeight = value; Ovale:UpdateFrame() end - } + }, + smallIconWidth = + { + order = 4, + type = "range", + name = L["Largeur des petites icônes"], + desc = L["La largeur des petites icônes"], + min = 16, max = 256, step = 2, + get = function(info) return Ovale.db.profile.apparence.smallIconWidth end, + set = function(info,value) Ovale.db.profile.apparence.smallIconWidth = value; Ovale:UpdateFrame() end + }, + smallIconHeight = + { + order = 5, + type = "range", + name = L["Hauteur des petites icônes"], + desc = L["La hauteur des petites icônes"], + min = 16, max = 256, step = 2, + get = function(info) return Ovale.db.profile.apparence.smallIconHeight end, + set = function(info,value) Ovale.db.profile.apparence.smallIconHeight = value; Ovale:UpdateFrame() end + }, + raccourcis = + { + order = 6, + type = "toggle", + name = L["Raccourcis clavier"], + desc = L["Afficher les raccourcis clavier dans le coin inférieur gauche des icônes"], + get = function(info) return Ovale.db.profile.apparence.raccourcis end, + set = function(info, value) Ovale.db.profile.apparence.raccourcis = value end + }, + numeric = + { + order = 7, + type = "toggle", + name = L["Affichage numérique"], + desc = L["Affiche le temps de recharge sous forme numérique"], + get = function(info) return Ovale.db.profile.apparence.numeric end, + set = function(info, value) Ovale.db.profile.apparence.numeric = value end + } } }, code = @@ -624,7 +665,8 @@ function Ovale:ChargerDefaut() top = 500, check = {}, list = {}, - apparence = {enCombat=false, iconWidth = 64, iconHeight = 64} + apparence = {enCombat=false, iconWidth = 64, iconHeight = 64, + smallIconWidth=32, smallIconHeight=32, raccourcis=true, numeric=false} } }) end diff --git a/OvaleCompile.lua b/OvaleCompile.lua index e284904..7d90187 100644 --- a/OvaleCompile.lua +++ b/OvaleCompile.lua @@ -3,7 +3,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Ovale") local node={} local defines = {} -local function ParseFunction(func, params) +local function ParseParameters(params) local paramList = {} for k,v in string.gmatch(params, "(%w+)=(%w+)") do if (string.match(v,"^%-?%d+%.?%d*$")) then @@ -20,6 +20,11 @@ local function ParseFunction(func, params) paramList[n+1] = w n=n+1 end + return paramList +end + +local function ParseFunction(func, params) + local paramList = ParseParameters(params) local newNode = { type="function", func=func, params=paramList} node[#node+1] = newNode return "node"..#node @@ -99,14 +104,13 @@ local function ParseDefine(key, value) return "" end -local function ParseAddIcon(text) +local function ParseAddIcon(params, text) text = string.gsub(text, "(%w+)%s*%((.-)%)", ParseFunction) text = subtest(text, "node(%d+)%s+and%s+node(%d+)", ParseAnd) text = subtest(text, "node(%d+)%s+or%s+node(%d+)", ParseOr) text = subtest(text, "{([^{}]*)}", ParseGroup) - - -- text = ParseGroup(text) + local masterNode if (text) then masterNode = string.match(text, "node(%d+)") @@ -115,12 +119,17 @@ local function ParseAddIcon(text) self:Print("no master node") return nil end + + -- Si il reste autre chose que des espaces, c'est une erreur de syntaxe text = string.gsub(text, "node%d+", "", 1) if (string.match(text,"[^ ]")) then self:Print("syntax error:"..text) return nil end + + -- On convertit le numéro de node en node masterNode = node[tonumber(masterNode)] + masterNode.params = ParseParameters(params) return masterNode end @@ -192,8 +201,8 @@ function Ovale:Compile(text) local masterNodes ={} -- On compile les AddIcon - for t in string.gmatch(text, "AddIcon%s*(%b{})") do - masterNodes[#masterNodes+1] = ParseAddIcon(t) + for p,t in string.gmatch(text, "AddIcon%s*(.-)%s*(%b{})") do + masterNodes[#masterNodes+1] = ParseAddIcon(p,t) end return masterNodes end diff --git a/OvaleFrame.lua b/OvaleFrame.lua index 0f4d964..8423b54 100644 --- a/OvaleFrame.lua +++ b/OvaleFrame.lua @@ -179,20 +179,43 @@ do icon:Hide() end + local left = 0 + local maxHeight = 0 + local maxWidth = 0 + local top = 0 + for k,node in pairs(Ovale.masterNodes) do if (not self.icone[k]) then self.icone[k] = CreateFrame("Frame",nil,self.frame,"OvaleIcone"); end self.icone[k].masterNode = node - self.icone[k]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",Ovale.db.profile.apparence.iconWidth*(k-1),0) - self.icone[k]:SetWidth(Ovale.db.profile.apparence.iconWidth) - self.icone[k]:SetHeight(Ovale.db.profile.apparence.iconHeight) + local width, height + if (node.params.size == "small") then + width = Ovale.db.profile.apparence.smallIconWidth + height = Ovale.db.profile.apparence.smallIconHeight + else + width = Ovale.db.profile.apparence.iconWidth + height = Ovale.db.profile.apparence.iconHeight + end + if (top + height > Ovale.db.profile.apparence.iconHeight) then + top = 0 + left = maxWidth + end + self.icone[k]:SetPoint("TOPLEFT",self.frame,"TOPLEFT",left,-top) + self.icone[k]:SetWidth(width) + self.icone[k]:SetHeight(height) self.icone[k]:Show(); + top = top + height + if (top> maxHeight) then + maxHeight = top + end + if (left + width > maxWidth) then + maxWidth = left + width + end end - - self.frame:SetWidth(#Ovale.masterNodes * Ovale.db.profile.apparence.iconWidth) - self.frame:SetHeight(Ovale.db.profile.apparence.iconHeight) - self.content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",#Ovale.masterNodes * Ovale.db.profile.apparence.iconWidth,0) + self.frame:SetWidth(maxWidth) + self.frame:SetHeight(maxHeight) + self.content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",maxWidth,0) end local function Constructor() diff --git a/OvaleIcone.lua b/OvaleIcone.lua index fd40a32..25539d6 100644 --- a/OvaleIcone.lua +++ b/OvaleIcone.lua @@ -16,6 +16,10 @@ if (Ovale.bug and not Ovale.traced) then Ovale.trace = true end + + if (self.masterNode.params.nocd == 1 and minAttente~=0) then + minAttente = nil + end if (minAttente~=nil and meilleureAction) then @@ -58,9 +62,21 @@ self.cd:SetCooldown(self.debutAction, minAttente+(Ovale.maintenant-self.debutAction)); end + -- Le temps restant + if (Ovale.db.profile.apparence.numeric) then + self.remains:SetText(string.format("%.1f", minAttente)) + self.remains:Show() + else + self.remains:Hide() + end + -- Le raccourcis clavier - self.shortcut:Show() - self.shortcut:SetText(Ovale.shortCut[meilleureAction]) + if (Ovale.db.profile.apparence.raccourcis) then + self.shortcut:Show() + self.shortcut:SetText(Ovale.shortCut[meilleureAction]) + else + self.shortcut:Hide() + end -- L'indicateur de portée self.aPortee:Show() @@ -77,6 +93,7 @@ self.icone:Hide() self.aPortee:Hide() self.shortcut:Hide() + self.remains:Hide() end end @@ -94,6 +111,12 @@ function OvaleIcone_OnLoad(self) 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);